From 31b61bb43d4f3e8384b915b7efa929ea23d27a7e Mon Sep 17 00:00:00 2001 From: UncP Date: Thu, 17 Aug 2017 11:45:52 +0800 Subject: [PATCH 01/13] update kvproto --- .../src/github.com/pingcap/kvproto/.gitignore | 12 + .../src/github.com/pingcap/kvproto/Cargo.toml | 12 + .../src/github.com/pingcap/kvproto/Makefile | 39 + .../src/github.com/pingcap/kvproto/README.md | 10 + .../src/github.com/gogo/protobuf/LICENSE | 36 + .../gogo/protobuf/_conformance/conformance.go | 161 + .../conformance_proto/conformance.pb.go | 1890 +++ .../conformance_proto/conformance.proto | 285 + .../github.com/gogo/protobuf/codec/codec.go | 91 + .../github.com/gogo/protobuf/gogoproto/doc.go | 168 + .../gogo/protobuf/gogoproto/gogo.pb.go | 749 + .../gogo/protobuf/gogoproto/gogo.proto | 125 + .../gogo/protobuf/gogoproto/helper.go | 345 + .../gogo/protobuf/gogoreplace/main.go | 25 + .../gogo/protobuf/install-protobuf.sh | 29 + .../src/github.com/gogo/protobuf/io/full.go | 102 + .../src/github.com/gogo/protobuf/io/io.go | 70 + .../src/github.com/gogo/protobuf/io/uint32.go | 126 + .../src/github.com/gogo/protobuf/io/varint.go | 134 + .../github.com/gogo/protobuf/jsonpb/jsonpb.go | 959 ++ .../gogo/protobuf/plugin/compare/compare.go | 526 + .../protobuf/plugin/compare/comparetest.go | 107 + .../plugin/defaultcheck/defaultcheck.go | 133 + .../plugin/description/description.go | 201 + .../plugin/description/descriptiontest.go | 73 + .../protobuf/plugin/embedcheck/embedcheck.go | 199 + .../plugin/enumstringer/enumstringer.go | 104 + .../gogo/protobuf/plugin/equal/equal.go | 645 + .../gogo/protobuf/plugin/equal/equaltest.go | 96 + .../gogo/protobuf/plugin/face/face.go | 233 + .../gogo/protobuf/plugin/face/facetest.go | 82 + .../gogo/protobuf/plugin/gostring/gostring.go | 368 + .../protobuf/plugin/gostring/gostringtest.go | 90 + .../protobuf/plugin/marshalto/marshalto.go | 1423 ++ .../protobuf/plugin/oneofcheck/oneofcheck.go | 93 + .../gogo/protobuf/plugin/populate/populate.go | 796 + .../gogo/protobuf/plugin/size/size.go | 669 + .../gogo/protobuf/plugin/size/sizetest.go | 134 + .../gogo/protobuf/plugin/stringer/stringer.go | 296 + .../protobuf/plugin/stringer/stringertest.go | 83 + .../gogo/protobuf/plugin/testgen/testgen.go | 608 + .../gogo/protobuf/plugin/union/union.go | 209 + .../gogo/protobuf/plugin/union/uniontest.go | 86 + .../protobuf/plugin/unmarshal/unmarshal.go | 1439 ++ .../github.com/gogo/protobuf/proto/clone.go | 234 + .../github.com/gogo/protobuf/proto/decode.go | 978 ++ .../gogo/protobuf/proto/decode_gogo.go | 172 + .../gogo/protobuf/proto/duration.go | 100 + .../gogo/protobuf/proto/duration_gogo.go | 203 + .../github.com/gogo/protobuf/proto/encode.go | 1362 ++ .../gogo/protobuf/proto/encode_gogo.go | 350 + .../github.com/gogo/protobuf/proto/equal.go | 300 + .../gogo/protobuf/proto/extensions.go | 693 + .../gogo/protobuf/proto/extensions_gogo.go | 294 + .../src/github.com/gogo/protobuf/proto/lib.go | 898 ++ .../gogo/protobuf/proto/lib_gogo.go | 42 + .../gogo/protobuf/proto/message_set.go | 311 + .../gogo/protobuf/proto/pointer_reflect.go | 484 + .../protobuf/proto/pointer_reflect_gogo.go | 85 + .../gogo/protobuf/proto/pointer_unsafe.go | 270 + .../protobuf/proto/pointer_unsafe_gogo.go | 128 + .../gogo/protobuf/proto/properties.go | 968 ++ .../gogo/protobuf/proto/properties_gogo.go | 111 + .../protobuf/proto/proto3_proto/proto3.pb.go | 347 + .../protobuf/proto/proto3_proto/proto3.proto | 87 + .../gogo/protobuf/proto/skip_gogo.go | 119 + .../github.com/gogo/protobuf/proto/text.go | 928 ++ .../gogo/protobuf/proto/text_gogo.go | 57 + .../gogo/protobuf/proto/text_parser.go | 1013 ++ .../gogo/protobuf/proto/timestamp.go | 113 + .../gogo/protobuf/proto/timestamp_gogo.go | 229 + .../protobuf/google/protobuf/any.proto | 140 + .../google/protobuf/compiler/plugin.proto | 150 + .../protobuf/google/protobuf/descriptor.proto | 813 + .../protobuf/google/protobuf/duration.proto | 98 + .../protobuf/google/protobuf/empty.proto | 53 + .../protobuf/google/protobuf/field_mask.proto | 246 + .../protobuf/google/protobuf/struct.proto | 96 + .../protobuf/google/protobuf/timestamp.proto | 111 + .../protobuf/google/protobuf/wrappers.proto | 119 + .../gogo/protobuf/protoc-gen-combo/combo.go | 200 + .../gogo/protobuf/protoc-gen-gofast/main.go | 48 + .../protoc-gen-gogo/descriptor/descriptor.go | 92 + .../descriptor/descriptor.pb.go | 2088 +++ .../descriptor/descriptor_gostring.gen.go | 715 + .../protoc-gen-gogo/descriptor/helper.go | 357 + .../gogo/protobuf/protoc-gen-gogo/doc.go | 51 + .../protoc-gen-gogo/generator/generator.go | 3318 ++++ .../protoc-gen-gogo/generator/helper.go | 447 + .../protobuf/protoc-gen-gogo/grpc/grpc.go | 463 + .../gogo/protobuf/protoc-gen-gogo/main.go | 57 + .../protoc-gen-gogo/plugin/plugin.pb.go | 230 + .../gogo/protobuf/protoc-gen-gogofast/main.go | 47 + .../protobuf/protoc-gen-gogofaster/main.go | 50 + .../protobuf/protoc-gen-gogoslick/main.go | 59 + .../protobuf/protoc-gen-gogotypes/main.go | 75 + .../gogo/protobuf/protoc-gen-gostring/main.go | 42 + .../protobuf/protoc-min-version/minversion.go | 65 + .../gogo/protobuf/sortkeys/sortkeys.go | 101 + .../src/github.com/gogo/protobuf/types/any.go | 135 + .../github.com/gogo/protobuf/types/any.pb.go | 687 + .../src/github.com/gogo/protobuf/types/doc.go | 35 + .../gogo/protobuf/types/duration.go | 100 + .../gogo/protobuf/types/duration.pb.go | 515 + .../gogo/protobuf/types/duration_gogo.go | 100 + .../gogo/protobuf/types/empty.pb.go | 478 + .../gogo/protobuf/types/field_mask.pb.go | 759 + .../gogo/protobuf/types/struct.pb.go | 1908 +++ .../gogo/protobuf/types/timestamp.go | 123 + .../gogo/protobuf/types/timestamp.pb.go | 527 + .../gogo/protobuf/types/timestamp_gogo.go | 94 + .../gogo/protobuf/types/wrappers.pb.go | 2280 +++ .../gogo/protobuf/vanity/command/command.go | 161 + .../github.com/gogo/protobuf/vanity/enum.go | 78 + .../github.com/gogo/protobuf/vanity/field.go | 83 + .../github.com/gogo/protobuf/vanity/file.go | 181 + .../gogo/protobuf/vanity/foreach.go | 125 + .../github.com/gogo/protobuf/vanity/msg.go | 142 + .../gogo/protobuf/vanity/test/doc.go | 1 + .../vanity/test/fast/gogovanity.pb.go | 408 + .../protobuf/vanity/test/fast/proto3.pb.go | 320 + .../protobuf/vanity/test/fast/vanity.pb.go | 375 + .../vanity/test/faster/gogovanity.pb.go | 396 + .../protobuf/vanity/test/faster/proto3.pb.go | 320 + .../protobuf/vanity/test/faster/vanity.pb.go | 354 + .../protobuf/vanity/test/gogovanity.proto | 39 + .../gogo/protobuf/vanity/test/proto3.proto | 35 + .../vanity/test/slick/gogovanity.pb.go | 512 + .../protobuf/vanity/test/slick/proto3.pb.go | 411 + .../protobuf/vanity/test/slick/vanity.pb.go | 449 + .../gogo/protobuf/vanity/test/vanity.proto | 36 + .../gogo/protobuf/version/version.go | 78 + .../src/github.com/golang/protobuf/LICENSE | 31 + .../github.com/golang/protobuf/proto/clone.go | 229 + .../golang/protobuf/proto/decode.go | 970 ++ .../golang/protobuf/proto/encode.go | 1362 ++ .../github.com/golang/protobuf/proto/equal.go | 300 + .../golang/protobuf/proto/extensions.go | 587 + .../github.com/golang/protobuf/proto/lib.go | 898 ++ .../golang/protobuf/proto/message_set.go | 311 + .../golang/protobuf/proto/pointer_reflect.go | 484 + .../golang/protobuf/proto/pointer_unsafe.go | 270 + .../golang/protobuf/proto/properties.go | 872 + .../github.com/golang/protobuf/proto/text.go | 854 + .../golang/protobuf/proto/text_parser.go | 895 ++ .../src/github.com/juju/errors/LICENSE | 191 + .../_vendor/src/github.com/juju/errors/doc.go | 81 + .../src/github.com/juju/errors/error.go | 145 + .../src/github.com/juju/errors/errortypes.go | 284 + .../src/github.com/juju/errors/functions.go | 330 + .../src/github.com/juju/errors/path.go | 38 + .../src/github.com/pingcap/tipb/LICENSE | 201 + .../pingcap/tipb/generate-binlog.sh | 13 + .../github.com/pingcap/tipb/generate-go.sh | 10 + .../github.com/pingcap/tipb/generate-rust.sh | 22 + .../pingcap/tipb/sharedbytes/sharedbytes.go | 42 + .../_vendor/src/golang.org/x/net/LICENSE | 27 + .../_vendor/src/golang.org/x/net/PATENTS | 22 + .../src/golang.org/x/net/context/context.go | 447 + .../x/net/http2/client_conn_pool.go | 225 + .../x/net/http2/configure_transport.go | 89 + .../src/golang.org/x/net/http2/errors.go | 122 + .../golang.org/x/net/http2/fixed_buffer.go | 60 + .../src/golang.org/x/net/http2/flow.go | 50 + .../src/golang.org/x/net/http2/frame.go | 1496 ++ .../src/golang.org/x/net/http2/go15.go | 11 + .../src/golang.org/x/net/http2/gotrack.go | 170 + .../src/golang.org/x/net/http2/headermap.go | 78 + .../golang.org/x/net/http2/hpack/encode.go | 251 + .../src/golang.org/x/net/http2/hpack/hpack.go | 542 + .../golang.org/x/net/http2/hpack/huffman.go | 190 + .../golang.org/x/net/http2/hpack/tables.go | 352 + .../src/golang.org/x/net/http2/http2.go | 429 + .../src/golang.org/x/net/http2/not_go15.go | 11 + .../src/golang.org/x/net/http2/not_go16.go | 13 + .../src/golang.org/x/net/http2/pipe.go | 147 + .../src/golang.org/x/net/http2/server.go | 2149 +++ .../src/golang.org/x/net/http2/transport.go | 1666 ++ .../src/golang.org/x/net/http2/write.go | 263 + .../src/golang.org/x/net/http2/writesched.go | 283 + .../x/net/internal/timeseries/timeseries.go | 525 + .../src/golang.org/x/net/trace/events.go | 524 + .../src/golang.org/x/net/trace/histogram.go | 356 + .../src/golang.org/x/net/trace/trace.go | 1059 ++ .../_vendor/src/golang.org/x/text/LICENSE | 27 + .../x/text/secure/bidirule/bidirule.go | 342 + .../_vendor/src/golang.org/x/tools/LICENSE | 27 + .../_vendor/src/golang.org/x/tools/PATENTS | 22 + .../golang.org/x/tools/cmd/goimports/doc.go | 45 + .../x/tools/cmd/goimports/goimports.go | 317 + .../x/tools/cmd/goimports/goimports_gc.go | 26 + .../x/tools/cmd/goimports/goimports_not_gc.go | 11 + .../x/tools/go/ast/astutil/enclosing.go | 627 + .../x/tools/go/ast/astutil/imports.go | 449 + .../golang.org/x/tools/go/ast/astutil/util.go | 14 + .../golang.org/x/tools/imports/fastwalk.go | 172 + .../x/tools/imports/fastwalk_dirent_fileno.go | 13 + .../x/tools/imports/fastwalk_dirent_ino.go | 13 + .../x/tools/imports/fastwalk_portable.go | 29 + .../x/tools/imports/fastwalk_unix.go | 122 + .../src/golang.org/x/tools/imports/fix.go | 978 ++ .../src/golang.org/x/tools/imports/imports.go | 289 + .../src/golang.org/x/tools/imports/mkindex.go | 173 + .../golang.org/x/tools/imports/mkstdlib.go | 103 + .../golang.org/x/tools/imports/sortimports.go | 212 + .../src/golang.org/x/tools/imports/zstdlib.go | 9289 +++++++++++ .../src/google.golang.org/grpc/LICENSE | 28 + .../src/google.golang.org/grpc/PATENTS | 22 + .../src/google.golang.org/grpc/backoff.go | 80 + .../src/google.golang.org/grpc/balancer.go | 400 + .../src/google.golang.org/grpc/call.go | 289 + .../src/google.golang.org/grpc/clientconn.go | 1006 ++ .../src/google.golang.org/grpc/codegen.sh | 17 + .../grpc/codes/code_string.go | 16 + .../src/google.golang.org/grpc/codes/codes.go | 159 + .../src/google.golang.org/grpc/coverage.sh | 48 + .../grpc/credentials/credentials.go | 230 + .../grpc/credentials/credentials_util_go17.go | 75 + .../grpc/credentials/credentials_util_go18.go | 53 + .../credentials/credentials_util_pre_go17.go | 72 + .../_vendor/src/google.golang.org/grpc/doc.go | 6 + .../google.golang.org/grpc/grpclog/logger.go | 93 + .../src/google.golang.org/grpc/interceptor.go | 90 + .../grpc/internal/internal.go | 49 + .../grpc/keepalive/keepalive.go | 52 + .../grpc/metadata/metadata.go | 152 + .../google.golang.org/grpc/naming/naming.go | 74 + .../src/google.golang.org/grpc/peer/peer.go | 65 + .../src/google.golang.org/grpc/rpc_util.go | 532 + .../src/google.golang.org/grpc/server.go | 1085 ++ .../google.golang.org/grpc/stats/handlers.go | 76 + .../src/google.golang.org/grpc/stats/stats.go | 223 + .../src/google.golang.org/grpc/stream.go | 626 + .../src/google.golang.org/grpc/tap/tap.go | 54 + .../src/google.golang.org/grpc/trace.go | 119 + .../grpc/transport/control.go | 199 + .../google.golang.org/grpc/transport/go16.go | 46 + .../google.golang.org/grpc/transport/go17.go | 46 + .../grpc/transport/handler_server.go | 397 + .../grpc/transport/http2_client.go | 1230 ++ .../grpc/transport/http2_server.go | 847 + .../grpc/transport/http_util.go | 511 + .../grpc/transport/pre_go16.go | 51 + .../grpc/transport/transport.go | 626 + .../src/github.com/pingcap/kvproto/circle.yml | 51 + .../src/github.com/pingcap/kvproto/common.sh | 27 + .../github.com/pingcap/kvproto/generate_go.sh | 68 + .../pingcap/kvproto/generate_rust.sh | 61 + .../src/github.com/pingcap/kvproto/glide.lock | 104 + .../src/github.com/pingcap/kvproto/glide.yaml | 81 + .../kvproto/pkg/coprocessor/coprocessor.pb.go | 960 ++ .../pingcap/kvproto/pkg/eraftpb/eraftpb.pb.go | 2219 +++ .../pingcap/kvproto/pkg/errorpb/errorpb.pb.go | 2027 +++ .../pingcap/kvproto/pkg/kvrpcpb/kvrpcpb.pb.go | 10053 ++++++++++++ .../pingcap/kvproto/pkg/metapb/metapb.pb.go | 2 +- .../pingcap/kvproto/pkg/pdpb/pdpb.pb.go | 328 +- .../kvproto/pkg/raft_cmdpb/raft_cmdpb.pb.go | 7803 +++++++++ .../pkg/raft_serverpb/raft_serverpb.pb.go | 2690 ++++ .../pingcap/kvproto/pkg/tikvpb/tikvpb.pb.go | 895 ++ .../pingcap/kvproto/proto/coprocessor.proto | 32 + .../pingcap/kvproto/proto/eraftpb.proto | 86 + .../pingcap/kvproto/proto/errorpb.proto | 58 + .../pingcap/kvproto/proto/kvrpcpb.proto | 292 + .../pingcap/kvproto/proto/metapb.proto | 59 + .../pingcap/kvproto/proto/pdpb.proto | 341 + .../pingcap/kvproto/proto/raft_cmdpb.proto | 256 + .../pingcap/kvproto/proto/raft_serverpb.proto | 81 + .../pingcap/kvproto/proto/tikvpb.proto | 48 + .../pingcap/kvproto/src/coprocessor.rs | 1045 ++ .../github.com/pingcap/kvproto/src/eraftpb.rs | 2797 ++++ .../github.com/pingcap/kvproto/src/errorpb.rs | 2469 +++ .../github.com/pingcap/kvproto/src/kvrpcpb.rs | 13213 ++++++++++++++++ .../src/github.com/pingcap/kvproto/src/lib.rs | 15 + .../github.com/pingcap/kvproto/src/metapb.rs | 1923 +++ .../github.com/pingcap/kvproto/src/pdpb.rs | 11027 +++++++++++++ .../pingcap/kvproto/src/pdpb_grpc.rs | 446 + .../pingcap/kvproto/src/raft_cmdpb.rs | 10096 ++++++++++++ .../pingcap/kvproto/src/raft_serverpb.rs | 3400 ++++ .../pingcap/kvproto/src/tikvpb_grpc.rs | 614 + .../github.com/pingcap/kvproto/src/util.rs | 20 + glide.lock | 2 +- glide.yaml | 2 +- 282 files changed, 167113 insertions(+), 112 deletions(-) create mode 100644 _vendor/src/github.com/pingcap/kvproto/.gitignore create mode 100644 _vendor/src/github.com/pingcap/kvproto/Cargo.toml create mode 100644 _vendor/src/github.com/pingcap/kvproto/Makefile create mode 100644 _vendor/src/github.com/pingcap/kvproto/README.md create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/LICENSE create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance_proto/conformance.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance_proto/conformance.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/codec/codec.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/doc.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/gogo.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/gogo.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/helper.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoreplace/main.go create mode 100755 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/install-protobuf.sh create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/full.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/io.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/uint32.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/varint.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/jsonpb/jsonpb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/compare/compare.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/compare/comparetest.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/defaultcheck/defaultcheck.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/description/description.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/description/descriptiontest.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/embedcheck/embedcheck.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/enumstringer/enumstringer.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/equal/equal.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/equal/equaltest.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/face/face.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/face/facetest.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/gostring/gostring.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/gostring/gostringtest.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/marshalto/marshalto.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/oneofcheck/oneofcheck.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/populate/populate.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/size/size.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/size/sizetest.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/stringer/stringer.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/stringer/stringertest.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/testgen/testgen.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/union/union.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/union/uniontest.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/unmarshal/unmarshal.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/clone.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/decode.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/decode_gogo.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/duration.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/duration_gogo.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/encode.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/encode_gogo.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/equal.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/extensions.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/extensions_gogo.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/lib.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/lib_gogo.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/message_set.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_reflect.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_unsafe.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/properties.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/properties_gogo.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/proto3_proto/proto3.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/proto3_proto/proto3.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/skip_gogo.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text_gogo.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text_parser.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/timestamp.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/timestamp_gogo.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/any.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/compiler/plugin.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/descriptor.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/duration.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/empty.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/field_mask.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/struct.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/timestamp.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/wrappers.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-combo/combo.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gofast/main.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/helper.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/doc.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/generator/generator.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/generator/helper.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/grpc/grpc.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/main.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/plugin/plugin.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogofast/main.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogofaster/main.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogoslick/main.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogotypes/main.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gostring/main.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-min-version/minversion.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/sortkeys/sortkeys.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/any.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/any.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/doc.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration_gogo.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/empty.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/field_mask.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/struct.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp_gogo.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/wrappers.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/command/command.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/enum.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/field.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/file.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/foreach.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/msg.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/doc.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/gogovanity.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/proto3.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/vanity.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/gogovanity.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/proto3.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/vanity.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/gogovanity.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/proto3.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/gogovanity.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/proto3.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/vanity.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/vanity.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/version/version.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/LICENSE create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/clone.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/decode.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/encode.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/equal.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/extensions.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/lib.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/message_set.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/pointer_reflect.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/pointer_unsafe.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/properties.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/text.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/text_parser.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/LICENSE create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/doc.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/error.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/errortypes.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/functions.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/path.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/LICENSE create mode 100755 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-binlog.sh create mode 100755 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-go.sh create mode 100755 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-rust.sh create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/sharedbytes/sharedbytes.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/LICENSE create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/PATENTS create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/context/context.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/client_conn_pool.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/configure_transport.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/errors.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/fixed_buffer.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/flow.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/frame.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/go15.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/gotrack.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/headermap.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/encode.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/hpack.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/huffman.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/tables.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/http2.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/not_go15.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/not_go16.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/pipe.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/server.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/transport.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/write.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/writesched.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/internal/timeseries/timeseries.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/events.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/histogram.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/trace.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/text/LICENSE create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/text/secure/bidirule/bidirule.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/LICENSE create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/PATENTS create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/cmd/goimports/doc.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/cmd/goimports/goimports.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/cmd/goimports/goimports_gc.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/cmd/goimports/goimports_not_gc.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/enclosing.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/imports.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/util.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_dirent_fileno.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_dirent_ino.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_portable.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_unix.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fix.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/imports.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/mkindex.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/mkstdlib.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/sortimports.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/zstdlib.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/LICENSE create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/PATENTS create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/backoff.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/balancer.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/call.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/clientconn.go create mode 100755 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codegen.sh create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codes/code_string.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codes/codes.go create mode 100755 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/coverage.sh create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_go17.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_go18.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_pre_go17.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/doc.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/grpclog/logger.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/interceptor.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/internal/internal.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/keepalive/keepalive.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/metadata/metadata.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/naming/naming.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/peer/peer.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/rpc_util.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/server.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stats/handlers.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stats/stats.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stream.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/tap/tap.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/trace.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/control.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/go16.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/go17.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/handler_server.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http2_client.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http2_server.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http_util.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/pre_go16.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/transport.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/circle.yml create mode 100755 _vendor/src/github.com/pingcap/kvproto/common.sh create mode 100755 _vendor/src/github.com/pingcap/kvproto/generate_go.sh create mode 100755 _vendor/src/github.com/pingcap/kvproto/generate_rust.sh create mode 100644 _vendor/src/github.com/pingcap/kvproto/glide.lock create mode 100644 _vendor/src/github.com/pingcap/kvproto/glide.yaml create mode 100644 _vendor/src/github.com/pingcap/kvproto/pkg/coprocessor/coprocessor.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/pkg/eraftpb/eraftpb.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/pkg/errorpb/errorpb.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/pkg/kvrpcpb/kvrpcpb.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/pkg/raft_cmdpb/raft_cmdpb.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/pkg/raft_serverpb/raft_serverpb.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/pkg/tikvpb/tikvpb.pb.go create mode 100644 _vendor/src/github.com/pingcap/kvproto/proto/coprocessor.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/proto/eraftpb.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/proto/errorpb.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/proto/kvrpcpb.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/proto/metapb.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/proto/pdpb.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/proto/raft_cmdpb.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/proto/raft_serverpb.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/proto/tikvpb.proto create mode 100644 _vendor/src/github.com/pingcap/kvproto/src/coprocessor.rs create mode 100644 _vendor/src/github.com/pingcap/kvproto/src/eraftpb.rs create mode 100644 _vendor/src/github.com/pingcap/kvproto/src/errorpb.rs create mode 100644 _vendor/src/github.com/pingcap/kvproto/src/kvrpcpb.rs create mode 100644 _vendor/src/github.com/pingcap/kvproto/src/lib.rs create mode 100644 _vendor/src/github.com/pingcap/kvproto/src/metapb.rs create mode 100644 _vendor/src/github.com/pingcap/kvproto/src/pdpb.rs create mode 100644 _vendor/src/github.com/pingcap/kvproto/src/pdpb_grpc.rs create mode 100644 _vendor/src/github.com/pingcap/kvproto/src/raft_cmdpb.rs create mode 100644 _vendor/src/github.com/pingcap/kvproto/src/raft_serverpb.rs create mode 100644 _vendor/src/github.com/pingcap/kvproto/src/tikvpb_grpc.rs create mode 100644 _vendor/src/github.com/pingcap/kvproto/src/util.rs diff --git a/_vendor/src/github.com/pingcap/kvproto/.gitignore b/_vendor/src/github.com/pingcap/kvproto/.gitignore new file mode 100644 index 00000000000..f4b3f76f095 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/.gitignore @@ -0,0 +1,12 @@ +target +# ignore object files generated by golang compiler +pkg/darwin_amd64/ +pkg/linux_amd64/ +# ignore source files downloaded by `go get` +src/github.com/ +# ignore binary file compiler by `go get` +bin/ +_vendor/bin +_vendor/pkg +Cargo.lock +.vscode diff --git a/_vendor/src/github.com/pingcap/kvproto/Cargo.toml b/_vendor/src/github.com/pingcap/kvproto/Cargo.toml new file mode 100644 index 00000000000..f47097be08e --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "kvproto" +version = "0.0.1" +keywords = ["TiKV"] + +[lib] +name = "kvproto" + +[dependencies] +protobuf = "1.*" +futures = "0.1" +grpcio = "0.1" diff --git a/_vendor/src/github.com/pingcap/kvproto/Makefile b/_vendor/src/github.com/pingcap/kvproto/Makefile new file mode 100644 index 00000000000..537507ebe1e --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/Makefile @@ -0,0 +1,39 @@ +### Makefile for kvproto + +CURDIR := $(shell pwd) + +KEEP_FILE := '**/*.proto,**/*.sh' + +export PATH := $(CURDIR)/_vendor/bin:$(PATH) +export GOPATH := $(GOPATH):$(CURDIR)/_vendor + +all: go rust test + +test: + # Build test. + go build ./pkg/... + cargo check + +go: + # Standalone GOPATH + GOPATH=$(CURDIR)/_vendor ./generate_go.sh + +rust: + GOPATH=$(CURDIR)/_vendor ./generate_rust.sh + +update_go_pkg: + which glide >/dev/null || curl https://glide.sh/get | sh + which glide-vc || go get -v -u github.com/sgotti/glide-vc + rm -rf vendor && mv _vendor vendor || true + rm -rf _vendor +ifdef PKG + glide get --strip-vendor --skip-test ${PKG} +else + glide update --strip-vendor --skip-test +endif + @echo "removing test files" + glide vc --only-code --no-tests --use-lock-file --keep $(KEEP_FILE) + mkdir -p _vendor + mv vendor _vendor + +.PHONY: update_go_pkg all diff --git a/_vendor/src/github.com/pingcap/kvproto/README.md b/_vendor/src/github.com/pingcap/kvproto/README.md new file mode 100644 index 00000000000..2e7b0adbb2b --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/README.md @@ -0,0 +1,10 @@ +# kvproto +Protocol buffer files for TiKV + +# Usage + ++ Write your own protocol file in proto folder. ++ Run `make` to generate go and rust code. + We generate all go codes in pkg folder and rust in src folder. ++ Update the dependent projects. + diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/LICENSE b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/LICENSE new file mode 100644 index 00000000000..7be0cc7b62c --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/LICENSE @@ -0,0 +1,36 @@ +Protocol Buffers for Go with Gadgets + +Copyright (c) 2013, The GoGo Authors. All rights reserved. +http://github.com/gogo/protobuf + +Go support for Protocol Buffers - Google's data interchange format + +Copyright 2010 The Go Authors. All rights reserved. +https://github.com/golang/protobuf + +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/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance.go new file mode 100644 index 00000000000..45b37881b72 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance.go @@ -0,0 +1,161 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +// conformance implements the conformance test subprocess protocol as +// documented in conformance.proto. +package main + +import ( + "encoding/binary" + "fmt" + "io" + "os" + + pb "github.com/gogo/protobuf/_conformance/conformance_proto" + "github.com/gogo/protobuf/jsonpb" + "github.com/gogo/protobuf/proto" +) + +func main() { + var sizeBuf [4]byte + inbuf := make([]byte, 0, 4096) + outbuf := proto.NewBuffer(nil) + for { + if _, err := io.ReadFull(os.Stdin, sizeBuf[:]); err == io.EOF { + break + } else if err != nil { + fmt.Fprintln(os.Stderr, "go conformance: read request:", err) + os.Exit(1) + } + size := binary.LittleEndian.Uint32(sizeBuf[:]) + if int(size) > cap(inbuf) { + inbuf = make([]byte, size) + } + inbuf = inbuf[:size] + if _, err := io.ReadFull(os.Stdin, inbuf); err != nil { + fmt.Fprintln(os.Stderr, "go conformance: read request:", err) + os.Exit(1) + } + + req := new(pb.ConformanceRequest) + if err := proto.Unmarshal(inbuf, req); err != nil { + fmt.Fprintln(os.Stderr, "go conformance: parse request:", err) + os.Exit(1) + } + res := handle(req) + + if err := outbuf.Marshal(res); err != nil { + fmt.Fprintln(os.Stderr, "go conformance: marshal response:", err) + os.Exit(1) + } + binary.LittleEndian.PutUint32(sizeBuf[:], uint32(len(outbuf.Bytes()))) + if _, err := os.Stdout.Write(sizeBuf[:]); err != nil { + fmt.Fprintln(os.Stderr, "go conformance: write response:", err) + os.Exit(1) + } + if _, err := os.Stdout.Write(outbuf.Bytes()); err != nil { + fmt.Fprintln(os.Stderr, "go conformance: write response:", err) + os.Exit(1) + } + outbuf.Reset() + } +} + +var jsonMarshaler = jsonpb.Marshaler{ + OrigName: true, +} + +func handle(req *pb.ConformanceRequest) *pb.ConformanceResponse { + var err error + var msg pb.TestAllTypes + switch p := req.Payload.(type) { + case *pb.ConformanceRequest_ProtobufPayload: + err = proto.Unmarshal(p.ProtobufPayload, &msg) + case *pb.ConformanceRequest_JsonPayload: + err = jsonpb.UnmarshalString(p.JsonPayload, &msg) + if err != nil && err.Error() == "unmarshaling Any not supported yet" { + return &pb.ConformanceResponse{ + Result: &pb.ConformanceResponse_Skipped{ + Skipped: err.Error(), + }, + } + } + default: + return &pb.ConformanceResponse{ + Result: &pb.ConformanceResponse_RuntimeError{ + RuntimeError: "unknown request payload type", + }, + } + } + if err != nil { + return &pb.ConformanceResponse{ + Result: &pb.ConformanceResponse_ParseError{ + ParseError: err.Error(), + }, + } + } + switch req.RequestedOutputFormat { + case pb.WireFormat_PROTOBUF: + p, err := proto.Marshal(&msg) + if err != nil { + return &pb.ConformanceResponse{ + Result: &pb.ConformanceResponse_SerializeError{ + SerializeError: err.Error(), + }, + } + } + return &pb.ConformanceResponse{ + Result: &pb.ConformanceResponse_ProtobufPayload{ + ProtobufPayload: p, + }, + } + case pb.WireFormat_JSON: + p, err := jsonMarshaler.MarshalToString(&msg) + if err != nil { + return &pb.ConformanceResponse{ + Result: &pb.ConformanceResponse_SerializeError{ + SerializeError: err.Error(), + }, + } + } + return &pb.ConformanceResponse{ + Result: &pb.ConformanceResponse_JsonPayload{ + JsonPayload: p, + }, + } + default: + return &pb.ConformanceResponse{ + Result: &pb.ConformanceResponse_RuntimeError{ + RuntimeError: "unknown output format", + }, + } + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance_proto/conformance.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance_proto/conformance.pb.go new file mode 100644 index 00000000000..9571c9c2093 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance_proto/conformance.pb.go @@ -0,0 +1,1890 @@ +// Code generated by protoc-gen-gogo. +// source: conformance_proto/conformance.proto +// DO NOT EDIT! + +/* +Package conformance is a generated protocol buffer package. + +It is generated from these files: + conformance_proto/conformance.proto + +It has these top-level messages: + ConformanceRequest + ConformanceResponse + TestAllTypes + ForeignMessage +*/ +package conformance + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import google_protobuf "github.com/gogo/protobuf/types" +import google_protobuf1 "github.com/gogo/protobuf/types" +import google_protobuf2 "github.com/gogo/protobuf/types" +import google_protobuf3 "github.com/gogo/protobuf/types" +import google_protobuf4 "github.com/gogo/protobuf/types" +import google_protobuf5 "github.com/gogo/protobuf/types" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type WireFormat int32 + +const ( + WireFormat_UNSPECIFIED WireFormat = 0 + WireFormat_PROTOBUF WireFormat = 1 + WireFormat_JSON WireFormat = 2 +) + +var WireFormat_name = map[int32]string{ + 0: "UNSPECIFIED", + 1: "PROTOBUF", + 2: "JSON", +} +var WireFormat_value = map[string]int32{ + "UNSPECIFIED": 0, + "PROTOBUF": 1, + "JSON": 2, +} + +func (x WireFormat) String() string { + return proto.EnumName(WireFormat_name, int32(x)) +} +func (WireFormat) EnumDescriptor() ([]byte, []int) { return fileDescriptorConformance, []int{0} } + +type ForeignEnum int32 + +const ( + ForeignEnum_FOREIGN_FOO ForeignEnum = 0 + ForeignEnum_FOREIGN_BAR ForeignEnum = 1 + ForeignEnum_FOREIGN_BAZ ForeignEnum = 2 +) + +var ForeignEnum_name = map[int32]string{ + 0: "FOREIGN_FOO", + 1: "FOREIGN_BAR", + 2: "FOREIGN_BAZ", +} +var ForeignEnum_value = map[string]int32{ + "FOREIGN_FOO": 0, + "FOREIGN_BAR": 1, + "FOREIGN_BAZ": 2, +} + +func (x ForeignEnum) String() string { + return proto.EnumName(ForeignEnum_name, int32(x)) +} +func (ForeignEnum) EnumDescriptor() ([]byte, []int) { return fileDescriptorConformance, []int{1} } + +type TestAllTypes_NestedEnum int32 + +const ( + TestAllTypes_FOO TestAllTypes_NestedEnum = 0 + TestAllTypes_BAR TestAllTypes_NestedEnum = 1 + TestAllTypes_BAZ TestAllTypes_NestedEnum = 2 + TestAllTypes_NEG TestAllTypes_NestedEnum = -1 +) + +var TestAllTypes_NestedEnum_name = map[int32]string{ + 0: "FOO", + 1: "BAR", + 2: "BAZ", + -1: "NEG", +} +var TestAllTypes_NestedEnum_value = map[string]int32{ + "FOO": 0, + "BAR": 1, + "BAZ": 2, + "NEG": -1, +} + +func (x TestAllTypes_NestedEnum) String() string { + return proto.EnumName(TestAllTypes_NestedEnum_name, int32(x)) +} +func (TestAllTypes_NestedEnum) EnumDescriptor() ([]byte, []int) { + return fileDescriptorConformance, []int{2, 0} +} + +// Represents a single test case's input. The testee should: +// +// 1. parse this proto (which should always succeed) +// 2. parse the protobuf or JSON payload in "payload" (which may fail) +// 3. if the parse succeeded, serialize the message in the requested format. +type ConformanceRequest struct { + // The payload (whether protobuf of JSON) is always for a TestAllTypes proto + // (see below). + // + // Types that are valid to be assigned to Payload: + // *ConformanceRequest_ProtobufPayload + // *ConformanceRequest_JsonPayload + Payload isConformanceRequest_Payload `protobuf_oneof:"payload"` + // Which format should the testee serialize its message to? + RequestedOutputFormat WireFormat `protobuf:"varint,3,opt,name=requested_output_format,json=requestedOutputFormat,proto3,enum=conformance.WireFormat" json:"requested_output_format,omitempty"` +} + +func (m *ConformanceRequest) Reset() { *m = ConformanceRequest{} } +func (m *ConformanceRequest) String() string { return proto.CompactTextString(m) } +func (*ConformanceRequest) ProtoMessage() {} +func (*ConformanceRequest) Descriptor() ([]byte, []int) { return fileDescriptorConformance, []int{0} } + +type isConformanceRequest_Payload interface { + isConformanceRequest_Payload() +} + +type ConformanceRequest_ProtobufPayload struct { + ProtobufPayload []byte `protobuf:"bytes,1,opt,name=protobuf_payload,json=protobufPayload,proto3,oneof"` +} +type ConformanceRequest_JsonPayload struct { + JsonPayload string `protobuf:"bytes,2,opt,name=json_payload,json=jsonPayload,proto3,oneof"` +} + +func (*ConformanceRequest_ProtobufPayload) isConformanceRequest_Payload() {} +func (*ConformanceRequest_JsonPayload) isConformanceRequest_Payload() {} + +func (m *ConformanceRequest) GetPayload() isConformanceRequest_Payload { + if m != nil { + return m.Payload + } + return nil +} + +func (m *ConformanceRequest) GetProtobufPayload() []byte { + if x, ok := m.GetPayload().(*ConformanceRequest_ProtobufPayload); ok { + return x.ProtobufPayload + } + return nil +} + +func (m *ConformanceRequest) GetJsonPayload() string { + if x, ok := m.GetPayload().(*ConformanceRequest_JsonPayload); ok { + return x.JsonPayload + } + return "" +} + +func (m *ConformanceRequest) GetRequestedOutputFormat() WireFormat { + if m != nil { + return m.RequestedOutputFormat + } + return WireFormat_UNSPECIFIED +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*ConformanceRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _ConformanceRequest_OneofMarshaler, _ConformanceRequest_OneofUnmarshaler, _ConformanceRequest_OneofSizer, []interface{}{ + (*ConformanceRequest_ProtobufPayload)(nil), + (*ConformanceRequest_JsonPayload)(nil), + } +} + +func _ConformanceRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*ConformanceRequest) + // payload + switch x := m.Payload.(type) { + case *ConformanceRequest_ProtobufPayload: + _ = b.EncodeVarint(1<<3 | proto.WireBytes) + _ = b.EncodeRawBytes(x.ProtobufPayload) + case *ConformanceRequest_JsonPayload: + _ = b.EncodeVarint(2<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.JsonPayload) + case nil: + default: + return fmt.Errorf("ConformanceRequest.Payload has unexpected type %T", x) + } + return nil +} + +func _ConformanceRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*ConformanceRequest) + switch tag { + case 1: // payload.protobuf_payload + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeRawBytes(true) + m.Payload = &ConformanceRequest_ProtobufPayload{x} + return true, err + case 2: // payload.json_payload + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Payload = &ConformanceRequest_JsonPayload{x} + return true, err + default: + return false, nil + } +} + +func _ConformanceRequest_OneofSizer(msg proto.Message) (n int) { + m := msg.(*ConformanceRequest) + // payload + switch x := m.Payload.(type) { + case *ConformanceRequest_ProtobufPayload: + n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.ProtobufPayload))) + n += len(x.ProtobufPayload) + case *ConformanceRequest_JsonPayload: + n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.JsonPayload))) + n += len(x.JsonPayload) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// Represents a single test case's output. +type ConformanceResponse struct { + // Types that are valid to be assigned to Result: + // *ConformanceResponse_ParseError + // *ConformanceResponse_SerializeError + // *ConformanceResponse_RuntimeError + // *ConformanceResponse_ProtobufPayload + // *ConformanceResponse_JsonPayload + // *ConformanceResponse_Skipped + Result isConformanceResponse_Result `protobuf_oneof:"result"` +} + +func (m *ConformanceResponse) Reset() { *m = ConformanceResponse{} } +func (m *ConformanceResponse) String() string { return proto.CompactTextString(m) } +func (*ConformanceResponse) ProtoMessage() {} +func (*ConformanceResponse) Descriptor() ([]byte, []int) { return fileDescriptorConformance, []int{1} } + +type isConformanceResponse_Result interface { + isConformanceResponse_Result() +} + +type ConformanceResponse_ParseError struct { + ParseError string `protobuf:"bytes,1,opt,name=parse_error,json=parseError,proto3,oneof"` +} +type ConformanceResponse_SerializeError struct { + SerializeError string `protobuf:"bytes,6,opt,name=serialize_error,json=serializeError,proto3,oneof"` +} +type ConformanceResponse_RuntimeError struct { + RuntimeError string `protobuf:"bytes,2,opt,name=runtime_error,json=runtimeError,proto3,oneof"` +} +type ConformanceResponse_ProtobufPayload struct { + ProtobufPayload []byte `protobuf:"bytes,3,opt,name=protobuf_payload,json=protobufPayload,proto3,oneof"` +} +type ConformanceResponse_JsonPayload struct { + JsonPayload string `protobuf:"bytes,4,opt,name=json_payload,json=jsonPayload,proto3,oneof"` +} +type ConformanceResponse_Skipped struct { + Skipped string `protobuf:"bytes,5,opt,name=skipped,proto3,oneof"` +} + +func (*ConformanceResponse_ParseError) isConformanceResponse_Result() {} +func (*ConformanceResponse_SerializeError) isConformanceResponse_Result() {} +func (*ConformanceResponse_RuntimeError) isConformanceResponse_Result() {} +func (*ConformanceResponse_ProtobufPayload) isConformanceResponse_Result() {} +func (*ConformanceResponse_JsonPayload) isConformanceResponse_Result() {} +func (*ConformanceResponse_Skipped) isConformanceResponse_Result() {} + +func (m *ConformanceResponse) GetResult() isConformanceResponse_Result { + if m != nil { + return m.Result + } + return nil +} + +func (m *ConformanceResponse) GetParseError() string { + if x, ok := m.GetResult().(*ConformanceResponse_ParseError); ok { + return x.ParseError + } + return "" +} + +func (m *ConformanceResponse) GetSerializeError() string { + if x, ok := m.GetResult().(*ConformanceResponse_SerializeError); ok { + return x.SerializeError + } + return "" +} + +func (m *ConformanceResponse) GetRuntimeError() string { + if x, ok := m.GetResult().(*ConformanceResponse_RuntimeError); ok { + return x.RuntimeError + } + return "" +} + +func (m *ConformanceResponse) GetProtobufPayload() []byte { + if x, ok := m.GetResult().(*ConformanceResponse_ProtobufPayload); ok { + return x.ProtobufPayload + } + return nil +} + +func (m *ConformanceResponse) GetJsonPayload() string { + if x, ok := m.GetResult().(*ConformanceResponse_JsonPayload); ok { + return x.JsonPayload + } + return "" +} + +func (m *ConformanceResponse) GetSkipped() string { + if x, ok := m.GetResult().(*ConformanceResponse_Skipped); ok { + return x.Skipped + } + return "" +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*ConformanceResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _ConformanceResponse_OneofMarshaler, _ConformanceResponse_OneofUnmarshaler, _ConformanceResponse_OneofSizer, []interface{}{ + (*ConformanceResponse_ParseError)(nil), + (*ConformanceResponse_SerializeError)(nil), + (*ConformanceResponse_RuntimeError)(nil), + (*ConformanceResponse_ProtobufPayload)(nil), + (*ConformanceResponse_JsonPayload)(nil), + (*ConformanceResponse_Skipped)(nil), + } +} + +func _ConformanceResponse_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*ConformanceResponse) + // result + switch x := m.Result.(type) { + case *ConformanceResponse_ParseError: + _ = b.EncodeVarint(1<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.ParseError) + case *ConformanceResponse_SerializeError: + _ = b.EncodeVarint(6<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.SerializeError) + case *ConformanceResponse_RuntimeError: + _ = b.EncodeVarint(2<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.RuntimeError) + case *ConformanceResponse_ProtobufPayload: + _ = b.EncodeVarint(3<<3 | proto.WireBytes) + _ = b.EncodeRawBytes(x.ProtobufPayload) + case *ConformanceResponse_JsonPayload: + _ = b.EncodeVarint(4<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.JsonPayload) + case *ConformanceResponse_Skipped: + _ = b.EncodeVarint(5<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.Skipped) + case nil: + default: + return fmt.Errorf("ConformanceResponse.Result has unexpected type %T", x) + } + return nil +} + +func _ConformanceResponse_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*ConformanceResponse) + switch tag { + case 1: // result.parse_error + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Result = &ConformanceResponse_ParseError{x} + return true, err + case 6: // result.serialize_error + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Result = &ConformanceResponse_SerializeError{x} + return true, err + case 2: // result.runtime_error + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Result = &ConformanceResponse_RuntimeError{x} + return true, err + case 3: // result.protobuf_payload + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeRawBytes(true) + m.Result = &ConformanceResponse_ProtobufPayload{x} + return true, err + case 4: // result.json_payload + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Result = &ConformanceResponse_JsonPayload{x} + return true, err + case 5: // result.skipped + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Result = &ConformanceResponse_Skipped{x} + return true, err + default: + return false, nil + } +} + +func _ConformanceResponse_OneofSizer(msg proto.Message) (n int) { + m := msg.(*ConformanceResponse) + // result + switch x := m.Result.(type) { + case *ConformanceResponse_ParseError: + n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.ParseError))) + n += len(x.ParseError) + case *ConformanceResponse_SerializeError: + n += proto.SizeVarint(6<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.SerializeError))) + n += len(x.SerializeError) + case *ConformanceResponse_RuntimeError: + n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.RuntimeError))) + n += len(x.RuntimeError) + case *ConformanceResponse_ProtobufPayload: + n += proto.SizeVarint(3<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.ProtobufPayload))) + n += len(x.ProtobufPayload) + case *ConformanceResponse_JsonPayload: + n += proto.SizeVarint(4<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.JsonPayload))) + n += len(x.JsonPayload) + case *ConformanceResponse_Skipped: + n += proto.SizeVarint(5<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.Skipped))) + n += len(x.Skipped) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// This proto includes every type of field in both singular and repeated +// forms. +type TestAllTypes struct { + // Singular + OptionalInt32 int32 `protobuf:"varint,1,opt,name=optional_int32,json=optionalInt32,proto3" json:"optional_int32,omitempty"` + OptionalInt64 int64 `protobuf:"varint,2,opt,name=optional_int64,json=optionalInt64,proto3" json:"optional_int64,omitempty"` + OptionalUint32 uint32 `protobuf:"varint,3,opt,name=optional_uint32,json=optionalUint32,proto3" json:"optional_uint32,omitempty"` + OptionalUint64 uint64 `protobuf:"varint,4,opt,name=optional_uint64,json=optionalUint64,proto3" json:"optional_uint64,omitempty"` + OptionalSint32 int32 `protobuf:"zigzag32,5,opt,name=optional_sint32,json=optionalSint32,proto3" json:"optional_sint32,omitempty"` + OptionalSint64 int64 `protobuf:"zigzag64,6,opt,name=optional_sint64,json=optionalSint64,proto3" json:"optional_sint64,omitempty"` + OptionalFixed32 uint32 `protobuf:"fixed32,7,opt,name=optional_fixed32,json=optionalFixed32,proto3" json:"optional_fixed32,omitempty"` + OptionalFixed64 uint64 `protobuf:"fixed64,8,opt,name=optional_fixed64,json=optionalFixed64,proto3" json:"optional_fixed64,omitempty"` + OptionalSfixed32 int32 `protobuf:"fixed32,9,opt,name=optional_sfixed32,json=optionalSfixed32,proto3" json:"optional_sfixed32,omitempty"` + OptionalSfixed64 int64 `protobuf:"fixed64,10,opt,name=optional_sfixed64,json=optionalSfixed64,proto3" json:"optional_sfixed64,omitempty"` + OptionalFloat float32 `protobuf:"fixed32,11,opt,name=optional_float,json=optionalFloat,proto3" json:"optional_float,omitempty"` + OptionalDouble float64 `protobuf:"fixed64,12,opt,name=optional_double,json=optionalDouble,proto3" json:"optional_double,omitempty"` + OptionalBool bool `protobuf:"varint,13,opt,name=optional_bool,json=optionalBool,proto3" json:"optional_bool,omitempty"` + OptionalString string `protobuf:"bytes,14,opt,name=optional_string,json=optionalString,proto3" json:"optional_string,omitempty"` + OptionalBytes []byte `protobuf:"bytes,15,opt,name=optional_bytes,json=optionalBytes,proto3" json:"optional_bytes,omitempty"` + OptionalNestedMessage *TestAllTypes_NestedMessage `protobuf:"bytes,18,opt,name=optional_nested_message,json=optionalNestedMessage" json:"optional_nested_message,omitempty"` + OptionalForeignMessage *ForeignMessage `protobuf:"bytes,19,opt,name=optional_foreign_message,json=optionalForeignMessage" json:"optional_foreign_message,omitempty"` + OptionalNestedEnum TestAllTypes_NestedEnum `protobuf:"varint,21,opt,name=optional_nested_enum,json=optionalNestedEnum,proto3,enum=conformance.TestAllTypes_NestedEnum" json:"optional_nested_enum,omitempty"` + OptionalForeignEnum ForeignEnum `protobuf:"varint,22,opt,name=optional_foreign_enum,json=optionalForeignEnum,proto3,enum=conformance.ForeignEnum" json:"optional_foreign_enum,omitempty"` + OptionalStringPiece string `protobuf:"bytes,24,opt,name=optional_string_piece,json=optionalStringPiece,proto3" json:"optional_string_piece,omitempty"` + OptionalCord string `protobuf:"bytes,25,opt,name=optional_cord,json=optionalCord,proto3" json:"optional_cord,omitempty"` + RecursiveMessage *TestAllTypes `protobuf:"bytes,27,opt,name=recursive_message,json=recursiveMessage" json:"recursive_message,omitempty"` + // Repeated + RepeatedInt32 []int32 `protobuf:"varint,31,rep,packed,name=repeated_int32,json=repeatedInt32" json:"repeated_int32,omitempty"` + RepeatedInt64 []int64 `protobuf:"varint,32,rep,packed,name=repeated_int64,json=repeatedInt64" json:"repeated_int64,omitempty"` + RepeatedUint32 []uint32 `protobuf:"varint,33,rep,packed,name=repeated_uint32,json=repeatedUint32" json:"repeated_uint32,omitempty"` + RepeatedUint64 []uint64 `protobuf:"varint,34,rep,packed,name=repeated_uint64,json=repeatedUint64" json:"repeated_uint64,omitempty"` + RepeatedSint32 []int32 `protobuf:"zigzag32,35,rep,packed,name=repeated_sint32,json=repeatedSint32" json:"repeated_sint32,omitempty"` + RepeatedSint64 []int64 `protobuf:"zigzag64,36,rep,packed,name=repeated_sint64,json=repeatedSint64" json:"repeated_sint64,omitempty"` + RepeatedFixed32 []uint32 `protobuf:"fixed32,37,rep,packed,name=repeated_fixed32,json=repeatedFixed32" json:"repeated_fixed32,omitempty"` + RepeatedFixed64 []uint64 `protobuf:"fixed64,38,rep,packed,name=repeated_fixed64,json=repeatedFixed64" json:"repeated_fixed64,omitempty"` + RepeatedSfixed32 []int32 `protobuf:"fixed32,39,rep,packed,name=repeated_sfixed32,json=repeatedSfixed32" json:"repeated_sfixed32,omitempty"` + RepeatedSfixed64 []int64 `protobuf:"fixed64,40,rep,packed,name=repeated_sfixed64,json=repeatedSfixed64" json:"repeated_sfixed64,omitempty"` + RepeatedFloat []float32 `protobuf:"fixed32,41,rep,packed,name=repeated_float,json=repeatedFloat" json:"repeated_float,omitempty"` + RepeatedDouble []float64 `protobuf:"fixed64,42,rep,packed,name=repeated_double,json=repeatedDouble" json:"repeated_double,omitempty"` + RepeatedBool []bool `protobuf:"varint,43,rep,packed,name=repeated_bool,json=repeatedBool" json:"repeated_bool,omitempty"` + RepeatedString []string `protobuf:"bytes,44,rep,name=repeated_string,json=repeatedString" json:"repeated_string,omitempty"` + RepeatedBytes [][]byte `protobuf:"bytes,45,rep,name=repeated_bytes,json=repeatedBytes" json:"repeated_bytes,omitempty"` + RepeatedNestedMessage []*TestAllTypes_NestedMessage `protobuf:"bytes,48,rep,name=repeated_nested_message,json=repeatedNestedMessage" json:"repeated_nested_message,omitempty"` + RepeatedForeignMessage []*ForeignMessage `protobuf:"bytes,49,rep,name=repeated_foreign_message,json=repeatedForeignMessage" json:"repeated_foreign_message,omitempty"` + RepeatedNestedEnum []TestAllTypes_NestedEnum `protobuf:"varint,51,rep,packed,name=repeated_nested_enum,json=repeatedNestedEnum,enum=conformance.TestAllTypes_NestedEnum" json:"repeated_nested_enum,omitempty"` + RepeatedForeignEnum []ForeignEnum `protobuf:"varint,52,rep,packed,name=repeated_foreign_enum,json=repeatedForeignEnum,enum=conformance.ForeignEnum" json:"repeated_foreign_enum,omitempty"` + RepeatedStringPiece []string `protobuf:"bytes,54,rep,name=repeated_string_piece,json=repeatedStringPiece" json:"repeated_string_piece,omitempty"` + RepeatedCord []string `protobuf:"bytes,55,rep,name=repeated_cord,json=repeatedCord" json:"repeated_cord,omitempty"` + // Map + MapInt32Int32 map[int32]int32 `protobuf:"bytes,56,rep,name=map_int32_int32,json=mapInt32Int32" json:"map_int32_int32,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` + MapInt64Int64 map[int64]int64 `protobuf:"bytes,57,rep,name=map_int64_int64,json=mapInt64Int64" json:"map_int64_int64,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` + MapUint32Uint32 map[uint32]uint32 `protobuf:"bytes,58,rep,name=map_uint32_uint32,json=mapUint32Uint32" json:"map_uint32_uint32,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` + MapUint64Uint64 map[uint64]uint64 `protobuf:"bytes,59,rep,name=map_uint64_uint64,json=mapUint64Uint64" json:"map_uint64_uint64,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` + MapSint32Sint32 map[int32]int32 `protobuf:"bytes,60,rep,name=map_sint32_sint32,json=mapSint32Sint32" json:"map_sint32_sint32,omitempty" protobuf_key:"zigzag32,1,opt,name=key,proto3" protobuf_val:"zigzag32,2,opt,name=value,proto3"` + MapSint64Sint64 map[int64]int64 `protobuf:"bytes,61,rep,name=map_sint64_sint64,json=mapSint64Sint64" json:"map_sint64_sint64,omitempty" protobuf_key:"zigzag64,1,opt,name=key,proto3" protobuf_val:"zigzag64,2,opt,name=value,proto3"` + MapFixed32Fixed32 map[uint32]uint32 `protobuf:"bytes,62,rep,name=map_fixed32_fixed32,json=mapFixed32Fixed32" json:"map_fixed32_fixed32,omitempty" protobuf_key:"fixed32,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"` + MapFixed64Fixed64 map[uint64]uint64 `protobuf:"bytes,63,rep,name=map_fixed64_fixed64,json=mapFixed64Fixed64" json:"map_fixed64_fixed64,omitempty" protobuf_key:"fixed64,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"` + MapSfixed32Sfixed32 map[int32]int32 `protobuf:"bytes,64,rep,name=map_sfixed32_sfixed32,json=mapSfixed32Sfixed32" json:"map_sfixed32_sfixed32,omitempty" protobuf_key:"fixed32,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"` + MapSfixed64Sfixed64 map[int64]int64 `protobuf:"bytes,65,rep,name=map_sfixed64_sfixed64,json=mapSfixed64Sfixed64" json:"map_sfixed64_sfixed64,omitempty" protobuf_key:"fixed64,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"` + MapInt32Float map[int32]float32 `protobuf:"bytes,66,rep,name=map_int32_float,json=mapInt32Float" json:"map_int32_float,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"` + MapInt32Double map[int32]float64 `protobuf:"bytes,67,rep,name=map_int32_double,json=mapInt32Double" json:"map_int32_double,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"` + MapBoolBool map[bool]bool `protobuf:"bytes,68,rep,name=map_bool_bool,json=mapBoolBool" json:"map_bool_bool,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` + MapStringString map[string]string `protobuf:"bytes,69,rep,name=map_string_string,json=mapStringString" json:"map_string_string,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + MapStringBytes map[string][]byte `protobuf:"bytes,70,rep,name=map_string_bytes,json=mapStringBytes" json:"map_string_bytes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + MapStringNestedMessage map[string]*TestAllTypes_NestedMessage `protobuf:"bytes,71,rep,name=map_string_nested_message,json=mapStringNestedMessage" json:"map_string_nested_message,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"` + MapStringForeignMessage map[string]*ForeignMessage `protobuf:"bytes,72,rep,name=map_string_foreign_message,json=mapStringForeignMessage" json:"map_string_foreign_message,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"` + MapStringNestedEnum map[string]TestAllTypes_NestedEnum `protobuf:"bytes,73,rep,name=map_string_nested_enum,json=mapStringNestedEnum" json:"map_string_nested_enum,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=conformance.TestAllTypes_NestedEnum"` + MapStringForeignEnum map[string]ForeignEnum `protobuf:"bytes,74,rep,name=map_string_foreign_enum,json=mapStringForeignEnum" json:"map_string_foreign_enum,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=conformance.ForeignEnum"` + // Types that are valid to be assigned to OneofField: + // *TestAllTypes_OneofUint32 + // *TestAllTypes_OneofNestedMessage + // *TestAllTypes_OneofString + // *TestAllTypes_OneofBytes + // *TestAllTypes_OneofBool + // *TestAllTypes_OneofUint64 + // *TestAllTypes_OneofFloat + // *TestAllTypes_OneofDouble + // *TestAllTypes_OneofEnum + OneofField isTestAllTypes_OneofField `protobuf_oneof:"oneof_field"` + // Well-known types + OptionalBoolWrapper *google_protobuf5.BoolValue `protobuf:"bytes,201,opt,name=optional_bool_wrapper,json=optionalBoolWrapper" json:"optional_bool_wrapper,omitempty"` + OptionalInt32Wrapper *google_protobuf5.Int32Value `protobuf:"bytes,202,opt,name=optional_int32_wrapper,json=optionalInt32Wrapper" json:"optional_int32_wrapper,omitempty"` + OptionalInt64Wrapper *google_protobuf5.Int64Value `protobuf:"bytes,203,opt,name=optional_int64_wrapper,json=optionalInt64Wrapper" json:"optional_int64_wrapper,omitempty"` + OptionalUint32Wrapper *google_protobuf5.UInt32Value `protobuf:"bytes,204,opt,name=optional_uint32_wrapper,json=optionalUint32Wrapper" json:"optional_uint32_wrapper,omitempty"` + OptionalUint64Wrapper *google_protobuf5.UInt64Value `protobuf:"bytes,205,opt,name=optional_uint64_wrapper,json=optionalUint64Wrapper" json:"optional_uint64_wrapper,omitempty"` + OptionalFloatWrapper *google_protobuf5.FloatValue `protobuf:"bytes,206,opt,name=optional_float_wrapper,json=optionalFloatWrapper" json:"optional_float_wrapper,omitempty"` + OptionalDoubleWrapper *google_protobuf5.DoubleValue `protobuf:"bytes,207,opt,name=optional_double_wrapper,json=optionalDoubleWrapper" json:"optional_double_wrapper,omitempty"` + OptionalStringWrapper *google_protobuf5.StringValue `protobuf:"bytes,208,opt,name=optional_string_wrapper,json=optionalStringWrapper" json:"optional_string_wrapper,omitempty"` + OptionalBytesWrapper *google_protobuf5.BytesValue `protobuf:"bytes,209,opt,name=optional_bytes_wrapper,json=optionalBytesWrapper" json:"optional_bytes_wrapper,omitempty"` + RepeatedBoolWrapper []*google_protobuf5.BoolValue `protobuf:"bytes,211,rep,name=repeated_bool_wrapper,json=repeatedBoolWrapper" json:"repeated_bool_wrapper,omitempty"` + RepeatedInt32Wrapper []*google_protobuf5.Int32Value `protobuf:"bytes,212,rep,name=repeated_int32_wrapper,json=repeatedInt32Wrapper" json:"repeated_int32_wrapper,omitempty"` + RepeatedInt64Wrapper []*google_protobuf5.Int64Value `protobuf:"bytes,213,rep,name=repeated_int64_wrapper,json=repeatedInt64Wrapper" json:"repeated_int64_wrapper,omitempty"` + RepeatedUint32Wrapper []*google_protobuf5.UInt32Value `protobuf:"bytes,214,rep,name=repeated_uint32_wrapper,json=repeatedUint32Wrapper" json:"repeated_uint32_wrapper,omitempty"` + RepeatedUint64Wrapper []*google_protobuf5.UInt64Value `protobuf:"bytes,215,rep,name=repeated_uint64_wrapper,json=repeatedUint64Wrapper" json:"repeated_uint64_wrapper,omitempty"` + RepeatedFloatWrapper []*google_protobuf5.FloatValue `protobuf:"bytes,216,rep,name=repeated_float_wrapper,json=repeatedFloatWrapper" json:"repeated_float_wrapper,omitempty"` + RepeatedDoubleWrapper []*google_protobuf5.DoubleValue `protobuf:"bytes,217,rep,name=repeated_double_wrapper,json=repeatedDoubleWrapper" json:"repeated_double_wrapper,omitempty"` + RepeatedStringWrapper []*google_protobuf5.StringValue `protobuf:"bytes,218,rep,name=repeated_string_wrapper,json=repeatedStringWrapper" json:"repeated_string_wrapper,omitempty"` + RepeatedBytesWrapper []*google_protobuf5.BytesValue `protobuf:"bytes,219,rep,name=repeated_bytes_wrapper,json=repeatedBytesWrapper" json:"repeated_bytes_wrapper,omitempty"` + OptionalDuration *google_protobuf1.Duration `protobuf:"bytes,301,opt,name=optional_duration,json=optionalDuration" json:"optional_duration,omitempty"` + OptionalTimestamp *google_protobuf4.Timestamp `protobuf:"bytes,302,opt,name=optional_timestamp,json=optionalTimestamp" json:"optional_timestamp,omitempty"` + OptionalFieldMask *google_protobuf2.FieldMask `protobuf:"bytes,303,opt,name=optional_field_mask,json=optionalFieldMask" json:"optional_field_mask,omitempty"` + OptionalStruct *google_protobuf3.Struct `protobuf:"bytes,304,opt,name=optional_struct,json=optionalStruct" json:"optional_struct,omitempty"` + OptionalAny *google_protobuf.Any `protobuf:"bytes,305,opt,name=optional_any,json=optionalAny" json:"optional_any,omitempty"` + OptionalValue *google_protobuf3.Value `protobuf:"bytes,306,opt,name=optional_value,json=optionalValue" json:"optional_value,omitempty"` + RepeatedDuration []*google_protobuf1.Duration `protobuf:"bytes,311,rep,name=repeated_duration,json=repeatedDuration" json:"repeated_duration,omitempty"` + RepeatedTimestamp []*google_protobuf4.Timestamp `protobuf:"bytes,312,rep,name=repeated_timestamp,json=repeatedTimestamp" json:"repeated_timestamp,omitempty"` + RepeatedFieldmask []*google_protobuf2.FieldMask `protobuf:"bytes,313,rep,name=repeated_fieldmask,json=repeatedFieldmask" json:"repeated_fieldmask,omitempty"` + RepeatedStruct []*google_protobuf3.Struct `protobuf:"bytes,324,rep,name=repeated_struct,json=repeatedStruct" json:"repeated_struct,omitempty"` + RepeatedAny []*google_protobuf.Any `protobuf:"bytes,315,rep,name=repeated_any,json=repeatedAny" json:"repeated_any,omitempty"` + RepeatedValue []*google_protobuf3.Value `protobuf:"bytes,316,rep,name=repeated_value,json=repeatedValue" json:"repeated_value,omitempty"` + // Test field-name-to-JSON-name convention. + // (protobuf says names can be any valid C/C++ identifier.) + Fieldname1 int32 `protobuf:"varint,401,opt,name=fieldname1,proto3" json:"fieldname1,omitempty"` + FieldName2 int32 `protobuf:"varint,402,opt,name=field_name2,json=fieldName2,proto3" json:"field_name2,omitempty"` + XFieldName3 int32 `protobuf:"varint,403,opt,name=_field_name3,json=FieldName3,proto3" json:"_field_name3,omitempty"` + Field_Name4_ int32 `protobuf:"varint,404,opt,name=field__name4_,json=fieldName4,proto3" json:"field__name4_,omitempty"` + Field0Name5 int32 `protobuf:"varint,405,opt,name=field0name5,proto3" json:"field0name5,omitempty"` + Field_0Name6 int32 `protobuf:"varint,406,opt,name=field_0_name6,json=field0Name6,proto3" json:"field_0_name6,omitempty"` + FieldName7 int32 `protobuf:"varint,407,opt,name=fieldName7,proto3" json:"fieldName7,omitempty"` + FieldName8 int32 `protobuf:"varint,408,opt,name=FieldName8,proto3" json:"FieldName8,omitempty"` + Field_Name9 int32 `protobuf:"varint,409,opt,name=field_Name9,json=fieldName9,proto3" json:"field_Name9,omitempty"` + Field_Name10 int32 `protobuf:"varint,410,opt,name=Field_Name10,json=FieldName10,proto3" json:"Field_Name10,omitempty"` + FIELD_NAME11 int32 `protobuf:"varint,411,opt,name=FIELD_NAME11,json=FIELDNAME11,proto3" json:"FIELD_NAME11,omitempty"` + FIELDName12 int32 `protobuf:"varint,412,opt,name=FIELD_name12,json=FIELDName12,proto3" json:"FIELD_name12,omitempty"` + XFieldName13 int32 `protobuf:"varint,413,opt,name=__field_name13,json=FieldName13,proto3" json:"__field_name13,omitempty"` + X_FieldName14 int32 `protobuf:"varint,414,opt,name=__Field_name14,json=FieldName14,proto3" json:"__Field_name14,omitempty"` + Field_Name15 int32 `protobuf:"varint,415,opt,name=field__name15,json=fieldName15,proto3" json:"field__name15,omitempty"` + Field__Name16 int32 `protobuf:"varint,416,opt,name=field__Name16,json=fieldName16,proto3" json:"field__Name16,omitempty"` + FieldName17__ int32 `protobuf:"varint,417,opt,name=field_name17__,json=fieldName17,proto3" json:"field_name17__,omitempty"` + FieldName18__ int32 `protobuf:"varint,418,opt,name=Field_name18__,json=FieldName18,proto3" json:"Field_name18__,omitempty"` +} + +func (m *TestAllTypes) Reset() { *m = TestAllTypes{} } +func (m *TestAllTypes) String() string { return proto.CompactTextString(m) } +func (*TestAllTypes) ProtoMessage() {} +func (*TestAllTypes) Descriptor() ([]byte, []int) { return fileDescriptorConformance, []int{2} } + +type isTestAllTypes_OneofField interface { + isTestAllTypes_OneofField() +} + +type TestAllTypes_OneofUint32 struct { + OneofUint32 uint32 `protobuf:"varint,111,opt,name=oneof_uint32,json=oneofUint32,proto3,oneof"` +} +type TestAllTypes_OneofNestedMessage struct { + OneofNestedMessage *TestAllTypes_NestedMessage `protobuf:"bytes,112,opt,name=oneof_nested_message,json=oneofNestedMessage,oneof"` +} +type TestAllTypes_OneofString struct { + OneofString string `protobuf:"bytes,113,opt,name=oneof_string,json=oneofString,proto3,oneof"` +} +type TestAllTypes_OneofBytes struct { + OneofBytes []byte `protobuf:"bytes,114,opt,name=oneof_bytes,json=oneofBytes,proto3,oneof"` +} +type TestAllTypes_OneofBool struct { + OneofBool bool `protobuf:"varint,115,opt,name=oneof_bool,json=oneofBool,proto3,oneof"` +} +type TestAllTypes_OneofUint64 struct { + OneofUint64 uint64 `protobuf:"varint,116,opt,name=oneof_uint64,json=oneofUint64,proto3,oneof"` +} +type TestAllTypes_OneofFloat struct { + OneofFloat float32 `protobuf:"fixed32,117,opt,name=oneof_float,json=oneofFloat,proto3,oneof"` +} +type TestAllTypes_OneofDouble struct { + OneofDouble float64 `protobuf:"fixed64,118,opt,name=oneof_double,json=oneofDouble,proto3,oneof"` +} +type TestAllTypes_OneofEnum struct { + OneofEnum TestAllTypes_NestedEnum `protobuf:"varint,119,opt,name=oneof_enum,json=oneofEnum,proto3,enum=conformance.TestAllTypes_NestedEnum,oneof"` +} + +func (*TestAllTypes_OneofUint32) isTestAllTypes_OneofField() {} +func (*TestAllTypes_OneofNestedMessage) isTestAllTypes_OneofField() {} +func (*TestAllTypes_OneofString) isTestAllTypes_OneofField() {} +func (*TestAllTypes_OneofBytes) isTestAllTypes_OneofField() {} +func (*TestAllTypes_OneofBool) isTestAllTypes_OneofField() {} +func (*TestAllTypes_OneofUint64) isTestAllTypes_OneofField() {} +func (*TestAllTypes_OneofFloat) isTestAllTypes_OneofField() {} +func (*TestAllTypes_OneofDouble) isTestAllTypes_OneofField() {} +func (*TestAllTypes_OneofEnum) isTestAllTypes_OneofField() {} + +func (m *TestAllTypes) GetOneofField() isTestAllTypes_OneofField { + if m != nil { + return m.OneofField + } + return nil +} + +func (m *TestAllTypes) GetOptionalInt32() int32 { + if m != nil { + return m.OptionalInt32 + } + return 0 +} + +func (m *TestAllTypes) GetOptionalInt64() int64 { + if m != nil { + return m.OptionalInt64 + } + return 0 +} + +func (m *TestAllTypes) GetOptionalUint32() uint32 { + if m != nil { + return m.OptionalUint32 + } + return 0 +} + +func (m *TestAllTypes) GetOptionalUint64() uint64 { + if m != nil { + return m.OptionalUint64 + } + return 0 +} + +func (m *TestAllTypes) GetOptionalSint32() int32 { + if m != nil { + return m.OptionalSint32 + } + return 0 +} + +func (m *TestAllTypes) GetOptionalSint64() int64 { + if m != nil { + return m.OptionalSint64 + } + return 0 +} + +func (m *TestAllTypes) GetOptionalFixed32() uint32 { + if m != nil { + return m.OptionalFixed32 + } + return 0 +} + +func (m *TestAllTypes) GetOptionalFixed64() uint64 { + if m != nil { + return m.OptionalFixed64 + } + return 0 +} + +func (m *TestAllTypes) GetOptionalSfixed32() int32 { + if m != nil { + return m.OptionalSfixed32 + } + return 0 +} + +func (m *TestAllTypes) GetOptionalSfixed64() int64 { + if m != nil { + return m.OptionalSfixed64 + } + return 0 +} + +func (m *TestAllTypes) GetOptionalFloat() float32 { + if m != nil { + return m.OptionalFloat + } + return 0 +} + +func (m *TestAllTypes) GetOptionalDouble() float64 { + if m != nil { + return m.OptionalDouble + } + return 0 +} + +func (m *TestAllTypes) GetOptionalBool() bool { + if m != nil { + return m.OptionalBool + } + return false +} + +func (m *TestAllTypes) GetOptionalString() string { + if m != nil { + return m.OptionalString + } + return "" +} + +func (m *TestAllTypes) GetOptionalBytes() []byte { + if m != nil { + return m.OptionalBytes + } + return nil +} + +func (m *TestAllTypes) GetOptionalNestedMessage() *TestAllTypes_NestedMessage { + if m != nil { + return m.OptionalNestedMessage + } + return nil +} + +func (m *TestAllTypes) GetOptionalForeignMessage() *ForeignMessage { + if m != nil { + return m.OptionalForeignMessage + } + return nil +} + +func (m *TestAllTypes) GetOptionalNestedEnum() TestAllTypes_NestedEnum { + if m != nil { + return m.OptionalNestedEnum + } + return TestAllTypes_FOO +} + +func (m *TestAllTypes) GetOptionalForeignEnum() ForeignEnum { + if m != nil { + return m.OptionalForeignEnum + } + return ForeignEnum_FOREIGN_FOO +} + +func (m *TestAllTypes) GetOptionalStringPiece() string { + if m != nil { + return m.OptionalStringPiece + } + return "" +} + +func (m *TestAllTypes) GetOptionalCord() string { + if m != nil { + return m.OptionalCord + } + return "" +} + +func (m *TestAllTypes) GetRecursiveMessage() *TestAllTypes { + if m != nil { + return m.RecursiveMessage + } + return nil +} + +func (m *TestAllTypes) GetRepeatedInt32() []int32 { + if m != nil { + return m.RepeatedInt32 + } + return nil +} + +func (m *TestAllTypes) GetRepeatedInt64() []int64 { + if m != nil { + return m.RepeatedInt64 + } + return nil +} + +func (m *TestAllTypes) GetRepeatedUint32() []uint32 { + if m != nil { + return m.RepeatedUint32 + } + return nil +} + +func (m *TestAllTypes) GetRepeatedUint64() []uint64 { + if m != nil { + return m.RepeatedUint64 + } + return nil +} + +func (m *TestAllTypes) GetRepeatedSint32() []int32 { + if m != nil { + return m.RepeatedSint32 + } + return nil +} + +func (m *TestAllTypes) GetRepeatedSint64() []int64 { + if m != nil { + return m.RepeatedSint64 + } + return nil +} + +func (m *TestAllTypes) GetRepeatedFixed32() []uint32 { + if m != nil { + return m.RepeatedFixed32 + } + return nil +} + +func (m *TestAllTypes) GetRepeatedFixed64() []uint64 { + if m != nil { + return m.RepeatedFixed64 + } + return nil +} + +func (m *TestAllTypes) GetRepeatedSfixed32() []int32 { + if m != nil { + return m.RepeatedSfixed32 + } + return nil +} + +func (m *TestAllTypes) GetRepeatedSfixed64() []int64 { + if m != nil { + return m.RepeatedSfixed64 + } + return nil +} + +func (m *TestAllTypes) GetRepeatedFloat() []float32 { + if m != nil { + return m.RepeatedFloat + } + return nil +} + +func (m *TestAllTypes) GetRepeatedDouble() []float64 { + if m != nil { + return m.RepeatedDouble + } + return nil +} + +func (m *TestAllTypes) GetRepeatedBool() []bool { + if m != nil { + return m.RepeatedBool + } + return nil +} + +func (m *TestAllTypes) GetRepeatedString() []string { + if m != nil { + return m.RepeatedString + } + return nil +} + +func (m *TestAllTypes) GetRepeatedBytes() [][]byte { + if m != nil { + return m.RepeatedBytes + } + return nil +} + +func (m *TestAllTypes) GetRepeatedNestedMessage() []*TestAllTypes_NestedMessage { + if m != nil { + return m.RepeatedNestedMessage + } + return nil +} + +func (m *TestAllTypes) GetRepeatedForeignMessage() []*ForeignMessage { + if m != nil { + return m.RepeatedForeignMessage + } + return nil +} + +func (m *TestAllTypes) GetRepeatedNestedEnum() []TestAllTypes_NestedEnum { + if m != nil { + return m.RepeatedNestedEnum + } + return nil +} + +func (m *TestAllTypes) GetRepeatedForeignEnum() []ForeignEnum { + if m != nil { + return m.RepeatedForeignEnum + } + return nil +} + +func (m *TestAllTypes) GetRepeatedStringPiece() []string { + if m != nil { + return m.RepeatedStringPiece + } + return nil +} + +func (m *TestAllTypes) GetRepeatedCord() []string { + if m != nil { + return m.RepeatedCord + } + return nil +} + +func (m *TestAllTypes) GetMapInt32Int32() map[int32]int32 { + if m != nil { + return m.MapInt32Int32 + } + return nil +} + +func (m *TestAllTypes) GetMapInt64Int64() map[int64]int64 { + if m != nil { + return m.MapInt64Int64 + } + return nil +} + +func (m *TestAllTypes) GetMapUint32Uint32() map[uint32]uint32 { + if m != nil { + return m.MapUint32Uint32 + } + return nil +} + +func (m *TestAllTypes) GetMapUint64Uint64() map[uint64]uint64 { + if m != nil { + return m.MapUint64Uint64 + } + return nil +} + +func (m *TestAllTypes) GetMapSint32Sint32() map[int32]int32 { + if m != nil { + return m.MapSint32Sint32 + } + return nil +} + +func (m *TestAllTypes) GetMapSint64Sint64() map[int64]int64 { + if m != nil { + return m.MapSint64Sint64 + } + return nil +} + +func (m *TestAllTypes) GetMapFixed32Fixed32() map[uint32]uint32 { + if m != nil { + return m.MapFixed32Fixed32 + } + return nil +} + +func (m *TestAllTypes) GetMapFixed64Fixed64() map[uint64]uint64 { + if m != nil { + return m.MapFixed64Fixed64 + } + return nil +} + +func (m *TestAllTypes) GetMapSfixed32Sfixed32() map[int32]int32 { + if m != nil { + return m.MapSfixed32Sfixed32 + } + return nil +} + +func (m *TestAllTypes) GetMapSfixed64Sfixed64() map[int64]int64 { + if m != nil { + return m.MapSfixed64Sfixed64 + } + return nil +} + +func (m *TestAllTypes) GetMapInt32Float() map[int32]float32 { + if m != nil { + return m.MapInt32Float + } + return nil +} + +func (m *TestAllTypes) GetMapInt32Double() map[int32]float64 { + if m != nil { + return m.MapInt32Double + } + return nil +} + +func (m *TestAllTypes) GetMapBoolBool() map[bool]bool { + if m != nil { + return m.MapBoolBool + } + return nil +} + +func (m *TestAllTypes) GetMapStringString() map[string]string { + if m != nil { + return m.MapStringString + } + return nil +} + +func (m *TestAllTypes) GetMapStringBytes() map[string][]byte { + if m != nil { + return m.MapStringBytes + } + return nil +} + +func (m *TestAllTypes) GetMapStringNestedMessage() map[string]*TestAllTypes_NestedMessage { + if m != nil { + return m.MapStringNestedMessage + } + return nil +} + +func (m *TestAllTypes) GetMapStringForeignMessage() map[string]*ForeignMessage { + if m != nil { + return m.MapStringForeignMessage + } + return nil +} + +func (m *TestAllTypes) GetMapStringNestedEnum() map[string]TestAllTypes_NestedEnum { + if m != nil { + return m.MapStringNestedEnum + } + return nil +} + +func (m *TestAllTypes) GetMapStringForeignEnum() map[string]ForeignEnum { + if m != nil { + return m.MapStringForeignEnum + } + return nil +} + +func (m *TestAllTypes) GetOneofUint32() uint32 { + if x, ok := m.GetOneofField().(*TestAllTypes_OneofUint32); ok { + return x.OneofUint32 + } + return 0 +} + +func (m *TestAllTypes) GetOneofNestedMessage() *TestAllTypes_NestedMessage { + if x, ok := m.GetOneofField().(*TestAllTypes_OneofNestedMessage); ok { + return x.OneofNestedMessage + } + return nil +} + +func (m *TestAllTypes) GetOneofString() string { + if x, ok := m.GetOneofField().(*TestAllTypes_OneofString); ok { + return x.OneofString + } + return "" +} + +func (m *TestAllTypes) GetOneofBytes() []byte { + if x, ok := m.GetOneofField().(*TestAllTypes_OneofBytes); ok { + return x.OneofBytes + } + return nil +} + +func (m *TestAllTypes) GetOneofBool() bool { + if x, ok := m.GetOneofField().(*TestAllTypes_OneofBool); ok { + return x.OneofBool + } + return false +} + +func (m *TestAllTypes) GetOneofUint64() uint64 { + if x, ok := m.GetOneofField().(*TestAllTypes_OneofUint64); ok { + return x.OneofUint64 + } + return 0 +} + +func (m *TestAllTypes) GetOneofFloat() float32 { + if x, ok := m.GetOneofField().(*TestAllTypes_OneofFloat); ok { + return x.OneofFloat + } + return 0 +} + +func (m *TestAllTypes) GetOneofDouble() float64 { + if x, ok := m.GetOneofField().(*TestAllTypes_OneofDouble); ok { + return x.OneofDouble + } + return 0 +} + +func (m *TestAllTypes) GetOneofEnum() TestAllTypes_NestedEnum { + if x, ok := m.GetOneofField().(*TestAllTypes_OneofEnum); ok { + return x.OneofEnum + } + return TestAllTypes_FOO +} + +func (m *TestAllTypes) GetOptionalBoolWrapper() *google_protobuf5.BoolValue { + if m != nil { + return m.OptionalBoolWrapper + } + return nil +} + +func (m *TestAllTypes) GetOptionalInt32Wrapper() *google_protobuf5.Int32Value { + if m != nil { + return m.OptionalInt32Wrapper + } + return nil +} + +func (m *TestAllTypes) GetOptionalInt64Wrapper() *google_protobuf5.Int64Value { + if m != nil { + return m.OptionalInt64Wrapper + } + return nil +} + +func (m *TestAllTypes) GetOptionalUint32Wrapper() *google_protobuf5.UInt32Value { + if m != nil { + return m.OptionalUint32Wrapper + } + return nil +} + +func (m *TestAllTypes) GetOptionalUint64Wrapper() *google_protobuf5.UInt64Value { + if m != nil { + return m.OptionalUint64Wrapper + } + return nil +} + +func (m *TestAllTypes) GetOptionalFloatWrapper() *google_protobuf5.FloatValue { + if m != nil { + return m.OptionalFloatWrapper + } + return nil +} + +func (m *TestAllTypes) GetOptionalDoubleWrapper() *google_protobuf5.DoubleValue { + if m != nil { + return m.OptionalDoubleWrapper + } + return nil +} + +func (m *TestAllTypes) GetOptionalStringWrapper() *google_protobuf5.StringValue { + if m != nil { + return m.OptionalStringWrapper + } + return nil +} + +func (m *TestAllTypes) GetOptionalBytesWrapper() *google_protobuf5.BytesValue { + if m != nil { + return m.OptionalBytesWrapper + } + return nil +} + +func (m *TestAllTypes) GetRepeatedBoolWrapper() []*google_protobuf5.BoolValue { + if m != nil { + return m.RepeatedBoolWrapper + } + return nil +} + +func (m *TestAllTypes) GetRepeatedInt32Wrapper() []*google_protobuf5.Int32Value { + if m != nil { + return m.RepeatedInt32Wrapper + } + return nil +} + +func (m *TestAllTypes) GetRepeatedInt64Wrapper() []*google_protobuf5.Int64Value { + if m != nil { + return m.RepeatedInt64Wrapper + } + return nil +} + +func (m *TestAllTypes) GetRepeatedUint32Wrapper() []*google_protobuf5.UInt32Value { + if m != nil { + return m.RepeatedUint32Wrapper + } + return nil +} + +func (m *TestAllTypes) GetRepeatedUint64Wrapper() []*google_protobuf5.UInt64Value { + if m != nil { + return m.RepeatedUint64Wrapper + } + return nil +} + +func (m *TestAllTypes) GetRepeatedFloatWrapper() []*google_protobuf5.FloatValue { + if m != nil { + return m.RepeatedFloatWrapper + } + return nil +} + +func (m *TestAllTypes) GetRepeatedDoubleWrapper() []*google_protobuf5.DoubleValue { + if m != nil { + return m.RepeatedDoubleWrapper + } + return nil +} + +func (m *TestAllTypes) GetRepeatedStringWrapper() []*google_protobuf5.StringValue { + if m != nil { + return m.RepeatedStringWrapper + } + return nil +} + +func (m *TestAllTypes) GetRepeatedBytesWrapper() []*google_protobuf5.BytesValue { + if m != nil { + return m.RepeatedBytesWrapper + } + return nil +} + +func (m *TestAllTypes) GetOptionalDuration() *google_protobuf1.Duration { + if m != nil { + return m.OptionalDuration + } + return nil +} + +func (m *TestAllTypes) GetOptionalTimestamp() *google_protobuf4.Timestamp { + if m != nil { + return m.OptionalTimestamp + } + return nil +} + +func (m *TestAllTypes) GetOptionalFieldMask() *google_protobuf2.FieldMask { + if m != nil { + return m.OptionalFieldMask + } + return nil +} + +func (m *TestAllTypes) GetOptionalStruct() *google_protobuf3.Struct { + if m != nil { + return m.OptionalStruct + } + return nil +} + +func (m *TestAllTypes) GetOptionalAny() *google_protobuf.Any { + if m != nil { + return m.OptionalAny + } + return nil +} + +func (m *TestAllTypes) GetOptionalValue() *google_protobuf3.Value { + if m != nil { + return m.OptionalValue + } + return nil +} + +func (m *TestAllTypes) GetRepeatedDuration() []*google_protobuf1.Duration { + if m != nil { + return m.RepeatedDuration + } + return nil +} + +func (m *TestAllTypes) GetRepeatedTimestamp() []*google_protobuf4.Timestamp { + if m != nil { + return m.RepeatedTimestamp + } + return nil +} + +func (m *TestAllTypes) GetRepeatedFieldmask() []*google_protobuf2.FieldMask { + if m != nil { + return m.RepeatedFieldmask + } + return nil +} + +func (m *TestAllTypes) GetRepeatedStruct() []*google_protobuf3.Struct { + if m != nil { + return m.RepeatedStruct + } + return nil +} + +func (m *TestAllTypes) GetRepeatedAny() []*google_protobuf.Any { + if m != nil { + return m.RepeatedAny + } + return nil +} + +func (m *TestAllTypes) GetRepeatedValue() []*google_protobuf3.Value { + if m != nil { + return m.RepeatedValue + } + return nil +} + +func (m *TestAllTypes) GetFieldname1() int32 { + if m != nil { + return m.Fieldname1 + } + return 0 +} + +func (m *TestAllTypes) GetFieldName2() int32 { + if m != nil { + return m.FieldName2 + } + return 0 +} + +func (m *TestAllTypes) GetXFieldName3() int32 { + if m != nil { + return m.XFieldName3 + } + return 0 +} + +func (m *TestAllTypes) GetField_Name4_() int32 { + if m != nil { + return m.Field_Name4_ + } + return 0 +} + +func (m *TestAllTypes) GetField0Name5() int32 { + if m != nil { + return m.Field0Name5 + } + return 0 +} + +func (m *TestAllTypes) GetField_0Name6() int32 { + if m != nil { + return m.Field_0Name6 + } + return 0 +} + +func (m *TestAllTypes) GetFieldName7() int32 { + if m != nil { + return m.FieldName7 + } + return 0 +} + +func (m *TestAllTypes) GetFieldName8() int32 { + if m != nil { + return m.FieldName8 + } + return 0 +} + +func (m *TestAllTypes) GetField_Name9() int32 { + if m != nil { + return m.Field_Name9 + } + return 0 +} + +func (m *TestAllTypes) GetField_Name10() int32 { + if m != nil { + return m.Field_Name10 + } + return 0 +} + +func (m *TestAllTypes) GetFIELD_NAME11() int32 { + if m != nil { + return m.FIELD_NAME11 + } + return 0 +} + +func (m *TestAllTypes) GetFIELDName12() int32 { + if m != nil { + return m.FIELDName12 + } + return 0 +} + +func (m *TestAllTypes) GetXFieldName13() int32 { + if m != nil { + return m.XFieldName13 + } + return 0 +} + +func (m *TestAllTypes) GetX_FieldName14() int32 { + if m != nil { + return m.X_FieldName14 + } + return 0 +} + +func (m *TestAllTypes) GetField_Name15() int32 { + if m != nil { + return m.Field_Name15 + } + return 0 +} + +func (m *TestAllTypes) GetField__Name16() int32 { + if m != nil { + return m.Field__Name16 + } + return 0 +} + +func (m *TestAllTypes) GetFieldName17__() int32 { + if m != nil { + return m.FieldName17__ + } + return 0 +} + +func (m *TestAllTypes) GetFieldName18__() int32 { + if m != nil { + return m.FieldName18__ + } + return 0 +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*TestAllTypes) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _TestAllTypes_OneofMarshaler, _TestAllTypes_OneofUnmarshaler, _TestAllTypes_OneofSizer, []interface{}{ + (*TestAllTypes_OneofUint32)(nil), + (*TestAllTypes_OneofNestedMessage)(nil), + (*TestAllTypes_OneofString)(nil), + (*TestAllTypes_OneofBytes)(nil), + (*TestAllTypes_OneofBool)(nil), + (*TestAllTypes_OneofUint64)(nil), + (*TestAllTypes_OneofFloat)(nil), + (*TestAllTypes_OneofDouble)(nil), + (*TestAllTypes_OneofEnum)(nil), + } +} + +func _TestAllTypes_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*TestAllTypes) + // oneof_field + switch x := m.OneofField.(type) { + case *TestAllTypes_OneofUint32: + _ = b.EncodeVarint(111<<3 | proto.WireVarint) + _ = b.EncodeVarint(uint64(x.OneofUint32)) + case *TestAllTypes_OneofNestedMessage: + _ = b.EncodeVarint(112<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.OneofNestedMessage); err != nil { + return err + } + case *TestAllTypes_OneofString: + _ = b.EncodeVarint(113<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.OneofString) + case *TestAllTypes_OneofBytes: + _ = b.EncodeVarint(114<<3 | proto.WireBytes) + _ = b.EncodeRawBytes(x.OneofBytes) + case *TestAllTypes_OneofBool: + t := uint64(0) + if x.OneofBool { + t = 1 + } + _ = b.EncodeVarint(115<<3 | proto.WireVarint) + _ = b.EncodeVarint(t) + case *TestAllTypes_OneofUint64: + _ = b.EncodeVarint(116<<3 | proto.WireVarint) + _ = b.EncodeVarint(uint64(x.OneofUint64)) + case *TestAllTypes_OneofFloat: + _ = b.EncodeVarint(117<<3 | proto.WireFixed32) + _ = b.EncodeFixed32(uint64(math.Float32bits(x.OneofFloat))) + case *TestAllTypes_OneofDouble: + _ = b.EncodeVarint(118<<3 | proto.WireFixed64) + _ = b.EncodeFixed64(math.Float64bits(x.OneofDouble)) + case *TestAllTypes_OneofEnum: + _ = b.EncodeVarint(119<<3 | proto.WireVarint) + _ = b.EncodeVarint(uint64(x.OneofEnum)) + case nil: + default: + return fmt.Errorf("TestAllTypes.OneofField has unexpected type %T", x) + } + return nil +} + +func _TestAllTypes_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*TestAllTypes) + switch tag { + case 111: // oneof_field.oneof_uint32 + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.OneofField = &TestAllTypes_OneofUint32{uint32(x)} + return true, err + case 112: // oneof_field.oneof_nested_message + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(TestAllTypes_NestedMessage) + err := b.DecodeMessage(msg) + m.OneofField = &TestAllTypes_OneofNestedMessage{msg} + return true, err + case 113: // oneof_field.oneof_string + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.OneofField = &TestAllTypes_OneofString{x} + return true, err + case 114: // oneof_field.oneof_bytes + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeRawBytes(true) + m.OneofField = &TestAllTypes_OneofBytes{x} + return true, err + case 115: // oneof_field.oneof_bool + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.OneofField = &TestAllTypes_OneofBool{x != 0} + return true, err + case 116: // oneof_field.oneof_uint64 + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.OneofField = &TestAllTypes_OneofUint64{x} + return true, err + case 117: // oneof_field.oneof_float + if wire != proto.WireFixed32 { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeFixed32() + m.OneofField = &TestAllTypes_OneofFloat{math.Float32frombits(uint32(x))} + return true, err + case 118: // oneof_field.oneof_double + if wire != proto.WireFixed64 { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeFixed64() + m.OneofField = &TestAllTypes_OneofDouble{math.Float64frombits(x)} + return true, err + case 119: // oneof_field.oneof_enum + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.OneofField = &TestAllTypes_OneofEnum{TestAllTypes_NestedEnum(x)} + return true, err + default: + return false, nil + } +} + +func _TestAllTypes_OneofSizer(msg proto.Message) (n int) { + m := msg.(*TestAllTypes) + // oneof_field + switch x := m.OneofField.(type) { + case *TestAllTypes_OneofUint32: + n += proto.SizeVarint(111<<3 | proto.WireVarint) + n += proto.SizeVarint(uint64(x.OneofUint32)) + case *TestAllTypes_OneofNestedMessage: + s := proto.Size(x.OneofNestedMessage) + n += proto.SizeVarint(112<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *TestAllTypes_OneofString: + n += proto.SizeVarint(113<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.OneofString))) + n += len(x.OneofString) + case *TestAllTypes_OneofBytes: + n += proto.SizeVarint(114<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.OneofBytes))) + n += len(x.OneofBytes) + case *TestAllTypes_OneofBool: + n += proto.SizeVarint(115<<3 | proto.WireVarint) + n += 1 + case *TestAllTypes_OneofUint64: + n += proto.SizeVarint(116<<3 | proto.WireVarint) + n += proto.SizeVarint(uint64(x.OneofUint64)) + case *TestAllTypes_OneofFloat: + n += proto.SizeVarint(117<<3 | proto.WireFixed32) + n += 4 + case *TestAllTypes_OneofDouble: + n += proto.SizeVarint(118<<3 | proto.WireFixed64) + n += 8 + case *TestAllTypes_OneofEnum: + n += proto.SizeVarint(119<<3 | proto.WireVarint) + n += proto.SizeVarint(uint64(x.OneofEnum)) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type TestAllTypes_NestedMessage struct { + A int32 `protobuf:"varint,1,opt,name=a,proto3" json:"a,omitempty"` + Corecursive *TestAllTypes `protobuf:"bytes,2,opt,name=corecursive" json:"corecursive,omitempty"` +} + +func (m *TestAllTypes_NestedMessage) Reset() { *m = TestAllTypes_NestedMessage{} } +func (m *TestAllTypes_NestedMessage) String() string { return proto.CompactTextString(m) } +func (*TestAllTypes_NestedMessage) ProtoMessage() {} +func (*TestAllTypes_NestedMessage) Descriptor() ([]byte, []int) { + return fileDescriptorConformance, []int{2, 0} +} + +func (m *TestAllTypes_NestedMessage) GetA() int32 { + if m != nil { + return m.A + } + return 0 +} + +func (m *TestAllTypes_NestedMessage) GetCorecursive() *TestAllTypes { + if m != nil { + return m.Corecursive + } + return nil +} + +type ForeignMessage struct { + C int32 `protobuf:"varint,1,opt,name=c,proto3" json:"c,omitempty"` +} + +func (m *ForeignMessage) Reset() { *m = ForeignMessage{} } +func (m *ForeignMessage) String() string { return proto.CompactTextString(m) } +func (*ForeignMessage) ProtoMessage() {} +func (*ForeignMessage) Descriptor() ([]byte, []int) { return fileDescriptorConformance, []int{3} } + +func (m *ForeignMessage) GetC() int32 { + if m != nil { + return m.C + } + return 0 +} + +func init() { + proto.RegisterType((*ConformanceRequest)(nil), "conformance.ConformanceRequest") + proto.RegisterType((*ConformanceResponse)(nil), "conformance.ConformanceResponse") + proto.RegisterType((*TestAllTypes)(nil), "conformance.TestAllTypes") + proto.RegisterType((*TestAllTypes_NestedMessage)(nil), "conformance.TestAllTypes.NestedMessage") + proto.RegisterType((*ForeignMessage)(nil), "conformance.ForeignMessage") + proto.RegisterEnum("conformance.WireFormat", WireFormat_name, WireFormat_value) + proto.RegisterEnum("conformance.ForeignEnum", ForeignEnum_name, ForeignEnum_value) + proto.RegisterEnum("conformance.TestAllTypes_NestedEnum", TestAllTypes_NestedEnum_name, TestAllTypes_NestedEnum_value) +} + +func init() { proto.RegisterFile("conformance_proto/conformance.proto", fileDescriptorConformance) } + +var fileDescriptorConformance = []byte{ + // 2737 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x5a, 0xd9, 0x72, 0xdb, 0xc8, + 0xd5, 0x16, 0x08, 0x59, 0x4b, 0x93, 0x92, 0xa8, 0xd6, 0xd6, 0x96, 0x5d, 0x63, 0x58, 0xb2, 0x7f, + 0xd3, 0xf6, 0x8c, 0xac, 0x05, 0x86, 0x65, 0xcf, 0x3f, 0x8e, 0x45, 0x9b, 0xb4, 0xe4, 0x8c, 0x25, + 0x17, 0x64, 0x8d, 0xab, 0x9c, 0x0b, 0x06, 0xa6, 0x20, 0x15, 0xc7, 0x24, 0xc1, 0x01, 0x48, 0x4f, + 0x94, 0xcb, 0xbc, 0x41, 0xf6, 0x7d, 0xbd, 0xcf, 0x7a, 0x93, 0xa4, 0x92, 0xab, 0x54, 0x6e, 0xb2, + 0x27, 0x95, 0x3d, 0x79, 0x85, 0xbc, 0x43, 0x52, 0xbd, 0xa2, 0xbb, 0x01, 0x50, 0xf4, 0x54, 0x0d, + 0x25, 0x1e, 0x7c, 0xfd, 0x9d, 0xd3, 0xe7, 0x1c, 0x7c, 0x2d, 0x1c, 0x18, 0x2c, 0xd7, 0x83, 0xf6, + 0x51, 0x10, 0xb6, 0xbc, 0x76, 0xdd, 0xaf, 0x75, 0xc2, 0xa0, 0x1b, 0xdc, 0x90, 0x2c, 0x2b, 0xc4, + 0x02, 0xf3, 0x92, 0x69, 0xf1, 0xec, 0x71, 0x10, 0x1c, 0x37, 0xfd, 0x1b, 0xe4, 0xd2, 0x8b, 0xde, + 0xd1, 0x0d, 0xaf, 0x7d, 0x42, 0x71, 0x8b, 0x6f, 0xe8, 0x97, 0x0e, 0x7b, 0xa1, 0xd7, 0x6d, 0x04, + 0x6d, 0x76, 0xdd, 0xd2, 0xaf, 0x1f, 0x35, 0xfc, 0xe6, 0x61, 0xad, 0xe5, 0x45, 0x2f, 0x19, 0xe2, + 0xbc, 0x8e, 0x88, 0xba, 0x61, 0xaf, 0xde, 0x65, 0x57, 0x2f, 0xe8, 0x57, 0xbb, 0x8d, 0x96, 0x1f, + 0x75, 0xbd, 0x56, 0x27, 0x2b, 0x80, 0x0f, 0x43, 0xaf, 0xd3, 0xf1, 0xc3, 0x88, 0x5e, 0x5f, 0xfa, + 0x85, 0x01, 0xe0, 0xfd, 0x78, 0x2f, 0xae, 0xff, 0x41, 0xcf, 0x8f, 0xba, 0xf0, 0x3a, 0x28, 0xf2, + 0x15, 0xb5, 0x8e, 0x77, 0xd2, 0x0c, 0xbc, 0x43, 0x64, 0x58, 0x46, 0xa9, 0xb0, 0x3d, 0xe4, 0x4e, + 0xf1, 0x2b, 0x4f, 0xe8, 0x05, 0xb8, 0x0c, 0x0a, 0xef, 0x47, 0x41, 0x5b, 0x00, 0x73, 0x96, 0x51, + 0x1a, 0xdf, 0x1e, 0x72, 0xf3, 0xd8, 0xca, 0x41, 0x7b, 0x60, 0x21, 0xa4, 0xe4, 0xfe, 0x61, 0x2d, + 0xe8, 0x75, 0x3b, 0xbd, 0x6e, 0x8d, 0x78, 0xed, 0x22, 0xd3, 0x32, 0x4a, 0x93, 0xeb, 0x0b, 0x2b, + 0x72, 0x9a, 0x9f, 0x35, 0x42, 0xbf, 0x4a, 0x2e, 0xbb, 0x73, 0x62, 0xdd, 0x1e, 0x59, 0x46, 0xcd, + 0xe5, 0x71, 0x30, 0xca, 0x1c, 0x2e, 0x7d, 0x2a, 0x07, 0x66, 0x94, 0x4d, 0x44, 0x9d, 0xa0, 0x1d, + 0xf9, 0xf0, 0x22, 0xc8, 0x77, 0xbc, 0x30, 0xf2, 0x6b, 0x7e, 0x18, 0x06, 0x21, 0xd9, 0x00, 0x8e, + 0x0b, 0x10, 0x63, 0x05, 0xdb, 0xe0, 0x55, 0x30, 0x15, 0xf9, 0x61, 0xc3, 0x6b, 0x36, 0x3e, 0xc9, + 0x61, 0x23, 0x0c, 0x36, 0x29, 0x2e, 0x50, 0xe8, 0x65, 0x30, 0x11, 0xf6, 0xda, 0x38, 0xc1, 0x0c, + 0xc8, 0xf7, 0x59, 0x60, 0x66, 0x0a, 0x4b, 0x4b, 0x9d, 0x39, 0x68, 0xea, 0x86, 0xd3, 0x52, 0xb7, + 0x08, 0x46, 0xa3, 0x97, 0x8d, 0x4e, 0xc7, 0x3f, 0x44, 0x67, 0xd8, 0x75, 0x6e, 0x28, 0x8f, 0x81, + 0x91, 0xd0, 0x8f, 0x7a, 0xcd, 0xee, 0xd2, 0x7f, 0xaa, 0xa0, 0xf0, 0xd4, 0x8f, 0xba, 0x5b, 0xcd, + 0xe6, 0xd3, 0x93, 0x8e, 0x1f, 0xc1, 0xcb, 0x60, 0x32, 0xe8, 0xe0, 0x5e, 0xf3, 0x9a, 0xb5, 0x46, + 0xbb, 0xbb, 0xb1, 0x4e, 0x12, 0x70, 0xc6, 0x9d, 0xe0, 0xd6, 0x1d, 0x6c, 0xd4, 0x61, 0x8e, 0x4d, + 0xf6, 0x65, 0x2a, 0x30, 0xc7, 0x86, 0x57, 0xc0, 0x94, 0x80, 0xf5, 0x28, 0x1d, 0xde, 0xd5, 0x84, + 0x2b, 0x56, 0x1f, 0x10, 0x6b, 0x02, 0xe8, 0xd8, 0x64, 0x57, 0xc3, 0x2a, 0x50, 0x63, 0x8c, 0x28, + 0x23, 0xde, 0xde, 0x74, 0x0c, 0xdc, 0x4f, 0x32, 0x46, 0x94, 0x11, 0xd7, 0x08, 0xaa, 0x40, 0xc7, + 0x86, 0x57, 0x41, 0x51, 0x00, 0x8f, 0x1a, 0x9f, 0xf0, 0x0f, 0x37, 0xd6, 0xd1, 0xa8, 0x65, 0x94, + 0x46, 0x5d, 0x41, 0x50, 0xa5, 0xe6, 0x24, 0xd4, 0xb1, 0xd1, 0x98, 0x65, 0x94, 0x46, 0x34, 0xa8, + 0x63, 0xc3, 0xeb, 0x60, 0x3a, 0x76, 0xcf, 0x69, 0xc7, 0x2d, 0xa3, 0x34, 0xe5, 0x0a, 0x8e, 0x7d, + 0x66, 0x4f, 0x01, 0x3b, 0x36, 0x02, 0x96, 0x51, 0x2a, 0xea, 0x60, 0xc7, 0x56, 0x52, 0x7f, 0xd4, + 0x0c, 0xbc, 0x2e, 0xca, 0x5b, 0x46, 0x29, 0x17, 0xa7, 0xbe, 0x8a, 0x8d, 0xca, 0xfe, 0x0f, 0x83, + 0xde, 0x8b, 0xa6, 0x8f, 0x0a, 0x96, 0x51, 0x32, 0xe2, 0xfd, 0x3f, 0x20, 0x56, 0xb8, 0x0c, 0xc4, + 0xca, 0xda, 0x8b, 0x20, 0x68, 0xa2, 0x09, 0xcb, 0x28, 0x8d, 0xb9, 0x05, 0x6e, 0x2c, 0x07, 0x41, + 0x53, 0xcd, 0x66, 0x37, 0x6c, 0xb4, 0x8f, 0xd1, 0x24, 0xee, 0x2a, 0x29, 0x9b, 0xc4, 0xaa, 0x44, + 0xf7, 0xe2, 0xa4, 0xeb, 0x47, 0x68, 0x0a, 0xb7, 0x71, 0x1c, 0x5d, 0x19, 0x1b, 0x61, 0x0d, 0x2c, + 0x08, 0x58, 0x9b, 0xde, 0xde, 0x2d, 0x3f, 0x8a, 0xbc, 0x63, 0x1f, 0x41, 0xcb, 0x28, 0xe5, 0xd7, + 0xaf, 0x28, 0x37, 0xb6, 0xdc, 0xa2, 0x2b, 0xbb, 0x04, 0xff, 0x98, 0xc2, 0xdd, 0x39, 0xce, 0xa3, + 0x98, 0xe1, 0x01, 0x40, 0x71, 0x96, 0x82, 0xd0, 0x6f, 0x1c, 0xb7, 0x85, 0x87, 0x19, 0xe2, 0xe1, + 0x9c, 0xe2, 0xa1, 0x4a, 0x31, 0x9c, 0x75, 0x5e, 0x24, 0x53, 0xb1, 0xc3, 0xf7, 0xc0, 0xac, 0x1e, + 0xb7, 0xdf, 0xee, 0xb5, 0xd0, 0x1c, 0x51, 0xa3, 0x4b, 0xa7, 0x05, 0x5d, 0x69, 0xf7, 0x5a, 0x2e, + 0x54, 0x23, 0xc6, 0x36, 0xf8, 0x2e, 0x98, 0x4b, 0x84, 0x4b, 0x88, 0xe7, 0x09, 0x31, 0x4a, 0x8b, + 0x95, 0x90, 0xcd, 0x68, 0x81, 0x12, 0x36, 0x47, 0x62, 0xa3, 0xd5, 0xaa, 0x75, 0x1a, 0x7e, 0xdd, + 0x47, 0x08, 0xd7, 0xac, 0x9c, 0x1b, 0xcb, 0xc5, 0xeb, 0x68, 0xdd, 0x9e, 0xe0, 0xcb, 0xf0, 0x8a, + 0xd4, 0x0a, 0xf5, 0x20, 0x3c, 0x44, 0x67, 0x19, 0xde, 0x88, 0xdb, 0xe1, 0x7e, 0x10, 0x1e, 0xc2, + 0x2a, 0x98, 0x0e, 0xfd, 0x7a, 0x2f, 0x8c, 0x1a, 0xaf, 0x7c, 0x91, 0xd6, 0x73, 0x24, 0xad, 0x67, + 0x33, 0x73, 0xe0, 0x16, 0xc5, 0x1a, 0x9e, 0xce, 0xcb, 0x60, 0x32, 0xf4, 0x3b, 0xbe, 0x87, 0xf3, + 0x48, 0x6f, 0xe6, 0x0b, 0x96, 0x89, 0xd5, 0x86, 0x5b, 0x85, 0xda, 0xc8, 0x30, 0xc7, 0x46, 0x96, + 0x65, 0x62, 0xb5, 0x91, 0x60, 0x54, 0x1b, 0x04, 0x8c, 0xa9, 0xcd, 0x45, 0xcb, 0xc4, 0x6a, 0xc3, + 0xcd, 0xb1, 0xda, 0x28, 0x40, 0xc7, 0x46, 0x4b, 0x96, 0x89, 0xd5, 0x46, 0x06, 0x6a, 0x8c, 0x4c, + 0x6d, 0x96, 0x2d, 0x13, 0xab, 0x0d, 0x37, 0xef, 0x27, 0x19, 0x99, 0xda, 0x5c, 0xb2, 0x4c, 0xac, + 0x36, 0x32, 0x90, 0xaa, 0x8d, 0x00, 0x72, 0x59, 0xb8, 0x6c, 0x99, 0x58, 0x6d, 0xb8, 0x5d, 0x52, + 0x1b, 0x15, 0xea, 0xd8, 0xe8, 0xff, 0x2c, 0x13, 0xab, 0x8d, 0x02, 0xa5, 0x6a, 0x13, 0xbb, 0xe7, + 0xb4, 0x57, 0x2c, 0x13, 0xab, 0x8d, 0x08, 0x40, 0x52, 0x1b, 0x0d, 0xec, 0xd8, 0xa8, 0x64, 0x99, + 0x58, 0x6d, 0x54, 0x30, 0x55, 0x9b, 0x38, 0x08, 0xa2, 0x36, 0x57, 0x2d, 0x13, 0xab, 0x8d, 0x08, + 0x81, 0xab, 0x8d, 0x80, 0x31, 0xb5, 0xb9, 0x66, 0x99, 0x58, 0x6d, 0xb8, 0x39, 0x56, 0x1b, 0x01, + 0x24, 0x6a, 0x73, 0xdd, 0x32, 0xb1, 0xda, 0x70, 0x23, 0x57, 0x9b, 0x38, 0x42, 0xaa, 0x36, 0x6f, + 0x5a, 0x26, 0x56, 0x1b, 0x11, 0x9f, 0x50, 0x9b, 0x98, 0x8d, 0xa8, 0xcd, 0x5b, 0x96, 0x89, 0xd5, + 0x46, 0xd0, 0x71, 0xb5, 0x11, 0x30, 0x4d, 0x6d, 0x56, 0x2d, 0xf3, 0xb5, 0xd4, 0x86, 0xf3, 0x24, + 0xd4, 0x26, 0xce, 0x92, 0xa6, 0x36, 0x6b, 0xc4, 0x43, 0x7f, 0xb5, 0x11, 0xc9, 0x4c, 0xa8, 0x8d, + 0x1e, 0x37, 0x11, 0x85, 0x0d, 0xcb, 0x1c, 0x5c, 0x6d, 0xd4, 0x88, 0xb9, 0xda, 0x24, 0xc2, 0x25, + 0xc4, 0x36, 0x21, 0xee, 0xa3, 0x36, 0x5a, 0xa0, 0x5c, 0x6d, 0xb4, 0x6a, 0x31, 0xb5, 0x71, 0x70, + 0xcd, 0xa8, 0xda, 0xa8, 0x75, 0x13, 0x6a, 0x23, 0xd6, 0x11, 0xb5, 0xb9, 0xc5, 0xf0, 0x46, 0xdc, + 0x0e, 0x44, 0x6d, 0x9e, 0x82, 0xa9, 0x96, 0xd7, 0xa1, 0x02, 0xc1, 0x64, 0x62, 0x93, 0x24, 0xf5, + 0xcd, 0xec, 0x0c, 0x3c, 0xf6, 0x3a, 0x44, 0x3b, 0xc8, 0x47, 0xa5, 0xdd, 0x0d, 0x4f, 0xdc, 0x89, + 0x96, 0x6c, 0x93, 0x58, 0x1d, 0x9b, 0xa9, 0xca, 0xed, 0xc1, 0x58, 0x1d, 0x9b, 0x7c, 0x28, 0xac, + 0xcc, 0x06, 0x9f, 0x83, 0x69, 0xcc, 0x4a, 0xe5, 0x87, 0xab, 0xd0, 0x1d, 0xc2, 0xbb, 0xd2, 0x97, + 0x97, 0x4a, 0x13, 0xfd, 0xa4, 0xcc, 0x38, 0x3c, 0xd9, 0x2a, 0x73, 0x3b, 0x36, 0x17, 0xae, 0xb7, + 0x07, 0xe4, 0x76, 0x6c, 0xfa, 0xa9, 0x72, 0x73, 0x2b, 0xe7, 0xa6, 0x22, 0xc7, 0xb5, 0xee, 0xff, + 0x07, 0xe0, 0xa6, 0x02, 0xb8, 0xaf, 0xc5, 0x2d, 0x5b, 0x65, 0x6e, 0xc7, 0xe6, 0xf2, 0xf8, 0xce, + 0x80, 0xdc, 0x8e, 0xbd, 0xaf, 0xc5, 0x2d, 0x5b, 0xe1, 0xc7, 0xc1, 0x0c, 0xe6, 0x66, 0xda, 0x26, + 0x24, 0xf5, 0x2e, 0x61, 0x5f, 0xed, 0xcb, 0xce, 0x74, 0x96, 0xfd, 0xa0, 0xfc, 0x38, 0x50, 0xd5, + 0xae, 0x78, 0x70, 0x6c, 0xa1, 0xc4, 0x1f, 0x19, 0xd4, 0x83, 0x63, 0xb3, 0x1f, 0x9a, 0x07, 0x61, + 0x87, 0x47, 0x60, 0x8e, 0xe4, 0x87, 0x6f, 0x42, 0x28, 0xf8, 0x3d, 0xe2, 0x63, 0xbd, 0x7f, 0x8e, + 0x18, 0x98, 0xff, 0xa4, 0x5e, 0x70, 0xc8, 0xfa, 0x15, 0xd5, 0x0f, 0xae, 0x04, 0xdf, 0xcb, 0xd6, + 0xc0, 0x7e, 0x1c, 0x9b, 0xff, 0xd4, 0xfd, 0xc4, 0x57, 0xd4, 0xfb, 0x95, 0x1e, 0x1a, 0xe5, 0x41, + 0xef, 0x57, 0x72, 0x9c, 0x68, 0xf7, 0x2b, 0x3d, 0x62, 0x9e, 0x81, 0x62, 0xcc, 0xca, 0xce, 0x98, + 0xfb, 0x84, 0xf6, 0xad, 0xd3, 0x69, 0xe9, 0xe9, 0x43, 0x79, 0x27, 0x5b, 0x8a, 0x11, 0xee, 0x02, + 0xec, 0x89, 0x9c, 0x46, 0xf4, 0x48, 0x7a, 0x40, 0x58, 0xaf, 0xf5, 0x65, 0xc5, 0xe7, 0x14, 0xfe, + 0x9f, 0x52, 0xe6, 0x5b, 0xb1, 0x45, 0xb4, 0x3b, 0x95, 0x42, 0x76, 0x7e, 0x55, 0x06, 0x69, 0x77, + 0x02, 0xa5, 0x9f, 0x52, 0xbb, 0x4b, 0x56, 0x9e, 0x04, 0xc6, 0x4d, 0x8f, 0xbc, 0xea, 0x00, 0x49, + 0xa0, 0xcb, 0xc9, 0x69, 0x18, 0x27, 0x41, 0x32, 0xc2, 0x0e, 0x38, 0x2b, 0x11, 0x6b, 0x87, 0xe4, + 0x43, 0xe2, 0xe1, 0xe6, 0x00, 0x1e, 0x94, 0x63, 0x91, 0x7a, 0x9a, 0x6f, 0xa5, 0x5e, 0x84, 0x11, + 0x58, 0x94, 0x3c, 0xea, 0xa7, 0xe6, 0x36, 0x71, 0xe9, 0x0c, 0xe0, 0x52, 0x3d, 0x33, 0xa9, 0xcf, + 0x85, 0x56, 0xfa, 0x55, 0x78, 0x0c, 0xe6, 0x93, 0xdb, 0x24, 0x47, 0xdf, 0xce, 0x20, 0xf7, 0x80, + 0xb4, 0x0d, 0x7c, 0xf4, 0x49, 0xf7, 0x80, 0x76, 0x05, 0xbe, 0x0f, 0x16, 0x52, 0x76, 0x47, 0x3c, + 0x3d, 0x22, 0x9e, 0x36, 0x06, 0xdf, 0x5a, 0xec, 0x6a, 0xb6, 0x95, 0x72, 0x09, 0x2e, 0x83, 0x42, + 0xd0, 0xf6, 0x83, 0x23, 0x7e, 0xdc, 0x04, 0xf8, 0x11, 0x7b, 0x7b, 0xc8, 0xcd, 0x13, 0x2b, 0x3b, + 0x3c, 0x3e, 0x06, 0x66, 0x29, 0x48, 0xab, 0x6d, 0xe7, 0xb5, 0x1e, 0xb7, 0xb6, 0x87, 0x5c, 0x48, + 0x68, 0xd4, 0x5a, 0x8a, 0x08, 0x58, 0xb7, 0x7f, 0xc0, 0x27, 0x12, 0xc4, 0xca, 0x7a, 0xf7, 0x22, + 0xa0, 0x5f, 0x59, 0xdb, 0x86, 0x6c, 0xbc, 0x01, 0x88, 0x91, 0x76, 0xe1, 0x05, 0x00, 0x18, 0x04, + 0xdf, 0x87, 0x11, 0x7e, 0x10, 0xdd, 0x1e, 0x72, 0xc7, 0x29, 0x02, 0xdf, 0x5b, 0xca, 0x56, 0x1d, + 0x1b, 0x75, 0x2d, 0xa3, 0x34, 0xac, 0x6c, 0xd5, 0xb1, 0x63, 0x47, 0x54, 0x7b, 0x7a, 0xf8, 0xf1, + 0x58, 0x38, 0xa2, 0x62, 0x22, 0x78, 0x98, 0x90, 0xbc, 0xc2, 0x8f, 0xc6, 0x82, 0x87, 0x09, 0x43, + 0x85, 0x47, 0x43, 0xca, 0xf6, 0xe1, 0xe0, 0x8f, 0x78, 0x22, 0x66, 0x52, 0x9e, 0x3d, 0xe9, 0x69, + 0x8c, 0x88, 0x0c, 0x9b, 0xa6, 0xa1, 0x5f, 0x19, 0x24, 0xf7, 0x8b, 0x2b, 0x74, 0xdc, 0xb6, 0xc2, + 0xe7, 0x3c, 0x2b, 0x78, 0xab, 0xef, 0x79, 0xcd, 0x9e, 0x1f, 0x3f, 0xa6, 0x61, 0xd3, 0x33, 0xba, + 0x0e, 0xba, 0x60, 0x5e, 0x9d, 0xd1, 0x08, 0xc6, 0x5f, 0x1b, 0xec, 0xd1, 0x56, 0x67, 0x24, 0x7a, + 0x47, 0x29, 0x67, 0x95, 0x49, 0x4e, 0x06, 0xa7, 0x63, 0x0b, 0xce, 0xdf, 0xf4, 0xe1, 0x74, 0xec, + 0x24, 0xa7, 0x63, 0x73, 0xce, 0x03, 0xe9, 0x21, 0xbf, 0xa7, 0x06, 0xfa, 0x5b, 0x4a, 0x7a, 0x3e, + 0x41, 0x7a, 0x20, 0x45, 0x3a, 0xa7, 0x0e, 0x89, 0xb2, 0x68, 0xa5, 0x58, 0x7f, 0xd7, 0x8f, 0x96, + 0x07, 0x3b, 0xa7, 0x8e, 0x94, 0xd2, 0x32, 0x40, 0x1a, 0x47, 0xb0, 0xfe, 0x3e, 0x2b, 0x03, 0xa4, + 0x97, 0xb4, 0x0c, 0x10, 0x5b, 0x5a, 0xa8, 0xb4, 0xd3, 0x04, 0xe9, 0x1f, 0xb2, 0x42, 0xa5, 0xcd, + 0xa7, 0x85, 0x4a, 0x8d, 0x69, 0xb4, 0x4c, 0x61, 0x38, 0xed, 0x1f, 0xb3, 0x68, 0xe9, 0x4d, 0xa8, + 0xd1, 0x52, 0x63, 0x5a, 0x06, 0xc8, 0x3d, 0x2a, 0x58, 0xff, 0x94, 0x95, 0x01, 0x72, 0xdb, 0x6a, + 0x19, 0x20, 0x36, 0xce, 0xb9, 0x27, 0x3d, 0x1c, 0x28, 0xcd, 0xff, 0x67, 0x83, 0xc8, 0x60, 0xdf, + 0xe6, 0x97, 0x1f, 0x0a, 0xa5, 0x20, 0xd5, 0x91, 0x81, 0x60, 0xfc, 0x8b, 0xc1, 0x9e, 0xb4, 0xfa, + 0x35, 0xbf, 0x32, 0x58, 0xc8, 0xe0, 0x94, 0x1a, 0xea, 0xaf, 0x7d, 0x38, 0x45, 0xf3, 0x2b, 0x53, + 0x08, 0xa9, 0x46, 0xda, 0x30, 0x42, 0x90, 0xfe, 0x8d, 0x92, 0x9e, 0xd2, 0xfc, 0xea, 0xcc, 0x22, + 0x8b, 0x56, 0x8a, 0xf5, 0xef, 0xfd, 0x68, 0x45, 0xf3, 0xab, 0x13, 0x8e, 0xb4, 0x0c, 0xa8, 0xcd, + 0xff, 0x8f, 0xac, 0x0c, 0xc8, 0xcd, 0xaf, 0x0c, 0x03, 0xd2, 0x42, 0xd5, 0x9a, 0xff, 0x9f, 0x59, + 0xa1, 0x2a, 0xcd, 0xaf, 0x8e, 0x0e, 0xd2, 0x68, 0xb5, 0xe6, 0xff, 0x57, 0x16, 0xad, 0xd2, 0xfc, + 0xea, 0xb3, 0x68, 0x5a, 0x06, 0xd4, 0xe6, 0xff, 0x77, 0x56, 0x06, 0xe4, 0xe6, 0x57, 0x06, 0x0e, + 0x9c, 0xf3, 0xa1, 0x34, 0xd7, 0xe5, 0xef, 0x70, 0xd0, 0x77, 0x73, 0x6c, 0x4e, 0x96, 0xd8, 0x3b, + 0x43, 0xc4, 0x33, 0x5f, 0x6e, 0x81, 0x8f, 0x80, 0x18, 0x1a, 0xd6, 0xc4, 0xcb, 0x1a, 0xf4, 0xbd, + 0x5c, 0xc6, 0xf9, 0xf1, 0x94, 0x43, 0x5c, 0xe1, 0x5f, 0x98, 0xe0, 0x47, 0xc1, 0x8c, 0x34, 0xc4, + 0xe6, 0x2f, 0x8e, 0xd0, 0xf7, 0xb3, 0xc8, 0xaa, 0x18, 0xf3, 0xd8, 0x8b, 0x5e, 0xc6, 0x64, 0xc2, + 0x04, 0xb7, 0xd4, 0xb9, 0x70, 0xaf, 0xde, 0x45, 0x3f, 0xa0, 0x44, 0x0b, 0x69, 0x45, 0xe8, 0xd5, + 0xbb, 0xca, 0xc4, 0xb8, 0x57, 0xef, 0xc2, 0x4d, 0x20, 0x66, 0x8b, 0x35, 0xaf, 0x7d, 0x82, 0x7e, + 0x48, 0xd7, 0xcf, 0x26, 0xd6, 0x6f, 0xb5, 0x4f, 0xdc, 0x3c, 0x87, 0x6e, 0xb5, 0x4f, 0xe0, 0x5d, + 0x69, 0xd6, 0xfc, 0x0a, 0x97, 0x01, 0xfd, 0x88, 0xae, 0x9d, 0x4f, 0xac, 0xa5, 0x55, 0x12, 0xd3, + 0x4d, 0xf2, 0x15, 0x97, 0x27, 0x6e, 0x50, 0x5e, 0x9e, 0x1f, 0xe7, 0x48, 0xb5, 0xfb, 0x95, 0x47, + 0xf4, 0xa5, 0x54, 0x1e, 0x41, 0x14, 0x97, 0xe7, 0x27, 0xb9, 0x0c, 0x85, 0x93, 0xca, 0xc3, 0x97, + 0xc5, 0xe5, 0x91, 0xb9, 0x48, 0x79, 0x48, 0x75, 0x7e, 0x9a, 0xc5, 0x25, 0x55, 0x27, 0x1e, 0x0a, + 0xb2, 0x55, 0xb8, 0x3a, 0xf2, 0xad, 0x82, 0xab, 0xf3, 0x4b, 0x4a, 0x94, 0x5d, 0x1d, 0xe9, 0xee, + 0x60, 0xd5, 0x11, 0x14, 0xb8, 0x3a, 0x3f, 0xa3, 0xeb, 0x33, 0xaa, 0xc3, 0xa1, 0xac, 0x3a, 0x62, + 0x25, 0xad, 0xce, 0xcf, 0xe9, 0xda, 0xcc, 0xea, 0x70, 0x38, 0xad, 0xce, 0x05, 0x00, 0xc8, 0xfe, + 0xdb, 0x5e, 0xcb, 0x5f, 0x43, 0x9f, 0x36, 0xc9, 0x6b, 0x28, 0xc9, 0x04, 0x2d, 0x90, 0xa7, 0xfd, + 0x8b, 0xbf, 0xae, 0xa3, 0xcf, 0xc8, 0x88, 0x5d, 0x6c, 0x82, 0x17, 0x41, 0xa1, 0x16, 0x43, 0x36, + 0xd0, 0x67, 0x19, 0xa4, 0xca, 0x21, 0x1b, 0x70, 0x09, 0x4c, 0x50, 0x04, 0x81, 0xd8, 0x35, 0xf4, + 0x39, 0x9d, 0x86, 0xfc, 0x3d, 0x49, 0xbe, 0xad, 0x62, 0xc8, 0x4d, 0xf4, 0x79, 0x8a, 0x90, 0x6d, + 0x70, 0x99, 0xd3, 0xac, 0x12, 0x1e, 0x07, 0x7d, 0x41, 0x01, 0x61, 0x1e, 0x47, 0xec, 0x08, 0x7f, + 0xbb, 0x85, 0xbe, 0xa8, 0x3b, 0xba, 0x85, 0x01, 0x22, 0xb4, 0x4d, 0xf4, 0x25, 0x3d, 0xda, 0xcd, + 0x78, 0xcb, 0xf8, 0xeb, 0x6d, 0xf4, 0x65, 0x9d, 0xe2, 0x36, 0x5c, 0x02, 0x85, 0xaa, 0x40, 0xac, + 0xad, 0xa2, 0xaf, 0xb0, 0x38, 0x04, 0xc9, 0xda, 0x2a, 0xc1, 0xec, 0x54, 0xde, 0x7d, 0x50, 0xdb, + 0xdd, 0x7a, 0x5c, 0x59, 0x5b, 0x43, 0x5f, 0xe5, 0x18, 0x6c, 0xa4, 0xb6, 0x18, 0x43, 0x72, 0xbd, + 0x8e, 0xbe, 0xa6, 0x60, 0x88, 0x0d, 0x5e, 0x02, 0x93, 0x35, 0x29, 0xbf, 0x6b, 0x1b, 0xe8, 0xeb, + 0x09, 0x6f, 0x1b, 0x14, 0x55, 0x8d, 0x51, 0x36, 0xfa, 0x46, 0x02, 0x65, 0xc7, 0x09, 0xa4, 0xa0, + 0x9b, 0xe8, 0x9b, 0x72, 0x02, 0x09, 0x48, 0xca, 0x32, 0xdd, 0x9d, 0x83, 0xbe, 0x95, 0x00, 0x39, + 0xd8, 0x9f, 0x14, 0xd3, 0xad, 0x5a, 0x0d, 0x7d, 0x3b, 0x81, 0xba, 0x85, 0x51, 0x52, 0x4c, 0x9b, + 0xb5, 0x1a, 0xfa, 0x4e, 0x22, 0xaa, 0xcd, 0xc5, 0xe7, 0x60, 0x42, 0x7d, 0xd0, 0x29, 0x00, 0xc3, + 0x63, 0x6f, 0x44, 0x0d, 0x0f, 0xbe, 0x0d, 0xf2, 0xf5, 0x40, 0xbc, 0xd4, 0x40, 0xb9, 0xd3, 0x5e, + 0x80, 0xc8, 0xe8, 0xc5, 0x7b, 0x00, 0x26, 0x87, 0x94, 0xb0, 0x08, 0xcc, 0x97, 0xfe, 0x09, 0x73, + 0x81, 0x7f, 0x85, 0xb3, 0xe0, 0x0c, 0xbd, 0x7d, 0x72, 0xc4, 0x46, 0xbf, 0xdc, 0xc9, 0x6d, 0x1a, + 0x31, 0x83, 0x3c, 0x90, 0x94, 0x19, 0xcc, 0x14, 0x06, 0x53, 0x66, 0x28, 0x83, 0xd9, 0xb4, 0xd1, + 0xa3, 0xcc, 0x31, 0x91, 0xc2, 0x31, 0x91, 0xce, 0xa1, 0x8c, 0x18, 0x65, 0x8e, 0xe1, 0x14, 0x8e, + 0xe1, 0x24, 0x47, 0x62, 0x94, 0x28, 0x73, 0x4c, 0xa7, 0x70, 0x4c, 0xa7, 0x73, 0x28, 0x23, 0x43, + 0x99, 0x03, 0xa6, 0x70, 0x40, 0x99, 0xe3, 0x01, 0x98, 0x4f, 0x1f, 0x0c, 0xca, 0x2c, 0xa3, 0x29, + 0x2c, 0xa3, 0x19, 0x2c, 0xea, 0xf0, 0x4f, 0x66, 0x19, 0x49, 0x61, 0x19, 0x91, 0x59, 0xaa, 0x00, + 0x65, 0x8d, 0xf7, 0x64, 0x9e, 0xa9, 0x14, 0x9e, 0xa9, 0x2c, 0x1e, 0x6d, 0x7c, 0x27, 0xf3, 0x14, + 0x53, 0x78, 0x8a, 0xa9, 0xdd, 0x26, 0x0f, 0xe9, 0x4e, 0xeb, 0xd7, 0x9c, 0xcc, 0xb0, 0x05, 0x66, + 0x52, 0xe6, 0x71, 0xa7, 0x51, 0x18, 0x32, 0xc5, 0x5d, 0x50, 0xd4, 0x87, 0x6f, 0xf2, 0xfa, 0xb1, + 0x94, 0xf5, 0x63, 0x29, 0x4d, 0xa2, 0x0f, 0xda, 0x64, 0x8e, 0xf1, 0x14, 0x8e, 0xf1, 0xe4, 0x36, + 0xf4, 0x89, 0xda, 0x69, 0x14, 0x05, 0x99, 0x22, 0x04, 0xe7, 0xfa, 0x8c, 0xcc, 0x52, 0xa8, 0xde, + 0x91, 0xa9, 0x5e, 0xe3, 0x7d, 0x95, 0xe4, 0xf3, 0x18, 0x9c, 0xef, 0x37, 0x33, 0x4b, 0x71, 0xba, + 0xa6, 0x3a, 0xed, 0xfb, 0x0a, 0x4b, 0x72, 0xd4, 0xa4, 0x0d, 0x97, 0x36, 0x2b, 0x4b, 0x71, 0x72, + 0x47, 0x76, 0x32, 0xe8, 0x4b, 0x2d, 0xc9, 0x9b, 0x07, 0xce, 0x66, 0xce, 0xcb, 0x52, 0xdc, 0xad, + 0xa8, 0xee, 0xb2, 0x5f, 0x75, 0xc5, 0x2e, 0x96, 0x6e, 0x03, 0x20, 0x4d, 0xf6, 0x46, 0x81, 0x59, + 0xdd, 0xdb, 0x2b, 0x0e, 0xe1, 0x5f, 0xca, 0x5b, 0x6e, 0xd1, 0xa0, 0xbf, 0x3c, 0x2f, 0xe6, 0xb0, + 0xbb, 0xdd, 0xca, 0xc3, 0xe2, 0x7f, 0xf9, 0x7f, 0x46, 0x79, 0x42, 0x8c, 0xa2, 0xf0, 0xa9, 0xb2, + 0xf4, 0x06, 0x98, 0xd4, 0x06, 0x92, 0x05, 0x60, 0xd4, 0xf9, 0x81, 0x52, 0xbf, 0x76, 0x13, 0x80, + 0xf8, 0xdf, 0x30, 0xc1, 0x29, 0x90, 0x3f, 0xd8, 0xdd, 0x7f, 0x52, 0xb9, 0xbf, 0x53, 0xdd, 0xa9, + 0x3c, 0x28, 0x0e, 0xc1, 0x02, 0x18, 0x7b, 0xe2, 0xee, 0x3d, 0xdd, 0x2b, 0x1f, 0x54, 0x8b, 0x06, + 0x1c, 0x03, 0xc3, 0x8f, 0xf6, 0xf7, 0x76, 0x8b, 0xb9, 0x6b, 0xf7, 0x40, 0x5e, 0x9e, 0x07, 0x4e, + 0x81, 0x7c, 0x75, 0xcf, 0xad, 0xec, 0x3c, 0xdc, 0xad, 0xd1, 0x48, 0x25, 0x03, 0x8d, 0x58, 0x31, + 0x3c, 0x2f, 0xe6, 0xca, 0x17, 0xc1, 0x85, 0x7a, 0xd0, 0x4a, 0xfc, 0x61, 0x26, 0x25, 0xe7, 0xc5, + 0x08, 0xb1, 0x6e, 0xfc, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x33, 0xc2, 0x0c, 0xb6, 0xeb, 0x26, 0x00, + 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance_proto/conformance.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance_proto/conformance.proto new file mode 100644 index 00000000000..95a8fd135f7 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance_proto/conformance.proto @@ -0,0 +1,285 @@ +// 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. + +syntax = "proto3"; +package conformance; +option java_package = "com.google.protobuf.conformance"; + +import "google/protobuf/any.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +// This defines the conformance testing protocol. This protocol exists between +// the conformance test suite itself and the code being tested. For each test, +// the suite will send a ConformanceRequest message and expect a +// ConformanceResponse message. +// +// You can either run the tests in two different ways: +// +// 1. in-process (using the interface in conformance_test.h). +// +// 2. as a sub-process communicating over a pipe. Information about how to +// do this is in conformance_test_runner.cc. +// +// Pros/cons of the two approaches: +// +// - running as a sub-process is much simpler for languages other than C/C++. +// +// - running as a sub-process may be more tricky in unusual environments like +// iOS apps, where fork/stdin/stdout are not available. + +enum WireFormat { + UNSPECIFIED = 0; + PROTOBUF = 1; + JSON = 2; +} + +// Represents a single test case's input. The testee should: +// +// 1. parse this proto (which should always succeed) +// 2. parse the protobuf or JSON payload in "payload" (which may fail) +// 3. if the parse succeeded, serialize the message in the requested format. +message ConformanceRequest { + // The payload (whether protobuf of JSON) is always for a TestAllTypes proto + // (see below). + oneof payload { + bytes protobuf_payload = 1; + string json_payload = 2; + } + + // Which format should the testee serialize its message to? + WireFormat requested_output_format = 3; +} + +// Represents a single test case's output. +message ConformanceResponse { + oneof result { + // This string should be set to indicate parsing failed. The string can + // provide more information about the parse error if it is available. + // + // Setting this string does not necessarily mean the testee failed the + // test. Some of the test cases are intentionally invalid input. + string parse_error = 1; + + // If the input was successfully parsed but errors occurred when + // serializing it to the requested output format, set the error message in + // this field. + string serialize_error = 6; + + // This should be set if some other error occurred. This will always + // indicate that the test failed. The string can provide more information + // about the failure. + string runtime_error = 2; + + // If the input was successfully parsed and the requested output was + // protobuf, serialize it to protobuf and set it in this field. + bytes protobuf_payload = 3; + + // If the input was successfully parsed and the requested output was JSON, + // serialize to JSON and set it in this field. + string json_payload = 4; + + // For when the testee skipped the test, likely because a certain feature + // wasn't supported, like JSON input/output. + string skipped = 5; + } +} + +// This proto includes every type of field in both singular and repeated +// forms. +message TestAllTypes { + message NestedMessage { + int32 a = 1; + TestAllTypes corecursive = 2; + } + + enum NestedEnum { + FOO = 0; + BAR = 1; + BAZ = 2; + NEG = -1; // Intentionally negative. + } + + // Singular + int32 optional_int32 = 1; + int64 optional_int64 = 2; + uint32 optional_uint32 = 3; + uint64 optional_uint64 = 4; + sint32 optional_sint32 = 5; + sint64 optional_sint64 = 6; + fixed32 optional_fixed32 = 7; + fixed64 optional_fixed64 = 8; + sfixed32 optional_sfixed32 = 9; + sfixed64 optional_sfixed64 = 10; + float optional_float = 11; + double optional_double = 12; + bool optional_bool = 13; + string optional_string = 14; + bytes optional_bytes = 15; + + NestedMessage optional_nested_message = 18; + ForeignMessage optional_foreign_message = 19; + + NestedEnum optional_nested_enum = 21; + ForeignEnum optional_foreign_enum = 22; + + string optional_string_piece = 24 [ctype=STRING_PIECE]; + string optional_cord = 25 [ctype=CORD]; + + TestAllTypes recursive_message = 27; + + // Repeated + repeated int32 repeated_int32 = 31; + repeated int64 repeated_int64 = 32; + repeated uint32 repeated_uint32 = 33; + repeated uint64 repeated_uint64 = 34; + repeated sint32 repeated_sint32 = 35; + repeated sint64 repeated_sint64 = 36; + repeated fixed32 repeated_fixed32 = 37; + repeated fixed64 repeated_fixed64 = 38; + repeated sfixed32 repeated_sfixed32 = 39; + repeated sfixed64 repeated_sfixed64 = 40; + repeated float repeated_float = 41; + repeated double repeated_double = 42; + repeated bool repeated_bool = 43; + repeated string repeated_string = 44; + repeated bytes repeated_bytes = 45; + + repeated NestedMessage repeated_nested_message = 48; + repeated ForeignMessage repeated_foreign_message = 49; + + repeated NestedEnum repeated_nested_enum = 51; + repeated ForeignEnum repeated_foreign_enum = 52; + + repeated string repeated_string_piece = 54 [ctype=STRING_PIECE]; + repeated string repeated_cord = 55 [ctype=CORD]; + + // Map + map < int32, int32> map_int32_int32 = 56; + map < int64, int64> map_int64_int64 = 57; + map < uint32, uint32> map_uint32_uint32 = 58; + map < uint64, uint64> map_uint64_uint64 = 59; + map < sint32, sint32> map_sint32_sint32 = 60; + map < sint64, sint64> map_sint64_sint64 = 61; + map < fixed32, fixed32> map_fixed32_fixed32 = 62; + map < fixed64, fixed64> map_fixed64_fixed64 = 63; + map map_sfixed32_sfixed32 = 64; + map map_sfixed64_sfixed64 = 65; + map < int32, float> map_int32_float = 66; + map < int32, double> map_int32_double = 67; + map < bool, bool> map_bool_bool = 68; + map < string, string> map_string_string = 69; + map < string, bytes> map_string_bytes = 70; + map < string, NestedMessage> map_string_nested_message = 71; + map < string, ForeignMessage> map_string_foreign_message = 72; + map < string, NestedEnum> map_string_nested_enum = 73; + map < string, ForeignEnum> map_string_foreign_enum = 74; + + oneof oneof_field { + uint32 oneof_uint32 = 111; + NestedMessage oneof_nested_message = 112; + string oneof_string = 113; + bytes oneof_bytes = 114; + bool oneof_bool = 115; + uint64 oneof_uint64 = 116; + float oneof_float = 117; + double oneof_double = 118; + NestedEnum oneof_enum = 119; + } + + // Well-known types + google.protobuf.BoolValue optional_bool_wrapper = 201; + google.protobuf.Int32Value optional_int32_wrapper = 202; + google.protobuf.Int64Value optional_int64_wrapper = 203; + google.protobuf.UInt32Value optional_uint32_wrapper = 204; + google.protobuf.UInt64Value optional_uint64_wrapper = 205; + google.protobuf.FloatValue optional_float_wrapper = 206; + google.protobuf.DoubleValue optional_double_wrapper = 207; + google.protobuf.StringValue optional_string_wrapper = 208; + google.protobuf.BytesValue optional_bytes_wrapper = 209; + + repeated google.protobuf.BoolValue repeated_bool_wrapper = 211; + repeated google.protobuf.Int32Value repeated_int32_wrapper = 212; + repeated google.protobuf.Int64Value repeated_int64_wrapper = 213; + repeated google.protobuf.UInt32Value repeated_uint32_wrapper = 214; + repeated google.protobuf.UInt64Value repeated_uint64_wrapper = 215; + repeated google.protobuf.FloatValue repeated_float_wrapper = 216; + repeated google.protobuf.DoubleValue repeated_double_wrapper = 217; + repeated google.protobuf.StringValue repeated_string_wrapper = 218; + repeated google.protobuf.BytesValue repeated_bytes_wrapper = 219; + + google.protobuf.Duration optional_duration = 301; + google.protobuf.Timestamp optional_timestamp = 302; + google.protobuf.FieldMask optional_field_mask = 303; + google.protobuf.Struct optional_struct = 304; + google.protobuf.Any optional_any = 305; + google.protobuf.Value optional_value = 306; + + repeated google.protobuf.Duration repeated_duration = 311; + repeated google.protobuf.Timestamp repeated_timestamp = 312; + repeated google.protobuf.FieldMask repeated_fieldmask = 313; + repeated google.protobuf.Struct repeated_struct = 324; + repeated google.protobuf.Any repeated_any = 315; + repeated google.protobuf.Value repeated_value = 316; + + // Test field-name-to-JSON-name convention. + // (protobuf says names can be any valid C/C++ identifier.) + int32 fieldname1 = 401; + int32 field_name2 = 402; + int32 _field_name3 = 403; + int32 field__name4_ = 404; + int32 field0name5 = 405; + int32 field_0_name6 = 406; + int32 fieldName7 = 407; + int32 FieldName8 = 408; + int32 field_Name9 = 409; + int32 Field_Name10 = 410; + int32 FIELD_NAME11 = 411; + int32 FIELD_name12 = 412; + int32 __field_name13 = 413; + int32 __Field_name14 = 414; + int32 field__name15 = 415; + int32 field__Name16 = 416; + int32 field_name17__ = 417; + int32 Field_name18__ = 418; +} + +message ForeignMessage { + int32 c = 1; +} + +enum ForeignEnum { + FOREIGN_FOO = 0; + FOREIGN_BAR = 1; + FOREIGN_BAZ = 2; +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/codec/codec.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/codec/codec.go new file mode 100644 index 00000000000..91d10fe7f30 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/codec/codec.go @@ -0,0 +1,91 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2015, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package codec + +import ( + "github.com/gogo/protobuf/proto" +) + +type Codec interface { + Marshal(v interface{}) ([]byte, error) + Unmarshal(data []byte, v interface{}) error + String() string +} + +type marshaler interface { + MarshalTo(data []byte) (n int, err error) +} + +func getSize(v interface{}) (int, bool) { + if sz, ok := v.(interface { + Size() (n int) + }); ok { + return sz.Size(), true + } else if sz, ok := v.(interface { + ProtoSize() (n int) + }); ok { + return sz.ProtoSize(), true + } else { + return 0, false + } +} + +type codec struct { + buf []byte +} + +func (this *codec) String() string { + return "proto" +} + +func New(size int) Codec { + return &codec{make([]byte, size)} +} + +func (this *codec) Marshal(v interface{}) ([]byte, error) { + if m, ok := v.(marshaler); ok { + n, ok := getSize(v) + if !ok { + return proto.Marshal(v.(proto.Message)) + } + if n > len(this.buf) { + this.buf = make([]byte, n) + } + _, err := m.MarshalTo(this.buf) + if err != nil { + return nil, err + } + return this.buf[:n], nil + } + return proto.Marshal(v.(proto.Message)) +} + +func (this *codec) Unmarshal(data []byte, v interface{}) error { + return proto.Unmarshal(data, v.(proto.Message)) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/doc.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/doc.go new file mode 100644 index 00000000000..5ecfae11351 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/doc.go @@ -0,0 +1,168 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +/* +Package gogoproto provides extensions for protocol buffers to achieve: + + - fast marshalling and unmarshalling. + - peace of mind by optionally generating test and benchmark code. + - more canonical Go structures. + - less typing by optionally generating extra helper code. + - goprotobuf compatibility + +More Canonical Go Structures + +A lot of time working with a goprotobuf struct will lead you to a place where you create another struct that is easier to work with and then have a function to copy the values between the two structs. +You might also find that basic structs that started their life as part of an API need to be sent over the wire. With gob, you could just send it. With goprotobuf, you need to make a parallel struct. +Gogoprotobuf tries to fix these problems with the nullable, embed, customtype and customname field extensions. + + - nullable, if false, a field is generated without a pointer (see warning below). + - embed, if true, the field is generated as an embedded field. + - customtype, It works with the Marshal and Unmarshal methods, to allow you to have your own types in your struct, but marshal to bytes. For example, custom.Uuid or custom.Fixed128 + - customname (beta), Changes the generated fieldname. This is especially useful when generated methods conflict with fieldnames. + - casttype (beta), Changes the generated fieldtype. All generated code assumes that this type is castable to the protocol buffer field type. It does not work for structs or enums. + - castkey (beta), Changes the generated fieldtype for a map key. All generated code assumes that this type is castable to the protocol buffer field type. Only supported on maps. + - castvalue (beta), Changes the generated fieldtype for a map value. All generated code assumes that this type is castable to the protocol buffer field type. Only supported on maps. + +Warning about nullable: According to the Protocol Buffer specification, you should be able to tell whether a field is set or unset. With the option nullable=false this feature is lost, since your non-nullable fields will always be set. It can be seen as a layer on top of Protocol Buffers, where before and after marshalling all non-nullable fields are set and they cannot be unset. + +Let us look at: + + github.com/gogo/protobuf/test/example/example.proto + +for a quicker overview. + +The following message: + + package test; + + import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + + message A { + optional string Description = 1 [(gogoproto.nullable) = false]; + optional int64 Number = 2 [(gogoproto.nullable) = false]; + optional bytes Id = 3 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uuid", (gogoproto.nullable) = false]; + } + +Will generate a go struct which looks a lot like this: + + type A struct { + Description string + Number int64 + Id github_com_gogo_protobuf_test_custom.Uuid + } + +You will see there are no pointers, since all fields are non-nullable. +You will also see a custom type which marshals to a string. +Be warned it is your responsibility to test your custom types thoroughly. +You should think of every possible empty and nil case for your marshaling, unmarshaling and size methods. + +Next we will embed the message A in message B. + + message B { + optional A A = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; + repeated bytes G = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false]; + } + +See below that A is embedded in B. + + type B struct { + A + G []github_com_gogo_protobuf_test_custom.Uint128 + } + +Also see the repeated custom type. + + type Uint128 [2]uint64 + +Next we will create a custom name for one of our fields. + + message C { + optional int64 size = 1 [(gogoproto.customname) = "MySize"]; + } + +See below that the field's name is MySize and not Size. + + type C struct { + MySize *int64 + } + +The is useful when having a protocol buffer message with a field name which conflicts with a generated method. +As an example, having a field name size and using the sizer plugin to generate a Size method will cause a go compiler error. +Using customname you can fix this error without changing the field name. +This is typically useful when working with a protocol buffer that was designed before these methods and/or the go language were avialable. + +Gogoprotobuf also has some more subtle changes, these could be changed back: + + - the generated package name for imports do not have the extra /filename.pb, + but are actually the imports specified in the .proto file. + +Gogoprotobuf also has lost some features which should be brought back with time: + + - Marshalling and unmarshalling with reflect and without the unsafe package, + this requires work in pointer_reflect.go + +Why does nullable break protocol buffer specifications: + +The protocol buffer specification states, somewhere, that you should be able to tell whether a +field is set or unset. With the option nullable=false this feature is lost, +since your non-nullable fields will always be set. It can be seen as a layer on top of +protocol buffers, where before and after marshalling all non-nullable fields are set +and they cannot be unset. + +Goprotobuf Compatibility: + +Gogoprotobuf is compatible with Goprotobuf, because it is compatible with protocol buffers. +Gogoprotobuf generates the same code as goprotobuf if no extensions are used. +The enumprefix, getters and stringer extensions can be used to remove some of the unnecessary code generated by goprotobuf: + + - gogoproto_import, if false, the generated code imports github.com/golang/protobuf/proto instead of github.com/gogo/protobuf/proto. + - goproto_enum_prefix, if false, generates the enum constant names without the messagetype prefix + - goproto_enum_stringer (experimental), if false, the enum is generated without the default string method, this is useful for rather using enum_stringer, or allowing you to write your own string method. + - goproto_getters, if false, the message is generated without get methods, this is useful when you would rather want to use face + - goproto_stringer, if false, the message is generated without the default string method, this is useful for rather using stringer, or allowing you to write your own string method. + - goproto_extensions_map (beta), if false, the extensions field is generated as type []byte instead of type map[int32]proto.Extension + - goproto_unrecognized (beta), if false, XXX_unrecognized field is not generated. This is useful in conjunction with gogoproto.nullable=false, to generate structures completely devoid of pointers and reduce GC pressure at the cost of losing information about unrecognized fields. + +Less Typing and Peace of Mind is explained in their specific plugin folders godoc: + + - github.com/gogo/protobuf/plugin/ + +If you do not use any of these extension the code that is generated +will be the same as if goprotobuf has generated it. + +The most complete way to see examples is to look at + + github.com/gogo/protobuf/test/thetest.proto + +Gogoprototest is a seperate project, +because we want to keep gogoprotobuf independant of goprotobuf, +but we still want to test it thoroughly. + +*/ +package gogoproto diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/gogo.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/gogo.pb.go new file mode 100644 index 00000000000..d88ba80131e --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/gogo.pb.go @@ -0,0 +1,749 @@ +// Code generated by protoc-gen-gogo. +// source: gogo.proto +// DO NOT EDIT! + +/* +Package gogoproto is a generated protocol buffer package. + +It is generated from these files: + gogo.proto + +It has these top-level messages: +*/ +package gogoproto + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import google_protobuf "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +var E_GoprotoEnumPrefix = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.EnumOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 62001, + Name: "gogoproto.goproto_enum_prefix", + Tag: "varint,62001,opt,name=goproto_enum_prefix,json=goprotoEnumPrefix", + Filename: "gogo.proto", +} + +var E_GoprotoEnumStringer = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.EnumOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 62021, + Name: "gogoproto.goproto_enum_stringer", + Tag: "varint,62021,opt,name=goproto_enum_stringer,json=goprotoEnumStringer", + Filename: "gogo.proto", +} + +var E_EnumStringer = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.EnumOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 62022, + Name: "gogoproto.enum_stringer", + Tag: "varint,62022,opt,name=enum_stringer,json=enumStringer", + Filename: "gogo.proto", +} + +var E_EnumCustomname = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.EnumOptions)(nil), + ExtensionType: (*string)(nil), + Field: 62023, + Name: "gogoproto.enum_customname", + Tag: "bytes,62023,opt,name=enum_customname,json=enumCustomname", + Filename: "gogo.proto", +} + +var E_EnumvalueCustomname = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.EnumValueOptions)(nil), + ExtensionType: (*string)(nil), + Field: 66001, + Name: "gogoproto.enumvalue_customname", + Tag: "bytes,66001,opt,name=enumvalue_customname,json=enumvalueCustomname", + Filename: "gogo.proto", +} + +var E_GoprotoGettersAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63001, + Name: "gogoproto.goproto_getters_all", + Tag: "varint,63001,opt,name=goproto_getters_all,json=goprotoGettersAll", + Filename: "gogo.proto", +} + +var E_GoprotoEnumPrefixAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63002, + Name: "gogoproto.goproto_enum_prefix_all", + Tag: "varint,63002,opt,name=goproto_enum_prefix_all,json=goprotoEnumPrefixAll", + Filename: "gogo.proto", +} + +var E_GoprotoStringerAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63003, + Name: "gogoproto.goproto_stringer_all", + Tag: "varint,63003,opt,name=goproto_stringer_all,json=goprotoStringerAll", + Filename: "gogo.proto", +} + +var E_VerboseEqualAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63004, + Name: "gogoproto.verbose_equal_all", + Tag: "varint,63004,opt,name=verbose_equal_all,json=verboseEqualAll", + Filename: "gogo.proto", +} + +var E_FaceAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63005, + Name: "gogoproto.face_all", + Tag: "varint,63005,opt,name=face_all,json=faceAll", + Filename: "gogo.proto", +} + +var E_GostringAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63006, + Name: "gogoproto.gostring_all", + Tag: "varint,63006,opt,name=gostring_all,json=gostringAll", + Filename: "gogo.proto", +} + +var E_PopulateAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63007, + Name: "gogoproto.populate_all", + Tag: "varint,63007,opt,name=populate_all,json=populateAll", + Filename: "gogo.proto", +} + +var E_StringerAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63008, + Name: "gogoproto.stringer_all", + Tag: "varint,63008,opt,name=stringer_all,json=stringerAll", + Filename: "gogo.proto", +} + +var E_OnlyoneAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63009, + Name: "gogoproto.onlyone_all", + Tag: "varint,63009,opt,name=onlyone_all,json=onlyoneAll", + Filename: "gogo.proto", +} + +var E_EqualAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63013, + Name: "gogoproto.equal_all", + Tag: "varint,63013,opt,name=equal_all,json=equalAll", + Filename: "gogo.proto", +} + +var E_DescriptionAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63014, + Name: "gogoproto.description_all", + Tag: "varint,63014,opt,name=description_all,json=descriptionAll", + Filename: "gogo.proto", +} + +var E_TestgenAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63015, + Name: "gogoproto.testgen_all", + Tag: "varint,63015,opt,name=testgen_all,json=testgenAll", + Filename: "gogo.proto", +} + +var E_BenchgenAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63016, + Name: "gogoproto.benchgen_all", + Tag: "varint,63016,opt,name=benchgen_all,json=benchgenAll", + Filename: "gogo.proto", +} + +var E_MarshalerAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63017, + Name: "gogoproto.marshaler_all", + Tag: "varint,63017,opt,name=marshaler_all,json=marshalerAll", + Filename: "gogo.proto", +} + +var E_UnmarshalerAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63018, + Name: "gogoproto.unmarshaler_all", + Tag: "varint,63018,opt,name=unmarshaler_all,json=unmarshalerAll", + Filename: "gogo.proto", +} + +var E_StableMarshalerAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63019, + Name: "gogoproto.stable_marshaler_all", + Tag: "varint,63019,opt,name=stable_marshaler_all,json=stableMarshalerAll", + Filename: "gogo.proto", +} + +var E_SizerAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63020, + Name: "gogoproto.sizer_all", + Tag: "varint,63020,opt,name=sizer_all,json=sizerAll", + Filename: "gogo.proto", +} + +var E_GoprotoEnumStringerAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63021, + Name: "gogoproto.goproto_enum_stringer_all", + Tag: "varint,63021,opt,name=goproto_enum_stringer_all,json=goprotoEnumStringerAll", + Filename: "gogo.proto", +} + +var E_EnumStringerAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63022, + Name: "gogoproto.enum_stringer_all", + Tag: "varint,63022,opt,name=enum_stringer_all,json=enumStringerAll", + Filename: "gogo.proto", +} + +var E_UnsafeMarshalerAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63023, + Name: "gogoproto.unsafe_marshaler_all", + Tag: "varint,63023,opt,name=unsafe_marshaler_all,json=unsafeMarshalerAll", + Filename: "gogo.proto", +} + +var E_UnsafeUnmarshalerAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63024, + Name: "gogoproto.unsafe_unmarshaler_all", + Tag: "varint,63024,opt,name=unsafe_unmarshaler_all,json=unsafeUnmarshalerAll", + Filename: "gogo.proto", +} + +var E_GoprotoExtensionsMapAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63025, + Name: "gogoproto.goproto_extensions_map_all", + Tag: "varint,63025,opt,name=goproto_extensions_map_all,json=goprotoExtensionsMapAll", + Filename: "gogo.proto", +} + +var E_GoprotoUnrecognizedAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63026, + Name: "gogoproto.goproto_unrecognized_all", + Tag: "varint,63026,opt,name=goproto_unrecognized_all,json=goprotoUnrecognizedAll", + Filename: "gogo.proto", +} + +var E_GogoprotoImport = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63027, + Name: "gogoproto.gogoproto_import", + Tag: "varint,63027,opt,name=gogoproto_import,json=gogoprotoImport", + Filename: "gogo.proto", +} + +var E_ProtosizerAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63028, + Name: "gogoproto.protosizer_all", + Tag: "varint,63028,opt,name=protosizer_all,json=protosizerAll", + Filename: "gogo.proto", +} + +var E_CompareAll = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63029, + Name: "gogoproto.compare_all", + Tag: "varint,63029,opt,name=compare_all,json=compareAll", + Filename: "gogo.proto", +} + +var E_GoprotoGetters = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64001, + Name: "gogoproto.goproto_getters", + Tag: "varint,64001,opt,name=goproto_getters,json=goprotoGetters", + Filename: "gogo.proto", +} + +var E_GoprotoStringer = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64003, + Name: "gogoproto.goproto_stringer", + Tag: "varint,64003,opt,name=goproto_stringer,json=goprotoStringer", + Filename: "gogo.proto", +} + +var E_VerboseEqual = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64004, + Name: "gogoproto.verbose_equal", + Tag: "varint,64004,opt,name=verbose_equal,json=verboseEqual", + Filename: "gogo.proto", +} + +var E_Face = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64005, + Name: "gogoproto.face", + Tag: "varint,64005,opt,name=face", + Filename: "gogo.proto", +} + +var E_Gostring = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64006, + Name: "gogoproto.gostring", + Tag: "varint,64006,opt,name=gostring", + Filename: "gogo.proto", +} + +var E_Populate = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64007, + Name: "gogoproto.populate", + Tag: "varint,64007,opt,name=populate", + Filename: "gogo.proto", +} + +var E_Stringer = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 67008, + Name: "gogoproto.stringer", + Tag: "varint,67008,opt,name=stringer", + Filename: "gogo.proto", +} + +var E_Onlyone = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64009, + Name: "gogoproto.onlyone", + Tag: "varint,64009,opt,name=onlyone", + Filename: "gogo.proto", +} + +var E_Equal = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64013, + Name: "gogoproto.equal", + Tag: "varint,64013,opt,name=equal", + Filename: "gogo.proto", +} + +var E_Description = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64014, + Name: "gogoproto.description", + Tag: "varint,64014,opt,name=description", + Filename: "gogo.proto", +} + +var E_Testgen = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64015, + Name: "gogoproto.testgen", + Tag: "varint,64015,opt,name=testgen", + Filename: "gogo.proto", +} + +var E_Benchgen = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64016, + Name: "gogoproto.benchgen", + Tag: "varint,64016,opt,name=benchgen", + Filename: "gogo.proto", +} + +var E_Marshaler = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64017, + Name: "gogoproto.marshaler", + Tag: "varint,64017,opt,name=marshaler", + Filename: "gogo.proto", +} + +var E_Unmarshaler = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64018, + Name: "gogoproto.unmarshaler", + Tag: "varint,64018,opt,name=unmarshaler", + Filename: "gogo.proto", +} + +var E_StableMarshaler = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64019, + Name: "gogoproto.stable_marshaler", + Tag: "varint,64019,opt,name=stable_marshaler,json=stableMarshaler", + Filename: "gogo.proto", +} + +var E_Sizer = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64020, + Name: "gogoproto.sizer", + Tag: "varint,64020,opt,name=sizer", + Filename: "gogo.proto", +} + +var E_UnsafeMarshaler = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64023, + Name: "gogoproto.unsafe_marshaler", + Tag: "varint,64023,opt,name=unsafe_marshaler,json=unsafeMarshaler", + Filename: "gogo.proto", +} + +var E_UnsafeUnmarshaler = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64024, + Name: "gogoproto.unsafe_unmarshaler", + Tag: "varint,64024,opt,name=unsafe_unmarshaler,json=unsafeUnmarshaler", + Filename: "gogo.proto", +} + +var E_GoprotoExtensionsMap = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64025, + Name: "gogoproto.goproto_extensions_map", + Tag: "varint,64025,opt,name=goproto_extensions_map,json=goprotoExtensionsMap", + Filename: "gogo.proto", +} + +var E_GoprotoUnrecognized = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64026, + Name: "gogoproto.goproto_unrecognized", + Tag: "varint,64026,opt,name=goproto_unrecognized,json=goprotoUnrecognized", + Filename: "gogo.proto", +} + +var E_Protosizer = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64028, + Name: "gogoproto.protosizer", + Tag: "varint,64028,opt,name=protosizer", + Filename: "gogo.proto", +} + +var E_Compare = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64029, + Name: "gogoproto.compare", + Tag: "varint,64029,opt,name=compare", + Filename: "gogo.proto", +} + +var E_Nullable = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FieldOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 65001, + Name: "gogoproto.nullable", + Tag: "varint,65001,opt,name=nullable", + Filename: "gogo.proto", +} + +var E_Embed = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FieldOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 65002, + Name: "gogoproto.embed", + Tag: "varint,65002,opt,name=embed", + Filename: "gogo.proto", +} + +var E_Customtype = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 65003, + Name: "gogoproto.customtype", + Tag: "bytes,65003,opt,name=customtype", + Filename: "gogo.proto", +} + +var E_Customname = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 65004, + Name: "gogoproto.customname", + Tag: "bytes,65004,opt,name=customname", + Filename: "gogo.proto", +} + +var E_Jsontag = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 65005, + Name: "gogoproto.jsontag", + Tag: "bytes,65005,opt,name=jsontag", + Filename: "gogo.proto", +} + +var E_Moretags = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 65006, + Name: "gogoproto.moretags", + Tag: "bytes,65006,opt,name=moretags", + Filename: "gogo.proto", +} + +var E_Casttype = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 65007, + Name: "gogoproto.casttype", + Tag: "bytes,65007,opt,name=casttype", + Filename: "gogo.proto", +} + +var E_Castkey = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 65008, + Name: "gogoproto.castkey", + Tag: "bytes,65008,opt,name=castkey", + Filename: "gogo.proto", +} + +var E_Castvalue = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 65009, + Name: "gogoproto.castvalue", + Tag: "bytes,65009,opt,name=castvalue", + Filename: "gogo.proto", +} + +var E_Stdtime = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FieldOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 65010, + Name: "gogoproto.stdtime", + Tag: "varint,65010,opt,name=stdtime", + Filename: "gogo.proto", +} + +var E_Stdduration = &proto.ExtensionDesc{ + ExtendedType: (*google_protobuf.FieldOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 65011, + Name: "gogoproto.stdduration", + Tag: "varint,65011,opt,name=stdduration", + Filename: "gogo.proto", +} + +func init() { + proto.RegisterExtension(E_GoprotoEnumPrefix) + proto.RegisterExtension(E_GoprotoEnumStringer) + proto.RegisterExtension(E_EnumStringer) + proto.RegisterExtension(E_EnumCustomname) + proto.RegisterExtension(E_EnumvalueCustomname) + proto.RegisterExtension(E_GoprotoGettersAll) + proto.RegisterExtension(E_GoprotoEnumPrefixAll) + proto.RegisterExtension(E_GoprotoStringerAll) + proto.RegisterExtension(E_VerboseEqualAll) + proto.RegisterExtension(E_FaceAll) + proto.RegisterExtension(E_GostringAll) + proto.RegisterExtension(E_PopulateAll) + proto.RegisterExtension(E_StringerAll) + proto.RegisterExtension(E_OnlyoneAll) + proto.RegisterExtension(E_EqualAll) + proto.RegisterExtension(E_DescriptionAll) + proto.RegisterExtension(E_TestgenAll) + proto.RegisterExtension(E_BenchgenAll) + proto.RegisterExtension(E_MarshalerAll) + proto.RegisterExtension(E_UnmarshalerAll) + proto.RegisterExtension(E_StableMarshalerAll) + proto.RegisterExtension(E_SizerAll) + proto.RegisterExtension(E_GoprotoEnumStringerAll) + proto.RegisterExtension(E_EnumStringerAll) + proto.RegisterExtension(E_UnsafeMarshalerAll) + proto.RegisterExtension(E_UnsafeUnmarshalerAll) + proto.RegisterExtension(E_GoprotoExtensionsMapAll) + proto.RegisterExtension(E_GoprotoUnrecognizedAll) + proto.RegisterExtension(E_GogoprotoImport) + proto.RegisterExtension(E_ProtosizerAll) + proto.RegisterExtension(E_CompareAll) + proto.RegisterExtension(E_GoprotoGetters) + proto.RegisterExtension(E_GoprotoStringer) + proto.RegisterExtension(E_VerboseEqual) + proto.RegisterExtension(E_Face) + proto.RegisterExtension(E_Gostring) + proto.RegisterExtension(E_Populate) + proto.RegisterExtension(E_Stringer) + proto.RegisterExtension(E_Onlyone) + proto.RegisterExtension(E_Equal) + proto.RegisterExtension(E_Description) + proto.RegisterExtension(E_Testgen) + proto.RegisterExtension(E_Benchgen) + proto.RegisterExtension(E_Marshaler) + proto.RegisterExtension(E_Unmarshaler) + proto.RegisterExtension(E_StableMarshaler) + proto.RegisterExtension(E_Sizer) + proto.RegisterExtension(E_UnsafeMarshaler) + proto.RegisterExtension(E_UnsafeUnmarshaler) + proto.RegisterExtension(E_GoprotoExtensionsMap) + proto.RegisterExtension(E_GoprotoUnrecognized) + proto.RegisterExtension(E_Protosizer) + proto.RegisterExtension(E_Compare) + proto.RegisterExtension(E_Nullable) + proto.RegisterExtension(E_Embed) + proto.RegisterExtension(E_Customtype) + proto.RegisterExtension(E_Customname) + proto.RegisterExtension(E_Jsontag) + proto.RegisterExtension(E_Moretags) + proto.RegisterExtension(E_Casttype) + proto.RegisterExtension(E_Castkey) + proto.RegisterExtension(E_Castvalue) + proto.RegisterExtension(E_Stdtime) + proto.RegisterExtension(E_Stdduration) +} + +func init() { proto.RegisterFile("gogo.proto", fileDescriptorGogo) } + +var fileDescriptorGogo = []byte{ + // 1129 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x97, 0xc9, 0x6f, 0x1c, 0x45, + 0x14, 0x87, 0x85, 0x70, 0x64, 0xcf, 0xf3, 0x86, 0xc7, 0xc6, 0x84, 0x08, 0x44, 0x72, 0xe3, 0xe4, + 0x9c, 0x22, 0x94, 0xb2, 0x22, 0xcb, 0xb1, 0x9c, 0x51, 0x10, 0x86, 0x91, 0x89, 0x03, 0x88, 0xc3, + 0xa8, 0x67, 0xa6, 0xdc, 0x69, 0xe8, 0xee, 0x6a, 0xba, 0xaa, 0xa3, 0x38, 0x37, 0x14, 0x16, 0x21, + 0xc4, 0x8e, 0x04, 0x09, 0x09, 0xcb, 0x81, 0x7d, 0x0d, 0xcb, 0x9d, 0x0b, 0x70, 0xe6, 0x7f, 0xe0, + 0x02, 0x84, 0xdd, 0x37, 0x5f, 0x50, 0x75, 0xbf, 0xd7, 0x53, 0xdd, 0x1e, 0xa9, 0x6a, 0x6e, 0xe3, + 0x71, 0x7d, 0xdf, 0x54, 0xbf, 0x37, 0xf5, 0x7e, 0x53, 0x00, 0xbe, 0xf0, 0xc5, 0x52, 0x92, 0x0a, + 0x25, 0x9a, 0x0d, 0xfd, 0x3a, 0x7f, 0x79, 0xe8, 0xb0, 0x2f, 0x84, 0x1f, 0xf2, 0xa3, 0xf9, 0x5f, + 0xdd, 0x6c, 0xfb, 0x68, 0x9f, 0xcb, 0x5e, 0x1a, 0x24, 0x4a, 0xa4, 0xc5, 0x62, 0x76, 0x3f, 0xcc, + 0xe3, 0xe2, 0x0e, 0x8f, 0xb3, 0xa8, 0x93, 0xa4, 0x7c, 0x3b, 0xb8, 0xd0, 0xbc, 0x63, 0xa9, 0x20, + 0x97, 0x88, 0x5c, 0x5a, 0x8f, 0xb3, 0xe8, 0x81, 0x44, 0x05, 0x22, 0x96, 0x07, 0xaf, 0xff, 0x72, + 0xf3, 0xe1, 0x9b, 0xee, 0x9e, 0xd8, 0x9c, 0x43, 0x54, 0xff, 0xaf, 0x9d, 0x83, 0x6c, 0x13, 0x6e, + 0xad, 0xf8, 0xa4, 0x4a, 0x83, 0xd8, 0xe7, 0xa9, 0xc5, 0xf8, 0x03, 0x1a, 0xe7, 0x0d, 0xe3, 0x83, + 0x88, 0xb2, 0x35, 0x98, 0x1e, 0xc5, 0xf5, 0x23, 0xba, 0xa6, 0xb8, 0x29, 0x69, 0xc1, 0x6c, 0x2e, + 0xe9, 0x65, 0x52, 0x89, 0x28, 0xf6, 0x22, 0x6e, 0xd1, 0xfc, 0x94, 0x6b, 0x1a, 0x9b, 0x33, 0x1a, + 0x5b, 0x2b, 0x29, 0x76, 0x16, 0x16, 0xf4, 0x3b, 0xe7, 0xbd, 0x30, 0xe3, 0xa6, 0xed, 0xc8, 0x50, + 0xdb, 0x59, 0xbd, 0x8c, 0x94, 0x3f, 0x5f, 0x1a, 0xcb, 0x95, 0xf3, 0xa5, 0xc0, 0xf0, 0x1a, 0x9d, + 0xf0, 0xb9, 0x52, 0x3c, 0x95, 0x1d, 0x2f, 0x0c, 0x87, 0x6c, 0xf2, 0x54, 0x10, 0x96, 0xc6, 0xcb, + 0x37, 0xaa, 0x9d, 0x68, 0x15, 0xe4, 0x6a, 0x18, 0xb2, 0x2d, 0xb8, 0x6d, 0x48, 0x67, 0x1d, 0x9c, + 0x57, 0xd0, 0xb9, 0xb0, 0xaf, 0xbb, 0x5a, 0xdb, 0x06, 0x7a, 0xbf, 0xec, 0x87, 0x83, 0xf3, 0x2d, + 0x74, 0x36, 0x91, 0xa5, 0xb6, 0x68, 0xe3, 0xbd, 0x30, 0x77, 0x9e, 0xa7, 0x5d, 0x21, 0x79, 0x87, + 0x3f, 0x91, 0x79, 0xa1, 0x83, 0xee, 0x2a, 0xea, 0x66, 0x11, 0x5c, 0xd7, 0x9c, 0x76, 0x1d, 0x87, + 0x89, 0x6d, 0xaf, 0xc7, 0x1d, 0x14, 0xd7, 0x50, 0x31, 0xae, 0xd7, 0x6b, 0x74, 0x15, 0xa6, 0x7c, + 0x51, 0x3c, 0x92, 0x03, 0xfe, 0x36, 0xe2, 0x93, 0xc4, 0xa0, 0x22, 0x11, 0x49, 0x16, 0x7a, 0xca, + 0x65, 0x07, 0xef, 0x90, 0x82, 0x18, 0x54, 0x8c, 0x50, 0xd6, 0x77, 0x49, 0x21, 0x8d, 0x7a, 0xae, + 0xc0, 0xa4, 0x88, 0xc3, 0x1d, 0x11, 0xbb, 0x6c, 0xe2, 0x3d, 0x34, 0x00, 0x22, 0x5a, 0xb0, 0x0c, + 0x0d, 0xd7, 0x46, 0xbc, 0x8f, 0xf8, 0x04, 0xa7, 0x0e, 0xb4, 0x60, 0x96, 0x86, 0x4c, 0x20, 0x62, + 0x07, 0xc5, 0x07, 0xa8, 0x98, 0x31, 0x30, 0x7c, 0x0c, 0xc5, 0xa5, 0xf2, 0xb9, 0x8b, 0xe4, 0x43, + 0x7a, 0x0c, 0x44, 0xb0, 0x94, 0x5d, 0x1e, 0xf7, 0xce, 0xb9, 0x19, 0x3e, 0xa2, 0x52, 0x12, 0xa3, + 0x15, 0x6b, 0x30, 0x1d, 0x79, 0xa9, 0x3c, 0xe7, 0x85, 0x4e, 0xed, 0xf8, 0x18, 0x1d, 0x53, 0x25, + 0x84, 0x15, 0xc9, 0xe2, 0x51, 0x34, 0x9f, 0x50, 0x45, 0x0c, 0x0c, 0x8f, 0x9e, 0x54, 0x5e, 0x37, + 0xe4, 0x9d, 0x51, 0x6c, 0x9f, 0xd2, 0xd1, 0x2b, 0xd8, 0x0d, 0xd3, 0xb8, 0x0c, 0x0d, 0x19, 0x5c, + 0x74, 0xd2, 0x7c, 0x46, 0x9d, 0xce, 0x01, 0x0d, 0x3f, 0x02, 0xb7, 0x0f, 0x1d, 0xf5, 0x0e, 0xb2, + 0xcf, 0x51, 0xb6, 0x38, 0x64, 0xdc, 0xe3, 0x48, 0x18, 0x55, 0xf9, 0x05, 0x8d, 0x04, 0x5e, 0x73, + 0xb5, 0x61, 0x21, 0x8b, 0xa5, 0xb7, 0x3d, 0x5a, 0xd5, 0xbe, 0xa4, 0xaa, 0x15, 0x6c, 0xa5, 0x6a, + 0x67, 0x60, 0x11, 0x8d, 0xa3, 0xf5, 0xf5, 0x2b, 0x1a, 0xac, 0x05, 0xbd, 0x55, 0xed, 0xee, 0xa3, + 0x70, 0xa8, 0x2c, 0xe7, 0x05, 0xc5, 0x63, 0xa9, 0x99, 0x4e, 0xe4, 0x25, 0x0e, 0xe6, 0xeb, 0x68, + 0xa6, 0x89, 0xbf, 0x5e, 0x0a, 0x36, 0xbc, 0x44, 0xcb, 0x1f, 0x86, 0x83, 0x24, 0xcf, 0xe2, 0x94, + 0xf7, 0x84, 0x1f, 0x07, 0x17, 0x79, 0xdf, 0x41, 0xfd, 0x75, 0xad, 0x55, 0x5b, 0x06, 0xae, 0xcd, + 0xa7, 0xe1, 0x96, 0xf2, 0xf7, 0x46, 0x27, 0x88, 0x12, 0x91, 0x2a, 0x8b, 0xf1, 0x1b, 0xea, 0x54, + 0xc9, 0x9d, 0xce, 0x31, 0xb6, 0x0e, 0x33, 0xf9, 0x9f, 0xae, 0x5f, 0xc9, 0x6f, 0x51, 0x34, 0x3d, + 0xa0, 0x70, 0x70, 0xf4, 0x44, 0x94, 0x78, 0xa9, 0xcb, 0xfc, 0xfb, 0x8e, 0x06, 0x07, 0x22, 0xc5, + 0xb7, 0x6f, 0xb6, 0x96, 0xc4, 0xcd, 0xbb, 0xf6, 0x49, 0x36, 0xb8, 0x94, 0x9e, 0x5f, 0x7a, 0x9e, + 0xdc, 0xc5, 0x33, 0x5b, 0x0d, 0x62, 0x76, 0x9f, 0x2e, 0x4f, 0x35, 0x2e, 0xed, 0xb2, 0x4b, 0xbb, + 0x65, 0x85, 0x2a, 0x69, 0xc9, 0x4e, 0xc1, 0x74, 0x25, 0x2a, 0xed, 0xaa, 0xa7, 0x50, 0x35, 0x65, + 0x26, 0x25, 0x3b, 0x06, 0x63, 0x3a, 0xf6, 0xec, 0xf8, 0xd3, 0x88, 0xe7, 0xcb, 0xd9, 0x09, 0x98, + 0xa0, 0xb8, 0xb3, 0xa3, 0xcf, 0x20, 0x5a, 0x22, 0x1a, 0xa7, 0xa8, 0xb3, 0xe3, 0xcf, 0x12, 0x4e, + 0x88, 0xc6, 0xdd, 0x4b, 0xf8, 0xfd, 0xf3, 0x63, 0x38, 0xae, 0xa8, 0x76, 0xcb, 0x30, 0x8e, 0x19, + 0x67, 0xa7, 0x9f, 0xc3, 0x0f, 0x27, 0x82, 0xdd, 0x03, 0x07, 0x1c, 0x0b, 0xfe, 0x02, 0xa2, 0xc5, + 0x7a, 0xb6, 0x06, 0x93, 0x46, 0xae, 0xd9, 0xf1, 0x17, 0x11, 0x37, 0x29, 0xbd, 0x75, 0xcc, 0x35, + 0xbb, 0xe0, 0x25, 0xda, 0x3a, 0x12, 0xba, 0x6c, 0x14, 0x69, 0x76, 0xfa, 0x65, 0xaa, 0x3a, 0x21, + 0x6c, 0x05, 0x1a, 0xe5, 0x98, 0xb2, 0xf3, 0xaf, 0x20, 0x3f, 0x60, 0x74, 0x05, 0x8c, 0x31, 0x69, + 0x57, 0xbc, 0x4a, 0x15, 0x30, 0x28, 0x7d, 0x8c, 0xea, 0xd1, 0x67, 0x37, 0xbd, 0x46, 0xc7, 0xa8, + 0x96, 0x7c, 0xba, 0x9b, 0xf9, 0xb4, 0xb0, 0x2b, 0x5e, 0xa7, 0x6e, 0xe6, 0xeb, 0xf5, 0x36, 0xea, + 0x59, 0x62, 0x77, 0xbc, 0x41, 0xdb, 0xa8, 0x45, 0x09, 0x6b, 0x43, 0x73, 0x7f, 0x8e, 0xd8, 0x7d, + 0x6f, 0xa2, 0x6f, 0x6e, 0x5f, 0x8c, 0xb0, 0x87, 0x60, 0x71, 0x78, 0x86, 0xd8, 0xad, 0x97, 0x77, + 0x6b, 0xbf, 0xfa, 0xcd, 0x08, 0x61, 0x67, 0x06, 0xbf, 0xfa, 0xcd, 0xfc, 0xb0, 0x6b, 0xaf, 0xec, + 0x56, 0x2f, 0x76, 0x66, 0x7c, 0xb0, 0x55, 0x80, 0xc1, 0xe8, 0xb6, 0xbb, 0xae, 0xa2, 0xcb, 0x80, + 0xf4, 0xd1, 0xc0, 0xc9, 0x6d, 0xe7, 0xaf, 0xd1, 0xd1, 0x40, 0x82, 0x2d, 0xc3, 0x44, 0x9c, 0x85, + 0xa1, 0xfe, 0x72, 0x34, 0xef, 0x1c, 0x12, 0x13, 0x3c, 0xec, 0x13, 0xfb, 0xeb, 0x1e, 0x1e, 0x0c, + 0x02, 0xd8, 0x31, 0x38, 0xc0, 0xa3, 0x2e, 0xef, 0xdb, 0xc8, 0xdf, 0xf6, 0x68, 0x20, 0xe8, 0xd5, + 0x6c, 0x05, 0xa0, 0xb8, 0x34, 0xaa, 0x9d, 0xc4, 0xfa, 0xa9, 0xbf, 0xef, 0x15, 0x77, 0x50, 0x03, + 0x19, 0x08, 0xf2, 0x5b, 0xa7, 0x45, 0x70, 0xa3, 0x2a, 0xc8, 0x2f, 0x9a, 0xc7, 0x61, 0xfc, 0x31, + 0x29, 0x62, 0xe5, 0xf9, 0x36, 0xfa, 0x0f, 0xa4, 0x69, 0xbd, 0x2e, 0x58, 0x24, 0x52, 0xae, 0x3c, + 0x5f, 0xda, 0xd8, 0x3f, 0x91, 0x2d, 0x01, 0x0d, 0xf7, 0x3c, 0xa9, 0x5c, 0x9e, 0xfb, 0x2f, 0x82, + 0x09, 0xd0, 0x9b, 0xd6, 0xaf, 0x1f, 0xe7, 0x3b, 0x36, 0xf6, 0x6f, 0xda, 0x34, 0xae, 0x67, 0x27, + 0xa0, 0xa1, 0x5f, 0xe6, 0xf7, 0x6d, 0x1b, 0xfc, 0x0f, 0xc2, 0x03, 0x42, 0x7f, 0xb2, 0x54, 0x7d, + 0x15, 0xd8, 0x8b, 0xfd, 0x2f, 0x76, 0x9a, 0xd6, 0xb3, 0x55, 0x98, 0x94, 0xaa, 0xdf, 0xcf, 0x52, + 0x2f, 0x1f, 0xfe, 0x16, 0xfc, 0xbf, 0xbd, 0xf2, 0x32, 0x57, 0x32, 0x27, 0x8f, 0xc0, 0x7c, 0x4f, + 0x44, 0x75, 0xf0, 0x24, 0xb4, 0x44, 0x4b, 0xb4, 0xf3, 0x63, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x3f, 0x9b, 0x2b, 0x54, 0xfc, 0x11, 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/gogo.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/gogo.proto new file mode 100644 index 00000000000..0da211a8e3e --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/gogo.proto @@ -0,0 +1,125 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +syntax = "proto2"; +package gogoproto; + +import "google/protobuf/descriptor.proto"; + +option java_package = "com.google.protobuf"; +option java_outer_classname = "GoGoProtos"; + +extend google.protobuf.EnumOptions { + optional bool goproto_enum_prefix = 62001; + optional bool goproto_enum_stringer = 62021; + optional bool enum_stringer = 62022; + optional string enum_customname = 62023; +} + +extend google.protobuf.EnumValueOptions { + optional string enumvalue_customname = 66001; +} + +extend google.protobuf.FileOptions { + optional bool goproto_getters_all = 63001; + optional bool goproto_enum_prefix_all = 63002; + optional bool goproto_stringer_all = 63003; + optional bool verbose_equal_all = 63004; + optional bool face_all = 63005; + optional bool gostring_all = 63006; + optional bool populate_all = 63007; + optional bool stringer_all = 63008; + optional bool onlyone_all = 63009; + + optional bool equal_all = 63013; + optional bool description_all = 63014; + optional bool testgen_all = 63015; + optional bool benchgen_all = 63016; + optional bool marshaler_all = 63017; + optional bool unmarshaler_all = 63018; + optional bool stable_marshaler_all = 63019; + + optional bool sizer_all = 63020; + + optional bool goproto_enum_stringer_all = 63021; + optional bool enum_stringer_all = 63022; + + optional bool unsafe_marshaler_all = 63023; + optional bool unsafe_unmarshaler_all = 63024; + + optional bool goproto_extensions_map_all = 63025; + optional bool goproto_unrecognized_all = 63026; + optional bool gogoproto_import = 63027; + optional bool protosizer_all = 63028; + optional bool compare_all = 63029; +} + +extend google.protobuf.MessageOptions { + optional bool goproto_getters = 64001; + optional bool goproto_stringer = 64003; + optional bool verbose_equal = 64004; + optional bool face = 64005; + optional bool gostring = 64006; + optional bool populate = 64007; + optional bool stringer = 67008; + optional bool onlyone = 64009; + + optional bool equal = 64013; + optional bool description = 64014; + optional bool testgen = 64015; + optional bool benchgen = 64016; + optional bool marshaler = 64017; + optional bool unmarshaler = 64018; + optional bool stable_marshaler = 64019; + + optional bool sizer = 64020; + + optional bool unsafe_marshaler = 64023; + optional bool unsafe_unmarshaler = 64024; + + optional bool goproto_extensions_map = 64025; + optional bool goproto_unrecognized = 64026; + + optional bool protosizer = 64028; + optional bool compare = 64029; +} + +extend google.protobuf.FieldOptions { + optional bool nullable = 65001; + optional bool embed = 65002; + optional string customtype = 65003; + optional string customname = 65004; + optional string jsontag = 65005; + optional string moretags = 65006; + optional string casttype = 65007; + optional string castkey = 65008; + optional string castvalue = 65009; + + optional bool stdtime = 65010; + optional bool stdduration = 65011; +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/helper.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/helper.go new file mode 100644 index 00000000000..bb5fff48b5e --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/helper.go @@ -0,0 +1,345 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package gogoproto + +import google_protobuf "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" +import proto "github.com/gogo/protobuf/proto" + +func IsEmbed(field *google_protobuf.FieldDescriptorProto) bool { + return proto.GetBoolExtension(field.Options, E_Embed, false) +} + +func IsNullable(field *google_protobuf.FieldDescriptorProto) bool { + return proto.GetBoolExtension(field.Options, E_Nullable, true) +} + +func IsStdTime(field *google_protobuf.FieldDescriptorProto) bool { + return proto.GetBoolExtension(field.Options, E_Stdtime, false) +} + +func IsStdDuration(field *google_protobuf.FieldDescriptorProto) bool { + return proto.GetBoolExtension(field.Options, E_Stdduration, false) +} + +func NeedsNilCheck(proto3 bool, field *google_protobuf.FieldDescriptorProto) bool { + nullable := IsNullable(field) + if field.IsMessage() || IsCustomType(field) { + return nullable + } + if proto3 { + return false + } + return nullable || *field.Type == google_protobuf.FieldDescriptorProto_TYPE_BYTES +} + +func IsCustomType(field *google_protobuf.FieldDescriptorProto) bool { + typ := GetCustomType(field) + if len(typ) > 0 { + return true + } + return false +} + +func IsCastType(field *google_protobuf.FieldDescriptorProto) bool { + typ := GetCastType(field) + if len(typ) > 0 { + return true + } + return false +} + +func IsCastKey(field *google_protobuf.FieldDescriptorProto) bool { + typ := GetCastKey(field) + if len(typ) > 0 { + return true + } + return false +} + +func IsCastValue(field *google_protobuf.FieldDescriptorProto) bool { + typ := GetCastValue(field) + if len(typ) > 0 { + return true + } + return false +} + +func GetCustomType(field *google_protobuf.FieldDescriptorProto) string { + if field == nil { + return "" + } + if field.Options != nil { + v, err := proto.GetExtension(field.Options, E_Customtype) + if err == nil && v.(*string) != nil { + return *(v.(*string)) + } + } + return "" +} + +func GetCastType(field *google_protobuf.FieldDescriptorProto) string { + if field == nil { + return "" + } + if field.Options != nil { + v, err := proto.GetExtension(field.Options, E_Casttype) + if err == nil && v.(*string) != nil { + return *(v.(*string)) + } + } + return "" +} + +func GetCastKey(field *google_protobuf.FieldDescriptorProto) string { + if field == nil { + return "" + } + if field.Options != nil { + v, err := proto.GetExtension(field.Options, E_Castkey) + if err == nil && v.(*string) != nil { + return *(v.(*string)) + } + } + return "" +} + +func GetCastValue(field *google_protobuf.FieldDescriptorProto) string { + if field == nil { + return "" + } + if field.Options != nil { + v, err := proto.GetExtension(field.Options, E_Castvalue) + if err == nil && v.(*string) != nil { + return *(v.(*string)) + } + } + return "" +} + +func IsCustomName(field *google_protobuf.FieldDescriptorProto) bool { + name := GetCustomName(field) + if len(name) > 0 { + return true + } + return false +} + +func IsEnumCustomName(field *google_protobuf.EnumDescriptorProto) bool { + name := GetEnumCustomName(field) + if len(name) > 0 { + return true + } + return false +} + +func IsEnumValueCustomName(field *google_protobuf.EnumValueDescriptorProto) bool { + name := GetEnumValueCustomName(field) + if len(name) > 0 { + return true + } + return false +} + +func GetCustomName(field *google_protobuf.FieldDescriptorProto) string { + if field == nil { + return "" + } + if field.Options != nil { + v, err := proto.GetExtension(field.Options, E_Customname) + if err == nil && v.(*string) != nil { + return *(v.(*string)) + } + } + return "" +} + +func GetEnumCustomName(field *google_protobuf.EnumDescriptorProto) string { + if field == nil { + return "" + } + if field.Options != nil { + v, err := proto.GetExtension(field.Options, E_EnumCustomname) + if err == nil && v.(*string) != nil { + return *(v.(*string)) + } + } + return "" +} + +func GetEnumValueCustomName(field *google_protobuf.EnumValueDescriptorProto) string { + if field == nil { + return "" + } + if field.Options != nil { + v, err := proto.GetExtension(field.Options, E_EnumvalueCustomname) + if err == nil && v.(*string) != nil { + return *(v.(*string)) + } + } + return "" +} + +func GetJsonTag(field *google_protobuf.FieldDescriptorProto) *string { + if field == nil { + return nil + } + if field.Options != nil { + v, err := proto.GetExtension(field.Options, E_Jsontag) + if err == nil && v.(*string) != nil { + return (v.(*string)) + } + } + return nil +} + +func GetMoreTags(field *google_protobuf.FieldDescriptorProto) *string { + if field == nil { + return nil + } + if field.Options != nil { + v, err := proto.GetExtension(field.Options, E_Moretags) + if err == nil && v.(*string) != nil { + return (v.(*string)) + } + } + return nil +} + +type EnableFunc func(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool + +func EnabledGoEnumPrefix(file *google_protobuf.FileDescriptorProto, enum *google_protobuf.EnumDescriptorProto) bool { + return proto.GetBoolExtension(enum.Options, E_GoprotoEnumPrefix, proto.GetBoolExtension(file.Options, E_GoprotoEnumPrefixAll, true)) +} + +func EnabledGoStringer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_GoprotoStringer, proto.GetBoolExtension(file.Options, E_GoprotoStringerAll, true)) +} + +func HasGoGetters(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_GoprotoGetters, proto.GetBoolExtension(file.Options, E_GoprotoGettersAll, true)) +} + +func IsUnion(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Onlyone, proto.GetBoolExtension(file.Options, E_OnlyoneAll, false)) +} + +func HasGoString(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Gostring, proto.GetBoolExtension(file.Options, E_GostringAll, false)) +} + +func HasEqual(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Equal, proto.GetBoolExtension(file.Options, E_EqualAll, false)) +} + +func HasVerboseEqual(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_VerboseEqual, proto.GetBoolExtension(file.Options, E_VerboseEqualAll, false)) +} + +func IsStringer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Stringer, proto.GetBoolExtension(file.Options, E_StringerAll, false)) +} + +func IsFace(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Face, proto.GetBoolExtension(file.Options, E_FaceAll, false)) +} + +func HasDescription(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Description, proto.GetBoolExtension(file.Options, E_DescriptionAll, false)) +} + +func HasPopulate(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Populate, proto.GetBoolExtension(file.Options, E_PopulateAll, false)) +} + +func HasTestGen(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Testgen, proto.GetBoolExtension(file.Options, E_TestgenAll, false)) +} + +func HasBenchGen(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Benchgen, proto.GetBoolExtension(file.Options, E_BenchgenAll, false)) +} + +func IsMarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Marshaler, proto.GetBoolExtension(file.Options, E_MarshalerAll, false)) +} + +func IsUnmarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Unmarshaler, proto.GetBoolExtension(file.Options, E_UnmarshalerAll, false)) +} + +func IsStableMarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_StableMarshaler, proto.GetBoolExtension(file.Options, E_StableMarshalerAll, false)) +} + +func IsSizer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Sizer, proto.GetBoolExtension(file.Options, E_SizerAll, false)) +} + +func IsProtoSizer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Protosizer, proto.GetBoolExtension(file.Options, E_ProtosizerAll, false)) +} + +func IsGoEnumStringer(file *google_protobuf.FileDescriptorProto, enum *google_protobuf.EnumDescriptorProto) bool { + return proto.GetBoolExtension(enum.Options, E_GoprotoEnumStringer, proto.GetBoolExtension(file.Options, E_GoprotoEnumStringerAll, true)) +} + +func IsEnumStringer(file *google_protobuf.FileDescriptorProto, enum *google_protobuf.EnumDescriptorProto) bool { + return proto.GetBoolExtension(enum.Options, E_EnumStringer, proto.GetBoolExtension(file.Options, E_EnumStringerAll, false)) +} + +func IsUnsafeMarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_UnsafeMarshaler, proto.GetBoolExtension(file.Options, E_UnsafeMarshalerAll, false)) +} + +func IsUnsafeUnmarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_UnsafeUnmarshaler, proto.GetBoolExtension(file.Options, E_UnsafeUnmarshalerAll, false)) +} + +func HasExtensionsMap(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_GoprotoExtensionsMap, proto.GetBoolExtension(file.Options, E_GoprotoExtensionsMapAll, true)) +} + +func HasUnrecognized(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + if IsProto3(file) { + return false + } + return proto.GetBoolExtension(message.Options, E_GoprotoUnrecognized, proto.GetBoolExtension(file.Options, E_GoprotoUnrecognizedAll, true)) +} + +func IsProto3(file *google_protobuf.FileDescriptorProto) bool { + return file.GetSyntax() == "proto3" +} + +func ImportsGoGoProto(file *google_protobuf.FileDescriptorProto) bool { + return proto.GetBoolExtension(file.Options, E_GogoprotoImport, true) +} + +func HasCompare(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { + return proto.GetBoolExtension(message.Options, E_Compare, proto.GetBoolExtension(file.Options, E_CompareAll, false)) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoreplace/main.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoreplace/main.go new file mode 100644 index 00000000000..3eab5651343 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoreplace/main.go @@ -0,0 +1,25 @@ +package main + +import ( + "bytes" + "fmt" + "io/ioutil" + "os" +) + +func main() { + args := os.Args + if len(args) != 4 { + fmt.Println("gogoreplace wants three arguments") + fmt.Println(" gogoreplace oldsubstring newsubstring filename") + os.Exit(1) + } + data, err := ioutil.ReadFile(args[3]) + if err != nil { + panic(err) + } + data = bytes.Replace(data, []byte(args[1]), []byte(args[2]), -1) + if err := ioutil.WriteFile(args[3], data, 0666); err != nil { + panic(err) + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/install-protobuf.sh b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/install-protobuf.sh new file mode 100755 index 00000000000..10c9320eaf3 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/install-protobuf.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +set -ex + +die() { + echo "$@" >&2 + exit 1 +} + +case "$PROTOBUF_VERSION" in +2*) + basename=protobuf-$PROTOBUF_VERSION + ;; +3*) + basename=protobuf-cpp-$PROTOBUF_VERSION + ;; +*) + die "unknown protobuf version: $PROTOBUF_VERSION" + ;; +esac + +cd /home/travis + +wget https://github.com/google/protobuf/releases/download/v$PROTOBUF_VERSION/$basename.tar.gz +tar xzf $basename.tar.gz + +cd protobuf-$PROTOBUF_VERSION + +./configure --prefix=/home/travis && make -j2 && make install diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/full.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/full.go new file mode 100644 index 00000000000..550726a32f7 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/full.go @@ -0,0 +1,102 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package io + +import ( + "github.com/gogo/protobuf/proto" + "io" +) + +func NewFullWriter(w io.Writer) WriteCloser { + return &fullWriter{w, nil} +} + +type fullWriter struct { + w io.Writer + buffer []byte +} + +func (this *fullWriter) WriteMsg(msg proto.Message) (err error) { + var data []byte + if m, ok := msg.(marshaler); ok { + n, ok := getSize(m) + if !ok { + data, err = proto.Marshal(msg) + if err != nil { + return err + } + } + if n >= len(this.buffer) { + this.buffer = make([]byte, n) + } + _, err = m.MarshalTo(this.buffer) + if err != nil { + return err + } + data = this.buffer[:n] + } else { + data, err = proto.Marshal(msg) + if err != nil { + return err + } + } + _, err = this.w.Write(data) + return err +} + +func (this *fullWriter) Close() error { + if closer, ok := this.w.(io.Closer); ok { + return closer.Close() + } + return nil +} + +type fullReader struct { + r io.Reader + buf []byte +} + +func NewFullReader(r io.Reader, maxSize int) ReadCloser { + return &fullReader{r, make([]byte, maxSize)} +} + +func (this *fullReader) ReadMsg(msg proto.Message) error { + length, err := this.r.Read(this.buf) + if err != nil { + return err + } + return proto.Unmarshal(this.buf[:length], msg) +} + +func (this *fullReader) Close() error { + if closer, ok := this.r.(io.Closer); ok { + return closer.Close() + } + return nil +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/io.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/io.go new file mode 100644 index 00000000000..6dca519a18f --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/io.go @@ -0,0 +1,70 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package io + +import ( + "github.com/gogo/protobuf/proto" + "io" +) + +type Writer interface { + WriteMsg(proto.Message) error +} + +type WriteCloser interface { + Writer + io.Closer +} + +type Reader interface { + ReadMsg(msg proto.Message) error +} + +type ReadCloser interface { + Reader + io.Closer +} + +type marshaler interface { + MarshalTo(data []byte) (n int, err error) +} + +func getSize(v interface{}) (int, bool) { + if sz, ok := v.(interface { + Size() (n int) + }); ok { + return sz.Size(), true + } else if sz, ok := v.(interface { + ProtoSize() (n int) + }); ok { + return sz.ProtoSize(), true + } else { + return 0, false + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/uint32.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/uint32.go new file mode 100644 index 00000000000..c3dad1ae750 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/uint32.go @@ -0,0 +1,126 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package io + +import ( + "encoding/binary" + "github.com/gogo/protobuf/proto" + "io" +) + +func NewUint32DelimitedWriter(w io.Writer, byteOrder binary.ByteOrder) WriteCloser { + return &uint32Writer{w, byteOrder, nil} +} + +func NewSizeUint32DelimitedWriter(w io.Writer, byteOrder binary.ByteOrder, size int) WriteCloser { + return &uint32Writer{w, byteOrder, make([]byte, size)} +} + +type uint32Writer struct { + w io.Writer + byteOrder binary.ByteOrder + buffer []byte +} + +func (this *uint32Writer) WriteMsg(msg proto.Message) (err error) { + var data []byte + if m, ok := msg.(marshaler); ok { + n, ok := getSize(m) + if !ok { + data, err = proto.Marshal(msg) + if err != nil { + return err + } + } + if n >= len(this.buffer) { + this.buffer = make([]byte, n) + } + _, err = m.MarshalTo(this.buffer) + if err != nil { + return err + } + data = this.buffer[:n] + } else { + data, err = proto.Marshal(msg) + if err != nil { + return err + } + } + length := uint32(len(data)) + if err = binary.Write(this.w, this.byteOrder, &length); err != nil { + return err + } + _, err = this.w.Write(data) + return err +} + +func (this *uint32Writer) Close() error { + if closer, ok := this.w.(io.Closer); ok { + return closer.Close() + } + return nil +} + +type uint32Reader struct { + r io.Reader + byteOrder binary.ByteOrder + lenBuf []byte + buf []byte + maxSize int +} + +func NewUint32DelimitedReader(r io.Reader, byteOrder binary.ByteOrder, maxSize int) ReadCloser { + return &uint32Reader{r, byteOrder, make([]byte, 4), nil, maxSize} +} + +func (this *uint32Reader) ReadMsg(msg proto.Message) error { + if _, err := io.ReadFull(this.r, this.lenBuf); err != nil { + return err + } + length32 := this.byteOrder.Uint32(this.lenBuf) + length := int(length32) + if length < 0 || length > this.maxSize { + return io.ErrShortBuffer + } + if length >= len(this.buf) { + this.buf = make([]byte, length) + } + _, err := io.ReadFull(this.r, this.buf[:length]) + if err != nil { + return err + } + return proto.Unmarshal(this.buf[:length], msg) +} + +func (this *uint32Reader) Close() error { + if closer, ok := this.r.(io.Closer); ok { + return closer.Close() + } + return nil +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/varint.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/varint.go new file mode 100644 index 00000000000..a72e14a583e --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/varint.go @@ -0,0 +1,134 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package io + +import ( + "bufio" + "encoding/binary" + "errors" + "github.com/gogo/protobuf/proto" + "io" +) + +var ( + errSmallBuffer = errors.New("Buffer Too Small") + errLargeValue = errors.New("Value is Larger than 64 bits") +) + +func NewDelimitedWriter(w io.Writer) WriteCloser { + return &varintWriter{w, make([]byte, 10), nil} +} + +type varintWriter struct { + w io.Writer + lenBuf []byte + buffer []byte +} + +func (this *varintWriter) WriteMsg(msg proto.Message) (err error) { + var data []byte + if m, ok := msg.(marshaler); ok { + n, ok := getSize(m) + if !ok { + data, err = proto.Marshal(msg) + if err != nil { + return err + } + } + if n >= len(this.buffer) { + this.buffer = make([]byte, n) + } + _, err = m.MarshalTo(this.buffer) + if err != nil { + return err + } + data = this.buffer[:n] + } else { + data, err = proto.Marshal(msg) + if err != nil { + return err + } + } + length := uint64(len(data)) + n := binary.PutUvarint(this.lenBuf, length) + _, err = this.w.Write(this.lenBuf[:n]) + if err != nil { + return err + } + _, err = this.w.Write(data) + return err +} + +func (this *varintWriter) Close() error { + if closer, ok := this.w.(io.Closer); ok { + return closer.Close() + } + return nil +} + +func NewDelimitedReader(r io.Reader, maxSize int) ReadCloser { + var closer io.Closer + if c, ok := r.(io.Closer); ok { + closer = c + } + return &varintReader{bufio.NewReader(r), nil, maxSize, closer} +} + +type varintReader struct { + r *bufio.Reader + buf []byte + maxSize int + closer io.Closer +} + +func (this *varintReader) ReadMsg(msg proto.Message) error { + length64, err := binary.ReadUvarint(this.r) + if err != nil { + return err + } + length := int(length64) + if length < 0 || length > this.maxSize { + return io.ErrShortBuffer + } + if len(this.buf) < length { + this.buf = make([]byte, length) + } + buf := this.buf[:length] + if _, err := io.ReadFull(this.r, buf); err != nil { + return err + } + return proto.Unmarshal(buf, msg) +} + +func (this *varintReader) Close() error { + if this.closer != nil { + return this.closer.Close() + } + return nil +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/jsonpb/jsonpb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/jsonpb/jsonpb.go new file mode 100644 index 00000000000..e621c3d33d6 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/jsonpb/jsonpb.go @@ -0,0 +1,959 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2015 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +/* +Package jsonpb provides marshaling and unmarshaling between protocol buffers and JSON. +It follows the specification at https://developers.google.com/protocol-buffers/docs/proto3#json. + +This package produces a different output than the standard "encoding/json" package, +which does not operate correctly on protocol buffers. +*/ +package jsonpb + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io" + "reflect" + "sort" + "strconv" + "strings" + "time" + + "github.com/gogo/protobuf/proto" + "github.com/gogo/protobuf/types" +) + +// Marshaler is a configurable object for converting between +// protocol buffer objects and a JSON representation for them. +type Marshaler struct { + // Whether to render enum values as integers, as opposed to string values. + EnumsAsInts bool + + // Whether to render fields with zero values. + EmitDefaults bool + + // A string to indent each level by. The presence of this field will + // also cause a space to appear between the field separator and + // value, and for newlines to be appear between fields and array + // elements. + Indent string + + // Whether to use the original (.proto) name for fields. + OrigName bool +} + +// Marshal marshals a protocol buffer into JSON. +func (m *Marshaler) Marshal(out io.Writer, pb proto.Message) error { + writer := &errWriter{writer: out} + return m.marshalObject(writer, pb, "", "") +} + +// MarshalToString converts a protocol buffer object to JSON string. +func (m *Marshaler) MarshalToString(pb proto.Message) (string, error) { + var buf bytes.Buffer + if err := m.Marshal(&buf, pb); err != nil { + return "", err + } + return buf.String(), nil +} + +type int32Slice []int32 + +// For sorting extensions ids to ensure stable output. +func (s int32Slice) Len() int { return len(s) } +func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] } +func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } + +type isWkt interface { + XXX_WellKnownType() string +} + +// marshalObject writes a struct to the Writer. +func (m *Marshaler) marshalObject(out *errWriter, v proto.Message, indent, typeURL string) error { + s := reflect.ValueOf(v).Elem() + + // Handle well-known types. + if wkt, ok := v.(isWkt); ok { + switch wkt.XXX_WellKnownType() { + case "DoubleValue", "FloatValue", "Int64Value", "UInt64Value", + "Int32Value", "UInt32Value", "BoolValue", "StringValue", "BytesValue": + // "Wrappers use the same representation in JSON + // as the wrapped primitive type, ..." + sprop := proto.GetProperties(s.Type()) + return m.marshalValue(out, sprop.Prop[0], s.Field(0), indent) + case "Any": + // Any is a bit more involved. + return m.marshalAny(out, v, indent) + case "Duration": + // "Generated output always contains 3, 6, or 9 fractional digits, + // depending on required precision." + s, ns := s.Field(0).Int(), s.Field(1).Int() + d := time.Duration(s)*time.Second + time.Duration(ns)*time.Nanosecond + x := fmt.Sprintf("%.9f", d.Seconds()) + x = strings.TrimSuffix(x, "000") + x = strings.TrimSuffix(x, "000") + out.write(`"`) + out.write(x) + out.write(`s"`) + return out.err + case "Struct": + // Let marshalValue handle the `fields` map. + // TODO: pass the correct Properties if needed. + return m.marshalValue(out, &proto.Properties{}, s.Field(0), indent) + case "Timestamp": + // "RFC 3339, where generated output will always be Z-normalized + // and uses 3, 6 or 9 fractional digits." + s, ns := s.Field(0).Int(), s.Field(1).Int() + t := time.Unix(s, ns).UTC() + // time.RFC3339Nano isn't exactly right (we need to get 3/6/9 fractional digits). + x := t.Format("2006-01-02T15:04:05.000000000") + x = strings.TrimSuffix(x, "000") + x = strings.TrimSuffix(x, "000") + out.write(`"`) + out.write(x) + out.write(`Z"`) + return out.err + case "Value": + // Value has a single oneof. + kind := s.Field(0) + if kind.IsNil() { + // "absence of any variant indicates an error" + return errors.New("nil Value") + } + // oneof -> *T -> T -> T.F + x := kind.Elem().Elem().Field(0) + // TODO: pass the correct Properties if needed. + return m.marshalValue(out, &proto.Properties{}, x, indent) + } + } + + out.write("{") + if m.Indent != "" { + out.write("\n") + } + + firstField := true + + if typeURL != "" { + if err := m.marshalTypeURL(out, indent, typeURL); err != nil { + return err + } + firstField = false + } + + for i := 0; i < s.NumField(); i++ { + value := s.Field(i) + valueField := s.Type().Field(i) + if strings.HasPrefix(valueField.Name, "XXX_") { + continue + } + + // IsNil will panic on most value kinds. + switch value.Kind() { + case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: + if value.IsNil() { + continue + } + } + + if !m.EmitDefaults { + switch value.Kind() { + case reflect.Bool: + if !value.Bool() { + continue + } + case reflect.Int32, reflect.Int64: + if value.Int() == 0 { + continue + } + case reflect.Uint32, reflect.Uint64: + if value.Uint() == 0 { + continue + } + case reflect.Float32, reflect.Float64: + if value.Float() == 0 { + continue + } + case reflect.String: + if value.Len() == 0 { + continue + } + } + } + + // Oneof fields need special handling. + if valueField.Tag.Get("protobuf_oneof") != "" { + // value is an interface containing &T{real_value}. + sv := value.Elem().Elem() // interface -> *T -> T + value = sv.Field(0) + valueField = sv.Type().Field(0) + } + prop := jsonProperties(valueField, m.OrigName) + if !firstField { + m.writeSep(out) + } + // If the map value is a cast type, it may not implement proto.Message, therefore + // allow the struct tag to declare the underlying message type. Instead of changing + // the signatures of the child types (and because prop.mvalue is not public), use + // CustomType as a passer. + if value.Kind() == reflect.Map { + if tag := valueField.Tag.Get("protobuf"); tag != "" { + for _, v := range strings.Split(tag, ",") { + if !strings.HasPrefix(v, "castvaluetype=") { + continue + } + v = strings.TrimPrefix(v, "castvaluetype=") + prop.CustomType = v + break + } + } + } + if err := m.marshalField(out, prop, value, indent); err != nil { + return err + } + firstField = false + } + + // Handle proto2 extensions. + if ep, ok := v.(proto.Message); ok { + extensions := proto.RegisteredExtensions(v) + // Sort extensions for stable output. + ids := make([]int32, 0, len(extensions)) + for id, desc := range extensions { + if !proto.HasExtension(ep, desc) { + continue + } + ids = append(ids, id) + } + sort.Sort(int32Slice(ids)) + for _, id := range ids { + desc := extensions[id] + if desc == nil { + // unknown extension + continue + } + ext, extErr := proto.GetExtension(ep, desc) + if extErr != nil { + return extErr + } + value := reflect.ValueOf(ext) + var prop proto.Properties + prop.Parse(desc.Tag) + prop.JSONName = fmt.Sprintf("[%s]", desc.Name) + if !firstField { + m.writeSep(out) + } + if err := m.marshalField(out, &prop, value, indent); err != nil { + return err + } + firstField = false + } + + } + + if m.Indent != "" { + out.write("\n") + out.write(indent) + } + out.write("}") + return out.err +} + +func (m *Marshaler) writeSep(out *errWriter) { + if m.Indent != "" { + out.write(",\n") + } else { + out.write(",") + } +} + +func (m *Marshaler) marshalAny(out *errWriter, any proto.Message, indent string) error { + // "If the Any contains a value that has a special JSON mapping, + // it will be converted as follows: {"@type": xxx, "value": yyy}. + // Otherwise, the value will be converted into a JSON object, + // and the "@type" field will be inserted to indicate the actual data type." + v := reflect.ValueOf(any).Elem() + turl := v.Field(0).String() + val := v.Field(1).Bytes() + + // Only the part of type_url after the last slash is relevant. + mname := turl + if slash := strings.LastIndex(mname, "/"); slash >= 0 { + mname = mname[slash+1:] + } + mt := proto.MessageType(mname) + if mt == nil { + return fmt.Errorf("unknown message type %q", mname) + } + msg := reflect.New(mt.Elem()).Interface().(proto.Message) + if err := proto.Unmarshal(val, msg); err != nil { + return err + } + + if _, ok := msg.(isWkt); ok { + out.write("{") + if m.Indent != "" { + out.write("\n") + } + if err := m.marshalTypeURL(out, indent, turl); err != nil { + return err + } + m.writeSep(out) + if m.Indent != "" { + out.write(indent) + out.write(m.Indent) + out.write(`"value": `) + } else { + out.write(`"value":`) + } + if err := m.marshalObject(out, msg, indent+m.Indent, ""); err != nil { + return err + } + if m.Indent != "" { + out.write("\n") + out.write(indent) + } + out.write("}") + return out.err + } + + return m.marshalObject(out, msg, indent, turl) +} + +func (m *Marshaler) marshalTypeURL(out *errWriter, indent, typeURL string) error { + if m.Indent != "" { + out.write(indent) + out.write(m.Indent) + } + out.write(`"@type":`) + if m.Indent != "" { + out.write(" ") + } + b, err := json.Marshal(typeURL) + if err != nil { + return err + } + out.write(string(b)) + return out.err +} + +// marshalField writes field description and value to the Writer. +func (m *Marshaler) marshalField(out *errWriter, prop *proto.Properties, v reflect.Value, indent string) error { + if m.Indent != "" { + out.write(indent) + out.write(m.Indent) + } + out.write(`"`) + out.write(prop.JSONName) + out.write(`":`) + if m.Indent != "" { + out.write(" ") + } + if err := m.marshalValue(out, prop, v, indent); err != nil { + return err + } + return nil +} + +// marshalValue writes the value to the Writer. +func (m *Marshaler) marshalValue(out *errWriter, prop *proto.Properties, v reflect.Value, indent string) error { + + v = reflect.Indirect(v) + + // Handle repeated elements. + if v.Kind() == reflect.Slice && v.Type().Elem().Kind() != reflect.Uint8 { + out.write("[") + comma := "" + for i := 0; i < v.Len(); i++ { + sliceVal := v.Index(i) + out.write(comma) + if m.Indent != "" { + out.write("\n") + out.write(indent) + out.write(m.Indent) + out.write(m.Indent) + } + if err := m.marshalValue(out, prop, sliceVal, indent+m.Indent); err != nil { + return err + } + comma = "," + } + if m.Indent != "" { + out.write("\n") + out.write(indent) + out.write(m.Indent) + } + out.write("]") + return out.err + } + + // Handle well-known types. + // Most are handled up in marshalObject (because 99% are messages). + if wkt, ok := v.Interface().(isWkt); ok { + switch wkt.XXX_WellKnownType() { + case "NullValue": + out.write("null") + return out.err + } + } + + if t, ok := v.Interface().(time.Time); ok { + ts, err := types.TimestampProto(t) + if err != nil { + return err + } + return m.marshalValue(out, prop, reflect.ValueOf(ts), indent) + } + + if d, ok := v.Interface().(time.Duration); ok { + dur := types.DurationProto(d) + return m.marshalValue(out, prop, reflect.ValueOf(dur), indent) + } + + // Handle enumerations. + if !m.EnumsAsInts && prop.Enum != "" { + // Unknown enum values will are stringified by the proto library as their + // value. Such values should _not_ be quoted or they will be interpreted + // as an enum string instead of their value. + enumStr := v.Interface().(fmt.Stringer).String() + var valStr string + if v.Kind() == reflect.Ptr { + valStr = strconv.Itoa(int(v.Elem().Int())) + } else { + valStr = strconv.Itoa(int(v.Int())) + } + + if m, ok := v.Interface().(interface { + MarshalJSON() ([]byte, error) + }); ok { + data, err := m.MarshalJSON() + if err != nil { + return err + } + enumStr = string(data) + enumStr, err = strconv.Unquote(enumStr) + if err != nil { + return err + } + } + + isKnownEnum := enumStr != valStr + + if isKnownEnum { + out.write(`"`) + } + out.write(enumStr) + if isKnownEnum { + out.write(`"`) + } + return out.err + } + + // Handle nested messages. + if v.Kind() == reflect.Struct { + i := v + if v.CanAddr() { + i = v.Addr() + } else { + i = reflect.New(v.Type()) + i.Elem().Set(v) + } + iface := i.Interface() + if iface == nil { + out.write(`null`) + return out.err + } + pm, ok := iface.(proto.Message) + if !ok { + if prop.CustomType == "" { + return fmt.Errorf("%v does not implement proto.Message", v.Type()) + } + t := proto.MessageType(prop.CustomType) + if t == nil || !i.Type().ConvertibleTo(t) { + return fmt.Errorf("%v declared custom type %s but it is not convertible to %v", v.Type(), prop.CustomType, t) + } + pm = i.Convert(t).Interface().(proto.Message) + } + return m.marshalObject(out, pm, indent+m.Indent, "") + } + + // Handle maps. + // Since Go randomizes map iteration, we sort keys for stable output. + if v.Kind() == reflect.Map { + out.write(`{`) + keys := v.MapKeys() + sort.Sort(mapKeys(keys)) + for i, k := range keys { + if i > 0 { + out.write(`,`) + } + if m.Indent != "" { + out.write("\n") + out.write(indent) + out.write(m.Indent) + out.write(m.Indent) + } + + b, err := json.Marshal(k.Interface()) + if err != nil { + return err + } + s := string(b) + + // If the JSON is not a string value, encode it again to make it one. + if !strings.HasPrefix(s, `"`) { + b, err := json.Marshal(s) + if err != nil { + return err + } + s = string(b) + } + + out.write(s) + out.write(`:`) + if m.Indent != "" { + out.write(` `) + } + + if err := m.marshalValue(out, prop, v.MapIndex(k), indent+m.Indent); err != nil { + return err + } + } + if m.Indent != "" { + out.write("\n") + out.write(indent) + out.write(m.Indent) + } + out.write(`}`) + return out.err + } + + // Default handling defers to the encoding/json library. + b, err := json.Marshal(v.Interface()) + if err != nil { + return err + } + needToQuote := string(b[0]) != `"` && (v.Kind() == reflect.Int64 || v.Kind() == reflect.Uint64) + if needToQuote { + out.write(`"`) + } + out.write(string(b)) + if needToQuote { + out.write(`"`) + } + return out.err +} + +// Unmarshaler is a configurable object for converting from a JSON +// representation to a protocol buffer object. +type Unmarshaler struct { + // Whether to allow messages to contain unknown fields, as opposed to + // failing to unmarshal. + AllowUnknownFields bool +} + +// UnmarshalNext unmarshals the next protocol buffer from a JSON object stream. +// This function is lenient and will decode any options permutations of the +// related Marshaler. +func (u *Unmarshaler) UnmarshalNext(dec *json.Decoder, pb proto.Message) error { + inputValue := json.RawMessage{} + if err := dec.Decode(&inputValue); err != nil { + return err + } + return u.unmarshalValue(reflect.ValueOf(pb).Elem(), inputValue, nil) +} + +// Unmarshal unmarshals a JSON object stream into a protocol +// buffer. This function is lenient and will decode any options +// permutations of the related Marshaler. +func (u *Unmarshaler) Unmarshal(r io.Reader, pb proto.Message) error { + dec := json.NewDecoder(r) + return u.UnmarshalNext(dec, pb) +} + +// UnmarshalNext unmarshals the next protocol buffer from a JSON object stream. +// This function is lenient and will decode any options permutations of the +// related Marshaler. +func UnmarshalNext(dec *json.Decoder, pb proto.Message) error { + return new(Unmarshaler).UnmarshalNext(dec, pb) +} + +// Unmarshal unmarshals a JSON object stream into a protocol +// buffer. This function is lenient and will decode any options +// permutations of the related Marshaler. +func Unmarshal(r io.Reader, pb proto.Message) error { + return new(Unmarshaler).Unmarshal(r, pb) +} + +// UnmarshalString will populate the fields of a protocol buffer based +// on a JSON string. This function is lenient and will decode any options +// permutations of the related Marshaler. +func UnmarshalString(str string, pb proto.Message) error { + return new(Unmarshaler).Unmarshal(strings.NewReader(str), pb) +} + +// unmarshalValue converts/copies a value into the target. +// prop may be nil. +func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMessage, prop *proto.Properties) error { + targetType := target.Type() + + // Allocate memory for pointer fields. + if targetType.Kind() == reflect.Ptr { + target.Set(reflect.New(targetType.Elem())) + return u.unmarshalValue(target.Elem(), inputValue, prop) + } + + // Handle well-known types. + if wkt, ok := target.Addr().Interface().(isWkt); ok { + switch wkt.XXX_WellKnownType() { + case "DoubleValue", "FloatValue", "Int64Value", "UInt64Value", + "Int32Value", "UInt32Value", "BoolValue", "StringValue", "BytesValue": + // "Wrappers use the same representation in JSON + // as the wrapped primitive type, except that null is allowed." + // encoding/json will turn JSON `null` into Go `nil`, + // so we don't have to do any extra work. + return u.unmarshalValue(target.Field(0), inputValue, prop) + case "Any": + return fmt.Errorf("unmarshaling Any not supported yet") + case "Duration": + ivStr := string(inputValue) + if ivStr == "null" { + target.Field(0).SetInt(0) + target.Field(1).SetInt(0) + return nil + } + + unq, err := strconv.Unquote(ivStr) + if err != nil { + return err + } + d, err := time.ParseDuration(unq) + if err != nil { + return fmt.Errorf("bad Duration: %v", err) + } + ns := d.Nanoseconds() + s := ns / 1e9 + ns %= 1e9 + target.Field(0).SetInt(s) + target.Field(1).SetInt(ns) + return nil + case "Timestamp": + ivStr := string(inputValue) + if ivStr == "null" { + target.Field(0).SetInt(0) + target.Field(1).SetInt(0) + return nil + } + + unq, err := strconv.Unquote(ivStr) + if err != nil { + return err + } + t, err := time.Parse(time.RFC3339Nano, unq) + if err != nil { + return fmt.Errorf("bad Timestamp: %v", err) + } + target.Field(0).SetInt(int64(t.Unix())) + target.Field(1).SetInt(int64(t.Nanosecond())) + return nil + } + } + + if t, ok := target.Addr().Interface().(*time.Time); ok { + ts := &types.Timestamp{} + if err := u.unmarshalValue(reflect.ValueOf(ts).Elem(), inputValue, prop); err != nil { + return err + } + tt, err := types.TimestampFromProto(ts) + if err != nil { + return err + } + *t = tt + return nil + } + + if d, ok := target.Addr().Interface().(*time.Duration); ok { + dur := &types.Duration{} + if err := u.unmarshalValue(reflect.ValueOf(dur).Elem(), inputValue, prop); err != nil { + return err + } + dd, err := types.DurationFromProto(dur) + if err != nil { + return err + } + *d = dd + return nil + } + + // Handle enums, which have an underlying type of int32, + // and may appear as strings. + // The case of an enum appearing as a number is handled + // at the bottom of this function. + if inputValue[0] == '"' && prop != nil && prop.Enum != "" { + vmap := proto.EnumValueMap(prop.Enum) + // Don't need to do unquoting; valid enum names + // are from a limited character set. + s := inputValue[1 : len(inputValue)-1] + n, ok := vmap[string(s)] + if !ok { + return fmt.Errorf("unknown value %q for enum %s", s, prop.Enum) + } + if target.Kind() == reflect.Ptr { // proto2 + target.Set(reflect.New(targetType.Elem())) + target = target.Elem() + } + target.SetInt(int64(n)) + return nil + } + + // Handle nested messages. + if targetType.Kind() == reflect.Struct { + var jsonFields map[string]json.RawMessage + if err := json.Unmarshal(inputValue, &jsonFields); err != nil { + return err + } + + consumeField := func(prop *proto.Properties) (json.RawMessage, bool) { + // Be liberal in what names we accept; both orig_name and camelName are okay. + fieldNames := acceptedJSONFieldNames(prop) + + vOrig, okOrig := jsonFields[fieldNames.orig] + vCamel, okCamel := jsonFields[fieldNames.camel] + if !okOrig && !okCamel { + return nil, false + } + // If, for some reason, both are present in the data, favour the camelName. + var raw json.RawMessage + if okOrig { + raw = vOrig + delete(jsonFields, fieldNames.orig) + } + if okCamel { + raw = vCamel + delete(jsonFields, fieldNames.camel) + } + return raw, true + } + + sprops := proto.GetProperties(targetType) + for i := 0; i < target.NumField(); i++ { + ft := target.Type().Field(i) + if strings.HasPrefix(ft.Name, "XXX_") { + continue + } + valueForField, ok := consumeField(sprops.Prop[i]) + if !ok { + continue + } + + if err := u.unmarshalValue(target.Field(i), valueForField, sprops.Prop[i]); err != nil { + return err + } + } + // Check for any oneof fields. + if len(jsonFields) > 0 { + for _, oop := range sprops.OneofTypes { + raw, ok := consumeField(oop.Prop) + if !ok { + continue + } + nv := reflect.New(oop.Type.Elem()) + target.Field(oop.Field).Set(nv) + if err := u.unmarshalValue(nv.Elem().Field(0), raw, oop.Prop); err != nil { + return err + } + } + } + if !u.AllowUnknownFields && len(jsonFields) > 0 { + // Pick any field to be the scapegoat. + var f string + for fname := range jsonFields { + f = fname + break + } + return fmt.Errorf("unknown field %q in %v", f, targetType) + } + return nil + } + + // Handle arrays + if targetType.Kind() == reflect.Slice { + if targetType.Elem().Kind() == reflect.Uint8 { + outRef := reflect.New(targetType) + outVal := outRef.Interface() + //CustomType with underlying type []byte + if _, ok := outVal.(interface { + UnmarshalJSON([]byte) error + }); ok { + if err := json.Unmarshal(inputValue, outVal); err != nil { + return err + } + target.Set(outRef.Elem()) + return nil + } + // Special case for encoded bytes. Pre-go1.5 doesn't support unmarshalling + // strings into aliased []byte types. + // https://github.com/golang/go/commit/4302fd0409da5e4f1d71471a6770dacdc3301197 + // https://github.com/golang/go/commit/c60707b14d6be26bf4213114d13070bff00d0b0a + var out []byte + if err := json.Unmarshal(inputValue, &out); err != nil { + return err + } + target.SetBytes(out) + return nil + } + + var slc []json.RawMessage + if err := json.Unmarshal(inputValue, &slc); err != nil { + return err + } + len := len(slc) + target.Set(reflect.MakeSlice(targetType, len, len)) + for i := 0; i < len; i++ { + if err := u.unmarshalValue(target.Index(i), slc[i], prop); err != nil { + return err + } + } + return nil + } + + // Handle maps (whose keys are always strings) + if targetType.Kind() == reflect.Map { + var mp map[string]json.RawMessage + if err := json.Unmarshal(inputValue, &mp); err != nil { + return err + } + target.Set(reflect.MakeMap(targetType)) + var keyprop, valprop *proto.Properties + if prop != nil { + // These could still be nil if the protobuf metadata is broken somehow. + // TODO: This won't work because the fields are unexported. + // We should probably just reparse them. + //keyprop, valprop = prop.mkeyprop, prop.mvalprop + } + for ks, raw := range mp { + // Unmarshal map key. The core json library already decoded the key into a + // string, so we handle that specially. Other types were quoted post-serialization. + var k reflect.Value + if targetType.Key().Kind() == reflect.String { + k = reflect.ValueOf(ks) + } else { + k = reflect.New(targetType.Key()).Elem() + if err := u.unmarshalValue(k, json.RawMessage(ks), keyprop); err != nil { + return err + } + } + + if !k.Type().AssignableTo(targetType.Key()) { + k = k.Convert(targetType.Key()) + } + + // Unmarshal map value. + v := reflect.New(targetType.Elem()).Elem() + if err := u.unmarshalValue(v, raw, valprop); err != nil { + return err + } + target.SetMapIndex(k, v) + } + return nil + } + + // 64-bit integers can be encoded as strings. In this case we drop + // the quotes and proceed as normal. + isNum := targetType.Kind() == reflect.Int64 || targetType.Kind() == reflect.Uint64 + if isNum && strings.HasPrefix(string(inputValue), `"`) { + inputValue = inputValue[1 : len(inputValue)-1] + } + + // Use the encoding/json for parsing other value types. + return json.Unmarshal(inputValue, target.Addr().Interface()) +} + +// jsonProperties returns parsed proto.Properties for the field and corrects JSONName attribute. +func jsonProperties(f reflect.StructField, origName bool) *proto.Properties { + var prop proto.Properties + prop.Init(f.Type, f.Name, f.Tag.Get("protobuf"), &f) + if origName || prop.JSONName == "" { + prop.JSONName = prop.OrigName + } + return &prop +} + +type fieldNames struct { + orig, camel string +} + +func acceptedJSONFieldNames(prop *proto.Properties) fieldNames { + opts := fieldNames{orig: prop.OrigName, camel: prop.OrigName} + if prop.JSONName != "" { + opts.camel = prop.JSONName + } + return opts +} + +// Writer wrapper inspired by https://blog.golang.org/errors-are-values +type errWriter struct { + writer io.Writer + err error +} + +func (w *errWriter) write(str string) { + if w.err != nil { + return + } + _, w.err = w.writer.Write([]byte(str)) +} + +// Map fields may have key types of non-float scalars, strings and enums. +// The easiest way to sort them in some deterministic order is to use fmt. +// If this turns out to be inefficient we can always consider other options, +// such as doing a Schwartzian transform. +// +// Numeric keys are sorted in numeric order per +// https://developers.google.com/protocol-buffers/docs/proto#maps. +type mapKeys []reflect.Value + +func (s mapKeys) Len() int { return len(s) } +func (s mapKeys) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +func (s mapKeys) Less(i, j int) bool { + if k := s[i].Kind(); k == s[j].Kind() { + switch k { + case reflect.Int32, reflect.Int64: + return s[i].Int() < s[j].Int() + case reflect.Uint32, reflect.Uint64: + return s[i].Uint() < s[j].Uint() + } + } + return fmt.Sprint(s[i].Interface()) < fmt.Sprint(s[j].Interface()) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/compare/compare.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/compare/compare.go new file mode 100644 index 00000000000..75c0399af93 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/compare/compare.go @@ -0,0 +1,526 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package compare + +import ( + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/proto" + descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" + "github.com/gogo/protobuf/vanity" +) + +type plugin struct { + *generator.Generator + generator.PluginImports + fmtPkg generator.Single + bytesPkg generator.Single + sortkeysPkg generator.Single + protoPkg generator.Single +} + +func NewPlugin() *plugin { + return &plugin{} +} + +func (p *plugin) Name() string { + return "compare" +} + +func (p *plugin) Init(g *generator.Generator) { + p.Generator = g +} + +func (p *plugin) Generate(file *generator.FileDescriptor) { + p.PluginImports = generator.NewPluginImports(p.Generator) + p.fmtPkg = p.NewImport("fmt") + p.bytesPkg = p.NewImport("bytes") + p.sortkeysPkg = p.NewImport("github.com/gogo/protobuf/sortkeys") + p.protoPkg = p.NewImport("github.com/gogo/protobuf/proto") + + for _, msg := range file.Messages() { + if msg.DescriptorProto.GetOptions().GetMapEntry() { + continue + } + if gogoproto.HasCompare(file.FileDescriptorProto, msg.DescriptorProto) { + p.generateMessage(file, msg) + } + } +} + +func (p *plugin) generateNullableField(fieldname string) { + p.P(`if this.`, fieldname, ` != nil && that1.`, fieldname, ` != nil {`) + p.In() + p.P(`if *this.`, fieldname, ` != *that1.`, fieldname, `{`) + p.In() + p.P(`if *this.`, fieldname, ` < *that1.`, fieldname, `{`) + p.In() + p.P(`return -1`) + p.Out() + p.P(`}`) + p.P(`return 1`) + p.Out() + p.P(`}`) + p.Out() + p.P(`} else if this.`, fieldname, ` != nil {`) + p.In() + p.P(`return 1`) + p.Out() + p.P(`} else if that1.`, fieldname, ` != nil {`) + p.In() + p.P(`return -1`) + p.Out() + p.P(`}`) +} + +func (p *plugin) generateMsgNullAndTypeCheck(ccTypeName string) { + p.P(`if that == nil {`) + p.In() + p.P(`if this == nil {`) + p.In() + p.P(`return 0`) + p.Out() + p.P(`}`) + p.P(`return 1`) + p.Out() + p.P(`}`) + p.P(``) + p.P(`that1, ok := that.(*`, ccTypeName, `)`) + p.P(`if !ok {`) + p.In() + p.P(`that2, ok := that.(`, ccTypeName, `)`) + p.P(`if ok {`) + p.In() + p.P(`that1 = &that2`) + p.Out() + p.P(`} else {`) + p.In() + p.P(`return 1`) + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + p.P(`if that1 == nil {`) + p.In() + p.P(`if this == nil {`) + p.In() + p.P(`return 0`) + p.Out() + p.P(`}`) + p.P(`return 1`) + p.Out() + p.P(`} else if this == nil {`) + p.In() + p.P(`return -1`) + p.Out() + p.P(`}`) +} + +func (p *plugin) generateField(file *generator.FileDescriptor, message *generator.Descriptor, field *descriptor.FieldDescriptorProto) { + proto3 := gogoproto.IsProto3(file.FileDescriptorProto) + fieldname := p.GetOneOfFieldName(message, field) + repeated := field.IsRepeated() + ctype := gogoproto.IsCustomType(field) + nullable := gogoproto.IsNullable(field) + // oneof := field.OneofIndex != nil + if !repeated { + if ctype { + if nullable { + p.P(`if that1.`, fieldname, ` == nil {`) + p.In() + p.P(`if this.`, fieldname, ` != nil {`) + p.In() + p.P(`return 1`) + p.Out() + p.P(`}`) + p.Out() + p.P(`} else if this.`, fieldname, ` == nil {`) + p.In() + p.P(`return -1`) + p.Out() + p.P(`} else if c := this.`, fieldname, `.Compare(*that1.`, fieldname, `); c != 0 {`) + } else { + p.P(`if c := this.`, fieldname, `.Compare(that1.`, fieldname, `); c != 0 {`) + } + p.In() + p.P(`return c`) + p.Out() + p.P(`}`) + } else { + if field.IsMessage() || p.IsGroup(field) { + if nullable { + p.P(`if c := this.`, fieldname, `.Compare(that1.`, fieldname, `); c != 0 {`) + } else { + p.P(`if c := this.`, fieldname, `.Compare(&that1.`, fieldname, `); c != 0 {`) + } + p.In() + p.P(`return c`) + p.Out() + p.P(`}`) + } else if field.IsBytes() { + p.P(`if c := `, p.bytesPkg.Use(), `.Compare(this.`, fieldname, `, that1.`, fieldname, `); c != 0 {`) + p.In() + p.P(`return c`) + p.Out() + p.P(`}`) + } else if field.IsString() { + if nullable && !proto3 { + p.generateNullableField(fieldname) + } else { + p.P(`if this.`, fieldname, ` != that1.`, fieldname, `{`) + p.In() + p.P(`if this.`, fieldname, ` < that1.`, fieldname, `{`) + p.In() + p.P(`return -1`) + p.Out() + p.P(`}`) + p.P(`return 1`) + p.Out() + p.P(`}`) + } + } else if field.IsBool() { + if nullable && !proto3 { + p.P(`if this.`, fieldname, ` != nil && that1.`, fieldname, ` != nil {`) + p.In() + p.P(`if *this.`, fieldname, ` != *that1.`, fieldname, `{`) + p.In() + p.P(`if !*this.`, fieldname, ` {`) + p.In() + p.P(`return -1`) + p.Out() + p.P(`}`) + p.P(`return 1`) + p.Out() + p.P(`}`) + p.Out() + p.P(`} else if this.`, fieldname, ` != nil {`) + p.In() + p.P(`return 1`) + p.Out() + p.P(`} else if that1.`, fieldname, ` != nil {`) + p.In() + p.P(`return -1`) + p.Out() + p.P(`}`) + } else { + p.P(`if this.`, fieldname, ` != that1.`, fieldname, `{`) + p.In() + p.P(`if !this.`, fieldname, ` {`) + p.In() + p.P(`return -1`) + p.Out() + p.P(`}`) + p.P(`return 1`) + p.Out() + p.P(`}`) + } + } else { + if nullable && !proto3 { + p.generateNullableField(fieldname) + } else { + p.P(`if this.`, fieldname, ` != that1.`, fieldname, `{`) + p.In() + p.P(`if this.`, fieldname, ` < that1.`, fieldname, `{`) + p.In() + p.P(`return -1`) + p.Out() + p.P(`}`) + p.P(`return 1`) + p.Out() + p.P(`}`) + } + } + } + } else { + p.P(`if len(this.`, fieldname, `) != len(that1.`, fieldname, `) {`) + p.In() + p.P(`if len(this.`, fieldname, `) < len(that1.`, fieldname, `) {`) + p.In() + p.P(`return -1`) + p.Out() + p.P(`}`) + p.P(`return 1`) + p.Out() + p.P(`}`) + p.P(`for i := range this.`, fieldname, ` {`) + p.In() + if ctype { + p.P(`if c := this.`, fieldname, `[i].Compare(that1.`, fieldname, `[i]); c != 0 {`) + p.In() + p.P(`return c`) + p.Out() + p.P(`}`) + } else { + if p.IsMap(field) { + m := p.GoMapType(nil, field) + valuegoTyp, _ := p.GoType(nil, m.ValueField) + valuegoAliasTyp, _ := p.GoType(nil, m.ValueAliasField) + nullable, valuegoTyp, valuegoAliasTyp = generator.GoMapValueTypes(field, m.ValueField, valuegoTyp, valuegoAliasTyp) + + mapValue := m.ValueAliasField + if mapValue.IsMessage() || p.IsGroup(mapValue) { + if nullable && valuegoTyp == valuegoAliasTyp { + p.P(`if c := this.`, fieldname, `[i].Compare(that1.`, fieldname, `[i]); c != 0 {`) + } else { + // Compare() has a pointer receiver, but map value is a value type + a := `this.` + fieldname + `[i]` + b := `that1.` + fieldname + `[i]` + if valuegoTyp != valuegoAliasTyp { + // cast back to the type that has the generated methods on it + a = `(` + valuegoTyp + `)(` + a + `)` + b = `(` + valuegoTyp + `)(` + b + `)` + } + p.P(`a := `, a) + p.P(`b := `, b) + if nullable { + p.P(`if c := a.Compare(b); c != 0 {`) + } else { + p.P(`if c := (&a).Compare(&b); c != 0 {`) + } + } + p.In() + p.P(`return c`) + p.Out() + p.P(`}`) + } else if mapValue.IsBytes() { + p.P(`if c := `, p.bytesPkg.Use(), `.Compare(this.`, fieldname, `[i], that1.`, fieldname, `[i]); c != 0 {`) + p.In() + p.P(`return c`) + p.Out() + p.P(`}`) + } else if mapValue.IsString() { + p.P(`if this.`, fieldname, `[i] != that1.`, fieldname, `[i] {`) + p.In() + p.P(`if this.`, fieldname, `[i] < that1.`, fieldname, `[i] {`) + p.In() + p.P(`return -1`) + p.Out() + p.P(`}`) + p.P(`return 1`) + p.Out() + p.P(`}`) + } else { + p.P(`if this.`, fieldname, `[i] != that1.`, fieldname, `[i] {`) + p.In() + p.P(`if this.`, fieldname, `[i] < that1.`, fieldname, `[i] {`) + p.In() + p.P(`return -1`) + p.Out() + p.P(`}`) + p.P(`return 1`) + p.Out() + p.P(`}`) + } + } else if field.IsMessage() || p.IsGroup(field) { + if nullable { + p.P(`if c := this.`, fieldname, `[i].Compare(that1.`, fieldname, `[i]); c != 0 {`) + p.In() + p.P(`return c`) + p.Out() + p.P(`}`) + } else { + p.P(`if c := this.`, fieldname, `[i].Compare(&that1.`, fieldname, `[i]); c != 0 {`) + p.In() + p.P(`return c`) + p.Out() + p.P(`}`) + } + } else if field.IsBytes() { + p.P(`if c := `, p.bytesPkg.Use(), `.Compare(this.`, fieldname, `[i], that1.`, fieldname, `[i]); c != 0 {`) + p.In() + p.P(`return c`) + p.Out() + p.P(`}`) + } else if field.IsString() { + p.P(`if this.`, fieldname, `[i] != that1.`, fieldname, `[i] {`) + p.In() + p.P(`if this.`, fieldname, `[i] < that1.`, fieldname, `[i] {`) + p.In() + p.P(`return -1`) + p.Out() + p.P(`}`) + p.P(`return 1`) + p.Out() + p.P(`}`) + } else if field.IsBool() { + p.P(`if this.`, fieldname, `[i] != that1.`, fieldname, `[i] {`) + p.In() + p.P(`if !this.`, fieldname, `[i] {`) + p.In() + p.P(`return -1`) + p.Out() + p.P(`}`) + p.P(`return 1`) + p.Out() + p.P(`}`) + } else { + p.P(`if this.`, fieldname, `[i] != that1.`, fieldname, `[i] {`) + p.In() + p.P(`if this.`, fieldname, `[i] < that1.`, fieldname, `[i] {`) + p.In() + p.P(`return -1`) + p.Out() + p.P(`}`) + p.P(`return 1`) + p.Out() + p.P(`}`) + } + } + p.Out() + p.P(`}`) + } +} + +func (p *plugin) generateMessage(file *generator.FileDescriptor, message *generator.Descriptor) { + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + p.P(`func (this *`, ccTypeName, `) Compare(that interface{}) int {`) + p.In() + p.generateMsgNullAndTypeCheck(ccTypeName) + oneofs := make(map[string]struct{}) + + for _, field := range message.Field { + oneof := field.OneofIndex != nil + if oneof { + fieldname := p.GetFieldName(message, field) + if _, ok := oneofs[fieldname]; ok { + continue + } else { + oneofs[fieldname] = struct{}{} + } + p.P(`if that1.`, fieldname, ` == nil {`) + p.In() + p.P(`if this.`, fieldname, ` != nil {`) + p.In() + p.P(`return 1`) + p.Out() + p.P(`}`) + p.Out() + p.P(`} else if this.`, fieldname, ` == nil {`) + p.In() + p.P(`return -1`) + p.Out() + p.P(`} else if c := this.`, fieldname, `.Compare(that1.`, fieldname, `); c != 0 {`) + p.In() + p.P(`return c`) + p.Out() + p.P(`}`) + } else { + p.generateField(file, message, field) + } + } + if message.DescriptorProto.HasExtension() { + if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) { + p.P(`thismap := `, p.protoPkg.Use(), `.GetUnsafeExtensionsMap(this)`) + p.P(`thatmap := `, p.protoPkg.Use(), `.GetUnsafeExtensionsMap(that1)`) + p.P(`extkeys := make([]int32, 0, len(thismap)+len(thatmap))`) + p.P(`for k, _ := range thismap {`) + p.In() + p.P(`extkeys = append(extkeys, k)`) + p.Out() + p.P(`}`) + p.P(`for k, _ := range thatmap {`) + p.In() + p.P(`if _, ok := thismap[k]; !ok {`) + p.In() + p.P(`extkeys = append(extkeys, k)`) + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + p.P(p.sortkeysPkg.Use(), `.Int32s(extkeys)`) + p.P(`for _, k := range extkeys {`) + p.In() + p.P(`if v, ok := thismap[k]; ok {`) + p.In() + p.P(`if v2, ok := thatmap[k]; ok {`) + p.In() + p.P(`if c := v.Compare(&v2); c != 0 {`) + p.In() + p.P(`return c`) + p.Out() + p.P(`}`) + p.Out() + p.P(`} else {`) + p.In() + p.P(`return 1`) + p.Out() + p.P(`}`) + p.Out() + p.P(`} else {`) + p.In() + p.P(`return -1`) + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + } else { + fieldname := "XXX_extensions" + p.P(`if c := `, p.bytesPkg.Use(), `.Compare(this.`, fieldname, `, that1.`, fieldname, `); c != 0 {`) + p.In() + p.P(`return c`) + p.Out() + p.P(`}`) + } + } + if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) { + fieldname := "XXX_unrecognized" + p.P(`if c := `, p.bytesPkg.Use(), `.Compare(this.`, fieldname, `, that1.`, fieldname, `); c != 0 {`) + p.In() + p.P(`return c`) + p.Out() + p.P(`}`) + } + p.P(`return 0`) + p.Out() + p.P(`}`) + + //Generate Compare methods for oneof fields + m := proto.Clone(message.DescriptorProto).(*descriptor.DescriptorProto) + for _, field := range m.Field { + oneof := field.OneofIndex != nil + if !oneof { + continue + } + ccTypeName := p.OneOfTypeName(message, field) + p.P(`func (this *`, ccTypeName, `) Compare(that interface{}) int {`) + p.In() + + p.generateMsgNullAndTypeCheck(ccTypeName) + vanity.TurnOffNullableForNativeTypesWithoutDefaultsOnly(field) + p.generateField(file, message, field) + + p.P(`return 0`) + p.Out() + p.P(`}`) + } +} + +func init() { + generator.RegisterPlugin(NewPlugin()) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/compare/comparetest.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/compare/comparetest.go new file mode 100644 index 00000000000..4db0d6acc57 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/compare/comparetest.go @@ -0,0 +1,107 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package compare + +import ( + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/plugin/testgen" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" +) + +type test struct { + *generator.Generator +} + +func NewTest(g *generator.Generator) testgen.TestPlugin { + return &test{g} +} + +func (p *test) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool { + used := false + randPkg := imports.NewImport("math/rand") + timePkg := imports.NewImport("time") + testingPkg := imports.NewImport("testing") + protoPkg := imports.NewImport("github.com/gogo/protobuf/proto") + if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { + protoPkg = imports.NewImport("github.com/golang/protobuf/proto") + } + for _, message := range file.Messages() { + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + if !gogoproto.HasCompare(file.FileDescriptorProto, message.DescriptorProto) { + continue + } + if message.DescriptorProto.GetOptions().GetMapEntry() { + continue + } + + if gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { + used = true + p.P(`func Test`, ccTypeName, `Compare(t *`, testingPkg.Use(), `.T) {`) + p.In() + p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(`, timePkg.Use(), `.Now().UnixNano()))`) + p.P(`p := NewPopulated`, ccTypeName, `(popr, false)`) + p.P(`dAtA, err := `, protoPkg.Use(), `.Marshal(p)`) + p.P(`if err != nil {`) + p.In() + p.P(`panic(err)`) + p.Out() + p.P(`}`) + p.P(`msg := &`, ccTypeName, `{}`) + p.P(`if err := `, protoPkg.Use(), `.Unmarshal(dAtA, msg); err != nil {`) + p.In() + p.P(`panic(err)`) + p.Out() + p.P(`}`) + p.P(`if c := p.Compare(msg); c != 0 {`) + p.In() + p.P(`t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)`) + p.Out() + p.P(`}`) + p.P(`p2 := NewPopulated`, ccTypeName, `(popr, false)`) + p.P(`c := p.Compare(p2)`) + p.P(`c2 := p2.Compare(p)`) + p.P(`if c != (-1 * c2) {`) + p.In() + p.P(`t.Errorf("p.Compare(p2) = %d", c)`) + p.P(`t.Errorf("p2.Compare(p) = %d", c2)`) + p.P(`t.Errorf("p = %#v", p)`) + p.P(`t.Errorf("p2 = %#v", p2)`) + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + } + + } + return used +} + +func init() { + testgen.RegisterTestPlugin(NewTest) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/defaultcheck/defaultcheck.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/defaultcheck/defaultcheck.go new file mode 100644 index 00000000000..486f2877192 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/defaultcheck/defaultcheck.go @@ -0,0 +1,133 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +/* +The defaultcheck plugin is used to check whether nullable is not used incorrectly. +For instance: +An error is caused if a nullable field: + - has a default value, + - is an enum which does not start at zero, + - is used for an extension, + - is used for a native proto3 type, + - is used for a repeated native type. + +An error is also caused if a field with a default value is used in a message: + - which is a face. + - without getters. + +It is enabled by the following extensions: + + - nullable + +For incorrect usage of nullable with tests see: + + github.com/gogo/protobuf/test/nullableconflict + +*/ +package defaultcheck + +import ( + "fmt" + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" + "os" +) + +type plugin struct { + *generator.Generator +} + +func NewPlugin() *plugin { + return &plugin{} +} + +func (p *plugin) Name() string { + return "defaultcheck" +} + +func (p *plugin) Init(g *generator.Generator) { + p.Generator = g +} + +func (p *plugin) Generate(file *generator.FileDescriptor) { + proto3 := gogoproto.IsProto3(file.FileDescriptorProto) + for _, msg := range file.Messages() { + getters := gogoproto.HasGoGetters(file.FileDescriptorProto, msg.DescriptorProto) + face := gogoproto.IsFace(file.FileDescriptorProto, msg.DescriptorProto) + for _, field := range msg.GetField() { + if len(field.GetDefaultValue()) > 0 { + if !getters { + fmt.Fprintf(os.Stderr, "ERROR: field %v.%v cannot have a default value and not have a getter method", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name)) + os.Exit(1) + } + if face { + fmt.Fprintf(os.Stderr, "ERROR: field %v.%v cannot have a default value be in a face", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name)) + os.Exit(1) + } + } + if gogoproto.IsNullable(field) { + continue + } + if len(field.GetDefaultValue()) > 0 { + fmt.Fprintf(os.Stderr, "ERROR: field %v.%v cannot be non-nullable and have a default value", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name)) + os.Exit(1) + } + if !field.IsMessage() && !gogoproto.IsCustomType(field) { + if field.IsRepeated() { + fmt.Fprintf(os.Stderr, "WARNING: field %v.%v is a repeated non-nullable native type, nullable=false has no effect\n", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name)) + } else if proto3 { + fmt.Fprintf(os.Stderr, "ERROR: field %v.%v is a native type and in proto3 syntax with nullable=false there exists conflicting implementations when encoding zero values", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name)) + os.Exit(1) + } + if field.IsBytes() { + fmt.Fprintf(os.Stderr, "WARNING: field %v.%v is a non-nullable bytes type, nullable=false has no effect\n", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name)) + } + } + if !field.IsEnum() { + continue + } + enum := p.ObjectNamed(field.GetTypeName()).(*generator.EnumDescriptor) + if len(enum.Value) == 0 || enum.Value[0].GetNumber() != 0 { + fmt.Fprintf(os.Stderr, "ERROR: field %v.%v cannot be non-nullable and be an enum type %v which does not start with zero", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name), enum.GetName()) + os.Exit(1) + } + } + } + for _, e := range file.GetExtension() { + if !gogoproto.IsNullable(e) { + fmt.Fprintf(os.Stderr, "ERROR: extended field %v cannot be nullable %v", generator.CamelCase(e.GetName()), generator.CamelCase(*e.Name)) + os.Exit(1) + } + } +} + +func (p *plugin) GenerateImports(*generator.FileDescriptor) {} + +func init() { + generator.RegisterPlugin(NewPlugin()) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/description/description.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/description/description.go new file mode 100644 index 00000000000..f72efba6128 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/description/description.go @@ -0,0 +1,201 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +/* +The description (experimental) plugin generates a Description method for each message. +The Description method returns a populated google_protobuf.FileDescriptorSet struct. +This contains the description of the files used to generate this message. + +It is enabled by the following extensions: + + - description + - description_all + +The description plugin also generates a test given it is enabled using one of the following extensions: + + - testgen + - testgen_all + +Let us look at: + + github.com/gogo/protobuf/test/example/example.proto + +Btw all the output can be seen at: + + github.com/gogo/protobuf/test/example/* + +The following message: + + message B { + option (gogoproto.description) = true; + optional A A = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; + repeated bytes G = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false]; + } + +given to the description plugin, will generate the following code: + + func (this *B) Description() (desc *google_protobuf.FileDescriptorSet) { + return ExampleDescription() + } + +and the following test code: + + func TestDescription(t *testing9.T) { + ExampleDescription() + } + +The hope is to use this struct in some way instead of reflect. +This package is subject to change, since a use has not been figured out yet. + +*/ +package description + +import ( + "bytes" + "compress/gzip" + "fmt" + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/proto" + descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" +) + +type plugin struct { + *generator.Generator + generator.PluginImports +} + +func NewPlugin() *plugin { + return &plugin{} +} + +func (p *plugin) Name() string { + return "description" +} + +func (p *plugin) Init(g *generator.Generator) { + p.Generator = g +} + +func (p *plugin) Generate(file *generator.FileDescriptor) { + used := false + localName := generator.FileName(file) + + p.PluginImports = generator.NewPluginImports(p.Generator) + descriptorPkg := p.NewImport("github.com/gogo/protobuf/protoc-gen-gogo/descriptor") + protoPkg := p.NewImport("github.com/gogo/protobuf/proto") + gzipPkg := p.NewImport("compress/gzip") + bytesPkg := p.NewImport("bytes") + ioutilPkg := p.NewImport("io/ioutil") + + for _, message := range file.Messages() { + if !gogoproto.HasDescription(file.FileDescriptorProto, message.DescriptorProto) { + continue + } + if message.DescriptorProto.GetOptions().GetMapEntry() { + continue + } + used = true + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + p.P(`func (this *`, ccTypeName, `) Description() (desc *`, descriptorPkg.Use(), `.FileDescriptorSet) {`) + p.In() + p.P(`return `, localName, `Description()`) + p.Out() + p.P(`}`) + } + + if used { + + p.P(`func `, localName, `Description() (desc *`, descriptorPkg.Use(), `.FileDescriptorSet) {`) + p.In() + //Don't generate SourceCodeInfo, since it will create too much code. + + ss := make([]*descriptor.SourceCodeInfo, 0) + for _, f := range p.Generator.AllFiles().GetFile() { + ss = append(ss, f.SourceCodeInfo) + f.SourceCodeInfo = nil + } + b, err := proto.Marshal(p.Generator.AllFiles()) + if err != nil { + panic(err) + } + for i, f := range p.Generator.AllFiles().GetFile() { + f.SourceCodeInfo = ss[i] + } + p.P(`d := &`, descriptorPkg.Use(), `.FileDescriptorSet{}`) + var buf bytes.Buffer + w, _ := gzip.NewWriterLevel(&buf, gzip.BestCompression) + w.Write(b) + w.Close() + b = buf.Bytes() + p.P("var gzipped = []byte{") + p.In() + p.P("// ", len(b), " bytes of a gzipped FileDescriptorSet") + for len(b) > 0 { + n := 16 + if n > len(b) { + n = len(b) + } + + s := "" + for _, c := range b[:n] { + s += fmt.Sprintf("0x%02x,", c) + } + p.P(s) + + b = b[n:] + } + p.Out() + p.P("}") + p.P(`r := `, bytesPkg.Use(), `.NewReader(gzipped)`) + p.P(`gzipr, err := `, gzipPkg.Use(), `.NewReader(r)`) + p.P(`if err != nil {`) + p.In() + p.P(`panic(err)`) + p.Out() + p.P(`}`) + p.P(`ungzipped, err := `, ioutilPkg.Use(), `.ReadAll(gzipr)`) + p.P(`if err != nil {`) + p.In() + p.P(`panic(err)`) + p.Out() + p.P(`}`) + p.P(`if err := `, protoPkg.Use(), `.Unmarshal(ungzipped, d); err != nil {`) + p.In() + p.P(`panic(err)`) + p.Out() + p.P(`}`) + p.P(`return d`) + p.Out() + p.P(`}`) + } +} + +func init() { + generator.RegisterPlugin(NewPlugin()) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/description/descriptiontest.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/description/descriptiontest.go new file mode 100644 index 00000000000..babcd311da4 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/description/descriptiontest.go @@ -0,0 +1,73 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package description + +import ( + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/plugin/testgen" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" +) + +type test struct { + *generator.Generator +} + +func NewTest(g *generator.Generator) testgen.TestPlugin { + return &test{g} +} + +func (p *test) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool { + used := false + testingPkg := imports.NewImport("testing") + for _, message := range file.Messages() { + if !gogoproto.HasDescription(file.FileDescriptorProto, message.DescriptorProto) || + !gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { + continue + } + if message.DescriptorProto.GetOptions().GetMapEntry() { + continue + } + used = true + } + + if used { + localName := generator.FileName(file) + p.P(`func Test`, localName, `Description(t *`, testingPkg.Use(), `.T) {`) + p.In() + p.P(localName, `Description()`) + p.Out() + p.P(`}`) + + } + return used +} + +func init() { + testgen.RegisterTestPlugin(NewTest) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/embedcheck/embedcheck.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/embedcheck/embedcheck.go new file mode 100644 index 00000000000..1cb77cacb10 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/embedcheck/embedcheck.go @@ -0,0 +1,199 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +/* +The embedcheck plugin is used to check whether embed is not used incorrectly. +For instance: +An embedded message has a generated string method, but the is a member of a message which does not. +This causes a warning. +An error is caused by a namespace conflict. + +It is enabled by the following extensions: + + - embed + - embed_all + +For incorrect usage of embed with tests see: + + github.com/gogo/protobuf/test/embedconflict + +*/ +package embedcheck + +import ( + "fmt" + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" + "os" +) + +type plugin struct { + *generator.Generator +} + +func NewPlugin() *plugin { + return &plugin{} +} + +func (p *plugin) Name() string { + return "embedcheck" +} + +func (p *plugin) Init(g *generator.Generator) { + p.Generator = g +} + +var overwriters []map[string]gogoproto.EnableFunc = []map[string]gogoproto.EnableFunc{ + { + "stringer": gogoproto.IsStringer, + }, + { + "gostring": gogoproto.HasGoString, + }, + { + "equal": gogoproto.HasEqual, + }, + { + "verboseequal": gogoproto.HasVerboseEqual, + }, + { + "size": gogoproto.IsSizer, + "protosizer": gogoproto.IsProtoSizer, + }, + { + "unmarshaler": gogoproto.IsUnmarshaler, + "unsafe_unmarshaler": gogoproto.IsUnsafeUnmarshaler, + }, + { + "marshaler": gogoproto.IsMarshaler, + "unsafe_marshaler": gogoproto.IsUnsafeMarshaler, + }, +} + +func (p *plugin) Generate(file *generator.FileDescriptor) { + for _, msg := range file.Messages() { + for _, os := range overwriters { + possible := true + for _, overwriter := range os { + if overwriter(file.FileDescriptorProto, msg.DescriptorProto) { + possible = false + } + } + if possible { + p.checkOverwrite(msg, os) + } + } + p.checkNameSpace(msg) + for _, field := range msg.GetField() { + if gogoproto.IsEmbed(field) && gogoproto.IsCustomName(field) { + fmt.Fprintf(os.Stderr, "ERROR: field %v with custom name %v cannot be embedded", *field.Name, gogoproto.GetCustomName(field)) + os.Exit(1) + } + } + p.checkRepeated(msg) + } + for _, e := range file.GetExtension() { + if gogoproto.IsEmbed(e) { + fmt.Fprintf(os.Stderr, "ERROR: extended field %v cannot be embedded", generator.CamelCase(*e.Name)) + os.Exit(1) + } + } +} + +func (p *plugin) checkNameSpace(message *generator.Descriptor) map[string]bool { + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + names := make(map[string]bool) + for _, field := range message.Field { + fieldname := generator.CamelCase(*field.Name) + if field.IsMessage() && gogoproto.IsEmbed(field) { + desc := p.ObjectNamed(field.GetTypeName()) + moreNames := p.checkNameSpace(desc.(*generator.Descriptor)) + for another := range moreNames { + if names[another] { + fmt.Fprintf(os.Stderr, "ERROR: duplicate embedded fieldname %v in type %v\n", fieldname, ccTypeName) + os.Exit(1) + } + names[another] = true + } + } else { + if names[fieldname] { + fmt.Fprintf(os.Stderr, "ERROR: duplicate embedded fieldname %v in type %v\n", fieldname, ccTypeName) + os.Exit(1) + } + names[fieldname] = true + } + } + return names +} + +func (p *plugin) checkOverwrite(message *generator.Descriptor, enablers map[string]gogoproto.EnableFunc) { + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + names := []string{} + for name := range enablers { + names = append(names, name) + } + for _, field := range message.Field { + if field.IsMessage() && gogoproto.IsEmbed(field) { + fieldname := generator.CamelCase(*field.Name) + desc := p.ObjectNamed(field.GetTypeName()) + msg := desc.(*generator.Descriptor) + for errStr, enabled := range enablers { + if enabled(msg.File(), msg.DescriptorProto) { + fmt.Fprintf(os.Stderr, "WARNING: found non-%v %v with embedded %v %v\n", names, ccTypeName, errStr, fieldname) + } + } + p.checkOverwrite(msg, enablers) + } + } +} + +func (p *plugin) checkRepeated(message *generator.Descriptor) { + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + for _, field := range message.Field { + if !gogoproto.IsEmbed(field) { + continue + } + if field.IsBytes() { + fieldname := generator.CamelCase(*field.Name) + fmt.Fprintf(os.Stderr, "ERROR: found embedded bytes field %s in message %s\n", fieldname, ccTypeName) + os.Exit(1) + } + if !field.IsRepeated() { + continue + } + fieldname := generator.CamelCase(*field.Name) + fmt.Fprintf(os.Stderr, "ERROR: found repeated embedded field %s in message %s\n", fieldname, ccTypeName) + os.Exit(1) + } +} + +func (p *plugin) GenerateImports(*generator.FileDescriptor) {} + +func init() { + generator.RegisterPlugin(NewPlugin()) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/enumstringer/enumstringer.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/enumstringer/enumstringer.go new file mode 100644 index 00000000000..04d6e547fc3 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/enumstringer/enumstringer.go @@ -0,0 +1,104 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +/* +The enumstringer (experimental) plugin generates a String method for each enum. + +It is enabled by the following extensions: + + - enum_stringer + - enum_stringer_all + +This package is subject to change. + +*/ +package enumstringer + +import ( + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" +) + +type enumstringer struct { + *generator.Generator + generator.PluginImports + atleastOne bool + localName string +} + +func NewEnumStringer() *enumstringer { + return &enumstringer{} +} + +func (p *enumstringer) Name() string { + return "enumstringer" +} + +func (p *enumstringer) Init(g *generator.Generator) { + p.Generator = g +} + +func (p *enumstringer) Generate(file *generator.FileDescriptor) { + p.PluginImports = generator.NewPluginImports(p.Generator) + p.atleastOne = false + + p.localName = generator.FileName(file) + + strconvPkg := p.NewImport("strconv") + + for _, enum := range file.Enums() { + if !gogoproto.IsEnumStringer(file.FileDescriptorProto, enum.EnumDescriptorProto) { + continue + } + if gogoproto.IsGoEnumStringer(file.FileDescriptorProto, enum.EnumDescriptorProto) { + panic("Go enum stringer conflicts with new enumstringer plugin: please use gogoproto.goproto_enum_stringer or gogoproto.goproto_enum_string_all and set it to false") + } + p.atleastOne = true + ccTypeName := generator.CamelCaseSlice(enum.TypeName()) + p.P("func (x ", ccTypeName, ") String() string {") + p.In() + p.P(`s, ok := `, ccTypeName, `_name[int32(x)]`) + p.P(`if ok {`) + p.In() + p.P(`return s`) + p.Out() + p.P(`}`) + p.P(`return `, strconvPkg.Use(), `.Itoa(int(x))`) + p.Out() + p.P(`}`) + } + + if !p.atleastOne { + return + } + +} + +func init() { + generator.RegisterPlugin(NewEnumStringer()) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/equal/equal.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/equal/equal.go new file mode 100644 index 00000000000..6a422635d40 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/equal/equal.go @@ -0,0 +1,645 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +/* +The equal plugin generates an Equal and a VerboseEqual method for each message. +These equal methods are quite obvious. +The only difference is that VerboseEqual returns a non nil error if it is not equal. +This error contains more detail on exactly which part of the message was not equal to the other message. +The idea is that this is useful for debugging. + +Equal is enabled using the following extensions: + + - equal + - equal_all + +While VerboseEqual is enable dusing the following extensions: + + - verbose_equal + - verbose_equal_all + +The equal plugin also generates a test given it is enabled using one of the following extensions: + + - testgen + - testgen_all + +Let us look at: + + github.com/gogo/protobuf/test/example/example.proto + +Btw all the output can be seen at: + + github.com/gogo/protobuf/test/example/* + +The following message: + + option (gogoproto.equal_all) = true; + option (gogoproto.verbose_equal_all) = true; + + message B { + optional A A = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; + repeated bytes G = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false]; + } + +given to the equal plugin, will generate the following code: + + func (this *B) VerboseEqual(that interface{}) error { + if that == nil { + if this == nil { + return nil + } + return fmt2.Errorf("that == nil && this != nil") + } + + that1, ok := that.(*B) + if !ok { + return fmt2.Errorf("that is not of type *B") + } + if that1 == nil { + if this == nil { + return nil + } + return fmt2.Errorf("that is type *B but is nil && this != nil") + } else if this == nil { + return fmt2.Errorf("that is type *B but is not nil && this == nil") + } + if !this.A.Equal(&that1.A) { + return fmt2.Errorf("A this(%v) Not Equal that(%v)", this.A, that1.A) + } + if len(this.G) != len(that1.G) { + return fmt2.Errorf("G this(%v) Not Equal that(%v)", len(this.G), len(that1.G)) + } + for i := range this.G { + if !this.G[i].Equal(that1.G[i]) { + return fmt2.Errorf("G this[%v](%v) Not Equal that[%v](%v)", i, this.G[i], i, that1.G[i]) + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return fmt2.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) + } + return nil + } + + func (this *B) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*B) + if !ok { + return false + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if !this.A.Equal(&that1.A) { + return false + } + if len(this.G) != len(that1.G) { + return false + } + for i := range this.G { + if !this.G[i].Equal(that1.G[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true + } + +and the following test code: + + func TestBVerboseEqual(t *testing8.T) { + popr := math_rand8.New(math_rand8.NewSource(time8.Now().UnixNano())) + p := NewPopulatedB(popr, false) + dAtA, err := github_com_gogo_protobuf_proto2.Marshal(p) + if err != nil { + panic(err) + } + msg := &B{} + if err := github_com_gogo_protobuf_proto2.Unmarshal(dAtA, msg); err != nil { + panic(err) + } + if err := p.VerboseEqual(msg); err != nil { + t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) + } + +*/ +package equal + +import ( + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/proto" + descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" + "github.com/gogo/protobuf/vanity" +) + +type plugin struct { + *generator.Generator + generator.PluginImports + fmtPkg generator.Single + bytesPkg generator.Single + protoPkg generator.Single +} + +func NewPlugin() *plugin { + return &plugin{} +} + +func (p *plugin) Name() string { + return "equal" +} + +func (p *plugin) Init(g *generator.Generator) { + p.Generator = g +} + +func (p *plugin) Generate(file *generator.FileDescriptor) { + p.PluginImports = generator.NewPluginImports(p.Generator) + p.fmtPkg = p.NewImport("fmt") + p.bytesPkg = p.NewImport("bytes") + p.protoPkg = p.NewImport("github.com/gogo/protobuf/proto") + + for _, msg := range file.Messages() { + if msg.DescriptorProto.GetOptions().GetMapEntry() { + continue + } + if gogoproto.HasVerboseEqual(file.FileDescriptorProto, msg.DescriptorProto) { + p.generateMessage(file, msg, true) + } + if gogoproto.HasEqual(file.FileDescriptorProto, msg.DescriptorProto) { + p.generateMessage(file, msg, false) + } + } +} + +func (p *plugin) generateNullableField(fieldname string, verbose bool) { + p.P(`if this.`, fieldname, ` != nil && that1.`, fieldname, ` != nil {`) + p.In() + p.P(`if *this.`, fieldname, ` != *that1.`, fieldname, `{`) + p.In() + if verbose { + p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, ` this(%v) Not Equal that(%v)", *this.`, fieldname, `, *that1.`, fieldname, `)`) + } else { + p.P(`return false`) + } + p.Out() + p.P(`}`) + p.Out() + p.P(`} else if this.`, fieldname, ` != nil {`) + p.In() + if verbose { + p.P(`return `, p.fmtPkg.Use(), `.Errorf("this.`, fieldname, ` == nil && that.`, fieldname, ` != nil")`) + } else { + p.P(`return false`) + } + p.Out() + p.P(`} else if that1.`, fieldname, ` != nil {`) +} + +func (p *plugin) generateMsgNullAndTypeCheck(ccTypeName string, verbose bool) { + p.P(`if that == nil {`) + p.In() + p.P(`if this == nil {`) + p.In() + if verbose { + p.P(`return nil`) + } else { + p.P(`return true`) + } + p.Out() + p.P(`}`) + if verbose { + p.P(`return `, p.fmtPkg.Use(), `.Errorf("that == nil && this != nil")`) + } else { + p.P(`return false`) + } + p.Out() + p.P(`}`) + p.P(``) + p.P(`that1, ok := that.(*`, ccTypeName, `)`) + p.P(`if !ok {`) + p.In() + p.P(`that2, ok := that.(`, ccTypeName, `)`) + p.P(`if ok {`) + p.In() + p.P(`that1 = &that2`) + p.Out() + p.P(`} else {`) + p.In() + if verbose { + p.P(`return `, p.fmtPkg.Use(), `.Errorf("that is not of type *`, ccTypeName, `")`) + } else { + p.P(`return false`) + } + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + p.P(`if that1 == nil {`) + p.In() + p.P(`if this == nil {`) + p.In() + if verbose { + p.P(`return nil`) + } else { + p.P(`return true`) + } + p.Out() + p.P(`}`) + if verbose { + p.P(`return `, p.fmtPkg.Use(), `.Errorf("that is type *`, ccTypeName, ` but is nil && this != nil")`) + } else { + p.P(`return false`) + } + p.Out() + p.P(`} else if this == nil {`) + p.In() + if verbose { + p.P(`return `, p.fmtPkg.Use(), `.Errorf("that is type *`, ccTypeName, ` but is not nil && this == nil")`) + } else { + p.P(`return false`) + } + p.Out() + p.P(`}`) +} + +func (p *plugin) generateField(file *generator.FileDescriptor, message *generator.Descriptor, field *descriptor.FieldDescriptorProto, verbose bool) { + proto3 := gogoproto.IsProto3(file.FileDescriptorProto) + fieldname := p.GetOneOfFieldName(message, field) + repeated := field.IsRepeated() + ctype := gogoproto.IsCustomType(field) + nullable := gogoproto.IsNullable(field) + isDuration := gogoproto.IsStdDuration(field) + isTimestamp := gogoproto.IsStdTime(field) + // oneof := field.OneofIndex != nil + if !repeated { + if ctype || isTimestamp { + if nullable { + p.P(`if that1.`, fieldname, ` == nil {`) + p.In() + p.P(`if this.`, fieldname, ` != nil {`) + p.In() + if verbose { + p.P(`return `, p.fmtPkg.Use(), `.Errorf("this.`, fieldname, ` != nil && that1.`, fieldname, ` == nil")`) + } else { + p.P(`return false`) + } + p.Out() + p.P(`}`) + p.Out() + p.P(`} else if !this.`, fieldname, `.Equal(*that1.`, fieldname, `) {`) + } else { + p.P(`if !this.`, fieldname, `.Equal(that1.`, fieldname, `) {`) + } + p.In() + if verbose { + p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, ` this(%v) Not Equal that(%v)", this.`, fieldname, `, that1.`, fieldname, `)`) + } else { + p.P(`return false`) + } + p.Out() + p.P(`}`) + } else if isDuration { + if nullable { + p.generateNullableField(fieldname, verbose) + } else { + p.P(`if this.`, fieldname, ` != that1.`, fieldname, `{`) + } + p.In() + if verbose { + p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, ` this(%v) Not Equal that(%v)", this.`, fieldname, `, that1.`, fieldname, `)`) + } else { + p.P(`return false`) + } + p.Out() + p.P(`}`) + } else { + if field.IsMessage() || p.IsGroup(field) { + if nullable { + p.P(`if !this.`, fieldname, `.Equal(that1.`, fieldname, `) {`) + } else { + p.P(`if !this.`, fieldname, `.Equal(&that1.`, fieldname, `) {`) + } + } else if field.IsBytes() { + p.P(`if !`, p.bytesPkg.Use(), `.Equal(this.`, fieldname, `, that1.`, fieldname, `) {`) + } else if field.IsString() { + if nullable && !proto3 { + p.generateNullableField(fieldname, verbose) + } else { + p.P(`if this.`, fieldname, ` != that1.`, fieldname, `{`) + } + } else { + if nullable && !proto3 { + p.generateNullableField(fieldname, verbose) + } else { + p.P(`if this.`, fieldname, ` != that1.`, fieldname, `{`) + } + } + p.In() + if verbose { + p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, ` this(%v) Not Equal that(%v)", this.`, fieldname, `, that1.`, fieldname, `)`) + } else { + p.P(`return false`) + } + p.Out() + p.P(`}`) + } + } else { + p.P(`if len(this.`, fieldname, `) != len(that1.`, fieldname, `) {`) + p.In() + if verbose { + p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, ` this(%v) Not Equal that(%v)", len(this.`, fieldname, `), len(that1.`, fieldname, `))`) + } else { + p.P(`return false`) + } + p.Out() + p.P(`}`) + p.P(`for i := range this.`, fieldname, ` {`) + p.In() + if ctype && !p.IsMap(field) { + p.P(`if !this.`, fieldname, `[i].Equal(that1.`, fieldname, `[i]) {`) + } else if isTimestamp { + if nullable { + p.P(`if !this.`, fieldname, `[i].Equal(*that1.`, fieldname, `[i]) {`) + } else { + p.P(`if !this.`, fieldname, `[i].Equal(that1.`, fieldname, `[i]) {`) + } + } else if isDuration { + if nullable { + p.P(`if dthis, dthat := this.`, fieldname, `[i], that1.`, fieldname, `[i]; (dthis != nil && dthat != nil && *dthis != *dthat) || (dthis != nil && dthat == nil) || (dthis == nil && dthat != nil) {`) + } else { + p.P(`if this.`, fieldname, `[i] != that1.`, fieldname, `[i] {`) + } + } else { + if p.IsMap(field) { + m := p.GoMapType(nil, field) + valuegoTyp, _ := p.GoType(nil, m.ValueField) + valuegoAliasTyp, _ := p.GoType(nil, m.ValueAliasField) + nullable, valuegoTyp, valuegoAliasTyp = generator.GoMapValueTypes(field, m.ValueField, valuegoTyp, valuegoAliasTyp) + + mapValue := m.ValueAliasField + if mapValue.IsMessage() || p.IsGroup(mapValue) { + if nullable && valuegoTyp == valuegoAliasTyp { + p.P(`if !this.`, fieldname, `[i].Equal(that1.`, fieldname, `[i]) {`) + } else { + // Equal() has a pointer receiver, but map value is a value type + a := `this.` + fieldname + `[i]` + b := `that1.` + fieldname + `[i]` + if valuegoTyp != valuegoAliasTyp { + // cast back to the type that has the generated methods on it + a = `(` + valuegoTyp + `)(` + a + `)` + b = `(` + valuegoTyp + `)(` + b + `)` + } + p.P(`a := `, a) + p.P(`b := `, b) + if nullable { + p.P(`if !a.Equal(b) {`) + } else { + p.P(`if !(&a).Equal(&b) {`) + } + } + } else if mapValue.IsBytes() { + if ctype { + if nullable { + p.P(`if !this.`, fieldname, `[i].Equal(*that1.`, fieldname, `[i]) { //nullable`) + } else { + p.P(`if !this.`, fieldname, `[i].Equal(that1.`, fieldname, `[i]) { //not nullable`) + } + } else { + p.P(`if !`, p.bytesPkg.Use(), `.Equal(this.`, fieldname, `[i], that1.`, fieldname, `[i]) {`) + } + } else if mapValue.IsString() { + p.P(`if this.`, fieldname, `[i] != that1.`, fieldname, `[i] {`) + } else { + p.P(`if this.`, fieldname, `[i] != that1.`, fieldname, `[i] {`) + } + } else if field.IsMessage() || p.IsGroup(field) { + if nullable { + p.P(`if !this.`, fieldname, `[i].Equal(that1.`, fieldname, `[i]) {`) + } else { + p.P(`if !this.`, fieldname, `[i].Equal(&that1.`, fieldname, `[i]) {`) + } + } else if field.IsBytes() { + p.P(`if !`, p.bytesPkg.Use(), `.Equal(this.`, fieldname, `[i], that1.`, fieldname, `[i]) {`) + } else if field.IsString() { + p.P(`if this.`, fieldname, `[i] != that1.`, fieldname, `[i] {`) + } else { + p.P(`if this.`, fieldname, `[i] != that1.`, fieldname, `[i] {`) + } + } + p.In() + if verbose { + p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, ` this[%v](%v) Not Equal that[%v](%v)", i, this.`, fieldname, `[i], i, that1.`, fieldname, `[i])`) + } else { + p.P(`return false`) + } + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + } +} + +func (p *plugin) generateMessage(file *generator.FileDescriptor, message *generator.Descriptor, verbose bool) { + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + if verbose { + p.P(`func (this *`, ccTypeName, `) VerboseEqual(that interface{}) error {`) + } else { + p.P(`func (this *`, ccTypeName, `) Equal(that interface{}) bool {`) + } + p.In() + p.generateMsgNullAndTypeCheck(ccTypeName, verbose) + oneofs := make(map[string]struct{}) + + for _, field := range message.Field { + oneof := field.OneofIndex != nil + if oneof { + fieldname := p.GetFieldName(message, field) + if _, ok := oneofs[fieldname]; ok { + continue + } else { + oneofs[fieldname] = struct{}{} + } + p.P(`if that1.`, fieldname, ` == nil {`) + p.In() + p.P(`if this.`, fieldname, ` != nil {`) + p.In() + if verbose { + p.P(`return `, p.fmtPkg.Use(), `.Errorf("this.`, fieldname, ` != nil && that1.`, fieldname, ` == nil")`) + } else { + p.P(`return false`) + } + p.Out() + p.P(`}`) + p.Out() + p.P(`} else if this.`, fieldname, ` == nil {`) + p.In() + if verbose { + p.P(`return `, p.fmtPkg.Use(), `.Errorf("this.`, fieldname, ` == nil && that1.`, fieldname, ` != nil")`) + } else { + p.P(`return false`) + } + p.Out() + if verbose { + p.P(`} else if err := this.`, fieldname, `.VerboseEqual(that1.`, fieldname, `); err != nil {`) + } else { + p.P(`} else if !this.`, fieldname, `.Equal(that1.`, fieldname, `) {`) + } + p.In() + if verbose { + p.P(`return err`) + } else { + p.P(`return false`) + } + p.Out() + p.P(`}`) + } else { + p.generateField(file, message, field, verbose) + } + } + if message.DescriptorProto.HasExtension() { + if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) { + fieldname := "XXX_InternalExtensions" + p.P(`thismap := `, p.protoPkg.Use(), `.GetUnsafeExtensionsMap(this)`) + p.P(`thatmap := `, p.protoPkg.Use(), `.GetUnsafeExtensionsMap(that1)`) + p.P(`for k, v := range thismap {`) + p.In() + p.P(`if v2, ok := thatmap[k]; ok {`) + p.In() + p.P(`if !v.Equal(&v2) {`) + p.In() + if verbose { + p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, ` this[%v](%v) Not Equal that[%v](%v)", k, thismap[k], k, thatmap[k])`) + } else { + p.P(`return false`) + } + p.Out() + p.P(`}`) + p.Out() + p.P(`} else {`) + p.In() + if verbose { + p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, `[%v] Not In that", k)`) + } else { + p.P(`return false`) + } + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + + p.P(`for k, _ := range thatmap {`) + p.In() + p.P(`if _, ok := thismap[k]; !ok {`) + p.In() + if verbose { + p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, `[%v] Not In this", k)`) + } else { + p.P(`return false`) + } + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + } else { + fieldname := "XXX_extensions" + p.P(`if !`, p.bytesPkg.Use(), `.Equal(this.`, fieldname, `, that1.`, fieldname, `) {`) + p.In() + if verbose { + p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, ` this(%v) Not Equal that(%v)", this.`, fieldname, `, that1.`, fieldname, `)`) + } else { + p.P(`return false`) + } + p.Out() + p.P(`}`) + } + } + if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) { + fieldname := "XXX_unrecognized" + p.P(`if !`, p.bytesPkg.Use(), `.Equal(this.`, fieldname, `, that1.`, fieldname, `) {`) + p.In() + if verbose { + p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, ` this(%v) Not Equal that(%v)", this.`, fieldname, `, that1.`, fieldname, `)`) + } else { + p.P(`return false`) + } + p.Out() + p.P(`}`) + } + if verbose { + p.P(`return nil`) + } else { + p.P(`return true`) + } + p.Out() + p.P(`}`) + + //Generate Equal methods for oneof fields + m := proto.Clone(message.DescriptorProto).(*descriptor.DescriptorProto) + for _, field := range m.Field { + oneof := field.OneofIndex != nil + if !oneof { + continue + } + ccTypeName := p.OneOfTypeName(message, field) + if verbose { + p.P(`func (this *`, ccTypeName, `) VerboseEqual(that interface{}) error {`) + } else { + p.P(`func (this *`, ccTypeName, `) Equal(that interface{}) bool {`) + } + p.In() + + p.generateMsgNullAndTypeCheck(ccTypeName, verbose) + vanity.TurnOffNullableForNativeTypesWithoutDefaultsOnly(field) + p.generateField(file, message, field, verbose) + + if verbose { + p.P(`return nil`) + } else { + p.P(`return true`) + } + p.Out() + p.P(`}`) + } +} + +func init() { + generator.RegisterPlugin(NewPlugin()) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/equal/equaltest.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/equal/equaltest.go new file mode 100644 index 00000000000..8a47a0c9be7 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/equal/equaltest.go @@ -0,0 +1,96 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package equal + +import ( + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/plugin/testgen" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" +) + +type test struct { + *generator.Generator +} + +func NewTest(g *generator.Generator) testgen.TestPlugin { + return &test{g} +} + +func (p *test) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool { + used := false + randPkg := imports.NewImport("math/rand") + timePkg := imports.NewImport("time") + testingPkg := imports.NewImport("testing") + protoPkg := imports.NewImport("github.com/gogo/protobuf/proto") + if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { + protoPkg = imports.NewImport("github.com/golang/protobuf/proto") + } + for _, message := range file.Messages() { + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + if !gogoproto.HasVerboseEqual(file.FileDescriptorProto, message.DescriptorProto) { + continue + } + if message.DescriptorProto.GetOptions().GetMapEntry() { + continue + } + + if gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { + used = true + p.P(`func Test`, ccTypeName, `VerboseEqual(t *`, testingPkg.Use(), `.T) {`) + p.In() + p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(`, timePkg.Use(), `.Now().UnixNano()))`) + p.P(`p := NewPopulated`, ccTypeName, `(popr, false)`) + p.P(`dAtA, err := `, protoPkg.Use(), `.Marshal(p)`) + p.P(`if err != nil {`) + p.In() + p.P(`panic(err)`) + p.Out() + p.P(`}`) + p.P(`msg := &`, ccTypeName, `{}`) + p.P(`if err := `, protoPkg.Use(), `.Unmarshal(dAtA, msg); err != nil {`) + p.In() + p.P(`panic(err)`) + p.Out() + p.P(`}`) + p.P(`if err := p.VerboseEqual(msg); err != nil {`) + p.In() + p.P(`t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)`) + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + } + + } + return used +} + +func init() { + testgen.RegisterTestPlugin(NewTest) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/face/face.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/face/face.go new file mode 100644 index 00000000000..a0293452652 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/face/face.go @@ -0,0 +1,233 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +/* +The face plugin generates a function will be generated which can convert a structure which satisfies an interface (face) to the specified structure. +This interface contains getters for each of the fields in the struct. +The specified struct is also generated with the getters. +This means that getters should be turned off so as not to conflict with face getters. +This allows it to satisfy its own face. + +It is enabled by the following extensions: + + - face + - face_all + +Turn off getters by using the following extensions: + + - getters + - getters_all + +The face plugin also generates a test given it is enabled using one of the following extensions: + + - testgen + - testgen_all + +Let us look at: + + github.com/gogo/protobuf/test/example/example.proto + +Btw all the output can be seen at: + + github.com/gogo/protobuf/test/example/* + +The following message: + + message A { + option (gogoproto.face) = true; + option (gogoproto.goproto_getters) = false; + optional string Description = 1 [(gogoproto.nullable) = false]; + optional int64 Number = 2 [(gogoproto.nullable) = false]; + optional bytes Id = 3 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uuid", (gogoproto.nullable) = false]; + } + +given to the face plugin, will generate the following code: + + type AFace interface { + Proto() github_com_gogo_protobuf_proto.Message + GetDescription() string + GetNumber() int64 + GetId() github_com_gogo_protobuf_test_custom.Uuid + } + + func (this *A) Proto() github_com_gogo_protobuf_proto.Message { + return this + } + + func (this *A) TestProto() github_com_gogo_protobuf_proto.Message { + return NewAFromFace(this) + } + + func (this *A) GetDescription() string { + return this.Description + } + + func (this *A) GetNumber() int64 { + return this.Number + } + + func (this *A) GetId() github_com_gogo_protobuf_test_custom.Uuid { + return this.Id + } + + func NewAFromFace(that AFace) *A { + this := &A{} + this.Description = that.GetDescription() + this.Number = that.GetNumber() + this.Id = that.GetId() + return this + } + +and the following test code: + + func TestAFace(t *testing7.T) { + popr := math_rand7.New(math_rand7.NewSource(time7.Now().UnixNano())) + p := NewPopulatedA(popr, true) + msg := p.TestProto() + if !p.Equal(msg) { + t.Fatalf("%#v !Face Equal %#v", msg, p) + } + } + +The struct A, representing the message, will also be generated just like always. +As you can see A satisfies its own Face, AFace. + +Creating another struct which satisfies AFace is very easy. +Simply create all these methods specified in AFace. +Implementing The Proto method is done with the helper function NewAFromFace: + + func (this *MyStruct) Proto() proto.Message { + return NewAFromFace(this) + } + +just the like TestProto method which is used to test the NewAFromFace function. + +*/ +package face + +import ( + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" +) + +type plugin struct { + *generator.Generator + generator.PluginImports +} + +func NewPlugin() *plugin { + return &plugin{} +} + +func (p *plugin) Name() string { + return "face" +} + +func (p *plugin) Init(g *generator.Generator) { + p.Generator = g +} + +func (p *plugin) Generate(file *generator.FileDescriptor) { + p.PluginImports = generator.NewPluginImports(p.Generator) + protoPkg := p.NewImport("github.com/gogo/protobuf/proto") + if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { + protoPkg = p.NewImport("github.com/golang/protobuf/proto") + } + for _, message := range file.Messages() { + if !gogoproto.IsFace(file.FileDescriptorProto, message.DescriptorProto) { + continue + } + if message.DescriptorProto.GetOptions().GetMapEntry() { + continue + } + if message.DescriptorProto.HasExtension() { + panic("face does not support message with extensions") + } + if gogoproto.HasGoGetters(file.FileDescriptorProto, message.DescriptorProto) { + panic("face requires getters to be disabled please use gogoproto.getters or gogoproto.getters_all and set it to false") + } + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + p.P(`type `, ccTypeName, `Face interface{`) + p.In() + p.P(`Proto() `, protoPkg.Use(), `.Message`) + for _, field := range message.Field { + fieldname := p.GetFieldName(message, field) + goTyp, _ := p.GoType(message, field) + if p.IsMap(field) { + m := p.GoMapType(nil, field) + goTyp = m.GoType + } + p.P(`Get`, fieldname, `() `, goTyp) + } + p.Out() + p.P(`}`) + p.P(``) + p.P(`func (this *`, ccTypeName, `) Proto() `, protoPkg.Use(), `.Message {`) + p.In() + p.P(`return this`) + p.Out() + p.P(`}`) + p.P(``) + p.P(`func (this *`, ccTypeName, `) TestProto() `, protoPkg.Use(), `.Message {`) + p.In() + p.P(`return New`, ccTypeName, `FromFace(this)`) + p.Out() + p.P(`}`) + p.P(``) + for _, field := range message.Field { + fieldname := p.GetFieldName(message, field) + goTyp, _ := p.GoType(message, field) + if p.IsMap(field) { + m := p.GoMapType(nil, field) + goTyp = m.GoType + } + p.P(`func (this *`, ccTypeName, `) Get`, fieldname, `() `, goTyp, `{`) + p.In() + p.P(` return this.`, fieldname) + p.Out() + p.P(`}`) + p.P(``) + } + p.P(``) + p.P(`func New`, ccTypeName, `FromFace(that `, ccTypeName, `Face) *`, ccTypeName, ` {`) + p.In() + p.P(`this := &`, ccTypeName, `{}`) + for _, field := range message.Field { + fieldname := p.GetFieldName(message, field) + p.P(`this.`, fieldname, ` = that.Get`, fieldname, `()`) + } + p.P(`return this`) + p.Out() + p.P(`}`) + p.P(``) + } +} + +func init() { + generator.RegisterPlugin(NewPlugin()) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/face/facetest.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/face/facetest.go new file mode 100644 index 00000000000..467cc0a6640 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/face/facetest.go @@ -0,0 +1,82 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package face + +import ( + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/plugin/testgen" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" +) + +type test struct { + *generator.Generator +} + +func NewTest(g *generator.Generator) testgen.TestPlugin { + return &test{g} +} + +func (p *test) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool { + used := false + randPkg := imports.NewImport("math/rand") + timePkg := imports.NewImport("time") + testingPkg := imports.NewImport("testing") + for _, message := range file.Messages() { + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + if !gogoproto.IsFace(file.FileDescriptorProto, message.DescriptorProto) { + continue + } + if message.DescriptorProto.GetOptions().GetMapEntry() { + continue + } + + if gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { + used = true + + p.P(`func Test`, ccTypeName, `Face(t *`, testingPkg.Use(), `.T) {`) + p.In() + p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(`, timePkg.Use(), `.Now().UnixNano()))`) + p.P(`p := NewPopulated`, ccTypeName, `(popr, true)`) + p.P(`msg := p.TestProto()`) + p.P(`if !p.Equal(msg) {`) + p.In() + p.P(`t.Fatalf("%#v !Face Equal %#v", msg, p)`) + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + } + + } + return used +} + +func init() { + testgen.RegisterTestPlugin(NewTest) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/gostring/gostring.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/gostring/gostring.go new file mode 100644 index 00000000000..789cc5d1d95 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/gostring/gostring.go @@ -0,0 +1,368 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +/* +The gostring plugin generates a GoString method for each message. +The GoString method is called whenever you use a fmt.Printf as such: + + fmt.Printf("%#v", mymessage) + +or whenever you actually call GoString() +The output produced by the GoString method can be copied from the output into code and used to set a variable. +It is totally valid Go Code and is populated exactly as the struct that was printed out. + +It is enabled by the following extensions: + + - gostring + - gostring_all + +The gostring plugin also generates a test given it is enabled using one of the following extensions: + + - testgen + - testgen_all + +Let us look at: + + github.com/gogo/protobuf/test/example/example.proto + +Btw all the output can be seen at: + + github.com/gogo/protobuf/test/example/* + +The following message: + + option (gogoproto.gostring_all) = true; + + message A { + optional string Description = 1 [(gogoproto.nullable) = false]; + optional int64 Number = 2 [(gogoproto.nullable) = false]; + optional bytes Id = 3 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uuid", (gogoproto.nullable) = false]; + } + +given to the gostring plugin, will generate the following code: + + func (this *A) GoString() string { + if this == nil { + return "nil" + } + s := strings1.Join([]string{`&test.A{` + `Description:` + fmt1.Sprintf("%#v", this.Description), `Number:` + fmt1.Sprintf("%#v", this.Number), `Id:` + fmt1.Sprintf("%#v", this.Id), `XXX_unrecognized:` + fmt1.Sprintf("%#v", this.XXX_unrecognized) + `}`}, ", ") + return s + } + +and the following test code: + + func TestAGoString(t *testing6.T) { + popr := math_rand6.New(math_rand6.NewSource(time6.Now().UnixNano())) + p := NewPopulatedA(popr, false) + s1 := p.GoString() + s2 := fmt2.Sprintf("%#v", p) + if s1 != s2 { + t.Fatalf("GoString want %v got %v", s1, s2) + } + _, err := go_parser.ParseExpr(s1) + if err != nil { + panic(err) + } + } + +Typically fmt.Printf("%#v") will stop to print when it reaches a pointer and +not print their values, while the generated GoString method will always print all values, recursively. + +*/ +package gostring + +import ( + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" + "strconv" + "strings" +) + +type gostring struct { + *generator.Generator + generator.PluginImports + atleastOne bool + localName string + overwrite bool +} + +func NewGoString() *gostring { + return &gostring{} +} + +func (p *gostring) Name() string { + return "gostring" +} + +func (p *gostring) Overwrite() { + p.overwrite = true +} + +func (p *gostring) Init(g *generator.Generator) { + p.Generator = g +} + +func (p *gostring) Generate(file *generator.FileDescriptor) { + proto3 := gogoproto.IsProto3(file.FileDescriptorProto) + p.PluginImports = generator.NewPluginImports(p.Generator) + p.atleastOne = false + + p.localName = generator.FileName(file) + + fmtPkg := p.NewImport("fmt") + stringsPkg := p.NewImport("strings") + protoPkg := p.NewImport("github.com/gogo/protobuf/proto") + if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { + protoPkg = p.NewImport("github.com/golang/protobuf/proto") + } + sortPkg := p.NewImport("sort") + strconvPkg := p.NewImport("strconv") + reflectPkg := p.NewImport("reflect") + sortKeysPkg := p.NewImport("github.com/gogo/protobuf/sortkeys") + + for _, message := range file.Messages() { + if !p.overwrite && !gogoproto.HasGoString(file.FileDescriptorProto, message.DescriptorProto) { + continue + } + if message.DescriptorProto.GetOptions().GetMapEntry() { + continue + } + p.atleastOne = true + packageName := file.PackageName() + + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + p.P(`func (this *`, ccTypeName, `) GoString() string {`) + p.In() + p.P(`if this == nil {`) + p.In() + p.P(`return "nil"`) + p.Out() + p.P(`}`) + + p.P(`s := make([]string, 0, `, strconv.Itoa(len(message.Field)+4), `)`) + p.P(`s = append(s, "&`, packageName, ".", ccTypeName, `{")`) + + oneofs := make(map[string]struct{}) + for _, field := range message.Field { + nullable := gogoproto.IsNullable(field) + repeated := field.IsRepeated() + fieldname := p.GetFieldName(message, field) + oneof := field.OneofIndex != nil + if oneof { + if _, ok := oneofs[fieldname]; ok { + continue + } else { + oneofs[fieldname] = struct{}{} + } + p.P(`if this.`, fieldname, ` != nil {`) + p.In() + p.P(`s = append(s, "`, fieldname, `: " + `, fmtPkg.Use(), `.Sprintf("%#v", this.`, fieldname, `) + ",\n")`) + p.Out() + p.P(`}`) + } else if p.IsMap(field) { + m := p.GoMapType(nil, field) + mapgoTyp, keyField, keyAliasField := m.GoType, m.KeyField, m.KeyAliasField + keysName := `keysFor` + fieldname + keygoTyp, _ := p.GoType(nil, keyField) + keygoTyp = strings.Replace(keygoTyp, "*", "", 1) + keygoAliasTyp, _ := p.GoType(nil, keyAliasField) + keygoAliasTyp = strings.Replace(keygoAliasTyp, "*", "", 1) + keyCapTyp := generator.CamelCase(keygoTyp) + p.P(keysName, ` := make([]`, keygoTyp, `, 0, len(this.`, fieldname, `))`) + p.P(`for k, _ := range this.`, fieldname, ` {`) + p.In() + if keygoAliasTyp == keygoTyp { + p.P(keysName, ` = append(`, keysName, `, k)`) + } else { + p.P(keysName, ` = append(`, keysName, `, `, keygoTyp, `(k))`) + } + p.Out() + p.P(`}`) + p.P(sortKeysPkg.Use(), `.`, keyCapTyp, `s(`, keysName, `)`) + mapName := `mapStringFor` + fieldname + p.P(mapName, ` := "`, mapgoTyp, `{"`) + p.P(`for _, k := range `, keysName, ` {`) + p.In() + if keygoAliasTyp == keygoTyp { + p.P(mapName, ` += fmt.Sprintf("%#v: %#v,", k, this.`, fieldname, `[k])`) + } else { + p.P(mapName, ` += fmt.Sprintf("%#v: %#v,", k, this.`, fieldname, `[`, keygoAliasTyp, `(k)])`) + } + p.Out() + p.P(`}`) + p.P(mapName, ` += "}"`) + p.P(`if this.`, fieldname, ` != nil {`) + p.In() + p.P(`s = append(s, "`, fieldname, `: " + `, mapName, `+ ",\n")`) + p.Out() + p.P(`}`) + } else if field.IsMessage() || p.IsGroup(field) { + if nullable || repeated { + p.P(`if this.`, fieldname, ` != nil {`) + p.In() + } + if nullable || repeated { + p.P(`s = append(s, "`, fieldname, `: " + `, fmtPkg.Use(), `.Sprintf("%#v", this.`, fieldname, `) + ",\n")`) + } else { + p.P(`s = append(s, "`, fieldname, `: " + `, stringsPkg.Use(), `.Replace(this.`, fieldname, `.GoString()`, ",`&`,``,1)", ` + ",\n")`) + } + if nullable || repeated { + p.Out() + p.P(`}`) + } + } else { + if !proto3 && (nullable || repeated) { + p.P(`if this.`, fieldname, ` != nil {`) + p.In() + } + if field.IsEnum() { + if nullable && !repeated && !proto3 { + goTyp, _ := p.GoType(message, field) + p.P(`s = append(s, "`, fieldname, `: " + valueToGoString`, p.localName, `(this.`, fieldname, `,"`, packageName, ".", generator.GoTypeToName(goTyp), `"`, `) + ",\n")`) + } else { + p.P(`s = append(s, "`, fieldname, `: " + `, fmtPkg.Use(), `.Sprintf("%#v", this.`, fieldname, `) + ",\n")`) + } + } else { + if nullable && !repeated && !proto3 { + goTyp, _ := p.GoType(message, field) + p.P(`s = append(s, "`, fieldname, `: " + valueToGoString`, p.localName, `(this.`, fieldname, `,"`, generator.GoTypeToName(goTyp), `"`, `) + ",\n")`) + } else { + p.P(`s = append(s, "`, fieldname, `: " + `, fmtPkg.Use(), `.Sprintf("%#v", this.`, fieldname, `) + ",\n")`) + } + } + if !proto3 && (nullable || repeated) { + p.Out() + p.P(`}`) + } + } + } + if message.DescriptorProto.HasExtension() { + if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) { + p.P(`s = append(s, "XXX_InternalExtensions: " + extensionToGoString`, p.localName, `(this) + ",\n")`) + } else { + p.P(`if this.XXX_extensions != nil {`) + p.In() + p.P(`s = append(s, "XXX_extensions: " + `, fmtPkg.Use(), `.Sprintf("%#v", this.XXX_extensions) + ",\n")`) + p.Out() + p.P(`}`) + } + } + if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) { + p.P(`if this.XXX_unrecognized != nil {`) + p.In() + p.P(`s = append(s, "XXX_unrecognized:" + `, fmtPkg.Use(), `.Sprintf("%#v", this.XXX_unrecognized) + ",\n")`) + p.Out() + p.P(`}`) + } + + p.P(`s = append(s, "}")`) + //outStr += strings.Join([]string{" + `}`", `}`, `,", "`, ")"}, "") + p.P(`return `, stringsPkg.Use(), `.Join(s, "")`) + p.Out() + p.P(`}`) + + //Generate GoString methods for oneof fields + for _, field := range message.Field { + oneof := field.OneofIndex != nil + if !oneof { + continue + } + ccTypeName := p.OneOfTypeName(message, field) + p.P(`func (this *`, ccTypeName, `) GoString() string {`) + p.In() + p.P(`if this == nil {`) + p.In() + p.P(`return "nil"`) + p.Out() + p.P(`}`) + outFlds := []string{} + fieldname := p.GetOneOfFieldName(message, field) + if field.IsMessage() || p.IsGroup(field) { + tmp := strings.Join([]string{"`", fieldname, ":` + "}, "") + tmp += strings.Join([]string{fmtPkg.Use(), `.Sprintf("%#v", this.`, fieldname, `)`}, "") + outFlds = append(outFlds, tmp) + } else { + tmp := strings.Join([]string{"`", fieldname, ":` + "}, "") + tmp += strings.Join([]string{fmtPkg.Use(), `.Sprintf("%#v", this.`, fieldname, ")"}, "") + outFlds = append(outFlds, tmp) + } + outStr := strings.Join([]string{"s := ", stringsPkg.Use(), ".Join([]string{`&", packageName, ".", ccTypeName, "{` + \n"}, "") + outStr += strings.Join(outFlds, ",\n") + outStr += strings.Join([]string{" + `}`", `}`, `,", "`, ")"}, "") + p.P(outStr) + p.P(`return s`) + p.Out() + p.P(`}`) + } + } + + if !p.atleastOne { + return + } + + p.P(`func valueToGoString`, p.localName, `(v interface{}, typ string) string {`) + p.In() + p.P(`rv := `, reflectPkg.Use(), `.ValueOf(v)`) + p.P(`if rv.IsNil() {`) + p.In() + p.P(`return "nil"`) + p.Out() + p.P(`}`) + p.P(`pv := `, reflectPkg.Use(), `.Indirect(rv).Interface()`) + p.P(`return `, fmtPkg.Use(), `.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)`) + p.Out() + p.P(`}`) + + p.P(`func extensionToGoString`, p.localName, `(m `, protoPkg.Use(), `.Message) string {`) + p.In() + p.P(`e := `, protoPkg.Use(), `.GetUnsafeExtensionsMap(m)`) + p.P(`if e == nil { return "nil" }`) + p.P(`s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{"`) + p.P(`keys := make([]int, 0, len(e))`) + p.P(`for k := range e {`) + p.In() + p.P(`keys = append(keys, int(k))`) + p.Out() + p.P(`}`) + p.P(sortPkg.Use(), `.Ints(keys)`) + p.P(`ss := []string{}`) + p.P(`for _, k := range keys {`) + p.In() + p.P(`ss = append(ss, `, strconvPkg.Use(), `.Itoa(k) + ": " + e[int32(k)].GoString())`) + p.Out() + p.P(`}`) + p.P(`s+=`, stringsPkg.Use(), `.Join(ss, ",") + "})"`) + p.P(`return s`) + p.Out() + p.P(`}`) + +} + +func init() { + generator.RegisterPlugin(NewGoString()) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/gostring/gostringtest.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/gostring/gostringtest.go new file mode 100644 index 00000000000..c7e6c16980e --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/gostring/gostringtest.go @@ -0,0 +1,90 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package gostring + +import ( + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/plugin/testgen" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" +) + +type test struct { + *generator.Generator +} + +func NewTest(g *generator.Generator) testgen.TestPlugin { + return &test{g} +} + +func (p *test) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool { + used := false + randPkg := imports.NewImport("math/rand") + timePkg := imports.NewImport("time") + testingPkg := imports.NewImport("testing") + fmtPkg := imports.NewImport("fmt") + parserPkg := imports.NewImport("go/parser") + for _, message := range file.Messages() { + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + if !gogoproto.HasGoString(file.FileDescriptorProto, message.DescriptorProto) { + continue + } + if message.DescriptorProto.GetOptions().GetMapEntry() { + continue + } + + if gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { + used = true + p.P(`func Test`, ccTypeName, `GoString(t *`, testingPkg.Use(), `.T) {`) + p.In() + p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(`, timePkg.Use(), `.Now().UnixNano()))`) + p.P(`p := NewPopulated`, ccTypeName, `(popr, false)`) + p.P(`s1 := p.GoString()`) + p.P(`s2 := `, fmtPkg.Use(), `.Sprintf("%#v", p)`) + p.P(`if s1 != s2 {`) + p.In() + p.P(`t.Fatalf("GoString want %v got %v", s1, s2)`) + p.Out() + p.P(`}`) + p.P(`_, err := `, parserPkg.Use(), `.ParseExpr(s1)`) + p.P(`if err != nil {`) + p.In() + p.P(`panic(err)`) + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + } + + } + return used +} + +func init() { + testgen.RegisterTestPlugin(NewTest) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/marshalto/marshalto.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/marshalto/marshalto.go new file mode 100644 index 00000000000..d8b1af09e45 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/marshalto/marshalto.go @@ -0,0 +1,1423 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +/* +The marshalto plugin generates a Marshal and MarshalTo method for each message. +The `Marshal() ([]byte, error)` method results in the fact that the message +implements the Marshaler interface. +This allows proto.Marshal to be faster by calling the generated Marshal method rather than using reflect to Marshal the struct. + +If is enabled by the following extensions: + + - marshaler + - marshaler_all + +Or the following extensions: + + - unsafe_marshaler + - unsafe_marshaler_all + +That is if you want to use the unsafe package in your generated code. +The speed up using the unsafe package is not very significant. + +The generation of marshalling tests are enabled using one of the following extensions: + + - testgen + - testgen_all + +And benchmarks given it is enabled using one of the following extensions: + + - benchgen + - benchgen_all + +Let us look at: + + github.com/gogo/protobuf/test/example/example.proto + +Btw all the output can be seen at: + + github.com/gogo/protobuf/test/example/* + +The following message: + +option (gogoproto.marshaler_all) = true; + +message B { + option (gogoproto.description) = true; + optional A A = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; + repeated bytes G = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false]; +} + +given to the marshalto plugin, will generate the following code: + + func (m *B) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil + } + + func (m *B) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintExample(dAtA, i, uint64(m.A.Size())) + n2, err := m.A.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + if len(m.G) > 0 { + for _, msg := range m.G { + dAtA[i] = 0x12 + i++ + i = encodeVarintExample(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil + } + +As shown above Marshal calculates the size of the not yet marshalled message +and allocates the appropriate buffer. +This is followed by calling the MarshalTo method which requires a preallocated buffer. +The MarshalTo method allows a user to rather preallocated a reusable buffer. + +The Size method is generated using the size plugin and the gogoproto.sizer, gogoproto.sizer_all extensions. +The user can also using the generated Size method to check that his reusable buffer is still big enough. + +The generated tests and benchmarks will keep you safe and show that this is really a significant speed improvement. + +An additional message-level option `stable_marshaler` (and the file-level +option `stable_marshaler_all`) exists which causes the generated marshalling +code to behave deterministically. Today, this only changes the serialization of +maps; they are serialized in sort order. +*/ +package marshalto + +import ( + "fmt" + "sort" + "strconv" + "strings" + + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/proto" + descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" + "github.com/gogo/protobuf/vanity" +) + +type NumGen interface { + Next() string + Current() string +} + +type numGen struct { + index int +} + +func NewNumGen() NumGen { + return &numGen{0} +} + +func (this *numGen) Next() string { + this.index++ + return this.Current() +} + +func (this *numGen) Current() string { + return strconv.Itoa(this.index) +} + +type marshalto struct { + *generator.Generator + generator.PluginImports + atleastOne bool + unsafePkg generator.Single + errorsPkg generator.Single + protoPkg generator.Single + sortKeysPkg generator.Single + mathPkg generator.Single + typesPkg generator.Single + localName string + unsafe bool +} + +func NewMarshal() *marshalto { + return &marshalto{} +} + +func NewUnsafeMarshal() *marshalto { + return &marshalto{unsafe: true} +} + +func (p *marshalto) Name() string { + if p.unsafe { + return "unsafemarshaler" + } + return "marshalto" +} + +func (p *marshalto) Init(g *generator.Generator) { + p.Generator = g +} + +func (p *marshalto) callFixed64(varName ...string) { + p.P(`i = encodeFixed64`, p.localName, `(dAtA, i, uint64(`, strings.Join(varName, ""), `))`) +} + +func (p *marshalto) callFixed32(varName ...string) { + p.P(`i = encodeFixed32`, p.localName, `(dAtA, i, uint32(`, strings.Join(varName, ""), `))`) +} + +func (p *marshalto) callVarint(varName ...string) { + p.P(`i = encodeVarint`, p.localName, `(dAtA, i, uint64(`, strings.Join(varName, ""), `))`) +} + +func (p *marshalto) encodeVarint(varName string) { + p.P(`for `, varName, ` >= 1<<7 {`) + p.In() + p.P(`dAtA[i] = uint8(uint64(`, varName, `)&0x7f|0x80)`) + p.P(varName, ` >>= 7`) + p.P(`i++`) + p.Out() + p.P(`}`) + p.P(`dAtA[i] = uint8(`, varName, `)`) + p.P(`i++`) +} + +func (p *marshalto) encodeFixed64(varName string) { + p.P(`dAtA[i] = uint8(`, varName, `)`) + p.P(`i++`) + p.P(`dAtA[i] = uint8(`, varName, ` >> 8)`) + p.P(`i++`) + p.P(`dAtA[i] = uint8(`, varName, ` >> 16)`) + p.P(`i++`) + p.P(`dAtA[i] = uint8(`, varName, ` >> 24)`) + p.P(`i++`) + p.P(`dAtA[i] = uint8(`, varName, ` >> 32)`) + p.P(`i++`) + p.P(`dAtA[i] = uint8(`, varName, ` >> 40)`) + p.P(`i++`) + p.P(`dAtA[i] = uint8(`, varName, ` >> 48)`) + p.P(`i++`) + p.P(`dAtA[i] = uint8(`, varName, ` >> 56)`) + p.P(`i++`) +} + +func (p *marshalto) unsafeFixed64(varName string, someType string) { + p.P(`*(*`, someType, `)(`, p.unsafePkg.Use(), `.Pointer(&dAtA[i])) = `, varName) + p.P(`i+=8`) +} + +func (p *marshalto) encodeFixed32(varName string) { + p.P(`dAtA[i] = uint8(`, varName, `)`) + p.P(`i++`) + p.P(`dAtA[i] = uint8(`, varName, ` >> 8)`) + p.P(`i++`) + p.P(`dAtA[i] = uint8(`, varName, ` >> 16)`) + p.P(`i++`) + p.P(`dAtA[i] = uint8(`, varName, ` >> 24)`) + p.P(`i++`) +} + +func (p *marshalto) unsafeFixed32(varName string, someType string) { + p.P(`*(*`, someType, `)(`, p.unsafePkg.Use(), `.Pointer(&dAtA[i])) = `, varName) + p.P(`i+=4`) +} + +func (p *marshalto) encodeKey(fieldNumber int32, wireType int) { + x := uint32(fieldNumber)<<3 | uint32(wireType) + i := 0 + keybuf := make([]byte, 0) + for i = 0; x > 127; i++ { + keybuf = append(keybuf, 0x80|uint8(x&0x7F)) + x >>= 7 + } + keybuf = append(keybuf, uint8(x)) + for _, b := range keybuf { + p.P(`dAtA[i] = `, fmt.Sprintf("%#v", b)) + p.P(`i++`) + } +} + +func keySize(fieldNumber int32, wireType int) int { + x := uint32(fieldNumber)<<3 | uint32(wireType) + size := 0 + for size = 0; x > 127; size++ { + x >>= 7 + } + size++ + return size +} + +func wireToType(wire string) int { + switch wire { + case "fixed64": + return proto.WireFixed64 + case "fixed32": + return proto.WireFixed32 + case "varint": + return proto.WireVarint + case "bytes": + return proto.WireBytes + case "group": + return proto.WireBytes + case "zigzag32": + return proto.WireVarint + case "zigzag64": + return proto.WireVarint + } + panic("unreachable") +} + +func (p *marshalto) mapField(numGen NumGen, field *descriptor.FieldDescriptorProto, kvField *descriptor.FieldDescriptorProto, varName string, protoSizer bool) { + switch kvField.GetType() { + case descriptor.FieldDescriptorProto_TYPE_DOUBLE: + p.callFixed64(p.mathPkg.Use(), `.Float64bits(float64(`, varName, `))`) + case descriptor.FieldDescriptorProto_TYPE_FLOAT: + p.callFixed32(p.mathPkg.Use(), `.Float32bits(float32(`, varName, `))`) + case descriptor.FieldDescriptorProto_TYPE_INT64, + descriptor.FieldDescriptorProto_TYPE_UINT64, + descriptor.FieldDescriptorProto_TYPE_INT32, + descriptor.FieldDescriptorProto_TYPE_UINT32, + descriptor.FieldDescriptorProto_TYPE_ENUM: + p.callVarint(varName) + case descriptor.FieldDescriptorProto_TYPE_FIXED64, + descriptor.FieldDescriptorProto_TYPE_SFIXED64: + p.callFixed64(varName) + case descriptor.FieldDescriptorProto_TYPE_FIXED32, + descriptor.FieldDescriptorProto_TYPE_SFIXED32: + p.callFixed32(varName) + case descriptor.FieldDescriptorProto_TYPE_BOOL: + p.P(`if `, varName, ` {`) + p.In() + p.P(`dAtA[i] = 1`) + p.Out() + p.P(`} else {`) + p.In() + p.P(`dAtA[i] = 0`) + p.Out() + p.P(`}`) + p.P(`i++`) + case descriptor.FieldDescriptorProto_TYPE_STRING, + descriptor.FieldDescriptorProto_TYPE_BYTES: + if gogoproto.IsCustomType(field) && kvField.IsBytes() { + p.callVarint(varName, `.Size()`) + p.P(`n`, numGen.Next(), `, err := `, varName, `.MarshalTo(dAtA[i:])`) + p.P(`if err != nil {`) + p.In() + p.P(`return 0, err`) + p.Out() + p.P(`}`) + p.P(`i+=n`, numGen.Current()) + } else { + p.callVarint(`len(`, varName, `)`) + p.P(`i+=copy(dAtA[i:], `, varName, `)`) + } + case descriptor.FieldDescriptorProto_TYPE_SINT32: + p.callVarint(`(uint32(`, varName, `) << 1) ^ uint32((`, varName, ` >> 31))`) + case descriptor.FieldDescriptorProto_TYPE_SINT64: + p.callVarint(`(uint64(`, varName, `) << 1) ^ uint64((`, varName, ` >> 63))`) + case descriptor.FieldDescriptorProto_TYPE_MESSAGE: + if gogoproto.IsStdTime(field) { + p.callVarint(p.typesPkg.Use(), `.SizeOfStdTime(*`, varName, `)`) + p.P(`n`, numGen.Next(), `, err := `, p.typesPkg.Use(), `.StdTimeMarshalTo(*`, varName, `, dAtA[i:])`) + } else if gogoproto.IsStdDuration(field) { + p.callVarint(p.typesPkg.Use(), `.SizeOfStdDuration(*`, varName, `)`) + p.P(`n`, numGen.Next(), `, err := `, p.typesPkg.Use(), `.StdDurationMarshalTo(*`, varName, `, dAtA[i:])`) + } else if protoSizer { + p.callVarint(varName, `.ProtoSize()`) + p.P(`n`, numGen.Next(), `, err := `, varName, `.MarshalTo(dAtA[i:])`) + } else { + p.callVarint(varName, `.Size()`) + p.P(`n`, numGen.Next(), `, err := `, varName, `.MarshalTo(dAtA[i:])`) + } + p.P(`if err != nil {`) + p.In() + p.P(`return 0, err`) + p.Out() + p.P(`}`) + p.P(`i+=n`, numGen.Current()) + } +} + +type orderFields []*descriptor.FieldDescriptorProto + +func (this orderFields) Len() int { + return len(this) +} + +func (this orderFields) Less(i, j int) bool { + return this[i].GetNumber() < this[j].GetNumber() +} + +func (this orderFields) Swap(i, j int) { + this[i], this[j] = this[j], this[i] +} + +func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.FileDescriptor, message *generator.Descriptor, field *descriptor.FieldDescriptorProto) { + fieldname := p.GetOneOfFieldName(message, field) + nullable := gogoproto.IsNullable(field) + repeated := field.IsRepeated() + required := field.IsRequired() + + protoSizer := gogoproto.IsProtoSizer(file.FileDescriptorProto, message.DescriptorProto) + doNilCheck := gogoproto.NeedsNilCheck(proto3, field) + if required && nullable { + p.P(`if m.`, fieldname, `== nil {`) + p.In() + if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { + p.P(`return 0, new(`, p.protoPkg.Use(), `.RequiredNotSetError)`) + } else { + p.P(`return 0, `, p.protoPkg.Use(), `.NewRequiredNotSetError("`, field.GetName(), `")`) + } + p.Out() + p.P(`} else {`) + } else if repeated { + p.P(`if len(m.`, fieldname, `) > 0 {`) + p.In() + } else if doNilCheck { + p.P(`if m.`, fieldname, ` != nil {`) + p.In() + } + packed := field.IsPacked() || (proto3 && field.IsRepeated() && generator.IsScalar(field)) + wireType := field.WireType() + fieldNumber := field.GetNumber() + if packed { + wireType = proto.WireBytes + } + switch *field.Type { + case descriptor.FieldDescriptorProto_TYPE_DOUBLE: + if !p.unsafe || gogoproto.IsCastType(field) { + if packed { + p.encodeKey(fieldNumber, wireType) + p.callVarint(`len(m.`, fieldname, `) * 8`) + p.P(`for _, num := range m.`, fieldname, ` {`) + p.In() + p.P(`f`, numGen.Next(), ` := `, p.mathPkg.Use(), `.Float64bits(float64(num))`) + p.encodeFixed64("f" + numGen.Current()) + p.Out() + p.P(`}`) + } else if repeated { + p.P(`for _, num := range m.`, fieldname, ` {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.P(`f`, numGen.Next(), ` := `, p.mathPkg.Use(), `.Float64bits(float64(num))`) + p.encodeFixed64("f" + numGen.Current()) + p.Out() + p.P(`}`) + } else if proto3 { + p.P(`if m.`, fieldname, ` != 0 {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.callFixed64(p.mathPkg.Use(), `.Float64bits(float64(m.`+fieldname, `))`) + p.Out() + p.P(`}`) + } else if !nullable { + p.encodeKey(fieldNumber, wireType) + p.callFixed64(p.mathPkg.Use(), `.Float64bits(float64(m.`+fieldname, `))`) + } else { + p.encodeKey(fieldNumber, wireType) + p.callFixed64(p.mathPkg.Use(), `.Float64bits(float64(*m.`+fieldname, `))`) + } + } else { + if packed { + p.encodeKey(fieldNumber, wireType) + p.callVarint(`len(m.`, fieldname, `) * 8`) + p.P(`for _, num := range m.`, fieldname, ` {`) + p.In() + p.unsafeFixed64("num", "float64") + p.Out() + p.P(`}`) + } else if repeated { + p.P(`for _, num := range m.`, fieldname, ` {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.unsafeFixed64("num", "float64") + p.Out() + p.P(`}`) + } else if proto3 { + p.P(`if m.`, fieldname, ` != 0 {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.unsafeFixed64(`m.`+fieldname, "float64") + p.Out() + p.P(`}`) + } else if !nullable { + p.encodeKey(fieldNumber, wireType) + p.unsafeFixed64(`m.`+fieldname, "float64") + } else { + p.encodeKey(fieldNumber, wireType) + p.unsafeFixed64(`*m.`+fieldname, `float64`) + } + } + case descriptor.FieldDescriptorProto_TYPE_FLOAT: + if !p.unsafe || gogoproto.IsCastType(field) { + if packed { + p.encodeKey(fieldNumber, wireType) + p.callVarint(`len(m.`, fieldname, `) * 4`) + p.P(`for _, num := range m.`, fieldname, ` {`) + p.In() + p.P(`f`, numGen.Next(), ` := `, p.mathPkg.Use(), `.Float32bits(float32(num))`) + p.encodeFixed32("f" + numGen.Current()) + p.Out() + p.P(`}`) + } else if repeated { + p.P(`for _, num := range m.`, fieldname, ` {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.P(`f`, numGen.Next(), ` := `, p.mathPkg.Use(), `.Float32bits(float32(num))`) + p.encodeFixed32("f" + numGen.Current()) + p.Out() + p.P(`}`) + } else if proto3 { + p.P(`if m.`, fieldname, ` != 0 {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.callFixed32(p.mathPkg.Use(), `.Float32bits(float32(m.`+fieldname, `))`) + p.Out() + p.P(`}`) + } else if !nullable { + p.encodeKey(fieldNumber, wireType) + p.callFixed32(p.mathPkg.Use(), `.Float32bits(float32(m.`+fieldname, `))`) + } else { + p.encodeKey(fieldNumber, wireType) + p.callFixed32(p.mathPkg.Use(), `.Float32bits(float32(*m.`+fieldname, `))`) + } + } else { + if packed { + p.encodeKey(fieldNumber, wireType) + p.callVarint(`len(m.`, fieldname, `) * 4`) + p.P(`for _, num := range m.`, fieldname, ` {`) + p.In() + p.unsafeFixed32("num", "float32") + p.Out() + p.P(`}`) + } else if repeated { + p.P(`for _, num := range m.`, fieldname, ` {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.unsafeFixed32("num", "float32") + p.Out() + p.P(`}`) + } else if proto3 { + p.P(`if m.`, fieldname, ` != 0 {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.unsafeFixed32(`m.`+fieldname, `float32`) + p.Out() + p.P(`}`) + } else if !nullable { + p.encodeKey(fieldNumber, wireType) + p.unsafeFixed32(`m.`+fieldname, `float32`) + } else { + p.encodeKey(fieldNumber, wireType) + p.unsafeFixed32(`*m.`+fieldname, "float32") + } + } + case descriptor.FieldDescriptorProto_TYPE_INT64, + descriptor.FieldDescriptorProto_TYPE_UINT64, + descriptor.FieldDescriptorProto_TYPE_INT32, + descriptor.FieldDescriptorProto_TYPE_UINT32, + descriptor.FieldDescriptorProto_TYPE_ENUM: + if packed { + jvar := "j" + numGen.Next() + p.P(`dAtA`, numGen.Next(), ` := make([]byte, len(m.`, fieldname, `)*10)`) + p.P(`var `, jvar, ` int`) + if *field.Type == descriptor.FieldDescriptorProto_TYPE_INT64 || + *field.Type == descriptor.FieldDescriptorProto_TYPE_INT32 { + p.P(`for _, num1 := range m.`, fieldname, ` {`) + p.In() + p.P(`num := uint64(num1)`) + } else { + p.P(`for _, num := range m.`, fieldname, ` {`) + p.In() + } + p.P(`for num >= 1<<7 {`) + p.In() + p.P(`dAtA`, numGen.Current(), `[`, jvar, `] = uint8(uint64(num)&0x7f|0x80)`) + p.P(`num >>= 7`) + p.P(jvar, `++`) + p.Out() + p.P(`}`) + p.P(`dAtA`, numGen.Current(), `[`, jvar, `] = uint8(num)`) + p.P(jvar, `++`) + p.Out() + p.P(`}`) + p.encodeKey(fieldNumber, wireType) + p.callVarint(jvar) + p.P(`i += copy(dAtA[i:], dAtA`, numGen.Current(), `[:`, jvar, `])`) + } else if repeated { + p.P(`for _, num := range m.`, fieldname, ` {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.callVarint("num") + p.Out() + p.P(`}`) + } else if proto3 { + p.P(`if m.`, fieldname, ` != 0 {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.callVarint(`m.`, fieldname) + p.Out() + p.P(`}`) + } else if !nullable { + p.encodeKey(fieldNumber, wireType) + p.callVarint(`m.`, fieldname) + } else { + p.encodeKey(fieldNumber, wireType) + p.callVarint(`*m.`, fieldname) + } + case descriptor.FieldDescriptorProto_TYPE_FIXED64, + descriptor.FieldDescriptorProto_TYPE_SFIXED64: + if !p.unsafe { + if packed { + p.encodeKey(fieldNumber, wireType) + p.callVarint(`len(m.`, fieldname, `) * 8`) + p.P(`for _, num := range m.`, fieldname, ` {`) + p.In() + p.encodeFixed64("num") + p.Out() + p.P(`}`) + } else if repeated { + p.P(`for _, num := range m.`, fieldname, ` {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.encodeFixed64("num") + p.Out() + p.P(`}`) + } else if proto3 { + p.P(`if m.`, fieldname, ` != 0 {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.callFixed64("m." + fieldname) + p.Out() + p.P(`}`) + } else if !nullable { + p.encodeKey(fieldNumber, wireType) + p.callFixed64("m." + fieldname) + } else { + p.encodeKey(fieldNumber, wireType) + p.callFixed64("*m." + fieldname) + } + } else { + typeName := "int64" + if *field.Type == descriptor.FieldDescriptorProto_TYPE_FIXED64 { + typeName = "uint64" + } + if packed { + p.encodeKey(fieldNumber, wireType) + p.callVarint(`len(m.`, fieldname, `) * 8`) + p.P(`for _, num := range m.`, fieldname, ` {`) + p.In() + p.unsafeFixed64("num", typeName) + p.Out() + p.P(`}`) + } else if repeated { + p.P(`for _, num := range m.`, fieldname, ` {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.unsafeFixed64("num", typeName) + p.Out() + p.P(`}`) + } else if proto3 { + p.P(`if m.`, fieldname, ` != 0 {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.unsafeFixed64("m."+fieldname, typeName) + p.Out() + p.P(`}`) + } else if !nullable { + p.encodeKey(fieldNumber, wireType) + p.unsafeFixed64("m."+fieldname, typeName) + } else { + p.encodeKey(fieldNumber, wireType) + p.unsafeFixed64("*m."+fieldname, typeName) + } + } + case descriptor.FieldDescriptorProto_TYPE_FIXED32, + descriptor.FieldDescriptorProto_TYPE_SFIXED32: + if !p.unsafe { + if packed { + p.encodeKey(fieldNumber, wireType) + p.callVarint(`len(m.`, fieldname, `) * 4`) + p.P(`for _, num := range m.`, fieldname, ` {`) + p.In() + p.encodeFixed32("num") + p.Out() + p.P(`}`) + } else if repeated { + p.P(`for _, num := range m.`, fieldname, ` {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.encodeFixed32("num") + p.Out() + p.P(`}`) + } else if proto3 { + p.P(`if m.`, fieldname, ` != 0 {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.callFixed32("m." + fieldname) + p.Out() + p.P(`}`) + } else if !nullable { + p.encodeKey(fieldNumber, wireType) + p.callFixed32("m." + fieldname) + } else { + p.encodeKey(fieldNumber, wireType) + p.callFixed32("*m." + fieldname) + } + } else { + typeName := "int32" + if *field.Type == descriptor.FieldDescriptorProto_TYPE_FIXED32 { + typeName = "uint32" + } + if packed { + p.encodeKey(fieldNumber, wireType) + p.callVarint(`len(m.`, fieldname, `) * 4`) + p.P(`for _, num := range m.`, fieldname, ` {`) + p.In() + p.unsafeFixed32("num", typeName) + p.Out() + p.P(`}`) + } else if repeated { + p.P(`for _, num := range m.`, fieldname, ` {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.unsafeFixed32("num", typeName) + p.Out() + p.P(`}`) + } else if proto3 { + p.P(`if m.`, fieldname, ` != 0 {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.unsafeFixed32("m."+fieldname, typeName) + p.Out() + p.P(`}`) + } else if !nullable { + p.encodeKey(fieldNumber, wireType) + p.unsafeFixed32("m."+fieldname, typeName) + } else { + p.encodeKey(fieldNumber, wireType) + p.unsafeFixed32("*m."+fieldname, typeName) + } + } + case descriptor.FieldDescriptorProto_TYPE_BOOL: + if packed { + p.encodeKey(fieldNumber, wireType) + p.callVarint(`len(m.`, fieldname, `)`) + p.P(`for _, b := range m.`, fieldname, ` {`) + p.In() + p.P(`if b {`) + p.In() + p.P(`dAtA[i] = 1`) + p.Out() + p.P(`} else {`) + p.In() + p.P(`dAtA[i] = 0`) + p.Out() + p.P(`}`) + p.P(`i++`) + p.Out() + p.P(`}`) + } else if repeated { + p.P(`for _, b := range m.`, fieldname, ` {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.P(`if b {`) + p.In() + p.P(`dAtA[i] = 1`) + p.Out() + p.P(`} else {`) + p.In() + p.P(`dAtA[i] = 0`) + p.Out() + p.P(`}`) + p.P(`i++`) + p.Out() + p.P(`}`) + } else if proto3 { + p.P(`if m.`, fieldname, ` {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.P(`if m.`, fieldname, ` {`) + p.In() + p.P(`dAtA[i] = 1`) + p.Out() + p.P(`} else {`) + p.In() + p.P(`dAtA[i] = 0`) + p.Out() + p.P(`}`) + p.P(`i++`) + p.Out() + p.P(`}`) + } else if !nullable { + p.encodeKey(fieldNumber, wireType) + p.P(`if m.`, fieldname, ` {`) + p.In() + p.P(`dAtA[i] = 1`) + p.Out() + p.P(`} else {`) + p.In() + p.P(`dAtA[i] = 0`) + p.Out() + p.P(`}`) + p.P(`i++`) + } else { + p.encodeKey(fieldNumber, wireType) + p.P(`if *m.`, fieldname, ` {`) + p.In() + p.P(`dAtA[i] = 1`) + p.Out() + p.P(`} else {`) + p.In() + p.P(`dAtA[i] = 0`) + p.Out() + p.P(`}`) + p.P(`i++`) + } + case descriptor.FieldDescriptorProto_TYPE_STRING: + if repeated { + p.P(`for _, s := range m.`, fieldname, ` {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.P(`l = len(s)`) + p.encodeVarint("l") + p.P(`i+=copy(dAtA[i:], s)`) + p.Out() + p.P(`}`) + } else if proto3 { + p.P(`if len(m.`, fieldname, `) > 0 {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.callVarint(`len(m.`, fieldname, `)`) + p.P(`i+=copy(dAtA[i:], m.`, fieldname, `)`) + p.Out() + p.P(`}`) + } else if !nullable { + p.encodeKey(fieldNumber, wireType) + p.callVarint(`len(m.`, fieldname, `)`) + p.P(`i+=copy(dAtA[i:], m.`, fieldname, `)`) + } else { + p.encodeKey(fieldNumber, wireType) + p.callVarint(`len(*m.`, fieldname, `)`) + p.P(`i+=copy(dAtA[i:], *m.`, fieldname, `)`) + } + case descriptor.FieldDescriptorProto_TYPE_GROUP: + panic(fmt.Errorf("marshaler does not support group %v", fieldname)) + case descriptor.FieldDescriptorProto_TYPE_MESSAGE: + if p.IsMap(field) { + m := p.GoMapType(nil, field) + keygoTyp, keywire := p.GoType(nil, m.KeyField) + keygoAliasTyp, _ := p.GoType(nil, m.KeyAliasField) + // keys may not be pointers + keygoTyp = strings.Replace(keygoTyp, "*", "", 1) + keygoAliasTyp = strings.Replace(keygoAliasTyp, "*", "", 1) + keyCapTyp := generator.CamelCase(keygoTyp) + valuegoTyp, valuewire := p.GoType(nil, m.ValueField) + valuegoAliasTyp, _ := p.GoType(nil, m.ValueAliasField) + nullable, valuegoTyp, valuegoAliasTyp = generator.GoMapValueTypes(field, m.ValueField, valuegoTyp, valuegoAliasTyp) + keyKeySize := keySize(1, wireToType(keywire)) + valueKeySize := keySize(2, wireToType(valuewire)) + if gogoproto.IsStableMarshaler(file.FileDescriptorProto, message.DescriptorProto) { + keysName := `keysFor` + fieldname + p.P(keysName, ` := make([]`, keygoTyp, `, 0, len(m.`, fieldname, `))`) + p.P(`for k, _ := range m.`, fieldname, ` {`) + p.In() + p.P(keysName, ` = append(`, keysName, `, `, keygoTyp, `(k))`) + p.Out() + p.P(`}`) + p.P(p.sortKeysPkg.Use(), `.`, keyCapTyp, `s(`, keysName, `)`) + p.P(`for _, k := range `, keysName, ` {`) + } else { + p.P(`for k, _ := range m.`, fieldname, ` {`) + } + p.In() + p.encodeKey(fieldNumber, wireType) + sum := []string{strconv.Itoa(keyKeySize)} + switch m.KeyField.GetType() { + case descriptor.FieldDescriptorProto_TYPE_DOUBLE, + descriptor.FieldDescriptorProto_TYPE_FIXED64, + descriptor.FieldDescriptorProto_TYPE_SFIXED64: + sum = append(sum, `8`) + case descriptor.FieldDescriptorProto_TYPE_FLOAT, + descriptor.FieldDescriptorProto_TYPE_FIXED32, + descriptor.FieldDescriptorProto_TYPE_SFIXED32: + sum = append(sum, `4`) + case descriptor.FieldDescriptorProto_TYPE_INT64, + descriptor.FieldDescriptorProto_TYPE_UINT64, + descriptor.FieldDescriptorProto_TYPE_UINT32, + descriptor.FieldDescriptorProto_TYPE_ENUM, + descriptor.FieldDescriptorProto_TYPE_INT32: + sum = append(sum, `sov`+p.localName+`(uint64(k))`) + case descriptor.FieldDescriptorProto_TYPE_BOOL: + sum = append(sum, `1`) + case descriptor.FieldDescriptorProto_TYPE_STRING, + descriptor.FieldDescriptorProto_TYPE_BYTES: + sum = append(sum, `len(k)+sov`+p.localName+`(uint64(len(k)))`) + case descriptor.FieldDescriptorProto_TYPE_SINT32, + descriptor.FieldDescriptorProto_TYPE_SINT64: + sum = append(sum, `soz`+p.localName+`(uint64(k))`) + } + if gogoproto.IsStableMarshaler(file.FileDescriptorProto, message.DescriptorProto) { + p.P(`v := m.`, fieldname, `[`, keygoAliasTyp, `(k)]`) + } else { + p.P(`v := m.`, fieldname, `[k]`) + } + accessor := `v` + switch m.ValueField.GetType() { + case descriptor.FieldDescriptorProto_TYPE_DOUBLE, + descriptor.FieldDescriptorProto_TYPE_FIXED64, + descriptor.FieldDescriptorProto_TYPE_SFIXED64: + sum = append(sum, strconv.Itoa(valueKeySize)) + sum = append(sum, strconv.Itoa(8)) + case descriptor.FieldDescriptorProto_TYPE_FLOAT, + descriptor.FieldDescriptorProto_TYPE_FIXED32, + descriptor.FieldDescriptorProto_TYPE_SFIXED32: + sum = append(sum, strconv.Itoa(valueKeySize)) + sum = append(sum, strconv.Itoa(4)) + case descriptor.FieldDescriptorProto_TYPE_INT64, + descriptor.FieldDescriptorProto_TYPE_UINT64, + descriptor.FieldDescriptorProto_TYPE_UINT32, + descriptor.FieldDescriptorProto_TYPE_ENUM, + descriptor.FieldDescriptorProto_TYPE_INT32: + sum = append(sum, strconv.Itoa(valueKeySize)) + sum = append(sum, `sov`+p.localName+`(uint64(v))`) + case descriptor.FieldDescriptorProto_TYPE_BOOL: + sum = append(sum, strconv.Itoa(valueKeySize)) + sum = append(sum, `1`) + case descriptor.FieldDescriptorProto_TYPE_STRING: + sum = append(sum, strconv.Itoa(valueKeySize)) + sum = append(sum, `len(v)+sov`+p.localName+`(uint64(len(v)))`) + case descriptor.FieldDescriptorProto_TYPE_BYTES: + if gogoproto.IsCustomType(field) { + p.P(`cSize := 0`) + if gogoproto.IsNullable(field) { + p.P(`if `, accessor, ` != nil {`) + p.In() + } + p.P(`cSize = `, accessor, `.Size()`) + p.P(`cSize += `, strconv.Itoa(valueKeySize), ` + sov`+p.localName+`(uint64(cSize))`) + if gogoproto.IsNullable(field) { + p.Out() + p.P(`}`) + } + sum = append(sum, `cSize`) + } else { + p.P(`byteSize := 0`) + if proto3 { + p.P(`if len(v) > 0 {`) + } else { + p.P(`if v != nil {`) + } + p.In() + p.P(`byteSize = `, strconv.Itoa(valueKeySize), ` + len(v)+sov`+p.localName+`(uint64(len(v)))`) + p.Out() + p.P(`}`) + sum = append(sum, `byteSize`) + } + case descriptor.FieldDescriptorProto_TYPE_SINT32, + descriptor.FieldDescriptorProto_TYPE_SINT64: + sum = append(sum, strconv.Itoa(valueKeySize)) + sum = append(sum, `soz`+p.localName+`(uint64(v))`) + case descriptor.FieldDescriptorProto_TYPE_MESSAGE: + if valuegoTyp != valuegoAliasTyp && + !gogoproto.IsStdTime(field) && + !gogoproto.IsStdDuration(field) { + if nullable { + // cast back to the type that has the generated methods on it + accessor = `((` + valuegoTyp + `)(` + accessor + `))` + } else { + accessor = `((*` + valuegoTyp + `)(&` + accessor + `))` + } + } else if !nullable { + accessor = `(&v)` + } + p.P(`msgSize := 0`) + p.P(`if `, accessor, ` != nil {`) + p.In() + if gogoproto.IsStdTime(field) { + p.P(`msgSize = `, p.typesPkg.Use(), `.SizeOfStdTime(*`, accessor, `)`) + } else if gogoproto.IsStdDuration(field) { + p.P(`msgSize = `, p.typesPkg.Use(), `.SizeOfStdDuration(*`, accessor, `)`) + } else if protoSizer { + p.P(`msgSize = `, accessor, `.ProtoSize()`) + } else { + p.P(`msgSize = `, accessor, `.Size()`) + } + p.P(`msgSize += `, strconv.Itoa(valueKeySize), ` + sov`+p.localName+`(uint64(msgSize))`) + p.Out() + p.P(`}`) + sum = append(sum, `msgSize`) + } + p.P(`mapSize := `, strings.Join(sum, " + ")) + p.callVarint("mapSize") + p.encodeKey(1, wireToType(keywire)) + p.mapField(numGen, field, m.KeyField, "k", protoSizer) + nullableMsg := nullable && (m.ValueField.GetType() == descriptor.FieldDescriptorProto_TYPE_MESSAGE || + gogoproto.IsCustomType(field) && m.ValueField.IsBytes()) + plainBytes := m.ValueField.IsBytes() && !gogoproto.IsCustomType(field) + if nullableMsg { + p.P(`if `, accessor, ` != nil { `) + p.In() + } else if plainBytes { + if proto3 { + p.P(`if len(`, accessor, `) > 0 {`) + } else { + p.P(`if `, accessor, ` != nil {`) + } + p.In() + } + p.encodeKey(2, wireToType(valuewire)) + p.mapField(numGen, field, m.ValueField, accessor, protoSizer) + if nullableMsg || plainBytes { + p.Out() + p.P(`}`) + } + p.Out() + p.P(`}`) + } else if repeated { + p.P(`for _, msg := range m.`, fieldname, ` {`) + p.In() + p.encodeKey(fieldNumber, wireType) + varName := "msg" + if gogoproto.IsStdTime(field) { + if gogoproto.IsNullable(field) { + varName = "*" + varName + } + p.callVarint(p.typesPkg.Use(), `.SizeOfStdTime(`, varName, `)`) + p.P(`n, err := `, p.typesPkg.Use(), `.StdTimeMarshalTo(`, varName, `, dAtA[i:])`) + } else if gogoproto.IsStdDuration(field) { + if gogoproto.IsNullable(field) { + varName = "*" + varName + } + p.callVarint(p.typesPkg.Use(), `.SizeOfStdDuration(`, varName, `)`) + p.P(`n, err := `, p.typesPkg.Use(), `.StdDurationMarshalTo(`, varName, `, dAtA[i:])`) + } else if protoSizer { + p.callVarint(varName, ".ProtoSize()") + p.P(`n, err := `, varName, `.MarshalTo(dAtA[i:])`) + } else { + p.callVarint(varName, ".Size()") + p.P(`n, err := `, varName, `.MarshalTo(dAtA[i:])`) + } + p.P(`if err != nil {`) + p.In() + p.P(`return 0, err`) + p.Out() + p.P(`}`) + p.P(`i+=n`) + p.Out() + p.P(`}`) + } else { + p.encodeKey(fieldNumber, wireType) + varName := `m.` + fieldname + if gogoproto.IsStdTime(field) { + if gogoproto.IsNullable(field) { + varName = "*" + varName + } + p.callVarint(p.typesPkg.Use(), `.SizeOfStdTime(`, varName, `)`) + p.P(`n`, numGen.Next(), `, err := `, p.typesPkg.Use(), `.StdTimeMarshalTo(`, varName, `, dAtA[i:])`) + } else if gogoproto.IsStdDuration(field) { + if gogoproto.IsNullable(field) { + varName = "*" + varName + } + p.callVarint(p.typesPkg.Use(), `.SizeOfStdDuration(`, varName, `)`) + p.P(`n`, numGen.Next(), `, err := `, p.typesPkg.Use(), `.StdDurationMarshalTo(`, varName, `, dAtA[i:])`) + } else if protoSizer { + p.callVarint(varName, `.ProtoSize()`) + p.P(`n`, numGen.Next(), `, err := `, varName, `.MarshalTo(dAtA[i:])`) + } else { + p.callVarint(varName, `.Size()`) + p.P(`n`, numGen.Next(), `, err := `, varName, `.MarshalTo(dAtA[i:])`) + } + p.P(`if err != nil {`) + p.In() + p.P(`return 0, err`) + p.Out() + p.P(`}`) + p.P(`i+=n`, numGen.Current()) + } + case descriptor.FieldDescriptorProto_TYPE_BYTES: + if !gogoproto.IsCustomType(field) { + if repeated { + p.P(`for _, b := range m.`, fieldname, ` {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.callVarint("len(b)") + p.P(`i+=copy(dAtA[i:], b)`) + p.Out() + p.P(`}`) + } else if proto3 { + p.P(`if len(m.`, fieldname, `) > 0 {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.callVarint(`len(m.`, fieldname, `)`) + p.P(`i+=copy(dAtA[i:], m.`, fieldname, `)`) + p.Out() + p.P(`}`) + } else { + p.encodeKey(fieldNumber, wireType) + p.callVarint(`len(m.`, fieldname, `)`) + p.P(`i+=copy(dAtA[i:], m.`, fieldname, `)`) + } + } else { + if repeated { + p.P(`for _, msg := range m.`, fieldname, ` {`) + p.In() + p.encodeKey(fieldNumber, wireType) + if protoSizer { + p.callVarint(`msg.ProtoSize()`) + } else { + p.callVarint(`msg.Size()`) + } + p.P(`n, err := msg.MarshalTo(dAtA[i:])`) + p.P(`if err != nil {`) + p.In() + p.P(`return 0, err`) + p.Out() + p.P(`}`) + p.P(`i+=n`) + p.Out() + p.P(`}`) + } else { + p.encodeKey(fieldNumber, wireType) + if protoSizer { + p.callVarint(`m.`, fieldname, `.ProtoSize()`) + } else { + p.callVarint(`m.`, fieldname, `.Size()`) + } + p.P(`n`, numGen.Next(), `, err := m.`, fieldname, `.MarshalTo(dAtA[i:])`) + p.P(`if err != nil {`) + p.In() + p.P(`return 0, err`) + p.Out() + p.P(`}`) + p.P(`i+=n`, numGen.Current()) + } + } + case descriptor.FieldDescriptorProto_TYPE_SINT32: + if packed { + datavar := "dAtA" + numGen.Next() + jvar := "j" + numGen.Next() + p.P(datavar, ` := make([]byte, len(m.`, fieldname, ")*5)") + p.P(`var `, jvar, ` int`) + p.P(`for _, num := range m.`, fieldname, ` {`) + p.In() + xvar := "x" + numGen.Next() + p.P(xvar, ` := (uint32(num) << 1) ^ uint32((num >> 31))`) + p.P(`for `, xvar, ` >= 1<<7 {`) + p.In() + p.P(datavar, `[`, jvar, `] = uint8(uint64(`, xvar, `)&0x7f|0x80)`) + p.P(jvar, `++`) + p.P(xvar, ` >>= 7`) + p.Out() + p.P(`}`) + p.P(datavar, `[`, jvar, `] = uint8(`, xvar, `)`) + p.P(jvar, `++`) + p.Out() + p.P(`}`) + p.encodeKey(fieldNumber, wireType) + p.callVarint(jvar) + p.P(`i+=copy(dAtA[i:], `, datavar, `[:`, jvar, `])`) + } else if repeated { + p.P(`for _, num := range m.`, fieldname, ` {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.P(`x`, numGen.Next(), ` := (uint32(num) << 1) ^ uint32((num >> 31))`) + p.encodeVarint("x" + numGen.Current()) + p.Out() + p.P(`}`) + } else if proto3 { + p.P(`if m.`, fieldname, ` != 0 {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.callVarint(`(uint32(m.`, fieldname, `) << 1) ^ uint32((m.`, fieldname, ` >> 31))`) + p.Out() + p.P(`}`) + } else if !nullable { + p.encodeKey(fieldNumber, wireType) + p.callVarint(`(uint32(m.`, fieldname, `) << 1) ^ uint32((m.`, fieldname, ` >> 31))`) + } else { + p.encodeKey(fieldNumber, wireType) + p.callVarint(`(uint32(*m.`, fieldname, `) << 1) ^ uint32((*m.`, fieldname, ` >> 31))`) + } + case descriptor.FieldDescriptorProto_TYPE_SINT64: + if packed { + jvar := "j" + numGen.Next() + xvar := "x" + numGen.Next() + datavar := "dAtA" + numGen.Next() + p.P(`var `, jvar, ` int`) + p.P(datavar, ` := make([]byte, len(m.`, fieldname, `)*10)`) + p.P(`for _, num := range m.`, fieldname, ` {`) + p.In() + p.P(xvar, ` := (uint64(num) << 1) ^ uint64((num >> 63))`) + p.P(`for `, xvar, ` >= 1<<7 {`) + p.In() + p.P(datavar, `[`, jvar, `] = uint8(uint64(`, xvar, `)&0x7f|0x80)`) + p.P(jvar, `++`) + p.P(xvar, ` >>= 7`) + p.Out() + p.P(`}`) + p.P(datavar, `[`, jvar, `] = uint8(`, xvar, `)`) + p.P(jvar, `++`) + p.Out() + p.P(`}`) + p.encodeKey(fieldNumber, wireType) + p.callVarint(jvar) + p.P(`i+=copy(dAtA[i:], `, datavar, `[:`, jvar, `])`) + } else if repeated { + p.P(`for _, num := range m.`, fieldname, ` {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.P(`x`, numGen.Next(), ` := (uint64(num) << 1) ^ uint64((num >> 63))`) + p.encodeVarint("x" + numGen.Current()) + p.Out() + p.P(`}`) + } else if proto3 { + p.P(`if m.`, fieldname, ` != 0 {`) + p.In() + p.encodeKey(fieldNumber, wireType) + p.callVarint(`(uint64(m.`, fieldname, `) << 1) ^ uint64((m.`, fieldname, ` >> 63))`) + p.Out() + p.P(`}`) + } else if !nullable { + p.encodeKey(fieldNumber, wireType) + p.callVarint(`(uint64(m.`, fieldname, `) << 1) ^ uint64((m.`, fieldname, ` >> 63))`) + } else { + p.encodeKey(fieldNumber, wireType) + p.callVarint(`(uint64(*m.`, fieldname, `) << 1) ^ uint64((*m.`, fieldname, ` >> 63))`) + } + default: + panic("not implemented") + } + if (required && nullable) || repeated || doNilCheck { + p.Out() + p.P(`}`) + } +} + +func (p *marshalto) Generate(file *generator.FileDescriptor) { + numGen := NewNumGen() + p.PluginImports = generator.NewPluginImports(p.Generator) + p.atleastOne = false + p.localName = generator.FileName(file) + + p.mathPkg = p.NewImport("math") + p.sortKeysPkg = p.NewImport("github.com/gogo/protobuf/sortkeys") + p.protoPkg = p.NewImport("github.com/gogo/protobuf/proto") + if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { + p.protoPkg = p.NewImport("github.com/golang/protobuf/proto") + } + p.unsafePkg = p.NewImport("unsafe") + p.errorsPkg = p.NewImport("errors") + p.typesPkg = p.NewImport("github.com/gogo/protobuf/types") + + for _, message := range file.Messages() { + if message.DescriptorProto.GetOptions().GetMapEntry() { + continue + } + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + if p.unsafe { + if !gogoproto.IsUnsafeMarshaler(file.FileDescriptorProto, message.DescriptorProto) { + continue + } + if gogoproto.IsMarshaler(file.FileDescriptorProto, message.DescriptorProto) { + panic(fmt.Sprintf("unsafe_marshaler and marshalto enabled for %v", ccTypeName)) + } + } + if !p.unsafe { + if !gogoproto.IsMarshaler(file.FileDescriptorProto, message.DescriptorProto) { + continue + } + if gogoproto.IsUnsafeMarshaler(file.FileDescriptorProto, message.DescriptorProto) { + panic(fmt.Sprintf("unsafe_marshaler and marshalto enabled for %v", ccTypeName)) + } + } + p.atleastOne = true + + p.P(`func (m *`, ccTypeName, `) Marshal() (dAtA []byte, err error) {`) + p.In() + if gogoproto.IsProtoSizer(file.FileDescriptorProto, message.DescriptorProto) { + p.P(`size := m.ProtoSize()`) + } else { + p.P(`size := m.Size()`) + } + p.P(`dAtA = make([]byte, size)`) + p.P(`n, err := m.MarshalTo(dAtA)`) + p.P(`if err != nil {`) + p.In() + p.P(`return nil, err`) + p.Out() + p.P(`}`) + p.P(`return dAtA[:n], nil`) + p.Out() + p.P(`}`) + p.P(``) + p.P(`func (m *`, ccTypeName, `) MarshalTo(dAtA []byte) (int, error) {`) + p.In() + p.P(`var i int`) + p.P(`_ = i`) + p.P(`var l int`) + p.P(`_ = l`) + fields := orderFields(message.GetField()) + sort.Sort(fields) + oneofs := make(map[string]struct{}) + for _, field := range message.Field { + oneof := field.OneofIndex != nil + if !oneof { + proto3 := gogoproto.IsProto3(file.FileDescriptorProto) + p.generateField(proto3, numGen, file, message, field) + } else { + fieldname := p.GetFieldName(message, field) + if _, ok := oneofs[fieldname]; !ok { + oneofs[fieldname] = struct{}{} + p.P(`if m.`, fieldname, ` != nil {`) + p.In() + p.P(`nn`, numGen.Next(), `, err := m.`, fieldname, `.MarshalTo(dAtA[i:])`) + p.P(`if err != nil {`) + p.In() + p.P(`return 0, err`) + p.Out() + p.P(`}`) + p.P(`i+=nn`, numGen.Current()) + p.Out() + p.P(`}`) + } + } + } + if message.DescriptorProto.HasExtension() { + if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) { + p.P(`n, err := `, p.protoPkg.Use(), `.EncodeInternalExtension(m, dAtA[i:])`) + p.P(`if err != nil {`) + p.In() + p.P(`return 0, err`) + p.Out() + p.P(`}`) + p.P(`i+=n`) + } else { + p.P(`if m.XXX_extensions != nil {`) + p.In() + p.P(`i+=copy(dAtA[i:], m.XXX_extensions)`) + p.Out() + p.P(`}`) + } + } + if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) { + p.P(`if m.XXX_unrecognized != nil {`) + p.In() + p.P(`i+=copy(dAtA[i:], m.XXX_unrecognized)`) + p.Out() + p.P(`}`) + } + + p.P(`return i, nil`) + p.Out() + p.P(`}`) + p.P() + + //Generate MarshalTo methods for oneof fields + m := proto.Clone(message.DescriptorProto).(*descriptor.DescriptorProto) + for _, field := range m.Field { + oneof := field.OneofIndex != nil + if !oneof { + continue + } + ccTypeName := p.OneOfTypeName(message, field) + p.P(`func (m *`, ccTypeName, `) MarshalTo(dAtA []byte) (int, error) {`) + p.In() + p.P(`i := 0`) + vanity.TurnOffNullableForNativeTypesWithoutDefaultsOnly(field) + p.generateField(false, numGen, file, message, field) + p.P(`return i, nil`) + p.Out() + p.P(`}`) + } + } + + if p.atleastOne { + p.P(`func encodeFixed64`, p.localName, `(dAtA []byte, offset int, v uint64) int {`) + p.In() + p.P(`dAtA[offset] = uint8(v)`) + p.P(`dAtA[offset+1] = uint8(v >> 8)`) + p.P(`dAtA[offset+2] = uint8(v >> 16)`) + p.P(`dAtA[offset+3] = uint8(v >> 24)`) + p.P(`dAtA[offset+4] = uint8(v >> 32)`) + p.P(`dAtA[offset+5] = uint8(v >> 40)`) + p.P(`dAtA[offset+6] = uint8(v >> 48)`) + p.P(`dAtA[offset+7] = uint8(v >> 56)`) + p.P(`return offset+8`) + p.Out() + p.P(`}`) + + p.P(`func encodeFixed32`, p.localName, `(dAtA []byte, offset int, v uint32) int {`) + p.In() + p.P(`dAtA[offset] = uint8(v)`) + p.P(`dAtA[offset+1] = uint8(v >> 8)`) + p.P(`dAtA[offset+2] = uint8(v >> 16)`) + p.P(`dAtA[offset+3] = uint8(v >> 24)`) + p.P(`return offset+4`) + p.Out() + p.P(`}`) + + p.P(`func encodeVarint`, p.localName, `(dAtA []byte, offset int, v uint64) int {`) + p.In() + p.P(`for v >= 1<<7 {`) + p.In() + p.P(`dAtA[offset] = uint8(v&0x7f|0x80)`) + p.P(`v >>= 7`) + p.P(`offset++`) + p.Out() + p.P(`}`) + p.P(`dAtA[offset] = uint8(v)`) + p.P(`return offset+1`) + p.Out() + p.P(`}`) + } + +} + +func init() { + generator.RegisterPlugin(NewMarshal()) + generator.RegisterPlugin(NewUnsafeMarshal()) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/oneofcheck/oneofcheck.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/oneofcheck/oneofcheck.go new file mode 100644 index 00000000000..0f822e8a8ac --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/oneofcheck/oneofcheck.go @@ -0,0 +1,93 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +/* +The oneofcheck plugin is used to check whether oneof is not used incorrectly. +For instance: +An error is caused if a oneof field: + - is used in a face + - is an embedded field + +*/ +package oneofcheck + +import ( + "fmt" + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" + "os" +) + +type plugin struct { + *generator.Generator +} + +func NewPlugin() *plugin { + return &plugin{} +} + +func (p *plugin) Name() string { + return "oneofcheck" +} + +func (p *plugin) Init(g *generator.Generator) { + p.Generator = g +} + +func (p *plugin) Generate(file *generator.FileDescriptor) { + for _, msg := range file.Messages() { + face := gogoproto.IsFace(file.FileDescriptorProto, msg.DescriptorProto) + for _, field := range msg.GetField() { + if field.OneofIndex == nil { + continue + } + if face { + fmt.Fprintf(os.Stderr, "ERROR: field %v.%v cannot be in a face and oneof\n", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name)) + os.Exit(1) + } + if gogoproto.IsEmbed(field) { + fmt.Fprintf(os.Stderr, "ERROR: field %v.%v cannot be in an oneof and an embedded field\n", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name)) + os.Exit(1) + } + if !gogoproto.IsNullable(field) { + fmt.Fprintf(os.Stderr, "ERROR: field %v.%v cannot be in an oneof and a non-nullable field\n", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name)) + os.Exit(1) + } + if gogoproto.IsUnion(file.FileDescriptorProto, msg.DescriptorProto) { + fmt.Fprintf(os.Stderr, "ERROR: field %v.%v cannot be in an oneof and in an union (deprecated)\n", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name)) + os.Exit(1) + } + } + } +} + +func (p *plugin) GenerateImports(*generator.FileDescriptor) {} + +func init() { + generator.RegisterPlugin(NewPlugin()) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/populate/populate.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/populate/populate.go new file mode 100644 index 00000000000..e03c3e29e0a --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/populate/populate.go @@ -0,0 +1,796 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +/* +The populate plugin generates a NewPopulated function. +This function returns a newly populated structure. + +It is enabled by the following extensions: + + - populate + - populate_all + +Let us look at: + + github.com/gogo/protobuf/test/example/example.proto + +Btw all the output can be seen at: + + github.com/gogo/protobuf/test/example/* + +The following message: + + option (gogoproto.populate_all) = true; + + message B { + optional A A = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; + repeated bytes G = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false]; + } + +given to the populate plugin, will generate code the following code: + + func NewPopulatedB(r randyExample, easy bool) *B { + this := &B{} + v2 := NewPopulatedA(r, easy) + this.A = *v2 + if r.Intn(10) != 0 { + v3 := r.Intn(10) + this.G = make([]github_com_gogo_protobuf_test_custom.Uint128, v3) + for i := 0; i < v3; i++ { + v4 := github_com_gogo_protobuf_test_custom.NewPopulatedUint128(r) + this.G[i] = *v4 + } + } + if !easy && r.Intn(10) != 0 { + this.XXX_unrecognized = randUnrecognizedExample(r, 3) + } + return this + } + +The idea that is useful for testing. +Most of the other plugins' generated test code uses it. +You will still be able to use the generated test code of other packages +if you turn off the popluate plugin and write your own custom NewPopulated function. + +If the easy flag is not set the XXX_unrecognized and XXX_extensions fields are also populated. +These have caused problems with JSON marshalling and unmarshalling tests. + +*/ +package populate + +import ( + "fmt" + "math" + "strconv" + "strings" + + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/proto" + descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" + "github.com/gogo/protobuf/vanity" +) + +type VarGen interface { + Next() string + Current() string +} + +type varGen struct { + index int64 +} + +func NewVarGen() VarGen { + return &varGen{0} +} + +func (this *varGen) Next() string { + this.index++ + return fmt.Sprintf("v%d", this.index) +} + +func (this *varGen) Current() string { + return fmt.Sprintf("v%d", this.index) +} + +type plugin struct { + *generator.Generator + generator.PluginImports + varGen VarGen + atleastOne bool + localName string + typesPkg generator.Single +} + +func NewPlugin() *plugin { + return &plugin{} +} + +func (p *plugin) Name() string { + return "populate" +} + +func (p *plugin) Init(g *generator.Generator) { + p.Generator = g +} + +func value(typeName string, fieldType descriptor.FieldDescriptorProto_Type) string { + switch fieldType { + case descriptor.FieldDescriptorProto_TYPE_DOUBLE: + return typeName + "(r.Float64())" + case descriptor.FieldDescriptorProto_TYPE_FLOAT: + return typeName + "(r.Float32())" + case descriptor.FieldDescriptorProto_TYPE_INT64, + descriptor.FieldDescriptorProto_TYPE_SFIXED64, + descriptor.FieldDescriptorProto_TYPE_SINT64: + return typeName + "(r.Int63())" + case descriptor.FieldDescriptorProto_TYPE_UINT64, + descriptor.FieldDescriptorProto_TYPE_FIXED64: + return typeName + "(uint64(r.Uint32()))" + case descriptor.FieldDescriptorProto_TYPE_INT32, + descriptor.FieldDescriptorProto_TYPE_SINT32, + descriptor.FieldDescriptorProto_TYPE_SFIXED32, + descriptor.FieldDescriptorProto_TYPE_ENUM: + return typeName + "(r.Int31())" + case descriptor.FieldDescriptorProto_TYPE_UINT32, + descriptor.FieldDescriptorProto_TYPE_FIXED32: + return typeName + "(r.Uint32())" + case descriptor.FieldDescriptorProto_TYPE_BOOL: + return typeName + `(bool(r.Intn(2) == 0))` + case descriptor.FieldDescriptorProto_TYPE_STRING, + descriptor.FieldDescriptorProto_TYPE_GROUP, + descriptor.FieldDescriptorProto_TYPE_MESSAGE, + descriptor.FieldDescriptorProto_TYPE_BYTES: + } + panic(fmt.Errorf("unexpected type %v", typeName)) +} + +func negative(fieldType descriptor.FieldDescriptorProto_Type) bool { + switch fieldType { + case descriptor.FieldDescriptorProto_TYPE_UINT64, + descriptor.FieldDescriptorProto_TYPE_FIXED64, + descriptor.FieldDescriptorProto_TYPE_UINT32, + descriptor.FieldDescriptorProto_TYPE_FIXED32, + descriptor.FieldDescriptorProto_TYPE_BOOL: + return false + } + return true +} + +func (p *plugin) getFuncName(goTypName string) string { + funcName := "NewPopulated" + goTypName + goTypNames := strings.Split(goTypName, ".") + if len(goTypNames) == 2 { + funcName = goTypNames[0] + ".NewPopulated" + goTypNames[1] + } else if len(goTypNames) != 1 { + panic(fmt.Errorf("unreachable: too many dots in %v", goTypName)) + } + switch funcName { + case "time.NewPopulatedTime": + funcName = p.typesPkg.Use() + ".NewPopulatedStdTime" + case "time.NewPopulatedDuration": + p.typesPkg.Use() + funcName = p.typesPkg.Use() + ".NewPopulatedStdDuration" + } + return funcName +} + +func (p *plugin) getFuncCall(goTypName string) string { + funcName := p.getFuncName(goTypName) + funcCall := funcName + "(r, easy)" + return funcCall +} + +func (p *plugin) getCustomFuncCall(goTypName string) string { + funcName := p.getFuncName(goTypName) + funcCall := funcName + "(r)" + return funcCall +} + +func (p *plugin) getEnumVal(field *descriptor.FieldDescriptorProto, goTyp string) string { + enum := p.ObjectNamed(field.GetTypeName()).(*generator.EnumDescriptor) + l := len(enum.Value) + values := make([]string, l) + for i := range enum.Value { + values[i] = strconv.Itoa(int(*enum.Value[i].Number)) + } + arr := "[]int32{" + strings.Join(values, ",") + "}" + val := strings.Join([]string{generator.GoTypeToName(goTyp), `(`, arr, `[r.Intn(`, fmt.Sprintf("%d", l), `)])`}, "") + return val +} + +func (p *plugin) GenerateField(file *generator.FileDescriptor, message *generator.Descriptor, field *descriptor.FieldDescriptorProto) { + proto3 := gogoproto.IsProto3(file.FileDescriptorProto) + goTyp, _ := p.GoType(message, field) + fieldname := p.GetOneOfFieldName(message, field) + goTypName := generator.GoTypeToName(goTyp) + if p.IsMap(field) { + m := p.GoMapType(nil, field) + keygoTyp, _ := p.GoType(nil, m.KeyField) + keygoTyp = strings.Replace(keygoTyp, "*", "", 1) + keygoAliasTyp, _ := p.GoType(nil, m.KeyAliasField) + keygoAliasTyp = strings.Replace(keygoAliasTyp, "*", "", 1) + + valuegoTyp, _ := p.GoType(nil, m.ValueField) + valuegoAliasTyp, _ := p.GoType(nil, m.ValueAliasField) + keytypName := generator.GoTypeToName(keygoTyp) + keygoAliasTyp = generator.GoTypeToName(keygoAliasTyp) + valuetypAliasName := generator.GoTypeToName(valuegoAliasTyp) + + nullable, valuegoTyp, valuegoAliasTyp := generator.GoMapValueTypes(field, m.ValueField, valuegoTyp, valuegoAliasTyp) + + p.P(p.varGen.Next(), ` := r.Intn(10)`) + p.P(`this.`, fieldname, ` = make(`, m.GoType, `)`) + p.P(`for i := 0; i < `, p.varGen.Current(), `; i++ {`) + p.In() + keyval := "" + if m.KeyField.IsString() { + keyval = fmt.Sprintf("randString%v(r)", p.localName) + } else { + keyval = value(keytypName, m.KeyField.GetType()) + } + if keygoAliasTyp != keygoTyp { + keyval = keygoAliasTyp + `(` + keyval + `)` + } + if m.ValueField.IsMessage() || p.IsGroup(field) || + (m.ValueField.IsBytes() && gogoproto.IsCustomType(field)) { + s := `this.` + fieldname + `[` + keyval + `] = ` + if gogoproto.IsStdTime(field) || gogoproto.IsStdDuration(field) { + valuegoTyp = valuegoAliasTyp + } + funcCall := p.getCustomFuncCall(goTypName) + if !gogoproto.IsCustomType(field) { + goTypName = generator.GoTypeToName(valuegoTyp) + funcCall = p.getFuncCall(goTypName) + } + if !nullable { + funcCall = `*` + funcCall + } + if valuegoTyp != valuegoAliasTyp { + funcCall = `(` + valuegoAliasTyp + `)(` + funcCall + `)` + } + s += funcCall + p.P(s) + } else if m.ValueField.IsEnum() { + s := `this.` + fieldname + `[` + keyval + `]` + ` = ` + p.getEnumVal(m.ValueField, valuegoTyp) + p.P(s) + } else if m.ValueField.IsBytes() { + count := p.varGen.Next() + p.P(count, ` := r.Intn(100)`) + p.P(p.varGen.Next(), ` := `, keyval) + p.P(`this.`, fieldname, `[`, p.varGen.Current(), `] = make(`, valuegoTyp, `, `, count, `)`) + p.P(`for i := 0; i < `, count, `; i++ {`) + p.In() + p.P(`this.`, fieldname, `[`, p.varGen.Current(), `][i] = byte(r.Intn(256))`) + p.Out() + p.P(`}`) + } else if m.ValueField.IsString() { + s := `this.` + fieldname + `[` + keyval + `]` + ` = ` + fmt.Sprintf("randString%v(r)", p.localName) + p.P(s) + } else { + p.P(p.varGen.Next(), ` := `, keyval) + p.P(`this.`, fieldname, `[`, p.varGen.Current(), `] = `, value(valuetypAliasName, m.ValueField.GetType())) + if negative(m.ValueField.GetType()) { + p.P(`if r.Intn(2) == 0 {`) + p.In() + p.P(`this.`, fieldname, `[`, p.varGen.Current(), `] *= -1`) + p.Out() + p.P(`}`) + } + } + p.Out() + p.P(`}`) + } else if field.IsMessage() || p.IsGroup(field) { + funcCall := p.getFuncCall(goTypName) + if field.IsRepeated() { + p.P(p.varGen.Next(), ` := r.Intn(5)`) + p.P(`this.`, fieldname, ` = make(`, goTyp, `, `, p.varGen.Current(), `)`) + p.P(`for i := 0; i < `, p.varGen.Current(), `; i++ {`) + p.In() + if gogoproto.IsNullable(field) { + p.P(`this.`, fieldname, `[i] = `, funcCall) + } else { + p.P(p.varGen.Next(), `:= `, funcCall) + p.P(`this.`, fieldname, `[i] = *`, p.varGen.Current()) + } + p.Out() + p.P(`}`) + } else { + if gogoproto.IsNullable(field) { + p.P(`this.`, fieldname, ` = `, funcCall) + } else { + p.P(p.varGen.Next(), `:= `, funcCall) + p.P(`this.`, fieldname, ` = *`, p.varGen.Current()) + } + } + } else { + if field.IsEnum() { + val := p.getEnumVal(field, goTyp) + if field.IsRepeated() { + p.P(p.varGen.Next(), ` := r.Intn(10)`) + p.P(`this.`, fieldname, ` = make(`, goTyp, `, `, p.varGen.Current(), `)`) + p.P(`for i := 0; i < `, p.varGen.Current(), `; i++ {`) + p.In() + p.P(`this.`, fieldname, `[i] = `, val) + p.Out() + p.P(`}`) + } else if !gogoproto.IsNullable(field) || proto3 { + p.P(`this.`, fieldname, ` = `, val) + } else { + p.P(p.varGen.Next(), ` := `, val) + p.P(`this.`, fieldname, ` = &`, p.varGen.Current()) + } + } else if gogoproto.IsCustomType(field) { + funcCall := p.getCustomFuncCall(goTypName) + if field.IsRepeated() { + p.P(p.varGen.Next(), ` := r.Intn(10)`) + p.P(`this.`, fieldname, ` = make(`, goTyp, `, `, p.varGen.Current(), `)`) + p.P(`for i := 0; i < `, p.varGen.Current(), `; i++ {`) + p.In() + p.P(p.varGen.Next(), `:= `, funcCall) + p.P(`this.`, fieldname, `[i] = *`, p.varGen.Current()) + p.Out() + p.P(`}`) + } else if gogoproto.IsNullable(field) { + p.P(`this.`, fieldname, ` = `, funcCall) + } else { + p.P(p.varGen.Next(), `:= `, funcCall) + p.P(`this.`, fieldname, ` = *`, p.varGen.Current()) + } + } else if field.IsBytes() { + if field.IsRepeated() { + p.P(p.varGen.Next(), ` := r.Intn(10)`) + p.P(`this.`, fieldname, ` = make(`, goTyp, `, `, p.varGen.Current(), `)`) + p.P(`for i := 0; i < `, p.varGen.Current(), `; i++ {`) + p.In() + p.P(p.varGen.Next(), ` := r.Intn(100)`) + p.P(`this.`, fieldname, `[i] = make([]byte,`, p.varGen.Current(), `)`) + p.P(`for j := 0; j < `, p.varGen.Current(), `; j++ {`) + p.In() + p.P(`this.`, fieldname, `[i][j] = byte(r.Intn(256))`) + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + } else { + p.P(p.varGen.Next(), ` := r.Intn(100)`) + p.P(`this.`, fieldname, ` = make(`, goTyp, `, `, p.varGen.Current(), `)`) + p.P(`for i := 0; i < `, p.varGen.Current(), `; i++ {`) + p.In() + p.P(`this.`, fieldname, `[i] = byte(r.Intn(256))`) + p.Out() + p.P(`}`) + } + } else if field.IsString() { + typName := generator.GoTypeToName(goTyp) + val := fmt.Sprintf("%s(randString%v(r))", typName, p.localName) + if field.IsRepeated() { + p.P(p.varGen.Next(), ` := r.Intn(10)`) + p.P(`this.`, fieldname, ` = make(`, goTyp, `, `, p.varGen.Current(), `)`) + p.P(`for i := 0; i < `, p.varGen.Current(), `; i++ {`) + p.In() + p.P(`this.`, fieldname, `[i] = `, val) + p.Out() + p.P(`}`) + } else if !gogoproto.IsNullable(field) || proto3 { + p.P(`this.`, fieldname, ` = `, val) + } else { + p.P(p.varGen.Next(), `:= `, val) + p.P(`this.`, fieldname, ` = &`, p.varGen.Current()) + } + } else { + typName := generator.GoTypeToName(goTyp) + if field.IsRepeated() { + p.P(p.varGen.Next(), ` := r.Intn(10)`) + p.P(`this.`, fieldname, ` = make(`, goTyp, `, `, p.varGen.Current(), `)`) + p.P(`for i := 0; i < `, p.varGen.Current(), `; i++ {`) + p.In() + p.P(`this.`, fieldname, `[i] = `, value(typName, field.GetType())) + if negative(field.GetType()) { + p.P(`if r.Intn(2) == 0 {`) + p.In() + p.P(`this.`, fieldname, `[i] *= -1`) + p.Out() + p.P(`}`) + } + p.Out() + p.P(`}`) + } else if !gogoproto.IsNullable(field) || proto3 { + p.P(`this.`, fieldname, ` = `, value(typName, field.GetType())) + if negative(field.GetType()) { + p.P(`if r.Intn(2) == 0 {`) + p.In() + p.P(`this.`, fieldname, ` *= -1`) + p.Out() + p.P(`}`) + } + } else { + p.P(p.varGen.Next(), ` := `, value(typName, field.GetType())) + if negative(field.GetType()) { + p.P(`if r.Intn(2) == 0 {`) + p.In() + p.P(p.varGen.Current(), ` *= -1`) + p.Out() + p.P(`}`) + } + p.P(`this.`, fieldname, ` = &`, p.varGen.Current()) + } + } + } +} + +func (p *plugin) hasLoop(field *descriptor.FieldDescriptorProto, visited []*generator.Descriptor, excludes []*generator.Descriptor) *generator.Descriptor { + if field.IsMessage() || p.IsGroup(field) || p.IsMap(field) { + var fieldMessage *generator.Descriptor + if p.IsMap(field) { + m := p.GoMapType(nil, field) + if !m.ValueField.IsMessage() { + return nil + } + fieldMessage = p.ObjectNamed(m.ValueField.GetTypeName()).(*generator.Descriptor) + } else { + fieldMessage = p.ObjectNamed(field.GetTypeName()).(*generator.Descriptor) + } + fieldTypeName := generator.CamelCaseSlice(fieldMessage.TypeName()) + for _, message := range visited { + messageTypeName := generator.CamelCaseSlice(message.TypeName()) + if fieldTypeName == messageTypeName { + for _, e := range excludes { + if fieldTypeName == generator.CamelCaseSlice(e.TypeName()) { + return nil + } + } + return fieldMessage + } + } + pkg := strings.Split(field.GetTypeName(), ".")[1] + for _, f := range fieldMessage.Field { + if strings.HasPrefix(f.GetTypeName(), "."+pkg+".") { + visited = append(visited, fieldMessage) + loopTo := p.hasLoop(f, visited, excludes) + if loopTo != nil { + return loopTo + } + } + } + } + return nil +} + +func (p *plugin) loops(field *descriptor.FieldDescriptorProto, message *generator.Descriptor) int { + //fmt.Fprintf(os.Stderr, "loops %v %v\n", field.GetTypeName(), generator.CamelCaseSlice(message.TypeName())) + excludes := []*generator.Descriptor{} + loops := 0 + for { + visited := []*generator.Descriptor{} + loopTo := p.hasLoop(field, visited, excludes) + if loopTo == nil { + break + } + //fmt.Fprintf(os.Stderr, "loopTo %v\n", generator.CamelCaseSlice(loopTo.TypeName())) + excludes = append(excludes, loopTo) + loops++ + } + return loops +} + +func (p *plugin) Generate(file *generator.FileDescriptor) { + p.atleastOne = false + p.PluginImports = generator.NewPluginImports(p.Generator) + p.varGen = NewVarGen() + proto3 := gogoproto.IsProto3(file.FileDescriptorProto) + p.typesPkg = p.NewImport("github.com/gogo/protobuf/types") + p.localName = generator.FileName(file) + protoPkg := p.NewImport("github.com/gogo/protobuf/proto") + if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { + protoPkg = p.NewImport("github.com/golang/protobuf/proto") + } + + for _, message := range file.Messages() { + if !gogoproto.HasPopulate(file.FileDescriptorProto, message.DescriptorProto) { + continue + } + if message.DescriptorProto.GetOptions().GetMapEntry() { + continue + } + p.atleastOne = true + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + loopLevels := make([]int, len(message.Field)) + maxLoopLevel := 0 + for i, field := range message.Field { + loopLevels[i] = p.loops(field, message) + if loopLevels[i] > maxLoopLevel { + maxLoopLevel = loopLevels[i] + } + } + ranTotal := 0 + for i := range loopLevels { + ranTotal += int(math.Pow10(maxLoopLevel - loopLevels[i])) + } + p.P(`func NewPopulated`, ccTypeName, `(r randy`, p.localName, `, easy bool) *`, ccTypeName, ` {`) + p.In() + p.P(`this := &`, ccTypeName, `{}`) + if gogoproto.IsUnion(message.File(), message.DescriptorProto) && len(message.Field) > 0 { + p.P(`fieldNum := r.Intn(`, fmt.Sprintf("%d", ranTotal), `)`) + p.P(`switch fieldNum {`) + k := 0 + for i, field := range message.Field { + is := []string{} + ran := int(math.Pow10(maxLoopLevel - loopLevels[i])) + for j := 0; j < ran; j++ { + is = append(is, fmt.Sprintf("%d", j+k)) + } + k += ran + p.P(`case `, strings.Join(is, ","), `:`) + p.In() + p.GenerateField(file, message, field) + p.Out() + } + p.P(`}`) + } else { + var maxFieldNumber int32 + oneofs := make(map[string]struct{}) + for fieldIndex, field := range message.Field { + if field.GetNumber() > maxFieldNumber { + maxFieldNumber = field.GetNumber() + } + oneof := field.OneofIndex != nil + if !oneof { + if field.IsRequired() || (!gogoproto.IsNullable(field) && !field.IsRepeated()) || (proto3 && !field.IsMessage()) { + p.GenerateField(file, message, field) + } else { + if loopLevels[fieldIndex] > 0 { + p.P(`if r.Intn(10) == 0 {`) + } else { + p.P(`if r.Intn(10) != 0 {`) + } + p.In() + p.GenerateField(file, message, field) + p.Out() + p.P(`}`) + } + } else { + fieldname := p.GetFieldName(message, field) + if _, ok := oneofs[fieldname]; ok { + continue + } else { + oneofs[fieldname] = struct{}{} + } + fieldNumbers := []int32{} + for _, f := range message.Field { + fname := p.GetFieldName(message, f) + if fname == fieldname { + fieldNumbers = append(fieldNumbers, f.GetNumber()) + } + } + + p.P(`oneofNumber_`, fieldname, ` := `, fmt.Sprintf("%#v", fieldNumbers), `[r.Intn(`, strconv.Itoa(len(fieldNumbers)), `)]`) + p.P(`switch oneofNumber_`, fieldname, ` {`) + for _, f := range message.Field { + fname := p.GetFieldName(message, f) + if fname != fieldname { + continue + } + p.P(`case `, strconv.Itoa(int(f.GetNumber())), `:`) + p.In() + ccTypeName := p.OneOfTypeName(message, f) + p.P(`this.`, fname, ` = NewPopulated`, ccTypeName, `(r, easy)`) + p.Out() + } + p.P(`}`) + } + } + if message.DescriptorProto.HasExtension() { + p.P(`if !easy && r.Intn(10) != 0 {`) + p.In() + p.P(`l := r.Intn(5)`) + p.P(`for i := 0; i < l; i++ {`) + p.In() + if len(message.DescriptorProto.GetExtensionRange()) > 1 { + p.P(`eIndex := r.Intn(`, strconv.Itoa(len(message.DescriptorProto.GetExtensionRange())), `)`) + p.P(`fieldNumber := 0`) + p.P(`switch eIndex {`) + for i, e := range message.DescriptorProto.GetExtensionRange() { + p.P(`case `, strconv.Itoa(i), `:`) + p.In() + p.P(`fieldNumber = r.Intn(`, strconv.Itoa(int(e.GetEnd()-e.GetStart())), `) + `, strconv.Itoa(int(e.GetStart()))) + p.Out() + if e.GetEnd() > maxFieldNumber { + maxFieldNumber = e.GetEnd() + } + } + p.P(`}`) + } else { + e := message.DescriptorProto.GetExtensionRange()[0] + p.P(`fieldNumber := r.Intn(`, strconv.Itoa(int(e.GetEnd()-e.GetStart())), `) + `, strconv.Itoa(int(e.GetStart()))) + if e.GetEnd() > maxFieldNumber { + maxFieldNumber = e.GetEnd() + } + } + p.P(`wire := r.Intn(4)`) + p.P(`if wire == 3 { wire = 5 }`) + p.P(`dAtA := randField`, p.localName, `(nil, r, fieldNumber, wire)`) + p.P(protoPkg.Use(), `.SetRawExtension(this, int32(fieldNumber), dAtA)`) + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + } + + if maxFieldNumber < (1 << 10) { + p.P(`if !easy && r.Intn(10) != 0 {`) + p.In() + if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) { + p.P(`this.XXX_unrecognized = randUnrecognized`, p.localName, `(r, `, strconv.Itoa(int(maxFieldNumber+1)), `)`) + } + p.Out() + p.P(`}`) + } + } + p.P(`return this`) + p.Out() + p.P(`}`) + p.P(``) + + //Generate NewPopulated functions for oneof fields + m := proto.Clone(message.DescriptorProto).(*descriptor.DescriptorProto) + for _, f := range m.Field { + oneof := f.OneofIndex != nil + if !oneof { + continue + } + ccTypeName := p.OneOfTypeName(message, f) + p.P(`func NewPopulated`, ccTypeName, `(r randy`, p.localName, `, easy bool) *`, ccTypeName, ` {`) + p.In() + p.P(`this := &`, ccTypeName, `{}`) + vanity.TurnOffNullableForNativeTypesWithoutDefaultsOnly(f) + p.GenerateField(file, message, f) + p.P(`return this`) + p.Out() + p.P(`}`) + } + } + + if !p.atleastOne { + return + } + + p.P(`type randy`, p.localName, ` interface {`) + p.In() + p.P(`Float32() float32`) + p.P(`Float64() float64`) + p.P(`Int63() int64`) + p.P(`Int31() int32`) + p.P(`Uint32() uint32`) + p.P(`Intn(n int) int`) + p.Out() + p.P(`}`) + + p.P(`func randUTF8Rune`, p.localName, `(r randy`, p.localName, `) rune {`) + p.In() + p.P(`ru := r.Intn(62)`) + p.P(`if ru < 10 {`) + p.In() + p.P(`return rune(ru+48)`) + p.Out() + p.P(`} else if ru < 36 {`) + p.In() + p.P(`return rune(ru+55)`) + p.Out() + p.P(`}`) + p.P(`return rune(ru+61)`) + p.Out() + p.P(`}`) + + p.P(`func randString`, p.localName, `(r randy`, p.localName, `) string {`) + p.In() + p.P(p.varGen.Next(), ` := r.Intn(100)`) + p.P(`tmps := make([]rune, `, p.varGen.Current(), `)`) + p.P(`for i := 0; i < `, p.varGen.Current(), `; i++ {`) + p.In() + p.P(`tmps[i] = randUTF8Rune`, p.localName, `(r)`) + p.Out() + p.P(`}`) + p.P(`return string(tmps)`) + p.Out() + p.P(`}`) + + p.P(`func randUnrecognized`, p.localName, `(r randy`, p.localName, `, maxFieldNumber int) (dAtA []byte) {`) + p.In() + p.P(`l := r.Intn(5)`) + p.P(`for i := 0; i < l; i++ {`) + p.In() + p.P(`wire := r.Intn(4)`) + p.P(`if wire == 3 { wire = 5 }`) + p.P(`fieldNumber := maxFieldNumber + r.Intn(100)`) + p.P(`dAtA = randField`, p.localName, `(dAtA, r, fieldNumber, wire)`) + p.Out() + p.P(`}`) + p.P(`return dAtA`) + p.Out() + p.P(`}`) + + p.P(`func randField`, p.localName, `(dAtA []byte, r randy`, p.localName, `, fieldNumber int, wire int) []byte {`) + p.In() + p.P(`key := uint32(fieldNumber)<<3 | uint32(wire)`) + p.P(`switch wire {`) + p.P(`case 0:`) + p.In() + p.P(`dAtA = encodeVarintPopulate`, p.localName, `(dAtA, uint64(key))`) + p.P(p.varGen.Next(), ` := r.Int63()`) + p.P(`if r.Intn(2) == 0 {`) + p.In() + p.P(p.varGen.Current(), ` *= -1`) + p.Out() + p.P(`}`) + p.P(`dAtA = encodeVarintPopulate`, p.localName, `(dAtA, uint64(`, p.varGen.Current(), `))`) + p.Out() + p.P(`case 1:`) + p.In() + p.P(`dAtA = encodeVarintPopulate`, p.localName, `(dAtA, uint64(key))`) + p.P(`dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))`) + p.Out() + p.P(`case 2:`) + p.In() + p.P(`dAtA = encodeVarintPopulate`, p.localName, `(dAtA, uint64(key))`) + p.P(`ll := r.Intn(100)`) + p.P(`dAtA = encodeVarintPopulate`, p.localName, `(dAtA, uint64(ll))`) + p.P(`for j := 0; j < ll; j++ {`) + p.In() + p.P(`dAtA = append(dAtA, byte(r.Intn(256)))`) + p.Out() + p.P(`}`) + p.Out() + p.P(`default:`) + p.In() + p.P(`dAtA = encodeVarintPopulate`, p.localName, `(dAtA, uint64(key))`) + p.P(`dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))`) + p.Out() + p.P(`}`) + p.P(`return dAtA`) + p.Out() + p.P(`}`) + + p.P(`func encodeVarintPopulate`, p.localName, `(dAtA []byte, v uint64) []byte {`) + p.In() + p.P(`for v >= 1<<7 {`) + p.In() + p.P(`dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80))`) + p.P(`v >>= 7`) + p.Out() + p.P(`}`) + p.P(`dAtA = append(dAtA, uint8(v))`) + p.P(`return dAtA`) + p.Out() + p.P(`}`) + +} + +func init() { + generator.RegisterPlugin(NewPlugin()) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/size/size.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/size/size.go new file mode 100644 index 00000000000..15ab49ccb87 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/size/size.go @@ -0,0 +1,669 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +/* +The size plugin generates a Size or ProtoSize method for each message. +This is useful with the MarshalTo method generated by the marshalto plugin and the +gogoproto.marshaler and gogoproto.marshaler_all extensions. + +It is enabled by the following extensions: + + - sizer + - sizer_all + - protosizer + - protosizer_all + +The size plugin also generates a test given it is enabled using one of the following extensions: + + - testgen + - testgen_all + +And a benchmark given it is enabled using one of the following extensions: + + - benchgen + - benchgen_all + +Let us look at: + + github.com/gogo/protobuf/test/example/example.proto + +Btw all the output can be seen at: + + github.com/gogo/protobuf/test/example/* + +The following message: + + option (gogoproto.sizer_all) = true; + + message B { + option (gogoproto.description) = true; + optional A A = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; + repeated bytes G = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false]; + } + +given to the size plugin, will generate the following code: + + func (m *B) Size() (n int) { + var l int + _ = l + l = m.A.Size() + n += 1 + l + sovExample(uint64(l)) + if len(m.G) > 0 { + for _, e := range m.G { + l = e.Size() + n += 1 + l + sovExample(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n + } + +and the following test code: + + func TestBSize(t *testing5.T) { + popr := math_rand5.New(math_rand5.NewSource(time5.Now().UnixNano())) + p := NewPopulatedB(popr, true) + dAtA, err := github_com_gogo_protobuf_proto2.Marshal(p) + if err != nil { + panic(err) + } + size := p.Size() + if len(dAtA) != size { + t.Fatalf("size %v != marshalled size %v", size, len(dAtA)) + } + } + + func BenchmarkBSize(b *testing5.B) { + popr := math_rand5.New(math_rand5.NewSource(616)) + total := 0 + pops := make([]*B, 1000) + for i := 0; i < 1000; i++ { + pops[i] = NewPopulatedB(popr, false) + } + b.ResetTimer() + for i := 0; i < b.N; i++ { + total += pops[i%1000].Size() + } + b.SetBytes(int64(total / b.N)) + } + +The sovExample function is a size of varint function for the example.pb.go file. + +*/ +package size + +import ( + "fmt" + "strconv" + "strings" + + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/proto" + descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" + "github.com/gogo/protobuf/vanity" +) + +type size struct { + *generator.Generator + generator.PluginImports + atleastOne bool + localName string + typesPkg generator.Single +} + +func NewSize() *size { + return &size{} +} + +func (p *size) Name() string { + return "size" +} + +func (p *size) Init(g *generator.Generator) { + p.Generator = g +} + +func wireToType(wire string) int { + switch wire { + case "fixed64": + return proto.WireFixed64 + case "fixed32": + return proto.WireFixed32 + case "varint": + return proto.WireVarint + case "bytes": + return proto.WireBytes + case "group": + return proto.WireBytes + case "zigzag32": + return proto.WireVarint + case "zigzag64": + return proto.WireVarint + } + panic("unreachable") +} + +func keySize(fieldNumber int32, wireType int) int { + x := uint32(fieldNumber)<<3 | uint32(wireType) + size := 0 + for size = 0; x > 127; size++ { + x >>= 7 + } + size++ + return size +} + +func (p *size) sizeVarint() { + p.P(` + func sov`, p.localName, `(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n + }`) +} + +func (p *size) sizeZigZag() { + p.P(`func soz`, p.localName, `(x uint64) (n int) { + return sov`, p.localName, `(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + }`) +} + +func (p *size) std(field *descriptor.FieldDescriptorProto, name string) (string, bool) { + if gogoproto.IsStdTime(field) { + if gogoproto.IsNullable(field) { + return p.typesPkg.Use() + `.SizeOfStdTime(*` + name + `)`, true + } else { + return p.typesPkg.Use() + `.SizeOfStdTime(` + name + `)`, true + } + } else if gogoproto.IsStdDuration(field) { + if gogoproto.IsNullable(field) { + return p.typesPkg.Use() + `.SizeOfStdDuration(*` + name + `)`, true + } else { + return p.typesPkg.Use() + `.SizeOfStdDuration(` + name + `)`, true + } + } + return "", false +} + +func (p *size) generateField(proto3 bool, file *generator.FileDescriptor, message *generator.Descriptor, field *descriptor.FieldDescriptorProto, sizeName string) { + fieldname := p.GetOneOfFieldName(message, field) + nullable := gogoproto.IsNullable(field) + repeated := field.IsRepeated() + doNilCheck := gogoproto.NeedsNilCheck(proto3, field) + if repeated { + p.P(`if len(m.`, fieldname, `) > 0 {`) + p.In() + } else if doNilCheck { + p.P(`if m.`, fieldname, ` != nil {`) + p.In() + } + packed := field.IsPacked() || (proto3 && field.IsRepeated() && generator.IsScalar(field)) + _, wire := p.GoType(message, field) + wireType := wireToType(wire) + fieldNumber := field.GetNumber() + if packed { + wireType = proto.WireBytes + } + key := keySize(fieldNumber, wireType) + switch *field.Type { + case descriptor.FieldDescriptorProto_TYPE_DOUBLE, + descriptor.FieldDescriptorProto_TYPE_FIXED64, + descriptor.FieldDescriptorProto_TYPE_SFIXED64: + if packed { + p.P(`n+=`, strconv.Itoa(key), `+sov`, p.localName, `(uint64(len(m.`, fieldname, `)*8))`, `+len(m.`, fieldname, `)*8`) + } else if repeated { + p.P(`n+=`, strconv.Itoa(key+8), `*len(m.`, fieldname, `)`) + } else if proto3 { + p.P(`if m.`, fieldname, ` != 0 {`) + p.In() + p.P(`n+=`, strconv.Itoa(key+8)) + p.Out() + p.P(`}`) + } else if nullable { + p.P(`n+=`, strconv.Itoa(key+8)) + } else { + p.P(`n+=`, strconv.Itoa(key+8)) + } + case descriptor.FieldDescriptorProto_TYPE_FLOAT, + descriptor.FieldDescriptorProto_TYPE_FIXED32, + descriptor.FieldDescriptorProto_TYPE_SFIXED32: + if packed { + p.P(`n+=`, strconv.Itoa(key), `+sov`, p.localName, `(uint64(len(m.`, fieldname, `)*4))`, `+len(m.`, fieldname, `)*4`) + } else if repeated { + p.P(`n+=`, strconv.Itoa(key+4), `*len(m.`, fieldname, `)`) + } else if proto3 { + p.P(`if m.`, fieldname, ` != 0 {`) + p.In() + p.P(`n+=`, strconv.Itoa(key+4)) + p.Out() + p.P(`}`) + } else if nullable { + p.P(`n+=`, strconv.Itoa(key+4)) + } else { + p.P(`n+=`, strconv.Itoa(key+4)) + } + case descriptor.FieldDescriptorProto_TYPE_INT64, + descriptor.FieldDescriptorProto_TYPE_UINT64, + descriptor.FieldDescriptorProto_TYPE_UINT32, + descriptor.FieldDescriptorProto_TYPE_ENUM, + descriptor.FieldDescriptorProto_TYPE_INT32: + if packed { + p.P(`l = 0`) + p.P(`for _, e := range m.`, fieldname, ` {`) + p.In() + p.P(`l+=sov`, p.localName, `(uint64(e))`) + p.Out() + p.P(`}`) + p.P(`n+=`, strconv.Itoa(key), `+sov`, p.localName, `(uint64(l))+l`) + } else if repeated { + p.P(`for _, e := range m.`, fieldname, ` {`) + p.In() + p.P(`n+=`, strconv.Itoa(key), `+sov`, p.localName, `(uint64(e))`) + p.Out() + p.P(`}`) + } else if proto3 { + p.P(`if m.`, fieldname, ` != 0 {`) + p.In() + p.P(`n+=`, strconv.Itoa(key), `+sov`, p.localName, `(uint64(m.`, fieldname, `))`) + p.Out() + p.P(`}`) + } else if nullable { + p.P(`n+=`, strconv.Itoa(key), `+sov`, p.localName, `(uint64(*m.`, fieldname, `))`) + } else { + p.P(`n+=`, strconv.Itoa(key), `+sov`, p.localName, `(uint64(m.`, fieldname, `))`) + } + case descriptor.FieldDescriptorProto_TYPE_BOOL: + if packed { + p.P(`n+=`, strconv.Itoa(key), `+sov`, p.localName, `(uint64(len(m.`, fieldname, `)))`, `+len(m.`, fieldname, `)*1`) + } else if repeated { + p.P(`n+=`, strconv.Itoa(key+1), `*len(m.`, fieldname, `)`) + } else if proto3 { + p.P(`if m.`, fieldname, ` {`) + p.In() + p.P(`n+=`, strconv.Itoa(key+1)) + p.Out() + p.P(`}`) + } else if nullable { + p.P(`n+=`, strconv.Itoa(key+1)) + } else { + p.P(`n+=`, strconv.Itoa(key+1)) + } + case descriptor.FieldDescriptorProto_TYPE_STRING: + if repeated { + p.P(`for _, s := range m.`, fieldname, ` { `) + p.In() + p.P(`l = len(s)`) + p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`) + p.Out() + p.P(`}`) + } else if proto3 { + p.P(`l=len(m.`, fieldname, `)`) + p.P(`if l > 0 {`) + p.In() + p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`) + p.Out() + p.P(`}`) + } else if nullable { + p.P(`l=len(*m.`, fieldname, `)`) + p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`) + } else { + p.P(`l=len(m.`, fieldname, `)`) + p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`) + } + case descriptor.FieldDescriptorProto_TYPE_GROUP: + panic(fmt.Errorf("size does not support group %v", fieldname)) + case descriptor.FieldDescriptorProto_TYPE_MESSAGE: + if p.IsMap(field) { + m := p.GoMapType(nil, field) + _, keywire := p.GoType(nil, m.KeyAliasField) + valuegoTyp, _ := p.GoType(nil, m.ValueField) + valuegoAliasTyp, valuewire := p.GoType(nil, m.ValueAliasField) + _, fieldwire := p.GoType(nil, field) + + nullable, valuegoTyp, valuegoAliasTyp = generator.GoMapValueTypes(field, m.ValueField, valuegoTyp, valuegoAliasTyp) + + fieldKeySize := keySize(field.GetNumber(), wireToType(fieldwire)) + keyKeySize := keySize(1, wireToType(keywire)) + valueKeySize := keySize(2, wireToType(valuewire)) + p.P(`for k, v := range m.`, fieldname, ` { `) + p.In() + p.P(`_ = k`) + p.P(`_ = v`) + sum := []string{strconv.Itoa(keyKeySize)} + switch m.KeyField.GetType() { + case descriptor.FieldDescriptorProto_TYPE_DOUBLE, + descriptor.FieldDescriptorProto_TYPE_FIXED64, + descriptor.FieldDescriptorProto_TYPE_SFIXED64: + sum = append(sum, `8`) + case descriptor.FieldDescriptorProto_TYPE_FLOAT, + descriptor.FieldDescriptorProto_TYPE_FIXED32, + descriptor.FieldDescriptorProto_TYPE_SFIXED32: + sum = append(sum, `4`) + case descriptor.FieldDescriptorProto_TYPE_INT64, + descriptor.FieldDescriptorProto_TYPE_UINT64, + descriptor.FieldDescriptorProto_TYPE_UINT32, + descriptor.FieldDescriptorProto_TYPE_ENUM, + descriptor.FieldDescriptorProto_TYPE_INT32: + sum = append(sum, `sov`+p.localName+`(uint64(k))`) + case descriptor.FieldDescriptorProto_TYPE_BOOL: + sum = append(sum, `1`) + case descriptor.FieldDescriptorProto_TYPE_STRING, + descriptor.FieldDescriptorProto_TYPE_BYTES: + sum = append(sum, `len(k)+sov`+p.localName+`(uint64(len(k)))`) + case descriptor.FieldDescriptorProto_TYPE_SINT32, + descriptor.FieldDescriptorProto_TYPE_SINT64: + sum = append(sum, `soz`+p.localName+`(uint64(k))`) + } + switch m.ValueField.GetType() { + case descriptor.FieldDescriptorProto_TYPE_DOUBLE, + descriptor.FieldDescriptorProto_TYPE_FIXED64, + descriptor.FieldDescriptorProto_TYPE_SFIXED64: + sum = append(sum, strconv.Itoa(valueKeySize)) + sum = append(sum, strconv.Itoa(8)) + case descriptor.FieldDescriptorProto_TYPE_FLOAT, + descriptor.FieldDescriptorProto_TYPE_FIXED32, + descriptor.FieldDescriptorProto_TYPE_SFIXED32: + sum = append(sum, strconv.Itoa(valueKeySize)) + sum = append(sum, strconv.Itoa(4)) + case descriptor.FieldDescriptorProto_TYPE_INT64, + descriptor.FieldDescriptorProto_TYPE_UINT64, + descriptor.FieldDescriptorProto_TYPE_UINT32, + descriptor.FieldDescriptorProto_TYPE_ENUM, + descriptor.FieldDescriptorProto_TYPE_INT32: + sum = append(sum, strconv.Itoa(valueKeySize)) + sum = append(sum, `sov`+p.localName+`(uint64(v))`) + case descriptor.FieldDescriptorProto_TYPE_BOOL: + sum = append(sum, strconv.Itoa(valueKeySize)) + sum = append(sum, `1`) + case descriptor.FieldDescriptorProto_TYPE_STRING: + sum = append(sum, strconv.Itoa(valueKeySize)) + sum = append(sum, `len(v)+sov`+p.localName+`(uint64(len(v)))`) + case descriptor.FieldDescriptorProto_TYPE_BYTES: + if gogoproto.IsCustomType(field) { + p.P(`l = 0`) + if nullable { + p.P(`if v != nil {`) + p.In() + } + p.P(`l = v.`, sizeName, `()`) + p.P(`l += `, strconv.Itoa(valueKeySize), ` + sov`+p.localName+`(uint64(l))`) + if nullable { + p.Out() + p.P(`}`) + } + sum = append(sum, `l`) + } else { + p.P(`l = 0`) + if proto3 { + p.P(`if len(v) > 0 {`) + } else { + p.P(`if v != nil {`) + } + p.In() + p.P(`l = `, strconv.Itoa(valueKeySize), ` + len(v)+sov`+p.localName+`(uint64(len(v)))`) + p.Out() + p.P(`}`) + sum = append(sum, `l`) + } + case descriptor.FieldDescriptorProto_TYPE_SINT32, + descriptor.FieldDescriptorProto_TYPE_SINT64: + sum = append(sum, strconv.Itoa(valueKeySize)) + sum = append(sum, `soz`+p.localName+`(uint64(v))`) + case descriptor.FieldDescriptorProto_TYPE_MESSAGE: + stdSizeCall, stdOk := p.std(field, "v") + if nullable { + p.P(`l = 0`) + p.P(`if v != nil {`) + p.In() + if stdOk { + p.P(`l = `, stdSizeCall) + } else if valuegoTyp != valuegoAliasTyp { + p.P(`l = ((`, valuegoTyp, `)(v)).`, sizeName, `()`) + } else { + p.P(`l = v.`, sizeName, `()`) + } + p.P(`l += `, strconv.Itoa(valueKeySize), ` + sov`+p.localName+`(uint64(l))`) + p.Out() + p.P(`}`) + sum = append(sum, `l`) + } else { + if stdOk { + p.P(`l = `, stdSizeCall) + } else if valuegoTyp != valuegoAliasTyp { + p.P(`l = ((*`, valuegoTyp, `)(&v)).`, sizeName, `()`) + } else { + p.P(`l = v.`, sizeName, `()`) + } + sum = append(sum, strconv.Itoa(valueKeySize)) + sum = append(sum, `l+sov`+p.localName+`(uint64(l))`) + } + } + p.P(`mapEntrySize := `, strings.Join(sum, "+")) + p.P(`n+=mapEntrySize+`, fieldKeySize, `+sov`, p.localName, `(uint64(mapEntrySize))`) + p.Out() + p.P(`}`) + } else if repeated { + p.P(`for _, e := range m.`, fieldname, ` { `) + p.In() + stdSizeCall, stdOk := p.std(field, "e") + if stdOk { + p.P(`l=`, stdSizeCall) + } else { + p.P(`l=e.`, sizeName, `()`) + } + p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`) + p.Out() + p.P(`}`) + } else { + stdSizeCall, stdOk := p.std(field, "m."+fieldname) + if stdOk { + p.P(`l=`, stdSizeCall) + } else { + p.P(`l=m.`, fieldname, `.`, sizeName, `()`) + } + p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`) + } + case descriptor.FieldDescriptorProto_TYPE_BYTES: + if !gogoproto.IsCustomType(field) { + if repeated { + p.P(`for _, b := range m.`, fieldname, ` { `) + p.In() + p.P(`l = len(b)`) + p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`) + p.Out() + p.P(`}`) + } else if proto3 { + p.P(`l=len(m.`, fieldname, `)`) + p.P(`if l > 0 {`) + p.In() + p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`) + p.Out() + p.P(`}`) + } else { + p.P(`l=len(m.`, fieldname, `)`) + p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`) + } + } else { + if repeated { + p.P(`for _, e := range m.`, fieldname, ` { `) + p.In() + p.P(`l=e.`, sizeName, `()`) + p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`) + p.Out() + p.P(`}`) + } else { + p.P(`l=m.`, fieldname, `.`, sizeName, `()`) + p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`) + } + } + case descriptor.FieldDescriptorProto_TYPE_SINT32, + descriptor.FieldDescriptorProto_TYPE_SINT64: + if packed { + p.P(`l = 0`) + p.P(`for _, e := range m.`, fieldname, ` {`) + p.In() + p.P(`l+=soz`, p.localName, `(uint64(e))`) + p.Out() + p.P(`}`) + p.P(`n+=`, strconv.Itoa(key), `+sov`, p.localName, `(uint64(l))+l`) + } else if repeated { + p.P(`for _, e := range m.`, fieldname, ` {`) + p.In() + p.P(`n+=`, strconv.Itoa(key), `+soz`, p.localName, `(uint64(e))`) + p.Out() + p.P(`}`) + } else if proto3 { + p.P(`if m.`, fieldname, ` != 0 {`) + p.In() + p.P(`n+=`, strconv.Itoa(key), `+soz`, p.localName, `(uint64(m.`, fieldname, `))`) + p.Out() + p.P(`}`) + } else if nullable { + p.P(`n+=`, strconv.Itoa(key), `+soz`, p.localName, `(uint64(*m.`, fieldname, `))`) + } else { + p.P(`n+=`, strconv.Itoa(key), `+soz`, p.localName, `(uint64(m.`, fieldname, `))`) + } + default: + panic("not implemented") + } + if repeated || doNilCheck { + p.Out() + p.P(`}`) + } +} + +func (p *size) Generate(file *generator.FileDescriptor) { + p.PluginImports = generator.NewPluginImports(p.Generator) + p.atleastOne = false + p.localName = generator.FileName(file) + p.typesPkg = p.NewImport("github.com/gogo/protobuf/types") + protoPkg := p.NewImport("github.com/gogo/protobuf/proto") + if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { + protoPkg = p.NewImport("github.com/golang/protobuf/proto") + } + for _, message := range file.Messages() { + sizeName := "" + if gogoproto.IsSizer(file.FileDescriptorProto, message.DescriptorProto) { + sizeName = "Size" + } else if gogoproto.IsProtoSizer(file.FileDescriptorProto, message.DescriptorProto) { + sizeName = "ProtoSize" + } else { + continue + } + if message.DescriptorProto.GetOptions().GetMapEntry() { + continue + } + p.atleastOne = true + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + p.P(`func (m *`, ccTypeName, `) `, sizeName, `() (n int) {`) + p.In() + p.P(`var l int`) + p.P(`_ = l`) + oneofs := make(map[string]struct{}) + for _, field := range message.Field { + oneof := field.OneofIndex != nil + if !oneof { + proto3 := gogoproto.IsProto3(file.FileDescriptorProto) + p.generateField(proto3, file, message, field, sizeName) + } else { + fieldname := p.GetFieldName(message, field) + if _, ok := oneofs[fieldname]; ok { + continue + } else { + oneofs[fieldname] = struct{}{} + } + p.P(`if m.`, fieldname, ` != nil {`) + p.In() + p.P(`n+=m.`, fieldname, `.`, sizeName, `()`) + p.Out() + p.P(`}`) + } + } + if message.DescriptorProto.HasExtension() { + if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) { + p.P(`n += `, protoPkg.Use(), `.SizeOfInternalExtension(m)`) + } else { + p.P(`if m.XXX_extensions != nil {`) + p.In() + p.P(`n+=len(m.XXX_extensions)`) + p.Out() + p.P(`}`) + } + } + if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) { + p.P(`if m.XXX_unrecognized != nil {`) + p.In() + p.P(`n+=len(m.XXX_unrecognized)`) + p.Out() + p.P(`}`) + } + p.P(`return n`) + p.Out() + p.P(`}`) + p.P() + + //Generate Size methods for oneof fields + m := proto.Clone(message.DescriptorProto).(*descriptor.DescriptorProto) + for _, f := range m.Field { + oneof := f.OneofIndex != nil + if !oneof { + continue + } + ccTypeName := p.OneOfTypeName(message, f) + p.P(`func (m *`, ccTypeName, `) `, sizeName, `() (n int) {`) + p.In() + p.P(`var l int`) + p.P(`_ = l`) + vanity.TurnOffNullableForNativeTypesWithoutDefaultsOnly(f) + p.generateField(false, file, message, f, sizeName) + p.P(`return n`) + p.Out() + p.P(`}`) + } + } + + if !p.atleastOne { + return + } + + p.sizeVarint() + p.sizeZigZag() + +} + +func init() { + generator.RegisterPlugin(NewSize()) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/size/sizetest.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/size/sizetest.go new file mode 100644 index 00000000000..1df98730007 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/size/sizetest.go @@ -0,0 +1,134 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package size + +import ( + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/plugin/testgen" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" +) + +type test struct { + *generator.Generator +} + +func NewTest(g *generator.Generator) testgen.TestPlugin { + return &test{g} +} + +func (p *test) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool { + used := false + randPkg := imports.NewImport("math/rand") + timePkg := imports.NewImport("time") + testingPkg := imports.NewImport("testing") + protoPkg := imports.NewImport("github.com/gogo/protobuf/proto") + if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { + protoPkg = imports.NewImport("github.com/golang/protobuf/proto") + } + for _, message := range file.Messages() { + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + sizeName := "" + if gogoproto.IsSizer(file.FileDescriptorProto, message.DescriptorProto) { + sizeName = "Size" + } else if gogoproto.IsProtoSizer(file.FileDescriptorProto, message.DescriptorProto) { + sizeName = "ProtoSize" + } else { + continue + } + if message.DescriptorProto.GetOptions().GetMapEntry() { + continue + } + + if gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { + used = true + p.P(`func Test`, ccTypeName, sizeName, `(t *`, testingPkg.Use(), `.T) {`) + p.In() + p.P(`seed := `, timePkg.Use(), `.Now().UnixNano()`) + p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(seed))`) + p.P(`p := NewPopulated`, ccTypeName, `(popr, true)`) + p.P(`size2 := `, protoPkg.Use(), `.Size(p)`) + p.P(`dAtA, err := `, protoPkg.Use(), `.Marshal(p)`) + p.P(`if err != nil {`) + p.In() + p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`) + p.Out() + p.P(`}`) + p.P(`size := p.`, sizeName, `()`) + p.P(`if len(dAtA) != size {`) + p.In() + p.P(`t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))`) + p.Out() + p.P(`}`) + p.P(`if size2 != size {`) + p.In() + p.P(`t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)`) + p.Out() + p.P(`}`) + p.P(`size3 := `, protoPkg.Use(), `.Size(p)`) + p.P(`if size3 != size {`) + p.In() + p.P(`t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)`) + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + p.P() + } + + if gogoproto.HasBenchGen(file.FileDescriptorProto, message.DescriptorProto) { + used = true + p.P(`func Benchmark`, ccTypeName, sizeName, `(b *`, testingPkg.Use(), `.B) {`) + p.In() + p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(616))`) + p.P(`total := 0`) + p.P(`pops := make([]*`, ccTypeName, `, 1000)`) + p.P(`for i := 0; i < 1000; i++ {`) + p.In() + p.P(`pops[i] = NewPopulated`, ccTypeName, `(popr, false)`) + p.Out() + p.P(`}`) + p.P(`b.ResetTimer()`) + p.P(`for i := 0; i < b.N; i++ {`) + p.In() + p.P(`total += pops[i%1000].`, sizeName, `()`) + p.Out() + p.P(`}`) + p.P(`b.SetBytes(int64(total / b.N))`) + p.Out() + p.P(`}`) + p.P() + } + + } + return used +} + +func init() { + testgen.RegisterTestPlugin(NewTest) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/stringer/stringer.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/stringer/stringer.go new file mode 100644 index 00000000000..aa5f022e4e5 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/stringer/stringer.go @@ -0,0 +1,296 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +/* +The stringer plugin generates a String method for each message. + +It is enabled by the following extensions: + + - stringer + - stringer_all + +The stringer plugin also generates a test given it is enabled using one of the following extensions: + + - testgen + - testgen_all + +Let us look at: + + github.com/gogo/protobuf/test/example/example.proto + +Btw all the output can be seen at: + + github.com/gogo/protobuf/test/example/* + +The following message: + + option (gogoproto.goproto_stringer_all) = false; + option (gogoproto.stringer_all) = true; + + message A { + optional string Description = 1 [(gogoproto.nullable) = false]; + optional int64 Number = 2 [(gogoproto.nullable) = false]; + optional bytes Id = 3 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uuid", (gogoproto.nullable) = false]; + } + +given to the stringer stringer, will generate the following code: + + func (this *A) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&A{`, + `Description:` + fmt.Sprintf("%v", this.Description) + `,`, + `Number:` + fmt.Sprintf("%v", this.Number) + `,`, + `Id:` + fmt.Sprintf("%v", this.Id) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s + } + +and the following test code: + + func TestAStringer(t *testing4.T) { + popr := math_rand4.New(math_rand4.NewSource(time4.Now().UnixNano())) + p := NewPopulatedA(popr, false) + s1 := p.String() + s2 := fmt1.Sprintf("%v", p) + if s1 != s2 { + t.Fatalf("String want %v got %v", s1, s2) + } + } + +Typically fmt.Printf("%v") will stop to print when it reaches a pointer and +not print their values, while the generated String method will always print all values, recursively. + +*/ +package stringer + +import ( + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" + "strings" +) + +type stringer struct { + *generator.Generator + generator.PluginImports + atleastOne bool + localName string +} + +func NewStringer() *stringer { + return &stringer{} +} + +func (p *stringer) Name() string { + return "stringer" +} + +func (p *stringer) Init(g *generator.Generator) { + p.Generator = g +} + +func (p *stringer) Generate(file *generator.FileDescriptor) { + proto3 := gogoproto.IsProto3(file.FileDescriptorProto) + p.PluginImports = generator.NewPluginImports(p.Generator) + p.atleastOne = false + + p.localName = generator.FileName(file) + + fmtPkg := p.NewImport("fmt") + stringsPkg := p.NewImport("strings") + reflectPkg := p.NewImport("reflect") + sortKeysPkg := p.NewImport("github.com/gogo/protobuf/sortkeys") + protoPkg := p.NewImport("github.com/gogo/protobuf/proto") + for _, message := range file.Messages() { + if !gogoproto.IsStringer(file.FileDescriptorProto, message.DescriptorProto) { + continue + } + if gogoproto.EnabledGoStringer(file.FileDescriptorProto, message.DescriptorProto) { + panic("old string method needs to be disabled, please use gogoproto.goproto_stringer or gogoproto.goproto_stringer_all and set it to false") + } + if message.DescriptorProto.GetOptions().GetMapEntry() { + continue + } + p.atleastOne = true + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + p.P(`func (this *`, ccTypeName, `) String() string {`) + p.In() + p.P(`if this == nil {`) + p.In() + p.P(`return "nil"`) + p.Out() + p.P(`}`) + for _, field := range message.Field { + if !p.IsMap(field) { + continue + } + fieldname := p.GetFieldName(message, field) + + m := p.GoMapType(nil, field) + mapgoTyp, keyField, keyAliasField := m.GoType, m.KeyField, m.KeyAliasField + keysName := `keysFor` + fieldname + keygoTyp, _ := p.GoType(nil, keyField) + keygoTyp = strings.Replace(keygoTyp, "*", "", 1) + keygoAliasTyp, _ := p.GoType(nil, keyAliasField) + keygoAliasTyp = strings.Replace(keygoAliasTyp, "*", "", 1) + keyCapTyp := generator.CamelCase(keygoTyp) + p.P(keysName, ` := make([]`, keygoTyp, `, 0, len(this.`, fieldname, `))`) + p.P(`for k, _ := range this.`, fieldname, ` {`) + p.In() + if keygoAliasTyp == keygoTyp { + p.P(keysName, ` = append(`, keysName, `, k)`) + } else { + p.P(keysName, ` = append(`, keysName, `, `, keygoTyp, `(k))`) + } + p.Out() + p.P(`}`) + p.P(sortKeysPkg.Use(), `.`, keyCapTyp, `s(`, keysName, `)`) + mapName := `mapStringFor` + fieldname + p.P(mapName, ` := "`, mapgoTyp, `{"`) + p.P(`for _, k := range `, keysName, ` {`) + p.In() + if keygoAliasTyp == keygoTyp { + p.P(mapName, ` += fmt.Sprintf("%v: %v,", k, this.`, fieldname, `[k])`) + } else { + p.P(mapName, ` += fmt.Sprintf("%v: %v,", k, this.`, fieldname, `[`, keygoAliasTyp, `(k)])`) + } + p.Out() + p.P(`}`) + p.P(mapName, ` += "}"`) + } + p.P("s := ", stringsPkg.Use(), ".Join([]string{`&", ccTypeName, "{`,") + oneofs := make(map[string]struct{}) + for _, field := range message.Field { + nullable := gogoproto.IsNullable(field) + repeated := field.IsRepeated() + fieldname := p.GetFieldName(message, field) + oneof := field.OneofIndex != nil + if oneof { + if _, ok := oneofs[fieldname]; ok { + continue + } else { + oneofs[fieldname] = struct{}{} + } + p.P("`", fieldname, ":`", ` + `, fmtPkg.Use(), `.Sprintf("%v", this.`, fieldname, ") + `,", "`,") + } else if p.IsMap(field) { + mapName := `mapStringFor` + fieldname + p.P("`", fieldname, ":`", ` + `, mapName, " + `,", "`,") + } else if field.IsMessage() || p.IsGroup(field) { + desc := p.ObjectNamed(field.GetTypeName()) + msgname := p.TypeName(desc) + msgnames := strings.Split(msgname, ".") + typeName := msgnames[len(msgnames)-1] + if nullable { + p.P("`", fieldname, ":`", ` + `, stringsPkg.Use(), `.Replace(`, fmtPkg.Use(), `.Sprintf("%v", this.`, fieldname, `), "`, typeName, `","`, msgname, `"`, ", 1) + `,", "`,") + } else if repeated { + p.P("`", fieldname, ":`", ` + `, stringsPkg.Use(), `.Replace(`, stringsPkg.Use(), `.Replace(`, fmtPkg.Use(), `.Sprintf("%v", this.`, fieldname, `), "`, typeName, `","`, msgname, `"`, ", 1),`&`,``,1) + `,", "`,") + } else { + p.P("`", fieldname, ":`", ` + `, stringsPkg.Use(), `.Replace(`, stringsPkg.Use(), `.Replace(this.`, fieldname, `.String(), "`, typeName, `","`, msgname, `"`, ", 1),`&`,``,1) + `,", "`,") + } + } else { + if nullable && !repeated && !proto3 { + p.P("`", fieldname, ":`", ` + valueToString`, p.localName, `(this.`, fieldname, ") + `,", "`,") + } else { + p.P("`", fieldname, ":`", ` + `, fmtPkg.Use(), `.Sprintf("%v", this.`, fieldname, ") + `,", "`,") + } + } + } + if message.DescriptorProto.HasExtension() { + if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) { + p.P("`XXX_InternalExtensions:` + ", protoPkg.Use(), ".StringFromInternalExtension(this) + `,`,") + } else { + p.P("`XXX_extensions:` + ", protoPkg.Use(), ".StringFromExtensionsBytes(this.XXX_extensions) + `,`,") + } + } + if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) { + p.P("`XXX_unrecognized:` + ", fmtPkg.Use(), `.Sprintf("%v", this.XXX_unrecognized) + `, "`,`,") + } + p.P("`}`,") + p.P(`}`, `,""`, ")") + p.P(`return s`) + p.Out() + p.P(`}`) + + //Generate String methods for oneof fields + for _, field := range message.Field { + oneof := field.OneofIndex != nil + if !oneof { + continue + } + ccTypeName := p.OneOfTypeName(message, field) + p.P(`func (this *`, ccTypeName, `) String() string {`) + p.In() + p.P(`if this == nil {`) + p.In() + p.P(`return "nil"`) + p.Out() + p.P(`}`) + p.P("s := ", stringsPkg.Use(), ".Join([]string{`&", ccTypeName, "{`,") + fieldname := p.GetOneOfFieldName(message, field) + if field.IsMessage() || p.IsGroup(field) { + desc := p.ObjectNamed(field.GetTypeName()) + msgname := p.TypeName(desc) + msgnames := strings.Split(msgname, ".") + typeName := msgnames[len(msgnames)-1] + p.P("`", fieldname, ":`", ` + `, stringsPkg.Use(), `.Replace(`, fmtPkg.Use(), `.Sprintf("%v", this.`, fieldname, `), "`, typeName, `","`, msgname, `"`, ", 1) + `,", "`,") + } else { + p.P("`", fieldname, ":`", ` + `, fmtPkg.Use(), `.Sprintf("%v", this.`, fieldname, ") + `,", "`,") + } + p.P("`}`,") + p.P(`}`, `,""`, ")") + p.P(`return s`) + p.Out() + p.P(`}`) + } + } + + if !p.atleastOne { + return + } + + p.P(`func valueToString`, p.localName, `(v interface{}) string {`) + p.In() + p.P(`rv := `, reflectPkg.Use(), `.ValueOf(v)`) + p.P(`if rv.IsNil() {`) + p.In() + p.P(`return "nil"`) + p.Out() + p.P(`}`) + p.P(`pv := `, reflectPkg.Use(), `.Indirect(rv).Interface()`) + p.P(`return `, fmtPkg.Use(), `.Sprintf("*%v", pv)`) + p.Out() + p.P(`}`) + +} + +func init() { + generator.RegisterPlugin(NewStringer()) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/stringer/stringertest.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/stringer/stringertest.go new file mode 100644 index 00000000000..0912a22df63 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/stringer/stringertest.go @@ -0,0 +1,83 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package stringer + +import ( + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/plugin/testgen" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" +) + +type test struct { + *generator.Generator +} + +func NewTest(g *generator.Generator) testgen.TestPlugin { + return &test{g} +} + +func (p *test) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool { + used := false + randPkg := imports.NewImport("math/rand") + timePkg := imports.NewImport("time") + testingPkg := imports.NewImport("testing") + fmtPkg := imports.NewImport("fmt") + for _, message := range file.Messages() { + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + if !gogoproto.IsStringer(file.FileDescriptorProto, message.DescriptorProto) { + continue + } + if message.DescriptorProto.GetOptions().GetMapEntry() { + continue + } + + if gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { + used = true + p.P(`func Test`, ccTypeName, `Stringer(t *`, testingPkg.Use(), `.T) {`) + p.In() + p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(`, timePkg.Use(), `.Now().UnixNano()))`) + p.P(`p := NewPopulated`, ccTypeName, `(popr, false)`) + p.P(`s1 := p.String()`) + p.P(`s2 := `, fmtPkg.Use(), `.Sprintf("%v", p)`) + p.P(`if s1 != s2 {`) + p.In() + p.P(`t.Fatalf("String want %v got %v", s1, s2)`) + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + } + + } + return used +} + +func init() { + testgen.RegisterTestPlugin(NewTest) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/testgen/testgen.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/testgen/testgen.go new file mode 100644 index 00000000000..e0a9287e560 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/testgen/testgen.go @@ -0,0 +1,608 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +/* +The testgen plugin generates Test and Benchmark functions for each message. + +Tests are enabled using the following extensions: + + - testgen + - testgen_all + +Benchmarks are enabled using the following extensions: + + - benchgen + - benchgen_all + +Let us look at: + + github.com/gogo/protobuf/test/example/example.proto + +Btw all the output can be seen at: + + github.com/gogo/protobuf/test/example/* + +The following message: + + option (gogoproto.testgen_all) = true; + option (gogoproto.benchgen_all) = true; + + message A { + optional string Description = 1 [(gogoproto.nullable) = false]; + optional int64 Number = 2 [(gogoproto.nullable) = false]; + optional bytes Id = 3 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uuid", (gogoproto.nullable) = false]; + } + +given to the testgen plugin, will generate the following test code: + + func TestAProto(t *testing.T) { + popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) + p := NewPopulatedA(popr, false) + dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) + if err != nil { + panic(err) + } + msg := &A{} + if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { + panic(err) + } + for i := range dAtA { + dAtA[i] = byte(popr.Intn(256)) + } + if err := p.VerboseEqual(msg); err != nil { + t.Fatalf("%#v !VerboseProto %#v, since %v", msg, p, err) + } + if !p.Equal(msg) { + t.Fatalf("%#v !Proto %#v", msg, p) + } + } + + func BenchmarkAProtoMarshal(b *testing.B) { + popr := math_rand.New(math_rand.NewSource(616)) + total := 0 + pops := make([]*A, 10000) + for i := 0; i < 10000; i++ { + pops[i] = NewPopulatedA(popr, false) + } + b.ResetTimer() + for i := 0; i < b.N; i++ { + dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) + if err != nil { + panic(err) + } + total += len(dAtA) + } + b.SetBytes(int64(total / b.N)) + } + + func BenchmarkAProtoUnmarshal(b *testing.B) { + popr := math_rand.New(math_rand.NewSource(616)) + total := 0 + datas := make([][]byte, 10000) + for i := 0; i < 10000; i++ { + dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedA(popr, false)) + if err != nil { + panic(err) + } + datas[i] = dAtA + } + msg := &A{} + b.ResetTimer() + for i := 0; i < b.N; i++ { + total += len(datas[i%10000]) + if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { + panic(err) + } + } + b.SetBytes(int64(total / b.N)) + } + + + func TestAJSON(t *testing1.T) { + popr := math_rand1.New(math_rand1.NewSource(time1.Now().UnixNano())) + p := NewPopulatedA(popr, true) + jsondata, err := encoding_json.Marshal(p) + if err != nil { + panic(err) + } + msg := &A{} + err = encoding_json.Unmarshal(jsondata, msg) + if err != nil { + panic(err) + } + if err := p.VerboseEqual(msg); err != nil { + t.Fatalf("%#v !VerboseProto %#v, since %v", msg, p, err) + } + if !p.Equal(msg) { + t.Fatalf("%#v !Json Equal %#v", msg, p) + } + } + + func TestAProtoText(t *testing2.T) { + popr := math_rand2.New(math_rand2.NewSource(time2.Now().UnixNano())) + p := NewPopulatedA(popr, true) + dAtA := github_com_gogo_protobuf_proto1.MarshalTextString(p) + msg := &A{} + if err := github_com_gogo_protobuf_proto1.UnmarshalText(dAtA, msg); err != nil { + panic(err) + } + if err := p.VerboseEqual(msg); err != nil { + t.Fatalf("%#v !VerboseProto %#v, since %v", msg, p, err) + } + if !p.Equal(msg) { + t.Fatalf("%#v !Proto %#v", msg, p) + } + } + + func TestAProtoCompactText(t *testing2.T) { + popr := math_rand2.New(math_rand2.NewSource(time2.Now().UnixNano())) + p := NewPopulatedA(popr, true) + dAtA := github_com_gogo_protobuf_proto1.CompactTextString(p) + msg := &A{} + if err := github_com_gogo_protobuf_proto1.UnmarshalText(dAtA, msg); err != nil { + panic(err) + } + if err := p.VerboseEqual(msg); err != nil { + t.Fatalf("%#v !VerboseProto %#v, since %v", msg, p, err) + } + if !p.Equal(msg) { + t.Fatalf("%#v !Proto %#v", msg, p) + } + } + +Other registered tests are also generated. +Tests are registered to this test plugin by calling the following function. + + func RegisterTestPlugin(newFunc NewTestPlugin) + +where NewTestPlugin is: + + type NewTestPlugin func(g *generator.Generator) TestPlugin + +and TestPlugin is an interface: + + type TestPlugin interface { + Generate(imports generator.PluginImports, file *generator.FileDescriptor) (used bool) + } + +Plugins that use this interface include: + + - populate + - gostring + - equal + - union + - and more + +Please look at these plugins as examples of how to create your own. +A good idea is to let each plugin generate its own tests. + +*/ +package testgen + +import ( + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" +) + +type TestPlugin interface { + Generate(imports generator.PluginImports, file *generator.FileDescriptor) (used bool) +} + +type NewTestPlugin func(g *generator.Generator) TestPlugin + +var testplugins = make([]NewTestPlugin, 0) + +func RegisterTestPlugin(newFunc NewTestPlugin) { + testplugins = append(testplugins, newFunc) +} + +type plugin struct { + *generator.Generator + generator.PluginImports + tests []TestPlugin +} + +func NewPlugin() *plugin { + return &plugin{} +} + +func (p *plugin) Name() string { + return "testgen" +} + +func (p *plugin) Init(g *generator.Generator) { + p.Generator = g + p.tests = make([]TestPlugin, 0, len(testplugins)) + for i := range testplugins { + p.tests = append(p.tests, testplugins[i](g)) + } +} + +func (p *plugin) Generate(file *generator.FileDescriptor) { + p.PluginImports = generator.NewPluginImports(p.Generator) + atLeastOne := false + for i := range p.tests { + used := p.tests[i].Generate(p.PluginImports, file) + if used { + atLeastOne = true + } + } + if atLeastOne { + p.P(`//These tests are generated by github.com/gogo/protobuf/plugin/testgen`) + } +} + +type testProto struct { + *generator.Generator +} + +func newProto(g *generator.Generator) TestPlugin { + return &testProto{g} +} + +func (p *testProto) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool { + used := false + testingPkg := imports.NewImport("testing") + randPkg := imports.NewImport("math/rand") + timePkg := imports.NewImport("time") + protoPkg := imports.NewImport("github.com/gogo/protobuf/proto") + if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { + protoPkg = imports.NewImport("github.com/golang/protobuf/proto") + } + for _, message := range file.Messages() { + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + if message.DescriptorProto.GetOptions().GetMapEntry() { + continue + } + if gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { + used = true + + p.P(`func Test`, ccTypeName, `Proto(t *`, testingPkg.Use(), `.T) {`) + p.In() + p.P(`seed := `, timePkg.Use(), `.Now().UnixNano()`) + p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(seed))`) + p.P(`p := NewPopulated`, ccTypeName, `(popr, false)`) + p.P(`dAtA, err := `, protoPkg.Use(), `.Marshal(p)`) + p.P(`if err != nil {`) + p.In() + p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`) + p.Out() + p.P(`}`) + p.P(`msg := &`, ccTypeName, `{}`) + p.P(`if err := `, protoPkg.Use(), `.Unmarshal(dAtA, msg); err != nil {`) + p.In() + p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`) + p.Out() + p.P(`}`) + p.P(`littlefuzz := make([]byte, len(dAtA))`) + p.P(`copy(littlefuzz, dAtA)`) + p.P(`for i := range dAtA {`) + p.In() + p.P(`dAtA[i] = byte(popr.Intn(256))`) + p.Out() + p.P(`}`) + if gogoproto.HasVerboseEqual(file.FileDescriptorProto, message.DescriptorProto) { + p.P(`if err := p.VerboseEqual(msg); err != nil {`) + p.In() + p.P(`t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)`) + p.Out() + p.P(`}`) + } + p.P(`if !p.Equal(msg) {`) + p.In() + p.P(`t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)`) + p.Out() + p.P(`}`) + p.P(`if len(littlefuzz) > 0 {`) + p.In() + p.P(`fuzzamount := 100`) + p.P(`for i := 0; i < fuzzamount; i++ {`) + p.In() + p.P(`littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))`) + p.P(`littlefuzz = append(littlefuzz, byte(popr.Intn(256)))`) + p.Out() + p.P(`}`) + p.P(`// shouldn't panic`) + p.P(`_ = `, protoPkg.Use(), `.Unmarshal(littlefuzz, msg)`) + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + p.P() + } + + if gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { + if gogoproto.IsMarshaler(file.FileDescriptorProto, message.DescriptorProto) || gogoproto.IsUnsafeMarshaler(file.FileDescriptorProto, message.DescriptorProto) { + p.P(`func Test`, ccTypeName, `MarshalTo(t *`, testingPkg.Use(), `.T) {`) + p.In() + p.P(`seed := `, timePkg.Use(), `.Now().UnixNano()`) + p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(seed))`) + p.P(`p := NewPopulated`, ccTypeName, `(popr, false)`) + if gogoproto.IsProtoSizer(file.FileDescriptorProto, message.DescriptorProto) { + p.P(`size := p.ProtoSize()`) + } else { + p.P(`size := p.Size()`) + } + p.P(`dAtA := make([]byte, size)`) + p.P(`for i := range dAtA {`) + p.In() + p.P(`dAtA[i] = byte(popr.Intn(256))`) + p.Out() + p.P(`}`) + p.P(`_, err := p.MarshalTo(dAtA)`) + p.P(`if err != nil {`) + p.In() + p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`) + p.Out() + p.P(`}`) + p.P(`msg := &`, ccTypeName, `{}`) + p.P(`if err := `, protoPkg.Use(), `.Unmarshal(dAtA, msg); err != nil {`) + p.In() + p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`) + p.Out() + p.P(`}`) + p.P(`for i := range dAtA {`) + p.In() + p.P(`dAtA[i] = byte(popr.Intn(256))`) + p.Out() + p.P(`}`) + if gogoproto.HasVerboseEqual(file.FileDescriptorProto, message.DescriptorProto) { + p.P(`if err := p.VerboseEqual(msg); err != nil {`) + p.In() + p.P(`t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)`) + p.Out() + p.P(`}`) + } + p.P(`if !p.Equal(msg) {`) + p.In() + p.P(`t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)`) + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + p.P() + } + } + + if gogoproto.HasBenchGen(file.FileDescriptorProto, message.DescriptorProto) { + used = true + p.P(`func Benchmark`, ccTypeName, `ProtoMarshal(b *`, testingPkg.Use(), `.B) {`) + p.In() + p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(616))`) + p.P(`total := 0`) + p.P(`pops := make([]*`, ccTypeName, `, 10000)`) + p.P(`for i := 0; i < 10000; i++ {`) + p.In() + p.P(`pops[i] = NewPopulated`, ccTypeName, `(popr, false)`) + p.Out() + p.P(`}`) + p.P(`b.ResetTimer()`) + p.P(`for i := 0; i < b.N; i++ {`) + p.In() + p.P(`dAtA, err := `, protoPkg.Use(), `.Marshal(pops[i%10000])`) + p.P(`if err != nil {`) + p.In() + p.P(`panic(err)`) + p.Out() + p.P(`}`) + p.P(`total += len(dAtA)`) + p.Out() + p.P(`}`) + p.P(`b.SetBytes(int64(total / b.N))`) + p.Out() + p.P(`}`) + p.P() + + p.P(`func Benchmark`, ccTypeName, `ProtoUnmarshal(b *`, testingPkg.Use(), `.B) {`) + p.In() + p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(616))`) + p.P(`total := 0`) + p.P(`datas := make([][]byte, 10000)`) + p.P(`for i := 0; i < 10000; i++ {`) + p.In() + p.P(`dAtA, err := `, protoPkg.Use(), `.Marshal(NewPopulated`, ccTypeName, `(popr, false))`) + p.P(`if err != nil {`) + p.In() + p.P(`panic(err)`) + p.Out() + p.P(`}`) + p.P(`datas[i] = dAtA`) + p.Out() + p.P(`}`) + p.P(`msg := &`, ccTypeName, `{}`) + p.P(`b.ResetTimer()`) + p.P(`for i := 0; i < b.N; i++ {`) + p.In() + p.P(`total += len(datas[i%10000])`) + p.P(`if err := `, protoPkg.Use(), `.Unmarshal(datas[i%10000], msg); err != nil {`) + p.In() + p.P(`panic(err)`) + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + p.P(`b.SetBytes(int64(total / b.N))`) + p.Out() + p.P(`}`) + p.P() + } + } + return used +} + +type testJson struct { + *generator.Generator +} + +func newJson(g *generator.Generator) TestPlugin { + return &testJson{g} +} + +func (p *testJson) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool { + used := false + testingPkg := imports.NewImport("testing") + randPkg := imports.NewImport("math/rand") + timePkg := imports.NewImport("time") + jsonPkg := imports.NewImport("github.com/gogo/protobuf/jsonpb") + for _, message := range file.Messages() { + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + if message.DescriptorProto.GetOptions().GetMapEntry() { + continue + } + if gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { + used = true + p.P(`func Test`, ccTypeName, `JSON(t *`, testingPkg.Use(), `.T) {`) + p.In() + p.P(`seed := `, timePkg.Use(), `.Now().UnixNano()`) + p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(seed))`) + p.P(`p := NewPopulated`, ccTypeName, `(popr, true)`) + p.P(`marshaler := `, jsonPkg.Use(), `.Marshaler{}`) + p.P(`jsondata, err := marshaler.MarshalToString(p)`) + p.P(`if err != nil {`) + p.In() + p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`) + p.Out() + p.P(`}`) + p.P(`msg := &`, ccTypeName, `{}`) + p.P(`err = `, jsonPkg.Use(), `.UnmarshalString(jsondata, msg)`) + p.P(`if err != nil {`) + p.In() + p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`) + p.Out() + p.P(`}`) + if gogoproto.HasVerboseEqual(file.FileDescriptorProto, message.DescriptorProto) { + p.P(`if err := p.VerboseEqual(msg); err != nil {`) + p.In() + p.P(`t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)`) + p.Out() + p.P(`}`) + } + p.P(`if !p.Equal(msg) {`) + p.In() + p.P(`t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)`) + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + } + } + return used +} + +type testText struct { + *generator.Generator +} + +func newText(g *generator.Generator) TestPlugin { + return &testText{g} +} + +func (p *testText) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool { + used := false + testingPkg := imports.NewImport("testing") + randPkg := imports.NewImport("math/rand") + timePkg := imports.NewImport("time") + protoPkg := imports.NewImport("github.com/gogo/protobuf/proto") + if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { + protoPkg = imports.NewImport("github.com/golang/protobuf/proto") + } + //fmtPkg := imports.NewImport("fmt") + for _, message := range file.Messages() { + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + if message.DescriptorProto.GetOptions().GetMapEntry() { + continue + } + if gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { + used = true + + p.P(`func Test`, ccTypeName, `ProtoText(t *`, testingPkg.Use(), `.T) {`) + p.In() + p.P(`seed := `, timePkg.Use(), `.Now().UnixNano()`) + p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(seed))`) + p.P(`p := NewPopulated`, ccTypeName, `(popr, true)`) + p.P(`dAtA := `, protoPkg.Use(), `.MarshalTextString(p)`) + p.P(`msg := &`, ccTypeName, `{}`) + p.P(`if err := `, protoPkg.Use(), `.UnmarshalText(dAtA, msg); err != nil {`) + p.In() + p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`) + p.Out() + p.P(`}`) + if gogoproto.HasVerboseEqual(file.FileDescriptorProto, message.DescriptorProto) { + p.P(`if err := p.VerboseEqual(msg); err != nil {`) + p.In() + p.P(`t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)`) + p.Out() + p.P(`}`) + } + p.P(`if !p.Equal(msg) {`) + p.In() + p.P(`t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)`) + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + p.P() + + p.P(`func Test`, ccTypeName, `ProtoCompactText(t *`, testingPkg.Use(), `.T) {`) + p.In() + p.P(`seed := `, timePkg.Use(), `.Now().UnixNano()`) + p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(seed))`) + p.P(`p := NewPopulated`, ccTypeName, `(popr, true)`) + p.P(`dAtA := `, protoPkg.Use(), `.CompactTextString(p)`) + p.P(`msg := &`, ccTypeName, `{}`) + p.P(`if err := `, protoPkg.Use(), `.UnmarshalText(dAtA, msg); err != nil {`) + p.In() + p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`) + p.Out() + p.P(`}`) + if gogoproto.HasVerboseEqual(file.FileDescriptorProto, message.DescriptorProto) { + p.P(`if err := p.VerboseEqual(msg); err != nil {`) + p.In() + p.P(`t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)`) + p.Out() + p.P(`}`) + } + p.P(`if !p.Equal(msg) {`) + p.In() + p.P(`t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)`) + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + p.P() + + } + } + return used +} + +func init() { + RegisterTestPlugin(newProto) + RegisterTestPlugin(newJson) + RegisterTestPlugin(newText) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/union/union.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/union/union.go new file mode 100644 index 00000000000..72edb2498cd --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/union/union.go @@ -0,0 +1,209 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +/* +The onlyone plugin generates code for the onlyone extension. +All fields must be nullable and only one of the fields may be set, like a union. +Two methods are generated + + GetValue() interface{} + +and + + SetValue(v interface{}) (set bool) + +These provide easier interaction with a onlyone. + +The onlyone extension is not called union as this causes compile errors in the C++ generated code. +There can only be one ;) + +It is enabled by the following extensions: + + - onlyone + - onlyone_all + +The onlyone plugin also generates a test given it is enabled using one of the following extensions: + + - testgen + - testgen_all + +Lets look at: + + github.com/gogo/protobuf/test/example/example.proto + +Btw all the output can be seen at: + + github.com/gogo/protobuf/test/example/* + +The following message: + + message U { + option (gogoproto.onlyone) = true; + optional A A = 1; + optional B B = 2; + } + +given to the onlyone plugin, will generate code which looks a lot like this: + + func (this *U) GetValue() interface{} { + if this.A != nil { + return this.A + } + if this.B != nil { + return this.B + } + return nil + } + + func (this *U) SetValue(value interface{}) bool { + switch vt := value.(type) { + case *A: + this.A = vt + case *B: + this.B = vt + default: + return false + } + return true + } + +and the following test code: + + func TestUUnion(t *testing.T) { + popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) + p := NewPopulatedU(popr) + v := p.GetValue() + msg := &U{} + if !msg.SetValue(v) { + t.Fatalf("Union: Could not set Value") + } + if !p.Equal(msg) { + t.Fatalf("%#v !Union Equal %#v", msg, p) + } + } + +*/ +package union + +import ( + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" +) + +type union struct { + *generator.Generator + generator.PluginImports +} + +func NewUnion() *union { + return &union{} +} + +func (p *union) Name() string { + return "union" +} + +func (p *union) Init(g *generator.Generator) { + p.Generator = g +} + +func (p *union) Generate(file *generator.FileDescriptor) { + p.PluginImports = generator.NewPluginImports(p.Generator) + + for _, message := range file.Messages() { + if !gogoproto.IsUnion(file.FileDescriptorProto, message.DescriptorProto) { + continue + } + if message.DescriptorProto.HasExtension() { + panic("onlyone does not currently support extensions") + } + if message.DescriptorProto.GetOptions().GetMapEntry() { + continue + } + + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + p.P(`func (this *`, ccTypeName, `) GetValue() interface{} {`) + p.In() + for _, field := range message.Field { + fieldname := p.GetFieldName(message, field) + if fieldname == "Value" { + panic("cannot have a onlyone message " + ccTypeName + " with a field named Value") + } + p.P(`if this.`, fieldname, ` != nil {`) + p.In() + p.P(`return this.`, fieldname) + p.Out() + p.P(`}`) + } + p.P(`return nil`) + p.Out() + p.P(`}`) + p.P(``) + p.P(`func (this *`, ccTypeName, `) SetValue(value interface{}) bool {`) + p.In() + p.P(`switch vt := value.(type) {`) + p.In() + for _, field := range message.Field { + fieldname := p.GetFieldName(message, field) + goTyp, _ := p.GoType(message, field) + p.P(`case `, goTyp, `:`) + p.In() + p.P(`this.`, fieldname, ` = vt`) + p.Out() + } + p.P(`default:`) + p.In() + for _, field := range message.Field { + fieldname := p.GetFieldName(message, field) + if field.IsMessage() { + goTyp, _ := p.GoType(message, field) + obj := p.ObjectNamed(field.GetTypeName()).(*generator.Descriptor) + + if gogoproto.IsUnion(obj.File(), obj.DescriptorProto) { + p.P(`this.`, fieldname, ` = new(`, generator.GoTypeToName(goTyp), `)`) + p.P(`if set := this.`, fieldname, `.SetValue(value); set {`) + p.In() + p.P(`return true`) + p.Out() + p.P(`}`) + p.P(`this.`, fieldname, ` = nil`) + } + } + } + p.P(`return false`) + p.Out() + p.P(`}`) + p.P(`return true`) + p.Out() + p.P(`}`) + } +} + +func init() { + generator.RegisterPlugin(NewUnion()) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/union/uniontest.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/union/uniontest.go new file mode 100644 index 00000000000..949cf833850 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/union/uniontest.go @@ -0,0 +1,86 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package union + +import ( + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/plugin/testgen" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" +) + +type test struct { + *generator.Generator +} + +func NewTest(g *generator.Generator) testgen.TestPlugin { + return &test{g} +} + +func (p *test) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool { + used := false + randPkg := imports.NewImport("math/rand") + timePkg := imports.NewImport("time") + testingPkg := imports.NewImport("testing") + for _, message := range file.Messages() { + if !gogoproto.IsUnion(file.FileDescriptorProto, message.DescriptorProto) || + !gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { + continue + } + if message.DescriptorProto.GetOptions().GetMapEntry() { + continue + } + used = true + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + + p.P(`func Test`, ccTypeName, `OnlyOne(t *`, testingPkg.Use(), `.T) {`) + p.In() + p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(`, timePkg.Use(), `.Now().UnixNano()))`) + p.P(`p := NewPopulated`, ccTypeName, `(popr, true)`) + p.P(`v := p.GetValue()`) + p.P(`msg := &`, ccTypeName, `{}`) + p.P(`if !msg.SetValue(v) {`) + p.In() + p.P(`t.Fatalf("OnlyOne: Could not set Value")`) + p.Out() + p.P(`}`) + p.P(`if !p.Equal(msg) {`) + p.In() + p.P(`t.Fatalf("%#v !OnlyOne Equal %#v", msg, p)`) + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + + } + return used +} + +func init() { + testgen.RegisterTestPlugin(NewTest) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/unmarshal/unmarshal.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/unmarshal/unmarshal.go new file mode 100644 index 00000000000..c8a704991b4 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/unmarshal/unmarshal.go @@ -0,0 +1,1439 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +/* +The unmarshal plugin generates a Unmarshal method for each message. +The `Unmarshal([]byte) error` method results in the fact that the message +implements the Unmarshaler interface. +The allows proto.Unmarshal to be faster by calling the generated Unmarshal method rather than using reflect. + +If is enabled by the following extensions: + + - unmarshaler + - unmarshaler_all + +Or the following extensions: + + - unsafe_unmarshaler + - unsafe_unmarshaler_all + +That is if you want to use the unsafe package in your generated code. +The speed up using the unsafe package is not very significant. + +The generation of unmarshalling tests are enabled using one of the following extensions: + + - testgen + - testgen_all + +And benchmarks given it is enabled using one of the following extensions: + + - benchgen + - benchgen_all + +Let us look at: + + github.com/gogo/protobuf/test/example/example.proto + +Btw all the output can be seen at: + + github.com/gogo/protobuf/test/example/* + +The following message: + + option (gogoproto.unmarshaler_all) = true; + + message B { + option (gogoproto.description) = true; + optional A A = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; + repeated bytes G = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false]; + } + +given to the unmarshal plugin, will generate the following code: + + func (m *B) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + switch fieldNum { + case 1: + if wireType != 2 { + return proto.ErrWrongType + } + var msglen int + for shift := uint(0); ; shift += 7 { + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.A.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return proto.ErrWrongType + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.G = append(m.G, github_com_gogo_protobuf_test_custom.Uint128{}) + if err := m.G[len(m.G)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + var sizeOfWire int + for { + sizeOfWire++ + wire >>= 7 + if wire == 0 { + break + } + } + iNdEx -= sizeOfWire + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + return nil + } + +Remember when using this code to call proto.Unmarshal. +This will call m.Reset and invoke the generated Unmarshal method for you. +If you call m.Unmarshal without m.Reset you could be merging protocol buffers. + +*/ +package unmarshal + +import ( + "fmt" + "strconv" + "strings" + + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/proto" + descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" +) + +type unmarshal struct { + *generator.Generator + unsafe bool + generator.PluginImports + atleastOne bool + ioPkg generator.Single + mathPkg generator.Single + unsafePkg generator.Single + typesPkg generator.Single + localName string +} + +func NewUnmarshal() *unmarshal { + return &unmarshal{} +} + +func NewUnsafeUnmarshal() *unmarshal { + return &unmarshal{unsafe: true} +} + +func (p *unmarshal) Name() string { + if p.unsafe { + return "unsafeunmarshaler" + } + return "unmarshal" +} + +func (p *unmarshal) Init(g *generator.Generator) { + p.Generator = g +} + +func (p *unmarshal) decodeVarint(varName string, typName string) { + p.P(`for shift := uint(0); ; shift += 7 {`) + p.In() + p.P(`if shift >= 64 {`) + p.In() + p.P(`return ErrIntOverflow` + p.localName) + p.Out() + p.P(`}`) + p.P(`if iNdEx >= l {`) + p.In() + p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) + p.Out() + p.P(`}`) + p.P(`b := dAtA[iNdEx]`) + p.P(`iNdEx++`) + p.P(varName, ` |= (`, typName, `(b) & 0x7F) << shift`) + p.P(`if b < 0x80 {`) + p.In() + p.P(`break`) + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) +} + +func (p *unmarshal) decodeFixed32(varName string, typeName string) { + p.P(`if (iNdEx+4) > l {`) + p.In() + p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) + p.Out() + p.P(`}`) + p.P(`iNdEx += 4`) + p.P(varName, ` = `, typeName, `(dAtA[iNdEx-4])`) + p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-3]) << 8`) + p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-2]) << 16`) + p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-1]) << 24`) +} + +func (p *unmarshal) unsafeFixed32(varName string, typeName string) { + p.P(`if iNdEx + 4 > l {`) + p.In() + p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) + p.Out() + p.P(`}`) + p.P(varName, ` = *(*`, typeName, `)(`, p.unsafePkg.Use(), `.Pointer(&dAtA[iNdEx]))`) + p.P(`iNdEx += 4`) +} + +func (p *unmarshal) decodeFixed64(varName string, typeName string) { + p.P(`if (iNdEx+8) > l {`) + p.In() + p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) + p.Out() + p.P(`}`) + p.P(`iNdEx += 8`) + p.P(varName, ` = `, typeName, `(dAtA[iNdEx-8])`) + p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-7]) << 8`) + p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-6]) << 16`) + p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-5]) << 24`) + p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-4]) << 32`) + p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-3]) << 40`) + p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-2]) << 48`) + p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-1]) << 56`) +} + +func (p *unmarshal) unsafeFixed64(varName string, typeName string) { + p.P(`if iNdEx + 8 > l {`) + p.In() + p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) + p.Out() + p.P(`}`) + p.P(varName, ` = *(*`, typeName, `)(`, p.unsafePkg.Use(), `.Pointer(&dAtA[iNdEx]))`) + p.P(`iNdEx += 8`) +} + +func (p *unmarshal) mapField(varName string, customType bool, field *descriptor.FieldDescriptorProto) { + switch field.GetType() { + case descriptor.FieldDescriptorProto_TYPE_DOUBLE: + p.P(`var `, varName, `temp uint64`) + p.decodeFixed64(varName+"temp", "uint64") + p.P(varName, ` := `, p.mathPkg.Use(), `.Float64frombits(`, varName, `temp)`) + case descriptor.FieldDescriptorProto_TYPE_FLOAT: + p.P(`var `, varName, `temp uint32`) + p.decodeFixed32(varName+"temp", "uint32") + p.P(varName, ` := `, p.mathPkg.Use(), `.Float32frombits(`, varName, `temp)`) + case descriptor.FieldDescriptorProto_TYPE_INT64: + p.P(`var `, varName, ` int64`) + p.decodeVarint(varName, "int64") + case descriptor.FieldDescriptorProto_TYPE_UINT64: + p.P(`var `, varName, ` uint64`) + p.decodeVarint(varName, "uint64") + case descriptor.FieldDescriptorProto_TYPE_INT32: + p.P(`var `, varName, ` int32`) + p.decodeVarint(varName, "int32") + case descriptor.FieldDescriptorProto_TYPE_FIXED64: + p.P(`var `, varName, ` uint64`) + p.decodeFixed64(varName, "uint64") + case descriptor.FieldDescriptorProto_TYPE_FIXED32: + p.P(`var `, varName, ` uint32`) + p.decodeFixed32(varName, "uint32") + case descriptor.FieldDescriptorProto_TYPE_BOOL: + p.P(`var `, varName, `temp int`) + p.decodeVarint(varName+"temp", "int") + p.P(varName, ` := bool(`, varName, `temp != 0)`) + case descriptor.FieldDescriptorProto_TYPE_STRING: + p.P(`var stringLen`, varName, ` uint64`) + p.decodeVarint("stringLen"+varName, "uint64") + p.P(`intStringLen`, varName, ` := int(stringLen`, varName, `)`) + p.P(`if intStringLen`, varName, ` < 0 {`) + p.In() + p.P(`return ErrInvalidLength` + p.localName) + p.Out() + p.P(`}`) + p.P(`postStringIndex`, varName, ` := iNdEx + intStringLen`, varName) + p.P(`if postStringIndex`, varName, ` > l {`) + p.In() + p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) + p.Out() + p.P(`}`) + cast, _ := p.GoType(nil, field) + cast = strings.Replace(cast, "*", "", 1) + p.P(varName, ` := `, cast, `(dAtA[iNdEx:postStringIndex`, varName, `])`) + p.P(`iNdEx = postStringIndex`, varName) + case descriptor.FieldDescriptorProto_TYPE_MESSAGE: + p.P(`var mapmsglen int`) + p.decodeVarint("mapmsglen", "int") + p.P(`if mapmsglen < 0 {`) + p.In() + p.P(`return ErrInvalidLength` + p.localName) + p.Out() + p.P(`}`) + p.P(`postmsgIndex := iNdEx + mapmsglen`) + p.P(`if mapmsglen < 0 {`) + p.In() + p.P(`return ErrInvalidLength` + p.localName) + p.Out() + p.P(`}`) + p.P(`if postmsgIndex > l {`) + p.In() + p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) + p.Out() + p.P(`}`) + desc := p.ObjectNamed(field.GetTypeName()) + msgname := p.TypeName(desc) + buf := `dAtA[iNdEx:postmsgIndex]` + if gogoproto.IsStdTime(field) { + p.P(varName, ` := new(time.Time)`) + p.P(`if err := `, p.typesPkg.Use(), `.StdTimeUnmarshal(`, varName, `, `, buf, `); err != nil {`) + } else if gogoproto.IsStdDuration(field) { + p.P(varName, ` := new(time.Duration)`) + p.P(`if err := `, p.typesPkg.Use(), `.StdDurationUnmarshal(`, varName, `, `, buf, `); err != nil {`) + } else { + p.P(varName, ` := &`, msgname, `{}`) + p.P(`if err := `, varName, `.Unmarshal(`, buf, `); err != nil {`) + } + p.In() + p.P(`return err`) + p.Out() + p.P(`}`) + p.P(`iNdEx = postmsgIndex`) + case descriptor.FieldDescriptorProto_TYPE_BYTES: + p.P(`var mapbyteLen uint64`) + p.decodeVarint("mapbyteLen", "uint64") + p.P(`intMapbyteLen := int(mapbyteLen)`) + p.P(`if intMapbyteLen < 0 {`) + p.In() + p.P(`return ErrInvalidLength` + p.localName) + p.Out() + p.P(`}`) + p.P(`postbytesIndex := iNdEx + intMapbyteLen`) + p.P(`if postbytesIndex > l {`) + p.In() + p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) + p.Out() + p.P(`}`) + if customType { + _, ctyp, err := generator.GetCustomType(field) + if err != nil { + panic(err) + } + p.P(`var `, varName, `1 `, ctyp) + p.P(`var `, varName, ` = &`, varName, `1`) + p.P(`if err := `, varName, `.Unmarshal(dAtA[iNdEx:postbytesIndex]); err != nil {`) + p.In() + p.P(`return err`) + p.Out() + p.P(`}`) + } else { + p.P(varName, ` := make([]byte, mapbyteLen)`) + p.P(`copy(`, varName, `, dAtA[iNdEx:postbytesIndex])`) + } + p.P(`iNdEx = postbytesIndex`) + case descriptor.FieldDescriptorProto_TYPE_UINT32: + p.P(`var `, varName, ` uint32`) + p.decodeVarint(varName, "uint32") + case descriptor.FieldDescriptorProto_TYPE_ENUM: + typName := p.TypeName(p.ObjectNamed(field.GetTypeName())) + p.P(`var `, varName, ` `, typName) + p.decodeVarint(varName, typName) + case descriptor.FieldDescriptorProto_TYPE_SFIXED32: + p.P(`var `, varName, ` int32`) + p.decodeFixed32(varName, "int32") + case descriptor.FieldDescriptorProto_TYPE_SFIXED64: + p.P(`var `, varName, ` int64`) + p.decodeFixed64(varName, "int64") + case descriptor.FieldDescriptorProto_TYPE_SINT32: + p.P(`var `, varName, `temp int32`) + p.decodeVarint(varName+"temp", "int32") + p.P(varName, `temp = int32((uint32(`, varName, `temp) >> 1) ^ uint32(((`, varName, `temp&1)<<31)>>31))`) + p.P(varName, ` := int32(`, varName, `temp)`) + case descriptor.FieldDescriptorProto_TYPE_SINT64: + p.P(`var `, varName, `temp uint64`) + p.decodeVarint(varName+"temp", "uint64") + p.P(varName, `temp = (`, varName, `temp >> 1) ^ uint64((int64(`, varName, `temp&1)<<63)>>63)`) + p.P(varName, ` := int64(`, varName, `temp)`) + } +} + +func (p *unmarshal) noStarOrSliceType(msg *generator.Descriptor, field *descriptor.FieldDescriptorProto) string { + typ, _ := p.GoType(msg, field) + if typ[0] == '*' { + return typ[1:] + } + if typ[0] == '[' && typ[1] == ']' { + return typ[2:] + } + return typ +} + +func (p *unmarshal) field(file *generator.FileDescriptor, msg *generator.Descriptor, field *descriptor.FieldDescriptorProto, fieldname string, proto3 bool) { + repeated := field.IsRepeated() + nullable := gogoproto.IsNullable(field) + typ := p.noStarOrSliceType(msg, field) + oneof := field.OneofIndex != nil + switch *field.Type { + case descriptor.FieldDescriptorProto_TYPE_DOUBLE: + if !p.unsafe || gogoproto.IsCastType(field) { + p.P(`var v uint64`) + p.decodeFixed64("v", "uint64") + if oneof { + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{`, typ, "(", p.mathPkg.Use(), `.Float64frombits(v))}`) + } else if repeated { + p.P(`v2 := `, typ, "(", p.mathPkg.Use(), `.Float64frombits(v))`) + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v2)`) + } else if proto3 || !nullable { + p.P(`m.`, fieldname, ` = `, typ, "(", p.mathPkg.Use(), `.Float64frombits(v))`) + } else { + p.P(`v2 := `, typ, "(", p.mathPkg.Use(), `.Float64frombits(v))`) + p.P(`m.`, fieldname, ` = &v2`) + } + } else { + if oneof { + p.P(`var v float64`) + p.unsafeFixed64("v", "float64") + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) + } else if repeated { + p.P(`var v float64`) + p.unsafeFixed64("v", "float64") + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) + } else if proto3 || !nullable { + p.unsafeFixed64(`m.`+fieldname, "float64") + } else { + p.P(`var v float64`) + p.unsafeFixed64("v", "float64") + p.P(`m.`, fieldname, ` = &v`) + } + } + case descriptor.FieldDescriptorProto_TYPE_FLOAT: + if !p.unsafe || gogoproto.IsCastType(field) { + p.P(`var v uint32`) + p.decodeFixed32("v", "uint32") + if oneof { + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{`, typ, "(", p.mathPkg.Use(), `.Float32frombits(v))}`) + } else if repeated { + p.P(`v2 := `, typ, "(", p.mathPkg.Use(), `.Float32frombits(v))`) + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v2)`) + } else if proto3 || !nullable { + p.P(`m.`, fieldname, ` = `, typ, "(", p.mathPkg.Use(), `.Float32frombits(v))`) + } else { + p.P(`v2 := `, typ, "(", p.mathPkg.Use(), `.Float32frombits(v))`) + p.P(`m.`, fieldname, ` = &v2`) + } + } else { + if oneof { + p.P(`var v float32`) + p.unsafeFixed32("v", "float32") + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) + } else if repeated { + p.P(`var v float32`) + p.unsafeFixed32("v", "float32") + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) + } else if proto3 || !nullable { + p.unsafeFixed32("m."+fieldname, "float32") + } else { + p.P(`var v float32`) + p.unsafeFixed32("v", "float32") + p.P(`m.`, fieldname, ` = &v`) + } + } + case descriptor.FieldDescriptorProto_TYPE_INT64: + if oneof { + p.P(`var v `, typ) + p.decodeVarint("v", typ) + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) + } else if repeated { + p.P(`var v `, typ) + p.decodeVarint("v", typ) + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) + } else if proto3 || !nullable { + p.P(`m.`, fieldname, ` = 0`) + p.decodeVarint("m."+fieldname, typ) + } else { + p.P(`var v `, typ) + p.decodeVarint("v", typ) + p.P(`m.`, fieldname, ` = &v`) + } + case descriptor.FieldDescriptorProto_TYPE_UINT64: + if oneof { + p.P(`var v `, typ) + p.decodeVarint("v", typ) + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) + } else if repeated { + p.P(`var v `, typ) + p.decodeVarint("v", typ) + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) + } else if proto3 || !nullable { + p.P(`m.`, fieldname, ` = 0`) + p.decodeVarint("m."+fieldname, typ) + } else { + p.P(`var v `, typ) + p.decodeVarint("v", typ) + p.P(`m.`, fieldname, ` = &v`) + } + case descriptor.FieldDescriptorProto_TYPE_INT32: + if oneof { + p.P(`var v `, typ) + p.decodeVarint("v", typ) + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) + } else if repeated { + p.P(`var v `, typ) + p.decodeVarint("v", typ) + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) + } else if proto3 || !nullable { + p.P(`m.`, fieldname, ` = 0`) + p.decodeVarint("m."+fieldname, typ) + } else { + p.P(`var v `, typ) + p.decodeVarint("v", typ) + p.P(`m.`, fieldname, ` = &v`) + } + case descriptor.FieldDescriptorProto_TYPE_FIXED64: + if !p.unsafe || gogoproto.IsCastType(field) { + if oneof { + p.P(`var v `, typ) + p.decodeFixed64("v", typ) + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) + } else if repeated { + p.P(`var v `, typ) + p.decodeFixed64("v", typ) + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) + } else if proto3 || !nullable { + p.P(`m.`, fieldname, ` = 0`) + p.decodeFixed64("m."+fieldname, typ) + } else { + p.P(`var v `, typ) + p.decodeFixed64("v", typ) + p.P(`m.`, fieldname, ` = &v`) + } + } else { + if oneof { + p.P(`var v uint64`) + p.unsafeFixed64("v", "uint64") + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) + } else if repeated { + p.P(`var v uint64`) + p.unsafeFixed64("v", "uint64") + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) + } else if proto3 || !nullable { + p.unsafeFixed64("m."+fieldname, "uint64") + } else { + p.P(`var v uint64`) + p.unsafeFixed64("v", "uint64") + p.P(`m.`, fieldname, ` = &v`) + } + } + case descriptor.FieldDescriptorProto_TYPE_FIXED32: + if !p.unsafe || gogoproto.IsCastType(field) { + if oneof { + p.P(`var v `, typ) + p.decodeFixed32("v", typ) + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) + } else if repeated { + p.P(`var v `, typ) + p.decodeFixed32("v", typ) + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) + } else if proto3 || !nullable { + p.P(`m.`, fieldname, ` = 0`) + p.decodeFixed32("m."+fieldname, typ) + } else { + p.P(`var v `, typ) + p.decodeFixed32("v", typ) + p.P(`m.`, fieldname, ` = &v`) + } + } else { + if oneof { + p.P(`var v uint32`) + p.unsafeFixed32("v", "uint32") + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) + } else if repeated { + p.P(`var v uint32`) + p.unsafeFixed32("v", "uint32") + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) + } else if proto3 || !nullable { + p.unsafeFixed32("m."+fieldname, "uint32") + } else { + p.P(`var v uint32`) + p.unsafeFixed32("v", "uint32") + p.P(`m.`, fieldname, ` = &v`) + } + } + case descriptor.FieldDescriptorProto_TYPE_BOOL: + p.P(`var v int`) + p.decodeVarint("v", "int") + if oneof { + p.P(`b := `, typ, `(v != 0)`) + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{b}`) + } else if repeated { + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, `, typ, `(v != 0))`) + } else if proto3 || !nullable { + p.P(`m.`, fieldname, ` = `, typ, `(v != 0)`) + } else { + p.P(`b := `, typ, `(v != 0)`) + p.P(`m.`, fieldname, ` = &b`) + } + case descriptor.FieldDescriptorProto_TYPE_STRING: + p.P(`var stringLen uint64`) + p.decodeVarint("stringLen", "uint64") + p.P(`intStringLen := int(stringLen)`) + p.P(`if intStringLen < 0 {`) + p.In() + p.P(`return ErrInvalidLength` + p.localName) + p.Out() + p.P(`}`) + p.P(`postIndex := iNdEx + intStringLen`) + p.P(`if postIndex > l {`) + p.In() + p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) + p.Out() + p.P(`}`) + if oneof { + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{`, typ, `(dAtA[iNdEx:postIndex])}`) + } else if repeated { + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, `, typ, `(dAtA[iNdEx:postIndex]))`) + } else if proto3 || !nullable { + p.P(`m.`, fieldname, ` = `, typ, `(dAtA[iNdEx:postIndex])`) + } else { + p.P(`s := `, typ, `(dAtA[iNdEx:postIndex])`) + p.P(`m.`, fieldname, ` = &s`) + } + p.P(`iNdEx = postIndex`) + case descriptor.FieldDescriptorProto_TYPE_GROUP: + panic(fmt.Errorf("unmarshaler does not support group %v", fieldname)) + case descriptor.FieldDescriptorProto_TYPE_MESSAGE: + desc := p.ObjectNamed(field.GetTypeName()) + msgname := p.TypeName(desc) + p.P(`var msglen int`) + p.decodeVarint("msglen", "int") + p.P(`if msglen < 0 {`) + p.In() + p.P(`return ErrInvalidLength` + p.localName) + p.Out() + p.P(`}`) + p.P(`postIndex := iNdEx + msglen`) + p.P(`if postIndex > l {`) + p.In() + p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) + p.Out() + p.P(`}`) + if oneof { + buf := `dAtA[iNdEx:postIndex]` + if gogoproto.IsStdTime(field) { + if nullable { + p.P(`v := new(time.Time)`) + p.P(`if err := `, p.typesPkg.Use(), `.StdTimeUnmarshal(v, `, buf, `); err != nil {`) + } else { + p.P(`v := time.Time{}`) + p.P(`if err := `, p.typesPkg.Use(), `.StdTimeUnmarshal(&v, `, buf, `); err != nil {`) + } + } else if gogoproto.IsStdDuration(field) { + if nullable { + p.P(`v := new(time.Duration)`) + p.P(`if err := `, p.typesPkg.Use(), `.StdDurationUnmarshal(v, `, buf, `); err != nil {`) + } else { + p.P(`v := time.Duration(0)`) + p.P(`if err := `, p.typesPkg.Use(), `.StdDurationUnmarshal(&v, `, buf, `); err != nil {`) + } + } else { + p.P(`v := &`, msgname, `{}`) + p.P(`if err := v.Unmarshal(`, buf, `); err != nil {`) + } + p.In() + p.P(`return err`) + p.Out() + p.P(`}`) + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) + } else if p.IsMap(field) { + m := p.GoMapType(nil, field) + + keygoTyp, _ := p.GoType(nil, m.KeyField) + keygoAliasTyp, _ := p.GoType(nil, m.KeyAliasField) + // keys may not be pointers + keygoTyp = strings.Replace(keygoTyp, "*", "", 1) + keygoAliasTyp = strings.Replace(keygoAliasTyp, "*", "", 1) + + valuegoTyp, _ := p.GoType(nil, m.ValueField) + valuegoAliasTyp, _ := p.GoType(nil, m.ValueAliasField) + + // if the map type is an alias and key or values are aliases (type Foo map[Bar]Baz), + // we need to explicitly record their use here. + p.RecordTypeUse(m.KeyAliasField.GetTypeName()) + p.RecordTypeUse(m.ValueAliasField.GetTypeName()) + + nullable, valuegoTyp, valuegoAliasTyp = generator.GoMapValueTypes(field, m.ValueField, valuegoTyp, valuegoAliasTyp) + if gogoproto.IsStdTime(field) || gogoproto.IsStdDuration(field) { + valuegoTyp = valuegoAliasTyp + } + + p.P(`var keykey uint64`) + p.decodeVarint("keykey", "uint64") + p.mapField("mapkey", false, m.KeyAliasField) + p.P(`if m.`, fieldname, ` == nil {`) + p.In() + p.P(`m.`, fieldname, ` = make(`, m.GoType, `)`) + p.Out() + p.P(`}`) + s := `m.` + fieldname + if keygoTyp == keygoAliasTyp { + s += `[mapkey]` + } else { + s += `[` + keygoAliasTyp + `(mapkey)]` + } + v := `mapvalue` + if (m.ValueField.IsMessage() || gogoproto.IsCustomType(field)) && !nullable { + v = `*` + v + } + if valuegoTyp != valuegoAliasTyp { + v = `((` + valuegoAliasTyp + `)(` + v + `))` + } + p.P(`if iNdEx < postIndex {`) + p.In() + p.P(`var valuekey uint64`) + p.decodeVarint("valuekey", "uint64") + p.mapField("mapvalue", gogoproto.IsCustomType(field), m.ValueAliasField) + p.P(s, ` = `, v) + p.Out() + p.P(`} else {`) + p.In() + if gogoproto.IsStdTime(field) { + p.P(`var mapvalue = new(time.Time)`) + if nullable { + p.P(s, ` = mapvalue`) + } else { + p.P(s, ` = *mapvalue`) + } + } else if gogoproto.IsStdDuration(field) { + p.P(`var mapvalue = new(time.Duration)`) + if nullable { + p.P(s, ` = mapvalue`) + } else { + p.P(s, ` = *mapvalue`) + } + } else { + p.P(`var mapvalue `, valuegoAliasTyp) + p.P(s, ` = mapvalue`) + } + p.Out() + p.P(`}`) + } else if repeated { + if gogoproto.IsStdTime(field) { + if nullable { + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, new(time.Time))`) + } else { + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, time.Time{})`) + } + } else if gogoproto.IsStdDuration(field) { + if nullable { + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, new(time.Duration))`) + } else { + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, time.Duration(0))`) + } + } else if nullable { + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, &`, msgname, `{})`) + } else { + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, `, msgname, `{})`) + } + varName := `m.` + fieldname + `[len(m.` + fieldname + `)-1]` + buf := `dAtA[iNdEx:postIndex]` + if gogoproto.IsStdTime(field) { + if nullable { + p.P(`if err := `, p.typesPkg.Use(), `.StdTimeUnmarshal(`, varName, `,`, buf, `); err != nil {`) + } else { + p.P(`if err := `, p.typesPkg.Use(), `.StdTimeUnmarshal(&(`, varName, `),`, buf, `); err != nil {`) + } + } else if gogoproto.IsStdDuration(field) { + if nullable { + p.P(`if err := `, p.typesPkg.Use(), `.StdDurationUnmarshal(`, varName, `,`, buf, `); err != nil {`) + } else { + p.P(`if err := `, p.typesPkg.Use(), `.StdDurationUnmarshal(&(`, varName, `),`, buf, `); err != nil {`) + } + } else { + p.P(`if err := `, varName, `.Unmarshal(`, buf, `); err != nil {`) + } + p.In() + p.P(`return err`) + p.Out() + p.P(`}`) + } else if nullable { + p.P(`if m.`, fieldname, ` == nil {`) + p.In() + if gogoproto.IsStdTime(field) { + p.P(`m.`, fieldname, ` = new(time.Time)`) + } else if gogoproto.IsStdDuration(field) { + p.P(`m.`, fieldname, ` = new(time.Duration)`) + } else { + p.P(`m.`, fieldname, ` = &`, msgname, `{}`) + } + p.Out() + p.P(`}`) + if gogoproto.IsStdTime(field) { + p.P(`if err := `, p.typesPkg.Use(), `.StdTimeUnmarshal(m.`, fieldname, `, dAtA[iNdEx:postIndex]); err != nil {`) + } else if gogoproto.IsStdDuration(field) { + p.P(`if err := `, p.typesPkg.Use(), `.StdDurationUnmarshal(m.`, fieldname, `, dAtA[iNdEx:postIndex]); err != nil {`) + } else { + p.P(`if err := m.`, fieldname, `.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {`) + } + p.In() + p.P(`return err`) + p.Out() + p.P(`}`) + } else { + if gogoproto.IsStdTime(field) { + p.P(`if err := `, p.typesPkg.Use(), `.StdTimeUnmarshal(&m.`, fieldname, `, dAtA[iNdEx:postIndex]); err != nil {`) + } else if gogoproto.IsStdDuration(field) { + p.P(`if err := `, p.typesPkg.Use(), `.StdDurationUnmarshal(&m.`, fieldname, `, dAtA[iNdEx:postIndex]); err != nil {`) + } else { + p.P(`if err := m.`, fieldname, `.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {`) + } + p.In() + p.P(`return err`) + p.Out() + p.P(`}`) + } + p.P(`iNdEx = postIndex`) + case descriptor.FieldDescriptorProto_TYPE_BYTES: + p.P(`var byteLen int`) + p.decodeVarint("byteLen", "int") + p.P(`if byteLen < 0 {`) + p.In() + p.P(`return ErrInvalidLength` + p.localName) + p.Out() + p.P(`}`) + p.P(`postIndex := iNdEx + byteLen`) + p.P(`if postIndex > l {`) + p.In() + p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) + p.Out() + p.P(`}`) + if !gogoproto.IsCustomType(field) { + if oneof { + p.P(`v := make([]byte, postIndex-iNdEx)`) + p.P(`copy(v, dAtA[iNdEx:postIndex])`) + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) + } else if repeated { + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, make([]byte, postIndex-iNdEx))`) + p.P(`copy(m.`, fieldname, `[len(m.`, fieldname, `)-1], dAtA[iNdEx:postIndex])`) + } else { + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `[:0] , dAtA[iNdEx:postIndex]...)`) + p.P(`if m.`, fieldname, ` == nil {`) + p.In() + p.P(`m.`, fieldname, ` = []byte{}`) + p.Out() + p.P(`}`) + } + } else { + _, ctyp, err := generator.GetCustomType(field) + if err != nil { + panic(err) + } + if oneof { + p.P(`var vv `, ctyp) + p.P(`v := &vv`) + p.P(`if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {`) + p.In() + p.P(`return err`) + p.Out() + p.P(`}`) + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{*v}`) + } else if repeated { + p.P(`var v `, ctyp) + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) + p.P(`if err := m.`, fieldname, `[len(m.`, fieldname, `)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {`) + p.In() + p.P(`return err`) + p.Out() + p.P(`}`) + } else if nullable { + p.P(`var v `, ctyp) + p.P(`m.`, fieldname, ` = &v`) + p.P(`if err := m.`, fieldname, `.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {`) + p.In() + p.P(`return err`) + p.Out() + p.P(`}`) + } else { + p.P(`if err := m.`, fieldname, `.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {`) + p.In() + p.P(`return err`) + p.Out() + p.P(`}`) + } + } + p.P(`iNdEx = postIndex`) + case descriptor.FieldDescriptorProto_TYPE_UINT32: + if oneof { + p.P(`var v `, typ) + p.decodeVarint("v", typ) + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) + } else if repeated { + p.P(`var v `, typ) + p.decodeVarint("v", typ) + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) + } else if proto3 || !nullable { + p.P(`m.`, fieldname, ` = 0`) + p.decodeVarint("m."+fieldname, typ) + } else { + p.P(`var v `, typ) + p.decodeVarint("v", typ) + p.P(`m.`, fieldname, ` = &v`) + } + case descriptor.FieldDescriptorProto_TYPE_ENUM: + typName := p.TypeName(p.ObjectNamed(field.GetTypeName())) + if oneof { + p.P(`var v `, typName) + p.decodeVarint("v", typName) + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) + } else if repeated { + p.P(`var v `, typName) + p.decodeVarint("v", typName) + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) + } else if proto3 || !nullable { + p.P(`m.`, fieldname, ` = 0`) + p.decodeVarint("m."+fieldname, typName) + } else { + p.P(`var v `, typName) + p.decodeVarint("v", typName) + p.P(`m.`, fieldname, ` = &v`) + } + case descriptor.FieldDescriptorProto_TYPE_SFIXED32: + if !p.unsafe || gogoproto.IsCastType(field) { + if oneof { + p.P(`var v `, typ) + p.decodeFixed32("v", typ) + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) + } else if repeated { + p.P(`var v `, typ) + p.decodeFixed32("v", typ) + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) + } else if proto3 || !nullable { + p.P(`m.`, fieldname, ` = 0`) + p.decodeFixed32("m."+fieldname, typ) + } else { + p.P(`var v `, typ) + p.decodeFixed32("v", typ) + p.P(`m.`, fieldname, ` = &v`) + } + } else { + if oneof { + p.P(`var v int32`) + p.unsafeFixed32("v", "int32") + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) + } else if repeated { + p.P(`var v int32`) + p.unsafeFixed32("v", "int32") + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) + } else if proto3 || !nullable { + p.unsafeFixed32("m."+fieldname, "int32") + } else { + p.P(`var v int32`) + p.unsafeFixed32("v", "int32") + p.P(`m.`, fieldname, ` = &v`) + } + } + case descriptor.FieldDescriptorProto_TYPE_SFIXED64: + if !p.unsafe || gogoproto.IsCastType(field) { + if oneof { + p.P(`var v `, typ) + p.decodeFixed64("v", typ) + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) + } else if repeated { + p.P(`var v `, typ) + p.decodeFixed64("v", typ) + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) + } else if proto3 || !nullable { + p.P(`m.`, fieldname, ` = 0`) + p.decodeFixed64("m."+fieldname, typ) + } else { + p.P(`var v `, typ) + p.decodeFixed64("v", typ) + p.P(`m.`, fieldname, ` = &v`) + } + } else { + if oneof { + p.P(`var v int64`) + p.unsafeFixed64("v", "int64") + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) + } else if repeated { + p.P(`var v int64`) + p.unsafeFixed64("v", "int64") + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) + } else if proto3 || !nullable { + p.unsafeFixed64("m."+fieldname, "int64") + } else { + p.P(`var v int64`) + p.unsafeFixed64("v", "int64") + p.P(`m.`, fieldname, ` = &v`) + } + } + case descriptor.FieldDescriptorProto_TYPE_SINT32: + p.P(`var v `, typ) + p.decodeVarint("v", typ) + p.P(`v = `, typ, `((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31))`) + if oneof { + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) + } else if repeated { + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) + } else if proto3 || !nullable { + p.P(`m.`, fieldname, ` = v`) + } else { + p.P(`m.`, fieldname, ` = &v`) + } + case descriptor.FieldDescriptorProto_TYPE_SINT64: + p.P(`var v uint64`) + p.decodeVarint("v", "uint64") + p.P(`v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63)`) + if oneof { + p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{`, typ, `(v)}`) + } else if repeated { + p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, `, typ, `(v))`) + } else if proto3 || !nullable { + p.P(`m.`, fieldname, ` = `, typ, `(v)`) + } else { + p.P(`v2 := `, typ, `(v)`) + p.P(`m.`, fieldname, ` = &v2`) + } + default: + panic("not implemented") + } +} + +func (p *unmarshal) Generate(file *generator.FileDescriptor) { + proto3 := gogoproto.IsProto3(file.FileDescriptorProto) + p.PluginImports = generator.NewPluginImports(p.Generator) + p.atleastOne = false + p.localName = generator.FileName(file) + if p.unsafe { + p.localName += "Unsafe" + } + + p.ioPkg = p.NewImport("io") + p.mathPkg = p.NewImport("math") + p.unsafePkg = p.NewImport("unsafe") + p.typesPkg = p.NewImport("github.com/gogo/protobuf/types") + fmtPkg := p.NewImport("fmt") + protoPkg := p.NewImport("github.com/gogo/protobuf/proto") + if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { + protoPkg = p.NewImport("github.com/golang/protobuf/proto") + } + + for _, message := range file.Messages() { + ccTypeName := generator.CamelCaseSlice(message.TypeName()) + if p.unsafe { + if !gogoproto.IsUnsafeUnmarshaler(file.FileDescriptorProto, message.DescriptorProto) { + continue + } + if gogoproto.IsUnmarshaler(file.FileDescriptorProto, message.DescriptorProto) { + panic(fmt.Sprintf("unsafe_unmarshaler and unmarshaler enabled for %v", ccTypeName)) + } + } + if !p.unsafe { + if !gogoproto.IsUnmarshaler(file.FileDescriptorProto, message.DescriptorProto) { + continue + } + if gogoproto.IsUnsafeUnmarshaler(file.FileDescriptorProto, message.DescriptorProto) { + panic(fmt.Sprintf("unsafe_unmarshaler and unmarshaler enabled for %v", ccTypeName)) + } + } + if message.DescriptorProto.GetOptions().GetMapEntry() { + continue + } + p.atleastOne = true + + // build a map required field_id -> bitmask offset + rfMap := make(map[int32]uint) + rfNextId := uint(0) + for _, field := range message.Field { + if field.IsRequired() { + rfMap[field.GetNumber()] = rfNextId + rfNextId++ + } + } + rfCount := len(rfMap) + + p.P(`func (m *`, ccTypeName, `) Unmarshal(dAtA []byte) error {`) + p.In() + if rfCount > 0 { + p.P(`var hasFields [`, strconv.Itoa(1+(rfCount-1)/64), `]uint64`) + } + p.P(`l := len(dAtA)`) + p.P(`iNdEx := 0`) + p.P(`for iNdEx < l {`) + p.In() + p.P(`preIndex := iNdEx`) + p.P(`var wire uint64`) + p.decodeVarint("wire", "uint64") + p.P(`fieldNum := int32(wire >> 3)`) + if len(message.Field) > 0 || !message.IsGroup() { + p.P(`wireType := int(wire & 0x7)`) + } + if !message.IsGroup() { + p.P(`if wireType == `, strconv.Itoa(proto.WireEndGroup), ` {`) + p.In() + p.P(`return `, fmtPkg.Use(), `.Errorf("proto: `+message.GetName()+`: wiretype end group for non-group")`) + p.Out() + p.P(`}`) + } + p.P(`if fieldNum <= 0 {`) + p.In() + p.P(`return `, fmtPkg.Use(), `.Errorf("proto: `+message.GetName()+`: illegal tag %d (wire type %d)", fieldNum, wire)`) + p.Out() + p.P(`}`) + p.P(`switch fieldNum {`) + p.In() + for _, field := range message.Field { + fieldname := p.GetFieldName(message, field) + errFieldname := fieldname + if field.OneofIndex != nil { + errFieldname = p.GetOneOfFieldName(message, field) + } + packed := field.IsPacked() || (proto3 && field.IsRepeated() && generator.IsScalar(field)) + p.P(`case `, strconv.Itoa(int(field.GetNumber())), `:`) + p.In() + wireType := field.WireType() + if packed { + p.P(`if wireType == `, strconv.Itoa(proto.WireBytes), `{`) + p.In() + p.P(`var packedLen int`) + p.decodeVarint("packedLen", "int") + p.P(`if packedLen < 0 {`) + p.In() + p.P(`return ErrInvalidLength` + p.localName) + p.Out() + p.P(`}`) + p.P(`postIndex := iNdEx + packedLen`) + p.P(`if postIndex > l {`) + p.In() + p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) + p.Out() + p.P(`}`) + p.P(`for iNdEx < postIndex {`) + p.In() + p.field(file, message, field, fieldname, false) + p.Out() + p.P(`}`) + p.Out() + p.P(`} else if wireType == `, strconv.Itoa(wireType), `{`) + p.In() + p.field(file, message, field, fieldname, false) + p.Out() + p.P(`} else {`) + p.In() + p.P(`return ` + fmtPkg.Use() + `.Errorf("proto: wrong wireType = %d for field ` + errFieldname + `", wireType)`) + p.Out() + p.P(`}`) + } else { + p.P(`if wireType != `, strconv.Itoa(wireType), `{`) + p.In() + p.P(`return ` + fmtPkg.Use() + `.Errorf("proto: wrong wireType = %d for field ` + errFieldname + `", wireType)`) + p.Out() + p.P(`}`) + p.field(file, message, field, fieldname, proto3) + } + + if field.IsRequired() { + fieldBit, ok := rfMap[field.GetNumber()] + if !ok { + panic("field is required, but no bit registered") + } + p.P(`hasFields[`, strconv.Itoa(int(fieldBit/64)), `] |= uint64(`, fmt.Sprintf("0x%08x", 1<<(fieldBit%64)), `)`) + } + } + p.Out() + p.P(`default:`) + p.In() + if message.DescriptorProto.HasExtension() { + c := []string{} + for _, erange := range message.GetExtensionRange() { + c = append(c, `((fieldNum >= `+strconv.Itoa(int(erange.GetStart()))+") && (fieldNum<"+strconv.Itoa(int(erange.GetEnd()))+`))`) + } + p.P(`if `, strings.Join(c, "||"), `{`) + p.In() + p.P(`var sizeOfWire int`) + p.P(`for {`) + p.In() + p.P(`sizeOfWire++`) + p.P(`wire >>= 7`) + p.P(`if wire == 0 {`) + p.In() + p.P(`break`) + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + p.P(`iNdEx-=sizeOfWire`) + p.P(`skippy, err := skip`, p.localName+`(dAtA[iNdEx:])`) + p.P(`if err != nil {`) + p.In() + p.P(`return err`) + p.Out() + p.P(`}`) + p.P(`if skippy < 0 {`) + p.In() + p.P(`return ErrInvalidLength`, p.localName) + p.Out() + p.P(`}`) + p.P(`if (iNdEx + skippy) > l {`) + p.In() + p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) + p.Out() + p.P(`}`) + p.P(protoPkg.Use(), `.AppendExtension(m, int32(fieldNum), dAtA[iNdEx:iNdEx+skippy])`) + p.P(`iNdEx += skippy`) + p.Out() + p.P(`} else {`) + p.In() + } + p.P(`iNdEx=preIndex`) + p.P(`skippy, err := skip`, p.localName, `(dAtA[iNdEx:])`) + p.P(`if err != nil {`) + p.In() + p.P(`return err`) + p.Out() + p.P(`}`) + p.P(`if skippy < 0 {`) + p.In() + p.P(`return ErrInvalidLength`, p.localName) + p.Out() + p.P(`}`) + p.P(`if (iNdEx + skippy) > l {`) + p.In() + p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) + p.Out() + p.P(`}`) + if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) { + p.P(`m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)`) + } + p.P(`iNdEx += skippy`) + p.Out() + if message.DescriptorProto.HasExtension() { + p.Out() + p.P(`}`) + } + p.Out() + p.P(`}`) + p.Out() + p.P(`}`) + + for _, field := range message.Field { + if !field.IsRequired() { + continue + } + + fieldBit, ok := rfMap[field.GetNumber()] + if !ok { + panic("field is required, but no bit registered") + } + + p.P(`if hasFields[`, strconv.Itoa(int(fieldBit/64)), `] & uint64(`, fmt.Sprintf("0x%08x", 1<<(fieldBit%64)), `) == 0 {`) + p.In() + if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { + p.P(`return new(`, protoPkg.Use(), `.RequiredNotSetError)`) + } else { + p.P(`return `, protoPkg.Use(), `.NewRequiredNotSetError("`, field.GetName(), `")`) + } + p.Out() + p.P(`}`) + } + p.P() + p.P(`if iNdEx > l {`) + p.In() + p.P(`return ` + p.ioPkg.Use() + `.ErrUnexpectedEOF`) + p.Out() + p.P(`}`) + p.P(`return nil`) + p.Out() + p.P(`}`) + } + if !p.atleastOne { + return + } + + p.P(`func skip` + p.localName + `(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow` + p.localName + ` + } + if iNdEx >= l { + return 0, ` + p.ioPkg.Use() + `.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow` + p.localName + ` + } + if iNdEx >= l { + return 0, ` + p.ioPkg.Use() + `.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow` + p.localName + ` + } + if iNdEx >= l { + return 0, ` + p.ioPkg.Use() + `.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLength` + p.localName + ` + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflow` + p.localName + ` + } + if iNdEx >= l { + return 0, ` + p.ioPkg.Use() + `.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skip` + p.localName + `(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, ` + fmtPkg.Use() + `.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") + } + + var ( + ErrInvalidLength` + p.localName + ` = ` + fmtPkg.Use() + `.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflow` + p.localName + ` = ` + fmtPkg.Use() + `.Errorf("proto: integer overflow") + ) + `) +} + +func init() { + generator.RegisterPlugin(NewUnmarshal()) + generator.RegisterPlugin(NewUnsafeUnmarshal()) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/clone.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/clone.go new file mode 100644 index 00000000000..5d4cba4b51c --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/clone.go @@ -0,0 +1,234 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2011 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +// Protocol buffer deep copy and merge. +// TODO: RawMessage. + +package proto + +import ( + "log" + "reflect" + "strings" +) + +// Clone returns a deep copy of a protocol buffer. +func Clone(pb Message) Message { + in := reflect.ValueOf(pb) + if in.IsNil() { + return pb + } + + out := reflect.New(in.Type().Elem()) + // out is empty so a merge is a deep copy. + mergeStruct(out.Elem(), in.Elem()) + return out.Interface().(Message) +} + +// Merge merges src into dst. +// Required and optional fields that are set in src will be set to that value in dst. +// Elements of repeated fields will be appended. +// Merge panics if src and dst are not the same type, or if dst is nil. +func Merge(dst, src Message) { + in := reflect.ValueOf(src) + out := reflect.ValueOf(dst) + if out.IsNil() { + panic("proto: nil destination") + } + if in.Type() != out.Type() { + // Explicit test prior to mergeStruct so that mistyped nils will fail + panic("proto: type mismatch") + } + if in.IsNil() { + // Merging nil into non-nil is a quiet no-op + return + } + mergeStruct(out.Elem(), in.Elem()) +} + +func mergeStruct(out, in reflect.Value) { + sprop := GetProperties(in.Type()) + for i := 0; i < in.NumField(); i++ { + f := in.Type().Field(i) + if strings.HasPrefix(f.Name, "XXX_") { + continue + } + mergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i]) + } + + if emIn, ok := in.Addr().Interface().(extensionsBytes); ok { + emOut := out.Addr().Interface().(extensionsBytes) + bIn := emIn.GetExtensions() + bOut := emOut.GetExtensions() + *bOut = append(*bOut, *bIn...) + } else if emIn, ok := extendable(in.Addr().Interface()); ok { + emOut, _ := extendable(out.Addr().Interface()) + mIn, muIn := emIn.extensionsRead() + if mIn != nil { + mOut := emOut.extensionsWrite() + muIn.Lock() + mergeExtension(mOut, mIn) + muIn.Unlock() + } + } + + uf := in.FieldByName("XXX_unrecognized") + if !uf.IsValid() { + return + } + uin := uf.Bytes() + if len(uin) > 0 { + out.FieldByName("XXX_unrecognized").SetBytes(append([]byte(nil), uin...)) + } +} + +// mergeAny performs a merge between two values of the same type. +// viaPtr indicates whether the values were indirected through a pointer (implying proto2). +// prop is set if this is a struct field (it may be nil). +func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) { + if in.Type() == protoMessageType { + if !in.IsNil() { + if out.IsNil() { + out.Set(reflect.ValueOf(Clone(in.Interface().(Message)))) + } else { + Merge(out.Interface().(Message), in.Interface().(Message)) + } + } + return + } + switch in.Kind() { + case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, + reflect.String, reflect.Uint32, reflect.Uint64: + if !viaPtr && isProto3Zero(in) { + return + } + out.Set(in) + case reflect.Interface: + // Probably a oneof field; copy non-nil values. + if in.IsNil() { + return + } + // Allocate destination if it is not set, or set to a different type. + // Otherwise we will merge as normal. + if out.IsNil() || out.Elem().Type() != in.Elem().Type() { + out.Set(reflect.New(in.Elem().Elem().Type())) // interface -> *T -> T -> new(T) + } + mergeAny(out.Elem(), in.Elem(), false, nil) + case reflect.Map: + if in.Len() == 0 { + return + } + if out.IsNil() { + out.Set(reflect.MakeMap(in.Type())) + } + // For maps with value types of *T or []byte we need to deep copy each value. + elemKind := in.Type().Elem().Kind() + for _, key := range in.MapKeys() { + var val reflect.Value + switch elemKind { + case reflect.Ptr: + val = reflect.New(in.Type().Elem().Elem()) + mergeAny(val, in.MapIndex(key), false, nil) + case reflect.Slice: + val = in.MapIndex(key) + val = reflect.ValueOf(append([]byte{}, val.Bytes()...)) + default: + val = in.MapIndex(key) + } + out.SetMapIndex(key, val) + } + case reflect.Ptr: + if in.IsNil() { + return + } + if out.IsNil() { + out.Set(reflect.New(in.Elem().Type())) + } + mergeAny(out.Elem(), in.Elem(), true, nil) + case reflect.Slice: + if in.IsNil() { + return + } + if in.Type().Elem().Kind() == reflect.Uint8 { + // []byte is a scalar bytes field, not a repeated field. + + // Edge case: if this is in a proto3 message, a zero length + // bytes field is considered the zero value, and should not + // be merged. + if prop != nil && prop.proto3 && in.Len() == 0 { + return + } + + // Make a deep copy. + // Append to []byte{} instead of []byte(nil) so that we never end up + // with a nil result. + out.SetBytes(append([]byte{}, in.Bytes()...)) + return + } + n := in.Len() + if out.IsNil() { + out.Set(reflect.MakeSlice(in.Type(), 0, n)) + } + switch in.Type().Elem().Kind() { + case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, + reflect.String, reflect.Uint32, reflect.Uint64: + out.Set(reflect.AppendSlice(out, in)) + default: + for i := 0; i < n; i++ { + x := reflect.Indirect(reflect.New(in.Type().Elem())) + mergeAny(x, in.Index(i), false, nil) + out.Set(reflect.Append(out, x)) + } + } + case reflect.Struct: + mergeStruct(out, in) + default: + // unknown type, so not a protocol buffer + log.Printf("proto: don't know how to copy %v", in) + } +} + +func mergeExtension(out, in map[int32]Extension) { + for extNum, eIn := range in { + eOut := Extension{desc: eIn.desc} + if eIn.value != nil { + v := reflect.New(reflect.TypeOf(eIn.value)).Elem() + mergeAny(v, reflect.ValueOf(eIn.value), false, nil) + eOut.value = v.Interface() + } + if eIn.enc != nil { + eOut.enc = make([]byte, len(eIn.enc)) + copy(eOut.enc, eIn.enc) + } + + out[extNum] = eOut + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/decode.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/decode.go new file mode 100644 index 00000000000..737f2731d45 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/decode.go @@ -0,0 +1,978 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +package proto + +/* + * Routines for decoding protocol buffer data to construct in-memory representations. + */ + +import ( + "errors" + "fmt" + "io" + "os" + "reflect" +) + +// errOverflow is returned when an integer is too large to be represented. +var errOverflow = errors.New("proto: integer overflow") + +// ErrInternalBadWireType is returned by generated code when an incorrect +// wire type is encountered. It does not get returned to user code. +var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof") + +// The fundamental decoders that interpret bytes on the wire. +// Those that take integer types all return uint64 and are +// therefore of type valueDecoder. + +// DecodeVarint reads a varint-encoded integer from the slice. +// It returns the integer and the number of bytes consumed, or +// zero if there is not enough. +// This is the format for the +// int32, int64, uint32, uint64, bool, and enum +// protocol buffer types. +func DecodeVarint(buf []byte) (x uint64, n int) { + for shift := uint(0); shift < 64; shift += 7 { + if n >= len(buf) { + return 0, 0 + } + b := uint64(buf[n]) + n++ + x |= (b & 0x7F) << shift + if (b & 0x80) == 0 { + return x, n + } + } + + // The number is too large to represent in a 64-bit value. + return 0, 0 +} + +func (p *Buffer) decodeVarintSlow() (x uint64, err error) { + i := p.index + l := len(p.buf) + + for shift := uint(0); shift < 64; shift += 7 { + if i >= l { + err = io.ErrUnexpectedEOF + return + } + b := p.buf[i] + i++ + x |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + p.index = i + return + } + } + + // The number is too large to represent in a 64-bit value. + err = errOverflow + return +} + +// DecodeVarint reads a varint-encoded integer from the Buffer. +// This is the format for the +// int32, int64, uint32, uint64, bool, and enum +// protocol buffer types. +func (p *Buffer) DecodeVarint() (x uint64, err error) { + i := p.index + buf := p.buf + + if i >= len(buf) { + return 0, io.ErrUnexpectedEOF + } else if buf[i] < 0x80 { + p.index++ + return uint64(buf[i]), nil + } else if len(buf)-i < 10 { + return p.decodeVarintSlow() + } + + var b uint64 + // we already checked the first byte + x = uint64(buf[i]) - 0x80 + i++ + + b = uint64(buf[i]) + i++ + x += b << 7 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 7 + + b = uint64(buf[i]) + i++ + x += b << 14 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 14 + + b = uint64(buf[i]) + i++ + x += b << 21 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 21 + + b = uint64(buf[i]) + i++ + x += b << 28 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 28 + + b = uint64(buf[i]) + i++ + x += b << 35 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 35 + + b = uint64(buf[i]) + i++ + x += b << 42 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 42 + + b = uint64(buf[i]) + i++ + x += b << 49 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 49 + + b = uint64(buf[i]) + i++ + x += b << 56 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 56 + + b = uint64(buf[i]) + i++ + x += b << 63 + if b&0x80 == 0 { + goto done + } + // x -= 0x80 << 63 // Always zero. + + return 0, errOverflow + +done: + p.index = i + return x, nil +} + +// DecodeFixed64 reads a 64-bit integer from the Buffer. +// This is the format for the +// fixed64, sfixed64, and double protocol buffer types. +func (p *Buffer) DecodeFixed64() (x uint64, err error) { + // x, err already 0 + i := p.index + 8 + if i < 0 || i > len(p.buf) { + err = io.ErrUnexpectedEOF + return + } + p.index = i + + x = uint64(p.buf[i-8]) + x |= uint64(p.buf[i-7]) << 8 + x |= uint64(p.buf[i-6]) << 16 + x |= uint64(p.buf[i-5]) << 24 + x |= uint64(p.buf[i-4]) << 32 + x |= uint64(p.buf[i-3]) << 40 + x |= uint64(p.buf[i-2]) << 48 + x |= uint64(p.buf[i-1]) << 56 + return +} + +// DecodeFixed32 reads a 32-bit integer from the Buffer. +// This is the format for the +// fixed32, sfixed32, and float protocol buffer types. +func (p *Buffer) DecodeFixed32() (x uint64, err error) { + // x, err already 0 + i := p.index + 4 + if i < 0 || i > len(p.buf) { + err = io.ErrUnexpectedEOF + return + } + p.index = i + + x = uint64(p.buf[i-4]) + x |= uint64(p.buf[i-3]) << 8 + x |= uint64(p.buf[i-2]) << 16 + x |= uint64(p.buf[i-1]) << 24 + return +} + +// DecodeZigzag64 reads a zigzag-encoded 64-bit integer +// from the Buffer. +// This is the format used for the sint64 protocol buffer type. +func (p *Buffer) DecodeZigzag64() (x uint64, err error) { + x, err = p.DecodeVarint() + if err != nil { + return + } + x = (x >> 1) ^ uint64((int64(x&1)<<63)>>63) + return +} + +// DecodeZigzag32 reads a zigzag-encoded 32-bit integer +// from the Buffer. +// This is the format used for the sint32 protocol buffer type. +func (p *Buffer) DecodeZigzag32() (x uint64, err error) { + x, err = p.DecodeVarint() + if err != nil { + return + } + x = uint64((uint32(x) >> 1) ^ uint32((int32(x&1)<<31)>>31)) + return +} + +// These are not ValueDecoders: they produce an array of bytes or a string. +// bytes, embedded messages + +// DecodeRawBytes reads a count-delimited byte buffer from the Buffer. +// This is the format used for the bytes protocol buffer +// type and for embedded messages. +func (p *Buffer) DecodeRawBytes(alloc bool) (buf []byte, err error) { + n, err := p.DecodeVarint() + if err != nil { + return nil, err + } + + nb := int(n) + if nb < 0 { + return nil, fmt.Errorf("proto: bad byte length %d", nb) + } + end := p.index + nb + if end < p.index || end > len(p.buf) { + return nil, io.ErrUnexpectedEOF + } + + if !alloc { + // todo: check if can get more uses of alloc=false + buf = p.buf[p.index:end] + p.index += nb + return + } + + buf = make([]byte, nb) + copy(buf, p.buf[p.index:]) + p.index += nb + return +} + +// DecodeStringBytes reads an encoded string from the Buffer. +// This is the format used for the proto2 string type. +func (p *Buffer) DecodeStringBytes() (s string, err error) { + buf, err := p.DecodeRawBytes(false) + if err != nil { + return + } + return string(buf), nil +} + +// Skip the next item in the buffer. Its wire type is decoded and presented as an argument. +// If the protocol buffer has extensions, and the field matches, add it as an extension. +// Otherwise, if the XXX_unrecognized field exists, append the skipped data there. +func (o *Buffer) skipAndSave(t reflect.Type, tag, wire int, base structPointer, unrecField field) error { + oi := o.index + + err := o.skip(t, tag, wire) + if err != nil { + return err + } + + if !unrecField.IsValid() { + return nil + } + + ptr := structPointer_Bytes(base, unrecField) + + // Add the skipped field to struct field + obuf := o.buf + + o.buf = *ptr + o.EncodeVarint(uint64(tag<<3 | wire)) + *ptr = append(o.buf, obuf[oi:o.index]...) + + o.buf = obuf + + return nil +} + +// Skip the next item in the buffer. Its wire type is decoded and presented as an argument. +func (o *Buffer) skip(t reflect.Type, tag, wire int) error { + + var u uint64 + var err error + + switch wire { + case WireVarint: + _, err = o.DecodeVarint() + case WireFixed64: + _, err = o.DecodeFixed64() + case WireBytes: + _, err = o.DecodeRawBytes(false) + case WireFixed32: + _, err = o.DecodeFixed32() + case WireStartGroup: + for { + u, err = o.DecodeVarint() + if err != nil { + break + } + fwire := int(u & 0x7) + if fwire == WireEndGroup { + break + } + ftag := int(u >> 3) + err = o.skip(t, ftag, fwire) + if err != nil { + break + } + } + default: + err = fmt.Errorf("proto: can't skip unknown wire type %d for %s", wire, t) + } + return err +} + +// Unmarshaler is the interface representing objects that can +// unmarshal themselves. The method should reset the receiver before +// decoding starts. The argument points to data that may be +// overwritten, so implementations should not keep references to the +// buffer. +type Unmarshaler interface { + Unmarshal([]byte) error +} + +// Unmarshal parses the protocol buffer representation in buf and places the +// decoded result in pb. If the struct underlying pb does not match +// the data in buf, the results can be unpredictable. +// +// Unmarshal resets pb before starting to unmarshal, so any +// existing data in pb is always removed. Use UnmarshalMerge +// to preserve and append to existing data. +func Unmarshal(buf []byte, pb Message) error { + pb.Reset() + return UnmarshalMerge(buf, pb) +} + +// UnmarshalMerge parses the protocol buffer representation in buf and +// writes the decoded result to pb. If the struct underlying pb does not match +// the data in buf, the results can be unpredictable. +// +// UnmarshalMerge merges into existing data in pb. +// Most code should use Unmarshal instead. +func UnmarshalMerge(buf []byte, pb Message) error { + // If the object can unmarshal itself, let it. + if u, ok := pb.(Unmarshaler); ok { + return u.Unmarshal(buf) + } + return NewBuffer(buf).Unmarshal(pb) +} + +// DecodeMessage reads a count-delimited message from the Buffer. +func (p *Buffer) DecodeMessage(pb Message) error { + enc, err := p.DecodeRawBytes(false) + if err != nil { + return err + } + return NewBuffer(enc).Unmarshal(pb) +} + +// DecodeGroup reads a tag-delimited group from the Buffer. +func (p *Buffer) DecodeGroup(pb Message) error { + typ, base, err := getbase(pb) + if err != nil { + return err + } + return p.unmarshalType(typ.Elem(), GetProperties(typ.Elem()), true, base) +} + +// Unmarshal parses the protocol buffer representation in the +// Buffer and places the decoded result in pb. If the struct +// underlying pb does not match the data in the buffer, the results can be +// unpredictable. +// +// Unlike proto.Unmarshal, this does not reset pb before starting to unmarshal. +func (p *Buffer) Unmarshal(pb Message) error { + // If the object can unmarshal itself, let it. + if u, ok := pb.(Unmarshaler); ok { + err := u.Unmarshal(p.buf[p.index:]) + p.index = len(p.buf) + return err + } + + typ, base, err := getbase(pb) + if err != nil { + return err + } + + err = p.unmarshalType(typ.Elem(), GetProperties(typ.Elem()), false, base) + + if collectStats { + stats.Decode++ + } + + return err +} + +// unmarshalType does the work of unmarshaling a structure. +func (o *Buffer) unmarshalType(st reflect.Type, prop *StructProperties, is_group bool, base structPointer) error { + var state errorState + required, reqFields := prop.reqCount, uint64(0) + + var err error + for err == nil && o.index < len(o.buf) { + oi := o.index + var u uint64 + u, err = o.DecodeVarint() + if err != nil { + break + } + wire := int(u & 0x7) + if wire == WireEndGroup { + if is_group { + if required > 0 { + // Not enough information to determine the exact field. + // (See below.) + return &RequiredNotSetError{"{Unknown}"} + } + return nil // input is satisfied + } + return fmt.Errorf("proto: %s: wiretype end group for non-group", st) + } + tag := int(u >> 3) + if tag <= 0 { + return fmt.Errorf("proto: %s: illegal tag %d (wire type %d)", st, tag, wire) + } + fieldnum, ok := prop.decoderTags.get(tag) + if !ok { + // Maybe it's an extension? + if prop.extendable { + if e, eok := structPointer_Interface(base, st).(extensionsBytes); eok { + if isExtensionField(e, int32(tag)) { + if err = o.skip(st, tag, wire); err == nil { + ext := e.GetExtensions() + *ext = append(*ext, o.buf[oi:o.index]...) + } + continue + } + } else if e, _ := extendable(structPointer_Interface(base, st)); isExtensionField(e, int32(tag)) { + if err = o.skip(st, tag, wire); err == nil { + extmap := e.extensionsWrite() + ext := extmap[int32(tag)] // may be missing + ext.enc = append(ext.enc, o.buf[oi:o.index]...) + extmap[int32(tag)] = ext + } + continue + } + } + // Maybe it's a oneof? + if prop.oneofUnmarshaler != nil { + m := structPointer_Interface(base, st).(Message) + // First return value indicates whether tag is a oneof field. + ok, err = prop.oneofUnmarshaler(m, tag, wire, o) + if err == ErrInternalBadWireType { + // Map the error to something more descriptive. + // Do the formatting here to save generated code space. + err = fmt.Errorf("bad wiretype for oneof field in %T", m) + } + if ok { + continue + } + } + err = o.skipAndSave(st, tag, wire, base, prop.unrecField) + continue + } + p := prop.Prop[fieldnum] + + if p.dec == nil { + fmt.Fprintf(os.Stderr, "proto: no protobuf decoder for %s.%s\n", st, st.Field(fieldnum).Name) + continue + } + dec := p.dec + if wire != WireStartGroup && wire != p.WireType { + if wire == WireBytes && p.packedDec != nil { + // a packable field + dec = p.packedDec + } else { + err = fmt.Errorf("proto: bad wiretype for field %s.%s: got wiretype %d, want %d", st, st.Field(fieldnum).Name, wire, p.WireType) + continue + } + } + decErr := dec(o, p, base) + if decErr != nil && !state.shouldContinue(decErr, p) { + err = decErr + } + if err == nil && p.Required { + // Successfully decoded a required field. + if tag <= 64 { + // use bitmap for fields 1-64 to catch field reuse. + var mask uint64 = 1 << uint64(tag-1) + if reqFields&mask == 0 { + // new required field + reqFields |= mask + required-- + } + } else { + // This is imprecise. It can be fooled by a required field + // with a tag > 64 that is encoded twice; that's very rare. + // A fully correct implementation would require allocating + // a data structure, which we would like to avoid. + required-- + } + } + } + if err == nil { + if is_group { + return io.ErrUnexpectedEOF + } + if state.err != nil { + return state.err + } + if required > 0 { + // Not enough information to determine the exact field. If we use extra + // CPU, we could determine the field only if the missing required field + // has a tag <= 64 and we check reqFields. + return &RequiredNotSetError{"{Unknown}"} + } + } + return err +} + +// Individual type decoders +// For each, +// u is the decoded value, +// v is a pointer to the field (pointer) in the struct + +// Sizes of the pools to allocate inside the Buffer. +// The goal is modest amortization and allocation +// on at least 16-byte boundaries. +const ( + boolPoolSize = 16 + uint32PoolSize = 8 + uint64PoolSize = 4 +) + +// Decode a bool. +func (o *Buffer) dec_bool(p *Properties, base structPointer) error { + u, err := p.valDec(o) + if err != nil { + return err + } + if len(o.bools) == 0 { + o.bools = make([]bool, boolPoolSize) + } + o.bools[0] = u != 0 + *structPointer_Bool(base, p.field) = &o.bools[0] + o.bools = o.bools[1:] + return nil +} + +func (o *Buffer) dec_proto3_bool(p *Properties, base structPointer) error { + u, err := p.valDec(o) + if err != nil { + return err + } + *structPointer_BoolVal(base, p.field) = u != 0 + return nil +} + +// Decode an int32. +func (o *Buffer) dec_int32(p *Properties, base structPointer) error { + u, err := p.valDec(o) + if err != nil { + return err + } + word32_Set(structPointer_Word32(base, p.field), o, uint32(u)) + return nil +} + +func (o *Buffer) dec_proto3_int32(p *Properties, base structPointer) error { + u, err := p.valDec(o) + if err != nil { + return err + } + word32Val_Set(structPointer_Word32Val(base, p.field), uint32(u)) + return nil +} + +// Decode an int64. +func (o *Buffer) dec_int64(p *Properties, base structPointer) error { + u, err := p.valDec(o) + if err != nil { + return err + } + word64_Set(structPointer_Word64(base, p.field), o, u) + return nil +} + +func (o *Buffer) dec_proto3_int64(p *Properties, base structPointer) error { + u, err := p.valDec(o) + if err != nil { + return err + } + word64Val_Set(structPointer_Word64Val(base, p.field), o, u) + return nil +} + +// Decode a string. +func (o *Buffer) dec_string(p *Properties, base structPointer) error { + s, err := o.DecodeStringBytes() + if err != nil { + return err + } + *structPointer_String(base, p.field) = &s + return nil +} + +func (o *Buffer) dec_proto3_string(p *Properties, base structPointer) error { + s, err := o.DecodeStringBytes() + if err != nil { + return err + } + *structPointer_StringVal(base, p.field) = s + return nil +} + +// Decode a slice of bytes ([]byte). +func (o *Buffer) dec_slice_byte(p *Properties, base structPointer) error { + b, err := o.DecodeRawBytes(true) + if err != nil { + return err + } + *structPointer_Bytes(base, p.field) = b + return nil +} + +// Decode a slice of bools ([]bool). +func (o *Buffer) dec_slice_bool(p *Properties, base structPointer) error { + u, err := p.valDec(o) + if err != nil { + return err + } + v := structPointer_BoolSlice(base, p.field) + *v = append(*v, u != 0) + return nil +} + +// Decode a slice of bools ([]bool) in packed format. +func (o *Buffer) dec_slice_packed_bool(p *Properties, base structPointer) error { + v := structPointer_BoolSlice(base, p.field) + + nn, err := o.DecodeVarint() + if err != nil { + return err + } + nb := int(nn) // number of bytes of encoded bools + fin := o.index + nb + if fin < o.index { + return errOverflow + } + + y := *v + for o.index < fin { + u, err := p.valDec(o) + if err != nil { + return err + } + y = append(y, u != 0) + } + + *v = y + return nil +} + +// Decode a slice of int32s ([]int32). +func (o *Buffer) dec_slice_int32(p *Properties, base structPointer) error { + u, err := p.valDec(o) + if err != nil { + return err + } + structPointer_Word32Slice(base, p.field).Append(uint32(u)) + return nil +} + +// Decode a slice of int32s ([]int32) in packed format. +func (o *Buffer) dec_slice_packed_int32(p *Properties, base structPointer) error { + v := structPointer_Word32Slice(base, p.field) + + nn, err := o.DecodeVarint() + if err != nil { + return err + } + nb := int(nn) // number of bytes of encoded int32s + + fin := o.index + nb + if fin < o.index { + return errOverflow + } + for o.index < fin { + u, err := p.valDec(o) + if err != nil { + return err + } + v.Append(uint32(u)) + } + return nil +} + +// Decode a slice of int64s ([]int64). +func (o *Buffer) dec_slice_int64(p *Properties, base structPointer) error { + u, err := p.valDec(o) + if err != nil { + return err + } + + structPointer_Word64Slice(base, p.field).Append(u) + return nil +} + +// Decode a slice of int64s ([]int64) in packed format. +func (o *Buffer) dec_slice_packed_int64(p *Properties, base structPointer) error { + v := structPointer_Word64Slice(base, p.field) + + nn, err := o.DecodeVarint() + if err != nil { + return err + } + nb := int(nn) // number of bytes of encoded int64s + + fin := o.index + nb + if fin < o.index { + return errOverflow + } + for o.index < fin { + u, err := p.valDec(o) + if err != nil { + return err + } + v.Append(u) + } + return nil +} + +// Decode a slice of strings ([]string). +func (o *Buffer) dec_slice_string(p *Properties, base structPointer) error { + s, err := o.DecodeStringBytes() + if err != nil { + return err + } + v := structPointer_StringSlice(base, p.field) + *v = append(*v, s) + return nil +} + +// Decode a slice of slice of bytes ([][]byte). +func (o *Buffer) dec_slice_slice_byte(p *Properties, base structPointer) error { + b, err := o.DecodeRawBytes(true) + if err != nil { + return err + } + v := structPointer_BytesSlice(base, p.field) + *v = append(*v, b) + return nil +} + +// Decode a map field. +func (o *Buffer) dec_new_map(p *Properties, base structPointer) error { + raw, err := o.DecodeRawBytes(false) + if err != nil { + return err + } + oi := o.index // index at the end of this map entry + o.index -= len(raw) // move buffer back to start of map entry + + mptr := structPointer_NewAt(base, p.field, p.mtype) // *map[K]V + if mptr.Elem().IsNil() { + mptr.Elem().Set(reflect.MakeMap(mptr.Type().Elem())) + } + v := mptr.Elem() // map[K]V + + // Prepare addressable doubly-indirect placeholders for the key and value types. + // See enc_new_map for why. + keyptr := reflect.New(reflect.PtrTo(p.mtype.Key())).Elem() // addressable *K + keybase := toStructPointer(keyptr.Addr()) // **K + + var valbase structPointer + var valptr reflect.Value + switch p.mtype.Elem().Kind() { + case reflect.Slice: + // []byte + var dummy []byte + valptr = reflect.ValueOf(&dummy) // *[]byte + valbase = toStructPointer(valptr) // *[]byte + case reflect.Ptr: + // message; valptr is **Msg; need to allocate the intermediate pointer + valptr = reflect.New(reflect.PtrTo(p.mtype.Elem())).Elem() // addressable *V + valptr.Set(reflect.New(valptr.Type().Elem())) + valbase = toStructPointer(valptr) + default: + // everything else + valptr = reflect.New(reflect.PtrTo(p.mtype.Elem())).Elem() // addressable *V + valbase = toStructPointer(valptr.Addr()) // **V + } + + // Decode. + // This parses a restricted wire format, namely the encoding of a message + // with two fields. See enc_new_map for the format. + for o.index < oi { + // tagcode for key and value properties are always a single byte + // because they have tags 1 and 2. + tagcode := o.buf[o.index] + o.index++ + switch tagcode { + case p.mkeyprop.tagcode[0]: + if err := p.mkeyprop.dec(o, p.mkeyprop, keybase); err != nil { + return err + } + case p.mvalprop.tagcode[0]: + if err := p.mvalprop.dec(o, p.mvalprop, valbase); err != nil { + return err + } + default: + // TODO: Should we silently skip this instead? + return fmt.Errorf("proto: bad map data tag %d", raw[0]) + } + } + keyelem, valelem := keyptr.Elem(), valptr.Elem() + if !keyelem.IsValid() { + keyelem = reflect.Zero(p.mtype.Key()) + } + if !valelem.IsValid() { + valelem = reflect.Zero(p.mtype.Elem()) + } + + v.SetMapIndex(keyelem, valelem) + return nil +} + +// Decode a group. +func (o *Buffer) dec_struct_group(p *Properties, base structPointer) error { + bas := structPointer_GetStructPointer(base, p.field) + if structPointer_IsNil(bas) { + // allocate new nested message + bas = toStructPointer(reflect.New(p.stype)) + structPointer_SetStructPointer(base, p.field, bas) + } + return o.unmarshalType(p.stype, p.sprop, true, bas) +} + +// Decode an embedded message. +func (o *Buffer) dec_struct_message(p *Properties, base structPointer) (err error) { + raw, e := o.DecodeRawBytes(false) + if e != nil { + return e + } + + bas := structPointer_GetStructPointer(base, p.field) + if structPointer_IsNil(bas) { + // allocate new nested message + bas = toStructPointer(reflect.New(p.stype)) + structPointer_SetStructPointer(base, p.field, bas) + } + + // If the object can unmarshal itself, let it. + if p.isUnmarshaler { + iv := structPointer_Interface(bas, p.stype) + return iv.(Unmarshaler).Unmarshal(raw) + } + + obuf := o.buf + oi := o.index + o.buf = raw + o.index = 0 + + err = o.unmarshalType(p.stype, p.sprop, false, bas) + o.buf = obuf + o.index = oi + + return err +} + +// Decode a slice of embedded messages. +func (o *Buffer) dec_slice_struct_message(p *Properties, base structPointer) error { + return o.dec_slice_struct(p, false, base) +} + +// Decode a slice of embedded groups. +func (o *Buffer) dec_slice_struct_group(p *Properties, base structPointer) error { + return o.dec_slice_struct(p, true, base) +} + +// Decode a slice of structs ([]*struct). +func (o *Buffer) dec_slice_struct(p *Properties, is_group bool, base structPointer) error { + v := reflect.New(p.stype) + bas := toStructPointer(v) + structPointer_StructPointerSlice(base, p.field).Append(bas) + + if is_group { + err := o.unmarshalType(p.stype, p.sprop, is_group, bas) + return err + } + + raw, err := o.DecodeRawBytes(false) + if err != nil { + return err + } + + // If the object can unmarshal itself, let it. + if p.isUnmarshaler { + iv := v.Interface() + return iv.(Unmarshaler).Unmarshal(raw) + } + + obuf := o.buf + oi := o.index + o.buf = raw + o.index = 0 + + err = o.unmarshalType(p.stype, p.sprop, is_group, bas) + + o.buf = obuf + o.index = oi + + return err +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/decode_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/decode_gogo.go new file mode 100644 index 00000000000..6fb74de4cc9 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/decode_gogo.go @@ -0,0 +1,172 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package proto + +import ( + "reflect" +) + +// Decode a reference to a struct pointer. +func (o *Buffer) dec_ref_struct_message(p *Properties, base structPointer) (err error) { + raw, e := o.DecodeRawBytes(false) + if e != nil { + return e + } + + // If the object can unmarshal itself, let it. + if p.isUnmarshaler { + panic("not supported, since this is a pointer receiver") + } + + obuf := o.buf + oi := o.index + o.buf = raw + o.index = 0 + + bas := structPointer_FieldPointer(base, p.field) + + err = o.unmarshalType(p.stype, p.sprop, false, bas) + o.buf = obuf + o.index = oi + + return err +} + +// Decode a slice of references to struct pointers ([]struct). +func (o *Buffer) dec_slice_ref_struct(p *Properties, is_group bool, base structPointer) error { + newBas := appendStructPointer(base, p.field, p.sstype) + + if is_group { + panic("not supported, maybe in future, if requested.") + } + + raw, err := o.DecodeRawBytes(false) + if err != nil { + return err + } + + // If the object can unmarshal itself, let it. + if p.isUnmarshaler { + panic("not supported, since this is not a pointer receiver.") + } + + obuf := o.buf + oi := o.index + o.buf = raw + o.index = 0 + + err = o.unmarshalType(p.stype, p.sprop, is_group, newBas) + + o.buf = obuf + o.index = oi + + return err +} + +// Decode a slice of references to struct pointers. +func (o *Buffer) dec_slice_ref_struct_message(p *Properties, base structPointer) error { + return o.dec_slice_ref_struct(p, false, base) +} + +func setPtrCustomType(base structPointer, f field, v interface{}) { + if v == nil { + return + } + structPointer_SetStructPointer(base, f, toStructPointer(reflect.ValueOf(v))) +} + +func setCustomType(base structPointer, f field, value interface{}) { + if value == nil { + return + } + v := reflect.ValueOf(value).Elem() + t := reflect.TypeOf(value).Elem() + kind := t.Kind() + switch kind { + case reflect.Slice: + slice := reflect.MakeSlice(t, v.Len(), v.Cap()) + reflect.Copy(slice, v) + oldHeader := structPointer_GetSliceHeader(base, f) + oldHeader.Data = slice.Pointer() + oldHeader.Len = v.Len() + oldHeader.Cap = v.Cap() + default: + size := reflect.TypeOf(value).Elem().Size() + structPointer_Copy(toStructPointer(reflect.ValueOf(value)), structPointer_Add(base, f), int(size)) + } +} + +func (o *Buffer) dec_custom_bytes(p *Properties, base structPointer) error { + b, err := o.DecodeRawBytes(true) + if err != nil { + return err + } + i := reflect.New(p.ctype.Elem()).Interface() + custom := (i).(Unmarshaler) + if err := custom.Unmarshal(b); err != nil { + return err + } + setPtrCustomType(base, p.field, custom) + return nil +} + +func (o *Buffer) dec_custom_ref_bytes(p *Properties, base structPointer) error { + b, err := o.DecodeRawBytes(true) + if err != nil { + return err + } + i := reflect.New(p.ctype).Interface() + custom := (i).(Unmarshaler) + if err := custom.Unmarshal(b); err != nil { + return err + } + if custom != nil { + setCustomType(base, p.field, custom) + } + return nil +} + +// Decode a slice of bytes ([]byte) into a slice of custom types. +func (o *Buffer) dec_custom_slice_bytes(p *Properties, base structPointer) error { + b, err := o.DecodeRawBytes(true) + if err != nil { + return err + } + i := reflect.New(p.ctype.Elem()).Interface() + custom := (i).(Unmarshaler) + if err := custom.Unmarshal(b); err != nil { + return err + } + newBas := appendStructPointer(base, p.field, p.ctype) + + var zero field + setCustomType(newBas, zero, custom) + + return nil +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/duration.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/duration.go new file mode 100644 index 00000000000..93464c91cff --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/duration.go @@ -0,0 +1,100 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +package proto + +// This file implements conversions between google.protobuf.Duration +// and time.Duration. + +import ( + "errors" + "fmt" + "time" +) + +const ( + // Range of a Duration in seconds, as specified in + // google/protobuf/duration.proto. This is about 10,000 years in seconds. + maxSeconds = int64(10000 * 365.25 * 24 * 60 * 60) + minSeconds = -maxSeconds +) + +// validateDuration determines whether the Duration is valid according to the +// definition in google/protobuf/duration.proto. A valid Duration +// may still be too large to fit into a time.Duration (the range of Duration +// is about 10,000 years, and the range of time.Duration is about 290). +func validateDuration(d *duration) error { + if d == nil { + return errors.New("duration: nil Duration") + } + if d.Seconds < minSeconds || d.Seconds > maxSeconds { + return fmt.Errorf("duration: %#v: seconds out of range", d) + } + if d.Nanos <= -1e9 || d.Nanos >= 1e9 { + return fmt.Errorf("duration: %#v: nanos out of range", d) + } + // Seconds and Nanos must have the same sign, unless d.Nanos is zero. + if (d.Seconds < 0 && d.Nanos > 0) || (d.Seconds > 0 && d.Nanos < 0) { + return fmt.Errorf("duration: %#v: seconds and nanos have different signs", d) + } + return nil +} + +// DurationFromProto converts a Duration to a time.Duration. DurationFromProto +// returns an error if the Duration is invalid or is too large to be +// represented in a time.Duration. +func durationFromProto(p *duration) (time.Duration, error) { + if err := validateDuration(p); err != nil { + return 0, err + } + d := time.Duration(p.Seconds) * time.Second + if int64(d/time.Second) != p.Seconds { + return 0, fmt.Errorf("duration: %#v is out of range for time.Duration", p) + } + if p.Nanos != 0 { + d += time.Duration(p.Nanos) + if (d < 0) != (p.Nanos < 0) { + return 0, fmt.Errorf("duration: %#v is out of range for time.Duration", p) + } + } + return d, nil +} + +// DurationProto converts a time.Duration to a Duration. +func durationProto(d time.Duration) *duration { + nanos := d.Nanoseconds() + secs := nanos / 1e9 + nanos -= secs * 1e9 + return &duration{ + Seconds: secs, + Nanos: int32(nanos), + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/duration_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/duration_gogo.go new file mode 100644 index 00000000000..18e2a5f7765 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/duration_gogo.go @@ -0,0 +1,203 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2016, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package proto + +import ( + "reflect" + "time" +) + +var durationType = reflect.TypeOf((*time.Duration)(nil)).Elem() + +type duration struct { + Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` + Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` +} + +func (m *duration) Reset() { *m = duration{} } +func (*duration) ProtoMessage() {} +func (*duration) String() string { return "duration" } + +func init() { + RegisterType((*duration)(nil), "gogo.protobuf.proto.duration") +} + +func (o *Buffer) decDuration() (time.Duration, error) { + b, err := o.DecodeRawBytes(true) + if err != nil { + return 0, err + } + dproto := &duration{} + if err := Unmarshal(b, dproto); err != nil { + return 0, err + } + return durationFromProto(dproto) +} + +func (o *Buffer) dec_duration(p *Properties, base structPointer) error { + d, err := o.decDuration() + if err != nil { + return err + } + word64_Set(structPointer_Word64(base, p.field), o, uint64(d)) + return nil +} + +func (o *Buffer) dec_ref_duration(p *Properties, base structPointer) error { + d, err := o.decDuration() + if err != nil { + return err + } + word64Val_Set(structPointer_Word64Val(base, p.field), o, uint64(d)) + return nil +} + +func (o *Buffer) dec_slice_duration(p *Properties, base structPointer) error { + d, err := o.decDuration() + if err != nil { + return err + } + newBas := appendStructPointer(base, p.field, reflect.SliceOf(reflect.PtrTo(durationType))) + var zero field + setPtrCustomType(newBas, zero, &d) + return nil +} + +func (o *Buffer) dec_slice_ref_duration(p *Properties, base structPointer) error { + d, err := o.decDuration() + if err != nil { + return err + } + structPointer_Word64Slice(base, p.field).Append(uint64(d)) + return nil +} + +func size_duration(p *Properties, base structPointer) (n int) { + structp := structPointer_GetStructPointer(base, p.field) + if structPointer_IsNil(structp) { + return 0 + } + dur := structPointer_Interface(structp, durationType).(*time.Duration) + d := durationProto(*dur) + size := Size(d) + return size + sizeVarint(uint64(size)) + len(p.tagcode) +} + +func (o *Buffer) enc_duration(p *Properties, base structPointer) error { + structp := structPointer_GetStructPointer(base, p.field) + if structPointer_IsNil(structp) { + return ErrNil + } + dur := structPointer_Interface(structp, durationType).(*time.Duration) + d := durationProto(*dur) + data, err := Marshal(d) + if err != nil { + return err + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeRawBytes(data) + return nil +} + +func size_ref_duration(p *Properties, base structPointer) (n int) { + dur := structPointer_InterfaceAt(base, p.field, durationType).(*time.Duration) + d := durationProto(*dur) + size := Size(d) + return size + sizeVarint(uint64(size)) + len(p.tagcode) +} + +func (o *Buffer) enc_ref_duration(p *Properties, base structPointer) error { + dur := structPointer_InterfaceAt(base, p.field, durationType).(*time.Duration) + d := durationProto(*dur) + data, err := Marshal(d) + if err != nil { + return err + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeRawBytes(data) + return nil +} + +func size_slice_duration(p *Properties, base structPointer) (n int) { + pdurs := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(reflect.PtrTo(durationType))).(*[]*time.Duration) + durs := *pdurs + for i := 0; i < len(durs); i++ { + if durs[i] == nil { + return 0 + } + dproto := durationProto(*durs[i]) + size := Size(dproto) + n += len(p.tagcode) + size + sizeVarint(uint64(size)) + } + return n +} + +func (o *Buffer) enc_slice_duration(p *Properties, base structPointer) error { + pdurs := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(reflect.PtrTo(durationType))).(*[]*time.Duration) + durs := *pdurs + for i := 0; i < len(durs); i++ { + if durs[i] == nil { + return errRepeatedHasNil + } + dproto := durationProto(*durs[i]) + data, err := Marshal(dproto) + if err != nil { + return err + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeRawBytes(data) + } + return nil +} + +func size_slice_ref_duration(p *Properties, base structPointer) (n int) { + pdurs := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(durationType)).(*[]time.Duration) + durs := *pdurs + for i := 0; i < len(durs); i++ { + dproto := durationProto(durs[i]) + size := Size(dproto) + n += len(p.tagcode) + size + sizeVarint(uint64(size)) + } + return n +} + +func (o *Buffer) enc_slice_ref_duration(p *Properties, base structPointer) error { + pdurs := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(durationType)).(*[]time.Duration) + durs := *pdurs + for i := 0; i < len(durs); i++ { + dproto := durationProto(durs[i]) + data, err := Marshal(dproto) + if err != nil { + return err + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeRawBytes(data) + } + return nil +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/encode.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/encode.go new file mode 100644 index 00000000000..2b30f84626a --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/encode.go @@ -0,0 +1,1362 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +package proto + +/* + * Routines for encoding data into the wire format for protocol buffers. + */ + +import ( + "errors" + "fmt" + "reflect" + "sort" +) + +// RequiredNotSetError is the error returned if Marshal is called with +// a protocol buffer struct whose required fields have not +// all been initialized. It is also the error returned if Unmarshal is +// called with an encoded protocol buffer that does not include all the +// required fields. +// +// When printed, RequiredNotSetError reports the first unset required field in a +// message. If the field cannot be precisely determined, it is reported as +// "{Unknown}". +type RequiredNotSetError struct { + field string +} + +func (e *RequiredNotSetError) Error() string { + return fmt.Sprintf("proto: required field %q not set", e.field) +} + +var ( + // errRepeatedHasNil is the error returned if Marshal is called with + // a struct with a repeated field containing a nil element. + errRepeatedHasNil = errors.New("proto: repeated field has nil element") + + // errOneofHasNil is the error returned if Marshal is called with + // a struct with a oneof field containing a nil element. + errOneofHasNil = errors.New("proto: oneof field has nil value") + + // ErrNil is the error returned if Marshal is called with nil. + ErrNil = errors.New("proto: Marshal called with nil") + + // ErrTooLarge is the error returned if Marshal is called with a + // message that encodes to >2GB. + ErrTooLarge = errors.New("proto: message encodes to over 2 GB") +) + +// The fundamental encoders that put bytes on the wire. +// Those that take integer types all accept uint64 and are +// therefore of type valueEncoder. + +const maxVarintBytes = 10 // maximum length of a varint + +// maxMarshalSize is the largest allowed size of an encoded protobuf, +// since C++ and Java use signed int32s for the size. +const maxMarshalSize = 1<<31 - 1 + +// EncodeVarint returns the varint encoding of x. +// This is the format for the +// int32, int64, uint32, uint64, bool, and enum +// protocol buffer types. +// Not used by the package itself, but helpful to clients +// wishing to use the same encoding. +func EncodeVarint(x uint64) []byte { + var buf [maxVarintBytes]byte + var n int + for n = 0; x > 127; n++ { + buf[n] = 0x80 | uint8(x&0x7F) + x >>= 7 + } + buf[n] = uint8(x) + n++ + return buf[0:n] +} + +// EncodeVarint writes a varint-encoded integer to the Buffer. +// This is the format for the +// int32, int64, uint32, uint64, bool, and enum +// protocol buffer types. +func (p *Buffer) EncodeVarint(x uint64) error { + for x >= 1<<7 { + p.buf = append(p.buf, uint8(x&0x7f|0x80)) + x >>= 7 + } + p.buf = append(p.buf, uint8(x)) + return nil +} + +// SizeVarint returns the varint encoding size of an integer. +func SizeVarint(x uint64) int { + return sizeVarint(x) +} + +func sizeVarint(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} + +// EncodeFixed64 writes a 64-bit integer to the Buffer. +// This is the format for the +// fixed64, sfixed64, and double protocol buffer types. +func (p *Buffer) EncodeFixed64(x uint64) error { + p.buf = append(p.buf, + uint8(x), + uint8(x>>8), + uint8(x>>16), + uint8(x>>24), + uint8(x>>32), + uint8(x>>40), + uint8(x>>48), + uint8(x>>56)) + return nil +} + +func sizeFixed64(x uint64) int { + return 8 +} + +// EncodeFixed32 writes a 32-bit integer to the Buffer. +// This is the format for the +// fixed32, sfixed32, and float protocol buffer types. +func (p *Buffer) EncodeFixed32(x uint64) error { + p.buf = append(p.buf, + uint8(x), + uint8(x>>8), + uint8(x>>16), + uint8(x>>24)) + return nil +} + +func sizeFixed32(x uint64) int { + return 4 +} + +// EncodeZigzag64 writes a zigzag-encoded 64-bit integer +// to the Buffer. +// This is the format used for the sint64 protocol buffer type. +func (p *Buffer) EncodeZigzag64(x uint64) error { + // use signed number to get arithmetic right shift. + return p.EncodeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} + +func sizeZigzag64(x uint64) int { + return sizeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} + +// EncodeZigzag32 writes a zigzag-encoded 32-bit integer +// to the Buffer. +// This is the format used for the sint32 protocol buffer type. +func (p *Buffer) EncodeZigzag32(x uint64) error { + // use signed number to get arithmetic right shift. + return p.EncodeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31)))) +} + +func sizeZigzag32(x uint64) int { + return sizeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31)))) +} + +// EncodeRawBytes writes a count-delimited byte buffer to the Buffer. +// This is the format used for the bytes protocol buffer +// type and for embedded messages. +func (p *Buffer) EncodeRawBytes(b []byte) error { + p.EncodeVarint(uint64(len(b))) + p.buf = append(p.buf, b...) + return nil +} + +func sizeRawBytes(b []byte) int { + return sizeVarint(uint64(len(b))) + + len(b) +} + +// EncodeStringBytes writes an encoded string to the Buffer. +// This is the format used for the proto2 string type. +func (p *Buffer) EncodeStringBytes(s string) error { + p.EncodeVarint(uint64(len(s))) + p.buf = append(p.buf, s...) + return nil +} + +func sizeStringBytes(s string) int { + return sizeVarint(uint64(len(s))) + + len(s) +} + +// Marshaler is the interface representing objects that can marshal themselves. +type Marshaler interface { + Marshal() ([]byte, error) +} + +// Marshal takes the protocol buffer +// and encodes it into the wire format, returning the data. +func Marshal(pb Message) ([]byte, error) { + // Can the object marshal itself? + if m, ok := pb.(Marshaler); ok { + return m.Marshal() + } + p := NewBuffer(nil) + err := p.Marshal(pb) + if p.buf == nil && err == nil { + // Return a non-nil slice on success. + return []byte{}, nil + } + return p.buf, err +} + +// EncodeMessage writes the protocol buffer to the Buffer, +// prefixed by a varint-encoded length. +func (p *Buffer) EncodeMessage(pb Message) error { + t, base, err := getbase(pb) + if structPointer_IsNil(base) { + return ErrNil + } + if err == nil { + var state errorState + err = p.enc_len_struct(GetProperties(t.Elem()), base, &state) + } + return err +} + +// Marshal takes the protocol buffer +// and encodes it into the wire format, writing the result to the +// Buffer. +func (p *Buffer) Marshal(pb Message) error { + // Can the object marshal itself? + if m, ok := pb.(Marshaler); ok { + data, err := m.Marshal() + p.buf = append(p.buf, data...) + return err + } + + t, base, err := getbase(pb) + if structPointer_IsNil(base) { + return ErrNil + } + if err == nil { + err = p.enc_struct(GetProperties(t.Elem()), base) + } + + if collectStats { + (stats).Encode++ // Parens are to work around a goimports bug. + } + + if len(p.buf) > maxMarshalSize { + return ErrTooLarge + } + return err +} + +// Size returns the encoded size of a protocol buffer. +func Size(pb Message) (n int) { + // Can the object marshal itself? If so, Size is slow. + // TODO: add Size to Marshaler, or add a Sizer interface. + if m, ok := pb.(Marshaler); ok { + b, _ := m.Marshal() + return len(b) + } + + t, base, err := getbase(pb) + if structPointer_IsNil(base) { + return 0 + } + if err == nil { + n = size_struct(GetProperties(t.Elem()), base) + } + + if collectStats { + (stats).Size++ // Parens are to work around a goimports bug. + } + + return +} + +// Individual type encoders. + +// Encode a bool. +func (o *Buffer) enc_bool(p *Properties, base structPointer) error { + v := *structPointer_Bool(base, p.field) + if v == nil { + return ErrNil + } + x := 0 + if *v { + x = 1 + } + o.buf = append(o.buf, p.tagcode...) + p.valEnc(o, uint64(x)) + return nil +} + +func (o *Buffer) enc_proto3_bool(p *Properties, base structPointer) error { + v := *structPointer_BoolVal(base, p.field) + if !v { + return ErrNil + } + o.buf = append(o.buf, p.tagcode...) + p.valEnc(o, 1) + return nil +} + +func size_bool(p *Properties, base structPointer) int { + v := *structPointer_Bool(base, p.field) + if v == nil { + return 0 + } + return len(p.tagcode) + 1 // each bool takes exactly one byte +} + +func size_proto3_bool(p *Properties, base structPointer) int { + v := *structPointer_BoolVal(base, p.field) + if !v && !p.oneof { + return 0 + } + return len(p.tagcode) + 1 // each bool takes exactly one byte +} + +// Encode an int32. +func (o *Buffer) enc_int32(p *Properties, base structPointer) error { + v := structPointer_Word32(base, p.field) + if word32_IsNil(v) { + return ErrNil + } + x := int32(word32_Get(v)) // permit sign extension to use full 64-bit range + o.buf = append(o.buf, p.tagcode...) + p.valEnc(o, uint64(x)) + return nil +} + +func (o *Buffer) enc_proto3_int32(p *Properties, base structPointer) error { + v := structPointer_Word32Val(base, p.field) + x := int32(word32Val_Get(v)) // permit sign extension to use full 64-bit range + if x == 0 { + return ErrNil + } + o.buf = append(o.buf, p.tagcode...) + p.valEnc(o, uint64(x)) + return nil +} + +func size_int32(p *Properties, base structPointer) (n int) { + v := structPointer_Word32(base, p.field) + if word32_IsNil(v) { + return 0 + } + x := int32(word32_Get(v)) // permit sign extension to use full 64-bit range + n += len(p.tagcode) + n += p.valSize(uint64(x)) + return +} + +func size_proto3_int32(p *Properties, base structPointer) (n int) { + v := structPointer_Word32Val(base, p.field) + x := int32(word32Val_Get(v)) // permit sign extension to use full 64-bit range + if x == 0 && !p.oneof { + return 0 + } + n += len(p.tagcode) + n += p.valSize(uint64(x)) + return +} + +// Encode a uint32. +// Exactly the same as int32, except for no sign extension. +func (o *Buffer) enc_uint32(p *Properties, base structPointer) error { + v := structPointer_Word32(base, p.field) + if word32_IsNil(v) { + return ErrNil + } + x := word32_Get(v) + o.buf = append(o.buf, p.tagcode...) + p.valEnc(o, uint64(x)) + return nil +} + +func (o *Buffer) enc_proto3_uint32(p *Properties, base structPointer) error { + v := structPointer_Word32Val(base, p.field) + x := word32Val_Get(v) + if x == 0 { + return ErrNil + } + o.buf = append(o.buf, p.tagcode...) + p.valEnc(o, uint64(x)) + return nil +} + +func size_uint32(p *Properties, base structPointer) (n int) { + v := structPointer_Word32(base, p.field) + if word32_IsNil(v) { + return 0 + } + x := word32_Get(v) + n += len(p.tagcode) + n += p.valSize(uint64(x)) + return +} + +func size_proto3_uint32(p *Properties, base structPointer) (n int) { + v := structPointer_Word32Val(base, p.field) + x := word32Val_Get(v) + if x == 0 && !p.oneof { + return 0 + } + n += len(p.tagcode) + n += p.valSize(uint64(x)) + return +} + +// Encode an int64. +func (o *Buffer) enc_int64(p *Properties, base structPointer) error { + v := structPointer_Word64(base, p.field) + if word64_IsNil(v) { + return ErrNil + } + x := word64_Get(v) + o.buf = append(o.buf, p.tagcode...) + p.valEnc(o, x) + return nil +} + +func (o *Buffer) enc_proto3_int64(p *Properties, base structPointer) error { + v := structPointer_Word64Val(base, p.field) + x := word64Val_Get(v) + if x == 0 { + return ErrNil + } + o.buf = append(o.buf, p.tagcode...) + p.valEnc(o, x) + return nil +} + +func size_int64(p *Properties, base structPointer) (n int) { + v := structPointer_Word64(base, p.field) + if word64_IsNil(v) { + return 0 + } + x := word64_Get(v) + n += len(p.tagcode) + n += p.valSize(x) + return +} + +func size_proto3_int64(p *Properties, base structPointer) (n int) { + v := structPointer_Word64Val(base, p.field) + x := word64Val_Get(v) + if x == 0 && !p.oneof { + return 0 + } + n += len(p.tagcode) + n += p.valSize(x) + return +} + +// Encode a string. +func (o *Buffer) enc_string(p *Properties, base structPointer) error { + v := *structPointer_String(base, p.field) + if v == nil { + return ErrNil + } + x := *v + o.buf = append(o.buf, p.tagcode...) + o.EncodeStringBytes(x) + return nil +} + +func (o *Buffer) enc_proto3_string(p *Properties, base structPointer) error { + v := *structPointer_StringVal(base, p.field) + if v == "" { + return ErrNil + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeStringBytes(v) + return nil +} + +func size_string(p *Properties, base structPointer) (n int) { + v := *structPointer_String(base, p.field) + if v == nil { + return 0 + } + x := *v + n += len(p.tagcode) + n += sizeStringBytes(x) + return +} + +func size_proto3_string(p *Properties, base structPointer) (n int) { + v := *structPointer_StringVal(base, p.field) + if v == "" && !p.oneof { + return 0 + } + n += len(p.tagcode) + n += sizeStringBytes(v) + return +} + +// All protocol buffer fields are nillable, but be careful. +func isNil(v reflect.Value) bool { + switch v.Kind() { + case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: + return v.IsNil() + } + return false +} + +// Encode a message struct. +func (o *Buffer) enc_struct_message(p *Properties, base structPointer) error { + var state errorState + structp := structPointer_GetStructPointer(base, p.field) + if structPointer_IsNil(structp) { + return ErrNil + } + + // Can the object marshal itself? + if p.isMarshaler { + m := structPointer_Interface(structp, p.stype).(Marshaler) + data, err := m.Marshal() + if err != nil && !state.shouldContinue(err, nil) { + return err + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeRawBytes(data) + return state.err + } + + o.buf = append(o.buf, p.tagcode...) + return o.enc_len_struct(p.sprop, structp, &state) +} + +func size_struct_message(p *Properties, base structPointer) int { + structp := structPointer_GetStructPointer(base, p.field) + if structPointer_IsNil(structp) { + return 0 + } + + // Can the object marshal itself? + if p.isMarshaler { + m := structPointer_Interface(structp, p.stype).(Marshaler) + data, _ := m.Marshal() + n0 := len(p.tagcode) + n1 := sizeRawBytes(data) + return n0 + n1 + } + + n0 := len(p.tagcode) + n1 := size_struct(p.sprop, structp) + n2 := sizeVarint(uint64(n1)) // size of encoded length + return n0 + n1 + n2 +} + +// Encode a group struct. +func (o *Buffer) enc_struct_group(p *Properties, base structPointer) error { + var state errorState + b := structPointer_GetStructPointer(base, p.field) + if structPointer_IsNil(b) { + return ErrNil + } + + o.EncodeVarint(uint64((p.Tag << 3) | WireStartGroup)) + err := o.enc_struct(p.sprop, b) + if err != nil && !state.shouldContinue(err, nil) { + return err + } + o.EncodeVarint(uint64((p.Tag << 3) | WireEndGroup)) + return state.err +} + +func size_struct_group(p *Properties, base structPointer) (n int) { + b := structPointer_GetStructPointer(base, p.field) + if structPointer_IsNil(b) { + return 0 + } + + n += sizeVarint(uint64((p.Tag << 3) | WireStartGroup)) + n += size_struct(p.sprop, b) + n += sizeVarint(uint64((p.Tag << 3) | WireEndGroup)) + return +} + +// Encode a slice of bools ([]bool). +func (o *Buffer) enc_slice_bool(p *Properties, base structPointer) error { + s := *structPointer_BoolSlice(base, p.field) + l := len(s) + if l == 0 { + return ErrNil + } + for _, x := range s { + o.buf = append(o.buf, p.tagcode...) + v := uint64(0) + if x { + v = 1 + } + p.valEnc(o, v) + } + return nil +} + +func size_slice_bool(p *Properties, base structPointer) int { + s := *structPointer_BoolSlice(base, p.field) + l := len(s) + if l == 0 { + return 0 + } + return l * (len(p.tagcode) + 1) // each bool takes exactly one byte +} + +// Encode a slice of bools ([]bool) in packed format. +func (o *Buffer) enc_slice_packed_bool(p *Properties, base structPointer) error { + s := *structPointer_BoolSlice(base, p.field) + l := len(s) + if l == 0 { + return ErrNil + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeVarint(uint64(l)) // each bool takes exactly one byte + for _, x := range s { + v := uint64(0) + if x { + v = 1 + } + p.valEnc(o, v) + } + return nil +} + +func size_slice_packed_bool(p *Properties, base structPointer) (n int) { + s := *structPointer_BoolSlice(base, p.field) + l := len(s) + if l == 0 { + return 0 + } + n += len(p.tagcode) + n += sizeVarint(uint64(l)) + n += l // each bool takes exactly one byte + return +} + +// Encode a slice of bytes ([]byte). +func (o *Buffer) enc_slice_byte(p *Properties, base structPointer) error { + s := *structPointer_Bytes(base, p.field) + if s == nil { + return ErrNil + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeRawBytes(s) + return nil +} + +func (o *Buffer) enc_proto3_slice_byte(p *Properties, base structPointer) error { + s := *structPointer_Bytes(base, p.field) + if len(s) == 0 { + return ErrNil + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeRawBytes(s) + return nil +} + +func size_slice_byte(p *Properties, base structPointer) (n int) { + s := *structPointer_Bytes(base, p.field) + if s == nil && !p.oneof { + return 0 + } + n += len(p.tagcode) + n += sizeRawBytes(s) + return +} + +func size_proto3_slice_byte(p *Properties, base structPointer) (n int) { + s := *structPointer_Bytes(base, p.field) + if len(s) == 0 && !p.oneof { + return 0 + } + n += len(p.tagcode) + n += sizeRawBytes(s) + return +} + +// Encode a slice of int32s ([]int32). +func (o *Buffer) enc_slice_int32(p *Properties, base structPointer) error { + s := structPointer_Word32Slice(base, p.field) + l := s.Len() + if l == 0 { + return ErrNil + } + for i := 0; i < l; i++ { + o.buf = append(o.buf, p.tagcode...) + x := int32(s.Index(i)) // permit sign extension to use full 64-bit range + p.valEnc(o, uint64(x)) + } + return nil +} + +func size_slice_int32(p *Properties, base structPointer) (n int) { + s := structPointer_Word32Slice(base, p.field) + l := s.Len() + if l == 0 { + return 0 + } + for i := 0; i < l; i++ { + n += len(p.tagcode) + x := int32(s.Index(i)) // permit sign extension to use full 64-bit range + n += p.valSize(uint64(x)) + } + return +} + +// Encode a slice of int32s ([]int32) in packed format. +func (o *Buffer) enc_slice_packed_int32(p *Properties, base structPointer) error { + s := structPointer_Word32Slice(base, p.field) + l := s.Len() + if l == 0 { + return ErrNil + } + // TODO: Reuse a Buffer. + buf := NewBuffer(nil) + for i := 0; i < l; i++ { + x := int32(s.Index(i)) // permit sign extension to use full 64-bit range + p.valEnc(buf, uint64(x)) + } + + o.buf = append(o.buf, p.tagcode...) + o.EncodeVarint(uint64(len(buf.buf))) + o.buf = append(o.buf, buf.buf...) + return nil +} + +func size_slice_packed_int32(p *Properties, base structPointer) (n int) { + s := structPointer_Word32Slice(base, p.field) + l := s.Len() + if l == 0 { + return 0 + } + var bufSize int + for i := 0; i < l; i++ { + x := int32(s.Index(i)) // permit sign extension to use full 64-bit range + bufSize += p.valSize(uint64(x)) + } + + n += len(p.tagcode) + n += sizeVarint(uint64(bufSize)) + n += bufSize + return +} + +// Encode a slice of uint32s ([]uint32). +// Exactly the same as int32, except for no sign extension. +func (o *Buffer) enc_slice_uint32(p *Properties, base structPointer) error { + s := structPointer_Word32Slice(base, p.field) + l := s.Len() + if l == 0 { + return ErrNil + } + for i := 0; i < l; i++ { + o.buf = append(o.buf, p.tagcode...) + x := s.Index(i) + p.valEnc(o, uint64(x)) + } + return nil +} + +func size_slice_uint32(p *Properties, base structPointer) (n int) { + s := structPointer_Word32Slice(base, p.field) + l := s.Len() + if l == 0 { + return 0 + } + for i := 0; i < l; i++ { + n += len(p.tagcode) + x := s.Index(i) + n += p.valSize(uint64(x)) + } + return +} + +// Encode a slice of uint32s ([]uint32) in packed format. +// Exactly the same as int32, except for no sign extension. +func (o *Buffer) enc_slice_packed_uint32(p *Properties, base structPointer) error { + s := structPointer_Word32Slice(base, p.field) + l := s.Len() + if l == 0 { + return ErrNil + } + // TODO: Reuse a Buffer. + buf := NewBuffer(nil) + for i := 0; i < l; i++ { + p.valEnc(buf, uint64(s.Index(i))) + } + + o.buf = append(o.buf, p.tagcode...) + o.EncodeVarint(uint64(len(buf.buf))) + o.buf = append(o.buf, buf.buf...) + return nil +} + +func size_slice_packed_uint32(p *Properties, base structPointer) (n int) { + s := structPointer_Word32Slice(base, p.field) + l := s.Len() + if l == 0 { + return 0 + } + var bufSize int + for i := 0; i < l; i++ { + bufSize += p.valSize(uint64(s.Index(i))) + } + + n += len(p.tagcode) + n += sizeVarint(uint64(bufSize)) + n += bufSize + return +} + +// Encode a slice of int64s ([]int64). +func (o *Buffer) enc_slice_int64(p *Properties, base structPointer) error { + s := structPointer_Word64Slice(base, p.field) + l := s.Len() + if l == 0 { + return ErrNil + } + for i := 0; i < l; i++ { + o.buf = append(o.buf, p.tagcode...) + p.valEnc(o, s.Index(i)) + } + return nil +} + +func size_slice_int64(p *Properties, base structPointer) (n int) { + s := structPointer_Word64Slice(base, p.field) + l := s.Len() + if l == 0 { + return 0 + } + for i := 0; i < l; i++ { + n += len(p.tagcode) + n += p.valSize(s.Index(i)) + } + return +} + +// Encode a slice of int64s ([]int64) in packed format. +func (o *Buffer) enc_slice_packed_int64(p *Properties, base structPointer) error { + s := structPointer_Word64Slice(base, p.field) + l := s.Len() + if l == 0 { + return ErrNil + } + // TODO: Reuse a Buffer. + buf := NewBuffer(nil) + for i := 0; i < l; i++ { + p.valEnc(buf, s.Index(i)) + } + + o.buf = append(o.buf, p.tagcode...) + o.EncodeVarint(uint64(len(buf.buf))) + o.buf = append(o.buf, buf.buf...) + return nil +} + +func size_slice_packed_int64(p *Properties, base structPointer) (n int) { + s := structPointer_Word64Slice(base, p.field) + l := s.Len() + if l == 0 { + return 0 + } + var bufSize int + for i := 0; i < l; i++ { + bufSize += p.valSize(s.Index(i)) + } + + n += len(p.tagcode) + n += sizeVarint(uint64(bufSize)) + n += bufSize + return +} + +// Encode a slice of slice of bytes ([][]byte). +func (o *Buffer) enc_slice_slice_byte(p *Properties, base structPointer) error { + ss := *structPointer_BytesSlice(base, p.field) + l := len(ss) + if l == 0 { + return ErrNil + } + for i := 0; i < l; i++ { + o.buf = append(o.buf, p.tagcode...) + o.EncodeRawBytes(ss[i]) + } + return nil +} + +func size_slice_slice_byte(p *Properties, base structPointer) (n int) { + ss := *structPointer_BytesSlice(base, p.field) + l := len(ss) + if l == 0 { + return 0 + } + n += l * len(p.tagcode) + for i := 0; i < l; i++ { + n += sizeRawBytes(ss[i]) + } + return +} + +// Encode a slice of strings ([]string). +func (o *Buffer) enc_slice_string(p *Properties, base structPointer) error { + ss := *structPointer_StringSlice(base, p.field) + l := len(ss) + for i := 0; i < l; i++ { + o.buf = append(o.buf, p.tagcode...) + o.EncodeStringBytes(ss[i]) + } + return nil +} + +func size_slice_string(p *Properties, base structPointer) (n int) { + ss := *structPointer_StringSlice(base, p.field) + l := len(ss) + n += l * len(p.tagcode) + for i := 0; i < l; i++ { + n += sizeStringBytes(ss[i]) + } + return +} + +// Encode a slice of message structs ([]*struct). +func (o *Buffer) enc_slice_struct_message(p *Properties, base structPointer) error { + var state errorState + s := structPointer_StructPointerSlice(base, p.field) + l := s.Len() + + for i := 0; i < l; i++ { + structp := s.Index(i) + if structPointer_IsNil(structp) { + return errRepeatedHasNil + } + + // Can the object marshal itself? + if p.isMarshaler { + m := structPointer_Interface(structp, p.stype).(Marshaler) + data, err := m.Marshal() + if err != nil && !state.shouldContinue(err, nil) { + return err + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeRawBytes(data) + continue + } + + o.buf = append(o.buf, p.tagcode...) + err := o.enc_len_struct(p.sprop, structp, &state) + if err != nil && !state.shouldContinue(err, nil) { + if err == ErrNil { + return errRepeatedHasNil + } + return err + } + } + return state.err +} + +func size_slice_struct_message(p *Properties, base structPointer) (n int) { + s := structPointer_StructPointerSlice(base, p.field) + l := s.Len() + n += l * len(p.tagcode) + for i := 0; i < l; i++ { + structp := s.Index(i) + if structPointer_IsNil(structp) { + return // return the size up to this point + } + + // Can the object marshal itself? + if p.isMarshaler { + m := structPointer_Interface(structp, p.stype).(Marshaler) + data, _ := m.Marshal() + n += sizeRawBytes(data) + continue + } + + n0 := size_struct(p.sprop, structp) + n1 := sizeVarint(uint64(n0)) // size of encoded length + n += n0 + n1 + } + return +} + +// Encode a slice of group structs ([]*struct). +func (o *Buffer) enc_slice_struct_group(p *Properties, base structPointer) error { + var state errorState + s := structPointer_StructPointerSlice(base, p.field) + l := s.Len() + + for i := 0; i < l; i++ { + b := s.Index(i) + if structPointer_IsNil(b) { + return errRepeatedHasNil + } + + o.EncodeVarint(uint64((p.Tag << 3) | WireStartGroup)) + + err := o.enc_struct(p.sprop, b) + + if err != nil && !state.shouldContinue(err, nil) { + if err == ErrNil { + return errRepeatedHasNil + } + return err + } + + o.EncodeVarint(uint64((p.Tag << 3) | WireEndGroup)) + } + return state.err +} + +func size_slice_struct_group(p *Properties, base structPointer) (n int) { + s := structPointer_StructPointerSlice(base, p.field) + l := s.Len() + + n += l * sizeVarint(uint64((p.Tag<<3)|WireStartGroup)) + n += l * sizeVarint(uint64((p.Tag<<3)|WireEndGroup)) + for i := 0; i < l; i++ { + b := s.Index(i) + if structPointer_IsNil(b) { + return // return size up to this point + } + + n += size_struct(p.sprop, b) + } + return +} + +// Encode an extension map. +func (o *Buffer) enc_map(p *Properties, base structPointer) error { + exts := structPointer_ExtMap(base, p.field) + if err := encodeExtensionsMap(*exts); err != nil { + return err + } + + return o.enc_map_body(*exts) +} + +func (o *Buffer) enc_exts(p *Properties, base structPointer) error { + exts := structPointer_Extensions(base, p.field) + + v, mu := exts.extensionsRead() + if v == nil { + return nil + } + + mu.Lock() + defer mu.Unlock() + if err := encodeExtensionsMap(v); err != nil { + return err + } + + return o.enc_map_body(v) +} + +func (o *Buffer) enc_map_body(v map[int32]Extension) error { + // Fast-path for common cases: zero or one extensions. + if len(v) <= 1 { + for _, e := range v { + o.buf = append(o.buf, e.enc...) + } + return nil + } + + // Sort keys to provide a deterministic encoding. + keys := make([]int, 0, len(v)) + for k := range v { + keys = append(keys, int(k)) + } + sort.Ints(keys) + + for _, k := range keys { + o.buf = append(o.buf, v[int32(k)].enc...) + } + return nil +} + +func size_map(p *Properties, base structPointer) int { + v := structPointer_ExtMap(base, p.field) + return extensionsMapSize(*v) +} + +func size_exts(p *Properties, base structPointer) int { + v := structPointer_Extensions(base, p.field) + return extensionsSize(v) +} + +// Encode a map field. +func (o *Buffer) enc_new_map(p *Properties, base structPointer) error { + var state errorState // XXX: or do we need to plumb this through? + + /* + A map defined as + map map_field = N; + is encoded in the same way as + message MapFieldEntry { + key_type key = 1; + value_type value = 2; + } + repeated MapFieldEntry map_field = N; + */ + + v := structPointer_NewAt(base, p.field, p.mtype).Elem() // map[K]V + if v.Len() == 0 { + return nil + } + + keycopy, valcopy, keybase, valbase := mapEncodeScratch(p.mtype) + + enc := func() error { + if err := p.mkeyprop.enc(o, p.mkeyprop, keybase); err != nil { + return err + } + if err := p.mvalprop.enc(o, p.mvalprop, valbase); err != nil && err != ErrNil { + return err + } + return nil + } + + // Don't sort map keys. It is not required by the spec, and C++ doesn't do it. + for _, key := range v.MapKeys() { + val := v.MapIndex(key) + + keycopy.Set(key) + valcopy.Set(val) + + o.buf = append(o.buf, p.tagcode...) + if err := o.enc_len_thing(enc, &state); err != nil { + return err + } + } + return nil +} + +func size_new_map(p *Properties, base structPointer) int { + v := structPointer_NewAt(base, p.field, p.mtype).Elem() // map[K]V + + keycopy, valcopy, keybase, valbase := mapEncodeScratch(p.mtype) + + n := 0 + for _, key := range v.MapKeys() { + val := v.MapIndex(key) + keycopy.Set(key) + valcopy.Set(val) + + // Tag codes for key and val are the responsibility of the sub-sizer. + keysize := p.mkeyprop.size(p.mkeyprop, keybase) + valsize := p.mvalprop.size(p.mvalprop, valbase) + entry := keysize + valsize + // Add on tag code and length of map entry itself. + n += len(p.tagcode) + sizeVarint(uint64(entry)) + entry + } + return n +} + +// mapEncodeScratch returns a new reflect.Value matching the map's value type, +// and a structPointer suitable for passing to an encoder or sizer. +func mapEncodeScratch(mapType reflect.Type) (keycopy, valcopy reflect.Value, keybase, valbase structPointer) { + // Prepare addressable doubly-indirect placeholders for the key and value types. + // This is needed because the element-type encoders expect **T, but the map iteration produces T. + + keycopy = reflect.New(mapType.Key()).Elem() // addressable K + keyptr := reflect.New(reflect.PtrTo(keycopy.Type())).Elem() // addressable *K + keyptr.Set(keycopy.Addr()) // + keybase = toStructPointer(keyptr.Addr()) // **K + + // Value types are more varied and require special handling. + switch mapType.Elem().Kind() { + case reflect.Slice: + // []byte + var dummy []byte + valcopy = reflect.ValueOf(&dummy).Elem() // addressable []byte + valbase = toStructPointer(valcopy.Addr()) + case reflect.Ptr: + // message; the generated field type is map[K]*Msg (so V is *Msg), + // so we only need one level of indirection. + valcopy = reflect.New(mapType.Elem()).Elem() // addressable V + valbase = toStructPointer(valcopy.Addr()) + default: + // everything else + valcopy = reflect.New(mapType.Elem()).Elem() // addressable V + valptr := reflect.New(reflect.PtrTo(valcopy.Type())).Elem() // addressable *V + valptr.Set(valcopy.Addr()) // + valbase = toStructPointer(valptr.Addr()) // **V + } + return +} + +// Encode a struct. +func (o *Buffer) enc_struct(prop *StructProperties, base structPointer) error { + var state errorState + // Encode fields in tag order so that decoders may use optimizations + // that depend on the ordering. + // https://developers.google.com/protocol-buffers/docs/encoding#order + for _, i := range prop.order { + p := prop.Prop[i] + if p.enc != nil { + err := p.enc(o, p, base) + if err != nil { + if err == ErrNil { + if p.Required && state.err == nil { + state.err = &RequiredNotSetError{p.Name} + } + } else if err == errRepeatedHasNil { + // Give more context to nil values in repeated fields. + return errors.New("repeated field " + p.OrigName + " has nil element") + } else if !state.shouldContinue(err, p) { + return err + } + } + if len(o.buf) > maxMarshalSize { + return ErrTooLarge + } + } + } + + // Do oneof fields. + if prop.oneofMarshaler != nil { + m := structPointer_Interface(base, prop.stype).(Message) + if err := prop.oneofMarshaler(m, o); err == ErrNil { + return errOneofHasNil + } else if err != nil { + return err + } + } + + // Add unrecognized fields at the end. + if prop.unrecField.IsValid() { + v := *structPointer_Bytes(base, prop.unrecField) + if len(o.buf)+len(v) > maxMarshalSize { + return ErrTooLarge + } + if len(v) > 0 { + o.buf = append(o.buf, v...) + } + } + + return state.err +} + +func size_struct(prop *StructProperties, base structPointer) (n int) { + for _, i := range prop.order { + p := prop.Prop[i] + if p.size != nil { + n += p.size(p, base) + } + } + + // Add unrecognized fields at the end. + if prop.unrecField.IsValid() { + v := *structPointer_Bytes(base, prop.unrecField) + n += len(v) + } + + // Factor in any oneof fields. + if prop.oneofSizer != nil { + m := structPointer_Interface(base, prop.stype).(Message) + n += prop.oneofSizer(m) + } + + return +} + +var zeroes [20]byte // longer than any conceivable sizeVarint + +// Encode a struct, preceded by its encoded length (as a varint). +func (o *Buffer) enc_len_struct(prop *StructProperties, base structPointer, state *errorState) error { + return o.enc_len_thing(func() error { return o.enc_struct(prop, base) }, state) +} + +// Encode something, preceded by its encoded length (as a varint). +func (o *Buffer) enc_len_thing(enc func() error, state *errorState) error { + iLen := len(o.buf) + o.buf = append(o.buf, 0, 0, 0, 0) // reserve four bytes for length + iMsg := len(o.buf) + err := enc() + if err != nil && !state.shouldContinue(err, nil) { + return err + } + lMsg := len(o.buf) - iMsg + lLen := sizeVarint(uint64(lMsg)) + switch x := lLen - (iMsg - iLen); { + case x > 0: // actual length is x bytes larger than the space we reserved + // Move msg x bytes right. + o.buf = append(o.buf, zeroes[:x]...) + copy(o.buf[iMsg+x:], o.buf[iMsg:iMsg+lMsg]) + case x < 0: // actual length is x bytes smaller than the space we reserved + // Move msg x bytes left. + copy(o.buf[iMsg+x:], o.buf[iMsg:iMsg+lMsg]) + o.buf = o.buf[:len(o.buf)+x] // x is negative + } + // Encode the length in the reserved space. + o.buf = o.buf[:iLen] + o.EncodeVarint(uint64(lMsg)) + o.buf = o.buf[:len(o.buf)+lMsg] + return state.err +} + +// errorState maintains the first error that occurs and updates that error +// with additional context. +type errorState struct { + err error +} + +// shouldContinue reports whether encoding should continue upon encountering the +// given error. If the error is RequiredNotSetError, shouldContinue returns true +// and, if this is the first appearance of that error, remembers it for future +// reporting. +// +// If prop is not nil, it may update any error with additional context about the +// field with the error. +func (s *errorState) shouldContinue(err error, prop *Properties) bool { + // Ignore unset required fields. + reqNotSet, ok := err.(*RequiredNotSetError) + if !ok { + return false + } + if s.err == nil { + if prop != nil { + err = &RequiredNotSetError{prop.Name + "." + reqNotSet.field} + } + s.err = err + } + return true +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/encode_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/encode_gogo.go new file mode 100644 index 00000000000..32111b7f41d --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/encode_gogo.go @@ -0,0 +1,350 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// http://github.com/golang/protobuf/ +// +// 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. + +package proto + +import ( + "reflect" +) + +func NewRequiredNotSetError(field string) *RequiredNotSetError { + return &RequiredNotSetError{field} +} + +type Sizer interface { + Size() int +} + +func (o *Buffer) enc_ext_slice_byte(p *Properties, base structPointer) error { + s := *structPointer_Bytes(base, p.field) + if s == nil { + return ErrNil + } + o.buf = append(o.buf, s...) + return nil +} + +func size_ext_slice_byte(p *Properties, base structPointer) (n int) { + s := *structPointer_Bytes(base, p.field) + if s == nil { + return 0 + } + n += len(s) + return +} + +// Encode a reference to bool pointer. +func (o *Buffer) enc_ref_bool(p *Properties, base structPointer) error { + v := *structPointer_BoolVal(base, p.field) + x := 0 + if v { + x = 1 + } + o.buf = append(o.buf, p.tagcode...) + p.valEnc(o, uint64(x)) + return nil +} + +func size_ref_bool(p *Properties, base structPointer) int { + return len(p.tagcode) + 1 // each bool takes exactly one byte +} + +// Encode a reference to int32 pointer. +func (o *Buffer) enc_ref_int32(p *Properties, base structPointer) error { + v := structPointer_Word32Val(base, p.field) + x := int32(word32Val_Get(v)) + o.buf = append(o.buf, p.tagcode...) + p.valEnc(o, uint64(x)) + return nil +} + +func size_ref_int32(p *Properties, base structPointer) (n int) { + v := structPointer_Word32Val(base, p.field) + x := int32(word32Val_Get(v)) + n += len(p.tagcode) + n += p.valSize(uint64(x)) + return +} + +func (o *Buffer) enc_ref_uint32(p *Properties, base structPointer) error { + v := structPointer_Word32Val(base, p.field) + x := word32Val_Get(v) + o.buf = append(o.buf, p.tagcode...) + p.valEnc(o, uint64(x)) + return nil +} + +func size_ref_uint32(p *Properties, base structPointer) (n int) { + v := structPointer_Word32Val(base, p.field) + x := word32Val_Get(v) + n += len(p.tagcode) + n += p.valSize(uint64(x)) + return +} + +// Encode a reference to an int64 pointer. +func (o *Buffer) enc_ref_int64(p *Properties, base structPointer) error { + v := structPointer_Word64Val(base, p.field) + x := word64Val_Get(v) + o.buf = append(o.buf, p.tagcode...) + p.valEnc(o, x) + return nil +} + +func size_ref_int64(p *Properties, base structPointer) (n int) { + v := structPointer_Word64Val(base, p.field) + x := word64Val_Get(v) + n += len(p.tagcode) + n += p.valSize(x) + return +} + +// Encode a reference to a string pointer. +func (o *Buffer) enc_ref_string(p *Properties, base structPointer) error { + v := *structPointer_StringVal(base, p.field) + o.buf = append(o.buf, p.tagcode...) + o.EncodeStringBytes(v) + return nil +} + +func size_ref_string(p *Properties, base structPointer) (n int) { + v := *structPointer_StringVal(base, p.field) + n += len(p.tagcode) + n += sizeStringBytes(v) + return +} + +// Encode a reference to a message struct. +func (o *Buffer) enc_ref_struct_message(p *Properties, base structPointer) error { + var state errorState + structp := structPointer_GetRefStructPointer(base, p.field) + if structPointer_IsNil(structp) { + return ErrNil + } + + // Can the object marshal itself? + if p.isMarshaler { + m := structPointer_Interface(structp, p.stype).(Marshaler) + data, err := m.Marshal() + if err != nil && !state.shouldContinue(err, nil) { + return err + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeRawBytes(data) + return nil + } + + o.buf = append(o.buf, p.tagcode...) + return o.enc_len_struct(p.sprop, structp, &state) +} + +//TODO this is only copied, please fix this +func size_ref_struct_message(p *Properties, base structPointer) int { + structp := structPointer_GetRefStructPointer(base, p.field) + if structPointer_IsNil(structp) { + return 0 + } + + // Can the object marshal itself? + if p.isMarshaler { + m := structPointer_Interface(structp, p.stype).(Marshaler) + data, _ := m.Marshal() + n0 := len(p.tagcode) + n1 := sizeRawBytes(data) + return n0 + n1 + } + + n0 := len(p.tagcode) + n1 := size_struct(p.sprop, structp) + n2 := sizeVarint(uint64(n1)) // size of encoded length + return n0 + n1 + n2 +} + +// Encode a slice of references to message struct pointers ([]struct). +func (o *Buffer) enc_slice_ref_struct_message(p *Properties, base structPointer) error { + var state errorState + ss := structPointer_StructRefSlice(base, p.field, p.stype.Size()) + l := ss.Len() + for i := 0; i < l; i++ { + structp := ss.Index(i) + if structPointer_IsNil(structp) { + return errRepeatedHasNil + } + + // Can the object marshal itself? + if p.isMarshaler { + m := structPointer_Interface(structp, p.stype).(Marshaler) + data, err := m.Marshal() + if err != nil && !state.shouldContinue(err, nil) { + return err + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeRawBytes(data) + continue + } + + o.buf = append(o.buf, p.tagcode...) + err := o.enc_len_struct(p.sprop, structp, &state) + if err != nil && !state.shouldContinue(err, nil) { + if err == ErrNil { + return errRepeatedHasNil + } + return err + } + + } + return state.err +} + +//TODO this is only copied, please fix this +func size_slice_ref_struct_message(p *Properties, base structPointer) (n int) { + ss := structPointer_StructRefSlice(base, p.field, p.stype.Size()) + l := ss.Len() + n += l * len(p.tagcode) + for i := 0; i < l; i++ { + structp := ss.Index(i) + if structPointer_IsNil(structp) { + return // return the size up to this point + } + + // Can the object marshal itself? + if p.isMarshaler { + m := structPointer_Interface(structp, p.stype).(Marshaler) + data, _ := m.Marshal() + n += len(p.tagcode) + n += sizeRawBytes(data) + continue + } + + n0 := size_struct(p.sprop, structp) + n1 := sizeVarint(uint64(n0)) // size of encoded length + n += n0 + n1 + } + return +} + +func (o *Buffer) enc_custom_bytes(p *Properties, base structPointer) error { + i := structPointer_InterfaceRef(base, p.field, p.ctype) + if i == nil { + return ErrNil + } + custom := i.(Marshaler) + data, err := custom.Marshal() + if err != nil { + return err + } + if data == nil { + return ErrNil + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeRawBytes(data) + return nil +} + +func size_custom_bytes(p *Properties, base structPointer) (n int) { + n += len(p.tagcode) + i := structPointer_InterfaceRef(base, p.field, p.ctype) + if i == nil { + return 0 + } + custom := i.(Marshaler) + data, _ := custom.Marshal() + n += sizeRawBytes(data) + return +} + +func (o *Buffer) enc_custom_ref_bytes(p *Properties, base structPointer) error { + custom := structPointer_InterfaceAt(base, p.field, p.ctype).(Marshaler) + data, err := custom.Marshal() + if err != nil { + return err + } + if data == nil { + return ErrNil + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeRawBytes(data) + return nil +} + +func size_custom_ref_bytes(p *Properties, base structPointer) (n int) { + n += len(p.tagcode) + i := structPointer_InterfaceAt(base, p.field, p.ctype) + if i == nil { + return 0 + } + custom := i.(Marshaler) + data, _ := custom.Marshal() + n += sizeRawBytes(data) + return +} + +func (o *Buffer) enc_custom_slice_bytes(p *Properties, base structPointer) error { + inter := structPointer_InterfaceRef(base, p.field, p.ctype) + if inter == nil { + return ErrNil + } + slice := reflect.ValueOf(inter) + l := slice.Len() + for i := 0; i < l; i++ { + v := slice.Index(i) + custom := v.Interface().(Marshaler) + data, err := custom.Marshal() + if err != nil { + return err + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeRawBytes(data) + } + return nil +} + +func size_custom_slice_bytes(p *Properties, base structPointer) (n int) { + inter := structPointer_InterfaceRef(base, p.field, p.ctype) + if inter == nil { + return 0 + } + slice := reflect.ValueOf(inter) + l := slice.Len() + n += l * len(p.tagcode) + for i := 0; i < l; i++ { + v := slice.Index(i) + custom := v.Interface().(Marshaler) + data, _ := custom.Marshal() + n += sizeRawBytes(data) + } + return +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/equal.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/equal.go new file mode 100644 index 00000000000..2ed1cf59666 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/equal.go @@ -0,0 +1,300 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2011 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +// Protocol buffer comparison. + +package proto + +import ( + "bytes" + "log" + "reflect" + "strings" +) + +/* +Equal returns true iff protocol buffers a and b are equal. +The arguments must both be pointers to protocol buffer structs. + +Equality is defined in this way: + - Two messages are equal iff they are the same type, + corresponding fields are equal, unknown field sets + are equal, and extensions sets are equal. + - Two set scalar fields are equal iff their values are equal. + If the fields are of a floating-point type, remember that + NaN != x for all x, including NaN. If the message is defined + in a proto3 .proto file, fields are not "set"; specifically, + zero length proto3 "bytes" fields are equal (nil == {}). + - Two repeated fields are equal iff their lengths are the same, + and their corresponding elements are equal. Note a "bytes" field, + although represented by []byte, is not a repeated field and the + rule for the scalar fields described above applies. + - Two unset fields are equal. + - Two unknown field sets are equal if their current + encoded state is equal. + - Two extension sets are equal iff they have corresponding + elements that are pairwise equal. + - Two map fields are equal iff their lengths are the same, + and they contain the same set of elements. Zero-length map + fields are equal. + - Every other combination of things are not equal. + +The return value is undefined if a and b are not protocol buffers. +*/ +func Equal(a, b Message) bool { + if a == nil || b == nil { + return a == b + } + v1, v2 := reflect.ValueOf(a), reflect.ValueOf(b) + if v1.Type() != v2.Type() { + return false + } + if v1.Kind() == reflect.Ptr { + if v1.IsNil() { + return v2.IsNil() + } + if v2.IsNil() { + return false + } + v1, v2 = v1.Elem(), v2.Elem() + } + if v1.Kind() != reflect.Struct { + return false + } + return equalStruct(v1, v2) +} + +// v1 and v2 are known to have the same type. +func equalStruct(v1, v2 reflect.Value) bool { + sprop := GetProperties(v1.Type()) + for i := 0; i < v1.NumField(); i++ { + f := v1.Type().Field(i) + if strings.HasPrefix(f.Name, "XXX_") { + continue + } + f1, f2 := v1.Field(i), v2.Field(i) + if f.Type.Kind() == reflect.Ptr { + if n1, n2 := f1.IsNil(), f2.IsNil(); n1 && n2 { + // both unset + continue + } else if n1 != n2 { + // set/unset mismatch + return false + } + b1, ok := f1.Interface().(raw) + if ok { + b2 := f2.Interface().(raw) + // RawMessage + if !bytes.Equal(b1.Bytes(), b2.Bytes()) { + return false + } + continue + } + f1, f2 = f1.Elem(), f2.Elem() + } + if !equalAny(f1, f2, sprop.Prop[i]) { + return false + } + } + + if em1 := v1.FieldByName("XXX_InternalExtensions"); em1.IsValid() { + em2 := v2.FieldByName("XXX_InternalExtensions") + if !equalExtensions(v1.Type(), em1.Interface().(XXX_InternalExtensions), em2.Interface().(XXX_InternalExtensions)) { + return false + } + } + + if em1 := v1.FieldByName("XXX_extensions"); em1.IsValid() { + em2 := v2.FieldByName("XXX_extensions") + if !equalExtMap(v1.Type(), em1.Interface().(map[int32]Extension), em2.Interface().(map[int32]Extension)) { + return false + } + } + + uf := v1.FieldByName("XXX_unrecognized") + if !uf.IsValid() { + return true + } + + u1 := uf.Bytes() + u2 := v2.FieldByName("XXX_unrecognized").Bytes() + if !bytes.Equal(u1, u2) { + return false + } + + return true +} + +// v1 and v2 are known to have the same type. +// prop may be nil. +func equalAny(v1, v2 reflect.Value, prop *Properties) bool { + if v1.Type() == protoMessageType { + m1, _ := v1.Interface().(Message) + m2, _ := v2.Interface().(Message) + return Equal(m1, m2) + } + switch v1.Kind() { + case reflect.Bool: + return v1.Bool() == v2.Bool() + case reflect.Float32, reflect.Float64: + return v1.Float() == v2.Float() + case reflect.Int32, reflect.Int64: + return v1.Int() == v2.Int() + case reflect.Interface: + // Probably a oneof field; compare the inner values. + n1, n2 := v1.IsNil(), v2.IsNil() + if n1 || n2 { + return n1 == n2 + } + e1, e2 := v1.Elem(), v2.Elem() + if e1.Type() != e2.Type() { + return false + } + return equalAny(e1, e2, nil) + case reflect.Map: + if v1.Len() != v2.Len() { + return false + } + for _, key := range v1.MapKeys() { + val2 := v2.MapIndex(key) + if !val2.IsValid() { + // This key was not found in the second map. + return false + } + if !equalAny(v1.MapIndex(key), val2, nil) { + return false + } + } + return true + case reflect.Ptr: + // Maps may have nil values in them, so check for nil. + if v1.IsNil() && v2.IsNil() { + return true + } + if v1.IsNil() != v2.IsNil() { + return false + } + return equalAny(v1.Elem(), v2.Elem(), prop) + case reflect.Slice: + if v1.Type().Elem().Kind() == reflect.Uint8 { + // short circuit: []byte + + // Edge case: if this is in a proto3 message, a zero length + // bytes field is considered the zero value. + if prop != nil && prop.proto3 && v1.Len() == 0 && v2.Len() == 0 { + return true + } + if v1.IsNil() != v2.IsNil() { + return false + } + return bytes.Equal(v1.Interface().([]byte), v2.Interface().([]byte)) + } + + if v1.Len() != v2.Len() { + return false + } + for i := 0; i < v1.Len(); i++ { + if !equalAny(v1.Index(i), v2.Index(i), prop) { + return false + } + } + return true + case reflect.String: + return v1.Interface().(string) == v2.Interface().(string) + case reflect.Struct: + return equalStruct(v1, v2) + case reflect.Uint32, reflect.Uint64: + return v1.Uint() == v2.Uint() + } + + // unknown type, so not a protocol buffer + log.Printf("proto: don't know how to compare %v", v1) + return false +} + +// base is the struct type that the extensions are based on. +// x1 and x2 are InternalExtensions. +func equalExtensions(base reflect.Type, x1, x2 XXX_InternalExtensions) bool { + em1, _ := x1.extensionsRead() + em2, _ := x2.extensionsRead() + return equalExtMap(base, em1, em2) +} + +func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool { + if len(em1) != len(em2) { + return false + } + + for extNum, e1 := range em1 { + e2, ok := em2[extNum] + if !ok { + return false + } + + m1, m2 := e1.value, e2.value + + if m1 != nil && m2 != nil { + // Both are unencoded. + if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { + return false + } + continue + } + + // At least one is encoded. To do a semantically correct comparison + // we need to unmarshal them first. + var desc *ExtensionDesc + if m := extensionMaps[base]; m != nil { + desc = m[extNum] + } + if desc == nil { + log.Printf("proto: don't know how to compare extension %d of %v", extNum, base) + continue + } + var err error + if m1 == nil { + m1, err = decodeExtension(e1.enc, desc) + } + if m2 == nil && err == nil { + m2, err = decodeExtension(e2.enc, desc) + } + if err != nil { + // The encoded form is invalid. + log.Printf("proto: badly encoded extension %d of %v: %v", extNum, base, err) + return false + } + if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { + return false + } + } + + return true +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/extensions.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/extensions.go new file mode 100644 index 00000000000..0dfcb538e8f --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/extensions.go @@ -0,0 +1,693 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +package proto + +/* + * Types and routines for supporting protocol buffer extensions. + */ + +import ( + "errors" + "fmt" + "reflect" + "strconv" + "sync" +) + +// ErrMissingExtension is the error returned by GetExtension if the named extension is not in the message. +var ErrMissingExtension = errors.New("proto: missing extension") + +// ExtensionRange represents a range of message extensions for a protocol buffer. +// Used in code generated by the protocol compiler. +type ExtensionRange struct { + Start, End int32 // both inclusive +} + +// extendableProto is an interface implemented by any protocol buffer generated by the current +// proto compiler that may be extended. +type extendableProto interface { + Message + ExtensionRangeArray() []ExtensionRange + extensionsWrite() map[int32]Extension + extensionsRead() (map[int32]Extension, sync.Locker) +} + +// extendableProtoV1 is an interface implemented by a protocol buffer generated by the previous +// version of the proto compiler that may be extended. +type extendableProtoV1 interface { + Message + ExtensionRangeArray() []ExtensionRange + ExtensionMap() map[int32]Extension +} + +type extensionsBytes interface { + Message + ExtensionRangeArray() []ExtensionRange + GetExtensions() *[]byte +} + +// extensionAdapter is a wrapper around extendableProtoV1 that implements extendableProto. +type extensionAdapter struct { + extendableProtoV1 +} + +func (e extensionAdapter) extensionsWrite() map[int32]Extension { + return e.ExtensionMap() +} + +func (e extensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) { + return e.ExtensionMap(), notLocker{} +} + +// notLocker is a sync.Locker whose Lock and Unlock methods are nops. +type notLocker struct{} + +func (n notLocker) Lock() {} +func (n notLocker) Unlock() {} + +// extendable returns the extendableProto interface for the given generated proto message. +// If the proto message has the old extension format, it returns a wrapper that implements +// the extendableProto interface. +func extendable(p interface{}) (extendableProto, bool) { + if ep, ok := p.(extendableProto); ok { + return ep, ok + } + if ep, ok := p.(extendableProtoV1); ok { + return extensionAdapter{ep}, ok + } + return nil, false +} + +// XXX_InternalExtensions is an internal representation of proto extensions. +// +// Each generated message struct type embeds an anonymous XXX_InternalExtensions field, +// thus gaining the unexported 'extensions' method, which can be called only from the proto package. +// +// The methods of XXX_InternalExtensions are not concurrency safe in general, +// but calls to logically read-only methods such as has and get may be executed concurrently. +type XXX_InternalExtensions struct { + // The struct must be indirect so that if a user inadvertently copies a + // generated message and its embedded XXX_InternalExtensions, they + // avoid the mayhem of a copied mutex. + // + // The mutex serializes all logically read-only operations to p.extensionMap. + // It is up to the client to ensure that write operations to p.extensionMap are + // mutually exclusive with other accesses. + p *struct { + mu sync.Mutex + extensionMap map[int32]Extension + } +} + +// extensionsWrite returns the extension map, creating it on first use. +func (e *XXX_InternalExtensions) extensionsWrite() map[int32]Extension { + if e.p == nil { + e.p = new(struct { + mu sync.Mutex + extensionMap map[int32]Extension + }) + e.p.extensionMap = make(map[int32]Extension) + } + return e.p.extensionMap +} + +// extensionsRead returns the extensions map for read-only use. It may be nil. +// The caller must hold the returned mutex's lock when accessing Elements within the map. +func (e *XXX_InternalExtensions) extensionsRead() (map[int32]Extension, sync.Locker) { + if e.p == nil { + return nil, nil + } + return e.p.extensionMap, &e.p.mu +} + +type extensionRange interface { + Message + ExtensionRangeArray() []ExtensionRange +} + +var extendableProtoType = reflect.TypeOf((*extendableProto)(nil)).Elem() +var extendableProtoV1Type = reflect.TypeOf((*extendableProtoV1)(nil)).Elem() +var extendableBytesType = reflect.TypeOf((*extensionsBytes)(nil)).Elem() +var extensionRangeType = reflect.TypeOf((*extensionRange)(nil)).Elem() + +// ExtensionDesc represents an extension specification. +// Used in generated code from the protocol compiler. +type ExtensionDesc struct { + ExtendedType Message // nil pointer to the type that is being extended + ExtensionType interface{} // nil pointer to the extension type + Field int32 // field number + Name string // fully-qualified name of extension, for text formatting + Tag string // protobuf tag style + Filename string // name of the file in which the extension is defined +} + +func (ed *ExtensionDesc) repeated() bool { + t := reflect.TypeOf(ed.ExtensionType) + return t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 +} + +// Extension represents an extension in a message. +type Extension struct { + // When an extension is stored in a message using SetExtension + // only desc and value are set. When the message is marshaled + // enc will be set to the encoded form of the message. + // + // When a message is unmarshaled and contains extensions, each + // extension will have only enc set. When such an extension is + // accessed using GetExtension (or GetExtensions) desc and value + // will be set. + desc *ExtensionDesc + value interface{} + enc []byte +} + +// SetRawExtension is for testing only. +func SetRawExtension(base Message, id int32, b []byte) { + if ebase, ok := base.(extensionsBytes); ok { + clearExtension(base, id) + ext := ebase.GetExtensions() + *ext = append(*ext, b...) + return + } + epb, ok := extendable(base) + if !ok { + return + } + extmap := epb.extensionsWrite() + extmap[id] = Extension{enc: b} +} + +// isExtensionField returns true iff the given field number is in an extension range. +func isExtensionField(pb extensionRange, field int32) bool { + for _, er := range pb.ExtensionRangeArray() { + if er.Start <= field && field <= er.End { + return true + } + } + return false +} + +// checkExtensionTypes checks that the given extension is valid for pb. +func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error { + var pbi interface{} = pb + // Check the extended type. + if ea, ok := pbi.(extensionAdapter); ok { + pbi = ea.extendableProtoV1 + } + if a, b := reflect.TypeOf(pbi), reflect.TypeOf(extension.ExtendedType); a != b { + return errors.New("proto: bad extended type; " + b.String() + " does not extend " + a.String()) + } + // Check the range. + if !isExtensionField(pb, extension.Field) { + return errors.New("proto: bad extension number; not in declared ranges") + } + return nil +} + +// extPropKey is sufficient to uniquely identify an extension. +type extPropKey struct { + base reflect.Type + field int32 +} + +var extProp = struct { + sync.RWMutex + m map[extPropKey]*Properties +}{ + m: make(map[extPropKey]*Properties), +} + +func extensionProperties(ed *ExtensionDesc) *Properties { + key := extPropKey{base: reflect.TypeOf(ed.ExtendedType), field: ed.Field} + + extProp.RLock() + if prop, ok := extProp.m[key]; ok { + extProp.RUnlock() + return prop + } + extProp.RUnlock() + + extProp.Lock() + defer extProp.Unlock() + // Check again. + if prop, ok := extProp.m[key]; ok { + return prop + } + + prop := new(Properties) + prop.Init(reflect.TypeOf(ed.ExtensionType), "unknown_name", ed.Tag, nil) + extProp.m[key] = prop + return prop +} + +// encode encodes any unmarshaled (unencoded) extensions in e. +func encodeExtensions(e *XXX_InternalExtensions) error { + m, mu := e.extensionsRead() + if m == nil { + return nil // fast path + } + mu.Lock() + defer mu.Unlock() + return encodeExtensionsMap(m) +} + +// encode encodes any unmarshaled (unencoded) extensions in e. +func encodeExtensionsMap(m map[int32]Extension) error { + for k, e := range m { + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + et := reflect.TypeOf(e.desc.ExtensionType) + props := extensionProperties(e.desc) + + p := NewBuffer(nil) + // If e.value has type T, the encoder expects a *struct{ X T }. + // Pass a *T with a zero field and hope it all works out. + x := reflect.New(et) + x.Elem().Set(reflect.ValueOf(e.value)) + if err := props.enc(p, props, toStructPointer(x)); err != nil { + return err + } + e.enc = p.buf + m[k] = e + } + return nil +} + +func extensionsSize(e *XXX_InternalExtensions) (n int) { + m, mu := e.extensionsRead() + if m == nil { + return 0 + } + mu.Lock() + defer mu.Unlock() + return extensionsMapSize(m) +} + +func extensionsMapSize(m map[int32]Extension) (n int) { + for _, e := range m { + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + n += len(e.enc) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + et := reflect.TypeOf(e.desc.ExtensionType) + props := extensionProperties(e.desc) + + // If e.value has type T, the encoder expects a *struct{ X T }. + // Pass a *T with a zero field and hope it all works out. + x := reflect.New(et) + x.Elem().Set(reflect.ValueOf(e.value)) + n += props.size(props, toStructPointer(x)) + } + return +} + +// HasExtension returns whether the given extension is present in pb. +func HasExtension(pb Message, extension *ExtensionDesc) bool { + if epb, doki := pb.(extensionsBytes); doki { + ext := epb.GetExtensions() + buf := *ext + o := 0 + for o < len(buf) { + tag, n := DecodeVarint(buf[o:]) + fieldNum := int32(tag >> 3) + if int32(fieldNum) == extension.Field { + return true + } + wireType := int(tag & 0x7) + o += n + l, err := size(buf[o:], wireType) + if err != nil { + return false + } + o += l + } + return false + } + // TODO: Check types, field numbers, etc.? + epb, ok := extendable(pb) + if !ok { + return false + } + extmap, mu := epb.extensionsRead() + if extmap == nil { + return false + } + mu.Lock() + _, ok = extmap[extension.Field] + mu.Unlock() + return ok +} + +func deleteExtension(pb extensionsBytes, theFieldNum int32, offset int) int { + ext := pb.GetExtensions() + for offset < len(*ext) { + tag, n1 := DecodeVarint((*ext)[offset:]) + fieldNum := int32(tag >> 3) + wireType := int(tag & 0x7) + n2, err := size((*ext)[offset+n1:], wireType) + if err != nil { + panic(err) + } + newOffset := offset + n1 + n2 + if fieldNum == theFieldNum { + *ext = append((*ext)[:offset], (*ext)[newOffset:]...) + return offset + } + offset = newOffset + } + return -1 +} + +// ClearExtension removes the given extension from pb. +func ClearExtension(pb Message, extension *ExtensionDesc) { + clearExtension(pb, extension.Field) +} + +func clearExtension(pb Message, fieldNum int32) { + if epb, doki := pb.(extensionsBytes); doki { + offset := 0 + for offset != -1 { + offset = deleteExtension(epb, fieldNum, offset) + } + return + } + epb, ok := extendable(pb) + if !ok { + return + } + // TODO: Check types, field numbers, etc.? + extmap := epb.extensionsWrite() + delete(extmap, fieldNum) +} + +// GetExtension parses and returns the given extension of pb. +// If the extension is not present and has no default value it returns ErrMissingExtension. +func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { + if epb, doki := pb.(extensionsBytes); doki { + ext := epb.GetExtensions() + o := 0 + for o < len(*ext) { + tag, n := DecodeVarint((*ext)[o:]) + fieldNum := int32(tag >> 3) + wireType := int(tag & 0x7) + l, err := size((*ext)[o+n:], wireType) + if err != nil { + return nil, err + } + if int32(fieldNum) == extension.Field { + v, err := decodeExtension((*ext)[o:o+n+l], extension) + if err != nil { + return nil, err + } + return v, nil + } + o += n + l + } + return defaultExtensionValue(extension) + } + epb, ok := extendable(pb) + if !ok { + return nil, errors.New("proto: not an extendable proto") + } + if err := checkExtensionTypes(epb, extension); err != nil { + return nil, err + } + + emap, mu := epb.extensionsRead() + if emap == nil { + return defaultExtensionValue(extension) + } + mu.Lock() + defer mu.Unlock() + e, ok := emap[extension.Field] + if !ok { + // defaultExtensionValue returns the default value or + // ErrMissingExtension if there is no default. + return defaultExtensionValue(extension) + } + + if e.value != nil { + // Already decoded. Check the descriptor, though. + if e.desc != extension { + // This shouldn't happen. If it does, it means that + // GetExtension was called twice with two different + // descriptors with the same field number. + return nil, errors.New("proto: descriptor conflict") + } + return e.value, nil + } + + v, err := decodeExtension(e.enc, extension) + if err != nil { + return nil, err + } + + // Remember the decoded version and drop the encoded version. + // That way it is safe to mutate what we return. + e.value = v + e.desc = extension + e.enc = nil + emap[extension.Field] = e + return e.value, nil +} + +// defaultExtensionValue returns the default value for extension. +// If no default for an extension is defined ErrMissingExtension is returned. +func defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) { + t := reflect.TypeOf(extension.ExtensionType) + props := extensionProperties(extension) + + sf, _, err := fieldDefault(t, props) + if err != nil { + return nil, err + } + + if sf == nil || sf.value == nil { + // There is no default value. + return nil, ErrMissingExtension + } + + if t.Kind() != reflect.Ptr { + // We do not need to return a Ptr, we can directly return sf.value. + return sf.value, nil + } + + // We need to return an interface{} that is a pointer to sf.value. + value := reflect.New(t).Elem() + value.Set(reflect.New(value.Type().Elem())) + if sf.kind == reflect.Int32 { + // We may have an int32 or an enum, but the underlying data is int32. + // Since we can't set an int32 into a non int32 reflect.value directly + // set it as a int32. + value.Elem().SetInt(int64(sf.value.(int32))) + } else { + value.Elem().Set(reflect.ValueOf(sf.value)) + } + return value.Interface(), nil +} + +// decodeExtension decodes an extension encoded in b. +func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) { + o := NewBuffer(b) + + t := reflect.TypeOf(extension.ExtensionType) + + props := extensionProperties(extension) + + // t is a pointer to a struct, pointer to basic type or a slice. + // Allocate a "field" to store the pointer/slice itself; the + // pointer/slice will be stored here. We pass + // the address of this field to props.dec. + // This passes a zero field and a *t and lets props.dec + // interpret it as a *struct{ x t }. + value := reflect.New(t).Elem() + + for { + // Discard wire type and field number varint. It isn't needed. + if _, err := o.DecodeVarint(); err != nil { + return nil, err + } + + if err := props.dec(o, props, toStructPointer(value.Addr())); err != nil { + return nil, err + } + + if o.index >= len(o.buf) { + break + } + } + return value.Interface(), nil +} + +// GetExtensions returns a slice of the extensions present in pb that are also listed in es. +// The returned slice has the same length as es; missing extensions will appear as nil elements. +func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) { + extensions = make([]interface{}, len(es)) + for i, e := range es { + extensions[i], err = GetExtension(pb, e) + if err == ErrMissingExtension { + err = nil + } + if err != nil { + return + } + } + return +} + +// ExtensionDescs returns a new slice containing pb's extension descriptors, in undefined order. +// For non-registered extensions, ExtensionDescs returns an incomplete descriptor containing +// just the Field field, which defines the extension's field number. +func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) { + epb, ok := extendable(pb) + if !ok { + return nil, fmt.Errorf("proto: %T is not an extendable proto.Message", pb) + } + registeredExtensions := RegisteredExtensions(pb) + + emap, mu := epb.extensionsRead() + if emap == nil { + return nil, nil + } + mu.Lock() + defer mu.Unlock() + extensions := make([]*ExtensionDesc, 0, len(emap)) + for extid, e := range emap { + desc := e.desc + if desc == nil { + desc = registeredExtensions[extid] + if desc == nil { + desc = &ExtensionDesc{Field: extid} + } + } + + extensions = append(extensions, desc) + } + return extensions, nil +} + +// SetExtension sets the specified extension of pb to the specified value. +func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error { + if epb, doki := pb.(extensionsBytes); doki { + ClearExtension(pb, extension) + ext := epb.GetExtensions() + et := reflect.TypeOf(extension.ExtensionType) + props := extensionProperties(extension) + p := NewBuffer(nil) + x := reflect.New(et) + x.Elem().Set(reflect.ValueOf(value)) + if err := props.enc(p, props, toStructPointer(x)); err != nil { + return err + } + *ext = append(*ext, p.buf...) + return nil + } + epb, ok := extendable(pb) + if !ok { + return errors.New("proto: not an extendable proto") + } + if err := checkExtensionTypes(epb, extension); err != nil { + return err + } + typ := reflect.TypeOf(extension.ExtensionType) + if typ != reflect.TypeOf(value) { + return errors.New("proto: bad extension value type") + } + // nil extension values need to be caught early, because the + // encoder can't distinguish an ErrNil due to a nil extension + // from an ErrNil due to a missing field. Extensions are + // always optional, so the encoder would just swallow the error + // and drop all the extensions from the encoded message. + if reflect.ValueOf(value).IsNil() { + return fmt.Errorf("proto: SetExtension called with nil value of type %T", value) + } + + extmap := epb.extensionsWrite() + extmap[extension.Field] = Extension{desc: extension, value: value} + return nil +} + +// ClearAllExtensions clears all extensions from pb. +func ClearAllExtensions(pb Message) { + if epb, doki := pb.(extensionsBytes); doki { + ext := epb.GetExtensions() + *ext = []byte{} + return + } + epb, ok := extendable(pb) + if !ok { + return + } + m := epb.extensionsWrite() + for k := range m { + delete(m, k) + } +} + +// A global registry of extensions. +// The generated code will register the generated descriptors by calling RegisterExtension. + +var extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc) + +// RegisterExtension is called from the generated code. +func RegisterExtension(desc *ExtensionDesc) { + st := reflect.TypeOf(desc.ExtendedType).Elem() + m := extensionMaps[st] + if m == nil { + m = make(map[int32]*ExtensionDesc) + extensionMaps[st] = m + } + if _, ok := m[desc.Field]; ok { + panic("proto: duplicate extension registered: " + st.String() + " " + strconv.Itoa(int(desc.Field))) + } + m[desc.Field] = desc +} + +// RegisteredExtensions returns a map of the registered extensions of a +// protocol buffer struct, indexed by the extension number. +// The argument pb should be a nil pointer to the struct type. +func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc { + return extensionMaps[reflect.TypeOf(pb).Elem()] +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/extensions_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/extensions_gogo.go new file mode 100644 index 00000000000..ea6478f009d --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/extensions_gogo.go @@ -0,0 +1,294 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package proto + +import ( + "bytes" + "errors" + "fmt" + "reflect" + "sort" + "strings" + "sync" +) + +func GetBoolExtension(pb Message, extension *ExtensionDesc, ifnotset bool) bool { + if reflect.ValueOf(pb).IsNil() { + return ifnotset + } + value, err := GetExtension(pb, extension) + if err != nil { + return ifnotset + } + if value == nil { + return ifnotset + } + if value.(*bool) == nil { + return ifnotset + } + return *(value.(*bool)) +} + +func (this *Extension) Equal(that *Extension) bool { + return bytes.Equal(this.enc, that.enc) +} + +func (this *Extension) Compare(that *Extension) int { + return bytes.Compare(this.enc, that.enc) +} + +func SizeOfInternalExtension(m extendableProto) (n int) { + return SizeOfExtensionMap(m.extensionsWrite()) +} + +func SizeOfExtensionMap(m map[int32]Extension) (n int) { + return extensionsMapSize(m) +} + +type sortableMapElem struct { + field int32 + ext Extension +} + +func newSortableExtensionsFromMap(m map[int32]Extension) sortableExtensions { + s := make(sortableExtensions, 0, len(m)) + for k, v := range m { + s = append(s, &sortableMapElem{field: k, ext: v}) + } + return s +} + +type sortableExtensions []*sortableMapElem + +func (this sortableExtensions) Len() int { return len(this) } + +func (this sortableExtensions) Swap(i, j int) { this[i], this[j] = this[j], this[i] } + +func (this sortableExtensions) Less(i, j int) bool { return this[i].field < this[j].field } + +func (this sortableExtensions) String() string { + sort.Sort(this) + ss := make([]string, len(this)) + for i := range this { + ss[i] = fmt.Sprintf("%d: %v", this[i].field, this[i].ext) + } + return "map[" + strings.Join(ss, ",") + "]" +} + +func StringFromInternalExtension(m extendableProto) string { + return StringFromExtensionsMap(m.extensionsWrite()) +} + +func StringFromExtensionsMap(m map[int32]Extension) string { + return newSortableExtensionsFromMap(m).String() +} + +func StringFromExtensionsBytes(ext []byte) string { + m, err := BytesToExtensionsMap(ext) + if err != nil { + panic(err) + } + return StringFromExtensionsMap(m) +} + +func EncodeInternalExtension(m extendableProto, data []byte) (n int, err error) { + return EncodeExtensionMap(m.extensionsWrite(), data) +} + +func EncodeExtensionMap(m map[int32]Extension, data []byte) (n int, err error) { + if err := encodeExtensionsMap(m); err != nil { + return 0, err + } + keys := make([]int, 0, len(m)) + for k := range m { + keys = append(keys, int(k)) + } + sort.Ints(keys) + for _, k := range keys { + n += copy(data[n:], m[int32(k)].enc) + } + return n, nil +} + +func GetRawExtension(m map[int32]Extension, id int32) ([]byte, error) { + if m[id].value == nil || m[id].desc == nil { + return m[id].enc, nil + } + if err := encodeExtensionsMap(m); err != nil { + return nil, err + } + return m[id].enc, nil +} + +func size(buf []byte, wire int) (int, error) { + switch wire { + case WireVarint: + _, n := DecodeVarint(buf) + return n, nil + case WireFixed64: + return 8, nil + case WireBytes: + v, n := DecodeVarint(buf) + return int(v) + n, nil + case WireFixed32: + return 4, nil + case WireStartGroup: + offset := 0 + for { + u, n := DecodeVarint(buf[offset:]) + fwire := int(u & 0x7) + offset += n + if fwire == WireEndGroup { + return offset, nil + } + s, err := size(buf[offset:], wire) + if err != nil { + return 0, err + } + offset += s + } + } + return 0, fmt.Errorf("proto: can't get size for unknown wire type %d", wire) +} + +func BytesToExtensionsMap(buf []byte) (map[int32]Extension, error) { + m := make(map[int32]Extension) + i := 0 + for i < len(buf) { + tag, n := DecodeVarint(buf[i:]) + if n <= 0 { + return nil, fmt.Errorf("unable to decode varint") + } + fieldNum := int32(tag >> 3) + wireType := int(tag & 0x7) + l, err := size(buf[i+n:], wireType) + if err != nil { + return nil, err + } + end := i + int(l) + n + m[int32(fieldNum)] = Extension{enc: buf[i:end]} + i = end + } + return m, nil +} + +func NewExtension(e []byte) Extension { + ee := Extension{enc: make([]byte, len(e))} + copy(ee.enc, e) + return ee +} + +func AppendExtension(e Message, tag int32, buf []byte) { + if ee, eok := e.(extensionsBytes); eok { + ext := ee.GetExtensions() + *ext = append(*ext, buf...) + return + } + if ee, eok := e.(extendableProto); eok { + m := ee.extensionsWrite() + ext := m[int32(tag)] // may be missing + ext.enc = append(ext.enc, buf...) + m[int32(tag)] = ext + } +} + +func encodeExtension(e *Extension) error { + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + return nil + } + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + et := reflect.TypeOf(e.desc.ExtensionType) + props := extensionProperties(e.desc) + + p := NewBuffer(nil) + // If e.value has type T, the encoder expects a *struct{ X T }. + // Pass a *T with a zero field and hope it all works out. + x := reflect.New(et) + x.Elem().Set(reflect.ValueOf(e.value)) + if err := props.enc(p, props, toStructPointer(x)); err != nil { + return err + } + e.enc = p.buf + return nil +} + +func (this Extension) GoString() string { + if this.enc == nil { + if err := encodeExtension(&this); err != nil { + panic(err) + } + } + return fmt.Sprintf("proto.NewExtension(%#v)", this.enc) +} + +func SetUnsafeExtension(pb Message, fieldNum int32, value interface{}) error { + typ := reflect.TypeOf(pb).Elem() + ext, ok := extensionMaps[typ] + if !ok { + return fmt.Errorf("proto: bad extended type; %s is not extendable", typ.String()) + } + desc, ok := ext[fieldNum] + if !ok { + return errors.New("proto: bad extension number; not in declared ranges") + } + return SetExtension(pb, desc, value) +} + +func GetUnsafeExtension(pb Message, fieldNum int32) (interface{}, error) { + typ := reflect.TypeOf(pb).Elem() + ext, ok := extensionMaps[typ] + if !ok { + return nil, fmt.Errorf("proto: bad extended type; %s is not extendable", typ.String()) + } + desc, ok := ext[fieldNum] + if !ok { + return nil, fmt.Errorf("unregistered field number %d", fieldNum) + } + return GetExtension(pb, desc) +} + +func NewUnsafeXXX_InternalExtensions(m map[int32]Extension) XXX_InternalExtensions { + x := &XXX_InternalExtensions{ + p: new(struct { + mu sync.Mutex + extensionMap map[int32]Extension + }), + } + x.p.extensionMap = m + return *x +} + +func GetUnsafeExtensionsMap(extendable Message) map[int32]Extension { + pb := extendable.(extendableProto) + return pb.extensionsWrite() +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/lib.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/lib.go new file mode 100644 index 00000000000..7580bb45c61 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/lib.go @@ -0,0 +1,898 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +/* +Package proto converts data structures to and from the wire format of +protocol buffers. It works in concert with the Go source code generated +for .proto files by the protocol compiler. + +A summary of the properties of the protocol buffer interface +for a protocol buffer variable v: + + - Names are turned from camel_case to CamelCase for export. + - There are no methods on v to set fields; just treat + them as structure fields. + - There are getters that return a field's value if set, + and return the field's default value if unset. + The getters work even if the receiver is a nil message. + - The zero value for a struct is its correct initialization state. + All desired fields must be set before marshaling. + - A Reset() method will restore a protobuf struct to its zero state. + - Non-repeated fields are pointers to the values; nil means unset. + That is, optional or required field int32 f becomes F *int32. + - Repeated fields are slices. + - Helper functions are available to aid the setting of fields. + msg.Foo = proto.String("hello") // set field + - Constants are defined to hold the default values of all fields that + have them. They have the form Default_StructName_FieldName. + Because the getter methods handle defaulted values, + direct use of these constants should be rare. + - Enums are given type names and maps from names to values. + Enum values are prefixed by the enclosing message's name, or by the + enum's type name if it is a top-level enum. Enum types have a String + method, and a Enum method to assist in message construction. + - Nested messages, groups and enums have type names prefixed with the name of + the surrounding message type. + - Extensions are given descriptor names that start with E_, + followed by an underscore-delimited list of the nested messages + that contain it (if any) followed by the CamelCased name of the + extension field itself. HasExtension, ClearExtension, GetExtension + and SetExtension are functions for manipulating extensions. + - Oneof field sets are given a single field in their message, + with distinguished wrapper types for each possible field value. + - Marshal and Unmarshal are functions to encode and decode the wire format. + +When the .proto file specifies `syntax="proto3"`, there are some differences: + + - Non-repeated fields of non-message type are values instead of pointers. + - Getters are only generated for message and oneof fields. + - Enum types do not get an Enum method. + +The simplest way to describe this is to see an example. +Given file test.proto, containing + + package example; + + enum FOO { X = 17; } + + message Test { + required string label = 1; + optional int32 type = 2 [default=77]; + repeated int64 reps = 3; + optional group OptionalGroup = 4 { + required string RequiredField = 5; + } + oneof union { + int32 number = 6; + string name = 7; + } + } + +The resulting file, test.pb.go, is: + + package example + + import proto "github.com/gogo/protobuf/proto" + import math "math" + + type FOO int32 + const ( + FOO_X FOO = 17 + ) + var FOO_name = map[int32]string{ + 17: "X", + } + var FOO_value = map[string]int32{ + "X": 17, + } + + func (x FOO) Enum() *FOO { + p := new(FOO) + *p = x + return p + } + func (x FOO) String() string { + return proto.EnumName(FOO_name, int32(x)) + } + func (x *FOO) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FOO_value, data) + if err != nil { + return err + } + *x = FOO(value) + return nil + } + + type Test struct { + Label *string `protobuf:"bytes,1,req,name=label" json:"label,omitempty"` + Type *int32 `protobuf:"varint,2,opt,name=type,def=77" json:"type,omitempty"` + Reps []int64 `protobuf:"varint,3,rep,name=reps" json:"reps,omitempty"` + Optionalgroup *Test_OptionalGroup `protobuf:"group,4,opt,name=OptionalGroup" json:"optionalgroup,omitempty"` + // Types that are valid to be assigned to Union: + // *Test_Number + // *Test_Name + Union isTest_Union `protobuf_oneof:"union"` + XXX_unrecognized []byte `json:"-"` + } + func (m *Test) Reset() { *m = Test{} } + func (m *Test) String() string { return proto.CompactTextString(m) } + func (*Test) ProtoMessage() {} + + type isTest_Union interface { + isTest_Union() + } + + type Test_Number struct { + Number int32 `protobuf:"varint,6,opt,name=number"` + } + type Test_Name struct { + Name string `protobuf:"bytes,7,opt,name=name"` + } + + func (*Test_Number) isTest_Union() {} + func (*Test_Name) isTest_Union() {} + + func (m *Test) GetUnion() isTest_Union { + if m != nil { + return m.Union + } + return nil + } + const Default_Test_Type int32 = 77 + + func (m *Test) GetLabel() string { + if m != nil && m.Label != nil { + return *m.Label + } + return "" + } + + func (m *Test) GetType() int32 { + if m != nil && m.Type != nil { + return *m.Type + } + return Default_Test_Type + } + + func (m *Test) GetOptionalgroup() *Test_OptionalGroup { + if m != nil { + return m.Optionalgroup + } + return nil + } + + type Test_OptionalGroup struct { + RequiredField *string `protobuf:"bytes,5,req" json:"RequiredField,omitempty"` + } + func (m *Test_OptionalGroup) Reset() { *m = Test_OptionalGroup{} } + func (m *Test_OptionalGroup) String() string { return proto.CompactTextString(m) } + + func (m *Test_OptionalGroup) GetRequiredField() string { + if m != nil && m.RequiredField != nil { + return *m.RequiredField + } + return "" + } + + func (m *Test) GetNumber() int32 { + if x, ok := m.GetUnion().(*Test_Number); ok { + return x.Number + } + return 0 + } + + func (m *Test) GetName() string { + if x, ok := m.GetUnion().(*Test_Name); ok { + return x.Name + } + return "" + } + + func init() { + proto.RegisterEnum("example.FOO", FOO_name, FOO_value) + } + +To create and play with a Test object: + + package main + + import ( + "log" + + "github.com/gogo/protobuf/proto" + pb "./example.pb" + ) + + func main() { + test := &pb.Test{ + Label: proto.String("hello"), + Type: proto.Int32(17), + Reps: []int64{1, 2, 3}, + Optionalgroup: &pb.Test_OptionalGroup{ + RequiredField: proto.String("good bye"), + }, + Union: &pb.Test_Name{"fred"}, + } + data, err := proto.Marshal(test) + if err != nil { + log.Fatal("marshaling error: ", err) + } + newTest := &pb.Test{} + err = proto.Unmarshal(data, newTest) + if err != nil { + log.Fatal("unmarshaling error: ", err) + } + // Now test and newTest contain the same data. + if test.GetLabel() != newTest.GetLabel() { + log.Fatalf("data mismatch %q != %q", test.GetLabel(), newTest.GetLabel()) + } + // Use a type switch to determine which oneof was set. + switch u := test.Union.(type) { + case *pb.Test_Number: // u.Number contains the number. + case *pb.Test_Name: // u.Name contains the string. + } + // etc. + } +*/ +package proto + +import ( + "encoding/json" + "fmt" + "log" + "reflect" + "sort" + "strconv" + "sync" +) + +// Message is implemented by generated protocol buffer messages. +type Message interface { + Reset() + String() string + ProtoMessage() +} + +// Stats records allocation details about the protocol buffer encoders +// and decoders. Useful for tuning the library itself. +type Stats struct { + Emalloc uint64 // mallocs in encode + Dmalloc uint64 // mallocs in decode + Encode uint64 // number of encodes + Decode uint64 // number of decodes + Chit uint64 // number of cache hits + Cmiss uint64 // number of cache misses + Size uint64 // number of sizes +} + +// Set to true to enable stats collection. +const collectStats = false + +var stats Stats + +// GetStats returns a copy of the global Stats structure. +func GetStats() Stats { return stats } + +// A Buffer is a buffer manager for marshaling and unmarshaling +// protocol buffers. It may be reused between invocations to +// reduce memory usage. It is not necessary to use a Buffer; +// the global functions Marshal and Unmarshal create a +// temporary Buffer and are fine for most applications. +type Buffer struct { + buf []byte // encode/decode byte stream + index int // read point + + // pools of basic types to amortize allocation. + bools []bool + uint32s []uint32 + uint64s []uint64 + + // extra pools, only used with pointer_reflect.go + int32s []int32 + int64s []int64 + float32s []float32 + float64s []float64 +} + +// NewBuffer allocates a new Buffer and initializes its internal data to +// the contents of the argument slice. +func NewBuffer(e []byte) *Buffer { + return &Buffer{buf: e} +} + +// Reset resets the Buffer, ready for marshaling a new protocol buffer. +func (p *Buffer) Reset() { + p.buf = p.buf[0:0] // for reading/writing + p.index = 0 // for reading +} + +// SetBuf replaces the internal buffer with the slice, +// ready for unmarshaling the contents of the slice. +func (p *Buffer) SetBuf(s []byte) { + p.buf = s + p.index = 0 +} + +// Bytes returns the contents of the Buffer. +func (p *Buffer) Bytes() []byte { return p.buf } + +/* + * Helper routines for simplifying the creation of optional fields of basic type. + */ + +// Bool is a helper routine that allocates a new bool value +// to store v and returns a pointer to it. +func Bool(v bool) *bool { + return &v +} + +// Int32 is a helper routine that allocates a new int32 value +// to store v and returns a pointer to it. +func Int32(v int32) *int32 { + return &v +} + +// Int is a helper routine that allocates a new int32 value +// to store v and returns a pointer to it, but unlike Int32 +// its argument value is an int. +func Int(v int) *int32 { + p := new(int32) + *p = int32(v) + return p +} + +// Int64 is a helper routine that allocates a new int64 value +// to store v and returns a pointer to it. +func Int64(v int64) *int64 { + return &v +} + +// Float32 is a helper routine that allocates a new float32 value +// to store v and returns a pointer to it. +func Float32(v float32) *float32 { + return &v +} + +// Float64 is a helper routine that allocates a new float64 value +// to store v and returns a pointer to it. +func Float64(v float64) *float64 { + return &v +} + +// Uint32 is a helper routine that allocates a new uint32 value +// to store v and returns a pointer to it. +func Uint32(v uint32) *uint32 { + return &v +} + +// Uint64 is a helper routine that allocates a new uint64 value +// to store v and returns a pointer to it. +func Uint64(v uint64) *uint64 { + return &v +} + +// String is a helper routine that allocates a new string value +// to store v and returns a pointer to it. +func String(v string) *string { + return &v +} + +// EnumName is a helper function to simplify printing protocol buffer enums +// by name. Given an enum map and a value, it returns a useful string. +func EnumName(m map[int32]string, v int32) string { + s, ok := m[v] + if ok { + return s + } + return strconv.Itoa(int(v)) +} + +// UnmarshalJSONEnum is a helper function to simplify recovering enum int values +// from their JSON-encoded representation. Given a map from the enum's symbolic +// names to its int values, and a byte buffer containing the JSON-encoded +// value, it returns an int32 that can be cast to the enum type by the caller. +// +// The function can deal with both JSON representations, numeric and symbolic. +func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) { + if data[0] == '"' { + // New style: enums are strings. + var repr string + if err := json.Unmarshal(data, &repr); err != nil { + return -1, err + } + val, ok := m[repr] + if !ok { + return 0, fmt.Errorf("unrecognized enum %s value %q", enumName, repr) + } + return val, nil + } + // Old style: enums are ints. + var val int32 + if err := json.Unmarshal(data, &val); err != nil { + return 0, fmt.Errorf("cannot unmarshal %#q into enum %s", data, enumName) + } + return val, nil +} + +// DebugPrint dumps the encoded data in b in a debugging format with a header +// including the string s. Used in testing but made available for general debugging. +func (p *Buffer) DebugPrint(s string, b []byte) { + var u uint64 + + obuf := p.buf + sindex := p.index + p.buf = b + p.index = 0 + depth := 0 + + fmt.Printf("\n--- %s ---\n", s) + +out: + for { + for i := 0; i < depth; i++ { + fmt.Print(" ") + } + + index := p.index + if index == len(p.buf) { + break + } + + op, err := p.DecodeVarint() + if err != nil { + fmt.Printf("%3d: fetching op err %v\n", index, err) + break out + } + tag := op >> 3 + wire := op & 7 + + switch wire { + default: + fmt.Printf("%3d: t=%3d unknown wire=%d\n", + index, tag, wire) + break out + + case WireBytes: + var r []byte + + r, err = p.DecodeRawBytes(false) + if err != nil { + break out + } + fmt.Printf("%3d: t=%3d bytes [%d]", index, tag, len(r)) + if len(r) <= 6 { + for i := 0; i < len(r); i++ { + fmt.Printf(" %.2x", r[i]) + } + } else { + for i := 0; i < 3; i++ { + fmt.Printf(" %.2x", r[i]) + } + fmt.Printf(" ..") + for i := len(r) - 3; i < len(r); i++ { + fmt.Printf(" %.2x", r[i]) + } + } + fmt.Printf("\n") + + case WireFixed32: + u, err = p.DecodeFixed32() + if err != nil { + fmt.Printf("%3d: t=%3d fix32 err %v\n", index, tag, err) + break out + } + fmt.Printf("%3d: t=%3d fix32 %d\n", index, tag, u) + + case WireFixed64: + u, err = p.DecodeFixed64() + if err != nil { + fmt.Printf("%3d: t=%3d fix64 err %v\n", index, tag, err) + break out + } + fmt.Printf("%3d: t=%3d fix64 %d\n", index, tag, u) + + case WireVarint: + u, err = p.DecodeVarint() + if err != nil { + fmt.Printf("%3d: t=%3d varint err %v\n", index, tag, err) + break out + } + fmt.Printf("%3d: t=%3d varint %d\n", index, tag, u) + + case WireStartGroup: + fmt.Printf("%3d: t=%3d start\n", index, tag) + depth++ + + case WireEndGroup: + depth-- + fmt.Printf("%3d: t=%3d end\n", index, tag) + } + } + + if depth != 0 { + fmt.Printf("%3d: start-end not balanced %d\n", p.index, depth) + } + fmt.Printf("\n") + + p.buf = obuf + p.index = sindex +} + +// SetDefaults sets unset protocol buffer fields to their default values. +// It only modifies fields that are both unset and have defined defaults. +// It recursively sets default values in any non-nil sub-messages. +func SetDefaults(pb Message) { + setDefaults(reflect.ValueOf(pb), true, false) +} + +// v is a pointer to a struct. +func setDefaults(v reflect.Value, recur, zeros bool) { + v = v.Elem() + + defaultMu.RLock() + dm, ok := defaults[v.Type()] + defaultMu.RUnlock() + if !ok { + dm = buildDefaultMessage(v.Type()) + defaultMu.Lock() + defaults[v.Type()] = dm + defaultMu.Unlock() + } + + for _, sf := range dm.scalars { + f := v.Field(sf.index) + if !f.IsNil() { + // field already set + continue + } + dv := sf.value + if dv == nil && !zeros { + // no explicit default, and don't want to set zeros + continue + } + fptr := f.Addr().Interface() // **T + // TODO: Consider batching the allocations we do here. + switch sf.kind { + case reflect.Bool: + b := new(bool) + if dv != nil { + *b = dv.(bool) + } + *(fptr.(**bool)) = b + case reflect.Float32: + f := new(float32) + if dv != nil { + *f = dv.(float32) + } + *(fptr.(**float32)) = f + case reflect.Float64: + f := new(float64) + if dv != nil { + *f = dv.(float64) + } + *(fptr.(**float64)) = f + case reflect.Int32: + // might be an enum + if ft := f.Type(); ft != int32PtrType { + // enum + f.Set(reflect.New(ft.Elem())) + if dv != nil { + f.Elem().SetInt(int64(dv.(int32))) + } + } else { + // int32 field + i := new(int32) + if dv != nil { + *i = dv.(int32) + } + *(fptr.(**int32)) = i + } + case reflect.Int64: + i := new(int64) + if dv != nil { + *i = dv.(int64) + } + *(fptr.(**int64)) = i + case reflect.String: + s := new(string) + if dv != nil { + *s = dv.(string) + } + *(fptr.(**string)) = s + case reflect.Uint8: + // exceptional case: []byte + var b []byte + if dv != nil { + db := dv.([]byte) + b = make([]byte, len(db)) + copy(b, db) + } else { + b = []byte{} + } + *(fptr.(*[]byte)) = b + case reflect.Uint32: + u := new(uint32) + if dv != nil { + *u = dv.(uint32) + } + *(fptr.(**uint32)) = u + case reflect.Uint64: + u := new(uint64) + if dv != nil { + *u = dv.(uint64) + } + *(fptr.(**uint64)) = u + default: + log.Printf("proto: can't set default for field %v (sf.kind=%v)", f, sf.kind) + } + } + + for _, ni := range dm.nested { + f := v.Field(ni) + // f is *T or []*T or map[T]*T + switch f.Kind() { + case reflect.Ptr: + if f.IsNil() { + continue + } + setDefaults(f, recur, zeros) + + case reflect.Slice: + for i := 0; i < f.Len(); i++ { + e := f.Index(i) + if e.IsNil() { + continue + } + setDefaults(e, recur, zeros) + } + + case reflect.Map: + for _, k := range f.MapKeys() { + e := f.MapIndex(k) + if e.IsNil() { + continue + } + setDefaults(e, recur, zeros) + } + } + } +} + +var ( + // defaults maps a protocol buffer struct type to a slice of the fields, + // with its scalar fields set to their proto-declared non-zero default values. + defaultMu sync.RWMutex + defaults = make(map[reflect.Type]defaultMessage) + + int32PtrType = reflect.TypeOf((*int32)(nil)) +) + +// defaultMessage represents information about the default values of a message. +type defaultMessage struct { + scalars []scalarField + nested []int // struct field index of nested messages +} + +type scalarField struct { + index int // struct field index + kind reflect.Kind // element type (the T in *T or []T) + value interface{} // the proto-declared default value, or nil +} + +// t is a struct type. +func buildDefaultMessage(t reflect.Type) (dm defaultMessage) { + sprop := GetProperties(t) + for _, prop := range sprop.Prop { + fi, ok := sprop.decoderTags.get(prop.Tag) + if !ok { + // XXX_unrecognized + continue + } + ft := t.Field(fi).Type + + sf, nested, err := fieldDefault(ft, prop) + switch { + case err != nil: + log.Print(err) + case nested: + dm.nested = append(dm.nested, fi) + case sf != nil: + sf.index = fi + dm.scalars = append(dm.scalars, *sf) + } + } + + return dm +} + +// fieldDefault returns the scalarField for field type ft. +// sf will be nil if the field can not have a default. +// nestedMessage will be true if this is a nested message. +// Note that sf.index is not set on return. +func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMessage bool, err error) { + var canHaveDefault bool + switch ft.Kind() { + case reflect.Ptr: + if ft.Elem().Kind() == reflect.Struct { + nestedMessage = true + } else { + canHaveDefault = true // proto2 scalar field + } + + case reflect.Slice: + switch ft.Elem().Kind() { + case reflect.Ptr: + nestedMessage = true // repeated message + case reflect.Uint8: + canHaveDefault = true // bytes field + } + + case reflect.Map: + if ft.Elem().Kind() == reflect.Ptr { + nestedMessage = true // map with message values + } + } + + if !canHaveDefault { + if nestedMessage { + return nil, true, nil + } + return nil, false, nil + } + + // We now know that ft is a pointer or slice. + sf = &scalarField{kind: ft.Elem().Kind()} + + // scalar fields without defaults + if !prop.HasDefault { + return sf, false, nil + } + + // a scalar field: either *T or []byte + switch ft.Elem().Kind() { + case reflect.Bool: + x, err := strconv.ParseBool(prop.Default) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default bool %q: %v", prop.Default, err) + } + sf.value = x + case reflect.Float32: + x, err := strconv.ParseFloat(prop.Default, 32) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default float32 %q: %v", prop.Default, err) + } + sf.value = float32(x) + case reflect.Float64: + x, err := strconv.ParseFloat(prop.Default, 64) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default float64 %q: %v", prop.Default, err) + } + sf.value = x + case reflect.Int32: + x, err := strconv.ParseInt(prop.Default, 10, 32) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default int32 %q: %v", prop.Default, err) + } + sf.value = int32(x) + case reflect.Int64: + x, err := strconv.ParseInt(prop.Default, 10, 64) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default int64 %q: %v", prop.Default, err) + } + sf.value = x + case reflect.String: + sf.value = prop.Default + case reflect.Uint8: + // []byte (not *uint8) + sf.value = []byte(prop.Default) + case reflect.Uint32: + x, err := strconv.ParseUint(prop.Default, 10, 32) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default uint32 %q: %v", prop.Default, err) + } + sf.value = uint32(x) + case reflect.Uint64: + x, err := strconv.ParseUint(prop.Default, 10, 64) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default uint64 %q: %v", prop.Default, err) + } + sf.value = x + default: + return nil, false, fmt.Errorf("proto: unhandled def kind %v", ft.Elem().Kind()) + } + + return sf, false, nil +} + +// Map fields may have key types of non-float scalars, strings and enums. +// The easiest way to sort them in some deterministic order is to use fmt. +// If this turns out to be inefficient we can always consider other options, +// such as doing a Schwartzian transform. + +func mapKeys(vs []reflect.Value) sort.Interface { + s := mapKeySorter{ + vs: vs, + // default Less function: textual comparison + less: func(a, b reflect.Value) bool { + return fmt.Sprint(a.Interface()) < fmt.Sprint(b.Interface()) + }, + } + + // Type specialization per https://developers.google.com/protocol-buffers/docs/proto#maps; + // numeric keys are sorted numerically. + if len(vs) == 0 { + return s + } + switch vs[0].Kind() { + case reflect.Int32, reflect.Int64: + s.less = func(a, b reflect.Value) bool { return a.Int() < b.Int() } + case reflect.Uint32, reflect.Uint64: + s.less = func(a, b reflect.Value) bool { return a.Uint() < b.Uint() } + } + + return s +} + +type mapKeySorter struct { + vs []reflect.Value + less func(a, b reflect.Value) bool +} + +func (s mapKeySorter) Len() int { return len(s.vs) } +func (s mapKeySorter) Swap(i, j int) { s.vs[i], s.vs[j] = s.vs[j], s.vs[i] } +func (s mapKeySorter) Less(i, j int) bool { + return s.less(s.vs[i], s.vs[j]) +} + +// isProto3Zero reports whether v is a zero proto3 value. +func isProto3Zero(v reflect.Value) bool { + switch v.Kind() { + case reflect.Bool: + return !v.Bool() + case reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint32, reflect.Uint64: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.String: + return v.String() == "" + } + return false +} + +// ProtoPackageIsVersion2 is referenced from generated protocol buffer files +// to assert that that code is compatible with this version of the proto package. +const GoGoProtoPackageIsVersion2 = true + +// ProtoPackageIsVersion1 is referenced from generated protocol buffer files +// to assert that that code is compatible with this version of the proto package. +const GoGoProtoPackageIsVersion1 = true diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/lib_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/lib_gogo.go new file mode 100644 index 00000000000..4b4f7c909e6 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/lib_gogo.go @@ -0,0 +1,42 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package proto + +import ( + "encoding/json" + "strconv" +) + +func MarshalJSONEnum(m map[int32]string, value int32) ([]byte, error) { + s, ok := m[value] + if !ok { + s = strconv.Itoa(int(value)) + } + return json.Marshal(s) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/message_set.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/message_set.go new file mode 100644 index 00000000000..fd982decd66 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/message_set.go @@ -0,0 +1,311 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +package proto + +/* + * Support for message sets. + */ + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "reflect" + "sort" +) + +// errNoMessageTypeID occurs when a protocol buffer does not have a message type ID. +// A message type ID is required for storing a protocol buffer in a message set. +var errNoMessageTypeID = errors.New("proto does not have a message type ID") + +// The first two types (_MessageSet_Item and messageSet) +// model what the protocol compiler produces for the following protocol message: +// message MessageSet { +// repeated group Item = 1 { +// required int32 type_id = 2; +// required string message = 3; +// }; +// } +// That is the MessageSet wire format. We can't use a proto to generate these +// because that would introduce a circular dependency between it and this package. + +type _MessageSet_Item struct { + TypeId *int32 `protobuf:"varint,2,req,name=type_id"` + Message []byte `protobuf:"bytes,3,req,name=message"` +} + +type messageSet struct { + Item []*_MessageSet_Item `protobuf:"group,1,rep"` + XXX_unrecognized []byte + // TODO: caching? +} + +// Make sure messageSet is a Message. +var _ Message = (*messageSet)(nil) + +// messageTypeIder is an interface satisfied by a protocol buffer type +// that may be stored in a MessageSet. +type messageTypeIder interface { + MessageTypeId() int32 +} + +func (ms *messageSet) find(pb Message) *_MessageSet_Item { + mti, ok := pb.(messageTypeIder) + if !ok { + return nil + } + id := mti.MessageTypeId() + for _, item := range ms.Item { + if *item.TypeId == id { + return item + } + } + return nil +} + +func (ms *messageSet) Has(pb Message) bool { + if ms.find(pb) != nil { + return true + } + return false +} + +func (ms *messageSet) Unmarshal(pb Message) error { + if item := ms.find(pb); item != nil { + return Unmarshal(item.Message, pb) + } + if _, ok := pb.(messageTypeIder); !ok { + return errNoMessageTypeID + } + return nil // TODO: return error instead? +} + +func (ms *messageSet) Marshal(pb Message) error { + msg, err := Marshal(pb) + if err != nil { + return err + } + if item := ms.find(pb); item != nil { + // reuse existing item + item.Message = msg + return nil + } + + mti, ok := pb.(messageTypeIder) + if !ok { + return errNoMessageTypeID + } + + mtid := mti.MessageTypeId() + ms.Item = append(ms.Item, &_MessageSet_Item{ + TypeId: &mtid, + Message: msg, + }) + return nil +} + +func (ms *messageSet) Reset() { *ms = messageSet{} } +func (ms *messageSet) String() string { return CompactTextString(ms) } +func (*messageSet) ProtoMessage() {} + +// Support for the message_set_wire_format message option. + +func skipVarint(buf []byte) []byte { + i := 0 + for ; buf[i]&0x80 != 0; i++ { + } + return buf[i+1:] +} + +// MarshalMessageSet encodes the extension map represented by m in the message set wire format. +// It is called by generated Marshal methods on protocol buffer messages with the message_set_wire_format option. +func MarshalMessageSet(exts interface{}) ([]byte, error) { + var m map[int32]Extension + switch exts := exts.(type) { + case *XXX_InternalExtensions: + if err := encodeExtensions(exts); err != nil { + return nil, err + } + m, _ = exts.extensionsRead() + case map[int32]Extension: + if err := encodeExtensionsMap(exts); err != nil { + return nil, err + } + m = exts + default: + return nil, errors.New("proto: not an extension map") + } + + // Sort extension IDs to provide a deterministic encoding. + // See also enc_map in encode.go. + ids := make([]int, 0, len(m)) + for id := range m { + ids = append(ids, int(id)) + } + sort.Ints(ids) + + ms := &messageSet{Item: make([]*_MessageSet_Item, 0, len(m))} + for _, id := range ids { + e := m[int32(id)] + // Remove the wire type and field number varint, as well as the length varint. + msg := skipVarint(skipVarint(e.enc)) + + ms.Item = append(ms.Item, &_MessageSet_Item{ + TypeId: Int32(int32(id)), + Message: msg, + }) + } + return Marshal(ms) +} + +// UnmarshalMessageSet decodes the extension map encoded in buf in the message set wire format. +// It is called by generated Unmarshal methods on protocol buffer messages with the message_set_wire_format option. +func UnmarshalMessageSet(buf []byte, exts interface{}) error { + var m map[int32]Extension + switch exts := exts.(type) { + case *XXX_InternalExtensions: + m = exts.extensionsWrite() + case map[int32]Extension: + m = exts + default: + return errors.New("proto: not an extension map") + } + + ms := new(messageSet) + if err := Unmarshal(buf, ms); err != nil { + return err + } + for _, item := range ms.Item { + id := *item.TypeId + msg := item.Message + + // Restore wire type and field number varint, plus length varint. + // Be careful to preserve duplicate items. + b := EncodeVarint(uint64(id)<<3 | WireBytes) + if ext, ok := m[id]; ok { + // Existing data; rip off the tag and length varint + // so we join the new data correctly. + // We can assume that ext.enc is set because we are unmarshaling. + o := ext.enc[len(b):] // skip wire type and field number + _, n := DecodeVarint(o) // calculate length of length varint + o = o[n:] // skip length varint + msg = append(o, msg...) // join old data and new data + } + b = append(b, EncodeVarint(uint64(len(msg)))...) + b = append(b, msg...) + + m[id] = Extension{enc: b} + } + return nil +} + +// MarshalMessageSetJSON encodes the extension map represented by m in JSON format. +// It is called by generated MarshalJSON methods on protocol buffer messages with the message_set_wire_format option. +func MarshalMessageSetJSON(exts interface{}) ([]byte, error) { + var m map[int32]Extension + switch exts := exts.(type) { + case *XXX_InternalExtensions: + m, _ = exts.extensionsRead() + case map[int32]Extension: + m = exts + default: + return nil, errors.New("proto: not an extension map") + } + var b bytes.Buffer + b.WriteByte('{') + + // Process the map in key order for deterministic output. + ids := make([]int32, 0, len(m)) + for id := range m { + ids = append(ids, id) + } + sort.Sort(int32Slice(ids)) // int32Slice defined in text.go + + for i, id := range ids { + ext := m[id] + if i > 0 { + b.WriteByte(',') + } + + msd, ok := messageSetMap[id] + if !ok { + // Unknown type; we can't render it, so skip it. + continue + } + fmt.Fprintf(&b, `"[%s]":`, msd.name) + + x := ext.value + if x == nil { + x = reflect.New(msd.t.Elem()).Interface() + if err := Unmarshal(ext.enc, x.(Message)); err != nil { + return nil, err + } + } + d, err := json.Marshal(x) + if err != nil { + return nil, err + } + b.Write(d) + } + b.WriteByte('}') + return b.Bytes(), nil +} + +// UnmarshalMessageSetJSON decodes the extension map encoded in buf in JSON format. +// It is called by generated UnmarshalJSON methods on protocol buffer messages with the message_set_wire_format option. +func UnmarshalMessageSetJSON(buf []byte, exts interface{}) error { + // Common-case fast path. + if len(buf) == 0 || bytes.Equal(buf, []byte("{}")) { + return nil + } + + // This is fairly tricky, and it's not clear that it is needed. + return errors.New("TODO: UnmarshalMessageSetJSON not yet implemented") +} + +// A global registry of types that can be used in a MessageSet. + +var messageSetMap = make(map[int32]messageSetDesc) + +type messageSetDesc struct { + t reflect.Type // pointer to struct + name string +} + +// RegisterMessageSetType is called from the generated code. +func RegisterMessageSetType(m Message, fieldNum int32, name string) { + messageSetMap[fieldNum] = messageSetDesc{ + t: reflect.TypeOf(m), + name: name, + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_reflect.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_reflect.go new file mode 100644 index 00000000000..fb512e2e16d --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_reflect.go @@ -0,0 +1,484 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2012 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +// +build appengine js + +// This file contains an implementation of proto field accesses using package reflect. +// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can +// be used on App Engine. + +package proto + +import ( + "math" + "reflect" +) + +// A structPointer is a pointer to a struct. +type structPointer struct { + v reflect.Value +} + +// toStructPointer returns a structPointer equivalent to the given reflect value. +// The reflect value must itself be a pointer to a struct. +func toStructPointer(v reflect.Value) structPointer { + return structPointer{v} +} + +// IsNil reports whether p is nil. +func structPointer_IsNil(p structPointer) bool { + return p.v.IsNil() +} + +// Interface returns the struct pointer as an interface value. +func structPointer_Interface(p structPointer, _ reflect.Type) interface{} { + return p.v.Interface() +} + +// A field identifies a field in a struct, accessible from a structPointer. +// In this implementation, a field is identified by the sequence of field indices +// passed to reflect's FieldByIndex. +type field []int + +// toField returns a field equivalent to the given reflect field. +func toField(f *reflect.StructField) field { + return f.Index +} + +// invalidField is an invalid field identifier. +var invalidField = field(nil) + +// IsValid reports whether the field identifier is valid. +func (f field) IsValid() bool { return f != nil } + +// field returns the given field in the struct as a reflect value. +func structPointer_field(p structPointer, f field) reflect.Value { + // Special case: an extension map entry with a value of type T + // passes a *T to the struct-handling code with a zero field, + // expecting that it will be treated as equivalent to *struct{ X T }, + // which has the same memory layout. We have to handle that case + // specially, because reflect will panic if we call FieldByIndex on a + // non-struct. + if f == nil { + return p.v.Elem() + } + + return p.v.Elem().FieldByIndex(f) +} + +// ifield returns the given field in the struct as an interface value. +func structPointer_ifield(p structPointer, f field) interface{} { + return structPointer_field(p, f).Addr().Interface() +} + +// Bytes returns the address of a []byte field in the struct. +func structPointer_Bytes(p structPointer, f field) *[]byte { + return structPointer_ifield(p, f).(*[]byte) +} + +// BytesSlice returns the address of a [][]byte field in the struct. +func structPointer_BytesSlice(p structPointer, f field) *[][]byte { + return structPointer_ifield(p, f).(*[][]byte) +} + +// Bool returns the address of a *bool field in the struct. +func structPointer_Bool(p structPointer, f field) **bool { + return structPointer_ifield(p, f).(**bool) +} + +// BoolVal returns the address of a bool field in the struct. +func structPointer_BoolVal(p structPointer, f field) *bool { + return structPointer_ifield(p, f).(*bool) +} + +// BoolSlice returns the address of a []bool field in the struct. +func structPointer_BoolSlice(p structPointer, f field) *[]bool { + return structPointer_ifield(p, f).(*[]bool) +} + +// String returns the address of a *string field in the struct. +func structPointer_String(p structPointer, f field) **string { + return structPointer_ifield(p, f).(**string) +} + +// StringVal returns the address of a string field in the struct. +func structPointer_StringVal(p structPointer, f field) *string { + return structPointer_ifield(p, f).(*string) +} + +// StringSlice returns the address of a []string field in the struct. +func structPointer_StringSlice(p structPointer, f field) *[]string { + return structPointer_ifield(p, f).(*[]string) +} + +// Extensions returns the address of an extension map field in the struct. +func structPointer_Extensions(p structPointer, f field) *XXX_InternalExtensions { + return structPointer_ifield(p, f).(*XXX_InternalExtensions) +} + +// ExtMap returns the address of an extension map field in the struct. +func structPointer_ExtMap(p structPointer, f field) *map[int32]Extension { + return structPointer_ifield(p, f).(*map[int32]Extension) +} + +// NewAt returns the reflect.Value for a pointer to a field in the struct. +func structPointer_NewAt(p structPointer, f field, typ reflect.Type) reflect.Value { + return structPointer_field(p, f).Addr() +} + +// SetStructPointer writes a *struct field in the struct. +func structPointer_SetStructPointer(p structPointer, f field, q structPointer) { + structPointer_field(p, f).Set(q.v) +} + +// GetStructPointer reads a *struct field in the struct. +func structPointer_GetStructPointer(p structPointer, f field) structPointer { + return structPointer{structPointer_field(p, f)} +} + +// StructPointerSlice the address of a []*struct field in the struct. +func structPointer_StructPointerSlice(p structPointer, f field) structPointerSlice { + return structPointerSlice{structPointer_field(p, f)} +} + +// A structPointerSlice represents the address of a slice of pointers to structs +// (themselves messages or groups). That is, v.Type() is *[]*struct{...}. +type structPointerSlice struct { + v reflect.Value +} + +func (p structPointerSlice) Len() int { return p.v.Len() } +func (p structPointerSlice) Index(i int) structPointer { return structPointer{p.v.Index(i)} } +func (p structPointerSlice) Append(q structPointer) { + p.v.Set(reflect.Append(p.v, q.v)) +} + +var ( + int32Type = reflect.TypeOf(int32(0)) + uint32Type = reflect.TypeOf(uint32(0)) + float32Type = reflect.TypeOf(float32(0)) + int64Type = reflect.TypeOf(int64(0)) + uint64Type = reflect.TypeOf(uint64(0)) + float64Type = reflect.TypeOf(float64(0)) +) + +// A word32 represents a field of type *int32, *uint32, *float32, or *enum. +// That is, v.Type() is *int32, *uint32, *float32, or *enum and v is assignable. +type word32 struct { + v reflect.Value +} + +// IsNil reports whether p is nil. +func word32_IsNil(p word32) bool { + return p.v.IsNil() +} + +// Set sets p to point at a newly allocated word with bits set to x. +func word32_Set(p word32, o *Buffer, x uint32) { + t := p.v.Type().Elem() + switch t { + case int32Type: + if len(o.int32s) == 0 { + o.int32s = make([]int32, uint32PoolSize) + } + o.int32s[0] = int32(x) + p.v.Set(reflect.ValueOf(&o.int32s[0])) + o.int32s = o.int32s[1:] + return + case uint32Type: + if len(o.uint32s) == 0 { + o.uint32s = make([]uint32, uint32PoolSize) + } + o.uint32s[0] = x + p.v.Set(reflect.ValueOf(&o.uint32s[0])) + o.uint32s = o.uint32s[1:] + return + case float32Type: + if len(o.float32s) == 0 { + o.float32s = make([]float32, uint32PoolSize) + } + o.float32s[0] = math.Float32frombits(x) + p.v.Set(reflect.ValueOf(&o.float32s[0])) + o.float32s = o.float32s[1:] + return + } + + // must be enum + p.v.Set(reflect.New(t)) + p.v.Elem().SetInt(int64(int32(x))) +} + +// Get gets the bits pointed at by p, as a uint32. +func word32_Get(p word32) uint32 { + elem := p.v.Elem() + switch elem.Kind() { + case reflect.Int32: + return uint32(elem.Int()) + case reflect.Uint32: + return uint32(elem.Uint()) + case reflect.Float32: + return math.Float32bits(float32(elem.Float())) + } + panic("unreachable") +} + +// Word32 returns a reference to a *int32, *uint32, *float32, or *enum field in the struct. +func structPointer_Word32(p structPointer, f field) word32 { + return word32{structPointer_field(p, f)} +} + +// A word32Val represents a field of type int32, uint32, float32, or enum. +// That is, v.Type() is int32, uint32, float32, or enum and v is assignable. +type word32Val struct { + v reflect.Value +} + +// Set sets *p to x. +func word32Val_Set(p word32Val, x uint32) { + switch p.v.Type() { + case int32Type: + p.v.SetInt(int64(x)) + return + case uint32Type: + p.v.SetUint(uint64(x)) + return + case float32Type: + p.v.SetFloat(float64(math.Float32frombits(x))) + return + } + + // must be enum + p.v.SetInt(int64(int32(x))) +} + +// Get gets the bits pointed at by p, as a uint32. +func word32Val_Get(p word32Val) uint32 { + elem := p.v + switch elem.Kind() { + case reflect.Int32: + return uint32(elem.Int()) + case reflect.Uint32: + return uint32(elem.Uint()) + case reflect.Float32: + return math.Float32bits(float32(elem.Float())) + } + panic("unreachable") +} + +// Word32Val returns a reference to a int32, uint32, float32, or enum field in the struct. +func structPointer_Word32Val(p structPointer, f field) word32Val { + return word32Val{structPointer_field(p, f)} +} + +// A word32Slice is a slice of 32-bit values. +// That is, v.Type() is []int32, []uint32, []float32, or []enum. +type word32Slice struct { + v reflect.Value +} + +func (p word32Slice) Append(x uint32) { + n, m := p.v.Len(), p.v.Cap() + if n < m { + p.v.SetLen(n + 1) + } else { + t := p.v.Type().Elem() + p.v.Set(reflect.Append(p.v, reflect.Zero(t))) + } + elem := p.v.Index(n) + switch elem.Kind() { + case reflect.Int32: + elem.SetInt(int64(int32(x))) + case reflect.Uint32: + elem.SetUint(uint64(x)) + case reflect.Float32: + elem.SetFloat(float64(math.Float32frombits(x))) + } +} + +func (p word32Slice) Len() int { + return p.v.Len() +} + +func (p word32Slice) Index(i int) uint32 { + elem := p.v.Index(i) + switch elem.Kind() { + case reflect.Int32: + return uint32(elem.Int()) + case reflect.Uint32: + return uint32(elem.Uint()) + case reflect.Float32: + return math.Float32bits(float32(elem.Float())) + } + panic("unreachable") +} + +// Word32Slice returns a reference to a []int32, []uint32, []float32, or []enum field in the struct. +func structPointer_Word32Slice(p structPointer, f field) word32Slice { + return word32Slice{structPointer_field(p, f)} +} + +// word64 is like word32 but for 64-bit values. +type word64 struct { + v reflect.Value +} + +func word64_Set(p word64, o *Buffer, x uint64) { + t := p.v.Type().Elem() + switch t { + case int64Type: + if len(o.int64s) == 0 { + o.int64s = make([]int64, uint64PoolSize) + } + o.int64s[0] = int64(x) + p.v.Set(reflect.ValueOf(&o.int64s[0])) + o.int64s = o.int64s[1:] + return + case uint64Type: + if len(o.uint64s) == 0 { + o.uint64s = make([]uint64, uint64PoolSize) + } + o.uint64s[0] = x + p.v.Set(reflect.ValueOf(&o.uint64s[0])) + o.uint64s = o.uint64s[1:] + return + case float64Type: + if len(o.float64s) == 0 { + o.float64s = make([]float64, uint64PoolSize) + } + o.float64s[0] = math.Float64frombits(x) + p.v.Set(reflect.ValueOf(&o.float64s[0])) + o.float64s = o.float64s[1:] + return + } + panic("unreachable") +} + +func word64_IsNil(p word64) bool { + return p.v.IsNil() +} + +func word64_Get(p word64) uint64 { + elem := p.v.Elem() + switch elem.Kind() { + case reflect.Int64: + return uint64(elem.Int()) + case reflect.Uint64: + return elem.Uint() + case reflect.Float64: + return math.Float64bits(elem.Float()) + } + panic("unreachable") +} + +func structPointer_Word64(p structPointer, f field) word64 { + return word64{structPointer_field(p, f)} +} + +// word64Val is like word32Val but for 64-bit values. +type word64Val struct { + v reflect.Value +} + +func word64Val_Set(p word64Val, o *Buffer, x uint64) { + switch p.v.Type() { + case int64Type: + p.v.SetInt(int64(x)) + return + case uint64Type: + p.v.SetUint(x) + return + case float64Type: + p.v.SetFloat(math.Float64frombits(x)) + return + } + panic("unreachable") +} + +func word64Val_Get(p word64Val) uint64 { + elem := p.v + switch elem.Kind() { + case reflect.Int64: + return uint64(elem.Int()) + case reflect.Uint64: + return elem.Uint() + case reflect.Float64: + return math.Float64bits(elem.Float()) + } + panic("unreachable") +} + +func structPointer_Word64Val(p structPointer, f field) word64Val { + return word64Val{structPointer_field(p, f)} +} + +type word64Slice struct { + v reflect.Value +} + +func (p word64Slice) Append(x uint64) { + n, m := p.v.Len(), p.v.Cap() + if n < m { + p.v.SetLen(n + 1) + } else { + t := p.v.Type().Elem() + p.v.Set(reflect.Append(p.v, reflect.Zero(t))) + } + elem := p.v.Index(n) + switch elem.Kind() { + case reflect.Int64: + elem.SetInt(int64(int64(x))) + case reflect.Uint64: + elem.SetUint(uint64(x)) + case reflect.Float64: + elem.SetFloat(float64(math.Float64frombits(x))) + } +} + +func (p word64Slice) Len() int { + return p.v.Len() +} + +func (p word64Slice) Index(i int) uint64 { + elem := p.v.Index(i) + switch elem.Kind() { + case reflect.Int64: + return uint64(elem.Int()) + case reflect.Uint64: + return uint64(elem.Uint()) + case reflect.Float64: + return math.Float64bits(float64(elem.Float())) + } + panic("unreachable") +} + +func structPointer_Word64Slice(p structPointer, f field) word64Slice { + return word64Slice{structPointer_field(p, f)} +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go new file mode 100644 index 00000000000..1763a5f227a --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go @@ -0,0 +1,85 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2016, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +// +build appengine js + +package proto + +import ( + "reflect" +) + +func structPointer_FieldPointer(p structPointer, f field) structPointer { + panic("not implemented") +} + +func appendStructPointer(base structPointer, f field, typ reflect.Type) structPointer { + panic("not implemented") +} + +func structPointer_InterfaceAt(p structPointer, f field, t reflect.Type) interface{} { + panic("not implemented") +} + +func structPointer_InterfaceRef(p structPointer, f field, t reflect.Type) interface{} { + panic("not implemented") +} + +func structPointer_GetRefStructPointer(p structPointer, f field) structPointer { + panic("not implemented") +} + +func structPointer_Add(p structPointer, size field) structPointer { + panic("not implemented") +} + +func structPointer_Len(p structPointer, f field) int { + panic("not implemented") +} + +func structPointer_GetSliceHeader(p structPointer, f field) *reflect.SliceHeader { + panic("not implemented") +} + +func structPointer_Copy(oldptr structPointer, newptr structPointer, size int) { + panic("not implemented") +} + +func structPointer_StructRefSlice(p structPointer, f field, size uintptr) *structRefSlice { + panic("not implemented") +} + +type structRefSlice struct{} + +func (v *structRefSlice) Len() int { + panic("not implemented") +} + +func (v *structRefSlice) Index(i int) structPointer { + panic("not implemented") +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_unsafe.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_unsafe.go new file mode 100644 index 00000000000..6b5567d47cd --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_unsafe.go @@ -0,0 +1,270 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2012 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +// +build !appengine,!js + +// This file contains the implementation of the proto field accesses using package unsafe. + +package proto + +import ( + "reflect" + "unsafe" +) + +// NOTE: These type_Foo functions would more idiomatically be methods, +// but Go does not allow methods on pointer types, and we must preserve +// some pointer type for the garbage collector. We use these +// funcs with clunky names as our poor approximation to methods. +// +// An alternative would be +// type structPointer struct { p unsafe.Pointer } +// but that does not registerize as well. + +// A structPointer is a pointer to a struct. +type structPointer unsafe.Pointer + +// toStructPointer returns a structPointer equivalent to the given reflect value. +func toStructPointer(v reflect.Value) structPointer { + return structPointer(unsafe.Pointer(v.Pointer())) +} + +// IsNil reports whether p is nil. +func structPointer_IsNil(p structPointer) bool { + return p == nil +} + +// Interface returns the struct pointer, assumed to have element type t, +// as an interface value. +func structPointer_Interface(p structPointer, t reflect.Type) interface{} { + return reflect.NewAt(t, unsafe.Pointer(p)).Interface() +} + +// A field identifies a field in a struct, accessible from a structPointer. +// In this implementation, a field is identified by its byte offset from the start of the struct. +type field uintptr + +// toField returns a field equivalent to the given reflect field. +func toField(f *reflect.StructField) field { + return field(f.Offset) +} + +// invalidField is an invalid field identifier. +const invalidField = ^field(0) + +// IsValid reports whether the field identifier is valid. +func (f field) IsValid() bool { + return f != ^field(0) +} + +// Bytes returns the address of a []byte field in the struct. +func structPointer_Bytes(p structPointer, f field) *[]byte { + return (*[]byte)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// BytesSlice returns the address of a [][]byte field in the struct. +func structPointer_BytesSlice(p structPointer, f field) *[][]byte { + return (*[][]byte)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// Bool returns the address of a *bool field in the struct. +func structPointer_Bool(p structPointer, f field) **bool { + return (**bool)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// BoolVal returns the address of a bool field in the struct. +func structPointer_BoolVal(p structPointer, f field) *bool { + return (*bool)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// BoolSlice returns the address of a []bool field in the struct. +func structPointer_BoolSlice(p structPointer, f field) *[]bool { + return (*[]bool)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// String returns the address of a *string field in the struct. +func structPointer_String(p structPointer, f field) **string { + return (**string)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// StringVal returns the address of a string field in the struct. +func structPointer_StringVal(p structPointer, f field) *string { + return (*string)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// StringSlice returns the address of a []string field in the struct. +func structPointer_StringSlice(p structPointer, f field) *[]string { + return (*[]string)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// ExtMap returns the address of an extension map field in the struct. +func structPointer_Extensions(p structPointer, f field) *XXX_InternalExtensions { + return (*XXX_InternalExtensions)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +func structPointer_ExtMap(p structPointer, f field) *map[int32]Extension { + return (*map[int32]Extension)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// NewAt returns the reflect.Value for a pointer to a field in the struct. +func structPointer_NewAt(p structPointer, f field, typ reflect.Type) reflect.Value { + return reflect.NewAt(typ, unsafe.Pointer(uintptr(p)+uintptr(f))) +} + +// SetStructPointer writes a *struct field in the struct. +func structPointer_SetStructPointer(p structPointer, f field, q structPointer) { + *(*structPointer)(unsafe.Pointer(uintptr(p) + uintptr(f))) = q +} + +// GetStructPointer reads a *struct field in the struct. +func structPointer_GetStructPointer(p structPointer, f field) structPointer { + return *(*structPointer)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// StructPointerSlice the address of a []*struct field in the struct. +func structPointer_StructPointerSlice(p structPointer, f field) *structPointerSlice { + return (*structPointerSlice)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// A structPointerSlice represents a slice of pointers to structs (themselves submessages or groups). +type structPointerSlice []structPointer + +func (v *structPointerSlice) Len() int { return len(*v) } +func (v *structPointerSlice) Index(i int) structPointer { return (*v)[i] } +func (v *structPointerSlice) Append(p structPointer) { *v = append(*v, p) } + +// A word32 is the address of a "pointer to 32-bit value" field. +type word32 **uint32 + +// IsNil reports whether *v is nil. +func word32_IsNil(p word32) bool { + return *p == nil +} + +// Set sets *v to point at a newly allocated word set to x. +func word32_Set(p word32, o *Buffer, x uint32) { + if len(o.uint32s) == 0 { + o.uint32s = make([]uint32, uint32PoolSize) + } + o.uint32s[0] = x + *p = &o.uint32s[0] + o.uint32s = o.uint32s[1:] +} + +// Get gets the value pointed at by *v. +func word32_Get(p word32) uint32 { + return **p +} + +// Word32 returns the address of a *int32, *uint32, *float32, or *enum field in the struct. +func structPointer_Word32(p structPointer, f field) word32 { + return word32((**uint32)(unsafe.Pointer(uintptr(p) + uintptr(f)))) +} + +// A word32Val is the address of a 32-bit value field. +type word32Val *uint32 + +// Set sets *p to x. +func word32Val_Set(p word32Val, x uint32) { + *p = x +} + +// Get gets the value pointed at by p. +func word32Val_Get(p word32Val) uint32 { + return *p +} + +// Word32Val returns the address of a *int32, *uint32, *float32, or *enum field in the struct. +func structPointer_Word32Val(p structPointer, f field) word32Val { + return word32Val((*uint32)(unsafe.Pointer(uintptr(p) + uintptr(f)))) +} + +// A word32Slice is a slice of 32-bit values. +type word32Slice []uint32 + +func (v *word32Slice) Append(x uint32) { *v = append(*v, x) } +func (v *word32Slice) Len() int { return len(*v) } +func (v *word32Slice) Index(i int) uint32 { return (*v)[i] } + +// Word32Slice returns the address of a []int32, []uint32, []float32, or []enum field in the struct. +func structPointer_Word32Slice(p structPointer, f field) *word32Slice { + return (*word32Slice)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// word64 is like word32 but for 64-bit values. +type word64 **uint64 + +func word64_Set(p word64, o *Buffer, x uint64) { + if len(o.uint64s) == 0 { + o.uint64s = make([]uint64, uint64PoolSize) + } + o.uint64s[0] = x + *p = &o.uint64s[0] + o.uint64s = o.uint64s[1:] +} + +func word64_IsNil(p word64) bool { + return *p == nil +} + +func word64_Get(p word64) uint64 { + return **p +} + +func structPointer_Word64(p structPointer, f field) word64 { + return word64((**uint64)(unsafe.Pointer(uintptr(p) + uintptr(f)))) +} + +// word64Val is like word32Val but for 64-bit values. +type word64Val *uint64 + +func word64Val_Set(p word64Val, o *Buffer, x uint64) { + *p = x +} + +func word64Val_Get(p word64Val) uint64 { + return *p +} + +func structPointer_Word64Val(p structPointer, f field) word64Val { + return word64Val((*uint64)(unsafe.Pointer(uintptr(p) + uintptr(f)))) +} + +// word64Slice is like word32Slice but for 64-bit values. +type word64Slice []uint64 + +func (v *word64Slice) Append(x uint64) { *v = append(*v, x) } +func (v *word64Slice) Len() int { return len(*v) } +func (v *word64Slice) Index(i int) uint64 { return (*v)[i] } + +func structPointer_Word64Slice(p structPointer, f field) *word64Slice { + return (*word64Slice)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go new file mode 100644 index 00000000000..f156a29f0e8 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go @@ -0,0 +1,128 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +// +build !appengine,!js + +// This file contains the implementation of the proto field accesses using package unsafe. + +package proto + +import ( + "reflect" + "unsafe" +) + +func structPointer_InterfaceAt(p structPointer, f field, t reflect.Type) interface{} { + point := unsafe.Pointer(uintptr(p) + uintptr(f)) + r := reflect.NewAt(t, point) + return r.Interface() +} + +func structPointer_InterfaceRef(p structPointer, f field, t reflect.Type) interface{} { + point := unsafe.Pointer(uintptr(p) + uintptr(f)) + r := reflect.NewAt(t, point) + if r.Elem().IsNil() { + return nil + } + return r.Elem().Interface() +} + +func copyUintPtr(oldptr, newptr uintptr, size int) { + oldbytes := make([]byte, 0) + oldslice := (*reflect.SliceHeader)(unsafe.Pointer(&oldbytes)) + oldslice.Data = oldptr + oldslice.Len = size + oldslice.Cap = size + newbytes := make([]byte, 0) + newslice := (*reflect.SliceHeader)(unsafe.Pointer(&newbytes)) + newslice.Data = newptr + newslice.Len = size + newslice.Cap = size + copy(newbytes, oldbytes) +} + +func structPointer_Copy(oldptr structPointer, newptr structPointer, size int) { + copyUintPtr(uintptr(oldptr), uintptr(newptr), size) +} + +func appendStructPointer(base structPointer, f field, typ reflect.Type) structPointer { + size := typ.Elem().Size() + + oldHeader := structPointer_GetSliceHeader(base, f) + oldSlice := reflect.NewAt(typ, unsafe.Pointer(oldHeader)).Elem() + newLen := oldHeader.Len + 1 + newSlice := reflect.MakeSlice(typ, newLen, newLen) + reflect.Copy(newSlice, oldSlice) + bas := toStructPointer(newSlice) + oldHeader.Data = uintptr(bas) + oldHeader.Len = newLen + oldHeader.Cap = newLen + + return structPointer(unsafe.Pointer(uintptr(unsafe.Pointer(bas)) + uintptr(uintptr(newLen-1)*size))) +} + +func structPointer_FieldPointer(p structPointer, f field) structPointer { + return structPointer(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +func structPointer_GetRefStructPointer(p structPointer, f field) structPointer { + return structPointer((*structPointer)(unsafe.Pointer(uintptr(p) + uintptr(f)))) +} + +func structPointer_GetSliceHeader(p structPointer, f field) *reflect.SliceHeader { + return (*reflect.SliceHeader)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +func structPointer_Add(p structPointer, size field) structPointer { + return structPointer(unsafe.Pointer(uintptr(p) + uintptr(size))) +} + +func structPointer_Len(p structPointer, f field) int { + return len(*(*[]interface{})(unsafe.Pointer(structPointer_GetRefStructPointer(p, f)))) +} + +func structPointer_StructRefSlice(p structPointer, f field, size uintptr) *structRefSlice { + return &structRefSlice{p: p, f: f, size: size} +} + +// A structRefSlice represents a slice of structs (themselves submessages or groups). +type structRefSlice struct { + p structPointer + f field + size uintptr +} + +func (v *structRefSlice) Len() int { + return structPointer_Len(v.p, v.f) +} + +func (v *structRefSlice) Index(i int) structPointer { + ss := structPointer_GetStructPointer(v.p, v.f) + ss1 := structPointer_GetRefStructPointer(ss, 0) + return structPointer_Add(ss1, field(uintptr(i)*v.size)) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/properties.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/properties.go new file mode 100644 index 00000000000..44b332052ef --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/properties.go @@ -0,0 +1,968 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +package proto + +/* + * Routines for encoding data into the wire format for protocol buffers. + */ + +import ( + "fmt" + "log" + "os" + "reflect" + "sort" + "strconv" + "strings" + "sync" +) + +const debug bool = false + +// Constants that identify the encoding of a value on the wire. +const ( + WireVarint = 0 + WireFixed64 = 1 + WireBytes = 2 + WireStartGroup = 3 + WireEndGroup = 4 + WireFixed32 = 5 +) + +const startSize = 10 // initial slice/string sizes + +// Encoders are defined in encode.go +// An encoder outputs the full representation of a field, including its +// tag and encoder type. +type encoder func(p *Buffer, prop *Properties, base structPointer) error + +// A valueEncoder encodes a single integer in a particular encoding. +type valueEncoder func(o *Buffer, x uint64) error + +// Sizers are defined in encode.go +// A sizer returns the encoded size of a field, including its tag and encoder +// type. +type sizer func(prop *Properties, base structPointer) int + +// A valueSizer returns the encoded size of a single integer in a particular +// encoding. +type valueSizer func(x uint64) int + +// Decoders are defined in decode.go +// A decoder creates a value from its wire representation. +// Unrecognized subelements are saved in unrec. +type decoder func(p *Buffer, prop *Properties, base structPointer) error + +// A valueDecoder decodes a single integer in a particular encoding. +type valueDecoder func(o *Buffer) (x uint64, err error) + +// A oneofMarshaler does the marshaling for all oneof fields in a message. +type oneofMarshaler func(Message, *Buffer) error + +// A oneofUnmarshaler does the unmarshaling for a oneof field in a message. +type oneofUnmarshaler func(Message, int, int, *Buffer) (bool, error) + +// A oneofSizer does the sizing for all oneof fields in a message. +type oneofSizer func(Message) int + +// tagMap is an optimization over map[int]int for typical protocol buffer +// use-cases. Encoded protocol buffers are often in tag order with small tag +// numbers. +type tagMap struct { + fastTags []int + slowTags map[int]int +} + +// tagMapFastLimit is the upper bound on the tag number that will be stored in +// the tagMap slice rather than its map. +const tagMapFastLimit = 1024 + +func (p *tagMap) get(t int) (int, bool) { + if t > 0 && t < tagMapFastLimit { + if t >= len(p.fastTags) { + return 0, false + } + fi := p.fastTags[t] + return fi, fi >= 0 + } + fi, ok := p.slowTags[t] + return fi, ok +} + +func (p *tagMap) put(t int, fi int) { + if t > 0 && t < tagMapFastLimit { + for len(p.fastTags) < t+1 { + p.fastTags = append(p.fastTags, -1) + } + p.fastTags[t] = fi + return + } + if p.slowTags == nil { + p.slowTags = make(map[int]int) + } + p.slowTags[t] = fi +} + +// StructProperties represents properties for all the fields of a struct. +// decoderTags and decoderOrigNames should only be used by the decoder. +type StructProperties struct { + Prop []*Properties // properties for each field + reqCount int // required count + decoderTags tagMap // map from proto tag to struct field number + decoderOrigNames map[string]int // map from original name to struct field number + order []int // list of struct field numbers in tag order + unrecField field // field id of the XXX_unrecognized []byte field + extendable bool // is this an extendable proto + + oneofMarshaler oneofMarshaler + oneofUnmarshaler oneofUnmarshaler + oneofSizer oneofSizer + stype reflect.Type + + // OneofTypes contains information about the oneof fields in this message. + // It is keyed by the original name of a field. + OneofTypes map[string]*OneofProperties +} + +// OneofProperties represents information about a specific field in a oneof. +type OneofProperties struct { + Type reflect.Type // pointer to generated struct type for this oneof field + Field int // struct field number of the containing oneof in the message + Prop *Properties +} + +// Implement the sorting interface so we can sort the fields in tag order, as recommended by the spec. +// See encode.go, (*Buffer).enc_struct. + +func (sp *StructProperties) Len() int { return len(sp.order) } +func (sp *StructProperties) Less(i, j int) bool { + return sp.Prop[sp.order[i]].Tag < sp.Prop[sp.order[j]].Tag +} +func (sp *StructProperties) Swap(i, j int) { sp.order[i], sp.order[j] = sp.order[j], sp.order[i] } + +// Properties represents the protocol-specific behavior of a single struct field. +type Properties struct { + Name string // name of the field, for error messages + OrigName string // original name before protocol compiler (always set) + JSONName string // name to use for JSON; determined by protoc + Wire string + WireType int + Tag int + Required bool + Optional bool + Repeated bool + Packed bool // relevant for repeated primitives only + Enum string // set for enum types only + proto3 bool // whether this is known to be a proto3 field; set for []byte only + oneof bool // whether this is a oneof field + + Default string // default value + HasDefault bool // whether an explicit default was provided + CustomType string + StdTime bool + StdDuration bool + + enc encoder + valEnc valueEncoder // set for bool and numeric types only + field field + tagcode []byte // encoding of EncodeVarint((Tag<<3)|WireType) + tagbuf [8]byte + stype reflect.Type // set for struct types only + sstype reflect.Type // set for slices of structs types only + ctype reflect.Type // set for custom types only + sprop *StructProperties // set for struct types only + isMarshaler bool + isUnmarshaler bool + + mtype reflect.Type // set for map types only + mkeyprop *Properties // set for map types only + mvalprop *Properties // set for map types only + + size sizer + valSize valueSizer // set for bool and numeric types only + + dec decoder + valDec valueDecoder // set for bool and numeric types only + + // If this is a packable field, this will be the decoder for the packed version of the field. + packedDec decoder +} + +// String formats the properties in the protobuf struct field tag style. +func (p *Properties) String() string { + s := p.Wire + s = "," + s += strconv.Itoa(p.Tag) + if p.Required { + s += ",req" + } + if p.Optional { + s += ",opt" + } + if p.Repeated { + s += ",rep" + } + if p.Packed { + s += ",packed" + } + s += ",name=" + p.OrigName + if p.JSONName != p.OrigName { + s += ",json=" + p.JSONName + } + if p.proto3 { + s += ",proto3" + } + if p.oneof { + s += ",oneof" + } + if len(p.Enum) > 0 { + s += ",enum=" + p.Enum + } + if p.HasDefault { + s += ",def=" + p.Default + } + return s +} + +// Parse populates p by parsing a string in the protobuf struct field tag style. +func (p *Properties) Parse(s string) { + // "bytes,49,opt,name=foo,def=hello!" + fields := strings.Split(s, ",") // breaks def=, but handled below. + if len(fields) < 2 { + fmt.Fprintf(os.Stderr, "proto: tag has too few fields: %q\n", s) + return + } + + p.Wire = fields[0] + switch p.Wire { + case "varint": + p.WireType = WireVarint + p.valEnc = (*Buffer).EncodeVarint + p.valDec = (*Buffer).DecodeVarint + p.valSize = sizeVarint + case "fixed32": + p.WireType = WireFixed32 + p.valEnc = (*Buffer).EncodeFixed32 + p.valDec = (*Buffer).DecodeFixed32 + p.valSize = sizeFixed32 + case "fixed64": + p.WireType = WireFixed64 + p.valEnc = (*Buffer).EncodeFixed64 + p.valDec = (*Buffer).DecodeFixed64 + p.valSize = sizeFixed64 + case "zigzag32": + p.WireType = WireVarint + p.valEnc = (*Buffer).EncodeZigzag32 + p.valDec = (*Buffer).DecodeZigzag32 + p.valSize = sizeZigzag32 + case "zigzag64": + p.WireType = WireVarint + p.valEnc = (*Buffer).EncodeZigzag64 + p.valDec = (*Buffer).DecodeZigzag64 + p.valSize = sizeZigzag64 + case "bytes", "group": + p.WireType = WireBytes + // no numeric converter for non-numeric types + default: + fmt.Fprintf(os.Stderr, "proto: tag has unknown wire type: %q\n", s) + return + } + + var err error + p.Tag, err = strconv.Atoi(fields[1]) + if err != nil { + return + } + + for i := 2; i < len(fields); i++ { + f := fields[i] + switch { + case f == "req": + p.Required = true + case f == "opt": + p.Optional = true + case f == "rep": + p.Repeated = true + case f == "packed": + p.Packed = true + case strings.HasPrefix(f, "name="): + p.OrigName = f[5:] + case strings.HasPrefix(f, "json="): + p.JSONName = f[5:] + case strings.HasPrefix(f, "enum="): + p.Enum = f[5:] + case f == "proto3": + p.proto3 = true + case f == "oneof": + p.oneof = true + case strings.HasPrefix(f, "def="): + p.HasDefault = true + p.Default = f[4:] // rest of string + if i+1 < len(fields) { + // Commas aren't escaped, and def is always last. + p.Default += "," + strings.Join(fields[i+1:], ",") + break + } + case strings.HasPrefix(f, "embedded="): + p.OrigName = strings.Split(f, "=")[1] + case strings.HasPrefix(f, "customtype="): + p.CustomType = strings.Split(f, "=")[1] + case f == "stdtime": + p.StdTime = true + case f == "stdduration": + p.StdDuration = true + } + } +} + +func logNoSliceEnc(t1, t2 reflect.Type) { + fmt.Fprintf(os.Stderr, "proto: no slice oenc for %T = []%T\n", t1, t2) +} + +var protoMessageType = reflect.TypeOf((*Message)(nil)).Elem() + +// Initialize the fields for encoding and decoding. +func (p *Properties) setEncAndDec(typ reflect.Type, f *reflect.StructField, lockGetProp bool) { + p.enc = nil + p.dec = nil + p.size = nil + isMap := typ.Kind() == reflect.Map + if len(p.CustomType) > 0 && !isMap { + p.setCustomEncAndDec(typ) + p.setTag(lockGetProp) + return + } + if p.StdTime && !isMap { + p.setTimeEncAndDec(typ) + p.setTag(lockGetProp) + return + } + if p.StdDuration && !isMap { + p.setDurationEncAndDec(typ) + p.setTag(lockGetProp) + return + } + switch t1 := typ; t1.Kind() { + default: + fmt.Fprintf(os.Stderr, "proto: no coders for %v\n", t1) + + // proto3 scalar types + + case reflect.Bool: + if p.proto3 { + p.enc = (*Buffer).enc_proto3_bool + p.dec = (*Buffer).dec_proto3_bool + p.size = size_proto3_bool + } else { + p.enc = (*Buffer).enc_ref_bool + p.dec = (*Buffer).dec_proto3_bool + p.size = size_ref_bool + } + case reflect.Int32: + if p.proto3 { + p.enc = (*Buffer).enc_proto3_int32 + p.dec = (*Buffer).dec_proto3_int32 + p.size = size_proto3_int32 + } else { + p.enc = (*Buffer).enc_ref_int32 + p.dec = (*Buffer).dec_proto3_int32 + p.size = size_ref_int32 + } + case reflect.Uint32: + if p.proto3 { + p.enc = (*Buffer).enc_proto3_uint32 + p.dec = (*Buffer).dec_proto3_int32 // can reuse + p.size = size_proto3_uint32 + } else { + p.enc = (*Buffer).enc_ref_uint32 + p.dec = (*Buffer).dec_proto3_int32 // can reuse + p.size = size_ref_uint32 + } + case reflect.Int64, reflect.Uint64: + if p.proto3 { + p.enc = (*Buffer).enc_proto3_int64 + p.dec = (*Buffer).dec_proto3_int64 + p.size = size_proto3_int64 + } else { + p.enc = (*Buffer).enc_ref_int64 + p.dec = (*Buffer).dec_proto3_int64 + p.size = size_ref_int64 + } + case reflect.Float32: + if p.proto3 { + p.enc = (*Buffer).enc_proto3_uint32 // can just treat them as bits + p.dec = (*Buffer).dec_proto3_int32 + p.size = size_proto3_uint32 + } else { + p.enc = (*Buffer).enc_ref_uint32 // can just treat them as bits + p.dec = (*Buffer).dec_proto3_int32 + p.size = size_ref_uint32 + } + case reflect.Float64: + if p.proto3 { + p.enc = (*Buffer).enc_proto3_int64 // can just treat them as bits + p.dec = (*Buffer).dec_proto3_int64 + p.size = size_proto3_int64 + } else { + p.enc = (*Buffer).enc_ref_int64 // can just treat them as bits + p.dec = (*Buffer).dec_proto3_int64 + p.size = size_ref_int64 + } + case reflect.String: + if p.proto3 { + p.enc = (*Buffer).enc_proto3_string + p.dec = (*Buffer).dec_proto3_string + p.size = size_proto3_string + } else { + p.enc = (*Buffer).enc_ref_string + p.dec = (*Buffer).dec_proto3_string + p.size = size_ref_string + } + case reflect.Struct: + p.stype = typ + p.isMarshaler = isMarshaler(typ) + p.isUnmarshaler = isUnmarshaler(typ) + if p.Wire == "bytes" { + p.enc = (*Buffer).enc_ref_struct_message + p.dec = (*Buffer).dec_ref_struct_message + p.size = size_ref_struct_message + } else { + fmt.Fprintf(os.Stderr, "proto: no coders for struct %T\n", typ) + } + + case reflect.Ptr: + switch t2 := t1.Elem(); t2.Kind() { + default: + fmt.Fprintf(os.Stderr, "proto: no encoder function for %v -> %v\n", t1, t2) + break + case reflect.Bool: + p.enc = (*Buffer).enc_bool + p.dec = (*Buffer).dec_bool + p.size = size_bool + case reflect.Int32: + p.enc = (*Buffer).enc_int32 + p.dec = (*Buffer).dec_int32 + p.size = size_int32 + case reflect.Uint32: + p.enc = (*Buffer).enc_uint32 + p.dec = (*Buffer).dec_int32 // can reuse + p.size = size_uint32 + case reflect.Int64, reflect.Uint64: + p.enc = (*Buffer).enc_int64 + p.dec = (*Buffer).dec_int64 + p.size = size_int64 + case reflect.Float32: + p.enc = (*Buffer).enc_uint32 // can just treat them as bits + p.dec = (*Buffer).dec_int32 + p.size = size_uint32 + case reflect.Float64: + p.enc = (*Buffer).enc_int64 // can just treat them as bits + p.dec = (*Buffer).dec_int64 + p.size = size_int64 + case reflect.String: + p.enc = (*Buffer).enc_string + p.dec = (*Buffer).dec_string + p.size = size_string + case reflect.Struct: + p.stype = t1.Elem() + p.isMarshaler = isMarshaler(t1) + p.isUnmarshaler = isUnmarshaler(t1) + if p.Wire == "bytes" { + p.enc = (*Buffer).enc_struct_message + p.dec = (*Buffer).dec_struct_message + p.size = size_struct_message + } else { + p.enc = (*Buffer).enc_struct_group + p.dec = (*Buffer).dec_struct_group + p.size = size_struct_group + } + } + + case reflect.Slice: + switch t2 := t1.Elem(); t2.Kind() { + default: + logNoSliceEnc(t1, t2) + break + case reflect.Bool: + if p.Packed { + p.enc = (*Buffer).enc_slice_packed_bool + p.size = size_slice_packed_bool + } else { + p.enc = (*Buffer).enc_slice_bool + p.size = size_slice_bool + } + p.dec = (*Buffer).dec_slice_bool + p.packedDec = (*Buffer).dec_slice_packed_bool + case reflect.Int32: + if p.Packed { + p.enc = (*Buffer).enc_slice_packed_int32 + p.size = size_slice_packed_int32 + } else { + p.enc = (*Buffer).enc_slice_int32 + p.size = size_slice_int32 + } + p.dec = (*Buffer).dec_slice_int32 + p.packedDec = (*Buffer).dec_slice_packed_int32 + case reflect.Uint32: + if p.Packed { + p.enc = (*Buffer).enc_slice_packed_uint32 + p.size = size_slice_packed_uint32 + } else { + p.enc = (*Buffer).enc_slice_uint32 + p.size = size_slice_uint32 + } + p.dec = (*Buffer).dec_slice_int32 + p.packedDec = (*Buffer).dec_slice_packed_int32 + case reflect.Int64, reflect.Uint64: + if p.Packed { + p.enc = (*Buffer).enc_slice_packed_int64 + p.size = size_slice_packed_int64 + } else { + p.enc = (*Buffer).enc_slice_int64 + p.size = size_slice_int64 + } + p.dec = (*Buffer).dec_slice_int64 + p.packedDec = (*Buffer).dec_slice_packed_int64 + case reflect.Uint8: + p.dec = (*Buffer).dec_slice_byte + if p.proto3 { + p.enc = (*Buffer).enc_proto3_slice_byte + p.size = size_proto3_slice_byte + } else { + p.enc = (*Buffer).enc_slice_byte + p.size = size_slice_byte + } + case reflect.Float32, reflect.Float64: + switch t2.Bits() { + case 32: + // can just treat them as bits + if p.Packed { + p.enc = (*Buffer).enc_slice_packed_uint32 + p.size = size_slice_packed_uint32 + } else { + p.enc = (*Buffer).enc_slice_uint32 + p.size = size_slice_uint32 + } + p.dec = (*Buffer).dec_slice_int32 + p.packedDec = (*Buffer).dec_slice_packed_int32 + case 64: + // can just treat them as bits + if p.Packed { + p.enc = (*Buffer).enc_slice_packed_int64 + p.size = size_slice_packed_int64 + } else { + p.enc = (*Buffer).enc_slice_int64 + p.size = size_slice_int64 + } + p.dec = (*Buffer).dec_slice_int64 + p.packedDec = (*Buffer).dec_slice_packed_int64 + default: + logNoSliceEnc(t1, t2) + break + } + case reflect.String: + p.enc = (*Buffer).enc_slice_string + p.dec = (*Buffer).dec_slice_string + p.size = size_slice_string + case reflect.Ptr: + switch t3 := t2.Elem(); t3.Kind() { + default: + fmt.Fprintf(os.Stderr, "proto: no ptr oenc for %T -> %T -> %T\n", t1, t2, t3) + break + case reflect.Struct: + p.stype = t2.Elem() + p.isMarshaler = isMarshaler(t2) + p.isUnmarshaler = isUnmarshaler(t2) + if p.Wire == "bytes" { + p.enc = (*Buffer).enc_slice_struct_message + p.dec = (*Buffer).dec_slice_struct_message + p.size = size_slice_struct_message + } else { + p.enc = (*Buffer).enc_slice_struct_group + p.dec = (*Buffer).dec_slice_struct_group + p.size = size_slice_struct_group + } + } + case reflect.Slice: + switch t2.Elem().Kind() { + default: + fmt.Fprintf(os.Stderr, "proto: no slice elem oenc for %T -> %T -> %T\n", t1, t2, t2.Elem()) + break + case reflect.Uint8: + p.enc = (*Buffer).enc_slice_slice_byte + p.dec = (*Buffer).dec_slice_slice_byte + p.size = size_slice_slice_byte + } + case reflect.Struct: + p.setSliceOfNonPointerStructs(t1) + } + + case reflect.Map: + p.enc = (*Buffer).enc_new_map + p.dec = (*Buffer).dec_new_map + p.size = size_new_map + + p.mtype = t1 + p.mkeyprop = &Properties{} + p.mkeyprop.init(reflect.PtrTo(p.mtype.Key()), "Key", f.Tag.Get("protobuf_key"), nil, lockGetProp) + p.mvalprop = &Properties{} + vtype := p.mtype.Elem() + if vtype.Kind() != reflect.Ptr && vtype.Kind() != reflect.Slice { + // The value type is not a message (*T) or bytes ([]byte), + // so we need encoders for the pointer to this type. + vtype = reflect.PtrTo(vtype) + } + + p.mvalprop.CustomType = p.CustomType + p.mvalprop.StdDuration = p.StdDuration + p.mvalprop.StdTime = p.StdTime + p.mvalprop.init(vtype, "Value", f.Tag.Get("protobuf_val"), nil, lockGetProp) + } + p.setTag(lockGetProp) +} + +func (p *Properties) setTag(lockGetProp bool) { + // precalculate tag code + wire := p.WireType + if p.Packed { + wire = WireBytes + } + x := uint32(p.Tag)<<3 | uint32(wire) + i := 0 + for i = 0; x > 127; i++ { + p.tagbuf[i] = 0x80 | uint8(x&0x7F) + x >>= 7 + } + p.tagbuf[i] = uint8(x) + p.tagcode = p.tagbuf[0 : i+1] + + if p.stype != nil { + if lockGetProp { + p.sprop = GetProperties(p.stype) + } else { + p.sprop = getPropertiesLocked(p.stype) + } + } +} + +var ( + marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem() + unmarshalerType = reflect.TypeOf((*Unmarshaler)(nil)).Elem() +) + +// isMarshaler reports whether type t implements Marshaler. +func isMarshaler(t reflect.Type) bool { + return t.Implements(marshalerType) +} + +// isUnmarshaler reports whether type t implements Unmarshaler. +func isUnmarshaler(t reflect.Type) bool { + return t.Implements(unmarshalerType) +} + +// Init populates the properties from a protocol buffer struct tag. +func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) { + p.init(typ, name, tag, f, true) +} + +func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructField, lockGetProp bool) { + // "bytes,49,opt,def=hello!" + p.Name = name + p.OrigName = name + if f != nil { + p.field = toField(f) + } + if tag == "" { + return + } + p.Parse(tag) + p.setEncAndDec(typ, f, lockGetProp) +} + +var ( + propertiesMu sync.RWMutex + propertiesMap = make(map[reflect.Type]*StructProperties) +) + +// GetProperties returns the list of properties for the type represented by t. +// t must represent a generated struct type of a protocol message. +func GetProperties(t reflect.Type) *StructProperties { + if t.Kind() != reflect.Struct { + panic("proto: type must have kind struct") + } + + // Most calls to GetProperties in a long-running program will be + // retrieving details for types we have seen before. + propertiesMu.RLock() + sprop, ok := propertiesMap[t] + propertiesMu.RUnlock() + if ok { + if collectStats { + stats.Chit++ + } + return sprop + } + + propertiesMu.Lock() + sprop = getPropertiesLocked(t) + propertiesMu.Unlock() + return sprop +} + +// getPropertiesLocked requires that propertiesMu is held. +func getPropertiesLocked(t reflect.Type) *StructProperties { + if prop, ok := propertiesMap[t]; ok { + if collectStats { + stats.Chit++ + } + return prop + } + if collectStats { + stats.Cmiss++ + } + + prop := new(StructProperties) + // in case of recursive protos, fill this in now. + propertiesMap[t] = prop + + // build properties + prop.extendable = reflect.PtrTo(t).Implements(extendableProtoType) || + reflect.PtrTo(t).Implements(extendableProtoV1Type) || + reflect.PtrTo(t).Implements(extendableBytesType) + prop.unrecField = invalidField + prop.Prop = make([]*Properties, t.NumField()) + prop.order = make([]int, t.NumField()) + + isOneofMessage := false + for i := 0; i < t.NumField(); i++ { + f := t.Field(i) + p := new(Properties) + name := f.Name + p.init(f.Type, name, f.Tag.Get("protobuf"), &f, false) + + if f.Name == "XXX_InternalExtensions" { // special case + p.enc = (*Buffer).enc_exts + p.dec = nil // not needed + p.size = size_exts + } else if f.Name == "XXX_extensions" { // special case + if len(f.Tag.Get("protobuf")) > 0 { + p.enc = (*Buffer).enc_ext_slice_byte + p.dec = nil // not needed + p.size = size_ext_slice_byte + } else { + p.enc = (*Buffer).enc_map + p.dec = nil // not needed + p.size = size_map + } + } else if f.Name == "XXX_unrecognized" { // special case + prop.unrecField = toField(&f) + } + oneof := f.Tag.Get("protobuf_oneof") // special case + if oneof != "" { + isOneofMessage = true + // Oneof fields don't use the traditional protobuf tag. + p.OrigName = oneof + } + prop.Prop[i] = p + prop.order[i] = i + if debug { + print(i, " ", f.Name, " ", t.String(), " ") + if p.Tag > 0 { + print(p.String()) + } + print("\n") + } + if p.enc == nil && !strings.HasPrefix(f.Name, "XXX_") && oneof == "" { + fmt.Fprintln(os.Stderr, "proto: no encoder for", f.Name, f.Type.String(), "[GetProperties]") + } + } + + // Re-order prop.order. + sort.Sort(prop) + + type oneofMessage interface { + XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) + } + if om, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); isOneofMessage && ok { + var oots []interface{} + prop.oneofMarshaler, prop.oneofUnmarshaler, prop.oneofSizer, oots = om.XXX_OneofFuncs() + prop.stype = t + + // Interpret oneof metadata. + prop.OneofTypes = make(map[string]*OneofProperties) + for _, oot := range oots { + oop := &OneofProperties{ + Type: reflect.ValueOf(oot).Type(), // *T + Prop: new(Properties), + } + sft := oop.Type.Elem().Field(0) + oop.Prop.Name = sft.Name + oop.Prop.Parse(sft.Tag.Get("protobuf")) + // There will be exactly one interface field that + // this new value is assignable to. + for i := 0; i < t.NumField(); i++ { + f := t.Field(i) + if f.Type.Kind() != reflect.Interface { + continue + } + if !oop.Type.AssignableTo(f.Type) { + continue + } + oop.Field = i + break + } + prop.OneofTypes[oop.Prop.OrigName] = oop + } + } + + // build required counts + // build tags + reqCount := 0 + prop.decoderOrigNames = make(map[string]int) + for i, p := range prop.Prop { + if strings.HasPrefix(p.Name, "XXX_") { + // Internal fields should not appear in tags/origNames maps. + // They are handled specially when encoding and decoding. + continue + } + if p.Required { + reqCount++ + } + prop.decoderTags.put(p.Tag, i) + prop.decoderOrigNames[p.OrigName] = i + } + prop.reqCount = reqCount + + return prop +} + +// Return the Properties object for the x[0]'th field of the structure. +func propByIndex(t reflect.Type, x []int) *Properties { + if len(x) != 1 { + fmt.Fprintf(os.Stderr, "proto: field index dimension %d (not 1) for type %s\n", len(x), t) + return nil + } + prop := GetProperties(t) + return prop.Prop[x[0]] +} + +// Get the address and type of a pointer to a struct from an interface. +func getbase(pb Message) (t reflect.Type, b structPointer, err error) { + if pb == nil { + err = ErrNil + return + } + // get the reflect type of the pointer to the struct. + t = reflect.TypeOf(pb) + // get the address of the struct. + value := reflect.ValueOf(pb) + b = toStructPointer(value) + return +} + +// A global registry of enum types. +// The generated code will register the generated maps by calling RegisterEnum. + +var enumValueMaps = make(map[string]map[string]int32) +var enumStringMaps = make(map[string]map[int32]string) + +// RegisterEnum is called from the generated code to install the enum descriptor +// maps into the global table to aid parsing text format protocol buffers. +func RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) { + if _, ok := enumValueMaps[typeName]; ok { + panic("proto: duplicate enum registered: " + typeName) + } + enumValueMaps[typeName] = valueMap + if _, ok := enumStringMaps[typeName]; ok { + panic("proto: duplicate enum registered: " + typeName) + } + enumStringMaps[typeName] = unusedNameMap +} + +// EnumValueMap returns the mapping from names to integers of the +// enum type enumType, or a nil if not found. +func EnumValueMap(enumType string) map[string]int32 { + return enumValueMaps[enumType] +} + +// A registry of all linked message types. +// The string is a fully-qualified proto name ("pkg.Message"). +var ( + protoTypes = make(map[string]reflect.Type) + revProtoTypes = make(map[reflect.Type]string) +) + +// RegisterType is called from generated code and maps from the fully qualified +// proto name to the type (pointer to struct) of the protocol buffer. +func RegisterType(x Message, name string) { + if _, ok := protoTypes[name]; ok { + // TODO: Some day, make this a panic. + log.Printf("proto: duplicate proto type registered: %s", name) + return + } + t := reflect.TypeOf(x) + protoTypes[name] = t + revProtoTypes[t] = name +} + +// MessageName returns the fully-qualified proto name for the given message type. +func MessageName(x Message) string { + type xname interface { + XXX_MessageName() string + } + if m, ok := x.(xname); ok { + return m.XXX_MessageName() + } + return revProtoTypes[reflect.TypeOf(x)] +} + +// MessageType returns the message type (pointer to struct) for a named message. +func MessageType(name string) reflect.Type { return protoTypes[name] } + +// A registry of all linked proto files. +var ( + protoFiles = make(map[string][]byte) // file name => fileDescriptor +) + +// RegisterFile is called from generated code and maps from the +// full file name of a .proto file to its compressed FileDescriptorProto. +func RegisterFile(filename string, fileDescriptor []byte) { + protoFiles[filename] = fileDescriptor +} + +// FileDescriptor returns the compressed FileDescriptorProto for a .proto file. +func FileDescriptor(filename string) []byte { return protoFiles[filename] } diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/properties_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/properties_gogo.go new file mode 100644 index 00000000000..b6b7176c565 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/properties_gogo.go @@ -0,0 +1,111 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package proto + +import ( + "fmt" + "os" + "reflect" +) + +func (p *Properties) setCustomEncAndDec(typ reflect.Type) { + p.ctype = typ + if p.Repeated { + p.enc = (*Buffer).enc_custom_slice_bytes + p.dec = (*Buffer).dec_custom_slice_bytes + p.size = size_custom_slice_bytes + } else if typ.Kind() == reflect.Ptr { + p.enc = (*Buffer).enc_custom_bytes + p.dec = (*Buffer).dec_custom_bytes + p.size = size_custom_bytes + } else { + p.enc = (*Buffer).enc_custom_ref_bytes + p.dec = (*Buffer).dec_custom_ref_bytes + p.size = size_custom_ref_bytes + } +} + +func (p *Properties) setDurationEncAndDec(typ reflect.Type) { + if p.Repeated { + if typ.Elem().Kind() == reflect.Ptr { + p.enc = (*Buffer).enc_slice_duration + p.dec = (*Buffer).dec_slice_duration + p.size = size_slice_duration + } else { + p.enc = (*Buffer).enc_slice_ref_duration + p.dec = (*Buffer).dec_slice_ref_duration + p.size = size_slice_ref_duration + } + } else if typ.Kind() == reflect.Ptr { + p.enc = (*Buffer).enc_duration + p.dec = (*Buffer).dec_duration + p.size = size_duration + } else { + p.enc = (*Buffer).enc_ref_duration + p.dec = (*Buffer).dec_ref_duration + p.size = size_ref_duration + } +} + +func (p *Properties) setTimeEncAndDec(typ reflect.Type) { + if p.Repeated { + if typ.Elem().Kind() == reflect.Ptr { + p.enc = (*Buffer).enc_slice_time + p.dec = (*Buffer).dec_slice_time + p.size = size_slice_time + } else { + p.enc = (*Buffer).enc_slice_ref_time + p.dec = (*Buffer).dec_slice_ref_time + p.size = size_slice_ref_time + } + } else if typ.Kind() == reflect.Ptr { + p.enc = (*Buffer).enc_time + p.dec = (*Buffer).dec_time + p.size = size_time + } else { + p.enc = (*Buffer).enc_ref_time + p.dec = (*Buffer).dec_ref_time + p.size = size_ref_time + } + +} + +func (p *Properties) setSliceOfNonPointerStructs(typ reflect.Type) { + t2 := typ.Elem() + p.sstype = typ + p.stype = t2 + p.isMarshaler = isMarshaler(t2) + p.isUnmarshaler = isUnmarshaler(t2) + p.enc = (*Buffer).enc_slice_ref_struct_message + p.dec = (*Buffer).dec_slice_ref_struct_message + p.size = size_slice_ref_struct_message + if p.Wire != "bytes" { + fmt.Fprintf(os.Stderr, "proto: no ptr oenc for %T -> %T \n", typ, t2) + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/proto3_proto/proto3.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/proto3_proto/proto3.pb.go new file mode 100644 index 00000000000..c3e7b6b76ac --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/proto3_proto/proto3.pb.go @@ -0,0 +1,347 @@ +// Code generated by protoc-gen-gogo. +// source: proto3_proto/proto3.proto +// DO NOT EDIT! + +/* +Package proto3_proto is a generated protocol buffer package. + +It is generated from these files: + proto3_proto/proto3.proto + +It has these top-level messages: + Message + Nested + MessageWithMap + IntMap + IntMaps +*/ +package proto3_proto + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import google_protobuf "github.com/gogo/protobuf/types" +import testdata "github.com/gogo/protobuf/proto/testdata" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type Message_Humour int32 + +const ( + Message_UNKNOWN Message_Humour = 0 + Message_PUNS Message_Humour = 1 + Message_SLAPSTICK Message_Humour = 2 + Message_BILL_BAILEY Message_Humour = 3 +) + +var Message_Humour_name = map[int32]string{ + 0: "UNKNOWN", + 1: "PUNS", + 2: "SLAPSTICK", + 3: "BILL_BAILEY", +} +var Message_Humour_value = map[string]int32{ + "UNKNOWN": 0, + "PUNS": 1, + "SLAPSTICK": 2, + "BILL_BAILEY": 3, +} + +func (x Message_Humour) String() string { + return proto.EnumName(Message_Humour_name, int32(x)) +} +func (Message_Humour) EnumDescriptor() ([]byte, []int) { return fileDescriptorProto3, []int{0, 0} } + +type Message struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Hilarity Message_Humour `protobuf:"varint,2,opt,name=hilarity,proto3,enum=proto3_proto.Message_Humour" json:"hilarity,omitempty"` + HeightInCm uint32 `protobuf:"varint,3,opt,name=height_in_cm,json=heightInCm,proto3" json:"height_in_cm,omitempty"` + Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` + ResultCount int64 `protobuf:"varint,7,opt,name=result_count,json=resultCount,proto3" json:"result_count,omitempty"` + TrueScotsman bool `protobuf:"varint,8,opt,name=true_scotsman,json=trueScotsman,proto3" json:"true_scotsman,omitempty"` + Score float32 `protobuf:"fixed32,9,opt,name=score,proto3" json:"score,omitempty"` + Key []uint64 `protobuf:"varint,5,rep,packed,name=key" json:"key,omitempty"` + ShortKey []int32 `protobuf:"varint,19,rep,packed,name=short_key,json=shortKey" json:"short_key,omitempty"` + Nested *Nested `protobuf:"bytes,6,opt,name=nested" json:"nested,omitempty"` + RFunny []Message_Humour `protobuf:"varint,16,rep,packed,name=r_funny,json=rFunny,enum=proto3_proto.Message_Humour" json:"r_funny,omitempty"` + Terrain map[string]*Nested `protobuf:"bytes,10,rep,name=terrain" json:"terrain,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"` + Proto2Field *testdata.SubDefaults `protobuf:"bytes,11,opt,name=proto2_field,json=proto2Field" json:"proto2_field,omitempty"` + Proto2Value map[string]*testdata.SubDefaults `protobuf:"bytes,13,rep,name=proto2_value,json=proto2Value" json:"proto2_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"` + Anything *google_protobuf.Any `protobuf:"bytes,14,opt,name=anything" json:"anything,omitempty"` + ManyThings []*google_protobuf.Any `protobuf:"bytes,15,rep,name=many_things,json=manyThings" json:"many_things,omitempty"` + Submessage *Message `protobuf:"bytes,17,opt,name=submessage" json:"submessage,omitempty"` + Children []*Message `protobuf:"bytes,18,rep,name=children" json:"children,omitempty"` +} + +func (m *Message) Reset() { *m = Message{} } +func (m *Message) String() string { return proto.CompactTextString(m) } +func (*Message) ProtoMessage() {} +func (*Message) Descriptor() ([]byte, []int) { return fileDescriptorProto3, []int{0} } + +func (m *Message) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Message) GetHilarity() Message_Humour { + if m != nil { + return m.Hilarity + } + return Message_UNKNOWN +} + +func (m *Message) GetHeightInCm() uint32 { + if m != nil { + return m.HeightInCm + } + return 0 +} + +func (m *Message) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +func (m *Message) GetResultCount() int64 { + if m != nil { + return m.ResultCount + } + return 0 +} + +func (m *Message) GetTrueScotsman() bool { + if m != nil { + return m.TrueScotsman + } + return false +} + +func (m *Message) GetScore() float32 { + if m != nil { + return m.Score + } + return 0 +} + +func (m *Message) GetKey() []uint64 { + if m != nil { + return m.Key + } + return nil +} + +func (m *Message) GetShortKey() []int32 { + if m != nil { + return m.ShortKey + } + return nil +} + +func (m *Message) GetNested() *Nested { + if m != nil { + return m.Nested + } + return nil +} + +func (m *Message) GetRFunny() []Message_Humour { + if m != nil { + return m.RFunny + } + return nil +} + +func (m *Message) GetTerrain() map[string]*Nested { + if m != nil { + return m.Terrain + } + return nil +} + +func (m *Message) GetProto2Field() *testdata.SubDefaults { + if m != nil { + return m.Proto2Field + } + return nil +} + +func (m *Message) GetProto2Value() map[string]*testdata.SubDefaults { + if m != nil { + return m.Proto2Value + } + return nil +} + +func (m *Message) GetAnything() *google_protobuf.Any { + if m != nil { + return m.Anything + } + return nil +} + +func (m *Message) GetManyThings() []*google_protobuf.Any { + if m != nil { + return m.ManyThings + } + return nil +} + +func (m *Message) GetSubmessage() *Message { + if m != nil { + return m.Submessage + } + return nil +} + +func (m *Message) GetChildren() []*Message { + if m != nil { + return m.Children + } + return nil +} + +type Nested struct { + Bunny string `protobuf:"bytes,1,opt,name=bunny,proto3" json:"bunny,omitempty"` + Cute bool `protobuf:"varint,2,opt,name=cute,proto3" json:"cute,omitempty"` +} + +func (m *Nested) Reset() { *m = Nested{} } +func (m *Nested) String() string { return proto.CompactTextString(m) } +func (*Nested) ProtoMessage() {} +func (*Nested) Descriptor() ([]byte, []int) { return fileDescriptorProto3, []int{1} } + +func (m *Nested) GetBunny() string { + if m != nil { + return m.Bunny + } + return "" +} + +func (m *Nested) GetCute() bool { + if m != nil { + return m.Cute + } + return false +} + +type MessageWithMap struct { + ByteMapping map[bool][]byte `protobuf:"bytes,1,rep,name=byte_mapping,json=byteMapping" json:"byte_mapping,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (m *MessageWithMap) Reset() { *m = MessageWithMap{} } +func (m *MessageWithMap) String() string { return proto.CompactTextString(m) } +func (*MessageWithMap) ProtoMessage() {} +func (*MessageWithMap) Descriptor() ([]byte, []int) { return fileDescriptorProto3, []int{2} } + +func (m *MessageWithMap) GetByteMapping() map[bool][]byte { + if m != nil { + return m.ByteMapping + } + return nil +} + +type IntMap struct { + Rtt map[int32]int32 `protobuf:"bytes,1,rep,name=rtt" json:"rtt,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` +} + +func (m *IntMap) Reset() { *m = IntMap{} } +func (m *IntMap) String() string { return proto.CompactTextString(m) } +func (*IntMap) ProtoMessage() {} +func (*IntMap) Descriptor() ([]byte, []int) { return fileDescriptorProto3, []int{3} } + +func (m *IntMap) GetRtt() map[int32]int32 { + if m != nil { + return m.Rtt + } + return nil +} + +type IntMaps struct { + Maps []*IntMap `protobuf:"bytes,1,rep,name=maps" json:"maps,omitempty"` +} + +func (m *IntMaps) Reset() { *m = IntMaps{} } +func (m *IntMaps) String() string { return proto.CompactTextString(m) } +func (*IntMaps) ProtoMessage() {} +func (*IntMaps) Descriptor() ([]byte, []int) { return fileDescriptorProto3, []int{4} } + +func (m *IntMaps) GetMaps() []*IntMap { + if m != nil { + return m.Maps + } + return nil +} + +func init() { + proto.RegisterType((*Message)(nil), "proto3_proto.Message") + proto.RegisterType((*Nested)(nil), "proto3_proto.Nested") + proto.RegisterType((*MessageWithMap)(nil), "proto3_proto.MessageWithMap") + proto.RegisterType((*IntMap)(nil), "proto3_proto.IntMap") + proto.RegisterType((*IntMaps)(nil), "proto3_proto.IntMaps") + proto.RegisterEnum("proto3_proto.Message_Humour", Message_Humour_name, Message_Humour_value) +} + +func init() { proto.RegisterFile("proto3_proto/proto3.proto", fileDescriptorProto3) } + +var fileDescriptorProto3 = []byte{ + // 733 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0x53, 0x6d, 0x6f, 0xf3, 0x34, + 0x14, 0x25, 0x4d, 0x5f, 0xd2, 0x9b, 0x74, 0x0b, 0x5e, 0x91, 0xbc, 0x02, 0x52, 0x28, 0x12, 0x8a, + 0x78, 0x49, 0xa1, 0xd3, 0xd0, 0x84, 0x10, 0x68, 0x1b, 0x9b, 0xa8, 0xd6, 0x95, 0xca, 0xdd, 0x98, + 0xf8, 0x14, 0xa5, 0xad, 0xdb, 0x46, 0x34, 0x4e, 0x49, 0x1c, 0xa4, 0xfc, 0x1d, 0xfe, 0x28, 0x8f, + 0x6c, 0xa7, 0x5d, 0x36, 0x65, 0xcf, 0xf3, 0x29, 0xf6, 0xf1, 0xb9, 0xf7, 0x9c, 0x1c, 0x5f, 0xc3, + 0xe9, 0x2e, 0x89, 0x79, 0x7c, 0xe6, 0xcb, 0xcf, 0x40, 0x6d, 0x3c, 0xf9, 0x41, 0x56, 0xf9, 0xa8, + 0x77, 0xba, 0x8e, 0xe3, 0xf5, 0x96, 0x2a, 0xca, 0x3c, 0x5b, 0x0d, 0x02, 0x96, 0x2b, 0x62, 0xef, + 0x84, 0xd3, 0x94, 0x2f, 0x03, 0x1e, 0x0c, 0xc4, 0x42, 0x81, 0xfd, 0xff, 0x5b, 0xd0, 0xba, 0xa7, + 0x69, 0x1a, 0xac, 0x29, 0x42, 0x50, 0x67, 0x41, 0x44, 0xb1, 0xe6, 0x68, 0x6e, 0x9b, 0xc8, 0x35, + 0xba, 0x00, 0x63, 0x13, 0x6e, 0x83, 0x24, 0xe4, 0x39, 0xae, 0x39, 0x9a, 0x7b, 0x34, 0xfc, 0xcc, + 0x2b, 0x0b, 0x7a, 0x45, 0xb1, 0xf7, 0x7b, 0x16, 0xc5, 0x59, 0x42, 0x0e, 0x6c, 0xe4, 0x80, 0xb5, + 0xa1, 0xe1, 0x7a, 0xc3, 0xfd, 0x90, 0xf9, 0x8b, 0x08, 0xeb, 0x8e, 0xe6, 0x76, 0x08, 0x28, 0x6c, + 0xc4, 0xae, 0x23, 0xa1, 0x27, 0xec, 0xe0, 0xba, 0xa3, 0xb9, 0x16, 0x91, 0x6b, 0xf4, 0x05, 0x58, + 0x09, 0x4d, 0xb3, 0x2d, 0xf7, 0x17, 0x71, 0xc6, 0x38, 0x6e, 0x39, 0x9a, 0xab, 0x13, 0x53, 0x61, + 0xd7, 0x02, 0x42, 0x5f, 0x42, 0x87, 0x27, 0x19, 0xf5, 0xd3, 0x45, 0xcc, 0xd3, 0x28, 0x60, 0xd8, + 0x70, 0x34, 0xd7, 0x20, 0x96, 0x00, 0x67, 0x05, 0x86, 0xba, 0xd0, 0x48, 0x17, 0x71, 0x42, 0x71, + 0xdb, 0xd1, 0xdc, 0x1a, 0x51, 0x1b, 0x64, 0x83, 0xfe, 0x37, 0xcd, 0x71, 0xc3, 0xd1, 0xdd, 0x3a, + 0x11, 0x4b, 0xf4, 0x29, 0xb4, 0xd3, 0x4d, 0x9c, 0x70, 0x5f, 0xe0, 0x27, 0x8e, 0xee, 0x36, 0x88, + 0x21, 0x81, 0x3b, 0x9a, 0xa3, 0x6f, 0xa1, 0xc9, 0x68, 0xca, 0xe9, 0x12, 0x37, 0x1d, 0xcd, 0x35, + 0x87, 0xdd, 0x97, 0xbf, 0x3e, 0x91, 0x67, 0xa4, 0xe0, 0xa0, 0x73, 0x68, 0x25, 0xfe, 0x2a, 0x63, + 0x2c, 0xc7, 0xb6, 0xa3, 0x7f, 0x30, 0xa9, 0x66, 0x72, 0x2b, 0xb8, 0xe8, 0x67, 0x68, 0x71, 0x9a, + 0x24, 0x41, 0xc8, 0x30, 0x38, 0xba, 0x6b, 0x0e, 0xfb, 0xd5, 0x65, 0x0f, 0x8a, 0x74, 0xc3, 0x78, + 0x92, 0x93, 0x7d, 0x09, 0xba, 0x00, 0x75, 0xff, 0x43, 0x7f, 0x15, 0xd2, 0xed, 0x12, 0x9b, 0xd2, + 0xe8, 0x27, 0xde, 0xfe, 0xae, 0xbd, 0x59, 0x36, 0xff, 0x8d, 0xae, 0x82, 0x6c, 0xcb, 0x53, 0x62, + 0x2a, 0xea, 0xad, 0x60, 0xa2, 0xd1, 0xa1, 0xf2, 0xdf, 0x60, 0x9b, 0x51, 0xdc, 0x91, 0xe2, 0x5f, + 0x55, 0x8b, 0x4f, 0x25, 0xf3, 0x4f, 0x41, 0x54, 0x06, 0x8a, 0x56, 0x12, 0x41, 0xdf, 0x83, 0x11, + 0xb0, 0x9c, 0x6f, 0x42, 0xb6, 0xc6, 0x47, 0x45, 0x52, 0x6a, 0x0e, 0xbd, 0xfd, 0x1c, 0x7a, 0x97, + 0x2c, 0x27, 0x07, 0x16, 0x3a, 0x07, 0x33, 0x0a, 0x58, 0xee, 0xcb, 0x5d, 0x8a, 0x8f, 0xa5, 0x76, + 0x75, 0x11, 0x08, 0xe2, 0x83, 0xe4, 0xa1, 0x73, 0x80, 0x34, 0x9b, 0x47, 0xca, 0x14, 0xfe, 0xb8, + 0xf8, 0xd7, 0x2a, 0xc7, 0xa4, 0x44, 0x44, 0x3f, 0x80, 0xb1, 0xd8, 0x84, 0xdb, 0x65, 0x42, 0x19, + 0x46, 0x52, 0xea, 0x8d, 0xa2, 0x03, 0xad, 0x37, 0x05, 0xab, 0x1c, 0xf8, 0x7e, 0x72, 0xd4, 0xd3, + 0x90, 0x93, 0xf3, 0x35, 0x34, 0x54, 0x70, 0xb5, 0xf7, 0xcc, 0x86, 0xa2, 0xfc, 0x54, 0xbb, 0xd0, + 0x7a, 0x8f, 0x60, 0xbf, 0x4e, 0xb1, 0xa2, 0xeb, 0x37, 0x2f, 0xbb, 0xbe, 0x71, 0x91, 0xcf, 0x6d, + 0xfb, 0xbf, 0x42, 0x53, 0x0d, 0x14, 0x32, 0xa1, 0xf5, 0x38, 0xb9, 0x9b, 0xfc, 0xf1, 0x34, 0xb1, + 0x3f, 0x42, 0x06, 0xd4, 0xa7, 0x8f, 0x93, 0x99, 0xad, 0xa1, 0x0e, 0xb4, 0x67, 0xe3, 0xcb, 0xe9, + 0xec, 0x61, 0x74, 0x7d, 0x67, 0xd7, 0xd0, 0x31, 0x98, 0x57, 0xa3, 0xf1, 0xd8, 0xbf, 0xba, 0x1c, + 0x8d, 0x6f, 0xfe, 0xb2, 0xf5, 0xfe, 0x10, 0x9a, 0xca, 0xac, 0x78, 0x33, 0x73, 0x39, 0xbe, 0xca, + 0x8f, 0xda, 0x88, 0x57, 0xba, 0xc8, 0xb8, 0x32, 0x64, 0x10, 0xb9, 0xee, 0xff, 0xa7, 0xc1, 0x51, + 0x91, 0xd9, 0x53, 0xc8, 0x37, 0xf7, 0xc1, 0x0e, 0x4d, 0xc1, 0x9a, 0xe7, 0x9c, 0xfa, 0x51, 0xb0, + 0xdb, 0x89, 0x39, 0xd0, 0x64, 0xce, 0xdf, 0x55, 0xe6, 0x5c, 0xd4, 0x78, 0x57, 0x39, 0xa7, 0xf7, + 0x8a, 0x5f, 0x4c, 0xd5, 0xfc, 0x19, 0xe9, 0xfd, 0x02, 0xf6, 0x6b, 0x42, 0x39, 0x30, 0x43, 0x05, + 0xd6, 0x2d, 0x07, 0x66, 0x95, 0x93, 0xf9, 0x07, 0x9a, 0x23, 0xc6, 0x85, 0xb7, 0x01, 0xe8, 0x09, + 0xe7, 0x85, 0xa5, 0xcf, 0x5f, 0x5a, 0x52, 0x14, 0x8f, 0x70, 0xae, 0x2c, 0x08, 0x66, 0xef, 0x47, + 0x30, 0xf6, 0x40, 0x59, 0xb2, 0x51, 0x21, 0xd9, 0x28, 0x4b, 0x9e, 0x41, 0x4b, 0xf5, 0x4b, 0x91, + 0x0b, 0xf5, 0x28, 0xd8, 0xa5, 0x85, 0x68, 0xb7, 0x4a, 0x94, 0x48, 0xc6, 0xbc, 0xa9, 0x8e, 0xde, + 0x05, 0x00, 0x00, 0xff, 0xff, 0x75, 0x38, 0xad, 0x84, 0xe4, 0x05, 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/proto3_proto/proto3.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/proto3_proto/proto3.proto new file mode 100644 index 00000000000..85a36818fc7 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/proto3_proto/proto3.proto @@ -0,0 +1,87 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2014 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +syntax = "proto3"; + +import "google/protobuf/any.proto"; +import "testdata/test.proto"; + +package proto3_proto; + +message Message { + enum Humour { + UNKNOWN = 0; + PUNS = 1; + SLAPSTICK = 2; + BILL_BAILEY = 3; + } + + string name = 1; + Humour hilarity = 2; + uint32 height_in_cm = 3; + bytes data = 4; + int64 result_count = 7; + bool true_scotsman = 8; + float score = 9; + + repeated uint64 key = 5; + repeated int32 short_key = 19; + Nested nested = 6; + repeated Humour r_funny = 16; + + map terrain = 10; + testdata.SubDefaults proto2_field = 11; + map proto2_value = 13; + + google.protobuf.Any anything = 14; + repeated google.protobuf.Any many_things = 15; + + Message submessage = 17; + repeated Message children = 18; +} + +message Nested { + string bunny = 1; + bool cute = 2; +} + +message MessageWithMap { + map byte_mapping = 1; +} + + +message IntMap { + map rtt = 1; +} + +message IntMaps { + repeated IntMap maps = 1; +} \ No newline at end of file diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/skip_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/skip_gogo.go new file mode 100644 index 00000000000..5a5fd93f7c1 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/skip_gogo.go @@ -0,0 +1,119 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package proto + +import ( + "fmt" + "io" +) + +func Skip(data []byte) (n int, err error) { + l := len(data) + index := 0 + for index < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if index >= l { + return 0, io.ErrUnexpectedEOF + } + b := data[index] + index++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for { + if index >= l { + return 0, io.ErrUnexpectedEOF + } + index++ + if data[index-1] < 0x80 { + break + } + } + return index, nil + case 1: + index += 8 + return index, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if index >= l { + return 0, io.ErrUnexpectedEOF + } + b := data[index] + index++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + index += length + return index, nil + case 3: + for { + var innerWire uint64 + var start int = index + for shift := uint(0); ; shift += 7 { + if index >= l { + return 0, io.ErrUnexpectedEOF + } + b := data[index] + index++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := Skip(data[start:]) + if err != nil { + return 0, err + } + index = start + next + } + return index, nil + case 4: + return index, nil + case 5: + index += 4 + return index, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text.go new file mode 100644 index 00000000000..d63732fcbda --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text.go @@ -0,0 +1,928 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +package proto + +// Functions for writing the text protocol buffer format. + +import ( + "bufio" + "bytes" + "encoding" + "errors" + "fmt" + "io" + "log" + "math" + "reflect" + "sort" + "strings" + "sync" + "time" +) + +var ( + newline = []byte("\n") + spaces = []byte(" ") + gtNewline = []byte(">\n") + endBraceNewline = []byte("}\n") + backslashN = []byte{'\\', 'n'} + backslashR = []byte{'\\', 'r'} + backslashT = []byte{'\\', 't'} + backslashDQ = []byte{'\\', '"'} + backslashBS = []byte{'\\', '\\'} + posInf = []byte("inf") + negInf = []byte("-inf") + nan = []byte("nan") +) + +type writer interface { + io.Writer + WriteByte(byte) error +} + +// textWriter is an io.Writer that tracks its indentation level. +type textWriter struct { + ind int + complete bool // if the current position is a complete line + compact bool // whether to write out as a one-liner + w writer +} + +func (w *textWriter) WriteString(s string) (n int, err error) { + if !strings.Contains(s, "\n") { + if !w.compact && w.complete { + w.writeIndent() + } + w.complete = false + return io.WriteString(w.w, s) + } + // WriteString is typically called without newlines, so this + // codepath and its copy are rare. We copy to avoid + // duplicating all of Write's logic here. + return w.Write([]byte(s)) +} + +func (w *textWriter) Write(p []byte) (n int, err error) { + newlines := bytes.Count(p, newline) + if newlines == 0 { + if !w.compact && w.complete { + w.writeIndent() + } + n, err = w.w.Write(p) + w.complete = false + return n, err + } + + frags := bytes.SplitN(p, newline, newlines+1) + if w.compact { + for i, frag := range frags { + if i > 0 { + if err := w.w.WriteByte(' '); err != nil { + return n, err + } + n++ + } + nn, err := w.w.Write(frag) + n += nn + if err != nil { + return n, err + } + } + return n, nil + } + + for i, frag := range frags { + if w.complete { + w.writeIndent() + } + nn, err := w.w.Write(frag) + n += nn + if err != nil { + return n, err + } + if i+1 < len(frags) { + if err := w.w.WriteByte('\n'); err != nil { + return n, err + } + n++ + } + } + w.complete = len(frags[len(frags)-1]) == 0 + return n, nil +} + +func (w *textWriter) WriteByte(c byte) error { + if w.compact && c == '\n' { + c = ' ' + } + if !w.compact && w.complete { + w.writeIndent() + } + err := w.w.WriteByte(c) + w.complete = c == '\n' + return err +} + +func (w *textWriter) indent() { w.ind++ } + +func (w *textWriter) unindent() { + if w.ind == 0 { + log.Print("proto: textWriter unindented too far") + return + } + w.ind-- +} + +func writeName(w *textWriter, props *Properties) error { + if _, err := w.WriteString(props.OrigName); err != nil { + return err + } + if props.Wire != "group" { + return w.WriteByte(':') + } + return nil +} + +// raw is the interface satisfied by RawMessage. +type raw interface { + Bytes() []byte +} + +func requiresQuotes(u string) bool { + // When type URL contains any characters except [0-9A-Za-z./\-]*, it must be quoted. + for _, ch := range u { + switch { + case ch == '.' || ch == '/' || ch == '_': + continue + case '0' <= ch && ch <= '9': + continue + case 'A' <= ch && ch <= 'Z': + continue + case 'a' <= ch && ch <= 'z': + continue + default: + return true + } + } + return false +} + +// isAny reports whether sv is a google.protobuf.Any message +func isAny(sv reflect.Value) bool { + type wkt interface { + XXX_WellKnownType() string + } + t, ok := sv.Addr().Interface().(wkt) + return ok && t.XXX_WellKnownType() == "Any" +} + +// writeProto3Any writes an expanded google.protobuf.Any message. +// +// It returns (false, nil) if sv value can't be unmarshaled (e.g. because +// required messages are not linked in). +// +// It returns (true, error) when sv was written in expanded format or an error +// was encountered. +func (tm *TextMarshaler) writeProto3Any(w *textWriter, sv reflect.Value) (bool, error) { + turl := sv.FieldByName("TypeUrl") + val := sv.FieldByName("Value") + if !turl.IsValid() || !val.IsValid() { + return true, errors.New("proto: invalid google.protobuf.Any message") + } + + b, ok := val.Interface().([]byte) + if !ok { + return true, errors.New("proto: invalid google.protobuf.Any message") + } + + parts := strings.Split(turl.String(), "/") + mt := MessageType(parts[len(parts)-1]) + if mt == nil { + return false, nil + } + m := reflect.New(mt.Elem()) + if err := Unmarshal(b, m.Interface().(Message)); err != nil { + return false, nil + } + w.Write([]byte("[")) + u := turl.String() + if requiresQuotes(u) { + writeString(w, u) + } else { + w.Write([]byte(u)) + } + if w.compact { + w.Write([]byte("]:<")) + } else { + w.Write([]byte("]: <\n")) + w.ind++ + } + if err := tm.writeStruct(w, m.Elem()); err != nil { + return true, err + } + if w.compact { + w.Write([]byte("> ")) + } else { + w.ind-- + w.Write([]byte(">\n")) + } + return true, nil +} + +func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { + if tm.ExpandAny && isAny(sv) { + if canExpand, err := tm.writeProto3Any(w, sv); canExpand { + return err + } + } + st := sv.Type() + sprops := GetProperties(st) + for i := 0; i < sv.NumField(); i++ { + fv := sv.Field(i) + props := sprops.Prop[i] + name := st.Field(i).Name + + if strings.HasPrefix(name, "XXX_") { + // There are two XXX_ fields: + // XXX_unrecognized []byte + // XXX_extensions map[int32]proto.Extension + // The first is handled here; + // the second is handled at the bottom of this function. + if name == "XXX_unrecognized" && !fv.IsNil() { + if err := writeUnknownStruct(w, fv.Interface().([]byte)); err != nil { + return err + } + } + continue + } + if fv.Kind() == reflect.Ptr && fv.IsNil() { + // Field not filled in. This could be an optional field or + // a required field that wasn't filled in. Either way, there + // isn't anything we can show for it. + continue + } + if fv.Kind() == reflect.Slice && fv.IsNil() { + // Repeated field that is empty, or a bytes field that is unused. + continue + } + + if props.Repeated && fv.Kind() == reflect.Slice { + // Repeated field. + for j := 0; j < fv.Len(); j++ { + if err := writeName(w, props); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + v := fv.Index(j) + if v.Kind() == reflect.Ptr && v.IsNil() { + // A nil message in a repeated field is not valid, + // but we can handle that more gracefully than panicking. + if _, err := w.Write([]byte("\n")); err != nil { + return err + } + continue + } + if len(props.Enum) > 0 { + if err := tm.writeEnum(w, v, props); err != nil { + return err + } + } else if err := tm.writeAny(w, v, props); err != nil { + return err + } + if err := w.WriteByte('\n'); err != nil { + return err + } + } + continue + } + if fv.Kind() == reflect.Map { + // Map fields are rendered as a repeated struct with key/value fields. + keys := fv.MapKeys() + sort.Sort(mapKeys(keys)) + for _, key := range keys { + val := fv.MapIndex(key) + if err := writeName(w, props); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + // open struct + if err := w.WriteByte('<'); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte('\n'); err != nil { + return err + } + } + w.indent() + // key + if _, err := w.WriteString("key:"); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + if err := tm.writeAny(w, key, props.mkeyprop); err != nil { + return err + } + if err := w.WriteByte('\n'); err != nil { + return err + } + // nil values aren't legal, but we can avoid panicking because of them. + if val.Kind() != reflect.Ptr || !val.IsNil() { + // value + if _, err := w.WriteString("value:"); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + if err := tm.writeAny(w, val, props.mvalprop); err != nil { + return err + } + if err := w.WriteByte('\n'); err != nil { + return err + } + } + // close struct + w.unindent() + if err := w.WriteByte('>'); err != nil { + return err + } + if err := w.WriteByte('\n'); err != nil { + return err + } + } + continue + } + if props.proto3 && fv.Kind() == reflect.Slice && fv.Len() == 0 { + // empty bytes field + continue + } + if props.proto3 && fv.Kind() != reflect.Ptr && fv.Kind() != reflect.Slice { + // proto3 non-repeated scalar field; skip if zero value + if isProto3Zero(fv) { + continue + } + } + + if fv.Kind() == reflect.Interface { + // Check if it is a oneof. + if st.Field(i).Tag.Get("protobuf_oneof") != "" { + // fv is nil, or holds a pointer to generated struct. + // That generated struct has exactly one field, + // which has a protobuf struct tag. + if fv.IsNil() { + continue + } + inner := fv.Elem().Elem() // interface -> *T -> T + tag := inner.Type().Field(0).Tag.Get("protobuf") + props = new(Properties) // Overwrite the outer props var, but not its pointee. + props.Parse(tag) + // Write the value in the oneof, not the oneof itself. + fv = inner.Field(0) + + // Special case to cope with malformed messages gracefully: + // If the value in the oneof is a nil pointer, don't panic + // in writeAny. + if fv.Kind() == reflect.Ptr && fv.IsNil() { + // Use errors.New so writeAny won't render quotes. + msg := errors.New("/* nil */") + fv = reflect.ValueOf(&msg).Elem() + } + } + } + + if err := writeName(w, props); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + if b, ok := fv.Interface().(raw); ok { + if err := writeRaw(w, b.Bytes()); err != nil { + return err + } + continue + } + + if len(props.Enum) > 0 { + if err := tm.writeEnum(w, fv, props); err != nil { + return err + } + } else if err := tm.writeAny(w, fv, props); err != nil { + return err + } + + if err := w.WriteByte('\n'); err != nil { + return err + } + } + + // Extensions (the XXX_extensions field). + pv := sv + if pv.CanAddr() { + pv = sv.Addr() + } else { + pv = reflect.New(sv.Type()) + pv.Elem().Set(sv) + } + if pv.Type().Implements(extensionRangeType) { + if err := tm.writeExtensions(w, pv); err != nil { + return err + } + } + + return nil +} + +// writeRaw writes an uninterpreted raw message. +func writeRaw(w *textWriter, b []byte) error { + if err := w.WriteByte('<'); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte('\n'); err != nil { + return err + } + } + w.indent() + if err := writeUnknownStruct(w, b); err != nil { + return err + } + w.unindent() + if err := w.WriteByte('>'); err != nil { + return err + } + return nil +} + +// writeAny writes an arbitrary field. +func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error { + v = reflect.Indirect(v) + + if props != nil { + if len(props.CustomType) > 0 { + custom, ok := v.Interface().(Marshaler) + if ok { + data, err := custom.Marshal() + if err != nil { + return err + } + if err := writeString(w, string(data)); err != nil { + return err + } + return nil + } + } else if props.StdTime { + t, ok := v.Interface().(time.Time) + if !ok { + return fmt.Errorf("stdtime is not time.Time, but %T", v.Interface()) + } + tproto, err := timestampProto(t) + if err != nil { + return err + } + props.StdTime = false + err = tm.writeAny(w, reflect.ValueOf(tproto), props) + props.StdTime = true + return err + } else if props.StdDuration { + d, ok := v.Interface().(time.Duration) + if !ok { + return fmt.Errorf("stdtime is not time.Duration, but %T", v.Interface()) + } + dproto := durationProto(d) + props.StdDuration = false + err := tm.writeAny(w, reflect.ValueOf(dproto), props) + props.StdDuration = true + return err + } + } + + // Floats have special cases. + if v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 { + x := v.Float() + var b []byte + switch { + case math.IsInf(x, 1): + b = posInf + case math.IsInf(x, -1): + b = negInf + case math.IsNaN(x): + b = nan + } + if b != nil { + _, err := w.Write(b) + return err + } + // Other values are handled below. + } + + // We don't attempt to serialise every possible value type; only those + // that can occur in protocol buffers. + switch v.Kind() { + case reflect.Slice: + // Should only be a []byte; repeated fields are handled in writeStruct. + if err := writeString(w, string(v.Bytes())); err != nil { + return err + } + case reflect.String: + if err := writeString(w, v.String()); err != nil { + return err + } + case reflect.Struct: + // Required/optional group/message. + var bra, ket byte = '<', '>' + if props != nil && props.Wire == "group" { + bra, ket = '{', '}' + } + if err := w.WriteByte(bra); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte('\n'); err != nil { + return err + } + } + w.indent() + if etm, ok := v.Interface().(encoding.TextMarshaler); ok { + text, err := etm.MarshalText() + if err != nil { + return err + } + if _, err = w.Write(text); err != nil { + return err + } + } else if err := tm.writeStruct(w, v); err != nil { + return err + } + w.unindent() + if err := w.WriteByte(ket); err != nil { + return err + } + default: + _, err := fmt.Fprint(w, v.Interface()) + return err + } + return nil +} + +// equivalent to C's isprint. +func isprint(c byte) bool { + return c >= 0x20 && c < 0x7f +} + +// writeString writes a string in the protocol buffer text format. +// It is similar to strconv.Quote except we don't use Go escape sequences, +// we treat the string as a byte sequence, and we use octal escapes. +// These differences are to maintain interoperability with the other +// languages' implementations of the text format. +func writeString(w *textWriter, s string) error { + // use WriteByte here to get any needed indent + if err := w.WriteByte('"'); err != nil { + return err + } + // Loop over the bytes, not the runes. + for i := 0; i < len(s); i++ { + var err error + // Divergence from C++: we don't escape apostrophes. + // There's no need to escape them, and the C++ parser + // copes with a naked apostrophe. + switch c := s[i]; c { + case '\n': + _, err = w.w.Write(backslashN) + case '\r': + _, err = w.w.Write(backslashR) + case '\t': + _, err = w.w.Write(backslashT) + case '"': + _, err = w.w.Write(backslashDQ) + case '\\': + _, err = w.w.Write(backslashBS) + default: + if isprint(c) { + err = w.w.WriteByte(c) + } else { + _, err = fmt.Fprintf(w.w, "\\%03o", c) + } + } + if err != nil { + return err + } + } + return w.WriteByte('"') +} + +func writeUnknownStruct(w *textWriter, data []byte) (err error) { + if !w.compact { + if _, err := fmt.Fprintf(w, "/* %d unknown bytes */\n", len(data)); err != nil { + return err + } + } + b := NewBuffer(data) + for b.index < len(b.buf) { + x, err := b.DecodeVarint() + if err != nil { + _, ferr := fmt.Fprintf(w, "/* %v */\n", err) + return ferr + } + wire, tag := x&7, x>>3 + if wire == WireEndGroup { + w.unindent() + if _, werr := w.Write(endBraceNewline); werr != nil { + return werr + } + continue + } + if _, ferr := fmt.Fprint(w, tag); ferr != nil { + return ferr + } + if wire != WireStartGroup { + if err = w.WriteByte(':'); err != nil { + return err + } + } + if !w.compact || wire == WireStartGroup { + if err = w.WriteByte(' '); err != nil { + return err + } + } + switch wire { + case WireBytes: + buf, e := b.DecodeRawBytes(false) + if e == nil { + _, err = fmt.Fprintf(w, "%q", buf) + } else { + _, err = fmt.Fprintf(w, "/* %v */", e) + } + case WireFixed32: + x, err = b.DecodeFixed32() + err = writeUnknownInt(w, x, err) + case WireFixed64: + x, err = b.DecodeFixed64() + err = writeUnknownInt(w, x, err) + case WireStartGroup: + err = w.WriteByte('{') + w.indent() + case WireVarint: + x, err = b.DecodeVarint() + err = writeUnknownInt(w, x, err) + default: + _, err = fmt.Fprintf(w, "/* unknown wire type %d */", wire) + } + if err != nil { + return err + } + if err := w.WriteByte('\n'); err != nil { + return err + } + } + return nil +} + +func writeUnknownInt(w *textWriter, x uint64, err error) error { + if err == nil { + _, err = fmt.Fprint(w, x) + } else { + _, err = fmt.Fprintf(w, "/* %v */", err) + } + return err +} + +type int32Slice []int32 + +func (s int32Slice) Len() int { return len(s) } +func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] } +func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } + +// writeExtensions writes all the extensions in pv. +// pv is assumed to be a pointer to a protocol message struct that is extendable. +func (tm *TextMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error { + emap := extensionMaps[pv.Type().Elem()] + e := pv.Interface().(Message) + + var m map[int32]Extension + var mu sync.Locker + if em, ok := e.(extensionsBytes); ok { + eb := em.GetExtensions() + var err error + m, err = BytesToExtensionsMap(*eb) + if err != nil { + return err + } + mu = notLocker{} + } else if _, ok := e.(extendableProto); ok { + ep, _ := extendable(e) + m, mu = ep.extensionsRead() + if m == nil { + return nil + } + } + + // Order the extensions by ID. + // This isn't strictly necessary, but it will give us + // canonical output, which will also make testing easier. + + mu.Lock() + ids := make([]int32, 0, len(m)) + for id := range m { + ids = append(ids, id) + } + sort.Sort(int32Slice(ids)) + mu.Unlock() + + for _, extNum := range ids { + ext := m[extNum] + var desc *ExtensionDesc + if emap != nil { + desc = emap[extNum] + } + if desc == nil { + // Unknown extension. + if err := writeUnknownStruct(w, ext.enc); err != nil { + return err + } + continue + } + + pb, err := GetExtension(e, desc) + if err != nil { + return fmt.Errorf("failed getting extension: %v", err) + } + + // Repeated extensions will appear as a slice. + if !desc.repeated() { + if err := tm.writeExtension(w, desc.Name, pb); err != nil { + return err + } + } else { + v := reflect.ValueOf(pb) + for i := 0; i < v.Len(); i++ { + if err := tm.writeExtension(w, desc.Name, v.Index(i).Interface()); err != nil { + return err + } + } + } + } + return nil +} + +func (tm *TextMarshaler) writeExtension(w *textWriter, name string, pb interface{}) error { + if _, err := fmt.Fprintf(w, "[%s]:", name); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + if err := tm.writeAny(w, reflect.ValueOf(pb), nil); err != nil { + return err + } + if err := w.WriteByte('\n'); err != nil { + return err + } + return nil +} + +func (w *textWriter) writeIndent() { + if !w.complete { + return + } + remain := w.ind * 2 + for remain > 0 { + n := remain + if n > len(spaces) { + n = len(spaces) + } + w.w.Write(spaces[:n]) + remain -= n + } + w.complete = false +} + +// TextMarshaler is a configurable text format marshaler. +type TextMarshaler struct { + Compact bool // use compact text format (one line). + ExpandAny bool // expand google.protobuf.Any messages of known types +} + +// Marshal writes a given protocol buffer in text format. +// The only errors returned are from w. +func (tm *TextMarshaler) Marshal(w io.Writer, pb Message) error { + val := reflect.ValueOf(pb) + if pb == nil || val.IsNil() { + w.Write([]byte("")) + return nil + } + var bw *bufio.Writer + ww, ok := w.(writer) + if !ok { + bw = bufio.NewWriter(w) + ww = bw + } + aw := &textWriter{ + w: ww, + complete: true, + compact: tm.Compact, + } + + if etm, ok := pb.(encoding.TextMarshaler); ok { + text, err := etm.MarshalText() + if err != nil { + return err + } + if _, err = aw.Write(text); err != nil { + return err + } + if bw != nil { + return bw.Flush() + } + return nil + } + // Dereference the received pointer so we don't have outer < and >. + v := reflect.Indirect(val) + if err := tm.writeStruct(aw, v); err != nil { + return err + } + if bw != nil { + return bw.Flush() + } + return nil +} + +// Text is the same as Marshal, but returns the string directly. +func (tm *TextMarshaler) Text(pb Message) string { + var buf bytes.Buffer + tm.Marshal(&buf, pb) + return buf.String() +} + +var ( + defaultTextMarshaler = TextMarshaler{} + compactTextMarshaler = TextMarshaler{Compact: true} +) + +// TODO: consider removing some of the Marshal functions below. + +// MarshalText writes a given protocol buffer in text format. +// The only errors returned are from w. +func MarshalText(w io.Writer, pb Message) error { return defaultTextMarshaler.Marshal(w, pb) } + +// MarshalTextString is the same as MarshalText, but returns the string directly. +func MarshalTextString(pb Message) string { return defaultTextMarshaler.Text(pb) } + +// CompactText writes a given protocol buffer in compact text format (one line). +func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Marshal(w, pb) } + +// CompactTextString is the same as CompactText, but returns the string directly. +func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) } diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text_gogo.go new file mode 100644 index 00000000000..1d6c6aa0e41 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text_gogo.go @@ -0,0 +1,57 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package proto + +import ( + "fmt" + "reflect" +) + +func (tm *TextMarshaler) writeEnum(w *textWriter, v reflect.Value, props *Properties) error { + m, ok := enumStringMaps[props.Enum] + if !ok { + if err := tm.writeAny(w, v, props); err != nil { + return err + } + } + key := int32(0) + if v.Kind() == reflect.Ptr { + key = int32(v.Elem().Int()) + } else { + key = int32(v.Int()) + } + s, ok := m[key] + if !ok { + if err := tm.writeAny(w, v, props); err != nil { + return err + } + } + _, err := fmt.Fprint(w, s) + return err +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text_parser.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text_parser.go new file mode 100644 index 00000000000..9db12e96018 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text_parser.go @@ -0,0 +1,1013 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +package proto + +// Functions for parsing the Text protocol buffer format. +// TODO: message sets. + +import ( + "encoding" + "errors" + "fmt" + "reflect" + "strconv" + "strings" + "time" + "unicode/utf8" +) + +// Error string emitted when deserializing Any and fields are already set +const anyRepeatedlyUnpacked = "Any message unpacked multiple times, or %q already set" + +type ParseError struct { + Message string + Line int // 1-based line number + Offset int // 0-based byte offset from start of input +} + +func (p *ParseError) Error() string { + if p.Line == 1 { + // show offset only for first line + return fmt.Sprintf("line 1.%d: %v", p.Offset, p.Message) + } + return fmt.Sprintf("line %d: %v", p.Line, p.Message) +} + +type token struct { + value string + err *ParseError + line int // line number + offset int // byte number from start of input, not start of line + unquoted string // the unquoted version of value, if it was a quoted string +} + +func (t *token) String() string { + if t.err == nil { + return fmt.Sprintf("%q (line=%d, offset=%d)", t.value, t.line, t.offset) + } + return fmt.Sprintf("parse error: %v", t.err) +} + +type textParser struct { + s string // remaining input + done bool // whether the parsing is finished (success or error) + backed bool // whether back() was called + offset, line int + cur token +} + +func newTextParser(s string) *textParser { + p := new(textParser) + p.s = s + p.line = 1 + p.cur.line = 1 + return p +} + +func (p *textParser) errorf(format string, a ...interface{}) *ParseError { + pe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset} + p.cur.err = pe + p.done = true + return pe +} + +// Numbers and identifiers are matched by [-+._A-Za-z0-9] +func isIdentOrNumberChar(c byte) bool { + switch { + case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z': + return true + case '0' <= c && c <= '9': + return true + } + switch c { + case '-', '+', '.', '_': + return true + } + return false +} + +func isWhitespace(c byte) bool { + switch c { + case ' ', '\t', '\n', '\r': + return true + } + return false +} + +func isQuote(c byte) bool { + switch c { + case '"', '\'': + return true + } + return false +} + +func (p *textParser) skipWhitespace() { + i := 0 + for i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') { + if p.s[i] == '#' { + // comment; skip to end of line or input + for i < len(p.s) && p.s[i] != '\n' { + i++ + } + if i == len(p.s) { + break + } + } + if p.s[i] == '\n' { + p.line++ + } + i++ + } + p.offset += i + p.s = p.s[i:len(p.s)] + if len(p.s) == 0 { + p.done = true + } +} + +func (p *textParser) advance() { + // Skip whitespace + p.skipWhitespace() + if p.done { + return + } + + // Start of non-whitespace + p.cur.err = nil + p.cur.offset, p.cur.line = p.offset, p.line + p.cur.unquoted = "" + switch p.s[0] { + case '<', '>', '{', '}', ':', '[', ']', ';', ',', '/': + // Single symbol + p.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)] + case '"', '\'': + // Quoted string + i := 1 + for i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\n' { + if p.s[i] == '\\' && i+1 < len(p.s) { + // skip escaped char + i++ + } + i++ + } + if i >= len(p.s) || p.s[i] != p.s[0] { + p.errorf("unmatched quote") + return + } + unq, err := unquoteC(p.s[1:i], rune(p.s[0])) + if err != nil { + p.errorf("invalid quoted string %s: %v", p.s[0:i+1], err) + return + } + p.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)] + p.cur.unquoted = unq + default: + i := 0 + for i < len(p.s) && isIdentOrNumberChar(p.s[i]) { + i++ + } + if i == 0 { + p.errorf("unexpected byte %#x", p.s[0]) + return + } + p.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)] + } + p.offset += len(p.cur.value) +} + +var ( + errBadUTF8 = errors.New("proto: bad UTF-8") + errBadHex = errors.New("proto: bad hexadecimal") +) + +func unquoteC(s string, quote rune) (string, error) { + // This is based on C++'s tokenizer.cc. + // Despite its name, this is *not* parsing C syntax. + // For instance, "\0" is an invalid quoted string. + + // Avoid allocation in trivial cases. + simple := true + for _, r := range s { + if r == '\\' || r == quote { + simple = false + break + } + } + if simple { + return s, nil + } + + buf := make([]byte, 0, 3*len(s)/2) + for len(s) > 0 { + r, n := utf8.DecodeRuneInString(s) + if r == utf8.RuneError && n == 1 { + return "", errBadUTF8 + } + s = s[n:] + if r != '\\' { + if r < utf8.RuneSelf { + buf = append(buf, byte(r)) + } else { + buf = append(buf, string(r)...) + } + continue + } + + ch, tail, err := unescape(s) + if err != nil { + return "", err + } + buf = append(buf, ch...) + s = tail + } + return string(buf), nil +} + +func unescape(s string) (ch string, tail string, err error) { + r, n := utf8.DecodeRuneInString(s) + if r == utf8.RuneError && n == 1 { + return "", "", errBadUTF8 + } + s = s[n:] + switch r { + case 'a': + return "\a", s, nil + case 'b': + return "\b", s, nil + case 'f': + return "\f", s, nil + case 'n': + return "\n", s, nil + case 'r': + return "\r", s, nil + case 't': + return "\t", s, nil + case 'v': + return "\v", s, nil + case '?': + return "?", s, nil // trigraph workaround + case '\'', '"', '\\': + return string(r), s, nil + case '0', '1', '2', '3', '4', '5', '6', '7', 'x', 'X': + if len(s) < 2 { + return "", "", fmt.Errorf(`\%c requires 2 following digits`, r) + } + base := 8 + ss := s[:2] + s = s[2:] + if r == 'x' || r == 'X' { + base = 16 + } else { + ss = string(r) + ss + } + i, err := strconv.ParseUint(ss, base, 8) + if err != nil { + return "", "", err + } + return string([]byte{byte(i)}), s, nil + case 'u', 'U': + n := 4 + if r == 'U' { + n = 8 + } + if len(s) < n { + return "", "", fmt.Errorf(`\%c requires %d digits`, r, n) + } + + bs := make([]byte, n/2) + for i := 0; i < n; i += 2 { + a, ok1 := unhex(s[i]) + b, ok2 := unhex(s[i+1]) + if !ok1 || !ok2 { + return "", "", errBadHex + } + bs[i/2] = a<<4 | b + } + s = s[n:] + return string(bs), s, nil + } + return "", "", fmt.Errorf(`unknown escape \%c`, r) +} + +// Adapted from src/pkg/strconv/quote.go. +func unhex(b byte) (v byte, ok bool) { + switch { + case '0' <= b && b <= '9': + return b - '0', true + case 'a' <= b && b <= 'f': + return b - 'a' + 10, true + case 'A' <= b && b <= 'F': + return b - 'A' + 10, true + } + return 0, false +} + +// Back off the parser by one token. Can only be done between calls to next(). +// It makes the next advance() a no-op. +func (p *textParser) back() { p.backed = true } + +// Advances the parser and returns the new current token. +func (p *textParser) next() *token { + if p.backed || p.done { + p.backed = false + return &p.cur + } + p.advance() + if p.done { + p.cur.value = "" + } else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) { + // Look for multiple quoted strings separated by whitespace, + // and concatenate them. + cat := p.cur + for { + p.skipWhitespace() + if p.done || !isQuote(p.s[0]) { + break + } + p.advance() + if p.cur.err != nil { + return &p.cur + } + cat.value += " " + p.cur.value + cat.unquoted += p.cur.unquoted + } + p.done = false // parser may have seen EOF, but we want to return cat + p.cur = cat + } + return &p.cur +} + +func (p *textParser) consumeToken(s string) error { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value != s { + p.back() + return p.errorf("expected %q, found %q", s, tok.value) + } + return nil +} + +// Return a RequiredNotSetError indicating which required field was not set. +func (p *textParser) missingRequiredFieldError(sv reflect.Value) *RequiredNotSetError { + st := sv.Type() + sprops := GetProperties(st) + for i := 0; i < st.NumField(); i++ { + if !isNil(sv.Field(i)) { + continue + } + + props := sprops.Prop[i] + if props.Required { + return &RequiredNotSetError{fmt.Sprintf("%v.%v", st, props.OrigName)} + } + } + return &RequiredNotSetError{fmt.Sprintf("%v.", st)} // should not happen +} + +// Returns the index in the struct for the named field, as well as the parsed tag properties. +func structFieldByName(sprops *StructProperties, name string) (int, *Properties, bool) { + i, ok := sprops.decoderOrigNames[name] + if ok { + return i, sprops.Prop[i], true + } + return -1, nil, false +} + +// Consume a ':' from the input stream (if the next token is a colon), +// returning an error if a colon is needed but not present. +func (p *textParser) checkForColon(props *Properties, typ reflect.Type) *ParseError { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value != ":" { + // Colon is optional when the field is a group or message. + needColon := true + switch props.Wire { + case "group": + needColon = false + case "bytes": + // A "bytes" field is either a message, a string, or a repeated field; + // those three become *T, *string and []T respectively, so we can check for + // this field being a pointer to a non-string. + if typ.Kind() == reflect.Ptr { + // *T or *string + if typ.Elem().Kind() == reflect.String { + break + } + } else if typ.Kind() == reflect.Slice { + // []T or []*T + if typ.Elem().Kind() != reflect.Ptr { + break + } + } else if typ.Kind() == reflect.String { + // The proto3 exception is for a string field, + // which requires a colon. + break + } + needColon = false + } + if needColon { + return p.errorf("expected ':', found %q", tok.value) + } + p.back() + } + return nil +} + +func (p *textParser) readStruct(sv reflect.Value, terminator string) error { + st := sv.Type() + sprops := GetProperties(st) + reqCount := sprops.reqCount + var reqFieldErr error + fieldSet := make(map[string]bool) + // A struct is a sequence of "name: value", terminated by one of + // '>' or '}', or the end of the input. A name may also be + // "[extension]" or "[type/url]". + // + // The whole struct can also be an expanded Any message, like: + // [type/url] < ... struct contents ... > + for { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value == terminator { + break + } + if tok.value == "[" { + // Looks like an extension or an Any. + // + // TODO: Check whether we need to handle + // namespace rooted names (e.g. ".something.Foo"). + extName, err := p.consumeExtName() + if err != nil { + return err + } + + if s := strings.LastIndex(extName, "/"); s >= 0 { + // If it contains a slash, it's an Any type URL. + messageName := extName[s+1:] + mt := MessageType(messageName) + if mt == nil { + return p.errorf("unrecognized message %q in google.protobuf.Any", messageName) + } + tok = p.next() + if tok.err != nil { + return tok.err + } + // consume an optional colon + if tok.value == ":" { + tok = p.next() + if tok.err != nil { + return tok.err + } + } + var terminator string + switch tok.value { + case "<": + terminator = ">" + case "{": + terminator = "}" + default: + return p.errorf("expected '{' or '<', found %q", tok.value) + } + v := reflect.New(mt.Elem()) + if pe := p.readStruct(v.Elem(), terminator); pe != nil { + return pe + } + b, err := Marshal(v.Interface().(Message)) + if err != nil { + return p.errorf("failed to marshal message of type %q: %v", messageName, err) + } + if fieldSet["type_url"] { + return p.errorf(anyRepeatedlyUnpacked, "type_url") + } + if fieldSet["value"] { + return p.errorf(anyRepeatedlyUnpacked, "value") + } + sv.FieldByName("TypeUrl").SetString(extName) + sv.FieldByName("Value").SetBytes(b) + fieldSet["type_url"] = true + fieldSet["value"] = true + continue + } + + var desc *ExtensionDesc + // This could be faster, but it's functional. + // TODO: Do something smarter than a linear scan. + for _, d := range RegisteredExtensions(reflect.New(st).Interface().(Message)) { + if d.Name == extName { + desc = d + break + } + } + if desc == nil { + return p.errorf("unrecognized extension %q", extName) + } + + props := &Properties{} + props.Parse(desc.Tag) + + typ := reflect.TypeOf(desc.ExtensionType) + if err := p.checkForColon(props, typ); err != nil { + return err + } + + rep := desc.repeated() + + // Read the extension structure, and set it in + // the value we're constructing. + var ext reflect.Value + if !rep { + ext = reflect.New(typ).Elem() + } else { + ext = reflect.New(typ.Elem()).Elem() + } + if err := p.readAny(ext, props); err != nil { + if _, ok := err.(*RequiredNotSetError); !ok { + return err + } + reqFieldErr = err + } + ep := sv.Addr().Interface().(Message) + if !rep { + SetExtension(ep, desc, ext.Interface()) + } else { + old, err := GetExtension(ep, desc) + var sl reflect.Value + if err == nil { + sl = reflect.ValueOf(old) // existing slice + } else { + sl = reflect.MakeSlice(typ, 0, 1) + } + sl = reflect.Append(sl, ext) + SetExtension(ep, desc, sl.Interface()) + } + if err := p.consumeOptionalSeparator(); err != nil { + return err + } + continue + } + + // This is a normal, non-extension field. + name := tok.value + var dst reflect.Value + fi, props, ok := structFieldByName(sprops, name) + if ok { + dst = sv.Field(fi) + } else if oop, ok := sprops.OneofTypes[name]; ok { + // It is a oneof. + props = oop.Prop + nv := reflect.New(oop.Type.Elem()) + dst = nv.Elem().Field(0) + field := sv.Field(oop.Field) + if !field.IsNil() { + return p.errorf("field '%s' would overwrite already parsed oneof '%s'", name, sv.Type().Field(oop.Field).Name) + } + field.Set(nv) + } + if !dst.IsValid() { + return p.errorf("unknown field name %q in %v", name, st) + } + + if dst.Kind() == reflect.Map { + // Consume any colon. + if err := p.checkForColon(props, dst.Type()); err != nil { + return err + } + + // Construct the map if it doesn't already exist. + if dst.IsNil() { + dst.Set(reflect.MakeMap(dst.Type())) + } + key := reflect.New(dst.Type().Key()).Elem() + val := reflect.New(dst.Type().Elem()).Elem() + + // The map entry should be this sequence of tokens: + // < key : KEY value : VALUE > + // However, implementations may omit key or value, and technically + // we should support them in any order. See b/28924776 for a time + // this went wrong. + + tok := p.next() + var terminator string + switch tok.value { + case "<": + terminator = ">" + case "{": + terminator = "}" + default: + return p.errorf("expected '{' or '<', found %q", tok.value) + } + for { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value == terminator { + break + } + switch tok.value { + case "key": + if err := p.consumeToken(":"); err != nil { + return err + } + if err := p.readAny(key, props.mkeyprop); err != nil { + return err + } + if err := p.consumeOptionalSeparator(); err != nil { + return err + } + case "value": + if err := p.checkForColon(props.mvalprop, dst.Type().Elem()); err != nil { + return err + } + if err := p.readAny(val, props.mvalprop); err != nil { + return err + } + if err := p.consumeOptionalSeparator(); err != nil { + return err + } + default: + p.back() + return p.errorf(`expected "key", "value", or %q, found %q`, terminator, tok.value) + } + } + + dst.SetMapIndex(key, val) + continue + } + + // Check that it's not already set if it's not a repeated field. + if !props.Repeated && fieldSet[name] { + return p.errorf("non-repeated field %q was repeated", name) + } + + if err := p.checkForColon(props, dst.Type()); err != nil { + return err + } + + // Parse into the field. + fieldSet[name] = true + if err := p.readAny(dst, props); err != nil { + if _, ok := err.(*RequiredNotSetError); !ok { + return err + } + reqFieldErr = err + } + if props.Required { + reqCount-- + } + + if err := p.consumeOptionalSeparator(); err != nil { + return err + } + + } + + if reqCount > 0 { + return p.missingRequiredFieldError(sv) + } + return reqFieldErr +} + +// consumeExtName consumes extension name or expanded Any type URL and the +// following ']'. It returns the name or URL consumed. +func (p *textParser) consumeExtName() (string, error) { + tok := p.next() + if tok.err != nil { + return "", tok.err + } + + // If extension name or type url is quoted, it's a single token. + if len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] { + name, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0])) + if err != nil { + return "", err + } + return name, p.consumeToken("]") + } + + // Consume everything up to "]" + var parts []string + for tok.value != "]" { + parts = append(parts, tok.value) + tok = p.next() + if tok.err != nil { + return "", p.errorf("unrecognized type_url or extension name: %s", tok.err) + } + } + return strings.Join(parts, ""), nil +} + +// consumeOptionalSeparator consumes an optional semicolon or comma. +// It is used in readStruct to provide backward compatibility. +func (p *textParser) consumeOptionalSeparator() error { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value != ";" && tok.value != "," { + p.back() + } + return nil +} + +func (p *textParser) readAny(v reflect.Value, props *Properties) error { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value == "" { + return p.errorf("unexpected EOF") + } + if len(props.CustomType) > 0 { + if props.Repeated { + t := reflect.TypeOf(v.Interface()) + if t.Kind() == reflect.Slice { + tc := reflect.TypeOf(new(Marshaler)) + ok := t.Elem().Implements(tc.Elem()) + if ok { + fv := v + flen := fv.Len() + if flen == fv.Cap() { + nav := reflect.MakeSlice(v.Type(), flen, 2*flen+1) + reflect.Copy(nav, fv) + fv.Set(nav) + } + fv.SetLen(flen + 1) + + // Read one. + p.back() + return p.readAny(fv.Index(flen), props) + } + } + } + if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { + custom := reflect.New(props.ctype.Elem()).Interface().(Unmarshaler) + err := custom.Unmarshal([]byte(tok.unquoted)) + if err != nil { + return p.errorf("%v %v: %v", err, v.Type(), tok.value) + } + v.Set(reflect.ValueOf(custom)) + } else { + custom := reflect.New(reflect.TypeOf(v.Interface())).Interface().(Unmarshaler) + err := custom.Unmarshal([]byte(tok.unquoted)) + if err != nil { + return p.errorf("%v %v: %v", err, v.Type(), tok.value) + } + v.Set(reflect.Indirect(reflect.ValueOf(custom))) + } + return nil + } + if props.StdTime { + fv := v + p.back() + props.StdTime = false + tproto := ×tamp{} + err := p.readAny(reflect.ValueOf(tproto).Elem(), props) + props.StdTime = true + if err != nil { + return err + } + tim, err := timestampFromProto(tproto) + if err != nil { + return err + } + if props.Repeated { + t := reflect.TypeOf(v.Interface()) + if t.Kind() == reflect.Slice { + if t.Elem().Kind() == reflect.Ptr { + ts := fv.Interface().([]*time.Time) + ts = append(ts, &tim) + fv.Set(reflect.ValueOf(ts)) + return nil + } else { + ts := fv.Interface().([]time.Time) + ts = append(ts, tim) + fv.Set(reflect.ValueOf(ts)) + return nil + } + } + } + if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { + v.Set(reflect.ValueOf(&tim)) + } else { + v.Set(reflect.Indirect(reflect.ValueOf(&tim))) + } + return nil + } + if props.StdDuration { + fv := v + p.back() + props.StdDuration = false + dproto := &duration{} + err := p.readAny(reflect.ValueOf(dproto).Elem(), props) + props.StdDuration = true + if err != nil { + return err + } + dur, err := durationFromProto(dproto) + if err != nil { + return err + } + if props.Repeated { + t := reflect.TypeOf(v.Interface()) + if t.Kind() == reflect.Slice { + if t.Elem().Kind() == reflect.Ptr { + ds := fv.Interface().([]*time.Duration) + ds = append(ds, &dur) + fv.Set(reflect.ValueOf(ds)) + return nil + } else { + ds := fv.Interface().([]time.Duration) + ds = append(ds, dur) + fv.Set(reflect.ValueOf(ds)) + return nil + } + } + } + if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { + v.Set(reflect.ValueOf(&dur)) + } else { + v.Set(reflect.Indirect(reflect.ValueOf(&dur))) + } + return nil + } + switch fv := v; fv.Kind() { + case reflect.Slice: + at := v.Type() + if at.Elem().Kind() == reflect.Uint8 { + // Special case for []byte + if tok.value[0] != '"' && tok.value[0] != '\'' { + // Deliberately written out here, as the error after + // this switch statement would write "invalid []byte: ...", + // which is not as user-friendly. + return p.errorf("invalid string: %v", tok.value) + } + bytes := []byte(tok.unquoted) + fv.Set(reflect.ValueOf(bytes)) + return nil + } + // Repeated field. + if tok.value == "[" { + // Repeated field with list notation, like [1,2,3]. + for { + fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) + err := p.readAny(fv.Index(fv.Len()-1), props) + if err != nil { + return err + } + ntok := p.next() + if ntok.err != nil { + return ntok.err + } + if ntok.value == "]" { + break + } + if ntok.value != "," { + return p.errorf("Expected ']' or ',' found %q", ntok.value) + } + } + return nil + } + // One value of the repeated field. + p.back() + fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) + return p.readAny(fv.Index(fv.Len()-1), props) + case reflect.Bool: + // true/1/t/True or false/f/0/False. + switch tok.value { + case "true", "1", "t", "True": + fv.SetBool(true) + return nil + case "false", "0", "f", "False": + fv.SetBool(false) + return nil + } + case reflect.Float32, reflect.Float64: + v := tok.value + // Ignore 'f' for compatibility with output generated by C++, but don't + // remove 'f' when the value is "-inf" or "inf". + if strings.HasSuffix(v, "f") && tok.value != "-inf" && tok.value != "inf" { + v = v[:len(v)-1] + } + if f, err := strconv.ParseFloat(v, fv.Type().Bits()); err == nil { + fv.SetFloat(f) + return nil + } + case reflect.Int32: + if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil { + fv.SetInt(x) + return nil + } + + if len(props.Enum) == 0 { + break + } + m, ok := enumValueMaps[props.Enum] + if !ok { + break + } + x, ok := m[tok.value] + if !ok { + break + } + fv.SetInt(int64(x)) + return nil + case reflect.Int64: + if x, err := strconv.ParseInt(tok.value, 0, 64); err == nil { + fv.SetInt(x) + return nil + } + + case reflect.Ptr: + // A basic field (indirected through pointer), or a repeated message/group + p.back() + fv.Set(reflect.New(fv.Type().Elem())) + return p.readAny(fv.Elem(), props) + case reflect.String: + if tok.value[0] == '"' || tok.value[0] == '\'' { + fv.SetString(tok.unquoted) + return nil + } + case reflect.Struct: + var terminator string + switch tok.value { + case "{": + terminator = "}" + case "<": + terminator = ">" + default: + return p.errorf("expected '{' or '<', found %q", tok.value) + } + // TODO: Handle nested messages which implement encoding.TextUnmarshaler. + return p.readStruct(fv, terminator) + case reflect.Uint32: + if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { + fv.SetUint(uint64(x)) + return nil + } + case reflect.Uint64: + if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil { + fv.SetUint(x) + return nil + } + } + return p.errorf("invalid %v: %v", v.Type(), tok.value) +} + +// UnmarshalText reads a protocol buffer in Text format. UnmarshalText resets pb +// before starting to unmarshal, so any existing data in pb is always removed. +// If a required field is not set and no other error occurs, +// UnmarshalText returns *RequiredNotSetError. +func UnmarshalText(s string, pb Message) error { + if um, ok := pb.(encoding.TextUnmarshaler); ok { + err := um.UnmarshalText([]byte(s)) + return err + } + pb.Reset() + v := reflect.ValueOf(pb) + if pe := newTextParser(s).readStruct(v.Elem(), ""); pe != nil { + return pe + } + return nil +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/timestamp.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/timestamp.go new file mode 100644 index 00000000000..9324f6542bc --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/timestamp.go @@ -0,0 +1,113 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +package proto + +// This file implements operations on google.protobuf.Timestamp. + +import ( + "errors" + "fmt" + "time" +) + +const ( + // Seconds field of the earliest valid Timestamp. + // This is time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). + minValidSeconds = -62135596800 + // Seconds field just after the latest valid Timestamp. + // This is time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). + maxValidSeconds = 253402300800 +) + +// validateTimestamp determines whether a Timestamp is valid. +// A valid timestamp represents a time in the range +// [0001-01-01, 10000-01-01) and has a Nanos field +// in the range [0, 1e9). +// +// If the Timestamp is valid, validateTimestamp returns nil. +// Otherwise, it returns an error that describes +// the problem. +// +// Every valid Timestamp can be represented by a time.Time, but the converse is not true. +func validateTimestamp(ts *timestamp) error { + if ts == nil { + return errors.New("timestamp: nil Timestamp") + } + if ts.Seconds < minValidSeconds { + return fmt.Errorf("timestamp: %#v before 0001-01-01", ts) + } + if ts.Seconds >= maxValidSeconds { + return fmt.Errorf("timestamp: %#v after 10000-01-01", ts) + } + if ts.Nanos < 0 || ts.Nanos >= 1e9 { + return fmt.Errorf("timestamp: %#v: nanos not in range [0, 1e9)", ts) + } + return nil +} + +// TimestampFromProto converts a google.protobuf.Timestamp proto to a time.Time. +// It returns an error if the argument is invalid. +// +// Unlike most Go functions, if Timestamp returns an error, the first return value +// is not the zero time.Time. Instead, it is the value obtained from the +// time.Unix function when passed the contents of the Timestamp, in the UTC +// locale. This may or may not be a meaningful time; many invalid Timestamps +// do map to valid time.Times. +// +// A nil Timestamp returns an error. The first return value in that case is +// undefined. +func timestampFromProto(ts *timestamp) (time.Time, error) { + // Don't return the zero value on error, because corresponds to a valid + // timestamp. Instead return whatever time.Unix gives us. + var t time.Time + if ts == nil { + t = time.Unix(0, 0).UTC() // treat nil like the empty Timestamp + } else { + t = time.Unix(ts.Seconds, int64(ts.Nanos)).UTC() + } + return t, validateTimestamp(ts) +} + +// TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. +// It returns an error if the resulting Timestamp is invalid. +func timestampProto(t time.Time) (*timestamp, error) { + seconds := t.Unix() + nanos := int32(t.Sub(time.Unix(seconds, 0))) + ts := ×tamp{ + Seconds: seconds, + Nanos: nanos, + } + if err := validateTimestamp(ts); err != nil { + return nil, err + } + return ts, nil +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/timestamp_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/timestamp_gogo.go new file mode 100644 index 00000000000..d4276474360 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/timestamp_gogo.go @@ -0,0 +1,229 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2016, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package proto + +import ( + "reflect" + "time" +) + +var timeType = reflect.TypeOf((*time.Time)(nil)).Elem() + +type timestamp struct { + Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` + Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` +} + +func (m *timestamp) Reset() { *m = timestamp{} } +func (*timestamp) ProtoMessage() {} +func (*timestamp) String() string { return "timestamp" } + +func init() { + RegisterType((*timestamp)(nil), "gogo.protobuf.proto.timestamp") +} + +func (o *Buffer) decTimestamp() (time.Time, error) { + b, err := o.DecodeRawBytes(true) + if err != nil { + return time.Time{}, err + } + tproto := ×tamp{} + if err := Unmarshal(b, tproto); err != nil { + return time.Time{}, err + } + return timestampFromProto(tproto) +} + +func (o *Buffer) dec_time(p *Properties, base structPointer) error { + t, err := o.decTimestamp() + if err != nil { + return err + } + setPtrCustomType(base, p.field, &t) + return nil +} + +func (o *Buffer) dec_ref_time(p *Properties, base structPointer) error { + t, err := o.decTimestamp() + if err != nil { + return err + } + setCustomType(base, p.field, &t) + return nil +} + +func (o *Buffer) dec_slice_time(p *Properties, base structPointer) error { + t, err := o.decTimestamp() + if err != nil { + return err + } + newBas := appendStructPointer(base, p.field, reflect.SliceOf(reflect.PtrTo(timeType))) + var zero field + setPtrCustomType(newBas, zero, &t) + return nil +} + +func (o *Buffer) dec_slice_ref_time(p *Properties, base structPointer) error { + t, err := o.decTimestamp() + if err != nil { + return err + } + newBas := appendStructPointer(base, p.field, reflect.SliceOf(timeType)) + var zero field + setCustomType(newBas, zero, &t) + return nil +} + +func size_time(p *Properties, base structPointer) (n int) { + structp := structPointer_GetStructPointer(base, p.field) + if structPointer_IsNil(structp) { + return 0 + } + tim := structPointer_Interface(structp, timeType).(*time.Time) + t, err := timestampProto(*tim) + if err != nil { + return 0 + } + size := Size(t) + return size + sizeVarint(uint64(size)) + len(p.tagcode) +} + +func (o *Buffer) enc_time(p *Properties, base structPointer) error { + structp := structPointer_GetStructPointer(base, p.field) + if structPointer_IsNil(structp) { + return ErrNil + } + tim := structPointer_Interface(structp, timeType).(*time.Time) + t, err := timestampProto(*tim) + if err != nil { + return err + } + data, err := Marshal(t) + if err != nil { + return err + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeRawBytes(data) + return nil +} + +func size_ref_time(p *Properties, base structPointer) (n int) { + tim := structPointer_InterfaceAt(base, p.field, timeType).(*time.Time) + t, err := timestampProto(*tim) + if err != nil { + return 0 + } + size := Size(t) + return size + sizeVarint(uint64(size)) + len(p.tagcode) +} + +func (o *Buffer) enc_ref_time(p *Properties, base structPointer) error { + tim := structPointer_InterfaceAt(base, p.field, timeType).(*time.Time) + t, err := timestampProto(*tim) + if err != nil { + return err + } + data, err := Marshal(t) + if err != nil { + return err + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeRawBytes(data) + return nil +} + +func size_slice_time(p *Properties, base structPointer) (n int) { + ptims := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(reflect.PtrTo(timeType))).(*[]*time.Time) + tims := *ptims + for i := 0; i < len(tims); i++ { + if tims[i] == nil { + return 0 + } + tproto, err := timestampProto(*tims[i]) + if err != nil { + return 0 + } + size := Size(tproto) + n += len(p.tagcode) + size + sizeVarint(uint64(size)) + } + return n +} + +func (o *Buffer) enc_slice_time(p *Properties, base structPointer) error { + ptims := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(reflect.PtrTo(timeType))).(*[]*time.Time) + tims := *ptims + for i := 0; i < len(tims); i++ { + if tims[i] == nil { + return errRepeatedHasNil + } + tproto, err := timestampProto(*tims[i]) + if err != nil { + return err + } + data, err := Marshal(tproto) + if err != nil { + return err + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeRawBytes(data) + } + return nil +} + +func size_slice_ref_time(p *Properties, base structPointer) (n int) { + ptims := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(timeType)).(*[]time.Time) + tims := *ptims + for i := 0; i < len(tims); i++ { + tproto, err := timestampProto(tims[i]) + if err != nil { + return 0 + } + size := Size(tproto) + n += len(p.tagcode) + size + sizeVarint(uint64(size)) + } + return n +} + +func (o *Buffer) enc_slice_ref_time(p *Properties, base structPointer) error { + ptims := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(timeType)).(*[]time.Time) + tims := *ptims + for i := 0; i < len(tims); i++ { + tproto, err := timestampProto(tims[i]) + if err != nil { + return err + } + data, err := Marshal(tproto) + if err != nil { + return err + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeRawBytes(data) + } + return nil +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/any.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/any.proto new file mode 100644 index 00000000000..8152a34e484 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/any.proto @@ -0,0 +1,140 @@ +// 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. + +syntax = "proto3"; + +package google.protobuf; + +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option go_package = "types"; +option java_package = "com.google.protobuf"; +option java_outer_classname = "AnyProto"; +option java_multiple_files = true; +option java_generate_equals_and_hash = true; +option objc_class_prefix = "GPB"; + +// `Any` contains an arbitrary serialized protocol buffer message along with a +// URL that describes the type of the serialized message. +// +// Protobuf library provides support to pack/unpack Any values in the form +// of utility functions or additional generated methods of the Any type. +// +// Example 1: Pack and unpack a message in C++. +// +// Foo foo = ...; +// Any any; +// any.PackFrom(foo); +// ... +// if (any.UnpackTo(&foo)) { +// ... +// } +// +// Example 2: Pack and unpack a message in Java. +// +// Foo foo = ...; +// Any any = Any.pack(foo); +// ... +// if (any.is(Foo.class)) { +// foo = any.unpack(Foo.class); +// } +// +// Example 3: Pack and unpack a message in Python. +// +// foo = Foo(...) +// any = Any() +// any.Pack(foo) +// ... +// if any.Is(Foo.DESCRIPTOR): +// any.Unpack(foo) +// ... +// +// The pack methods provided by protobuf library will by default use +// 'type.googleapis.com/full.type.name' as the type URL and the unpack +// methods only use the fully qualified type name after the last '/' +// in the type URL, for example "foo.bar.com/x/y.z" will yield type +// name "y.z". +// +// +// JSON +// ==== +// The JSON representation of an `Any` value uses the regular +// representation of the deserialized, embedded message, with an +// additional field `@type` which contains the type URL. Example: +// +// package google.profile; +// message Person { +// string first_name = 1; +// string last_name = 2; +// } +// +// { +// "@type": "type.googleapis.com/google.profile.Person", +// "firstName": , +// "lastName": +// } +// +// If the embedded message type is well-known and has a custom JSON +// representation, that representation will be embedded adding a field +// `value` which holds the custom JSON in addition to the `@type` +// field. Example (for message [google.protobuf.Duration][]): +// +// { +// "@type": "type.googleapis.com/google.protobuf.Duration", +// "value": "1.212s" +// } +// +message Any { + // A URL/resource name whose content describes the type of the + // serialized protocol buffer message. + // + // For URLs which use the scheme `http`, `https`, or no scheme, the + // following restrictions and interpretations apply: + // + // * If no scheme is provided, `https` is assumed. + // * The last segment of the URL's path must represent the fully + // qualified name of the type (as in `path/google.protobuf.Duration`). + // The name should be in a canonical form (e.g., leading "." is + // not accepted). + // * An HTTP GET on the URL must yield a [google.protobuf.Type][] + // value in binary format, or produce an error. + // * Applications are allowed to cache lookup results based on the + // URL, or have them precompiled into a binary to avoid any + // lookup. Therefore, binary compatibility needs to be preserved + // on changes to types. (Use versioned type names to manage + // breaking changes.) + // + // Schemes other than `http`, `https` (or the empty scheme) might be + // used with implementation specific semantics. + // + string type_url = 1; + + // Must be a valid serialized protocol buffer of the above specified type. + bytes value = 2; +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/compiler/plugin.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/compiler/plugin.proto new file mode 100644 index 00000000000..acaee1f4945 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/compiler/plugin.proto @@ -0,0 +1,150 @@ +// 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. + +// Author: kenton@google.com (Kenton Varda) +// +// WARNING: The plugin interface is currently EXPERIMENTAL and is subject to +// change. +// +// protoc (aka the Protocol Compiler) can be extended via plugins. A plugin is +// just a program that reads a CodeGeneratorRequest from stdin and writes a +// CodeGeneratorResponse to stdout. +// +// Plugins written using C++ can use google/protobuf/compiler/plugin.h instead +// of dealing with the raw protocol defined here. +// +// A plugin executable needs only to be placed somewhere in the path. The +// plugin should be named "protoc-gen-$NAME", and will then be used when the +// flag "--${NAME}_out" is passed to protoc. + +syntax = "proto2"; +package google.protobuf.compiler; +option java_package = "com.google.protobuf.compiler"; +option java_outer_classname = "PluginProtos"; + +option go_package = "plugin_go"; + +import "google/protobuf/descriptor.proto"; + +// An encoded CodeGeneratorRequest is written to the plugin's stdin. +message CodeGeneratorRequest { + // The .proto files that were explicitly listed on the command-line. The + // code generator should generate code only for these files. Each file's + // descriptor will be included in proto_file, below. + repeated string file_to_generate = 1; + + // The generator parameter passed on the command-line. + optional string parameter = 2; + + // FileDescriptorProtos for all files in files_to_generate and everything + // they import. The files will appear in topological order, so each file + // appears before any file that imports it. + // + // protoc guarantees that all proto_files will be written after + // the fields above, even though this is not technically guaranteed by the + // protobuf wire format. This theoretically could allow a plugin to stream + // in the FileDescriptorProtos and handle them one by one rather than read + // the entire set into memory at once. However, as of this writing, this + // is not similarly optimized on protoc's end -- it will store all fields in + // memory at once before sending them to the plugin. + repeated FileDescriptorProto proto_file = 15; +} + +// The plugin writes an encoded CodeGeneratorResponse to stdout. +message CodeGeneratorResponse { + // Error message. If non-empty, code generation failed. The plugin process + // should exit with status code zero even if it reports an error in this way. + // + // This should be used to indicate errors in .proto files which prevent the + // code generator from generating correct code. Errors which indicate a + // problem in protoc itself -- such as the input CodeGeneratorRequest being + // unparseable -- should be reported by writing a message to stderr and + // exiting with a non-zero status code. + optional string error = 1; + + // Represents a single generated file. + message File { + // The file name, relative to the output directory. The name must not + // contain "." or ".." components and must be relative, not be absolute (so, + // the file cannot lie outside the output directory). "/" must be used as + // the path separator, not "\". + // + // If the name is omitted, the content will be appended to the previous + // file. This allows the generator to break large files into small chunks, + // and allows the generated text to be streamed back to protoc so that large + // files need not reside completely in memory at one time. Note that as of + // this writing protoc does not optimize for this -- it will read the entire + // CodeGeneratorResponse before writing files to disk. + optional string name = 1; + + // If non-empty, indicates that the named file should already exist, and the + // content here is to be inserted into that file at a defined insertion + // point. This feature allows a code generator to extend the output + // produced by another code generator. The original generator may provide + // insertion points by placing special annotations in the file that look + // like: + // @@protoc_insertion_point(NAME) + // The annotation can have arbitrary text before and after it on the line, + // which allows it to be placed in a comment. NAME should be replaced with + // an identifier naming the point -- this is what other generators will use + // as the insertion_point. Code inserted at this point will be placed + // immediately above the line containing the insertion point (thus multiple + // insertions to the same point will come out in the order they were added). + // The double-@ is intended to make it unlikely that the generated code + // could contain things that look like insertion points by accident. + // + // For example, the C++ code generator places the following line in the + // .pb.h files that it generates: + // // @@protoc_insertion_point(namespace_scope) + // This line appears within the scope of the file's package namespace, but + // outside of any particular class. Another plugin can then specify the + // insertion_point "namespace_scope" to generate additional classes or + // other declarations that should be placed in this scope. + // + // Note that if the line containing the insertion point begins with + // whitespace, the same whitespace will be added to every line of the + // inserted text. This is useful for languages like Python, where + // indentation matters. In these languages, the insertion point comment + // should be indented the same amount as any inserted code will need to be + // in order to work correctly in that context. + // + // The code generator that generates the initial file and the one which + // inserts into it must both run as part of a single invocation of protoc. + // Code generators are executed in the order in which they appear on the + // command line. + // + // If |insertion_point| is present, |name| must also be present. + optional string insertion_point = 2; + + // The file contents. + optional string content = 15; + } + repeated File file = 15; +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/descriptor.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/descriptor.proto new file mode 100644 index 00000000000..9aefdef2fab --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/descriptor.proto @@ -0,0 +1,813 @@ +// 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. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// The messages in this file describe the definitions found in .proto files. +// A valid .proto file can be translated directly to a FileDescriptorProto +// without any other information (e.g. without reading its imports). + + +syntax = "proto2"; + +package google.protobuf; +option go_package = "descriptor"; +option java_package = "com.google.protobuf"; +option java_outer_classname = "DescriptorProtos"; +option csharp_namespace = "Google.Protobuf.Reflection"; +option objc_class_prefix = "GPB"; +option java_generate_equals_and_hash = true; + +// descriptor.proto must be optimized for speed because reflection-based +// algorithms don't work during bootstrapping. +option optimize_for = SPEED; + +// The protocol compiler can output a FileDescriptorSet containing the .proto +// files it parses. +message FileDescriptorSet { + repeated FileDescriptorProto file = 1; +} + +// Describes a complete .proto file. +message FileDescriptorProto { + optional string name = 1; // file name, relative to root of source tree + optional string package = 2; // e.g. "foo", "foo.bar", etc. + + // Names of files imported by this file. + repeated string dependency = 3; + // Indexes of the public imported files in the dependency list above. + repeated int32 public_dependency = 10; + // Indexes of the weak imported files in the dependency list. + // For Google-internal migration only. Do not use. + repeated int32 weak_dependency = 11; + + // All top-level definitions in this file. + repeated DescriptorProto message_type = 4; + repeated EnumDescriptorProto enum_type = 5; + repeated ServiceDescriptorProto service = 6; + repeated FieldDescriptorProto extension = 7; + + optional FileOptions options = 8; + + // This field contains optional information about the original source code. + // You may safely remove this entire field without harming runtime + // functionality of the descriptors -- the information is needed only by + // development tools. + optional SourceCodeInfo source_code_info = 9; + + // The syntax of the proto file. + // The supported values are "proto2" and "proto3". + optional string syntax = 12; +} + +// Describes a message type. +message DescriptorProto { + optional string name = 1; + + repeated FieldDescriptorProto field = 2; + repeated FieldDescriptorProto extension = 6; + + repeated DescriptorProto nested_type = 3; + repeated EnumDescriptorProto enum_type = 4; + + message ExtensionRange { + optional int32 start = 1; + optional int32 end = 2; + } + repeated ExtensionRange extension_range = 5; + + repeated OneofDescriptorProto oneof_decl = 8; + + optional MessageOptions options = 7; + + // Range of reserved tag numbers. Reserved tag numbers may not be used by + // fields or extension ranges in the same message. Reserved ranges may + // not overlap. + message ReservedRange { + optional int32 start = 1; // Inclusive. + optional int32 end = 2; // Exclusive. + } + repeated ReservedRange reserved_range = 9; + // Reserved field names, which may not be used by fields in the same message. + // A given name may only be reserved once. + repeated string reserved_name = 10; +} + +// Describes a field within a message. +message FieldDescriptorProto { + enum Type { + // 0 is reserved for errors. + // Order is weird for historical reasons. + TYPE_DOUBLE = 1; + TYPE_FLOAT = 2; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + // negative values are likely. + TYPE_INT64 = 3; + TYPE_UINT64 = 4; + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + // negative values are likely. + TYPE_INT32 = 5; + TYPE_FIXED64 = 6; + TYPE_FIXED32 = 7; + TYPE_BOOL = 8; + TYPE_STRING = 9; + TYPE_GROUP = 10; // Tag-delimited aggregate. + TYPE_MESSAGE = 11; // Length-delimited aggregate. + + // New in version 2. + TYPE_BYTES = 12; + TYPE_UINT32 = 13; + TYPE_ENUM = 14; + TYPE_SFIXED32 = 15; + TYPE_SFIXED64 = 16; + TYPE_SINT32 = 17; // Uses ZigZag encoding. + TYPE_SINT64 = 18; // Uses ZigZag encoding. + }; + + enum Label { + // 0 is reserved for errors + LABEL_OPTIONAL = 1; + LABEL_REQUIRED = 2; + LABEL_REPEATED = 3; + // TODO(sanjay): Should we add LABEL_MAP? + }; + + optional string name = 1; + optional int32 number = 3; + optional Label label = 4; + + // If type_name is set, this need not be set. If both this and type_name + // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + optional Type type = 5; + + // For message and enum types, this is the name of the type. If the name + // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + // rules are used to find the type (i.e. first the nested types within this + // message are searched, then within the parent, on up to the root + // namespace). + optional string type_name = 6; + + // For extensions, this is the name of the type being extended. It is + // resolved in the same manner as type_name. + optional string extendee = 2; + + // For numeric types, contains the original text representation of the value. + // For booleans, "true" or "false". + // For strings, contains the default text contents (not escaped in any way). + // For bytes, contains the C escaped value. All bytes >= 128 are escaped. + // TODO(kenton): Base-64 encode? + optional string default_value = 7; + + // If set, gives the index of a oneof in the containing type's oneof_decl + // list. This field is a member of that oneof. + optional int32 oneof_index = 9; + + // JSON name of this field. The value is set by protocol compiler. If the + // user has set a "json_name" option on this field, that option's value + // will be used. Otherwise, it's deduced from the field's name by converting + // it to camelCase. + optional string json_name = 10; + + optional FieldOptions options = 8; +} + +// Describes a oneof. +message OneofDescriptorProto { + optional string name = 1; + optional OneofOptions options = 2; +} + +// Describes an enum type. +message EnumDescriptorProto { + optional string name = 1; + + repeated EnumValueDescriptorProto value = 2; + + optional EnumOptions options = 3; +} + +// Describes a value within an enum. +message EnumValueDescriptorProto { + optional string name = 1; + optional int32 number = 2; + + optional EnumValueOptions options = 3; +} + +// Describes a service. +message ServiceDescriptorProto { + optional string name = 1; + repeated MethodDescriptorProto method = 2; + + optional ServiceOptions options = 3; +} + +// Describes a method of a service. +message MethodDescriptorProto { + optional string name = 1; + + // Input and output type names. These are resolved in the same way as + // FieldDescriptorProto.type_name, but must refer to a message type. + optional string input_type = 2; + optional string output_type = 3; + + optional MethodOptions options = 4; + + // Identifies if client streams multiple client messages + optional bool client_streaming = 5 [default=false]; + // Identifies if server streams multiple server messages + optional bool server_streaming = 6 [default=false]; +} + + +// =================================================================== +// Options + +// Each of the definitions above may have "options" attached. These are +// just annotations which may cause code to be generated slightly differently +// or may contain hints for code that manipulates protocol messages. +// +// Clients may define custom options as extensions of the *Options messages. +// These extensions may not yet be known at parsing time, so the parser cannot +// store the values in them. Instead it stores them in a field in the *Options +// message called uninterpreted_option. This field must have the same name +// across all *Options messages. We then use this field to populate the +// extensions when we build a descriptor, at which point all protos have been +// parsed and so all extensions are known. +// +// Extension numbers for custom options may be chosen as follows: +// * For options which will only be used within a single application or +// organization, or for experimental options, use field numbers 50000 +// through 99999. It is up to you to ensure that you do not use the +// same number for multiple options. +// * For options which will be published and used publicly by multiple +// independent entities, e-mail protobuf-global-extension-registry@google.com +// to reserve extension numbers. Simply provide your project name (e.g. +// Objective-C plugin) and your project website (if available) -- there's no +// need to explain how you intend to use them. Usually you only need one +// extension number. You can declare multiple options with only one extension +// number by putting them in a sub-message. See the Custom Options section of +// the docs for examples: +// https://developers.google.com/protocol-buffers/docs/proto#options +// If this turns out to be popular, a web service will be set up +// to automatically assign option numbers. + + +message FileOptions { + + // Sets the Java package where classes generated from this .proto will be + // placed. By default, the proto package is used, but this is often + // inappropriate because proto packages do not normally start with backwards + // domain names. + optional string java_package = 1; + + + // If set, all the classes from the .proto file are wrapped in a single + // outer class with the given name. This applies to both Proto1 + // (equivalent to the old "--one_java_file" option) and Proto2 (where + // a .proto always translates to a single class, but you may want to + // explicitly choose the class name). + optional string java_outer_classname = 8; + + // If set true, then the Java code generator will generate a separate .java + // file for each top-level message, enum, and service defined in the .proto + // file. Thus, these types will *not* be nested inside the outer class + // named by java_outer_classname. However, the outer class will still be + // generated to contain the file's getDescriptor() method as well as any + // top-level extensions defined in the file. + optional bool java_multiple_files = 10 [default=false]; + + // If set true, then the Java code generator will generate equals() and + // hashCode() methods for all messages defined in the .proto file. + // This increases generated code size, potentially substantially for large + // protos, which may harm a memory-constrained application. + // - In the full runtime this is a speed optimization, as the + // AbstractMessage base class includes reflection-based implementations of + // these methods. + // - In the lite runtime, setting this option changes the semantics of + // equals() and hashCode() to more closely match those of the full runtime; + // the generated methods compute their results based on field values rather + // than object identity. (Implementations should not assume that hashcodes + // will be consistent across runtimes or versions of the protocol compiler.) + optional bool java_generate_equals_and_hash = 20 [default=false]; + + // If set true, then the Java2 code generator will generate code that + // throws an exception whenever an attempt is made to assign a non-UTF-8 + // byte sequence to a string field. + // Message reflection will do the same. + // However, an extension field still accepts non-UTF-8 byte sequences. + // This option has no effect on when used with the lite runtime. + optional bool java_string_check_utf8 = 27 [default=false]; + + + // Generated classes can be optimized for speed or code size. + enum OptimizeMode { + SPEED = 1; // Generate complete code for parsing, serialization, + // etc. + CODE_SIZE = 2; // Use ReflectionOps to implement these methods. + LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. + } + optional OptimizeMode optimize_for = 9 [default=SPEED]; + + // Sets the Go package where structs generated from this .proto will be + // placed. If omitted, the Go package will be derived from the following: + // - The basename of the package import path, if provided. + // - Otherwise, the package statement in the .proto file, if present. + // - Otherwise, the basename of the .proto file, without extension. + optional string go_package = 11; + + + + // Should generic services be generated in each language? "Generic" services + // are not specific to any particular RPC system. They are generated by the + // main code generators in each language (without additional plugins). + // Generic services were the only kind of service generation supported by + // early versions of google.protobuf. + // + // Generic services are now considered deprecated in favor of using plugins + // that generate code specific to your particular RPC system. Therefore, + // these default to false. Old code which depends on generic services should + // explicitly set them to true. + optional bool cc_generic_services = 16 [default=false]; + optional bool java_generic_services = 17 [default=false]; + optional bool py_generic_services = 18 [default=false]; + + // Is this file deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for everything in the file, or it will be completely ignored; in the very + // least, this is a formalization for deprecating files. + optional bool deprecated = 23 [default=false]; + + // Enables the use of arenas for the proto messages in this file. This applies + // only to generated classes for C++. + optional bool cc_enable_arenas = 31 [default=false]; + + + // Sets the objective c class prefix which is prepended to all objective c + // generated classes from this .proto. There is no default. + optional string objc_class_prefix = 36; + + // Namespace for generated classes; defaults to the package. + optional string csharp_namespace = 37; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; + + //reserved 38; +} + +message MessageOptions { + // Set true to use the old proto1 MessageSet wire format for extensions. + // This is provided for backwards-compatibility with the MessageSet wire + // format. You should not use this for any other reason: It's less + // efficient, has fewer features, and is more complicated. + // + // The message must be defined exactly as follows: + // message Foo { + // option message_set_wire_format = true; + // extensions 4 to max; + // } + // Note that the message cannot have any defined fields; MessageSets only + // have extensions. + // + // All extensions of your type must be singular messages; e.g. they cannot + // be int32s, enums, or repeated messages. + // + // Because this is an option, the above two restrictions are not enforced by + // the protocol compiler. + optional bool message_set_wire_format = 1 [default=false]; + + // Disables the generation of the standard "descriptor()" accessor, which can + // conflict with a field of the same name. This is meant to make migration + // from proto1 easier; new code should avoid fields named "descriptor". + optional bool no_standard_descriptor_accessor = 2 [default=false]; + + // Is this message deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the message, or it will be completely ignored; in the very least, + // this is a formalization for deprecating messages. + optional bool deprecated = 3 [default=false]; + + // Whether the message is an automatically generated map entry type for the + // maps field. + // + // For maps fields: + // map map_field = 1; + // The parsed descriptor looks like: + // message MapFieldEntry { + // option map_entry = true; + // optional KeyType key = 1; + // optional ValueType value = 2; + // } + // repeated MapFieldEntry map_field = 1; + // + // Implementations may choose not to generate the map_entry=true message, but + // use a native map in the target language to hold the keys and values. + // The reflection APIs in such implementions still need to work as + // if the field is a repeated message field. + // + // NOTE: Do not set the option in .proto files. Always use the maps syntax + // instead. The option should only be implicitly set by the proto compiler + // parser. + optional bool map_entry = 7; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message FieldOptions { + // The ctype option instructs the C++ code generator to use a different + // representation of the field than it normally would. See the specific + // options below. This option is not yet implemented in the open source + // release -- sorry, we'll try to include it in a future version! + optional CType ctype = 1 [default = STRING]; + enum CType { + // Default mode. + STRING = 0; + + CORD = 1; + + STRING_PIECE = 2; + } + // The packed option can be enabled for repeated primitive fields to enable + // a more efficient representation on the wire. Rather than repeatedly + // writing the tag and type for each element, the entire array is encoded as + // a single length-delimited blob. In proto3, only explicit setting it to + // false will avoid using packed encoding. + optional bool packed = 2; + + + // The jstype option determines the JavaScript type used for values of the + // field. The option is permitted only for 64 bit integral and fixed types + // (int64, uint64, sint64, fixed64, sfixed64). By default these types are + // represented as JavaScript strings. This avoids loss of precision that can + // happen when a large value is converted to a floating point JavaScript + // numbers. Specifying JS_NUMBER for the jstype causes the generated + // JavaScript code to use the JavaScript "number" type instead of strings. + // This option is an enum to permit additional types to be added, + // e.g. goog.math.Integer. + optional JSType jstype = 6 [default = JS_NORMAL]; + enum JSType { + // Use the default type. + JS_NORMAL = 0; + + // Use JavaScript strings. + JS_STRING = 1; + + // Use JavaScript numbers. + JS_NUMBER = 2; + } + + // Should this field be parsed lazily? Lazy applies only to message-type + // fields. It means that when the outer message is initially parsed, the + // inner message's contents will not be parsed but instead stored in encoded + // form. The inner message will actually be parsed when it is first accessed. + // + // This is only a hint. Implementations are free to choose whether to use + // eager or lazy parsing regardless of the value of this option. However, + // setting this option true suggests that the protocol author believes that + // using lazy parsing on this field is worth the additional bookkeeping + // overhead typically needed to implement it. + // + // This option does not affect the public interface of any generated code; + // all method signatures remain the same. Furthermore, thread-safety of the + // interface is not affected by this option; const methods remain safe to + // call from multiple threads concurrently, while non-const methods continue + // to require exclusive access. + // + // + // Note that implementations may choose not to check required fields within + // a lazy sub-message. That is, calling IsInitialized() on the outher message + // may return true even if the inner message has missing required fields. + // This is necessary because otherwise the inner message would have to be + // parsed in order to perform the check, defeating the purpose of lazy + // parsing. An implementation which chooses not to check required fields + // must be consistent about it. That is, for any particular sub-message, the + // implementation must either *always* check its required fields, or *never* + // check its required fields, regardless of whether or not the message has + // been parsed. + optional bool lazy = 5 [default=false]; + + // Is this field deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for accessors, or it will be completely ignored; in the very least, this + // is a formalization for deprecating fields. + optional bool deprecated = 3 [default=false]; + + // For Google-internal migration only. Do not use. + optional bool weak = 10 [default=false]; + + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message OneofOptions { + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumOptions { + + // Set this option to true to allow mapping different tag names to the same + // value. + optional bool allow_alias = 2; + + // Is this enum deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum, or it will be completely ignored; in the very least, this + // is a formalization for deprecating enums. + optional bool deprecated = 3 [default=false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumValueOptions { + // Is this enum value deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum value, or it will be completely ignored; in the very least, + // this is a formalization for deprecating enum values. + optional bool deprecated = 1 [default=false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message ServiceOptions { + + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // Is this service deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the service, or it will be completely ignored; in the very least, + // this is a formalization for deprecating services. + optional bool deprecated = 33 [default=false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message MethodOptions { + + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // Is this method deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the method, or it will be completely ignored; in the very least, + // this is a formalization for deprecating methods. + optional bool deprecated = 33 [default=false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + + +// A message representing a option the parser does not recognize. This only +// appears in options protos created by the compiler::Parser class. +// DescriptorPool resolves these when building Descriptor objects. Therefore, +// options protos in descriptor objects (e.g. returned by Descriptor::options(), +// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions +// in them. +message UninterpretedOption { + // The name of the uninterpreted option. Each string represents a segment in + // a dot-separated name. is_extension is true iff a segment represents an + // extension (denoted with parentheses in options specs in .proto files). + // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + // "foo.(bar.baz).qux". + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } + repeated NamePart name = 2; + + // The value of the uninterpreted option, in whatever type the tokenizer + // identified it as during parsing. Exactly one of these should be set. + optional string identifier_value = 3; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; +} + +// =================================================================== +// Optional source code info + +// Encapsulates information about the original source file from which a +// FileDescriptorProto was generated. +message SourceCodeInfo { + // A Location identifies a piece of source code in a .proto file which + // corresponds to a particular definition. This information is intended + // to be useful to IDEs, code indexers, documentation generators, and similar + // tools. + // + // For example, say we have a file like: + // message Foo { + // optional string foo = 1; + // } + // Let's look at just the field definition: + // optional string foo = 1; + // ^ ^^ ^^ ^ ^^^ + // a bc de f ghi + // We have the following locations: + // span path represents + // [a,i) [ 4, 0, 2, 0 ] The whole field definition. + // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + // + // Notes: + // - A location may refer to a repeated field itself (i.e. not to any + // particular index within it). This is used whenever a set of elements are + // logically enclosed in a single code segment. For example, an entire + // extend block (possibly containing multiple extension definitions) will + // have an outer location whose path refers to the "extensions" repeated + // field without an index. + // - Multiple locations may have the same path. This happens when a single + // logical declaration is spread out across multiple places. The most + // obvious example is the "extend" block again -- there may be multiple + // extend blocks in the same scope, each of which will have the same path. + // - A location's span is not always a subset of its parent's span. For + // example, the "extendee" of an extension declaration appears at the + // beginning of the "extend" block and is shared by all extensions within + // the block. + // - Just because a location's span is a subset of some other location's span + // does not mean that it is a descendent. For example, a "group" defines + // both a type and a field in a single declaration. Thus, the locations + // corresponding to the type and field and their components will overlap. + // - Code which tries to interpret locations should probably be designed to + // ignore those that it doesn't understand, as more types of locations could + // be recorded in the future. + repeated Location location = 1; + message Location { + // Identifies which part of the FileDescriptorProto was defined at this + // location. + // + // Each element is a field number or an index. They form a path from + // the root FileDescriptorProto to the place where the definition. For + // example, this path: + // [ 4, 3, 2, 7, 1 ] + // refers to: + // file.message_type(3) // 4, 3 + // .field(7) // 2, 7 + // .name() // 1 + // This is because FileDescriptorProto.message_type has field number 4: + // repeated DescriptorProto message_type = 4; + // and DescriptorProto.field has field number 2: + // repeated FieldDescriptorProto field = 2; + // and FieldDescriptorProto.name has field number 1: + // optional string name = 1; + // + // Thus, the above path gives the location of a field name. If we removed + // the last element: + // [ 4, 3, 2, 7 ] + // this path refers to the whole field declaration (from the beginning + // of the label to the terminating semicolon). + repeated int32 path = 1 [packed=true]; + + // Always has exactly three or four elements: start line, start column, + // end line (optional, otherwise assumed same as start line), end column. + // These are packed into a single field for efficiency. Note that line + // and column numbers are zero-based -- typically you will want to add + // 1 to each before displaying to a user. + repeated int32 span = 2 [packed=true]; + + // If this SourceCodeInfo represents a complete declaration, these are any + // comments appearing before and after the declaration which appear to be + // attached to the declaration. + // + // A series of line comments appearing on consecutive lines, with no other + // tokens appearing on those lines, will be treated as a single comment. + // + // leading_detached_comments will keep paragraphs of comments that appear + // before (but not connected to) the current element. Each paragraph, + // separated by empty lines, will be one comment element in the repeated + // field. + // + // Only the comment content is provided; comment markers (e.g. //) are + // stripped out. For block comments, leading whitespace and an asterisk + // will be stripped from the beginning of each line other than the first. + // Newlines are included in the output. + // + // Examples: + // + // optional int32 foo = 1; // Comment attached to foo. + // // Comment attached to bar. + // optional int32 bar = 2; + // + // optional string baz = 3; + // // Comment attached to baz. + // // Another line attached to baz. + // + // // Comment attached to qux. + // // + // // Another line attached to qux. + // optional double qux = 4; + // + // // Detached comment for corge. This is not leading or trailing comments + // // to qux or corge because there are blank lines separating it from + // // both. + // + // // Detached comment for corge paragraph 2. + // + // optional string corge = 5; + // /* Block comment attached + // * to corge. Leading asterisks + // * will be removed. */ + // /* Block comment attached to + // * grault. */ + // optional int32 grault = 6; + // + // // ignored detached comments. + optional string leading_comments = 3; + optional string trailing_comments = 4; + repeated string leading_detached_comments = 6; + } +} + +// Describes the relationship between generated code and its original source +// file. A GeneratedCodeInfo message is associated with only one generated +// source file, but may contain references to different source .proto files. +message GeneratedCodeInfo { + // An Annotation connects some span of text in generated code to an element + // of its generating .proto file. + repeated Annotation annotation = 1; + message Annotation { + // Identifies the element in the original source .proto file. This field + // is formatted the same as SourceCodeInfo.Location.path. + repeated int32 path = 1 [packed=true]; + + // Identifies the filesystem path to the original source .proto. + optional string source_file = 2; + + // Identifies the starting offset in bytes in the generated code + // that relates to the identified object. + optional int32 begin = 3; + + // Identifies the ending offset in bytes in the generated code that + // relates to the identified offset. The end offset should be one past + // the last relevant byte (so the length of the text = end - begin). + optional int32 end = 4; + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/duration.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/duration.proto new file mode 100644 index 00000000000..c4359dbd200 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/duration.proto @@ -0,0 +1,98 @@ +// 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. + +syntax = "proto3"; + +package google.protobuf; + +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option go_package = "types"; +option java_package = "com.google.protobuf"; +option java_outer_classname = "DurationProto"; +option java_multiple_files = true; +option java_generate_equals_and_hash = true; +option objc_class_prefix = "GPB"; + +// A Duration represents a signed, fixed-length span of time represented +// as a count of seconds and fractions of seconds at nanosecond +// resolution. It is independent of any calendar and concepts like "day" +// or "month". It is related to Timestamp in that the difference between +// two Timestamp values is a Duration and it can be added or subtracted +// from a Timestamp. Range is approximately +-10,000 years. +// +// Example 1: Compute Duration from two Timestamps in pseudo code. +// +// Timestamp start = ...; +// Timestamp end = ...; +// Duration duration = ...; +// +// duration.seconds = end.seconds - start.seconds; +// duration.nanos = end.nanos - start.nanos; +// +// if (duration.seconds < 0 && duration.nanos > 0) { +// duration.seconds += 1; +// duration.nanos -= 1000000000; +// } else if (durations.seconds > 0 && duration.nanos < 0) { +// duration.seconds -= 1; +// duration.nanos += 1000000000; +// } +// +// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. +// +// Timestamp start = ...; +// Duration duration = ...; +// Timestamp end = ...; +// +// end.seconds = start.seconds + duration.seconds; +// end.nanos = start.nanos + duration.nanos; +// +// if (end.nanos < 0) { +// end.seconds -= 1; +// end.nanos += 1000000000; +// } else if (end.nanos >= 1000000000) { +// end.seconds += 1; +// end.nanos -= 1000000000; +// } +// +// +message Duration { + + // Signed seconds of the span of time. Must be from -315,576,000,000 + // to +315,576,000,000 inclusive. + int64 seconds = 1; + + // Signed fractions of a second at nanosecond resolution of the span + // of time. Durations less than one second are represented with a 0 + // `seconds` field and a positive or negative `nanos` field. For durations + // of one second or more, a non-zero value for the `nanos` field must be + // of the same sign as the `seconds` field. Must be from -999,999,999 + // to +999,999,999 inclusive. + int32 nanos = 2; +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/empty.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/empty.proto new file mode 100644 index 00000000000..61a574b6a42 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/empty.proto @@ -0,0 +1,53 @@ +// 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. + +syntax = "proto3"; + +package google.protobuf; + +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option go_package = "types"; +option java_package = "com.google.protobuf"; +option java_outer_classname = "EmptyProto"; +option java_multiple_files = true; +option java_generate_equals_and_hash = true; +option objc_class_prefix = "GPB"; +option cc_enable_arenas = true; + +// A generic empty message that you can re-use to avoid defining duplicated +// empty messages in your APIs. A typical example is to use it as the request +// or the response type of an API method. For instance: +// +// service Foo { +// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +// } +// +// The JSON representation for `Empty` is empty JSON object `{}`. +message Empty {} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/field_mask.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/field_mask.proto new file mode 100644 index 00000000000..fd252889aae --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/field_mask.proto @@ -0,0 +1,246 @@ +// 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. + +syntax = "proto3"; + +package google.protobuf; + +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option go_package = "types"; +option java_package = "com.google.protobuf"; +option java_outer_classname = "FieldMaskProto"; +option java_multiple_files = true; +option objc_class_prefix = "GPB"; +option java_generate_equals_and_hash = true; + +// `FieldMask` represents a set of symbolic field paths, for example: +// +// paths: "f.a" +// paths: "f.b.d" +// +// Here `f` represents a field in some root message, `a` and `b` +// fields in the message found in `f`, and `d` a field found in the +// message in `f.b`. +// +// Field masks are used to specify a subset of fields that should be +// returned by a get operation or modified by an update operation. +// Field masks also have a custom JSON encoding (see below). +// +// # Field Masks in Projections +// +// When used in the context of a projection, a response message or +// sub-message is filtered by the API to only contain those fields as +// specified in the mask. For example, if the mask in the previous +// example is applied to a response message as follows: +// +// f { +// a : 22 +// b { +// d : 1 +// x : 2 +// } +// y : 13 +// } +// z: 8 +// +// The result will not contain specific values for fields x,y and z +// (their value will be set to the default, and omitted in proto text +// output): +// +// +// f { +// a : 22 +// b { +// d : 1 +// } +// } +// +// A repeated field is not allowed except at the last position of a +// field mask. +// +// If a FieldMask object is not present in a get operation, the +// operation applies to all fields (as if a FieldMask of all fields +// had been specified). +// +// Note that a field mask does not necessarily apply to the +// top-level response message. In case of a REST get operation, the +// field mask applies directly to the response, but in case of a REST +// list operation, the mask instead applies to each individual message +// in the returned resource list. In case of a REST custom method, +// other definitions may be used. Where the mask applies will be +// clearly documented together with its declaration in the API. In +// any case, the effect on the returned resource/resources is required +// behavior for APIs. +// +// # Field Masks in Update Operations +// +// A field mask in update operations specifies which fields of the +// targeted resource are going to be updated. The API is required +// to only change the values of the fields as specified in the mask +// and leave the others untouched. If a resource is passed in to +// describe the updated values, the API ignores the values of all +// fields not covered by the mask. +// +// If a repeated field is specified for an update operation, the existing +// repeated values in the target resource will be overwritten by the new values. +// Note that a repeated field is only allowed in the last position of a field +// mask. +// +// If a sub-message is specified in the last position of the field mask for an +// update operation, then the existing sub-message in the target resource is +// overwritten. Given the target message: +// +// f { +// b { +// d : 1 +// x : 2 +// } +// c : 1 +// } +// +// And an update message: +// +// f { +// b { +// d : 10 +// } +// } +// +// then if the field mask is: +// +// paths: "f.b" +// +// then the result will be: +// +// f { +// b { +// d : 10 +// } +// c : 1 +// } +// +// However, if the update mask was: +// +// paths: "f.b.d" +// +// then the result would be: +// +// f { +// b { +// d : 10 +// x : 2 +// } +// c : 1 +// } +// +// In order to reset a field's value to the default, the field must +// be in the mask and set to the default value in the provided resource. +// Hence, in order to reset all fields of a resource, provide a default +// instance of the resource and set all fields in the mask, or do +// not provide a mask as described below. +// +// If a field mask is not present on update, the operation applies to +// all fields (as if a field mask of all fields has been specified). +// Note that in the presence of schema evolution, this may mean that +// fields the client does not know and has therefore not filled into +// the request will be reset to their default. If this is unwanted +// behavior, a specific service may require a client to always specify +// a field mask, producing an error if not. +// +// As with get operations, the location of the resource which +// describes the updated values in the request message depends on the +// operation kind. In any case, the effect of the field mask is +// required to be honored by the API. +// +// ## Considerations for HTTP REST +// +// The HTTP kind of an update operation which uses a field mask must +// be set to PATCH instead of PUT in order to satisfy HTTP semantics +// (PUT must only be used for full updates). +// +// # JSON Encoding of Field Masks +// +// In JSON, a field mask is encoded as a single string where paths are +// separated by a comma. Fields name in each path are converted +// to/from lower-camel naming conventions. +// +// As an example, consider the following message declarations: +// +// message Profile { +// User user = 1; +// Photo photo = 2; +// } +// message User { +// string display_name = 1; +// string address = 2; +// } +// +// In proto a field mask for `Profile` may look as such: +// +// mask { +// paths: "user.display_name" +// paths: "photo" +// } +// +// In JSON, the same mask is represented as below: +// +// { +// mask: "user.displayName,photo" +// } +// +// # Field Masks and Oneof Fields +// +// Field masks treat fields in oneofs just as regular fields. Consider the +// following message: +// +// message SampleMessage { +// oneof test_oneof { +// string name = 4; +// SubMessage sub_message = 9; +// } +// } +// +// The field mask can be: +// +// mask { +// paths: "name" +// } +// +// Or: +// +// mask { +// paths: "sub_message" +// } +// +// Note that oneof type names ("test_oneof" in this case) cannot be used in +// paths. +message FieldMask { + // The set of field mask paths. + repeated string paths = 1; +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/struct.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/struct.proto new file mode 100644 index 00000000000..27fdb9188e0 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/struct.proto @@ -0,0 +1,96 @@ +// 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. + +syntax = "proto3"; + +package google.protobuf; + +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option go_package = "types"; +option java_package = "com.google.protobuf"; +option java_outer_classname = "StructProto"; +option java_multiple_files = true; +option java_generate_equals_and_hash = true; +option objc_class_prefix = "GPB"; + + +// `Struct` represents a structured data value, consisting of fields +// which map to dynamically typed values. In some languages, `Struct` +// might be supported by a native representation. For example, in +// scripting languages like JS a struct is represented as an +// object. The details of that representation are described together +// with the proto support for the language. +// +// The JSON representation for `Struct` is JSON object. +message Struct { + // Unordered map of dynamically typed values. + map fields = 1; +} + +// `Value` represents a dynamically typed value which can be either +// null, a number, a string, a boolean, a recursive struct value, or a +// list of values. A producer of value is expected to set one of that +// variants, absence of any variant indicates an error. +// +// The JSON representation for `Value` is JSON value. +message Value { + // The kind of value. + oneof kind { + // Represents a null value. + NullValue null_value = 1; + // Represents a double value. + double number_value = 2; + // Represents a string value. + string string_value = 3; + // Represents a boolean value. + bool bool_value = 4; + // Represents a structured value. + Struct struct_value = 5; + // Represents a repeated `Value`. + ListValue list_value = 6; + } +} + +// `NullValue` is a singleton enumeration to represent the null value for the +// `Value` type union. +// +// The JSON representation for `NullValue` is JSON `null`. +enum NullValue { + // Null value. + NULL_VALUE = 0; +} + +// `ListValue` is a wrapper around a repeated field of values. +// +// The JSON representation for `ListValue` is JSON array. +message ListValue { + // Repeated field of dynamically typed values. + repeated Value values = 1; +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/timestamp.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/timestamp.proto new file mode 100644 index 00000000000..c85024a4278 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/timestamp.proto @@ -0,0 +1,111 @@ +// 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. + +syntax = "proto3"; + +package google.protobuf; + +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option cc_enable_arenas = true; +option go_package = "types"; +option java_package = "com.google.protobuf"; +option java_outer_classname = "TimestampProto"; +option java_multiple_files = true; +option java_generate_equals_and_hash = true; +option objc_class_prefix = "GPB"; + +// A Timestamp represents a point in time independent of any time zone +// or calendar, represented as seconds and fractions of seconds at +// nanosecond resolution in UTC Epoch time. It is encoded using the +// Proleptic Gregorian Calendar which extends the Gregorian calendar +// backwards to year one. It is encoded assuming all minutes are 60 +// seconds long, i.e. leap seconds are "smeared" so that no leap second +// table is needed for interpretation. 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 date strings. +// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). +// +// 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 current time in Python. +// +// now = time.time() +// seconds = int(now) +// nanos = int((now - seconds) * 10**9) +// timestamp = Timestamp(seconds=seconds, nanos=nanos) +// +// +message Timestamp { + + // Represents seconds of UTC time since Unix epoch + // 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to + // 9999-12-31T23:59:59Z inclusive. + int64 seconds = 1; + + // 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. + int32 nanos = 2; +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/wrappers.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/wrappers.proto new file mode 100644 index 00000000000..f685dc082a9 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/wrappers.proto @@ -0,0 +1,119 @@ +// 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. + +// Wrappers for primitive (non-message) types. These types are useful +// for embedding primitives in the `google.protobuf.Any` type and for places +// where we need to distinguish between the absence of a primitive +// typed field and its default value. + +syntax = "proto3"; + +package google.protobuf; + +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option cc_enable_arenas = true; +option go_package = "types"; +option java_package = "com.google.protobuf"; +option java_outer_classname = "WrappersProto"; +option java_multiple_files = true; +option java_generate_equals_and_hash = true; +option objc_class_prefix = "GPB"; + +// Wrapper message for `double`. +// +// The JSON representation for `DoubleValue` is JSON number. +message DoubleValue { + // The double value. + double value = 1; +} + +// Wrapper message for `float`. +// +// The JSON representation for `FloatValue` is JSON number. +message FloatValue { + // The float value. + float value = 1; +} + +// Wrapper message for `int64`. +// +// The JSON representation for `Int64Value` is JSON string. +message Int64Value { + // The int64 value. + int64 value = 1; +} + +// Wrapper message for `uint64`. +// +// The JSON representation for `UInt64Value` is JSON string. +message UInt64Value { + // The uint64 value. + uint64 value = 1; +} + +// Wrapper message for `int32`. +// +// The JSON representation for `Int32Value` is JSON number. +message Int32Value { + // The int32 value. + int32 value = 1; +} + +// Wrapper message for `uint32`. +// +// The JSON representation for `UInt32Value` is JSON number. +message UInt32Value { + // The uint32 value. + uint32 value = 1; +} + +// Wrapper message for `bool`. +// +// The JSON representation for `BoolValue` is JSON `true` and `false`. +message BoolValue { + // The bool value. + bool value = 1; +} + +// Wrapper message for `string`. +// +// The JSON representation for `StringValue` is JSON string. +message StringValue { + // The string value. + string value = 1; +} + +// Wrapper message for `bytes`. +// +// The JSON representation for `BytesValue` is JSON string. +message BytesValue { + // The bytes value. + bytes value = 1; +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-combo/combo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-combo/combo.go new file mode 100644 index 00000000000..eebcc1cf4b7 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-combo/combo.go @@ -0,0 +1,200 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package main + +import ( + "bufio" + "bytes" + "flag" + "fmt" + "io/ioutil" + "os" + "os/exec" + "path/filepath" + "strings" + + "github.com/gogo/protobuf/version" +) + +type MixMatch struct { + Old []string + Filename string + Args []string +} + +func (this MixMatch) Gen(folder string, news []string) { + if err := os.MkdirAll(folder, 0777); err != nil { + panic(err) + } + data, err := ioutil.ReadFile(this.Filename) + if err != nil { + panic(err) + } + content := string(data) + for i, old := range this.Old { + if !strings.Contains(content, old) { + panic(fmt.Errorf("could not find string {%s} to replace with {%s}", old, news[i])) + } + content = strings.Replace(content, old, news[i], 1) + if strings.Contains(content, old) && old != news[i] { + panic(fmt.Errorf("found another string {%s} after it was replaced with {%s}", old, news[i])) + } + } + if err = ioutil.WriteFile(filepath.Join(folder, this.Filename), []byte(content), 0666); err != nil { + panic(err) + } + args := append(this.Args, filepath.Join(folder, this.Filename)) + var regenerate = exec.Command("protoc", args...) + out, err := regenerate.CombinedOutput() + + failed := false + scanner := bufio.NewScanner(bytes.NewReader(out)) + for scanner.Scan() { + text := scanner.Text() + fmt.Println("protoc-gen-combo: ", text) + if !strings.Contains(text, "WARNING") { + failed = true + } + } + + if err != nil { + fmt.Print("protoc-gen-combo: error: ", err) + failed = true + } + + if failed { + os.Exit(1) + } +} + +func filter(ss []string, flag string) ([]string, string) { + s := make([]string, 0, len(ss)) + var v string + for i := range ss { + if strings.Contains(ss[i], flag) { + vs := strings.Split(ss[i], "=") + v = vs[1] + continue + } + s = append(s, ss[i]) + } + return s, v +} + +func filterArgs(ss []string) ([]string, []string) { + var args []string + var flags []string + for i := range ss { + if strings.Contains(ss[i], "=") { + flags = append(flags, ss[i]) + continue + } + args = append(args, ss[i]) + } + return flags, args +} + +func main() { + flag.String("version", "2.3.0", "minimum protoc version") + flag.Bool("default", true, "generate the case where everything is false") + flags, args := filterArgs(os.Args[1:]) + var min string + flags, min = filter(flags, "-version") + if len(min) == 0 { + min = "2.3.1" + } + if !version.AtLeast(min) { + fmt.Printf("protoc version not high enough to parse this proto file\n") + return + } + if len(args) != 1 { + fmt.Printf("protoc-gen-combo expects a filename\n") + os.Exit(1) + } + filename := args[0] + var def string + flags, def = filter(flags, "-default") + if _, err := exec.LookPath("protoc"); err != nil { + panic("cannot find protoc in PATH") + } + m := MixMatch{ + Old: []string{ + "option (gogoproto.unmarshaler_all) = false;", + "option (gogoproto.marshaler_all) = false;", + "option (gogoproto.unsafe_unmarshaler_all) = false;", + "option (gogoproto.unsafe_marshaler_all) = false;", + }, + Filename: filename, + Args: flags, + } + if def != "false" { + m.Gen("./combos/neither/", []string{ + "option (gogoproto.unmarshaler_all) = false;", + "option (gogoproto.marshaler_all) = false;", + "option (gogoproto.unsafe_unmarshaler_all) = false;", + "option (gogoproto.unsafe_marshaler_all) = false;", + }) + } + m.Gen("./combos/marshaler/", []string{ + "option (gogoproto.unmarshaler_all) = false;", + "option (gogoproto.marshaler_all) = true;", + "option (gogoproto.unsafe_unmarshaler_all) = false;", + "option (gogoproto.unsafe_marshaler_all) = false;", + }) + m.Gen("./combos/unmarshaler/", []string{ + "option (gogoproto.unmarshaler_all) = true;", + "option (gogoproto.marshaler_all) = false;", + "option (gogoproto.unsafe_unmarshaler_all) = false;", + "option (gogoproto.unsafe_marshaler_all) = false;", + }) + m.Gen("./combos/both/", []string{ + "option (gogoproto.unmarshaler_all) = true;", + "option (gogoproto.marshaler_all) = true;", + "option (gogoproto.unsafe_unmarshaler_all) = false;", + "option (gogoproto.unsafe_marshaler_all) = false;", + }) + m.Gen("./combos/unsafemarshaler/", []string{ + "option (gogoproto.unmarshaler_all) = false;", + "option (gogoproto.marshaler_all) = false;", + "option (gogoproto.unsafe_unmarshaler_all) = false;", + "option (gogoproto.unsafe_marshaler_all) = true;", + }) + m.Gen("./combos/unsafeunmarshaler/", []string{ + "option (gogoproto.unmarshaler_all) = false;", + "option (gogoproto.marshaler_all) = false;", + "option (gogoproto.unsafe_unmarshaler_all) = true;", + "option (gogoproto.unsafe_marshaler_all) = false;", + }) + m.Gen("./combos/unsafeboth/", []string{ + "option (gogoproto.unmarshaler_all) = false;", + "option (gogoproto.marshaler_all) = false;", + "option (gogoproto.unsafe_unmarshaler_all) = true;", + "option (gogoproto.unsafe_marshaler_all) = true;", + }) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gofast/main.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gofast/main.go new file mode 100644 index 00000000000..3562a81ecf4 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gofast/main.go @@ -0,0 +1,48 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2015, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package main + +import ( + "github.com/gogo/protobuf/vanity" + "github.com/gogo/protobuf/vanity/command" +) + +func main() { + req := command.Read() + files := req.GetProtoFile() + + vanity.ForEachFile(files, vanity.TurnOffGogoImport) + + vanity.ForEachFile(files, vanity.TurnOnMarshalerAll) + vanity.ForEachFile(files, vanity.TurnOnSizerAll) + vanity.ForEachFile(files, vanity.TurnOnUnmarshalerAll) + + resp := command.Generate(req) + command.Write(resp) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.go new file mode 100644 index 00000000000..e808a3fd0f6 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.go @@ -0,0 +1,92 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +// Package descriptor provides functions for obtaining protocol buffer +// descriptors for generated Go types. +// +// These functions cannot go in package proto because they depend on the +// generated protobuf descriptor messages, which themselves depend on proto. +package descriptor + +import ( + "bytes" + "compress/gzip" + "fmt" + "io/ioutil" + + "github.com/gogo/protobuf/proto" +) + +// extractFile extracts a FileDescriptorProto from a gzip'd buffer. +func extractFile(gz []byte) (*FileDescriptorProto, error) { + r, err := gzip.NewReader(bytes.NewReader(gz)) + if err != nil { + return nil, fmt.Errorf("failed to open gzip reader: %v", err) + } + defer r.Close() + + b, err := ioutil.ReadAll(r) + if err != nil { + return nil, fmt.Errorf("failed to uncompress descriptor: %v", err) + } + + fd := new(FileDescriptorProto) + if err := proto.Unmarshal(b, fd); err != nil { + return nil, fmt.Errorf("malformed FileDescriptorProto: %v", err) + } + + return fd, nil +} + +// Message is a proto.Message with a method to return its descriptor. +// +// Message types generated by the protocol compiler always satisfy +// the Message interface. +type Message interface { + proto.Message + Descriptor() ([]byte, []int) +} + +// ForMessage returns a FileDescriptorProto and a DescriptorProto from within it +// describing the given message. +func ForMessage(msg Message) (fd *FileDescriptorProto, md *DescriptorProto) { + gz, path := msg.Descriptor() + fd, err := extractFile(gz) + if err != nil { + panic(fmt.Sprintf("invalid FileDescriptorProto for %T: %v", msg, err)) + } + + md = fd.MessageType[path[0]] + for _, i := range path[1:] { + md = md.NestedType[i] + } + return fd, md +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go new file mode 100644 index 00000000000..6c4d80f5fdc --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go @@ -0,0 +1,2088 @@ +// Code generated by protoc-gen-gogo. +// source: descriptor.proto +// DO NOT EDIT! + +/* +Package descriptor is a generated protocol buffer package. + +It is generated from these files: + descriptor.proto + +It has these top-level messages: + FileDescriptorSet + FileDescriptorProto + DescriptorProto + FieldDescriptorProto + OneofDescriptorProto + EnumDescriptorProto + EnumValueDescriptorProto + ServiceDescriptorProto + MethodDescriptorProto + FileOptions + MessageOptions + FieldOptions + OneofOptions + EnumOptions + EnumValueOptions + ServiceOptions + MethodOptions + UninterpretedOption + SourceCodeInfo + GeneratedCodeInfo +*/ +package descriptor + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type FieldDescriptorProto_Type int32 + +const ( + // 0 is reserved for errors. + // Order is weird for historical reasons. + FieldDescriptorProto_TYPE_DOUBLE FieldDescriptorProto_Type = 1 + FieldDescriptorProto_TYPE_FLOAT FieldDescriptorProto_Type = 2 + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + // negative values are likely. + FieldDescriptorProto_TYPE_INT64 FieldDescriptorProto_Type = 3 + FieldDescriptorProto_TYPE_UINT64 FieldDescriptorProto_Type = 4 + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + // negative values are likely. + FieldDescriptorProto_TYPE_INT32 FieldDescriptorProto_Type = 5 + FieldDescriptorProto_TYPE_FIXED64 FieldDescriptorProto_Type = 6 + FieldDescriptorProto_TYPE_FIXED32 FieldDescriptorProto_Type = 7 + FieldDescriptorProto_TYPE_BOOL FieldDescriptorProto_Type = 8 + FieldDescriptorProto_TYPE_STRING FieldDescriptorProto_Type = 9 + FieldDescriptorProto_TYPE_GROUP FieldDescriptorProto_Type = 10 + FieldDescriptorProto_TYPE_MESSAGE FieldDescriptorProto_Type = 11 + // New in version 2. + FieldDescriptorProto_TYPE_BYTES FieldDescriptorProto_Type = 12 + FieldDescriptorProto_TYPE_UINT32 FieldDescriptorProto_Type = 13 + FieldDescriptorProto_TYPE_ENUM FieldDescriptorProto_Type = 14 + FieldDescriptorProto_TYPE_SFIXED32 FieldDescriptorProto_Type = 15 + FieldDescriptorProto_TYPE_SFIXED64 FieldDescriptorProto_Type = 16 + FieldDescriptorProto_TYPE_SINT32 FieldDescriptorProto_Type = 17 + FieldDescriptorProto_TYPE_SINT64 FieldDescriptorProto_Type = 18 +) + +var FieldDescriptorProto_Type_name = map[int32]string{ + 1: "TYPE_DOUBLE", + 2: "TYPE_FLOAT", + 3: "TYPE_INT64", + 4: "TYPE_UINT64", + 5: "TYPE_INT32", + 6: "TYPE_FIXED64", + 7: "TYPE_FIXED32", + 8: "TYPE_BOOL", + 9: "TYPE_STRING", + 10: "TYPE_GROUP", + 11: "TYPE_MESSAGE", + 12: "TYPE_BYTES", + 13: "TYPE_UINT32", + 14: "TYPE_ENUM", + 15: "TYPE_SFIXED32", + 16: "TYPE_SFIXED64", + 17: "TYPE_SINT32", + 18: "TYPE_SINT64", +} +var FieldDescriptorProto_Type_value = map[string]int32{ + "TYPE_DOUBLE": 1, + "TYPE_FLOAT": 2, + "TYPE_INT64": 3, + "TYPE_UINT64": 4, + "TYPE_INT32": 5, + "TYPE_FIXED64": 6, + "TYPE_FIXED32": 7, + "TYPE_BOOL": 8, + "TYPE_STRING": 9, + "TYPE_GROUP": 10, + "TYPE_MESSAGE": 11, + "TYPE_BYTES": 12, + "TYPE_UINT32": 13, + "TYPE_ENUM": 14, + "TYPE_SFIXED32": 15, + "TYPE_SFIXED64": 16, + "TYPE_SINT32": 17, + "TYPE_SINT64": 18, +} + +func (x FieldDescriptorProto_Type) Enum() *FieldDescriptorProto_Type { + p := new(FieldDescriptorProto_Type) + *p = x + return p +} +func (x FieldDescriptorProto_Type) String() string { + return proto.EnumName(FieldDescriptorProto_Type_name, int32(x)) +} +func (x *FieldDescriptorProto_Type) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FieldDescriptorProto_Type_value, data, "FieldDescriptorProto_Type") + if err != nil { + return err + } + *x = FieldDescriptorProto_Type(value) + return nil +} +func (FieldDescriptorProto_Type) EnumDescriptor() ([]byte, []int) { + return fileDescriptorDescriptor, []int{3, 0} +} + +type FieldDescriptorProto_Label int32 + +const ( + // 0 is reserved for errors + FieldDescriptorProto_LABEL_OPTIONAL FieldDescriptorProto_Label = 1 + FieldDescriptorProto_LABEL_REQUIRED FieldDescriptorProto_Label = 2 + FieldDescriptorProto_LABEL_REPEATED FieldDescriptorProto_Label = 3 +) + +var FieldDescriptorProto_Label_name = map[int32]string{ + 1: "LABEL_OPTIONAL", + 2: "LABEL_REQUIRED", + 3: "LABEL_REPEATED", +} +var FieldDescriptorProto_Label_value = map[string]int32{ + "LABEL_OPTIONAL": 1, + "LABEL_REQUIRED": 2, + "LABEL_REPEATED": 3, +} + +func (x FieldDescriptorProto_Label) Enum() *FieldDescriptorProto_Label { + p := new(FieldDescriptorProto_Label) + *p = x + return p +} +func (x FieldDescriptorProto_Label) String() string { + return proto.EnumName(FieldDescriptorProto_Label_name, int32(x)) +} +func (x *FieldDescriptorProto_Label) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FieldDescriptorProto_Label_value, data, "FieldDescriptorProto_Label") + if err != nil { + return err + } + *x = FieldDescriptorProto_Label(value) + return nil +} +func (FieldDescriptorProto_Label) EnumDescriptor() ([]byte, []int) { + return fileDescriptorDescriptor, []int{3, 1} +} + +// Generated classes can be optimized for speed or code size. +type FileOptions_OptimizeMode int32 + +const ( + FileOptions_SPEED FileOptions_OptimizeMode = 1 + // etc. + FileOptions_CODE_SIZE FileOptions_OptimizeMode = 2 + FileOptions_LITE_RUNTIME FileOptions_OptimizeMode = 3 +) + +var FileOptions_OptimizeMode_name = map[int32]string{ + 1: "SPEED", + 2: "CODE_SIZE", + 3: "LITE_RUNTIME", +} +var FileOptions_OptimizeMode_value = map[string]int32{ + "SPEED": 1, + "CODE_SIZE": 2, + "LITE_RUNTIME": 3, +} + +func (x FileOptions_OptimizeMode) Enum() *FileOptions_OptimizeMode { + p := new(FileOptions_OptimizeMode) + *p = x + return p +} +func (x FileOptions_OptimizeMode) String() string { + return proto.EnumName(FileOptions_OptimizeMode_name, int32(x)) +} +func (x *FileOptions_OptimizeMode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FileOptions_OptimizeMode_value, data, "FileOptions_OptimizeMode") + if err != nil { + return err + } + *x = FileOptions_OptimizeMode(value) + return nil +} +func (FileOptions_OptimizeMode) EnumDescriptor() ([]byte, []int) { + return fileDescriptorDescriptor, []int{9, 0} +} + +type FieldOptions_CType int32 + +const ( + // Default mode. + FieldOptions_STRING FieldOptions_CType = 0 + FieldOptions_CORD FieldOptions_CType = 1 + FieldOptions_STRING_PIECE FieldOptions_CType = 2 +) + +var FieldOptions_CType_name = map[int32]string{ + 0: "STRING", + 1: "CORD", + 2: "STRING_PIECE", +} +var FieldOptions_CType_value = map[string]int32{ + "STRING": 0, + "CORD": 1, + "STRING_PIECE": 2, +} + +func (x FieldOptions_CType) Enum() *FieldOptions_CType { + p := new(FieldOptions_CType) + *p = x + return p +} +func (x FieldOptions_CType) String() string { + return proto.EnumName(FieldOptions_CType_name, int32(x)) +} +func (x *FieldOptions_CType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FieldOptions_CType_value, data, "FieldOptions_CType") + if err != nil { + return err + } + *x = FieldOptions_CType(value) + return nil +} +func (FieldOptions_CType) EnumDescriptor() ([]byte, []int) { + return fileDescriptorDescriptor, []int{11, 0} +} + +type FieldOptions_JSType int32 + +const ( + // Use the default type. + FieldOptions_JS_NORMAL FieldOptions_JSType = 0 + // Use JavaScript strings. + FieldOptions_JS_STRING FieldOptions_JSType = 1 + // Use JavaScript numbers. + FieldOptions_JS_NUMBER FieldOptions_JSType = 2 +) + +var FieldOptions_JSType_name = map[int32]string{ + 0: "JS_NORMAL", + 1: "JS_STRING", + 2: "JS_NUMBER", +} +var FieldOptions_JSType_value = map[string]int32{ + "JS_NORMAL": 0, + "JS_STRING": 1, + "JS_NUMBER": 2, +} + +func (x FieldOptions_JSType) Enum() *FieldOptions_JSType { + p := new(FieldOptions_JSType) + *p = x + return p +} +func (x FieldOptions_JSType) String() string { + return proto.EnumName(FieldOptions_JSType_name, int32(x)) +} +func (x *FieldOptions_JSType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FieldOptions_JSType_value, data, "FieldOptions_JSType") + if err != nil { + return err + } + *x = FieldOptions_JSType(value) + return nil +} +func (FieldOptions_JSType) EnumDescriptor() ([]byte, []int) { + return fileDescriptorDescriptor, []int{11, 1} +} + +// The protocol compiler can output a FileDescriptorSet containing the .proto +// files it parses. +type FileDescriptorSet struct { + File []*FileDescriptorProto `protobuf:"bytes,1,rep,name=file" json:"file,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *FileDescriptorSet) Reset() { *m = FileDescriptorSet{} } +func (m *FileDescriptorSet) String() string { return proto.CompactTextString(m) } +func (*FileDescriptorSet) ProtoMessage() {} +func (*FileDescriptorSet) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{0} } + +func (m *FileDescriptorSet) GetFile() []*FileDescriptorProto { + if m != nil { + return m.File + } + return nil +} + +// Describes a complete .proto file. +type FileDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Package *string `protobuf:"bytes,2,opt,name=package" json:"package,omitempty"` + // Names of files imported by this file. + Dependency []string `protobuf:"bytes,3,rep,name=dependency" json:"dependency,omitempty"` + // Indexes of the public imported files in the dependency list above. + PublicDependency []int32 `protobuf:"varint,10,rep,name=public_dependency,json=publicDependency" json:"public_dependency,omitempty"` + // Indexes of the weak imported files in the dependency list. + // For Google-internal migration only. Do not use. + WeakDependency []int32 `protobuf:"varint,11,rep,name=weak_dependency,json=weakDependency" json:"weak_dependency,omitempty"` + // All top-level definitions in this file. + MessageType []*DescriptorProto `protobuf:"bytes,4,rep,name=message_type,json=messageType" json:"message_type,omitempty"` + EnumType []*EnumDescriptorProto `protobuf:"bytes,5,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` + Service []*ServiceDescriptorProto `protobuf:"bytes,6,rep,name=service" json:"service,omitempty"` + Extension []*FieldDescriptorProto `protobuf:"bytes,7,rep,name=extension" json:"extension,omitempty"` + Options *FileOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` + // This field contains optional information about the original source code. + // You may safely remove this entire field without harming runtime + // functionality of the descriptors -- the information is needed only by + // development tools. + SourceCodeInfo *SourceCodeInfo `protobuf:"bytes,9,opt,name=source_code_info,json=sourceCodeInfo" json:"source_code_info,omitempty"` + // The syntax of the proto file. + // The supported values are "proto2" and "proto3". + Syntax *string `protobuf:"bytes,12,opt,name=syntax" json:"syntax,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *FileDescriptorProto) Reset() { *m = FileDescriptorProto{} } +func (m *FileDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*FileDescriptorProto) ProtoMessage() {} +func (*FileDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{1} } + +func (m *FileDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *FileDescriptorProto) GetPackage() string { + if m != nil && m.Package != nil { + return *m.Package + } + return "" +} + +func (m *FileDescriptorProto) GetDependency() []string { + if m != nil { + return m.Dependency + } + return nil +} + +func (m *FileDescriptorProto) GetPublicDependency() []int32 { + if m != nil { + return m.PublicDependency + } + return nil +} + +func (m *FileDescriptorProto) GetWeakDependency() []int32 { + if m != nil { + return m.WeakDependency + } + return nil +} + +func (m *FileDescriptorProto) GetMessageType() []*DescriptorProto { + if m != nil { + return m.MessageType + } + return nil +} + +func (m *FileDescriptorProto) GetEnumType() []*EnumDescriptorProto { + if m != nil { + return m.EnumType + } + return nil +} + +func (m *FileDescriptorProto) GetService() []*ServiceDescriptorProto { + if m != nil { + return m.Service + } + return nil +} + +func (m *FileDescriptorProto) GetExtension() []*FieldDescriptorProto { + if m != nil { + return m.Extension + } + return nil +} + +func (m *FileDescriptorProto) GetOptions() *FileOptions { + if m != nil { + return m.Options + } + return nil +} + +func (m *FileDescriptorProto) GetSourceCodeInfo() *SourceCodeInfo { + if m != nil { + return m.SourceCodeInfo + } + return nil +} + +func (m *FileDescriptorProto) GetSyntax() string { + if m != nil && m.Syntax != nil { + return *m.Syntax + } + return "" +} + +// Describes a message type. +type DescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Field []*FieldDescriptorProto `protobuf:"bytes,2,rep,name=field" json:"field,omitempty"` + Extension []*FieldDescriptorProto `protobuf:"bytes,6,rep,name=extension" json:"extension,omitempty"` + NestedType []*DescriptorProto `protobuf:"bytes,3,rep,name=nested_type,json=nestedType" json:"nested_type,omitempty"` + EnumType []*EnumDescriptorProto `protobuf:"bytes,4,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` + ExtensionRange []*DescriptorProto_ExtensionRange `protobuf:"bytes,5,rep,name=extension_range,json=extensionRange" json:"extension_range,omitempty"` + OneofDecl []*OneofDescriptorProto `protobuf:"bytes,8,rep,name=oneof_decl,json=oneofDecl" json:"oneof_decl,omitempty"` + Options *MessageOptions `protobuf:"bytes,7,opt,name=options" json:"options,omitempty"` + ReservedRange []*DescriptorProto_ReservedRange `protobuf:"bytes,9,rep,name=reserved_range,json=reservedRange" json:"reserved_range,omitempty"` + // Reserved field names, which may not be used by fields in the same message. + // A given name may only be reserved once. + ReservedName []string `protobuf:"bytes,10,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *DescriptorProto) Reset() { *m = DescriptorProto{} } +func (m *DescriptorProto) String() string { return proto.CompactTextString(m) } +func (*DescriptorProto) ProtoMessage() {} +func (*DescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{2} } + +func (m *DescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *DescriptorProto) GetField() []*FieldDescriptorProto { + if m != nil { + return m.Field + } + return nil +} + +func (m *DescriptorProto) GetExtension() []*FieldDescriptorProto { + if m != nil { + return m.Extension + } + return nil +} + +func (m *DescriptorProto) GetNestedType() []*DescriptorProto { + if m != nil { + return m.NestedType + } + return nil +} + +func (m *DescriptorProto) GetEnumType() []*EnumDescriptorProto { + if m != nil { + return m.EnumType + } + return nil +} + +func (m *DescriptorProto) GetExtensionRange() []*DescriptorProto_ExtensionRange { + if m != nil { + return m.ExtensionRange + } + return nil +} + +func (m *DescriptorProto) GetOneofDecl() []*OneofDescriptorProto { + if m != nil { + return m.OneofDecl + } + return nil +} + +func (m *DescriptorProto) GetOptions() *MessageOptions { + if m != nil { + return m.Options + } + return nil +} + +func (m *DescriptorProto) GetReservedRange() []*DescriptorProto_ReservedRange { + if m != nil { + return m.ReservedRange + } + return nil +} + +func (m *DescriptorProto) GetReservedName() []string { + if m != nil { + return m.ReservedName + } + return nil +} + +type DescriptorProto_ExtensionRange struct { + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *DescriptorProto_ExtensionRange) Reset() { *m = DescriptorProto_ExtensionRange{} } +func (m *DescriptorProto_ExtensionRange) String() string { return proto.CompactTextString(m) } +func (*DescriptorProto_ExtensionRange) ProtoMessage() {} +func (*DescriptorProto_ExtensionRange) Descriptor() ([]byte, []int) { + return fileDescriptorDescriptor, []int{2, 0} +} + +func (m *DescriptorProto_ExtensionRange) GetStart() int32 { + if m != nil && m.Start != nil { + return *m.Start + } + return 0 +} + +func (m *DescriptorProto_ExtensionRange) GetEnd() int32 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + +// Range of reserved tag numbers. Reserved tag numbers may not be used by +// fields or extension ranges in the same message. Reserved ranges may +// not overlap. +type DescriptorProto_ReservedRange struct { + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *DescriptorProto_ReservedRange) Reset() { *m = DescriptorProto_ReservedRange{} } +func (m *DescriptorProto_ReservedRange) String() string { return proto.CompactTextString(m) } +func (*DescriptorProto_ReservedRange) ProtoMessage() {} +func (*DescriptorProto_ReservedRange) Descriptor() ([]byte, []int) { + return fileDescriptorDescriptor, []int{2, 1} +} + +func (m *DescriptorProto_ReservedRange) GetStart() int32 { + if m != nil && m.Start != nil { + return *m.Start + } + return 0 +} + +func (m *DescriptorProto_ReservedRange) GetEnd() int32 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + +// Describes a field within a message. +type FieldDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Number *int32 `protobuf:"varint,3,opt,name=number" json:"number,omitempty"` + Label *FieldDescriptorProto_Label `protobuf:"varint,4,opt,name=label,enum=google.protobuf.FieldDescriptorProto_Label" json:"label,omitempty"` + // If type_name is set, this need not be set. If both this and type_name + // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + Type *FieldDescriptorProto_Type `protobuf:"varint,5,opt,name=type,enum=google.protobuf.FieldDescriptorProto_Type" json:"type,omitempty"` + // For message and enum types, this is the name of the type. If the name + // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + // rules are used to find the type (i.e. first the nested types within this + // message are searched, then within the parent, on up to the root + // namespace). + TypeName *string `protobuf:"bytes,6,opt,name=type_name,json=typeName" json:"type_name,omitempty"` + // For extensions, this is the name of the type being extended. It is + // resolved in the same manner as type_name. + Extendee *string `protobuf:"bytes,2,opt,name=extendee" json:"extendee,omitempty"` + // For numeric types, contains the original text representation of the value. + // For booleans, "true" or "false". + // For strings, contains the default text contents (not escaped in any way). + // For bytes, contains the C escaped value. All bytes >= 128 are escaped. + // TODO(kenton): Base-64 encode? + DefaultValue *string `protobuf:"bytes,7,opt,name=default_value,json=defaultValue" json:"default_value,omitempty"` + // If set, gives the index of a oneof in the containing type's oneof_decl + // list. This field is a member of that oneof. + OneofIndex *int32 `protobuf:"varint,9,opt,name=oneof_index,json=oneofIndex" json:"oneof_index,omitempty"` + // JSON name of this field. The value is set by protocol compiler. If the + // user has set a "json_name" option on this field, that option's value + // will be used. Otherwise, it's deduced from the field's name by converting + // it to camelCase. + JsonName *string `protobuf:"bytes,10,opt,name=json_name,json=jsonName" json:"json_name,omitempty"` + Options *FieldOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *FieldDescriptorProto) Reset() { *m = FieldDescriptorProto{} } +func (m *FieldDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*FieldDescriptorProto) ProtoMessage() {} +func (*FieldDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{3} } + +func (m *FieldDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *FieldDescriptorProto) GetNumber() int32 { + if m != nil && m.Number != nil { + return *m.Number + } + return 0 +} + +func (m *FieldDescriptorProto) GetLabel() FieldDescriptorProto_Label { + if m != nil && m.Label != nil { + return *m.Label + } + return FieldDescriptorProto_LABEL_OPTIONAL +} + +func (m *FieldDescriptorProto) GetType() FieldDescriptorProto_Type { + if m != nil && m.Type != nil { + return *m.Type + } + return FieldDescriptorProto_TYPE_DOUBLE +} + +func (m *FieldDescriptorProto) GetTypeName() string { + if m != nil && m.TypeName != nil { + return *m.TypeName + } + return "" +} + +func (m *FieldDescriptorProto) GetExtendee() string { + if m != nil && m.Extendee != nil { + return *m.Extendee + } + return "" +} + +func (m *FieldDescriptorProto) GetDefaultValue() string { + if m != nil && m.DefaultValue != nil { + return *m.DefaultValue + } + return "" +} + +func (m *FieldDescriptorProto) GetOneofIndex() int32 { + if m != nil && m.OneofIndex != nil { + return *m.OneofIndex + } + return 0 +} + +func (m *FieldDescriptorProto) GetJsonName() string { + if m != nil && m.JsonName != nil { + return *m.JsonName + } + return "" +} + +func (m *FieldDescriptorProto) GetOptions() *FieldOptions { + if m != nil { + return m.Options + } + return nil +} + +// Describes a oneof. +type OneofDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Options *OneofOptions `protobuf:"bytes,2,opt,name=options" json:"options,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *OneofDescriptorProto) Reset() { *m = OneofDescriptorProto{} } +func (m *OneofDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*OneofDescriptorProto) ProtoMessage() {} +func (*OneofDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{4} } + +func (m *OneofDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *OneofDescriptorProto) GetOptions() *OneofOptions { + if m != nil { + return m.Options + } + return nil +} + +// Describes an enum type. +type EnumDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Value []*EnumValueDescriptorProto `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"` + Options *EnumOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *EnumDescriptorProto) Reset() { *m = EnumDescriptorProto{} } +func (m *EnumDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*EnumDescriptorProto) ProtoMessage() {} +func (*EnumDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{5} } + +func (m *EnumDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *EnumDescriptorProto) GetValue() []*EnumValueDescriptorProto { + if m != nil { + return m.Value + } + return nil +} + +func (m *EnumDescriptorProto) GetOptions() *EnumOptions { + if m != nil { + return m.Options + } + return nil +} + +// Describes a value within an enum. +type EnumValueDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Number *int32 `protobuf:"varint,2,opt,name=number" json:"number,omitempty"` + Options *EnumValueOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *EnumValueDescriptorProto) Reset() { *m = EnumValueDescriptorProto{} } +func (m *EnumValueDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*EnumValueDescriptorProto) ProtoMessage() {} +func (*EnumValueDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptorDescriptor, []int{6} +} + +func (m *EnumValueDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *EnumValueDescriptorProto) GetNumber() int32 { + if m != nil && m.Number != nil { + return *m.Number + } + return 0 +} + +func (m *EnumValueDescriptorProto) GetOptions() *EnumValueOptions { + if m != nil { + return m.Options + } + return nil +} + +// Describes a service. +type ServiceDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Method []*MethodDescriptorProto `protobuf:"bytes,2,rep,name=method" json:"method,omitempty"` + Options *ServiceOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *ServiceDescriptorProto) Reset() { *m = ServiceDescriptorProto{} } +func (m *ServiceDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*ServiceDescriptorProto) ProtoMessage() {} +func (*ServiceDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{7} } + +func (m *ServiceDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *ServiceDescriptorProto) GetMethod() []*MethodDescriptorProto { + if m != nil { + return m.Method + } + return nil +} + +func (m *ServiceDescriptorProto) GetOptions() *ServiceOptions { + if m != nil { + return m.Options + } + return nil +} + +// Describes a method of a service. +type MethodDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // Input and output type names. These are resolved in the same way as + // FieldDescriptorProto.type_name, but must refer to a message type. + InputType *string `protobuf:"bytes,2,opt,name=input_type,json=inputType" json:"input_type,omitempty"` + OutputType *string `protobuf:"bytes,3,opt,name=output_type,json=outputType" json:"output_type,omitempty"` + Options *MethodOptions `protobuf:"bytes,4,opt,name=options" json:"options,omitempty"` + // Identifies if client streams multiple client messages + ClientStreaming *bool `protobuf:"varint,5,opt,name=client_streaming,json=clientStreaming,def=0" json:"client_streaming,omitempty"` + // Identifies if server streams multiple server messages + ServerStreaming *bool `protobuf:"varint,6,opt,name=server_streaming,json=serverStreaming,def=0" json:"server_streaming,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *MethodDescriptorProto) Reset() { *m = MethodDescriptorProto{} } +func (m *MethodDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*MethodDescriptorProto) ProtoMessage() {} +func (*MethodDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{8} } + +const Default_MethodDescriptorProto_ClientStreaming bool = false +const Default_MethodDescriptorProto_ServerStreaming bool = false + +func (m *MethodDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *MethodDescriptorProto) GetInputType() string { + if m != nil && m.InputType != nil { + return *m.InputType + } + return "" +} + +func (m *MethodDescriptorProto) GetOutputType() string { + if m != nil && m.OutputType != nil { + return *m.OutputType + } + return "" +} + +func (m *MethodDescriptorProto) GetOptions() *MethodOptions { + if m != nil { + return m.Options + } + return nil +} + +func (m *MethodDescriptorProto) GetClientStreaming() bool { + if m != nil && m.ClientStreaming != nil { + return *m.ClientStreaming + } + return Default_MethodDescriptorProto_ClientStreaming +} + +func (m *MethodDescriptorProto) GetServerStreaming() bool { + if m != nil && m.ServerStreaming != nil { + return *m.ServerStreaming + } + return Default_MethodDescriptorProto_ServerStreaming +} + +type FileOptions struct { + // Sets the Java package where classes generated from this .proto will be + // placed. By default, the proto package is used, but this is often + // inappropriate because proto packages do not normally start with backwards + // domain names. + JavaPackage *string `protobuf:"bytes,1,opt,name=java_package,json=javaPackage" json:"java_package,omitempty"` + // If set, all the classes from the .proto file are wrapped in a single + // outer class with the given name. This applies to both Proto1 + // (equivalent to the old "--one_java_file" option) and Proto2 (where + // a .proto always translates to a single class, but you may want to + // explicitly choose the class name). + JavaOuterClassname *string `protobuf:"bytes,8,opt,name=java_outer_classname,json=javaOuterClassname" json:"java_outer_classname,omitempty"` + // If set true, then the Java code generator will generate a separate .java + // file for each top-level message, enum, and service defined in the .proto + // file. Thus, these types will *not* be nested inside the outer class + // named by java_outer_classname. However, the outer class will still be + // generated to contain the file's getDescriptor() method as well as any + // top-level extensions defined in the file. + JavaMultipleFiles *bool `protobuf:"varint,10,opt,name=java_multiple_files,json=javaMultipleFiles,def=0" json:"java_multiple_files,omitempty"` + // If set true, then the Java code generator will generate equals() and + // hashCode() methods for all messages defined in the .proto file. + // This increases generated code size, potentially substantially for large + // protos, which may harm a memory-constrained application. + // - In the full runtime this is a speed optimization, as the + // AbstractMessage base class includes reflection-based implementations of + // these methods. + // - In the lite runtime, setting this option changes the semantics of + // equals() and hashCode() to more closely match those of the full runtime; + // the generated methods compute their results based on field values rather + // than object identity. (Implementations should not assume that hashcodes + // will be consistent across runtimes or versions of the protocol compiler.) + JavaGenerateEqualsAndHash *bool `protobuf:"varint,20,opt,name=java_generate_equals_and_hash,json=javaGenerateEqualsAndHash,def=0" json:"java_generate_equals_and_hash,omitempty"` + // If set true, then the Java2 code generator will generate code that + // throws an exception whenever an attempt is made to assign a non-UTF-8 + // byte sequence to a string field. + // Message reflection will do the same. + // However, an extension field still accepts non-UTF-8 byte sequences. + // This option has no effect on when used with the lite runtime. + JavaStringCheckUtf8 *bool `protobuf:"varint,27,opt,name=java_string_check_utf8,json=javaStringCheckUtf8,def=0" json:"java_string_check_utf8,omitempty"` + OptimizeFor *FileOptions_OptimizeMode `protobuf:"varint,9,opt,name=optimize_for,json=optimizeFor,enum=google.protobuf.FileOptions_OptimizeMode,def=1" json:"optimize_for,omitempty"` + // Sets the Go package where structs generated from this .proto will be + // placed. If omitted, the Go package will be derived from the following: + // - The basename of the package import path, if provided. + // - Otherwise, the package statement in the .proto file, if present. + // - Otherwise, the basename of the .proto file, without extension. + GoPackage *string `protobuf:"bytes,11,opt,name=go_package,json=goPackage" json:"go_package,omitempty"` + // Should generic services be generated in each language? "Generic" services + // are not specific to any particular RPC system. They are generated by the + // main code generators in each language (without additional plugins). + // Generic services were the only kind of service generation supported by + // early versions of google.protobuf. + // + // Generic services are now considered deprecated in favor of using plugins + // that generate code specific to your particular RPC system. Therefore, + // these default to false. Old code which depends on generic services should + // explicitly set them to true. + CcGenericServices *bool `protobuf:"varint,16,opt,name=cc_generic_services,json=ccGenericServices,def=0" json:"cc_generic_services,omitempty"` + JavaGenericServices *bool `protobuf:"varint,17,opt,name=java_generic_services,json=javaGenericServices,def=0" json:"java_generic_services,omitempty"` + PyGenericServices *bool `protobuf:"varint,18,opt,name=py_generic_services,json=pyGenericServices,def=0" json:"py_generic_services,omitempty"` + // Is this file deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for everything in the file, or it will be completely ignored; in the very + // least, this is a formalization for deprecating files. + Deprecated *bool `protobuf:"varint,23,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // Enables the use of arenas for the proto messages in this file. This applies + // only to generated classes for C++. + CcEnableArenas *bool `protobuf:"varint,31,opt,name=cc_enable_arenas,json=ccEnableArenas,def=0" json:"cc_enable_arenas,omitempty"` + // Sets the objective c class prefix which is prepended to all objective c + // generated classes from this .proto. There is no default. + ObjcClassPrefix *string `protobuf:"bytes,36,opt,name=objc_class_prefix,json=objcClassPrefix" json:"objc_class_prefix,omitempty"` + // Namespace for generated classes; defaults to the package. + CsharpNamespace *string `protobuf:"bytes,37,opt,name=csharp_namespace,json=csharpNamespace" json:"csharp_namespace,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *FileOptions) Reset() { *m = FileOptions{} } +func (m *FileOptions) String() string { return proto.CompactTextString(m) } +func (*FileOptions) ProtoMessage() {} +func (*FileOptions) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{9} } + +var extRange_FileOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*FileOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_FileOptions +} + +const Default_FileOptions_JavaMultipleFiles bool = false +const Default_FileOptions_JavaGenerateEqualsAndHash bool = false +const Default_FileOptions_JavaStringCheckUtf8 bool = false +const Default_FileOptions_OptimizeFor FileOptions_OptimizeMode = FileOptions_SPEED +const Default_FileOptions_CcGenericServices bool = false +const Default_FileOptions_JavaGenericServices bool = false +const Default_FileOptions_PyGenericServices bool = false +const Default_FileOptions_Deprecated bool = false +const Default_FileOptions_CcEnableArenas bool = false + +func (m *FileOptions) GetJavaPackage() string { + if m != nil && m.JavaPackage != nil { + return *m.JavaPackage + } + return "" +} + +func (m *FileOptions) GetJavaOuterClassname() string { + if m != nil && m.JavaOuterClassname != nil { + return *m.JavaOuterClassname + } + return "" +} + +func (m *FileOptions) GetJavaMultipleFiles() bool { + if m != nil && m.JavaMultipleFiles != nil { + return *m.JavaMultipleFiles + } + return Default_FileOptions_JavaMultipleFiles +} + +func (m *FileOptions) GetJavaGenerateEqualsAndHash() bool { + if m != nil && m.JavaGenerateEqualsAndHash != nil { + return *m.JavaGenerateEqualsAndHash + } + return Default_FileOptions_JavaGenerateEqualsAndHash +} + +func (m *FileOptions) GetJavaStringCheckUtf8() bool { + if m != nil && m.JavaStringCheckUtf8 != nil { + return *m.JavaStringCheckUtf8 + } + return Default_FileOptions_JavaStringCheckUtf8 +} + +func (m *FileOptions) GetOptimizeFor() FileOptions_OptimizeMode { + if m != nil && m.OptimizeFor != nil { + return *m.OptimizeFor + } + return Default_FileOptions_OptimizeFor +} + +func (m *FileOptions) GetGoPackage() string { + if m != nil && m.GoPackage != nil { + return *m.GoPackage + } + return "" +} + +func (m *FileOptions) GetCcGenericServices() bool { + if m != nil && m.CcGenericServices != nil { + return *m.CcGenericServices + } + return Default_FileOptions_CcGenericServices +} + +func (m *FileOptions) GetJavaGenericServices() bool { + if m != nil && m.JavaGenericServices != nil { + return *m.JavaGenericServices + } + return Default_FileOptions_JavaGenericServices +} + +func (m *FileOptions) GetPyGenericServices() bool { + if m != nil && m.PyGenericServices != nil { + return *m.PyGenericServices + } + return Default_FileOptions_PyGenericServices +} + +func (m *FileOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_FileOptions_Deprecated +} + +func (m *FileOptions) GetCcEnableArenas() bool { + if m != nil && m.CcEnableArenas != nil { + return *m.CcEnableArenas + } + return Default_FileOptions_CcEnableArenas +} + +func (m *FileOptions) GetObjcClassPrefix() string { + if m != nil && m.ObjcClassPrefix != nil { + return *m.ObjcClassPrefix + } + return "" +} + +func (m *FileOptions) GetCsharpNamespace() string { + if m != nil && m.CsharpNamespace != nil { + return *m.CsharpNamespace + } + return "" +} + +func (m *FileOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type MessageOptions struct { + // Set true to use the old proto1 MessageSet wire format for extensions. + // This is provided for backwards-compatibility with the MessageSet wire + // format. You should not use this for any other reason: It's less + // efficient, has fewer features, and is more complicated. + // + // The message must be defined exactly as follows: + // message Foo { + // option message_set_wire_format = true; + // extensions 4 to max; + // } + // Note that the message cannot have any defined fields; MessageSets only + // have extensions. + // + // All extensions of your type must be singular messages; e.g. they cannot + // be int32s, enums, or repeated messages. + // + // Because this is an option, the above two restrictions are not enforced by + // the protocol compiler. + MessageSetWireFormat *bool `protobuf:"varint,1,opt,name=message_set_wire_format,json=messageSetWireFormat,def=0" json:"message_set_wire_format,omitempty"` + // Disables the generation of the standard "descriptor()" accessor, which can + // conflict with a field of the same name. This is meant to make migration + // from proto1 easier; new code should avoid fields named "descriptor". + NoStandardDescriptorAccessor *bool `protobuf:"varint,2,opt,name=no_standard_descriptor_accessor,json=noStandardDescriptorAccessor,def=0" json:"no_standard_descriptor_accessor,omitempty"` + // Is this message deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the message, or it will be completely ignored; in the very least, + // this is a formalization for deprecating messages. + Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // Whether the message is an automatically generated map entry type for the + // maps field. + // + // For maps fields: + // map map_field = 1; + // The parsed descriptor looks like: + // message MapFieldEntry { + // option map_entry = true; + // optional KeyType key = 1; + // optional ValueType value = 2; + // } + // repeated MapFieldEntry map_field = 1; + // + // Implementations may choose not to generate the map_entry=true message, but + // use a native map in the target language to hold the keys and values. + // The reflection APIs in such implementions still need to work as + // if the field is a repeated message field. + // + // NOTE: Do not set the option in .proto files. Always use the maps syntax + // instead. The option should only be implicitly set by the proto compiler + // parser. + MapEntry *bool `protobuf:"varint,7,opt,name=map_entry,json=mapEntry" json:"map_entry,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *MessageOptions) Reset() { *m = MessageOptions{} } +func (m *MessageOptions) String() string { return proto.CompactTextString(m) } +func (*MessageOptions) ProtoMessage() {} +func (*MessageOptions) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{10} } + +var extRange_MessageOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*MessageOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_MessageOptions +} + +const Default_MessageOptions_MessageSetWireFormat bool = false +const Default_MessageOptions_NoStandardDescriptorAccessor bool = false +const Default_MessageOptions_Deprecated bool = false + +func (m *MessageOptions) GetMessageSetWireFormat() bool { + if m != nil && m.MessageSetWireFormat != nil { + return *m.MessageSetWireFormat + } + return Default_MessageOptions_MessageSetWireFormat +} + +func (m *MessageOptions) GetNoStandardDescriptorAccessor() bool { + if m != nil && m.NoStandardDescriptorAccessor != nil { + return *m.NoStandardDescriptorAccessor + } + return Default_MessageOptions_NoStandardDescriptorAccessor +} + +func (m *MessageOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_MessageOptions_Deprecated +} + +func (m *MessageOptions) GetMapEntry() bool { + if m != nil && m.MapEntry != nil { + return *m.MapEntry + } + return false +} + +func (m *MessageOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type FieldOptions struct { + // The ctype option instructs the C++ code generator to use a different + // representation of the field than it normally would. See the specific + // options below. This option is not yet implemented in the open source + // release -- sorry, we'll try to include it in a future version! + Ctype *FieldOptions_CType `protobuf:"varint,1,opt,name=ctype,enum=google.protobuf.FieldOptions_CType,def=0" json:"ctype,omitempty"` + // The packed option can be enabled for repeated primitive fields to enable + // a more efficient representation on the wire. Rather than repeatedly + // writing the tag and type for each element, the entire array is encoded as + // a single length-delimited blob. In proto3, only explicit setting it to + // false will avoid using packed encoding. + Packed *bool `protobuf:"varint,2,opt,name=packed" json:"packed,omitempty"` + // The jstype option determines the JavaScript type used for values of the + // field. The option is permitted only for 64 bit integral and fixed types + // (int64, uint64, sint64, fixed64, sfixed64). By default these types are + // represented as JavaScript strings. This avoids loss of precision that can + // happen when a large value is converted to a floating point JavaScript + // numbers. Specifying JS_NUMBER for the jstype causes the generated + // JavaScript code to use the JavaScript "number" type instead of strings. + // This option is an enum to permit additional types to be added, + // e.g. goog.math.Integer. + Jstype *FieldOptions_JSType `protobuf:"varint,6,opt,name=jstype,enum=google.protobuf.FieldOptions_JSType,def=0" json:"jstype,omitempty"` + // Should this field be parsed lazily? Lazy applies only to message-type + // fields. It means that when the outer message is initially parsed, the + // inner message's contents will not be parsed but instead stored in encoded + // form. The inner message will actually be parsed when it is first accessed. + // + // This is only a hint. Implementations are free to choose whether to use + // eager or lazy parsing regardless of the value of this option. However, + // setting this option true suggests that the protocol author believes that + // using lazy parsing on this field is worth the additional bookkeeping + // overhead typically needed to implement it. + // + // This option does not affect the public interface of any generated code; + // all method signatures remain the same. Furthermore, thread-safety of the + // interface is not affected by this option; const methods remain safe to + // call from multiple threads concurrently, while non-const methods continue + // to require exclusive access. + // + // + // Note that implementations may choose not to check required fields within + // a lazy sub-message. That is, calling IsInitialized() on the outher message + // may return true even if the inner message has missing required fields. + // This is necessary because otherwise the inner message would have to be + // parsed in order to perform the check, defeating the purpose of lazy + // parsing. An implementation which chooses not to check required fields + // must be consistent about it. That is, for any particular sub-message, the + // implementation must either *always* check its required fields, or *never* + // check its required fields, regardless of whether or not the message has + // been parsed. + Lazy *bool `protobuf:"varint,5,opt,name=lazy,def=0" json:"lazy,omitempty"` + // Is this field deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for accessors, or it will be completely ignored; in the very least, this + // is a formalization for deprecating fields. + Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // For Google-internal migration only. Do not use. + Weak *bool `protobuf:"varint,10,opt,name=weak,def=0" json:"weak,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *FieldOptions) Reset() { *m = FieldOptions{} } +func (m *FieldOptions) String() string { return proto.CompactTextString(m) } +func (*FieldOptions) ProtoMessage() {} +func (*FieldOptions) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{11} } + +var extRange_FieldOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*FieldOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_FieldOptions +} + +const Default_FieldOptions_Ctype FieldOptions_CType = FieldOptions_STRING +const Default_FieldOptions_Jstype FieldOptions_JSType = FieldOptions_JS_NORMAL +const Default_FieldOptions_Lazy bool = false +const Default_FieldOptions_Deprecated bool = false +const Default_FieldOptions_Weak bool = false + +func (m *FieldOptions) GetCtype() FieldOptions_CType { + if m != nil && m.Ctype != nil { + return *m.Ctype + } + return Default_FieldOptions_Ctype +} + +func (m *FieldOptions) GetPacked() bool { + if m != nil && m.Packed != nil { + return *m.Packed + } + return false +} + +func (m *FieldOptions) GetJstype() FieldOptions_JSType { + if m != nil && m.Jstype != nil { + return *m.Jstype + } + return Default_FieldOptions_Jstype +} + +func (m *FieldOptions) GetLazy() bool { + if m != nil && m.Lazy != nil { + return *m.Lazy + } + return Default_FieldOptions_Lazy +} + +func (m *FieldOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_FieldOptions_Deprecated +} + +func (m *FieldOptions) GetWeak() bool { + if m != nil && m.Weak != nil { + return *m.Weak + } + return Default_FieldOptions_Weak +} + +func (m *FieldOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type OneofOptions struct { + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *OneofOptions) Reset() { *m = OneofOptions{} } +func (m *OneofOptions) String() string { return proto.CompactTextString(m) } +func (*OneofOptions) ProtoMessage() {} +func (*OneofOptions) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{12} } + +var extRange_OneofOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*OneofOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_OneofOptions +} + +func (m *OneofOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type EnumOptions struct { + // Set this option to true to allow mapping different tag names to the same + // value. + AllowAlias *bool `protobuf:"varint,2,opt,name=allow_alias,json=allowAlias" json:"allow_alias,omitempty"` + // Is this enum deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum, or it will be completely ignored; in the very least, this + // is a formalization for deprecating enums. + Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *EnumOptions) Reset() { *m = EnumOptions{} } +func (m *EnumOptions) String() string { return proto.CompactTextString(m) } +func (*EnumOptions) ProtoMessage() {} +func (*EnumOptions) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{13} } + +var extRange_EnumOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*EnumOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_EnumOptions +} + +const Default_EnumOptions_Deprecated bool = false + +func (m *EnumOptions) GetAllowAlias() bool { + if m != nil && m.AllowAlias != nil { + return *m.AllowAlias + } + return false +} + +func (m *EnumOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_EnumOptions_Deprecated +} + +func (m *EnumOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type EnumValueOptions struct { + // Is this enum value deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum value, or it will be completely ignored; in the very least, + // this is a formalization for deprecating enum values. + Deprecated *bool `protobuf:"varint,1,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *EnumValueOptions) Reset() { *m = EnumValueOptions{} } +func (m *EnumValueOptions) String() string { return proto.CompactTextString(m) } +func (*EnumValueOptions) ProtoMessage() {} +func (*EnumValueOptions) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{14} } + +var extRange_EnumValueOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*EnumValueOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_EnumValueOptions +} + +const Default_EnumValueOptions_Deprecated bool = false + +func (m *EnumValueOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_EnumValueOptions_Deprecated +} + +func (m *EnumValueOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type ServiceOptions struct { + // Is this service deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the service, or it will be completely ignored; in the very least, + // this is a formalization for deprecating services. + Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *ServiceOptions) Reset() { *m = ServiceOptions{} } +func (m *ServiceOptions) String() string { return proto.CompactTextString(m) } +func (*ServiceOptions) ProtoMessage() {} +func (*ServiceOptions) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{15} } + +var extRange_ServiceOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*ServiceOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_ServiceOptions +} + +const Default_ServiceOptions_Deprecated bool = false + +func (m *ServiceOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_ServiceOptions_Deprecated +} + +func (m *ServiceOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type MethodOptions struct { + // Is this method deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the method, or it will be completely ignored; in the very least, + // this is a formalization for deprecating methods. + Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *MethodOptions) Reset() { *m = MethodOptions{} } +func (m *MethodOptions) String() string { return proto.CompactTextString(m) } +func (*MethodOptions) ProtoMessage() {} +func (*MethodOptions) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{16} } + +var extRange_MethodOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*MethodOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_MethodOptions +} + +const Default_MethodOptions_Deprecated bool = false + +func (m *MethodOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_MethodOptions_Deprecated +} + +func (m *MethodOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +// A message representing a option the parser does not recognize. This only +// appears in options protos created by the compiler::Parser class. +// DescriptorPool resolves these when building Descriptor objects. Therefore, +// options protos in descriptor objects (e.g. returned by Descriptor::options(), +// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions +// in them. +type UninterpretedOption struct { + Name []*UninterpretedOption_NamePart `protobuf:"bytes,2,rep,name=name" json:"name,omitempty"` + // The value of the uninterpreted option, in whatever type the tokenizer + // identified it as during parsing. Exactly one of these should be set. + IdentifierValue *string `protobuf:"bytes,3,opt,name=identifier_value,json=identifierValue" json:"identifier_value,omitempty"` + PositiveIntValue *uint64 `protobuf:"varint,4,opt,name=positive_int_value,json=positiveIntValue" json:"positive_int_value,omitempty"` + NegativeIntValue *int64 `protobuf:"varint,5,opt,name=negative_int_value,json=negativeIntValue" json:"negative_int_value,omitempty"` + DoubleValue *float64 `protobuf:"fixed64,6,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` + StringValue []byte `protobuf:"bytes,7,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` + AggregateValue *string `protobuf:"bytes,8,opt,name=aggregate_value,json=aggregateValue" json:"aggregate_value,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *UninterpretedOption) Reset() { *m = UninterpretedOption{} } +func (m *UninterpretedOption) String() string { return proto.CompactTextString(m) } +func (*UninterpretedOption) ProtoMessage() {} +func (*UninterpretedOption) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{17} } + +func (m *UninterpretedOption) GetName() []*UninterpretedOption_NamePart { + if m != nil { + return m.Name + } + return nil +} + +func (m *UninterpretedOption) GetIdentifierValue() string { + if m != nil && m.IdentifierValue != nil { + return *m.IdentifierValue + } + return "" +} + +func (m *UninterpretedOption) GetPositiveIntValue() uint64 { + if m != nil && m.PositiveIntValue != nil { + return *m.PositiveIntValue + } + return 0 +} + +func (m *UninterpretedOption) GetNegativeIntValue() int64 { + if m != nil && m.NegativeIntValue != nil { + return *m.NegativeIntValue + } + return 0 +} + +func (m *UninterpretedOption) GetDoubleValue() float64 { + if m != nil && m.DoubleValue != nil { + return *m.DoubleValue + } + return 0 +} + +func (m *UninterpretedOption) GetStringValue() []byte { + if m != nil { + return m.StringValue + } + return nil +} + +func (m *UninterpretedOption) GetAggregateValue() string { + if m != nil && m.AggregateValue != nil { + return *m.AggregateValue + } + return "" +} + +// The name of the uninterpreted option. Each string represents a segment in +// a dot-separated name. is_extension is true iff a segment represents an +// extension (denoted with parentheses in options specs in .proto files). +// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents +// "foo.(bar.baz).qux". +type UninterpretedOption_NamePart struct { + NamePart *string `protobuf:"bytes,1,req,name=name_part,json=namePart" json:"name_part,omitempty"` + IsExtension *bool `protobuf:"varint,2,req,name=is_extension,json=isExtension" json:"is_extension,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *UninterpretedOption_NamePart) Reset() { *m = UninterpretedOption_NamePart{} } +func (m *UninterpretedOption_NamePart) String() string { return proto.CompactTextString(m) } +func (*UninterpretedOption_NamePart) ProtoMessage() {} +func (*UninterpretedOption_NamePart) Descriptor() ([]byte, []int) { + return fileDescriptorDescriptor, []int{17, 0} +} + +func (m *UninterpretedOption_NamePart) GetNamePart() string { + if m != nil && m.NamePart != nil { + return *m.NamePart + } + return "" +} + +func (m *UninterpretedOption_NamePart) GetIsExtension() bool { + if m != nil && m.IsExtension != nil { + return *m.IsExtension + } + return false +} + +// Encapsulates information about the original source file from which a +// FileDescriptorProto was generated. +type SourceCodeInfo struct { + // A Location identifies a piece of source code in a .proto file which + // corresponds to a particular definition. This information is intended + // to be useful to IDEs, code indexers, documentation generators, and similar + // tools. + // + // For example, say we have a file like: + // message Foo { + // optional string foo = 1; + // } + // Let's look at just the field definition: + // optional string foo = 1; + // ^ ^^ ^^ ^ ^^^ + // a bc de f ghi + // We have the following locations: + // span path represents + // [a,i) [ 4, 0, 2, 0 ] The whole field definition. + // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + // + // Notes: + // - A location may refer to a repeated field itself (i.e. not to any + // particular index within it). This is used whenever a set of elements are + // logically enclosed in a single code segment. For example, an entire + // extend block (possibly containing multiple extension definitions) will + // have an outer location whose path refers to the "extensions" repeated + // field without an index. + // - Multiple locations may have the same path. This happens when a single + // logical declaration is spread out across multiple places. The most + // obvious example is the "extend" block again -- there may be multiple + // extend blocks in the same scope, each of which will have the same path. + // - A location's span is not always a subset of its parent's span. For + // example, the "extendee" of an extension declaration appears at the + // beginning of the "extend" block and is shared by all extensions within + // the block. + // - Just because a location's span is a subset of some other location's span + // does not mean that it is a descendent. For example, a "group" defines + // both a type and a field in a single declaration. Thus, the locations + // corresponding to the type and field and their components will overlap. + // - Code which tries to interpret locations should probably be designed to + // ignore those that it doesn't understand, as more types of locations could + // be recorded in the future. + Location []*SourceCodeInfo_Location `protobuf:"bytes,1,rep,name=location" json:"location,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *SourceCodeInfo) Reset() { *m = SourceCodeInfo{} } +func (m *SourceCodeInfo) String() string { return proto.CompactTextString(m) } +func (*SourceCodeInfo) ProtoMessage() {} +func (*SourceCodeInfo) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{18} } + +func (m *SourceCodeInfo) GetLocation() []*SourceCodeInfo_Location { + if m != nil { + return m.Location + } + return nil +} + +type SourceCodeInfo_Location struct { + // Identifies which part of the FileDescriptorProto was defined at this + // location. + // + // Each element is a field number or an index. They form a path from + // the root FileDescriptorProto to the place where the definition. For + // example, this path: + // [ 4, 3, 2, 7, 1 ] + // refers to: + // file.message_type(3) // 4, 3 + // .field(7) // 2, 7 + // .name() // 1 + // This is because FileDescriptorProto.message_type has field number 4: + // repeated DescriptorProto message_type = 4; + // and DescriptorProto.field has field number 2: + // repeated FieldDescriptorProto field = 2; + // and FieldDescriptorProto.name has field number 1: + // optional string name = 1; + // + // Thus, the above path gives the location of a field name. If we removed + // the last element: + // [ 4, 3, 2, 7 ] + // this path refers to the whole field declaration (from the beginning + // of the label to the terminating semicolon). + Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` + // Always has exactly three or four elements: start line, start column, + // end line (optional, otherwise assumed same as start line), end column. + // These are packed into a single field for efficiency. Note that line + // and column numbers are zero-based -- typically you will want to add + // 1 to each before displaying to a user. + Span []int32 `protobuf:"varint,2,rep,packed,name=span" json:"span,omitempty"` + // If this SourceCodeInfo represents a complete declaration, these are any + // comments appearing before and after the declaration which appear to be + // attached to the declaration. + // + // A series of line comments appearing on consecutive lines, with no other + // tokens appearing on those lines, will be treated as a single comment. + // + // leading_detached_comments will keep paragraphs of comments that appear + // before (but not connected to) the current element. Each paragraph, + // separated by empty lines, will be one comment element in the repeated + // field. + // + // Only the comment content is provided; comment markers (e.g. //) are + // stripped out. For block comments, leading whitespace and an asterisk + // will be stripped from the beginning of each line other than the first. + // Newlines are included in the output. + // + // Examples: + // + // optional int32 foo = 1; // Comment attached to foo. + // // Comment attached to bar. + // optional int32 bar = 2; + // + // optional string baz = 3; + // // Comment attached to baz. + // // Another line attached to baz. + // + // // Comment attached to qux. + // // + // // Another line attached to qux. + // optional double qux = 4; + // + // // Detached comment for corge. This is not leading or trailing comments + // // to qux or corge because there are blank lines separating it from + // // both. + // + // // Detached comment for corge paragraph 2. + // + // optional string corge = 5; + // /* Block comment attached + // * to corge. Leading asterisks + // * will be removed. */ + // /* Block comment attached to + // * grault. */ + // optional int32 grault = 6; + // + // // ignored detached comments. + LeadingComments *string `protobuf:"bytes,3,opt,name=leading_comments,json=leadingComments" json:"leading_comments,omitempty"` + TrailingComments *string `protobuf:"bytes,4,opt,name=trailing_comments,json=trailingComments" json:"trailing_comments,omitempty"` + LeadingDetachedComments []string `protobuf:"bytes,6,rep,name=leading_detached_comments,json=leadingDetachedComments" json:"leading_detached_comments,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *SourceCodeInfo_Location) Reset() { *m = SourceCodeInfo_Location{} } +func (m *SourceCodeInfo_Location) String() string { return proto.CompactTextString(m) } +func (*SourceCodeInfo_Location) ProtoMessage() {} +func (*SourceCodeInfo_Location) Descriptor() ([]byte, []int) { + return fileDescriptorDescriptor, []int{18, 0} +} + +func (m *SourceCodeInfo_Location) GetPath() []int32 { + if m != nil { + return m.Path + } + return nil +} + +func (m *SourceCodeInfo_Location) GetSpan() []int32 { + if m != nil { + return m.Span + } + return nil +} + +func (m *SourceCodeInfo_Location) GetLeadingComments() string { + if m != nil && m.LeadingComments != nil { + return *m.LeadingComments + } + return "" +} + +func (m *SourceCodeInfo_Location) GetTrailingComments() string { + if m != nil && m.TrailingComments != nil { + return *m.TrailingComments + } + return "" +} + +func (m *SourceCodeInfo_Location) GetLeadingDetachedComments() []string { + if m != nil { + return m.LeadingDetachedComments + } + return nil +} + +// Describes the relationship between generated code and its original source +// file. A GeneratedCodeInfo message is associated with only one generated +// source file, but may contain references to different source .proto files. +type GeneratedCodeInfo struct { + // An Annotation connects some span of text in generated code to an element + // of its generating .proto file. + Annotation []*GeneratedCodeInfo_Annotation `protobuf:"bytes,1,rep,name=annotation" json:"annotation,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *GeneratedCodeInfo) Reset() { *m = GeneratedCodeInfo{} } +func (m *GeneratedCodeInfo) String() string { return proto.CompactTextString(m) } +func (*GeneratedCodeInfo) ProtoMessage() {} +func (*GeneratedCodeInfo) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{19} } + +func (m *GeneratedCodeInfo) GetAnnotation() []*GeneratedCodeInfo_Annotation { + if m != nil { + return m.Annotation + } + return nil +} + +type GeneratedCodeInfo_Annotation struct { + // Identifies the element in the original source .proto file. This field + // is formatted the same as SourceCodeInfo.Location.path. + Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` + // Identifies the filesystem path to the original source .proto. + SourceFile *string `protobuf:"bytes,2,opt,name=source_file,json=sourceFile" json:"source_file,omitempty"` + // Identifies the starting offset in bytes in the generated code + // that relates to the identified object. + Begin *int32 `protobuf:"varint,3,opt,name=begin" json:"begin,omitempty"` + // Identifies the ending offset in bytes in the generated code that + // relates to the identified offset. The end offset should be one past + // the last relevant byte (so the length of the text = end - begin). + End *int32 `protobuf:"varint,4,opt,name=end" json:"end,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *GeneratedCodeInfo_Annotation) Reset() { *m = GeneratedCodeInfo_Annotation{} } +func (m *GeneratedCodeInfo_Annotation) String() string { return proto.CompactTextString(m) } +func (*GeneratedCodeInfo_Annotation) ProtoMessage() {} +func (*GeneratedCodeInfo_Annotation) Descriptor() ([]byte, []int) { + return fileDescriptorDescriptor, []int{19, 0} +} + +func (m *GeneratedCodeInfo_Annotation) GetPath() []int32 { + if m != nil { + return m.Path + } + return nil +} + +func (m *GeneratedCodeInfo_Annotation) GetSourceFile() string { + if m != nil && m.SourceFile != nil { + return *m.SourceFile + } + return "" +} + +func (m *GeneratedCodeInfo_Annotation) GetBegin() int32 { + if m != nil && m.Begin != nil { + return *m.Begin + } + return 0 +} + +func (m *GeneratedCodeInfo_Annotation) GetEnd() int32 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + +func init() { + proto.RegisterType((*FileDescriptorSet)(nil), "google.protobuf.FileDescriptorSet") + proto.RegisterType((*FileDescriptorProto)(nil), "google.protobuf.FileDescriptorProto") + proto.RegisterType((*DescriptorProto)(nil), "google.protobuf.DescriptorProto") + proto.RegisterType((*DescriptorProto_ExtensionRange)(nil), "google.protobuf.DescriptorProto.ExtensionRange") + proto.RegisterType((*DescriptorProto_ReservedRange)(nil), "google.protobuf.DescriptorProto.ReservedRange") + proto.RegisterType((*FieldDescriptorProto)(nil), "google.protobuf.FieldDescriptorProto") + proto.RegisterType((*OneofDescriptorProto)(nil), "google.protobuf.OneofDescriptorProto") + proto.RegisterType((*EnumDescriptorProto)(nil), "google.protobuf.EnumDescriptorProto") + proto.RegisterType((*EnumValueDescriptorProto)(nil), "google.protobuf.EnumValueDescriptorProto") + proto.RegisterType((*ServiceDescriptorProto)(nil), "google.protobuf.ServiceDescriptorProto") + proto.RegisterType((*MethodDescriptorProto)(nil), "google.protobuf.MethodDescriptorProto") + proto.RegisterType((*FileOptions)(nil), "google.protobuf.FileOptions") + proto.RegisterType((*MessageOptions)(nil), "google.protobuf.MessageOptions") + proto.RegisterType((*FieldOptions)(nil), "google.protobuf.FieldOptions") + proto.RegisterType((*OneofOptions)(nil), "google.protobuf.OneofOptions") + proto.RegisterType((*EnumOptions)(nil), "google.protobuf.EnumOptions") + proto.RegisterType((*EnumValueOptions)(nil), "google.protobuf.EnumValueOptions") + proto.RegisterType((*ServiceOptions)(nil), "google.protobuf.ServiceOptions") + proto.RegisterType((*MethodOptions)(nil), "google.protobuf.MethodOptions") + proto.RegisterType((*UninterpretedOption)(nil), "google.protobuf.UninterpretedOption") + proto.RegisterType((*UninterpretedOption_NamePart)(nil), "google.protobuf.UninterpretedOption.NamePart") + proto.RegisterType((*SourceCodeInfo)(nil), "google.protobuf.SourceCodeInfo") + proto.RegisterType((*SourceCodeInfo_Location)(nil), "google.protobuf.SourceCodeInfo.Location") + proto.RegisterType((*GeneratedCodeInfo)(nil), "google.protobuf.GeneratedCodeInfo") + proto.RegisterType((*GeneratedCodeInfo_Annotation)(nil), "google.protobuf.GeneratedCodeInfo.Annotation") + proto.RegisterEnum("google.protobuf.FieldDescriptorProto_Type", FieldDescriptorProto_Type_name, FieldDescriptorProto_Type_value) + proto.RegisterEnum("google.protobuf.FieldDescriptorProto_Label", FieldDescriptorProto_Label_name, FieldDescriptorProto_Label_value) + proto.RegisterEnum("google.protobuf.FileOptions_OptimizeMode", FileOptions_OptimizeMode_name, FileOptions_OptimizeMode_value) + proto.RegisterEnum("google.protobuf.FieldOptions_CType", FieldOptions_CType_name, FieldOptions_CType_value) + proto.RegisterEnum("google.protobuf.FieldOptions_JSType", FieldOptions_JSType_name, FieldOptions_JSType_value) +} + +func init() { proto.RegisterFile("descriptor.proto", fileDescriptorDescriptor) } + +var fileDescriptorDescriptor = []byte{ + // 2273 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xcc, 0x59, 0xcd, 0x6f, 0xdb, 0xc8, + 0x15, 0x5f, 0xea, 0xcb, 0xd2, 0x93, 0x2c, 0x8f, 0xc7, 0xde, 0x84, 0x71, 0x36, 0x1b, 0x47, 0x9b, + 0x34, 0x4e, 0xd2, 0x3a, 0x0b, 0xe7, 0x63, 0xb3, 0xde, 0x62, 0x0b, 0x59, 0x62, 0xbc, 0x0a, 0x64, + 0x4b, 0xa5, 0xec, 0x36, 0xbb, 0x3d, 0x10, 0x63, 0x72, 0x24, 0x33, 0xa1, 0x86, 0x2c, 0x49, 0x25, + 0xf1, 0x9e, 0x02, 0xf4, 0x54, 0xf4, 0x1f, 0x28, 0xda, 0xa2, 0x28, 0xf6, 0xb2, 0x40, 0xff, 0x80, + 0x1e, 0x7a, 0xef, 0xb5, 0x40, 0xef, 0x3d, 0x16, 0x68, 0xff, 0x83, 0x5e, 0x8b, 0x99, 0x21, 0x29, + 0xea, 0x6b, 0xe3, 0x2e, 0xb0, 0x1f, 0x27, 0x6b, 0x7e, 0xef, 0xf7, 0x1e, 0xdf, 0xbc, 0x79, 0x7c, + 0xef, 0x71, 0x0c, 0xc8, 0xa2, 0x81, 0xe9, 0xdb, 0x5e, 0xe8, 0xfa, 0xdb, 0x9e, 0xef, 0x86, 0x2e, + 0x5e, 0x19, 0xb8, 0xee, 0xc0, 0xa1, 0x72, 0x75, 0x32, 0xea, 0xd7, 0x0e, 0x60, 0xf5, 0xb1, 0xed, + 0xd0, 0x66, 0x42, 0xec, 0xd1, 0x10, 0x3f, 0x82, 0x5c, 0xdf, 0x76, 0xa8, 0xaa, 0x6c, 0x66, 0xb7, + 0xca, 0x3b, 0xd7, 0xb7, 0xa7, 0x94, 0xb6, 0x27, 0x35, 0xba, 0x1c, 0xd6, 0x85, 0x46, 0xed, 0x5f, + 0x39, 0x58, 0x9b, 0x23, 0xc5, 0x18, 0x72, 0x8c, 0x0c, 0xb9, 0x45, 0x65, 0xab, 0xa4, 0x8b, 0xdf, + 0x58, 0x85, 0x25, 0x8f, 0x98, 0xcf, 0xc9, 0x80, 0xaa, 0x19, 0x01, 0xc7, 0x4b, 0xfc, 0x2e, 0x80, + 0x45, 0x3d, 0xca, 0x2c, 0xca, 0xcc, 0x33, 0x35, 0xbb, 0x99, 0xdd, 0x2a, 0xe9, 0x29, 0x04, 0xdf, + 0x81, 0x55, 0x6f, 0x74, 0xe2, 0xd8, 0xa6, 0x91, 0xa2, 0xc1, 0x66, 0x76, 0x2b, 0xaf, 0x23, 0x29, + 0x68, 0x8e, 0xc9, 0x37, 0x61, 0xe5, 0x25, 0x25, 0xcf, 0xd3, 0xd4, 0xb2, 0xa0, 0x56, 0x39, 0x9c, + 0x22, 0x36, 0xa0, 0x32, 0xa4, 0x41, 0x40, 0x06, 0xd4, 0x08, 0xcf, 0x3c, 0xaa, 0xe6, 0xc4, 0xee, + 0x37, 0x67, 0x76, 0x3f, 0xbd, 0xf3, 0x72, 0xa4, 0x75, 0x74, 0xe6, 0x51, 0x5c, 0x87, 0x12, 0x65, + 0xa3, 0xa1, 0xb4, 0x90, 0x5f, 0x10, 0x3f, 0x8d, 0x8d, 0x86, 0xd3, 0x56, 0x8a, 0x5c, 0x2d, 0x32, + 0xb1, 0x14, 0x50, 0xff, 0x85, 0x6d, 0x52, 0xb5, 0x20, 0x0c, 0xdc, 0x9c, 0x31, 0xd0, 0x93, 0xf2, + 0x69, 0x1b, 0xb1, 0x1e, 0x6e, 0x40, 0x89, 0xbe, 0x0a, 0x29, 0x0b, 0x6c, 0x97, 0xa9, 0x4b, 0xc2, + 0xc8, 0x8d, 0x39, 0xa7, 0x48, 0x1d, 0x6b, 0xda, 0xc4, 0x58, 0x0f, 0x3f, 0x84, 0x25, 0xd7, 0x0b, + 0x6d, 0x97, 0x05, 0x6a, 0x71, 0x53, 0xd9, 0x2a, 0xef, 0xbc, 0x33, 0x37, 0x11, 0x3a, 0x92, 0xa3, + 0xc7, 0x64, 0xdc, 0x02, 0x14, 0xb8, 0x23, 0xdf, 0xa4, 0x86, 0xe9, 0x5a, 0xd4, 0xb0, 0x59, 0xdf, + 0x55, 0x4b, 0xc2, 0xc0, 0xd5, 0xd9, 0x8d, 0x08, 0x62, 0xc3, 0xb5, 0x68, 0x8b, 0xf5, 0x5d, 0xbd, + 0x1a, 0x4c, 0xac, 0xf1, 0x05, 0x28, 0x04, 0x67, 0x2c, 0x24, 0xaf, 0xd4, 0x8a, 0xc8, 0x90, 0x68, + 0x55, 0xfb, 0x6f, 0x1e, 0x56, 0xce, 0x93, 0x62, 0x1f, 0x41, 0xbe, 0xcf, 0x77, 0xa9, 0x66, 0xfe, + 0x9f, 0x18, 0x48, 0x9d, 0xc9, 0x20, 0x16, 0xbe, 0x66, 0x10, 0xeb, 0x50, 0x66, 0x34, 0x08, 0xa9, + 0x25, 0x33, 0x22, 0x7b, 0xce, 0x9c, 0x02, 0xa9, 0x34, 0x9b, 0x52, 0xb9, 0xaf, 0x95, 0x52, 0x4f, + 0x61, 0x25, 0x71, 0xc9, 0xf0, 0x09, 0x1b, 0xc4, 0xb9, 0x79, 0xf7, 0x4d, 0x9e, 0x6c, 0x6b, 0xb1, + 0x9e, 0xce, 0xd5, 0xf4, 0x2a, 0x9d, 0x58, 0xe3, 0x26, 0x80, 0xcb, 0xa8, 0xdb, 0x37, 0x2c, 0x6a, + 0x3a, 0x6a, 0x71, 0x41, 0x94, 0x3a, 0x9c, 0x32, 0x13, 0x25, 0x57, 0xa2, 0xa6, 0x83, 0x3f, 0x1c, + 0xa7, 0xda, 0xd2, 0x82, 0x4c, 0x39, 0x90, 0x2f, 0xd9, 0x4c, 0xb6, 0x1d, 0x43, 0xd5, 0xa7, 0x3c, + 0xef, 0xa9, 0x15, 0xed, 0xac, 0x24, 0x9c, 0xd8, 0x7e, 0xe3, 0xce, 0xf4, 0x48, 0x4d, 0x6e, 0x6c, + 0xd9, 0x4f, 0x2f, 0xf1, 0x7b, 0x90, 0x00, 0x86, 0x48, 0x2b, 0x10, 0x55, 0xa8, 0x12, 0x83, 0x87, + 0x64, 0x48, 0x37, 0x1e, 0x41, 0x75, 0x32, 0x3c, 0x78, 0x1d, 0xf2, 0x41, 0x48, 0xfc, 0x50, 0x64, + 0x61, 0x5e, 0x97, 0x0b, 0x8c, 0x20, 0x4b, 0x99, 0x25, 0xaa, 0x5c, 0x5e, 0xe7, 0x3f, 0x37, 0x3e, + 0x80, 0xe5, 0x89, 0xc7, 0x9f, 0x57, 0xb1, 0xf6, 0xdb, 0x02, 0xac, 0xcf, 0xcb, 0xb9, 0xb9, 0xe9, + 0x7f, 0x01, 0x0a, 0x6c, 0x34, 0x3c, 0xa1, 0xbe, 0x9a, 0x15, 0x16, 0xa2, 0x15, 0xae, 0x43, 0xde, + 0x21, 0x27, 0xd4, 0x51, 0x73, 0x9b, 0xca, 0x56, 0x75, 0xe7, 0xce, 0xb9, 0xb2, 0x7a, 0xbb, 0xcd, + 0x55, 0x74, 0xa9, 0x89, 0x3f, 0x86, 0x5c, 0x54, 0xe2, 0xb8, 0x85, 0xdb, 0xe7, 0xb3, 0xc0, 0x73, + 0x51, 0x17, 0x7a, 0xf8, 0x32, 0x94, 0xf8, 0x5f, 0x19, 0xdb, 0x82, 0xf0, 0xb9, 0xc8, 0x01, 0x1e, + 0x57, 0xbc, 0x01, 0x45, 0x91, 0x66, 0x16, 0x8d, 0x5b, 0x43, 0xb2, 0xe6, 0x07, 0x63, 0xd1, 0x3e, + 0x19, 0x39, 0xa1, 0xf1, 0x82, 0x38, 0x23, 0x2a, 0x12, 0xa6, 0xa4, 0x57, 0x22, 0xf0, 0x67, 0x1c, + 0xc3, 0x57, 0xa1, 0x2c, 0xb3, 0xd2, 0x66, 0x16, 0x7d, 0x25, 0xaa, 0x4f, 0x5e, 0x97, 0x89, 0xda, + 0xe2, 0x08, 0x7f, 0xfc, 0xb3, 0xc0, 0x65, 0xf1, 0xd1, 0x8a, 0x47, 0x70, 0x40, 0x3c, 0xfe, 0x83, + 0xe9, 0xc2, 0x77, 0x65, 0xfe, 0xf6, 0xa6, 0x73, 0xb1, 0xf6, 0x97, 0x0c, 0xe4, 0xc4, 0xfb, 0xb6, + 0x02, 0xe5, 0xa3, 0x4f, 0xbb, 0x9a, 0xd1, 0xec, 0x1c, 0xef, 0xb5, 0x35, 0xa4, 0xe0, 0x2a, 0x80, + 0x00, 0x1e, 0xb7, 0x3b, 0xf5, 0x23, 0x94, 0x49, 0xd6, 0xad, 0xc3, 0xa3, 0x87, 0xf7, 0x51, 0x36, + 0x51, 0x38, 0x96, 0x40, 0x2e, 0x4d, 0xb8, 0xb7, 0x83, 0xf2, 0x18, 0x41, 0x45, 0x1a, 0x68, 0x3d, + 0xd5, 0x9a, 0x0f, 0xef, 0xa3, 0xc2, 0x24, 0x72, 0x6f, 0x07, 0x2d, 0xe1, 0x65, 0x28, 0x09, 0x64, + 0xaf, 0xd3, 0x69, 0xa3, 0x62, 0x62, 0xb3, 0x77, 0xa4, 0xb7, 0x0e, 0xf7, 0x51, 0x29, 0xb1, 0xb9, + 0xaf, 0x77, 0x8e, 0xbb, 0x08, 0x12, 0x0b, 0x07, 0x5a, 0xaf, 0x57, 0xdf, 0xd7, 0x50, 0x39, 0x61, + 0xec, 0x7d, 0x7a, 0xa4, 0xf5, 0x50, 0x65, 0xc2, 0xad, 0x7b, 0x3b, 0x68, 0x39, 0x79, 0x84, 0x76, + 0x78, 0x7c, 0x80, 0xaa, 0x78, 0x15, 0x96, 0xe5, 0x23, 0x62, 0x27, 0x56, 0xa6, 0xa0, 0x87, 0xf7, + 0x11, 0x1a, 0x3b, 0x22, 0xad, 0xac, 0x4e, 0x00, 0x0f, 0xef, 0x23, 0x5c, 0x6b, 0x40, 0x5e, 0x64, + 0x17, 0xc6, 0x50, 0x6d, 0xd7, 0xf7, 0xb4, 0xb6, 0xd1, 0xe9, 0x1e, 0xb5, 0x3a, 0x87, 0xf5, 0x36, + 0x52, 0xc6, 0x98, 0xae, 0xfd, 0xf4, 0xb8, 0xa5, 0x6b, 0x4d, 0x94, 0x49, 0x63, 0x5d, 0xad, 0x7e, + 0xa4, 0x35, 0x51, 0xb6, 0x66, 0xc2, 0xfa, 0xbc, 0x3a, 0x33, 0xf7, 0xcd, 0x48, 0x1d, 0x71, 0x66, + 0xc1, 0x11, 0x0b, 0x5b, 0x33, 0x47, 0xfc, 0x85, 0x02, 0x6b, 0x73, 0x6a, 0xed, 0xdc, 0x87, 0xfc, + 0x04, 0xf2, 0x32, 0x45, 0x65, 0xf7, 0xb9, 0x35, 0xb7, 0x68, 0x8b, 0x84, 0x9d, 0xe9, 0x40, 0x42, + 0x2f, 0xdd, 0x81, 0xb3, 0x0b, 0x3a, 0x30, 0x37, 0x31, 0xe3, 0xe4, 0xaf, 0x14, 0x50, 0x17, 0xd9, + 0x7e, 0x43, 0xa1, 0xc8, 0x4c, 0x14, 0x8a, 0x8f, 0xa6, 0x1d, 0xb8, 0xb6, 0x78, 0x0f, 0x33, 0x5e, + 0x7c, 0xa9, 0xc0, 0x85, 0xf9, 0x83, 0xca, 0x5c, 0x1f, 0x3e, 0x86, 0xc2, 0x90, 0x86, 0xa7, 0x6e, + 0xdc, 0xac, 0x7f, 0x30, 0xa7, 0x05, 0x70, 0xf1, 0x74, 0xac, 0x22, 0xad, 0x74, 0x0f, 0xc9, 0x2e, + 0x9a, 0x36, 0xa4, 0x37, 0x33, 0x9e, 0xfe, 0x3a, 0x03, 0x6f, 0xcf, 0x35, 0x3e, 0xd7, 0xd1, 0x2b, + 0x00, 0x36, 0xf3, 0x46, 0xa1, 0x6c, 0xc8, 0xb2, 0x3e, 0x95, 0x04, 0x22, 0xde, 0x7d, 0x5e, 0x7b, + 0x46, 0x61, 0x22, 0xcf, 0x0a, 0x39, 0x48, 0x48, 0x10, 0x1e, 0x8d, 0x1d, 0xcd, 0x09, 0x47, 0xdf, + 0x5d, 0xb0, 0xd3, 0x99, 0x5e, 0xf7, 0x3e, 0x20, 0xd3, 0xb1, 0x29, 0x0b, 0x8d, 0x20, 0xf4, 0x29, + 0x19, 0xda, 0x6c, 0x20, 0x0a, 0x70, 0x71, 0x37, 0xdf, 0x27, 0x4e, 0x40, 0xf5, 0x15, 0x29, 0xee, + 0xc5, 0x52, 0xae, 0x21, 0xba, 0x8c, 0x9f, 0xd2, 0x28, 0x4c, 0x68, 0x48, 0x71, 0xa2, 0x51, 0xfb, + 0xcd, 0x12, 0x94, 0x53, 0x63, 0x1d, 0xbe, 0x06, 0x95, 0x67, 0xe4, 0x05, 0x31, 0xe2, 0x51, 0x5d, + 0x46, 0xa2, 0xcc, 0xb1, 0x6e, 0x34, 0xae, 0xbf, 0x0f, 0xeb, 0x82, 0xe2, 0x8e, 0x42, 0xea, 0x1b, + 0xa6, 0x43, 0x82, 0x40, 0x04, 0xad, 0x28, 0xa8, 0x98, 0xcb, 0x3a, 0x5c, 0xd4, 0x88, 0x25, 0xf8, + 0x01, 0xac, 0x09, 0x8d, 0xe1, 0xc8, 0x09, 0x6d, 0xcf, 0xa1, 0x06, 0xff, 0x78, 0x08, 0x44, 0x21, + 0x4e, 0x3c, 0x5b, 0xe5, 0x8c, 0x83, 0x88, 0xc0, 0x3d, 0x0a, 0xf0, 0x3e, 0x5c, 0x11, 0x6a, 0x03, + 0xca, 0xa8, 0x4f, 0x42, 0x6a, 0xd0, 0x5f, 0x8e, 0x88, 0x13, 0x18, 0x84, 0x59, 0xc6, 0x29, 0x09, + 0x4e, 0xd5, 0xf5, 0xb4, 0x81, 0x4b, 0x9c, 0xbb, 0x1f, 0x51, 0x35, 0xc1, 0xac, 0x33, 0xeb, 0x13, + 0x12, 0x9c, 0xe2, 0x5d, 0xb8, 0x20, 0x0c, 0x05, 0xa1, 0x6f, 0xb3, 0x81, 0x61, 0x9e, 0x52, 0xf3, + 0xb9, 0x31, 0x0a, 0xfb, 0x8f, 0xd4, 0xcb, 0x69, 0x0b, 0xc2, 0xc9, 0x9e, 0xe0, 0x34, 0x38, 0xe5, + 0x38, 0xec, 0x3f, 0xc2, 0x3d, 0xa8, 0xf0, 0xf3, 0x18, 0xda, 0x9f, 0x53, 0xa3, 0xef, 0xfa, 0xa2, + 0xb9, 0x54, 0xe7, 0xbc, 0xdc, 0xa9, 0x20, 0x6e, 0x77, 0x22, 0x85, 0x03, 0xd7, 0xa2, 0xbb, 0xf9, + 0x5e, 0x57, 0xd3, 0x9a, 0x7a, 0x39, 0xb6, 0xf2, 0xd8, 0xf5, 0x79, 0x4e, 0x0d, 0xdc, 0x24, 0xc6, + 0x65, 0x99, 0x53, 0x03, 0x37, 0x8e, 0xf0, 0x03, 0x58, 0x33, 0x4d, 0xb9, 0x6d, 0xdb, 0x34, 0xa2, + 0x29, 0x3f, 0x50, 0xd1, 0x44, 0xbc, 0x4c, 0x73, 0x5f, 0x12, 0xa2, 0x34, 0x0f, 0xf0, 0x87, 0xf0, + 0xf6, 0x38, 0x5e, 0x69, 0xc5, 0xd5, 0x99, 0x5d, 0x4e, 0xab, 0x3e, 0x80, 0x35, 0xef, 0x6c, 0x56, + 0x11, 0x4f, 0x3c, 0xd1, 0x3b, 0x9b, 0x56, 0xbb, 0x21, 0xbe, 0xdc, 0x7c, 0x6a, 0x92, 0x90, 0x5a, + 0xea, 0xc5, 0x34, 0x3b, 0x25, 0xc0, 0x77, 0x01, 0x99, 0xa6, 0x41, 0x19, 0x39, 0x71, 0xa8, 0x41, + 0x7c, 0xca, 0x48, 0xa0, 0x5e, 0x4d, 0x93, 0xab, 0xa6, 0xa9, 0x09, 0x69, 0x5d, 0x08, 0xf1, 0x6d, + 0x58, 0x75, 0x4f, 0x9e, 0x99, 0x32, 0xb9, 0x0c, 0xcf, 0xa7, 0x7d, 0xfb, 0x95, 0x7a, 0x5d, 0x84, + 0x69, 0x85, 0x0b, 0x44, 0x6a, 0x75, 0x05, 0x8c, 0x6f, 0x01, 0x32, 0x83, 0x53, 0xe2, 0x7b, 0xa2, + 0xbb, 0x07, 0x1e, 0x31, 0xa9, 0x7a, 0x43, 0x52, 0x25, 0x7e, 0x18, 0xc3, 0xf8, 0x29, 0xac, 0x8f, + 0x98, 0xcd, 0x42, 0xea, 0x7b, 0x3e, 0xe5, 0x43, 0xba, 0x7c, 0xd3, 0xd4, 0x7f, 0x2f, 0x2d, 0x18, + 0xb3, 0x8f, 0xd3, 0x6c, 0x79, 0xba, 0xfa, 0xda, 0x68, 0x16, 0xac, 0xed, 0x42, 0x25, 0x7d, 0xe8, + 0xb8, 0x04, 0xf2, 0xd8, 0x91, 0xc2, 0x7b, 0x68, 0xa3, 0xd3, 0xe4, 0xdd, 0xef, 0x33, 0x0d, 0x65, + 0x78, 0x17, 0x6e, 0xb7, 0x8e, 0x34, 0x43, 0x3f, 0x3e, 0x3c, 0x6a, 0x1d, 0x68, 0x28, 0x7b, 0xbb, + 0x54, 0xfc, 0xcf, 0x12, 0x7a, 0xfd, 0xfa, 0xf5, 0xeb, 0x4c, 0xed, 0x6f, 0x19, 0xa8, 0x4e, 0x4e, + 0xbe, 0xf8, 0xc7, 0x70, 0x31, 0xfe, 0x4c, 0x0d, 0x68, 0x68, 0xbc, 0xb4, 0x7d, 0x91, 0x87, 0x43, + 0x22, 0x67, 0xc7, 0x24, 0x84, 0xeb, 0x11, 0xab, 0x47, 0xc3, 0x9f, 0xdb, 0x3e, 0xcf, 0xb2, 0x21, + 0x09, 0x71, 0x1b, 0xae, 0x32, 0xd7, 0x08, 0x42, 0xc2, 0x2c, 0xe2, 0x5b, 0xc6, 0xf8, 0x82, 0xc0, + 0x20, 0xa6, 0x49, 0x83, 0xc0, 0x95, 0x2d, 0x20, 0xb1, 0xf2, 0x0e, 0x73, 0x7b, 0x11, 0x79, 0x5c, + 0x1b, 0xeb, 0x11, 0x75, 0xea, 0xb8, 0xb3, 0x8b, 0x8e, 0xfb, 0x32, 0x94, 0x86, 0xc4, 0x33, 0x28, + 0x0b, 0xfd, 0x33, 0x31, 0xaf, 0x15, 0xf5, 0xe2, 0x90, 0x78, 0x1a, 0x5f, 0x7f, 0x73, 0x67, 0x90, + 0x8e, 0xe3, 0x3f, 0xb3, 0x50, 0x49, 0xcf, 0x6c, 0x7c, 0x04, 0x36, 0x45, 0x7d, 0x56, 0xc4, 0xeb, + 0xfb, 0xde, 0x57, 0x4e, 0x78, 0xdb, 0x0d, 0x5e, 0xb8, 0x77, 0x0b, 0x72, 0x92, 0xd2, 0xa5, 0x26, + 0x6f, 0x9a, 0xfc, 0x85, 0xa5, 0x72, 0x3e, 0x2f, 0xea, 0xd1, 0x0a, 0xef, 0x43, 0xe1, 0x59, 0x20, + 0x6c, 0x17, 0x84, 0xed, 0xeb, 0x5f, 0x6d, 0xfb, 0x49, 0x4f, 0x18, 0x2f, 0x3d, 0xe9, 0x19, 0x87, + 0x1d, 0xfd, 0xa0, 0xde, 0xd6, 0x23, 0x75, 0x7c, 0x09, 0x72, 0x0e, 0xf9, 0xfc, 0x6c, 0xb2, 0xc4, + 0x0b, 0xe8, 0xbc, 0x81, 0xbf, 0x04, 0xb9, 0x97, 0x94, 0x3c, 0x9f, 0x2c, 0xac, 0x02, 0xfa, 0x06, + 0x53, 0xff, 0x2e, 0xe4, 0x45, 0xbc, 0x30, 0x40, 0x14, 0x31, 0xf4, 0x16, 0x2e, 0x42, 0xae, 0xd1, + 0xd1, 0x79, 0xfa, 0x23, 0xa8, 0x48, 0xd4, 0xe8, 0xb6, 0xb4, 0x86, 0x86, 0x32, 0xb5, 0x07, 0x50, + 0x90, 0x41, 0xe0, 0xaf, 0x46, 0x12, 0x06, 0xf4, 0x56, 0xb4, 0x8c, 0x6c, 0x28, 0xb1, 0xf4, 0xf8, + 0x60, 0x4f, 0xd3, 0x51, 0x26, 0x7d, 0xbc, 0x01, 0x54, 0xd2, 0xe3, 0xda, 0xb7, 0x93, 0x53, 0x7f, + 0x55, 0xa0, 0x9c, 0x1a, 0xbf, 0x78, 0xe3, 0x27, 0x8e, 0xe3, 0xbe, 0x34, 0x88, 0x63, 0x93, 0x20, + 0x4a, 0x0a, 0x10, 0x50, 0x9d, 0x23, 0xe7, 0x3d, 0xb4, 0x6f, 0xc5, 0xf9, 0x3f, 0x2a, 0x80, 0xa6, + 0x47, 0xb7, 0x29, 0x07, 0x95, 0xef, 0xd4, 0xc1, 0x3f, 0x28, 0x50, 0x9d, 0x9c, 0xd7, 0xa6, 0xdc, + 0xbb, 0xf6, 0x9d, 0xba, 0xf7, 0x7b, 0x05, 0x96, 0x27, 0xa6, 0xb4, 0xef, 0x95, 0x77, 0xbf, 0xcb, + 0xc2, 0xda, 0x1c, 0x3d, 0x5c, 0x8f, 0xc6, 0x59, 0x39, 0x61, 0xff, 0xe8, 0x3c, 0xcf, 0xda, 0xe6, + 0xdd, 0xb2, 0x4b, 0xfc, 0x30, 0x9a, 0x7e, 0x6f, 0x01, 0xb2, 0x2d, 0xca, 0x42, 0xbb, 0x6f, 0x53, + 0x3f, 0xfa, 0x04, 0x97, 0x33, 0xee, 0xca, 0x18, 0x97, 0x5f, 0xe1, 0x3f, 0x04, 0xec, 0xb9, 0x81, + 0x1d, 0xda, 0x2f, 0xa8, 0x61, 0xb3, 0xf8, 0x7b, 0x9d, 0xcf, 0xbc, 0x39, 0x1d, 0xc5, 0x92, 0x16, + 0x0b, 0x13, 0x36, 0xa3, 0x03, 0x32, 0xc5, 0xe6, 0xb5, 0x2f, 0xab, 0xa3, 0x58, 0x92, 0xb0, 0xaf, + 0x41, 0xc5, 0x72, 0x47, 0x7c, 0x7c, 0x90, 0x3c, 0x5e, 0x6a, 0x15, 0xbd, 0x2c, 0xb1, 0x84, 0x12, + 0xcd, 0x77, 0xe3, 0x8b, 0x82, 0x8a, 0x5e, 0x96, 0x98, 0xa4, 0xdc, 0x84, 0x15, 0x32, 0x18, 0xf8, + 0xdc, 0x78, 0x6c, 0x48, 0x0e, 0xad, 0xd5, 0x04, 0x16, 0xc4, 0x8d, 0x27, 0x50, 0x8c, 0xe3, 0xc0, + 0xbb, 0x19, 0x8f, 0x84, 0xe1, 0xc9, 0xeb, 0x9a, 0xcc, 0x56, 0x49, 0x2f, 0xb2, 0x58, 0x78, 0x0d, + 0x2a, 0x76, 0x60, 0x8c, 0xef, 0x0d, 0x33, 0x9b, 0x99, 0xad, 0xa2, 0x5e, 0xb6, 0x83, 0xe4, 0xa2, + 0xa8, 0xf6, 0x65, 0x06, 0xaa, 0x93, 0xf7, 0x9e, 0xb8, 0x09, 0x45, 0xc7, 0x35, 0x89, 0x48, 0x04, + 0x79, 0xe9, 0xbe, 0xf5, 0x86, 0xab, 0xd2, 0xed, 0x76, 0xc4, 0xd7, 0x13, 0xcd, 0x8d, 0xbf, 0x2b, + 0x50, 0x8c, 0x61, 0x7c, 0x01, 0x72, 0x1e, 0x09, 0x4f, 0x85, 0xb9, 0xfc, 0x5e, 0x06, 0x29, 0xba, + 0x58, 0x73, 0x3c, 0xf0, 0x08, 0x13, 0x29, 0x10, 0xe1, 0x7c, 0xcd, 0xcf, 0xd5, 0xa1, 0xc4, 0x12, + 0xe3, 0xb0, 0x3b, 0x1c, 0x52, 0x16, 0x06, 0xf1, 0xb9, 0x46, 0x78, 0x23, 0x82, 0xf1, 0x1d, 0x58, + 0x0d, 0x7d, 0x62, 0x3b, 0x13, 0xdc, 0x9c, 0xe0, 0xa2, 0x58, 0x90, 0x90, 0x77, 0xe1, 0x52, 0x6c, + 0xd7, 0xa2, 0x21, 0x31, 0x4f, 0xa9, 0x35, 0x56, 0x2a, 0x88, 0x4b, 0xb5, 0x8b, 0x11, 0xa1, 0x19, + 0xc9, 0x63, 0xdd, 0xda, 0x3f, 0x14, 0x58, 0x8d, 0x07, 0x78, 0x2b, 0x09, 0xd6, 0x01, 0x00, 0x61, + 0xcc, 0x0d, 0xd3, 0xe1, 0x9a, 0x4d, 0xe5, 0x19, 0xbd, 0xed, 0x7a, 0xa2, 0xa4, 0xa7, 0x0c, 0x6c, + 0x0c, 0x01, 0xc6, 0x92, 0x85, 0x61, 0xbb, 0x0a, 0xe5, 0xe8, 0x52, 0x5b, 0xfc, 0x67, 0x44, 0x7e, + 0xf5, 0x81, 0x84, 0xf8, 0xa4, 0x8f, 0xd7, 0x21, 0x7f, 0x42, 0x07, 0x36, 0x8b, 0xae, 0xda, 0xe4, + 0x22, 0xbe, 0xc0, 0xcb, 0x25, 0x17, 0x78, 0x7b, 0xbf, 0x80, 0x35, 0xd3, 0x1d, 0x4e, 0xbb, 0xbb, + 0x87, 0xa6, 0xbe, 0x3c, 0x83, 0x4f, 0x94, 0xcf, 0x60, 0x3c, 0x9d, 0xfd, 0x49, 0x51, 0xbe, 0xc8, + 0x64, 0xf7, 0xbb, 0x7b, 0x7f, 0xce, 0x6c, 0xec, 0x4b, 0xd5, 0x6e, 0xbc, 0x53, 0x9d, 0xf6, 0x1d, + 0x6a, 0x72, 0xef, 0xff, 0x17, 0x00, 0x00, 0xff, 0xff, 0xd0, 0xf2, 0xf3, 0xa9, 0xf1, 0x19, 0x00, + 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go new file mode 100644 index 00000000000..785d6f9fe88 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go @@ -0,0 +1,715 @@ +// Code generated by protoc-gen-gogo. +// source: descriptor.proto +// DO NOT EDIT! + +/* +Package descriptor is a generated protocol buffer package. + +It is generated from these files: + descriptor.proto + +It has these top-level messages: + FileDescriptorSet + FileDescriptorProto + DescriptorProto + FieldDescriptorProto + OneofDescriptorProto + EnumDescriptorProto + EnumValueDescriptorProto + ServiceDescriptorProto + MethodDescriptorProto + FileOptions + MessageOptions + FieldOptions + OneofOptions + EnumOptions + EnumValueOptions + ServiceOptions + MethodOptions + UninterpretedOption + SourceCodeInfo + GeneratedCodeInfo +*/ +package descriptor + +import fmt "fmt" +import strings "strings" +import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" +import sort "sort" +import strconv "strconv" +import reflect "reflect" +import proto "github.com/gogo/protobuf/proto" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +func (this *FileDescriptorSet) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&descriptor.FileDescriptorSet{") + if this.File != nil { + s = append(s, "File: "+fmt.Sprintf("%#v", this.File)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *FileDescriptorProto) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 16) + s = append(s, "&descriptor.FileDescriptorProto{") + if this.Name != nil { + s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") + } + if this.Package != nil { + s = append(s, "Package: "+valueToGoStringDescriptor(this.Package, "string")+",\n") + } + if this.Dependency != nil { + s = append(s, "Dependency: "+fmt.Sprintf("%#v", this.Dependency)+",\n") + } + if this.PublicDependency != nil { + s = append(s, "PublicDependency: "+fmt.Sprintf("%#v", this.PublicDependency)+",\n") + } + if this.WeakDependency != nil { + s = append(s, "WeakDependency: "+fmt.Sprintf("%#v", this.WeakDependency)+",\n") + } + if this.MessageType != nil { + s = append(s, "MessageType: "+fmt.Sprintf("%#v", this.MessageType)+",\n") + } + if this.EnumType != nil { + s = append(s, "EnumType: "+fmt.Sprintf("%#v", this.EnumType)+",\n") + } + if this.Service != nil { + s = append(s, "Service: "+fmt.Sprintf("%#v", this.Service)+",\n") + } + if this.Extension != nil { + s = append(s, "Extension: "+fmt.Sprintf("%#v", this.Extension)+",\n") + } + if this.Options != nil { + s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") + } + if this.SourceCodeInfo != nil { + s = append(s, "SourceCodeInfo: "+fmt.Sprintf("%#v", this.SourceCodeInfo)+",\n") + } + if this.Syntax != nil { + s = append(s, "Syntax: "+valueToGoStringDescriptor(this.Syntax, "string")+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *DescriptorProto) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 14) + s = append(s, "&descriptor.DescriptorProto{") + if this.Name != nil { + s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") + } + if this.Field != nil { + s = append(s, "Field: "+fmt.Sprintf("%#v", this.Field)+",\n") + } + if this.Extension != nil { + s = append(s, "Extension: "+fmt.Sprintf("%#v", this.Extension)+",\n") + } + if this.NestedType != nil { + s = append(s, "NestedType: "+fmt.Sprintf("%#v", this.NestedType)+",\n") + } + if this.EnumType != nil { + s = append(s, "EnumType: "+fmt.Sprintf("%#v", this.EnumType)+",\n") + } + if this.ExtensionRange != nil { + s = append(s, "ExtensionRange: "+fmt.Sprintf("%#v", this.ExtensionRange)+",\n") + } + if this.OneofDecl != nil { + s = append(s, "OneofDecl: "+fmt.Sprintf("%#v", this.OneofDecl)+",\n") + } + if this.Options != nil { + s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") + } + if this.ReservedRange != nil { + s = append(s, "ReservedRange: "+fmt.Sprintf("%#v", this.ReservedRange)+",\n") + } + if this.ReservedName != nil { + s = append(s, "ReservedName: "+fmt.Sprintf("%#v", this.ReservedName)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *DescriptorProto_ExtensionRange) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&descriptor.DescriptorProto_ExtensionRange{") + if this.Start != nil { + s = append(s, "Start: "+valueToGoStringDescriptor(this.Start, "int32")+",\n") + } + if this.End != nil { + s = append(s, "End: "+valueToGoStringDescriptor(this.End, "int32")+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *DescriptorProto_ReservedRange) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&descriptor.DescriptorProto_ReservedRange{") + if this.Start != nil { + s = append(s, "Start: "+valueToGoStringDescriptor(this.Start, "int32")+",\n") + } + if this.End != nil { + s = append(s, "End: "+valueToGoStringDescriptor(this.End, "int32")+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *FieldDescriptorProto) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 14) + s = append(s, "&descriptor.FieldDescriptorProto{") + if this.Name != nil { + s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") + } + if this.Number != nil { + s = append(s, "Number: "+valueToGoStringDescriptor(this.Number, "int32")+",\n") + } + if this.Label != nil { + s = append(s, "Label: "+valueToGoStringDescriptor(this.Label, "descriptor.FieldDescriptorProto_Label")+",\n") + } + if this.Type != nil { + s = append(s, "Type: "+valueToGoStringDescriptor(this.Type, "descriptor.FieldDescriptorProto_Type")+",\n") + } + if this.TypeName != nil { + s = append(s, "TypeName: "+valueToGoStringDescriptor(this.TypeName, "string")+",\n") + } + if this.Extendee != nil { + s = append(s, "Extendee: "+valueToGoStringDescriptor(this.Extendee, "string")+",\n") + } + if this.DefaultValue != nil { + s = append(s, "DefaultValue: "+valueToGoStringDescriptor(this.DefaultValue, "string")+",\n") + } + if this.OneofIndex != nil { + s = append(s, "OneofIndex: "+valueToGoStringDescriptor(this.OneofIndex, "int32")+",\n") + } + if this.JsonName != nil { + s = append(s, "JsonName: "+valueToGoStringDescriptor(this.JsonName, "string")+",\n") + } + if this.Options != nil { + s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *OneofDescriptorProto) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&descriptor.OneofDescriptorProto{") + if this.Name != nil { + s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") + } + if this.Options != nil { + s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *EnumDescriptorProto) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 7) + s = append(s, "&descriptor.EnumDescriptorProto{") + if this.Name != nil { + s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") + } + if this.Value != nil { + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + } + if this.Options != nil { + s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *EnumValueDescriptorProto) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 7) + s = append(s, "&descriptor.EnumValueDescriptorProto{") + if this.Name != nil { + s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") + } + if this.Number != nil { + s = append(s, "Number: "+valueToGoStringDescriptor(this.Number, "int32")+",\n") + } + if this.Options != nil { + s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *ServiceDescriptorProto) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 7) + s = append(s, "&descriptor.ServiceDescriptorProto{") + if this.Name != nil { + s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") + } + if this.Method != nil { + s = append(s, "Method: "+fmt.Sprintf("%#v", this.Method)+",\n") + } + if this.Options != nil { + s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *MethodDescriptorProto) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 10) + s = append(s, "&descriptor.MethodDescriptorProto{") + if this.Name != nil { + s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") + } + if this.InputType != nil { + s = append(s, "InputType: "+valueToGoStringDescriptor(this.InputType, "string")+",\n") + } + if this.OutputType != nil { + s = append(s, "OutputType: "+valueToGoStringDescriptor(this.OutputType, "string")+",\n") + } + if this.Options != nil { + s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") + } + if this.ClientStreaming != nil { + s = append(s, "ClientStreaming: "+valueToGoStringDescriptor(this.ClientStreaming, "bool")+",\n") + } + if this.ServerStreaming != nil { + s = append(s, "ServerStreaming: "+valueToGoStringDescriptor(this.ServerStreaming, "bool")+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *FileOptions) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 19) + s = append(s, "&descriptor.FileOptions{") + if this.JavaPackage != nil { + s = append(s, "JavaPackage: "+valueToGoStringDescriptor(this.JavaPackage, "string")+",\n") + } + if this.JavaOuterClassname != nil { + s = append(s, "JavaOuterClassname: "+valueToGoStringDescriptor(this.JavaOuterClassname, "string")+",\n") + } + if this.JavaMultipleFiles != nil { + s = append(s, "JavaMultipleFiles: "+valueToGoStringDescriptor(this.JavaMultipleFiles, "bool")+",\n") + } + if this.JavaGenerateEqualsAndHash != nil { + s = append(s, "JavaGenerateEqualsAndHash: "+valueToGoStringDescriptor(this.JavaGenerateEqualsAndHash, "bool")+",\n") + } + if this.JavaStringCheckUtf8 != nil { + s = append(s, "JavaStringCheckUtf8: "+valueToGoStringDescriptor(this.JavaStringCheckUtf8, "bool")+",\n") + } + if this.OptimizeFor != nil { + s = append(s, "OptimizeFor: "+valueToGoStringDescriptor(this.OptimizeFor, "descriptor.FileOptions_OptimizeMode")+",\n") + } + if this.GoPackage != nil { + s = append(s, "GoPackage: "+valueToGoStringDescriptor(this.GoPackage, "string")+",\n") + } + if this.CcGenericServices != nil { + s = append(s, "CcGenericServices: "+valueToGoStringDescriptor(this.CcGenericServices, "bool")+",\n") + } + if this.JavaGenericServices != nil { + s = append(s, "JavaGenericServices: "+valueToGoStringDescriptor(this.JavaGenericServices, "bool")+",\n") + } + if this.PyGenericServices != nil { + s = append(s, "PyGenericServices: "+valueToGoStringDescriptor(this.PyGenericServices, "bool")+",\n") + } + if this.Deprecated != nil { + s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") + } + if this.CcEnableArenas != nil { + s = append(s, "CcEnableArenas: "+valueToGoStringDescriptor(this.CcEnableArenas, "bool")+",\n") + } + if this.ObjcClassPrefix != nil { + s = append(s, "ObjcClassPrefix: "+valueToGoStringDescriptor(this.ObjcClassPrefix, "string")+",\n") + } + if this.CsharpNamespace != nil { + s = append(s, "CsharpNamespace: "+valueToGoStringDescriptor(this.CsharpNamespace, "string")+",\n") + } + if this.UninterpretedOption != nil { + s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") + } + s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *MessageOptions) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 9) + s = append(s, "&descriptor.MessageOptions{") + if this.MessageSetWireFormat != nil { + s = append(s, "MessageSetWireFormat: "+valueToGoStringDescriptor(this.MessageSetWireFormat, "bool")+",\n") + } + if this.NoStandardDescriptorAccessor != nil { + s = append(s, "NoStandardDescriptorAccessor: "+valueToGoStringDescriptor(this.NoStandardDescriptorAccessor, "bool")+",\n") + } + if this.Deprecated != nil { + s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") + } + if this.MapEntry != nil { + s = append(s, "MapEntry: "+valueToGoStringDescriptor(this.MapEntry, "bool")+",\n") + } + if this.UninterpretedOption != nil { + s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") + } + s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *FieldOptions) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 11) + s = append(s, "&descriptor.FieldOptions{") + if this.Ctype != nil { + s = append(s, "Ctype: "+valueToGoStringDescriptor(this.Ctype, "descriptor.FieldOptions_CType")+",\n") + } + if this.Packed != nil { + s = append(s, "Packed: "+valueToGoStringDescriptor(this.Packed, "bool")+",\n") + } + if this.Jstype != nil { + s = append(s, "Jstype: "+valueToGoStringDescriptor(this.Jstype, "descriptor.FieldOptions_JSType")+",\n") + } + if this.Lazy != nil { + s = append(s, "Lazy: "+valueToGoStringDescriptor(this.Lazy, "bool")+",\n") + } + if this.Deprecated != nil { + s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") + } + if this.Weak != nil { + s = append(s, "Weak: "+valueToGoStringDescriptor(this.Weak, "bool")+",\n") + } + if this.UninterpretedOption != nil { + s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") + } + s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *OneofOptions) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&descriptor.OneofOptions{") + if this.UninterpretedOption != nil { + s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") + } + s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *EnumOptions) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 7) + s = append(s, "&descriptor.EnumOptions{") + if this.AllowAlias != nil { + s = append(s, "AllowAlias: "+valueToGoStringDescriptor(this.AllowAlias, "bool")+",\n") + } + if this.Deprecated != nil { + s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") + } + if this.UninterpretedOption != nil { + s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") + } + s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *EnumValueOptions) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&descriptor.EnumValueOptions{") + if this.Deprecated != nil { + s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") + } + if this.UninterpretedOption != nil { + s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") + } + s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *ServiceOptions) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&descriptor.ServiceOptions{") + if this.Deprecated != nil { + s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") + } + if this.UninterpretedOption != nil { + s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") + } + s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *MethodOptions) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&descriptor.MethodOptions{") + if this.Deprecated != nil { + s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") + } + if this.UninterpretedOption != nil { + s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") + } + s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *UninterpretedOption) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 11) + s = append(s, "&descriptor.UninterpretedOption{") + if this.Name != nil { + s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") + } + if this.IdentifierValue != nil { + s = append(s, "IdentifierValue: "+valueToGoStringDescriptor(this.IdentifierValue, "string")+",\n") + } + if this.PositiveIntValue != nil { + s = append(s, "PositiveIntValue: "+valueToGoStringDescriptor(this.PositiveIntValue, "uint64")+",\n") + } + if this.NegativeIntValue != nil { + s = append(s, "NegativeIntValue: "+valueToGoStringDescriptor(this.NegativeIntValue, "int64")+",\n") + } + if this.DoubleValue != nil { + s = append(s, "DoubleValue: "+valueToGoStringDescriptor(this.DoubleValue, "float64")+",\n") + } + if this.StringValue != nil { + s = append(s, "StringValue: "+valueToGoStringDescriptor(this.StringValue, "byte")+",\n") + } + if this.AggregateValue != nil { + s = append(s, "AggregateValue: "+valueToGoStringDescriptor(this.AggregateValue, "string")+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *UninterpretedOption_NamePart) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&descriptor.UninterpretedOption_NamePart{") + if this.NamePart != nil { + s = append(s, "NamePart: "+valueToGoStringDescriptor(this.NamePart, "string")+",\n") + } + if this.IsExtension != nil { + s = append(s, "IsExtension: "+valueToGoStringDescriptor(this.IsExtension, "bool")+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *SourceCodeInfo) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&descriptor.SourceCodeInfo{") + if this.Location != nil { + s = append(s, "Location: "+fmt.Sprintf("%#v", this.Location)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *SourceCodeInfo_Location) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 9) + s = append(s, "&descriptor.SourceCodeInfo_Location{") + if this.Path != nil { + s = append(s, "Path: "+fmt.Sprintf("%#v", this.Path)+",\n") + } + if this.Span != nil { + s = append(s, "Span: "+fmt.Sprintf("%#v", this.Span)+",\n") + } + if this.LeadingComments != nil { + s = append(s, "LeadingComments: "+valueToGoStringDescriptor(this.LeadingComments, "string")+",\n") + } + if this.TrailingComments != nil { + s = append(s, "TrailingComments: "+valueToGoStringDescriptor(this.TrailingComments, "string")+",\n") + } + if this.LeadingDetachedComments != nil { + s = append(s, "LeadingDetachedComments: "+fmt.Sprintf("%#v", this.LeadingDetachedComments)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *GeneratedCodeInfo) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&descriptor.GeneratedCodeInfo{") + if this.Annotation != nil { + s = append(s, "Annotation: "+fmt.Sprintf("%#v", this.Annotation)+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *GeneratedCodeInfo_Annotation) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 8) + s = append(s, "&descriptor.GeneratedCodeInfo_Annotation{") + if this.Path != nil { + s = append(s, "Path: "+fmt.Sprintf("%#v", this.Path)+",\n") + } + if this.SourceFile != nil { + s = append(s, "SourceFile: "+valueToGoStringDescriptor(this.SourceFile, "string")+",\n") + } + if this.Begin != nil { + s = append(s, "Begin: "+valueToGoStringDescriptor(this.Begin, "int32")+",\n") + } + if this.End != nil { + s = append(s, "End: "+valueToGoStringDescriptor(this.End, "int32")+",\n") + } + if this.XXX_unrecognized != nil { + s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringDescriptor(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func extensionToGoStringDescriptor(m github_com_gogo_protobuf_proto.Message) string { + e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) + if e == nil { + return "nil" + } + s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" + keys := make([]int, 0, len(e)) + for k := range e { + keys = append(keys, int(k)) + } + sort.Ints(keys) + ss := []string{} + for _, k := range keys { + ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) + } + s += strings.Join(ss, ",") + "})" + return s +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/helper.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/helper.go new file mode 100644 index 00000000000..861f4d028d8 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/helper.go @@ -0,0 +1,357 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package descriptor + +import ( + "strings" +) + +func (msg *DescriptorProto) GetMapFields() (*FieldDescriptorProto, *FieldDescriptorProto) { + if !msg.GetOptions().GetMapEntry() { + return nil, nil + } + return msg.GetField()[0], msg.GetField()[1] +} + +func dotToUnderscore(r rune) rune { + if r == '.' { + return '_' + } + return r +} + +func (field *FieldDescriptorProto) WireType() (wire int) { + switch *field.Type { + case FieldDescriptorProto_TYPE_DOUBLE: + return 1 + case FieldDescriptorProto_TYPE_FLOAT: + return 5 + case FieldDescriptorProto_TYPE_INT64: + return 0 + case FieldDescriptorProto_TYPE_UINT64: + return 0 + case FieldDescriptorProto_TYPE_INT32: + return 0 + case FieldDescriptorProto_TYPE_UINT32: + return 0 + case FieldDescriptorProto_TYPE_FIXED64: + return 1 + case FieldDescriptorProto_TYPE_FIXED32: + return 5 + case FieldDescriptorProto_TYPE_BOOL: + return 0 + case FieldDescriptorProto_TYPE_STRING: + return 2 + case FieldDescriptorProto_TYPE_GROUP: + return 2 + case FieldDescriptorProto_TYPE_MESSAGE: + return 2 + case FieldDescriptorProto_TYPE_BYTES: + return 2 + case FieldDescriptorProto_TYPE_ENUM: + return 0 + case FieldDescriptorProto_TYPE_SFIXED32: + return 5 + case FieldDescriptorProto_TYPE_SFIXED64: + return 1 + case FieldDescriptorProto_TYPE_SINT32: + return 0 + case FieldDescriptorProto_TYPE_SINT64: + return 0 + } + panic("unreachable") +} + +func (field *FieldDescriptorProto) GetKeyUint64() (x uint64) { + packed := field.IsPacked() + wireType := field.WireType() + fieldNumber := field.GetNumber() + if packed { + wireType = 2 + } + x = uint64(uint32(fieldNumber)<<3 | uint32(wireType)) + return x +} + +func (field *FieldDescriptorProto) GetKey() []byte { + x := field.GetKeyUint64() + i := 0 + keybuf := make([]byte, 0) + for i = 0; x > 127; i++ { + keybuf = append(keybuf, 0x80|uint8(x&0x7F)) + x >>= 7 + } + keybuf = append(keybuf, uint8(x)) + return keybuf +} + +func (desc *FileDescriptorSet) GetField(packageName, messageName, fieldName string) *FieldDescriptorProto { + msg := desc.GetMessage(packageName, messageName) + if msg == nil { + return nil + } + for _, field := range msg.GetField() { + if field.GetName() == fieldName { + return field + } + } + return nil +} + +func (file *FileDescriptorProto) GetMessage(typeName string) *DescriptorProto { + for _, msg := range file.GetMessageType() { + if msg.GetName() == typeName { + return msg + } + nes := file.GetNestedMessage(msg, strings.TrimPrefix(typeName, msg.GetName()+".")) + if nes != nil { + return nes + } + } + return nil +} + +func (file *FileDescriptorProto) GetNestedMessage(msg *DescriptorProto, typeName string) *DescriptorProto { + for _, nes := range msg.GetNestedType() { + if nes.GetName() == typeName { + return nes + } + res := file.GetNestedMessage(nes, strings.TrimPrefix(typeName, nes.GetName()+".")) + if res != nil { + return res + } + } + return nil +} + +func (desc *FileDescriptorSet) GetMessage(packageName string, typeName string) *DescriptorProto { + for _, file := range desc.GetFile() { + if strings.Map(dotToUnderscore, file.GetPackage()) != strings.Map(dotToUnderscore, packageName) { + continue + } + for _, msg := range file.GetMessageType() { + if msg.GetName() == typeName { + return msg + } + } + for _, msg := range file.GetMessageType() { + for _, nes := range msg.GetNestedType() { + if nes.GetName() == typeName { + return nes + } + if msg.GetName()+"."+nes.GetName() == typeName { + return nes + } + } + } + } + return nil +} + +func (desc *FileDescriptorSet) IsProto3(packageName string, typeName string) bool { + for _, file := range desc.GetFile() { + if strings.Map(dotToUnderscore, file.GetPackage()) != strings.Map(dotToUnderscore, packageName) { + continue + } + for _, msg := range file.GetMessageType() { + if msg.GetName() == typeName { + return file.GetSyntax() == "proto3" + } + } + for _, msg := range file.GetMessageType() { + for _, nes := range msg.GetNestedType() { + if nes.GetName() == typeName { + return file.GetSyntax() == "proto3" + } + if msg.GetName()+"."+nes.GetName() == typeName { + return file.GetSyntax() == "proto3" + } + } + } + } + return false +} + +func (msg *DescriptorProto) IsExtendable() bool { + return len(msg.GetExtensionRange()) > 0 +} + +func (desc *FileDescriptorSet) FindExtension(packageName string, typeName string, fieldName string) (extPackageName string, field *FieldDescriptorProto) { + parent := desc.GetMessage(packageName, typeName) + if parent == nil { + return "", nil + } + if !parent.IsExtendable() { + return "", nil + } + extendee := "." + packageName + "." + typeName + for _, file := range desc.GetFile() { + for _, ext := range file.GetExtension() { + if strings.Map(dotToUnderscore, file.GetPackage()) == strings.Map(dotToUnderscore, packageName) { + if !(ext.GetExtendee() == typeName || ext.GetExtendee() == extendee) { + continue + } + } else { + if ext.GetExtendee() != extendee { + continue + } + } + if ext.GetName() == fieldName { + return file.GetPackage(), ext + } + } + } + return "", nil +} + +func (desc *FileDescriptorSet) FindExtensionByFieldNumber(packageName string, typeName string, fieldNum int32) (extPackageName string, field *FieldDescriptorProto) { + parent := desc.GetMessage(packageName, typeName) + if parent == nil { + return "", nil + } + if !parent.IsExtendable() { + return "", nil + } + extendee := "." + packageName + "." + typeName + for _, file := range desc.GetFile() { + for _, ext := range file.GetExtension() { + if strings.Map(dotToUnderscore, file.GetPackage()) == strings.Map(dotToUnderscore, packageName) { + if !(ext.GetExtendee() == typeName || ext.GetExtendee() == extendee) { + continue + } + } else { + if ext.GetExtendee() != extendee { + continue + } + } + if ext.GetNumber() == fieldNum { + return file.GetPackage(), ext + } + } + } + return "", nil +} + +func (desc *FileDescriptorSet) FindMessage(packageName string, typeName string, fieldName string) (msgPackageName string, msgName string) { + parent := desc.GetMessage(packageName, typeName) + if parent == nil { + return "", "" + } + field := parent.GetFieldDescriptor(fieldName) + if field == nil { + var extPackageName string + extPackageName, field = desc.FindExtension(packageName, typeName, fieldName) + if field == nil { + return "", "" + } + packageName = extPackageName + } + typeNames := strings.Split(field.GetTypeName(), ".") + if len(typeNames) == 1 { + msg := desc.GetMessage(packageName, typeName) + if msg == nil { + return "", "" + } + return packageName, msg.GetName() + } + if len(typeNames) > 2 { + for i := 1; i < len(typeNames)-1; i++ { + packageName = strings.Join(typeNames[1:len(typeNames)-i], ".") + typeName = strings.Join(typeNames[len(typeNames)-i:], ".") + msg := desc.GetMessage(packageName, typeName) + if msg != nil { + typeNames := strings.Split(msg.GetName(), ".") + if len(typeNames) == 1 { + return packageName, msg.GetName() + } + return strings.Join(typeNames[1:len(typeNames)-1], "."), typeNames[len(typeNames)-1] + } + } + } + return "", "" +} + +func (msg *DescriptorProto) GetFieldDescriptor(fieldName string) *FieldDescriptorProto { + for _, field := range msg.GetField() { + if field.GetName() == fieldName { + return field + } + } + return nil +} + +func (desc *FileDescriptorSet) GetEnum(packageName string, typeName string) *EnumDescriptorProto { + for _, file := range desc.GetFile() { + if strings.Map(dotToUnderscore, file.GetPackage()) != strings.Map(dotToUnderscore, packageName) { + continue + } + for _, enum := range file.GetEnumType() { + if enum.GetName() == typeName { + return enum + } + } + } + return nil +} + +func (f *FieldDescriptorProto) IsEnum() bool { + return *f.Type == FieldDescriptorProto_TYPE_ENUM +} + +func (f *FieldDescriptorProto) IsMessage() bool { + return *f.Type == FieldDescriptorProto_TYPE_MESSAGE +} + +func (f *FieldDescriptorProto) IsBytes() bool { + return *f.Type == FieldDescriptorProto_TYPE_BYTES +} + +func (f *FieldDescriptorProto) IsRepeated() bool { + return f.Label != nil && *f.Label == FieldDescriptorProto_LABEL_REPEATED +} + +func (f *FieldDescriptorProto) IsString() bool { + return *f.Type == FieldDescriptorProto_TYPE_STRING +} + +func (f *FieldDescriptorProto) IsBool() bool { + return *f.Type == FieldDescriptorProto_TYPE_BOOL +} + +func (f *FieldDescriptorProto) IsRequired() bool { + return f.Label != nil && *f.Label == FieldDescriptorProto_LABEL_REQUIRED +} + +func (f *FieldDescriptorProto) IsPacked() bool { + return f.Options != nil && f.GetOptions().GetPacked() +} + +func (m *DescriptorProto) HasExtension() bool { + return len(m.ExtensionRange) > 0 +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/doc.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/doc.go new file mode 100644 index 00000000000..15c7cf43c28 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/doc.go @@ -0,0 +1,51 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +/* + A plugin for the Google protocol buffer compiler to generate Go code. + Run it by building this program and putting it in your path with the name + protoc-gen-gogo + That word 'gogo' at the end becomes part of the option string set for the + protocol compiler, so once the protocol compiler (protoc) is installed + you can run + protoc --gogo_out=output_directory input_directory/file.proto + to generate Go bindings for the protocol defined by file.proto. + With that input, the output will be written to + output_directory/go_package/file.pb.go + + The generated code is documented in the package comment for + the library. + + See the README and documentation for protocol buffers to learn more: + https://developers.google.com/protocol-buffers/ + +*/ +package documentation diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/generator/generator.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/generator/generator.go new file mode 100644 index 00000000000..566454bdc20 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/generator/generator.go @@ -0,0 +1,3318 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +/* + The code generator for the plugin for the Google protocol buffer compiler. + It generates Go code from the protocol buffer description files read by the + main routine. +*/ +package generator + +import ( + "bufio" + "bytes" + "compress/gzip" + "fmt" + "go/parser" + "go/printer" + "go/token" + "log" + "os" + "path" + "sort" + "strconv" + "strings" + "unicode" + "unicode/utf8" + + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/proto" + descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" + plugin "github.com/gogo/protobuf/protoc-gen-gogo/plugin" +) + +// generatedCodeVersion indicates a version of the generated code. +// It is incremented whenever an incompatibility between the generated code and +// proto package is introduced; the generated code references +// a constant, proto.ProtoPackageIsVersionN (where N is generatedCodeVersion). +const generatedCodeVersion = 2 + +// A Plugin provides functionality to add to the output during Go code generation, +// such as to produce RPC stubs. +type Plugin interface { + // Name identifies the plugin. + Name() string + // Init is called once after data structures are built but before + // code generation begins. + Init(g *Generator) + // Generate produces the code generated by the plugin for this file, + // except for the imports, by calling the generator's methods P, In, and Out. + Generate(file *FileDescriptor) + // GenerateImports produces the import declarations for this file. + // It is called after Generate. + GenerateImports(file *FileDescriptor) +} + +type pluginSlice []Plugin + +func (ps pluginSlice) Len() int { + return len(ps) +} + +func (ps pluginSlice) Less(i, j int) bool { + return ps[i].Name() < ps[j].Name() +} + +func (ps pluginSlice) Swap(i, j int) { + ps[i], ps[j] = ps[j], ps[i] +} + +var plugins pluginSlice + +// RegisterPlugin installs a (second-order) plugin to be run when the Go output is generated. +// It is typically called during initialization. +func RegisterPlugin(p Plugin) { + plugins = append(plugins, p) +} + +// Each type we import as a protocol buffer (other than FileDescriptorProto) needs +// a pointer to the FileDescriptorProto that represents it. These types achieve that +// wrapping by placing each Proto inside a struct with the pointer to its File. The +// structs have the same names as their contents, with "Proto" removed. +// FileDescriptor is used to store the things that it points to. + +// The file and package name method are common to messages and enums. +type common struct { + file *descriptor.FileDescriptorProto // File this object comes from. +} + +// PackageName is name in the package clause in the generated file. +func (c *common) PackageName() string { return uniquePackageOf(c.file) } + +func (c *common) File() *descriptor.FileDescriptorProto { return c.file } + +func fileIsProto3(file *descriptor.FileDescriptorProto) bool { + return file.GetSyntax() == "proto3" +} + +func (c *common) proto3() bool { return fileIsProto3(c.file) } + +// Descriptor represents a protocol buffer message. +type Descriptor struct { + common + *descriptor.DescriptorProto + parent *Descriptor // The containing message, if any. + nested []*Descriptor // Inner messages, if any. + enums []*EnumDescriptor // Inner enums, if any. + ext []*ExtensionDescriptor // Extensions, if any. + typename []string // Cached typename vector. + index int // The index into the container, whether the file or another message. + path string // The SourceCodeInfo path as comma-separated integers. + group bool +} + +// TypeName returns the elements of the dotted type name. +// The package name is not part of this name. +func (d *Descriptor) TypeName() []string { + if d.typename != nil { + return d.typename + } + n := 0 + for parent := d; parent != nil; parent = parent.parent { + n++ + } + s := make([]string, n, n) + for parent := d; parent != nil; parent = parent.parent { + n-- + s[n] = parent.GetName() + } + d.typename = s + return s +} + +func (d *Descriptor) allowOneof() bool { + return true +} + +// EnumDescriptor describes an enum. If it's at top level, its parent will be nil. +// Otherwise it will be the descriptor of the message in which it is defined. +type EnumDescriptor struct { + common + *descriptor.EnumDescriptorProto + parent *Descriptor // The containing message, if any. + typename []string // Cached typename vector. + index int // The index into the container, whether the file or a message. + path string // The SourceCodeInfo path as comma-separated integers. +} + +// TypeName returns the elements of the dotted type name. +// The package name is not part of this name. +func (e *EnumDescriptor) TypeName() (s []string) { + if e.typename != nil { + return e.typename + } + name := e.GetName() + if e.parent == nil { + s = make([]string, 1) + } else { + pname := e.parent.TypeName() + s = make([]string, len(pname)+1) + copy(s, pname) + } + s[len(s)-1] = name + e.typename = s + return s +} + +// alias provides the TypeName corrected for the application of any naming +// extensions on the enum type. It should be used for generating references to +// the Go types and for calculating prefixes. +func (e *EnumDescriptor) alias() (s []string) { + s = e.TypeName() + if gogoproto.IsEnumCustomName(e.EnumDescriptorProto) { + s[len(s)-1] = gogoproto.GetEnumCustomName(e.EnumDescriptorProto) + } + + return +} + +// Everything but the last element of the full type name, CamelCased. +// The values of type Foo.Bar are call Foo_value1... not Foo_Bar_value1... . +func (e *EnumDescriptor) prefix() string { + typeName := e.alias() + if e.parent == nil { + // If the enum is not part of a message, the prefix is just the type name. + return CamelCase(typeName[len(typeName)-1]) + "_" + } + return CamelCaseSlice(typeName[0:len(typeName)-1]) + "_" +} + +// The integer value of the named constant in this enumerated type. +func (e *EnumDescriptor) integerValueAsString(name string) string { + for _, c := range e.Value { + if c.GetName() == name { + return fmt.Sprint(c.GetNumber()) + } + } + log.Fatal("cannot find value for enum constant") + return "" +} + +// ExtensionDescriptor describes an extension. If it's at top level, its parent will be nil. +// Otherwise it will be the descriptor of the message in which it is defined. +type ExtensionDescriptor struct { + common + *descriptor.FieldDescriptorProto + parent *Descriptor // The containing message, if any. +} + +// TypeName returns the elements of the dotted type name. +// The package name is not part of this name. +func (e *ExtensionDescriptor) TypeName() (s []string) { + name := e.GetName() + if e.parent == nil { + // top-level extension + s = make([]string, 1) + } else { + pname := e.parent.TypeName() + s = make([]string, len(pname)+1) + copy(s, pname) + } + s[len(s)-1] = name + return s +} + +// DescName returns the variable name used for the generated descriptor. +func (e *ExtensionDescriptor) DescName() string { + // The full type name. + typeName := e.TypeName() + // Each scope of the extension is individually CamelCased, and all are joined with "_" with an "E_" prefix. + for i, s := range typeName { + typeName[i] = CamelCase(s) + } + return "E_" + strings.Join(typeName, "_") +} + +// ImportedDescriptor describes a type that has been publicly imported from another file. +type ImportedDescriptor struct { + common + o Object +} + +func (id *ImportedDescriptor) TypeName() []string { return id.o.TypeName() } + +// FileDescriptor describes an protocol buffer descriptor file (.proto). +// It includes slices of all the messages and enums defined within it. +// Those slices are constructed by WrapTypes. +type FileDescriptor struct { + *descriptor.FileDescriptorProto + desc []*Descriptor // All the messages defined in this file. + enum []*EnumDescriptor // All the enums defined in this file. + ext []*ExtensionDescriptor // All the top-level extensions defined in this file. + imp []*ImportedDescriptor // All types defined in files publicly imported by this file. + + // Comments, stored as a map of path (comma-separated integers) to the comment. + comments map[string]*descriptor.SourceCodeInfo_Location + + // The full list of symbols that are exported, + // as a map from the exported object to its symbols. + // This is used for supporting public imports. + exported map[Object][]symbol + + index int // The index of this file in the list of files to generate code for + + proto3 bool // whether to generate proto3 code for this file +} + +// PackageName is the package name we'll use in the generated code to refer to this file. +func (d *FileDescriptor) PackageName() string { return uniquePackageOf(d.FileDescriptorProto) } + +// VarName is the variable name we'll use in the generated code to refer +// to the compressed bytes of this descriptor. It is not exported, so +// it is only valid inside the generated package. +func (d *FileDescriptor) VarName() string { return fmt.Sprintf("fileDescriptor%v", FileName(d)) } + +// goPackageOption interprets the file's go_package option. +// If there is no go_package, it returns ("", "", false). +// If there's a simple name, it returns ("", pkg, true). +// If the option implies an import path, it returns (impPath, pkg, true). +func (d *FileDescriptor) goPackageOption() (impPath, pkg string, ok bool) { + pkg = d.GetOptions().GetGoPackage() + if pkg == "" { + return + } + ok = true + // The presence of a slash implies there's an import path. + slash := strings.LastIndex(pkg, "/") + if slash < 0 { + return + } + impPath, pkg = pkg, pkg[slash+1:] + // A semicolon-delimited suffix overrides the package name. + sc := strings.IndexByte(impPath, ';') + if sc < 0 { + return + } + impPath, pkg = impPath[:sc], impPath[sc+1:] + return +} + +// goPackageName returns the Go package name to use in the +// generated Go file. The result explicit reports whether the name +// came from an option go_package statement. If explicit is false, +// the name was derived from the protocol buffer's package statement +// or the input file name. +func (d *FileDescriptor) goPackageName() (name string, explicit bool) { + // Does the file have a "go_package" option? + if _, pkg, ok := d.goPackageOption(); ok { + return pkg, true + } + + // Does the file have a package clause? + if pkg := d.GetPackage(); pkg != "" { + return pkg, false + } + // Use the file base name. + return baseName(d.GetName()), false +} + +// goFileName returns the output name for the generated Go file. +func (d *FileDescriptor) goFileName() string { + name := *d.Name + if ext := path.Ext(name); ext == ".proto" || ext == ".protodevel" { + name = name[:len(name)-len(ext)] + } + name += ".pb.go" + + // Does the file have a "go_package" option? + // If it does, it may override the filename. + if impPath, _, ok := d.goPackageOption(); ok && impPath != "" { + // Replace the existing dirname with the declared import path. + _, name = path.Split(name) + name = path.Join(impPath, name) + return name + } + + return name +} + +func (d *FileDescriptor) addExport(obj Object, sym symbol) { + d.exported[obj] = append(d.exported[obj], sym) +} + +// symbol is an interface representing an exported Go symbol. +type symbol interface { + // GenerateAlias should generate an appropriate alias + // for the symbol from the named package. + GenerateAlias(g *Generator, pkg string) +} + +type messageSymbol struct { + sym string + hasExtensions, isMessageSet bool + hasOneof bool + getters []getterSymbol +} + +type getterSymbol struct { + name string + typ string + typeName string // canonical name in proto world; empty for proto.Message and similar + genType bool // whether typ contains a generated type (message/group/enum) +} + +func (ms *messageSymbol) GenerateAlias(g *Generator, pkg string) { + remoteSym := pkg + "." + ms.sym + + g.P("type ", ms.sym, " ", remoteSym) + g.P("func (m *", ms.sym, ") Reset() { (*", remoteSym, ")(m).Reset() }") + g.P("func (m *", ms.sym, ") String() string { return (*", remoteSym, ")(m).String() }") + g.P("func (*", ms.sym, ") ProtoMessage() {}") + if ms.hasExtensions { + g.P("func (*", ms.sym, ") ExtensionRangeArray() []", g.Pkg["proto"], ".ExtensionRange ", + "{ return (*", remoteSym, ")(nil).ExtensionRangeArray() }") + if ms.isMessageSet { + g.P("func (m *", ms.sym, ") Marshal() ([]byte, error) ", + "{ return (*", remoteSym, ")(m).Marshal() }") + g.P("func (m *", ms.sym, ") Unmarshal(buf []byte) error ", + "{ return (*", remoteSym, ")(m).Unmarshal(buf) }") + } + } + if ms.hasOneof { + // Oneofs and public imports do not mix well. + // We can make them work okay for the binary format, + // but they're going to break weirdly for text/JSON. + enc := "_" + ms.sym + "_OneofMarshaler" + dec := "_" + ms.sym + "_OneofUnmarshaler" + size := "_" + ms.sym + "_OneofSizer" + encSig := "(msg " + g.Pkg["proto"] + ".Message, b *" + g.Pkg["proto"] + ".Buffer) error" + decSig := "(msg " + g.Pkg["proto"] + ".Message, tag, wire int, b *" + g.Pkg["proto"] + ".Buffer) (bool, error)" + sizeSig := "(msg " + g.Pkg["proto"] + ".Message) int" + g.P("func (m *", ms.sym, ") XXX_OneofFuncs() (func", encSig, ", func", decSig, ", func", sizeSig, ", []interface{}) {") + g.P("return ", enc, ", ", dec, ", ", size, ", nil") + g.P("}") + + g.P("func ", enc, encSig, " {") + g.P("m := msg.(*", ms.sym, ")") + g.P("m0 := (*", remoteSym, ")(m)") + g.P("enc, _, _, _ := m0.XXX_OneofFuncs()") + g.P("return enc(m0, b)") + g.P("}") + + g.P("func ", dec, decSig, " {") + g.P("m := msg.(*", ms.sym, ")") + g.P("m0 := (*", remoteSym, ")(m)") + g.P("_, dec, _, _ := m0.XXX_OneofFuncs()") + g.P("return dec(m0, tag, wire, b)") + g.P("}") + + g.P("func ", size, sizeSig, " {") + g.P("m := msg.(*", ms.sym, ")") + g.P("m0 := (*", remoteSym, ")(m)") + g.P("_, _, size, _ := m0.XXX_OneofFuncs()") + g.P("return size(m0)") + g.P("}") + } + for _, get := range ms.getters { + + if get.typeName != "" { + g.RecordTypeUse(get.typeName) + } + typ := get.typ + val := "(*" + remoteSym + ")(m)." + get.name + "()" + if get.genType { + // typ will be "*pkg.T" (message/group) or "pkg.T" (enum) + // or "map[t]*pkg.T" (map to message/enum). + // The first two of those might have a "[]" prefix if it is repeated. + // Drop any package qualifier since we have hoisted the type into this package. + rep := strings.HasPrefix(typ, "[]") + if rep { + typ = typ[2:] + } + isMap := strings.HasPrefix(typ, "map[") + star := typ[0] == '*' + if !isMap { // map types handled lower down + typ = typ[strings.Index(typ, ".")+1:] + } + if star { + typ = "*" + typ + } + if rep { + // Go does not permit conversion between slice types where both + // element types are named. That means we need to generate a bit + // of code in this situation. + // typ is the element type. + // val is the expression to get the slice from the imported type. + + ctyp := typ // conversion type expression; "Foo" or "(*Foo)" + if star { + ctyp = "(" + typ + ")" + } + + g.P("func (m *", ms.sym, ") ", get.name, "() []", typ, " {") + g.In() + g.P("o := ", val) + g.P("if o == nil {") + g.In() + g.P("return nil") + g.Out() + g.P("}") + g.P("s := make([]", typ, ", len(o))") + g.P("for i, x := range o {") + g.In() + g.P("s[i] = ", ctyp, "(x)") + g.Out() + g.P("}") + g.P("return s") + g.Out() + g.P("}") + continue + } + if isMap { + // Split map[keyTyp]valTyp. + bra, ket := strings.Index(typ, "["), strings.Index(typ, "]") + keyTyp, valTyp := typ[bra+1:ket], typ[ket+1:] + // Drop any package qualifier. + // Only the value type may be foreign. + star := valTyp[0] == '*' + valTyp = valTyp[strings.Index(valTyp, ".")+1:] + if star { + valTyp = "*" + valTyp + } + + maptyp := "map[" + keyTyp + "]" + valTyp + g.P("func (m *", ms.sym, ") ", get.name, "() ", typ, " {") + g.P("o := ", val) + g.P("if o == nil { return nil }") + g.P("s := make(", maptyp, ", len(o))") + g.P("for k, v := range o {") + g.P("s[k] = (", valTyp, ")(v)") + g.P("}") + g.P("return s") + g.P("}") + continue + } + // Convert imported type into the forwarding type. + val = "(" + typ + ")(" + val + ")" + } + + g.P("func (m *", ms.sym, ") ", get.name, "() ", typ, " { return ", val, " }") + } + +} + +type enumSymbol struct { + name string + proto3 bool // Whether this came from a proto3 file. +} + +func (es enumSymbol) GenerateAlias(g *Generator, pkg string) { + s := es.name + g.P("type ", s, " ", pkg, ".", s) + g.P("var ", s, "_name = ", pkg, ".", s, "_name") + g.P("var ", s, "_value = ", pkg, ".", s, "_value") + g.P("func (x ", s, ") String() string { return (", pkg, ".", s, ")(x).String() }") + if !es.proto3 { + g.P("func (x ", s, ") Enum() *", s, "{ return (*", s, ")((", pkg, ".", s, ")(x).Enum()) }") + g.P("func (x *", s, ") UnmarshalJSON(data []byte) error { return (*", pkg, ".", s, ")(x).UnmarshalJSON(data) }") + } +} + +type constOrVarSymbol struct { + sym string + typ string // either "const" or "var" + cast string // if non-empty, a type cast is required (used for enums) +} + +func (cs constOrVarSymbol) GenerateAlias(g *Generator, pkg string) { + v := pkg + "." + cs.sym + if cs.cast != "" { + v = cs.cast + "(" + v + ")" + } + g.P(cs.typ, " ", cs.sym, " = ", v) +} + +// Object is an interface abstracting the abilities shared by enums, messages, extensions and imported objects. +type Object interface { + PackageName() string // The name we use in our output (a_b_c), possibly renamed for uniqueness. + TypeName() []string + File() *descriptor.FileDescriptorProto +} + +// Each package name we generate must be unique. The package we're generating +// gets its own name but every other package must have a unique name that does +// not conflict in the code we generate. These names are chosen globally (although +// they don't have to be, it simplifies things to do them globally). +func uniquePackageOf(fd *descriptor.FileDescriptorProto) string { + s, ok := uniquePackageName[fd] + if !ok { + log.Fatal("internal error: no package name defined for " + fd.GetName()) + } + return s +} + +// Generator is the type whose methods generate the output, stored in the associated response structure. +type Generator struct { + *bytes.Buffer + + Request *plugin.CodeGeneratorRequest // The input. + Response *plugin.CodeGeneratorResponse // The output. + + Param map[string]string // Command-line parameters. + PackageImportPath string // Go import path of the package we're generating code for + ImportPrefix string // String to prefix to imported package file names. + ImportMap map[string]string // Mapping from .proto file name to import path + + Pkg map[string]string // The names under which we import support packages + + packageName string // What we're calling ourselves. + allFiles []*FileDescriptor // All files in the tree + allFilesByName map[string]*FileDescriptor // All files by filename. + genFiles []*FileDescriptor // Those files we will generate output for. + file *FileDescriptor // The file we are compiling now. + usedPackages map[string]bool // Names of packages used in current file. + typeNameToObject map[string]Object // Key is a fully-qualified name in input syntax. + init []string // Lines to emit in the init function. + indent string + writeOutput bool + + customImports []string + writtenImports map[string]bool // For de-duplicating written imports +} + +// New creates a new generator and allocates the request and response protobufs. +func New() *Generator { + g := new(Generator) + g.Buffer = new(bytes.Buffer) + g.Request = new(plugin.CodeGeneratorRequest) + g.Response = new(plugin.CodeGeneratorResponse) + g.writtenImports = make(map[string]bool) + uniquePackageName = make(map[*descriptor.FileDescriptorProto]string) + pkgNamesInUse = make(map[string][]*FileDescriptor) + return g +} + +// Error reports a problem, including an error, and exits the program. +func (g *Generator) Error(err error, msgs ...string) { + s := strings.Join(msgs, " ") + ":" + err.Error() + log.Print("protoc-gen-gogo: error:", s) + os.Exit(1) +} + +// Fail reports a problem and exits the program. +func (g *Generator) Fail(msgs ...string) { + s := strings.Join(msgs, " ") + log.Print("protoc-gen-gogo: error:", s) + os.Exit(1) +} + +// CommandLineParameters breaks the comma-separated list of key=value pairs +// in the parameter (a member of the request protobuf) into a key/value map. +// It then sets file name mappings defined by those entries. +func (g *Generator) CommandLineParameters(parameter string) { + g.Param = make(map[string]string) + for _, p := range strings.Split(parameter, ",") { + if i := strings.Index(p, "="); i < 0 { + g.Param[p] = "" + } else { + g.Param[p[0:i]] = p[i+1:] + } + } + + g.ImportMap = make(map[string]string) + pluginList := "none" // Default list of plugin names to enable (empty means all). + for k, v := range g.Param { + switch k { + case "import_prefix": + g.ImportPrefix = v + case "import_path": + g.PackageImportPath = v + case "plugins": + pluginList = v + default: + if len(k) > 0 && k[0] == 'M' { + g.ImportMap[k[1:]] = v + } + } + } + if pluginList == "" { + return + } + if pluginList == "none" { + pluginList = "" + } + gogoPluginNames := []string{"unmarshal", "unsafeunmarshaler", "union", "stringer", "size", "protosizer", "populate", "marshalto", "unsafemarshaler", "gostring", "face", "equal", "enumstringer", "embedcheck", "description", "defaultcheck", "oneofcheck", "compare"} + pluginList = strings.Join(append(gogoPluginNames, pluginList), "+") + if pluginList != "" { + // Amend the set of plugins. + enabled := make(map[string]bool) + for _, name := range strings.Split(pluginList, "+") { + enabled[name] = true + } + var nplugins pluginSlice + for _, p := range plugins { + if enabled[p.Name()] { + nplugins = append(nplugins, p) + } + } + sort.Sort(nplugins) + plugins = nplugins + } +} + +// DefaultPackageName returns the package name printed for the object. +// If its file is in a different package, it returns the package name we're using for this file, plus ".". +// Otherwise it returns the empty string. +func (g *Generator) DefaultPackageName(obj Object) string { + pkg := obj.PackageName() + if pkg == g.packageName { + return "" + } + return pkg + "." +} + +// For each input file, the unique package name to use, underscored. +var uniquePackageName = make(map[*descriptor.FileDescriptorProto]string) + +// Package names already registered. Key is the name from the .proto file; +// value is the name that appears in the generated code. +var pkgNamesInUse = make(map[string][]*FileDescriptor) + +// Create and remember a guaranteed unique package name for this file descriptor. +// Pkg is the candidate name. If f is nil, it's a builtin package like "proto" and +// has no file descriptor. +func RegisterUniquePackageName(pkg string, f *FileDescriptor) string { + // Convert dots to underscores before finding a unique alias. + pkg = strings.Map(badToUnderscore, pkg) + + var i = -1 + var ptr *FileDescriptor = nil + for i, ptr = range pkgNamesInUse[pkg] { + if ptr == f { + if i == 0 { + return pkg + } + return pkg + strconv.Itoa(i) + } + } + + pkgNamesInUse[pkg] = append(pkgNamesInUse[pkg], f) + i += 1 + + if i > 0 { + pkg = pkg + strconv.Itoa(i) + } + + if f != nil { + uniquePackageName[f.FileDescriptorProto] = pkg + } + return pkg +} + +var isGoKeyword = map[string]bool{ + "break": true, + "case": true, + "chan": true, + "const": true, + "continue": true, + "default": true, + "else": true, + "defer": true, + "fallthrough": true, + "for": true, + "func": true, + "go": true, + "goto": true, + "if": true, + "import": true, + "interface": true, + "map": true, + "package": true, + "range": true, + "return": true, + "select": true, + "struct": true, + "switch": true, + "type": true, + "var": true, +} + +// defaultGoPackage returns the package name to use, +// derived from the import path of the package we're building code for. +func (g *Generator) defaultGoPackage() string { + p := g.PackageImportPath + if i := strings.LastIndex(p, "/"); i >= 0 { + p = p[i+1:] + } + if p == "" { + return "" + } + + p = strings.Map(badToUnderscore, p) + // Identifier must not be keyword: insert _. + if isGoKeyword[p] { + p = "_" + p + } + // Identifier must not begin with digit: insert _. + if r, _ := utf8.DecodeRuneInString(p); unicode.IsDigit(r) { + p = "_" + p + } + return p +} + +// SetPackageNames sets the package name for this run. +// The package name must agree across all files being generated. +// It also defines unique package names for all imported files. +func (g *Generator) SetPackageNames() { + // Register the name for this package. It will be the first name + // registered so is guaranteed to be unmodified. + pkg, explicit := g.genFiles[0].goPackageName() + + // Check all files for an explicit go_package option. + for _, f := range g.genFiles { + thisPkg, thisExplicit := f.goPackageName() + if thisExplicit { + if !explicit { + // Let this file's go_package option serve for all input files. + pkg, explicit = thisPkg, true + } else if thisPkg != pkg { + g.Fail("inconsistent package names:", thisPkg, pkg) + } + } + } + + // If we don't have an explicit go_package option but we have an + // import path, use that. + if !explicit { + p := g.defaultGoPackage() + if p != "" { + pkg, explicit = p, true + } + } + + // If there was no go_package and no import path to use, + // double-check that all the inputs have the same implicit + // Go package name. + if !explicit { + for _, f := range g.genFiles { + thisPkg, _ := f.goPackageName() + if thisPkg != pkg { + g.Fail("inconsistent package names:", thisPkg, pkg) + } + } + } + + g.packageName = RegisterUniquePackageName(pkg, g.genFiles[0]) + + // Register the support package names. They might collide with the + // name of a package we import. + g.Pkg = map[string]string{ + "fmt": RegisterUniquePackageName("fmt", nil), + "math": RegisterUniquePackageName("math", nil), + "proto": RegisterUniquePackageName("proto", nil), + } + +AllFiles: + for _, f := range g.allFiles { + for _, genf := range g.genFiles { + if f == genf { + // In this package already. + uniquePackageName[f.FileDescriptorProto] = g.packageName + continue AllFiles + } + } + // The file is a dependency, so we want to ignore its go_package option + // because that is only relevant for its specific generated output. + pkg := f.GetPackage() + if pkg == "" { + pkg = baseName(*f.Name) + } + RegisterUniquePackageName(pkg, f) + } +} + +// WrapTypes walks the incoming data, wrapping DescriptorProtos, EnumDescriptorProtos +// and FileDescriptorProtos into file-referenced objects within the Generator. +// It also creates the list of files to generate and so should be called before GenerateAllFiles. +func (g *Generator) WrapTypes() { + g.allFiles = make([]*FileDescriptor, 0, len(g.Request.ProtoFile)) + g.allFilesByName = make(map[string]*FileDescriptor, len(g.allFiles)) + for _, f := range g.Request.ProtoFile { + // We must wrap the descriptors before we wrap the enums + descs := wrapDescriptors(f) + g.buildNestedDescriptors(descs) + enums := wrapEnumDescriptors(f, descs) + g.buildNestedEnums(descs, enums) + exts := wrapExtensions(f) + fd := &FileDescriptor{ + FileDescriptorProto: f, + desc: descs, + enum: enums, + ext: exts, + exported: make(map[Object][]symbol), + proto3: fileIsProto3(f), + } + extractComments(fd) + g.allFiles = append(g.allFiles, fd) + g.allFilesByName[f.GetName()] = fd + } + for _, fd := range g.allFiles { + fd.imp = wrapImported(fd.FileDescriptorProto, g) + } + + g.genFiles = make([]*FileDescriptor, 0, len(g.Request.FileToGenerate)) + for _, fileName := range g.Request.FileToGenerate { + fd := g.allFilesByName[fileName] + if fd == nil { + g.Fail("could not find file named", fileName) + } + fd.index = len(g.genFiles) + g.genFiles = append(g.genFiles, fd) + } +} + +// Scan the descriptors in this file. For each one, build the slice of nested descriptors +func (g *Generator) buildNestedDescriptors(descs []*Descriptor) { + for _, desc := range descs { + if len(desc.NestedType) != 0 { + for _, nest := range descs { + if nest.parent == desc { + desc.nested = append(desc.nested, nest) + } + } + if len(desc.nested) != len(desc.NestedType) { + g.Fail("internal error: nesting failure for", desc.GetName()) + } + } + } +} + +func (g *Generator) buildNestedEnums(descs []*Descriptor, enums []*EnumDescriptor) { + for _, desc := range descs { + if len(desc.EnumType) != 0 { + for _, enum := range enums { + if enum.parent == desc { + desc.enums = append(desc.enums, enum) + } + } + if len(desc.enums) != len(desc.EnumType) { + g.Fail("internal error: enum nesting failure for", desc.GetName()) + } + } + } +} + +// Construct the Descriptor +func newDescriptor(desc *descriptor.DescriptorProto, parent *Descriptor, file *descriptor.FileDescriptorProto, index int) *Descriptor { + d := &Descriptor{ + common: common{file}, + DescriptorProto: desc, + parent: parent, + index: index, + } + if parent == nil { + d.path = fmt.Sprintf("%d,%d", messagePath, index) + } else { + d.path = fmt.Sprintf("%s,%d,%d", parent.path, messageMessagePath, index) + } + + // The only way to distinguish a group from a message is whether + // the containing message has a TYPE_GROUP field that matches. + if parent != nil { + parts := d.TypeName() + if file.Package != nil { + parts = append([]string{*file.Package}, parts...) + } + exp := "." + strings.Join(parts, ".") + for _, field := range parent.Field { + if field.GetType() == descriptor.FieldDescriptorProto_TYPE_GROUP && field.GetTypeName() == exp { + d.group = true + break + } + } + } + + for _, field := range desc.Extension { + d.ext = append(d.ext, &ExtensionDescriptor{common{file}, field, d}) + } + + return d +} + +// Return a slice of all the Descriptors defined within this file +func wrapDescriptors(file *descriptor.FileDescriptorProto) []*Descriptor { + sl := make([]*Descriptor, 0, len(file.MessageType)+10) + for i, desc := range file.MessageType { + sl = wrapThisDescriptor(sl, desc, nil, file, i) + } + return sl +} + +// Wrap this Descriptor, recursively +func wrapThisDescriptor(sl []*Descriptor, desc *descriptor.DescriptorProto, parent *Descriptor, file *descriptor.FileDescriptorProto, index int) []*Descriptor { + sl = append(sl, newDescriptor(desc, parent, file, index)) + me := sl[len(sl)-1] + for i, nested := range desc.NestedType { + sl = wrapThisDescriptor(sl, nested, me, file, i) + } + return sl +} + +// Construct the EnumDescriptor +func newEnumDescriptor(desc *descriptor.EnumDescriptorProto, parent *Descriptor, file *descriptor.FileDescriptorProto, index int) *EnumDescriptor { + ed := &EnumDescriptor{ + common: common{file}, + EnumDescriptorProto: desc, + parent: parent, + index: index, + } + if parent == nil { + ed.path = fmt.Sprintf("%d,%d", enumPath, index) + } else { + ed.path = fmt.Sprintf("%s,%d,%d", parent.path, messageEnumPath, index) + } + return ed +} + +// Return a slice of all the EnumDescriptors defined within this file +func wrapEnumDescriptors(file *descriptor.FileDescriptorProto, descs []*Descriptor) []*EnumDescriptor { + sl := make([]*EnumDescriptor, 0, len(file.EnumType)+10) + // Top-level enums. + for i, enum := range file.EnumType { + sl = append(sl, newEnumDescriptor(enum, nil, file, i)) + } + // Enums within messages. Enums within embedded messages appear in the outer-most message. + for _, nested := range descs { + for i, enum := range nested.EnumType { + sl = append(sl, newEnumDescriptor(enum, nested, file, i)) + } + } + return sl +} + +// Return a slice of all the top-level ExtensionDescriptors defined within this file. +func wrapExtensions(file *descriptor.FileDescriptorProto) []*ExtensionDescriptor { + var sl []*ExtensionDescriptor + for _, field := range file.Extension { + sl = append(sl, &ExtensionDescriptor{common{file}, field, nil}) + } + return sl +} + +// Return a slice of all the types that are publicly imported into this file. +func wrapImported(file *descriptor.FileDescriptorProto, g *Generator) (sl []*ImportedDescriptor) { + for _, index := range file.PublicDependency { + df := g.fileByName(file.Dependency[index]) + for _, d := range df.desc { + if d.GetOptions().GetMapEntry() { + continue + } + sl = append(sl, &ImportedDescriptor{common{file}, d}) + } + for _, e := range df.enum { + sl = append(sl, &ImportedDescriptor{common{file}, e}) + } + for _, ext := range df.ext { + sl = append(sl, &ImportedDescriptor{common{file}, ext}) + } + } + return +} + +func extractComments(file *FileDescriptor) { + file.comments = make(map[string]*descriptor.SourceCodeInfo_Location) + for _, loc := range file.GetSourceCodeInfo().GetLocation() { + if loc.LeadingComments == nil { + continue + } + var p []string + for _, n := range loc.Path { + p = append(p, strconv.Itoa(int(n))) + } + file.comments[strings.Join(p, ",")] = loc + } +} + +// BuildTypeNameMap builds the map from fully qualified type names to objects. +// The key names for the map come from the input data, which puts a period at the beginning. +// It should be called after SetPackageNames and before GenerateAllFiles. +func (g *Generator) BuildTypeNameMap() { + g.typeNameToObject = make(map[string]Object) + for _, f := range g.allFiles { + // The names in this loop are defined by the proto world, not us, so the + // package name may be empty. If so, the dotted package name of X will + // be ".X"; otherwise it will be ".pkg.X". + dottedPkg := "." + f.GetPackage() + if dottedPkg != "." { + dottedPkg += "." + } + for _, enum := range f.enum { + name := dottedPkg + dottedSlice(enum.TypeName()) + g.typeNameToObject[name] = enum + } + for _, desc := range f.desc { + name := dottedPkg + dottedSlice(desc.TypeName()) + g.typeNameToObject[name] = desc + } + } +} + +// ObjectNamed, given a fully-qualified input type name as it appears in the input data, +// returns the descriptor for the message or enum with that name. +func (g *Generator) ObjectNamed(typeName string) Object { + o, ok := g.typeNameToObject[typeName] + if !ok { + g.Fail("can't find object with type", typeName) + } + + // If the file of this object isn't a direct dependency of the current file, + // or in the current file, then this object has been publicly imported into + // a dependency of the current file. + // We should return the ImportedDescriptor object for it instead. + direct := *o.File().Name == *g.file.Name + if !direct { + for _, dep := range g.file.Dependency { + if *g.fileByName(dep).Name == *o.File().Name { + direct = true + break + } + } + } + if !direct { + found := false + Loop: + for _, dep := range g.file.Dependency { + df := g.fileByName(*g.fileByName(dep).Name) + for _, td := range df.imp { + if td.o == o { + // Found it! + o = td + found = true + break Loop + } + } + } + if !found { + log.Printf("protoc-gen-gogo: WARNING: failed finding publicly imported dependency for %v, used in %v", typeName, *g.file.Name) + } + } + + return o +} + +// P prints the arguments to the generated output. It handles strings and int32s, plus +// handling indirections because they may be *string, etc. +func (g *Generator) P(str ...interface{}) { + if !g.writeOutput { + return + } + g.WriteString(g.indent) + for _, v := range str { + switch s := v.(type) { + case string: + g.WriteString(s) + case *string: + g.WriteString(*s) + case bool: + fmt.Fprintf(g, "%t", s) + case *bool: + fmt.Fprintf(g, "%t", *s) + case int: + fmt.Fprintf(g, "%d", s) + case *int32: + fmt.Fprintf(g, "%d", *s) + case *int64: + fmt.Fprintf(g, "%d", *s) + case float64: + fmt.Fprintf(g, "%g", s) + case *float64: + fmt.Fprintf(g, "%g", *s) + default: + g.Fail(fmt.Sprintf("unknown type in printer: %T", v)) + } + } + g.WriteByte('\n') +} + +// addInitf stores the given statement to be printed inside the file's init function. +// The statement is given as a format specifier and arguments. +func (g *Generator) addInitf(stmt string, a ...interface{}) { + g.init = append(g.init, fmt.Sprintf(stmt, a...)) +} + +func (g *Generator) PrintImport(alias, pkg string) { + statement := "import " + alias + " " + strconv.Quote(pkg) + if g.writtenImports[statement] { + return + } + g.P(statement) + g.writtenImports[statement] = true +} + +// In Indents the output one tab stop. +func (g *Generator) In() { g.indent += "\t" } + +// Out unindents the output one tab stop. +func (g *Generator) Out() { + if len(g.indent) > 0 { + g.indent = g.indent[1:] + } +} + +// GenerateAllFiles generates the output for all the files we're outputting. +func (g *Generator) GenerateAllFiles() { + // Initialize the plugins + for _, p := range plugins { + p.Init(g) + } + // Generate the output. The generator runs for every file, even the files + // that we don't generate output for, so that we can collate the full list + // of exported symbols to support public imports. + genFileMap := make(map[*FileDescriptor]bool, len(g.genFiles)) + for _, file := range g.genFiles { + genFileMap[file] = true + } + for _, file := range g.allFiles { + g.Reset() + g.writeOutput = genFileMap[file] + g.generate(file) + if !g.writeOutput { + continue + } + g.Response.File = append(g.Response.File, &plugin.CodeGeneratorResponse_File{ + Name: proto.String(file.goFileName()), + Content: proto.String(g.String()), + }) + } +} + +// Run all the plugins associated with the file. +func (g *Generator) runPlugins(file *FileDescriptor) { + for _, p := range plugins { + p.Generate(file) + } +} + +// FileOf return the FileDescriptor for this FileDescriptorProto. +func (g *Generator) FileOf(fd *descriptor.FileDescriptorProto) *FileDescriptor { + for _, file := range g.allFiles { + if file.FileDescriptorProto == fd { + return file + } + } + g.Fail("could not find file in table:", fd.GetName()) + return nil +} + +// Fill the response protocol buffer with the generated output for all the files we're +// supposed to generate. +func (g *Generator) generate(file *FileDescriptor) { + g.customImports = make([]string, 0) + g.file = g.FileOf(file.FileDescriptorProto) + g.usedPackages = make(map[string]bool) + + if g.file.index == 0 { + // For one file in the package, assert version compatibility. + g.P("// This is a compile-time assertion to ensure that this generated file") + g.P("// is compatible with the proto package it is being compiled against.") + g.P("// A compilation error at this line likely means your copy of the") + g.P("// proto package needs to be updated.") + if gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { + g.P("const _ = ", g.Pkg["proto"], ".GoGoProtoPackageIsVersion", generatedCodeVersion, " // please upgrade the proto package") + } else { + g.P("const _ = ", g.Pkg["proto"], ".ProtoPackageIsVersion", generatedCodeVersion, " // please upgrade the proto package") + } + g.P() + } + // Reset on each file + g.writtenImports = make(map[string]bool) + for _, td := range g.file.imp { + g.generateImported(td) + } + for _, enum := range g.file.enum { + g.generateEnum(enum) + } + for _, desc := range g.file.desc { + // Don't generate virtual messages for maps. + if desc.GetOptions().GetMapEntry() { + continue + } + g.generateMessage(desc) + } + for _, ext := range g.file.ext { + g.generateExtension(ext) + } + g.generateInitFunction() + + // Run the plugins before the imports so we know which imports are necessary. + g.runPlugins(file) + + g.generateFileDescriptor(file) + + // Generate header and imports last, though they appear first in the output. + rem := g.Buffer + g.Buffer = new(bytes.Buffer) + g.generateHeader() + g.generateImports() + if !g.writeOutput { + return + } + g.Write(rem.Bytes()) + + // Reformat generated code. + fset := token.NewFileSet() + raw := g.Bytes() + ast, err := parser.ParseFile(fset, "", g, parser.ParseComments) + if err != nil { + // Print out the bad code with line numbers. + // This should never happen in practice, but it can while changing generated code, + // so consider this a debugging aid. + var src bytes.Buffer + s := bufio.NewScanner(bytes.NewReader(raw)) + for line := 1; s.Scan(); line++ { + fmt.Fprintf(&src, "%5d\t%s\n", line, s.Bytes()) + } + if serr := s.Err(); serr != nil { + g.Fail("bad Go source code was generated:", err.Error(), "\n"+string(raw)) + } else { + g.Fail("bad Go source code was generated:", err.Error(), "\n"+src.String()) + } + } + g.Reset() + err = (&printer.Config{Mode: printer.TabIndent | printer.UseSpaces, Tabwidth: 8}).Fprint(g, fset, ast) + if err != nil { + g.Fail("generated Go source code could not be reformatted:", err.Error()) + } +} + +// Generate the header, including package definition +func (g *Generator) generateHeader() { + g.P("// Code generated by protoc-gen-gogo.") + g.P("// source: ", *g.file.Name) + g.P("// DO NOT EDIT!") + g.P() + + name := g.file.PackageName() + + if g.file.index == 0 { + // Generate package docs for the first file in the package. + g.P("/*") + g.P("Package ", name, " is a generated protocol buffer package.") + g.P() + if loc, ok := g.file.comments[strconv.Itoa(packagePath)]; ok { + // not using g.PrintComments because this is a /* */ comment block. + text := strings.TrimSuffix(loc.GetLeadingComments(), "\n") + for _, line := range strings.Split(text, "\n") { + line = strings.TrimPrefix(line, " ") + // ensure we don't escape from the block comment + line = strings.Replace(line, "*/", "* /", -1) + g.P(line) + } + g.P() + } + var topMsgs []string + g.P("It is generated from these files:") + for _, f := range g.genFiles { + g.P("\t", f.Name) + for _, msg := range f.desc { + if msg.parent != nil { + continue + } + topMsgs = append(topMsgs, CamelCaseSlice(msg.TypeName())) + } + } + g.P() + g.P("It has these top-level messages:") + for _, msg := range topMsgs { + g.P("\t", msg) + } + g.P("*/") + } + + g.P("package ", name) + g.P() +} + +// PrintComments prints any comments from the source .proto file. +// The path is a comma-separated list of integers. +// It returns an indication of whether any comments were printed. +// See descriptor.proto for its format. +func (g *Generator) PrintComments(path string) bool { + if !g.writeOutput { + return false + } + if loc, ok := g.file.comments[path]; ok { + text := strings.TrimSuffix(loc.GetLeadingComments(), "\n") + for _, line := range strings.Split(text, "\n") { + g.P("// ", strings.TrimPrefix(line, " ")) + } + return true + } + return false +} + +// Comments returns any comments from the source .proto file and empty string if comments not found. +// The path is a comma-separated list of intergers. +// See descriptor.proto for its format. +func (g *Generator) Comments(path string) string { + loc, ok := g.file.comments[path] + if !ok { + return "" + } + text := strings.TrimSuffix(loc.GetLeadingComments(), "\n") + return text +} + +func (g *Generator) fileByName(filename string) *FileDescriptor { + return g.allFilesByName[filename] +} + +// weak returns whether the ith import of the current file is a weak import. +func (g *Generator) weak(i int32) bool { + for _, j := range g.file.WeakDependency { + if j == i { + return true + } + } + return false +} + +// Generate the imports +func (g *Generator) generateImports() { + // We almost always need a proto import. Rather than computing when we + // do, which is tricky when there's a plugin, just import it and + // reference it later. The same argument applies to the fmt and math packages. + if gogoproto.ImportsGoGoProto(g.file.FileDescriptorProto) { + g.PrintImport(g.Pkg["proto"], g.ImportPrefix+"github.com/gogo/protobuf/proto") + } else { + g.PrintImport(g.Pkg["proto"], g.ImportPrefix+"github.com/golang/protobuf/proto") + } + g.PrintImport(g.Pkg["fmt"], "fmt") + g.PrintImport(g.Pkg["math"], "math") + + for i, s := range g.file.Dependency { + fd := g.fileByName(s) + // Do not import our own package. + if fd.PackageName() == g.packageName { + continue + } + filename := fd.goFileName() + // By default, import path is the dirname of the Go filename. + importPath := path.Dir(filename) + if substitution, ok := g.ImportMap[s]; ok { + importPath = substitution + } + importPath = g.ImportPrefix + importPath + // Skip weak imports. + if g.weak(int32(i)) { + g.P("// skipping weak import ", fd.PackageName(), " ", strconv.Quote(importPath)) + continue + } + // We need to import all the dependencies, even if we don't reference them, + // because other code and tools depend on having the full transitive closure + // of protocol buffer types in the binary. + if _, ok := g.usedPackages[fd.PackageName()]; ok { + g.PrintImport(fd.PackageName(), importPath) + } else { + g.P("import _ ", strconv.Quote(importPath)) + } + } + g.P() + for _, s := range g.customImports { + s1 := strings.Map(badToUnderscore, s) + g.PrintImport(s1, s) + } + g.P() + // TODO: may need to worry about uniqueness across plugins + for _, p := range plugins { + p.GenerateImports(g.file) + g.P() + } + g.P("// Reference imports to suppress errors if they are not otherwise used.") + g.P("var _ = ", g.Pkg["proto"], ".Marshal") + g.P("var _ = ", g.Pkg["fmt"], ".Errorf") + g.P("var _ = ", g.Pkg["math"], ".Inf") + g.P() +} + +func (g *Generator) generateImported(id *ImportedDescriptor) { + // Don't generate public import symbols for files that we are generating + // code for, since those symbols will already be in this package. + // We can't simply avoid creating the ImportedDescriptor objects, + // because g.genFiles isn't populated at that stage. + tn := id.TypeName() + sn := tn[len(tn)-1] + df := g.FileOf(id.o.File()) + filename := *df.Name + for _, fd := range g.genFiles { + if *fd.Name == filename { + g.P("// Ignoring public import of ", sn, " from ", filename) + g.P() + return + } + } + g.P("// ", sn, " from public import ", filename) + g.usedPackages[df.PackageName()] = true + + for _, sym := range df.exported[id.o] { + sym.GenerateAlias(g, df.PackageName()) + } + + g.P() +} + +// Generate the enum definitions for this EnumDescriptor. +func (g *Generator) generateEnum(enum *EnumDescriptor) { + // The full type name + typeName := enum.alias() + // The full type name, CamelCased. + ccTypeName := CamelCaseSlice(typeName) + ccPrefix := enum.prefix() + + g.PrintComments(enum.path) + if !gogoproto.EnabledGoEnumPrefix(enum.file, enum.EnumDescriptorProto) { + ccPrefix = "" + } + g.P("type ", ccTypeName, " int32") + g.file.addExport(enum, enumSymbol{ccTypeName, enum.proto3()}) + g.P("const (") + g.In() + for i, e := range enum.Value { + g.PrintComments(fmt.Sprintf("%s,%d,%d", enum.path, enumValuePath, i)) + name := *e.Name + if gogoproto.IsEnumValueCustomName(e) { + name = gogoproto.GetEnumValueCustomName(e) + } + name = ccPrefix + name + + g.P(name, " ", ccTypeName, " = ", e.Number) + g.file.addExport(enum, constOrVarSymbol{name, "const", ccTypeName}) + } + g.Out() + g.P(")") + g.P("var ", ccTypeName, "_name = map[int32]string{") + g.In() + generated := make(map[int32]bool) // avoid duplicate values + for _, e := range enum.Value { + duplicate := "" + if _, present := generated[*e.Number]; present { + duplicate = "// Duplicate value: " + } + g.P(duplicate, e.Number, ": ", strconv.Quote(*e.Name), ",") + generated[*e.Number] = true + } + g.Out() + g.P("}") + g.P("var ", ccTypeName, "_value = map[string]int32{") + g.In() + for _, e := range enum.Value { + g.P(strconv.Quote(*e.Name), ": ", e.Number, ",") + } + g.Out() + g.P("}") + + if !enum.proto3() { + g.P("func (x ", ccTypeName, ") Enum() *", ccTypeName, " {") + g.In() + g.P("p := new(", ccTypeName, ")") + g.P("*p = x") + g.P("return p") + g.Out() + g.P("}") + } + + if gogoproto.IsGoEnumStringer(g.file.FileDescriptorProto, enum.EnumDescriptorProto) { + g.P("func (x ", ccTypeName, ") String() string {") + g.In() + g.P("return ", g.Pkg["proto"], ".EnumName(", ccTypeName, "_name, int32(x))") + g.Out() + g.P("}") + } + + if !enum.proto3() && !gogoproto.IsGoEnumStringer(g.file.FileDescriptorProto, enum.EnumDescriptorProto) { + g.P("func (x ", ccTypeName, ") MarshalJSON() ([]byte, error) {") + g.In() + g.P("return ", g.Pkg["proto"], ".MarshalJSONEnum(", ccTypeName, "_name, int32(x))") + g.Out() + g.P("}") + } + if !enum.proto3() { + g.P("func (x *", ccTypeName, ") UnmarshalJSON(data []byte) error {") + g.In() + g.P("value, err := ", g.Pkg["proto"], ".UnmarshalJSONEnum(", ccTypeName, `_value, data, "`, ccTypeName, `")`) + g.P("if err != nil {") + g.In() + g.P("return err") + g.Out() + g.P("}") + g.P("*x = ", ccTypeName, "(value)") + g.P("return nil") + g.Out() + g.P("}") + } + + var indexes []string + for m := enum.parent; m != nil; m = m.parent { + // XXX: skip groups? + indexes = append([]string{strconv.Itoa(m.index)}, indexes...) + } + indexes = append(indexes, strconv.Itoa(enum.index)) + g.P("func (", ccTypeName, ") EnumDescriptor() ([]byte, []int) { return ", g.file.VarName(), ", []int{", strings.Join(indexes, ", "), "} }") + if enum.file.GetPackage() == "google.protobuf" && enum.GetName() == "NullValue" { + g.P("func (", ccTypeName, `) XXX_WellKnownType() string { return "`, enum.GetName(), `" }`) + } + g.P() +} + +// The tag is a string like "varint,2,opt,name=fieldname,def=7" that +// identifies details of the field for the protocol buffer marshaling and unmarshaling +// code. The fields are: +// wire encoding +// protocol tag number +// opt,req,rep for optional, required, or repeated +// packed whether the encoding is "packed" (optional; repeated primitives only) +// name= the original declared name +// enum= the name of the enum type if it is an enum-typed field. +// proto3 if this field is in a proto3 message +// def= string representation of the default value, if any. +// The default value must be in a representation that can be used at run-time +// to generate the default value. Thus bools become 0 and 1, for instance. +func (g *Generator) goTag(message *Descriptor, field *descriptor.FieldDescriptorProto, wiretype string) string { + optrepreq := "" + switch { + case isOptional(field): + optrepreq = "opt" + case isRequired(field): + optrepreq = "req" + case isRepeated(field): + optrepreq = "rep" + } + var defaultValue string + if dv := field.DefaultValue; dv != nil { // set means an explicit default + defaultValue = *dv + // Some types need tweaking. + switch *field.Type { + case descriptor.FieldDescriptorProto_TYPE_BOOL: + if defaultValue == "true" { + defaultValue = "1" + } else { + defaultValue = "0" + } + case descriptor.FieldDescriptorProto_TYPE_STRING, + descriptor.FieldDescriptorProto_TYPE_BYTES: + // Nothing to do. Quoting is done for the whole tag. + case descriptor.FieldDescriptorProto_TYPE_ENUM: + // For enums we need to provide the integer constant. + obj := g.ObjectNamed(field.GetTypeName()) + if id, ok := obj.(*ImportedDescriptor); ok { + // It is an enum that was publicly imported. + // We need the underlying type. + obj = id.o + } + enum, ok := obj.(*EnumDescriptor) + if !ok { + log.Printf("obj is a %T", obj) + if id, ok := obj.(*ImportedDescriptor); ok { + log.Printf("id.o is a %T", id.o) + } + g.Fail("unknown enum type", CamelCaseSlice(obj.TypeName())) + } + defaultValue = enum.integerValueAsString(defaultValue) + } + defaultValue = ",def=" + defaultValue + } + enum := "" + if *field.Type == descriptor.FieldDescriptorProto_TYPE_ENUM { + // We avoid using obj.PackageName(), because we want to use the + // original (proto-world) package name. + obj := g.ObjectNamed(field.GetTypeName()) + if id, ok := obj.(*ImportedDescriptor); ok { + obj = id.o + } + enum = ",enum=" + if pkg := obj.File().GetPackage(); pkg != "" { + enum += pkg + "." + } + enum += CamelCaseSlice(obj.TypeName()) + } + packed := "" + if (field.Options != nil && field.Options.GetPacked()) || + // Per https://developers.google.com/protocol-buffers/docs/proto3#simple: + // "In proto3, repeated fields of scalar numeric types use packed encoding by default." + (message.proto3() && (field.Options == nil || field.Options.Packed == nil) && + isRepeated(field) && IsScalar(field)) { + packed = ",packed" + } + fieldName := field.GetName() + name := fieldName + if *field.Type == descriptor.FieldDescriptorProto_TYPE_GROUP { + // We must use the type name for groups instead of + // the field name to preserve capitalization. + // type_name in FieldDescriptorProto is fully-qualified, + // but we only want the local part. + name = *field.TypeName + if i := strings.LastIndex(name, "."); i >= 0 { + name = name[i+1:] + } + } + if json := field.GetJsonName(); json != "" && json != name { + // TODO: escaping might be needed, in which case + // perhaps this should be in its own "json" tag. + name += ",json=" + json + } + name = ",name=" + name + + embed := "" + if gogoproto.IsEmbed(field) { + embed = ",embedded=" + fieldName + } + + ctype := "" + if gogoproto.IsCustomType(field) { + ctype = ",customtype=" + gogoproto.GetCustomType(field) + } + + casttype := "" + if gogoproto.IsCastType(field) { + casttype = ",casttype=" + gogoproto.GetCastType(field) + } + + castkey := "" + if gogoproto.IsCastKey(field) { + castkey = ",castkey=" + gogoproto.GetCastKey(field) + } + + castvalue := "" + if gogoproto.IsCastValue(field) { + castvalue = ",castvalue=" + gogoproto.GetCastValue(field) + // record the original message type for jsonpb reconstruction + desc := g.ObjectNamed(field.GetTypeName()) + if d, ok := desc.(*Descriptor); ok && d.GetOptions().GetMapEntry() { + valueField := d.Field[1] + if valueField.IsMessage() { + castvalue += ",castvaluetype=" + strings.TrimPrefix(valueField.GetTypeName(), ".") + } + } + } + + if message.proto3() { + // We only need the extra tag for []byte fields; + // no need to add noise for the others. + if *field.Type != descriptor.FieldDescriptorProto_TYPE_MESSAGE && + *field.Type != descriptor.FieldDescriptorProto_TYPE_GROUP && + !field.IsRepeated() { + name += ",proto3" + } + } + oneof := "" + if field.OneofIndex != nil { + oneof = ",oneof" + } + stdtime := "" + if gogoproto.IsStdTime(field) { + stdtime = ",stdtime" + } + stdduration := "" + if gogoproto.IsStdDuration(field) { + stdduration = ",stdduration" + } + return strconv.Quote(fmt.Sprintf("%s,%d,%s%s%s%s%s%s%s%s%s%s%s%s%s", + wiretype, + field.GetNumber(), + optrepreq, + packed, + name, + enum, + oneof, + defaultValue, + embed, + ctype, + casttype, + castkey, + castvalue, + stdtime, + stdduration)) +} + +func needsStar(field *descriptor.FieldDescriptorProto, proto3 bool, allowOneOf bool) bool { + if isRepeated(field) && + (*field.Type != descriptor.FieldDescriptorProto_TYPE_MESSAGE) && + (*field.Type != descriptor.FieldDescriptorProto_TYPE_GROUP) { + return false + } + if *field.Type == descriptor.FieldDescriptorProto_TYPE_BYTES && !gogoproto.IsCustomType(field) { + return false + } + if !gogoproto.IsNullable(field) { + return false + } + if field.OneofIndex != nil && allowOneOf && + (*field.Type != descriptor.FieldDescriptorProto_TYPE_MESSAGE) && + (*field.Type != descriptor.FieldDescriptorProto_TYPE_GROUP) { + return false + } + if proto3 && + (*field.Type != descriptor.FieldDescriptorProto_TYPE_MESSAGE) && + (*field.Type != descriptor.FieldDescriptorProto_TYPE_GROUP) && + !gogoproto.IsCustomType(field) { + return false + } + return true +} + +// TypeName is the printed name appropriate for an item. If the object is in the current file, +// TypeName drops the package name and underscores the rest. +// Otherwise the object is from another package; and the result is the underscored +// package name followed by the item name. +// The result always has an initial capital. +func (g *Generator) TypeName(obj Object) string { + return g.DefaultPackageName(obj) + CamelCaseSlice(obj.TypeName()) +} + +// TypeNameWithPackage is like TypeName, but always includes the package +// name even if the object is in our own package. +func (g *Generator) TypeNameWithPackage(obj Object) string { + return obj.PackageName() + CamelCaseSlice(obj.TypeName()) +} + +// GoType returns a string representing the type name, and the wire type +func (g *Generator) GoType(message *Descriptor, field *descriptor.FieldDescriptorProto) (typ string, wire string) { + // TODO: Options. + switch *field.Type { + case descriptor.FieldDescriptorProto_TYPE_DOUBLE: + typ, wire = "float64", "fixed64" + case descriptor.FieldDescriptorProto_TYPE_FLOAT: + typ, wire = "float32", "fixed32" + case descriptor.FieldDescriptorProto_TYPE_INT64: + typ, wire = "int64", "varint" + case descriptor.FieldDescriptorProto_TYPE_UINT64: + typ, wire = "uint64", "varint" + case descriptor.FieldDescriptorProto_TYPE_INT32: + typ, wire = "int32", "varint" + case descriptor.FieldDescriptorProto_TYPE_UINT32: + typ, wire = "uint32", "varint" + case descriptor.FieldDescriptorProto_TYPE_FIXED64: + typ, wire = "uint64", "fixed64" + case descriptor.FieldDescriptorProto_TYPE_FIXED32: + typ, wire = "uint32", "fixed32" + case descriptor.FieldDescriptorProto_TYPE_BOOL: + typ, wire = "bool", "varint" + case descriptor.FieldDescriptorProto_TYPE_STRING: + typ, wire = "string", "bytes" + case descriptor.FieldDescriptorProto_TYPE_GROUP: + desc := g.ObjectNamed(field.GetTypeName()) + typ, wire = g.TypeName(desc), "group" + case descriptor.FieldDescriptorProto_TYPE_MESSAGE: + desc := g.ObjectNamed(field.GetTypeName()) + typ, wire = g.TypeName(desc), "bytes" + case descriptor.FieldDescriptorProto_TYPE_BYTES: + typ, wire = "[]byte", "bytes" + case descriptor.FieldDescriptorProto_TYPE_ENUM: + desc := g.ObjectNamed(field.GetTypeName()) + typ, wire = g.TypeName(desc), "varint" + case descriptor.FieldDescriptorProto_TYPE_SFIXED32: + typ, wire = "int32", "fixed32" + case descriptor.FieldDescriptorProto_TYPE_SFIXED64: + typ, wire = "int64", "fixed64" + case descriptor.FieldDescriptorProto_TYPE_SINT32: + typ, wire = "int32", "zigzag32" + case descriptor.FieldDescriptorProto_TYPE_SINT64: + typ, wire = "int64", "zigzag64" + default: + g.Fail("unknown type for", field.GetName()) + } + switch { + case gogoproto.IsCustomType(field) && gogoproto.IsCastType(field): + g.Fail(field.GetName() + " cannot be custom type and cast type") + case gogoproto.IsCustomType(field): + var packageName string + var err error + packageName, typ, err = getCustomType(field) + if err != nil { + g.Fail(err.Error()) + } + if len(packageName) > 0 { + g.customImports = append(g.customImports, packageName) + } + case gogoproto.IsCastType(field): + var packageName string + var err error + packageName, typ, err = getCastType(field) + if err != nil { + g.Fail(err.Error()) + } + if len(packageName) > 0 { + g.customImports = append(g.customImports, packageName) + } + case gogoproto.IsStdTime(field): + g.customImports = append(g.customImports, "time") + typ = "time.Time" + case gogoproto.IsStdDuration(field): + g.customImports = append(g.customImports, "time") + typ = "time.Duration" + } + if needsStar(field, g.file.proto3 && field.Extendee == nil, message != nil && message.allowOneof()) { + typ = "*" + typ + } + if isRepeated(field) { + typ = "[]" + typ + } + return +} + +// GoMapDescriptor is a full description of the map output struct. +type GoMapDescriptor struct { + GoType string + + KeyField *descriptor.FieldDescriptorProto + KeyAliasField *descriptor.FieldDescriptorProto + KeyTag string + + ValueField *descriptor.FieldDescriptorProto + ValueAliasField *descriptor.FieldDescriptorProto + ValueTag string +} + +func (g *Generator) GoMapType(d *Descriptor, field *descriptor.FieldDescriptorProto) *GoMapDescriptor { + if d == nil { + byName := g.ObjectNamed(field.GetTypeName()) + desc, ok := byName.(*Descriptor) + if byName == nil || !ok || !desc.GetOptions().GetMapEntry() { + g.Fail(fmt.Sprintf("field %s is not a map", field.GetTypeName())) + return nil + } + d = desc + } + + m := &GoMapDescriptor{ + KeyField: d.Field[0], + ValueField: d.Field[1], + } + + // Figure out the Go types and tags for the key and value types. + m.KeyAliasField, m.ValueAliasField = g.GetMapKeyField(field, m.KeyField), g.GetMapValueField(field, m.ValueField) + keyType, keyWire := g.GoType(d, m.KeyAliasField) + valType, valWire := g.GoType(d, m.ValueAliasField) + + m.KeyTag, m.ValueTag = g.goTag(d, m.KeyField, keyWire), g.goTag(d, m.ValueField, valWire) + + if gogoproto.IsCastType(field) { + var packageName string + var err error + packageName, typ, err := getCastType(field) + if err != nil { + g.Fail(err.Error()) + } + if len(packageName) > 0 { + g.customImports = append(g.customImports, packageName) + } + m.GoType = typ + return m + } + + // We don't use stars, except for message-typed values. + // Message and enum types are the only two possibly foreign types used in maps, + // so record their use. They are not permitted as map keys. + keyType = strings.TrimPrefix(keyType, "*") + switch *m.ValueAliasField.Type { + case descriptor.FieldDescriptorProto_TYPE_ENUM: + valType = strings.TrimPrefix(valType, "*") + g.RecordTypeUse(m.ValueAliasField.GetTypeName()) + case descriptor.FieldDescriptorProto_TYPE_MESSAGE: + if !gogoproto.IsNullable(m.ValueAliasField) { + valType = strings.TrimPrefix(valType, "*") + } + if !gogoproto.IsStdTime(field) && !gogoproto.IsStdDuration(field) { + g.RecordTypeUse(m.ValueAliasField.GetTypeName()) + } + default: + if gogoproto.IsCustomType(m.ValueAliasField) { + if !gogoproto.IsNullable(m.ValueAliasField) { + valType = strings.TrimPrefix(valType, "*") + } + g.RecordTypeUse(m.ValueAliasField.GetTypeName()) + } else { + valType = strings.TrimPrefix(valType, "*") + } + } + + m.GoType = fmt.Sprintf("map[%s]%s", keyType, valType) + return m +} + +func (g *Generator) RecordTypeUse(t string) { + if obj, ok := g.typeNameToObject[t]; ok { + // Call ObjectNamed to get the true object to record the use. + obj = g.ObjectNamed(t) + g.usedPackages[obj.PackageName()] = true + } +} + +// Method names that may be generated. Fields with these names get an +// underscore appended. Any change to this set is a potential incompatible +// API change because it changes generated field names. +var methodNames = [...]string{ + "Reset", + "String", + "ProtoMessage", + "Marshal", + "Unmarshal", + "ExtensionRangeArray", + "ExtensionMap", + "Descriptor", + "MarshalTo", + "Equal", + "VerboseEqual", + "GoString", + "ProtoSize", +} + +// Names of messages in the `google.protobuf` package for which +// we will generate XXX_WellKnownType methods. +var wellKnownTypes = map[string]bool{ + "Any": true, + "Duration": true, + "Empty": true, + "Struct": true, + "Timestamp": true, + + "Value": true, + "ListValue": true, + "DoubleValue": true, + "FloatValue": true, + "Int64Value": true, + "UInt64Value": true, + "Int32Value": true, + "UInt32Value": true, + "BoolValue": true, + "StringValue": true, + "BytesValue": true, +} + +// Generate the type and default constant definitions for this Descriptor. +func (g *Generator) generateMessage(message *Descriptor) { + // The full type name + typeName := message.TypeName() + // The full type name, CamelCased. + ccTypeName := CamelCaseSlice(typeName) + + usedNames := make(map[string]bool) + for _, n := range methodNames { + usedNames[n] = true + } + if !gogoproto.IsProtoSizer(message.file, message.DescriptorProto) { + usedNames["Size"] = true + } + fieldNames := make(map[*descriptor.FieldDescriptorProto]string) + fieldGetterNames := make(map[*descriptor.FieldDescriptorProto]string) + fieldTypes := make(map[*descriptor.FieldDescriptorProto]string) + mapFieldTypes := make(map[*descriptor.FieldDescriptorProto]string) + + oneofFieldName := make(map[int32]string) // indexed by oneof_index field of FieldDescriptorProto + oneofDisc := make(map[int32]string) // name of discriminator method + oneofTypeName := make(map[*descriptor.FieldDescriptorProto]string) // without star + oneofInsertPoints := make(map[int32]int) // oneof_index => offset of g.Buffer + + g.PrintComments(message.path) + g.P("type ", ccTypeName, " struct {") + g.In() + + // allocNames finds a conflict-free variation of the given strings, + // consistently mutating their suffixes. + // It returns the same number of strings. + allocNames := func(ns ...string) []string { + Loop: + for { + for _, n := range ns { + if usedNames[n] { + for i := range ns { + ns[i] += "_" + } + continue Loop + } + } + for _, n := range ns { + usedNames[n] = true + } + return ns + } + } + + for i, field := range message.Field { + // Allocate the getter and the field at the same time so name + // collisions create field/method consistent names. + // TODO: This allocation occurs based on the order of the fields + // in the proto file, meaning that a change in the field + // ordering can change generated Method/Field names. + base := CamelCase(*field.Name) + if gogoproto.IsCustomName(field) { + base = gogoproto.GetCustomName(field) + } + ns := allocNames(base, "Get"+base) + fieldName, fieldGetterName := ns[0], ns[1] + typename, wiretype := g.GoType(message, field) + jsonName := *field.Name + jsonTag := jsonName + ",omitempty" + repeatedNativeType := (!field.IsMessage() && !gogoproto.IsCustomType(field) && field.IsRepeated()) + if !gogoproto.IsNullable(field) && !repeatedNativeType { + jsonTag = jsonName + } + gogoJsonTag := gogoproto.GetJsonTag(field) + if gogoJsonTag != nil { + jsonTag = *gogoJsonTag + } + gogoMoreTags := gogoproto.GetMoreTags(field) + moreTags := "" + if gogoMoreTags != nil { + moreTags = " " + *gogoMoreTags + } + tag := fmt.Sprintf("protobuf:%s json:%q%s", g.goTag(message, field, wiretype), jsonTag, moreTags) + fieldNames[field] = fieldName + fieldGetterNames[field] = fieldGetterName + if *field.Type == descriptor.FieldDescriptorProto_TYPE_MESSAGE && gogoproto.IsEmbed(field) { + fieldName = "" + } + + oneof := field.OneofIndex != nil && message.allowOneof() + if oneof && oneofFieldName[*field.OneofIndex] == "" { + odp := message.OneofDecl[int(*field.OneofIndex)] + fname := allocNames(CamelCase(odp.GetName()))[0] + + // This is the first field of a oneof we haven't seen before. + // Generate the union field. + com := g.PrintComments(fmt.Sprintf("%s,%d,%d", message.path, messageOneofPath, *field.OneofIndex)) + if com { + g.P("//") + } + g.P("// Types that are valid to be assigned to ", fname, ":") + // Generate the rest of this comment later, + // when we've computed any disambiguation. + oneofInsertPoints[*field.OneofIndex] = g.Buffer.Len() + + dname := "is" + ccTypeName + "_" + fname + oneofFieldName[*field.OneofIndex] = fname + oneofDisc[*field.OneofIndex] = dname + otag := `protobuf_oneof:"` + odp.GetName() + `"` + g.P(fname, " ", dname, " `", otag, "`") + } + + if *field.Type == descriptor.FieldDescriptorProto_TYPE_MESSAGE { + desc := g.ObjectNamed(field.GetTypeName()) + if d, ok := desc.(*Descriptor); ok && d.GetOptions().GetMapEntry() { + m := g.GoMapType(d, field) + typename = m.GoType + mapFieldTypes[field] = typename // record for the getter generation + + tag += fmt.Sprintf(" protobuf_key:%s protobuf_val:%s", m.KeyTag, m.ValueTag) + } + } + + fieldTypes[field] = typename + + if oneof { + tname := ccTypeName + "_" + fieldName + // It is possible for this to collide with a message or enum + // nested in this message. Check for collisions. + for { + ok := true + for _, desc := range message.nested { + if CamelCaseSlice(desc.TypeName()) == tname { + ok = false + break + } + } + for _, enum := range message.enums { + if CamelCaseSlice(enum.TypeName()) == tname { + ok = false + break + } + } + if !ok { + tname += "_" + continue + } + break + } + + oneofTypeName[field] = tname + continue + } + + g.PrintComments(fmt.Sprintf("%s,%d,%d", message.path, messageFieldPath, i)) + g.P(fieldName, "\t", typename, "\t`", tag, "`") + if !gogoproto.IsStdTime(field) && !gogoproto.IsStdDuration(field) { + g.RecordTypeUse(field.GetTypeName()) + } + } + if len(message.ExtensionRange) > 0 { + if gogoproto.HasExtensionsMap(g.file.FileDescriptorProto, message.DescriptorProto) { + g.P(g.Pkg["proto"], ".XXX_InternalExtensions `json:\"-\"`") + } else { + g.P("XXX_extensions\t\t[]byte `protobuf:\"bytes,0,opt\" json:\"-\"`") + } + } + if gogoproto.HasUnrecognized(g.file.FileDescriptorProto, message.DescriptorProto) && !message.proto3() { + g.P("XXX_unrecognized\t[]byte `json:\"-\"`") + } + g.Out() + g.P("}") + + // Update g.Buffer to list valid oneof types. + // We do this down here, after we've disambiguated the oneof type names. + // We go in reverse order of insertion point to avoid invalidating offsets. + for oi := int32(len(message.OneofDecl)); oi >= 0; oi-- { + ip := oneofInsertPoints[oi] + all := g.Buffer.Bytes() + rem := all[ip:] + g.Buffer = bytes.NewBuffer(all[:ip:ip]) // set cap so we don't scribble on rem + for _, field := range message.Field { + if field.OneofIndex == nil || *field.OneofIndex != oi { + continue + } + g.P("//\t*", oneofTypeName[field]) + } + g.Buffer.Write(rem) + } + + // Reset, String and ProtoMessage methods. + g.P("func (m *", ccTypeName, ") Reset() { *m = ", ccTypeName, "{} }") + if gogoproto.EnabledGoStringer(g.file.FileDescriptorProto, message.DescriptorProto) { + g.P("func (m *", ccTypeName, ") String() string { return ", g.Pkg["proto"], ".CompactTextString(m) }") + } + g.P("func (*", ccTypeName, ") ProtoMessage() {}") + var indexes []string + for m := message; m != nil; m = m.parent { + indexes = append([]string{strconv.Itoa(m.index)}, indexes...) + } + g.P("func (*", ccTypeName, ") Descriptor() ([]byte, []int) { return ", g.file.VarName(), ", []int{", strings.Join(indexes, ", "), "} }") + // TODO: Revisit the decision to use a XXX_WellKnownType method + // if we change proto.MessageName to work with multiple equivalents. + if message.file.GetPackage() == "google.protobuf" && wellKnownTypes[message.GetName()] { + g.P("func (*", ccTypeName, `) XXX_WellKnownType() string { return "`, message.GetName(), `" }`) + } + // Extension support methods + var hasExtensions, isMessageSet bool + if len(message.ExtensionRange) > 0 { + hasExtensions = true + // message_set_wire_format only makes sense when extensions are defined. + if opts := message.Options; opts != nil && opts.GetMessageSetWireFormat() { + isMessageSet = true + g.P() + g.P("func (m *", ccTypeName, ") Marshal() ([]byte, error) {") + g.In() + g.P("return ", g.Pkg["proto"], ".MarshalMessageSet(&m.XXX_InternalExtensions)") + g.Out() + g.P("}") + g.P("func (m *", ccTypeName, ") Unmarshal(buf []byte) error {") + g.In() + g.P("return ", g.Pkg["proto"], ".UnmarshalMessageSet(buf, &m.XXX_InternalExtensions)") + g.Out() + g.P("}") + g.P("func (m *", ccTypeName, ") MarshalJSON() ([]byte, error) {") + g.In() + g.P("return ", g.Pkg["proto"], ".MarshalMessageSetJSON(&m.XXX_InternalExtensions)") + g.Out() + g.P("}") + g.P("func (m *", ccTypeName, ") UnmarshalJSON(buf []byte) error {") + g.In() + g.P("return ", g.Pkg["proto"], ".UnmarshalMessageSetJSON(buf, &m.XXX_InternalExtensions)") + g.Out() + g.P("}") + g.P("// ensure ", ccTypeName, " satisfies proto.Marshaler and proto.Unmarshaler") + g.P("var _ ", g.Pkg["proto"], ".Marshaler = (*", ccTypeName, ")(nil)") + g.P("var _ ", g.Pkg["proto"], ".Unmarshaler = (*", ccTypeName, ")(nil)") + } + + g.P() + g.P("var extRange_", ccTypeName, " = []", g.Pkg["proto"], ".ExtensionRange{") + g.In() + for _, r := range message.ExtensionRange { + end := fmt.Sprint(*r.End - 1) // make range inclusive on both ends + g.P("{Start: ", r.Start, ", End: ", end, "},") + } + g.Out() + g.P("}") + g.P("func (*", ccTypeName, ") ExtensionRangeArray() []", g.Pkg["proto"], ".ExtensionRange {") + g.In() + g.P("return extRange_", ccTypeName) + g.Out() + g.P("}") + if !gogoproto.HasExtensionsMap(g.file.FileDescriptorProto, message.DescriptorProto) { + g.P("func (m *", ccTypeName, ") GetExtensions() *[]byte {") + g.In() + g.P("if m.XXX_extensions == nil {") + g.In() + g.P("m.XXX_extensions = make([]byte, 0)") + g.Out() + g.P("}") + g.P("return &m.XXX_extensions") + g.Out() + g.P("}") + } + } + + // Default constants + defNames := make(map[*descriptor.FieldDescriptorProto]string) + for _, field := range message.Field { + def := field.GetDefaultValue() + if def == "" { + continue + } + if !gogoproto.IsNullable(field) { + g.Fail("illegal default value: ", field.GetName(), " in ", message.GetName(), " is not nullable and is thus not allowed to have a default value") + } + fieldname := "Default_" + ccTypeName + "_" + CamelCase(*field.Name) + defNames[field] = fieldname + typename, _ := g.GoType(message, field) + if typename[0] == '*' { + typename = typename[1:] + } + kind := "const " + switch { + case typename == "bool": + case typename == "string": + def = strconv.Quote(def) + case typename == "[]byte": + def = "[]byte(" + strconv.Quote(def) + ")" + kind = "var " + case def == "inf", def == "-inf", def == "nan": + // These names are known to, and defined by, the protocol language. + switch def { + case "inf": + def = "math.Inf(1)" + case "-inf": + def = "math.Inf(-1)" + case "nan": + def = "math.NaN()" + } + if *field.Type == descriptor.FieldDescriptorProto_TYPE_FLOAT { + def = "float32(" + def + ")" + } + kind = "var " + case *field.Type == descriptor.FieldDescriptorProto_TYPE_ENUM: + // Must be an enum. Need to construct the prefixed name. + obj := g.ObjectNamed(field.GetTypeName()) + var enum *EnumDescriptor + if id, ok := obj.(*ImportedDescriptor); ok { + // The enum type has been publicly imported. + enum, _ = id.o.(*EnumDescriptor) + } else { + enum, _ = obj.(*EnumDescriptor) + } + if enum == nil { + log.Printf("don't know how to generate constant for %s", fieldname) + continue + } + + // hunt down the actual enum corresponding to the default + var enumValue *descriptor.EnumValueDescriptorProto + for _, ev := range enum.Value { + if def == ev.GetName() { + enumValue = ev + } + } + + if enumValue != nil { + if gogoproto.IsEnumValueCustomName(enumValue) { + def = gogoproto.GetEnumValueCustomName(enumValue) + } + } else { + g.Fail(fmt.Sprintf("could not resolve default enum value for %v.%v", + g.DefaultPackageName(obj), def)) + + } + + if gogoproto.EnabledGoEnumPrefix(enum.file, enum.EnumDescriptorProto) { + def = g.DefaultPackageName(obj) + enum.prefix() + def + } else { + def = g.DefaultPackageName(obj) + def + } + } + g.P(kind, fieldname, " ", typename, " = ", def) + g.file.addExport(message, constOrVarSymbol{fieldname, kind, ""}) + } + g.P() + + // Oneof per-field types, discriminants and getters. + if message.allowOneof() { + // Generate unexported named types for the discriminant interfaces. + // We shouldn't have to do this, but there was (~19 Aug 2015) a compiler/linker bug + // that was triggered by using anonymous interfaces here. + // TODO: Revisit this and consider reverting back to anonymous interfaces. + for oi := range message.OneofDecl { + dname := oneofDisc[int32(oi)] + g.P("type ", dname, " interface {") + g.In() + g.P(dname, "()") + if gogoproto.HasEqual(g.file.FileDescriptorProto, message.DescriptorProto) { + g.P(`Equal(interface{}) bool`) + } + if gogoproto.HasVerboseEqual(g.file.FileDescriptorProto, message.DescriptorProto) { + g.P(`VerboseEqual(interface{}) error`) + } + if gogoproto.IsMarshaler(g.file.FileDescriptorProto, message.DescriptorProto) || + gogoproto.IsUnsafeMarshaler(g.file.FileDescriptorProto, message.DescriptorProto) { + g.P(`MarshalTo([]byte) (int, error)`) + } + if gogoproto.IsSizer(g.file.FileDescriptorProto, message.DescriptorProto) { + g.P(`Size() int`) + } + if gogoproto.IsProtoSizer(g.file.FileDescriptorProto, message.DescriptorProto) { + g.P(`ProtoSize() int`) + } + g.Out() + g.P("}") + } + g.P() + for _, field := range message.Field { + if field.OneofIndex == nil { + continue + } + _, wiretype := g.GoType(message, field) + tag := "protobuf:" + g.goTag(message, field, wiretype) + g.P("type ", oneofTypeName[field], " struct{ ", fieldNames[field], " ", fieldTypes[field], " `", tag, "` }") + if !gogoproto.IsStdTime(field) && !gogoproto.IsStdDuration(field) { + g.RecordTypeUse(field.GetTypeName()) + } + } + g.P() + for _, field := range message.Field { + if field.OneofIndex == nil { + continue + } + g.P("func (*", oneofTypeName[field], ") ", oneofDisc[*field.OneofIndex], "() {}") + } + g.P() + for oi := range message.OneofDecl { + fname := oneofFieldName[int32(oi)] + g.P("func (m *", ccTypeName, ") Get", fname, "() ", oneofDisc[int32(oi)], " {") + g.P("if m != nil { return m.", fname, " }") + g.P("return nil") + g.P("}") + } + g.P() + } + + // Field getters + var getters []getterSymbol + for _, field := range message.Field { + oneof := field.OneofIndex != nil && message.allowOneof() + if !oneof && !gogoproto.HasGoGetters(g.file.FileDescriptorProto, message.DescriptorProto) { + continue + } + if gogoproto.IsEmbed(field) || gogoproto.IsCustomType(field) { + continue + } + fname := fieldNames[field] + typename, _ := g.GoType(message, field) + if t, ok := mapFieldTypes[field]; ok { + typename = t + } + mname := fieldGetterNames[field] + star := "" + if (*field.Type != descriptor.FieldDescriptorProto_TYPE_MESSAGE) && + (*field.Type != descriptor.FieldDescriptorProto_TYPE_GROUP) && + needsStar(field, g.file.proto3, message != nil && message.allowOneof()) && typename[0] == '*' { + typename = typename[1:] + star = "*" + } + + // Only export getter symbols for basic types, + // and for messages and enums in the same package. + // Groups are not exported. + // Foreign types can't be hoisted through a public import because + // the importer may not already be importing the defining .proto. + // As an example, imagine we have an import tree like this: + // A.proto -> B.proto -> C.proto + // If A publicly imports B, we need to generate the getters from B in A's output, + // but if one such getter returns something from C then we cannot do that + // because A is not importing C already. + var getter, genType bool + switch *field.Type { + case descriptor.FieldDescriptorProto_TYPE_GROUP: + getter = false + case descriptor.FieldDescriptorProto_TYPE_MESSAGE, descriptor.FieldDescriptorProto_TYPE_ENUM: + // Only export getter if its return type is in this package. + getter = g.ObjectNamed(field.GetTypeName()).PackageName() == message.PackageName() + genType = true + default: + getter = true + } + if getter { + getters = append(getters, getterSymbol{ + name: mname, + typ: typename, + typeName: field.GetTypeName(), + genType: genType, + }) + } + + g.P("func (m *", ccTypeName, ") "+mname+"() "+typename+" {") + g.In() + def, hasDef := defNames[field] + typeDefaultIsNil := false // whether this field type's default value is a literal nil unless specified + switch *field.Type { + case descriptor.FieldDescriptorProto_TYPE_BYTES: + typeDefaultIsNil = !hasDef + case descriptor.FieldDescriptorProto_TYPE_GROUP, descriptor.FieldDescriptorProto_TYPE_MESSAGE: + typeDefaultIsNil = gogoproto.IsNullable(field) + } + if isRepeated(field) { + typeDefaultIsNil = true + } + if typeDefaultIsNil && !oneof { + // A bytes field with no explicit default needs less generated code, + // as does a message or group field, or a repeated field. + g.P("if m != nil {") + g.In() + g.P("return m." + fname) + g.Out() + g.P("}") + g.P("return nil") + g.Out() + g.P("}") + g.P() + continue + } + if !gogoproto.IsNullable(field) { + g.P("if m != nil {") + g.In() + g.P("return m." + fname) + g.Out() + g.P("}") + } else if !oneof { + if message.proto3() { + g.P("if m != nil {") + } else { + g.P("if m != nil && m." + fname + " != nil {") + } + g.In() + g.P("return " + star + "m." + fname) + g.Out() + g.P("}") + } else { + uname := oneofFieldName[*field.OneofIndex] + tname := oneofTypeName[field] + g.P("if x, ok := m.Get", uname, "().(*", tname, "); ok {") + g.P("return x.", fname) + g.P("}") + } + if hasDef { + if *field.Type != descriptor.FieldDescriptorProto_TYPE_BYTES { + g.P("return " + def) + } else { + // The default is a []byte var. + // Make a copy when returning it to be safe. + g.P("return append([]byte(nil), ", def, "...)") + } + } else { + switch *field.Type { + case descriptor.FieldDescriptorProto_TYPE_GROUP, + descriptor.FieldDescriptorProto_TYPE_MESSAGE: + if field.OneofIndex != nil { + g.P(`return nil`) + } else { + goTyp, _ := g.GoType(message, field) + goTypName := GoTypeToName(goTyp) + if !gogoproto.IsNullable(field) && gogoproto.IsStdDuration(field) { + g.P("return 0") + } else { + g.P("return ", goTypName, "{}") + } + } + case descriptor.FieldDescriptorProto_TYPE_BOOL: + g.P("return false") + case descriptor.FieldDescriptorProto_TYPE_STRING: + g.P(`return ""`) + case descriptor.FieldDescriptorProto_TYPE_BYTES: + // This is only possible for oneof fields. + g.P("return nil") + case descriptor.FieldDescriptorProto_TYPE_ENUM: + // The default default for an enum is the first value in the enum, + // not zero. + obj := g.ObjectNamed(field.GetTypeName()) + var enum *EnumDescriptor + if id, ok := obj.(*ImportedDescriptor); ok { + // The enum type has been publicly imported. + enum, _ = id.o.(*EnumDescriptor) + } else { + enum, _ = obj.(*EnumDescriptor) + } + if enum == nil { + log.Printf("don't know how to generate getter for %s", field.GetName()) + continue + } + if len(enum.Value) == 0 { + g.P("return 0 // empty enum") + } else { + first := enum.Value[0].GetName() + if gogoproto.IsEnumValueCustomName(enum.Value[0]) { + first = gogoproto.GetEnumValueCustomName(enum.Value[0]) + } + + if gogoproto.EnabledGoEnumPrefix(enum.file, enum.EnumDescriptorProto) { + g.P("return ", g.DefaultPackageName(obj)+enum.prefix()+first) + } else { + g.P("return ", g.DefaultPackageName(obj)+first) + } + } + default: + g.P("return 0") + } + } + g.Out() + g.P("}") + g.P() + } + + if !message.group { + ms := &messageSymbol{ + sym: ccTypeName, + hasExtensions: hasExtensions, + isMessageSet: isMessageSet, + hasOneof: len(message.OneofDecl) > 0, + getters: getters, + } + g.file.addExport(message, ms) + } + + // Oneof functions + if len(message.OneofDecl) > 0 && message.allowOneof() { + fieldWire := make(map[*descriptor.FieldDescriptorProto]string) + + // method + enc := "_" + ccTypeName + "_OneofMarshaler" + dec := "_" + ccTypeName + "_OneofUnmarshaler" + size := "_" + ccTypeName + "_OneofSizer" + encSig := "(msg " + g.Pkg["proto"] + ".Message, b *" + g.Pkg["proto"] + ".Buffer) error" + decSig := "(msg " + g.Pkg["proto"] + ".Message, tag, wire int, b *" + g.Pkg["proto"] + ".Buffer) (bool, error)" + sizeSig := "(msg " + g.Pkg["proto"] + ".Message) (n int)" + + g.P("// XXX_OneofFuncs is for the internal use of the proto package.") + g.P("func (*", ccTypeName, ") XXX_OneofFuncs() (func", encSig, ", func", decSig, ", func", sizeSig, ", []interface{}) {") + g.P("return ", enc, ", ", dec, ", ", size, ", []interface{}{") + for _, field := range message.Field { + if field.OneofIndex == nil { + continue + } + g.P("(*", oneofTypeName[field], ")(nil),") + } + g.P("}") + g.P("}") + g.P() + + // marshaler + g.P("func ", enc, encSig, " {") + g.P("m := msg.(*", ccTypeName, ")") + for oi, odp := range message.OneofDecl { + g.P("// ", odp.GetName()) + fname := oneofFieldName[int32(oi)] + g.P("switch x := m.", fname, ".(type) {") + for _, field := range message.Field { + if field.OneofIndex == nil || int(*field.OneofIndex) != oi { + continue + } + g.P("case *", oneofTypeName[field], ":") + var wire, pre, post string + val := "x." + fieldNames[field] // overridden for TYPE_BOOL + canFail := false // only TYPE_MESSAGE and TYPE_GROUP can fail + switch *field.Type { + case descriptor.FieldDescriptorProto_TYPE_DOUBLE: + wire = "WireFixed64" + pre = "b.EncodeFixed64(" + g.Pkg["math"] + ".Float64bits(" + post = "))" + case descriptor.FieldDescriptorProto_TYPE_FLOAT: + wire = "WireFixed32" + pre = "b.EncodeFixed32(uint64(" + g.Pkg["math"] + ".Float32bits(" + post = ")))" + case descriptor.FieldDescriptorProto_TYPE_INT64, + descriptor.FieldDescriptorProto_TYPE_UINT64: + wire = "WireVarint" + pre, post = "b.EncodeVarint(uint64(", "))" + case descriptor.FieldDescriptorProto_TYPE_INT32, + descriptor.FieldDescriptorProto_TYPE_UINT32, + descriptor.FieldDescriptorProto_TYPE_ENUM: + wire = "WireVarint" + pre, post = "b.EncodeVarint(uint64(", "))" + case descriptor.FieldDescriptorProto_TYPE_FIXED64, + descriptor.FieldDescriptorProto_TYPE_SFIXED64: + wire = "WireFixed64" + pre, post = "b.EncodeFixed64(uint64(", "))" + case descriptor.FieldDescriptorProto_TYPE_FIXED32, + descriptor.FieldDescriptorProto_TYPE_SFIXED32: + wire = "WireFixed32" + pre, post = "b.EncodeFixed32(uint64(", "))" + case descriptor.FieldDescriptorProto_TYPE_BOOL: + // bool needs special handling. + g.P("t := uint64(0)") + g.P("if ", val, " { t = 1 }") + val = "t" + wire = "WireVarint" + pre, post = "b.EncodeVarint(", ")" + case descriptor.FieldDescriptorProto_TYPE_STRING: + wire = "WireBytes" + pre, post = "b.EncodeStringBytes(", ")" + case descriptor.FieldDescriptorProto_TYPE_GROUP: + wire = "WireStartGroup" + pre, post = "b.Marshal(", ")" + canFail = true + case descriptor.FieldDescriptorProto_TYPE_MESSAGE: + wire = "WireBytes" + pre, post = "b.EncodeMessage(", ")" + canFail = true + case descriptor.FieldDescriptorProto_TYPE_BYTES: + wire = "WireBytes" + pre, post = "b.EncodeRawBytes(", ")" + case descriptor.FieldDescriptorProto_TYPE_SINT32: + wire = "WireVarint" + pre, post = "b.EncodeZigzag32(uint64(", "))" + case descriptor.FieldDescriptorProto_TYPE_SINT64: + wire = "WireVarint" + pre, post = "b.EncodeZigzag64(uint64(", "))" + default: + g.Fail("unhandled oneof field type ", field.Type.String()) + } + fieldWire[field] = wire + g.P("_ = b.EncodeVarint(", field.Number, "<<3|", g.Pkg["proto"], ".", wire, ")") + if *field.Type == descriptor.FieldDescriptorProto_TYPE_BYTES && gogoproto.IsCustomType(field) { + g.P(`dAtA, err := `, val, `.Marshal()`) + g.P(`if err != nil {`) + g.In() + g.P(`return err`) + g.Out() + g.P(`}`) + val = "dAtA" + } else if gogoproto.IsStdTime(field) { + pkg := g.useTypes() + if gogoproto.IsNullable(field) { + g.P(`dAtA, err := `, pkg, `.StdTimeMarshal(*`, val, `)`) + } else { + g.P(`dAtA, err := `, pkg, `.StdTimeMarshal(`, val, `)`) + } + g.P(`if err != nil {`) + g.In() + g.P(`return err`) + g.Out() + g.P(`}`) + val = "dAtA" + pre, post = "b.EncodeRawBytes(", ")" + } else if gogoproto.IsStdDuration(field) { + pkg := g.useTypes() + if gogoproto.IsNullable(field) { + g.P(`dAtA, err := `, pkg, `.StdDurationMarshal(*`, val, `)`) + } else { + g.P(`dAtA, err := `, pkg, `.StdDurationMarshal(`, val, `)`) + } + g.P(`if err != nil {`) + g.In() + g.P(`return err`) + g.Out() + g.P(`}`) + val = "dAtA" + pre, post = "b.EncodeRawBytes(", ")" + } + if !canFail { + g.P("_ = ", pre, val, post) + } else { + g.P("if err := ", pre, val, post, "; err != nil {") + g.In() + g.P("return err") + g.Out() + g.P("}") + } + if *field.Type == descriptor.FieldDescriptorProto_TYPE_GROUP { + g.P("_ = b.EncodeVarint(", field.Number, "<<3|", g.Pkg["proto"], ".WireEndGroup)") + } + } + g.P("case nil:") + g.P("default: return ", g.Pkg["fmt"], `.Errorf("`, ccTypeName, ".", fname, ` has unexpected type %T", x)`) + g.P("}") + } + g.P("return nil") + g.P("}") + g.P() + + // unmarshaler + g.P("func ", dec, decSig, " {") + g.P("m := msg.(*", ccTypeName, ")") + g.P("switch tag {") + for _, field := range message.Field { + if field.OneofIndex == nil { + continue + } + odp := message.OneofDecl[int(*field.OneofIndex)] + g.P("case ", field.Number, ": // ", odp.GetName(), ".", *field.Name) + g.P("if wire != ", g.Pkg["proto"], ".", fieldWire[field], " {") + g.P("return true, ", g.Pkg["proto"], ".ErrInternalBadWireType") + g.P("}") + lhs := "x, err" // overridden for TYPE_MESSAGE and TYPE_GROUP + var dec, cast, cast2 string + switch *field.Type { + case descriptor.FieldDescriptorProto_TYPE_DOUBLE: + dec, cast = "b.DecodeFixed64()", g.Pkg["math"]+".Float64frombits" + case descriptor.FieldDescriptorProto_TYPE_FLOAT: + dec, cast, cast2 = "b.DecodeFixed32()", "uint32", g.Pkg["math"]+".Float32frombits" + case descriptor.FieldDescriptorProto_TYPE_INT64: + dec, cast = "b.DecodeVarint()", "int64" + case descriptor.FieldDescriptorProto_TYPE_UINT64: + dec = "b.DecodeVarint()" + case descriptor.FieldDescriptorProto_TYPE_INT32: + dec, cast = "b.DecodeVarint()", "int32" + case descriptor.FieldDescriptorProto_TYPE_FIXED64: + dec = "b.DecodeFixed64()" + case descriptor.FieldDescriptorProto_TYPE_FIXED32: + dec, cast = "b.DecodeFixed32()", "uint32" + case descriptor.FieldDescriptorProto_TYPE_BOOL: + dec = "b.DecodeVarint()" + // handled specially below + case descriptor.FieldDescriptorProto_TYPE_STRING: + dec = "b.DecodeStringBytes()" + case descriptor.FieldDescriptorProto_TYPE_GROUP: + g.P("msg := new(", fieldTypes[field][1:], ")") // drop star + lhs = "err" + dec = "b.DecodeGroup(msg)" + // handled specially below + case descriptor.FieldDescriptorProto_TYPE_MESSAGE: + if gogoproto.IsStdTime(field) || gogoproto.IsStdDuration(field) { + dec = "b.DecodeRawBytes(true)" + } else { + g.P("msg := new(", fieldTypes[field][1:], ")") // drop star + lhs = "err" + dec = "b.DecodeMessage(msg)" + } + // handled specially below + case descriptor.FieldDescriptorProto_TYPE_BYTES: + dec = "b.DecodeRawBytes(true)" + case descriptor.FieldDescriptorProto_TYPE_UINT32: + dec, cast = "b.DecodeVarint()", "uint32" + case descriptor.FieldDescriptorProto_TYPE_ENUM: + dec, cast = "b.DecodeVarint()", fieldTypes[field] + case descriptor.FieldDescriptorProto_TYPE_SFIXED32: + dec, cast = "b.DecodeFixed32()", "int32" + case descriptor.FieldDescriptorProto_TYPE_SFIXED64: + dec, cast = "b.DecodeFixed64()", "int64" + case descriptor.FieldDescriptorProto_TYPE_SINT32: + dec, cast = "b.DecodeZigzag32()", "int32" + case descriptor.FieldDescriptorProto_TYPE_SINT64: + dec, cast = "b.DecodeZigzag64()", "int64" + default: + g.Fail("unhandled oneof field type ", field.Type.String()) + } + g.P(lhs, " := ", dec) + val := "x" + if *field.Type == descriptor.FieldDescriptorProto_TYPE_BYTES && gogoproto.IsCustomType(field) { + g.P(`if err != nil {`) + g.In() + g.P(`return true, err`) + g.Out() + g.P(`}`) + _, ctyp, err := GetCustomType(field) + if err != nil { + panic(err) + } + g.P(`var cc `, ctyp) + g.P(`c := &cc`) + g.P(`err = c.Unmarshal(`, val, `)`) + val = "*c" + } else if gogoproto.IsStdTime(field) { + pkg := g.useTypes() + g.P(`if err != nil {`) + g.In() + g.P(`return true, err`) + g.Out() + g.P(`}`) + g.P(`c := new(time.Time)`) + g.P(`if err2 := `, pkg, `.StdTimeUnmarshal(c, `, val, `); err2 != nil {`) + g.In() + g.P(`return true, err`) + g.Out() + g.P(`}`) + val = "c" + } else if gogoproto.IsStdDuration(field) { + pkg := g.useTypes() + g.P(`if err != nil {`) + g.In() + g.P(`return true, err`) + g.Out() + g.P(`}`) + g.P(`c := new(time.Duration)`) + g.P(`if err2 := `, pkg, `.StdDurationUnmarshal(c, `, val, `); err2 != nil {`) + g.In() + g.P(`return true, err`) + g.Out() + g.P(`}`) + val = "c" + } + if cast != "" { + val = cast + "(" + val + ")" + } + if cast2 != "" { + val = cast2 + "(" + val + ")" + } + switch *field.Type { + case descriptor.FieldDescriptorProto_TYPE_BOOL: + val += " != 0" + case descriptor.FieldDescriptorProto_TYPE_GROUP, + descriptor.FieldDescriptorProto_TYPE_MESSAGE: + if !gogoproto.IsStdTime(field) && !gogoproto.IsStdDuration(field) { + val = "msg" + } + } + if gogoproto.IsCastType(field) { + _, typ, err := getCastType(field) + if err != nil { + g.Fail(err.Error()) + } + val = typ + "(" + val + ")" + } + g.P("m.", oneofFieldName[*field.OneofIndex], " = &", oneofTypeName[field], "{", val, "}") + g.P("return true, err") + } + g.P("default: return false, nil") + g.P("}") + g.P("}") + g.P() + + // sizer + g.P("func ", size, sizeSig, " {") + g.P("m := msg.(*", ccTypeName, ")") + for oi, odp := range message.OneofDecl { + g.P("// ", odp.GetName()) + fname := oneofFieldName[int32(oi)] + g.P("switch x := m.", fname, ".(type) {") + for _, field := range message.Field { + if field.OneofIndex == nil || int(*field.OneofIndex) != oi { + continue + } + g.P("case *", oneofTypeName[field], ":") + val := "x." + fieldNames[field] + var wire, varint, fixed string + switch *field.Type { + case descriptor.FieldDescriptorProto_TYPE_DOUBLE: + wire = "WireFixed64" + fixed = "8" + case descriptor.FieldDescriptorProto_TYPE_FLOAT: + wire = "WireFixed32" + fixed = "4" + case descriptor.FieldDescriptorProto_TYPE_INT64, + descriptor.FieldDescriptorProto_TYPE_UINT64, + descriptor.FieldDescriptorProto_TYPE_INT32, + descriptor.FieldDescriptorProto_TYPE_UINT32, + descriptor.FieldDescriptorProto_TYPE_ENUM: + wire = "WireVarint" + varint = val + case descriptor.FieldDescriptorProto_TYPE_FIXED64, + descriptor.FieldDescriptorProto_TYPE_SFIXED64: + wire = "WireFixed64" + fixed = "8" + case descriptor.FieldDescriptorProto_TYPE_FIXED32, + descriptor.FieldDescriptorProto_TYPE_SFIXED32: + wire = "WireFixed32" + fixed = "4" + case descriptor.FieldDescriptorProto_TYPE_BOOL: + wire = "WireVarint" + fixed = "1" + case descriptor.FieldDescriptorProto_TYPE_STRING: + wire = "WireBytes" + fixed = "len(" + val + ")" + varint = fixed + case descriptor.FieldDescriptorProto_TYPE_GROUP: + wire = "WireStartGroup" + fixed = g.Pkg["proto"] + ".Size(" + val + ")" + case descriptor.FieldDescriptorProto_TYPE_MESSAGE: + wire = "WireBytes" + if gogoproto.IsStdTime(field) { + if gogoproto.IsNullable(field) { + val = "*" + val + } + pkg := g.useTypes() + g.P("s := ", pkg, ".SizeOfStdTime(", val, ")") + } else if gogoproto.IsStdDuration(field) { + if gogoproto.IsNullable(field) { + val = "*" + val + } + pkg := g.useTypes() + g.P("s := ", pkg, ".SizeOfStdDuration(", val, ")") + } else { + g.P("s := ", g.Pkg["proto"], ".Size(", val, ")") + } + fixed = "s" + varint = fixed + case descriptor.FieldDescriptorProto_TYPE_BYTES: + wire = "WireBytes" + if gogoproto.IsCustomType(field) { + fixed = val + ".Size()" + } else { + fixed = "len(" + val + ")" + } + varint = fixed + case descriptor.FieldDescriptorProto_TYPE_SINT32: + wire = "WireVarint" + varint = "(uint32(" + val + ") << 1) ^ uint32((int32(" + val + ") >> 31))" + case descriptor.FieldDescriptorProto_TYPE_SINT64: + wire = "WireVarint" + varint = "uint64(" + val + " << 1) ^ uint64((int64(" + val + ") >> 63))" + default: + g.Fail("unhandled oneof field type ", field.Type.String()) + } + g.P("n += ", g.Pkg["proto"], ".SizeVarint(", field.Number, "<<3|", g.Pkg["proto"], ".", wire, ")") + if varint != "" { + g.P("n += ", g.Pkg["proto"], ".SizeVarint(uint64(", varint, "))") + } + if fixed != "" { + g.P("n += ", fixed) + } + if *field.Type == descriptor.FieldDescriptorProto_TYPE_GROUP { + g.P("n += ", g.Pkg["proto"], ".SizeVarint(", field.Number, "<<3|", g.Pkg["proto"], ".WireEndGroup)") + } + } + g.P("case nil:") + g.P("default:") + g.P("panic(", g.Pkg["fmt"], ".Sprintf(\"proto: unexpected type %T in oneof\", x))") + g.P("}") + } + g.P("return n") + g.P("}") + g.P() + } + + for _, ext := range message.ext { + g.generateExtension(ext) + } + + fullName := strings.Join(message.TypeName(), ".") + if g.file.Package != nil { + fullName = *g.file.Package + "." + fullName + } + + g.addInitf("%s.RegisterType((*%s)(nil), %q)", g.Pkg["proto"], ccTypeName, fullName) +} + +func (g *Generator) generateExtension(ext *ExtensionDescriptor) { + ccTypeName := ext.DescName() + + extObj := g.ObjectNamed(*ext.Extendee) + var extDesc *Descriptor + if id, ok := extObj.(*ImportedDescriptor); ok { + // This is extending a publicly imported message. + // We need the underlying type for goTag. + extDesc = id.o.(*Descriptor) + } else { + extDesc = extObj.(*Descriptor) + } + extendedType := "*" + g.TypeName(extObj) // always use the original + field := ext.FieldDescriptorProto + fieldType, wireType := g.GoType(ext.parent, field) + tag := g.goTag(extDesc, field, wireType) + g.RecordTypeUse(*ext.Extendee) + if n := ext.FieldDescriptorProto.TypeName; n != nil { + // foreign extension type + g.RecordTypeUse(*n) + } + + typeName := ext.TypeName() + + // Special case for proto2 message sets: If this extension is extending + // proto2_bridge.MessageSet, and its final name component is "message_set_extension", + // then drop that last component. + mset := false + if extendedType == "*proto2_bridge.MessageSet" && typeName[len(typeName)-1] == "message_set_extension" { + typeName = typeName[:len(typeName)-1] + mset = true + } + + // For text formatting, the package must be exactly what the .proto file declares, + // ignoring overrides such as the go_package option, and with no dot/underscore mapping. + extName := strings.Join(typeName, ".") + if g.file.Package != nil { + extName = *g.file.Package + "." + extName + } + + g.P("var ", ccTypeName, " = &", g.Pkg["proto"], ".ExtensionDesc{") + g.In() + g.P("ExtendedType: (", extendedType, ")(nil),") + g.P("ExtensionType: (", fieldType, ")(nil),") + g.P("Field: ", field.Number, ",") + g.P(`Name: "`, extName, `",`) + g.P("Tag: ", tag, ",") + g.P(`Filename: "`, g.file.GetName(), `",`) + + g.Out() + g.P("}") + g.P() + + if mset { + // Generate a bit more code to register with message_set.go. + g.addInitf("%s.RegisterMessageSetType((%s)(nil), %d, %q)", g.Pkg["proto"], fieldType, *field.Number, extName) + } + + g.file.addExport(ext, constOrVarSymbol{ccTypeName, "var", ""}) +} + +func (g *Generator) generateInitFunction() { + for _, enum := range g.file.enum { + g.generateEnumRegistration(enum) + } + for _, d := range g.file.desc { + for _, ext := range d.ext { + g.generateExtensionRegistration(ext) + } + } + for _, ext := range g.file.ext { + g.generateExtensionRegistration(ext) + } + if len(g.init) == 0 { + return + } + g.P("func init() {") + g.In() + for _, l := range g.init { + g.P(l) + } + g.Out() + g.P("}") + g.init = nil +} + +func (g *Generator) generateFileDescriptor(file *FileDescriptor) { + // Make a copy and trim source_code_info data. + // TODO: Trim this more when we know exactly what we need. + pb := proto.Clone(file.FileDescriptorProto).(*descriptor.FileDescriptorProto) + pb.SourceCodeInfo = nil + + b, err := proto.Marshal(pb) + if err != nil { + g.Fail(err.Error()) + } + + var buf bytes.Buffer + w, _ := gzip.NewWriterLevel(&buf, gzip.BestCompression) + w.Write(b) + w.Close() + b = buf.Bytes() + + v := file.VarName() + g.P() + g.P("func init() { ", g.Pkg["proto"], ".RegisterFile(", strconv.Quote(*file.Name), ", ", v, ") }") + g.P("var ", v, " = []byte{") + g.In() + g.P("// ", len(b), " bytes of a gzipped FileDescriptorProto") + for len(b) > 0 { + n := 16 + if n > len(b) { + n = len(b) + } + + s := "" + for _, c := range b[:n] { + s += fmt.Sprintf("0x%02x,", c) + } + g.P(s) + + b = b[n:] + } + g.Out() + g.P("}") +} + +func (g *Generator) generateEnumRegistration(enum *EnumDescriptor) { + // // We always print the full (proto-world) package name here. + pkg := enum.File().GetPackage() + if pkg != "" { + pkg += "." + } + // The full type name + typeName := enum.TypeName() + // The full type name, CamelCased. + ccTypeName := CamelCaseSlice(typeName) + g.addInitf("%s.RegisterEnum(%q, %[3]s_name, %[3]s_value)", g.Pkg["proto"], pkg+ccTypeName, ccTypeName) +} + +func (g *Generator) generateExtensionRegistration(ext *ExtensionDescriptor) { + g.addInitf("%s.RegisterExtension(%s)", g.Pkg["proto"], ext.DescName()) +} + +// And now lots of helper functions. + +// Is c an ASCII lower-case letter? +func isASCIILower(c byte) bool { + return 'a' <= c && c <= 'z' +} + +// Is c an ASCII digit? +func isASCIIDigit(c byte) bool { + return '0' <= c && c <= '9' +} + +// CamelCase returns the CamelCased name. +// If there is an interior underscore followed by a lower case letter, +// drop the underscore and convert the letter to upper case. +// There is a remote possibility of this rewrite causing a name collision, +// but it's so remote we're prepared to pretend it's nonexistent - since the +// C++ generator lowercases names, it's extremely unlikely to have two fields +// with different capitalizations. +// In short, _my_field_name_2 becomes XMyFieldName_2. +func CamelCase(s string) string { + if s == "" { + return "" + } + t := make([]byte, 0, 32) + i := 0 + if s[0] == '_' { + // Need a capital letter; drop the '_'. + t = append(t, 'X') + i++ + } + // 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. + for ; i < len(s); i++ { + c := s[i] + if c == '_' && i+1 < len(s) && isASCIILower(s[i+1]) { + continue // Skip the underscore in s. + } + if isASCIIDigit(c) { + t = append(t, c) + continue + } + // 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 ^= ' ' // Make it a capital letter. + } + t = append(t, c) // Guaranteed not lower case. + // Accept lower case sequence that follows. + for i+1 < len(s) && isASCIILower(s[i+1]) { + i++ + t = append(t, s[i]) + } + } + return string(t) +} + +// CamelCaseSlice is like CamelCase, but the argument is a slice of strings to +// be joined with "_". +func CamelCaseSlice(elem []string) string { return CamelCase(strings.Join(elem, "_")) } + +// dottedSlice turns a sliced name into a dotted name. +func dottedSlice(elem []string) string { return strings.Join(elem, ".") } + +// Is this field optional? +func isOptional(field *descriptor.FieldDescriptorProto) bool { + return field.Label != nil && *field.Label == descriptor.FieldDescriptorProto_LABEL_OPTIONAL +} + +// Is this field required? +func isRequired(field *descriptor.FieldDescriptorProto) bool { + return field.Label != nil && *field.Label == descriptor.FieldDescriptorProto_LABEL_REQUIRED +} + +// Is this field repeated? +func isRepeated(field *descriptor.FieldDescriptorProto) bool { + return field.Label != nil && *field.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED +} + +// Is this field a scalar numeric type? +func IsScalar(field *descriptor.FieldDescriptorProto) bool { + if field.Type == nil { + return false + } + switch *field.Type { + case descriptor.FieldDescriptorProto_TYPE_DOUBLE, + descriptor.FieldDescriptorProto_TYPE_FLOAT, + descriptor.FieldDescriptorProto_TYPE_INT64, + descriptor.FieldDescriptorProto_TYPE_UINT64, + descriptor.FieldDescriptorProto_TYPE_INT32, + descriptor.FieldDescriptorProto_TYPE_FIXED64, + descriptor.FieldDescriptorProto_TYPE_FIXED32, + descriptor.FieldDescriptorProto_TYPE_BOOL, + descriptor.FieldDescriptorProto_TYPE_UINT32, + descriptor.FieldDescriptorProto_TYPE_ENUM, + descriptor.FieldDescriptorProto_TYPE_SFIXED32, + descriptor.FieldDescriptorProto_TYPE_SFIXED64, + descriptor.FieldDescriptorProto_TYPE_SINT32, + descriptor.FieldDescriptorProto_TYPE_SINT64: + return true + default: + return false + } +} + +// badToUnderscore is the mapping function used to generate Go names from package names, +// which can be dotted in the input .proto file. It replaces non-identifier characters such as +// dot or dash with underscore. +func badToUnderscore(r rune) rune { + if unicode.IsLetter(r) || unicode.IsDigit(r) || r == '_' { + return r + } + return '_' +} + +// baseName returns the last path element of the name, with the last dotted suffix removed. +func baseName(name string) string { + // First, find the last element + if i := strings.LastIndex(name, "/"); i >= 0 { + name = name[i+1:] + } + // Now drop the suffix + if i := strings.LastIndex(name, "."); i >= 0 { + name = name[0:i] + } + return name +} + +// The SourceCodeInfo message describes the location of elements of a parsed +// .proto file by way of a "path", which is a sequence of integers that +// describe the route from a FileDescriptorProto to the relevant submessage. +// The path alternates between a field number of a repeated field, and an index +// into that repeated field. The constants below define the field numbers that +// are used. +// +// See descriptor.proto for more information about this. +const ( + // tag numbers in FileDescriptorProto + packagePath = 2 // package + messagePath = 4 // message_type + enumPath = 5 // enum_type + // tag numbers in DescriptorProto + messageFieldPath = 2 // field + messageMessagePath = 3 // nested_type + messageEnumPath = 4 // enum_type + messageOneofPath = 8 // oneof_decl + // tag numbers in EnumDescriptorProto + enumValuePath = 2 // value +) diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/generator/helper.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/generator/helper.go new file mode 100644 index 00000000000..d7a406e7ccd --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/generator/helper.go @@ -0,0 +1,447 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package generator + +import ( + "bytes" + "go/parser" + "go/printer" + "go/token" + "path" + "strings" + + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/proto" + descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" + plugin "github.com/gogo/protobuf/protoc-gen-gogo/plugin" +) + +func (d *FileDescriptor) Messages() []*Descriptor { + return d.desc +} + +func (d *FileDescriptor) Enums() []*EnumDescriptor { + return d.enum +} + +func (d *Descriptor) IsGroup() bool { + return d.group +} + +func (g *Generator) IsGroup(field *descriptor.FieldDescriptorProto) bool { + if d, ok := g.typeNameToObject[field.GetTypeName()].(*Descriptor); ok { + return d.IsGroup() + } + return false +} + +func (g *Generator) TypeNameByObject(typeName string) Object { + o, ok := g.typeNameToObject[typeName] + if !ok { + g.Fail("can't find object with type", typeName) + } + return o +} + +func (g *Generator) OneOfTypeName(message *Descriptor, field *descriptor.FieldDescriptorProto) string { + typeName := message.TypeName() + ccTypeName := CamelCaseSlice(typeName) + fieldName := g.GetOneOfFieldName(message, field) + tname := ccTypeName + "_" + fieldName + // It is possible for this to collide with a message or enum + // nested in this message. Check for collisions. + ok := true + for _, desc := range message.nested { + if strings.Join(desc.TypeName(), "_") == tname { + ok = false + break + } + } + for _, enum := range message.enums { + if strings.Join(enum.TypeName(), "_") == tname { + ok = false + break + } + } + if !ok { + tname += "_" + } + return tname +} + +type PluginImports interface { + NewImport(pkg string) Single + GenerateImports(file *FileDescriptor) +} + +type pluginImports struct { + generator *Generator + singles []Single +} + +func NewPluginImports(generator *Generator) *pluginImports { + return &pluginImports{generator, make([]Single, 0)} +} + +func (this *pluginImports) NewImport(pkg string) Single { + imp := newImportedPackage(this.generator.ImportPrefix, pkg) + this.singles = append(this.singles, imp) + return imp +} + +func (this *pluginImports) GenerateImports(file *FileDescriptor) { + for _, s := range this.singles { + if s.IsUsed() { + this.generator.PrintImport(s.Name(), s.Location()) + } + } +} + +type Single interface { + Use() string + IsUsed() bool + Name() string + Location() string +} + +type importedPackage struct { + used bool + pkg string + name string + importPrefix string +} + +func newImportedPackage(importPrefix, pkg string) *importedPackage { + return &importedPackage{ + pkg: pkg, + importPrefix: importPrefix, + } +} + +func (this *importedPackage) Use() string { + if !this.used { + this.name = RegisterUniquePackageName(this.pkg, nil) + this.used = true + } + return this.name +} + +func (this *importedPackage) IsUsed() bool { + return this.used +} + +func (this *importedPackage) Name() string { + return this.name +} + +func (this *importedPackage) Location() string { + return this.importPrefix + this.pkg +} + +func (g *Generator) GetFieldName(message *Descriptor, field *descriptor.FieldDescriptorProto) string { + goTyp, _ := g.GoType(message, field) + fieldname := CamelCase(*field.Name) + if gogoproto.IsCustomName(field) { + fieldname = gogoproto.GetCustomName(field) + } + if gogoproto.IsEmbed(field) { + fieldname = EmbedFieldName(goTyp) + } + if field.OneofIndex != nil { + fieldname = message.OneofDecl[int(*field.OneofIndex)].GetName() + fieldname = CamelCase(fieldname) + } + for _, f := range methodNames { + if f == fieldname { + return fieldname + "_" + } + } + if !gogoproto.IsProtoSizer(message.file, message.DescriptorProto) { + if fieldname == "Size" { + return fieldname + "_" + } + } + return fieldname +} + +func (g *Generator) GetOneOfFieldName(message *Descriptor, field *descriptor.FieldDescriptorProto) string { + goTyp, _ := g.GoType(message, field) + fieldname := CamelCase(*field.Name) + if gogoproto.IsCustomName(field) { + fieldname = gogoproto.GetCustomName(field) + } + if gogoproto.IsEmbed(field) { + fieldname = EmbedFieldName(goTyp) + } + for _, f := range methodNames { + if f == fieldname { + return fieldname + "_" + } + } + if !gogoproto.IsProtoSizer(message.file, message.DescriptorProto) { + if fieldname == "Size" { + return fieldname + "_" + } + } + return fieldname +} + +func (g *Generator) IsMap(field *descriptor.FieldDescriptorProto) bool { + if !field.IsMessage() { + return false + } + byName := g.ObjectNamed(field.GetTypeName()) + desc, ok := byName.(*Descriptor) + if byName == nil || !ok || !desc.GetOptions().GetMapEntry() { + return false + } + return true +} + +func (g *Generator) GetMapKeyField(field, keyField *descriptor.FieldDescriptorProto) *descriptor.FieldDescriptorProto { + if !gogoproto.IsCastKey(field) { + return keyField + } + keyField = proto.Clone(keyField).(*descriptor.FieldDescriptorProto) + if keyField.Options == nil { + keyField.Options = &descriptor.FieldOptions{} + } + keyType := gogoproto.GetCastKey(field) + if err := proto.SetExtension(keyField.Options, gogoproto.E_Casttype, &keyType); err != nil { + g.Fail(err.Error()) + } + return keyField +} + +func (g *Generator) GetMapValueField(field, valField *descriptor.FieldDescriptorProto) *descriptor.FieldDescriptorProto { + if gogoproto.IsCustomType(field) && gogoproto.IsCastValue(field) { + g.Fail("cannot have a customtype and casttype: ", field.String()) + } + valField = proto.Clone(valField).(*descriptor.FieldDescriptorProto) + if valField.Options == nil { + valField.Options = &descriptor.FieldOptions{} + } + + stdtime := gogoproto.IsStdTime(field) + if stdtime { + if err := proto.SetExtension(valField.Options, gogoproto.E_Stdtime, &stdtime); err != nil { + g.Fail(err.Error()) + } + } + + stddur := gogoproto.IsStdDuration(field) + if stddur { + if err := proto.SetExtension(valField.Options, gogoproto.E_Stdduration, &stddur); err != nil { + g.Fail(err.Error()) + } + } + + if valType := gogoproto.GetCastValue(field); len(valType) > 0 { + if err := proto.SetExtension(valField.Options, gogoproto.E_Casttype, &valType); err != nil { + g.Fail(err.Error()) + } + } + if valType := gogoproto.GetCustomType(field); len(valType) > 0 { + if err := proto.SetExtension(valField.Options, gogoproto.E_Customtype, &valType); err != nil { + g.Fail(err.Error()) + } + } + + nullable := gogoproto.IsNullable(field) + if err := proto.SetExtension(valField.Options, gogoproto.E_Nullable, &nullable); err != nil { + g.Fail(err.Error()) + } + return valField +} + +// GoMapValueTypes returns the map value Go type and the alias map value Go type (for casting), taking into +// account whether the map is nullable or the value is a message. +func GoMapValueTypes(mapField, valueField *descriptor.FieldDescriptorProto, goValueType, goValueAliasType string) (nullable bool, outGoType string, outGoAliasType string) { + nullable = gogoproto.IsNullable(mapField) && (valueField.IsMessage() || gogoproto.IsCustomType(mapField)) + if nullable { + // ensure the non-aliased Go value type is a pointer for consistency + if strings.HasPrefix(goValueType, "*") { + outGoType = goValueType + } else { + outGoType = "*" + goValueType + } + outGoAliasType = goValueAliasType + } else { + outGoType = strings.Replace(goValueType, "*", "", 1) + outGoAliasType = strings.Replace(goValueAliasType, "*", "", 1) + } + return +} + +func GoTypeToName(goTyp string) string { + return strings.Replace(strings.Replace(goTyp, "*", "", -1), "[]", "", -1) +} + +func EmbedFieldName(goTyp string) string { + goTyp = GoTypeToName(goTyp) + goTyps := strings.Split(goTyp, ".") + if len(goTyps) == 1 { + return goTyp + } + if len(goTyps) == 2 { + return goTyps[1] + } + panic("unreachable") +} + +func (g *Generator) GeneratePlugin(p Plugin) { + plugins = []Plugin{p} + p.Init(g) + // Generate the output. The generator runs for every file, even the files + // that we don't generate output for, so that we can collate the full list + // of exported symbols to support public imports. + genFileMap := make(map[*FileDescriptor]bool, len(g.genFiles)) + for _, file := range g.genFiles { + genFileMap[file] = true + } + for _, file := range g.allFiles { + g.Reset() + g.writeOutput = genFileMap[file] + g.generatePlugin(file, p) + if !g.writeOutput { + continue + } + g.Response.File = append(g.Response.File, &plugin.CodeGeneratorResponse_File{ + Name: proto.String(file.goFileName()), + Content: proto.String(g.String()), + }) + } +} + +func (g *Generator) SetFile(file *descriptor.FileDescriptorProto) { + g.file = g.FileOf(file) +} + +func (g *Generator) generatePlugin(file *FileDescriptor, p Plugin) { + g.writtenImports = make(map[string]bool) + g.file = g.FileOf(file.FileDescriptorProto) + g.usedPackages = make(map[string]bool) + + // Run the plugins before the imports so we know which imports are necessary. + p.Generate(file) + + // Generate header and imports last, though they appear first in the output. + rem := g.Buffer + g.Buffer = new(bytes.Buffer) + g.generateHeader() + p.GenerateImports(g.file) + g.generateImports() + if !g.writeOutput { + return + } + g.Write(rem.Bytes()) + + // Reformat generated code. + contents := string(g.Buffer.Bytes()) + fset := token.NewFileSet() + ast, err := parser.ParseFile(fset, "", g, parser.ParseComments) + if err != nil { + g.Fail("bad Go source code was generated:", contents, err.Error()) + return + } + g.Reset() + err = (&printer.Config{Mode: printer.TabIndent | printer.UseSpaces, Tabwidth: 8}).Fprint(g, fset, ast) + if err != nil { + g.Fail("generated Go source code could not be reformatted:", err.Error()) + } +} + +func GetCustomType(field *descriptor.FieldDescriptorProto) (packageName string, typ string, err error) { + return getCustomType(field) +} + +func getCustomType(field *descriptor.FieldDescriptorProto) (packageName string, typ string, err error) { + if field.Options != nil { + var v interface{} + v, err = proto.GetExtension(field.Options, gogoproto.E_Customtype) + if err == nil && v.(*string) != nil { + ctype := *(v.(*string)) + packageName, typ = splitCPackageType(ctype) + return packageName, typ, nil + } + } + return "", "", err +} + +func splitCPackageType(ctype string) (packageName string, typ string) { + ss := strings.Split(ctype, ".") + if len(ss) == 1 { + return "", ctype + } + packageName = strings.Join(ss[0:len(ss)-1], ".") + typeName := ss[len(ss)-1] + importStr := strings.Map(badToUnderscore, packageName) + typ = importStr + "." + typeName + return packageName, typ +} + +func getCastType(field *descriptor.FieldDescriptorProto) (packageName string, typ string, err error) { + if field.Options != nil { + var v interface{} + v, err = proto.GetExtension(field.Options, gogoproto.E_Casttype) + if err == nil && v.(*string) != nil { + ctype := *(v.(*string)) + packageName, typ = splitCPackageType(ctype) + return packageName, typ, nil + } + } + return "", "", err +} + +func FileName(file *FileDescriptor) string { + fname := path.Base(file.FileDescriptorProto.GetName()) + fname = strings.Replace(fname, ".proto", "", -1) + fname = strings.Replace(fname, "-", "_", -1) + fname = strings.Replace(fname, ".", "_", -1) + return CamelCase(fname) +} + +func (g *Generator) AllFiles() *descriptor.FileDescriptorSet { + set := &descriptor.FileDescriptorSet{} + set.File = make([]*descriptor.FileDescriptorProto, len(g.allFiles)) + for i := range g.allFiles { + set.File[i] = g.allFiles[i].FileDescriptorProto + } + return set +} + +func (d *Descriptor) Path() string { + return d.path +} + +func (g *Generator) useTypes() string { + pkg := strings.Map(badToUnderscore, "github.com/gogo/protobuf/types") + g.customImports = append(g.customImports, "github.com/gogo/protobuf/types") + return pkg +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/grpc/grpc.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/grpc/grpc.go new file mode 100644 index 00000000000..359001b4709 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/grpc/grpc.go @@ -0,0 +1,463 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2015 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +// Package grpc outputs gRPC service descriptions in Go code. +// It runs as a plugin for the Go protocol buffer compiler plugin. +// It is linked in to protoc-gen-go. +package grpc + +import ( + "fmt" + "path" + "strconv" + "strings" + + pb "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" +) + +// generatedCodeVersion indicates a version of the generated code. +// It is incremented whenever an incompatibility between the generated code and +// the grpc package is introduced; the generated code references +// a constant, grpc.SupportPackageIsVersionN (where N is generatedCodeVersion). +const generatedCodeVersion = 4 + +// Paths for packages used by code generated in this file, +// relative to the import_prefix of the generator.Generator. +const ( + contextPkgPath = "golang.org/x/net/context" + grpcPkgPath = "google.golang.org/grpc" +) + +func init() { + generator.RegisterPlugin(new(grpc)) +} + +// grpc is an implementation of the Go protocol buffer compiler's +// plugin architecture. It generates bindings for gRPC support. +type grpc struct { + gen *generator.Generator +} + +// Name returns the name of this plugin, "grpc". +func (g *grpc) Name() string { + return "grpc" +} + +// The names for packages imported in the generated code. +// They may vary from the final path component of the import path +// if the name is used by other packages. +var ( + contextPkg string + grpcPkg string +) + +// Init initializes the plugin. +func (g *grpc) Init(gen *generator.Generator) { + g.gen = gen + contextPkg = generator.RegisterUniquePackageName("context", nil) + grpcPkg = generator.RegisterUniquePackageName("grpc", nil) +} + +// Given a type name defined in a .proto, return its object. +// Also record that we're using it, to guarantee the associated import. +func (g *grpc) objectNamed(name string) generator.Object { + g.gen.RecordTypeUse(name) + return g.gen.ObjectNamed(name) +} + +// Given a type name defined in a .proto, return its name as we will print it. +func (g *grpc) typeName(str string) string { + return g.gen.TypeName(g.objectNamed(str)) +} + +// P forwards to g.gen.P. +func (g *grpc) P(args ...interface{}) { g.gen.P(args...) } + +// Generate generates code for the services in the given file. +func (g *grpc) Generate(file *generator.FileDescriptor) { + if len(file.FileDescriptorProto.Service) == 0 { + return + } + + g.P("// Reference imports to suppress errors if they are not otherwise used.") + g.P("var _ ", contextPkg, ".Context") + g.P("var _ ", grpcPkg, ".ClientConn") + g.P() + + // Assert version compatibility. + g.P("// This is a compile-time assertion to ensure that this generated file") + g.P("// is compatible with the grpc package it is being compiled against.") + g.P("const _ = ", grpcPkg, ".SupportPackageIsVersion", generatedCodeVersion) + g.P() + + for i, service := range file.FileDescriptorProto.Service { + g.generateService(file, service, i) + } +} + +// GenerateImports generates the import declaration for this file. +func (g *grpc) GenerateImports(file *generator.FileDescriptor) { + if len(file.FileDescriptorProto.Service) == 0 { + return + } + g.P("import (") + g.P(contextPkg, " ", strconv.Quote(path.Join(g.gen.ImportPrefix, contextPkgPath))) + g.P(grpcPkg, " ", strconv.Quote(path.Join(g.gen.ImportPrefix, grpcPkgPath))) + g.P(")") + g.P() +} + +// reservedClientName records whether a client name is reserved on the client side. +var reservedClientName = map[string]bool{ +// TODO: do we need any in gRPC? +} + +func unexport(s string) string { return strings.ToLower(s[:1]) + s[1:] } + +// generateService generates all the code for the named service. +func (g *grpc) generateService(file *generator.FileDescriptor, service *pb.ServiceDescriptorProto, index int) { + path := fmt.Sprintf("6,%d", index) // 6 means service. + + origServName := service.GetName() + fullServName := origServName + if pkg := file.GetPackage(); pkg != "" { + fullServName = pkg + "." + fullServName + } + servName := generator.CamelCase(origServName) + + g.P() + g.P("// Client API for ", servName, " service") + g.P() + + // Client interface. + g.P("type ", servName, "Client interface {") + for i, method := range service.Method { + g.gen.PrintComments(fmt.Sprintf("%s,2,%d", path, i)) // 2 means method in a service. + g.P(g.generateClientSignature(servName, method)) + } + g.P("}") + g.P() + + // Client structure. + g.P("type ", unexport(servName), "Client struct {") + g.P("cc *", grpcPkg, ".ClientConn") + g.P("}") + g.P() + + // NewClient factory. + g.P("func New", servName, "Client (cc *", grpcPkg, ".ClientConn) ", servName, "Client {") + g.P("return &", unexport(servName), "Client{cc}") + g.P("}") + g.P() + + var methodIndex, streamIndex int + serviceDescVar := "_" + servName + "_serviceDesc" + // Client method implementations. + for _, method := range service.Method { + var descExpr string + if !method.GetServerStreaming() && !method.GetClientStreaming() { + // Unary RPC method + descExpr = fmt.Sprintf("&%s.Methods[%d]", serviceDescVar, methodIndex) + methodIndex++ + } else { + // Streaming RPC method + descExpr = fmt.Sprintf("&%s.Streams[%d]", serviceDescVar, streamIndex) + streamIndex++ + } + g.generateClientMethod(servName, fullServName, serviceDescVar, method, descExpr) + } + + g.P("// Server API for ", servName, " service") + g.P() + + // Server interface. + serverType := servName + "Server" + g.P("type ", serverType, " interface {") + for i, method := range service.Method { + g.gen.PrintComments(fmt.Sprintf("%s,2,%d", path, i)) // 2 means method in a service. + g.P(g.generateServerSignature(servName, method)) + } + g.P("}") + g.P() + + // Server registration. + g.P("func Register", servName, "Server(s *", grpcPkg, ".Server, srv ", serverType, ") {") + g.P("s.RegisterService(&", serviceDescVar, `, srv)`) + g.P("}") + g.P() + + // Server handler implementations. + var handlerNames []string + for _, method := range service.Method { + hname := g.generateServerMethod(servName, fullServName, method) + handlerNames = append(handlerNames, hname) + } + + // Service descriptor. + g.P("var ", serviceDescVar, " = ", grpcPkg, ".ServiceDesc {") + g.P("ServiceName: ", strconv.Quote(fullServName), ",") + g.P("HandlerType: (*", serverType, ")(nil),") + g.P("Methods: []", grpcPkg, ".MethodDesc{") + for i, method := range service.Method { + if method.GetServerStreaming() || method.GetClientStreaming() { + continue + } + g.P("{") + g.P("MethodName: ", strconv.Quote(method.GetName()), ",") + g.P("Handler: ", handlerNames[i], ",") + g.P("},") + } + g.P("},") + g.P("Streams: []", grpcPkg, ".StreamDesc{") + for i, method := range service.Method { + if !method.GetServerStreaming() && !method.GetClientStreaming() { + continue + } + g.P("{") + g.P("StreamName: ", strconv.Quote(method.GetName()), ",") + g.P("Handler: ", handlerNames[i], ",") + if method.GetServerStreaming() { + g.P("ServerStreams: true,") + } + if method.GetClientStreaming() { + g.P("ClientStreams: true,") + } + g.P("},") + } + g.P("},") + g.P("Metadata: \"", file.GetName(), "\",") + g.P("}") + g.P() +} + +// generateClientSignature returns the client-side signature for a method. +func (g *grpc) generateClientSignature(servName string, method *pb.MethodDescriptorProto) string { + origMethName := method.GetName() + methName := generator.CamelCase(origMethName) + if reservedClientName[methName] { + methName += "_" + } + reqArg := ", in *" + g.typeName(method.GetInputType()) + if method.GetClientStreaming() { + reqArg = "" + } + respName := "*" + g.typeName(method.GetOutputType()) + if method.GetServerStreaming() || method.GetClientStreaming() { + respName = servName + "_" + generator.CamelCase(origMethName) + "Client" + } + return fmt.Sprintf("%s(ctx %s.Context%s, opts ...%s.CallOption) (%s, error)", methName, contextPkg, reqArg, grpcPkg, respName) +} + +func (g *grpc) generateClientMethod(servName, fullServName, serviceDescVar string, method *pb.MethodDescriptorProto, descExpr string) { + sname := fmt.Sprintf("/%s/%s", fullServName, method.GetName()) + methName := generator.CamelCase(method.GetName()) + inType := g.typeName(method.GetInputType()) + outType := g.typeName(method.GetOutputType()) + + g.P("func (c *", unexport(servName), "Client) ", g.generateClientSignature(servName, method), "{") + if !method.GetServerStreaming() && !method.GetClientStreaming() { + g.P("out := new(", outType, ")") + // TODO: Pass descExpr to Invoke. + g.P("err := ", grpcPkg, `.Invoke(ctx, "`, sname, `", in, out, c.cc, opts...)`) + g.P("if err != nil { return nil, err }") + g.P("return out, nil") + g.P("}") + g.P() + return + } + streamType := unexport(servName) + methName + "Client" + g.P("stream, err := ", grpcPkg, ".NewClientStream(ctx, ", descExpr, `, c.cc, "`, sname, `", opts...)`) + g.P("if err != nil { return nil, err }") + g.P("x := &", streamType, "{stream}") + if !method.GetClientStreaming() { + g.P("if err := x.ClientStream.SendMsg(in); err != nil { return nil, err }") + g.P("if err := x.ClientStream.CloseSend(); err != nil { return nil, err }") + } + g.P("return x, nil") + g.P("}") + g.P() + + genSend := method.GetClientStreaming() + genRecv := method.GetServerStreaming() + genCloseAndRecv := !method.GetServerStreaming() + + // Stream auxiliary types and methods. + g.P("type ", servName, "_", methName, "Client interface {") + if genSend { + g.P("Send(*", inType, ") error") + } + if genRecv { + g.P("Recv() (*", outType, ", error)") + } + if genCloseAndRecv { + g.P("CloseAndRecv() (*", outType, ", error)") + } + g.P(grpcPkg, ".ClientStream") + g.P("}") + g.P() + + g.P("type ", streamType, " struct {") + g.P(grpcPkg, ".ClientStream") + g.P("}") + g.P() + + if genSend { + g.P("func (x *", streamType, ") Send(m *", inType, ") error {") + g.P("return x.ClientStream.SendMsg(m)") + g.P("}") + g.P() + } + if genRecv { + g.P("func (x *", streamType, ") Recv() (*", outType, ", error) {") + g.P("m := new(", outType, ")") + g.P("if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err }") + g.P("return m, nil") + g.P("}") + g.P() + } + if genCloseAndRecv { + g.P("func (x *", streamType, ") CloseAndRecv() (*", outType, ", error) {") + g.P("if err := x.ClientStream.CloseSend(); err != nil { return nil, err }") + g.P("m := new(", outType, ")") + g.P("if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err }") + g.P("return m, nil") + g.P("}") + g.P() + } +} + +// generateServerSignature returns the server-side signature for a method. +func (g *grpc) generateServerSignature(servName string, method *pb.MethodDescriptorProto) string { + origMethName := method.GetName() + methName := generator.CamelCase(origMethName) + if reservedClientName[methName] { + methName += "_" + } + + var reqArgs []string + ret := "error" + if !method.GetServerStreaming() && !method.GetClientStreaming() { + reqArgs = append(reqArgs, contextPkg+".Context") + ret = "(*" + g.typeName(method.GetOutputType()) + ", error)" + } + if !method.GetClientStreaming() { + reqArgs = append(reqArgs, "*"+g.typeName(method.GetInputType())) + } + if method.GetServerStreaming() || method.GetClientStreaming() { + reqArgs = append(reqArgs, servName+"_"+generator.CamelCase(origMethName)+"Server") + } + + return methName + "(" + strings.Join(reqArgs, ", ") + ") " + ret +} + +func (g *grpc) generateServerMethod(servName, fullServName string, method *pb.MethodDescriptorProto) string { + methName := generator.CamelCase(method.GetName()) + hname := fmt.Sprintf("_%s_%s_Handler", servName, methName) + inType := g.typeName(method.GetInputType()) + outType := g.typeName(method.GetOutputType()) + + if !method.GetServerStreaming() && !method.GetClientStreaming() { + g.P("func ", hname, "(srv interface{}, ctx ", contextPkg, ".Context, dec func(interface{}) error, interceptor ", grpcPkg, ".UnaryServerInterceptor) (interface{}, error) {") + g.P("in := new(", inType, ")") + g.P("if err := dec(in); err != nil { return nil, err }") + g.P("if interceptor == nil { return srv.(", servName, "Server).", methName, "(ctx, in) }") + g.P("info := &", grpcPkg, ".UnaryServerInfo{") + g.P("Server: srv,") + g.P("FullMethod: ", strconv.Quote(fmt.Sprintf("/%s/%s", fullServName, methName)), ",") + g.P("}") + g.P("handler := func(ctx ", contextPkg, ".Context, req interface{}) (interface{}, error) {") + g.P("return srv.(", servName, "Server).", methName, "(ctx, req.(*", inType, "))") + g.P("}") + g.P("return interceptor(ctx, in, info, handler)") + g.P("}") + g.P() + return hname + } + streamType := unexport(servName) + methName + "Server" + g.P("func ", hname, "(srv interface{}, stream ", grpcPkg, ".ServerStream) error {") + if !method.GetClientStreaming() { + g.P("m := new(", inType, ")") + g.P("if err := stream.RecvMsg(m); err != nil { return err }") + g.P("return srv.(", servName, "Server).", methName, "(m, &", streamType, "{stream})") + } else { + g.P("return srv.(", servName, "Server).", methName, "(&", streamType, "{stream})") + } + g.P("}") + g.P() + + genSend := method.GetServerStreaming() + genSendAndClose := !method.GetServerStreaming() + genRecv := method.GetClientStreaming() + + // Stream auxiliary types and methods. + g.P("type ", servName, "_", methName, "Server interface {") + if genSend { + g.P("Send(*", outType, ") error") + } + if genSendAndClose { + g.P("SendAndClose(*", outType, ") error") + } + if genRecv { + g.P("Recv() (*", inType, ", error)") + } + g.P(grpcPkg, ".ServerStream") + g.P("}") + g.P() + + g.P("type ", streamType, " struct {") + g.P(grpcPkg, ".ServerStream") + g.P("}") + g.P() + + if genSend { + g.P("func (x *", streamType, ") Send(m *", outType, ") error {") + g.P("return x.ServerStream.SendMsg(m)") + g.P("}") + g.P() + } + if genSendAndClose { + g.P("func (x *", streamType, ") SendAndClose(m *", outType, ") error {") + g.P("return x.ServerStream.SendMsg(m)") + g.P("}") + g.P() + } + if genRecv { + g.P("func (x *", streamType, ") Recv() (*", inType, ", error) {") + g.P("m := new(", inType, ")") + g.P("if err := x.ServerStream.RecvMsg(m); err != nil { return nil, err }") + g.P("return m, nil") + g.P("}") + g.P() + } + + return hname +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/main.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/main.go new file mode 100644 index 00000000000..dd8e795030c --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/main.go @@ -0,0 +1,57 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +// protoc-gen-go is a plugin for the Google protocol buffer compiler to generate +// Go code. Run it by building this program and putting it in your path with +// the name +// protoc-gen-gogo +// That word 'gogo' at the end becomes part of the option string set for the +// protocol compiler, so once the protocol compiler (protoc) is installed +// you can run +// protoc --gogo_out=output_directory input_directory/file.proto +// to generate Go bindings for the protocol defined by file.proto. +// With that input, the output will be written to +// output_directory/file.pb.go +// +// The generated code is documented in the package comment for +// the library. +// +// See the README and documentation for protocol buffers to learn more: +// https://developers.google.com/protocol-buffers/ +package main + +import ( + "github.com/gogo/protobuf/vanity/command" +) + +func main() { + command.Write(command.Generate(command.Read())) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/plugin/plugin.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/plugin/plugin.pb.go new file mode 100644 index 00000000000..6c5973e9281 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/plugin/plugin.pb.go @@ -0,0 +1,230 @@ +// Code generated by protoc-gen-gogo. +// source: plugin.proto +// DO NOT EDIT! + +/* +Package plugin_go is a generated protocol buffer package. + +It is generated from these files: + plugin.proto + +It has these top-level messages: + CodeGeneratorRequest + CodeGeneratorResponse +*/ +package plugin_go + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import google_protobuf "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// An encoded CodeGeneratorRequest is written to the plugin's stdin. +type CodeGeneratorRequest struct { + // The .proto files that were explicitly listed on the command-line. The + // code generator should generate code only for these files. Each file's + // descriptor will be included in proto_file, below. + FileToGenerate []string `protobuf:"bytes,1,rep,name=file_to_generate,json=fileToGenerate" json:"file_to_generate,omitempty"` + // The generator parameter passed on the command-line. + Parameter *string `protobuf:"bytes,2,opt,name=parameter" json:"parameter,omitempty"` + // FileDescriptorProtos for all files in files_to_generate and everything + // they import. The files will appear in topological order, so each file + // appears before any file that imports it. + // + // protoc guarantees that all proto_files will be written after + // the fields above, even though this is not technically guaranteed by the + // protobuf wire format. This theoretically could allow a plugin to stream + // in the FileDescriptorProtos and handle them one by one rather than read + // the entire set into memory at once. However, as of this writing, this + // is not similarly optimized on protoc's end -- it will store all fields in + // memory at once before sending them to the plugin. + ProtoFile []*google_protobuf.FileDescriptorProto `protobuf:"bytes,15,rep,name=proto_file,json=protoFile" json:"proto_file,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *CodeGeneratorRequest) Reset() { *m = CodeGeneratorRequest{} } +func (m *CodeGeneratorRequest) String() string { return proto.CompactTextString(m) } +func (*CodeGeneratorRequest) ProtoMessage() {} +func (*CodeGeneratorRequest) Descriptor() ([]byte, []int) { return fileDescriptorPlugin, []int{0} } + +func (m *CodeGeneratorRequest) GetFileToGenerate() []string { + if m != nil { + return m.FileToGenerate + } + return nil +} + +func (m *CodeGeneratorRequest) GetParameter() string { + if m != nil && m.Parameter != nil { + return *m.Parameter + } + return "" +} + +func (m *CodeGeneratorRequest) GetProtoFile() []*google_protobuf.FileDescriptorProto { + if m != nil { + return m.ProtoFile + } + return nil +} + +// The plugin writes an encoded CodeGeneratorResponse to stdout. +type CodeGeneratorResponse struct { + // Error message. If non-empty, code generation failed. The plugin process + // should exit with status code zero even if it reports an error in this way. + // + // This should be used to indicate errors in .proto files which prevent the + // code generator from generating correct code. Errors which indicate a + // problem in protoc itself -- such as the input CodeGeneratorRequest being + // unparseable -- should be reported by writing a message to stderr and + // exiting with a non-zero status code. + Error *string `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"` + File []*CodeGeneratorResponse_File `protobuf:"bytes,15,rep,name=file" json:"file,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *CodeGeneratorResponse) Reset() { *m = CodeGeneratorResponse{} } +func (m *CodeGeneratorResponse) String() string { return proto.CompactTextString(m) } +func (*CodeGeneratorResponse) ProtoMessage() {} +func (*CodeGeneratorResponse) Descriptor() ([]byte, []int) { return fileDescriptorPlugin, []int{1} } + +func (m *CodeGeneratorResponse) GetError() string { + if m != nil && m.Error != nil { + return *m.Error + } + return "" +} + +func (m *CodeGeneratorResponse) GetFile() []*CodeGeneratorResponse_File { + if m != nil { + return m.File + } + return nil +} + +// Represents a single generated file. +type CodeGeneratorResponse_File struct { + // The file name, relative to the output directory. The name must not + // contain "." or ".." components and must be relative, not be absolute (so, + // the file cannot lie outside the output directory). "/" must be used as + // the path separator, not "\". + // + // If the name is omitted, the content will be appended to the previous + // file. This allows the generator to break large files into small chunks, + // and allows the generated text to be streamed back to protoc so that large + // files need not reside completely in memory at one time. Note that as of + // this writing protoc does not optimize for this -- it will read the entire + // CodeGeneratorResponse before writing files to disk. + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // If non-empty, indicates that the named file should already exist, and the + // content here is to be inserted into that file at a defined insertion + // point. This feature allows a code generator to extend the output + // produced by another code generator. The original generator may provide + // insertion points by placing special annotations in the file that look + // like: + // @@protoc_insertion_point(NAME) + // The annotation can have arbitrary text before and after it on the line, + // which allows it to be placed in a comment. NAME should be replaced with + // an identifier naming the point -- this is what other generators will use + // as the insertion_point. Code inserted at this point will be placed + // immediately above the line containing the insertion point (thus multiple + // insertions to the same point will come out in the order they were added). + // The double-@ is intended to make it unlikely that the generated code + // could contain things that look like insertion points by accident. + // + // For example, the C++ code generator places the following line in the + // .pb.h files that it generates: + // // @@protoc_insertion_point(namespace_scope) + // This line appears within the scope of the file's package namespace, but + // outside of any particular class. Another plugin can then specify the + // insertion_point "namespace_scope" to generate additional classes or + // other declarations that should be placed in this scope. + // + // Note that if the line containing the insertion point begins with + // whitespace, the same whitespace will be added to every line of the + // inserted text. This is useful for languages like Python, where + // indentation matters. In these languages, the insertion point comment + // should be indented the same amount as any inserted code will need to be + // in order to work correctly in that context. + // + // The code generator that generates the initial file and the one which + // inserts into it must both run as part of a single invocation of protoc. + // Code generators are executed in the order in which they appear on the + // command line. + // + // If |insertion_point| is present, |name| must also be present. + InsertionPoint *string `protobuf:"bytes,2,opt,name=insertion_point,json=insertionPoint" json:"insertion_point,omitempty"` + // The file contents. + Content *string `protobuf:"bytes,15,opt,name=content" json:"content,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *CodeGeneratorResponse_File) Reset() { *m = CodeGeneratorResponse_File{} } +func (m *CodeGeneratorResponse_File) String() string { return proto.CompactTextString(m) } +func (*CodeGeneratorResponse_File) ProtoMessage() {} +func (*CodeGeneratorResponse_File) Descriptor() ([]byte, []int) { + return fileDescriptorPlugin, []int{1, 0} +} + +func (m *CodeGeneratorResponse_File) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *CodeGeneratorResponse_File) GetInsertionPoint() string { + if m != nil && m.InsertionPoint != nil { + return *m.InsertionPoint + } + return "" +} + +func (m *CodeGeneratorResponse_File) GetContent() string { + if m != nil && m.Content != nil { + return *m.Content + } + return "" +} + +func init() { + proto.RegisterType((*CodeGeneratorRequest)(nil), "google.protobuf.compiler.CodeGeneratorRequest") + proto.RegisterType((*CodeGeneratorResponse)(nil), "google.protobuf.compiler.CodeGeneratorResponse") + proto.RegisterType((*CodeGeneratorResponse_File)(nil), "google.protobuf.compiler.CodeGeneratorResponse.File") +} + +func init() { proto.RegisterFile("plugin.proto", fileDescriptorPlugin) } + +var fileDescriptorPlugin = []byte{ + // 304 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x51, 0xc1, 0x4a, 0xc3, 0x40, + 0x10, 0x25, 0xb6, 0x22, 0x19, 0x4b, 0x2b, 0x4b, 0x85, 0xa5, 0xf4, 0x10, 0x8a, 0x60, 0x4e, 0x29, + 0x88, 0xe0, 0xbd, 0x15, 0xf5, 0x58, 0x82, 0x27, 0x41, 0x42, 0x4c, 0xa7, 0x61, 0x21, 0xd9, 0x59, + 0x27, 0xdb, 0x2f, 0xf2, 0x9f, 0xfc, 0x1e, 0xd9, 0xdd, 0xb6, 0x4a, 0xb1, 0xb7, 0x7d, 0xef, 0xcd, + 0xcc, 0x7b, 0x3b, 0x03, 0x03, 0xd3, 0x6c, 0x6b, 0xa5, 0x33, 0xc3, 0x64, 0x49, 0xc8, 0x9a, 0xa8, + 0x6e, 0x30, 0xa0, 0x8f, 0xed, 0x26, 0xab, 0xa8, 0x35, 0xaa, 0x41, 0x9e, 0x24, 0x41, 0x99, 0xef, + 0x95, 0xf9, 0x1a, 0xbb, 0x8a, 0x95, 0xb1, 0xc4, 0xa1, 0x7a, 0xf6, 0x15, 0xc1, 0x78, 0x49, 0x6b, + 0x7c, 0x46, 0x8d, 0x5c, 0x5a, 0xe2, 0x1c, 0x3f, 0xb7, 0xd8, 0x59, 0x91, 0xc2, 0xd5, 0x46, 0x35, + 0x58, 0x58, 0x2a, 0xea, 0xa0, 0xa1, 0x8c, 0x92, 0x5e, 0x1a, 0xe7, 0x43, 0xc7, 0xbf, 0xd2, 0xae, + 0x03, 0xc5, 0x14, 0x62, 0x53, 0x72, 0xd9, 0xa2, 0x45, 0x96, 0x67, 0x49, 0x94, 0xc6, 0xf9, 0x2f, + 0x21, 0x96, 0x00, 0xde, 0xa9, 0x70, 0x5d, 0x72, 0x94, 0xf4, 0xd2, 0xcb, 0xbb, 0x9b, 0xec, 0x38, + 0xf1, 0x93, 0x6a, 0xf0, 0xf1, 0x90, 0x6d, 0xe5, 0xe8, 0x3c, 0xf6, 0xaa, 0x53, 0x66, 0xdf, 0x11, + 0x5c, 0x1f, 0xa5, 0xec, 0x0c, 0xe9, 0x0e, 0xc5, 0x18, 0xce, 0x91, 0x99, 0x58, 0x46, 0xde, 0x38, + 0x00, 0xf1, 0x02, 0xfd, 0x3f, 0x76, 0xf7, 0xd9, 0xa9, 0x05, 0x65, 0xff, 0x0e, 0xf5, 0x69, 0x72, + 0x3f, 0x61, 0xf2, 0x0e, 0x7d, 0x87, 0x84, 0x80, 0xbe, 0x2e, 0x5b, 0xdc, 0xd9, 0xf8, 0xb7, 0xb8, + 0x85, 0x91, 0xd2, 0x1d, 0xb2, 0x55, 0xa4, 0x0b, 0x43, 0x4a, 0xdb, 0xdd, 0xf7, 0x87, 0x07, 0x7a, + 0xe5, 0x58, 0x21, 0xe1, 0xa2, 0x22, 0x6d, 0x51, 0x5b, 0x39, 0xf2, 0x05, 0x7b, 0xb8, 0x78, 0x80, + 0x69, 0x45, 0xed, 0xc9, 0x7c, 0x8b, 0xc1, 0xca, 0x1f, 0xda, 0x2f, 0xa4, 0x7b, 0x8b, 0xc3, 0xd9, + 0x8b, 0x9a, 0x7e, 0x02, 0x00, 0x00, 0xff, 0xff, 0x70, 0xa2, 0xbd, 0x30, 0x02, 0x02, 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogofast/main.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogofast/main.go new file mode 100644 index 00000000000..96c18d9fc70 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogofast/main.go @@ -0,0 +1,47 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2015, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package main + +import ( + "github.com/gogo/protobuf/vanity" + "github.com/gogo/protobuf/vanity/command" +) + +func main() { + req := command.Read() + files := req.GetProtoFile() + files = vanity.FilterFiles(files, vanity.NotGoogleProtobufDescriptorProto) + + vanity.ForEachFile(files, vanity.TurnOnMarshalerAll) + vanity.ForEachFile(files, vanity.TurnOnSizerAll) + vanity.ForEachFile(files, vanity.TurnOnUnmarshalerAll) + + resp := command.Generate(req) + command.Write(resp) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogofaster/main.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogofaster/main.go new file mode 100644 index 00000000000..ba3e7e155fb --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogofaster/main.go @@ -0,0 +1,50 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2015, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package main + +import ( + "github.com/gogo/protobuf/vanity" + "github.com/gogo/protobuf/vanity/command" +) + +func main() { + req := command.Read() + files := req.GetProtoFile() + files = vanity.FilterFiles(files, vanity.NotGoogleProtobufDescriptorProto) + + vanity.ForEachFile(files, vanity.TurnOnMarshalerAll) + vanity.ForEachFile(files, vanity.TurnOnSizerAll) + vanity.ForEachFile(files, vanity.TurnOnUnmarshalerAll) + + vanity.ForEachFieldInFilesExcludingExtensions(vanity.OnlyProto2(files), vanity.TurnOffNullableForNativeTypesWithoutDefaultsOnly) + vanity.ForEachFile(files, vanity.TurnOffGoUnrecognizedAll) + + resp := command.Generate(req) + command.Write(resp) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogoslick/main.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogoslick/main.go new file mode 100644 index 00000000000..235bd64af75 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogoslick/main.go @@ -0,0 +1,59 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2015, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package main + +import ( + "github.com/gogo/protobuf/vanity" + "github.com/gogo/protobuf/vanity/command" +) + +func main() { + req := command.Read() + files := req.GetProtoFile() + files = vanity.FilterFiles(files, vanity.NotGoogleProtobufDescriptorProto) + + vanity.ForEachFile(files, vanity.TurnOnMarshalerAll) + vanity.ForEachFile(files, vanity.TurnOnSizerAll) + vanity.ForEachFile(files, vanity.TurnOnUnmarshalerAll) + + vanity.ForEachFieldInFilesExcludingExtensions(vanity.OnlyProto2(files), vanity.TurnOffNullableForNativeTypesWithoutDefaultsOnly) + vanity.ForEachFile(files, vanity.TurnOffGoUnrecognizedAll) + + vanity.ForEachFile(files, vanity.TurnOffGoEnumPrefixAll) + vanity.ForEachFile(files, vanity.TurnOffGoEnumStringerAll) + vanity.ForEachFile(files, vanity.TurnOnEnumStringerAll) + + vanity.ForEachFile(files, vanity.TurnOnEqualAll) + vanity.ForEachFile(files, vanity.TurnOnGoStringAll) + vanity.ForEachFile(files, vanity.TurnOffGoStringerAll) + vanity.ForEachFile(files, vanity.TurnOnStringerAll) + + resp := command.Generate(req) + command.Write(resp) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogotypes/main.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogotypes/main.go new file mode 100644 index 00000000000..d227a264f2a --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogotypes/main.go @@ -0,0 +1,75 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2015, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package main + +import ( + "strings" + + "github.com/gogo/protobuf/vanity" + "github.com/gogo/protobuf/vanity/command" +) + +func main() { + req := command.Read() + files := req.GetProtoFile() + files = vanity.FilterFiles(files, vanity.NotGoogleProtobufDescriptorProto) + + vanity.ForEachFile(files, vanity.TurnOnMarshalerAll) + vanity.ForEachFile(files, vanity.TurnOnSizerAll) + vanity.ForEachFile(files, vanity.TurnOnUnmarshalerAll) + + vanity.ForEachFile(files, vanity.TurnOffGoEnumPrefixAll) + vanity.ForEachFile(files, vanity.TurnOffGoEnumStringerAll) + vanity.ForEachFile(files, vanity.TurnOnEnumStringerAll) + + vanity.ForEachFile(files, vanity.TurnOnEqualAll) + vanity.ForEachFile(files, vanity.TurnOnGoStringAll) + vanity.ForEachFile(files, vanity.TurnOffGoStringerAll) + + for _, file := range files { + if strings.HasSuffix(file.GetName(), "struct.proto") { + // TODO struct can also get a compare method when + // https://github.com/gogo/protobuf/issues/221 is fixed + continue + } + vanity.TurnOnCompareAll(file) + } + + for _, file := range files { + if strings.HasSuffix(file.GetName(), "timestamp.proto") || + strings.HasSuffix(file.GetName(), "duration.proto") { + continue + } + vanity.TurnOnStringerAll(file) + vanity.TurnOnPopulateAll(file) + } + + resp := command.Generate(req) + command.Write(resp) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gostring/main.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gostring/main.go new file mode 100644 index 00000000000..9c7dd6b85e1 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gostring/main.go @@ -0,0 +1,42 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2016, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package main + +import ( + "github.com/gogo/protobuf/plugin/gostring" + "github.com/gogo/protobuf/vanity/command" +) + +func main() { + req := command.Read() + p := gostring.NewGoString() + p.Overwrite() + resp := command.GeneratePlugin(req, p, "_gostring.gen.go") + command.Write(resp) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-min-version/minversion.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-min-version/minversion.go new file mode 100644 index 00000000000..b8434d50401 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-min-version/minversion.go @@ -0,0 +1,65 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package main + +import ( + "fmt" + "github.com/gogo/protobuf/version" + "os" + "os/exec" + "strings" +) + +func filter(ss []string, flag string) ([]string, string) { + s := make([]string, 0, len(ss)) + var v string + for i := range ss { + if strings.Contains(ss[i], flag) { + vs := strings.Split(ss[i], "=") + v = vs[1] + continue + } + s = append(s, ss[i]) + } + return s, v +} + +func main() { + args, min := filter(os.Args[1:], "-version") + if !version.AtLeast(min) { + fmt.Printf("protoc version not high enough to parse this proto file\n") + return + } + gen := exec.Command("protoc", args...) + out, err := gen.CombinedOutput() + if err != nil { + fmt.Printf("%s\n", string(out)) + panic(err) + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/sortkeys/sortkeys.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/sortkeys/sortkeys.go new file mode 100644 index 00000000000..ceadde6a5e1 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/sortkeys/sortkeys.go @@ -0,0 +1,101 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package sortkeys + +import ( + "sort" +) + +func Strings(l []string) { + sort.Strings(l) +} + +func Float64s(l []float64) { + sort.Float64s(l) +} + +func Float32s(l []float32) { + sort.Sort(Float32Slice(l)) +} + +func Int64s(l []int64) { + sort.Sort(Int64Slice(l)) +} + +func Int32s(l []int32) { + sort.Sort(Int32Slice(l)) +} + +func Uint64s(l []uint64) { + sort.Sort(Uint64Slice(l)) +} + +func Uint32s(l []uint32) { + sort.Sort(Uint32Slice(l)) +} + +func Bools(l []bool) { + sort.Sort(BoolSlice(l)) +} + +type BoolSlice []bool + +func (p BoolSlice) Len() int { return len(p) } +func (p BoolSlice) Less(i, j int) bool { return p[j] } +func (p BoolSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +type Int64Slice []int64 + +func (p Int64Slice) Len() int { return len(p) } +func (p Int64Slice) Less(i, j int) bool { return p[i] < p[j] } +func (p Int64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +type Int32Slice []int32 + +func (p Int32Slice) Len() int { return len(p) } +func (p Int32Slice) Less(i, j int) bool { return p[i] < p[j] } +func (p Int32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +type Uint64Slice []uint64 + +func (p Uint64Slice) Len() int { return len(p) } +func (p Uint64Slice) Less(i, j int) bool { return p[i] < p[j] } +func (p Uint64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +type Uint32Slice []uint32 + +func (p Uint32Slice) Len() int { return len(p) } +func (p Uint32Slice) Less(i, j int) bool { return p[i] < p[j] } +func (p Uint32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +type Float32Slice []float32 + +func (p Float32Slice) Len() int { return len(p) } +func (p Float32Slice) Less(i, j int) bool { return p[i] < p[j] } +func (p Float32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/any.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/any.go new file mode 100644 index 00000000000..c10caf40557 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/any.go @@ -0,0 +1,135 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +package types + +// This file implements functions to marshal proto.Message to/from +// google.protobuf.Any message. + +import ( + "fmt" + "reflect" + "strings" + + "github.com/gogo/protobuf/proto" +) + +const googleApis = "type.googleapis.com/" + +// AnyMessageName returns the name of the message contained in a google.protobuf.Any message. +// +// Note that regular type assertions should be done using the Is +// function. AnyMessageName is provided for less common use cases like filtering a +// sequence of Any messages based on a set of allowed message type names. +func AnyMessageName(any *Any) (string, error) { + slash := strings.LastIndex(any.TypeUrl, "/") + if slash < 0 { + return "", fmt.Errorf("message type url %q is invalid", any.TypeUrl) + } + return any.TypeUrl[slash+1:], nil +} + +// MarshalAny takes the protocol buffer and encodes it into google.protobuf.Any. +func MarshalAny(pb proto.Message) (*Any, error) { + value, err := proto.Marshal(pb) + if err != nil { + return nil, err + } + return &Any{TypeUrl: googleApis + proto.MessageName(pb), Value: value}, nil +} + +// DynamicAny is a value that can be passed to UnmarshalAny to automatically +// allocate a proto.Message for the type specified in a google.protobuf.Any +// message. The allocated message is stored in the embedded proto.Message. +// +// Example: +// +// var x ptypes.DynamicAny +// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... } +// fmt.Printf("unmarshaled message: %v", x.Message) +type DynamicAny struct { + proto.Message +} + +// Empty returns a new proto.Message of the type specified in a +// google.protobuf.Any message. It returns an error if corresponding message +// type isn't linked in. +func EmptyAny(any *Any) (proto.Message, error) { + aname, err := AnyMessageName(any) + if err != nil { + return nil, err + } + + t := proto.MessageType(aname) + if t == nil { + return nil, fmt.Errorf("any: message type %q isn't linked in", aname) + } + return reflect.New(t.Elem()).Interface().(proto.Message), nil +} + +// UnmarshalAny parses the protocol buffer representation in a google.protobuf.Any +// message and places the decoded result in pb. It returns an error if type of +// contents of Any message does not match type of pb message. +// +// pb can be a proto.Message, or a *DynamicAny. +func UnmarshalAny(any *Any, pb proto.Message) error { + if d, ok := pb.(*DynamicAny); ok { + if d.Message == nil { + var err error + d.Message, err = EmptyAny(any) + if err != nil { + return err + } + } + return UnmarshalAny(any, d.Message) + } + + aname, err := AnyMessageName(any) + if err != nil { + return err + } + + mname := proto.MessageName(pb) + if aname != mname { + return fmt.Errorf("mismatched message type: got %q want %q", aname, mname) + } + return proto.Unmarshal(any.Value, pb) +} + +// Is returns true if any value contains a given message type. +func Is(any *Any, pb proto.Message) bool { + aname, err := AnyMessageName(any) + if err != nil { + return false + } + + return aname == proto.MessageName(pb) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/any.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/any.pb.go new file mode 100644 index 00000000000..ebd976e3d0d --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/any.pb.go @@ -0,0 +1,687 @@ +// Code generated by protoc-gen-gogo. +// source: any.proto +// DO NOT EDIT! + +/* + Package types is a generated protocol buffer package. + + It is generated from these files: + any.proto + + It has these top-level messages: + Any +*/ +package types + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import bytes "bytes" + +import strings "strings" +import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" +import sort "sort" +import strconv "strconv" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// `Any` contains an arbitrary serialized protocol buffer message along with a +// URL that describes the type of the serialized message. +// +// Protobuf library provides support to pack/unpack Any values in the form +// of utility functions or additional generated methods of the Any type. +// +// Example 1: Pack and unpack a message in C++. +// +// Foo foo = ...; +// Any any; +// any.PackFrom(foo); +// ... +// if (any.UnpackTo(&foo)) { +// ... +// } +// +// Example 2: Pack and unpack a message in Java. +// +// Foo foo = ...; +// Any any = Any.pack(foo); +// ... +// if (any.is(Foo.class)) { +// foo = any.unpack(Foo.class); +// } +// +// Example 3: Pack and unpack a message in Python. +// +// foo = Foo(...) +// any = Any() +// any.Pack(foo) +// ... +// if any.Is(Foo.DESCRIPTOR): +// any.Unpack(foo) +// ... +// +// The pack methods provided by protobuf library will by default use +// 'type.googleapis.com/full.type.name' as the type URL and the unpack +// methods only use the fully qualified type name after the last '/' +// in the type URL, for example "foo.bar.com/x/y.z" will yield type +// name "y.z". +// +// +// JSON +// ==== +// The JSON representation of an `Any` value uses the regular +// representation of the deserialized, embedded message, with an +// additional field `@type` which contains the type URL. Example: +// +// package google.profile; +// message Person { +// string first_name = 1; +// string last_name = 2; +// } +// +// { +// "@type": "type.googleapis.com/google.profile.Person", +// "firstName": , +// "lastName": +// } +// +// If the embedded message type is well-known and has a custom JSON +// representation, that representation will be embedded adding a field +// `value` which holds the custom JSON in addition to the `@type` +// field. Example (for message [google.protobuf.Duration][]): +// +// { +// "@type": "type.googleapis.com/google.protobuf.Duration", +// "value": "1.212s" +// } +// +type Any struct { + // A URL/resource name whose content describes the type of the + // serialized protocol buffer message. + // + // For URLs which use the scheme `http`, `https`, or no scheme, the + // following restrictions and interpretations apply: + // + // * If no scheme is provided, `https` is assumed. + // * The last segment of the URL's path must represent the fully + // qualified name of the type (as in `path/google.protobuf.Duration`). + // The name should be in a canonical form (e.g., leading "." is + // not accepted). + // * An HTTP GET on the URL must yield a [google.protobuf.Type][] + // value in binary format, or produce an error. + // * Applications are allowed to cache lookup results based on the + // URL, or have them precompiled into a binary to avoid any + // lookup. Therefore, binary compatibility needs to be preserved + // on changes to types. (Use versioned type names to manage + // breaking changes.) + // + // Schemes other than `http`, `https` (or the empty scheme) might be + // used with implementation specific semantics. + // + TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` + // Must be a valid serialized protocol buffer of the above specified type. + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *Any) Reset() { *m = Any{} } +func (*Any) ProtoMessage() {} +func (*Any) Descriptor() ([]byte, []int) { return fileDescriptorAny, []int{0} } +func (*Any) XXX_WellKnownType() string { return "Any" } + +func (m *Any) GetTypeUrl() string { + if m != nil { + return m.TypeUrl + } + return "" +} + +func (m *Any) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +func init() { + proto.RegisterType((*Any)(nil), "google.protobuf.Any") +} +func (this *Any) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Any) + if !ok { + that2, ok := that.(Any) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.TypeUrl != that1.TypeUrl { + if this.TypeUrl < that1.TypeUrl { + return -1 + } + return 1 + } + if c := bytes.Compare(this.Value, that1.Value); c != 0 { + return c + } + return 0 +} +func (this *Any) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*Any) + if !ok { + that2, ok := that.(Any) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if this.TypeUrl != that1.TypeUrl { + return false + } + if !bytes.Equal(this.Value, that1.Value) { + return false + } + return true +} +func (this *Any) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&types.Any{") + s = append(s, "TypeUrl: "+fmt.Sprintf("%#v", this.TypeUrl)+",\n") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringAny(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func extensionToGoStringAny(m github_com_gogo_protobuf_proto.Message) string { + e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) + if e == nil { + return "nil" + } + s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" + keys := make([]int, 0, len(e)) + for k := range e { + keys = append(keys, int(k)) + } + sort.Ints(keys) + ss := []string{} + for _, k := range keys { + ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) + } + s += strings.Join(ss, ",") + "})" + return s +} +func (m *Any) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Any) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.TypeUrl) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintAny(dAtA, i, uint64(len(m.TypeUrl))) + i += copy(dAtA[i:], m.TypeUrl) + } + if len(m.Value) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintAny(dAtA, i, uint64(len(m.Value))) + i += copy(dAtA[i:], m.Value) + } + return i, nil +} + +func encodeFixed64Any(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Any(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintAny(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func NewPopulatedAny(r randyAny, easy bool) *Any { + this := &Any{} + this.TypeUrl = string(randStringAny(r)) + v1 := r.Intn(100) + this.Value = make([]byte, v1) + for i := 0; i < v1; i++ { + this.Value[i] = byte(r.Intn(256)) + } + if !easy && r.Intn(10) != 0 { + } + return this +} + +type randyAny interface { + Float32() float32 + Float64() float64 + Int63() int64 + Int31() int32 + Uint32() uint32 + Intn(n int) int +} + +func randUTF8RuneAny(r randyAny) rune { + ru := r.Intn(62) + if ru < 10 { + return rune(ru + 48) + } else if ru < 36 { + return rune(ru + 55) + } + return rune(ru + 61) +} +func randStringAny(r randyAny) string { + v2 := r.Intn(100) + tmps := make([]rune, v2) + for i := 0; i < v2; i++ { + tmps[i] = randUTF8RuneAny(r) + } + return string(tmps) +} +func randUnrecognizedAny(r randyAny, maxFieldNumber int) (dAtA []byte) { + l := r.Intn(5) + for i := 0; i < l; i++ { + wire := r.Intn(4) + if wire == 3 { + wire = 5 + } + fieldNumber := maxFieldNumber + r.Intn(100) + dAtA = randFieldAny(dAtA, r, fieldNumber, wire) + } + return dAtA +} +func randFieldAny(dAtA []byte, r randyAny, fieldNumber int, wire int) []byte { + key := uint32(fieldNumber)<<3 | uint32(wire) + switch wire { + case 0: + dAtA = encodeVarintPopulateAny(dAtA, uint64(key)) + v3 := r.Int63() + if r.Intn(2) == 0 { + v3 *= -1 + } + dAtA = encodeVarintPopulateAny(dAtA, uint64(v3)) + case 1: + dAtA = encodeVarintPopulateAny(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + case 2: + dAtA = encodeVarintPopulateAny(dAtA, uint64(key)) + ll := r.Intn(100) + dAtA = encodeVarintPopulateAny(dAtA, uint64(ll)) + for j := 0; j < ll; j++ { + dAtA = append(dAtA, byte(r.Intn(256))) + } + default: + dAtA = encodeVarintPopulateAny(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + } + return dAtA +} +func encodeVarintPopulateAny(dAtA []byte, v uint64) []byte { + for v >= 1<<7 { + dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) + v >>= 7 + } + dAtA = append(dAtA, uint8(v)) + return dAtA +} +func (m *Any) Size() (n int) { + var l int + _ = l + l = len(m.TypeUrl) + if l > 0 { + n += 1 + l + sovAny(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovAny(uint64(l)) + } + return n +} + +func sovAny(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozAny(x uint64) (n int) { + return sovAny(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Any) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Any{`, + `TypeUrl:` + fmt.Sprintf("%v", this.TypeUrl) + `,`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `}`, + }, "") + return s +} +func valueToStringAny(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Any) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAny + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Any: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Any: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TypeUrl", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAny + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthAny + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TypeUrl = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAny + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthAny + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAny(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthAny + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipAny(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAny + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAny + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAny + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthAny + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowAny + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipAny(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthAny = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowAny = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("any.proto", fileDescriptorAny) } + +var fileDescriptorAny = []byte{ + // 208 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x4c, 0xcc, 0xab, 0xd4, + 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x4f, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0x85, 0xf0, 0x92, + 0x4a, 0xd3, 0x94, 0xcc, 0xb8, 0x98, 0x1d, 0xf3, 0x2a, 0x85, 0x24, 0xb9, 0x38, 0x4a, 0x2a, 0x0b, + 0x52, 0xe3, 0x4b, 0x8b, 0x72, 0x24, 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0xd8, 0x41, 0xfc, 0xd0, + 0xa2, 0x1c, 0x21, 0x11, 0x2e, 0xd6, 0xb2, 0xc4, 0x9c, 0xd2, 0x54, 0x09, 0x26, 0x05, 0x46, 0x0d, + 0x9e, 0x20, 0x08, 0xc7, 0xa9, 0x89, 0xf1, 0xc2, 0x43, 0x39, 0x86, 0x1b, 0x0f, 0xe5, 0x18, 0x3e, + 0x3c, 0x94, 0x63, 0xfc, 0xf1, 0x50, 0x8e, 0xb1, 0xe1, 0x91, 0x1c, 0xe3, 0x8a, 0x47, 0x72, 0x8c, + 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8b, 0x47, 0x72, + 0x0c, 0x1f, 0x40, 0xe2, 0x8f, 0xe5, 0x18, 0xb9, 0x84, 0x93, 0xf3, 0x73, 0xf5, 0xd0, 0xec, 0x77, + 0xe2, 0x70, 0xcc, 0xab, 0x0c, 0x00, 0x71, 0x02, 0x18, 0xa3, 0x58, 0x41, 0x56, 0x16, 0x2f, 0x60, + 0x64, 0x5c, 0xc4, 0xc4, 0xec, 0x1e, 0xe0, 0xb4, 0x8a, 0x49, 0xce, 0x1d, 0xa2, 0x3a, 0x00, 0xaa, + 0x5a, 0x2f, 0x3c, 0x35, 0x27, 0xc7, 0x3b, 0x2f, 0xbf, 0x3c, 0x2f, 0x04, 0xa4, 0x32, 0x89, 0x0d, + 0x6c, 0x8c, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x63, 0x5d, 0x2d, 0x27, 0xe1, 0x00, 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/doc.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/doc.go new file mode 100644 index 00000000000..ff2810af1ee --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/doc.go @@ -0,0 +1,35 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +/* +Package types contains code for interacting with well-known types. +*/ +package types diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration.go new file mode 100644 index 00000000000..475d61f1db2 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration.go @@ -0,0 +1,100 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +package types + +// This file implements conversions between google.protobuf.Duration +// and time.Duration. + +import ( + "errors" + "fmt" + "time" +) + +const ( + // Range of a Duration in seconds, as specified in + // google/protobuf/duration.proto. This is about 10,000 years in seconds. + maxSeconds = int64(10000 * 365.25 * 24 * 60 * 60) + minSeconds = -maxSeconds +) + +// validateDuration determines whether the Duration is valid according to the +// definition in google/protobuf/duration.proto. A valid Duration +// may still be too large to fit into a time.Duration (the range of Duration +// is about 10,000 years, and the range of time.Duration is about 290). +func validateDuration(d *Duration) error { + if d == nil { + return errors.New("duration: nil Duration") + } + if d.Seconds < minSeconds || d.Seconds > maxSeconds { + return fmt.Errorf("duration: %#v: seconds out of range", d) + } + if d.Nanos <= -1e9 || d.Nanos >= 1e9 { + return fmt.Errorf("duration: %#v: nanos out of range", d) + } + // Seconds and Nanos must have the same sign, unless d.Nanos is zero. + if (d.Seconds < 0 && d.Nanos > 0) || (d.Seconds > 0 && d.Nanos < 0) { + return fmt.Errorf("duration: %#v: seconds and nanos have different signs", d) + } + return nil +} + +// DurationFromProto converts a Duration to a time.Duration. DurationFromProto +// returns an error if the Duration is invalid or is too large to be +// represented in a time.Duration. +func DurationFromProto(p *Duration) (time.Duration, error) { + if err := validateDuration(p); err != nil { + return 0, err + } + d := time.Duration(p.Seconds) * time.Second + if int64(d/time.Second) != p.Seconds { + return 0, fmt.Errorf("duration: %#v is out of range for time.Duration", p) + } + if p.Nanos != 0 { + d += time.Duration(p.Nanos) + if (d < 0) != (p.Nanos < 0) { + return 0, fmt.Errorf("duration: %#v is out of range for time.Duration", p) + } + } + return d, nil +} + +// DurationProto converts a time.Duration to a Duration. +func DurationProto(d time.Duration) *Duration { + nanos := d.Nanoseconds() + secs := nanos / 1e9 + nanos -= secs * 1e9 + return &Duration{ + Seconds: secs, + Nanos: int32(nanos), + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration.pb.go new file mode 100644 index 00000000000..dcaaa644285 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration.pb.go @@ -0,0 +1,515 @@ +// Code generated by protoc-gen-gogo. +// source: duration.proto +// DO NOT EDIT! + +/* + Package types is a generated protocol buffer package. + + It is generated from these files: + duration.proto + + It has these top-level messages: + Duration +*/ +package types + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import strings "strings" +import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" +import sort "sort" +import strconv "strconv" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// A Duration represents a signed, fixed-length span of time represented +// as a count of seconds and fractions of seconds at nanosecond +// resolution. It is independent of any calendar and concepts like "day" +// or "month". It is related to Timestamp in that the difference between +// two Timestamp values is a Duration and it can be added or subtracted +// from a Timestamp. Range is approximately +-10,000 years. +// +// Example 1: Compute Duration from two Timestamps in pseudo code. +// +// Timestamp start = ...; +// Timestamp end = ...; +// Duration duration = ...; +// +// duration.seconds = end.seconds - start.seconds; +// duration.nanos = end.nanos - start.nanos; +// +// if (duration.seconds < 0 && duration.nanos > 0) { +// duration.seconds += 1; +// duration.nanos -= 1000000000; +// } else if (durations.seconds > 0 && duration.nanos < 0) { +// duration.seconds -= 1; +// duration.nanos += 1000000000; +// } +// +// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. +// +// Timestamp start = ...; +// Duration duration = ...; +// Timestamp end = ...; +// +// end.seconds = start.seconds + duration.seconds; +// end.nanos = start.nanos + duration.nanos; +// +// if (end.nanos < 0) { +// end.seconds -= 1; +// end.nanos += 1000000000; +// } else if (end.nanos >= 1000000000) { +// end.seconds += 1; +// end.nanos -= 1000000000; +// } +// +// +type Duration struct { + // Signed seconds of the span of time. Must be from -315,576,000,000 + // to +315,576,000,000 inclusive. + Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` + // Signed fractions of a second at nanosecond resolution of the span + // of time. Durations less than one second are represented with a 0 + // `seconds` field and a positive or negative `nanos` field. For durations + // of one second or more, a non-zero value for the `nanos` field must be + // of the same sign as the `seconds` field. Must be from -999,999,999 + // to +999,999,999 inclusive. + Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` +} + +func (m *Duration) Reset() { *m = Duration{} } +func (*Duration) ProtoMessage() {} +func (*Duration) Descriptor() ([]byte, []int) { return fileDescriptorDuration, []int{0} } +func (*Duration) XXX_WellKnownType() string { return "Duration" } + +func (m *Duration) GetSeconds() int64 { + if m != nil { + return m.Seconds + } + return 0 +} + +func (m *Duration) GetNanos() int32 { + if m != nil { + return m.Nanos + } + return 0 +} + +func init() { + proto.RegisterType((*Duration)(nil), "google.protobuf.Duration") +} +func (this *Duration) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Duration) + if !ok { + that2, ok := that.(Duration) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Seconds != that1.Seconds { + if this.Seconds < that1.Seconds { + return -1 + } + return 1 + } + if this.Nanos != that1.Nanos { + if this.Nanos < that1.Nanos { + return -1 + } + return 1 + } + return 0 +} +func (this *Duration) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*Duration) + if !ok { + that2, ok := that.(Duration) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if this.Seconds != that1.Seconds { + return false + } + if this.Nanos != that1.Nanos { + return false + } + return true +} +func (this *Duration) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&types.Duration{") + s = append(s, "Seconds: "+fmt.Sprintf("%#v", this.Seconds)+",\n") + s = append(s, "Nanos: "+fmt.Sprintf("%#v", this.Nanos)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringDuration(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func extensionToGoStringDuration(m github_com_gogo_protobuf_proto.Message) string { + e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) + if e == nil { + return "nil" + } + s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" + keys := make([]int, 0, len(e)) + for k := range e { + keys = append(keys, int(k)) + } + sort.Ints(keys) + ss := []string{} + for _, k := range keys { + ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) + } + s += strings.Join(ss, ",") + "})" + return s +} +func (m *Duration) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Duration) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Seconds != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintDuration(dAtA, i, uint64(m.Seconds)) + } + if m.Nanos != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintDuration(dAtA, i, uint64(m.Nanos)) + } + return i, nil +} + +func encodeFixed64Duration(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Duration(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintDuration(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *Duration) Size() (n int) { + var l int + _ = l + if m.Seconds != 0 { + n += 1 + sovDuration(uint64(m.Seconds)) + } + if m.Nanos != 0 { + n += 1 + sovDuration(uint64(m.Nanos)) + } + return n +} + +func sovDuration(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozDuration(x uint64) (n int) { + return sovDuration(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Duration) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDuration + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Duration: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Duration: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seconds", wireType) + } + m.Seconds = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDuration + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seconds |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nanos", wireType) + } + m.Nanos = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDuration + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Nanos |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipDuration(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDuration + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipDuration(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDuration + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDuration + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDuration + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthDuration + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDuration + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipDuration(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthDuration = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowDuration = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("duration.proto", fileDescriptorDuration) } + +var fileDescriptorDuration = []byte{ + // 203 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x4b, 0x29, 0x2d, 0x4a, + 0x2c, 0xc9, 0xcc, 0xcf, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x4f, 0xcf, 0xcf, 0x4f, + 0xcf, 0x49, 0x85, 0xf0, 0x92, 0x4a, 0xd3, 0x94, 0xac, 0xb8, 0x38, 0x5c, 0xa0, 0x4a, 0x84, 0x24, + 0xb8, 0xd8, 0x8b, 0x53, 0x93, 0xf3, 0xf3, 0x52, 0x8a, 0x25, 0x18, 0x15, 0x18, 0x35, 0x98, 0x83, + 0x60, 0x5c, 0x21, 0x11, 0x2e, 0xd6, 0xbc, 0xc4, 0xbc, 0xfc, 0x62, 0x09, 0x26, 0x05, 0x46, 0x0d, + 0xd6, 0x20, 0x08, 0xc7, 0xa9, 0xfe, 0xc2, 0x43, 0x39, 0x86, 0x1b, 0x0f, 0xe5, 0x18, 0x3e, 0x3c, + 0x94, 0x63, 0x5c, 0xf1, 0x48, 0x8e, 0xf1, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, + 0x3c, 0x92, 0x63, 0x7c, 0xf1, 0x48, 0x8e, 0xe1, 0xc3, 0x23, 0x39, 0xc6, 0x15, 0x8f, 0xe5, 0x18, + 0xb9, 0x84, 0x93, 0xf3, 0x73, 0xf5, 0xd0, 0xac, 0x76, 0xe2, 0x85, 0x59, 0x1c, 0x00, 0x12, 0x09, + 0x60, 0x8c, 0x62, 0x2d, 0xa9, 0x2c, 0x48, 0x2d, 0x5e, 0xc0, 0xc8, 0xb8, 0x88, 0x89, 0xd9, 0x3d, + 0xc0, 0x69, 0x15, 0x93, 0x9c, 0x3b, 0x44, 0x4b, 0x00, 0x54, 0x8b, 0x5e, 0x78, 0x6a, 0x4e, 0x8e, + 0x77, 0x5e, 0x7e, 0x79, 0x5e, 0x08, 0x48, 0x65, 0x12, 0x1b, 0xd8, 0x2c, 0x63, 0x40, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xba, 0xfb, 0x15, 0xc9, 0xe6, 0x00, 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration_gogo.go new file mode 100644 index 00000000000..90e7670e21d --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration_gogo.go @@ -0,0 +1,100 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2016, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package types + +import ( + "fmt" + "time" +) + +func NewPopulatedDuration(r interface { + Int63() int64 +}, easy bool) *Duration { + this := &Duration{} + maxSecs := time.Hour.Nanoseconds() / 1e9 + max := 2 * maxSecs + s := int64(r.Int63()) % max + s -= maxSecs + neg := int64(1) + if s < 0 { + neg = -1 + } + this.Seconds = s + this.Nanos = int32(neg * (r.Int63() % 1e9)) + return this +} + +func (d *Duration) String() string { + td, err := DurationFromProto(d) + if err != nil { + return fmt.Sprintf("(%v)", err) + } + return td.String() +} + +func NewPopulatedStdDuration(r interface { + Int63() int64 +}, easy bool) *time.Duration { + dur := NewPopulatedDuration(r, easy) + d, err := DurationFromProto(dur) + if err != nil { + return nil + } + return &d +} + +func SizeOfStdDuration(d time.Duration) int { + dur := DurationProto(d) + return dur.Size() +} + +func StdDurationMarshal(d time.Duration) ([]byte, error) { + size := SizeOfStdDuration(d) + buf := make([]byte, size) + _, err := StdDurationMarshalTo(d, buf) + return buf, err +} + +func StdDurationMarshalTo(d time.Duration, data []byte) (int, error) { + dur := DurationProto(d) + return dur.MarshalTo(data) +} + +func StdDurationUnmarshal(d *time.Duration, data []byte) error { + dur := &Duration{} + if err := dur.Unmarshal(data); err != nil { + return err + } + dd, err := DurationFromProto(dur) + if err != nil { + return err + } + *d = dd + return nil +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/empty.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/empty.pb.go new file mode 100644 index 00000000000..c94f81f7ce6 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/empty.pb.go @@ -0,0 +1,478 @@ +// Code generated by protoc-gen-gogo. +// source: empty.proto +// DO NOT EDIT! + +/* +Package types is a generated protocol buffer package. + +It is generated from these files: + empty.proto + +It has these top-level messages: + Empty +*/ +package types + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import strings "strings" +import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" +import sort "sort" +import strconv "strconv" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// A generic empty message that you can re-use to avoid defining duplicated +// empty messages in your APIs. A typical example is to use it as the request +// or the response type of an API method. For instance: +// +// service Foo { +// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +// } +// +// The JSON representation for `Empty` is empty JSON object `{}`. +type Empty struct { +} + +func (m *Empty) Reset() { *m = Empty{} } +func (*Empty) ProtoMessage() {} +func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptorEmpty, []int{0} } +func (*Empty) XXX_WellKnownType() string { return "Empty" } + +func init() { + proto.RegisterType((*Empty)(nil), "google.protobuf.Empty") +} +func (this *Empty) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Empty) + if !ok { + that2, ok := that.(Empty) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + return 0 +} +func (this *Empty) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*Empty) + if !ok { + that2, ok := that.(Empty) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + return true +} +func (this *Empty) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 4) + s = append(s, "&types.Empty{") + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringEmpty(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func extensionToGoStringEmpty(m github_com_gogo_protobuf_proto.Message) string { + e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) + if e == nil { + return "nil" + } + s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" + keys := make([]int, 0, len(e)) + for k := range e { + keys = append(keys, int(k)) + } + sort.Ints(keys) + ss := []string{} + for _, k := range keys { + ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) + } + s += strings.Join(ss, ",") + "})" + return s +} +func (m *Empty) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Empty) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + return i, nil +} + +func encodeFixed64Empty(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Empty(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintEmpty(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func NewPopulatedEmpty(r randyEmpty, easy bool) *Empty { + this := &Empty{} + if !easy && r.Intn(10) != 0 { + } + return this +} + +type randyEmpty interface { + Float32() float32 + Float64() float64 + Int63() int64 + Int31() int32 + Uint32() uint32 + Intn(n int) int +} + +func randUTF8RuneEmpty(r randyEmpty) rune { + ru := r.Intn(62) + if ru < 10 { + return rune(ru + 48) + } else if ru < 36 { + return rune(ru + 55) + } + return rune(ru + 61) +} +func randStringEmpty(r randyEmpty) string { + v1 := r.Intn(100) + tmps := make([]rune, v1) + for i := 0; i < v1; i++ { + tmps[i] = randUTF8RuneEmpty(r) + } + return string(tmps) +} +func randUnrecognizedEmpty(r randyEmpty, maxFieldNumber int) (dAtA []byte) { + l := r.Intn(5) + for i := 0; i < l; i++ { + wire := r.Intn(4) + if wire == 3 { + wire = 5 + } + fieldNumber := maxFieldNumber + r.Intn(100) + dAtA = randFieldEmpty(dAtA, r, fieldNumber, wire) + } + return dAtA +} +func randFieldEmpty(dAtA []byte, r randyEmpty, fieldNumber int, wire int) []byte { + key := uint32(fieldNumber)<<3 | uint32(wire) + switch wire { + case 0: + dAtA = encodeVarintPopulateEmpty(dAtA, uint64(key)) + v2 := r.Int63() + if r.Intn(2) == 0 { + v2 *= -1 + } + dAtA = encodeVarintPopulateEmpty(dAtA, uint64(v2)) + case 1: + dAtA = encodeVarintPopulateEmpty(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + case 2: + dAtA = encodeVarintPopulateEmpty(dAtA, uint64(key)) + ll := r.Intn(100) + dAtA = encodeVarintPopulateEmpty(dAtA, uint64(ll)) + for j := 0; j < ll; j++ { + dAtA = append(dAtA, byte(r.Intn(256))) + } + default: + dAtA = encodeVarintPopulateEmpty(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + } + return dAtA +} +func encodeVarintPopulateEmpty(dAtA []byte, v uint64) []byte { + for v >= 1<<7 { + dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) + v >>= 7 + } + dAtA = append(dAtA, uint8(v)) + return dAtA +} +func (m *Empty) Size() (n int) { + var l int + _ = l + return n +} + +func sovEmpty(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozEmpty(x uint64) (n int) { + return sovEmpty(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Empty) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Empty{`, + `}`, + }, "") + return s +} +func valueToStringEmpty(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Empty) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEmpty + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Empty: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Empty: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipEmpty(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEmpty + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEmpty(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEmpty + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEmpty + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEmpty + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthEmpty + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEmpty + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipEmpty(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthEmpty = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEmpty = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("empty.proto", fileDescriptorEmpty) } + +var fileDescriptorEmpty = []byte{ + // 172 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x4e, 0xcd, 0x2d, 0x28, + 0xa9, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x4f, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0x85, + 0xf0, 0x92, 0x4a, 0xd3, 0x94, 0xd8, 0xb9, 0x58, 0x5d, 0x41, 0xf2, 0x4e, 0xed, 0x8c, 0x17, 0x1e, + 0xca, 0x31, 0xdc, 0x78, 0x28, 0xc7, 0xf0, 0xe1, 0xa1, 0x1c, 0xe3, 0x8f, 0x87, 0x72, 0x8c, 0x0d, + 0x8f, 0xe4, 0x18, 0x57, 0x3c, 0x92, 0x63, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, + 0x07, 0x8f, 0xe4, 0x18, 0x5f, 0x3c, 0x92, 0x63, 0xf8, 0x00, 0x12, 0x7f, 0x2c, 0xc7, 0xc8, 0x25, + 0x9c, 0x9c, 0x9f, 0xab, 0x87, 0x66, 0xa0, 0x13, 0x17, 0xd8, 0xb8, 0x00, 0x10, 0x37, 0x80, 0x31, + 0x8a, 0xb5, 0xa4, 0xb2, 0x20, 0xb5, 0x78, 0x01, 0x23, 0xe3, 0x0f, 0x46, 0xc6, 0x45, 0x4c, 0xcc, + 0xee, 0x01, 0x4e, 0xab, 0x98, 0xe4, 0xdc, 0x21, 0x5a, 0x02, 0xa0, 0x5a, 0xf4, 0xc2, 0x53, 0x73, + 0x72, 0xbc, 0xf3, 0xf2, 0xcb, 0xf3, 0x42, 0x40, 0x8a, 0x93, 0xd8, 0xc0, 0x66, 0x19, 0x03, 0x02, + 0x00, 0x00, 0xff, 0xff, 0x97, 0x6c, 0x95, 0xdd, 0xb9, 0x00, 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/field_mask.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/field_mask.pb.go new file mode 100644 index 00000000000..d5f19e3aa80 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/field_mask.pb.go @@ -0,0 +1,759 @@ +// Code generated by protoc-gen-gogo. +// source: field_mask.proto +// DO NOT EDIT! + +/* +Package types is a generated protocol buffer package. + +It is generated from these files: + field_mask.proto + +It has these top-level messages: + FieldMask +*/ +package types + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import strings "strings" +import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" +import sort "sort" +import strconv "strconv" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// `FieldMask` represents a set of symbolic field paths, for example: +// +// paths: "f.a" +// paths: "f.b.d" +// +// Here `f` represents a field in some root message, `a` and `b` +// fields in the message found in `f`, and `d` a field found in the +// message in `f.b`. +// +// Field masks are used to specify a subset of fields that should be +// returned by a get operation or modified by an update operation. +// Field masks also have a custom JSON encoding (see below). +// +// # Field Masks in Projections +// +// When used in the context of a projection, a response message or +// sub-message is filtered by the API to only contain those fields as +// specified in the mask. For example, if the mask in the previous +// example is applied to a response message as follows: +// +// f { +// a : 22 +// b { +// d : 1 +// x : 2 +// } +// y : 13 +// } +// z: 8 +// +// The result will not contain specific values for fields x,y and z +// (their value will be set to the default, and omitted in proto text +// output): +// +// +// f { +// a : 22 +// b { +// d : 1 +// } +// } +// +// A repeated field is not allowed except at the last position of a +// field mask. +// +// If a FieldMask object is not present in a get operation, the +// operation applies to all fields (as if a FieldMask of all fields +// had been specified). +// +// Note that a field mask does not necessarily apply to the +// top-level response message. In case of a REST get operation, the +// field mask applies directly to the response, but in case of a REST +// list operation, the mask instead applies to each individual message +// in the returned resource list. In case of a REST custom method, +// other definitions may be used. Where the mask applies will be +// clearly documented together with its declaration in the API. In +// any case, the effect on the returned resource/resources is required +// behavior for APIs. +// +// # Field Masks in Update Operations +// +// A field mask in update operations specifies which fields of the +// targeted resource are going to be updated. The API is required +// to only change the values of the fields as specified in the mask +// and leave the others untouched. If a resource is passed in to +// describe the updated values, the API ignores the values of all +// fields not covered by the mask. +// +// If a repeated field is specified for an update operation, the existing +// repeated values in the target resource will be overwritten by the new values. +// Note that a repeated field is only allowed in the last position of a field +// mask. +// +// If a sub-message is specified in the last position of the field mask for an +// update operation, then the existing sub-message in the target resource is +// overwritten. Given the target message: +// +// f { +// b { +// d : 1 +// x : 2 +// } +// c : 1 +// } +// +// And an update message: +// +// f { +// b { +// d : 10 +// } +// } +// +// then if the field mask is: +// +// paths: "f.b" +// +// then the result will be: +// +// f { +// b { +// d : 10 +// } +// c : 1 +// } +// +// However, if the update mask was: +// +// paths: "f.b.d" +// +// then the result would be: +// +// f { +// b { +// d : 10 +// x : 2 +// } +// c : 1 +// } +// +// In order to reset a field's value to the default, the field must +// be in the mask and set to the default value in the provided resource. +// Hence, in order to reset all fields of a resource, provide a default +// instance of the resource and set all fields in the mask, or do +// not provide a mask as described below. +// +// If a field mask is not present on update, the operation applies to +// all fields (as if a field mask of all fields has been specified). +// Note that in the presence of schema evolution, this may mean that +// fields the client does not know and has therefore not filled into +// the request will be reset to their default. If this is unwanted +// behavior, a specific service may require a client to always specify +// a field mask, producing an error if not. +// +// As with get operations, the location of the resource which +// describes the updated values in the request message depends on the +// operation kind. In any case, the effect of the field mask is +// required to be honored by the API. +// +// ## Considerations for HTTP REST +// +// The HTTP kind of an update operation which uses a field mask must +// be set to PATCH instead of PUT in order to satisfy HTTP semantics +// (PUT must only be used for full updates). +// +// # JSON Encoding of Field Masks +// +// In JSON, a field mask is encoded as a single string where paths are +// separated by a comma. Fields name in each path are converted +// to/from lower-camel naming conventions. +// +// As an example, consider the following message declarations: +// +// message Profile { +// User user = 1; +// Photo photo = 2; +// } +// message User { +// string display_name = 1; +// string address = 2; +// } +// +// In proto a field mask for `Profile` may look as such: +// +// mask { +// paths: "user.display_name" +// paths: "photo" +// } +// +// In JSON, the same mask is represented as below: +// +// { +// mask: "user.displayName,photo" +// } +// +// # Field Masks and Oneof Fields +// +// Field masks treat fields in oneofs just as regular fields. Consider the +// following message: +// +// message SampleMessage { +// oneof test_oneof { +// string name = 4; +// SubMessage sub_message = 9; +// } +// } +// +// The field mask can be: +// +// mask { +// paths: "name" +// } +// +// Or: +// +// mask { +// paths: "sub_message" +// } +// +// Note that oneof type names ("test_oneof" in this case) cannot be used in +// paths. +type FieldMask struct { + // The set of field mask paths. + Paths []string `protobuf:"bytes,1,rep,name=paths" json:"paths,omitempty"` +} + +func (m *FieldMask) Reset() { *m = FieldMask{} } +func (*FieldMask) ProtoMessage() {} +func (*FieldMask) Descriptor() ([]byte, []int) { return fileDescriptorFieldMask, []int{0} } + +func (m *FieldMask) GetPaths() []string { + if m != nil { + return m.Paths + } + return nil +} + +func init() { + proto.RegisterType((*FieldMask)(nil), "google.protobuf.FieldMask") +} +func (this *FieldMask) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*FieldMask) + if !ok { + that2, ok := that.(FieldMask) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if len(this.Paths) != len(that1.Paths) { + if len(this.Paths) < len(that1.Paths) { + return -1 + } + return 1 + } + for i := range this.Paths { + if this.Paths[i] != that1.Paths[i] { + if this.Paths[i] < that1.Paths[i] { + return -1 + } + return 1 + } + } + return 0 +} +func (this *FieldMask) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*FieldMask) + if !ok { + that2, ok := that.(FieldMask) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if len(this.Paths) != len(that1.Paths) { + return false + } + for i := range this.Paths { + if this.Paths[i] != that1.Paths[i] { + return false + } + } + return true +} +func (this *FieldMask) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.FieldMask{") + s = append(s, "Paths: "+fmt.Sprintf("%#v", this.Paths)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringFieldMask(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func extensionToGoStringFieldMask(m github_com_gogo_protobuf_proto.Message) string { + e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) + if e == nil { + return "nil" + } + s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" + keys := make([]int, 0, len(e)) + for k := range e { + keys = append(keys, int(k)) + } + sort.Ints(keys) + ss := []string{} + for _, k := range keys { + ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) + } + s += strings.Join(ss, ",") + "})" + return s +} +func (m *FieldMask) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FieldMask) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Paths) > 0 { + for _, s := range m.Paths { + dAtA[i] = 0xa + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + return i, nil +} + +func encodeFixed64FieldMask(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32FieldMask(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintFieldMask(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func NewPopulatedFieldMask(r randyFieldMask, easy bool) *FieldMask { + this := &FieldMask{} + v1 := r.Intn(10) + this.Paths = make([]string, v1) + for i := 0; i < v1; i++ { + this.Paths[i] = string(randStringFieldMask(r)) + } + if !easy && r.Intn(10) != 0 { + } + return this +} + +type randyFieldMask interface { + Float32() float32 + Float64() float64 + Int63() int64 + Int31() int32 + Uint32() uint32 + Intn(n int) int +} + +func randUTF8RuneFieldMask(r randyFieldMask) rune { + ru := r.Intn(62) + if ru < 10 { + return rune(ru + 48) + } else if ru < 36 { + return rune(ru + 55) + } + return rune(ru + 61) +} +func randStringFieldMask(r randyFieldMask) string { + v2 := r.Intn(100) + tmps := make([]rune, v2) + for i := 0; i < v2; i++ { + tmps[i] = randUTF8RuneFieldMask(r) + } + return string(tmps) +} +func randUnrecognizedFieldMask(r randyFieldMask, maxFieldNumber int) (dAtA []byte) { + l := r.Intn(5) + for i := 0; i < l; i++ { + wire := r.Intn(4) + if wire == 3 { + wire = 5 + } + fieldNumber := maxFieldNumber + r.Intn(100) + dAtA = randFieldFieldMask(dAtA, r, fieldNumber, wire) + } + return dAtA +} +func randFieldFieldMask(dAtA []byte, r randyFieldMask, fieldNumber int, wire int) []byte { + key := uint32(fieldNumber)<<3 | uint32(wire) + switch wire { + case 0: + dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(key)) + v3 := r.Int63() + if r.Intn(2) == 0 { + v3 *= -1 + } + dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(v3)) + case 1: + dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + case 2: + dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(key)) + ll := r.Intn(100) + dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(ll)) + for j := 0; j < ll; j++ { + dAtA = append(dAtA, byte(r.Intn(256))) + } + default: + dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + } + return dAtA +} +func encodeVarintPopulateFieldMask(dAtA []byte, v uint64) []byte { + for v >= 1<<7 { + dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) + v >>= 7 + } + dAtA = append(dAtA, uint8(v)) + return dAtA +} +func (m *FieldMask) Size() (n int) { + var l int + _ = l + if len(m.Paths) > 0 { + for _, s := range m.Paths { + l = len(s) + n += 1 + l + sovFieldMask(uint64(l)) + } + } + return n +} + +func sovFieldMask(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozFieldMask(x uint64) (n int) { + return sovFieldMask(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *FieldMask) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&FieldMask{`, + `Paths:` + fmt.Sprintf("%v", this.Paths) + `,`, + `}`, + }, "") + return s +} +func valueToStringFieldMask(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *FieldMask) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFieldMask + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FieldMask: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FieldMask: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Paths", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFieldMask + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFieldMask + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Paths = append(m.Paths, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipFieldMask(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthFieldMask + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipFieldMask(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFieldMask + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFieldMask + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFieldMask + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthFieldMask + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFieldMask + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipFieldMask(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthFieldMask = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowFieldMask = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("field_mask.proto", fileDescriptorFieldMask) } + +var fileDescriptorFieldMask = []byte{ + // 196 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x12, 0x48, 0xcb, 0x4c, 0xcd, + 0x49, 0x89, 0xcf, 0x4d, 0x2c, 0xce, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x4f, 0xcf, + 0xcf, 0x4f, 0xcf, 0x49, 0x85, 0xf0, 0x92, 0x4a, 0xd3, 0x94, 0x14, 0xb9, 0x38, 0xdd, 0x40, 0x8a, + 0x7c, 0x13, 0x8b, 0xb3, 0x85, 0x44, 0xb8, 0x58, 0x0b, 0x12, 0x4b, 0x32, 0x8a, 0x25, 0x18, 0x15, + 0x98, 0x35, 0x38, 0x83, 0x20, 0x1c, 0xa7, 0x0e, 0xc6, 0x0b, 0x0f, 0xe5, 0x18, 0x6e, 0x3c, 0x94, + 0x63, 0xf8, 0xf0, 0x50, 0x8e, 0xf1, 0xc7, 0x43, 0x39, 0xc6, 0x86, 0x47, 0x72, 0x8c, 0x2b, 0x1e, + 0xc9, 0x31, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x2f, + 0x1e, 0xc9, 0x31, 0x7c, 0x00, 0x89, 0x3f, 0x96, 0x63, 0xe4, 0x12, 0x4e, 0xce, 0xcf, 0xd5, 0x43, + 0xb3, 0xca, 0x89, 0x0f, 0x6e, 0x51, 0x00, 0x48, 0x28, 0x80, 0x31, 0x8a, 0xb5, 0xa4, 0xb2, 0x20, + 0xb5, 0x78, 0x01, 0x23, 0xe3, 0x22, 0x26, 0x66, 0xf7, 0x00, 0xa7, 0x55, 0x4c, 0x72, 0xee, 0x10, + 0x3d, 0x01, 0x50, 0x3d, 0x7a, 0xe1, 0xa9, 0x39, 0x39, 0xde, 0x79, 0xf9, 0xe5, 0x79, 0x21, 0x20, + 0x95, 0x49, 0x6c, 0x60, 0xc3, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xea, 0xb1, 0x3a, 0xd5, + 0xd9, 0x00, 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/struct.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/struct.pb.go new file mode 100644 index 00000000000..61acd4a6494 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/struct.pb.go @@ -0,0 +1,1908 @@ +// Code generated by protoc-gen-gogo. +// source: struct.proto +// DO NOT EDIT! + +/* + Package types is a generated protocol buffer package. + + It is generated from these files: + struct.proto + + It has these top-level messages: + Struct + Value + ListValue +*/ +package types + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import strconv "strconv" + +import strings "strings" +import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" +import sort "sort" +import reflect "reflect" +import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// `NullValue` is a singleton enumeration to represent the null value for the +// `Value` type union. +// +// The JSON representation for `NullValue` is JSON `null`. +type NullValue int32 + +const ( + // Null value. + NULL_VALUE NullValue = 0 +) + +var NullValue_name = map[int32]string{ + 0: "NULL_VALUE", +} +var NullValue_value = map[string]int32{ + "NULL_VALUE": 0, +} + +func (NullValue) EnumDescriptor() ([]byte, []int) { return fileDescriptorStruct, []int{0} } +func (NullValue) XXX_WellKnownType() string { return "NullValue" } + +// `Struct` represents a structured data value, consisting of fields +// which map to dynamically typed values. In some languages, `Struct` +// might be supported by a native representation. For example, in +// scripting languages like JS a struct is represented as an +// object. The details of that representation are described together +// with the proto support for the language. +// +// The JSON representation for `Struct` is JSON object. +type Struct struct { + // Unordered map of dynamically typed values. + Fields map[string]*Value `protobuf:"bytes,1,rep,name=fields" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"` +} + +func (m *Struct) Reset() { *m = Struct{} } +func (*Struct) ProtoMessage() {} +func (*Struct) Descriptor() ([]byte, []int) { return fileDescriptorStruct, []int{0} } +func (*Struct) XXX_WellKnownType() string { return "Struct" } + +func (m *Struct) GetFields() map[string]*Value { + if m != nil { + return m.Fields + } + return nil +} + +// `Value` represents a dynamically typed value which can be either +// null, a number, a string, a boolean, a recursive struct value, or a +// list of values. A producer of value is expected to set one of that +// variants, absence of any variant indicates an error. +// +// The JSON representation for `Value` is JSON value. +type Value struct { + // The kind of value. + // + // Types that are valid to be assigned to Kind: + // *Value_NullValue + // *Value_NumberValue + // *Value_StringValue + // *Value_BoolValue + // *Value_StructValue + // *Value_ListValue + Kind isValue_Kind `protobuf_oneof:"kind"` +} + +func (m *Value) Reset() { *m = Value{} } +func (*Value) ProtoMessage() {} +func (*Value) Descriptor() ([]byte, []int) { return fileDescriptorStruct, []int{1} } +func (*Value) XXX_WellKnownType() string { return "Value" } + +type isValue_Kind interface { + isValue_Kind() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type Value_NullValue struct { + NullValue NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,proto3,enum=google.protobuf.NullValue,oneof"` +} +type Value_NumberValue struct { + NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,proto3,oneof"` +} +type Value_StringValue struct { + StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"` +} +type Value_BoolValue struct { + BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"` +} +type Value_StructValue struct { + StructValue *Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,oneof"` +} +type Value_ListValue struct { + ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,oneof"` +} + +func (*Value_NullValue) isValue_Kind() {} +func (*Value_NumberValue) isValue_Kind() {} +func (*Value_StringValue) isValue_Kind() {} +func (*Value_BoolValue) isValue_Kind() {} +func (*Value_StructValue) isValue_Kind() {} +func (*Value_ListValue) isValue_Kind() {} + +func (m *Value) GetKind() isValue_Kind { + if m != nil { + return m.Kind + } + return nil +} + +func (m *Value) GetNullValue() NullValue { + if x, ok := m.GetKind().(*Value_NullValue); ok { + return x.NullValue + } + return NULL_VALUE +} + +func (m *Value) GetNumberValue() float64 { + if x, ok := m.GetKind().(*Value_NumberValue); ok { + return x.NumberValue + } + return 0 +} + +func (m *Value) GetStringValue() string { + if x, ok := m.GetKind().(*Value_StringValue); ok { + return x.StringValue + } + return "" +} + +func (m *Value) GetBoolValue() bool { + if x, ok := m.GetKind().(*Value_BoolValue); ok { + return x.BoolValue + } + return false +} + +func (m *Value) GetStructValue() *Struct { + if x, ok := m.GetKind().(*Value_StructValue); ok { + return x.StructValue + } + return nil +} + +func (m *Value) GetListValue() *ListValue { + if x, ok := m.GetKind().(*Value_ListValue); ok { + return x.ListValue + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*Value) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _Value_OneofMarshaler, _Value_OneofUnmarshaler, _Value_OneofSizer, []interface{}{ + (*Value_NullValue)(nil), + (*Value_NumberValue)(nil), + (*Value_StringValue)(nil), + (*Value_BoolValue)(nil), + (*Value_StructValue)(nil), + (*Value_ListValue)(nil), + } +} + +func _Value_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*Value) + // kind + switch x := m.Kind.(type) { + case *Value_NullValue: + _ = b.EncodeVarint(1<<3 | proto.WireVarint) + _ = b.EncodeVarint(uint64(x.NullValue)) + case *Value_NumberValue: + _ = b.EncodeVarint(2<<3 | proto.WireFixed64) + _ = b.EncodeFixed64(math.Float64bits(x.NumberValue)) + case *Value_StringValue: + _ = b.EncodeVarint(3<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.StringValue) + case *Value_BoolValue: + t := uint64(0) + if x.BoolValue { + t = 1 + } + _ = b.EncodeVarint(4<<3 | proto.WireVarint) + _ = b.EncodeVarint(t) + case *Value_StructValue: + _ = b.EncodeVarint(5<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.StructValue); err != nil { + return err + } + case *Value_ListValue: + _ = b.EncodeVarint(6<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.ListValue); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("Value.Kind has unexpected type %T", x) + } + return nil +} + +func _Value_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*Value) + switch tag { + case 1: // kind.null_value + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Kind = &Value_NullValue{NullValue(x)} + return true, err + case 2: // kind.number_value + if wire != proto.WireFixed64 { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeFixed64() + m.Kind = &Value_NumberValue{math.Float64frombits(x)} + return true, err + case 3: // kind.string_value + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Kind = &Value_StringValue{x} + return true, err + case 4: // kind.bool_value + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Kind = &Value_BoolValue{x != 0} + return true, err + case 5: // kind.struct_value + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Struct) + err := b.DecodeMessage(msg) + m.Kind = &Value_StructValue{msg} + return true, err + case 6: // kind.list_value + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(ListValue) + err := b.DecodeMessage(msg) + m.Kind = &Value_ListValue{msg} + return true, err + default: + return false, nil + } +} + +func _Value_OneofSizer(msg proto.Message) (n int) { + m := msg.(*Value) + // kind + switch x := m.Kind.(type) { + case *Value_NullValue: + n += proto.SizeVarint(1<<3 | proto.WireVarint) + n += proto.SizeVarint(uint64(x.NullValue)) + case *Value_NumberValue: + n += proto.SizeVarint(2<<3 | proto.WireFixed64) + n += 8 + case *Value_StringValue: + n += proto.SizeVarint(3<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.StringValue))) + n += len(x.StringValue) + case *Value_BoolValue: + n += proto.SizeVarint(4<<3 | proto.WireVarint) + n += 1 + case *Value_StructValue: + s := proto.Size(x.StructValue) + n += proto.SizeVarint(5<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *Value_ListValue: + s := proto.Size(x.ListValue) + n += proto.SizeVarint(6<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// `ListValue` is a wrapper around a repeated field of values. +// +// The JSON representation for `ListValue` is JSON array. +type ListValue struct { + // Repeated field of dynamically typed values. + Values []*Value `protobuf:"bytes,1,rep,name=values" json:"values,omitempty"` +} + +func (m *ListValue) Reset() { *m = ListValue{} } +func (*ListValue) ProtoMessage() {} +func (*ListValue) Descriptor() ([]byte, []int) { return fileDescriptorStruct, []int{2} } +func (*ListValue) XXX_WellKnownType() string { return "ListValue" } + +func (m *ListValue) GetValues() []*Value { + if m != nil { + return m.Values + } + return nil +} + +func init() { + proto.RegisterType((*Struct)(nil), "google.protobuf.Struct") + proto.RegisterType((*Value)(nil), "google.protobuf.Value") + proto.RegisterType((*ListValue)(nil), "google.protobuf.ListValue") + proto.RegisterEnum("google.protobuf.NullValue", NullValue_name, NullValue_value) +} +func (x NullValue) String() string { + s, ok := NullValue_name[int32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} +func (this *Struct) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*Struct) + if !ok { + that2, ok := that.(Struct) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if len(this.Fields) != len(that1.Fields) { + return false + } + for i := range this.Fields { + if !this.Fields[i].Equal(that1.Fields[i]) { + return false + } + } + return true +} +func (this *Value) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*Value) + if !ok { + that2, ok := that.(Value) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if that1.Kind == nil { + if this.Kind != nil { + return false + } + } else if this.Kind == nil { + return false + } else if !this.Kind.Equal(that1.Kind) { + return false + } + return true +} +func (this *Value_NullValue) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*Value_NullValue) + if !ok { + that2, ok := that.(Value_NullValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if this.NullValue != that1.NullValue { + return false + } + return true +} +func (this *Value_NumberValue) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*Value_NumberValue) + if !ok { + that2, ok := that.(Value_NumberValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if this.NumberValue != that1.NumberValue { + return false + } + return true +} +func (this *Value_StringValue) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*Value_StringValue) + if !ok { + that2, ok := that.(Value_StringValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if this.StringValue != that1.StringValue { + return false + } + return true +} +func (this *Value_BoolValue) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*Value_BoolValue) + if !ok { + that2, ok := that.(Value_BoolValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if this.BoolValue != that1.BoolValue { + return false + } + return true +} +func (this *Value_StructValue) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*Value_StructValue) + if !ok { + that2, ok := that.(Value_StructValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if !this.StructValue.Equal(that1.StructValue) { + return false + } + return true +} +func (this *Value_ListValue) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*Value_ListValue) + if !ok { + that2, ok := that.(Value_ListValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if !this.ListValue.Equal(that1.ListValue) { + return false + } + return true +} +func (this *ListValue) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*ListValue) + if !ok { + that2, ok := that.(ListValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if len(this.Values) != len(that1.Values) { + return false + } + for i := range this.Values { + if !this.Values[i].Equal(that1.Values[i]) { + return false + } + } + return true +} +func (this *Struct) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.Struct{") + keysForFields := make([]string, 0, len(this.Fields)) + for k := range this.Fields { + keysForFields = append(keysForFields, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForFields) + mapStringForFields := "map[string]*Value{" + for _, k := range keysForFields { + mapStringForFields += fmt.Sprintf("%#v: %#v,", k, this.Fields[k]) + } + mapStringForFields += "}" + if this.Fields != nil { + s = append(s, "Fields: "+mapStringForFields+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *Value) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 10) + s = append(s, "&types.Value{") + if this.Kind != nil { + s = append(s, "Kind: "+fmt.Sprintf("%#v", this.Kind)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *Value_NullValue) GoString() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&types.Value_NullValue{` + + `NullValue:` + fmt.Sprintf("%#v", this.NullValue) + `}`}, ", ") + return s +} +func (this *Value_NumberValue) GoString() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&types.Value_NumberValue{` + + `NumberValue:` + fmt.Sprintf("%#v", this.NumberValue) + `}`}, ", ") + return s +} +func (this *Value_StringValue) GoString() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&types.Value_StringValue{` + + `StringValue:` + fmt.Sprintf("%#v", this.StringValue) + `}`}, ", ") + return s +} +func (this *Value_BoolValue) GoString() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&types.Value_BoolValue{` + + `BoolValue:` + fmt.Sprintf("%#v", this.BoolValue) + `}`}, ", ") + return s +} +func (this *Value_StructValue) GoString() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&types.Value_StructValue{` + + `StructValue:` + fmt.Sprintf("%#v", this.StructValue) + `}`}, ", ") + return s +} +func (this *Value_ListValue) GoString() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&types.Value_ListValue{` + + `ListValue:` + fmt.Sprintf("%#v", this.ListValue) + `}`}, ", ") + return s +} +func (this *ListValue) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.ListValue{") + if this.Values != nil { + s = append(s, "Values: "+fmt.Sprintf("%#v", this.Values)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringStruct(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func extensionToGoStringStruct(m github_com_gogo_protobuf_proto.Message) string { + e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) + if e == nil { + return "nil" + } + s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" + keys := make([]int, 0, len(e)) + for k := range e { + keys = append(keys, int(k)) + } + sort.Ints(keys) + ss := []string{} + for _, k := range keys { + ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) + } + s += strings.Join(ss, ",") + "})" + return s +} +func (m *Struct) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Struct) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Fields) > 0 { + for k := range m.Fields { + dAtA[i] = 0xa + i++ + v := m.Fields[k] + msgSize := 0 + if v != nil { + msgSize = v.Size() + msgSize += 1 + sovStruct(uint64(msgSize)) + } + mapSize := 1 + len(k) + sovStruct(uint64(len(k))) + msgSize + i = encodeVarintStruct(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintStruct(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + if v != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintStruct(dAtA, i, uint64(v.Size())) + n1, err := v.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + } + } + return i, nil +} + +func (m *Value) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Value) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Kind != nil { + nn2, err := m.Kind.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn2 + } + return i, nil +} + +func (m *Value_NullValue) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x8 + i++ + i = encodeVarintStruct(dAtA, i, uint64(m.NullValue)) + return i, nil +} +func (m *Value_NumberValue) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x11 + i++ + i = encodeFixed64Struct(dAtA, i, uint64(math.Float64bits(float64(m.NumberValue)))) + return i, nil +} +func (m *Value_StringValue) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x1a + i++ + i = encodeVarintStruct(dAtA, i, uint64(len(m.StringValue))) + i += copy(dAtA[i:], m.StringValue) + return i, nil +} +func (m *Value_BoolValue) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x20 + i++ + if m.BoolValue { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + return i, nil +} +func (m *Value_StructValue) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.StructValue != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintStruct(dAtA, i, uint64(m.StructValue.Size())) + n3, err := m.StructValue.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + return i, nil +} +func (m *Value_ListValue) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.ListValue != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintStruct(dAtA, i, uint64(m.ListValue.Size())) + n4, err := m.ListValue.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + return i, nil +} +func (m *ListValue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ListValue) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Values) > 0 { + for _, msg := range m.Values { + dAtA[i] = 0xa + i++ + i = encodeVarintStruct(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func encodeFixed64Struct(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Struct(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintStruct(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func NewPopulatedStruct(r randyStruct, easy bool) *Struct { + this := &Struct{} + if r.Intn(10) == 0 { + v1 := r.Intn(10) + this.Fields = make(map[string]*Value) + for i := 0; i < v1; i++ { + this.Fields[randStringStruct(r)] = NewPopulatedValue(r, easy) + } + } + if !easy && r.Intn(10) != 0 { + } + return this +} + +func NewPopulatedValue(r randyStruct, easy bool) *Value { + this := &Value{} + oneofNumber_Kind := []int32{1, 2, 3, 4, 5, 6}[r.Intn(6)] + switch oneofNumber_Kind { + case 1: + this.Kind = NewPopulatedValue_NullValue(r, easy) + case 2: + this.Kind = NewPopulatedValue_NumberValue(r, easy) + case 3: + this.Kind = NewPopulatedValue_StringValue(r, easy) + case 4: + this.Kind = NewPopulatedValue_BoolValue(r, easy) + case 5: + this.Kind = NewPopulatedValue_StructValue(r, easy) + case 6: + this.Kind = NewPopulatedValue_ListValue(r, easy) + } + if !easy && r.Intn(10) != 0 { + } + return this +} + +func NewPopulatedValue_NullValue(r randyStruct, easy bool) *Value_NullValue { + this := &Value_NullValue{} + this.NullValue = NullValue([]int32{0}[r.Intn(1)]) + return this +} +func NewPopulatedValue_NumberValue(r randyStruct, easy bool) *Value_NumberValue { + this := &Value_NumberValue{} + this.NumberValue = float64(r.Float64()) + if r.Intn(2) == 0 { + this.NumberValue *= -1 + } + return this +} +func NewPopulatedValue_StringValue(r randyStruct, easy bool) *Value_StringValue { + this := &Value_StringValue{} + this.StringValue = string(randStringStruct(r)) + return this +} +func NewPopulatedValue_BoolValue(r randyStruct, easy bool) *Value_BoolValue { + this := &Value_BoolValue{} + this.BoolValue = bool(bool(r.Intn(2) == 0)) + return this +} +func NewPopulatedValue_StructValue(r randyStruct, easy bool) *Value_StructValue { + this := &Value_StructValue{} + this.StructValue = NewPopulatedStruct(r, easy) + return this +} +func NewPopulatedValue_ListValue(r randyStruct, easy bool) *Value_ListValue { + this := &Value_ListValue{} + this.ListValue = NewPopulatedListValue(r, easy) + return this +} +func NewPopulatedListValue(r randyStruct, easy bool) *ListValue { + this := &ListValue{} + if r.Intn(10) == 0 { + v2 := r.Intn(5) + this.Values = make([]*Value, v2) + for i := 0; i < v2; i++ { + this.Values[i] = NewPopulatedValue(r, easy) + } + } + if !easy && r.Intn(10) != 0 { + } + return this +} + +type randyStruct interface { + Float32() float32 + Float64() float64 + Int63() int64 + Int31() int32 + Uint32() uint32 + Intn(n int) int +} + +func randUTF8RuneStruct(r randyStruct) rune { + ru := r.Intn(62) + if ru < 10 { + return rune(ru + 48) + } else if ru < 36 { + return rune(ru + 55) + } + return rune(ru + 61) +} +func randStringStruct(r randyStruct) string { + v3 := r.Intn(100) + tmps := make([]rune, v3) + for i := 0; i < v3; i++ { + tmps[i] = randUTF8RuneStruct(r) + } + return string(tmps) +} +func randUnrecognizedStruct(r randyStruct, maxFieldNumber int) (dAtA []byte) { + l := r.Intn(5) + for i := 0; i < l; i++ { + wire := r.Intn(4) + if wire == 3 { + wire = 5 + } + fieldNumber := maxFieldNumber + r.Intn(100) + dAtA = randFieldStruct(dAtA, r, fieldNumber, wire) + } + return dAtA +} +func randFieldStruct(dAtA []byte, r randyStruct, fieldNumber int, wire int) []byte { + key := uint32(fieldNumber)<<3 | uint32(wire) + switch wire { + case 0: + dAtA = encodeVarintPopulateStruct(dAtA, uint64(key)) + v4 := r.Int63() + if r.Intn(2) == 0 { + v4 *= -1 + } + dAtA = encodeVarintPopulateStruct(dAtA, uint64(v4)) + case 1: + dAtA = encodeVarintPopulateStruct(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + case 2: + dAtA = encodeVarintPopulateStruct(dAtA, uint64(key)) + ll := r.Intn(100) + dAtA = encodeVarintPopulateStruct(dAtA, uint64(ll)) + for j := 0; j < ll; j++ { + dAtA = append(dAtA, byte(r.Intn(256))) + } + default: + dAtA = encodeVarintPopulateStruct(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + } + return dAtA +} +func encodeVarintPopulateStruct(dAtA []byte, v uint64) []byte { + for v >= 1<<7 { + dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) + v >>= 7 + } + dAtA = append(dAtA, uint8(v)) + return dAtA +} +func (m *Struct) Size() (n int) { + var l int + _ = l + if len(m.Fields) > 0 { + for k, v := range m.Fields { + _ = k + _ = v + l = 0 + if v != nil { + l = v.Size() + l += 1 + sovStruct(uint64(l)) + } + mapEntrySize := 1 + len(k) + sovStruct(uint64(len(k))) + l + n += mapEntrySize + 1 + sovStruct(uint64(mapEntrySize)) + } + } + return n +} + +func (m *Value) Size() (n int) { + var l int + _ = l + if m.Kind != nil { + n += m.Kind.Size() + } + return n +} + +func (m *Value_NullValue) Size() (n int) { + var l int + _ = l + n += 1 + sovStruct(uint64(m.NullValue)) + return n +} +func (m *Value_NumberValue) Size() (n int) { + var l int + _ = l + n += 9 + return n +} +func (m *Value_StringValue) Size() (n int) { + var l int + _ = l + l = len(m.StringValue) + n += 1 + l + sovStruct(uint64(l)) + return n +} +func (m *Value_BoolValue) Size() (n int) { + var l int + _ = l + n += 2 + return n +} +func (m *Value_StructValue) Size() (n int) { + var l int + _ = l + if m.StructValue != nil { + l = m.StructValue.Size() + n += 1 + l + sovStruct(uint64(l)) + } + return n +} +func (m *Value_ListValue) Size() (n int) { + var l int + _ = l + if m.ListValue != nil { + l = m.ListValue.Size() + n += 1 + l + sovStruct(uint64(l)) + } + return n +} +func (m *ListValue) Size() (n int) { + var l int + _ = l + if len(m.Values) > 0 { + for _, e := range m.Values { + l = e.Size() + n += 1 + l + sovStruct(uint64(l)) + } + } + return n +} + +func sovStruct(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozStruct(x uint64) (n int) { + return sovStruct(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Struct) String() string { + if this == nil { + return "nil" + } + keysForFields := make([]string, 0, len(this.Fields)) + for k := range this.Fields { + keysForFields = append(keysForFields, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForFields) + mapStringForFields := "map[string]*Value{" + for _, k := range keysForFields { + mapStringForFields += fmt.Sprintf("%v: %v,", k, this.Fields[k]) + } + mapStringForFields += "}" + s := strings.Join([]string{`&Struct{`, + `Fields:` + mapStringForFields + `,`, + `}`, + }, "") + return s +} +func (this *Value) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Value{`, + `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, + `}`, + }, "") + return s +} +func (this *Value_NullValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Value_NullValue{`, + `NullValue:` + fmt.Sprintf("%v", this.NullValue) + `,`, + `}`, + }, "") + return s +} +func (this *Value_NumberValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Value_NumberValue{`, + `NumberValue:` + fmt.Sprintf("%v", this.NumberValue) + `,`, + `}`, + }, "") + return s +} +func (this *Value_StringValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Value_StringValue{`, + `StringValue:` + fmt.Sprintf("%v", this.StringValue) + `,`, + `}`, + }, "") + return s +} +func (this *Value_BoolValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Value_BoolValue{`, + `BoolValue:` + fmt.Sprintf("%v", this.BoolValue) + `,`, + `}`, + }, "") + return s +} +func (this *Value_StructValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Value_StructValue{`, + `StructValue:` + strings.Replace(fmt.Sprintf("%v", this.StructValue), "Struct", "Struct", 1) + `,`, + `}`, + }, "") + return s +} +func (this *Value_ListValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Value_ListValue{`, + `ListValue:` + strings.Replace(fmt.Sprintf("%v", this.ListValue), "ListValue", "ListValue", 1) + `,`, + `}`, + }, "") + return s +} +func (this *ListValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ListValue{`, + `Values:` + strings.Replace(fmt.Sprintf("%v", this.Values), "Value", "Value", 1) + `,`, + `}`, + }, "") + return s +} +func valueToStringStruct(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Struct) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Struct: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Struct: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fields", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStruct + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var keykey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + keykey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthStruct + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey := string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + if m.Fields == nil { + m.Fields = make(map[string]*Value) + } + if iNdEx < postIndex { + var valuekey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + valuekey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthStruct + } + postmsgIndex := iNdEx + mapmsglen + if mapmsglen < 0 { + return ErrInvalidLengthStruct + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue := &Value{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + m.Fields[mapkey] = mapvalue + } else { + var mapvalue *Value + m.Fields[mapkey] = mapvalue + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStruct(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStruct + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Value) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Value: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Value: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NullValue", wireType) + } + var v NullValue + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (NullValue(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Kind = &Value_NullValue{v} + case 2: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field NumberValue", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + iNdEx += 8 + v = uint64(dAtA[iNdEx-8]) + v |= uint64(dAtA[iNdEx-7]) << 8 + v |= uint64(dAtA[iNdEx-6]) << 16 + v |= uint64(dAtA[iNdEx-5]) << 24 + v |= uint64(dAtA[iNdEx-4]) << 32 + v |= uint64(dAtA[iNdEx-3]) << 40 + v |= uint64(dAtA[iNdEx-2]) << 48 + v |= uint64(dAtA[iNdEx-1]) << 56 + m.Kind = &Value_NumberValue{float64(math.Float64frombits(v))} + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StringValue", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStruct + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Kind = &Value_StringValue{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BoolValue", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.Kind = &Value_BoolValue{b} + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StructValue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStruct + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &Struct{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Kind = &Value_StructValue{v} + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListValue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStruct + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &ListValue{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Kind = &Value_ListValue{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStruct(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStruct + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ListValue) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ListValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStruct + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStruct + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Values = append(m.Values, &Value{}) + if err := m.Values[len(m.Values)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStruct(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStruct + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipStruct(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStruct + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStruct + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStruct + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthStruct + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStruct + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipStruct(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthStruct = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowStruct = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("struct.proto", fileDescriptorStruct) } + +var fileDescriptorStruct = []byte{ + // 432 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x91, 0xc1, 0x6b, 0xd4, 0x40, + 0x14, 0xc6, 0xf3, 0xb2, 0xdd, 0xe0, 0xbe, 0x94, 0x5a, 0x46, 0xd0, 0xa5, 0xc2, 0xb8, 0x6c, 0x2f, + 0x41, 0x24, 0x87, 0xf5, 0x22, 0xae, 0x17, 0x03, 0xb5, 0x05, 0x43, 0x89, 0xd1, 0x56, 0xf0, 0xb2, + 0x98, 0x6d, 0xba, 0x84, 0x4e, 0x67, 0x4a, 0x32, 0x51, 0xf6, 0xa6, 0xff, 0x85, 0x47, 0xf1, 0x24, + 0x1e, 0xfd, 0x2b, 0x3c, 0xf6, 0xe8, 0xd1, 0xe4, 0xe4, 0xb1, 0x47, 0x8f, 0x32, 0x33, 0x49, 0x94, + 0x2e, 0x7b, 0xcb, 0xfb, 0xf2, 0x7b, 0xdf, 0x7b, 0xdf, 0x1b, 0xdc, 0x2c, 0x64, 0x5e, 0xce, 0xa5, + 0x7f, 0x91, 0x0b, 0x29, 0xc8, 0xcd, 0x85, 0x10, 0x0b, 0x96, 0x9a, 0x2a, 0x29, 0x4f, 0xc7, 0x9f, + 0x00, 0x9d, 0x97, 0x9a, 0x20, 0x53, 0x74, 0x4e, 0xb3, 0x94, 0x9d, 0x14, 0x43, 0x18, 0xf5, 0x3c, + 0x77, 0xb2, 0xeb, 0x5f, 0x83, 0x7d, 0x03, 0xfa, 0xcf, 0x34, 0xb5, 0xc7, 0x65, 0xbe, 0x8c, 0x9b, + 0x96, 0x9d, 0x17, 0xe8, 0xfe, 0x27, 0x93, 0x6d, 0xec, 0x9d, 0xa5, 0xcb, 0x21, 0x8c, 0xc0, 0x1b, + 0xc4, 0xea, 0x93, 0x3c, 0xc0, 0xfe, 0xbb, 0xb7, 0xac, 0x4c, 0x87, 0xf6, 0x08, 0x3c, 0x77, 0x72, + 0x7b, 0xc5, 0xfc, 0x58, 0xfd, 0x8d, 0x0d, 0xf4, 0xd8, 0x7e, 0x04, 0xe3, 0xef, 0x36, 0xf6, 0xb5, + 0x48, 0xa6, 0x88, 0xbc, 0x64, 0x6c, 0x66, 0x0c, 0x94, 0xe9, 0xd6, 0x64, 0x67, 0xc5, 0xe0, 0xb0, + 0x64, 0x4c, 0xf3, 0x07, 0x56, 0x3c, 0xe0, 0x6d, 0x41, 0x76, 0x71, 0x93, 0x97, 0xe7, 0x49, 0x9a, + 0xcf, 0xfe, 0xcd, 0x87, 0x03, 0x2b, 0x76, 0x8d, 0xda, 0x41, 0x85, 0xcc, 0x33, 0xbe, 0x68, 0xa0, + 0x9e, 0x5a, 0x5c, 0x41, 0x46, 0x35, 0xd0, 0x3d, 0xc4, 0x44, 0x88, 0x76, 0x8d, 0x8d, 0x11, 0x78, + 0x37, 0xd4, 0x28, 0xa5, 0x19, 0xe0, 0x49, 0x7b, 0xed, 0x06, 0xe9, 0xeb, 0xa8, 0x77, 0xd6, 0xdc, + 0xb1, 0xb1, 0x2f, 0xe7, 0xb2, 0x4b, 0xc9, 0xb2, 0xa2, 0xed, 0x75, 0x74, 0xef, 0x6a, 0xca, 0x30, + 0x2b, 0x64, 0x97, 0x92, 0xb5, 0x45, 0xe0, 0xe0, 0xc6, 0x59, 0xc6, 0x4f, 0xc6, 0x53, 0x1c, 0x74, + 0x04, 0xf1, 0xd1, 0xd1, 0x66, 0xed, 0x8b, 0xae, 0x3b, 0x7a, 0x43, 0xdd, 0xbf, 0x8b, 0x83, 0xee, + 0x88, 0x64, 0x0b, 0xf1, 0xf0, 0x28, 0x0c, 0x67, 0xc7, 0x4f, 0xc3, 0xa3, 0xbd, 0x6d, 0x2b, 0xf8, + 0x08, 0x97, 0x15, 0xb5, 0x7e, 0x56, 0xd4, 0xba, 0xaa, 0x28, 0xfc, 0xa9, 0x28, 0x7c, 0xa8, 0x29, + 0x7c, 0xad, 0x29, 0xfc, 0xa8, 0x29, 0x5c, 0xd6, 0x14, 0x7e, 0xd5, 0x14, 0x7e, 0xd7, 0xd4, 0xba, + 0xaa, 0x29, 0xe0, 0xad, 0xb9, 0x38, 0xbf, 0x3e, 0x2e, 0x70, 0x4d, 0xf2, 0x48, 0xd5, 0x11, 0xbc, + 0xe9, 0xcb, 0xe5, 0x45, 0x5a, 0x7c, 0x06, 0xf8, 0x62, 0xf7, 0xf6, 0xa3, 0xe0, 0x9b, 0x4d, 0xf7, + 0x4d, 0x43, 0xd4, 0xee, 0xf7, 0x3a, 0x65, 0xec, 0x39, 0x17, 0xef, 0xf9, 0x2b, 0x45, 0x26, 0x8e, + 0x76, 0x7a, 0xf8, 0x37, 0x00, 0x00, 0xff, 0xff, 0x52, 0x64, 0x2c, 0x57, 0xd5, 0x02, 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp.go new file mode 100644 index 00000000000..521b62d925e --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp.go @@ -0,0 +1,123 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2016 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +package types + +// This file implements operations on google.protobuf.Timestamp. + +import ( + "errors" + "fmt" + "time" +) + +const ( + // Seconds field of the earliest valid Timestamp. + // This is time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). + minValidSeconds = -62135596800 + // Seconds field just after the latest valid Timestamp. + // This is time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). + maxValidSeconds = 253402300800 +) + +// validateTimestamp determines whether a Timestamp is valid. +// A valid timestamp represents a time in the range +// [0001-01-01, 10000-01-01) and has a Nanos field +// in the range [0, 1e9). +// +// If the Timestamp is valid, validateTimestamp returns nil. +// Otherwise, it returns an error that describes +// the problem. +// +// Every valid Timestamp can be represented by a time.Time, but the converse is not true. +func validateTimestamp(ts *Timestamp) error { + if ts == nil { + return errors.New("timestamp: nil Timestamp") + } + if ts.Seconds < minValidSeconds { + return fmt.Errorf("timestamp: %#v before 0001-01-01", ts) + } + if ts.Seconds >= maxValidSeconds { + return fmt.Errorf("timestamp: %#v after 10000-01-01", ts) + } + if ts.Nanos < 0 || ts.Nanos >= 1e9 { + return fmt.Errorf("timestamp: %#v: nanos not in range [0, 1e9)", ts) + } + return nil +} + +// TimestampFromProto converts a google.protobuf.Timestamp proto to a time.Time. +// It returns an error if the argument is invalid. +// +// Unlike most Go functions, if Timestamp returns an error, the first return value +// is not the zero time.Time. Instead, it is the value obtained from the +// time.Unix function when passed the contents of the Timestamp, in the UTC +// locale. This may or may not be a meaningful time; many invalid Timestamps +// do map to valid time.Times. +// +// A nil Timestamp returns an error. The first return value in that case is +// undefined. +func TimestampFromProto(ts *Timestamp) (time.Time, error) { + // Don't return the zero value on error, because corresponds to a valid + // timestamp. Instead return whatever time.Unix gives us. + var t time.Time + if ts == nil { + t = time.Unix(0, 0).UTC() // treat nil like the empty Timestamp + } else { + t = time.Unix(ts.Seconds, int64(ts.Nanos)).UTC() + } + return t, validateTimestamp(ts) +} + +// TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. +// It returns an error if the resulting Timestamp is invalid. +func TimestampProto(t time.Time) (*Timestamp, error) { + seconds := t.Unix() + nanos := int32(t.Sub(time.Unix(seconds, 0))) + ts := &Timestamp{ + Seconds: seconds, + Nanos: nanos, + } + if err := validateTimestamp(ts); err != nil { + return nil, err + } + return ts, nil +} + +// TimestampString returns the RFC 3339 string for valid Timestamps. For invalid +// Timestamps, it returns an error message in parentheses. +func TimestampString(ts *Timestamp) string { + t, err := TimestampFromProto(ts) + if err != nil { + return fmt.Sprintf("(%v)", err) + } + return t.Format(time.RFC3339Nano) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp.pb.go new file mode 100644 index 00000000000..4b0c34f2c47 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp.pb.go @@ -0,0 +1,527 @@ +// Code generated by protoc-gen-gogo. +// source: timestamp.proto +// DO NOT EDIT! + +/* + Package types is a generated protocol buffer package. + + It is generated from these files: + timestamp.proto + + It has these top-level messages: + Timestamp +*/ +package types + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import strings "strings" +import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" +import sort "sort" +import strconv "strconv" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// A Timestamp represents a point in time independent of any time zone +// or calendar, represented as seconds and fractions of seconds at +// nanosecond resolution in UTC Epoch time. It is encoded using the +// Proleptic Gregorian Calendar which extends the Gregorian calendar +// backwards to year one. It is encoded assuming all minutes are 60 +// seconds long, i.e. leap seconds are "smeared" so that no leap second +// table is needed for interpretation. 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 date strings. +// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). +// +// 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 current time in Python. +// +// now = time.time() +// seconds = int(now) +// nanos = int((now - seconds) * 10**9) +// timestamp = Timestamp(seconds=seconds, nanos=nanos) +// +// +type Timestamp struct { + // Represents seconds of UTC time since Unix epoch + // 1970-01-01T00:00:00Z. Must be from 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"` +} + +func (m *Timestamp) Reset() { *m = Timestamp{} } +func (*Timestamp) ProtoMessage() {} +func (*Timestamp) Descriptor() ([]byte, []int) { return fileDescriptorTimestamp, []int{0} } +func (*Timestamp) XXX_WellKnownType() string { return "Timestamp" } + +func (m *Timestamp) GetSeconds() int64 { + if m != nil { + return m.Seconds + } + return 0 +} + +func (m *Timestamp) GetNanos() int32 { + if m != nil { + return m.Nanos + } + return 0 +} + +func init() { + proto.RegisterType((*Timestamp)(nil), "google.protobuf.Timestamp") +} +func (this *Timestamp) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Timestamp) + if !ok { + that2, ok := that.(Timestamp) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Seconds != that1.Seconds { + if this.Seconds < that1.Seconds { + return -1 + } + return 1 + } + if this.Nanos != that1.Nanos { + if this.Nanos < that1.Nanos { + return -1 + } + return 1 + } + return 0 +} +func (this *Timestamp) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*Timestamp) + if !ok { + that2, ok := that.(Timestamp) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if this.Seconds != that1.Seconds { + return false + } + if this.Nanos != that1.Nanos { + return false + } + return true +} +func (this *Timestamp) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&types.Timestamp{") + s = append(s, "Seconds: "+fmt.Sprintf("%#v", this.Seconds)+",\n") + s = append(s, "Nanos: "+fmt.Sprintf("%#v", this.Nanos)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringTimestamp(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func extensionToGoStringTimestamp(m github_com_gogo_protobuf_proto.Message) string { + e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) + if e == nil { + return "nil" + } + s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" + keys := make([]int, 0, len(e)) + for k := range e { + keys = append(keys, int(k)) + } + sort.Ints(keys) + ss := []string{} + for _, k := range keys { + ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) + } + s += strings.Join(ss, ",") + "})" + return s +} +func (m *Timestamp) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Timestamp) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Seconds != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintTimestamp(dAtA, i, uint64(m.Seconds)) + } + if m.Nanos != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintTimestamp(dAtA, i, uint64(m.Nanos)) + } + return i, nil +} + +func encodeFixed64Timestamp(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Timestamp(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintTimestamp(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *Timestamp) Size() (n int) { + var l int + _ = l + if m.Seconds != 0 { + n += 1 + sovTimestamp(uint64(m.Seconds)) + } + if m.Nanos != 0 { + n += 1 + sovTimestamp(uint64(m.Nanos)) + } + return n +} + +func sovTimestamp(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozTimestamp(x uint64) (n int) { + return sovTimestamp(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Timestamp) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTimestamp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Timestamp: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Timestamp: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seconds", wireType) + } + m.Seconds = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTimestamp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seconds |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nanos", wireType) + } + m.Nanos = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTimestamp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Nanos |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTimestamp(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTimestamp + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTimestamp(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTimestamp + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTimestamp + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTimestamp + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthTimestamp + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTimestamp + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipTimestamp(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthTimestamp = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTimestamp = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("timestamp.proto", fileDescriptorTimestamp) } + +var fileDescriptorTimestamp = []byte{ + // 208 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x2f, 0xc9, 0xcc, 0x4d, + 0x2d, 0x2e, 0x49, 0xcc, 0x2d, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x4f, 0xcf, 0xcf, + 0x4f, 0xcf, 0x49, 0x85, 0xf0, 0x92, 0x4a, 0xd3, 0x94, 0xac, 0xb9, 0x38, 0x43, 0x60, 0x6a, 0x84, + 0x24, 0xb8, 0xd8, 0x8b, 0x53, 0x93, 0xf3, 0xf3, 0x52, 0x8a, 0x25, 0x18, 0x15, 0x18, 0x35, 0x98, + 0x83, 0x60, 0x5c, 0x21, 0x11, 0x2e, 0xd6, 0xbc, 0xc4, 0xbc, 0xfc, 0x62, 0x09, 0x26, 0x05, 0x46, + 0x0d, 0xd6, 0x20, 0x08, 0xc7, 0xa9, 0x99, 0xf1, 0xc2, 0x43, 0x39, 0x86, 0x1b, 0x0f, 0xe5, 0x18, + 0x3e, 0x3c, 0x94, 0x63, 0x5c, 0xf1, 0x48, 0x8e, 0xf1, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, + 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x7c, 0xf1, 0x48, 0x8e, 0xe1, 0xc3, 0x23, 0x39, 0xc6, 0x15, 0x8f, + 0xe5, 0x18, 0xb9, 0x84, 0x93, 0xf3, 0x73, 0xf5, 0xd0, 0x2c, 0x77, 0xe2, 0x83, 0x5b, 0x1d, 0x00, + 0x12, 0x0a, 0x60, 0x8c, 0x62, 0x2d, 0xa9, 0x2c, 0x48, 0x2d, 0x5e, 0xc0, 0xc8, 0xf8, 0x83, 0x91, + 0x71, 0x11, 0x13, 0xb3, 0x7b, 0x80, 0xd3, 0x2a, 0x26, 0x39, 0x77, 0x88, 0xb6, 0x00, 0xa8, 0x36, + 0xbd, 0xf0, 0xd4, 0x9c, 0x1c, 0xef, 0xbc, 0xfc, 0xf2, 0xbc, 0x10, 0x90, 0xe2, 0x24, 0x36, 0xb0, + 0x79, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7c, 0x4d, 0xbd, 0x9c, 0xed, 0x00, 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp_gogo.go new file mode 100644 index 00000000000..e03fa131583 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp_gogo.go @@ -0,0 +1,94 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2016, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package types + +import ( + "time" +) + +func NewPopulatedTimestamp(r interface { + Int63() int64 +}, easy bool) *Timestamp { + this := &Timestamp{} + ns := int64(r.Int63()) + this.Seconds = ns / 1e9 + this.Nanos = int32(ns % 1e9) + return this +} + +func (ts *Timestamp) String() string { + return TimestampString(ts) +} + +func NewPopulatedStdTime(r interface { + Int63() int64 +}, easy bool) *time.Time { + timestamp := NewPopulatedTimestamp(r, easy) + t, err := TimestampFromProto(timestamp) + if err != nil { + return nil + } + return &t +} + +func SizeOfStdTime(t time.Time) int { + ts, err := TimestampProto(t) + if err != nil { + return 0 + } + return ts.Size() +} + +func StdTimeMarshal(t time.Time) ([]byte, error) { + size := SizeOfStdTime(t) + buf := make([]byte, size) + _, err := StdTimeMarshalTo(t, buf) + return buf, err +} + +func StdTimeMarshalTo(t time.Time, data []byte) (int, error) { + ts, err := TimestampProto(t) + if err != nil { + return 0, err + } + return ts.MarshalTo(data) +} + +func StdTimeUnmarshal(t *time.Time, data []byte) error { + ts := &Timestamp{} + if err := ts.Unmarshal(data); err != nil { + return err + } + tt, err := TimestampFromProto(ts) + if err != nil { + return err + } + *t = tt + return nil +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/wrappers.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/wrappers.pb.go new file mode 100644 index 00000000000..bcd011dc0ca --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/wrappers.pb.go @@ -0,0 +1,2280 @@ +// Code generated by protoc-gen-gogo. +// source: wrappers.proto +// DO NOT EDIT! + +/* +Package types is a generated protocol buffer package. + +It is generated from these files: + wrappers.proto + +It has these top-level messages: + DoubleValue + FloatValue + Int64Value + UInt64Value + Int32Value + UInt32Value + BoolValue + StringValue + BytesValue +*/ +package types + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import bytes "bytes" + +import strings "strings" +import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" +import sort "sort" +import strconv "strconv" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// Wrapper message for `double`. +// +// The JSON representation for `DoubleValue` is JSON number. +type DoubleValue struct { + // The double value. + Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *DoubleValue) Reset() { *m = DoubleValue{} } +func (*DoubleValue) ProtoMessage() {} +func (*DoubleValue) Descriptor() ([]byte, []int) { return fileDescriptorWrappers, []int{0} } +func (*DoubleValue) XXX_WellKnownType() string { return "DoubleValue" } + +func (m *DoubleValue) GetValue() float64 { + if m != nil { + return m.Value + } + return 0 +} + +// Wrapper message for `float`. +// +// The JSON representation for `FloatValue` is JSON number. +type FloatValue struct { + // The float value. + Value float32 `protobuf:"fixed32,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *FloatValue) Reset() { *m = FloatValue{} } +func (*FloatValue) ProtoMessage() {} +func (*FloatValue) Descriptor() ([]byte, []int) { return fileDescriptorWrappers, []int{1} } +func (*FloatValue) XXX_WellKnownType() string { return "FloatValue" } + +func (m *FloatValue) GetValue() float32 { + if m != nil { + return m.Value + } + return 0 +} + +// Wrapper message for `int64`. +// +// The JSON representation for `Int64Value` is JSON string. +type Int64Value struct { + // The int64 value. + Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *Int64Value) Reset() { *m = Int64Value{} } +func (*Int64Value) ProtoMessage() {} +func (*Int64Value) Descriptor() ([]byte, []int) { return fileDescriptorWrappers, []int{2} } +func (*Int64Value) XXX_WellKnownType() string { return "Int64Value" } + +func (m *Int64Value) GetValue() int64 { + if m != nil { + return m.Value + } + return 0 +} + +// Wrapper message for `uint64`. +// +// The JSON representation for `UInt64Value` is JSON string. +type UInt64Value struct { + // The uint64 value. + Value uint64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *UInt64Value) Reset() { *m = UInt64Value{} } +func (*UInt64Value) ProtoMessage() {} +func (*UInt64Value) Descriptor() ([]byte, []int) { return fileDescriptorWrappers, []int{3} } +func (*UInt64Value) XXX_WellKnownType() string { return "UInt64Value" } + +func (m *UInt64Value) GetValue() uint64 { + if m != nil { + return m.Value + } + return 0 +} + +// Wrapper message for `int32`. +// +// The JSON representation for `Int32Value` is JSON number. +type Int32Value struct { + // The int32 value. + Value int32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *Int32Value) Reset() { *m = Int32Value{} } +func (*Int32Value) ProtoMessage() {} +func (*Int32Value) Descriptor() ([]byte, []int) { return fileDescriptorWrappers, []int{4} } +func (*Int32Value) XXX_WellKnownType() string { return "Int32Value" } + +func (m *Int32Value) GetValue() int32 { + if m != nil { + return m.Value + } + return 0 +} + +// Wrapper message for `uint32`. +// +// The JSON representation for `UInt32Value` is JSON number. +type UInt32Value struct { + // The uint32 value. + Value uint32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *UInt32Value) Reset() { *m = UInt32Value{} } +func (*UInt32Value) ProtoMessage() {} +func (*UInt32Value) Descriptor() ([]byte, []int) { return fileDescriptorWrappers, []int{5} } +func (*UInt32Value) XXX_WellKnownType() string { return "UInt32Value" } + +func (m *UInt32Value) GetValue() uint32 { + if m != nil { + return m.Value + } + return 0 +} + +// Wrapper message for `bool`. +// +// The JSON representation for `BoolValue` is JSON `true` and `false`. +type BoolValue struct { + // The bool value. + Value bool `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *BoolValue) Reset() { *m = BoolValue{} } +func (*BoolValue) ProtoMessage() {} +func (*BoolValue) Descriptor() ([]byte, []int) { return fileDescriptorWrappers, []int{6} } +func (*BoolValue) XXX_WellKnownType() string { return "BoolValue" } + +func (m *BoolValue) GetValue() bool { + if m != nil { + return m.Value + } + return false +} + +// Wrapper message for `string`. +// +// The JSON representation for `StringValue` is JSON string. +type StringValue struct { + // The string value. + Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *StringValue) Reset() { *m = StringValue{} } +func (*StringValue) ProtoMessage() {} +func (*StringValue) Descriptor() ([]byte, []int) { return fileDescriptorWrappers, []int{7} } +func (*StringValue) XXX_WellKnownType() string { return "StringValue" } + +func (m *StringValue) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +// Wrapper message for `bytes`. +// +// The JSON representation for `BytesValue` is JSON string. +type BytesValue struct { + // The bytes value. + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *BytesValue) Reset() { *m = BytesValue{} } +func (*BytesValue) ProtoMessage() {} +func (*BytesValue) Descriptor() ([]byte, []int) { return fileDescriptorWrappers, []int{8} } +func (*BytesValue) XXX_WellKnownType() string { return "BytesValue" } + +func (m *BytesValue) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +func init() { + proto.RegisterType((*DoubleValue)(nil), "google.protobuf.DoubleValue") + proto.RegisterType((*FloatValue)(nil), "google.protobuf.FloatValue") + proto.RegisterType((*Int64Value)(nil), "google.protobuf.Int64Value") + proto.RegisterType((*UInt64Value)(nil), "google.protobuf.UInt64Value") + proto.RegisterType((*Int32Value)(nil), "google.protobuf.Int32Value") + proto.RegisterType((*UInt32Value)(nil), "google.protobuf.UInt32Value") + proto.RegisterType((*BoolValue)(nil), "google.protobuf.BoolValue") + proto.RegisterType((*StringValue)(nil), "google.protobuf.StringValue") + proto.RegisterType((*BytesValue)(nil), "google.protobuf.BytesValue") +} +func (this *DoubleValue) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*DoubleValue) + if !ok { + that2, ok := that.(DoubleValue) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Value != that1.Value { + if this.Value < that1.Value { + return -1 + } + return 1 + } + return 0 +} +func (this *FloatValue) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*FloatValue) + if !ok { + that2, ok := that.(FloatValue) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Value != that1.Value { + if this.Value < that1.Value { + return -1 + } + return 1 + } + return 0 +} +func (this *Int64Value) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Int64Value) + if !ok { + that2, ok := that.(Int64Value) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Value != that1.Value { + if this.Value < that1.Value { + return -1 + } + return 1 + } + return 0 +} +func (this *UInt64Value) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*UInt64Value) + if !ok { + that2, ok := that.(UInt64Value) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Value != that1.Value { + if this.Value < that1.Value { + return -1 + } + return 1 + } + return 0 +} +func (this *Int32Value) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Int32Value) + if !ok { + that2, ok := that.(Int32Value) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Value != that1.Value { + if this.Value < that1.Value { + return -1 + } + return 1 + } + return 0 +} +func (this *UInt32Value) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*UInt32Value) + if !ok { + that2, ok := that.(UInt32Value) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Value != that1.Value { + if this.Value < that1.Value { + return -1 + } + return 1 + } + return 0 +} +func (this *BoolValue) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*BoolValue) + if !ok { + that2, ok := that.(BoolValue) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Value != that1.Value { + if !this.Value { + return -1 + } + return 1 + } + return 0 +} +func (this *StringValue) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*StringValue) + if !ok { + that2, ok := that.(StringValue) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if this.Value != that1.Value { + if this.Value < that1.Value { + return -1 + } + return 1 + } + return 0 +} +func (this *BytesValue) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*BytesValue) + if !ok { + that2, ok := that.(BytesValue) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if c := bytes.Compare(this.Value, that1.Value); c != 0 { + return c + } + return 0 +} +func (this *DoubleValue) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*DoubleValue) + if !ok { + that2, ok := that.(DoubleValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if this.Value != that1.Value { + return false + } + return true +} +func (this *FloatValue) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*FloatValue) + if !ok { + that2, ok := that.(FloatValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if this.Value != that1.Value { + return false + } + return true +} +func (this *Int64Value) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*Int64Value) + if !ok { + that2, ok := that.(Int64Value) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if this.Value != that1.Value { + return false + } + return true +} +func (this *UInt64Value) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*UInt64Value) + if !ok { + that2, ok := that.(UInt64Value) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if this.Value != that1.Value { + return false + } + return true +} +func (this *Int32Value) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*Int32Value) + if !ok { + that2, ok := that.(Int32Value) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if this.Value != that1.Value { + return false + } + return true +} +func (this *UInt32Value) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*UInt32Value) + if !ok { + that2, ok := that.(UInt32Value) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if this.Value != that1.Value { + return false + } + return true +} +func (this *BoolValue) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*BoolValue) + if !ok { + that2, ok := that.(BoolValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if this.Value != that1.Value { + return false + } + return true +} +func (this *StringValue) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*StringValue) + if !ok { + that2, ok := that.(StringValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if this.Value != that1.Value { + return false + } + return true +} +func (this *BytesValue) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*BytesValue) + if !ok { + that2, ok := that.(BytesValue) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if !bytes.Equal(this.Value, that1.Value) { + return false + } + return true +} +func (this *DoubleValue) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.DoubleValue{") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func (this *FloatValue) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.FloatValue{") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func (this *Int64Value) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.Int64Value{") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func (this *UInt64Value) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.UInt64Value{") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func (this *Int32Value) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.Int32Value{") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func (this *UInt32Value) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.UInt32Value{") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func (this *BoolValue) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.BoolValue{") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func (this *StringValue) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.StringValue{") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func (this *BytesValue) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&types.BytesValue{") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringWrappers(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func extensionToGoStringWrappers(m github_com_gogo_protobuf_proto.Message) string { + e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) + if e == nil { + return "nil" + } + s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" + keys := make([]int, 0, len(e)) + for k := range e { + keys = append(keys, int(k)) + } + sort.Ints(keys) + ss := []string{} + for _, k := range keys { + ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) + } + s += strings.Join(ss, ",") + "})" + return s +} +func (m *DoubleValue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DoubleValue) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Value != 0 { + dAtA[i] = 0x9 + i++ + i = encodeFixed64Wrappers(dAtA, i, uint64(math.Float64bits(float64(m.Value)))) + } + return i, nil +} + +func (m *FloatValue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FloatValue) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Value != 0 { + dAtA[i] = 0xd + i++ + i = encodeFixed32Wrappers(dAtA, i, uint32(math.Float32bits(float32(m.Value)))) + } + return i, nil +} + +func (m *Int64Value) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Int64Value) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Value != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintWrappers(dAtA, i, uint64(m.Value)) + } + return i, nil +} + +func (m *UInt64Value) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UInt64Value) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Value != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintWrappers(dAtA, i, uint64(m.Value)) + } + return i, nil +} + +func (m *Int32Value) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Int32Value) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Value != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintWrappers(dAtA, i, uint64(m.Value)) + } + return i, nil +} + +func (m *UInt32Value) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UInt32Value) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Value != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintWrappers(dAtA, i, uint64(m.Value)) + } + return i, nil +} + +func (m *BoolValue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BoolValue) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Value { + dAtA[i] = 0x8 + i++ + if m.Value { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + return i, nil +} + +func (m *StringValue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StringValue) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Value) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintWrappers(dAtA, i, uint64(len(m.Value))) + i += copy(dAtA[i:], m.Value) + } + return i, nil +} + +func (m *BytesValue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BytesValue) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Value) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintWrappers(dAtA, i, uint64(len(m.Value))) + i += copy(dAtA[i:], m.Value) + } + return i, nil +} + +func encodeFixed64Wrappers(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Wrappers(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintWrappers(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func NewPopulatedDoubleValue(r randyWrappers, easy bool) *DoubleValue { + this := &DoubleValue{} + this.Value = float64(r.Float64()) + if r.Intn(2) == 0 { + this.Value *= -1 + } + if !easy && r.Intn(10) != 0 { + } + return this +} + +func NewPopulatedFloatValue(r randyWrappers, easy bool) *FloatValue { + this := &FloatValue{} + this.Value = float32(r.Float32()) + if r.Intn(2) == 0 { + this.Value *= -1 + } + if !easy && r.Intn(10) != 0 { + } + return this +} + +func NewPopulatedInt64Value(r randyWrappers, easy bool) *Int64Value { + this := &Int64Value{} + this.Value = int64(r.Int63()) + if r.Intn(2) == 0 { + this.Value *= -1 + } + if !easy && r.Intn(10) != 0 { + } + return this +} + +func NewPopulatedUInt64Value(r randyWrappers, easy bool) *UInt64Value { + this := &UInt64Value{} + this.Value = uint64(uint64(r.Uint32())) + if !easy && r.Intn(10) != 0 { + } + return this +} + +func NewPopulatedInt32Value(r randyWrappers, easy bool) *Int32Value { + this := &Int32Value{} + this.Value = int32(r.Int31()) + if r.Intn(2) == 0 { + this.Value *= -1 + } + if !easy && r.Intn(10) != 0 { + } + return this +} + +func NewPopulatedUInt32Value(r randyWrappers, easy bool) *UInt32Value { + this := &UInt32Value{} + this.Value = uint32(r.Uint32()) + if !easy && r.Intn(10) != 0 { + } + return this +} + +func NewPopulatedBoolValue(r randyWrappers, easy bool) *BoolValue { + this := &BoolValue{} + this.Value = bool(bool(r.Intn(2) == 0)) + if !easy && r.Intn(10) != 0 { + } + return this +} + +func NewPopulatedStringValue(r randyWrappers, easy bool) *StringValue { + this := &StringValue{} + this.Value = string(randStringWrappers(r)) + if !easy && r.Intn(10) != 0 { + } + return this +} + +func NewPopulatedBytesValue(r randyWrappers, easy bool) *BytesValue { + this := &BytesValue{} + v1 := r.Intn(100) + this.Value = make([]byte, v1) + for i := 0; i < v1; i++ { + this.Value[i] = byte(r.Intn(256)) + } + if !easy && r.Intn(10) != 0 { + } + return this +} + +type randyWrappers interface { + Float32() float32 + Float64() float64 + Int63() int64 + Int31() int32 + Uint32() uint32 + Intn(n int) int +} + +func randUTF8RuneWrappers(r randyWrappers) rune { + ru := r.Intn(62) + if ru < 10 { + return rune(ru + 48) + } else if ru < 36 { + return rune(ru + 55) + } + return rune(ru + 61) +} +func randStringWrappers(r randyWrappers) string { + v2 := r.Intn(100) + tmps := make([]rune, v2) + for i := 0; i < v2; i++ { + tmps[i] = randUTF8RuneWrappers(r) + } + return string(tmps) +} +func randUnrecognizedWrappers(r randyWrappers, maxFieldNumber int) (dAtA []byte) { + l := r.Intn(5) + for i := 0; i < l; i++ { + wire := r.Intn(4) + if wire == 3 { + wire = 5 + } + fieldNumber := maxFieldNumber + r.Intn(100) + dAtA = randFieldWrappers(dAtA, r, fieldNumber, wire) + } + return dAtA +} +func randFieldWrappers(dAtA []byte, r randyWrappers, fieldNumber int, wire int) []byte { + key := uint32(fieldNumber)<<3 | uint32(wire) + switch wire { + case 0: + dAtA = encodeVarintPopulateWrappers(dAtA, uint64(key)) + v3 := r.Int63() + if r.Intn(2) == 0 { + v3 *= -1 + } + dAtA = encodeVarintPopulateWrappers(dAtA, uint64(v3)) + case 1: + dAtA = encodeVarintPopulateWrappers(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + case 2: + dAtA = encodeVarintPopulateWrappers(dAtA, uint64(key)) + ll := r.Intn(100) + dAtA = encodeVarintPopulateWrappers(dAtA, uint64(ll)) + for j := 0; j < ll; j++ { + dAtA = append(dAtA, byte(r.Intn(256))) + } + default: + dAtA = encodeVarintPopulateWrappers(dAtA, uint64(key)) + dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) + } + return dAtA +} +func encodeVarintPopulateWrappers(dAtA []byte, v uint64) []byte { + for v >= 1<<7 { + dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) + v >>= 7 + } + dAtA = append(dAtA, uint8(v)) + return dAtA +} +func (m *DoubleValue) Size() (n int) { + var l int + _ = l + if m.Value != 0 { + n += 9 + } + return n +} + +func (m *FloatValue) Size() (n int) { + var l int + _ = l + if m.Value != 0 { + n += 5 + } + return n +} + +func (m *Int64Value) Size() (n int) { + var l int + _ = l + if m.Value != 0 { + n += 1 + sovWrappers(uint64(m.Value)) + } + return n +} + +func (m *UInt64Value) Size() (n int) { + var l int + _ = l + if m.Value != 0 { + n += 1 + sovWrappers(uint64(m.Value)) + } + return n +} + +func (m *Int32Value) Size() (n int) { + var l int + _ = l + if m.Value != 0 { + n += 1 + sovWrappers(uint64(m.Value)) + } + return n +} + +func (m *UInt32Value) Size() (n int) { + var l int + _ = l + if m.Value != 0 { + n += 1 + sovWrappers(uint64(m.Value)) + } + return n +} + +func (m *BoolValue) Size() (n int) { + var l int + _ = l + if m.Value { + n += 2 + } + return n +} + +func (m *StringValue) Size() (n int) { + var l int + _ = l + l = len(m.Value) + if l > 0 { + n += 1 + l + sovWrappers(uint64(l)) + } + return n +} + +func (m *BytesValue) Size() (n int) { + var l int + _ = l + l = len(m.Value) + if l > 0 { + n += 1 + l + sovWrappers(uint64(l)) + } + return n +} + +func sovWrappers(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozWrappers(x uint64) (n int) { + return sovWrappers(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *DoubleValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DoubleValue{`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `}`, + }, "") + return s +} +func (this *FloatValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&FloatValue{`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `}`, + }, "") + return s +} +func (this *Int64Value) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Int64Value{`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `}`, + }, "") + return s +} +func (this *UInt64Value) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&UInt64Value{`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `}`, + }, "") + return s +} +func (this *Int32Value) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Int32Value{`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `}`, + }, "") + return s +} +func (this *UInt32Value) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&UInt32Value{`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `}`, + }, "") + return s +} +func (this *BoolValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&BoolValue{`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `}`, + }, "") + return s +} +func (this *StringValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StringValue{`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `}`, + }, "") + return s +} +func (this *BytesValue) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&BytesValue{`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `}`, + }, "") + return s +} +func valueToStringWrappers(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *DoubleValue) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DoubleValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DoubleValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + iNdEx += 8 + v = uint64(dAtA[iNdEx-8]) + v |= uint64(dAtA[iNdEx-7]) << 8 + v |= uint64(dAtA[iNdEx-6]) << 16 + v |= uint64(dAtA[iNdEx-5]) << 24 + v |= uint64(dAtA[iNdEx-4]) << 32 + v |= uint64(dAtA[iNdEx-3]) << 40 + v |= uint64(dAtA[iNdEx-2]) << 48 + v |= uint64(dAtA[iNdEx-1]) << 56 + m.Value = float64(math.Float64frombits(v)) + default: + iNdEx = preIndex + skippy, err := skipWrappers(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWrappers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FloatValue) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FloatValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FloatValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + iNdEx += 4 + v = uint32(dAtA[iNdEx-4]) + v |= uint32(dAtA[iNdEx-3]) << 8 + v |= uint32(dAtA[iNdEx-2]) << 16 + v |= uint32(dAtA[iNdEx-1]) << 24 + m.Value = float32(math.Float32frombits(v)) + default: + iNdEx = preIndex + skippy, err := skipWrappers(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWrappers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Int64Value) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Int64Value: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Int64Value: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipWrappers(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWrappers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UInt64Value) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UInt64Value: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UInt64Value: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipWrappers(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWrappers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Int32Value) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Int32Value: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Int32Value: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipWrappers(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWrappers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UInt32Value) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UInt32Value: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UInt32Value: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipWrappers(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWrappers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BoolValue) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BoolValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BoolValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Value = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipWrappers(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWrappers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StringValue) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StringValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StringValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthWrappers + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipWrappers(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWrappers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BytesValue) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BytesValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BytesValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWrappers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthWrappers + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipWrappers(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthWrappers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipWrappers(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowWrappers + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowWrappers + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowWrappers + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthWrappers + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowWrappers + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipWrappers(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthWrappers = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowWrappers = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("wrappers.proto", fileDescriptorWrappers) } + +var fileDescriptorWrappers = []byte{ + // 281 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x2b, 0x2f, 0x4a, 0x2c, + 0x28, 0x48, 0x2d, 0x2a, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x4f, 0xcf, 0xcf, 0x4f, + 0xcf, 0x49, 0x85, 0xf0, 0x92, 0x4a, 0xd3, 0x94, 0x94, 0xb9, 0xb8, 0x5d, 0xf2, 0x4b, 0x93, 0x72, + 0x52, 0xc3, 0x12, 0x73, 0x4a, 0x53, 0x85, 0x44, 0xb8, 0x58, 0xcb, 0x40, 0x0c, 0x09, 0x46, 0x05, + 0x46, 0x0d, 0xc6, 0x20, 0x08, 0x47, 0x49, 0x89, 0x8b, 0xcb, 0x2d, 0x27, 0x3f, 0xb1, 0x04, 0x8b, + 0x1a, 0x26, 0x24, 0x35, 0x9e, 0x79, 0x25, 0x66, 0x26, 0x58, 0xd4, 0x30, 0xc3, 0xd4, 0x28, 0x73, + 0x71, 0x87, 0xe2, 0x52, 0xc4, 0x82, 0x6a, 0x90, 0xb1, 0x11, 0x16, 0x35, 0xac, 0x68, 0x06, 0x61, + 0x55, 0xc4, 0x0b, 0x53, 0xa4, 0xc8, 0xc5, 0xe9, 0x94, 0x9f, 0x9f, 0x83, 0x45, 0x09, 0x07, 0x92, + 0x39, 0xc1, 0x25, 0x45, 0x99, 0x79, 0xe9, 0x58, 0x14, 0x71, 0x22, 0x39, 0xc8, 0xa9, 0xb2, 0x24, + 0xb5, 0x18, 0x8b, 0x1a, 0x1e, 0xa8, 0x1a, 0xa7, 0x2e, 0xc6, 0x0b, 0x0f, 0xe5, 0x18, 0x6e, 0x3c, + 0x94, 0x63, 0xf8, 0xf0, 0x50, 0x8e, 0xf1, 0xc7, 0x43, 0x39, 0xc6, 0x86, 0x47, 0x72, 0x8c, 0x2b, + 0x1e, 0xc9, 0x31, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, + 0x2f, 0x1e, 0xc9, 0x31, 0x7c, 0x00, 0x89, 0x3f, 0x96, 0x63, 0xe4, 0x12, 0x4e, 0xce, 0xcf, 0xd5, + 0x43, 0x8b, 0x0e, 0x27, 0xde, 0x70, 0x68, 0x7c, 0x05, 0x80, 0x44, 0x02, 0x18, 0xa3, 0x58, 0x4b, + 0x2a, 0x0b, 0x52, 0x8b, 0x17, 0x30, 0x32, 0xfe, 0x60, 0x64, 0x5c, 0xc4, 0xc4, 0xec, 0x1e, 0xe0, + 0xb4, 0x8a, 0x49, 0xce, 0x1d, 0xa2, 0x2b, 0x00, 0xaa, 0x4b, 0x2f, 0x3c, 0x35, 0x27, 0xc7, 0x3b, + 0x2f, 0xbf, 0x3c, 0x2f, 0x04, 0xa4, 0x38, 0x89, 0x0d, 0x6c, 0x9c, 0x31, 0x20, 0x00, 0x00, 0xff, + 0xff, 0xac, 0x8b, 0x9f, 0x55, 0xfd, 0x01, 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/command/command.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/command/command.go new file mode 100644 index 00000000000..eeca42ba0d0 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/command/command.go @@ -0,0 +1,161 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2015, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package command + +import ( + "fmt" + "go/format" + "io/ioutil" + "os" + "strings" + + _ "github.com/gogo/protobuf/plugin/compare" + _ "github.com/gogo/protobuf/plugin/defaultcheck" + _ "github.com/gogo/protobuf/plugin/description" + _ "github.com/gogo/protobuf/plugin/embedcheck" + _ "github.com/gogo/protobuf/plugin/enumstringer" + _ "github.com/gogo/protobuf/plugin/equal" + _ "github.com/gogo/protobuf/plugin/face" + _ "github.com/gogo/protobuf/plugin/gostring" + _ "github.com/gogo/protobuf/plugin/marshalto" + _ "github.com/gogo/protobuf/plugin/oneofcheck" + _ "github.com/gogo/protobuf/plugin/populate" + _ "github.com/gogo/protobuf/plugin/size" + _ "github.com/gogo/protobuf/plugin/stringer" + "github.com/gogo/protobuf/plugin/testgen" + _ "github.com/gogo/protobuf/plugin/union" + _ "github.com/gogo/protobuf/plugin/unmarshal" + "github.com/gogo/protobuf/proto" + "github.com/gogo/protobuf/protoc-gen-gogo/generator" + _ "github.com/gogo/protobuf/protoc-gen-gogo/grpc" + plugin "github.com/gogo/protobuf/protoc-gen-gogo/plugin" +) + +func Read() *plugin.CodeGeneratorRequest { + g := generator.New() + data, err := ioutil.ReadAll(os.Stdin) + if err != nil { + g.Error(err, "reading input") + } + + if err := proto.Unmarshal(data, g.Request); err != nil { + g.Error(err, "parsing input proto") + } + + if len(g.Request.FileToGenerate) == 0 { + g.Fail("no files to generate") + } + return g.Request +} + +// filenameSuffix replaces the .pb.go at the end of each filename. +func GeneratePlugin(req *plugin.CodeGeneratorRequest, p generator.Plugin, filenameSuffix string) *plugin.CodeGeneratorResponse { + g := generator.New() + g.Request = req + if len(g.Request.FileToGenerate) == 0 { + g.Fail("no files to generate") + } + + g.CommandLineParameters(g.Request.GetParameter()) + + g.WrapTypes() + g.SetPackageNames() + g.BuildTypeNameMap() + g.GeneratePlugin(p) + + for i := 0; i < len(g.Response.File); i++ { + g.Response.File[i].Name = proto.String( + strings.Replace(*g.Response.File[i].Name, ".pb.go", filenameSuffix, -1), + ) + } + if err := goformat(g.Response); err != nil { + g.Error(err) + } + return g.Response +} + +func goformat(resp *plugin.CodeGeneratorResponse) error { + for i := 0; i < len(resp.File); i++ { + formatted, err := format.Source([]byte(resp.File[i].GetContent())) + if err != nil { + return fmt.Errorf("go format error: %v", err) + } + fmts := string(formatted) + resp.File[i].Content = &fmts + } + return nil +} + +func Generate(req *plugin.CodeGeneratorRequest) *plugin.CodeGeneratorResponse { + // Begin by allocating a generator. The request and response structures are stored there + // so we can do error handling easily - the response structure contains the field to + // report failure. + g := generator.New() + g.Request = req + + g.CommandLineParameters(g.Request.GetParameter()) + + // Create a wrapped version of the Descriptors and EnumDescriptors that + // point to the file that defines them. + g.WrapTypes() + + g.SetPackageNames() + g.BuildTypeNameMap() + + g.GenerateAllFiles() + + if err := goformat(g.Response); err != nil { + g.Error(err) + } + + testReq := proto.Clone(req).(*plugin.CodeGeneratorRequest) + + testResp := GeneratePlugin(testReq, testgen.NewPlugin(), "pb_test.go") + + for i := 0; i < len(testResp.File); i++ { + if strings.Contains(*testResp.File[i].Content, `//These tests are generated by github.com/gogo/protobuf/plugin/testgen`) { + g.Response.File = append(g.Response.File, testResp.File[i]) + } + } + + return g.Response +} + +func Write(resp *plugin.CodeGeneratorResponse) { + g := generator.New() + // Send back the results. + data, err := proto.Marshal(resp) + if err != nil { + g.Error(err, "failed to marshal output proto") + } + _, err = os.Stdout.Write(data) + if err != nil { + g.Error(err, "failed to write output proto") + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/enum.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/enum.go new file mode 100644 index 00000000000..466d07b54eb --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/enum.go @@ -0,0 +1,78 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2015, The GoGo Authors. rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package vanity + +import ( + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/proto" + descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" +) + +func EnumHasBoolExtension(enum *descriptor.EnumDescriptorProto, extension *proto.ExtensionDesc) bool { + if enum.Options == nil { + return false + } + value, err := proto.GetExtension(enum.Options, extension) + if err != nil { + return false + } + if value == nil { + return false + } + if value.(*bool) == nil { + return false + } + return true +} + +func SetBoolEnumOption(extension *proto.ExtensionDesc, value bool) func(enum *descriptor.EnumDescriptorProto) { + return func(enum *descriptor.EnumDescriptorProto) { + if EnumHasBoolExtension(enum, extension) { + return + } + if enum.Options == nil { + enum.Options = &descriptor.EnumOptions{} + } + if err := proto.SetExtension(enum.Options, extension, &value); err != nil { + panic(err) + } + } +} + +func TurnOffGoEnumPrefix(enum *descriptor.EnumDescriptorProto) { + SetBoolEnumOption(gogoproto.E_GoprotoEnumPrefix, false)(enum) +} + +func TurnOffGoEnumStringer(enum *descriptor.EnumDescriptorProto) { + SetBoolEnumOption(gogoproto.E_GoprotoEnumStringer, false)(enum) +} + +func TurnOnEnumStringer(enum *descriptor.EnumDescriptorProto) { + SetBoolEnumOption(gogoproto.E_EnumStringer, true)(enum) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/field.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/field.go new file mode 100644 index 00000000000..9c5e2263c10 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/field.go @@ -0,0 +1,83 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2015, The GoGo Authors. rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package vanity + +import ( + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/proto" + descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" +) + +func FieldHasBoolExtension(field *descriptor.FieldDescriptorProto, extension *proto.ExtensionDesc) bool { + if field.Options == nil { + return false + } + value, err := proto.GetExtension(field.Options, extension) + if err != nil { + return false + } + if value == nil { + return false + } + if value.(*bool) == nil { + return false + } + return true +} + +func SetBoolFieldOption(extension *proto.ExtensionDesc, value bool) func(field *descriptor.FieldDescriptorProto) { + return func(field *descriptor.FieldDescriptorProto) { + if FieldHasBoolExtension(field, extension) { + return + } + if field.Options == nil { + field.Options = &descriptor.FieldOptions{} + } + if err := proto.SetExtension(field.Options, extension, &value); err != nil { + panic(err) + } + } +} + +func TurnOffNullable(field *descriptor.FieldDescriptorProto) { + if field.IsRepeated() && !field.IsMessage() { + return + } + SetBoolFieldOption(gogoproto.E_Nullable, false)(field) +} + +func TurnOffNullableForNativeTypesWithoutDefaultsOnly(field *descriptor.FieldDescriptorProto) { + if field.IsRepeated() || field.IsMessage() { + return + } + if field.DefaultValue != nil { + return + } + SetBoolFieldOption(gogoproto.E_Nullable, false)(field) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/file.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/file.go new file mode 100644 index 00000000000..e7b56de1f7a --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/file.go @@ -0,0 +1,181 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2015, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package vanity + +import ( + "path/filepath" + + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/proto" + descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" +) + +func NotGoogleProtobufDescriptorProto(file *descriptor.FileDescriptorProto) bool { + // can not just check if file.GetName() == "google/protobuf/descriptor.proto" because we do not want to assume compile path + _, fileName := filepath.Split(file.GetName()) + return !(file.GetPackage() == "google.protobuf" && fileName == "descriptor.proto") +} + +func FilterFiles(files []*descriptor.FileDescriptorProto, f func(file *descriptor.FileDescriptorProto) bool) []*descriptor.FileDescriptorProto { + filtered := make([]*descriptor.FileDescriptorProto, 0, len(files)) + for i := range files { + if !f(files[i]) { + continue + } + filtered = append(filtered, files[i]) + } + return filtered +} + +func FileHasBoolExtension(file *descriptor.FileDescriptorProto, extension *proto.ExtensionDesc) bool { + if file.Options == nil { + return false + } + value, err := proto.GetExtension(file.Options, extension) + if err != nil { + return false + } + if value == nil { + return false + } + if value.(*bool) == nil { + return false + } + return true +} + +func SetBoolFileOption(extension *proto.ExtensionDesc, value bool) func(file *descriptor.FileDescriptorProto) { + return func(file *descriptor.FileDescriptorProto) { + if FileHasBoolExtension(file, extension) { + return + } + if file.Options == nil { + file.Options = &descriptor.FileOptions{} + } + if err := proto.SetExtension(file.Options, extension, &value); err != nil { + panic(err) + } + } +} + +func TurnOffGoGettersAll(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_GoprotoGettersAll, false)(file) +} + +func TurnOffGoEnumPrefixAll(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_GoprotoEnumPrefixAll, false)(file) +} + +func TurnOffGoStringerAll(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_GoprotoStringerAll, false)(file) +} + +func TurnOnVerboseEqualAll(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_VerboseEqualAll, true)(file) +} + +func TurnOnFaceAll(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_FaceAll, true)(file) +} + +func TurnOnGoStringAll(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_GostringAll, true)(file) +} + +func TurnOnPopulateAll(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_PopulateAll, true)(file) +} + +func TurnOnStringerAll(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_StringerAll, true)(file) +} + +func TurnOnEqualAll(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_EqualAll, true)(file) +} + +func TurnOnDescriptionAll(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_DescriptionAll, true)(file) +} + +func TurnOnTestGenAll(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_TestgenAll, true)(file) +} + +func TurnOnBenchGenAll(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_BenchgenAll, true)(file) +} + +func TurnOnMarshalerAll(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_MarshalerAll, true)(file) +} + +func TurnOnUnmarshalerAll(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_UnmarshalerAll, true)(file) +} + +func TurnOnStable_MarshalerAll(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_StableMarshalerAll, true)(file) +} + +func TurnOnSizerAll(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_SizerAll, true)(file) +} + +func TurnOffGoEnumStringerAll(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_GoprotoEnumStringerAll, false)(file) +} + +func TurnOnEnumStringerAll(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_EnumStringerAll, true)(file) +} + +func TurnOnUnsafeUnmarshalerAll(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_UnsafeUnmarshalerAll, true)(file) +} + +func TurnOnUnsafeMarshalerAll(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_UnsafeMarshalerAll, true)(file) +} + +func TurnOffGoExtensionsMapAll(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_GoprotoExtensionsMapAll, false)(file) +} + +func TurnOffGoUnrecognizedAll(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_GoprotoUnrecognizedAll, false)(file) +} + +func TurnOffGogoImport(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_GogoprotoImport, false)(file) +} + +func TurnOnCompareAll(file *descriptor.FileDescriptorProto) { + SetBoolFileOption(gogoproto.E_CompareAll, true)(file) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/foreach.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/foreach.go new file mode 100644 index 00000000000..888b6d04d59 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/foreach.go @@ -0,0 +1,125 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2015, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package vanity + +import descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" + +func ForEachFile(files []*descriptor.FileDescriptorProto, f func(file *descriptor.FileDescriptorProto)) { + for _, file := range files { + f(file) + } +} + +func OnlyProto2(files []*descriptor.FileDescriptorProto) []*descriptor.FileDescriptorProto { + outs := make([]*descriptor.FileDescriptorProto, 0, len(files)) + for i, file := range files { + if file.GetSyntax() == "proto3" { + continue + } + outs = append(outs, files[i]) + } + return outs +} + +func OnlyProto3(files []*descriptor.FileDescriptorProto) []*descriptor.FileDescriptorProto { + outs := make([]*descriptor.FileDescriptorProto, 0, len(files)) + for i, file := range files { + if file.GetSyntax() != "proto3" { + continue + } + outs = append(outs, files[i]) + } + return outs +} + +func ForEachMessageInFiles(files []*descriptor.FileDescriptorProto, f func(msg *descriptor.DescriptorProto)) { + for _, file := range files { + ForEachMessage(file.MessageType, f) + } +} + +func ForEachMessage(msgs []*descriptor.DescriptorProto, f func(msg *descriptor.DescriptorProto)) { + for _, msg := range msgs { + f(msg) + ForEachMessage(msg.NestedType, f) + } +} + +func ForEachFieldInFilesExcludingExtensions(files []*descriptor.FileDescriptorProto, f func(field *descriptor.FieldDescriptorProto)) { + for _, file := range files { + ForEachFieldExcludingExtensions(file.MessageType, f) + } +} + +func ForEachFieldInFiles(files []*descriptor.FileDescriptorProto, f func(field *descriptor.FieldDescriptorProto)) { + for _, file := range files { + for _, ext := range file.Extension { + f(ext) + } + ForEachField(file.MessageType, f) + } +} + +func ForEachFieldExcludingExtensions(msgs []*descriptor.DescriptorProto, f func(field *descriptor.FieldDescriptorProto)) { + for _, msg := range msgs { + for _, field := range msg.Field { + f(field) + } + ForEachField(msg.NestedType, f) + } +} + +func ForEachField(msgs []*descriptor.DescriptorProto, f func(field *descriptor.FieldDescriptorProto)) { + for _, msg := range msgs { + for _, field := range msg.Field { + f(field) + } + for _, ext := range msg.Extension { + f(ext) + } + ForEachField(msg.NestedType, f) + } +} + +func ForEachEnumInFiles(files []*descriptor.FileDescriptorProto, f func(enum *descriptor.EnumDescriptorProto)) { + for _, file := range files { + for _, enum := range file.EnumType { + f(enum) + } + } +} + +func ForEachEnum(msgs []*descriptor.DescriptorProto, f func(field *descriptor.EnumDescriptorProto)) { + for _, msg := range msgs { + for _, field := range msg.EnumType { + f(field) + } + ForEachEnum(msg.NestedType, f) + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/msg.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/msg.go new file mode 100644 index 00000000000..7ff2b9879e5 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/msg.go @@ -0,0 +1,142 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2015, The GoGo Authors. rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package vanity + +import ( + "github.com/gogo/protobuf/gogoproto" + "github.com/gogo/protobuf/proto" + descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" +) + +func MessageHasBoolExtension(msg *descriptor.DescriptorProto, extension *proto.ExtensionDesc) bool { + if msg.Options == nil { + return false + } + value, err := proto.GetExtension(msg.Options, extension) + if err != nil { + return false + } + if value == nil { + return false + } + if value.(*bool) == nil { + return false + } + return true +} + +func SetBoolMessageOption(extension *proto.ExtensionDesc, value bool) func(msg *descriptor.DescriptorProto) { + return func(msg *descriptor.DescriptorProto) { + if MessageHasBoolExtension(msg, extension) { + return + } + if msg.Options == nil { + msg.Options = &descriptor.MessageOptions{} + } + if err := proto.SetExtension(msg.Options, extension, &value); err != nil { + panic(err) + } + } +} + +func TurnOffGoGetters(msg *descriptor.DescriptorProto) { + SetBoolMessageOption(gogoproto.E_GoprotoGetters, false)(msg) +} + +func TurnOffGoStringer(msg *descriptor.DescriptorProto) { + SetBoolMessageOption(gogoproto.E_GoprotoStringer, false)(msg) +} + +func TurnOnVerboseEqual(msg *descriptor.DescriptorProto) { + SetBoolMessageOption(gogoproto.E_VerboseEqual, true)(msg) +} + +func TurnOnFace(msg *descriptor.DescriptorProto) { + SetBoolMessageOption(gogoproto.E_Face, true)(msg) +} + +func TurnOnGoString(msg *descriptor.DescriptorProto) { + SetBoolMessageOption(gogoproto.E_Face, true)(msg) +} + +func TurnOnPopulate(msg *descriptor.DescriptorProto) { + SetBoolMessageOption(gogoproto.E_Populate, true)(msg) +} + +func TurnOnStringer(msg *descriptor.DescriptorProto) { + SetBoolMessageOption(gogoproto.E_Stringer, true)(msg) +} + +func TurnOnEqual(msg *descriptor.DescriptorProto) { + SetBoolMessageOption(gogoproto.E_Equal, true)(msg) +} + +func TurnOnDescription(msg *descriptor.DescriptorProto) { + SetBoolMessageOption(gogoproto.E_Description, true)(msg) +} + +func TurnOnTestGen(msg *descriptor.DescriptorProto) { + SetBoolMessageOption(gogoproto.E_Testgen, true)(msg) +} + +func TurnOnBenchGen(msg *descriptor.DescriptorProto) { + SetBoolMessageOption(gogoproto.E_Benchgen, true)(msg) +} + +func TurnOnMarshaler(msg *descriptor.DescriptorProto) { + SetBoolMessageOption(gogoproto.E_Marshaler, true)(msg) +} + +func TurnOnUnmarshaler(msg *descriptor.DescriptorProto) { + SetBoolMessageOption(gogoproto.E_Unmarshaler, true)(msg) +} + +func TurnOnSizer(msg *descriptor.DescriptorProto) { + SetBoolMessageOption(gogoproto.E_Sizer, true)(msg) +} + +func TurnOnUnsafeUnmarshaler(msg *descriptor.DescriptorProto) { + SetBoolMessageOption(gogoproto.E_UnsafeUnmarshaler, true)(msg) +} + +func TurnOnUnsafeMarshaler(msg *descriptor.DescriptorProto) { + SetBoolMessageOption(gogoproto.E_UnsafeMarshaler, true)(msg) +} + +func TurnOffGoExtensionsMap(msg *descriptor.DescriptorProto) { + SetBoolMessageOption(gogoproto.E_GoprotoExtensionsMap, false)(msg) +} + +func TurnOffGoUnrecognized(msg *descriptor.DescriptorProto) { + SetBoolMessageOption(gogoproto.E_GoprotoUnrecognized, false)(msg) +} + +func TurnOnCompare(msg *descriptor.DescriptorProto) { + SetBoolMessageOption(gogoproto.E_Compare, true)(msg) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/doc.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/doc.go new file mode 100644 index 00000000000..56e54040790 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/doc.go @@ -0,0 +1 @@ +package test diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/gogovanity.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/gogovanity.pb.go new file mode 100644 index 00000000000..df03703780c --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/gogovanity.pb.go @@ -0,0 +1,408 @@ +// Code generated by protoc-gen-gogo. +// source: gogovanity.proto +// DO NOT EDIT! + +/* + Package vanity is a generated protocol buffer package. + + It is generated from these files: + gogovanity.proto + + It has these top-level messages: + B +*/ +package vanity + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type B struct { + String_ *string `protobuf:"bytes,1,opt,name=String" json:"String,omitempty"` + Int64 *int64 `protobuf:"varint,2,opt,name=Int64" json:"Int64,omitempty"` + Int32 *int32 `protobuf:"varint,3,opt,name=Int32,def=1234" json:"Int32,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *B) Reset() { *m = B{} } +func (m *B) String() string { return proto.CompactTextString(m) } +func (*B) ProtoMessage() {} +func (*B) Descriptor() ([]byte, []int) { return fileDescriptorGogovanity, []int{0} } + +const Default_B_Int32 int32 = 1234 + +func (m *B) GetString_() string { + if m != nil && m.String_ != nil { + return *m.String_ + } + return "" +} + +func (m *B) GetInt64() int64 { + if m != nil && m.Int64 != nil { + return *m.Int64 + } + return 0 +} + +func (m *B) GetInt32() int32 { + if m != nil && m.Int32 != nil { + return *m.Int32 + } + return Default_B_Int32 +} + +func init() { + proto.RegisterType((*B)(nil), "vanity.B") +} +func (m *B) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *B) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.String_ != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintGogovanity(dAtA, i, uint64(len(*m.String_))) + i += copy(dAtA[i:], *m.String_) + } + if m.Int64 != nil { + dAtA[i] = 0x10 + i++ + i = encodeVarintGogovanity(dAtA, i, uint64(*m.Int64)) + } + if m.Int32 != nil { + dAtA[i] = 0x18 + i++ + i = encodeVarintGogovanity(dAtA, i, uint64(*m.Int32)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeFixed64Gogovanity(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Gogovanity(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintGogovanity(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *B) Size() (n int) { + var l int + _ = l + if m.String_ != nil { + l = len(*m.String_) + n += 1 + l + sovGogovanity(uint64(l)) + } + if m.Int64 != nil { + n += 1 + sovGogovanity(uint64(*m.Int64)) + } + if m.Int32 != nil { + n += 1 + sovGogovanity(uint64(*m.Int32)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovGogovanity(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozGogovanity(x uint64) (n int) { + return sovGogovanity(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *B) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGogovanity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: B: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: B: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field String_", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGogovanity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGogovanity + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.String_ = &s + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Int64", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGogovanity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Int64 = &v + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Int32", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGogovanity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Int32 = &v + default: + iNdEx = preIndex + skippy, err := skipGogovanity(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGogovanity + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGogovanity(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGogovanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGogovanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGogovanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthGogovanity + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGogovanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipGogovanity(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthGogovanity = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGogovanity = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("gogovanity.proto", fileDescriptorGogovanity) } + +var fileDescriptorGogovanity = []byte{ + // 157 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x12, 0x48, 0xcf, 0x4f, 0xcf, + 0x2f, 0x4b, 0xcc, 0xcb, 0x2c, 0xa9, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0, + 0xa4, 0x74, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x41, 0x8a, 0xf4, + 0xc1, 0xd2, 0x49, 0xa5, 0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0xb4, 0x29, 0x05, 0x73, 0x31, + 0x3a, 0x09, 0xc9, 0x70, 0xb1, 0x05, 0x97, 0x14, 0x65, 0xe6, 0xa5, 0x4b, 0x30, 0x2a, 0x30, 0x6a, + 0x70, 0x3a, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x18, 0x04, 0x15, 0x13, 0x12, 0xe1, 0x62, 0xf5, 0xcc, + 0x2b, 0x31, 0x33, 0x91, 0x60, 0x52, 0x60, 0xd4, 0x60, 0x0e, 0x82, 0x70, 0x84, 0xa4, 0xc0, 0xa2, + 0xc6, 0x46, 0x12, 0xcc, 0x0a, 0x8c, 0x1a, 0xac, 0x56, 0x2c, 0x86, 0x46, 0xc6, 0x26, 0x41, 0x10, + 0x21, 0x27, 0x9e, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x11, + 0x10, 0x00, 0x00, 0xff, 0xff, 0x35, 0x73, 0x31, 0x4a, 0xac, 0x00, 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/proto3.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/proto3.pb.go new file mode 100644 index 00000000000..ffa3c4256c9 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/proto3.pb.go @@ -0,0 +1,320 @@ +// Code generated by protoc-gen-gogo. +// source: proto3.proto +// DO NOT EDIT! + +/* +Package vanity is a generated protocol buffer package. + +It is generated from these files: + proto3.proto + +It has these top-level messages: + Aproto3 +*/ +package vanity + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type Aproto3 struct { + B string `protobuf:"bytes,1,opt,name=B,proto3" json:"B,omitempty"` +} + +func (m *Aproto3) Reset() { *m = Aproto3{} } +func (m *Aproto3) String() string { return proto.CompactTextString(m) } +func (*Aproto3) ProtoMessage() {} +func (*Aproto3) Descriptor() ([]byte, []int) { return fileDescriptorProto3, []int{0} } + +func (m *Aproto3) GetB() string { + if m != nil { + return m.B + } + return "" +} + +func init() { + proto.RegisterType((*Aproto3)(nil), "vanity.Aproto3") +} +func (m *Aproto3) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Aproto3) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.B) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintProto3(dAtA, i, uint64(len(m.B))) + i += copy(dAtA[i:], m.B) + } + return i, nil +} + +func encodeFixed64Proto3(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Proto3(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintProto3(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *Aproto3) Size() (n int) { + var l int + _ = l + l = len(m.B) + if l > 0 { + n += 1 + l + sovProto3(uint64(l)) + } + return n +} + +func sovProto3(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozProto3(x uint64) (n int) { + return sovProto3(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Aproto3) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProto3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Aproto3: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Aproto3: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field B", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProto3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProto3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.B = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProto3(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthProto3 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipProto3(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowProto3 + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowProto3 + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowProto3 + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthProto3 + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowProto3 + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipProto3(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthProto3 = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowProto3 = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("proto3.proto", fileDescriptorProto3) } + +var fileDescriptorProto3 = []byte{ + // 82 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x28, 0xca, 0x2f, + 0xc9, 0x37, 0xd6, 0x03, 0x53, 0x42, 0x6c, 0x65, 0x89, 0x79, 0x99, 0x25, 0x95, 0x4a, 0xe2, 0x5c, + 0xec, 0x8e, 0x10, 0x09, 0x21, 0x1e, 0x2e, 0x46, 0x27, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, + 0x46, 0x27, 0x27, 0x9e, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, + 0x31, 0x89, 0x0d, 0xa2, 0x06, 0x10, 0x00, 0x00, 0xff, 0xff, 0x97, 0x18, 0x92, 0x84, 0x45, 0x00, + 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/vanity.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/vanity.pb.go new file mode 100644 index 00000000000..e0091465f29 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/vanity.pb.go @@ -0,0 +1,375 @@ +// Code generated by protoc-gen-gogo. +// source: vanity.proto +// DO NOT EDIT! + +/* + Package vanity is a generated protocol buffer package. + + It is generated from these files: + vanity.proto + + It has these top-level messages: + A +*/ +package vanity + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type A struct { + Strings *string `protobuf:"bytes,1,opt,name=Strings" json:"Strings,omitempty"` + Int *int64 `protobuf:"varint,2,req,name=Int" json:"Int,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *A) Reset() { *m = A{} } +func (m *A) String() string { return proto.CompactTextString(m) } +func (*A) ProtoMessage() {} +func (*A) Descriptor() ([]byte, []int) { return fileDescriptorVanity, []int{0} } + +func (m *A) GetStrings() string { + if m != nil && m.Strings != nil { + return *m.Strings + } + return "" +} + +func (m *A) GetInt() int64 { + if m != nil && m.Int != nil { + return *m.Int + } + return 0 +} + +func init() { + proto.RegisterType((*A)(nil), "vanity.A") +} +func (m *A) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *A) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Strings != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintVanity(dAtA, i, uint64(len(*m.Strings))) + i += copy(dAtA[i:], *m.Strings) + } + if m.Int == nil { + return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("Int") + } else { + dAtA[i] = 0x10 + i++ + i = encodeVarintVanity(dAtA, i, uint64(*m.Int)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeFixed64Vanity(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Vanity(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintVanity(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *A) Size() (n int) { + var l int + _ = l + if m.Strings != nil { + l = len(*m.Strings) + n += 1 + l + sovVanity(uint64(l)) + } + if m.Int != nil { + n += 1 + sovVanity(uint64(*m.Int)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovVanity(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozVanity(x uint64) (n int) { + return sovVanity(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *A) Unmarshal(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVanity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: A: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: A: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Strings", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVanity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthVanity + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.Strings = &s + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Int", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVanity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Int = &v + hasFields[0] |= uint64(0x00000001) + default: + iNdEx = preIndex + skippy, err := skipVanity(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVanity + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Int") + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipVanity(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthVanity + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipVanity(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthVanity = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowVanity = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("vanity.proto", fileDescriptorVanity) } + +var fileDescriptorVanity = []byte{ + // 97 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x4b, 0xcc, 0xcb, + 0x2c, 0xa9, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0, 0x94, 0xf4, 0xb9, 0x18, + 0x1d, 0x85, 0x24, 0xb8, 0xd8, 0x83, 0x4b, 0x8a, 0x32, 0xf3, 0xd2, 0x8b, 0x25, 0x18, 0x15, 0x18, + 0x35, 0x38, 0x83, 0x60, 0x5c, 0x21, 0x01, 0x2e, 0x66, 0xcf, 0xbc, 0x12, 0x09, 0x26, 0x05, 0x26, + 0x0d, 0xe6, 0x20, 0x10, 0xd3, 0x89, 0xe7, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, + 0x3c, 0x92, 0x63, 0x04, 0x04, 0x00, 0x00, 0xff, 0xff, 0x2f, 0x7a, 0xd7, 0x63, 0x55, 0x00, 0x00, + 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/gogovanity.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/gogovanity.pb.go new file mode 100644 index 00000000000..28aa729e326 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/gogovanity.pb.go @@ -0,0 +1,396 @@ +// Code generated by protoc-gen-gogo. +// source: gogovanity.proto +// DO NOT EDIT! + +/* + Package vanity is a generated protocol buffer package. + + It is generated from these files: + gogovanity.proto + + It has these top-level messages: + B +*/ +package vanity + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type B struct { + String_ *string `protobuf:"bytes,1,opt,name=String" json:"String,omitempty"` + Int64 int64 `protobuf:"varint,2,opt,name=Int64" json:"Int64"` + Int32 *int32 `protobuf:"varint,3,opt,name=Int32,def=1234" json:"Int32,omitempty"` +} + +func (m *B) Reset() { *m = B{} } +func (m *B) String() string { return proto.CompactTextString(m) } +func (*B) ProtoMessage() {} +func (*B) Descriptor() ([]byte, []int) { return fileDescriptorGogovanity, []int{0} } + +const Default_B_Int32 int32 = 1234 + +func (m *B) GetString_() string { + if m != nil && m.String_ != nil { + return *m.String_ + } + return "" +} + +func (m *B) GetInt64() int64 { + if m != nil { + return m.Int64 + } + return 0 +} + +func (m *B) GetInt32() int32 { + if m != nil && m.Int32 != nil { + return *m.Int32 + } + return Default_B_Int32 +} + +func init() { + proto.RegisterType((*B)(nil), "vanity.B") +} +func (m *B) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *B) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.String_ != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintGogovanity(dAtA, i, uint64(len(*m.String_))) + i += copy(dAtA[i:], *m.String_) + } + dAtA[i] = 0x10 + i++ + i = encodeVarintGogovanity(dAtA, i, uint64(m.Int64)) + if m.Int32 != nil { + dAtA[i] = 0x18 + i++ + i = encodeVarintGogovanity(dAtA, i, uint64(*m.Int32)) + } + return i, nil +} + +func encodeFixed64Gogovanity(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Gogovanity(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintGogovanity(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *B) Size() (n int) { + var l int + _ = l + if m.String_ != nil { + l = len(*m.String_) + n += 1 + l + sovGogovanity(uint64(l)) + } + n += 1 + sovGogovanity(uint64(m.Int64)) + if m.Int32 != nil { + n += 1 + sovGogovanity(uint64(*m.Int32)) + } + return n +} + +func sovGogovanity(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozGogovanity(x uint64) (n int) { + return sovGogovanity(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *B) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGogovanity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: B: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: B: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field String_", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGogovanity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGogovanity + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.String_ = &s + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Int64", wireType) + } + m.Int64 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGogovanity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Int64 |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Int32", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGogovanity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Int32 = &v + default: + iNdEx = preIndex + skippy, err := skipGogovanity(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGogovanity + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGogovanity(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGogovanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGogovanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGogovanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthGogovanity + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGogovanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipGogovanity(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthGogovanity = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGogovanity = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("gogovanity.proto", fileDescriptorGogovanity) } + +var fileDescriptorGogovanity = []byte{ + // 163 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x12, 0x48, 0xcf, 0x4f, 0xcf, + 0x2f, 0x4b, 0xcc, 0xcb, 0x2c, 0xa9, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0, + 0xa4, 0x74, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x41, 0x8a, 0xf4, + 0xc1, 0xd2, 0x49, 0xa5, 0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0xb4, 0x29, 0x45, 0x72, 0x31, + 0x3a, 0x09, 0xc9, 0x70, 0xb1, 0x05, 0x97, 0x14, 0x65, 0xe6, 0xa5, 0x4b, 0x30, 0x2a, 0x30, 0x6a, + 0x70, 0x3a, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x18, 0x04, 0x15, 0x13, 0x92, 0xe2, 0x62, 0xf5, 0xcc, + 0x2b, 0x31, 0x33, 0x91, 0x60, 0x52, 0x60, 0xd4, 0x60, 0x06, 0x4b, 0x32, 0x04, 0x41, 0x84, 0xa0, + 0x72, 0xc6, 0x46, 0x12, 0xcc, 0x0a, 0x8c, 0x1a, 0xac, 0x56, 0x2c, 0x86, 0x46, 0xc6, 0x26, 0x41, + 0x10, 0x21, 0x27, 0x81, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, + 0x71, 0xc2, 0x63, 0x39, 0x06, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfc, 0xde, 0x29, 0x72, 0xb6, + 0x00, 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/proto3.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/proto3.pb.go new file mode 100644 index 00000000000..66eaa8729c6 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/proto3.pb.go @@ -0,0 +1,320 @@ +// Code generated by protoc-gen-gogo. +// source: proto3.proto +// DO NOT EDIT! + +/* +Package vanity is a generated protocol buffer package. + +It is generated from these files: + proto3.proto + +It has these top-level messages: + Aproto3 +*/ +package vanity + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type Aproto3 struct { + B string `protobuf:"bytes,1,opt,name=B,proto3" json:"B,omitempty"` +} + +func (m *Aproto3) Reset() { *m = Aproto3{} } +func (m *Aproto3) String() string { return proto.CompactTextString(m) } +func (*Aproto3) ProtoMessage() {} +func (*Aproto3) Descriptor() ([]byte, []int) { return fileDescriptorProto3, []int{0} } + +func (m *Aproto3) GetB() string { + if m != nil { + return m.B + } + return "" +} + +func init() { + proto.RegisterType((*Aproto3)(nil), "vanity.Aproto3") +} +func (m *Aproto3) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Aproto3) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.B) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintProto3(dAtA, i, uint64(len(m.B))) + i += copy(dAtA[i:], m.B) + } + return i, nil +} + +func encodeFixed64Proto3(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Proto3(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintProto3(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *Aproto3) Size() (n int) { + var l int + _ = l + l = len(m.B) + if l > 0 { + n += 1 + l + sovProto3(uint64(l)) + } + return n +} + +func sovProto3(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozProto3(x uint64) (n int) { + return sovProto3(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Aproto3) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProto3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Aproto3: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Aproto3: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field B", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProto3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProto3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.B = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProto3(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthProto3 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipProto3(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowProto3 + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowProto3 + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowProto3 + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthProto3 + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowProto3 + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipProto3(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthProto3 = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowProto3 = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("proto3.proto", fileDescriptorProto3) } + +var fileDescriptorProto3 = []byte{ + // 87 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x28, 0xca, 0x2f, + 0xc9, 0x37, 0xd6, 0x03, 0x53, 0x42, 0x6c, 0x65, 0x89, 0x79, 0x99, 0x25, 0x95, 0x4a, 0xe2, 0x5c, + 0xec, 0x8e, 0x10, 0x09, 0x21, 0x1e, 0x2e, 0x46, 0x27, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, + 0x46, 0x27, 0x27, 0x81, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, + 0x71, 0xc2, 0x63, 0x39, 0x86, 0x24, 0x36, 0x88, 0x3a, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x77, + 0x21, 0xa3, 0xc0, 0x49, 0x00, 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/vanity.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/vanity.pb.go new file mode 100644 index 00000000000..ecba7f08dfc --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/vanity.pb.go @@ -0,0 +1,354 @@ +// Code generated by protoc-gen-gogo. +// source: vanity.proto +// DO NOT EDIT! + +/* + Package vanity is a generated protocol buffer package. + + It is generated from these files: + vanity.proto + + It has these top-level messages: + A +*/ +package vanity + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import io "io" +import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type A struct { + Strings string `protobuf:"bytes,1,opt,name=Strings" json:"Strings"` + Int int64 `protobuf:"varint,2,req,name=Int" json:"Int"` +} + +func (m *A) Reset() { *m = A{} } +func (m *A) String() string { return proto.CompactTextString(m) } +func (*A) ProtoMessage() {} +func (*A) Descriptor() ([]byte, []int) { return fileDescriptorVanity, []int{0} } + +func (m *A) GetStrings() string { + if m != nil { + return m.Strings + } + return "" +} + +func (m *A) GetInt() int64 { + if m != nil { + return m.Int + } + return 0 +} + +func init() { + proto.RegisterType((*A)(nil), "vanity.A") +} +func (m *A) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *A) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintVanity(dAtA, i, uint64(len(m.Strings))) + i += copy(dAtA[i:], m.Strings) + dAtA[i] = 0x10 + i++ + i = encodeVarintVanity(dAtA, i, uint64(m.Int)) + return i, nil +} + +func encodeFixed64Vanity(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Vanity(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintVanity(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *A) Size() (n int) { + var l int + _ = l + l = len(m.Strings) + n += 1 + l + sovVanity(uint64(l)) + n += 1 + sovVanity(uint64(m.Int)) + return n +} + +func sovVanity(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozVanity(x uint64) (n int) { + return sovVanity(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *A) Unmarshal(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVanity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: A: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: A: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Strings", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVanity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthVanity + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Strings = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Int", wireType) + } + m.Int = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVanity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Int |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + hasFields[0] |= uint64(0x00000001) + default: + iNdEx = preIndex + skippy, err := skipVanity(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVanity + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Int") + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipVanity(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthVanity + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipVanity(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthVanity = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowVanity = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("vanity.proto", fileDescriptorVanity) } + +var fileDescriptorVanity = []byte{ + // 109 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x4b, 0xcc, 0xcb, + 0x2c, 0xa9, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0, 0x94, 0xac, 0xb9, 0x18, + 0x1d, 0x85, 0xe4, 0xb8, 0xd8, 0x83, 0x4b, 0x8a, 0x32, 0xf3, 0xd2, 0x8b, 0x25, 0x18, 0x15, 0x18, + 0x35, 0x38, 0x9d, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, 0x82, 0x09, 0x0a, 0x89, 0x71, 0x31, 0x7b, + 0xe6, 0x95, 0x48, 0x30, 0x29, 0x30, 0x69, 0x30, 0x43, 0xe5, 0x40, 0x02, 0x4e, 0x02, 0x27, 0x1e, + 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x80, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x56, 0x0d, 0x52, 0xbb, 0x65, 0x00, 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/gogovanity.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/gogovanity.proto new file mode 100644 index 00000000000..b0f9279a170 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/gogovanity.proto @@ -0,0 +1,39 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2015, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +syntax = "proto2"; + +package vanity; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +message B { + optional string String = 1 [(gogoproto.nullable) = true]; + optional int64 Int64 = 2; + optional int32 Int32 = 3 [default = 1234]; +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/proto3.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/proto3.proto new file mode 100644 index 00000000000..aa2f4ac516e --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/proto3.proto @@ -0,0 +1,35 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2015, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +syntax = "proto3"; + +package vanity; + +message Aproto3 { + string B = 1; +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/gogovanity.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/gogovanity.pb.go new file mode 100644 index 00000000000..28dbceb19ed --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/gogovanity.pb.go @@ -0,0 +1,512 @@ +// Code generated by protoc-gen-gogo. +// source: gogovanity.proto +// DO NOT EDIT! + +/* + Package vanity is a generated protocol buffer package. + + It is generated from these files: + gogovanity.proto + + It has these top-level messages: + B +*/ +package vanity + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" + +import strings "strings" +import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" +import sort "sort" +import strconv "strconv" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type B struct { + String_ *string `protobuf:"bytes,1,opt,name=String" json:"String,omitempty"` + Int64 int64 `protobuf:"varint,2,opt,name=Int64" json:"Int64"` + Int32 *int32 `protobuf:"varint,3,opt,name=Int32,def=1234" json:"Int32,omitempty"` +} + +func (m *B) Reset() { *m = B{} } +func (*B) ProtoMessage() {} +func (*B) Descriptor() ([]byte, []int) { return fileDescriptorGogovanity, []int{0} } + +const Default_B_Int32 int32 = 1234 + +func (m *B) GetString_() string { + if m != nil && m.String_ != nil { + return *m.String_ + } + return "" +} + +func (m *B) GetInt64() int64 { + if m != nil { + return m.Int64 + } + return 0 +} + +func (m *B) GetInt32() int32 { + if m != nil && m.Int32 != nil { + return *m.Int32 + } + return Default_B_Int32 +} + +func init() { + proto.RegisterType((*B)(nil), "vanity.B") +} +func (this *B) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*B) + if !ok { + that2, ok := that.(B) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if this.String_ != nil && that1.String_ != nil { + if *this.String_ != *that1.String_ { + return false + } + } else if this.String_ != nil { + return false + } else if that1.String_ != nil { + return false + } + if this.Int64 != that1.Int64 { + return false + } + if this.Int32 != nil && that1.Int32 != nil { + if *this.Int32 != *that1.Int32 { + return false + } + } else if this.Int32 != nil { + return false + } else if that1.Int32 != nil { + return false + } + return true +} +func (this *B) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 7) + s = append(s, "&vanity.B{") + if this.String_ != nil { + s = append(s, "String_: "+valueToGoStringGogovanity(this.String_, "string")+",\n") + } + s = append(s, "Int64: "+fmt.Sprintf("%#v", this.Int64)+",\n") + if this.Int32 != nil { + s = append(s, "Int32: "+valueToGoStringGogovanity(this.Int32, "int32")+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringGogovanity(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func extensionToGoStringGogovanity(m github_com_gogo_protobuf_proto.Message) string { + e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) + if e == nil { + return "nil" + } + s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" + keys := make([]int, 0, len(e)) + for k := range e { + keys = append(keys, int(k)) + } + sort.Ints(keys) + ss := []string{} + for _, k := range keys { + ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) + } + s += strings.Join(ss, ",") + "})" + return s +} +func (m *B) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *B) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.String_ != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintGogovanity(dAtA, i, uint64(len(*m.String_))) + i += copy(dAtA[i:], *m.String_) + } + dAtA[i] = 0x10 + i++ + i = encodeVarintGogovanity(dAtA, i, uint64(m.Int64)) + if m.Int32 != nil { + dAtA[i] = 0x18 + i++ + i = encodeVarintGogovanity(dAtA, i, uint64(*m.Int32)) + } + return i, nil +} + +func encodeFixed64Gogovanity(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Gogovanity(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintGogovanity(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *B) Size() (n int) { + var l int + _ = l + if m.String_ != nil { + l = len(*m.String_) + n += 1 + l + sovGogovanity(uint64(l)) + } + n += 1 + sovGogovanity(uint64(m.Int64)) + if m.Int32 != nil { + n += 1 + sovGogovanity(uint64(*m.Int32)) + } + return n +} + +func sovGogovanity(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozGogovanity(x uint64) (n int) { + return sovGogovanity(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *B) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&B{`, + `String_:` + valueToStringGogovanity(this.String_) + `,`, + `Int64:` + fmt.Sprintf("%v", this.Int64) + `,`, + `Int32:` + valueToStringGogovanity(this.Int32) + `,`, + `}`, + }, "") + return s +} +func valueToStringGogovanity(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *B) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGogovanity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: B: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: B: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field String_", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGogovanity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGogovanity + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.String_ = &s + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Int64", wireType) + } + m.Int64 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGogovanity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Int64 |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Int32", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGogovanity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Int32 = &v + default: + iNdEx = preIndex + skippy, err := skipGogovanity(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGogovanity + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGogovanity(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGogovanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGogovanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGogovanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthGogovanity + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGogovanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipGogovanity(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthGogovanity = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGogovanity = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("gogovanity.proto", fileDescriptorGogovanity) } + +var fileDescriptorGogovanity = []byte{ + // 192 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x12, 0x48, 0xcf, 0x4f, 0xcf, + 0x2f, 0x4b, 0xcc, 0xcb, 0x2c, 0xa9, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0, + 0xa4, 0x74, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x41, 0x8a, 0xf4, + 0xc1, 0xd2, 0x49, 0xa5, 0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0xb4, 0x29, 0x45, 0x72, 0x31, + 0x3a, 0x09, 0xc9, 0x70, 0xb1, 0x05, 0x97, 0x14, 0x65, 0xe6, 0xa5, 0x4b, 0x30, 0x2a, 0x30, 0x6a, + 0x70, 0x3a, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x18, 0x04, 0x15, 0x13, 0x92, 0xe2, 0x62, 0xf5, 0xcc, + 0x2b, 0x31, 0x33, 0x91, 0x60, 0x52, 0x60, 0xd4, 0x60, 0x06, 0x4b, 0x32, 0x04, 0x41, 0x84, 0xa0, + 0x72, 0xc6, 0x46, 0x12, 0xcc, 0x0a, 0x8c, 0x1a, 0xac, 0x56, 0x2c, 0x86, 0x46, 0xc6, 0x26, 0x41, + 0x10, 0x21, 0x27, 0x9d, 0x0b, 0x0f, 0xe5, 0x18, 0x6e, 0x3c, 0x94, 0x63, 0xf8, 0xf0, 0x50, 0x8e, + 0xb1, 0xe1, 0x91, 0x1c, 0xe3, 0x8a, 0x47, 0x72, 0x8c, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, + 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8b, 0x47, 0x72, 0x0c, 0x1f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, + 0x2c, 0xc7, 0x00, 0x08, 0x00, 0x00, 0xff, 0xff, 0x0a, 0x7e, 0xee, 0xf2, 0xd2, 0x00, 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/proto3.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/proto3.pb.go new file mode 100644 index 00000000000..5ce2132bcd7 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/proto3.pb.go @@ -0,0 +1,411 @@ +// Code generated by protoc-gen-gogo. +// source: proto3.proto +// DO NOT EDIT! + +/* +Package vanity is a generated protocol buffer package. + +It is generated from these files: + proto3.proto + +It has these top-level messages: + Aproto3 +*/ +package vanity + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import strings "strings" +import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" +import sort "sort" +import strconv "strconv" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type Aproto3 struct { + B string `protobuf:"bytes,1,opt,name=B,proto3" json:"B,omitempty"` +} + +func (m *Aproto3) Reset() { *m = Aproto3{} } +func (*Aproto3) ProtoMessage() {} +func (*Aproto3) Descriptor() ([]byte, []int) { return fileDescriptorProto3, []int{0} } + +func (m *Aproto3) GetB() string { + if m != nil { + return m.B + } + return "" +} + +func init() { + proto.RegisterType((*Aproto3)(nil), "vanity.Aproto3") +} +func (this *Aproto3) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*Aproto3) + if !ok { + that2, ok := that.(Aproto3) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if this.B != that1.B { + return false + } + return true +} +func (this *Aproto3) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&vanity.Aproto3{") + s = append(s, "B: "+fmt.Sprintf("%#v", this.B)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringProto3(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func extensionToGoStringProto3(m github_com_gogo_protobuf_proto.Message) string { + e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) + if e == nil { + return "nil" + } + s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" + keys := make([]int, 0, len(e)) + for k := range e { + keys = append(keys, int(k)) + } + sort.Ints(keys) + ss := []string{} + for _, k := range keys { + ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) + } + s += strings.Join(ss, ",") + "})" + return s +} +func (m *Aproto3) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Aproto3) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.B) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintProto3(dAtA, i, uint64(len(m.B))) + i += copy(dAtA[i:], m.B) + } + return i, nil +} + +func encodeFixed64Proto3(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Proto3(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintProto3(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *Aproto3) Size() (n int) { + var l int + _ = l + l = len(m.B) + if l > 0 { + n += 1 + l + sovProto3(uint64(l)) + } + return n +} + +func sovProto3(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozProto3(x uint64) (n int) { + return sovProto3(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Aproto3) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Aproto3{`, + `B:` + fmt.Sprintf("%v", this.B) + `,`, + `}`, + }, "") + return s +} +func valueToStringProto3(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Aproto3) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProto3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Aproto3: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Aproto3: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field B", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProto3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProto3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.B = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProto3(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthProto3 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipProto3(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowProto3 + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowProto3 + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowProto3 + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthProto3 + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowProto3 + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipProto3(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthProto3 = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowProto3 = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("proto3.proto", fileDescriptorProto3) } + +var fileDescriptorProto3 = []byte{ + // 116 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x28, 0xca, 0x2f, + 0xc9, 0x37, 0xd6, 0x03, 0x53, 0x42, 0x6c, 0x65, 0x89, 0x79, 0x99, 0x25, 0x95, 0x4a, 0xe2, 0x5c, + 0xec, 0x8e, 0x10, 0x09, 0x21, 0x1e, 0x2e, 0x46, 0x27, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, + 0x46, 0x27, 0x27, 0x9d, 0x0b, 0x0f, 0xe5, 0x18, 0x6e, 0x3c, 0x94, 0x63, 0xf8, 0xf0, 0x50, 0x8e, + 0xb1, 0xe1, 0x91, 0x1c, 0xe3, 0x8a, 0x47, 0x72, 0x8c, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, + 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8b, 0x47, 0x72, 0x0c, 0x1f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, + 0x2c, 0xc7, 0x90, 0xc4, 0x06, 0x31, 0x03, 0x10, 0x00, 0x00, 0xff, 0xff, 0xb1, 0xa0, 0x15, 0x6b, + 0x65, 0x00, 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/vanity.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/vanity.pb.go new file mode 100644 index 00000000000..e7f5599d46b --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/vanity.pb.go @@ -0,0 +1,449 @@ +// Code generated by protoc-gen-gogo. +// source: vanity.proto +// DO NOT EDIT! + +/* + Package vanity is a generated protocol buffer package. + + It is generated from these files: + vanity.proto + + It has these top-level messages: + A +*/ +package vanity + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import strings "strings" +import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" +import sort "sort" +import strconv "strconv" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type A struct { + Strings string `protobuf:"bytes,1,opt,name=Strings" json:"Strings"` + Int int64 `protobuf:"varint,2,req,name=Int" json:"Int"` +} + +func (m *A) Reset() { *m = A{} } +func (*A) ProtoMessage() {} +func (*A) Descriptor() ([]byte, []int) { return fileDescriptorVanity, []int{0} } + +func (m *A) GetStrings() string { + if m != nil { + return m.Strings + } + return "" +} + +func (m *A) GetInt() int64 { + if m != nil { + return m.Int + } + return 0 +} + +func init() { + proto.RegisterType((*A)(nil), "vanity.A") +} +func (this *A) Equal(that interface{}) bool { + if that == nil { + if this == nil { + return true + } + return false + } + + that1, ok := that.(*A) + if !ok { + that2, ok := that.(A) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + if this == nil { + return true + } + return false + } else if this == nil { + return false + } + if this.Strings != that1.Strings { + return false + } + if this.Int != that1.Int { + return false + } + return true +} +func (this *A) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&vanity.A{") + s = append(s, "Strings: "+fmt.Sprintf("%#v", this.Strings)+",\n") + s = append(s, "Int: "+fmt.Sprintf("%#v", this.Int)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringVanity(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func extensionToGoStringVanity(m github_com_gogo_protobuf_proto.Message) string { + e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) + if e == nil { + return "nil" + } + s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" + keys := make([]int, 0, len(e)) + for k := range e { + keys = append(keys, int(k)) + } + sort.Ints(keys) + ss := []string{} + for _, k := range keys { + ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) + } + s += strings.Join(ss, ",") + "})" + return s +} +func (m *A) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *A) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintVanity(dAtA, i, uint64(len(m.Strings))) + i += copy(dAtA[i:], m.Strings) + dAtA[i] = 0x10 + i++ + i = encodeVarintVanity(dAtA, i, uint64(m.Int)) + return i, nil +} + +func encodeFixed64Vanity(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Vanity(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintVanity(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *A) Size() (n int) { + var l int + _ = l + l = len(m.Strings) + n += 1 + l + sovVanity(uint64(l)) + n += 1 + sovVanity(uint64(m.Int)) + return n +} + +func sovVanity(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozVanity(x uint64) (n int) { + return sovVanity(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *A) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&A{`, + `Strings:` + fmt.Sprintf("%v", this.Strings) + `,`, + `Int:` + fmt.Sprintf("%v", this.Int) + `,`, + `}`, + }, "") + return s +} +func valueToStringVanity(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *A) Unmarshal(dAtA []byte) error { + var hasFields [1]uint64 + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVanity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: A: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: A: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Strings", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVanity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthVanity + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Strings = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Int", wireType) + } + m.Int = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVanity + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Int |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + hasFields[0] |= uint64(0x00000001) + default: + iNdEx = preIndex + skippy, err := skipVanity(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVanity + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + if hasFields[0]&uint64(0x00000001) == 0 { + return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Int") + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipVanity(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthVanity + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVanity + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipVanity(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthVanity = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowVanity = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("vanity.proto", fileDescriptorVanity) } + +var fileDescriptorVanity = []byte{ + // 138 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x4b, 0xcc, 0xcb, + 0x2c, 0xa9, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0, 0x94, 0xac, 0xb9, 0x18, + 0x1d, 0x85, 0xe4, 0xb8, 0xd8, 0x83, 0x4b, 0x8a, 0x32, 0xf3, 0xd2, 0x8b, 0x25, 0x18, 0x15, 0x18, + 0x35, 0x38, 0x9d, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, 0x82, 0x09, 0x0a, 0x89, 0x71, 0x31, 0x7b, + 0xe6, 0x95, 0x48, 0x30, 0x29, 0x30, 0x69, 0x30, 0x43, 0xe5, 0x40, 0x02, 0x4e, 0x3a, 0x17, 0x1e, + 0xca, 0x31, 0xdc, 0x78, 0x28, 0xc7, 0xf0, 0xe1, 0xa1, 0x1c, 0x63, 0xc3, 0x23, 0x39, 0xc6, 0x15, + 0x8f, 0xe4, 0x18, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, + 0x17, 0x8f, 0xe4, 0x18, 0x3e, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0x01, 0x10, 0x00, 0x00, + 0xff, 0xff, 0x4d, 0xd9, 0xba, 0x18, 0x81, 0x00, 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/vanity.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/vanity.proto new file mode 100644 index 00000000000..c21750bc09f --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/vanity.proto @@ -0,0 +1,36 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2015, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +syntax = "proto2"; + +package vanity; + +message A { + optional string Strings = 1; + required int64 Int = 2; +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/version/version.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/version/version.go new file mode 100644 index 00000000000..461e9903228 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/version/version.go @@ -0,0 +1,78 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// 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. +// +// 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. + +package version + +import ( + "fmt" + "os/exec" + "strconv" + "strings" +) + +func Get() string { + versionBytes, _ := exec.Command("protoc", "--version").CombinedOutput() + version := strings.TrimSpace(string(versionBytes)) + versions := strings.Split(version, " ") + if len(versions) != 2 { + panic("version string returned from protoc is seperated with a space: " + version) + } + return versions[1] +} + +func parseVersion(version string) (int, error) { + versions := strings.Split(version, ".") + if len(versions) != 3 { + return 0, fmt.Errorf("version does not have 3 numbers seperated by dots: %s", version) + } + n := 0 + for _, v := range versions { + i, err := strconv.Atoi(v) + if err != nil { + return 0, err + } + n = n*10 + i + } + return n, nil +} + +func less(this, that string) bool { + thisNum, err := parseVersion(this) + if err != nil { + panic(err) + } + thatNum, err := parseVersion(that) + if err != nil { + panic(err) + } + return thisNum <= thatNum +} + +func AtLeast(v string) bool { + return less(v, Get()) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/LICENSE b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/LICENSE new file mode 100644 index 00000000000..1b1b1921efa --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/LICENSE @@ -0,0 +1,31 @@ +Go support for Protocol Buffers - Google's data interchange format + +Copyright 2010 The Go Authors. All rights reserved. +https://github.com/golang/protobuf + +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/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/clone.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/clone.go new file mode 100644 index 00000000000..e392575b353 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/clone.go @@ -0,0 +1,229 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2011 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +// Protocol buffer deep copy and merge. +// TODO: RawMessage. + +package proto + +import ( + "log" + "reflect" + "strings" +) + +// Clone returns a deep copy of a protocol buffer. +func Clone(pb Message) Message { + in := reflect.ValueOf(pb) + if in.IsNil() { + return pb + } + + out := reflect.New(in.Type().Elem()) + // out is empty so a merge is a deep copy. + mergeStruct(out.Elem(), in.Elem()) + return out.Interface().(Message) +} + +// Merge merges src into dst. +// Required and optional fields that are set in src will be set to that value in dst. +// Elements of repeated fields will be appended. +// Merge panics if src and dst are not the same type, or if dst is nil. +func Merge(dst, src Message) { + in := reflect.ValueOf(src) + out := reflect.ValueOf(dst) + if out.IsNil() { + panic("proto: nil destination") + } + if in.Type() != out.Type() { + // Explicit test prior to mergeStruct so that mistyped nils will fail + panic("proto: type mismatch") + } + if in.IsNil() { + // Merging nil into non-nil is a quiet no-op + return + } + mergeStruct(out.Elem(), in.Elem()) +} + +func mergeStruct(out, in reflect.Value) { + sprop := GetProperties(in.Type()) + for i := 0; i < in.NumField(); i++ { + f := in.Type().Field(i) + if strings.HasPrefix(f.Name, "XXX_") { + continue + } + mergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i]) + } + + if emIn, ok := extendable(in.Addr().Interface()); ok { + emOut, _ := extendable(out.Addr().Interface()) + mIn, muIn := emIn.extensionsRead() + if mIn != nil { + mOut := emOut.extensionsWrite() + muIn.Lock() + mergeExtension(mOut, mIn) + muIn.Unlock() + } + } + + uf := in.FieldByName("XXX_unrecognized") + if !uf.IsValid() { + return + } + uin := uf.Bytes() + if len(uin) > 0 { + out.FieldByName("XXX_unrecognized").SetBytes(append([]byte(nil), uin...)) + } +} + +// mergeAny performs a merge between two values of the same type. +// viaPtr indicates whether the values were indirected through a pointer (implying proto2). +// prop is set if this is a struct field (it may be nil). +func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) { + if in.Type() == protoMessageType { + if !in.IsNil() { + if out.IsNil() { + out.Set(reflect.ValueOf(Clone(in.Interface().(Message)))) + } else { + Merge(out.Interface().(Message), in.Interface().(Message)) + } + } + return + } + switch in.Kind() { + case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, + reflect.String, reflect.Uint32, reflect.Uint64: + if !viaPtr && isProto3Zero(in) { + return + } + out.Set(in) + case reflect.Interface: + // Probably a oneof field; copy non-nil values. + if in.IsNil() { + return + } + // Allocate destination if it is not set, or set to a different type. + // Otherwise we will merge as normal. + if out.IsNil() || out.Elem().Type() != in.Elem().Type() { + out.Set(reflect.New(in.Elem().Elem().Type())) // interface -> *T -> T -> new(T) + } + mergeAny(out.Elem(), in.Elem(), false, nil) + case reflect.Map: + if in.Len() == 0 { + return + } + if out.IsNil() { + out.Set(reflect.MakeMap(in.Type())) + } + // For maps with value types of *T or []byte we need to deep copy each value. + elemKind := in.Type().Elem().Kind() + for _, key := range in.MapKeys() { + var val reflect.Value + switch elemKind { + case reflect.Ptr: + val = reflect.New(in.Type().Elem().Elem()) + mergeAny(val, in.MapIndex(key), false, nil) + case reflect.Slice: + val = in.MapIndex(key) + val = reflect.ValueOf(append([]byte{}, val.Bytes()...)) + default: + val = in.MapIndex(key) + } + out.SetMapIndex(key, val) + } + case reflect.Ptr: + if in.IsNil() { + return + } + if out.IsNil() { + out.Set(reflect.New(in.Elem().Type())) + } + mergeAny(out.Elem(), in.Elem(), true, nil) + case reflect.Slice: + if in.IsNil() { + return + } + if in.Type().Elem().Kind() == reflect.Uint8 { + // []byte is a scalar bytes field, not a repeated field. + + // Edge case: if this is in a proto3 message, a zero length + // bytes field is considered the zero value, and should not + // be merged. + if prop != nil && prop.proto3 && in.Len() == 0 { + return + } + + // Make a deep copy. + // Append to []byte{} instead of []byte(nil) so that we never end up + // with a nil result. + out.SetBytes(append([]byte{}, in.Bytes()...)) + return + } + n := in.Len() + if out.IsNil() { + out.Set(reflect.MakeSlice(in.Type(), 0, n)) + } + switch in.Type().Elem().Kind() { + case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, + reflect.String, reflect.Uint32, reflect.Uint64: + out.Set(reflect.AppendSlice(out, in)) + default: + for i := 0; i < n; i++ { + x := reflect.Indirect(reflect.New(in.Type().Elem())) + mergeAny(x, in.Index(i), false, nil) + out.Set(reflect.Append(out, x)) + } + } + case reflect.Struct: + mergeStruct(out, in) + default: + // unknown type, so not a protocol buffer + log.Printf("proto: don't know how to copy %v", in) + } +} + +func mergeExtension(out, in map[int32]Extension) { + for extNum, eIn := range in { + eOut := Extension{desc: eIn.desc} + if eIn.value != nil { + v := reflect.New(reflect.TypeOf(eIn.value)).Elem() + mergeAny(v, reflect.ValueOf(eIn.value), false, nil) + eOut.value = v.Interface() + } + if eIn.enc != nil { + eOut.enc = make([]byte, len(eIn.enc)) + copy(eOut.enc, eIn.enc) + } + + out[extNum] = eOut + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/decode.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/decode.go new file mode 100644 index 00000000000..aa207298f99 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/decode.go @@ -0,0 +1,970 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +package proto + +/* + * Routines for decoding protocol buffer data to construct in-memory representations. + */ + +import ( + "errors" + "fmt" + "io" + "os" + "reflect" +) + +// errOverflow is returned when an integer is too large to be represented. +var errOverflow = errors.New("proto: integer overflow") + +// ErrInternalBadWireType is returned by generated code when an incorrect +// wire type is encountered. It does not get returned to user code. +var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof") + +// The fundamental decoders that interpret bytes on the wire. +// Those that take integer types all return uint64 and are +// therefore of type valueDecoder. + +// DecodeVarint reads a varint-encoded integer from the slice. +// It returns the integer and the number of bytes consumed, or +// zero if there is not enough. +// This is the format for the +// int32, int64, uint32, uint64, bool, and enum +// protocol buffer types. +func DecodeVarint(buf []byte) (x uint64, n int) { + for shift := uint(0); shift < 64; shift += 7 { + if n >= len(buf) { + return 0, 0 + } + b := uint64(buf[n]) + n++ + x |= (b & 0x7F) << shift + if (b & 0x80) == 0 { + return x, n + } + } + + // The number is too large to represent in a 64-bit value. + return 0, 0 +} + +func (p *Buffer) decodeVarintSlow() (x uint64, err error) { + i := p.index + l := len(p.buf) + + for shift := uint(0); shift < 64; shift += 7 { + if i >= l { + err = io.ErrUnexpectedEOF + return + } + b := p.buf[i] + i++ + x |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + p.index = i + return + } + } + + // The number is too large to represent in a 64-bit value. + err = errOverflow + return +} + +// DecodeVarint reads a varint-encoded integer from the Buffer. +// This is the format for the +// int32, int64, uint32, uint64, bool, and enum +// protocol buffer types. +func (p *Buffer) DecodeVarint() (x uint64, err error) { + i := p.index + buf := p.buf + + if i >= len(buf) { + return 0, io.ErrUnexpectedEOF + } else if buf[i] < 0x80 { + p.index++ + return uint64(buf[i]), nil + } else if len(buf)-i < 10 { + return p.decodeVarintSlow() + } + + var b uint64 + // we already checked the first byte + x = uint64(buf[i]) - 0x80 + i++ + + b = uint64(buf[i]) + i++ + x += b << 7 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 7 + + b = uint64(buf[i]) + i++ + x += b << 14 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 14 + + b = uint64(buf[i]) + i++ + x += b << 21 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 21 + + b = uint64(buf[i]) + i++ + x += b << 28 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 28 + + b = uint64(buf[i]) + i++ + x += b << 35 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 35 + + b = uint64(buf[i]) + i++ + x += b << 42 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 42 + + b = uint64(buf[i]) + i++ + x += b << 49 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 49 + + b = uint64(buf[i]) + i++ + x += b << 56 + if b&0x80 == 0 { + goto done + } + x -= 0x80 << 56 + + b = uint64(buf[i]) + i++ + x += b << 63 + if b&0x80 == 0 { + goto done + } + // x -= 0x80 << 63 // Always zero. + + return 0, errOverflow + +done: + p.index = i + return x, nil +} + +// DecodeFixed64 reads a 64-bit integer from the Buffer. +// This is the format for the +// fixed64, sfixed64, and double protocol buffer types. +func (p *Buffer) DecodeFixed64() (x uint64, err error) { + // x, err already 0 + i := p.index + 8 + if i < 0 || i > len(p.buf) { + err = io.ErrUnexpectedEOF + return + } + p.index = i + + x = uint64(p.buf[i-8]) + x |= uint64(p.buf[i-7]) << 8 + x |= uint64(p.buf[i-6]) << 16 + x |= uint64(p.buf[i-5]) << 24 + x |= uint64(p.buf[i-4]) << 32 + x |= uint64(p.buf[i-3]) << 40 + x |= uint64(p.buf[i-2]) << 48 + x |= uint64(p.buf[i-1]) << 56 + return +} + +// DecodeFixed32 reads a 32-bit integer from the Buffer. +// This is the format for the +// fixed32, sfixed32, and float protocol buffer types. +func (p *Buffer) DecodeFixed32() (x uint64, err error) { + // x, err already 0 + i := p.index + 4 + if i < 0 || i > len(p.buf) { + err = io.ErrUnexpectedEOF + return + } + p.index = i + + x = uint64(p.buf[i-4]) + x |= uint64(p.buf[i-3]) << 8 + x |= uint64(p.buf[i-2]) << 16 + x |= uint64(p.buf[i-1]) << 24 + return +} + +// DecodeZigzag64 reads a zigzag-encoded 64-bit integer +// from the Buffer. +// This is the format used for the sint64 protocol buffer type. +func (p *Buffer) DecodeZigzag64() (x uint64, err error) { + x, err = p.DecodeVarint() + if err != nil { + return + } + x = (x >> 1) ^ uint64((int64(x&1)<<63)>>63) + return +} + +// DecodeZigzag32 reads a zigzag-encoded 32-bit integer +// from the Buffer. +// This is the format used for the sint32 protocol buffer type. +func (p *Buffer) DecodeZigzag32() (x uint64, err error) { + x, err = p.DecodeVarint() + if err != nil { + return + } + x = uint64((uint32(x) >> 1) ^ uint32((int32(x&1)<<31)>>31)) + return +} + +// These are not ValueDecoders: they produce an array of bytes or a string. +// bytes, embedded messages + +// DecodeRawBytes reads a count-delimited byte buffer from the Buffer. +// This is the format used for the bytes protocol buffer +// type and for embedded messages. +func (p *Buffer) DecodeRawBytes(alloc bool) (buf []byte, err error) { + n, err := p.DecodeVarint() + if err != nil { + return nil, err + } + + nb := int(n) + if nb < 0 { + return nil, fmt.Errorf("proto: bad byte length %d", nb) + } + end := p.index + nb + if end < p.index || end > len(p.buf) { + return nil, io.ErrUnexpectedEOF + } + + if !alloc { + // todo: check if can get more uses of alloc=false + buf = p.buf[p.index:end] + p.index += nb + return + } + + buf = make([]byte, nb) + copy(buf, p.buf[p.index:]) + p.index += nb + return +} + +// DecodeStringBytes reads an encoded string from the Buffer. +// This is the format used for the proto2 string type. +func (p *Buffer) DecodeStringBytes() (s string, err error) { + buf, err := p.DecodeRawBytes(false) + if err != nil { + return + } + return string(buf), nil +} + +// Skip the next item in the buffer. Its wire type is decoded and presented as an argument. +// If the protocol buffer has extensions, and the field matches, add it as an extension. +// Otherwise, if the XXX_unrecognized field exists, append the skipped data there. +func (o *Buffer) skipAndSave(t reflect.Type, tag, wire int, base structPointer, unrecField field) error { + oi := o.index + + err := o.skip(t, tag, wire) + if err != nil { + return err + } + + if !unrecField.IsValid() { + return nil + } + + ptr := structPointer_Bytes(base, unrecField) + + // Add the skipped field to struct field + obuf := o.buf + + o.buf = *ptr + o.EncodeVarint(uint64(tag<<3 | wire)) + *ptr = append(o.buf, obuf[oi:o.index]...) + + o.buf = obuf + + return nil +} + +// Skip the next item in the buffer. Its wire type is decoded and presented as an argument. +func (o *Buffer) skip(t reflect.Type, tag, wire int) error { + + var u uint64 + var err error + + switch wire { + case WireVarint: + _, err = o.DecodeVarint() + case WireFixed64: + _, err = o.DecodeFixed64() + case WireBytes: + _, err = o.DecodeRawBytes(false) + case WireFixed32: + _, err = o.DecodeFixed32() + case WireStartGroup: + for { + u, err = o.DecodeVarint() + if err != nil { + break + } + fwire := int(u & 0x7) + if fwire == WireEndGroup { + break + } + ftag := int(u >> 3) + err = o.skip(t, ftag, fwire) + if err != nil { + break + } + } + default: + err = fmt.Errorf("proto: can't skip unknown wire type %d for %s", wire, t) + } + return err +} + +// Unmarshaler is the interface representing objects that can +// unmarshal themselves. The method should reset the receiver before +// decoding starts. The argument points to data that may be +// overwritten, so implementations should not keep references to the +// buffer. +type Unmarshaler interface { + Unmarshal([]byte) error +} + +// Unmarshal parses the protocol buffer representation in buf and places the +// decoded result in pb. If the struct underlying pb does not match +// the data in buf, the results can be unpredictable. +// +// Unmarshal resets pb before starting to unmarshal, so any +// existing data in pb is always removed. Use UnmarshalMerge +// to preserve and append to existing data. +func Unmarshal(buf []byte, pb Message) error { + pb.Reset() + return UnmarshalMerge(buf, pb) +} + +// UnmarshalMerge parses the protocol buffer representation in buf and +// writes the decoded result to pb. If the struct underlying pb does not match +// the data in buf, the results can be unpredictable. +// +// UnmarshalMerge merges into existing data in pb. +// Most code should use Unmarshal instead. +func UnmarshalMerge(buf []byte, pb Message) error { + // If the object can unmarshal itself, let it. + if u, ok := pb.(Unmarshaler); ok { + return u.Unmarshal(buf) + } + return NewBuffer(buf).Unmarshal(pb) +} + +// DecodeMessage reads a count-delimited message from the Buffer. +func (p *Buffer) DecodeMessage(pb Message) error { + enc, err := p.DecodeRawBytes(false) + if err != nil { + return err + } + return NewBuffer(enc).Unmarshal(pb) +} + +// DecodeGroup reads a tag-delimited group from the Buffer. +func (p *Buffer) DecodeGroup(pb Message) error { + typ, base, err := getbase(pb) + if err != nil { + return err + } + return p.unmarshalType(typ.Elem(), GetProperties(typ.Elem()), true, base) +} + +// Unmarshal parses the protocol buffer representation in the +// Buffer and places the decoded result in pb. If the struct +// underlying pb does not match the data in the buffer, the results can be +// unpredictable. +// +// Unlike proto.Unmarshal, this does not reset pb before starting to unmarshal. +func (p *Buffer) Unmarshal(pb Message) error { + // If the object can unmarshal itself, let it. + if u, ok := pb.(Unmarshaler); ok { + err := u.Unmarshal(p.buf[p.index:]) + p.index = len(p.buf) + return err + } + + typ, base, err := getbase(pb) + if err != nil { + return err + } + + err = p.unmarshalType(typ.Elem(), GetProperties(typ.Elem()), false, base) + + if collectStats { + stats.Decode++ + } + + return err +} + +// unmarshalType does the work of unmarshaling a structure. +func (o *Buffer) unmarshalType(st reflect.Type, prop *StructProperties, is_group bool, base structPointer) error { + var state errorState + required, reqFields := prop.reqCount, uint64(0) + + var err error + for err == nil && o.index < len(o.buf) { + oi := o.index + var u uint64 + u, err = o.DecodeVarint() + if err != nil { + break + } + wire := int(u & 0x7) + if wire == WireEndGroup { + if is_group { + if required > 0 { + // Not enough information to determine the exact field. + // (See below.) + return &RequiredNotSetError{"{Unknown}"} + } + return nil // input is satisfied + } + return fmt.Errorf("proto: %s: wiretype end group for non-group", st) + } + tag := int(u >> 3) + if tag <= 0 { + return fmt.Errorf("proto: %s: illegal tag %d (wire type %d)", st, tag, wire) + } + fieldnum, ok := prop.decoderTags.get(tag) + if !ok { + // Maybe it's an extension? + if prop.extendable { + if e, _ := extendable(structPointer_Interface(base, st)); isExtensionField(e, int32(tag)) { + if err = o.skip(st, tag, wire); err == nil { + extmap := e.extensionsWrite() + ext := extmap[int32(tag)] // may be missing + ext.enc = append(ext.enc, o.buf[oi:o.index]...) + extmap[int32(tag)] = ext + } + continue + } + } + // Maybe it's a oneof? + if prop.oneofUnmarshaler != nil { + m := structPointer_Interface(base, st).(Message) + // First return value indicates whether tag is a oneof field. + ok, err = prop.oneofUnmarshaler(m, tag, wire, o) + if err == ErrInternalBadWireType { + // Map the error to something more descriptive. + // Do the formatting here to save generated code space. + err = fmt.Errorf("bad wiretype for oneof field in %T", m) + } + if ok { + continue + } + } + err = o.skipAndSave(st, tag, wire, base, prop.unrecField) + continue + } + p := prop.Prop[fieldnum] + + if p.dec == nil { + fmt.Fprintf(os.Stderr, "proto: no protobuf decoder for %s.%s\n", st, st.Field(fieldnum).Name) + continue + } + dec := p.dec + if wire != WireStartGroup && wire != p.WireType { + if wire == WireBytes && p.packedDec != nil { + // a packable field + dec = p.packedDec + } else { + err = fmt.Errorf("proto: bad wiretype for field %s.%s: got wiretype %d, want %d", st, st.Field(fieldnum).Name, wire, p.WireType) + continue + } + } + decErr := dec(o, p, base) + if decErr != nil && !state.shouldContinue(decErr, p) { + err = decErr + } + if err == nil && p.Required { + // Successfully decoded a required field. + if tag <= 64 { + // use bitmap for fields 1-64 to catch field reuse. + var mask uint64 = 1 << uint64(tag-1) + if reqFields&mask == 0 { + // new required field + reqFields |= mask + required-- + } + } else { + // This is imprecise. It can be fooled by a required field + // with a tag > 64 that is encoded twice; that's very rare. + // A fully correct implementation would require allocating + // a data structure, which we would like to avoid. + required-- + } + } + } + if err == nil { + if is_group { + return io.ErrUnexpectedEOF + } + if state.err != nil { + return state.err + } + if required > 0 { + // Not enough information to determine the exact field. If we use extra + // CPU, we could determine the field only if the missing required field + // has a tag <= 64 and we check reqFields. + return &RequiredNotSetError{"{Unknown}"} + } + } + return err +} + +// Individual type decoders +// For each, +// u is the decoded value, +// v is a pointer to the field (pointer) in the struct + +// Sizes of the pools to allocate inside the Buffer. +// The goal is modest amortization and allocation +// on at least 16-byte boundaries. +const ( + boolPoolSize = 16 + uint32PoolSize = 8 + uint64PoolSize = 4 +) + +// Decode a bool. +func (o *Buffer) dec_bool(p *Properties, base structPointer) error { + u, err := p.valDec(o) + if err != nil { + return err + } + if len(o.bools) == 0 { + o.bools = make([]bool, boolPoolSize) + } + o.bools[0] = u != 0 + *structPointer_Bool(base, p.field) = &o.bools[0] + o.bools = o.bools[1:] + return nil +} + +func (o *Buffer) dec_proto3_bool(p *Properties, base structPointer) error { + u, err := p.valDec(o) + if err != nil { + return err + } + *structPointer_BoolVal(base, p.field) = u != 0 + return nil +} + +// Decode an int32. +func (o *Buffer) dec_int32(p *Properties, base structPointer) error { + u, err := p.valDec(o) + if err != nil { + return err + } + word32_Set(structPointer_Word32(base, p.field), o, uint32(u)) + return nil +} + +func (o *Buffer) dec_proto3_int32(p *Properties, base structPointer) error { + u, err := p.valDec(o) + if err != nil { + return err + } + word32Val_Set(structPointer_Word32Val(base, p.field), uint32(u)) + return nil +} + +// Decode an int64. +func (o *Buffer) dec_int64(p *Properties, base structPointer) error { + u, err := p.valDec(o) + if err != nil { + return err + } + word64_Set(structPointer_Word64(base, p.field), o, u) + return nil +} + +func (o *Buffer) dec_proto3_int64(p *Properties, base structPointer) error { + u, err := p.valDec(o) + if err != nil { + return err + } + word64Val_Set(structPointer_Word64Val(base, p.field), o, u) + return nil +} + +// Decode a string. +func (o *Buffer) dec_string(p *Properties, base structPointer) error { + s, err := o.DecodeStringBytes() + if err != nil { + return err + } + *structPointer_String(base, p.field) = &s + return nil +} + +func (o *Buffer) dec_proto3_string(p *Properties, base structPointer) error { + s, err := o.DecodeStringBytes() + if err != nil { + return err + } + *structPointer_StringVal(base, p.field) = s + return nil +} + +// Decode a slice of bytes ([]byte). +func (o *Buffer) dec_slice_byte(p *Properties, base structPointer) error { + b, err := o.DecodeRawBytes(true) + if err != nil { + return err + } + *structPointer_Bytes(base, p.field) = b + return nil +} + +// Decode a slice of bools ([]bool). +func (o *Buffer) dec_slice_bool(p *Properties, base structPointer) error { + u, err := p.valDec(o) + if err != nil { + return err + } + v := structPointer_BoolSlice(base, p.field) + *v = append(*v, u != 0) + return nil +} + +// Decode a slice of bools ([]bool) in packed format. +func (o *Buffer) dec_slice_packed_bool(p *Properties, base structPointer) error { + v := structPointer_BoolSlice(base, p.field) + + nn, err := o.DecodeVarint() + if err != nil { + return err + } + nb := int(nn) // number of bytes of encoded bools + fin := o.index + nb + if fin < o.index { + return errOverflow + } + + y := *v + for o.index < fin { + u, err := p.valDec(o) + if err != nil { + return err + } + y = append(y, u != 0) + } + + *v = y + return nil +} + +// Decode a slice of int32s ([]int32). +func (o *Buffer) dec_slice_int32(p *Properties, base structPointer) error { + u, err := p.valDec(o) + if err != nil { + return err + } + structPointer_Word32Slice(base, p.field).Append(uint32(u)) + return nil +} + +// Decode a slice of int32s ([]int32) in packed format. +func (o *Buffer) dec_slice_packed_int32(p *Properties, base structPointer) error { + v := structPointer_Word32Slice(base, p.field) + + nn, err := o.DecodeVarint() + if err != nil { + return err + } + nb := int(nn) // number of bytes of encoded int32s + + fin := o.index + nb + if fin < o.index { + return errOverflow + } + for o.index < fin { + u, err := p.valDec(o) + if err != nil { + return err + } + v.Append(uint32(u)) + } + return nil +} + +// Decode a slice of int64s ([]int64). +func (o *Buffer) dec_slice_int64(p *Properties, base structPointer) error { + u, err := p.valDec(o) + if err != nil { + return err + } + + structPointer_Word64Slice(base, p.field).Append(u) + return nil +} + +// Decode a slice of int64s ([]int64) in packed format. +func (o *Buffer) dec_slice_packed_int64(p *Properties, base structPointer) error { + v := structPointer_Word64Slice(base, p.field) + + nn, err := o.DecodeVarint() + if err != nil { + return err + } + nb := int(nn) // number of bytes of encoded int64s + + fin := o.index + nb + if fin < o.index { + return errOverflow + } + for o.index < fin { + u, err := p.valDec(o) + if err != nil { + return err + } + v.Append(u) + } + return nil +} + +// Decode a slice of strings ([]string). +func (o *Buffer) dec_slice_string(p *Properties, base structPointer) error { + s, err := o.DecodeStringBytes() + if err != nil { + return err + } + v := structPointer_StringSlice(base, p.field) + *v = append(*v, s) + return nil +} + +// Decode a slice of slice of bytes ([][]byte). +func (o *Buffer) dec_slice_slice_byte(p *Properties, base structPointer) error { + b, err := o.DecodeRawBytes(true) + if err != nil { + return err + } + v := structPointer_BytesSlice(base, p.field) + *v = append(*v, b) + return nil +} + +// Decode a map field. +func (o *Buffer) dec_new_map(p *Properties, base structPointer) error { + raw, err := o.DecodeRawBytes(false) + if err != nil { + return err + } + oi := o.index // index at the end of this map entry + o.index -= len(raw) // move buffer back to start of map entry + + mptr := structPointer_NewAt(base, p.field, p.mtype) // *map[K]V + if mptr.Elem().IsNil() { + mptr.Elem().Set(reflect.MakeMap(mptr.Type().Elem())) + } + v := mptr.Elem() // map[K]V + + // Prepare addressable doubly-indirect placeholders for the key and value types. + // See enc_new_map for why. + keyptr := reflect.New(reflect.PtrTo(p.mtype.Key())).Elem() // addressable *K + keybase := toStructPointer(keyptr.Addr()) // **K + + var valbase structPointer + var valptr reflect.Value + switch p.mtype.Elem().Kind() { + case reflect.Slice: + // []byte + var dummy []byte + valptr = reflect.ValueOf(&dummy) // *[]byte + valbase = toStructPointer(valptr) // *[]byte + case reflect.Ptr: + // message; valptr is **Msg; need to allocate the intermediate pointer + valptr = reflect.New(reflect.PtrTo(p.mtype.Elem())).Elem() // addressable *V + valptr.Set(reflect.New(valptr.Type().Elem())) + valbase = toStructPointer(valptr) + default: + // everything else + valptr = reflect.New(reflect.PtrTo(p.mtype.Elem())).Elem() // addressable *V + valbase = toStructPointer(valptr.Addr()) // **V + } + + // Decode. + // This parses a restricted wire format, namely the encoding of a message + // with two fields. See enc_new_map for the format. + for o.index < oi { + // tagcode for key and value properties are always a single byte + // because they have tags 1 and 2. + tagcode := o.buf[o.index] + o.index++ + switch tagcode { + case p.mkeyprop.tagcode[0]: + if err := p.mkeyprop.dec(o, p.mkeyprop, keybase); err != nil { + return err + } + case p.mvalprop.tagcode[0]: + if err := p.mvalprop.dec(o, p.mvalprop, valbase); err != nil { + return err + } + default: + // TODO: Should we silently skip this instead? + return fmt.Errorf("proto: bad map data tag %d", raw[0]) + } + } + keyelem, valelem := keyptr.Elem(), valptr.Elem() + if !keyelem.IsValid() { + keyelem = reflect.Zero(p.mtype.Key()) + } + if !valelem.IsValid() { + valelem = reflect.Zero(p.mtype.Elem()) + } + + v.SetMapIndex(keyelem, valelem) + return nil +} + +// Decode a group. +func (o *Buffer) dec_struct_group(p *Properties, base structPointer) error { + bas := structPointer_GetStructPointer(base, p.field) + if structPointer_IsNil(bas) { + // allocate new nested message + bas = toStructPointer(reflect.New(p.stype)) + structPointer_SetStructPointer(base, p.field, bas) + } + return o.unmarshalType(p.stype, p.sprop, true, bas) +} + +// Decode an embedded message. +func (o *Buffer) dec_struct_message(p *Properties, base structPointer) (err error) { + raw, e := o.DecodeRawBytes(false) + if e != nil { + return e + } + + bas := structPointer_GetStructPointer(base, p.field) + if structPointer_IsNil(bas) { + // allocate new nested message + bas = toStructPointer(reflect.New(p.stype)) + structPointer_SetStructPointer(base, p.field, bas) + } + + // If the object can unmarshal itself, let it. + if p.isUnmarshaler { + iv := structPointer_Interface(bas, p.stype) + return iv.(Unmarshaler).Unmarshal(raw) + } + + obuf := o.buf + oi := o.index + o.buf = raw + o.index = 0 + + err = o.unmarshalType(p.stype, p.sprop, false, bas) + o.buf = obuf + o.index = oi + + return err +} + +// Decode a slice of embedded messages. +func (o *Buffer) dec_slice_struct_message(p *Properties, base structPointer) error { + return o.dec_slice_struct(p, false, base) +} + +// Decode a slice of embedded groups. +func (o *Buffer) dec_slice_struct_group(p *Properties, base structPointer) error { + return o.dec_slice_struct(p, true, base) +} + +// Decode a slice of structs ([]*struct). +func (o *Buffer) dec_slice_struct(p *Properties, is_group bool, base structPointer) error { + v := reflect.New(p.stype) + bas := toStructPointer(v) + structPointer_StructPointerSlice(base, p.field).Append(bas) + + if is_group { + err := o.unmarshalType(p.stype, p.sprop, is_group, bas) + return err + } + + raw, err := o.DecodeRawBytes(false) + if err != nil { + return err + } + + // If the object can unmarshal itself, let it. + if p.isUnmarshaler { + iv := v.Interface() + return iv.(Unmarshaler).Unmarshal(raw) + } + + obuf := o.buf + oi := o.index + o.buf = raw + o.index = 0 + + err = o.unmarshalType(p.stype, p.sprop, is_group, bas) + + o.buf = obuf + o.index = oi + + return err +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/encode.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/encode.go new file mode 100644 index 00000000000..2b30f84626a --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/encode.go @@ -0,0 +1,1362 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +package proto + +/* + * Routines for encoding data into the wire format for protocol buffers. + */ + +import ( + "errors" + "fmt" + "reflect" + "sort" +) + +// RequiredNotSetError is the error returned if Marshal is called with +// a protocol buffer struct whose required fields have not +// all been initialized. It is also the error returned if Unmarshal is +// called with an encoded protocol buffer that does not include all the +// required fields. +// +// When printed, RequiredNotSetError reports the first unset required field in a +// message. If the field cannot be precisely determined, it is reported as +// "{Unknown}". +type RequiredNotSetError struct { + field string +} + +func (e *RequiredNotSetError) Error() string { + return fmt.Sprintf("proto: required field %q not set", e.field) +} + +var ( + // errRepeatedHasNil is the error returned if Marshal is called with + // a struct with a repeated field containing a nil element. + errRepeatedHasNil = errors.New("proto: repeated field has nil element") + + // errOneofHasNil is the error returned if Marshal is called with + // a struct with a oneof field containing a nil element. + errOneofHasNil = errors.New("proto: oneof field has nil value") + + // ErrNil is the error returned if Marshal is called with nil. + ErrNil = errors.New("proto: Marshal called with nil") + + // ErrTooLarge is the error returned if Marshal is called with a + // message that encodes to >2GB. + ErrTooLarge = errors.New("proto: message encodes to over 2 GB") +) + +// The fundamental encoders that put bytes on the wire. +// Those that take integer types all accept uint64 and are +// therefore of type valueEncoder. + +const maxVarintBytes = 10 // maximum length of a varint + +// maxMarshalSize is the largest allowed size of an encoded protobuf, +// since C++ and Java use signed int32s for the size. +const maxMarshalSize = 1<<31 - 1 + +// EncodeVarint returns the varint encoding of x. +// This is the format for the +// int32, int64, uint32, uint64, bool, and enum +// protocol buffer types. +// Not used by the package itself, but helpful to clients +// wishing to use the same encoding. +func EncodeVarint(x uint64) []byte { + var buf [maxVarintBytes]byte + var n int + for n = 0; x > 127; n++ { + buf[n] = 0x80 | uint8(x&0x7F) + x >>= 7 + } + buf[n] = uint8(x) + n++ + return buf[0:n] +} + +// EncodeVarint writes a varint-encoded integer to the Buffer. +// This is the format for the +// int32, int64, uint32, uint64, bool, and enum +// protocol buffer types. +func (p *Buffer) EncodeVarint(x uint64) error { + for x >= 1<<7 { + p.buf = append(p.buf, uint8(x&0x7f|0x80)) + x >>= 7 + } + p.buf = append(p.buf, uint8(x)) + return nil +} + +// SizeVarint returns the varint encoding size of an integer. +func SizeVarint(x uint64) int { + return sizeVarint(x) +} + +func sizeVarint(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} + +// EncodeFixed64 writes a 64-bit integer to the Buffer. +// This is the format for the +// fixed64, sfixed64, and double protocol buffer types. +func (p *Buffer) EncodeFixed64(x uint64) error { + p.buf = append(p.buf, + uint8(x), + uint8(x>>8), + uint8(x>>16), + uint8(x>>24), + uint8(x>>32), + uint8(x>>40), + uint8(x>>48), + uint8(x>>56)) + return nil +} + +func sizeFixed64(x uint64) int { + return 8 +} + +// EncodeFixed32 writes a 32-bit integer to the Buffer. +// This is the format for the +// fixed32, sfixed32, and float protocol buffer types. +func (p *Buffer) EncodeFixed32(x uint64) error { + p.buf = append(p.buf, + uint8(x), + uint8(x>>8), + uint8(x>>16), + uint8(x>>24)) + return nil +} + +func sizeFixed32(x uint64) int { + return 4 +} + +// EncodeZigzag64 writes a zigzag-encoded 64-bit integer +// to the Buffer. +// This is the format used for the sint64 protocol buffer type. +func (p *Buffer) EncodeZigzag64(x uint64) error { + // use signed number to get arithmetic right shift. + return p.EncodeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} + +func sizeZigzag64(x uint64) int { + return sizeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} + +// EncodeZigzag32 writes a zigzag-encoded 32-bit integer +// to the Buffer. +// This is the format used for the sint32 protocol buffer type. +func (p *Buffer) EncodeZigzag32(x uint64) error { + // use signed number to get arithmetic right shift. + return p.EncodeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31)))) +} + +func sizeZigzag32(x uint64) int { + return sizeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31)))) +} + +// EncodeRawBytes writes a count-delimited byte buffer to the Buffer. +// This is the format used for the bytes protocol buffer +// type and for embedded messages. +func (p *Buffer) EncodeRawBytes(b []byte) error { + p.EncodeVarint(uint64(len(b))) + p.buf = append(p.buf, b...) + return nil +} + +func sizeRawBytes(b []byte) int { + return sizeVarint(uint64(len(b))) + + len(b) +} + +// EncodeStringBytes writes an encoded string to the Buffer. +// This is the format used for the proto2 string type. +func (p *Buffer) EncodeStringBytes(s string) error { + p.EncodeVarint(uint64(len(s))) + p.buf = append(p.buf, s...) + return nil +} + +func sizeStringBytes(s string) int { + return sizeVarint(uint64(len(s))) + + len(s) +} + +// Marshaler is the interface representing objects that can marshal themselves. +type Marshaler interface { + Marshal() ([]byte, error) +} + +// Marshal takes the protocol buffer +// and encodes it into the wire format, returning the data. +func Marshal(pb Message) ([]byte, error) { + // Can the object marshal itself? + if m, ok := pb.(Marshaler); ok { + return m.Marshal() + } + p := NewBuffer(nil) + err := p.Marshal(pb) + if p.buf == nil && err == nil { + // Return a non-nil slice on success. + return []byte{}, nil + } + return p.buf, err +} + +// EncodeMessage writes the protocol buffer to the Buffer, +// prefixed by a varint-encoded length. +func (p *Buffer) EncodeMessage(pb Message) error { + t, base, err := getbase(pb) + if structPointer_IsNil(base) { + return ErrNil + } + if err == nil { + var state errorState + err = p.enc_len_struct(GetProperties(t.Elem()), base, &state) + } + return err +} + +// Marshal takes the protocol buffer +// and encodes it into the wire format, writing the result to the +// Buffer. +func (p *Buffer) Marshal(pb Message) error { + // Can the object marshal itself? + if m, ok := pb.(Marshaler); ok { + data, err := m.Marshal() + p.buf = append(p.buf, data...) + return err + } + + t, base, err := getbase(pb) + if structPointer_IsNil(base) { + return ErrNil + } + if err == nil { + err = p.enc_struct(GetProperties(t.Elem()), base) + } + + if collectStats { + (stats).Encode++ // Parens are to work around a goimports bug. + } + + if len(p.buf) > maxMarshalSize { + return ErrTooLarge + } + return err +} + +// Size returns the encoded size of a protocol buffer. +func Size(pb Message) (n int) { + // Can the object marshal itself? If so, Size is slow. + // TODO: add Size to Marshaler, or add a Sizer interface. + if m, ok := pb.(Marshaler); ok { + b, _ := m.Marshal() + return len(b) + } + + t, base, err := getbase(pb) + if structPointer_IsNil(base) { + return 0 + } + if err == nil { + n = size_struct(GetProperties(t.Elem()), base) + } + + if collectStats { + (stats).Size++ // Parens are to work around a goimports bug. + } + + return +} + +// Individual type encoders. + +// Encode a bool. +func (o *Buffer) enc_bool(p *Properties, base structPointer) error { + v := *structPointer_Bool(base, p.field) + if v == nil { + return ErrNil + } + x := 0 + if *v { + x = 1 + } + o.buf = append(o.buf, p.tagcode...) + p.valEnc(o, uint64(x)) + return nil +} + +func (o *Buffer) enc_proto3_bool(p *Properties, base structPointer) error { + v := *structPointer_BoolVal(base, p.field) + if !v { + return ErrNil + } + o.buf = append(o.buf, p.tagcode...) + p.valEnc(o, 1) + return nil +} + +func size_bool(p *Properties, base structPointer) int { + v := *structPointer_Bool(base, p.field) + if v == nil { + return 0 + } + return len(p.tagcode) + 1 // each bool takes exactly one byte +} + +func size_proto3_bool(p *Properties, base structPointer) int { + v := *structPointer_BoolVal(base, p.field) + if !v && !p.oneof { + return 0 + } + return len(p.tagcode) + 1 // each bool takes exactly one byte +} + +// Encode an int32. +func (o *Buffer) enc_int32(p *Properties, base structPointer) error { + v := structPointer_Word32(base, p.field) + if word32_IsNil(v) { + return ErrNil + } + x := int32(word32_Get(v)) // permit sign extension to use full 64-bit range + o.buf = append(o.buf, p.tagcode...) + p.valEnc(o, uint64(x)) + return nil +} + +func (o *Buffer) enc_proto3_int32(p *Properties, base structPointer) error { + v := structPointer_Word32Val(base, p.field) + x := int32(word32Val_Get(v)) // permit sign extension to use full 64-bit range + if x == 0 { + return ErrNil + } + o.buf = append(o.buf, p.tagcode...) + p.valEnc(o, uint64(x)) + return nil +} + +func size_int32(p *Properties, base structPointer) (n int) { + v := structPointer_Word32(base, p.field) + if word32_IsNil(v) { + return 0 + } + x := int32(word32_Get(v)) // permit sign extension to use full 64-bit range + n += len(p.tagcode) + n += p.valSize(uint64(x)) + return +} + +func size_proto3_int32(p *Properties, base structPointer) (n int) { + v := structPointer_Word32Val(base, p.field) + x := int32(word32Val_Get(v)) // permit sign extension to use full 64-bit range + if x == 0 && !p.oneof { + return 0 + } + n += len(p.tagcode) + n += p.valSize(uint64(x)) + return +} + +// Encode a uint32. +// Exactly the same as int32, except for no sign extension. +func (o *Buffer) enc_uint32(p *Properties, base structPointer) error { + v := structPointer_Word32(base, p.field) + if word32_IsNil(v) { + return ErrNil + } + x := word32_Get(v) + o.buf = append(o.buf, p.tagcode...) + p.valEnc(o, uint64(x)) + return nil +} + +func (o *Buffer) enc_proto3_uint32(p *Properties, base structPointer) error { + v := structPointer_Word32Val(base, p.field) + x := word32Val_Get(v) + if x == 0 { + return ErrNil + } + o.buf = append(o.buf, p.tagcode...) + p.valEnc(o, uint64(x)) + return nil +} + +func size_uint32(p *Properties, base structPointer) (n int) { + v := structPointer_Word32(base, p.field) + if word32_IsNil(v) { + return 0 + } + x := word32_Get(v) + n += len(p.tagcode) + n += p.valSize(uint64(x)) + return +} + +func size_proto3_uint32(p *Properties, base structPointer) (n int) { + v := structPointer_Word32Val(base, p.field) + x := word32Val_Get(v) + if x == 0 && !p.oneof { + return 0 + } + n += len(p.tagcode) + n += p.valSize(uint64(x)) + return +} + +// Encode an int64. +func (o *Buffer) enc_int64(p *Properties, base structPointer) error { + v := structPointer_Word64(base, p.field) + if word64_IsNil(v) { + return ErrNil + } + x := word64_Get(v) + o.buf = append(o.buf, p.tagcode...) + p.valEnc(o, x) + return nil +} + +func (o *Buffer) enc_proto3_int64(p *Properties, base structPointer) error { + v := structPointer_Word64Val(base, p.field) + x := word64Val_Get(v) + if x == 0 { + return ErrNil + } + o.buf = append(o.buf, p.tagcode...) + p.valEnc(o, x) + return nil +} + +func size_int64(p *Properties, base structPointer) (n int) { + v := structPointer_Word64(base, p.field) + if word64_IsNil(v) { + return 0 + } + x := word64_Get(v) + n += len(p.tagcode) + n += p.valSize(x) + return +} + +func size_proto3_int64(p *Properties, base structPointer) (n int) { + v := structPointer_Word64Val(base, p.field) + x := word64Val_Get(v) + if x == 0 && !p.oneof { + return 0 + } + n += len(p.tagcode) + n += p.valSize(x) + return +} + +// Encode a string. +func (o *Buffer) enc_string(p *Properties, base structPointer) error { + v := *structPointer_String(base, p.field) + if v == nil { + return ErrNil + } + x := *v + o.buf = append(o.buf, p.tagcode...) + o.EncodeStringBytes(x) + return nil +} + +func (o *Buffer) enc_proto3_string(p *Properties, base structPointer) error { + v := *structPointer_StringVal(base, p.field) + if v == "" { + return ErrNil + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeStringBytes(v) + return nil +} + +func size_string(p *Properties, base structPointer) (n int) { + v := *structPointer_String(base, p.field) + if v == nil { + return 0 + } + x := *v + n += len(p.tagcode) + n += sizeStringBytes(x) + return +} + +func size_proto3_string(p *Properties, base structPointer) (n int) { + v := *structPointer_StringVal(base, p.field) + if v == "" && !p.oneof { + return 0 + } + n += len(p.tagcode) + n += sizeStringBytes(v) + return +} + +// All protocol buffer fields are nillable, but be careful. +func isNil(v reflect.Value) bool { + switch v.Kind() { + case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: + return v.IsNil() + } + return false +} + +// Encode a message struct. +func (o *Buffer) enc_struct_message(p *Properties, base structPointer) error { + var state errorState + structp := structPointer_GetStructPointer(base, p.field) + if structPointer_IsNil(structp) { + return ErrNil + } + + // Can the object marshal itself? + if p.isMarshaler { + m := structPointer_Interface(structp, p.stype).(Marshaler) + data, err := m.Marshal() + if err != nil && !state.shouldContinue(err, nil) { + return err + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeRawBytes(data) + return state.err + } + + o.buf = append(o.buf, p.tagcode...) + return o.enc_len_struct(p.sprop, structp, &state) +} + +func size_struct_message(p *Properties, base structPointer) int { + structp := structPointer_GetStructPointer(base, p.field) + if structPointer_IsNil(structp) { + return 0 + } + + // Can the object marshal itself? + if p.isMarshaler { + m := structPointer_Interface(structp, p.stype).(Marshaler) + data, _ := m.Marshal() + n0 := len(p.tagcode) + n1 := sizeRawBytes(data) + return n0 + n1 + } + + n0 := len(p.tagcode) + n1 := size_struct(p.sprop, structp) + n2 := sizeVarint(uint64(n1)) // size of encoded length + return n0 + n1 + n2 +} + +// Encode a group struct. +func (o *Buffer) enc_struct_group(p *Properties, base structPointer) error { + var state errorState + b := structPointer_GetStructPointer(base, p.field) + if structPointer_IsNil(b) { + return ErrNil + } + + o.EncodeVarint(uint64((p.Tag << 3) | WireStartGroup)) + err := o.enc_struct(p.sprop, b) + if err != nil && !state.shouldContinue(err, nil) { + return err + } + o.EncodeVarint(uint64((p.Tag << 3) | WireEndGroup)) + return state.err +} + +func size_struct_group(p *Properties, base structPointer) (n int) { + b := structPointer_GetStructPointer(base, p.field) + if structPointer_IsNil(b) { + return 0 + } + + n += sizeVarint(uint64((p.Tag << 3) | WireStartGroup)) + n += size_struct(p.sprop, b) + n += sizeVarint(uint64((p.Tag << 3) | WireEndGroup)) + return +} + +// Encode a slice of bools ([]bool). +func (o *Buffer) enc_slice_bool(p *Properties, base structPointer) error { + s := *structPointer_BoolSlice(base, p.field) + l := len(s) + if l == 0 { + return ErrNil + } + for _, x := range s { + o.buf = append(o.buf, p.tagcode...) + v := uint64(0) + if x { + v = 1 + } + p.valEnc(o, v) + } + return nil +} + +func size_slice_bool(p *Properties, base structPointer) int { + s := *structPointer_BoolSlice(base, p.field) + l := len(s) + if l == 0 { + return 0 + } + return l * (len(p.tagcode) + 1) // each bool takes exactly one byte +} + +// Encode a slice of bools ([]bool) in packed format. +func (o *Buffer) enc_slice_packed_bool(p *Properties, base structPointer) error { + s := *structPointer_BoolSlice(base, p.field) + l := len(s) + if l == 0 { + return ErrNil + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeVarint(uint64(l)) // each bool takes exactly one byte + for _, x := range s { + v := uint64(0) + if x { + v = 1 + } + p.valEnc(o, v) + } + return nil +} + +func size_slice_packed_bool(p *Properties, base structPointer) (n int) { + s := *structPointer_BoolSlice(base, p.field) + l := len(s) + if l == 0 { + return 0 + } + n += len(p.tagcode) + n += sizeVarint(uint64(l)) + n += l // each bool takes exactly one byte + return +} + +// Encode a slice of bytes ([]byte). +func (o *Buffer) enc_slice_byte(p *Properties, base structPointer) error { + s := *structPointer_Bytes(base, p.field) + if s == nil { + return ErrNil + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeRawBytes(s) + return nil +} + +func (o *Buffer) enc_proto3_slice_byte(p *Properties, base structPointer) error { + s := *structPointer_Bytes(base, p.field) + if len(s) == 0 { + return ErrNil + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeRawBytes(s) + return nil +} + +func size_slice_byte(p *Properties, base structPointer) (n int) { + s := *structPointer_Bytes(base, p.field) + if s == nil && !p.oneof { + return 0 + } + n += len(p.tagcode) + n += sizeRawBytes(s) + return +} + +func size_proto3_slice_byte(p *Properties, base structPointer) (n int) { + s := *structPointer_Bytes(base, p.field) + if len(s) == 0 && !p.oneof { + return 0 + } + n += len(p.tagcode) + n += sizeRawBytes(s) + return +} + +// Encode a slice of int32s ([]int32). +func (o *Buffer) enc_slice_int32(p *Properties, base structPointer) error { + s := structPointer_Word32Slice(base, p.field) + l := s.Len() + if l == 0 { + return ErrNil + } + for i := 0; i < l; i++ { + o.buf = append(o.buf, p.tagcode...) + x := int32(s.Index(i)) // permit sign extension to use full 64-bit range + p.valEnc(o, uint64(x)) + } + return nil +} + +func size_slice_int32(p *Properties, base structPointer) (n int) { + s := structPointer_Word32Slice(base, p.field) + l := s.Len() + if l == 0 { + return 0 + } + for i := 0; i < l; i++ { + n += len(p.tagcode) + x := int32(s.Index(i)) // permit sign extension to use full 64-bit range + n += p.valSize(uint64(x)) + } + return +} + +// Encode a slice of int32s ([]int32) in packed format. +func (o *Buffer) enc_slice_packed_int32(p *Properties, base structPointer) error { + s := structPointer_Word32Slice(base, p.field) + l := s.Len() + if l == 0 { + return ErrNil + } + // TODO: Reuse a Buffer. + buf := NewBuffer(nil) + for i := 0; i < l; i++ { + x := int32(s.Index(i)) // permit sign extension to use full 64-bit range + p.valEnc(buf, uint64(x)) + } + + o.buf = append(o.buf, p.tagcode...) + o.EncodeVarint(uint64(len(buf.buf))) + o.buf = append(o.buf, buf.buf...) + return nil +} + +func size_slice_packed_int32(p *Properties, base structPointer) (n int) { + s := structPointer_Word32Slice(base, p.field) + l := s.Len() + if l == 0 { + return 0 + } + var bufSize int + for i := 0; i < l; i++ { + x := int32(s.Index(i)) // permit sign extension to use full 64-bit range + bufSize += p.valSize(uint64(x)) + } + + n += len(p.tagcode) + n += sizeVarint(uint64(bufSize)) + n += bufSize + return +} + +// Encode a slice of uint32s ([]uint32). +// Exactly the same as int32, except for no sign extension. +func (o *Buffer) enc_slice_uint32(p *Properties, base structPointer) error { + s := structPointer_Word32Slice(base, p.field) + l := s.Len() + if l == 0 { + return ErrNil + } + for i := 0; i < l; i++ { + o.buf = append(o.buf, p.tagcode...) + x := s.Index(i) + p.valEnc(o, uint64(x)) + } + return nil +} + +func size_slice_uint32(p *Properties, base structPointer) (n int) { + s := structPointer_Word32Slice(base, p.field) + l := s.Len() + if l == 0 { + return 0 + } + for i := 0; i < l; i++ { + n += len(p.tagcode) + x := s.Index(i) + n += p.valSize(uint64(x)) + } + return +} + +// Encode a slice of uint32s ([]uint32) in packed format. +// Exactly the same as int32, except for no sign extension. +func (o *Buffer) enc_slice_packed_uint32(p *Properties, base structPointer) error { + s := structPointer_Word32Slice(base, p.field) + l := s.Len() + if l == 0 { + return ErrNil + } + // TODO: Reuse a Buffer. + buf := NewBuffer(nil) + for i := 0; i < l; i++ { + p.valEnc(buf, uint64(s.Index(i))) + } + + o.buf = append(o.buf, p.tagcode...) + o.EncodeVarint(uint64(len(buf.buf))) + o.buf = append(o.buf, buf.buf...) + return nil +} + +func size_slice_packed_uint32(p *Properties, base structPointer) (n int) { + s := structPointer_Word32Slice(base, p.field) + l := s.Len() + if l == 0 { + return 0 + } + var bufSize int + for i := 0; i < l; i++ { + bufSize += p.valSize(uint64(s.Index(i))) + } + + n += len(p.tagcode) + n += sizeVarint(uint64(bufSize)) + n += bufSize + return +} + +// Encode a slice of int64s ([]int64). +func (o *Buffer) enc_slice_int64(p *Properties, base structPointer) error { + s := structPointer_Word64Slice(base, p.field) + l := s.Len() + if l == 0 { + return ErrNil + } + for i := 0; i < l; i++ { + o.buf = append(o.buf, p.tagcode...) + p.valEnc(o, s.Index(i)) + } + return nil +} + +func size_slice_int64(p *Properties, base structPointer) (n int) { + s := structPointer_Word64Slice(base, p.field) + l := s.Len() + if l == 0 { + return 0 + } + for i := 0; i < l; i++ { + n += len(p.tagcode) + n += p.valSize(s.Index(i)) + } + return +} + +// Encode a slice of int64s ([]int64) in packed format. +func (o *Buffer) enc_slice_packed_int64(p *Properties, base structPointer) error { + s := structPointer_Word64Slice(base, p.field) + l := s.Len() + if l == 0 { + return ErrNil + } + // TODO: Reuse a Buffer. + buf := NewBuffer(nil) + for i := 0; i < l; i++ { + p.valEnc(buf, s.Index(i)) + } + + o.buf = append(o.buf, p.tagcode...) + o.EncodeVarint(uint64(len(buf.buf))) + o.buf = append(o.buf, buf.buf...) + return nil +} + +func size_slice_packed_int64(p *Properties, base structPointer) (n int) { + s := structPointer_Word64Slice(base, p.field) + l := s.Len() + if l == 0 { + return 0 + } + var bufSize int + for i := 0; i < l; i++ { + bufSize += p.valSize(s.Index(i)) + } + + n += len(p.tagcode) + n += sizeVarint(uint64(bufSize)) + n += bufSize + return +} + +// Encode a slice of slice of bytes ([][]byte). +func (o *Buffer) enc_slice_slice_byte(p *Properties, base structPointer) error { + ss := *structPointer_BytesSlice(base, p.field) + l := len(ss) + if l == 0 { + return ErrNil + } + for i := 0; i < l; i++ { + o.buf = append(o.buf, p.tagcode...) + o.EncodeRawBytes(ss[i]) + } + return nil +} + +func size_slice_slice_byte(p *Properties, base structPointer) (n int) { + ss := *structPointer_BytesSlice(base, p.field) + l := len(ss) + if l == 0 { + return 0 + } + n += l * len(p.tagcode) + for i := 0; i < l; i++ { + n += sizeRawBytes(ss[i]) + } + return +} + +// Encode a slice of strings ([]string). +func (o *Buffer) enc_slice_string(p *Properties, base structPointer) error { + ss := *structPointer_StringSlice(base, p.field) + l := len(ss) + for i := 0; i < l; i++ { + o.buf = append(o.buf, p.tagcode...) + o.EncodeStringBytes(ss[i]) + } + return nil +} + +func size_slice_string(p *Properties, base structPointer) (n int) { + ss := *structPointer_StringSlice(base, p.field) + l := len(ss) + n += l * len(p.tagcode) + for i := 0; i < l; i++ { + n += sizeStringBytes(ss[i]) + } + return +} + +// Encode a slice of message structs ([]*struct). +func (o *Buffer) enc_slice_struct_message(p *Properties, base structPointer) error { + var state errorState + s := structPointer_StructPointerSlice(base, p.field) + l := s.Len() + + for i := 0; i < l; i++ { + structp := s.Index(i) + if structPointer_IsNil(structp) { + return errRepeatedHasNil + } + + // Can the object marshal itself? + if p.isMarshaler { + m := structPointer_Interface(structp, p.stype).(Marshaler) + data, err := m.Marshal() + if err != nil && !state.shouldContinue(err, nil) { + return err + } + o.buf = append(o.buf, p.tagcode...) + o.EncodeRawBytes(data) + continue + } + + o.buf = append(o.buf, p.tagcode...) + err := o.enc_len_struct(p.sprop, structp, &state) + if err != nil && !state.shouldContinue(err, nil) { + if err == ErrNil { + return errRepeatedHasNil + } + return err + } + } + return state.err +} + +func size_slice_struct_message(p *Properties, base structPointer) (n int) { + s := structPointer_StructPointerSlice(base, p.field) + l := s.Len() + n += l * len(p.tagcode) + for i := 0; i < l; i++ { + structp := s.Index(i) + if structPointer_IsNil(structp) { + return // return the size up to this point + } + + // Can the object marshal itself? + if p.isMarshaler { + m := structPointer_Interface(structp, p.stype).(Marshaler) + data, _ := m.Marshal() + n += sizeRawBytes(data) + continue + } + + n0 := size_struct(p.sprop, structp) + n1 := sizeVarint(uint64(n0)) // size of encoded length + n += n0 + n1 + } + return +} + +// Encode a slice of group structs ([]*struct). +func (o *Buffer) enc_slice_struct_group(p *Properties, base structPointer) error { + var state errorState + s := structPointer_StructPointerSlice(base, p.field) + l := s.Len() + + for i := 0; i < l; i++ { + b := s.Index(i) + if structPointer_IsNil(b) { + return errRepeatedHasNil + } + + o.EncodeVarint(uint64((p.Tag << 3) | WireStartGroup)) + + err := o.enc_struct(p.sprop, b) + + if err != nil && !state.shouldContinue(err, nil) { + if err == ErrNil { + return errRepeatedHasNil + } + return err + } + + o.EncodeVarint(uint64((p.Tag << 3) | WireEndGroup)) + } + return state.err +} + +func size_slice_struct_group(p *Properties, base structPointer) (n int) { + s := structPointer_StructPointerSlice(base, p.field) + l := s.Len() + + n += l * sizeVarint(uint64((p.Tag<<3)|WireStartGroup)) + n += l * sizeVarint(uint64((p.Tag<<3)|WireEndGroup)) + for i := 0; i < l; i++ { + b := s.Index(i) + if structPointer_IsNil(b) { + return // return size up to this point + } + + n += size_struct(p.sprop, b) + } + return +} + +// Encode an extension map. +func (o *Buffer) enc_map(p *Properties, base structPointer) error { + exts := structPointer_ExtMap(base, p.field) + if err := encodeExtensionsMap(*exts); err != nil { + return err + } + + return o.enc_map_body(*exts) +} + +func (o *Buffer) enc_exts(p *Properties, base structPointer) error { + exts := structPointer_Extensions(base, p.field) + + v, mu := exts.extensionsRead() + if v == nil { + return nil + } + + mu.Lock() + defer mu.Unlock() + if err := encodeExtensionsMap(v); err != nil { + return err + } + + return o.enc_map_body(v) +} + +func (o *Buffer) enc_map_body(v map[int32]Extension) error { + // Fast-path for common cases: zero or one extensions. + if len(v) <= 1 { + for _, e := range v { + o.buf = append(o.buf, e.enc...) + } + return nil + } + + // Sort keys to provide a deterministic encoding. + keys := make([]int, 0, len(v)) + for k := range v { + keys = append(keys, int(k)) + } + sort.Ints(keys) + + for _, k := range keys { + o.buf = append(o.buf, v[int32(k)].enc...) + } + return nil +} + +func size_map(p *Properties, base structPointer) int { + v := structPointer_ExtMap(base, p.field) + return extensionsMapSize(*v) +} + +func size_exts(p *Properties, base structPointer) int { + v := structPointer_Extensions(base, p.field) + return extensionsSize(v) +} + +// Encode a map field. +func (o *Buffer) enc_new_map(p *Properties, base structPointer) error { + var state errorState // XXX: or do we need to plumb this through? + + /* + A map defined as + map map_field = N; + is encoded in the same way as + message MapFieldEntry { + key_type key = 1; + value_type value = 2; + } + repeated MapFieldEntry map_field = N; + */ + + v := structPointer_NewAt(base, p.field, p.mtype).Elem() // map[K]V + if v.Len() == 0 { + return nil + } + + keycopy, valcopy, keybase, valbase := mapEncodeScratch(p.mtype) + + enc := func() error { + if err := p.mkeyprop.enc(o, p.mkeyprop, keybase); err != nil { + return err + } + if err := p.mvalprop.enc(o, p.mvalprop, valbase); err != nil && err != ErrNil { + return err + } + return nil + } + + // Don't sort map keys. It is not required by the spec, and C++ doesn't do it. + for _, key := range v.MapKeys() { + val := v.MapIndex(key) + + keycopy.Set(key) + valcopy.Set(val) + + o.buf = append(o.buf, p.tagcode...) + if err := o.enc_len_thing(enc, &state); err != nil { + return err + } + } + return nil +} + +func size_new_map(p *Properties, base structPointer) int { + v := structPointer_NewAt(base, p.field, p.mtype).Elem() // map[K]V + + keycopy, valcopy, keybase, valbase := mapEncodeScratch(p.mtype) + + n := 0 + for _, key := range v.MapKeys() { + val := v.MapIndex(key) + keycopy.Set(key) + valcopy.Set(val) + + // Tag codes for key and val are the responsibility of the sub-sizer. + keysize := p.mkeyprop.size(p.mkeyprop, keybase) + valsize := p.mvalprop.size(p.mvalprop, valbase) + entry := keysize + valsize + // Add on tag code and length of map entry itself. + n += len(p.tagcode) + sizeVarint(uint64(entry)) + entry + } + return n +} + +// mapEncodeScratch returns a new reflect.Value matching the map's value type, +// and a structPointer suitable for passing to an encoder or sizer. +func mapEncodeScratch(mapType reflect.Type) (keycopy, valcopy reflect.Value, keybase, valbase structPointer) { + // Prepare addressable doubly-indirect placeholders for the key and value types. + // This is needed because the element-type encoders expect **T, but the map iteration produces T. + + keycopy = reflect.New(mapType.Key()).Elem() // addressable K + keyptr := reflect.New(reflect.PtrTo(keycopy.Type())).Elem() // addressable *K + keyptr.Set(keycopy.Addr()) // + keybase = toStructPointer(keyptr.Addr()) // **K + + // Value types are more varied and require special handling. + switch mapType.Elem().Kind() { + case reflect.Slice: + // []byte + var dummy []byte + valcopy = reflect.ValueOf(&dummy).Elem() // addressable []byte + valbase = toStructPointer(valcopy.Addr()) + case reflect.Ptr: + // message; the generated field type is map[K]*Msg (so V is *Msg), + // so we only need one level of indirection. + valcopy = reflect.New(mapType.Elem()).Elem() // addressable V + valbase = toStructPointer(valcopy.Addr()) + default: + // everything else + valcopy = reflect.New(mapType.Elem()).Elem() // addressable V + valptr := reflect.New(reflect.PtrTo(valcopy.Type())).Elem() // addressable *V + valptr.Set(valcopy.Addr()) // + valbase = toStructPointer(valptr.Addr()) // **V + } + return +} + +// Encode a struct. +func (o *Buffer) enc_struct(prop *StructProperties, base structPointer) error { + var state errorState + // Encode fields in tag order so that decoders may use optimizations + // that depend on the ordering. + // https://developers.google.com/protocol-buffers/docs/encoding#order + for _, i := range prop.order { + p := prop.Prop[i] + if p.enc != nil { + err := p.enc(o, p, base) + if err != nil { + if err == ErrNil { + if p.Required && state.err == nil { + state.err = &RequiredNotSetError{p.Name} + } + } else if err == errRepeatedHasNil { + // Give more context to nil values in repeated fields. + return errors.New("repeated field " + p.OrigName + " has nil element") + } else if !state.shouldContinue(err, p) { + return err + } + } + if len(o.buf) > maxMarshalSize { + return ErrTooLarge + } + } + } + + // Do oneof fields. + if prop.oneofMarshaler != nil { + m := structPointer_Interface(base, prop.stype).(Message) + if err := prop.oneofMarshaler(m, o); err == ErrNil { + return errOneofHasNil + } else if err != nil { + return err + } + } + + // Add unrecognized fields at the end. + if prop.unrecField.IsValid() { + v := *structPointer_Bytes(base, prop.unrecField) + if len(o.buf)+len(v) > maxMarshalSize { + return ErrTooLarge + } + if len(v) > 0 { + o.buf = append(o.buf, v...) + } + } + + return state.err +} + +func size_struct(prop *StructProperties, base structPointer) (n int) { + for _, i := range prop.order { + p := prop.Prop[i] + if p.size != nil { + n += p.size(p, base) + } + } + + // Add unrecognized fields at the end. + if prop.unrecField.IsValid() { + v := *structPointer_Bytes(base, prop.unrecField) + n += len(v) + } + + // Factor in any oneof fields. + if prop.oneofSizer != nil { + m := structPointer_Interface(base, prop.stype).(Message) + n += prop.oneofSizer(m) + } + + return +} + +var zeroes [20]byte // longer than any conceivable sizeVarint + +// Encode a struct, preceded by its encoded length (as a varint). +func (o *Buffer) enc_len_struct(prop *StructProperties, base structPointer, state *errorState) error { + return o.enc_len_thing(func() error { return o.enc_struct(prop, base) }, state) +} + +// Encode something, preceded by its encoded length (as a varint). +func (o *Buffer) enc_len_thing(enc func() error, state *errorState) error { + iLen := len(o.buf) + o.buf = append(o.buf, 0, 0, 0, 0) // reserve four bytes for length + iMsg := len(o.buf) + err := enc() + if err != nil && !state.shouldContinue(err, nil) { + return err + } + lMsg := len(o.buf) - iMsg + lLen := sizeVarint(uint64(lMsg)) + switch x := lLen - (iMsg - iLen); { + case x > 0: // actual length is x bytes larger than the space we reserved + // Move msg x bytes right. + o.buf = append(o.buf, zeroes[:x]...) + copy(o.buf[iMsg+x:], o.buf[iMsg:iMsg+lMsg]) + case x < 0: // actual length is x bytes smaller than the space we reserved + // Move msg x bytes left. + copy(o.buf[iMsg+x:], o.buf[iMsg:iMsg+lMsg]) + o.buf = o.buf[:len(o.buf)+x] // x is negative + } + // Encode the length in the reserved space. + o.buf = o.buf[:iLen] + o.EncodeVarint(uint64(lMsg)) + o.buf = o.buf[:len(o.buf)+lMsg] + return state.err +} + +// errorState maintains the first error that occurs and updates that error +// with additional context. +type errorState struct { + err error +} + +// shouldContinue reports whether encoding should continue upon encountering the +// given error. If the error is RequiredNotSetError, shouldContinue returns true +// and, if this is the first appearance of that error, remembers it for future +// reporting. +// +// If prop is not nil, it may update any error with additional context about the +// field with the error. +func (s *errorState) shouldContinue(err error, prop *Properties) bool { + // Ignore unset required fields. + reqNotSet, ok := err.(*RequiredNotSetError) + if !ok { + return false + } + if s.err == nil { + if prop != nil { + err = &RequiredNotSetError{prop.Name + "." + reqNotSet.field} + } + s.err = err + } + return true +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/equal.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/equal.go new file mode 100644 index 00000000000..2ed1cf59666 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/equal.go @@ -0,0 +1,300 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2011 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +// Protocol buffer comparison. + +package proto + +import ( + "bytes" + "log" + "reflect" + "strings" +) + +/* +Equal returns true iff protocol buffers a and b are equal. +The arguments must both be pointers to protocol buffer structs. + +Equality is defined in this way: + - Two messages are equal iff they are the same type, + corresponding fields are equal, unknown field sets + are equal, and extensions sets are equal. + - Two set scalar fields are equal iff their values are equal. + If the fields are of a floating-point type, remember that + NaN != x for all x, including NaN. If the message is defined + in a proto3 .proto file, fields are not "set"; specifically, + zero length proto3 "bytes" fields are equal (nil == {}). + - Two repeated fields are equal iff their lengths are the same, + and their corresponding elements are equal. Note a "bytes" field, + although represented by []byte, is not a repeated field and the + rule for the scalar fields described above applies. + - Two unset fields are equal. + - Two unknown field sets are equal if their current + encoded state is equal. + - Two extension sets are equal iff they have corresponding + elements that are pairwise equal. + - Two map fields are equal iff their lengths are the same, + and they contain the same set of elements. Zero-length map + fields are equal. + - Every other combination of things are not equal. + +The return value is undefined if a and b are not protocol buffers. +*/ +func Equal(a, b Message) bool { + if a == nil || b == nil { + return a == b + } + v1, v2 := reflect.ValueOf(a), reflect.ValueOf(b) + if v1.Type() != v2.Type() { + return false + } + if v1.Kind() == reflect.Ptr { + if v1.IsNil() { + return v2.IsNil() + } + if v2.IsNil() { + return false + } + v1, v2 = v1.Elem(), v2.Elem() + } + if v1.Kind() != reflect.Struct { + return false + } + return equalStruct(v1, v2) +} + +// v1 and v2 are known to have the same type. +func equalStruct(v1, v2 reflect.Value) bool { + sprop := GetProperties(v1.Type()) + for i := 0; i < v1.NumField(); i++ { + f := v1.Type().Field(i) + if strings.HasPrefix(f.Name, "XXX_") { + continue + } + f1, f2 := v1.Field(i), v2.Field(i) + if f.Type.Kind() == reflect.Ptr { + if n1, n2 := f1.IsNil(), f2.IsNil(); n1 && n2 { + // both unset + continue + } else if n1 != n2 { + // set/unset mismatch + return false + } + b1, ok := f1.Interface().(raw) + if ok { + b2 := f2.Interface().(raw) + // RawMessage + if !bytes.Equal(b1.Bytes(), b2.Bytes()) { + return false + } + continue + } + f1, f2 = f1.Elem(), f2.Elem() + } + if !equalAny(f1, f2, sprop.Prop[i]) { + return false + } + } + + if em1 := v1.FieldByName("XXX_InternalExtensions"); em1.IsValid() { + em2 := v2.FieldByName("XXX_InternalExtensions") + if !equalExtensions(v1.Type(), em1.Interface().(XXX_InternalExtensions), em2.Interface().(XXX_InternalExtensions)) { + return false + } + } + + if em1 := v1.FieldByName("XXX_extensions"); em1.IsValid() { + em2 := v2.FieldByName("XXX_extensions") + if !equalExtMap(v1.Type(), em1.Interface().(map[int32]Extension), em2.Interface().(map[int32]Extension)) { + return false + } + } + + uf := v1.FieldByName("XXX_unrecognized") + if !uf.IsValid() { + return true + } + + u1 := uf.Bytes() + u2 := v2.FieldByName("XXX_unrecognized").Bytes() + if !bytes.Equal(u1, u2) { + return false + } + + return true +} + +// v1 and v2 are known to have the same type. +// prop may be nil. +func equalAny(v1, v2 reflect.Value, prop *Properties) bool { + if v1.Type() == protoMessageType { + m1, _ := v1.Interface().(Message) + m2, _ := v2.Interface().(Message) + return Equal(m1, m2) + } + switch v1.Kind() { + case reflect.Bool: + return v1.Bool() == v2.Bool() + case reflect.Float32, reflect.Float64: + return v1.Float() == v2.Float() + case reflect.Int32, reflect.Int64: + return v1.Int() == v2.Int() + case reflect.Interface: + // Probably a oneof field; compare the inner values. + n1, n2 := v1.IsNil(), v2.IsNil() + if n1 || n2 { + return n1 == n2 + } + e1, e2 := v1.Elem(), v2.Elem() + if e1.Type() != e2.Type() { + return false + } + return equalAny(e1, e2, nil) + case reflect.Map: + if v1.Len() != v2.Len() { + return false + } + for _, key := range v1.MapKeys() { + val2 := v2.MapIndex(key) + if !val2.IsValid() { + // This key was not found in the second map. + return false + } + if !equalAny(v1.MapIndex(key), val2, nil) { + return false + } + } + return true + case reflect.Ptr: + // Maps may have nil values in them, so check for nil. + if v1.IsNil() && v2.IsNil() { + return true + } + if v1.IsNil() != v2.IsNil() { + return false + } + return equalAny(v1.Elem(), v2.Elem(), prop) + case reflect.Slice: + if v1.Type().Elem().Kind() == reflect.Uint8 { + // short circuit: []byte + + // Edge case: if this is in a proto3 message, a zero length + // bytes field is considered the zero value. + if prop != nil && prop.proto3 && v1.Len() == 0 && v2.Len() == 0 { + return true + } + if v1.IsNil() != v2.IsNil() { + return false + } + return bytes.Equal(v1.Interface().([]byte), v2.Interface().([]byte)) + } + + if v1.Len() != v2.Len() { + return false + } + for i := 0; i < v1.Len(); i++ { + if !equalAny(v1.Index(i), v2.Index(i), prop) { + return false + } + } + return true + case reflect.String: + return v1.Interface().(string) == v2.Interface().(string) + case reflect.Struct: + return equalStruct(v1, v2) + case reflect.Uint32, reflect.Uint64: + return v1.Uint() == v2.Uint() + } + + // unknown type, so not a protocol buffer + log.Printf("proto: don't know how to compare %v", v1) + return false +} + +// base is the struct type that the extensions are based on. +// x1 and x2 are InternalExtensions. +func equalExtensions(base reflect.Type, x1, x2 XXX_InternalExtensions) bool { + em1, _ := x1.extensionsRead() + em2, _ := x2.extensionsRead() + return equalExtMap(base, em1, em2) +} + +func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool { + if len(em1) != len(em2) { + return false + } + + for extNum, e1 := range em1 { + e2, ok := em2[extNum] + if !ok { + return false + } + + m1, m2 := e1.value, e2.value + + if m1 != nil && m2 != nil { + // Both are unencoded. + if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { + return false + } + continue + } + + // At least one is encoded. To do a semantically correct comparison + // we need to unmarshal them first. + var desc *ExtensionDesc + if m := extensionMaps[base]; m != nil { + desc = m[extNum] + } + if desc == nil { + log.Printf("proto: don't know how to compare extension %d of %v", extNum, base) + continue + } + var err error + if m1 == nil { + m1, err = decodeExtension(e1.enc, desc) + } + if m2 == nil && err == nil { + m2, err = decodeExtension(e2.enc, desc) + } + if err != nil { + // The encoded form is invalid. + log.Printf("proto: badly encoded extension %d of %v: %v", extNum, base, err) + return false + } + if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { + return false + } + } + + return true +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/extensions.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/extensions.go new file mode 100644 index 00000000000..eaad2183126 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/extensions.go @@ -0,0 +1,587 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +package proto + +/* + * Types and routines for supporting protocol buffer extensions. + */ + +import ( + "errors" + "fmt" + "reflect" + "strconv" + "sync" +) + +// ErrMissingExtension is the error returned by GetExtension if the named extension is not in the message. +var ErrMissingExtension = errors.New("proto: missing extension") + +// ExtensionRange represents a range of message extensions for a protocol buffer. +// Used in code generated by the protocol compiler. +type ExtensionRange struct { + Start, End int32 // both inclusive +} + +// extendableProto is an interface implemented by any protocol buffer generated by the current +// proto compiler that may be extended. +type extendableProto interface { + Message + ExtensionRangeArray() []ExtensionRange + extensionsWrite() map[int32]Extension + extensionsRead() (map[int32]Extension, sync.Locker) +} + +// extendableProtoV1 is an interface implemented by a protocol buffer generated by the previous +// version of the proto compiler that may be extended. +type extendableProtoV1 interface { + Message + ExtensionRangeArray() []ExtensionRange + ExtensionMap() map[int32]Extension +} + +// extensionAdapter is a wrapper around extendableProtoV1 that implements extendableProto. +type extensionAdapter struct { + extendableProtoV1 +} + +func (e extensionAdapter) extensionsWrite() map[int32]Extension { + return e.ExtensionMap() +} + +func (e extensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) { + return e.ExtensionMap(), notLocker{} +} + +// notLocker is a sync.Locker whose Lock and Unlock methods are nops. +type notLocker struct{} + +func (n notLocker) Lock() {} +func (n notLocker) Unlock() {} + +// extendable returns the extendableProto interface for the given generated proto message. +// If the proto message has the old extension format, it returns a wrapper that implements +// the extendableProto interface. +func extendable(p interface{}) (extendableProto, bool) { + if ep, ok := p.(extendableProto); ok { + return ep, ok + } + if ep, ok := p.(extendableProtoV1); ok { + return extensionAdapter{ep}, ok + } + return nil, false +} + +// XXX_InternalExtensions is an internal representation of proto extensions. +// +// Each generated message struct type embeds an anonymous XXX_InternalExtensions field, +// thus gaining the unexported 'extensions' method, which can be called only from the proto package. +// +// The methods of XXX_InternalExtensions are not concurrency safe in general, +// but calls to logically read-only methods such as has and get may be executed concurrently. +type XXX_InternalExtensions struct { + // The struct must be indirect so that if a user inadvertently copies a + // generated message and its embedded XXX_InternalExtensions, they + // avoid the mayhem of a copied mutex. + // + // The mutex serializes all logically read-only operations to p.extensionMap. + // It is up to the client to ensure that write operations to p.extensionMap are + // mutually exclusive with other accesses. + p *struct { + mu sync.Mutex + extensionMap map[int32]Extension + } +} + +// extensionsWrite returns the extension map, creating it on first use. +func (e *XXX_InternalExtensions) extensionsWrite() map[int32]Extension { + if e.p == nil { + e.p = new(struct { + mu sync.Mutex + extensionMap map[int32]Extension + }) + e.p.extensionMap = make(map[int32]Extension) + } + return e.p.extensionMap +} + +// extensionsRead returns the extensions map for read-only use. It may be nil. +// The caller must hold the returned mutex's lock when accessing Elements within the map. +func (e *XXX_InternalExtensions) extensionsRead() (map[int32]Extension, sync.Locker) { + if e.p == nil { + return nil, nil + } + return e.p.extensionMap, &e.p.mu +} + +var extendableProtoType = reflect.TypeOf((*extendableProto)(nil)).Elem() +var extendableProtoV1Type = reflect.TypeOf((*extendableProtoV1)(nil)).Elem() + +// ExtensionDesc represents an extension specification. +// Used in generated code from the protocol compiler. +type ExtensionDesc struct { + ExtendedType Message // nil pointer to the type that is being extended + ExtensionType interface{} // nil pointer to the extension type + Field int32 // field number + Name string // fully-qualified name of extension, for text formatting + Tag string // protobuf tag style + Filename string // name of the file in which the extension is defined +} + +func (ed *ExtensionDesc) repeated() bool { + t := reflect.TypeOf(ed.ExtensionType) + return t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 +} + +// Extension represents an extension in a message. +type Extension struct { + // When an extension is stored in a message using SetExtension + // only desc and value are set. When the message is marshaled + // enc will be set to the encoded form of the message. + // + // When a message is unmarshaled and contains extensions, each + // extension will have only enc set. When such an extension is + // accessed using GetExtension (or GetExtensions) desc and value + // will be set. + desc *ExtensionDesc + value interface{} + enc []byte +} + +// SetRawExtension is for testing only. +func SetRawExtension(base Message, id int32, b []byte) { + epb, ok := extendable(base) + if !ok { + return + } + extmap := epb.extensionsWrite() + extmap[id] = Extension{enc: b} +} + +// isExtensionField returns true iff the given field number is in an extension range. +func isExtensionField(pb extendableProto, field int32) bool { + for _, er := range pb.ExtensionRangeArray() { + if er.Start <= field && field <= er.End { + return true + } + } + return false +} + +// checkExtensionTypes checks that the given extension is valid for pb. +func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error { + var pbi interface{} = pb + // Check the extended type. + if ea, ok := pbi.(extensionAdapter); ok { + pbi = ea.extendableProtoV1 + } + if a, b := reflect.TypeOf(pbi), reflect.TypeOf(extension.ExtendedType); a != b { + return errors.New("proto: bad extended type; " + b.String() + " does not extend " + a.String()) + } + // Check the range. + if !isExtensionField(pb, extension.Field) { + return errors.New("proto: bad extension number; not in declared ranges") + } + return nil +} + +// extPropKey is sufficient to uniquely identify an extension. +type extPropKey struct { + base reflect.Type + field int32 +} + +var extProp = struct { + sync.RWMutex + m map[extPropKey]*Properties +}{ + m: make(map[extPropKey]*Properties), +} + +func extensionProperties(ed *ExtensionDesc) *Properties { + key := extPropKey{base: reflect.TypeOf(ed.ExtendedType), field: ed.Field} + + extProp.RLock() + if prop, ok := extProp.m[key]; ok { + extProp.RUnlock() + return prop + } + extProp.RUnlock() + + extProp.Lock() + defer extProp.Unlock() + // Check again. + if prop, ok := extProp.m[key]; ok { + return prop + } + + prop := new(Properties) + prop.Init(reflect.TypeOf(ed.ExtensionType), "unknown_name", ed.Tag, nil) + extProp.m[key] = prop + return prop +} + +// encode encodes any unmarshaled (unencoded) extensions in e. +func encodeExtensions(e *XXX_InternalExtensions) error { + m, mu := e.extensionsRead() + if m == nil { + return nil // fast path + } + mu.Lock() + defer mu.Unlock() + return encodeExtensionsMap(m) +} + +// encode encodes any unmarshaled (unencoded) extensions in e. +func encodeExtensionsMap(m map[int32]Extension) error { + for k, e := range m { + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + et := reflect.TypeOf(e.desc.ExtensionType) + props := extensionProperties(e.desc) + + p := NewBuffer(nil) + // If e.value has type T, the encoder expects a *struct{ X T }. + // Pass a *T with a zero field and hope it all works out. + x := reflect.New(et) + x.Elem().Set(reflect.ValueOf(e.value)) + if err := props.enc(p, props, toStructPointer(x)); err != nil { + return err + } + e.enc = p.buf + m[k] = e + } + return nil +} + +func extensionsSize(e *XXX_InternalExtensions) (n int) { + m, mu := e.extensionsRead() + if m == nil { + return 0 + } + mu.Lock() + defer mu.Unlock() + return extensionsMapSize(m) +} + +func extensionsMapSize(m map[int32]Extension) (n int) { + for _, e := range m { + if e.value == nil || e.desc == nil { + // Extension is only in its encoded form. + n += len(e.enc) + continue + } + + // We don't skip extensions that have an encoded form set, + // because the extension value may have been mutated after + // the last time this function was called. + + et := reflect.TypeOf(e.desc.ExtensionType) + props := extensionProperties(e.desc) + + // If e.value has type T, the encoder expects a *struct{ X T }. + // Pass a *T with a zero field and hope it all works out. + x := reflect.New(et) + x.Elem().Set(reflect.ValueOf(e.value)) + n += props.size(props, toStructPointer(x)) + } + return +} + +// HasExtension returns whether the given extension is present in pb. +func HasExtension(pb Message, extension *ExtensionDesc) bool { + // TODO: Check types, field numbers, etc.? + epb, ok := extendable(pb) + if !ok { + return false + } + extmap, mu := epb.extensionsRead() + if extmap == nil { + return false + } + mu.Lock() + _, ok = extmap[extension.Field] + mu.Unlock() + return ok +} + +// ClearExtension removes the given extension from pb. +func ClearExtension(pb Message, extension *ExtensionDesc) { + epb, ok := extendable(pb) + if !ok { + return + } + // TODO: Check types, field numbers, etc.? + extmap := epb.extensionsWrite() + delete(extmap, extension.Field) +} + +// GetExtension parses and returns the given extension of pb. +// If the extension is not present and has no default value it returns ErrMissingExtension. +func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { + epb, ok := extendable(pb) + if !ok { + return nil, errors.New("proto: not an extendable proto") + } + + if err := checkExtensionTypes(epb, extension); err != nil { + return nil, err + } + + emap, mu := epb.extensionsRead() + if emap == nil { + return defaultExtensionValue(extension) + } + mu.Lock() + defer mu.Unlock() + e, ok := emap[extension.Field] + if !ok { + // defaultExtensionValue returns the default value or + // ErrMissingExtension if there is no default. + return defaultExtensionValue(extension) + } + + if e.value != nil { + // Already decoded. Check the descriptor, though. + if e.desc != extension { + // This shouldn't happen. If it does, it means that + // GetExtension was called twice with two different + // descriptors with the same field number. + return nil, errors.New("proto: descriptor conflict") + } + return e.value, nil + } + + v, err := decodeExtension(e.enc, extension) + if err != nil { + return nil, err + } + + // Remember the decoded version and drop the encoded version. + // That way it is safe to mutate what we return. + e.value = v + e.desc = extension + e.enc = nil + emap[extension.Field] = e + return e.value, nil +} + +// defaultExtensionValue returns the default value for extension. +// If no default for an extension is defined ErrMissingExtension is returned. +func defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) { + t := reflect.TypeOf(extension.ExtensionType) + props := extensionProperties(extension) + + sf, _, err := fieldDefault(t, props) + if err != nil { + return nil, err + } + + if sf == nil || sf.value == nil { + // There is no default value. + return nil, ErrMissingExtension + } + + if t.Kind() != reflect.Ptr { + // We do not need to return a Ptr, we can directly return sf.value. + return sf.value, nil + } + + // We need to return an interface{} that is a pointer to sf.value. + value := reflect.New(t).Elem() + value.Set(reflect.New(value.Type().Elem())) + if sf.kind == reflect.Int32 { + // We may have an int32 or an enum, but the underlying data is int32. + // Since we can't set an int32 into a non int32 reflect.value directly + // set it as a int32. + value.Elem().SetInt(int64(sf.value.(int32))) + } else { + value.Elem().Set(reflect.ValueOf(sf.value)) + } + return value.Interface(), nil +} + +// decodeExtension decodes an extension encoded in b. +func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) { + o := NewBuffer(b) + + t := reflect.TypeOf(extension.ExtensionType) + + props := extensionProperties(extension) + + // t is a pointer to a struct, pointer to basic type or a slice. + // Allocate a "field" to store the pointer/slice itself; the + // pointer/slice will be stored here. We pass + // the address of this field to props.dec. + // This passes a zero field and a *t and lets props.dec + // interpret it as a *struct{ x t }. + value := reflect.New(t).Elem() + + for { + // Discard wire type and field number varint. It isn't needed. + if _, err := o.DecodeVarint(); err != nil { + return nil, err + } + + if err := props.dec(o, props, toStructPointer(value.Addr())); err != nil { + return nil, err + } + + if o.index >= len(o.buf) { + break + } + } + return value.Interface(), nil +} + +// GetExtensions returns a slice of the extensions present in pb that are also listed in es. +// The returned slice has the same length as es; missing extensions will appear as nil elements. +func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) { + epb, ok := extendable(pb) + if !ok { + return nil, errors.New("proto: not an extendable proto") + } + extensions = make([]interface{}, len(es)) + for i, e := range es { + extensions[i], err = GetExtension(epb, e) + if err == ErrMissingExtension { + err = nil + } + if err != nil { + return + } + } + return +} + +// ExtensionDescs returns a new slice containing pb's extension descriptors, in undefined order. +// For non-registered extensions, ExtensionDescs returns an incomplete descriptor containing +// just the Field field, which defines the extension's field number. +func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) { + epb, ok := extendable(pb) + if !ok { + return nil, fmt.Errorf("proto: %T is not an extendable proto.Message", pb) + } + registeredExtensions := RegisteredExtensions(pb) + + emap, mu := epb.extensionsRead() + if emap == nil { + return nil, nil + } + mu.Lock() + defer mu.Unlock() + extensions := make([]*ExtensionDesc, 0, len(emap)) + for extid, e := range emap { + desc := e.desc + if desc == nil { + desc = registeredExtensions[extid] + if desc == nil { + desc = &ExtensionDesc{Field: extid} + } + } + + extensions = append(extensions, desc) + } + return extensions, nil +} + +// SetExtension sets the specified extension of pb to the specified value. +func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error { + epb, ok := extendable(pb) + if !ok { + return errors.New("proto: not an extendable proto") + } + if err := checkExtensionTypes(epb, extension); err != nil { + return err + } + typ := reflect.TypeOf(extension.ExtensionType) + if typ != reflect.TypeOf(value) { + return errors.New("proto: bad extension value type") + } + // nil extension values need to be caught early, because the + // encoder can't distinguish an ErrNil due to a nil extension + // from an ErrNil due to a missing field. Extensions are + // always optional, so the encoder would just swallow the error + // and drop all the extensions from the encoded message. + if reflect.ValueOf(value).IsNil() { + return fmt.Errorf("proto: SetExtension called with nil value of type %T", value) + } + + extmap := epb.extensionsWrite() + extmap[extension.Field] = Extension{desc: extension, value: value} + return nil +} + +// ClearAllExtensions clears all extensions from pb. +func ClearAllExtensions(pb Message) { + epb, ok := extendable(pb) + if !ok { + return + } + m := epb.extensionsWrite() + for k := range m { + delete(m, k) + } +} + +// A global registry of extensions. +// The generated code will register the generated descriptors by calling RegisterExtension. + +var extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc) + +// RegisterExtension is called from the generated code. +func RegisterExtension(desc *ExtensionDesc) { + st := reflect.TypeOf(desc.ExtendedType).Elem() + m := extensionMaps[st] + if m == nil { + m = make(map[int32]*ExtensionDesc) + extensionMaps[st] = m + } + if _, ok := m[desc.Field]; ok { + panic("proto: duplicate extension registered: " + st.String() + " " + strconv.Itoa(int(desc.Field))) + } + m[desc.Field] = desc +} + +// RegisteredExtensions returns a map of the registered extensions of a +// protocol buffer struct, indexed by the extension number. +// The argument pb should be a nil pointer to the struct type. +func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc { + return extensionMaps[reflect.TypeOf(pb).Elem()] +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/lib.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/lib.go new file mode 100644 index 00000000000..ac4ddbc0759 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/lib.go @@ -0,0 +1,898 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +/* +Package proto converts data structures to and from the wire format of +protocol buffers. It works in concert with the Go source code generated +for .proto files by the protocol compiler. + +A summary of the properties of the protocol buffer interface +for a protocol buffer variable v: + + - Names are turned from camel_case to CamelCase for export. + - There are no methods on v to set fields; just treat + them as structure fields. + - There are getters that return a field's value if set, + and return the field's default value if unset. + The getters work even if the receiver is a nil message. + - The zero value for a struct is its correct initialization state. + All desired fields must be set before marshaling. + - A Reset() method will restore a protobuf struct to its zero state. + - Non-repeated fields are pointers to the values; nil means unset. + That is, optional or required field int32 f becomes F *int32. + - Repeated fields are slices. + - Helper functions are available to aid the setting of fields. + msg.Foo = proto.String("hello") // set field + - Constants are defined to hold the default values of all fields that + have them. They have the form Default_StructName_FieldName. + Because the getter methods handle defaulted values, + direct use of these constants should be rare. + - Enums are given type names and maps from names to values. + Enum values are prefixed by the enclosing message's name, or by the + enum's type name if it is a top-level enum. Enum types have a String + method, and a Enum method to assist in message construction. + - Nested messages, groups and enums have type names prefixed with the name of + the surrounding message type. + - Extensions are given descriptor names that start with E_, + followed by an underscore-delimited list of the nested messages + that contain it (if any) followed by the CamelCased name of the + extension field itself. HasExtension, ClearExtension, GetExtension + and SetExtension are functions for manipulating extensions. + - Oneof field sets are given a single field in their message, + with distinguished wrapper types for each possible field value. + - Marshal and Unmarshal are functions to encode and decode the wire format. + +When the .proto file specifies `syntax="proto3"`, there are some differences: + + - Non-repeated fields of non-message type are values instead of pointers. + - Getters are only generated for message and oneof fields. + - Enum types do not get an Enum method. + +The simplest way to describe this is to see an example. +Given file test.proto, containing + + package example; + + enum FOO { X = 17; } + + message Test { + required string label = 1; + optional int32 type = 2 [default=77]; + repeated int64 reps = 3; + optional group OptionalGroup = 4 { + required string RequiredField = 5; + } + oneof union { + int32 number = 6; + string name = 7; + } + } + +The resulting file, test.pb.go, is: + + package example + + import proto "github.com/golang/protobuf/proto" + import math "math" + + type FOO int32 + const ( + FOO_X FOO = 17 + ) + var FOO_name = map[int32]string{ + 17: "X", + } + var FOO_value = map[string]int32{ + "X": 17, + } + + func (x FOO) Enum() *FOO { + p := new(FOO) + *p = x + return p + } + func (x FOO) String() string { + return proto.EnumName(FOO_name, int32(x)) + } + func (x *FOO) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FOO_value, data) + if err != nil { + return err + } + *x = FOO(value) + return nil + } + + type Test struct { + Label *string `protobuf:"bytes,1,req,name=label" json:"label,omitempty"` + Type *int32 `protobuf:"varint,2,opt,name=type,def=77" json:"type,omitempty"` + Reps []int64 `protobuf:"varint,3,rep,name=reps" json:"reps,omitempty"` + Optionalgroup *Test_OptionalGroup `protobuf:"group,4,opt,name=OptionalGroup" json:"optionalgroup,omitempty"` + // Types that are valid to be assigned to Union: + // *Test_Number + // *Test_Name + Union isTest_Union `protobuf_oneof:"union"` + XXX_unrecognized []byte `json:"-"` + } + func (m *Test) Reset() { *m = Test{} } + func (m *Test) String() string { return proto.CompactTextString(m) } + func (*Test) ProtoMessage() {} + + type isTest_Union interface { + isTest_Union() + } + + type Test_Number struct { + Number int32 `protobuf:"varint,6,opt,name=number"` + } + type Test_Name struct { + Name string `protobuf:"bytes,7,opt,name=name"` + } + + func (*Test_Number) isTest_Union() {} + func (*Test_Name) isTest_Union() {} + + func (m *Test) GetUnion() isTest_Union { + if m != nil { + return m.Union + } + return nil + } + const Default_Test_Type int32 = 77 + + func (m *Test) GetLabel() string { + if m != nil && m.Label != nil { + return *m.Label + } + return "" + } + + func (m *Test) GetType() int32 { + if m != nil && m.Type != nil { + return *m.Type + } + return Default_Test_Type + } + + func (m *Test) GetOptionalgroup() *Test_OptionalGroup { + if m != nil { + return m.Optionalgroup + } + return nil + } + + type Test_OptionalGroup struct { + RequiredField *string `protobuf:"bytes,5,req" json:"RequiredField,omitempty"` + } + func (m *Test_OptionalGroup) Reset() { *m = Test_OptionalGroup{} } + func (m *Test_OptionalGroup) String() string { return proto.CompactTextString(m) } + + func (m *Test_OptionalGroup) GetRequiredField() string { + if m != nil && m.RequiredField != nil { + return *m.RequiredField + } + return "" + } + + func (m *Test) GetNumber() int32 { + if x, ok := m.GetUnion().(*Test_Number); ok { + return x.Number + } + return 0 + } + + func (m *Test) GetName() string { + if x, ok := m.GetUnion().(*Test_Name); ok { + return x.Name + } + return "" + } + + func init() { + proto.RegisterEnum("example.FOO", FOO_name, FOO_value) + } + +To create and play with a Test object: + + package main + + import ( + "log" + + "github.com/golang/protobuf/proto" + pb "./example.pb" + ) + + func main() { + test := &pb.Test{ + Label: proto.String("hello"), + Type: proto.Int32(17), + Reps: []int64{1, 2, 3}, + Optionalgroup: &pb.Test_OptionalGroup{ + RequiredField: proto.String("good bye"), + }, + Union: &pb.Test_Name{"fred"}, + } + data, err := proto.Marshal(test) + if err != nil { + log.Fatal("marshaling error: ", err) + } + newTest := &pb.Test{} + err = proto.Unmarshal(data, newTest) + if err != nil { + log.Fatal("unmarshaling error: ", err) + } + // Now test and newTest contain the same data. + if test.GetLabel() != newTest.GetLabel() { + log.Fatalf("data mismatch %q != %q", test.GetLabel(), newTest.GetLabel()) + } + // Use a type switch to determine which oneof was set. + switch u := test.Union.(type) { + case *pb.Test_Number: // u.Number contains the number. + case *pb.Test_Name: // u.Name contains the string. + } + // etc. + } +*/ +package proto + +import ( + "encoding/json" + "fmt" + "log" + "reflect" + "sort" + "strconv" + "sync" +) + +// Message is implemented by generated protocol buffer messages. +type Message interface { + Reset() + String() string + ProtoMessage() +} + +// Stats records allocation details about the protocol buffer encoders +// and decoders. Useful for tuning the library itself. +type Stats struct { + Emalloc uint64 // mallocs in encode + Dmalloc uint64 // mallocs in decode + Encode uint64 // number of encodes + Decode uint64 // number of decodes + Chit uint64 // number of cache hits + Cmiss uint64 // number of cache misses + Size uint64 // number of sizes +} + +// Set to true to enable stats collection. +const collectStats = false + +var stats Stats + +// GetStats returns a copy of the global Stats structure. +func GetStats() Stats { return stats } + +// A Buffer is a buffer manager for marshaling and unmarshaling +// protocol buffers. It may be reused between invocations to +// reduce memory usage. It is not necessary to use a Buffer; +// the global functions Marshal and Unmarshal create a +// temporary Buffer and are fine for most applications. +type Buffer struct { + buf []byte // encode/decode byte stream + index int // read point + + // pools of basic types to amortize allocation. + bools []bool + uint32s []uint32 + uint64s []uint64 + + // extra pools, only used with pointer_reflect.go + int32s []int32 + int64s []int64 + float32s []float32 + float64s []float64 +} + +// NewBuffer allocates a new Buffer and initializes its internal data to +// the contents of the argument slice. +func NewBuffer(e []byte) *Buffer { + return &Buffer{buf: e} +} + +// Reset resets the Buffer, ready for marshaling a new protocol buffer. +func (p *Buffer) Reset() { + p.buf = p.buf[0:0] // for reading/writing + p.index = 0 // for reading +} + +// SetBuf replaces the internal buffer with the slice, +// ready for unmarshaling the contents of the slice. +func (p *Buffer) SetBuf(s []byte) { + p.buf = s + p.index = 0 +} + +// Bytes returns the contents of the Buffer. +func (p *Buffer) Bytes() []byte { return p.buf } + +/* + * Helper routines for simplifying the creation of optional fields of basic type. + */ + +// Bool is a helper routine that allocates a new bool value +// to store v and returns a pointer to it. +func Bool(v bool) *bool { + return &v +} + +// Int32 is a helper routine that allocates a new int32 value +// to store v and returns a pointer to it. +func Int32(v int32) *int32 { + return &v +} + +// Int is a helper routine that allocates a new int32 value +// to store v and returns a pointer to it, but unlike Int32 +// its argument value is an int. +func Int(v int) *int32 { + p := new(int32) + *p = int32(v) + return p +} + +// Int64 is a helper routine that allocates a new int64 value +// to store v and returns a pointer to it. +func Int64(v int64) *int64 { + return &v +} + +// Float32 is a helper routine that allocates a new float32 value +// to store v and returns a pointer to it. +func Float32(v float32) *float32 { + return &v +} + +// Float64 is a helper routine that allocates a new float64 value +// to store v and returns a pointer to it. +func Float64(v float64) *float64 { + return &v +} + +// Uint32 is a helper routine that allocates a new uint32 value +// to store v and returns a pointer to it. +func Uint32(v uint32) *uint32 { + return &v +} + +// Uint64 is a helper routine that allocates a new uint64 value +// to store v and returns a pointer to it. +func Uint64(v uint64) *uint64 { + return &v +} + +// String is a helper routine that allocates a new string value +// to store v and returns a pointer to it. +func String(v string) *string { + return &v +} + +// EnumName is a helper function to simplify printing protocol buffer enums +// by name. Given an enum map and a value, it returns a useful string. +func EnumName(m map[int32]string, v int32) string { + s, ok := m[v] + if ok { + return s + } + return strconv.Itoa(int(v)) +} + +// UnmarshalJSONEnum is a helper function to simplify recovering enum int values +// from their JSON-encoded representation. Given a map from the enum's symbolic +// names to its int values, and a byte buffer containing the JSON-encoded +// value, it returns an int32 that can be cast to the enum type by the caller. +// +// The function can deal with both JSON representations, numeric and symbolic. +func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) { + if data[0] == '"' { + // New style: enums are strings. + var repr string + if err := json.Unmarshal(data, &repr); err != nil { + return -1, err + } + val, ok := m[repr] + if !ok { + return 0, fmt.Errorf("unrecognized enum %s value %q", enumName, repr) + } + return val, nil + } + // Old style: enums are ints. + var val int32 + if err := json.Unmarshal(data, &val); err != nil { + return 0, fmt.Errorf("cannot unmarshal %#q into enum %s", data, enumName) + } + return val, nil +} + +// DebugPrint dumps the encoded data in b in a debugging format with a header +// including the string s. Used in testing but made available for general debugging. +func (p *Buffer) DebugPrint(s string, b []byte) { + var u uint64 + + obuf := p.buf + index := p.index + p.buf = b + p.index = 0 + depth := 0 + + fmt.Printf("\n--- %s ---\n", s) + +out: + for { + for i := 0; i < depth; i++ { + fmt.Print(" ") + } + + index := p.index + if index == len(p.buf) { + break + } + + op, err := p.DecodeVarint() + if err != nil { + fmt.Printf("%3d: fetching op err %v\n", index, err) + break out + } + tag := op >> 3 + wire := op & 7 + + switch wire { + default: + fmt.Printf("%3d: t=%3d unknown wire=%d\n", + index, tag, wire) + break out + + case WireBytes: + var r []byte + + r, err = p.DecodeRawBytes(false) + if err != nil { + break out + } + fmt.Printf("%3d: t=%3d bytes [%d]", index, tag, len(r)) + if len(r) <= 6 { + for i := 0; i < len(r); i++ { + fmt.Printf(" %.2x", r[i]) + } + } else { + for i := 0; i < 3; i++ { + fmt.Printf(" %.2x", r[i]) + } + fmt.Printf(" ..") + for i := len(r) - 3; i < len(r); i++ { + fmt.Printf(" %.2x", r[i]) + } + } + fmt.Printf("\n") + + case WireFixed32: + u, err = p.DecodeFixed32() + if err != nil { + fmt.Printf("%3d: t=%3d fix32 err %v\n", index, tag, err) + break out + } + fmt.Printf("%3d: t=%3d fix32 %d\n", index, tag, u) + + case WireFixed64: + u, err = p.DecodeFixed64() + if err != nil { + fmt.Printf("%3d: t=%3d fix64 err %v\n", index, tag, err) + break out + } + fmt.Printf("%3d: t=%3d fix64 %d\n", index, tag, u) + + case WireVarint: + u, err = p.DecodeVarint() + if err != nil { + fmt.Printf("%3d: t=%3d varint err %v\n", index, tag, err) + break out + } + fmt.Printf("%3d: t=%3d varint %d\n", index, tag, u) + + case WireStartGroup: + fmt.Printf("%3d: t=%3d start\n", index, tag) + depth++ + + case WireEndGroup: + depth-- + fmt.Printf("%3d: t=%3d end\n", index, tag) + } + } + + if depth != 0 { + fmt.Printf("%3d: start-end not balanced %d\n", p.index, depth) + } + fmt.Printf("\n") + + p.buf = obuf + p.index = index +} + +// SetDefaults sets unset protocol buffer fields to their default values. +// It only modifies fields that are both unset and have defined defaults. +// It recursively sets default values in any non-nil sub-messages. +func SetDefaults(pb Message) { + setDefaults(reflect.ValueOf(pb), true, false) +} + +// v is a pointer to a struct. +func setDefaults(v reflect.Value, recur, zeros bool) { + v = v.Elem() + + defaultMu.RLock() + dm, ok := defaults[v.Type()] + defaultMu.RUnlock() + if !ok { + dm = buildDefaultMessage(v.Type()) + defaultMu.Lock() + defaults[v.Type()] = dm + defaultMu.Unlock() + } + + for _, sf := range dm.scalars { + f := v.Field(sf.index) + if !f.IsNil() { + // field already set + continue + } + dv := sf.value + if dv == nil && !zeros { + // no explicit default, and don't want to set zeros + continue + } + fptr := f.Addr().Interface() // **T + // TODO: Consider batching the allocations we do here. + switch sf.kind { + case reflect.Bool: + b := new(bool) + if dv != nil { + *b = dv.(bool) + } + *(fptr.(**bool)) = b + case reflect.Float32: + f := new(float32) + if dv != nil { + *f = dv.(float32) + } + *(fptr.(**float32)) = f + case reflect.Float64: + f := new(float64) + if dv != nil { + *f = dv.(float64) + } + *(fptr.(**float64)) = f + case reflect.Int32: + // might be an enum + if ft := f.Type(); ft != int32PtrType { + // enum + f.Set(reflect.New(ft.Elem())) + if dv != nil { + f.Elem().SetInt(int64(dv.(int32))) + } + } else { + // int32 field + i := new(int32) + if dv != nil { + *i = dv.(int32) + } + *(fptr.(**int32)) = i + } + case reflect.Int64: + i := new(int64) + if dv != nil { + *i = dv.(int64) + } + *(fptr.(**int64)) = i + case reflect.String: + s := new(string) + if dv != nil { + *s = dv.(string) + } + *(fptr.(**string)) = s + case reflect.Uint8: + // exceptional case: []byte + var b []byte + if dv != nil { + db := dv.([]byte) + b = make([]byte, len(db)) + copy(b, db) + } else { + b = []byte{} + } + *(fptr.(*[]byte)) = b + case reflect.Uint32: + u := new(uint32) + if dv != nil { + *u = dv.(uint32) + } + *(fptr.(**uint32)) = u + case reflect.Uint64: + u := new(uint64) + if dv != nil { + *u = dv.(uint64) + } + *(fptr.(**uint64)) = u + default: + log.Printf("proto: can't set default for field %v (sf.kind=%v)", f, sf.kind) + } + } + + for _, ni := range dm.nested { + f := v.Field(ni) + // f is *T or []*T or map[T]*T + switch f.Kind() { + case reflect.Ptr: + if f.IsNil() { + continue + } + setDefaults(f, recur, zeros) + + case reflect.Slice: + for i := 0; i < f.Len(); i++ { + e := f.Index(i) + if e.IsNil() { + continue + } + setDefaults(e, recur, zeros) + } + + case reflect.Map: + for _, k := range f.MapKeys() { + e := f.MapIndex(k) + if e.IsNil() { + continue + } + setDefaults(e, recur, zeros) + } + } + } +} + +var ( + // defaults maps a protocol buffer struct type to a slice of the fields, + // with its scalar fields set to their proto-declared non-zero default values. + defaultMu sync.RWMutex + defaults = make(map[reflect.Type]defaultMessage) + + int32PtrType = reflect.TypeOf((*int32)(nil)) +) + +// defaultMessage represents information about the default values of a message. +type defaultMessage struct { + scalars []scalarField + nested []int // struct field index of nested messages +} + +type scalarField struct { + index int // struct field index + kind reflect.Kind // element type (the T in *T or []T) + value interface{} // the proto-declared default value, or nil +} + +// t is a struct type. +func buildDefaultMessage(t reflect.Type) (dm defaultMessage) { + sprop := GetProperties(t) + for _, prop := range sprop.Prop { + fi, ok := sprop.decoderTags.get(prop.Tag) + if !ok { + // XXX_unrecognized + continue + } + ft := t.Field(fi).Type + + sf, nested, err := fieldDefault(ft, prop) + switch { + case err != nil: + log.Print(err) + case nested: + dm.nested = append(dm.nested, fi) + case sf != nil: + sf.index = fi + dm.scalars = append(dm.scalars, *sf) + } + } + + return dm +} + +// fieldDefault returns the scalarField for field type ft. +// sf will be nil if the field can not have a default. +// nestedMessage will be true if this is a nested message. +// Note that sf.index is not set on return. +func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMessage bool, err error) { + var canHaveDefault bool + switch ft.Kind() { + case reflect.Ptr: + if ft.Elem().Kind() == reflect.Struct { + nestedMessage = true + } else { + canHaveDefault = true // proto2 scalar field + } + + case reflect.Slice: + switch ft.Elem().Kind() { + case reflect.Ptr: + nestedMessage = true // repeated message + case reflect.Uint8: + canHaveDefault = true // bytes field + } + + case reflect.Map: + if ft.Elem().Kind() == reflect.Ptr { + nestedMessage = true // map with message values + } + } + + if !canHaveDefault { + if nestedMessage { + return nil, true, nil + } + return nil, false, nil + } + + // We now know that ft is a pointer or slice. + sf = &scalarField{kind: ft.Elem().Kind()} + + // scalar fields without defaults + if !prop.HasDefault { + return sf, false, nil + } + + // a scalar field: either *T or []byte + switch ft.Elem().Kind() { + case reflect.Bool: + x, err := strconv.ParseBool(prop.Default) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default bool %q: %v", prop.Default, err) + } + sf.value = x + case reflect.Float32: + x, err := strconv.ParseFloat(prop.Default, 32) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default float32 %q: %v", prop.Default, err) + } + sf.value = float32(x) + case reflect.Float64: + x, err := strconv.ParseFloat(prop.Default, 64) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default float64 %q: %v", prop.Default, err) + } + sf.value = x + case reflect.Int32: + x, err := strconv.ParseInt(prop.Default, 10, 32) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default int32 %q: %v", prop.Default, err) + } + sf.value = int32(x) + case reflect.Int64: + x, err := strconv.ParseInt(prop.Default, 10, 64) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default int64 %q: %v", prop.Default, err) + } + sf.value = x + case reflect.String: + sf.value = prop.Default + case reflect.Uint8: + // []byte (not *uint8) + sf.value = []byte(prop.Default) + case reflect.Uint32: + x, err := strconv.ParseUint(prop.Default, 10, 32) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default uint32 %q: %v", prop.Default, err) + } + sf.value = uint32(x) + case reflect.Uint64: + x, err := strconv.ParseUint(prop.Default, 10, 64) + if err != nil { + return nil, false, fmt.Errorf("proto: bad default uint64 %q: %v", prop.Default, err) + } + sf.value = x + default: + return nil, false, fmt.Errorf("proto: unhandled def kind %v", ft.Elem().Kind()) + } + + return sf, false, nil +} + +// Map fields may have key types of non-float scalars, strings and enums. +// The easiest way to sort them in some deterministic order is to use fmt. +// If this turns out to be inefficient we can always consider other options, +// such as doing a Schwartzian transform. + +func mapKeys(vs []reflect.Value) sort.Interface { + s := mapKeySorter{ + vs: vs, + // default Less function: textual comparison + less: func(a, b reflect.Value) bool { + return fmt.Sprint(a.Interface()) < fmt.Sprint(b.Interface()) + }, + } + + // Type specialization per https://developers.google.com/protocol-buffers/docs/proto#maps; + // numeric keys are sorted numerically. + if len(vs) == 0 { + return s + } + switch vs[0].Kind() { + case reflect.Int32, reflect.Int64: + s.less = func(a, b reflect.Value) bool { return a.Int() < b.Int() } + case reflect.Uint32, reflect.Uint64: + s.less = func(a, b reflect.Value) bool { return a.Uint() < b.Uint() } + } + + return s +} + +type mapKeySorter struct { + vs []reflect.Value + less func(a, b reflect.Value) bool +} + +func (s mapKeySorter) Len() int { return len(s.vs) } +func (s mapKeySorter) Swap(i, j int) { s.vs[i], s.vs[j] = s.vs[j], s.vs[i] } +func (s mapKeySorter) Less(i, j int) bool { + return s.less(s.vs[i], s.vs[j]) +} + +// isProto3Zero reports whether v is a zero proto3 value. +func isProto3Zero(v reflect.Value) bool { + switch v.Kind() { + case reflect.Bool: + return !v.Bool() + case reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint32, reflect.Uint64: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.String: + return v.String() == "" + } + return false +} + +// ProtoPackageIsVersion2 is referenced from generated protocol buffer files +// to assert that that code is compatible with this version of the proto package. +const ProtoPackageIsVersion2 = true + +// ProtoPackageIsVersion1 is referenced from generated protocol buffer files +// to assert that that code is compatible with this version of the proto package. +const ProtoPackageIsVersion1 = true diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/message_set.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/message_set.go new file mode 100644 index 00000000000..fd982decd66 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/message_set.go @@ -0,0 +1,311 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +package proto + +/* + * Support for message sets. + */ + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "reflect" + "sort" +) + +// errNoMessageTypeID occurs when a protocol buffer does not have a message type ID. +// A message type ID is required for storing a protocol buffer in a message set. +var errNoMessageTypeID = errors.New("proto does not have a message type ID") + +// The first two types (_MessageSet_Item and messageSet) +// model what the protocol compiler produces for the following protocol message: +// message MessageSet { +// repeated group Item = 1 { +// required int32 type_id = 2; +// required string message = 3; +// }; +// } +// That is the MessageSet wire format. We can't use a proto to generate these +// because that would introduce a circular dependency between it and this package. + +type _MessageSet_Item struct { + TypeId *int32 `protobuf:"varint,2,req,name=type_id"` + Message []byte `protobuf:"bytes,3,req,name=message"` +} + +type messageSet struct { + Item []*_MessageSet_Item `protobuf:"group,1,rep"` + XXX_unrecognized []byte + // TODO: caching? +} + +// Make sure messageSet is a Message. +var _ Message = (*messageSet)(nil) + +// messageTypeIder is an interface satisfied by a protocol buffer type +// that may be stored in a MessageSet. +type messageTypeIder interface { + MessageTypeId() int32 +} + +func (ms *messageSet) find(pb Message) *_MessageSet_Item { + mti, ok := pb.(messageTypeIder) + if !ok { + return nil + } + id := mti.MessageTypeId() + for _, item := range ms.Item { + if *item.TypeId == id { + return item + } + } + return nil +} + +func (ms *messageSet) Has(pb Message) bool { + if ms.find(pb) != nil { + return true + } + return false +} + +func (ms *messageSet) Unmarshal(pb Message) error { + if item := ms.find(pb); item != nil { + return Unmarshal(item.Message, pb) + } + if _, ok := pb.(messageTypeIder); !ok { + return errNoMessageTypeID + } + return nil // TODO: return error instead? +} + +func (ms *messageSet) Marshal(pb Message) error { + msg, err := Marshal(pb) + if err != nil { + return err + } + if item := ms.find(pb); item != nil { + // reuse existing item + item.Message = msg + return nil + } + + mti, ok := pb.(messageTypeIder) + if !ok { + return errNoMessageTypeID + } + + mtid := mti.MessageTypeId() + ms.Item = append(ms.Item, &_MessageSet_Item{ + TypeId: &mtid, + Message: msg, + }) + return nil +} + +func (ms *messageSet) Reset() { *ms = messageSet{} } +func (ms *messageSet) String() string { return CompactTextString(ms) } +func (*messageSet) ProtoMessage() {} + +// Support for the message_set_wire_format message option. + +func skipVarint(buf []byte) []byte { + i := 0 + for ; buf[i]&0x80 != 0; i++ { + } + return buf[i+1:] +} + +// MarshalMessageSet encodes the extension map represented by m in the message set wire format. +// It is called by generated Marshal methods on protocol buffer messages with the message_set_wire_format option. +func MarshalMessageSet(exts interface{}) ([]byte, error) { + var m map[int32]Extension + switch exts := exts.(type) { + case *XXX_InternalExtensions: + if err := encodeExtensions(exts); err != nil { + return nil, err + } + m, _ = exts.extensionsRead() + case map[int32]Extension: + if err := encodeExtensionsMap(exts); err != nil { + return nil, err + } + m = exts + default: + return nil, errors.New("proto: not an extension map") + } + + // Sort extension IDs to provide a deterministic encoding. + // See also enc_map in encode.go. + ids := make([]int, 0, len(m)) + for id := range m { + ids = append(ids, int(id)) + } + sort.Ints(ids) + + ms := &messageSet{Item: make([]*_MessageSet_Item, 0, len(m))} + for _, id := range ids { + e := m[int32(id)] + // Remove the wire type and field number varint, as well as the length varint. + msg := skipVarint(skipVarint(e.enc)) + + ms.Item = append(ms.Item, &_MessageSet_Item{ + TypeId: Int32(int32(id)), + Message: msg, + }) + } + return Marshal(ms) +} + +// UnmarshalMessageSet decodes the extension map encoded in buf in the message set wire format. +// It is called by generated Unmarshal methods on protocol buffer messages with the message_set_wire_format option. +func UnmarshalMessageSet(buf []byte, exts interface{}) error { + var m map[int32]Extension + switch exts := exts.(type) { + case *XXX_InternalExtensions: + m = exts.extensionsWrite() + case map[int32]Extension: + m = exts + default: + return errors.New("proto: not an extension map") + } + + ms := new(messageSet) + if err := Unmarshal(buf, ms); err != nil { + return err + } + for _, item := range ms.Item { + id := *item.TypeId + msg := item.Message + + // Restore wire type and field number varint, plus length varint. + // Be careful to preserve duplicate items. + b := EncodeVarint(uint64(id)<<3 | WireBytes) + if ext, ok := m[id]; ok { + // Existing data; rip off the tag and length varint + // so we join the new data correctly. + // We can assume that ext.enc is set because we are unmarshaling. + o := ext.enc[len(b):] // skip wire type and field number + _, n := DecodeVarint(o) // calculate length of length varint + o = o[n:] // skip length varint + msg = append(o, msg...) // join old data and new data + } + b = append(b, EncodeVarint(uint64(len(msg)))...) + b = append(b, msg...) + + m[id] = Extension{enc: b} + } + return nil +} + +// MarshalMessageSetJSON encodes the extension map represented by m in JSON format. +// It is called by generated MarshalJSON methods on protocol buffer messages with the message_set_wire_format option. +func MarshalMessageSetJSON(exts interface{}) ([]byte, error) { + var m map[int32]Extension + switch exts := exts.(type) { + case *XXX_InternalExtensions: + m, _ = exts.extensionsRead() + case map[int32]Extension: + m = exts + default: + return nil, errors.New("proto: not an extension map") + } + var b bytes.Buffer + b.WriteByte('{') + + // Process the map in key order for deterministic output. + ids := make([]int32, 0, len(m)) + for id := range m { + ids = append(ids, id) + } + sort.Sort(int32Slice(ids)) // int32Slice defined in text.go + + for i, id := range ids { + ext := m[id] + if i > 0 { + b.WriteByte(',') + } + + msd, ok := messageSetMap[id] + if !ok { + // Unknown type; we can't render it, so skip it. + continue + } + fmt.Fprintf(&b, `"[%s]":`, msd.name) + + x := ext.value + if x == nil { + x = reflect.New(msd.t.Elem()).Interface() + if err := Unmarshal(ext.enc, x.(Message)); err != nil { + return nil, err + } + } + d, err := json.Marshal(x) + if err != nil { + return nil, err + } + b.Write(d) + } + b.WriteByte('}') + return b.Bytes(), nil +} + +// UnmarshalMessageSetJSON decodes the extension map encoded in buf in JSON format. +// It is called by generated UnmarshalJSON methods on protocol buffer messages with the message_set_wire_format option. +func UnmarshalMessageSetJSON(buf []byte, exts interface{}) error { + // Common-case fast path. + if len(buf) == 0 || bytes.Equal(buf, []byte("{}")) { + return nil + } + + // This is fairly tricky, and it's not clear that it is needed. + return errors.New("TODO: UnmarshalMessageSetJSON not yet implemented") +} + +// A global registry of types that can be used in a MessageSet. + +var messageSetMap = make(map[int32]messageSetDesc) + +type messageSetDesc struct { + t reflect.Type // pointer to struct + name string +} + +// RegisterMessageSetType is called from the generated code. +func RegisterMessageSetType(m Message, fieldNum int32, name string) { + messageSetMap[fieldNum] = messageSetDesc{ + t: reflect.TypeOf(m), + name: name, + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/pointer_reflect.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/pointer_reflect.go new file mode 100644 index 00000000000..fb512e2e16d --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/pointer_reflect.go @@ -0,0 +1,484 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2012 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +// +build appengine js + +// This file contains an implementation of proto field accesses using package reflect. +// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can +// be used on App Engine. + +package proto + +import ( + "math" + "reflect" +) + +// A structPointer is a pointer to a struct. +type structPointer struct { + v reflect.Value +} + +// toStructPointer returns a structPointer equivalent to the given reflect value. +// The reflect value must itself be a pointer to a struct. +func toStructPointer(v reflect.Value) structPointer { + return structPointer{v} +} + +// IsNil reports whether p is nil. +func structPointer_IsNil(p structPointer) bool { + return p.v.IsNil() +} + +// Interface returns the struct pointer as an interface value. +func structPointer_Interface(p structPointer, _ reflect.Type) interface{} { + return p.v.Interface() +} + +// A field identifies a field in a struct, accessible from a structPointer. +// In this implementation, a field is identified by the sequence of field indices +// passed to reflect's FieldByIndex. +type field []int + +// toField returns a field equivalent to the given reflect field. +func toField(f *reflect.StructField) field { + return f.Index +} + +// invalidField is an invalid field identifier. +var invalidField = field(nil) + +// IsValid reports whether the field identifier is valid. +func (f field) IsValid() bool { return f != nil } + +// field returns the given field in the struct as a reflect value. +func structPointer_field(p structPointer, f field) reflect.Value { + // Special case: an extension map entry with a value of type T + // passes a *T to the struct-handling code with a zero field, + // expecting that it will be treated as equivalent to *struct{ X T }, + // which has the same memory layout. We have to handle that case + // specially, because reflect will panic if we call FieldByIndex on a + // non-struct. + if f == nil { + return p.v.Elem() + } + + return p.v.Elem().FieldByIndex(f) +} + +// ifield returns the given field in the struct as an interface value. +func structPointer_ifield(p structPointer, f field) interface{} { + return structPointer_field(p, f).Addr().Interface() +} + +// Bytes returns the address of a []byte field in the struct. +func structPointer_Bytes(p structPointer, f field) *[]byte { + return structPointer_ifield(p, f).(*[]byte) +} + +// BytesSlice returns the address of a [][]byte field in the struct. +func structPointer_BytesSlice(p structPointer, f field) *[][]byte { + return structPointer_ifield(p, f).(*[][]byte) +} + +// Bool returns the address of a *bool field in the struct. +func structPointer_Bool(p structPointer, f field) **bool { + return structPointer_ifield(p, f).(**bool) +} + +// BoolVal returns the address of a bool field in the struct. +func structPointer_BoolVal(p structPointer, f field) *bool { + return structPointer_ifield(p, f).(*bool) +} + +// BoolSlice returns the address of a []bool field in the struct. +func structPointer_BoolSlice(p structPointer, f field) *[]bool { + return structPointer_ifield(p, f).(*[]bool) +} + +// String returns the address of a *string field in the struct. +func structPointer_String(p structPointer, f field) **string { + return structPointer_ifield(p, f).(**string) +} + +// StringVal returns the address of a string field in the struct. +func structPointer_StringVal(p structPointer, f field) *string { + return structPointer_ifield(p, f).(*string) +} + +// StringSlice returns the address of a []string field in the struct. +func structPointer_StringSlice(p structPointer, f field) *[]string { + return structPointer_ifield(p, f).(*[]string) +} + +// Extensions returns the address of an extension map field in the struct. +func structPointer_Extensions(p structPointer, f field) *XXX_InternalExtensions { + return structPointer_ifield(p, f).(*XXX_InternalExtensions) +} + +// ExtMap returns the address of an extension map field in the struct. +func structPointer_ExtMap(p structPointer, f field) *map[int32]Extension { + return structPointer_ifield(p, f).(*map[int32]Extension) +} + +// NewAt returns the reflect.Value for a pointer to a field in the struct. +func structPointer_NewAt(p structPointer, f field, typ reflect.Type) reflect.Value { + return structPointer_field(p, f).Addr() +} + +// SetStructPointer writes a *struct field in the struct. +func structPointer_SetStructPointer(p structPointer, f field, q structPointer) { + structPointer_field(p, f).Set(q.v) +} + +// GetStructPointer reads a *struct field in the struct. +func structPointer_GetStructPointer(p structPointer, f field) structPointer { + return structPointer{structPointer_field(p, f)} +} + +// StructPointerSlice the address of a []*struct field in the struct. +func structPointer_StructPointerSlice(p structPointer, f field) structPointerSlice { + return structPointerSlice{structPointer_field(p, f)} +} + +// A structPointerSlice represents the address of a slice of pointers to structs +// (themselves messages or groups). That is, v.Type() is *[]*struct{...}. +type structPointerSlice struct { + v reflect.Value +} + +func (p structPointerSlice) Len() int { return p.v.Len() } +func (p structPointerSlice) Index(i int) structPointer { return structPointer{p.v.Index(i)} } +func (p structPointerSlice) Append(q structPointer) { + p.v.Set(reflect.Append(p.v, q.v)) +} + +var ( + int32Type = reflect.TypeOf(int32(0)) + uint32Type = reflect.TypeOf(uint32(0)) + float32Type = reflect.TypeOf(float32(0)) + int64Type = reflect.TypeOf(int64(0)) + uint64Type = reflect.TypeOf(uint64(0)) + float64Type = reflect.TypeOf(float64(0)) +) + +// A word32 represents a field of type *int32, *uint32, *float32, or *enum. +// That is, v.Type() is *int32, *uint32, *float32, or *enum and v is assignable. +type word32 struct { + v reflect.Value +} + +// IsNil reports whether p is nil. +func word32_IsNil(p word32) bool { + return p.v.IsNil() +} + +// Set sets p to point at a newly allocated word with bits set to x. +func word32_Set(p word32, o *Buffer, x uint32) { + t := p.v.Type().Elem() + switch t { + case int32Type: + if len(o.int32s) == 0 { + o.int32s = make([]int32, uint32PoolSize) + } + o.int32s[0] = int32(x) + p.v.Set(reflect.ValueOf(&o.int32s[0])) + o.int32s = o.int32s[1:] + return + case uint32Type: + if len(o.uint32s) == 0 { + o.uint32s = make([]uint32, uint32PoolSize) + } + o.uint32s[0] = x + p.v.Set(reflect.ValueOf(&o.uint32s[0])) + o.uint32s = o.uint32s[1:] + return + case float32Type: + if len(o.float32s) == 0 { + o.float32s = make([]float32, uint32PoolSize) + } + o.float32s[0] = math.Float32frombits(x) + p.v.Set(reflect.ValueOf(&o.float32s[0])) + o.float32s = o.float32s[1:] + return + } + + // must be enum + p.v.Set(reflect.New(t)) + p.v.Elem().SetInt(int64(int32(x))) +} + +// Get gets the bits pointed at by p, as a uint32. +func word32_Get(p word32) uint32 { + elem := p.v.Elem() + switch elem.Kind() { + case reflect.Int32: + return uint32(elem.Int()) + case reflect.Uint32: + return uint32(elem.Uint()) + case reflect.Float32: + return math.Float32bits(float32(elem.Float())) + } + panic("unreachable") +} + +// Word32 returns a reference to a *int32, *uint32, *float32, or *enum field in the struct. +func structPointer_Word32(p structPointer, f field) word32 { + return word32{structPointer_field(p, f)} +} + +// A word32Val represents a field of type int32, uint32, float32, or enum. +// That is, v.Type() is int32, uint32, float32, or enum and v is assignable. +type word32Val struct { + v reflect.Value +} + +// Set sets *p to x. +func word32Val_Set(p word32Val, x uint32) { + switch p.v.Type() { + case int32Type: + p.v.SetInt(int64(x)) + return + case uint32Type: + p.v.SetUint(uint64(x)) + return + case float32Type: + p.v.SetFloat(float64(math.Float32frombits(x))) + return + } + + // must be enum + p.v.SetInt(int64(int32(x))) +} + +// Get gets the bits pointed at by p, as a uint32. +func word32Val_Get(p word32Val) uint32 { + elem := p.v + switch elem.Kind() { + case reflect.Int32: + return uint32(elem.Int()) + case reflect.Uint32: + return uint32(elem.Uint()) + case reflect.Float32: + return math.Float32bits(float32(elem.Float())) + } + panic("unreachable") +} + +// Word32Val returns a reference to a int32, uint32, float32, or enum field in the struct. +func structPointer_Word32Val(p structPointer, f field) word32Val { + return word32Val{structPointer_field(p, f)} +} + +// A word32Slice is a slice of 32-bit values. +// That is, v.Type() is []int32, []uint32, []float32, or []enum. +type word32Slice struct { + v reflect.Value +} + +func (p word32Slice) Append(x uint32) { + n, m := p.v.Len(), p.v.Cap() + if n < m { + p.v.SetLen(n + 1) + } else { + t := p.v.Type().Elem() + p.v.Set(reflect.Append(p.v, reflect.Zero(t))) + } + elem := p.v.Index(n) + switch elem.Kind() { + case reflect.Int32: + elem.SetInt(int64(int32(x))) + case reflect.Uint32: + elem.SetUint(uint64(x)) + case reflect.Float32: + elem.SetFloat(float64(math.Float32frombits(x))) + } +} + +func (p word32Slice) Len() int { + return p.v.Len() +} + +func (p word32Slice) Index(i int) uint32 { + elem := p.v.Index(i) + switch elem.Kind() { + case reflect.Int32: + return uint32(elem.Int()) + case reflect.Uint32: + return uint32(elem.Uint()) + case reflect.Float32: + return math.Float32bits(float32(elem.Float())) + } + panic("unreachable") +} + +// Word32Slice returns a reference to a []int32, []uint32, []float32, or []enum field in the struct. +func structPointer_Word32Slice(p structPointer, f field) word32Slice { + return word32Slice{structPointer_field(p, f)} +} + +// word64 is like word32 but for 64-bit values. +type word64 struct { + v reflect.Value +} + +func word64_Set(p word64, o *Buffer, x uint64) { + t := p.v.Type().Elem() + switch t { + case int64Type: + if len(o.int64s) == 0 { + o.int64s = make([]int64, uint64PoolSize) + } + o.int64s[0] = int64(x) + p.v.Set(reflect.ValueOf(&o.int64s[0])) + o.int64s = o.int64s[1:] + return + case uint64Type: + if len(o.uint64s) == 0 { + o.uint64s = make([]uint64, uint64PoolSize) + } + o.uint64s[0] = x + p.v.Set(reflect.ValueOf(&o.uint64s[0])) + o.uint64s = o.uint64s[1:] + return + case float64Type: + if len(o.float64s) == 0 { + o.float64s = make([]float64, uint64PoolSize) + } + o.float64s[0] = math.Float64frombits(x) + p.v.Set(reflect.ValueOf(&o.float64s[0])) + o.float64s = o.float64s[1:] + return + } + panic("unreachable") +} + +func word64_IsNil(p word64) bool { + return p.v.IsNil() +} + +func word64_Get(p word64) uint64 { + elem := p.v.Elem() + switch elem.Kind() { + case reflect.Int64: + return uint64(elem.Int()) + case reflect.Uint64: + return elem.Uint() + case reflect.Float64: + return math.Float64bits(elem.Float()) + } + panic("unreachable") +} + +func structPointer_Word64(p structPointer, f field) word64 { + return word64{structPointer_field(p, f)} +} + +// word64Val is like word32Val but for 64-bit values. +type word64Val struct { + v reflect.Value +} + +func word64Val_Set(p word64Val, o *Buffer, x uint64) { + switch p.v.Type() { + case int64Type: + p.v.SetInt(int64(x)) + return + case uint64Type: + p.v.SetUint(x) + return + case float64Type: + p.v.SetFloat(math.Float64frombits(x)) + return + } + panic("unreachable") +} + +func word64Val_Get(p word64Val) uint64 { + elem := p.v + switch elem.Kind() { + case reflect.Int64: + return uint64(elem.Int()) + case reflect.Uint64: + return elem.Uint() + case reflect.Float64: + return math.Float64bits(elem.Float()) + } + panic("unreachable") +} + +func structPointer_Word64Val(p structPointer, f field) word64Val { + return word64Val{structPointer_field(p, f)} +} + +type word64Slice struct { + v reflect.Value +} + +func (p word64Slice) Append(x uint64) { + n, m := p.v.Len(), p.v.Cap() + if n < m { + p.v.SetLen(n + 1) + } else { + t := p.v.Type().Elem() + p.v.Set(reflect.Append(p.v, reflect.Zero(t))) + } + elem := p.v.Index(n) + switch elem.Kind() { + case reflect.Int64: + elem.SetInt(int64(int64(x))) + case reflect.Uint64: + elem.SetUint(uint64(x)) + case reflect.Float64: + elem.SetFloat(float64(math.Float64frombits(x))) + } +} + +func (p word64Slice) Len() int { + return p.v.Len() +} + +func (p word64Slice) Index(i int) uint64 { + elem := p.v.Index(i) + switch elem.Kind() { + case reflect.Int64: + return uint64(elem.Int()) + case reflect.Uint64: + return uint64(elem.Uint()) + case reflect.Float64: + return math.Float64bits(float64(elem.Float())) + } + panic("unreachable") +} + +func structPointer_Word64Slice(p structPointer, f field) word64Slice { + return word64Slice{structPointer_field(p, f)} +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/pointer_unsafe.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/pointer_unsafe.go new file mode 100644 index 00000000000..6b5567d47cd --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/pointer_unsafe.go @@ -0,0 +1,270 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2012 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +// +build !appengine,!js + +// This file contains the implementation of the proto field accesses using package unsafe. + +package proto + +import ( + "reflect" + "unsafe" +) + +// NOTE: These type_Foo functions would more idiomatically be methods, +// but Go does not allow methods on pointer types, and we must preserve +// some pointer type for the garbage collector. We use these +// funcs with clunky names as our poor approximation to methods. +// +// An alternative would be +// type structPointer struct { p unsafe.Pointer } +// but that does not registerize as well. + +// A structPointer is a pointer to a struct. +type structPointer unsafe.Pointer + +// toStructPointer returns a structPointer equivalent to the given reflect value. +func toStructPointer(v reflect.Value) structPointer { + return structPointer(unsafe.Pointer(v.Pointer())) +} + +// IsNil reports whether p is nil. +func structPointer_IsNil(p structPointer) bool { + return p == nil +} + +// Interface returns the struct pointer, assumed to have element type t, +// as an interface value. +func structPointer_Interface(p structPointer, t reflect.Type) interface{} { + return reflect.NewAt(t, unsafe.Pointer(p)).Interface() +} + +// A field identifies a field in a struct, accessible from a structPointer. +// In this implementation, a field is identified by its byte offset from the start of the struct. +type field uintptr + +// toField returns a field equivalent to the given reflect field. +func toField(f *reflect.StructField) field { + return field(f.Offset) +} + +// invalidField is an invalid field identifier. +const invalidField = ^field(0) + +// IsValid reports whether the field identifier is valid. +func (f field) IsValid() bool { + return f != ^field(0) +} + +// Bytes returns the address of a []byte field in the struct. +func structPointer_Bytes(p structPointer, f field) *[]byte { + return (*[]byte)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// BytesSlice returns the address of a [][]byte field in the struct. +func structPointer_BytesSlice(p structPointer, f field) *[][]byte { + return (*[][]byte)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// Bool returns the address of a *bool field in the struct. +func structPointer_Bool(p structPointer, f field) **bool { + return (**bool)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// BoolVal returns the address of a bool field in the struct. +func structPointer_BoolVal(p structPointer, f field) *bool { + return (*bool)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// BoolSlice returns the address of a []bool field in the struct. +func structPointer_BoolSlice(p structPointer, f field) *[]bool { + return (*[]bool)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// String returns the address of a *string field in the struct. +func structPointer_String(p structPointer, f field) **string { + return (**string)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// StringVal returns the address of a string field in the struct. +func structPointer_StringVal(p structPointer, f field) *string { + return (*string)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// StringSlice returns the address of a []string field in the struct. +func structPointer_StringSlice(p structPointer, f field) *[]string { + return (*[]string)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// ExtMap returns the address of an extension map field in the struct. +func structPointer_Extensions(p structPointer, f field) *XXX_InternalExtensions { + return (*XXX_InternalExtensions)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +func structPointer_ExtMap(p structPointer, f field) *map[int32]Extension { + return (*map[int32]Extension)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// NewAt returns the reflect.Value for a pointer to a field in the struct. +func structPointer_NewAt(p structPointer, f field, typ reflect.Type) reflect.Value { + return reflect.NewAt(typ, unsafe.Pointer(uintptr(p)+uintptr(f))) +} + +// SetStructPointer writes a *struct field in the struct. +func structPointer_SetStructPointer(p structPointer, f field, q structPointer) { + *(*structPointer)(unsafe.Pointer(uintptr(p) + uintptr(f))) = q +} + +// GetStructPointer reads a *struct field in the struct. +func structPointer_GetStructPointer(p structPointer, f field) structPointer { + return *(*structPointer)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// StructPointerSlice the address of a []*struct field in the struct. +func structPointer_StructPointerSlice(p structPointer, f field) *structPointerSlice { + return (*structPointerSlice)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// A structPointerSlice represents a slice of pointers to structs (themselves submessages or groups). +type structPointerSlice []structPointer + +func (v *structPointerSlice) Len() int { return len(*v) } +func (v *structPointerSlice) Index(i int) structPointer { return (*v)[i] } +func (v *structPointerSlice) Append(p structPointer) { *v = append(*v, p) } + +// A word32 is the address of a "pointer to 32-bit value" field. +type word32 **uint32 + +// IsNil reports whether *v is nil. +func word32_IsNil(p word32) bool { + return *p == nil +} + +// Set sets *v to point at a newly allocated word set to x. +func word32_Set(p word32, o *Buffer, x uint32) { + if len(o.uint32s) == 0 { + o.uint32s = make([]uint32, uint32PoolSize) + } + o.uint32s[0] = x + *p = &o.uint32s[0] + o.uint32s = o.uint32s[1:] +} + +// Get gets the value pointed at by *v. +func word32_Get(p word32) uint32 { + return **p +} + +// Word32 returns the address of a *int32, *uint32, *float32, or *enum field in the struct. +func structPointer_Word32(p structPointer, f field) word32 { + return word32((**uint32)(unsafe.Pointer(uintptr(p) + uintptr(f)))) +} + +// A word32Val is the address of a 32-bit value field. +type word32Val *uint32 + +// Set sets *p to x. +func word32Val_Set(p word32Val, x uint32) { + *p = x +} + +// Get gets the value pointed at by p. +func word32Val_Get(p word32Val) uint32 { + return *p +} + +// Word32Val returns the address of a *int32, *uint32, *float32, or *enum field in the struct. +func structPointer_Word32Val(p structPointer, f field) word32Val { + return word32Val((*uint32)(unsafe.Pointer(uintptr(p) + uintptr(f)))) +} + +// A word32Slice is a slice of 32-bit values. +type word32Slice []uint32 + +func (v *word32Slice) Append(x uint32) { *v = append(*v, x) } +func (v *word32Slice) Len() int { return len(*v) } +func (v *word32Slice) Index(i int) uint32 { return (*v)[i] } + +// Word32Slice returns the address of a []int32, []uint32, []float32, or []enum field in the struct. +func structPointer_Word32Slice(p structPointer, f field) *word32Slice { + return (*word32Slice)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} + +// word64 is like word32 but for 64-bit values. +type word64 **uint64 + +func word64_Set(p word64, o *Buffer, x uint64) { + if len(o.uint64s) == 0 { + o.uint64s = make([]uint64, uint64PoolSize) + } + o.uint64s[0] = x + *p = &o.uint64s[0] + o.uint64s = o.uint64s[1:] +} + +func word64_IsNil(p word64) bool { + return *p == nil +} + +func word64_Get(p word64) uint64 { + return **p +} + +func structPointer_Word64(p structPointer, f field) word64 { + return word64((**uint64)(unsafe.Pointer(uintptr(p) + uintptr(f)))) +} + +// word64Val is like word32Val but for 64-bit values. +type word64Val *uint64 + +func word64Val_Set(p word64Val, o *Buffer, x uint64) { + *p = x +} + +func word64Val_Get(p word64Val) uint64 { + return *p +} + +func structPointer_Word64Val(p structPointer, f field) word64Val { + return word64Val((*uint64)(unsafe.Pointer(uintptr(p) + uintptr(f)))) +} + +// word64Slice is like word32Slice but for 64-bit values. +type word64Slice []uint64 + +func (v *word64Slice) Append(x uint64) { *v = append(*v, x) } +func (v *word64Slice) Len() int { return len(*v) } +func (v *word64Slice) Index(i int) uint64 { return (*v)[i] } + +func structPointer_Word64Slice(p structPointer, f field) *word64Slice { + return (*word64Slice)(unsafe.Pointer(uintptr(p) + uintptr(f))) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/properties.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/properties.go new file mode 100644 index 00000000000..ec2289c0058 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/properties.go @@ -0,0 +1,872 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +package proto + +/* + * Routines for encoding data into the wire format for protocol buffers. + */ + +import ( + "fmt" + "log" + "os" + "reflect" + "sort" + "strconv" + "strings" + "sync" +) + +const debug bool = false + +// Constants that identify the encoding of a value on the wire. +const ( + WireVarint = 0 + WireFixed64 = 1 + WireBytes = 2 + WireStartGroup = 3 + WireEndGroup = 4 + WireFixed32 = 5 +) + +const startSize = 10 // initial slice/string sizes + +// Encoders are defined in encode.go +// An encoder outputs the full representation of a field, including its +// tag and encoder type. +type encoder func(p *Buffer, prop *Properties, base structPointer) error + +// A valueEncoder encodes a single integer in a particular encoding. +type valueEncoder func(o *Buffer, x uint64) error + +// Sizers are defined in encode.go +// A sizer returns the encoded size of a field, including its tag and encoder +// type. +type sizer func(prop *Properties, base structPointer) int + +// A valueSizer returns the encoded size of a single integer in a particular +// encoding. +type valueSizer func(x uint64) int + +// Decoders are defined in decode.go +// A decoder creates a value from its wire representation. +// Unrecognized subelements are saved in unrec. +type decoder func(p *Buffer, prop *Properties, base structPointer) error + +// A valueDecoder decodes a single integer in a particular encoding. +type valueDecoder func(o *Buffer) (x uint64, err error) + +// A oneofMarshaler does the marshaling for all oneof fields in a message. +type oneofMarshaler func(Message, *Buffer) error + +// A oneofUnmarshaler does the unmarshaling for a oneof field in a message. +type oneofUnmarshaler func(Message, int, int, *Buffer) (bool, error) + +// A oneofSizer does the sizing for all oneof fields in a message. +type oneofSizer func(Message) int + +// tagMap is an optimization over map[int]int for typical protocol buffer +// use-cases. Encoded protocol buffers are often in tag order with small tag +// numbers. +type tagMap struct { + fastTags []int + slowTags map[int]int +} + +// tagMapFastLimit is the upper bound on the tag number that will be stored in +// the tagMap slice rather than its map. +const tagMapFastLimit = 1024 + +func (p *tagMap) get(t int) (int, bool) { + if t > 0 && t < tagMapFastLimit { + if t >= len(p.fastTags) { + return 0, false + } + fi := p.fastTags[t] + return fi, fi >= 0 + } + fi, ok := p.slowTags[t] + return fi, ok +} + +func (p *tagMap) put(t int, fi int) { + if t > 0 && t < tagMapFastLimit { + for len(p.fastTags) < t+1 { + p.fastTags = append(p.fastTags, -1) + } + p.fastTags[t] = fi + return + } + if p.slowTags == nil { + p.slowTags = make(map[int]int) + } + p.slowTags[t] = fi +} + +// StructProperties represents properties for all the fields of a struct. +// decoderTags and decoderOrigNames should only be used by the decoder. +type StructProperties struct { + Prop []*Properties // properties for each field + reqCount int // required count + decoderTags tagMap // map from proto tag to struct field number + decoderOrigNames map[string]int // map from original name to struct field number + order []int // list of struct field numbers in tag order + unrecField field // field id of the XXX_unrecognized []byte field + extendable bool // is this an extendable proto + + oneofMarshaler oneofMarshaler + oneofUnmarshaler oneofUnmarshaler + oneofSizer oneofSizer + stype reflect.Type + + // OneofTypes contains information about the oneof fields in this message. + // It is keyed by the original name of a field. + OneofTypes map[string]*OneofProperties +} + +// OneofProperties represents information about a specific field in a oneof. +type OneofProperties struct { + Type reflect.Type // pointer to generated struct type for this oneof field + Field int // struct field number of the containing oneof in the message + Prop *Properties +} + +// Implement the sorting interface so we can sort the fields in tag order, as recommended by the spec. +// See encode.go, (*Buffer).enc_struct. + +func (sp *StructProperties) Len() int { return len(sp.order) } +func (sp *StructProperties) Less(i, j int) bool { + return sp.Prop[sp.order[i]].Tag < sp.Prop[sp.order[j]].Tag +} +func (sp *StructProperties) Swap(i, j int) { sp.order[i], sp.order[j] = sp.order[j], sp.order[i] } + +// Properties represents the protocol-specific behavior of a single struct field. +type Properties struct { + Name string // name of the field, for error messages + OrigName string // original name before protocol compiler (always set) + JSONName string // name to use for JSON; determined by protoc + Wire string + WireType int + Tag int + Required bool + Optional bool + Repeated bool + Packed bool // relevant for repeated primitives only + Enum string // set for enum types only + proto3 bool // whether this is known to be a proto3 field; set for []byte only + oneof bool // whether this is a oneof field + + Default string // default value + HasDefault bool // whether an explicit default was provided + def_uint64 uint64 + + enc encoder + valEnc valueEncoder // set for bool and numeric types only + field field + tagcode []byte // encoding of EncodeVarint((Tag<<3)|WireType) + tagbuf [8]byte + stype reflect.Type // set for struct types only + sprop *StructProperties // set for struct types only + isMarshaler bool + isUnmarshaler bool + + mtype reflect.Type // set for map types only + mkeyprop *Properties // set for map types only + mvalprop *Properties // set for map types only + + size sizer + valSize valueSizer // set for bool and numeric types only + + dec decoder + valDec valueDecoder // set for bool and numeric types only + + // If this is a packable field, this will be the decoder for the packed version of the field. + packedDec decoder +} + +// String formats the properties in the protobuf struct field tag style. +func (p *Properties) String() string { + s := p.Wire + s = "," + s += strconv.Itoa(p.Tag) + if p.Required { + s += ",req" + } + if p.Optional { + s += ",opt" + } + if p.Repeated { + s += ",rep" + } + if p.Packed { + s += ",packed" + } + s += ",name=" + p.OrigName + if p.JSONName != p.OrigName { + s += ",json=" + p.JSONName + } + if p.proto3 { + s += ",proto3" + } + if p.oneof { + s += ",oneof" + } + if len(p.Enum) > 0 { + s += ",enum=" + p.Enum + } + if p.HasDefault { + s += ",def=" + p.Default + } + return s +} + +// Parse populates p by parsing a string in the protobuf struct field tag style. +func (p *Properties) Parse(s string) { + // "bytes,49,opt,name=foo,def=hello!" + fields := strings.Split(s, ",") // breaks def=, but handled below. + if len(fields) < 2 { + fmt.Fprintf(os.Stderr, "proto: tag has too few fields: %q\n", s) + return + } + + p.Wire = fields[0] + switch p.Wire { + case "varint": + p.WireType = WireVarint + p.valEnc = (*Buffer).EncodeVarint + p.valDec = (*Buffer).DecodeVarint + p.valSize = sizeVarint + case "fixed32": + p.WireType = WireFixed32 + p.valEnc = (*Buffer).EncodeFixed32 + p.valDec = (*Buffer).DecodeFixed32 + p.valSize = sizeFixed32 + case "fixed64": + p.WireType = WireFixed64 + p.valEnc = (*Buffer).EncodeFixed64 + p.valDec = (*Buffer).DecodeFixed64 + p.valSize = sizeFixed64 + case "zigzag32": + p.WireType = WireVarint + p.valEnc = (*Buffer).EncodeZigzag32 + p.valDec = (*Buffer).DecodeZigzag32 + p.valSize = sizeZigzag32 + case "zigzag64": + p.WireType = WireVarint + p.valEnc = (*Buffer).EncodeZigzag64 + p.valDec = (*Buffer).DecodeZigzag64 + p.valSize = sizeZigzag64 + case "bytes", "group": + p.WireType = WireBytes + // no numeric converter for non-numeric types + default: + fmt.Fprintf(os.Stderr, "proto: tag has unknown wire type: %q\n", s) + return + } + + var err error + p.Tag, err = strconv.Atoi(fields[1]) + if err != nil { + return + } + + for i := 2; i < len(fields); i++ { + f := fields[i] + switch { + case f == "req": + p.Required = true + case f == "opt": + p.Optional = true + case f == "rep": + p.Repeated = true + case f == "packed": + p.Packed = true + case strings.HasPrefix(f, "name="): + p.OrigName = f[5:] + case strings.HasPrefix(f, "json="): + p.JSONName = f[5:] + case strings.HasPrefix(f, "enum="): + p.Enum = f[5:] + case f == "proto3": + p.proto3 = true + case f == "oneof": + p.oneof = true + case strings.HasPrefix(f, "def="): + p.HasDefault = true + p.Default = f[4:] // rest of string + if i+1 < len(fields) { + // Commas aren't escaped, and def is always last. + p.Default += "," + strings.Join(fields[i+1:], ",") + break + } + } + } +} + +func logNoSliceEnc(t1, t2 reflect.Type) { + fmt.Fprintf(os.Stderr, "proto: no slice oenc for %T = []%T\n", t1, t2) +} + +var protoMessageType = reflect.TypeOf((*Message)(nil)).Elem() + +// Initialize the fields for encoding and decoding. +func (p *Properties) setEncAndDec(typ reflect.Type, f *reflect.StructField, lockGetProp bool) { + p.enc = nil + p.dec = nil + p.size = nil + + switch t1 := typ; t1.Kind() { + default: + fmt.Fprintf(os.Stderr, "proto: no coders for %v\n", t1) + + // proto3 scalar types + + case reflect.Bool: + p.enc = (*Buffer).enc_proto3_bool + p.dec = (*Buffer).dec_proto3_bool + p.size = size_proto3_bool + case reflect.Int32: + p.enc = (*Buffer).enc_proto3_int32 + p.dec = (*Buffer).dec_proto3_int32 + p.size = size_proto3_int32 + case reflect.Uint32: + p.enc = (*Buffer).enc_proto3_uint32 + p.dec = (*Buffer).dec_proto3_int32 // can reuse + p.size = size_proto3_uint32 + case reflect.Int64, reflect.Uint64: + p.enc = (*Buffer).enc_proto3_int64 + p.dec = (*Buffer).dec_proto3_int64 + p.size = size_proto3_int64 + case reflect.Float32: + p.enc = (*Buffer).enc_proto3_uint32 // can just treat them as bits + p.dec = (*Buffer).dec_proto3_int32 + p.size = size_proto3_uint32 + case reflect.Float64: + p.enc = (*Buffer).enc_proto3_int64 // can just treat them as bits + p.dec = (*Buffer).dec_proto3_int64 + p.size = size_proto3_int64 + case reflect.String: + p.enc = (*Buffer).enc_proto3_string + p.dec = (*Buffer).dec_proto3_string + p.size = size_proto3_string + + case reflect.Ptr: + switch t2 := t1.Elem(); t2.Kind() { + default: + fmt.Fprintf(os.Stderr, "proto: no encoder function for %v -> %v\n", t1, t2) + break + case reflect.Bool: + p.enc = (*Buffer).enc_bool + p.dec = (*Buffer).dec_bool + p.size = size_bool + case reflect.Int32: + p.enc = (*Buffer).enc_int32 + p.dec = (*Buffer).dec_int32 + p.size = size_int32 + case reflect.Uint32: + p.enc = (*Buffer).enc_uint32 + p.dec = (*Buffer).dec_int32 // can reuse + p.size = size_uint32 + case reflect.Int64, reflect.Uint64: + p.enc = (*Buffer).enc_int64 + p.dec = (*Buffer).dec_int64 + p.size = size_int64 + case reflect.Float32: + p.enc = (*Buffer).enc_uint32 // can just treat them as bits + p.dec = (*Buffer).dec_int32 + p.size = size_uint32 + case reflect.Float64: + p.enc = (*Buffer).enc_int64 // can just treat them as bits + p.dec = (*Buffer).dec_int64 + p.size = size_int64 + case reflect.String: + p.enc = (*Buffer).enc_string + p.dec = (*Buffer).dec_string + p.size = size_string + case reflect.Struct: + p.stype = t1.Elem() + p.isMarshaler = isMarshaler(t1) + p.isUnmarshaler = isUnmarshaler(t1) + if p.Wire == "bytes" { + p.enc = (*Buffer).enc_struct_message + p.dec = (*Buffer).dec_struct_message + p.size = size_struct_message + } else { + p.enc = (*Buffer).enc_struct_group + p.dec = (*Buffer).dec_struct_group + p.size = size_struct_group + } + } + + case reflect.Slice: + switch t2 := t1.Elem(); t2.Kind() { + default: + logNoSliceEnc(t1, t2) + break + case reflect.Bool: + if p.Packed { + p.enc = (*Buffer).enc_slice_packed_bool + p.size = size_slice_packed_bool + } else { + p.enc = (*Buffer).enc_slice_bool + p.size = size_slice_bool + } + p.dec = (*Buffer).dec_slice_bool + p.packedDec = (*Buffer).dec_slice_packed_bool + case reflect.Int32: + if p.Packed { + p.enc = (*Buffer).enc_slice_packed_int32 + p.size = size_slice_packed_int32 + } else { + p.enc = (*Buffer).enc_slice_int32 + p.size = size_slice_int32 + } + p.dec = (*Buffer).dec_slice_int32 + p.packedDec = (*Buffer).dec_slice_packed_int32 + case reflect.Uint32: + if p.Packed { + p.enc = (*Buffer).enc_slice_packed_uint32 + p.size = size_slice_packed_uint32 + } else { + p.enc = (*Buffer).enc_slice_uint32 + p.size = size_slice_uint32 + } + p.dec = (*Buffer).dec_slice_int32 + p.packedDec = (*Buffer).dec_slice_packed_int32 + case reflect.Int64, reflect.Uint64: + if p.Packed { + p.enc = (*Buffer).enc_slice_packed_int64 + p.size = size_slice_packed_int64 + } else { + p.enc = (*Buffer).enc_slice_int64 + p.size = size_slice_int64 + } + p.dec = (*Buffer).dec_slice_int64 + p.packedDec = (*Buffer).dec_slice_packed_int64 + case reflect.Uint8: + p.dec = (*Buffer).dec_slice_byte + if p.proto3 { + p.enc = (*Buffer).enc_proto3_slice_byte + p.size = size_proto3_slice_byte + } else { + p.enc = (*Buffer).enc_slice_byte + p.size = size_slice_byte + } + case reflect.Float32, reflect.Float64: + switch t2.Bits() { + case 32: + // can just treat them as bits + if p.Packed { + p.enc = (*Buffer).enc_slice_packed_uint32 + p.size = size_slice_packed_uint32 + } else { + p.enc = (*Buffer).enc_slice_uint32 + p.size = size_slice_uint32 + } + p.dec = (*Buffer).dec_slice_int32 + p.packedDec = (*Buffer).dec_slice_packed_int32 + case 64: + // can just treat them as bits + if p.Packed { + p.enc = (*Buffer).enc_slice_packed_int64 + p.size = size_slice_packed_int64 + } else { + p.enc = (*Buffer).enc_slice_int64 + p.size = size_slice_int64 + } + p.dec = (*Buffer).dec_slice_int64 + p.packedDec = (*Buffer).dec_slice_packed_int64 + default: + logNoSliceEnc(t1, t2) + break + } + case reflect.String: + p.enc = (*Buffer).enc_slice_string + p.dec = (*Buffer).dec_slice_string + p.size = size_slice_string + case reflect.Ptr: + switch t3 := t2.Elem(); t3.Kind() { + default: + fmt.Fprintf(os.Stderr, "proto: no ptr oenc for %T -> %T -> %T\n", t1, t2, t3) + break + case reflect.Struct: + p.stype = t2.Elem() + p.isMarshaler = isMarshaler(t2) + p.isUnmarshaler = isUnmarshaler(t2) + if p.Wire == "bytes" { + p.enc = (*Buffer).enc_slice_struct_message + p.dec = (*Buffer).dec_slice_struct_message + p.size = size_slice_struct_message + } else { + p.enc = (*Buffer).enc_slice_struct_group + p.dec = (*Buffer).dec_slice_struct_group + p.size = size_slice_struct_group + } + } + case reflect.Slice: + switch t2.Elem().Kind() { + default: + fmt.Fprintf(os.Stderr, "proto: no slice elem oenc for %T -> %T -> %T\n", t1, t2, t2.Elem()) + break + case reflect.Uint8: + p.enc = (*Buffer).enc_slice_slice_byte + p.dec = (*Buffer).dec_slice_slice_byte + p.size = size_slice_slice_byte + } + } + + case reflect.Map: + p.enc = (*Buffer).enc_new_map + p.dec = (*Buffer).dec_new_map + p.size = size_new_map + + p.mtype = t1 + p.mkeyprop = &Properties{} + p.mkeyprop.init(reflect.PtrTo(p.mtype.Key()), "Key", f.Tag.Get("protobuf_key"), nil, lockGetProp) + p.mvalprop = &Properties{} + vtype := p.mtype.Elem() + if vtype.Kind() != reflect.Ptr && vtype.Kind() != reflect.Slice { + // The value type is not a message (*T) or bytes ([]byte), + // so we need encoders for the pointer to this type. + vtype = reflect.PtrTo(vtype) + } + p.mvalprop.init(vtype, "Value", f.Tag.Get("protobuf_val"), nil, lockGetProp) + } + + // precalculate tag code + wire := p.WireType + if p.Packed { + wire = WireBytes + } + x := uint32(p.Tag)<<3 | uint32(wire) + i := 0 + for i = 0; x > 127; i++ { + p.tagbuf[i] = 0x80 | uint8(x&0x7F) + x >>= 7 + } + p.tagbuf[i] = uint8(x) + p.tagcode = p.tagbuf[0 : i+1] + + if p.stype != nil { + if lockGetProp { + p.sprop = GetProperties(p.stype) + } else { + p.sprop = getPropertiesLocked(p.stype) + } + } +} + +var ( + marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem() + unmarshalerType = reflect.TypeOf((*Unmarshaler)(nil)).Elem() +) + +// isMarshaler reports whether type t implements Marshaler. +func isMarshaler(t reflect.Type) bool { + // We're checking for (likely) pointer-receiver methods + // so if t is not a pointer, something is very wrong. + // The calls above only invoke isMarshaler on pointer types. + if t.Kind() != reflect.Ptr { + panic("proto: misuse of isMarshaler") + } + return t.Implements(marshalerType) +} + +// isUnmarshaler reports whether type t implements Unmarshaler. +func isUnmarshaler(t reflect.Type) bool { + // We're checking for (likely) pointer-receiver methods + // so if t is not a pointer, something is very wrong. + // The calls above only invoke isUnmarshaler on pointer types. + if t.Kind() != reflect.Ptr { + panic("proto: misuse of isUnmarshaler") + } + return t.Implements(unmarshalerType) +} + +// Init populates the properties from a protocol buffer struct tag. +func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) { + p.init(typ, name, tag, f, true) +} + +func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructField, lockGetProp bool) { + // "bytes,49,opt,def=hello!" + p.Name = name + p.OrigName = name + if f != nil { + p.field = toField(f) + } + if tag == "" { + return + } + p.Parse(tag) + p.setEncAndDec(typ, f, lockGetProp) +} + +var ( + propertiesMu sync.RWMutex + propertiesMap = make(map[reflect.Type]*StructProperties) +) + +// GetProperties returns the list of properties for the type represented by t. +// t must represent a generated struct type of a protocol message. +func GetProperties(t reflect.Type) *StructProperties { + if t.Kind() != reflect.Struct { + panic("proto: type must have kind struct") + } + + // Most calls to GetProperties in a long-running program will be + // retrieving details for types we have seen before. + propertiesMu.RLock() + sprop, ok := propertiesMap[t] + propertiesMu.RUnlock() + if ok { + if collectStats { + stats.Chit++ + } + return sprop + } + + propertiesMu.Lock() + sprop = getPropertiesLocked(t) + propertiesMu.Unlock() + return sprop +} + +// getPropertiesLocked requires that propertiesMu is held. +func getPropertiesLocked(t reflect.Type) *StructProperties { + if prop, ok := propertiesMap[t]; ok { + if collectStats { + stats.Chit++ + } + return prop + } + if collectStats { + stats.Cmiss++ + } + + prop := new(StructProperties) + // in case of recursive protos, fill this in now. + propertiesMap[t] = prop + + // build properties + prop.extendable = reflect.PtrTo(t).Implements(extendableProtoType) || + reflect.PtrTo(t).Implements(extendableProtoV1Type) + prop.unrecField = invalidField + prop.Prop = make([]*Properties, t.NumField()) + prop.order = make([]int, t.NumField()) + + for i := 0; i < t.NumField(); i++ { + f := t.Field(i) + p := new(Properties) + name := f.Name + p.init(f.Type, name, f.Tag.Get("protobuf"), &f, false) + + if f.Name == "XXX_InternalExtensions" { // special case + p.enc = (*Buffer).enc_exts + p.dec = nil // not needed + p.size = size_exts + } else if f.Name == "XXX_extensions" { // special case + p.enc = (*Buffer).enc_map + p.dec = nil // not needed + p.size = size_map + } else if f.Name == "XXX_unrecognized" { // special case + prop.unrecField = toField(&f) + } + oneof := f.Tag.Get("protobuf_oneof") // special case + if oneof != "" { + // Oneof fields don't use the traditional protobuf tag. + p.OrigName = oneof + } + prop.Prop[i] = p + prop.order[i] = i + if debug { + print(i, " ", f.Name, " ", t.String(), " ") + if p.Tag > 0 { + print(p.String()) + } + print("\n") + } + if p.enc == nil && !strings.HasPrefix(f.Name, "XXX_") && oneof == "" { + fmt.Fprintln(os.Stderr, "proto: no encoder for", f.Name, f.Type.String(), "[GetProperties]") + } + } + + // Re-order prop.order. + sort.Sort(prop) + + type oneofMessage interface { + XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) + } + if om, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); ok { + var oots []interface{} + prop.oneofMarshaler, prop.oneofUnmarshaler, prop.oneofSizer, oots = om.XXX_OneofFuncs() + prop.stype = t + + // Interpret oneof metadata. + prop.OneofTypes = make(map[string]*OneofProperties) + for _, oot := range oots { + oop := &OneofProperties{ + Type: reflect.ValueOf(oot).Type(), // *T + Prop: new(Properties), + } + sft := oop.Type.Elem().Field(0) + oop.Prop.Name = sft.Name + oop.Prop.Parse(sft.Tag.Get("protobuf")) + // There will be exactly one interface field that + // this new value is assignable to. + for i := 0; i < t.NumField(); i++ { + f := t.Field(i) + if f.Type.Kind() != reflect.Interface { + continue + } + if !oop.Type.AssignableTo(f.Type) { + continue + } + oop.Field = i + break + } + prop.OneofTypes[oop.Prop.OrigName] = oop + } + } + + // build required counts + // build tags + reqCount := 0 + prop.decoderOrigNames = make(map[string]int) + for i, p := range prop.Prop { + if strings.HasPrefix(p.Name, "XXX_") { + // Internal fields should not appear in tags/origNames maps. + // They are handled specially when encoding and decoding. + continue + } + if p.Required { + reqCount++ + } + prop.decoderTags.put(p.Tag, i) + prop.decoderOrigNames[p.OrigName] = i + } + prop.reqCount = reqCount + + return prop +} + +// Return the Properties object for the x[0]'th field of the structure. +func propByIndex(t reflect.Type, x []int) *Properties { + if len(x) != 1 { + fmt.Fprintf(os.Stderr, "proto: field index dimension %d (not 1) for type %s\n", len(x), t) + return nil + } + prop := GetProperties(t) + return prop.Prop[x[0]] +} + +// Get the address and type of a pointer to a struct from an interface. +func getbase(pb Message) (t reflect.Type, b structPointer, err error) { + if pb == nil { + err = ErrNil + return + } + // get the reflect type of the pointer to the struct. + t = reflect.TypeOf(pb) + // get the address of the struct. + value := reflect.ValueOf(pb) + b = toStructPointer(value) + return +} + +// A global registry of enum types. +// The generated code will register the generated maps by calling RegisterEnum. + +var enumValueMaps = make(map[string]map[string]int32) + +// RegisterEnum is called from the generated code to install the enum descriptor +// maps into the global table to aid parsing text format protocol buffers. +func RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) { + if _, ok := enumValueMaps[typeName]; ok { + panic("proto: duplicate enum registered: " + typeName) + } + enumValueMaps[typeName] = valueMap +} + +// EnumValueMap returns the mapping from names to integers of the +// enum type enumType, or a nil if not found. +func EnumValueMap(enumType string) map[string]int32 { + return enumValueMaps[enumType] +} + +// A registry of all linked message types. +// The string is a fully-qualified proto name ("pkg.Message"). +var ( + protoTypes = make(map[string]reflect.Type) + revProtoTypes = make(map[reflect.Type]string) +) + +// RegisterType is called from generated code and maps from the fully qualified +// proto name to the type (pointer to struct) of the protocol buffer. +func RegisterType(x Message, name string) { + if _, ok := protoTypes[name]; ok { + // TODO: Some day, make this a panic. + log.Printf("proto: duplicate proto type registered: %s", name) + return + } + t := reflect.TypeOf(x) + protoTypes[name] = t + revProtoTypes[t] = name +} + +// MessageName returns the fully-qualified proto name for the given message type. +func MessageName(x Message) string { + type xname interface { + XXX_MessageName() string + } + if m, ok := x.(xname); ok { + return m.XXX_MessageName() + } + return revProtoTypes[reflect.TypeOf(x)] +} + +// MessageType returns the message type (pointer to struct) for a named message. +func MessageType(name string) reflect.Type { return protoTypes[name] } + +// A registry of all linked proto files. +var ( + protoFiles = make(map[string][]byte) // file name => fileDescriptor +) + +// RegisterFile is called from generated code and maps from the +// full file name of a .proto file to its compressed FileDescriptorProto. +func RegisterFile(filename string, fileDescriptor []byte) { + protoFiles[filename] = fileDescriptor +} + +// FileDescriptor returns the compressed FileDescriptorProto for a .proto file. +func FileDescriptor(filename string) []byte { return protoFiles[filename] } diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/text.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/text.go new file mode 100644 index 00000000000..965876bf033 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/text.go @@ -0,0 +1,854 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +package proto + +// Functions for writing the text protocol buffer format. + +import ( + "bufio" + "bytes" + "encoding" + "errors" + "fmt" + "io" + "log" + "math" + "reflect" + "sort" + "strings" +) + +var ( + newline = []byte("\n") + spaces = []byte(" ") + gtNewline = []byte(">\n") + endBraceNewline = []byte("}\n") + backslashN = []byte{'\\', 'n'} + backslashR = []byte{'\\', 'r'} + backslashT = []byte{'\\', 't'} + backslashDQ = []byte{'\\', '"'} + backslashBS = []byte{'\\', '\\'} + posInf = []byte("inf") + negInf = []byte("-inf") + nan = []byte("nan") +) + +type writer interface { + io.Writer + WriteByte(byte) error +} + +// textWriter is an io.Writer that tracks its indentation level. +type textWriter struct { + ind int + complete bool // if the current position is a complete line + compact bool // whether to write out as a one-liner + w writer +} + +func (w *textWriter) WriteString(s string) (n int, err error) { + if !strings.Contains(s, "\n") { + if !w.compact && w.complete { + w.writeIndent() + } + w.complete = false + return io.WriteString(w.w, s) + } + // WriteString is typically called without newlines, so this + // codepath and its copy are rare. We copy to avoid + // duplicating all of Write's logic here. + return w.Write([]byte(s)) +} + +func (w *textWriter) Write(p []byte) (n int, err error) { + newlines := bytes.Count(p, newline) + if newlines == 0 { + if !w.compact && w.complete { + w.writeIndent() + } + n, err = w.w.Write(p) + w.complete = false + return n, err + } + + frags := bytes.SplitN(p, newline, newlines+1) + if w.compact { + for i, frag := range frags { + if i > 0 { + if err := w.w.WriteByte(' '); err != nil { + return n, err + } + n++ + } + nn, err := w.w.Write(frag) + n += nn + if err != nil { + return n, err + } + } + return n, nil + } + + for i, frag := range frags { + if w.complete { + w.writeIndent() + } + nn, err := w.w.Write(frag) + n += nn + if err != nil { + return n, err + } + if i+1 < len(frags) { + if err := w.w.WriteByte('\n'); err != nil { + return n, err + } + n++ + } + } + w.complete = len(frags[len(frags)-1]) == 0 + return n, nil +} + +func (w *textWriter) WriteByte(c byte) error { + if w.compact && c == '\n' { + c = ' ' + } + if !w.compact && w.complete { + w.writeIndent() + } + err := w.w.WriteByte(c) + w.complete = c == '\n' + return err +} + +func (w *textWriter) indent() { w.ind++ } + +func (w *textWriter) unindent() { + if w.ind == 0 { + log.Print("proto: textWriter unindented too far") + return + } + w.ind-- +} + +func writeName(w *textWriter, props *Properties) error { + if _, err := w.WriteString(props.OrigName); err != nil { + return err + } + if props.Wire != "group" { + return w.WriteByte(':') + } + return nil +} + +// raw is the interface satisfied by RawMessage. +type raw interface { + Bytes() []byte +} + +func requiresQuotes(u string) bool { + // When type URL contains any characters except [0-9A-Za-z./\-]*, it must be quoted. + for _, ch := range u { + switch { + case ch == '.' || ch == '/' || ch == '_': + continue + case '0' <= ch && ch <= '9': + continue + case 'A' <= ch && ch <= 'Z': + continue + case 'a' <= ch && ch <= 'z': + continue + default: + return true + } + } + return false +} + +// isAny reports whether sv is a google.protobuf.Any message +func isAny(sv reflect.Value) bool { + type wkt interface { + XXX_WellKnownType() string + } + t, ok := sv.Addr().Interface().(wkt) + return ok && t.XXX_WellKnownType() == "Any" +} + +// writeProto3Any writes an expanded google.protobuf.Any message. +// +// It returns (false, nil) if sv value can't be unmarshaled (e.g. because +// required messages are not linked in). +// +// It returns (true, error) when sv was written in expanded format or an error +// was encountered. +func (tm *TextMarshaler) writeProto3Any(w *textWriter, sv reflect.Value) (bool, error) { + turl := sv.FieldByName("TypeUrl") + val := sv.FieldByName("Value") + if !turl.IsValid() || !val.IsValid() { + return true, errors.New("proto: invalid google.protobuf.Any message") + } + + b, ok := val.Interface().([]byte) + if !ok { + return true, errors.New("proto: invalid google.protobuf.Any message") + } + + parts := strings.Split(turl.String(), "/") + mt := MessageType(parts[len(parts)-1]) + if mt == nil { + return false, nil + } + m := reflect.New(mt.Elem()) + if err := Unmarshal(b, m.Interface().(Message)); err != nil { + return false, nil + } + w.Write([]byte("[")) + u := turl.String() + if requiresQuotes(u) { + writeString(w, u) + } else { + w.Write([]byte(u)) + } + if w.compact { + w.Write([]byte("]:<")) + } else { + w.Write([]byte("]: <\n")) + w.ind++ + } + if err := tm.writeStruct(w, m.Elem()); err != nil { + return true, err + } + if w.compact { + w.Write([]byte("> ")) + } else { + w.ind-- + w.Write([]byte(">\n")) + } + return true, nil +} + +func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { + if tm.ExpandAny && isAny(sv) { + if canExpand, err := tm.writeProto3Any(w, sv); canExpand { + return err + } + } + st := sv.Type() + sprops := GetProperties(st) + for i := 0; i < sv.NumField(); i++ { + fv := sv.Field(i) + props := sprops.Prop[i] + name := st.Field(i).Name + + if strings.HasPrefix(name, "XXX_") { + // There are two XXX_ fields: + // XXX_unrecognized []byte + // XXX_extensions map[int32]proto.Extension + // The first is handled here; + // the second is handled at the bottom of this function. + if name == "XXX_unrecognized" && !fv.IsNil() { + if err := writeUnknownStruct(w, fv.Interface().([]byte)); err != nil { + return err + } + } + continue + } + if fv.Kind() == reflect.Ptr && fv.IsNil() { + // Field not filled in. This could be an optional field or + // a required field that wasn't filled in. Either way, there + // isn't anything we can show for it. + continue + } + if fv.Kind() == reflect.Slice && fv.IsNil() { + // Repeated field that is empty, or a bytes field that is unused. + continue + } + + if props.Repeated && fv.Kind() == reflect.Slice { + // Repeated field. + for j := 0; j < fv.Len(); j++ { + if err := writeName(w, props); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + v := fv.Index(j) + if v.Kind() == reflect.Ptr && v.IsNil() { + // A nil message in a repeated field is not valid, + // but we can handle that more gracefully than panicking. + if _, err := w.Write([]byte("\n")); err != nil { + return err + } + continue + } + if err := tm.writeAny(w, v, props); err != nil { + return err + } + if err := w.WriteByte('\n'); err != nil { + return err + } + } + continue + } + if fv.Kind() == reflect.Map { + // Map fields are rendered as a repeated struct with key/value fields. + keys := fv.MapKeys() + sort.Sort(mapKeys(keys)) + for _, key := range keys { + val := fv.MapIndex(key) + if err := writeName(w, props); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + // open struct + if err := w.WriteByte('<'); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte('\n'); err != nil { + return err + } + } + w.indent() + // key + if _, err := w.WriteString("key:"); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + if err := tm.writeAny(w, key, props.mkeyprop); err != nil { + return err + } + if err := w.WriteByte('\n'); err != nil { + return err + } + // nil values aren't legal, but we can avoid panicking because of them. + if val.Kind() != reflect.Ptr || !val.IsNil() { + // value + if _, err := w.WriteString("value:"); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + if err := tm.writeAny(w, val, props.mvalprop); err != nil { + return err + } + if err := w.WriteByte('\n'); err != nil { + return err + } + } + // close struct + w.unindent() + if err := w.WriteByte('>'); err != nil { + return err + } + if err := w.WriteByte('\n'); err != nil { + return err + } + } + continue + } + if props.proto3 && fv.Kind() == reflect.Slice && fv.Len() == 0 { + // empty bytes field + continue + } + if fv.Kind() != reflect.Ptr && fv.Kind() != reflect.Slice { + // proto3 non-repeated scalar field; skip if zero value + if isProto3Zero(fv) { + continue + } + } + + if fv.Kind() == reflect.Interface { + // Check if it is a oneof. + if st.Field(i).Tag.Get("protobuf_oneof") != "" { + // fv is nil, or holds a pointer to generated struct. + // That generated struct has exactly one field, + // which has a protobuf struct tag. + if fv.IsNil() { + continue + } + inner := fv.Elem().Elem() // interface -> *T -> T + tag := inner.Type().Field(0).Tag.Get("protobuf") + props = new(Properties) // Overwrite the outer props var, but not its pointee. + props.Parse(tag) + // Write the value in the oneof, not the oneof itself. + fv = inner.Field(0) + + // Special case to cope with malformed messages gracefully: + // If the value in the oneof is a nil pointer, don't panic + // in writeAny. + if fv.Kind() == reflect.Ptr && fv.IsNil() { + // Use errors.New so writeAny won't render quotes. + msg := errors.New("/* nil */") + fv = reflect.ValueOf(&msg).Elem() + } + } + } + + if err := writeName(w, props); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + if b, ok := fv.Interface().(raw); ok { + if err := writeRaw(w, b.Bytes()); err != nil { + return err + } + continue + } + + // Enums have a String method, so writeAny will work fine. + if err := tm.writeAny(w, fv, props); err != nil { + return err + } + + if err := w.WriteByte('\n'); err != nil { + return err + } + } + + // Extensions (the XXX_extensions field). + pv := sv.Addr() + if _, ok := extendable(pv.Interface()); ok { + if err := tm.writeExtensions(w, pv); err != nil { + return err + } + } + + return nil +} + +// writeRaw writes an uninterpreted raw message. +func writeRaw(w *textWriter, b []byte) error { + if err := w.WriteByte('<'); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte('\n'); err != nil { + return err + } + } + w.indent() + if err := writeUnknownStruct(w, b); err != nil { + return err + } + w.unindent() + if err := w.WriteByte('>'); err != nil { + return err + } + return nil +} + +// writeAny writes an arbitrary field. +func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error { + v = reflect.Indirect(v) + + // Floats have special cases. + if v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 { + x := v.Float() + var b []byte + switch { + case math.IsInf(x, 1): + b = posInf + case math.IsInf(x, -1): + b = negInf + case math.IsNaN(x): + b = nan + } + if b != nil { + _, err := w.Write(b) + return err + } + // Other values are handled below. + } + + // We don't attempt to serialise every possible value type; only those + // that can occur in protocol buffers. + switch v.Kind() { + case reflect.Slice: + // Should only be a []byte; repeated fields are handled in writeStruct. + if err := writeString(w, string(v.Bytes())); err != nil { + return err + } + case reflect.String: + if err := writeString(w, v.String()); err != nil { + return err + } + case reflect.Struct: + // Required/optional group/message. + var bra, ket byte = '<', '>' + if props != nil && props.Wire == "group" { + bra, ket = '{', '}' + } + if err := w.WriteByte(bra); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte('\n'); err != nil { + return err + } + } + w.indent() + if etm, ok := v.Interface().(encoding.TextMarshaler); ok { + text, err := etm.MarshalText() + if err != nil { + return err + } + if _, err = w.Write(text); err != nil { + return err + } + } else if err := tm.writeStruct(w, v); err != nil { + return err + } + w.unindent() + if err := w.WriteByte(ket); err != nil { + return err + } + default: + _, err := fmt.Fprint(w, v.Interface()) + return err + } + return nil +} + +// equivalent to C's isprint. +func isprint(c byte) bool { + return c >= 0x20 && c < 0x7f +} + +// writeString writes a string in the protocol buffer text format. +// It is similar to strconv.Quote except we don't use Go escape sequences, +// we treat the string as a byte sequence, and we use octal escapes. +// These differences are to maintain interoperability with the other +// languages' implementations of the text format. +func writeString(w *textWriter, s string) error { + // use WriteByte here to get any needed indent + if err := w.WriteByte('"'); err != nil { + return err + } + // Loop over the bytes, not the runes. + for i := 0; i < len(s); i++ { + var err error + // Divergence from C++: we don't escape apostrophes. + // There's no need to escape them, and the C++ parser + // copes with a naked apostrophe. + switch c := s[i]; c { + case '\n': + _, err = w.w.Write(backslashN) + case '\r': + _, err = w.w.Write(backslashR) + case '\t': + _, err = w.w.Write(backslashT) + case '"': + _, err = w.w.Write(backslashDQ) + case '\\': + _, err = w.w.Write(backslashBS) + default: + if isprint(c) { + err = w.w.WriteByte(c) + } else { + _, err = fmt.Fprintf(w.w, "\\%03o", c) + } + } + if err != nil { + return err + } + } + return w.WriteByte('"') +} + +func writeUnknownStruct(w *textWriter, data []byte) (err error) { + if !w.compact { + if _, err := fmt.Fprintf(w, "/* %d unknown bytes */\n", len(data)); err != nil { + return err + } + } + b := NewBuffer(data) + for b.index < len(b.buf) { + x, err := b.DecodeVarint() + if err != nil { + _, err := fmt.Fprintf(w, "/* %v */\n", err) + return err + } + wire, tag := x&7, x>>3 + if wire == WireEndGroup { + w.unindent() + if _, err := w.Write(endBraceNewline); err != nil { + return err + } + continue + } + if _, err := fmt.Fprint(w, tag); err != nil { + return err + } + if wire != WireStartGroup { + if err := w.WriteByte(':'); err != nil { + return err + } + } + if !w.compact || wire == WireStartGroup { + if err := w.WriteByte(' '); err != nil { + return err + } + } + switch wire { + case WireBytes: + buf, e := b.DecodeRawBytes(false) + if e == nil { + _, err = fmt.Fprintf(w, "%q", buf) + } else { + _, err = fmt.Fprintf(w, "/* %v */", e) + } + case WireFixed32: + x, err = b.DecodeFixed32() + err = writeUnknownInt(w, x, err) + case WireFixed64: + x, err = b.DecodeFixed64() + err = writeUnknownInt(w, x, err) + case WireStartGroup: + err = w.WriteByte('{') + w.indent() + case WireVarint: + x, err = b.DecodeVarint() + err = writeUnknownInt(w, x, err) + default: + _, err = fmt.Fprintf(w, "/* unknown wire type %d */", wire) + } + if err != nil { + return err + } + if err = w.WriteByte('\n'); err != nil { + return err + } + } + return nil +} + +func writeUnknownInt(w *textWriter, x uint64, err error) error { + if err == nil { + _, err = fmt.Fprint(w, x) + } else { + _, err = fmt.Fprintf(w, "/* %v */", err) + } + return err +} + +type int32Slice []int32 + +func (s int32Slice) Len() int { return len(s) } +func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] } +func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } + +// writeExtensions writes all the extensions in pv. +// pv is assumed to be a pointer to a protocol message struct that is extendable. +func (tm *TextMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error { + emap := extensionMaps[pv.Type().Elem()] + ep, _ := extendable(pv.Interface()) + + // Order the extensions by ID. + // This isn't strictly necessary, but it will give us + // canonical output, which will also make testing easier. + m, mu := ep.extensionsRead() + if m == nil { + return nil + } + mu.Lock() + ids := make([]int32, 0, len(m)) + for id := range m { + ids = append(ids, id) + } + sort.Sort(int32Slice(ids)) + mu.Unlock() + + for _, extNum := range ids { + ext := m[extNum] + var desc *ExtensionDesc + if emap != nil { + desc = emap[extNum] + } + if desc == nil { + // Unknown extension. + if err := writeUnknownStruct(w, ext.enc); err != nil { + return err + } + continue + } + + pb, err := GetExtension(ep, desc) + if err != nil { + return fmt.Errorf("failed getting extension: %v", err) + } + + // Repeated extensions will appear as a slice. + if !desc.repeated() { + if err := tm.writeExtension(w, desc.Name, pb); err != nil { + return err + } + } else { + v := reflect.ValueOf(pb) + for i := 0; i < v.Len(); i++ { + if err := tm.writeExtension(w, desc.Name, v.Index(i).Interface()); err != nil { + return err + } + } + } + } + return nil +} + +func (tm *TextMarshaler) writeExtension(w *textWriter, name string, pb interface{}) error { + if _, err := fmt.Fprintf(w, "[%s]:", name); err != nil { + return err + } + if !w.compact { + if err := w.WriteByte(' '); err != nil { + return err + } + } + if err := tm.writeAny(w, reflect.ValueOf(pb), nil); err != nil { + return err + } + if err := w.WriteByte('\n'); err != nil { + return err + } + return nil +} + +func (w *textWriter) writeIndent() { + if !w.complete { + return + } + remain := w.ind * 2 + for remain > 0 { + n := remain + if n > len(spaces) { + n = len(spaces) + } + w.w.Write(spaces[:n]) + remain -= n + } + w.complete = false +} + +// TextMarshaler is a configurable text format marshaler. +type TextMarshaler struct { + Compact bool // use compact text format (one line). + ExpandAny bool // expand google.protobuf.Any messages of known types +} + +// Marshal writes a given protocol buffer in text format. +// The only errors returned are from w. +func (tm *TextMarshaler) Marshal(w io.Writer, pb Message) error { + val := reflect.ValueOf(pb) + if pb == nil || val.IsNil() { + w.Write([]byte("")) + return nil + } + var bw *bufio.Writer + ww, ok := w.(writer) + if !ok { + bw = bufio.NewWriter(w) + ww = bw + } + aw := &textWriter{ + w: ww, + complete: true, + compact: tm.Compact, + } + + if etm, ok := pb.(encoding.TextMarshaler); ok { + text, err := etm.MarshalText() + if err != nil { + return err + } + if _, err = aw.Write(text); err != nil { + return err + } + if bw != nil { + return bw.Flush() + } + return nil + } + // Dereference the received pointer so we don't have outer < and >. + v := reflect.Indirect(val) + if err := tm.writeStruct(aw, v); err != nil { + return err + } + if bw != nil { + return bw.Flush() + } + return nil +} + +// Text is the same as Marshal, but returns the string directly. +func (tm *TextMarshaler) Text(pb Message) string { + var buf bytes.Buffer + tm.Marshal(&buf, pb) + return buf.String() +} + +var ( + defaultTextMarshaler = TextMarshaler{} + compactTextMarshaler = TextMarshaler{Compact: true} +) + +// TODO: consider removing some of the Marshal functions below. + +// MarshalText writes a given protocol buffer in text format. +// The only errors returned are from w. +func MarshalText(w io.Writer, pb Message) error { return defaultTextMarshaler.Marshal(w, pb) } + +// MarshalTextString is the same as MarshalText, but returns the string directly. +func MarshalTextString(pb Message) string { return defaultTextMarshaler.Text(pb) } + +// CompactText writes a given protocol buffer in compact text format (one line). +func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Marshal(w, pb) } + +// CompactTextString is the same as CompactText, but returns the string directly. +func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) } diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/text_parser.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/text_parser.go new file mode 100644 index 00000000000..61f83c1e10f --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/text_parser.go @@ -0,0 +1,895 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +package proto + +// Functions for parsing the Text protocol buffer format. +// TODO: message sets. + +import ( + "encoding" + "errors" + "fmt" + "reflect" + "strconv" + "strings" + "unicode/utf8" +) + +// Error string emitted when deserializing Any and fields are already set +const anyRepeatedlyUnpacked = "Any message unpacked multiple times, or %q already set" + +type ParseError struct { + Message string + Line int // 1-based line number + Offset int // 0-based byte offset from start of input +} + +func (p *ParseError) Error() string { + if p.Line == 1 { + // show offset only for first line + return fmt.Sprintf("line 1.%d: %v", p.Offset, p.Message) + } + return fmt.Sprintf("line %d: %v", p.Line, p.Message) +} + +type token struct { + value string + err *ParseError + line int // line number + offset int // byte number from start of input, not start of line + unquoted string // the unquoted version of value, if it was a quoted string +} + +func (t *token) String() string { + if t.err == nil { + return fmt.Sprintf("%q (line=%d, offset=%d)", t.value, t.line, t.offset) + } + return fmt.Sprintf("parse error: %v", t.err) +} + +type textParser struct { + s string // remaining input + done bool // whether the parsing is finished (success or error) + backed bool // whether back() was called + offset, line int + cur token +} + +func newTextParser(s string) *textParser { + p := new(textParser) + p.s = s + p.line = 1 + p.cur.line = 1 + return p +} + +func (p *textParser) errorf(format string, a ...interface{}) *ParseError { + pe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset} + p.cur.err = pe + p.done = true + return pe +} + +// Numbers and identifiers are matched by [-+._A-Za-z0-9] +func isIdentOrNumberChar(c byte) bool { + switch { + case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z': + return true + case '0' <= c && c <= '9': + return true + } + switch c { + case '-', '+', '.', '_': + return true + } + return false +} + +func isWhitespace(c byte) bool { + switch c { + case ' ', '\t', '\n', '\r': + return true + } + return false +} + +func isQuote(c byte) bool { + switch c { + case '"', '\'': + return true + } + return false +} + +func (p *textParser) skipWhitespace() { + i := 0 + for i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') { + if p.s[i] == '#' { + // comment; skip to end of line or input + for i < len(p.s) && p.s[i] != '\n' { + i++ + } + if i == len(p.s) { + break + } + } + if p.s[i] == '\n' { + p.line++ + } + i++ + } + p.offset += i + p.s = p.s[i:len(p.s)] + if len(p.s) == 0 { + p.done = true + } +} + +func (p *textParser) advance() { + // Skip whitespace + p.skipWhitespace() + if p.done { + return + } + + // Start of non-whitespace + p.cur.err = nil + p.cur.offset, p.cur.line = p.offset, p.line + p.cur.unquoted = "" + switch p.s[0] { + case '<', '>', '{', '}', ':', '[', ']', ';', ',', '/': + // Single symbol + p.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)] + case '"', '\'': + // Quoted string + i := 1 + for i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\n' { + if p.s[i] == '\\' && i+1 < len(p.s) { + // skip escaped char + i++ + } + i++ + } + if i >= len(p.s) || p.s[i] != p.s[0] { + p.errorf("unmatched quote") + return + } + unq, err := unquoteC(p.s[1:i], rune(p.s[0])) + if err != nil { + p.errorf("invalid quoted string %s: %v", p.s[0:i+1], err) + return + } + p.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)] + p.cur.unquoted = unq + default: + i := 0 + for i < len(p.s) && isIdentOrNumberChar(p.s[i]) { + i++ + } + if i == 0 { + p.errorf("unexpected byte %#x", p.s[0]) + return + } + p.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)] + } + p.offset += len(p.cur.value) +} + +var ( + errBadUTF8 = errors.New("proto: bad UTF-8") + errBadHex = errors.New("proto: bad hexadecimal") +) + +func unquoteC(s string, quote rune) (string, error) { + // This is based on C++'s tokenizer.cc. + // Despite its name, this is *not* parsing C syntax. + // For instance, "\0" is an invalid quoted string. + + // Avoid allocation in trivial cases. + simple := true + for _, r := range s { + if r == '\\' || r == quote { + simple = false + break + } + } + if simple { + return s, nil + } + + buf := make([]byte, 0, 3*len(s)/2) + for len(s) > 0 { + r, n := utf8.DecodeRuneInString(s) + if r == utf8.RuneError && n == 1 { + return "", errBadUTF8 + } + s = s[n:] + if r != '\\' { + if r < utf8.RuneSelf { + buf = append(buf, byte(r)) + } else { + buf = append(buf, string(r)...) + } + continue + } + + ch, tail, err := unescape(s) + if err != nil { + return "", err + } + buf = append(buf, ch...) + s = tail + } + return string(buf), nil +} + +func unescape(s string) (ch string, tail string, err error) { + r, n := utf8.DecodeRuneInString(s) + if r == utf8.RuneError && n == 1 { + return "", "", errBadUTF8 + } + s = s[n:] + switch r { + case 'a': + return "\a", s, nil + case 'b': + return "\b", s, nil + case 'f': + return "\f", s, nil + case 'n': + return "\n", s, nil + case 'r': + return "\r", s, nil + case 't': + return "\t", s, nil + case 'v': + return "\v", s, nil + case '?': + return "?", s, nil // trigraph workaround + case '\'', '"', '\\': + return string(r), s, nil + case '0', '1', '2', '3', '4', '5', '6', '7', 'x', 'X': + if len(s) < 2 { + return "", "", fmt.Errorf(`\%c requires 2 following digits`, r) + } + base := 8 + ss := s[:2] + s = s[2:] + if r == 'x' || r == 'X' { + base = 16 + } else { + ss = string(r) + ss + } + i, err := strconv.ParseUint(ss, base, 8) + if err != nil { + return "", "", err + } + return string([]byte{byte(i)}), s, nil + case 'u', 'U': + n := 4 + if r == 'U' { + n = 8 + } + if len(s) < n { + return "", "", fmt.Errorf(`\%c requires %d digits`, r, n) + } + + bs := make([]byte, n/2) + for i := 0; i < n; i += 2 { + a, ok1 := unhex(s[i]) + b, ok2 := unhex(s[i+1]) + if !ok1 || !ok2 { + return "", "", errBadHex + } + bs[i/2] = a<<4 | b + } + s = s[n:] + return string(bs), s, nil + } + return "", "", fmt.Errorf(`unknown escape \%c`, r) +} + +// Adapted from src/pkg/strconv/quote.go. +func unhex(b byte) (v byte, ok bool) { + switch { + case '0' <= b && b <= '9': + return b - '0', true + case 'a' <= b && b <= 'f': + return b - 'a' + 10, true + case 'A' <= b && b <= 'F': + return b - 'A' + 10, true + } + return 0, false +} + +// Back off the parser by one token. Can only be done between calls to next(). +// It makes the next advance() a no-op. +func (p *textParser) back() { p.backed = true } + +// Advances the parser and returns the new current token. +func (p *textParser) next() *token { + if p.backed || p.done { + p.backed = false + return &p.cur + } + p.advance() + if p.done { + p.cur.value = "" + } else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) { + // Look for multiple quoted strings separated by whitespace, + // and concatenate them. + cat := p.cur + for { + p.skipWhitespace() + if p.done || !isQuote(p.s[0]) { + break + } + p.advance() + if p.cur.err != nil { + return &p.cur + } + cat.value += " " + p.cur.value + cat.unquoted += p.cur.unquoted + } + p.done = false // parser may have seen EOF, but we want to return cat + p.cur = cat + } + return &p.cur +} + +func (p *textParser) consumeToken(s string) error { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value != s { + p.back() + return p.errorf("expected %q, found %q", s, tok.value) + } + return nil +} + +// Return a RequiredNotSetError indicating which required field was not set. +func (p *textParser) missingRequiredFieldError(sv reflect.Value) *RequiredNotSetError { + st := sv.Type() + sprops := GetProperties(st) + for i := 0; i < st.NumField(); i++ { + if !isNil(sv.Field(i)) { + continue + } + + props := sprops.Prop[i] + if props.Required { + return &RequiredNotSetError{fmt.Sprintf("%v.%v", st, props.OrigName)} + } + } + return &RequiredNotSetError{fmt.Sprintf("%v.", st)} // should not happen +} + +// Returns the index in the struct for the named field, as well as the parsed tag properties. +func structFieldByName(sprops *StructProperties, name string) (int, *Properties, bool) { + i, ok := sprops.decoderOrigNames[name] + if ok { + return i, sprops.Prop[i], true + } + return -1, nil, false +} + +// Consume a ':' from the input stream (if the next token is a colon), +// returning an error if a colon is needed but not present. +func (p *textParser) checkForColon(props *Properties, typ reflect.Type) *ParseError { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value != ":" { + // Colon is optional when the field is a group or message. + needColon := true + switch props.Wire { + case "group": + needColon = false + case "bytes": + // A "bytes" field is either a message, a string, or a repeated field; + // those three become *T, *string and []T respectively, so we can check for + // this field being a pointer to a non-string. + if typ.Kind() == reflect.Ptr { + // *T or *string + if typ.Elem().Kind() == reflect.String { + break + } + } else if typ.Kind() == reflect.Slice { + // []T or []*T + if typ.Elem().Kind() != reflect.Ptr { + break + } + } else if typ.Kind() == reflect.String { + // The proto3 exception is for a string field, + // which requires a colon. + break + } + needColon = false + } + if needColon { + return p.errorf("expected ':', found %q", tok.value) + } + p.back() + } + return nil +} + +func (p *textParser) readStruct(sv reflect.Value, terminator string) error { + st := sv.Type() + sprops := GetProperties(st) + reqCount := sprops.reqCount + var reqFieldErr error + fieldSet := make(map[string]bool) + // A struct is a sequence of "name: value", terminated by one of + // '>' or '}', or the end of the input. A name may also be + // "[extension]" or "[type/url]". + // + // The whole struct can also be an expanded Any message, like: + // [type/url] < ... struct contents ... > + for { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value == terminator { + break + } + if tok.value == "[" { + // Looks like an extension or an Any. + // + // TODO: Check whether we need to handle + // namespace rooted names (e.g. ".something.Foo"). + extName, err := p.consumeExtName() + if err != nil { + return err + } + + if s := strings.LastIndex(extName, "/"); s >= 0 { + // If it contains a slash, it's an Any type URL. + messageName := extName[s+1:] + mt := MessageType(messageName) + if mt == nil { + return p.errorf("unrecognized message %q in google.protobuf.Any", messageName) + } + tok = p.next() + if tok.err != nil { + return tok.err + } + // consume an optional colon + if tok.value == ":" { + tok = p.next() + if tok.err != nil { + return tok.err + } + } + var terminator string + switch tok.value { + case "<": + terminator = ">" + case "{": + terminator = "}" + default: + return p.errorf("expected '{' or '<', found %q", tok.value) + } + v := reflect.New(mt.Elem()) + if pe := p.readStruct(v.Elem(), terminator); pe != nil { + return pe + } + b, err := Marshal(v.Interface().(Message)) + if err != nil { + return p.errorf("failed to marshal message of type %q: %v", messageName, err) + } + if fieldSet["type_url"] { + return p.errorf(anyRepeatedlyUnpacked, "type_url") + } + if fieldSet["value"] { + return p.errorf(anyRepeatedlyUnpacked, "value") + } + sv.FieldByName("TypeUrl").SetString(extName) + sv.FieldByName("Value").SetBytes(b) + fieldSet["type_url"] = true + fieldSet["value"] = true + continue + } + + var desc *ExtensionDesc + // This could be faster, but it's functional. + // TODO: Do something smarter than a linear scan. + for _, d := range RegisteredExtensions(reflect.New(st).Interface().(Message)) { + if d.Name == extName { + desc = d + break + } + } + if desc == nil { + return p.errorf("unrecognized extension %q", extName) + } + + props := &Properties{} + props.Parse(desc.Tag) + + typ := reflect.TypeOf(desc.ExtensionType) + if err := p.checkForColon(props, typ); err != nil { + return err + } + + rep := desc.repeated() + + // Read the extension structure, and set it in + // the value we're constructing. + var ext reflect.Value + if !rep { + ext = reflect.New(typ).Elem() + } else { + ext = reflect.New(typ.Elem()).Elem() + } + if err := p.readAny(ext, props); err != nil { + if _, ok := err.(*RequiredNotSetError); !ok { + return err + } + reqFieldErr = err + } + ep := sv.Addr().Interface().(Message) + if !rep { + SetExtension(ep, desc, ext.Interface()) + } else { + old, err := GetExtension(ep, desc) + var sl reflect.Value + if err == nil { + sl = reflect.ValueOf(old) // existing slice + } else { + sl = reflect.MakeSlice(typ, 0, 1) + } + sl = reflect.Append(sl, ext) + SetExtension(ep, desc, sl.Interface()) + } + if err := p.consumeOptionalSeparator(); err != nil { + return err + } + continue + } + + // This is a normal, non-extension field. + name := tok.value + var dst reflect.Value + fi, props, ok := structFieldByName(sprops, name) + if ok { + dst = sv.Field(fi) + } else if oop, ok := sprops.OneofTypes[name]; ok { + // It is a oneof. + props = oop.Prop + nv := reflect.New(oop.Type.Elem()) + dst = nv.Elem().Field(0) + field := sv.Field(oop.Field) + if !field.IsNil() { + return p.errorf("field '%s' would overwrite already parsed oneof '%s'", name, sv.Type().Field(oop.Field).Name) + } + field.Set(nv) + } + if !dst.IsValid() { + return p.errorf("unknown field name %q in %v", name, st) + } + + if dst.Kind() == reflect.Map { + // Consume any colon. + if err := p.checkForColon(props, dst.Type()); err != nil { + return err + } + + // Construct the map if it doesn't already exist. + if dst.IsNil() { + dst.Set(reflect.MakeMap(dst.Type())) + } + key := reflect.New(dst.Type().Key()).Elem() + val := reflect.New(dst.Type().Elem()).Elem() + + // The map entry should be this sequence of tokens: + // < key : KEY value : VALUE > + // However, implementations may omit key or value, and technically + // we should support them in any order. See b/28924776 for a time + // this went wrong. + + tok := p.next() + var terminator string + switch tok.value { + case "<": + terminator = ">" + case "{": + terminator = "}" + default: + return p.errorf("expected '{' or '<', found %q", tok.value) + } + for { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value == terminator { + break + } + switch tok.value { + case "key": + if err := p.consumeToken(":"); err != nil { + return err + } + if err := p.readAny(key, props.mkeyprop); err != nil { + return err + } + if err := p.consumeOptionalSeparator(); err != nil { + return err + } + case "value": + if err := p.checkForColon(props.mvalprop, dst.Type().Elem()); err != nil { + return err + } + if err := p.readAny(val, props.mvalprop); err != nil { + return err + } + if err := p.consumeOptionalSeparator(); err != nil { + return err + } + default: + p.back() + return p.errorf(`expected "key", "value", or %q, found %q`, terminator, tok.value) + } + } + + dst.SetMapIndex(key, val) + continue + } + + // Check that it's not already set if it's not a repeated field. + if !props.Repeated && fieldSet[name] { + return p.errorf("non-repeated field %q was repeated", name) + } + + if err := p.checkForColon(props, dst.Type()); err != nil { + return err + } + + // Parse into the field. + fieldSet[name] = true + if err := p.readAny(dst, props); err != nil { + if _, ok := err.(*RequiredNotSetError); !ok { + return err + } + reqFieldErr = err + } + if props.Required { + reqCount-- + } + + if err := p.consumeOptionalSeparator(); err != nil { + return err + } + + } + + if reqCount > 0 { + return p.missingRequiredFieldError(sv) + } + return reqFieldErr +} + +// consumeExtName consumes extension name or expanded Any type URL and the +// following ']'. It returns the name or URL consumed. +func (p *textParser) consumeExtName() (string, error) { + tok := p.next() + if tok.err != nil { + return "", tok.err + } + + // If extension name or type url is quoted, it's a single token. + if len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] { + name, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0])) + if err != nil { + return "", err + } + return name, p.consumeToken("]") + } + + // Consume everything up to "]" + var parts []string + for tok.value != "]" { + parts = append(parts, tok.value) + tok = p.next() + if tok.err != nil { + return "", p.errorf("unrecognized type_url or extension name: %s", tok.err) + } + } + return strings.Join(parts, ""), nil +} + +// consumeOptionalSeparator consumes an optional semicolon or comma. +// It is used in readStruct to provide backward compatibility. +func (p *textParser) consumeOptionalSeparator() error { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value != ";" && tok.value != "," { + p.back() + } + return nil +} + +func (p *textParser) readAny(v reflect.Value, props *Properties) error { + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value == "" { + return p.errorf("unexpected EOF") + } + + switch fv := v; fv.Kind() { + case reflect.Slice: + at := v.Type() + if at.Elem().Kind() == reflect.Uint8 { + // Special case for []byte + if tok.value[0] != '"' && tok.value[0] != '\'' { + // Deliberately written out here, as the error after + // this switch statement would write "invalid []byte: ...", + // which is not as user-friendly. + return p.errorf("invalid string: %v", tok.value) + } + bytes := []byte(tok.unquoted) + fv.Set(reflect.ValueOf(bytes)) + return nil + } + // Repeated field. + if tok.value == "[" { + // Repeated field with list notation, like [1,2,3]. + for { + fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) + err := p.readAny(fv.Index(fv.Len()-1), props) + if err != nil { + return err + } + tok := p.next() + if tok.err != nil { + return tok.err + } + if tok.value == "]" { + break + } + if tok.value != "," { + return p.errorf("Expected ']' or ',' found %q", tok.value) + } + } + return nil + } + // One value of the repeated field. + p.back() + fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) + return p.readAny(fv.Index(fv.Len()-1), props) + case reflect.Bool: + // true/1/t/True or false/f/0/False. + switch tok.value { + case "true", "1", "t", "True": + fv.SetBool(true) + return nil + case "false", "0", "f", "False": + fv.SetBool(false) + return nil + } + case reflect.Float32, reflect.Float64: + v := tok.value + // Ignore 'f' for compatibility with output generated by C++, but don't + // remove 'f' when the value is "-inf" or "inf". + if strings.HasSuffix(v, "f") && tok.value != "-inf" && tok.value != "inf" { + v = v[:len(v)-1] + } + if f, err := strconv.ParseFloat(v, fv.Type().Bits()); err == nil { + fv.SetFloat(f) + return nil + } + case reflect.Int32: + if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil { + fv.SetInt(x) + return nil + } + + if len(props.Enum) == 0 { + break + } + m, ok := enumValueMaps[props.Enum] + if !ok { + break + } + x, ok := m[tok.value] + if !ok { + break + } + fv.SetInt(int64(x)) + return nil + case reflect.Int64: + if x, err := strconv.ParseInt(tok.value, 0, 64); err == nil { + fv.SetInt(x) + return nil + } + + case reflect.Ptr: + // A basic field (indirected through pointer), or a repeated message/group + p.back() + fv.Set(reflect.New(fv.Type().Elem())) + return p.readAny(fv.Elem(), props) + case reflect.String: + if tok.value[0] == '"' || tok.value[0] == '\'' { + fv.SetString(tok.unquoted) + return nil + } + case reflect.Struct: + var terminator string + switch tok.value { + case "{": + terminator = "}" + case "<": + terminator = ">" + default: + return p.errorf("expected '{' or '<', found %q", tok.value) + } + // TODO: Handle nested messages which implement encoding.TextUnmarshaler. + return p.readStruct(fv, terminator) + case reflect.Uint32: + if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { + fv.SetUint(uint64(x)) + return nil + } + case reflect.Uint64: + if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil { + fv.SetUint(x) + return nil + } + } + return p.errorf("invalid %v: %v", v.Type(), tok.value) +} + +// UnmarshalText reads a protocol buffer in Text format. UnmarshalText resets pb +// before starting to unmarshal, so any existing data in pb is always removed. +// If a required field is not set and no other error occurs, +// UnmarshalText returns *RequiredNotSetError. +func UnmarshalText(s string, pb Message) error { + if um, ok := pb.(encoding.TextUnmarshaler); ok { + err := um.UnmarshalText([]byte(s)) + return err + } + pb.Reset() + v := reflect.ValueOf(pb) + if pe := newTextParser(s).readStruct(v.Elem(), ""); pe != nil { + return pe + } + return nil +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/LICENSE b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/LICENSE new file mode 100644 index 00000000000..ade9307b390 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/LICENSE @@ -0,0 +1,191 @@ +All files in this repository are licensed as follows. If you contribute +to this repository, it is assumed that you license your contribution +under the same license unless you state otherwise. + +All files Copyright (C) 2015 Canonical Ltd. unless otherwise specified in the file. + +This software is licensed under the LGPLv3, included below. + +As a special exception to the GNU Lesser General Public License version 3 +("LGPL3"), the copyright holders of this Library give you permission to +convey to a third party a Combined Work that links statically or dynamically +to this Library without providing any Minimal Corresponding Source or +Minimal Application Code as set out in 4d or providing the installation +information set out in section 4e, provided that you comply with the other +provisions of LGPL3 and provided that you meet, for the Application the +terms and conditions of the license(s) which apply to the Application. + +Except as stated in this special exception, the provisions of LGPL3 will +continue to comply in full to this Library. If you modify this Library, you +may apply this exception to your version of this Library, but you are not +obliged to do so. If you do not wish to do so, delete this exception +statement from your version. This exception does not (and cannot) modify any +license terms which apply to the Application, with which you must still +comply. + + + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/doc.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/doc.go new file mode 100644 index 00000000000..35b119aa345 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/doc.go @@ -0,0 +1,81 @@ +// Copyright 2013, 2014 Canonical Ltd. +// Licensed under the LGPLv3, see LICENCE file for details. + +/* +[godoc-link-here] + +The juju/errors provides an easy way to annotate errors without losing the +orginal error context. + +The exported `New` and `Errorf` functions are designed to replace the +`errors.New` and `fmt.Errorf` functions respectively. The same underlying +error is there, but the package also records the location at which the error +was created. + +A primary use case for this library is to add extra context any time an +error is returned from a function. + + if err := SomeFunc(); err != nil { + return err + } + +This instead becomes: + + if err := SomeFunc(); err != nil { + return errors.Trace(err) + } + +which just records the file and line number of the Trace call, or + + if err := SomeFunc(); err != nil { + return errors.Annotate(err, "more context") + } + +which also adds an annotation to the error. + +When you want to check to see if an error is of a particular type, a helper +function is normally exported by the package that returned the error, like the +`os` package does. The underlying cause of the error is available using the +`Cause` function. + + os.IsNotExist(errors.Cause(err)) + +The result of the `Error()` call on an annotated error is the annotations joined +with colons, then the result of the `Error()` method for the underlying error +that was the cause. + + err := errors.Errorf("original") + err = errors.Annotatef(err, "context") + err = errors.Annotatef(err, "more context") + err.Error() -> "more context: context: original" + +Obviously recording the file, line and functions is not very useful if you +cannot get them back out again. + + errors.ErrorStack(err) + +will return something like: + + first error + github.com/juju/errors/annotation_test.go:193: + github.com/juju/errors/annotation_test.go:194: annotation + github.com/juju/errors/annotation_test.go:195: + github.com/juju/errors/annotation_test.go:196: more context + github.com/juju/errors/annotation_test.go:197: + +The first error was generated by an external system, so there was no location +associated. The second, fourth, and last lines were generated with Trace calls, +and the other two through Annotate. + +Sometimes when responding to an error you want to return a more specific error +for the situation. + + if err := FindField(field); err != nil { + return errors.Wrap(err, errors.NotFoundf(field)) + } + +This returns an error where the complete error stack is still available, and +`errors.Cause()` will return the `NotFound` error. + +*/ +package errors diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/error.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/error.go new file mode 100644 index 00000000000..8c51c45b39e --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/error.go @@ -0,0 +1,145 @@ +// Copyright 2014 Canonical Ltd. +// Licensed under the LGPLv3, see LICENCE file for details. + +package errors + +import ( + "fmt" + "reflect" + "runtime" +) + +// Err holds a description of an error along with information about +// where the error was created. +// +// It may be embedded in custom error types to add extra information that +// this errors package can understand. +type Err struct { + // message holds an annotation of the error. + message string + + // cause holds the cause of the error as returned + // by the Cause method. + cause error + + // previous holds the previous error in the error stack, if any. + previous error + + // file and line hold the source code location where the error was + // created. + file string + line int +} + +// NewErr is used to return an Err for the purpose of embedding in other +// structures. The location is not specified, and needs to be set with a call +// to SetLocation. +// +// For example: +// type FooError struct { +// errors.Err +// code int +// } +// +// func NewFooError(code int) error { +// err := &FooError{errors.NewErr("foo"), code} +// err.SetLocation(1) +// return err +// } +func NewErr(format string, args ...interface{}) Err { + return Err{ + message: fmt.Sprintf(format, args...), + } +} + +// NewErrWithCause is used to return an Err with case by other error for the purpose of embedding in other +// structures. The location is not specified, and needs to be set with a call +// to SetLocation. +// +// For example: +// type FooError struct { +// errors.Err +// code int +// } +// +// func (e *FooError) Annotate(format string, args ...interface{}) error { +// err := &FooError{errors.NewErrWithCause(e.Err, format, args...), e.code} +// err.SetLocation(1) +// return err +// }) +func NewErrWithCause(other error, format string, args ...interface{}) Err { + return Err{ + message: fmt.Sprintf(format, args...), + cause: Cause(other), + previous: other, + } +} + +// Location is the file and line of where the error was most recently +// created or annotated. +func (e *Err) Location() (filename string, line int) { + return e.file, e.line +} + +// Underlying returns the previous error in the error stack, if any. A client +// should not ever really call this method. It is used to build the error +// stack and should not be introspected by client calls. Or more +// specifically, clients should not depend on anything but the `Cause` of an +// error. +func (e *Err) Underlying() error { + return e.previous +} + +// The Cause of an error is the most recent error in the error stack that +// meets one of these criteria: the original error that was raised; the new +// error that was passed into the Wrap function; the most recently masked +// error; or nil if the error itself is considered the Cause. Normally this +// method is not invoked directly, but instead through the Cause stand alone +// function. +func (e *Err) Cause() error { + return e.cause +} + +// Message returns the message stored with the most recent location. This is +// the empty string if the most recent call was Trace, or the message stored +// with Annotate or Mask. +func (e *Err) Message() string { + return e.message +} + +// Error implements error.Error. +func (e *Err) Error() string { + // We want to walk up the stack of errors showing the annotations + // as long as the cause is the same. + err := e.previous + if !sameError(Cause(err), e.cause) && e.cause != nil { + err = e.cause + } + switch { + case err == nil: + return e.message + case e.message == "": + return err.Error() + } + return fmt.Sprintf("%s: %v", e.message, err) +} + +// SetLocation records the source location of the error at callDepth stack +// frames above the call. +func (e *Err) SetLocation(callDepth int) { + _, file, line, _ := runtime.Caller(callDepth + 1) + e.file = trimGoPath(file) + e.line = line +} + +// StackTrace returns one string for each location recorded in the stack of +// errors. The first value is the originating error, with a line for each +// other annotation or tracing of the error. +func (e *Err) StackTrace() []string { + return errorStack(e) +} + +// Ideally we'd have a way to check identity, but deep equals will do. +func sameError(e1, e2 error) bool { + return reflect.DeepEqual(e1, e2) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/errortypes.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/errortypes.go new file mode 100644 index 00000000000..10b3b19c22a --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/errortypes.go @@ -0,0 +1,284 @@ +// Copyright 2014 Canonical Ltd. +// Licensed under the LGPLv3, see LICENCE file for details. + +package errors + +import ( + "fmt" +) + +// wrap is a helper to construct an *wrapper. +func wrap(err error, format, suffix string, args ...interface{}) Err { + newErr := Err{ + message: fmt.Sprintf(format+suffix, args...), + previous: err, + } + newErr.SetLocation(2) + return newErr +} + +// notFound represents an error when something has not been found. +type notFound struct { + Err +} + +// NotFoundf returns an error which satisfies IsNotFound(). +func NotFoundf(format string, args ...interface{}) error { + return ¬Found{wrap(nil, format, " not found", args...)} +} + +// NewNotFound returns an error which wraps err that satisfies +// IsNotFound(). +func NewNotFound(err error, msg string) error { + return ¬Found{wrap(err, msg, "")} +} + +// IsNotFound reports whether err was created with NotFoundf() or +// NewNotFound(). +func IsNotFound(err error) bool { + err = Cause(err) + _, ok := err.(*notFound) + return ok +} + +// userNotFound represents an error when an inexistent user is looked up. +type userNotFound struct { + Err +} + +// UserNotFoundf returns an error which satisfies IsUserNotFound(). +func UserNotFoundf(format string, args ...interface{}) error { + return &userNotFound{wrap(nil, format, " user not found", args...)} +} + +// NewUserNotFound returns an error which wraps err and satisfies +// IsUserNotFound(). +func NewUserNotFound(err error, msg string) error { + return &userNotFound{wrap(err, msg, "")} +} + +// IsUserNotFound reports whether err was created with UserNotFoundf() or +// NewUserNotFound(). +func IsUserNotFound(err error) bool { + err = Cause(err) + _, ok := err.(*userNotFound) + return ok +} + +// unauthorized represents an error when an operation is unauthorized. +type unauthorized struct { + Err +} + +// Unauthorizedf returns an error which satisfies IsUnauthorized(). +func Unauthorizedf(format string, args ...interface{}) error { + return &unauthorized{wrap(nil, format, "", args...)} +} + +// NewUnauthorized returns an error which wraps err and satisfies +// IsUnauthorized(). +func NewUnauthorized(err error, msg string) error { + return &unauthorized{wrap(err, msg, "")} +} + +// IsUnauthorized reports whether err was created with Unauthorizedf() or +// NewUnauthorized(). +func IsUnauthorized(err error) bool { + err = Cause(err) + _, ok := err.(*unauthorized) + return ok +} + +// notImplemented represents an error when something is not +// implemented. +type notImplemented struct { + Err +} + +// NotImplementedf returns an error which satisfies IsNotImplemented(). +func NotImplementedf(format string, args ...interface{}) error { + return ¬Implemented{wrap(nil, format, " not implemented", args...)} +} + +// NewNotImplemented returns an error which wraps err and satisfies +// IsNotImplemented(). +func NewNotImplemented(err error, msg string) error { + return ¬Implemented{wrap(err, msg, "")} +} + +// IsNotImplemented reports whether err was created with +// NotImplementedf() or NewNotImplemented(). +func IsNotImplemented(err error) bool { + err = Cause(err) + _, ok := err.(*notImplemented) + return ok +} + +// alreadyExists represents and error when something already exists. +type alreadyExists struct { + Err +} + +// AlreadyExistsf returns an error which satisfies IsAlreadyExists(). +func AlreadyExistsf(format string, args ...interface{}) error { + return &alreadyExists{wrap(nil, format, " already exists", args...)} +} + +// NewAlreadyExists returns an error which wraps err and satisfies +// IsAlreadyExists(). +func NewAlreadyExists(err error, msg string) error { + return &alreadyExists{wrap(err, msg, "")} +} + +// IsAlreadyExists reports whether the error was created with +// AlreadyExistsf() or NewAlreadyExists(). +func IsAlreadyExists(err error) bool { + err = Cause(err) + _, ok := err.(*alreadyExists) + return ok +} + +// notSupported represents an error when something is not supported. +type notSupported struct { + Err +} + +// NotSupportedf returns an error which satisfies IsNotSupported(). +func NotSupportedf(format string, args ...interface{}) error { + return ¬Supported{wrap(nil, format, " not supported", args...)} +} + +// NewNotSupported returns an error which wraps err and satisfies +// IsNotSupported(). +func NewNotSupported(err error, msg string) error { + return ¬Supported{wrap(err, msg, "")} +} + +// IsNotSupported reports whether the error was created with +// NotSupportedf() or NewNotSupported(). +func IsNotSupported(err error) bool { + err = Cause(err) + _, ok := err.(*notSupported) + return ok +} + +// notValid represents an error when something is not valid. +type notValid struct { + Err +} + +// NotValidf returns an error which satisfies IsNotValid(). +func NotValidf(format string, args ...interface{}) error { + return ¬Valid{wrap(nil, format, " not valid", args...)} +} + +// NewNotValid returns an error which wraps err and satisfies IsNotValid(). +func NewNotValid(err error, msg string) error { + return ¬Valid{wrap(err, msg, "")} +} + +// IsNotValid reports whether the error was created with NotValidf() or +// NewNotValid(). +func IsNotValid(err error) bool { + err = Cause(err) + _, ok := err.(*notValid) + return ok +} + +// notProvisioned represents an error when something is not yet provisioned. +type notProvisioned struct { + Err +} + +// NotProvisionedf returns an error which satisfies IsNotProvisioned(). +func NotProvisionedf(format string, args ...interface{}) error { + return ¬Provisioned{wrap(nil, format, " not provisioned", args...)} +} + +// NewNotProvisioned returns an error which wraps err that satisfies +// IsNotProvisioned(). +func NewNotProvisioned(err error, msg string) error { + return ¬Provisioned{wrap(err, msg, "")} +} + +// IsNotProvisioned reports whether err was created with NotProvisionedf() or +// NewNotProvisioned(). +func IsNotProvisioned(err error) bool { + err = Cause(err) + _, ok := err.(*notProvisioned) + return ok +} + +// notAssigned represents an error when something is not yet assigned to +// something else. +type notAssigned struct { + Err +} + +// NotAssignedf returns an error which satisfies IsNotAssigned(). +func NotAssignedf(format string, args ...interface{}) error { + return ¬Assigned{wrap(nil, format, " not assigned", args...)} +} + +// NewNotAssigned returns an error which wraps err that satisfies +// IsNotAssigned(). +func NewNotAssigned(err error, msg string) error { + return ¬Assigned{wrap(err, msg, "")} +} + +// IsNotAssigned reports whether err was created with NotAssignedf() or +// NewNotAssigned(). +func IsNotAssigned(err error) bool { + err = Cause(err) + _, ok := err.(*notAssigned) + return ok +} + +// badRequest represents an error when a request has bad parameters. +type badRequest struct { + Err +} + +// BadRequestf returns an error which satisfies IsBadRequest(). +func BadRequestf(format string, args ...interface{}) error { + return &badRequest{wrap(nil, format, "", args...)} +} + +// NewBadRequest returns an error which wraps err that satisfies +// IsBadRequest(). +func NewBadRequest(err error, msg string) error { + return &badRequest{wrap(err, msg, "")} +} + +// IsBadRequest reports whether err was created with BadRequestf() or +// NewBadRequest(). +func IsBadRequest(err error) bool { + err = Cause(err) + _, ok := err.(*badRequest) + return ok +} + +// methodNotAllowed represents an error when an HTTP request +// is made with an inappropriate method. +type methodNotAllowed struct { + Err +} + +// MethodNotAllowedf returns an error which satisfies IsMethodNotAllowed(). +func MethodNotAllowedf(format string, args ...interface{}) error { + return &methodNotAllowed{wrap(nil, format, "", args...)} +} + +// NewMethodNotAllowed returns an error which wraps err that satisfies +// IsMethodNotAllowed(). +func NewMethodNotAllowed(err error, msg string) error { + return &methodNotAllowed{wrap(err, msg, "")} +} + +// IsMethodNotAllowed reports whether err was created with MethodNotAllowedf() or +// NewMethodNotAllowed(). +func IsMethodNotAllowed(err error) bool { + err = Cause(err) + _, ok := err.(*methodNotAllowed) + return ok +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/functions.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/functions.go new file mode 100644 index 00000000000..994208d8d77 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/functions.go @@ -0,0 +1,330 @@ +// Copyright 2014 Canonical Ltd. +// Licensed under the LGPLv3, see LICENCE file for details. + +package errors + +import ( + "fmt" + "strings" +) + +// New is a drop in replacement for the standard libary errors module that records +// the location that the error is created. +// +// For example: +// return errors.New("validation failed") +// +func New(message string) error { + err := &Err{message: message} + err.SetLocation(1) + return err +} + +// Errorf creates a new annotated error and records the location that the +// error is created. This should be a drop in replacement for fmt.Errorf. +// +// For example: +// return errors.Errorf("validation failed: %s", message) +// +func Errorf(format string, args ...interface{}) error { + err := &Err{message: fmt.Sprintf(format, args...)} + err.SetLocation(1) + return err +} + +// Trace adds the location of the Trace call to the stack. The Cause of the +// resulting error is the same as the error parameter. If the other error is +// nil, the result will be nil. +// +// For example: +// if err := SomeFunc(); err != nil { +// return errors.Trace(err) +// } +// +func Trace(other error) error { + if other == nil { + return nil + } + err := &Err{previous: other, cause: Cause(other)} + err.SetLocation(1) + return err +} + +// Annotate is used to add extra context to an existing error. The location of +// the Annotate call is recorded with the annotations. The file, line and +// function are also recorded. +// +// For example: +// if err := SomeFunc(); err != nil { +// return errors.Annotate(err, "failed to frombulate") +// } +// +func Annotate(other error, message string) error { + if other == nil { + return nil + } + err := &Err{ + previous: other, + cause: Cause(other), + message: message, + } + err.SetLocation(1) + return err +} + +// Annotatef is used to add extra context to an existing error. The location of +// the Annotate call is recorded with the annotations. The file, line and +// function are also recorded. +// +// For example: +// if err := SomeFunc(); err != nil { +// return errors.Annotatef(err, "failed to frombulate the %s", arg) +// } +// +func Annotatef(other error, format string, args ...interface{}) error { + if other == nil { + return nil + } + err := &Err{ + previous: other, + cause: Cause(other), + message: fmt.Sprintf(format, args...), + } + err.SetLocation(1) + return err +} + +// DeferredAnnotatef annotates the given error (when it is not nil) with the given +// format string and arguments (like fmt.Sprintf). If *err is nil, DeferredAnnotatef +// does nothing. This method is used in a defer statement in order to annotate any +// resulting error with the same message. +// +// For example: +// +// defer DeferredAnnotatef(&err, "failed to frombulate the %s", arg) +// +func DeferredAnnotatef(err *error, format string, args ...interface{}) { + if *err == nil { + return + } + newErr := &Err{ + message: fmt.Sprintf(format, args...), + cause: Cause(*err), + previous: *err, + } + newErr.SetLocation(1) + *err = newErr +} + +// Wrap changes the Cause of the error. The location of the Wrap call is also +// stored in the error stack. +// +// For example: +// if err := SomeFunc(); err != nil { +// newErr := &packageError{"more context", private_value} +// return errors.Wrap(err, newErr) +// } +// +func Wrap(other, newDescriptive error) error { + err := &Err{ + previous: other, + cause: newDescriptive, + } + err.SetLocation(1) + return err +} + +// Wrapf changes the Cause of the error, and adds an annotation. The location +// of the Wrap call is also stored in the error stack. +// +// For example: +// if err := SomeFunc(); err != nil { +// return errors.Wrapf(err, simpleErrorType, "invalid value %q", value) +// } +// +func Wrapf(other, newDescriptive error, format string, args ...interface{}) error { + err := &Err{ + message: fmt.Sprintf(format, args...), + previous: other, + cause: newDescriptive, + } + err.SetLocation(1) + return err +} + +// Mask masks the given error with the given format string and arguments (like +// fmt.Sprintf), returning a new error that maintains the error stack, but +// hides the underlying error type. The error string still contains the full +// annotations. If you want to hide the annotations, call Wrap. +func Maskf(other error, format string, args ...interface{}) error { + if other == nil { + return nil + } + err := &Err{ + message: fmt.Sprintf(format, args...), + previous: other, + } + err.SetLocation(1) + return err +} + +// Mask hides the underlying error type, and records the location of the masking. +func Mask(other error) error { + if other == nil { + return nil + } + err := &Err{ + previous: other, + } + err.SetLocation(1) + return err +} + +// Cause returns the cause of the given error. This will be either the +// original error, or the result of a Wrap or Mask call. +// +// Cause is the usual way to diagnose errors that may have been wrapped by +// the other errors functions. +func Cause(err error) error { + var diag error + if err, ok := err.(causer); ok { + diag = err.Cause() + } + if diag != nil { + return diag + } + return err +} + +type causer interface { + Cause() error +} + +type wrapper interface { + // Message returns the top level error message, + // not including the message from the Previous + // error. + Message() string + + // Underlying returns the Previous error, or nil + // if there is none. + Underlying() error +} + +type locationer interface { + Location() (string, int) +} + +var ( + _ wrapper = (*Err)(nil) + _ locationer = (*Err)(nil) + _ causer = (*Err)(nil) +) + +// Details returns information about the stack of errors wrapped by err, in +// the format: +// +// [{filename:99: error one} {otherfile:55: cause of error one}] +// +// This is a terse alternative to ErrorStack as it returns a single line. +func Details(err error) string { + if err == nil { + return "[]" + } + var s []byte + s = append(s, '[') + for { + s = append(s, '{') + if err, ok := err.(locationer); ok { + file, line := err.Location() + if file != "" { + s = append(s, fmt.Sprintf("%s:%d", file, line)...) + s = append(s, ": "...) + } + } + if cerr, ok := err.(wrapper); ok { + s = append(s, cerr.Message()...) + err = cerr.Underlying() + } else { + s = append(s, err.Error()...) + err = nil + } + s = append(s, '}') + if err == nil { + break + } + s = append(s, ' ') + } + s = append(s, ']') + return string(s) +} + +// ErrorStack returns a string representation of the annotated error. If the +// error passed as the parameter is not an annotated error, the result is +// simply the result of the Error() method on that error. +// +// If the error is an annotated error, a multi-line string is returned where +// each line represents one entry in the annotation stack. The full filename +// from the call stack is used in the output. +// +// first error +// github.com/juju/errors/annotation_test.go:193: +// github.com/juju/errors/annotation_test.go:194: annotation +// github.com/juju/errors/annotation_test.go:195: +// github.com/juju/errors/annotation_test.go:196: more context +// github.com/juju/errors/annotation_test.go:197: +func ErrorStack(err error) string { + return strings.Join(errorStack(err), "\n") +} + +func errorStack(err error) []string { + if err == nil { + return nil + } + + // We want the first error first + var lines []string + for { + var buff []byte + if err, ok := err.(locationer); ok { + file, line := err.Location() + // Strip off the leading GOPATH/src path elements. + file = trimGoPath(file) + if file != "" { + buff = append(buff, fmt.Sprintf("%s:%d", file, line)...) + buff = append(buff, ": "...) + } + } + if cerr, ok := err.(wrapper); ok { + message := cerr.Message() + buff = append(buff, message...) + // If there is a cause for this error, and it is different to the cause + // of the underlying error, then output the error string in the stack trace. + var cause error + if err1, ok := err.(causer); ok { + cause = err1.Cause() + } + err = cerr.Underlying() + if cause != nil && !sameError(Cause(err), cause) { + if message != "" { + buff = append(buff, ": "...) + } + buff = append(buff, cause.Error()...) + } + } else { + buff = append(buff, err.Error()...) + err = nil + } + lines = append(lines, string(buff)) + if err == nil { + break + } + } + // reverse the lines to get the original error, which was at the end of + // the list, back to the start. + var result []string + for i := len(lines); i > 0; i-- { + result = append(result, lines[i-1]) + } + return result +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/path.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/path.go new file mode 100644 index 00000000000..a7b726ab094 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/path.go @@ -0,0 +1,38 @@ +// Copyright 2013, 2014 Canonical Ltd. +// Licensed under the LGPLv3, see LICENCE file for details. + +package errors + +import ( + "runtime" + "strings" +) + +// prefixSize is used internally to trim the user specific path from the +// front of the returned filenames from the runtime call stack. +var prefixSize int + +// goPath is the deduced path based on the location of this file as compiled. +var goPath string + +func init() { + _, file, _, ok := runtime.Caller(0) + if file == "?" { + return + } + if ok { + // We know that the end of the file should be: + // github.com/juju/errors/path.go + size := len(file) + suffix := len("github.com/juju/errors/path.go") + goPath = file[:size-suffix] + prefixSize = len(goPath) + } +} + +func trimGoPath(filename string) string { + if strings.HasPrefix(filename, goPath) { + return filename[prefixSize:] + } + return filename +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/LICENSE b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/LICENSE new file mode 100644 index 00000000000..8dada3edaf5 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/LICENSE @@ -0,0 +1,201 @@ + 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/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-binlog.sh b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-binlog.sh new file mode 100755 index 00000000000..71fbf4c85a0 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-binlog.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +cd proto/binlog + +echo "generate binlog code..." +GOGO_ROOT=${GOPATH}/src/github.com/gogo/protobuf +protoc -I.:${GOGO_ROOT}:${GOGO_ROOT}/protobuf --gofast_out=../../go-binlog binlog.proto +protoc -I.:${GOGO_ROOT}:${GOGO_ROOT}/protobuf --gofast_out=plugins=grpc:../../go-binlog pump.proto +protoc -I.:${GOGO_ROOT}:${GOGO_ROOT}/protobuf --gofast_out=plugins=grpc:../../go-binlog cistern.proto +cd ../../go-binlog +sed -i.bak -E 's/import _ \"gogoproto\"//g' *.pb.go +sed -i.bak -E 's/import fmt \"fmt\"//g' *.pb.go +rm -f *.bak +goimports -w *.pb.go diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-go.sh b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-go.sh new file mode 100755 index 00000000000..ef91f60abb1 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-go.sh @@ -0,0 +1,10 @@ +cd proto + +echo "generate go code..." +GOGO_ROOT=${GOPATH}/src/github.com/gogo/protobuf +protoc -I.:${GOGO_ROOT}:${GOGO_ROOT}/protobuf --gofast_out=../go-tipb *.proto +cd ../go-tipb +sed -i.bak -E 's/import _ \"gogoproto\"//g' *.pb.go +sed -i.bak -E 's/import fmt \"fmt\"//g' *.pb.go +rm -f *.bak +goimports -w *.pb.go diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-rust.sh b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-rust.sh new file mode 100755 index 00000000000..605bd98d370 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-rust.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +cd proto + +echo "generate rust code..." +ret=0 +GOGO_ROOT=${GOPATH}/src/github.com/gogo/protobuf +protoc -I.:${GOGO_ROOT}:${GOGO_ROOT}/protobuf --rust_out ../src *.proto || ret=$? + + +echo "extern crate protobuf;" > ../src/lib.rs +for file in `ls *.proto` + do + base_name=$(basename $file ".proto") + echo "#[cfg_attr(rustfmt, rustfmt_skip)]" >> ../src/lib.rs + echo "pub mod $base_name;" >> ../src/lib.rs +done +if [[ $ret -ne 0 ]]; then + exit $ret +fi +cd .. +cargo build diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/sharedbytes/sharedbytes.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/sharedbytes/sharedbytes.go new file mode 100644 index 00000000000..4dd461e0c41 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/sharedbytes/sharedbytes.go @@ -0,0 +1,42 @@ +// Copyright 2017 PingCAP, Inc. +// +// 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, +// See the License for the specific language governing permissions and +// limitations under the License. + +package sharedbytes + +// SharedBytes is a custom type for protobuf, it does not +// allocates memory in Unmarshal. +type SharedBytes []byte + +// Marshal implements custom type for gogo/protobuf. +func (sb SharedBytes) Marshal() ([]byte, error) { + data := make([]byte, len(sb)) + copy(data, sb) + return data, nil +} + +// MarshalTo implements custom type for gogo/protobuf. +func (sb SharedBytes) MarshalTo(data []byte) (n int, err error) { + n = copy(data, sb) + return +} + +// Unmarshal implements custom type for gogo/protobuf. +func (sb *SharedBytes) Unmarshal(data []byte) error { + *sb = data + return nil +} + +// Size implements custom type for gogo/protobuf. +func (sb SharedBytes) Size() int { + return len(sb) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/LICENSE b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/LICENSE new file mode 100644 index 00000000000..6a66aea5eaf --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 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/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/PATENTS b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/PATENTS new file mode 100644 index 00000000000..733099041f8 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/PATENTS @@ -0,0 +1,22 @@ +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/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/context/context.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/context/context.go new file mode 100644 index 00000000000..77b64d0c679 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/context/context.go @@ -0,0 +1,447 @@ +// Copyright 2014 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 context defines the Context type, which carries deadlines, +// cancelation signals, and other request-scoped values across API boundaries +// and between processes. +// +// Incoming requests to a server should create a Context, and outgoing calls to +// servers should accept a Context. The chain of function calls between must +// propagate the Context, optionally replacing it with a modified copy created +// using WithDeadline, WithTimeout, WithCancel, or WithValue. +// +// Programs that use Contexts should follow these rules to keep interfaces +// consistent across packages and enable static analysis tools to check context +// propagation: +// +// Do not store Contexts inside a struct type; instead, pass a Context +// explicitly to each function that needs it. The Context should be the first +// parameter, typically named ctx: +// +// func DoSomething(ctx context.Context, arg Arg) error { +// // ... use ctx ... +// } +// +// Do not pass a nil Context, even if a function permits it. Pass context.TODO +// if you are unsure about which Context to use. +// +// Use context Values only for request-scoped data that transits processes and +// APIs, not for passing optional parameters to functions. +// +// The same Context may be passed to functions running in different goroutines; +// Contexts are safe for simultaneous use by multiple goroutines. +// +// See http://blog.golang.org/context for example code for a server that uses +// Contexts. +package context // import "golang.org/x/net/context" + +import ( + "errors" + "fmt" + "sync" + "time" +) + +// A Context carries a deadline, a cancelation signal, and other values across +// API boundaries. +// +// Context's methods may be called by multiple goroutines simultaneously. +type Context interface { + // Deadline returns the time when work done on behalf of this context + // should be canceled. Deadline returns ok==false when no deadline is + // set. Successive calls to Deadline return the same results. + Deadline() (deadline time.Time, ok bool) + + // Done returns a channel that's closed when work done on behalf of this + // context should be canceled. Done may return nil if this context can + // never be canceled. Successive calls to Done return the same value. + // + // WithCancel arranges for Done to be closed when cancel is called; + // WithDeadline arranges for Done to be closed when the deadline + // expires; WithTimeout arranges for Done to be closed when the timeout + // elapses. + // + // Done is provided for use in select statements: + // + // // Stream generates values with DoSomething and sends them to out + // // until DoSomething returns an error or ctx.Done is closed. + // func Stream(ctx context.Context, out <-chan Value) error { + // for { + // v, err := DoSomething(ctx) + // if err != nil { + // return err + // } + // select { + // case <-ctx.Done(): + // return ctx.Err() + // case out <- v: + // } + // } + // } + // + // See http://blog.golang.org/pipelines for more examples of how to use + // a Done channel for cancelation. + Done() <-chan struct{} + + // Err returns a non-nil error value after Done is closed. Err returns + // Canceled if the context was canceled or DeadlineExceeded if the + // context's deadline passed. No other values for Err are defined. + // After Done is closed, successive calls to Err return the same value. + Err() error + + // Value returns the value associated with this context for key, or nil + // if no value is associated with key. Successive calls to Value with + // the same key returns the same result. + // + // Use context values only for request-scoped data that transits + // processes and API boundaries, not for passing optional parameters to + // functions. + // + // A key identifies a specific value in a Context. Functions that wish + // to store values in Context typically allocate a key in a global + // variable then use that key as the argument to context.WithValue and + // Context.Value. A key can be any type that supports equality; + // packages should define keys as an unexported type to avoid + // collisions. + // + // Packages that define a Context key should provide type-safe accessors + // for the values stores using that key: + // + // // Package user defines a User type that's stored in Contexts. + // package user + // + // import "golang.org/x/net/context" + // + // // User is the type of value stored in the Contexts. + // type User struct {...} + // + // // key is an unexported type for keys defined in this package. + // // This prevents collisions with keys defined in other packages. + // type key int + // + // // userKey is the key for user.User values in Contexts. It is + // // unexported; clients use user.NewContext and user.FromContext + // // instead of using this key directly. + // var userKey key = 0 + // + // // NewContext returns a new Context that carries value u. + // func NewContext(ctx context.Context, u *User) context.Context { + // return context.WithValue(ctx, userKey, u) + // } + // + // // FromContext returns the User value stored in ctx, if any. + // func FromContext(ctx context.Context) (*User, bool) { + // u, ok := ctx.Value(userKey).(*User) + // return u, ok + // } + Value(key interface{}) interface{} +} + +// Canceled is the error returned by Context.Err when the context is canceled. +var Canceled = errors.New("context canceled") + +// DeadlineExceeded is the error returned by Context.Err when the context's +// deadline passes. +var DeadlineExceeded = errors.New("context deadline exceeded") + +// An emptyCtx is never canceled, has no values, and has no deadline. It is not +// struct{}, since vars of this type must have distinct addresses. +type emptyCtx int + +func (*emptyCtx) Deadline() (deadline time.Time, ok bool) { + return +} + +func (*emptyCtx) Done() <-chan struct{} { + return nil +} + +func (*emptyCtx) Err() error { + return nil +} + +func (*emptyCtx) Value(key interface{}) interface{} { + return nil +} + +func (e *emptyCtx) String() string { + switch e { + case background: + return "context.Background" + case todo: + return "context.TODO" + } + return "unknown empty Context" +} + +var ( + background = new(emptyCtx) + todo = new(emptyCtx) +) + +// Background returns a non-nil, empty Context. It is never canceled, has no +// values, and has no deadline. It is typically used by the main function, +// initialization, and tests, and as the top-level Context for incoming +// requests. +func Background() Context { + return background +} + +// TODO returns a non-nil, empty Context. Code should use context.TODO when +// it's unclear which Context to use or it is not yet available (because the +// surrounding function has not yet been extended to accept a Context +// parameter). TODO is recognized by static analysis tools that determine +// whether Contexts are propagated correctly in a program. +func TODO() Context { + return todo +} + +// A CancelFunc tells an operation to abandon its work. +// A CancelFunc does not wait for the work to stop. +// After the first call, subsequent calls to a CancelFunc do nothing. +type CancelFunc func() + +// WithCancel returns a copy of parent with a new Done channel. The returned +// context's Done channel is closed when the returned cancel function is called +// or when the parent context's Done channel is closed, whichever happens first. +// +// Canceling this context releases resources associated with it, so code should +// call cancel as soon as the operations running in this Context complete. +func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { + c := newCancelCtx(parent) + propagateCancel(parent, &c) + return &c, func() { c.cancel(true, Canceled) } +} + +// newCancelCtx returns an initialized cancelCtx. +func newCancelCtx(parent Context) cancelCtx { + return cancelCtx{ + Context: parent, + done: make(chan struct{}), + } +} + +// propagateCancel arranges for child to be canceled when parent is. +func propagateCancel(parent Context, child canceler) { + if parent.Done() == nil { + return // parent is never canceled + } + if p, ok := parentCancelCtx(parent); ok { + p.mu.Lock() + if p.err != nil { + // parent has already been canceled + child.cancel(false, p.err) + } else { + if p.children == nil { + p.children = make(map[canceler]bool) + } + p.children[child] = true + } + p.mu.Unlock() + } else { + go func() { + select { + case <-parent.Done(): + child.cancel(false, parent.Err()) + case <-child.Done(): + } + }() + } +} + +// parentCancelCtx follows a chain of parent references until it finds a +// *cancelCtx. This function understands how each of the concrete types in this +// package represents its parent. +func parentCancelCtx(parent Context) (*cancelCtx, bool) { + for { + switch c := parent.(type) { + case *cancelCtx: + return c, true + case *timerCtx: + return &c.cancelCtx, true + case *valueCtx: + parent = c.Context + default: + return nil, false + } + } +} + +// removeChild removes a context from its parent. +func removeChild(parent Context, child canceler) { + p, ok := parentCancelCtx(parent) + if !ok { + return + } + p.mu.Lock() + if p.children != nil { + delete(p.children, child) + } + p.mu.Unlock() +} + +// A canceler is a context type that can be canceled directly. The +// implementations are *cancelCtx and *timerCtx. +type canceler interface { + cancel(removeFromParent bool, err error) + Done() <-chan struct{} +} + +// A cancelCtx can be canceled. When canceled, it also cancels any children +// that implement canceler. +type cancelCtx struct { + Context + + done chan struct{} // closed by the first cancel call. + + mu sync.Mutex + children map[canceler]bool // set to nil by the first cancel call + err error // set to non-nil by the first cancel call +} + +func (c *cancelCtx) Done() <-chan struct{} { + return c.done +} + +func (c *cancelCtx) Err() error { + c.mu.Lock() + defer c.mu.Unlock() + return c.err +} + +func (c *cancelCtx) String() string { + return fmt.Sprintf("%v.WithCancel", c.Context) +} + +// cancel closes c.done, cancels each of c's children, and, if +// removeFromParent is true, removes c from its parent's children. +func (c *cancelCtx) cancel(removeFromParent bool, err error) { + if err == nil { + panic("context: internal error: missing cancel error") + } + c.mu.Lock() + if c.err != nil { + c.mu.Unlock() + return // already canceled + } + c.err = err + close(c.done) + for child := range c.children { + // NOTE: acquiring the child's lock while holding parent's lock. + child.cancel(false, err) + } + c.children = nil + c.mu.Unlock() + + if removeFromParent { + removeChild(c.Context, c) + } +} + +// WithDeadline returns a copy of the parent context with the deadline adjusted +// to be no later than d. If the parent's deadline is already earlier than d, +// WithDeadline(parent, d) is semantically equivalent to parent. The returned +// context's Done channel is closed when the deadline expires, when the returned +// cancel function is called, or when the parent context's Done channel is +// closed, whichever happens first. +// +// Canceling this context releases resources associated with it, so code should +// call cancel as soon as the operations running in this Context complete. +func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) { + if cur, ok := parent.Deadline(); ok && cur.Before(deadline) { + // The current deadline is already sooner than the new one. + return WithCancel(parent) + } + c := &timerCtx{ + cancelCtx: newCancelCtx(parent), + deadline: deadline, + } + propagateCancel(parent, c) + d := deadline.Sub(time.Now()) + if d <= 0 { + c.cancel(true, DeadlineExceeded) // deadline has already passed + return c, func() { c.cancel(true, Canceled) } + } + c.mu.Lock() + defer c.mu.Unlock() + if c.err == nil { + c.timer = time.AfterFunc(d, func() { + c.cancel(true, DeadlineExceeded) + }) + } + return c, func() { c.cancel(true, Canceled) } +} + +// A timerCtx carries a timer and a deadline. It embeds a cancelCtx to +// implement Done and Err. It implements cancel by stopping its timer then +// delegating to cancelCtx.cancel. +type timerCtx struct { + cancelCtx + timer *time.Timer // Under cancelCtx.mu. + + deadline time.Time +} + +func (c *timerCtx) Deadline() (deadline time.Time, ok bool) { + return c.deadline, true +} + +func (c *timerCtx) String() string { + return fmt.Sprintf("%v.WithDeadline(%s [%s])", c.cancelCtx.Context, c.deadline, c.deadline.Sub(time.Now())) +} + +func (c *timerCtx) cancel(removeFromParent bool, err error) { + c.cancelCtx.cancel(false, err) + if removeFromParent { + // Remove this timerCtx from its parent cancelCtx's children. + removeChild(c.cancelCtx.Context, c) + } + c.mu.Lock() + if c.timer != nil { + c.timer.Stop() + c.timer = nil + } + c.mu.Unlock() +} + +// WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)). +// +// Canceling this context releases resources associated with it, so code should +// call cancel as soon as the operations running in this Context complete: +// +// func slowOperationWithTimeout(ctx context.Context) (Result, error) { +// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond) +// defer cancel() // releases resources if slowOperation completes before timeout elapses +// return slowOperation(ctx) +// } +func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) { + return WithDeadline(parent, time.Now().Add(timeout)) +} + +// WithValue returns a copy of parent in which the value associated with key is +// val. +// +// Use context Values only for request-scoped data that transits processes and +// APIs, not for passing optional parameters to functions. +func WithValue(parent Context, key interface{}, val interface{}) Context { + return &valueCtx{parent, key, val} +} + +// A valueCtx carries a key-value pair. It implements Value for that key and +// delegates all other calls to the embedded Context. +type valueCtx struct { + Context + key, val interface{} +} + +func (c *valueCtx) String() string { + return fmt.Sprintf("%v.WithValue(%#v, %#v)", c.Context, c.key, c.val) +} + +func (c *valueCtx) Value(key interface{}) interface{} { + if c.key == key { + return c.val + } + return c.Context.Value(key) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/client_conn_pool.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/client_conn_pool.go new file mode 100644 index 00000000000..772ea5e9244 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/client_conn_pool.go @@ -0,0 +1,225 @@ +// Copyright 2015 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. + +// Transport code's client connection pooling. + +package http2 + +import ( + "crypto/tls" + "net/http" + "sync" +) + +// ClientConnPool manages a pool of HTTP/2 client connections. +type ClientConnPool interface { + GetClientConn(req *http.Request, addr string) (*ClientConn, error) + MarkDead(*ClientConn) +} + +// TODO: use singleflight for dialing and addConnCalls? +type clientConnPool struct { + t *Transport + + mu sync.Mutex // TODO: maybe switch to RWMutex + // TODO: add support for sharing conns based on cert names + // (e.g. share conn for googleapis.com and appspot.com) + conns map[string][]*ClientConn // key is host:port + dialing map[string]*dialCall // currently in-flight dials + keys map[*ClientConn][]string + addConnCalls map[string]*addConnCall // in-flight addConnIfNeede calls +} + +func (p *clientConnPool) GetClientConn(req *http.Request, addr string) (*ClientConn, error) { + return p.getClientConn(req, addr, dialOnMiss) +} + +const ( + dialOnMiss = true + noDialOnMiss = false +) + +func (p *clientConnPool) getClientConn(_ *http.Request, addr string, dialOnMiss bool) (*ClientConn, error) { + p.mu.Lock() + for _, cc := range p.conns[addr] { + if cc.CanTakeNewRequest() { + p.mu.Unlock() + return cc, nil + } + } + if !dialOnMiss { + p.mu.Unlock() + return nil, ErrNoCachedConn + } + call := p.getStartDialLocked(addr) + p.mu.Unlock() + <-call.done + return call.res, call.err +} + +// dialCall is an in-flight Transport dial call to a host. +type dialCall struct { + p *clientConnPool + done chan struct{} // closed when done + res *ClientConn // valid after done is closed + err error // valid after done is closed +} + +// requires p.mu is held. +func (p *clientConnPool) getStartDialLocked(addr string) *dialCall { + if call, ok := p.dialing[addr]; ok { + // A dial is already in-flight. Don't start another. + return call + } + call := &dialCall{p: p, done: make(chan struct{})} + if p.dialing == nil { + p.dialing = make(map[string]*dialCall) + } + p.dialing[addr] = call + go call.dial(addr) + return call +} + +// run in its own goroutine. +func (c *dialCall) dial(addr string) { + c.res, c.err = c.p.t.dialClientConn(addr) + close(c.done) + + c.p.mu.Lock() + delete(c.p.dialing, addr) + if c.err == nil { + c.p.addConnLocked(addr, c.res) + } + c.p.mu.Unlock() +} + +// addConnIfNeeded makes a NewClientConn out of c if a connection for key doesn't +// already exist. It coalesces concurrent calls with the same key. +// This is used by the http1 Transport code when it creates a new connection. Because +// the http1 Transport doesn't de-dup TCP dials to outbound hosts (because it doesn't know +// the protocol), it can get into a situation where it has multiple TLS connections. +// This code decides which ones live or die. +// The return value used is whether c was used. +// c is never closed. +func (p *clientConnPool) addConnIfNeeded(key string, t *Transport, c *tls.Conn) (used bool, err error) { + p.mu.Lock() + for _, cc := range p.conns[key] { + if cc.CanTakeNewRequest() { + p.mu.Unlock() + return false, nil + } + } + call, dup := p.addConnCalls[key] + if !dup { + if p.addConnCalls == nil { + p.addConnCalls = make(map[string]*addConnCall) + } + call = &addConnCall{ + p: p, + done: make(chan struct{}), + } + p.addConnCalls[key] = call + go call.run(t, key, c) + } + p.mu.Unlock() + + <-call.done + if call.err != nil { + return false, call.err + } + return !dup, nil +} + +type addConnCall struct { + p *clientConnPool + done chan struct{} // closed when done + err error +} + +func (c *addConnCall) run(t *Transport, key string, tc *tls.Conn) { + cc, err := t.NewClientConn(tc) + + p := c.p + p.mu.Lock() + if err != nil { + c.err = err + } else { + p.addConnLocked(key, cc) + } + delete(p.addConnCalls, key) + p.mu.Unlock() + close(c.done) +} + +func (p *clientConnPool) addConn(key string, cc *ClientConn) { + p.mu.Lock() + p.addConnLocked(key, cc) + p.mu.Unlock() +} + +// p.mu must be held +func (p *clientConnPool) addConnLocked(key string, cc *ClientConn) { + for _, v := range p.conns[key] { + if v == cc { + return + } + } + if p.conns == nil { + p.conns = make(map[string][]*ClientConn) + } + if p.keys == nil { + p.keys = make(map[*ClientConn][]string) + } + p.conns[key] = append(p.conns[key], cc) + p.keys[cc] = append(p.keys[cc], key) +} + +func (p *clientConnPool) MarkDead(cc *ClientConn) { + p.mu.Lock() + defer p.mu.Unlock() + for _, key := range p.keys[cc] { + vv, ok := p.conns[key] + if !ok { + continue + } + newList := filterOutClientConn(vv, cc) + if len(newList) > 0 { + p.conns[key] = newList + } else { + delete(p.conns, key) + } + } + delete(p.keys, cc) +} + +func (p *clientConnPool) closeIdleConnections() { + p.mu.Lock() + defer p.mu.Unlock() + // TODO: don't close a cc if it was just added to the pool + // milliseconds ago and has never been used. There's currently + // a small race window with the HTTP/1 Transport's integration + // where it can add an idle conn just before using it, and + // somebody else can concurrently call CloseIdleConns and + // break some caller's RoundTrip. + for _, vv := range p.conns { + for _, cc := range vv { + cc.closeIfIdle() + } + } +} + +func filterOutClientConn(in []*ClientConn, exclude *ClientConn) []*ClientConn { + out := in[:0] + for _, v := range in { + if v != exclude { + out = append(out, v) + } + } + // If we filtered it out, zero out the last item to prevent + // the GC from seeing it. + if len(in) != len(out) { + in[len(in)-1] = nil + } + return out +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/configure_transport.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/configure_transport.go new file mode 100644 index 00000000000..daa17f5d43b --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/configure_transport.go @@ -0,0 +1,89 @@ +// Copyright 2015 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. + +// +build go1.6 + +package http2 + +import ( + "crypto/tls" + "fmt" + "net/http" +) + +func configureTransport(t1 *http.Transport) (*Transport, error) { + connPool := new(clientConnPool) + t2 := &Transport{ + ConnPool: noDialClientConnPool{connPool}, + t1: t1, + } + connPool.t = t2 + if err := registerHTTPSProtocol(t1, noDialH2RoundTripper{t2}); err != nil { + return nil, err + } + if t1.TLSClientConfig == nil { + t1.TLSClientConfig = new(tls.Config) + } + if !strSliceContains(t1.TLSClientConfig.NextProtos, "h2") { + t1.TLSClientConfig.NextProtos = append([]string{"h2"}, t1.TLSClientConfig.NextProtos...) + } + if !strSliceContains(t1.TLSClientConfig.NextProtos, "http/1.1") { + t1.TLSClientConfig.NextProtos = append(t1.TLSClientConfig.NextProtos, "http/1.1") + } + upgradeFn := func(authority string, c *tls.Conn) http.RoundTripper { + addr := authorityAddr(authority) + if used, err := connPool.addConnIfNeeded(addr, t2, c); err != nil { + go c.Close() + return erringRoundTripper{err} + } else if !used { + // Turns out we don't need this c. + // For example, two goroutines made requests to the same host + // at the same time, both kicking off TCP dials. (since protocol + // was unknown) + go c.Close() + } + return t2 + } + if m := t1.TLSNextProto; len(m) == 0 { + t1.TLSNextProto = map[string]func(string, *tls.Conn) http.RoundTripper{ + "h2": upgradeFn, + } + } else { + m["h2"] = upgradeFn + } + return t2, nil +} + +// registerHTTPSProtocol calls Transport.RegisterProtocol but +// convering panics into errors. +func registerHTTPSProtocol(t *http.Transport, rt http.RoundTripper) (err error) { + defer func() { + if e := recover(); e != nil { + err = fmt.Errorf("%v", e) + } + }() + t.RegisterProtocol("https", rt) + return nil +} + +// noDialClientConnPool is an implementation of http2.ClientConnPool +// which never dials. We let the HTTP/1.1 client dial and use its TLS +// connection instead. +type noDialClientConnPool struct{ *clientConnPool } + +func (p noDialClientConnPool) GetClientConn(req *http.Request, addr string) (*ClientConn, error) { + return p.getClientConn(req, addr, noDialOnMiss) +} + +// noDialH2RoundTripper is a RoundTripper which only tries to complete the request +// if there's already has a cached connection to the host. +type noDialH2RoundTripper struct{ t *Transport } + +func (rt noDialH2RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { + res, err := rt.t.RoundTrip(req) + if err == ErrNoCachedConn { + return nil, http.ErrSkipAltProtocol + } + return res, err +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/errors.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/errors.go new file mode 100644 index 00000000000..71a4e290568 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/errors.go @@ -0,0 +1,122 @@ +// Copyright 2014 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 http2 + +import ( + "errors" + "fmt" +) + +// An ErrCode is an unsigned 32-bit error code as defined in the HTTP/2 spec. +type ErrCode uint32 + +const ( + ErrCodeNo ErrCode = 0x0 + ErrCodeProtocol ErrCode = 0x1 + ErrCodeInternal ErrCode = 0x2 + ErrCodeFlowControl ErrCode = 0x3 + ErrCodeSettingsTimeout ErrCode = 0x4 + ErrCodeStreamClosed ErrCode = 0x5 + ErrCodeFrameSize ErrCode = 0x6 + ErrCodeRefusedStream ErrCode = 0x7 + ErrCodeCancel ErrCode = 0x8 + ErrCodeCompression ErrCode = 0x9 + ErrCodeConnect ErrCode = 0xa + ErrCodeEnhanceYourCalm ErrCode = 0xb + ErrCodeInadequateSecurity ErrCode = 0xc + ErrCodeHTTP11Required ErrCode = 0xd +) + +var errCodeName = map[ErrCode]string{ + ErrCodeNo: "NO_ERROR", + ErrCodeProtocol: "PROTOCOL_ERROR", + ErrCodeInternal: "INTERNAL_ERROR", + ErrCodeFlowControl: "FLOW_CONTROL_ERROR", + ErrCodeSettingsTimeout: "SETTINGS_TIMEOUT", + ErrCodeStreamClosed: "STREAM_CLOSED", + ErrCodeFrameSize: "FRAME_SIZE_ERROR", + ErrCodeRefusedStream: "REFUSED_STREAM", + ErrCodeCancel: "CANCEL", + ErrCodeCompression: "COMPRESSION_ERROR", + ErrCodeConnect: "CONNECT_ERROR", + ErrCodeEnhanceYourCalm: "ENHANCE_YOUR_CALM", + ErrCodeInadequateSecurity: "INADEQUATE_SECURITY", + ErrCodeHTTP11Required: "HTTP_1_1_REQUIRED", +} + +func (e ErrCode) String() string { + if s, ok := errCodeName[e]; ok { + return s + } + return fmt.Sprintf("unknown error code 0x%x", uint32(e)) +} + +// ConnectionError is an error that results in the termination of the +// entire connection. +type ConnectionError ErrCode + +func (e ConnectionError) Error() string { return fmt.Sprintf("connection error: %s", ErrCode(e)) } + +// StreamError is an error that only affects one stream within an +// HTTP/2 connection. +type StreamError struct { + StreamID uint32 + Code ErrCode +} + +func (e StreamError) Error() string { + return fmt.Sprintf("stream error: stream ID %d; %v", e.StreamID, e.Code) +} + +// 6.9.1 The Flow Control Window +// "If a sender receives a WINDOW_UPDATE that causes a flow control +// window to exceed this maximum it MUST terminate either the stream +// or the connection, as appropriate. For streams, [...]; for the +// connection, a GOAWAY frame with a FLOW_CONTROL_ERROR code." +type goAwayFlowError struct{} + +func (goAwayFlowError) Error() string { return "connection exceeded flow control window size" } + +// connErrorReason wraps a ConnectionError with an informative error about why it occurs. + +// Errors of this type are only returned by the frame parser functions +// and converted into ConnectionError(ErrCodeProtocol). +type connError struct { + Code ErrCode + Reason string +} + +func (e connError) Error() string { + return fmt.Sprintf("http2: connection error: %v: %v", e.Code, e.Reason) +} + +type pseudoHeaderError string + +func (e pseudoHeaderError) Error() string { + return fmt.Sprintf("invalid pseudo-header %q", string(e)) +} + +type duplicatePseudoHeaderError string + +func (e duplicatePseudoHeaderError) Error() string { + return fmt.Sprintf("duplicate pseudo-header %q", string(e)) +} + +type headerFieldNameError string + +func (e headerFieldNameError) Error() string { + return fmt.Sprintf("invalid header field name %q", string(e)) +} + +type headerFieldValueError string + +func (e headerFieldValueError) Error() string { + return fmt.Sprintf("invalid header field value %q", string(e)) +} + +var ( + errMixPseudoHeaderTypes = errors.New("mix of request and response pseudo headers") + errPseudoAfterRegular = errors.New("pseudo header field after regular") +) diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/fixed_buffer.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/fixed_buffer.go new file mode 100644 index 00000000000..47da0f0bf71 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/fixed_buffer.go @@ -0,0 +1,60 @@ +// Copyright 2014 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 http2 + +import ( + "errors" +) + +// fixedBuffer is an io.ReadWriter backed by a fixed size buffer. +// It never allocates, but moves old data as new data is written. +type fixedBuffer struct { + buf []byte + r, w int +} + +var ( + errReadEmpty = errors.New("read from empty fixedBuffer") + errWriteFull = errors.New("write on full fixedBuffer") +) + +// Read copies bytes from the buffer into p. +// It is an error to read when no data is available. +func (b *fixedBuffer) Read(p []byte) (n int, err error) { + if b.r == b.w { + return 0, errReadEmpty + } + n = copy(p, b.buf[b.r:b.w]) + b.r += n + if b.r == b.w { + b.r = 0 + b.w = 0 + } + return n, nil +} + +// Len returns the number of bytes of the unread portion of the buffer. +func (b *fixedBuffer) Len() int { + return b.w - b.r +} + +// Write copies bytes from p into the buffer. +// It is an error to write more data than the buffer can hold. +func (b *fixedBuffer) Write(p []byte) (n int, err error) { + // Slide existing data to beginning. + if b.r > 0 && len(p) > len(b.buf)-b.w { + copy(b.buf, b.buf[b.r:b.w]) + b.w -= b.r + b.r = 0 + } + + // Write new data. + n = copy(b.buf[b.w:], p) + b.w += n + if n < len(p) { + err = errWriteFull + } + return n, err +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/flow.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/flow.go new file mode 100644 index 00000000000..957de25420d --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/flow.go @@ -0,0 +1,50 @@ +// Copyright 2014 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. + +// Flow control + +package http2 + +// flow is the flow control window's size. +type flow struct { + // n is the number of DATA bytes we're allowed to send. + // A flow is kept both on a conn and a per-stream. + n int32 + + // conn points to the shared connection-level flow that is + // shared by all streams on that conn. It is nil for the flow + // that's on the conn directly. + conn *flow +} + +func (f *flow) setConnFlow(cf *flow) { f.conn = cf } + +func (f *flow) available() int32 { + n := f.n + if f.conn != nil && f.conn.n < n { + n = f.conn.n + } + return n +} + +func (f *flow) take(n int32) { + if n > f.available() { + panic("internal error: took too much") + } + f.n -= n + if f.conn != nil { + f.conn.n -= n + } +} + +// add adds n bytes (positive or negative) to the flow control window. +// It returns false if the sum would exceed 2^31-1. +func (f *flow) add(n int32) bool { + remain := (1<<31 - 1) - f.n + if n > remain { + return false + } + f.n += n + return true +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/frame.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/frame.go new file mode 100644 index 00000000000..6943f93380c --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/frame.go @@ -0,0 +1,1496 @@ +// Copyright 2014 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 http2 + +import ( + "bytes" + "encoding/binary" + "errors" + "fmt" + "io" + "log" + "strings" + "sync" + + "golang.org/x/net/http2/hpack" +) + +const frameHeaderLen = 9 + +var padZeros = make([]byte, 255) // zeros for padding + +// A FrameType is a registered frame type as defined in +// http://http2.github.io/http2-spec/#rfc.section.11.2 +type FrameType uint8 + +const ( + FrameData FrameType = 0x0 + FrameHeaders FrameType = 0x1 + FramePriority FrameType = 0x2 + FrameRSTStream FrameType = 0x3 + FrameSettings FrameType = 0x4 + FramePushPromise FrameType = 0x5 + FramePing FrameType = 0x6 + FrameGoAway FrameType = 0x7 + FrameWindowUpdate FrameType = 0x8 + FrameContinuation FrameType = 0x9 +) + +var frameName = map[FrameType]string{ + FrameData: "DATA", + FrameHeaders: "HEADERS", + FramePriority: "PRIORITY", + FrameRSTStream: "RST_STREAM", + FrameSettings: "SETTINGS", + FramePushPromise: "PUSH_PROMISE", + FramePing: "PING", + FrameGoAway: "GOAWAY", + FrameWindowUpdate: "WINDOW_UPDATE", + FrameContinuation: "CONTINUATION", +} + +func (t FrameType) String() string { + if s, ok := frameName[t]; ok { + return s + } + return fmt.Sprintf("UNKNOWN_FRAME_TYPE_%d", uint8(t)) +} + +// Flags is a bitmask of HTTP/2 flags. +// The meaning of flags varies depending on the frame type. +type Flags uint8 + +// Has reports whether f contains all (0 or more) flags in v. +func (f Flags) Has(v Flags) bool { + return (f & v) == v +} + +// Frame-specific FrameHeader flag bits. +const ( + // Data Frame + FlagDataEndStream Flags = 0x1 + FlagDataPadded Flags = 0x8 + + // Headers Frame + FlagHeadersEndStream Flags = 0x1 + FlagHeadersEndHeaders Flags = 0x4 + FlagHeadersPadded Flags = 0x8 + FlagHeadersPriority Flags = 0x20 + + // Settings Frame + FlagSettingsAck Flags = 0x1 + + // Ping Frame + FlagPingAck Flags = 0x1 + + // Continuation Frame + FlagContinuationEndHeaders Flags = 0x4 + + FlagPushPromiseEndHeaders Flags = 0x4 + FlagPushPromisePadded Flags = 0x8 +) + +var flagName = map[FrameType]map[Flags]string{ + FrameData: { + FlagDataEndStream: "END_STREAM", + FlagDataPadded: "PADDED", + }, + FrameHeaders: { + FlagHeadersEndStream: "END_STREAM", + FlagHeadersEndHeaders: "END_HEADERS", + FlagHeadersPadded: "PADDED", + FlagHeadersPriority: "PRIORITY", + }, + FrameSettings: { + FlagSettingsAck: "ACK", + }, + FramePing: { + FlagPingAck: "ACK", + }, + FrameContinuation: { + FlagContinuationEndHeaders: "END_HEADERS", + }, + FramePushPromise: { + FlagPushPromiseEndHeaders: "END_HEADERS", + FlagPushPromisePadded: "PADDED", + }, +} + +// a frameParser parses a frame given its FrameHeader and payload +// bytes. The length of payload will always equal fh.Length (which +// might be 0). +type frameParser func(fh FrameHeader, payload []byte) (Frame, error) + +var frameParsers = map[FrameType]frameParser{ + FrameData: parseDataFrame, + FrameHeaders: parseHeadersFrame, + FramePriority: parsePriorityFrame, + FrameRSTStream: parseRSTStreamFrame, + FrameSettings: parseSettingsFrame, + FramePushPromise: parsePushPromise, + FramePing: parsePingFrame, + FrameGoAway: parseGoAwayFrame, + FrameWindowUpdate: parseWindowUpdateFrame, + FrameContinuation: parseContinuationFrame, +} + +func typeFrameParser(t FrameType) frameParser { + if f := frameParsers[t]; f != nil { + return f + } + return parseUnknownFrame +} + +// A FrameHeader is the 9 byte header of all HTTP/2 frames. +// +// See http://http2.github.io/http2-spec/#FrameHeader +type FrameHeader struct { + valid bool // caller can access []byte fields in the Frame + + // Type is the 1 byte frame type. There are ten standard frame + // types, but extension frame types may be written by WriteRawFrame + // and will be returned by ReadFrame (as UnknownFrame). + Type FrameType + + // Flags are the 1 byte of 8 potential bit flags per frame. + // They are specific to the frame type. + Flags Flags + + // Length is the length of the frame, not including the 9 byte header. + // The maximum size is one byte less than 16MB (uint24), but only + // frames up to 16KB are allowed without peer agreement. + Length uint32 + + // StreamID is which stream this frame is for. Certain frames + // are not stream-specific, in which case this field is 0. + StreamID uint32 +} + +// Header returns h. It exists so FrameHeaders can be embedded in other +// specific frame types and implement the Frame interface. +func (h FrameHeader) Header() FrameHeader { return h } + +func (h FrameHeader) String() string { + var buf bytes.Buffer + buf.WriteString("[FrameHeader ") + h.writeDebug(&buf) + buf.WriteByte(']') + return buf.String() +} + +func (h FrameHeader) writeDebug(buf *bytes.Buffer) { + buf.WriteString(h.Type.String()) + if h.Flags != 0 { + buf.WriteString(" flags=") + set := 0 + for i := uint8(0); i < 8; i++ { + if h.Flags&(1< 1 { + buf.WriteByte('|') + } + name := flagName[h.Type][Flags(1<>24), + byte(streamID>>16), + byte(streamID>>8), + byte(streamID)) +} + +func (f *Framer) endWrite() error { + // Now that we know the final size, fill in the FrameHeader in + // the space previously reserved for it. Abuse append. + length := len(f.wbuf) - frameHeaderLen + if length >= (1 << 24) { + return ErrFrameTooLarge + } + _ = append(f.wbuf[:0], + byte(length>>16), + byte(length>>8), + byte(length)) + if logFrameWrites { + f.logWrite() + } + + n, err := f.w.Write(f.wbuf) + if err == nil && n != len(f.wbuf) { + err = io.ErrShortWrite + } + return err +} + +func (f *Framer) logWrite() { + if f.debugFramer == nil { + f.debugFramerBuf = new(bytes.Buffer) + f.debugFramer = NewFramer(nil, f.debugFramerBuf) + f.debugFramer.logReads = false // we log it ourselves, saying "wrote" below + // Let us read anything, even if we accidentally wrote it + // in the wrong order: + f.debugFramer.AllowIllegalReads = true + } + f.debugFramerBuf.Write(f.wbuf) + fr, err := f.debugFramer.ReadFrame() + if err != nil { + log.Printf("http2: Framer %p: failed to decode just-written frame", f) + return + } + log.Printf("http2: Framer %p: wrote %v", f, summarizeFrame(fr)) +} + +func (f *Framer) writeByte(v byte) { f.wbuf = append(f.wbuf, v) } +func (f *Framer) writeBytes(v []byte) { f.wbuf = append(f.wbuf, v...) } +func (f *Framer) writeUint16(v uint16) { f.wbuf = append(f.wbuf, byte(v>>8), byte(v)) } +func (f *Framer) writeUint32(v uint32) { + f.wbuf = append(f.wbuf, byte(v>>24), byte(v>>16), byte(v>>8), byte(v)) +} + +const ( + minMaxFrameSize = 1 << 14 + maxFrameSize = 1<<24 - 1 +) + +// NewFramer returns a Framer that writes frames to w and reads them from r. +func NewFramer(w io.Writer, r io.Reader) *Framer { + fr := &Framer{ + w: w, + r: r, + logReads: logFrameReads, + } + fr.getReadBuf = func(size uint32) []byte { + if cap(fr.readBuf) >= int(size) { + return fr.readBuf[:size] + } + fr.readBuf = make([]byte, size) + return fr.readBuf + } + fr.SetMaxReadFrameSize(maxFrameSize) + return fr +} + +// SetMaxReadFrameSize sets the maximum size of a frame +// that will be read by a subsequent call to ReadFrame. +// It is the caller's responsibility to advertise this +// limit with a SETTINGS frame. +func (fr *Framer) SetMaxReadFrameSize(v uint32) { + if v > maxFrameSize { + v = maxFrameSize + } + fr.maxReadSize = v +} + +// ErrorDetail returns a more detailed error of the last error +// returned by Framer.ReadFrame. For instance, if ReadFrame +// returns a StreamError with code PROTOCOL_ERROR, ErrorDetail +// will say exactly what was invalid. ErrorDetail is not guaranteed +// to return a non-nil value and like the rest of the http2 package, +// its return value is not protected by an API compatibility promise. +// ErrorDetail is reset after the next call to ReadFrame. +func (fr *Framer) ErrorDetail() error { + return fr.errDetail +} + +// ErrFrameTooLarge is returned from Framer.ReadFrame when the peer +// sends a frame that is larger than declared with SetMaxReadFrameSize. +var ErrFrameTooLarge = errors.New("http2: frame too large") + +// terminalReadFrameError reports whether err is an unrecoverable +// error from ReadFrame and no other frames should be read. +func terminalReadFrameError(err error) bool { + if _, ok := err.(StreamError); ok { + return false + } + return err != nil +} + +// ReadFrame reads a single frame. The returned Frame is only valid +// until the next call to ReadFrame. +// +// If the frame is larger than previously set with SetMaxReadFrameSize, the +// returned error is ErrFrameTooLarge. Other errors may be of type +// ConnectionError, StreamError, or anything else from from the underlying +// reader. +func (fr *Framer) ReadFrame() (Frame, error) { + fr.errDetail = nil + if fr.lastFrame != nil { + fr.lastFrame.invalidate() + } + fh, err := readFrameHeader(fr.headerBuf[:], fr.r) + if err != nil { + return nil, err + } + if fh.Length > fr.maxReadSize { + return nil, ErrFrameTooLarge + } + payload := fr.getReadBuf(fh.Length) + if _, err := io.ReadFull(fr.r, payload); err != nil { + return nil, err + } + f, err := typeFrameParser(fh.Type)(fh, payload) + if err != nil { + if ce, ok := err.(connError); ok { + return nil, fr.connError(ce.Code, ce.Reason) + } + return nil, err + } + if err := fr.checkFrameOrder(f); err != nil { + return nil, err + } + if fr.logReads { + log.Printf("http2: Framer %p: read %v", fr, summarizeFrame(f)) + } + if fh.Type == FrameHeaders && fr.ReadMetaHeaders != nil { + return fr.readMetaFrame(f.(*HeadersFrame)) + } + return f, nil +} + +// connError returns ConnectionError(code) but first +// stashes away a public reason to the caller can optionally relay it +// to the peer before hanging up on them. This might help others debug +// their implementations. +func (fr *Framer) connError(code ErrCode, reason string) error { + fr.errDetail = errors.New(reason) + return ConnectionError(code) +} + +// checkFrameOrder reports an error if f is an invalid frame to return +// next from ReadFrame. Mostly it checks whether HEADERS and +// CONTINUATION frames are contiguous. +func (fr *Framer) checkFrameOrder(f Frame) error { + last := fr.lastFrame + fr.lastFrame = f + if fr.AllowIllegalReads { + return nil + } + + fh := f.Header() + if fr.lastHeaderStream != 0 { + if fh.Type != FrameContinuation { + return fr.connError(ErrCodeProtocol, + fmt.Sprintf("got %s for stream %d; expected CONTINUATION following %s for stream %d", + fh.Type, fh.StreamID, + last.Header().Type, fr.lastHeaderStream)) + } + if fh.StreamID != fr.lastHeaderStream { + return fr.connError(ErrCodeProtocol, + fmt.Sprintf("got CONTINUATION for stream %d; expected stream %d", + fh.StreamID, fr.lastHeaderStream)) + } + } else if fh.Type == FrameContinuation { + return fr.connError(ErrCodeProtocol, fmt.Sprintf("unexpected CONTINUATION for stream %d", fh.StreamID)) + } + + switch fh.Type { + case FrameHeaders, FrameContinuation: + if fh.Flags.Has(FlagHeadersEndHeaders) { + fr.lastHeaderStream = 0 + } else { + fr.lastHeaderStream = fh.StreamID + } + } + + return nil +} + +// A DataFrame conveys arbitrary, variable-length sequences of octets +// associated with a stream. +// See http://http2.github.io/http2-spec/#rfc.section.6.1 +type DataFrame struct { + FrameHeader + data []byte +} + +func (f *DataFrame) StreamEnded() bool { + return f.FrameHeader.Flags.Has(FlagDataEndStream) +} + +// Data returns the frame's data octets, not including any padding +// size byte or padding suffix bytes. +// The caller must not retain the returned memory past the next +// call to ReadFrame. +func (f *DataFrame) Data() []byte { + f.checkValid() + return f.data +} + +func parseDataFrame(fh FrameHeader, payload []byte) (Frame, error) { + if fh.StreamID == 0 { + // DATA frames MUST be associated with a stream. If a + // DATA frame is received whose stream identifier + // field is 0x0, the recipient MUST respond with a + // connection error (Section 5.4.1) of type + // PROTOCOL_ERROR. + return nil, connError{ErrCodeProtocol, "DATA frame with stream ID 0"} + } + f := &DataFrame{ + FrameHeader: fh, + } + var padSize byte + if fh.Flags.Has(FlagDataPadded) { + var err error + payload, padSize, err = readByte(payload) + if err != nil { + return nil, err + } + } + if int(padSize) > len(payload) { + // If the length of the padding is greater than the + // length of the frame payload, the recipient MUST + // treat this as a connection error. + // Filed: https://github.com/http2/http2-spec/issues/610 + return nil, connError{ErrCodeProtocol, "pad size larger than data payload"} + } + f.data = payload[:len(payload)-int(padSize)] + return f, nil +} + +var errStreamID = errors.New("invalid streamid") + +func validStreamID(streamID uint32) bool { + return streamID != 0 && streamID&(1<<31) == 0 +} + +// WriteData writes a DATA frame. +// +// It will perform exactly one Write to the underlying Writer. +// It is the caller's responsibility to not call other Write methods concurrently. +func (f *Framer) WriteData(streamID uint32, endStream bool, data []byte) error { + // TODO: ignoring padding for now. will add when somebody cares. + if !validStreamID(streamID) && !f.AllowIllegalWrites { + return errStreamID + } + var flags Flags + if endStream { + flags |= FlagDataEndStream + } + f.startWrite(FrameData, flags, streamID) + f.wbuf = append(f.wbuf, data...) + return f.endWrite() +} + +// A SettingsFrame conveys configuration parameters that affect how +// endpoints communicate, such as preferences and constraints on peer +// behavior. +// +// See http://http2.github.io/http2-spec/#SETTINGS +type SettingsFrame struct { + FrameHeader + p []byte +} + +func parseSettingsFrame(fh FrameHeader, p []byte) (Frame, error) { + if fh.Flags.Has(FlagSettingsAck) && fh.Length > 0 { + // When this (ACK 0x1) bit is set, the payload of the + // SETTINGS frame MUST be empty. Receipt of a + // SETTINGS frame with the ACK flag set and a length + // field value other than 0 MUST be treated as a + // connection error (Section 5.4.1) of type + // FRAME_SIZE_ERROR. + return nil, ConnectionError(ErrCodeFrameSize) + } + if fh.StreamID != 0 { + // SETTINGS frames always apply to a connection, + // never a single stream. The stream identifier for a + // SETTINGS frame MUST be zero (0x0). If an endpoint + // receives a SETTINGS frame whose stream identifier + // field is anything other than 0x0, the endpoint MUST + // respond with a connection error (Section 5.4.1) of + // type PROTOCOL_ERROR. + return nil, ConnectionError(ErrCodeProtocol) + } + if len(p)%6 != 0 { + // Expecting even number of 6 byte settings. + return nil, ConnectionError(ErrCodeFrameSize) + } + f := &SettingsFrame{FrameHeader: fh, p: p} + if v, ok := f.Value(SettingInitialWindowSize); ok && v > (1<<31)-1 { + // Values above the maximum flow control window size of 2^31 - 1 MUST + // be treated as a connection error (Section 5.4.1) of type + // FLOW_CONTROL_ERROR. + return nil, ConnectionError(ErrCodeFlowControl) + } + return f, nil +} + +func (f *SettingsFrame) IsAck() bool { + return f.FrameHeader.Flags.Has(FlagSettingsAck) +} + +func (f *SettingsFrame) Value(s SettingID) (v uint32, ok bool) { + f.checkValid() + buf := f.p + for len(buf) > 0 { + settingID := SettingID(binary.BigEndian.Uint16(buf[:2])) + if settingID == s { + return binary.BigEndian.Uint32(buf[2:6]), true + } + buf = buf[6:] + } + return 0, false +} + +// ForeachSetting runs fn for each setting. +// It stops and returns the first error. +func (f *SettingsFrame) ForeachSetting(fn func(Setting) error) error { + f.checkValid() + buf := f.p + for len(buf) > 0 { + if err := fn(Setting{ + SettingID(binary.BigEndian.Uint16(buf[:2])), + binary.BigEndian.Uint32(buf[2:6]), + }); err != nil { + return err + } + buf = buf[6:] + } + return nil +} + +// WriteSettings writes a SETTINGS frame with zero or more settings +// specified and the ACK bit not set. +// +// It will perform exactly one Write to the underlying Writer. +// It is the caller's responsibility to not call other Write methods concurrently. +func (f *Framer) WriteSettings(settings ...Setting) error { + f.startWrite(FrameSettings, 0, 0) + for _, s := range settings { + f.writeUint16(uint16(s.ID)) + f.writeUint32(s.Val) + } + return f.endWrite() +} + +// WriteSettings writes an empty SETTINGS frame with the ACK bit set. +// +// It will perform exactly one Write to the underlying Writer. +// It is the caller's responsibility to not call other Write methods concurrently. +func (f *Framer) WriteSettingsAck() error { + f.startWrite(FrameSettings, FlagSettingsAck, 0) + return f.endWrite() +} + +// A PingFrame is a mechanism for measuring a minimal round trip time +// from the sender, as well as determining whether an idle connection +// is still functional. +// See http://http2.github.io/http2-spec/#rfc.section.6.7 +type PingFrame struct { + FrameHeader + Data [8]byte +} + +func (f *PingFrame) IsAck() bool { return f.Flags.Has(FlagPingAck) } + +func parsePingFrame(fh FrameHeader, payload []byte) (Frame, error) { + if len(payload) != 8 { + return nil, ConnectionError(ErrCodeFrameSize) + } + if fh.StreamID != 0 { + return nil, ConnectionError(ErrCodeProtocol) + } + f := &PingFrame{FrameHeader: fh} + copy(f.Data[:], payload) + return f, nil +} + +func (f *Framer) WritePing(ack bool, data [8]byte) error { + var flags Flags + if ack { + flags = FlagPingAck + } + f.startWrite(FramePing, flags, 0) + f.writeBytes(data[:]) + return f.endWrite() +} + +// A GoAwayFrame informs the remote peer to stop creating streams on this connection. +// See http://http2.github.io/http2-spec/#rfc.section.6.8 +type GoAwayFrame struct { + FrameHeader + LastStreamID uint32 + ErrCode ErrCode + debugData []byte +} + +// DebugData returns any debug data in the GOAWAY frame. Its contents +// are not defined. +// The caller must not retain the returned memory past the next +// call to ReadFrame. +func (f *GoAwayFrame) DebugData() []byte { + f.checkValid() + return f.debugData +} + +func parseGoAwayFrame(fh FrameHeader, p []byte) (Frame, error) { + if fh.StreamID != 0 { + return nil, ConnectionError(ErrCodeProtocol) + } + if len(p) < 8 { + return nil, ConnectionError(ErrCodeFrameSize) + } + return &GoAwayFrame{ + FrameHeader: fh, + LastStreamID: binary.BigEndian.Uint32(p[:4]) & (1<<31 - 1), + ErrCode: ErrCode(binary.BigEndian.Uint32(p[4:8])), + debugData: p[8:], + }, nil +} + +func (f *Framer) WriteGoAway(maxStreamID uint32, code ErrCode, debugData []byte) error { + f.startWrite(FrameGoAway, 0, 0) + f.writeUint32(maxStreamID & (1<<31 - 1)) + f.writeUint32(uint32(code)) + f.writeBytes(debugData) + return f.endWrite() +} + +// An UnknownFrame is the frame type returned when the frame type is unknown +// or no specific frame type parser exists. +type UnknownFrame struct { + FrameHeader + p []byte +} + +// Payload returns the frame's payload (after the header). It is not +// valid to call this method after a subsequent call to +// Framer.ReadFrame, nor is it valid to retain the returned slice. +// The memory is owned by the Framer and is invalidated when the next +// frame is read. +func (f *UnknownFrame) Payload() []byte { + f.checkValid() + return f.p +} + +func parseUnknownFrame(fh FrameHeader, p []byte) (Frame, error) { + return &UnknownFrame{fh, p}, nil +} + +// A WindowUpdateFrame is used to implement flow control. +// See http://http2.github.io/http2-spec/#rfc.section.6.9 +type WindowUpdateFrame struct { + FrameHeader + Increment uint32 // never read with high bit set +} + +func parseWindowUpdateFrame(fh FrameHeader, p []byte) (Frame, error) { + if len(p) != 4 { + return nil, ConnectionError(ErrCodeFrameSize) + } + inc := binary.BigEndian.Uint32(p[:4]) & 0x7fffffff // mask off high reserved bit + if inc == 0 { + // A receiver MUST treat the receipt of a + // WINDOW_UPDATE frame with an flow control window + // increment of 0 as a stream error (Section 5.4.2) of + // type PROTOCOL_ERROR; errors on the connection flow + // control window MUST be treated as a connection + // error (Section 5.4.1). + if fh.StreamID == 0 { + return nil, ConnectionError(ErrCodeProtocol) + } + return nil, StreamError{fh.StreamID, ErrCodeProtocol} + } + return &WindowUpdateFrame{ + FrameHeader: fh, + Increment: inc, + }, nil +} + +// WriteWindowUpdate writes a WINDOW_UPDATE frame. +// The increment value must be between 1 and 2,147,483,647, inclusive. +// If the Stream ID is zero, the window update applies to the +// connection as a whole. +func (f *Framer) WriteWindowUpdate(streamID, incr uint32) error { + // "The legal range for the increment to the flow control window is 1 to 2^31-1 (2,147,483,647) octets." + if (incr < 1 || incr > 2147483647) && !f.AllowIllegalWrites { + return errors.New("illegal window increment value") + } + f.startWrite(FrameWindowUpdate, 0, streamID) + f.writeUint32(incr) + return f.endWrite() +} + +// A HeadersFrame is used to open a stream and additionally carries a +// header block fragment. +type HeadersFrame struct { + FrameHeader + + // Priority is set if FlagHeadersPriority is set in the FrameHeader. + Priority PriorityParam + + headerFragBuf []byte // not owned +} + +func (f *HeadersFrame) HeaderBlockFragment() []byte { + f.checkValid() + return f.headerFragBuf +} + +func (f *HeadersFrame) HeadersEnded() bool { + return f.FrameHeader.Flags.Has(FlagHeadersEndHeaders) +} + +func (f *HeadersFrame) StreamEnded() bool { + return f.FrameHeader.Flags.Has(FlagHeadersEndStream) +} + +func (f *HeadersFrame) HasPriority() bool { + return f.FrameHeader.Flags.Has(FlagHeadersPriority) +} + +func parseHeadersFrame(fh FrameHeader, p []byte) (_ Frame, err error) { + hf := &HeadersFrame{ + FrameHeader: fh, + } + if fh.StreamID == 0 { + // HEADERS frames MUST be associated with a stream. If a HEADERS frame + // is received whose stream identifier field is 0x0, the recipient MUST + // respond with a connection error (Section 5.4.1) of type + // PROTOCOL_ERROR. + return nil, connError{ErrCodeProtocol, "HEADERS frame with stream ID 0"} + } + var padLength uint8 + if fh.Flags.Has(FlagHeadersPadded) { + if p, padLength, err = readByte(p); err != nil { + return + } + } + if fh.Flags.Has(FlagHeadersPriority) { + var v uint32 + p, v, err = readUint32(p) + if err != nil { + return nil, err + } + hf.Priority.StreamDep = v & 0x7fffffff + hf.Priority.Exclusive = (v != hf.Priority.StreamDep) // high bit was set + p, hf.Priority.Weight, err = readByte(p) + if err != nil { + return nil, err + } + } + if len(p)-int(padLength) <= 0 { + return nil, StreamError{fh.StreamID, ErrCodeProtocol} + } + hf.headerFragBuf = p[:len(p)-int(padLength)] + return hf, nil +} + +// HeadersFrameParam are the parameters for writing a HEADERS frame. +type HeadersFrameParam struct { + // StreamID is the required Stream ID to initiate. + StreamID uint32 + // BlockFragment is part (or all) of a Header Block. + BlockFragment []byte + + // EndStream indicates that the header block is the last that + // the endpoint will send for the identified stream. Setting + // this flag causes the stream to enter one of "half closed" + // states. + EndStream bool + + // EndHeaders indicates that this frame contains an entire + // header block and is not followed by any + // CONTINUATION frames. + EndHeaders bool + + // PadLength is the optional number of bytes of zeros to add + // to this frame. + PadLength uint8 + + // Priority, if non-zero, includes stream priority information + // in the HEADER frame. + Priority PriorityParam +} + +// WriteHeaders writes a single HEADERS frame. +// +// This is a low-level header writing method. Encoding headers and +// splitting them into any necessary CONTINUATION frames is handled +// elsewhere. +// +// It will perform exactly one Write to the underlying Writer. +// It is the caller's responsibility to not call other Write methods concurrently. +func (f *Framer) WriteHeaders(p HeadersFrameParam) error { + if !validStreamID(p.StreamID) && !f.AllowIllegalWrites { + return errStreamID + } + var flags Flags + if p.PadLength != 0 { + flags |= FlagHeadersPadded + } + if p.EndStream { + flags |= FlagHeadersEndStream + } + if p.EndHeaders { + flags |= FlagHeadersEndHeaders + } + if !p.Priority.IsZero() { + flags |= FlagHeadersPriority + } + f.startWrite(FrameHeaders, flags, p.StreamID) + if p.PadLength != 0 { + f.writeByte(p.PadLength) + } + if !p.Priority.IsZero() { + v := p.Priority.StreamDep + if !validStreamID(v) && !f.AllowIllegalWrites { + return errors.New("invalid dependent stream id") + } + if p.Priority.Exclusive { + v |= 1 << 31 + } + f.writeUint32(v) + f.writeByte(p.Priority.Weight) + } + f.wbuf = append(f.wbuf, p.BlockFragment...) + f.wbuf = append(f.wbuf, padZeros[:p.PadLength]...) + return f.endWrite() +} + +// A PriorityFrame specifies the sender-advised priority of a stream. +// See http://http2.github.io/http2-spec/#rfc.section.6.3 +type PriorityFrame struct { + FrameHeader + PriorityParam +} + +// PriorityParam are the stream prioritzation parameters. +type PriorityParam struct { + // StreamDep is a 31-bit stream identifier for the + // stream that this stream depends on. Zero means no + // dependency. + StreamDep uint32 + + // Exclusive is whether the dependency is exclusive. + Exclusive bool + + // Weight is the stream's zero-indexed weight. It should be + // set together with StreamDep, or neither should be set. Per + // the spec, "Add one to the value to obtain a weight between + // 1 and 256." + Weight uint8 +} + +func (p PriorityParam) IsZero() bool { + return p == PriorityParam{} +} + +func parsePriorityFrame(fh FrameHeader, payload []byte) (Frame, error) { + if fh.StreamID == 0 { + return nil, connError{ErrCodeProtocol, "PRIORITY frame with stream ID 0"} + } + if len(payload) != 5 { + return nil, connError{ErrCodeFrameSize, fmt.Sprintf("PRIORITY frame payload size was %d; want 5", len(payload))} + } + v := binary.BigEndian.Uint32(payload[:4]) + streamID := v & 0x7fffffff // mask off high bit + return &PriorityFrame{ + FrameHeader: fh, + PriorityParam: PriorityParam{ + Weight: payload[4], + StreamDep: streamID, + Exclusive: streamID != v, // was high bit set? + }, + }, nil +} + +// WritePriority writes a PRIORITY frame. +// +// It will perform exactly one Write to the underlying Writer. +// It is the caller's responsibility to not call other Write methods concurrently. +func (f *Framer) WritePriority(streamID uint32, p PriorityParam) error { + if !validStreamID(streamID) && !f.AllowIllegalWrites { + return errStreamID + } + f.startWrite(FramePriority, 0, streamID) + v := p.StreamDep + if p.Exclusive { + v |= 1 << 31 + } + f.writeUint32(v) + f.writeByte(p.Weight) + return f.endWrite() +} + +// A RSTStreamFrame allows for abnormal termination of a stream. +// See http://http2.github.io/http2-spec/#rfc.section.6.4 +type RSTStreamFrame struct { + FrameHeader + ErrCode ErrCode +} + +func parseRSTStreamFrame(fh FrameHeader, p []byte) (Frame, error) { + if len(p) != 4 { + return nil, ConnectionError(ErrCodeFrameSize) + } + if fh.StreamID == 0 { + return nil, ConnectionError(ErrCodeProtocol) + } + return &RSTStreamFrame{fh, ErrCode(binary.BigEndian.Uint32(p[:4]))}, nil +} + +// WriteRSTStream writes a RST_STREAM frame. +// +// It will perform exactly one Write to the underlying Writer. +// It is the caller's responsibility to not call other Write methods concurrently. +func (f *Framer) WriteRSTStream(streamID uint32, code ErrCode) error { + if !validStreamID(streamID) && !f.AllowIllegalWrites { + return errStreamID + } + f.startWrite(FrameRSTStream, 0, streamID) + f.writeUint32(uint32(code)) + return f.endWrite() +} + +// A ContinuationFrame is used to continue a sequence of header block fragments. +// See http://http2.github.io/http2-spec/#rfc.section.6.10 +type ContinuationFrame struct { + FrameHeader + headerFragBuf []byte +} + +func parseContinuationFrame(fh FrameHeader, p []byte) (Frame, error) { + if fh.StreamID == 0 { + return nil, connError{ErrCodeProtocol, "CONTINUATION frame with stream ID 0"} + } + return &ContinuationFrame{fh, p}, nil +} + +func (f *ContinuationFrame) HeaderBlockFragment() []byte { + f.checkValid() + return f.headerFragBuf +} + +func (f *ContinuationFrame) HeadersEnded() bool { + return f.FrameHeader.Flags.Has(FlagContinuationEndHeaders) +} + +// WriteContinuation writes a CONTINUATION frame. +// +// It will perform exactly one Write to the underlying Writer. +// It is the caller's responsibility to not call other Write methods concurrently. +func (f *Framer) WriteContinuation(streamID uint32, endHeaders bool, headerBlockFragment []byte) error { + if !validStreamID(streamID) && !f.AllowIllegalWrites { + return errStreamID + } + var flags Flags + if endHeaders { + flags |= FlagContinuationEndHeaders + } + f.startWrite(FrameContinuation, flags, streamID) + f.wbuf = append(f.wbuf, headerBlockFragment...) + return f.endWrite() +} + +// A PushPromiseFrame is used to initiate a server stream. +// See http://http2.github.io/http2-spec/#rfc.section.6.6 +type PushPromiseFrame struct { + FrameHeader + PromiseID uint32 + headerFragBuf []byte // not owned +} + +func (f *PushPromiseFrame) HeaderBlockFragment() []byte { + f.checkValid() + return f.headerFragBuf +} + +func (f *PushPromiseFrame) HeadersEnded() bool { + return f.FrameHeader.Flags.Has(FlagPushPromiseEndHeaders) +} + +func parsePushPromise(fh FrameHeader, p []byte) (_ Frame, err error) { + pp := &PushPromiseFrame{ + FrameHeader: fh, + } + if pp.StreamID == 0 { + // PUSH_PROMISE frames MUST be associated with an existing, + // peer-initiated stream. The stream identifier of a + // PUSH_PROMISE frame indicates the stream it is associated + // with. If the stream identifier field specifies the value + // 0x0, a recipient MUST respond with a connection error + // (Section 5.4.1) of type PROTOCOL_ERROR. + return nil, ConnectionError(ErrCodeProtocol) + } + // The PUSH_PROMISE frame includes optional padding. + // Padding fields and flags are identical to those defined for DATA frames + var padLength uint8 + if fh.Flags.Has(FlagPushPromisePadded) { + if p, padLength, err = readByte(p); err != nil { + return + } + } + + p, pp.PromiseID, err = readUint32(p) + if err != nil { + return + } + pp.PromiseID = pp.PromiseID & (1<<31 - 1) + + if int(padLength) > len(p) { + // like the DATA frame, error out if padding is longer than the body. + return nil, ConnectionError(ErrCodeProtocol) + } + pp.headerFragBuf = p[:len(p)-int(padLength)] + return pp, nil +} + +// PushPromiseParam are the parameters for writing a PUSH_PROMISE frame. +type PushPromiseParam struct { + // StreamID is the required Stream ID to initiate. + StreamID uint32 + + // PromiseID is the required Stream ID which this + // Push Promises + PromiseID uint32 + + // BlockFragment is part (or all) of a Header Block. + BlockFragment []byte + + // EndHeaders indicates that this frame contains an entire + // header block and is not followed by any + // CONTINUATION frames. + EndHeaders bool + + // PadLength is the optional number of bytes of zeros to add + // to this frame. + PadLength uint8 +} + +// WritePushPromise writes a single PushPromise Frame. +// +// As with Header Frames, This is the low level call for writing +// individual frames. Continuation frames are handled elsewhere. +// +// It will perform exactly one Write to the underlying Writer. +// It is the caller's responsibility to not call other Write methods concurrently. +func (f *Framer) WritePushPromise(p PushPromiseParam) error { + if !validStreamID(p.StreamID) && !f.AllowIllegalWrites { + return errStreamID + } + var flags Flags + if p.PadLength != 0 { + flags |= FlagPushPromisePadded + } + if p.EndHeaders { + flags |= FlagPushPromiseEndHeaders + } + f.startWrite(FramePushPromise, flags, p.StreamID) + if p.PadLength != 0 { + f.writeByte(p.PadLength) + } + if !validStreamID(p.PromiseID) && !f.AllowIllegalWrites { + return errStreamID + } + f.writeUint32(p.PromiseID) + f.wbuf = append(f.wbuf, p.BlockFragment...) + f.wbuf = append(f.wbuf, padZeros[:p.PadLength]...) + return f.endWrite() +} + +// WriteRawFrame writes a raw frame. This can be used to write +// extension frames unknown to this package. +func (f *Framer) WriteRawFrame(t FrameType, flags Flags, streamID uint32, payload []byte) error { + f.startWrite(t, flags, streamID) + f.writeBytes(payload) + return f.endWrite() +} + +func readByte(p []byte) (remain []byte, b byte, err error) { + if len(p) == 0 { + return nil, 0, io.ErrUnexpectedEOF + } + return p[1:], p[0], nil +} + +func readUint32(p []byte) (remain []byte, v uint32, err error) { + if len(p) < 4 { + return nil, 0, io.ErrUnexpectedEOF + } + return p[4:], binary.BigEndian.Uint32(p[:4]), nil +} + +type streamEnder interface { + StreamEnded() bool +} + +type headersEnder interface { + HeadersEnded() bool +} + +type headersOrContinuation interface { + headersEnder + HeaderBlockFragment() []byte +} + +// A MetaHeadersFrame is the representation of one HEADERS frame and +// zero or more contiguous CONTINUATION frames and the decoding of +// their HPACK-encoded contents. +// +// This type of frame does not appear on the wire and is only returned +// by the Framer when Framer.ReadMetaHeaders is set. +type MetaHeadersFrame struct { + *HeadersFrame + + // Fields are the fields contained in the HEADERS and + // CONTINUATION frames. The underlying slice is owned by the + // Framer and must not be retained after the next call to + // ReadFrame. + // + // Fields are guaranteed to be in the correct http2 order and + // not have unknown pseudo header fields or invalid header + // field names or values. Required pseudo header fields may be + // missing, however. Use the MetaHeadersFrame.Pseudo accessor + // method access pseudo headers. + Fields []hpack.HeaderField + + // Truncated is whether the max header list size limit was hit + // and Fields is incomplete. The hpack decoder state is still + // valid, however. + Truncated bool +} + +// PseudoValue returns the given pseudo header field's value. +// The provided pseudo field should not contain the leading colon. +func (mh *MetaHeadersFrame) PseudoValue(pseudo string) string { + for _, hf := range mh.Fields { + if !hf.IsPseudo() { + return "" + } + if hf.Name[1:] == pseudo { + return hf.Value + } + } + return "" +} + +// RegularFields returns the regular (non-pseudo) header fields of mh. +// The caller does not own the returned slice. +func (mh *MetaHeadersFrame) RegularFields() []hpack.HeaderField { + for i, hf := range mh.Fields { + if !hf.IsPseudo() { + return mh.Fields[i:] + } + } + return nil +} + +// PseudoFields returns the pseudo header fields of mh. +// The caller does not own the returned slice. +func (mh *MetaHeadersFrame) PseudoFields() []hpack.HeaderField { + for i, hf := range mh.Fields { + if !hf.IsPseudo() { + return mh.Fields[:i] + } + } + return mh.Fields +} + +func (mh *MetaHeadersFrame) checkPseudos() error { + var isRequest, isResponse bool + pf := mh.PseudoFields() + for i, hf := range pf { + switch hf.Name { + case ":method", ":path", ":scheme", ":authority": + isRequest = true + case ":status": + isResponse = true + default: + return pseudoHeaderError(hf.Name) + } + // Check for duplicates. + // This would be a bad algorithm, but N is 4. + // And this doesn't allocate. + for _, hf2 := range pf[:i] { + if hf.Name == hf2.Name { + return duplicatePseudoHeaderError(hf.Name) + } + } + } + if isRequest && isResponse { + return errMixPseudoHeaderTypes + } + return nil +} + +func (fr *Framer) maxHeaderStringLen() int { + v := fr.maxHeaderListSize() + if uint32(int(v)) == v { + return int(v) + } + // They had a crazy big number for MaxHeaderBytes anyway, + // so give them unlimited header lengths: + return 0 +} + +// readMetaFrame returns 0 or more CONTINUATION frames from fr and +// merge them into into the provided hf and returns a MetaHeadersFrame +// with the decoded hpack values. +func (fr *Framer) readMetaFrame(hf *HeadersFrame) (*MetaHeadersFrame, error) { + if fr.AllowIllegalReads { + return nil, errors.New("illegal use of AllowIllegalReads with ReadMetaHeaders") + } + mh := &MetaHeadersFrame{ + HeadersFrame: hf, + } + var remainSize = fr.maxHeaderListSize() + var sawRegular bool + + var invalid error // pseudo header field errors + hdec := fr.ReadMetaHeaders + hdec.SetEmitEnabled(true) + hdec.SetMaxStringLength(fr.maxHeaderStringLen()) + hdec.SetEmitFunc(func(hf hpack.HeaderField) { + if !validHeaderFieldValue(hf.Value) { + invalid = headerFieldValueError(hf.Value) + } + isPseudo := strings.HasPrefix(hf.Name, ":") + if isPseudo { + if sawRegular { + invalid = errPseudoAfterRegular + } + } else { + sawRegular = true + if !validHeaderFieldName(hf.Name) { + invalid = headerFieldNameError(hf.Name) + } + } + + if invalid != nil { + hdec.SetEmitEnabled(false) + return + } + + size := hf.Size() + if size > remainSize { + hdec.SetEmitEnabled(false) + mh.Truncated = true + return + } + remainSize -= size + + mh.Fields = append(mh.Fields, hf) + }) + // Lose reference to MetaHeadersFrame: + defer hdec.SetEmitFunc(func(hf hpack.HeaderField) {}) + + var hc headersOrContinuation = hf + for { + frag := hc.HeaderBlockFragment() + if _, err := hdec.Write(frag); err != nil { + return nil, ConnectionError(ErrCodeCompression) + } + + if hc.HeadersEnded() { + break + } + if f, err := fr.ReadFrame(); err != nil { + return nil, err + } else { + hc = f.(*ContinuationFrame) // guaranteed by checkFrameOrder + } + } + + mh.HeadersFrame.headerFragBuf = nil + mh.HeadersFrame.invalidate() + + if err := hdec.Close(); err != nil { + return nil, ConnectionError(ErrCodeCompression) + } + if invalid != nil { + fr.errDetail = invalid + return nil, StreamError{mh.StreamID, ErrCodeProtocol} + } + if err := mh.checkPseudos(); err != nil { + fr.errDetail = err + return nil, StreamError{mh.StreamID, ErrCodeProtocol} + } + return mh, nil +} + +func summarizeFrame(f Frame) string { + var buf bytes.Buffer + f.Header().writeDebug(&buf) + switch f := f.(type) { + case *SettingsFrame: + n := 0 + f.ForeachSetting(func(s Setting) error { + n++ + if n == 1 { + buf.WriteString(", settings:") + } + fmt.Fprintf(&buf, " %v=%v,", s.ID, s.Val) + return nil + }) + if n > 0 { + buf.Truncate(buf.Len() - 1) // remove trailing comma + } + case *DataFrame: + data := f.Data() + const max = 256 + if len(data) > max { + data = data[:max] + } + fmt.Fprintf(&buf, " data=%q", data) + if len(f.Data()) > max { + fmt.Fprintf(&buf, " (%d bytes omitted)", len(f.Data())-max) + } + case *WindowUpdateFrame: + if f.StreamID == 0 { + buf.WriteString(" (conn)") + } + fmt.Fprintf(&buf, " incr=%v", f.Increment) + case *PingFrame: + fmt.Fprintf(&buf, " ping=%q", f.Data[:]) + case *GoAwayFrame: + fmt.Fprintf(&buf, " LastStreamID=%v ErrCode=%v Debug=%q", + f.LastStreamID, f.ErrCode, f.debugData) + case *RSTStreamFrame: + fmt.Fprintf(&buf, " ErrCode=%v", f.ErrCode) + } + return buf.String() +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/go15.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/go15.go new file mode 100644 index 00000000000..f0a56241415 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/go15.go @@ -0,0 +1,11 @@ +// Copyright 2015 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. + +// +build go1.5 + +package http2 + +import "net/http" + +func requestCancel(req *http.Request) <-chan struct{} { return req.Cancel } diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/gotrack.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/gotrack.go new file mode 100644 index 00000000000..9933c9f8c74 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/gotrack.go @@ -0,0 +1,170 @@ +// Copyright 2014 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. + +// Defensive debug-only utility to track that functions run on the +// goroutine that they're supposed to. + +package http2 + +import ( + "bytes" + "errors" + "fmt" + "os" + "runtime" + "strconv" + "sync" +) + +var DebugGoroutines = os.Getenv("DEBUG_HTTP2_GOROUTINES") == "1" + +type goroutineLock uint64 + +func newGoroutineLock() goroutineLock { + if !DebugGoroutines { + return 0 + } + return goroutineLock(curGoroutineID()) +} + +func (g goroutineLock) check() { + if !DebugGoroutines { + return + } + if curGoroutineID() != uint64(g) { + panic("running on the wrong goroutine") + } +} + +func (g goroutineLock) checkNotOn() { + if !DebugGoroutines { + return + } + if curGoroutineID() == uint64(g) { + panic("running on the wrong goroutine") + } +} + +var goroutineSpace = []byte("goroutine ") + +func curGoroutineID() uint64 { + bp := littleBuf.Get().(*[]byte) + defer littleBuf.Put(bp) + b := *bp + b = b[:runtime.Stack(b, false)] + // Parse the 4707 out of "goroutine 4707 [" + b = bytes.TrimPrefix(b, goroutineSpace) + i := bytes.IndexByte(b, ' ') + if i < 0 { + panic(fmt.Sprintf("No space found in %q", b)) + } + b = b[:i] + n, err := parseUintBytes(b, 10, 64) + if err != nil { + panic(fmt.Sprintf("Failed to parse goroutine ID out of %q: %v", b, err)) + } + return n +} + +var littleBuf = sync.Pool{ + New: func() interface{} { + buf := make([]byte, 64) + return &buf + }, +} + +// parseUintBytes is like strconv.ParseUint, but using a []byte. +func parseUintBytes(s []byte, base int, bitSize int) (n uint64, err error) { + var cutoff, maxVal uint64 + + if bitSize == 0 { + bitSize = int(strconv.IntSize) + } + + s0 := s + switch { + case len(s) < 1: + err = strconv.ErrSyntax + goto Error + + case 2 <= base && base <= 36: + // valid base; nothing to do + + case base == 0: + // Look for octal, hex prefix. + switch { + case s[0] == '0' && len(s) > 1 && (s[1] == 'x' || s[1] == 'X'): + base = 16 + s = s[2:] + if len(s) < 1 { + err = strconv.ErrSyntax + goto Error + } + case s[0] == '0': + base = 8 + default: + base = 10 + } + + default: + err = errors.New("invalid base " + strconv.Itoa(base)) + goto Error + } + + n = 0 + cutoff = cutoff64(base) + maxVal = 1<= base { + n = 0 + err = strconv.ErrSyntax + goto Error + } + + if n >= cutoff { + // n*base overflows + n = 1<<64 - 1 + err = strconv.ErrRange + goto Error + } + n *= uint64(base) + + n1 := n + uint64(v) + if n1 < n || n1 > maxVal { + // n+v overflows + n = 1<<64 - 1 + err = strconv.ErrRange + goto Error + } + n = n1 + } + + return n, nil + +Error: + return n, &strconv.NumError{Func: "ParseUint", Num: string(s0), Err: err} +} + +// Return the first number n such that n*base >= 1<<64. +func cutoff64(base int) uint64 { + if base < 2 { + return 0 + } + return (1<<64-1)/uint64(base) + 1 +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/headermap.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/headermap.go new file mode 100644 index 00000000000..c2805f6ac4d --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/headermap.go @@ -0,0 +1,78 @@ +// Copyright 2014 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 http2 + +import ( + "net/http" + "strings" +) + +var ( + commonLowerHeader = map[string]string{} // Go-Canonical-Case -> lower-case + commonCanonHeader = map[string]string{} // lower-case -> Go-Canonical-Case +) + +func init() { + for _, v := range []string{ + "accept", + "accept-charset", + "accept-encoding", + "accept-language", + "accept-ranges", + "age", + "access-control-allow-origin", + "allow", + "authorization", + "cache-control", + "content-disposition", + "content-encoding", + "content-language", + "content-length", + "content-location", + "content-range", + "content-type", + "cookie", + "date", + "etag", + "expect", + "expires", + "from", + "host", + "if-match", + "if-modified-since", + "if-none-match", + "if-unmodified-since", + "last-modified", + "link", + "location", + "max-forwards", + "proxy-authenticate", + "proxy-authorization", + "range", + "referer", + "refresh", + "retry-after", + "server", + "set-cookie", + "strict-transport-security", + "trailer", + "transfer-encoding", + "user-agent", + "vary", + "via", + "www-authenticate", + } { + chk := http.CanonicalHeaderKey(v) + commonLowerHeader[chk] = v + commonCanonHeader[v] = chk + } +} + +func lowerHeader(v string) string { + if s, ok := commonLowerHeader[v]; ok { + return s + } + return strings.ToLower(v) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/encode.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/encode.go new file mode 100644 index 00000000000..f9bb0339848 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/encode.go @@ -0,0 +1,251 @@ +// Copyright 2014 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 hpack + +import ( + "io" +) + +const ( + uint32Max = ^uint32(0) + initialHeaderTableSize = 4096 +) + +type Encoder struct { + dynTab dynamicTable + // minSize is the minimum table size set by + // SetMaxDynamicTableSize after the previous Header Table Size + // Update. + minSize uint32 + // maxSizeLimit is the maximum table size this encoder + // supports. This will protect the encoder from too large + // size. + maxSizeLimit uint32 + // tableSizeUpdate indicates whether "Header Table Size + // Update" is required. + tableSizeUpdate bool + w io.Writer + buf []byte +} + +// NewEncoder returns a new Encoder which performs HPACK encoding. An +// encoded data is written to w. +func NewEncoder(w io.Writer) *Encoder { + e := &Encoder{ + minSize: uint32Max, + maxSizeLimit: initialHeaderTableSize, + tableSizeUpdate: false, + w: w, + } + e.dynTab.setMaxSize(initialHeaderTableSize) + return e +} + +// WriteField encodes f into a single Write to e's underlying Writer. +// This function may also produce bytes for "Header Table Size Update" +// if necessary. If produced, it is done before encoding f. +func (e *Encoder) WriteField(f HeaderField) error { + e.buf = e.buf[:0] + + if e.tableSizeUpdate { + e.tableSizeUpdate = false + if e.minSize < e.dynTab.maxSize { + e.buf = appendTableSize(e.buf, e.minSize) + } + e.minSize = uint32Max + e.buf = appendTableSize(e.buf, e.dynTab.maxSize) + } + + idx, nameValueMatch := e.searchTable(f) + if nameValueMatch { + e.buf = appendIndexed(e.buf, idx) + } else { + indexing := e.shouldIndex(f) + if indexing { + e.dynTab.add(f) + } + + if idx == 0 { + e.buf = appendNewName(e.buf, f, indexing) + } else { + e.buf = appendIndexedName(e.buf, f, idx, indexing) + } + } + n, err := e.w.Write(e.buf) + if err == nil && n != len(e.buf) { + err = io.ErrShortWrite + } + return err +} + +// searchTable searches f in both stable and dynamic header tables. +// The static header table is searched first. Only when there is no +// exact match for both name and value, the dynamic header table is +// then searched. If there is no match, i is 0. If both name and value +// match, i is the matched index and nameValueMatch becomes true. If +// only name matches, i points to that index and nameValueMatch +// becomes false. +func (e *Encoder) searchTable(f HeaderField) (i uint64, nameValueMatch bool) { + for idx, hf := range staticTable { + if !constantTimeStringCompare(hf.Name, f.Name) { + continue + } + if i == 0 { + i = uint64(idx + 1) + } + if f.Sensitive { + continue + } + if !constantTimeStringCompare(hf.Value, f.Value) { + continue + } + i = uint64(idx + 1) + nameValueMatch = true + return + } + + j, nameValueMatch := e.dynTab.search(f) + if nameValueMatch || (i == 0 && j != 0) { + i = j + uint64(len(staticTable)) + } + return +} + +// SetMaxDynamicTableSize changes the dynamic header table size to v. +// The actual size is bounded by the value passed to +// SetMaxDynamicTableSizeLimit. +func (e *Encoder) SetMaxDynamicTableSize(v uint32) { + if v > e.maxSizeLimit { + v = e.maxSizeLimit + } + if v < e.minSize { + e.minSize = v + } + e.tableSizeUpdate = true + e.dynTab.setMaxSize(v) +} + +// SetMaxDynamicTableSizeLimit changes the maximum value that can be +// specified in SetMaxDynamicTableSize to v. By default, it is set to +// 4096, which is the same size of the default dynamic header table +// size described in HPACK specification. If the current maximum +// dynamic header table size is strictly greater than v, "Header Table +// Size Update" will be done in the next WriteField call and the +// maximum dynamic header table size is truncated to v. +func (e *Encoder) SetMaxDynamicTableSizeLimit(v uint32) { + e.maxSizeLimit = v + if e.dynTab.maxSize > v { + e.tableSizeUpdate = true + e.dynTab.setMaxSize(v) + } +} + +// shouldIndex reports whether f should be indexed. +func (e *Encoder) shouldIndex(f HeaderField) bool { + return !f.Sensitive && f.Size() <= e.dynTab.maxSize +} + +// appendIndexed appends index i, as encoded in "Indexed Header Field" +// representation, to dst and returns the extended buffer. +func appendIndexed(dst []byte, i uint64) []byte { + first := len(dst) + dst = appendVarInt(dst, 7, i) + dst[first] |= 0x80 + return dst +} + +// appendNewName appends f, as encoded in one of "Literal Header field +// - New Name" representation variants, to dst and returns the +// extended buffer. +// +// If f.Sensitive is true, "Never Indexed" representation is used. If +// f.Sensitive is false and indexing is true, "Inremental Indexing" +// representation is used. +func appendNewName(dst []byte, f HeaderField, indexing bool) []byte { + dst = append(dst, encodeTypeByte(indexing, f.Sensitive)) + dst = appendHpackString(dst, f.Name) + return appendHpackString(dst, f.Value) +} + +// appendIndexedName appends f and index i referring indexed name +// entry, as encoded in one of "Literal Header field - Indexed Name" +// representation variants, to dst and returns the extended buffer. +// +// If f.Sensitive is true, "Never Indexed" representation is used. If +// f.Sensitive is false and indexing is true, "Incremental Indexing" +// representation is used. +func appendIndexedName(dst []byte, f HeaderField, i uint64, indexing bool) []byte { + first := len(dst) + var n byte + if indexing { + n = 6 + } else { + n = 4 + } + dst = appendVarInt(dst, n, i) + dst[first] |= encodeTypeByte(indexing, f.Sensitive) + return appendHpackString(dst, f.Value) +} + +// appendTableSize appends v, as encoded in "Header Table Size Update" +// representation, to dst and returns the extended buffer. +func appendTableSize(dst []byte, v uint32) []byte { + first := len(dst) + dst = appendVarInt(dst, 5, uint64(v)) + dst[first] |= 0x20 + return dst +} + +// appendVarInt appends i, as encoded in variable integer form using n +// bit prefix, to dst and returns the extended buffer. +// +// See +// http://http2.github.io/http2-spec/compression.html#integer.representation +func appendVarInt(dst []byte, n byte, i uint64) []byte { + k := uint64((1 << n) - 1) + if i < k { + return append(dst, byte(i)) + } + dst = append(dst, byte(k)) + i -= k + for ; i >= 128; i >>= 7 { + dst = append(dst, byte(0x80|(i&0x7f))) + } + return append(dst, byte(i)) +} + +// appendHpackString appends s, as encoded in "String Literal" +// representation, to dst and returns the the extended buffer. +// +// s will be encoded in Huffman codes only when it produces strictly +// shorter byte string. +func appendHpackString(dst []byte, s string) []byte { + huffmanLength := HuffmanEncodeLength(s) + if huffmanLength < uint64(len(s)) { + first := len(dst) + dst = appendVarInt(dst, 7, huffmanLength) + dst = AppendHuffmanString(dst, s) + dst[first] |= 0x80 + } else { + dst = appendVarInt(dst, 7, uint64(len(s))) + dst = append(dst, s...) + } + return dst +} + +// encodeTypeByte returns type byte. If sensitive is true, type byte +// for "Never Indexed" representation is returned. If sensitive is +// false and indexing is true, type byte for "Incremental Indexing" +// representation is returned. Otherwise, type byte for "Without +// Indexing" is returned. +func encodeTypeByte(indexing, sensitive bool) byte { + if sensitive { + return 0x10 + } + if indexing { + return 0x40 + } + return 0 +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/hpack.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/hpack.go new file mode 100644 index 00000000000..dcf257afa41 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/hpack.go @@ -0,0 +1,542 @@ +// Copyright 2014 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 hpack implements HPACK, a compression format for +// efficiently representing HTTP header fields in the context of HTTP/2. +// +// See http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-09 +package hpack + +import ( + "bytes" + "errors" + "fmt" +) + +// A DecodingError is something the spec defines as a decoding error. +type DecodingError struct { + Err error +} + +func (de DecodingError) Error() string { + return fmt.Sprintf("decoding error: %v", de.Err) +} + +// An InvalidIndexError is returned when an encoder references a table +// entry before the static table or after the end of the dynamic table. +type InvalidIndexError int + +func (e InvalidIndexError) Error() string { + return fmt.Sprintf("invalid indexed representation index %d", int(e)) +} + +// A HeaderField is a name-value pair. Both the name and value are +// treated as opaque sequences of octets. +type HeaderField struct { + Name, Value string + + // Sensitive means that this header field should never be + // indexed. + Sensitive bool +} + +// IsPseudo reports whether the header field is an http2 pseudo header. +// That is, it reports whether it starts with a colon. +// It is not otherwise guaranteed to be a valid psuedo header field, +// though. +func (hf HeaderField) IsPseudo() bool { + return len(hf.Name) != 0 && hf.Name[0] == ':' +} + +func (hf HeaderField) String() string { + var suffix string + if hf.Sensitive { + suffix = " (sensitive)" + } + return fmt.Sprintf("header field %q = %q%s", hf.Name, hf.Value, suffix) +} + +// Size returns the size of an entry per RFC 7540 section 5.2. +func (hf HeaderField) Size() uint32 { + // http://http2.github.io/http2-spec/compression.html#rfc.section.4.1 + // "The size of the dynamic table is the sum of the size of + // its entries. The size of an entry is the sum of its name's + // length in octets (as defined in Section 5.2), its value's + // length in octets (see Section 5.2), plus 32. The size of + // an entry is calculated using the length of the name and + // value without any Huffman encoding applied." + + // This can overflow if somebody makes a large HeaderField + // Name and/or Value by hand, but we don't care, because that + // won't happen on the wire because the encoding doesn't allow + // it. + return uint32(len(hf.Name) + len(hf.Value) + 32) +} + +// A Decoder is the decoding context for incremental processing of +// header blocks. +type Decoder struct { + dynTab dynamicTable + emit func(f HeaderField) + + emitEnabled bool // whether calls to emit are enabled + maxStrLen int // 0 means unlimited + + // buf is the unparsed buffer. It's only written to + // saveBuf if it was truncated in the middle of a header + // block. Because it's usually not owned, we can only + // process it under Write. + buf []byte // not owned; only valid during Write + + // saveBuf is previous data passed to Write which we weren't able + // to fully parse before. Unlike buf, we own this data. + saveBuf bytes.Buffer +} + +// NewDecoder returns a new decoder with the provided maximum dynamic +// table size. The emitFunc will be called for each valid field +// parsed, in the same goroutine as calls to Write, before Write returns. +func NewDecoder(maxDynamicTableSize uint32, emitFunc func(f HeaderField)) *Decoder { + d := &Decoder{ + emit: emitFunc, + emitEnabled: true, + } + d.dynTab.allowedMaxSize = maxDynamicTableSize + d.dynTab.setMaxSize(maxDynamicTableSize) + return d +} + +// ErrStringLength is returned by Decoder.Write when the max string length +// (as configured by Decoder.SetMaxStringLength) would be violated. +var ErrStringLength = errors.New("hpack: string too long") + +// SetMaxStringLength sets the maximum size of a HeaderField name or +// value string. If a string exceeds this length (even after any +// decompression), Write will return ErrStringLength. +// A value of 0 means unlimited and is the default from NewDecoder. +func (d *Decoder) SetMaxStringLength(n int) { + d.maxStrLen = n +} + +// SetEmitFunc changes the callback used when new header fields +// are decoded. +// It must be non-nil. It does not affect EmitEnabled. +func (d *Decoder) SetEmitFunc(emitFunc func(f HeaderField)) { + d.emit = emitFunc +} + +// SetEmitEnabled controls whether the emitFunc provided to NewDecoder +// should be called. The default is true. +// +// This facility exists to let servers enforce MAX_HEADER_LIST_SIZE +// while still decoding and keeping in-sync with decoder state, but +// without doing unnecessary decompression or generating unnecessary +// garbage for header fields past the limit. +func (d *Decoder) SetEmitEnabled(v bool) { d.emitEnabled = v } + +// EmitEnabled reports whether calls to the emitFunc provided to NewDecoder +// are currently enabled. The default is true. +func (d *Decoder) EmitEnabled() bool { return d.emitEnabled } + +// TODO: add method *Decoder.Reset(maxSize, emitFunc) to let callers re-use Decoders and their +// underlying buffers for garbage reasons. + +func (d *Decoder) SetMaxDynamicTableSize(v uint32) { + d.dynTab.setMaxSize(v) +} + +// SetAllowedMaxDynamicTableSize sets the upper bound that the encoded +// stream (via dynamic table size updates) may set the maximum size +// to. +func (d *Decoder) SetAllowedMaxDynamicTableSize(v uint32) { + d.dynTab.allowedMaxSize = v +} + +type dynamicTable struct { + // ents is the FIFO described at + // http://http2.github.io/http2-spec/compression.html#rfc.section.2.3.2 + // The newest (low index) is append at the end, and items are + // evicted from the front. + ents []HeaderField + size uint32 + maxSize uint32 // current maxSize + allowedMaxSize uint32 // maxSize may go up to this, inclusive +} + +func (dt *dynamicTable) setMaxSize(v uint32) { + dt.maxSize = v + dt.evict() +} + +// TODO: change dynamicTable to be a struct with a slice and a size int field, +// per http://http2.github.io/http2-spec/compression.html#rfc.section.4.1: +// +// +// Then make add increment the size. maybe the max size should move from Decoder to +// dynamicTable and add should return an ok bool if there was enough space. +// +// Later we'll need a remove operation on dynamicTable. + +func (dt *dynamicTable) add(f HeaderField) { + dt.ents = append(dt.ents, f) + dt.size += f.Size() + dt.evict() +} + +// If we're too big, evict old stuff (front of the slice) +func (dt *dynamicTable) evict() { + base := dt.ents // keep base pointer of slice + for dt.size > dt.maxSize { + dt.size -= dt.ents[0].Size() + dt.ents = dt.ents[1:] + } + + // Shift slice contents down if we evicted things. + if len(dt.ents) != len(base) { + copy(base, dt.ents) + dt.ents = base[:len(dt.ents)] + } +} + +// constantTimeStringCompare compares string a and b in a constant +// time manner. +func constantTimeStringCompare(a, b string) bool { + if len(a) != len(b) { + return false + } + + c := byte(0) + + for i := 0; i < len(a); i++ { + c |= a[i] ^ b[i] + } + + return c == 0 +} + +// Search searches f in the table. The return value i is 0 if there is +// no name match. If there is name match or name/value match, i is the +// index of that entry (1-based). If both name and value match, +// nameValueMatch becomes true. +func (dt *dynamicTable) search(f HeaderField) (i uint64, nameValueMatch bool) { + l := len(dt.ents) + for j := l - 1; j >= 0; j-- { + ent := dt.ents[j] + if !constantTimeStringCompare(ent.Name, f.Name) { + continue + } + if i == 0 { + i = uint64(l - j) + } + if f.Sensitive { + continue + } + if !constantTimeStringCompare(ent.Value, f.Value) { + continue + } + i = uint64(l - j) + nameValueMatch = true + return + } + return +} + +func (d *Decoder) maxTableIndex() int { + return len(d.dynTab.ents) + len(staticTable) +} + +func (d *Decoder) at(i uint64) (hf HeaderField, ok bool) { + if i < 1 { + return + } + if i > uint64(d.maxTableIndex()) { + return + } + if i <= uint64(len(staticTable)) { + return staticTable[i-1], true + } + dents := d.dynTab.ents + return dents[len(dents)-(int(i)-len(staticTable))], true +} + +// Decode decodes an entire block. +// +// TODO: remove this method and make it incremental later? This is +// easier for debugging now. +func (d *Decoder) DecodeFull(p []byte) ([]HeaderField, error) { + var hf []HeaderField + saveFunc := d.emit + defer func() { d.emit = saveFunc }() + d.emit = func(f HeaderField) { hf = append(hf, f) } + if _, err := d.Write(p); err != nil { + return nil, err + } + if err := d.Close(); err != nil { + return nil, err + } + return hf, nil +} + +func (d *Decoder) Close() error { + if d.saveBuf.Len() > 0 { + d.saveBuf.Reset() + return DecodingError{errors.New("truncated headers")} + } + return nil +} + +func (d *Decoder) Write(p []byte) (n int, err error) { + if len(p) == 0 { + // Prevent state machine CPU attacks (making us redo + // work up to the point of finding out we don't have + // enough data) + return + } + // Only copy the data if we have to. Optimistically assume + // that p will contain a complete header block. + if d.saveBuf.Len() == 0 { + d.buf = p + } else { + d.saveBuf.Write(p) + d.buf = d.saveBuf.Bytes() + d.saveBuf.Reset() + } + + for len(d.buf) > 0 { + err = d.parseHeaderFieldRepr() + if err == errNeedMore { + // Extra paranoia, making sure saveBuf won't + // get too large. All the varint and string + // reading code earlier should already catch + // overlong things and return ErrStringLength, + // but keep this as a last resort. + const varIntOverhead = 8 // conservative + if d.maxStrLen != 0 && int64(len(d.buf)) > 2*(int64(d.maxStrLen)+varIntOverhead) { + return 0, ErrStringLength + } + d.saveBuf.Write(d.buf) + return len(p), nil + } + if err != nil { + break + } + } + return len(p), err +} + +// errNeedMore is an internal sentinel error value that means the +// buffer is truncated and we need to read more data before we can +// continue parsing. +var errNeedMore = errors.New("need more data") + +type indexType int + +const ( + indexedTrue indexType = iota + indexedFalse + indexedNever +) + +func (v indexType) indexed() bool { return v == indexedTrue } +func (v indexType) sensitive() bool { return v == indexedNever } + +// returns errNeedMore if there isn't enough data available. +// any other error is fatal. +// consumes d.buf iff it returns nil. +// precondition: must be called with len(d.buf) > 0 +func (d *Decoder) parseHeaderFieldRepr() error { + b := d.buf[0] + switch { + case b&128 != 0: + // Indexed representation. + // High bit set? + // http://http2.github.io/http2-spec/compression.html#rfc.section.6.1 + return d.parseFieldIndexed() + case b&192 == 64: + // 6.2.1 Literal Header Field with Incremental Indexing + // 0b10xxxxxx: top two bits are 10 + // http://http2.github.io/http2-spec/compression.html#rfc.section.6.2.1 + return d.parseFieldLiteral(6, indexedTrue) + case b&240 == 0: + // 6.2.2 Literal Header Field without Indexing + // 0b0000xxxx: top four bits are 0000 + // http://http2.github.io/http2-spec/compression.html#rfc.section.6.2.2 + return d.parseFieldLiteral(4, indexedFalse) + case b&240 == 16: + // 6.2.3 Literal Header Field never Indexed + // 0b0001xxxx: top four bits are 0001 + // http://http2.github.io/http2-spec/compression.html#rfc.section.6.2.3 + return d.parseFieldLiteral(4, indexedNever) + case b&224 == 32: + // 6.3 Dynamic Table Size Update + // Top three bits are '001'. + // http://http2.github.io/http2-spec/compression.html#rfc.section.6.3 + return d.parseDynamicTableSizeUpdate() + } + + return DecodingError{errors.New("invalid encoding")} +} + +// (same invariants and behavior as parseHeaderFieldRepr) +func (d *Decoder) parseFieldIndexed() error { + buf := d.buf + idx, buf, err := readVarInt(7, buf) + if err != nil { + return err + } + hf, ok := d.at(idx) + if !ok { + return DecodingError{InvalidIndexError(idx)} + } + d.buf = buf + return d.callEmit(HeaderField{Name: hf.Name, Value: hf.Value}) +} + +// (same invariants and behavior as parseHeaderFieldRepr) +func (d *Decoder) parseFieldLiteral(n uint8, it indexType) error { + buf := d.buf + nameIdx, buf, err := readVarInt(n, buf) + if err != nil { + return err + } + + var hf HeaderField + wantStr := d.emitEnabled || it.indexed() + if nameIdx > 0 { + ihf, ok := d.at(nameIdx) + if !ok { + return DecodingError{InvalidIndexError(nameIdx)} + } + hf.Name = ihf.Name + } else { + hf.Name, buf, err = d.readString(buf, wantStr) + if err != nil { + return err + } + } + hf.Value, buf, err = d.readString(buf, wantStr) + if err != nil { + return err + } + d.buf = buf + if it.indexed() { + d.dynTab.add(hf) + } + hf.Sensitive = it.sensitive() + return d.callEmit(hf) +} + +func (d *Decoder) callEmit(hf HeaderField) error { + if d.maxStrLen != 0 { + if len(hf.Name) > d.maxStrLen || len(hf.Value) > d.maxStrLen { + return ErrStringLength + } + } + if d.emitEnabled { + d.emit(hf) + } + return nil +} + +// (same invariants and behavior as parseHeaderFieldRepr) +func (d *Decoder) parseDynamicTableSizeUpdate() error { + buf := d.buf + size, buf, err := readVarInt(5, buf) + if err != nil { + return err + } + if size > uint64(d.dynTab.allowedMaxSize) { + return DecodingError{errors.New("dynamic table size update too large")} + } + d.dynTab.setMaxSize(uint32(size)) + d.buf = buf + return nil +} + +var errVarintOverflow = DecodingError{errors.New("varint integer overflow")} + +// readVarInt reads an unsigned variable length integer off the +// beginning of p. n is the parameter as described in +// http://http2.github.io/http2-spec/compression.html#rfc.section.5.1. +// +// n must always be between 1 and 8. +// +// The returned remain buffer is either a smaller suffix of p, or err != nil. +// The error is errNeedMore if p doesn't contain a complete integer. +func readVarInt(n byte, p []byte) (i uint64, remain []byte, err error) { + if n < 1 || n > 8 { + panic("bad n") + } + if len(p) == 0 { + return 0, p, errNeedMore + } + i = uint64(p[0]) + if n < 8 { + i &= (1 << uint64(n)) - 1 + } + if i < (1< 0 { + b := p[0] + p = p[1:] + i += uint64(b&127) << m + if b&128 == 0 { + return i, p, nil + } + m += 7 + if m >= 63 { // TODO: proper overflow check. making this up. + return 0, origP, errVarintOverflow + } + } + return 0, origP, errNeedMore +} + +// readString decodes an hpack string from p. +// +// wantStr is whether s will be used. If false, decompression and +// []byte->string garbage are skipped if s will be ignored +// anyway. This does mean that huffman decoding errors for non-indexed +// strings past the MAX_HEADER_LIST_SIZE are ignored, but the server +// is returning an error anyway, and because they're not indexed, the error +// won't affect the decoding state. +func (d *Decoder) readString(p []byte, wantStr bool) (s string, remain []byte, err error) { + if len(p) == 0 { + return "", p, errNeedMore + } + isHuff := p[0]&128 != 0 + strLen, p, err := readVarInt(7, p) + if err != nil { + return "", p, err + } + if d.maxStrLen != 0 && strLen > uint64(d.maxStrLen) { + return "", nil, ErrStringLength + } + if uint64(len(p)) < strLen { + return "", p, errNeedMore + } + if !isHuff { + if wantStr { + s = string(p[:strLen]) + } + return s, p[strLen:], nil + } + + if wantStr { + buf := bufPool.Get().(*bytes.Buffer) + buf.Reset() // don't trust others + defer bufPool.Put(buf) + if err := huffmanDecode(buf, d.maxStrLen, p[:strLen]); err != nil { + buf.Reset() + return "", nil, err + } + s = buf.String() + buf.Reset() // be nice to GC + } + return s, p[strLen:], nil +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/huffman.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/huffman.go new file mode 100644 index 00000000000..eb4b1f05cd0 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/huffman.go @@ -0,0 +1,190 @@ +// Copyright 2014 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 hpack + +import ( + "bytes" + "errors" + "io" + "sync" +) + +var bufPool = sync.Pool{ + New: func() interface{} { return new(bytes.Buffer) }, +} + +// HuffmanDecode decodes the string in v and writes the expanded +// result to w, returning the number of bytes written to w and the +// Write call's return value. At most one Write call is made. +func HuffmanDecode(w io.Writer, v []byte) (int, error) { + buf := bufPool.Get().(*bytes.Buffer) + buf.Reset() + defer bufPool.Put(buf) + if err := huffmanDecode(buf, 0, v); err != nil { + return 0, err + } + return w.Write(buf.Bytes()) +} + +// HuffmanDecodeToString decodes the string in v. +func HuffmanDecodeToString(v []byte) (string, error) { + buf := bufPool.Get().(*bytes.Buffer) + buf.Reset() + defer bufPool.Put(buf) + if err := huffmanDecode(buf, 0, v); err != nil { + return "", err + } + return buf.String(), nil +} + +// ErrInvalidHuffman is returned for errors found decoding +// Huffman-encoded strings. +var ErrInvalidHuffman = errors.New("hpack: invalid Huffman-encoded data") + +// huffmanDecode decodes v to buf. +// If maxLen is greater than 0, attempts to write more to buf than +// maxLen bytes will return ErrStringLength. +func huffmanDecode(buf *bytes.Buffer, maxLen int, v []byte) error { + n := rootHuffmanNode + cur, nbits := uint(0), uint8(0) + for _, b := range v { + cur = cur<<8 | uint(b) + nbits += 8 + for nbits >= 8 { + idx := byte(cur >> (nbits - 8)) + n = n.children[idx] + if n == nil { + return ErrInvalidHuffman + } + if n.children == nil { + if maxLen != 0 && buf.Len() == maxLen { + return ErrStringLength + } + buf.WriteByte(n.sym) + nbits -= n.codeLen + n = rootHuffmanNode + } else { + nbits -= 8 + } + } + } + for nbits > 0 { + n = n.children[byte(cur<<(8-nbits))] + if n.children != nil || n.codeLen > nbits { + break + } + buf.WriteByte(n.sym) + nbits -= n.codeLen + n = rootHuffmanNode + } + return nil +} + +type node struct { + // children is non-nil for internal nodes + children []*node + + // The following are only valid if children is nil: + codeLen uint8 // number of bits that led to the output of sym + sym byte // output symbol +} + +func newInternalNode() *node { + return &node{children: make([]*node, 256)} +} + +var rootHuffmanNode = newInternalNode() + +func init() { + if len(huffmanCodes) != 256 { + panic("unexpected size") + } + for i, code := range huffmanCodes { + addDecoderNode(byte(i), code, huffmanCodeLen[i]) + } +} + +func addDecoderNode(sym byte, code uint32, codeLen uint8) { + cur := rootHuffmanNode + for codeLen > 8 { + codeLen -= 8 + i := uint8(code >> codeLen) + if cur.children[i] == nil { + cur.children[i] = newInternalNode() + } + cur = cur.children[i] + } + shift := 8 - codeLen + start, end := int(uint8(code<> (nbits - rembits)) + dst[len(dst)-1] |= t + } + + return dst +} + +// HuffmanEncodeLength returns the number of bytes required to encode +// s in Huffman codes. The result is round up to byte boundary. +func HuffmanEncodeLength(s string) uint64 { + n := uint64(0) + for i := 0; i < len(s); i++ { + n += uint64(huffmanCodeLen[s[i]]) + } + return (n + 7) / 8 +} + +// appendByteToHuffmanCode appends Huffman code for c to dst and +// returns the extended buffer and the remaining bits in the last +// element. The appending is not byte aligned and the remaining bits +// in the last element of dst is given in rembits. +func appendByteToHuffmanCode(dst []byte, rembits uint8, c byte) ([]byte, uint8) { + code := huffmanCodes[c] + nbits := huffmanCodeLen[c] + + for { + if rembits > nbits { + t := uint8(code << (rembits - nbits)) + dst[len(dst)-1] |= t + rembits -= nbits + break + } + + t := uint8(code >> (nbits - rembits)) + dst[len(dst)-1] |= t + + nbits -= rembits + rembits = 8 + + if nbits == 0 { + break + } + + dst = append(dst, 0) + } + + return dst, rembits +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/tables.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/tables.go new file mode 100644 index 00000000000..b9283a02330 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/tables.go @@ -0,0 +1,352 @@ +// Copyright 2014 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 hpack + +func pair(name, value string) HeaderField { + return HeaderField{Name: name, Value: value} +} + +// http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-07#appendix-B +var staticTable = [...]HeaderField{ + pair(":authority", ""), // index 1 (1-based) + pair(":method", "GET"), + pair(":method", "POST"), + pair(":path", "/"), + pair(":path", "/index.html"), + pair(":scheme", "http"), + pair(":scheme", "https"), + pair(":status", "200"), + pair(":status", "204"), + pair(":status", "206"), + pair(":status", "304"), + pair(":status", "400"), + pair(":status", "404"), + pair(":status", "500"), + pair("accept-charset", ""), + pair("accept-encoding", "gzip, deflate"), + pair("accept-language", ""), + pair("accept-ranges", ""), + pair("accept", ""), + pair("access-control-allow-origin", ""), + pair("age", ""), + pair("allow", ""), + pair("authorization", ""), + pair("cache-control", ""), + pair("content-disposition", ""), + pair("content-encoding", ""), + pair("content-language", ""), + pair("content-length", ""), + pair("content-location", ""), + pair("content-range", ""), + pair("content-type", ""), + pair("cookie", ""), + pair("date", ""), + pair("etag", ""), + pair("expect", ""), + pair("expires", ""), + pair("from", ""), + pair("host", ""), + pair("if-match", ""), + pair("if-modified-since", ""), + pair("if-none-match", ""), + pair("if-range", ""), + pair("if-unmodified-since", ""), + pair("last-modified", ""), + pair("link", ""), + pair("location", ""), + pair("max-forwards", ""), + pair("proxy-authenticate", ""), + pair("proxy-authorization", ""), + pair("range", ""), + pair("referer", ""), + pair("refresh", ""), + pair("retry-after", ""), + pair("server", ""), + pair("set-cookie", ""), + pair("strict-transport-security", ""), + pair("transfer-encoding", ""), + pair("user-agent", ""), + pair("vary", ""), + pair("via", ""), + pair("www-authenticate", ""), +} + +var huffmanCodes = [256]uint32{ + 0x1ff8, + 0x7fffd8, + 0xfffffe2, + 0xfffffe3, + 0xfffffe4, + 0xfffffe5, + 0xfffffe6, + 0xfffffe7, + 0xfffffe8, + 0xffffea, + 0x3ffffffc, + 0xfffffe9, + 0xfffffea, + 0x3ffffffd, + 0xfffffeb, + 0xfffffec, + 0xfffffed, + 0xfffffee, + 0xfffffef, + 0xffffff0, + 0xffffff1, + 0xffffff2, + 0x3ffffffe, + 0xffffff3, + 0xffffff4, + 0xffffff5, + 0xffffff6, + 0xffffff7, + 0xffffff8, + 0xffffff9, + 0xffffffa, + 0xffffffb, + 0x14, + 0x3f8, + 0x3f9, + 0xffa, + 0x1ff9, + 0x15, + 0xf8, + 0x7fa, + 0x3fa, + 0x3fb, + 0xf9, + 0x7fb, + 0xfa, + 0x16, + 0x17, + 0x18, + 0x0, + 0x1, + 0x2, + 0x19, + 0x1a, + 0x1b, + 0x1c, + 0x1d, + 0x1e, + 0x1f, + 0x5c, + 0xfb, + 0x7ffc, + 0x20, + 0xffb, + 0x3fc, + 0x1ffa, + 0x21, + 0x5d, + 0x5e, + 0x5f, + 0x60, + 0x61, + 0x62, + 0x63, + 0x64, + 0x65, + 0x66, + 0x67, + 0x68, + 0x69, + 0x6a, + 0x6b, + 0x6c, + 0x6d, + 0x6e, + 0x6f, + 0x70, + 0x71, + 0x72, + 0xfc, + 0x73, + 0xfd, + 0x1ffb, + 0x7fff0, + 0x1ffc, + 0x3ffc, + 0x22, + 0x7ffd, + 0x3, + 0x23, + 0x4, + 0x24, + 0x5, + 0x25, + 0x26, + 0x27, + 0x6, + 0x74, + 0x75, + 0x28, + 0x29, + 0x2a, + 0x7, + 0x2b, + 0x76, + 0x2c, + 0x8, + 0x9, + 0x2d, + 0x77, + 0x78, + 0x79, + 0x7a, + 0x7b, + 0x7ffe, + 0x7fc, + 0x3ffd, + 0x1ffd, + 0xffffffc, + 0xfffe6, + 0x3fffd2, + 0xfffe7, + 0xfffe8, + 0x3fffd3, + 0x3fffd4, + 0x3fffd5, + 0x7fffd9, + 0x3fffd6, + 0x7fffda, + 0x7fffdb, + 0x7fffdc, + 0x7fffdd, + 0x7fffde, + 0xffffeb, + 0x7fffdf, + 0xffffec, + 0xffffed, + 0x3fffd7, + 0x7fffe0, + 0xffffee, + 0x7fffe1, + 0x7fffe2, + 0x7fffe3, + 0x7fffe4, + 0x1fffdc, + 0x3fffd8, + 0x7fffe5, + 0x3fffd9, + 0x7fffe6, + 0x7fffe7, + 0xffffef, + 0x3fffda, + 0x1fffdd, + 0xfffe9, + 0x3fffdb, + 0x3fffdc, + 0x7fffe8, + 0x7fffe9, + 0x1fffde, + 0x7fffea, + 0x3fffdd, + 0x3fffde, + 0xfffff0, + 0x1fffdf, + 0x3fffdf, + 0x7fffeb, + 0x7fffec, + 0x1fffe0, + 0x1fffe1, + 0x3fffe0, + 0x1fffe2, + 0x7fffed, + 0x3fffe1, + 0x7fffee, + 0x7fffef, + 0xfffea, + 0x3fffe2, + 0x3fffe3, + 0x3fffe4, + 0x7ffff0, + 0x3fffe5, + 0x3fffe6, + 0x7ffff1, + 0x3ffffe0, + 0x3ffffe1, + 0xfffeb, + 0x7fff1, + 0x3fffe7, + 0x7ffff2, + 0x3fffe8, + 0x1ffffec, + 0x3ffffe2, + 0x3ffffe3, + 0x3ffffe4, + 0x7ffffde, + 0x7ffffdf, + 0x3ffffe5, + 0xfffff1, + 0x1ffffed, + 0x7fff2, + 0x1fffe3, + 0x3ffffe6, + 0x7ffffe0, + 0x7ffffe1, + 0x3ffffe7, + 0x7ffffe2, + 0xfffff2, + 0x1fffe4, + 0x1fffe5, + 0x3ffffe8, + 0x3ffffe9, + 0xffffffd, + 0x7ffffe3, + 0x7ffffe4, + 0x7ffffe5, + 0xfffec, + 0xfffff3, + 0xfffed, + 0x1fffe6, + 0x3fffe9, + 0x1fffe7, + 0x1fffe8, + 0x7ffff3, + 0x3fffea, + 0x3fffeb, + 0x1ffffee, + 0x1ffffef, + 0xfffff4, + 0xfffff5, + 0x3ffffea, + 0x7ffff4, + 0x3ffffeb, + 0x7ffffe6, + 0x3ffffec, + 0x3ffffed, + 0x7ffffe7, + 0x7ffffe8, + 0x7ffffe9, + 0x7ffffea, + 0x7ffffeb, + 0xffffffe, + 0x7ffffec, + 0x7ffffed, + 0x7ffffee, + 0x7ffffef, + 0x7fffff0, + 0x3ffffee, +} + +var huffmanCodeLen = [256]uint8{ + 13, 23, 28, 28, 28, 28, 28, 28, 28, 24, 30, 28, 28, 30, 28, 28, + 28, 28, 28, 28, 28, 28, 30, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 6, 10, 10, 12, 13, 6, 8, 11, 10, 10, 8, 11, 8, 6, 6, 6, + 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 8, 15, 6, 12, 10, + 13, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 8, 7, 8, 13, 19, 13, 14, 6, + 15, 5, 6, 5, 6, 5, 6, 6, 6, 5, 7, 7, 6, 6, 6, 5, + 6, 7, 6, 5, 5, 6, 7, 7, 7, 7, 7, 15, 11, 14, 13, 28, + 20, 22, 20, 20, 22, 22, 22, 23, 22, 23, 23, 23, 23, 23, 24, 23, + 24, 24, 22, 23, 24, 23, 23, 23, 23, 21, 22, 23, 22, 23, 23, 24, + 22, 21, 20, 22, 22, 23, 23, 21, 23, 22, 22, 24, 21, 22, 23, 23, + 21, 21, 22, 21, 23, 22, 23, 23, 20, 22, 22, 22, 23, 22, 22, 23, + 26, 26, 20, 19, 22, 23, 22, 25, 26, 26, 26, 27, 27, 26, 24, 25, + 19, 21, 26, 27, 27, 26, 27, 24, 21, 21, 26, 26, 28, 27, 27, 27, + 20, 24, 20, 21, 22, 21, 21, 23, 22, 22, 25, 25, 24, 24, 26, 23, + 26, 27, 26, 26, 27, 27, 27, 27, 27, 28, 27, 27, 27, 27, 27, 26, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/http2.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/http2.go new file mode 100644 index 00000000000..4c5e11ac2cd --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/http2.go @@ -0,0 +1,429 @@ +// Copyright 2014 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 http2 implements the HTTP/2 protocol. +// +// This package is low-level and intended to be used directly by very +// few people. Most users will use it indirectly through the automatic +// use by the net/http package (from Go 1.6 and later). +// For use in earlier Go versions see ConfigureServer. (Transport support +// requires Go 1.6 or later) +// +// See https://http2.github.io/ for more information on HTTP/2. +// +// See https://http2.golang.org/ for a test server running this code. +package http2 + +import ( + "bufio" + "crypto/tls" + "errors" + "fmt" + "io" + "net/http" + "os" + "strconv" + "strings" + "sync" +) + +var ( + VerboseLogs bool + logFrameWrites bool + logFrameReads bool +) + +func init() { + e := os.Getenv("GODEBUG") + if strings.Contains(e, "http2debug=1") { + VerboseLogs = true + } + if strings.Contains(e, "http2debug=2") { + VerboseLogs = true + logFrameWrites = true + logFrameReads = true + } +} + +const ( + // ClientPreface is the string that must be sent by new + // connections from clients. + ClientPreface = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" + + // SETTINGS_MAX_FRAME_SIZE default + // http://http2.github.io/http2-spec/#rfc.section.6.5.2 + initialMaxFrameSize = 16384 + + // NextProtoTLS is the NPN/ALPN protocol negotiated during + // HTTP/2's TLS setup. + NextProtoTLS = "h2" + + // http://http2.github.io/http2-spec/#SettingValues + initialHeaderTableSize = 4096 + + initialWindowSize = 65535 // 6.9.2 Initial Flow Control Window Size + + defaultMaxReadFrameSize = 1 << 20 +) + +var ( + clientPreface = []byte(ClientPreface) +) + +type streamState int + +const ( + stateIdle streamState = iota + stateOpen + stateHalfClosedLocal + stateHalfClosedRemote + stateResvLocal + stateResvRemote + stateClosed +) + +var stateName = [...]string{ + stateIdle: "Idle", + stateOpen: "Open", + stateHalfClosedLocal: "HalfClosedLocal", + stateHalfClosedRemote: "HalfClosedRemote", + stateResvLocal: "ResvLocal", + stateResvRemote: "ResvRemote", + stateClosed: "Closed", +} + +func (st streamState) String() string { + return stateName[st] +} + +// Setting is a setting parameter: which setting it is, and its value. +type Setting struct { + // ID is which setting is being set. + // See http://http2.github.io/http2-spec/#SettingValues + ID SettingID + + // Val is the value. + Val uint32 +} + +func (s Setting) String() string { + return fmt.Sprintf("[%v = %d]", s.ID, s.Val) +} + +// Valid reports whether the setting is valid. +func (s Setting) Valid() error { + // Limits and error codes from 6.5.2 Defined SETTINGS Parameters + switch s.ID { + case SettingEnablePush: + if s.Val != 1 && s.Val != 0 { + return ConnectionError(ErrCodeProtocol) + } + case SettingInitialWindowSize: + if s.Val > 1<<31-1 { + return ConnectionError(ErrCodeFlowControl) + } + case SettingMaxFrameSize: + if s.Val < 16384 || s.Val > 1<<24-1 { + return ConnectionError(ErrCodeProtocol) + } + } + return nil +} + +// A SettingID is an HTTP/2 setting as defined in +// http://http2.github.io/http2-spec/#iana-settings +type SettingID uint16 + +const ( + SettingHeaderTableSize SettingID = 0x1 + SettingEnablePush SettingID = 0x2 + SettingMaxConcurrentStreams SettingID = 0x3 + SettingInitialWindowSize SettingID = 0x4 + SettingMaxFrameSize SettingID = 0x5 + SettingMaxHeaderListSize SettingID = 0x6 +) + +var settingName = map[SettingID]string{ + SettingHeaderTableSize: "HEADER_TABLE_SIZE", + SettingEnablePush: "ENABLE_PUSH", + SettingMaxConcurrentStreams: "MAX_CONCURRENT_STREAMS", + SettingInitialWindowSize: "INITIAL_WINDOW_SIZE", + SettingMaxFrameSize: "MAX_FRAME_SIZE", + SettingMaxHeaderListSize: "MAX_HEADER_LIST_SIZE", +} + +func (s SettingID) String() string { + if v, ok := settingName[s]; ok { + return v + } + return fmt.Sprintf("UNKNOWN_SETTING_%d", uint16(s)) +} + +var ( + errInvalidHeaderFieldName = errors.New("http2: invalid header field name") + errInvalidHeaderFieldValue = errors.New("http2: invalid header field value") +) + +// validHeaderFieldName reports whether v is a valid header field name (key). +// RFC 7230 says: +// header-field = field-name ":" OWS field-value OWS +// field-name = token +// tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." / +// "^" / "_" / " +// Further, http2 says: +// "Just as in HTTP/1.x, header field names are strings of ASCII +// characters that are compared in a case-insensitive +// fashion. However, header field names MUST be converted to +// lowercase prior to their encoding in HTTP/2. " +func validHeaderFieldName(v string) bool { + if len(v) == 0 { + return false + } + for _, r := range v { + if int(r) >= len(isTokenTable) || ('A' <= r && r <= 'Z') { + return false + } + if !isTokenTable[byte(r)] { + return false + } + } + return true +} + +// validHeaderFieldValue reports whether v is a valid header field value. +// +// RFC 7230 says: +// field-value = *( field-content / obs-fold ) +// obj-fold = N/A to http2, and deprecated +// field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] +// field-vchar = VCHAR / obs-text +// obs-text = %x80-FF +// VCHAR = "any visible [USASCII] character" +// +// http2 further says: "Similarly, HTTP/2 allows header field values +// that are not valid. While most of the values that can be encoded +// will not alter header field parsing, carriage return (CR, ASCII +// 0xd), line feed (LF, ASCII 0xa), and the zero character (NUL, ASCII +// 0x0) might be exploited by an attacker if they are translated +// verbatim. Any request or response that contains a character not +// permitted in a header field value MUST be treated as malformed +// (Section 8.1.2.6). Valid characters are defined by the +// field-content ABNF rule in Section 3.2 of [RFC7230]." +// +// This function does not (yet?) properly handle the rejection of +// strings that begin or end with SP or HTAB. +func validHeaderFieldValue(v string) bool { + for i := 0; i < len(v); i++ { + if b := v[i]; b < ' ' && b != '\t' || b == 0x7f { + return false + } + } + return true +} + +var httpCodeStringCommon = map[int]string{} // n -> strconv.Itoa(n) + +func init() { + for i := 100; i <= 999; i++ { + if v := http.StatusText(i); v != "" { + httpCodeStringCommon[i] = strconv.Itoa(i) + } + } +} + +func httpCodeString(code int) string { + if s, ok := httpCodeStringCommon[code]; ok { + return s + } + return strconv.Itoa(code) +} + +// from pkg io +type stringWriter interface { + WriteString(s string) (n int, err error) +} + +// A gate lets two goroutines coordinate their activities. +type gate chan struct{} + +func (g gate) Done() { g <- struct{}{} } +func (g gate) Wait() { <-g } + +// A closeWaiter is like a sync.WaitGroup but only goes 1 to 0 (open to closed). +type closeWaiter chan struct{} + +// Init makes a closeWaiter usable. +// It exists because so a closeWaiter value can be placed inside a +// larger struct and have the Mutex and Cond's memory in the same +// allocation. +func (cw *closeWaiter) Init() { + *cw = make(chan struct{}) +} + +// Close marks the closeWaiter as closed and unblocks any waiters. +func (cw closeWaiter) Close() { + close(cw) +} + +// Wait waits for the closeWaiter to become closed. +func (cw closeWaiter) Wait() { + <-cw +} + +// bufferedWriter is a buffered writer that writes to w. +// Its buffered writer is lazily allocated as needed, to minimize +// idle memory usage with many connections. +type bufferedWriter struct { + w io.Writer // immutable + bw *bufio.Writer // non-nil when data is buffered +} + +func newBufferedWriter(w io.Writer) *bufferedWriter { + return &bufferedWriter{w: w} +} + +var bufWriterPool = sync.Pool{ + New: func() interface{} { + // TODO: pick something better? this is a bit under + // (3 x typical 1500 byte MTU) at least. + return bufio.NewWriterSize(nil, 4<<10) + }, +} + +func (w *bufferedWriter) Write(p []byte) (n int, err error) { + if w.bw == nil { + bw := bufWriterPool.Get().(*bufio.Writer) + bw.Reset(w.w) + w.bw = bw + } + return w.bw.Write(p) +} + +func (w *bufferedWriter) Flush() error { + bw := w.bw + if bw == nil { + return nil + } + err := bw.Flush() + bw.Reset(nil) + bufWriterPool.Put(bw) + w.bw = nil + return err +} + +func mustUint31(v int32) uint32 { + if v < 0 || v > 2147483647 { + panic("out of range") + } + return uint32(v) +} + +// bodyAllowedForStatus reports whether a given response status code +// permits a body. See RFC2616, section 4.4. +func bodyAllowedForStatus(status int) bool { + switch { + case status >= 100 && status <= 199: + return false + case status == 204: + return false + case status == 304: + return false + } + return true +} + +type httpError struct { + msg string + timeout bool +} + +func (e *httpError) Error() string { return e.msg } +func (e *httpError) Timeout() bool { return e.timeout } +func (e *httpError) Temporary() bool { return true } + +var errTimeout error = &httpError{msg: "http2: timeout awaiting response headers", timeout: true} + +var isTokenTable = [127]bool{ + '!': true, + '#': true, + '$': true, + '%': true, + '&': true, + '\'': true, + '*': true, + '+': true, + '-': true, + '.': true, + '0': true, + '1': true, + '2': true, + '3': true, + '4': true, + '5': true, + '6': true, + '7': true, + '8': true, + '9': true, + 'A': true, + 'B': true, + 'C': true, + 'D': true, + 'E': true, + 'F': true, + 'G': true, + 'H': true, + 'I': true, + 'J': true, + 'K': true, + 'L': true, + 'M': true, + 'N': true, + 'O': true, + 'P': true, + 'Q': true, + 'R': true, + 'S': true, + 'T': true, + 'U': true, + 'W': true, + 'V': true, + 'X': true, + 'Y': true, + 'Z': true, + '^': true, + '_': true, + '`': true, + 'a': true, + 'b': true, + 'c': true, + 'd': true, + 'e': true, + 'f': true, + 'g': true, + 'h': true, + 'i': true, + 'j': true, + 'k': true, + 'l': true, + 'm': true, + 'n': true, + 'o': true, + 'p': true, + 'q': true, + 'r': true, + 's': true, + 't': true, + 'u': true, + 'v': true, + 'w': true, + 'x': true, + 'y': true, + 'z': true, + '|': true, + '~': true, +} + +type connectionStater interface { + ConnectionState() tls.ConnectionState +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/not_go15.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/not_go15.go new file mode 100644 index 00000000000..d0fa5c89069 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/not_go15.go @@ -0,0 +1,11 @@ +// Copyright 2015 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. + +// +build !go1.5 + +package http2 + +import "net/http" + +func requestCancel(req *http.Request) <-chan struct{} { return nil } diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/not_go16.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/not_go16.go new file mode 100644 index 00000000000..db53c5b8cbf --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/not_go16.go @@ -0,0 +1,13 @@ +// Copyright 2015 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. + +// +build !go1.6 + +package http2 + +import "net/http" + +func configureTransport(t1 *http.Transport) (*Transport, error) { + return nil, errTransportVersion +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/pipe.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/pipe.go new file mode 100644 index 00000000000..69446e7a370 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/pipe.go @@ -0,0 +1,147 @@ +// Copyright 2014 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 http2 + +import ( + "errors" + "io" + "sync" +) + +// pipe is a goroutine-safe io.Reader/io.Writer pair. It's like +// io.Pipe except there are no PipeReader/PipeWriter halves, and the +// underlying buffer is an interface. (io.Pipe is always unbuffered) +type pipe struct { + mu sync.Mutex + c sync.Cond // c.L lazily initialized to &p.mu + b pipeBuffer + err error // read error once empty. non-nil means closed. + breakErr error // immediate read error (caller doesn't see rest of b) + donec chan struct{} // closed on error + readFn func() // optional code to run in Read before error +} + +type pipeBuffer interface { + Len() int + io.Writer + io.Reader +} + +// Read waits until data is available and copies bytes +// from the buffer into p. +func (p *pipe) Read(d []byte) (n int, err error) { + p.mu.Lock() + defer p.mu.Unlock() + if p.c.L == nil { + p.c.L = &p.mu + } + for { + if p.breakErr != nil { + return 0, p.breakErr + } + if p.b.Len() > 0 { + return p.b.Read(d) + } + if p.err != nil { + if p.readFn != nil { + p.readFn() // e.g. copy trailers + p.readFn = nil // not sticky like p.err + } + return 0, p.err + } + p.c.Wait() + } +} + +var errClosedPipeWrite = errors.New("write on closed buffer") + +// Write copies bytes from p into the buffer and wakes a reader. +// It is an error to write more data than the buffer can hold. +func (p *pipe) Write(d []byte) (n int, err error) { + p.mu.Lock() + defer p.mu.Unlock() + if p.c.L == nil { + p.c.L = &p.mu + } + defer p.c.Signal() + if p.err != nil { + return 0, errClosedPipeWrite + } + return p.b.Write(d) +} + +// CloseWithError causes the next Read (waking up a current blocked +// Read if needed) to return the provided err after all data has been +// read. +// +// The error must be non-nil. +func (p *pipe) CloseWithError(err error) { p.closeWithError(&p.err, err, nil) } + +// BreakWithError causes the next Read (waking up a current blocked +// Read if needed) to return the provided err immediately, without +// waiting for unread data. +func (p *pipe) BreakWithError(err error) { p.closeWithError(&p.breakErr, err, nil) } + +// closeWithErrorAndCode is like CloseWithError but also sets some code to run +// in the caller's goroutine before returning the error. +func (p *pipe) closeWithErrorAndCode(err error, fn func()) { p.closeWithError(&p.err, err, fn) } + +func (p *pipe) closeWithError(dst *error, err error, fn func()) { + if err == nil { + panic("err must be non-nil") + } + p.mu.Lock() + defer p.mu.Unlock() + if p.c.L == nil { + p.c.L = &p.mu + } + defer p.c.Signal() + if *dst != nil { + // Already been done. + return + } + p.readFn = fn + *dst = err + p.closeDoneLocked() +} + +// requires p.mu be held. +func (p *pipe) closeDoneLocked() { + if p.donec == nil { + return + } + // Close if unclosed. This isn't racy since we always + // hold p.mu while closing. + select { + case <-p.donec: + default: + close(p.donec) + } +} + +// Err returns the error (if any) first set by BreakWithError or CloseWithError. +func (p *pipe) Err() error { + p.mu.Lock() + defer p.mu.Unlock() + if p.breakErr != nil { + return p.breakErr + } + return p.err +} + +// Done returns a channel which is closed if and when this pipe is closed +// with CloseWithError. +func (p *pipe) Done() <-chan struct{} { + p.mu.Lock() + defer p.mu.Unlock() + if p.donec == nil { + p.donec = make(chan struct{}) + if p.err != nil || p.breakErr != nil { + // Already hit an error. + p.closeDoneLocked() + } + } + return p.donec +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/server.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/server.go new file mode 100644 index 00000000000..915e257164b --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/server.go @@ -0,0 +1,2149 @@ +// Copyright 2014 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. + +// TODO: replace all <-sc.doneServing with reads from the stream's cw +// instead, and make sure that on close we close all open +// streams. then remove doneServing? + +// TODO: re-audit GOAWAY support. Consider each incoming frame type and +// whether it should be ignored during graceful shutdown. + +// TODO: disconnect idle clients. GFE seems to do 4 minutes. make +// configurable? or maximum number of idle clients and remove the +// oldest? + +// TODO: turn off the serve goroutine when idle, so +// an idle conn only has the readFrames goroutine active. (which could +// also be optimized probably to pin less memory in crypto/tls). This +// would involve tracking when the serve goroutine is active (atomic +// int32 read/CAS probably?) and starting it up when frames arrive, +// and shutting it down when all handlers exit. the occasional PING +// packets could use time.AfterFunc to call sc.wakeStartServeLoop() +// (which is a no-op if already running) and then queue the PING write +// as normal. The serve loop would then exit in most cases (if no +// Handlers running) and not be woken up again until the PING packet +// returns. + +// TODO (maybe): add a mechanism for Handlers to going into +// half-closed-local mode (rw.(io.Closer) test?) but not exit their +// handler, and continue to be able to read from the +// Request.Body. This would be a somewhat semantic change from HTTP/1 +// (or at least what we expose in net/http), so I'd probably want to +// add it there too. For now, this package says that returning from +// the Handler ServeHTTP function means you're both done reading and +// done writing, without a way to stop just one or the other. + +package http2 + +import ( + "bufio" + "bytes" + "crypto/tls" + "errors" + "fmt" + "io" + "log" + "net" + "net/http" + "net/textproto" + "net/url" + "os" + "reflect" + "runtime" + "sort" + "strconv" + "strings" + "sync" + "time" + + "golang.org/x/net/http2/hpack" +) + +const ( + prefaceTimeout = 10 * time.Second + firstSettingsTimeout = 2 * time.Second // should be in-flight with preface anyway + handlerChunkWriteSize = 4 << 10 + defaultMaxStreams = 250 // TODO: make this 100 as the GFE seems to? +) + +var ( + errClientDisconnected = errors.New("client disconnected") + errClosedBody = errors.New("body closed by handler") + errHandlerComplete = errors.New("http2: request body closed due to handler exiting") + errStreamClosed = errors.New("http2: stream closed") +) + +var responseWriterStatePool = sync.Pool{ + New: func() interface{} { + rws := &responseWriterState{} + rws.bw = bufio.NewWriterSize(chunkWriter{rws}, handlerChunkWriteSize) + return rws + }, +} + +// Test hooks. +var ( + testHookOnConn func() + testHookGetServerConn func(*serverConn) + testHookOnPanicMu *sync.Mutex // nil except in tests + testHookOnPanic func(sc *serverConn, panicVal interface{}) (rePanic bool) +) + +// Server is an HTTP/2 server. +type Server struct { + // MaxHandlers limits the number of http.Handler ServeHTTP goroutines + // which may run at a time over all connections. + // Negative or zero no limit. + // TODO: implement + MaxHandlers int + + // MaxConcurrentStreams optionally specifies the number of + // concurrent streams that each client may have open at a + // time. This is unrelated to the number of http.Handler goroutines + // which may be active globally, which is MaxHandlers. + // If zero, MaxConcurrentStreams defaults to at least 100, per + // the HTTP/2 spec's recommendations. + MaxConcurrentStreams uint32 + + // MaxReadFrameSize optionally specifies the largest frame + // this server is willing to read. A valid value is between + // 16k and 16M, inclusive. If zero or otherwise invalid, a + // default value is used. + MaxReadFrameSize uint32 + + // PermitProhibitedCipherSuites, if true, permits the use of + // cipher suites prohibited by the HTTP/2 spec. + PermitProhibitedCipherSuites bool +} + +func (s *Server) maxReadFrameSize() uint32 { + if v := s.MaxReadFrameSize; v >= minMaxFrameSize && v <= maxFrameSize { + return v + } + return defaultMaxReadFrameSize +} + +func (s *Server) maxConcurrentStreams() uint32 { + if v := s.MaxConcurrentStreams; v > 0 { + return v + } + return defaultMaxStreams +} + +// ConfigureServer adds HTTP/2 support to a net/http Server. +// +// The configuration conf may be nil. +// +// ConfigureServer must be called before s begins serving. +func ConfigureServer(s *http.Server, conf *Server) error { + if conf == nil { + conf = new(Server) + } + + if s.TLSConfig == nil { + s.TLSConfig = new(tls.Config) + } else if s.TLSConfig.CipherSuites != nil { + // If they already provided a CipherSuite list, return + // an error if it has a bad order or is missing + // ECDHE_RSA_WITH_AES_128_GCM_SHA256. + const requiredCipher = tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 + haveRequired := false + sawBad := false + for i, cs := range s.TLSConfig.CipherSuites { + if cs == requiredCipher { + haveRequired = true + } + if isBadCipher(cs) { + sawBad = true + } else if sawBad { + return fmt.Errorf("http2: TLSConfig.CipherSuites index %d contains an HTTP/2-approved cipher suite (%#04x), but it comes after unapproved cipher suites. With this configuration, clients that don't support previous, approved cipher suites may be given an unapproved one and reject the connection.", i, cs) + } + } + if !haveRequired { + return fmt.Errorf("http2: TLSConfig.CipherSuites is missing HTTP/2-required TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256") + } + } + + // Note: not setting MinVersion to tls.VersionTLS12, + // as we don't want to interfere with HTTP/1.1 traffic + // on the user's server. We enforce TLS 1.2 later once + // we accept a connection. Ideally this should be done + // during next-proto selection, but using TLS <1.2 with + // HTTP/2 is still the client's bug. + + s.TLSConfig.PreferServerCipherSuites = true + + haveNPN := false + for _, p := range s.TLSConfig.NextProtos { + if p == NextProtoTLS { + haveNPN = true + break + } + } + if !haveNPN { + s.TLSConfig.NextProtos = append(s.TLSConfig.NextProtos, NextProtoTLS) + } + // h2-14 is temporary (as of 2015-03-05) while we wait for all browsers + // to switch to "h2". + s.TLSConfig.NextProtos = append(s.TLSConfig.NextProtos, "h2-14") + + if s.TLSNextProto == nil { + s.TLSNextProto = map[string]func(*http.Server, *tls.Conn, http.Handler){} + } + protoHandler := func(hs *http.Server, c *tls.Conn, h http.Handler) { + if testHookOnConn != nil { + testHookOnConn() + } + conf.ServeConn(c, &ServeConnOpts{ + Handler: h, + BaseConfig: hs, + }) + } + s.TLSNextProto[NextProtoTLS] = protoHandler + s.TLSNextProto["h2-14"] = protoHandler // temporary; see above. + return nil +} + +// ServeConnOpts are options for the Server.ServeConn method. +type ServeConnOpts struct { + // BaseConfig optionally sets the base configuration + // for values. If nil, defaults are used. + BaseConfig *http.Server + + // Handler specifies which handler to use for processing + // requests. If nil, BaseConfig.Handler is used. If BaseConfig + // or BaseConfig.Handler is nil, http.DefaultServeMux is used. + Handler http.Handler +} + +func (o *ServeConnOpts) baseConfig() *http.Server { + if o != nil && o.BaseConfig != nil { + return o.BaseConfig + } + return new(http.Server) +} + +func (o *ServeConnOpts) handler() http.Handler { + if o != nil { + if o.Handler != nil { + return o.Handler + } + if o.BaseConfig != nil && o.BaseConfig.Handler != nil { + return o.BaseConfig.Handler + } + } + return http.DefaultServeMux +} + +// ServeConn serves HTTP/2 requests on the provided connection and +// blocks until the connection is no longer readable. +// +// ServeConn starts speaking HTTP/2 assuming that c has not had any +// reads or writes. It writes its initial settings frame and expects +// to be able to read the preface and settings frame from the +// client. If c has a ConnectionState method like a *tls.Conn, the +// ConnectionState is used to verify the TLS ciphersuite and to set +// the Request.TLS field in Handlers. +// +// ServeConn does not support h2c by itself. Any h2c support must be +// implemented in terms of providing a suitably-behaving net.Conn. +// +// The opts parameter is optional. If nil, default values are used. +func (s *Server) ServeConn(c net.Conn, opts *ServeConnOpts) { + sc := &serverConn{ + srv: s, + hs: opts.baseConfig(), + conn: c, + remoteAddrStr: c.RemoteAddr().String(), + bw: newBufferedWriter(c), + handler: opts.handler(), + streams: make(map[uint32]*stream), + readFrameCh: make(chan readFrameResult), + wantWriteFrameCh: make(chan frameWriteMsg, 8), + wroteFrameCh: make(chan frameWriteResult, 1), // buffered; one send in writeFrameAsync + bodyReadCh: make(chan bodyReadMsg), // buffering doesn't matter either way + doneServing: make(chan struct{}), + advMaxStreams: s.maxConcurrentStreams(), + writeSched: writeScheduler{ + maxFrameSize: initialMaxFrameSize, + }, + initialWindowSize: initialWindowSize, + headerTableSize: initialHeaderTableSize, + serveG: newGoroutineLock(), + pushEnabled: true, + } + sc.flow.add(initialWindowSize) + sc.inflow.add(initialWindowSize) + sc.hpackEncoder = hpack.NewEncoder(&sc.headerWriteBuf) + + fr := NewFramer(sc.bw, c) + fr.ReadMetaHeaders = hpack.NewDecoder(initialHeaderTableSize, nil) + fr.MaxHeaderListSize = sc.maxHeaderListSize() + fr.SetMaxReadFrameSize(s.maxReadFrameSize()) + sc.framer = fr + + if tc, ok := c.(connectionStater); ok { + sc.tlsState = new(tls.ConnectionState) + *sc.tlsState = tc.ConnectionState() + // 9.2 Use of TLS Features + // An implementation of HTTP/2 over TLS MUST use TLS + // 1.2 or higher with the restrictions on feature set + // and cipher suite described in this section. Due to + // implementation limitations, it might not be + // possible to fail TLS negotiation. An endpoint MUST + // immediately terminate an HTTP/2 connection that + // does not meet the TLS requirements described in + // this section with a connection error (Section + // 5.4.1) of type INADEQUATE_SECURITY. + if sc.tlsState.Version < tls.VersionTLS12 { + sc.rejectConn(ErrCodeInadequateSecurity, "TLS version too low") + return + } + + if sc.tlsState.ServerName == "" { + // Client must use SNI, but we don't enforce that anymore, + // since it was causing problems when connecting to bare IP + // addresses during development. + // + // TODO: optionally enforce? Or enforce at the time we receive + // a new request, and verify the the ServerName matches the :authority? + // But that precludes proxy situations, perhaps. + // + // So for now, do nothing here again. + } + + if !s.PermitProhibitedCipherSuites && isBadCipher(sc.tlsState.CipherSuite) { + // "Endpoints MAY choose to generate a connection error + // (Section 5.4.1) of type INADEQUATE_SECURITY if one of + // the prohibited cipher suites are negotiated." + // + // We choose that. In my opinion, the spec is weak + // here. It also says both parties must support at least + // TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 so there's no + // excuses here. If we really must, we could allow an + // "AllowInsecureWeakCiphers" option on the server later. + // Let's see how it plays out first. + sc.rejectConn(ErrCodeInadequateSecurity, fmt.Sprintf("Prohibited TLS 1.2 Cipher Suite: %x", sc.tlsState.CipherSuite)) + return + } + } + + if hook := testHookGetServerConn; hook != nil { + hook(sc) + } + sc.serve() +} + +// isBadCipher reports whether the cipher is blacklisted by the HTTP/2 spec. +func isBadCipher(cipher uint16) bool { + switch cipher { + case tls.TLS_RSA_WITH_RC4_128_SHA, + tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA, + tls.TLS_RSA_WITH_AES_128_CBC_SHA, + tls.TLS_RSA_WITH_AES_256_CBC_SHA, + tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, + tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, + tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, + tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA, + tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, + tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, + tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA: + // Reject cipher suites from Appendix A. + // "This list includes those cipher suites that do not + // offer an ephemeral key exchange and those that are + // based on the TLS null, stream or block cipher type" + return true + default: + return false + } +} + +func (sc *serverConn) rejectConn(err ErrCode, debug string) { + sc.vlogf("http2: server rejecting conn: %v, %s", err, debug) + // ignoring errors. hanging up anyway. + sc.framer.WriteGoAway(0, err, []byte(debug)) + sc.bw.Flush() + sc.conn.Close() +} + +type serverConn struct { + // Immutable: + srv *Server + hs *http.Server + conn net.Conn + bw *bufferedWriter // writing to conn + handler http.Handler + framer *Framer + doneServing chan struct{} // closed when serverConn.serve ends + readFrameCh chan readFrameResult // written by serverConn.readFrames + wantWriteFrameCh chan frameWriteMsg // from handlers -> serve + wroteFrameCh chan frameWriteResult // from writeFrameAsync -> serve, tickles more frame writes + bodyReadCh chan bodyReadMsg // from handlers -> serve + testHookCh chan func(int) // code to run on the serve loop + flow flow // conn-wide (not stream-specific) outbound flow control + inflow flow // conn-wide inbound flow control + tlsState *tls.ConnectionState // shared by all handlers, like net/http + remoteAddrStr string + + // Everything following is owned by the serve loop; use serveG.check(): + serveG goroutineLock // used to verify funcs are on serve() + pushEnabled bool + sawFirstSettings bool // got the initial SETTINGS frame after the preface + needToSendSettingsAck bool + unackedSettings int // how many SETTINGS have we sent without ACKs? + clientMaxStreams uint32 // SETTINGS_MAX_CONCURRENT_STREAMS from client (our PUSH_PROMISE limit) + advMaxStreams uint32 // our SETTINGS_MAX_CONCURRENT_STREAMS advertised the client + curOpenStreams uint32 // client's number of open streams + maxStreamID uint32 // max ever seen + streams map[uint32]*stream + initialWindowSize int32 + headerTableSize uint32 + peerMaxHeaderListSize uint32 // zero means unknown (default) + canonHeader map[string]string // http2-lower-case -> Go-Canonical-Case + writingFrame bool // started write goroutine but haven't heard back on wroteFrameCh + needsFrameFlush bool // last frame write wasn't a flush + writeSched writeScheduler + inGoAway bool // we've started to or sent GOAWAY + needToSendGoAway bool // we need to schedule a GOAWAY frame write + goAwayCode ErrCode + shutdownTimerCh <-chan time.Time // nil until used + shutdownTimer *time.Timer // nil until used + + // Owned by the writeFrameAsync goroutine: + headerWriteBuf bytes.Buffer + hpackEncoder *hpack.Encoder +} + +func (sc *serverConn) maxHeaderListSize() uint32 { + n := sc.hs.MaxHeaderBytes + if n <= 0 { + n = http.DefaultMaxHeaderBytes + } + // http2's count is in a slightly different unit and includes 32 bytes per pair. + // So, take the net/http.Server value and pad it up a bit, assuming 10 headers. + const perFieldOverhead = 32 // per http2 spec + const typicalHeaders = 10 // conservative + return uint32(n + typicalHeaders*perFieldOverhead) +} + +// stream represents a stream. This is the minimal metadata needed by +// the serve goroutine. Most of the actual stream state is owned by +// the http.Handler's goroutine in the responseWriter. Because the +// responseWriter's responseWriterState is recycled at the end of a +// handler, this struct intentionally has no pointer to the +// *responseWriter{,State} itself, as the Handler ending nils out the +// responseWriter's state field. +type stream struct { + // immutable: + sc *serverConn + id uint32 + body *pipe // non-nil if expecting DATA frames + cw closeWaiter // closed wait stream transitions to closed state + + // owned by serverConn's serve loop: + bodyBytes int64 // body bytes seen so far + declBodyBytes int64 // or -1 if undeclared + flow flow // limits writing from Handler to client + inflow flow // what the client is allowed to POST/etc to us + parent *stream // or nil + numTrailerValues int64 + weight uint8 + state streamState + sentReset bool // only true once detached from streams map + gotReset bool // only true once detacted from streams map + gotTrailerHeader bool // HEADER frame for trailers was seen + + trailer http.Header // accumulated trailers + reqTrailer http.Header // handler's Request.Trailer +} + +func (sc *serverConn) Framer() *Framer { return sc.framer } +func (sc *serverConn) CloseConn() error { return sc.conn.Close() } +func (sc *serverConn) Flush() error { return sc.bw.Flush() } +func (sc *serverConn) HeaderEncoder() (*hpack.Encoder, *bytes.Buffer) { + return sc.hpackEncoder, &sc.headerWriteBuf +} + +func (sc *serverConn) state(streamID uint32) (streamState, *stream) { + sc.serveG.check() + // http://http2.github.io/http2-spec/#rfc.section.5.1 + if st, ok := sc.streams[streamID]; ok { + return st.state, st + } + // "The first use of a new stream identifier implicitly closes all + // streams in the "idle" state that might have been initiated by + // that peer with a lower-valued stream identifier. For example, if + // a client sends a HEADERS frame on stream 7 without ever sending a + // frame on stream 5, then stream 5 transitions to the "closed" + // state when the first frame for stream 7 is sent or received." + if streamID <= sc.maxStreamID { + return stateClosed, nil + } + return stateIdle, nil +} + +// setConnState calls the net/http ConnState hook for this connection, if configured. +// Note that the net/http package does StateNew and StateClosed for us. +// There is currently no plan for StateHijacked or hijacking HTTP/2 connections. +func (sc *serverConn) setConnState(state http.ConnState) { + if sc.hs.ConnState != nil { + sc.hs.ConnState(sc.conn, state) + } +} + +func (sc *serverConn) vlogf(format string, args ...interface{}) { + if VerboseLogs { + sc.logf(format, args...) + } +} + +func (sc *serverConn) logf(format string, args ...interface{}) { + if lg := sc.hs.ErrorLog; lg != nil { + lg.Printf(format, args...) + } else { + log.Printf(format, args...) + } +} + +// errno returns v's underlying uintptr, else 0. +// +// TODO: remove this helper function once http2 can use build +// tags. See comment in isClosedConnError. +func errno(v error) uintptr { + if rv := reflect.ValueOf(v); rv.Kind() == reflect.Uintptr { + return uintptr(rv.Uint()) + } + return 0 +} + +// isClosedConnError reports whether err is an error from use of a closed +// network connection. +func isClosedConnError(err error) bool { + if err == nil { + return false + } + + // TODO: remove this string search and be more like the Windows + // case below. That might involve modifying the standard library + // to return better error types. + str := err.Error() + if strings.Contains(str, "use of closed network connection") { + return true + } + + // TODO(bradfitz): x/tools/cmd/bundle doesn't really support + // build tags, so I can't make an http2_windows.go file with + // Windows-specific stuff. Fix that and move this, once we + // have a way to bundle this into std's net/http somehow. + if runtime.GOOS == "windows" { + if oe, ok := err.(*net.OpError); ok && oe.Op == "read" { + if se, ok := oe.Err.(*os.SyscallError); ok && se.Syscall == "wsarecv" { + const WSAECONNABORTED = 10053 + const WSAECONNRESET = 10054 + if n := errno(se.Err); n == WSAECONNRESET || n == WSAECONNABORTED { + return true + } + } + } + } + return false +} + +func (sc *serverConn) condlogf(err error, format string, args ...interface{}) { + if err == nil { + return + } + if err == io.EOF || err == io.ErrUnexpectedEOF || isClosedConnError(err) { + // Boring, expected errors. + sc.vlogf(format, args...) + } else { + sc.logf(format, args...) + } +} + +func (sc *serverConn) canonicalHeader(v string) string { + sc.serveG.check() + cv, ok := commonCanonHeader[v] + if ok { + return cv + } + cv, ok = sc.canonHeader[v] + if ok { + return cv + } + if sc.canonHeader == nil { + sc.canonHeader = make(map[string]string) + } + cv = http.CanonicalHeaderKey(v) + sc.canonHeader[v] = cv + return cv +} + +type readFrameResult struct { + f Frame // valid until readMore is called + err error + + // readMore should be called once the consumer no longer needs or + // retains f. After readMore, f is invalid and more frames can be + // read. + readMore func() +} + +// readFrames is the loop that reads incoming frames. +// It takes care to only read one frame at a time, blocking until the +// consumer is done with the frame. +// It's run on its own goroutine. +func (sc *serverConn) readFrames() { + gate := make(gate) + for { + f, err := sc.framer.ReadFrame() + select { + case sc.readFrameCh <- readFrameResult{f, err, gate.Done}: + case <-sc.doneServing: + return + } + select { + case <-gate: + case <-sc.doneServing: + return + } + if terminalReadFrameError(err) { + return + } + } +} + +// frameWriteResult is the message passed from writeFrameAsync to the serve goroutine. +type frameWriteResult struct { + wm frameWriteMsg // what was written (or attempted) + err error // result of the writeFrame call +} + +// writeFrameAsync runs in its own goroutine and writes a single frame +// and then reports when it's done. +// At most one goroutine can be running writeFrameAsync at a time per +// serverConn. +func (sc *serverConn) writeFrameAsync(wm frameWriteMsg) { + err := wm.write.writeFrame(sc) + sc.wroteFrameCh <- frameWriteResult{wm, err} +} + +func (sc *serverConn) closeAllStreamsOnConnClose() { + sc.serveG.check() + for _, st := range sc.streams { + sc.closeStream(st, errClientDisconnected) + } +} + +func (sc *serverConn) stopShutdownTimer() { + sc.serveG.check() + if t := sc.shutdownTimer; t != nil { + t.Stop() + } +} + +func (sc *serverConn) notePanic() { + // Note: this is for serverConn.serve panicking, not http.Handler code. + if testHookOnPanicMu != nil { + testHookOnPanicMu.Lock() + defer testHookOnPanicMu.Unlock() + } + if testHookOnPanic != nil { + if e := recover(); e != nil { + if testHookOnPanic(sc, e) { + panic(e) + } + } + } +} + +func (sc *serverConn) serve() { + sc.serveG.check() + defer sc.notePanic() + defer sc.conn.Close() + defer sc.closeAllStreamsOnConnClose() + defer sc.stopShutdownTimer() + defer close(sc.doneServing) // unblocks handlers trying to send + + if VerboseLogs { + sc.vlogf("http2: server connection from %v on %p", sc.conn.RemoteAddr(), sc.hs) + } + + sc.writeFrame(frameWriteMsg{ + write: writeSettings{ + {SettingMaxFrameSize, sc.srv.maxReadFrameSize()}, + {SettingMaxConcurrentStreams, sc.advMaxStreams}, + {SettingMaxHeaderListSize, sc.maxHeaderListSize()}, + + // TODO: more actual settings, notably + // SettingInitialWindowSize, but then we also + // want to bump up the conn window size the + // same amount here right after the settings + }, + }) + sc.unackedSettings++ + + if err := sc.readPreface(); err != nil { + sc.condlogf(err, "http2: server: error reading preface from client %v: %v", sc.conn.RemoteAddr(), err) + return + } + // Now that we've got the preface, get us out of the + // "StateNew" state. We can't go directly to idle, though. + // Active means we read some data and anticipate a request. We'll + // do another Active when we get a HEADERS frame. + sc.setConnState(http.StateActive) + sc.setConnState(http.StateIdle) + + go sc.readFrames() // closed by defer sc.conn.Close above + + settingsTimer := time.NewTimer(firstSettingsTimeout) + loopNum := 0 + for { + loopNum++ + select { + case wm := <-sc.wantWriteFrameCh: + sc.writeFrame(wm) + case res := <-sc.wroteFrameCh: + sc.wroteFrame(res) + case res := <-sc.readFrameCh: + if !sc.processFrameFromReader(res) { + return + } + res.readMore() + if settingsTimer.C != nil { + settingsTimer.Stop() + settingsTimer.C = nil + } + case m := <-sc.bodyReadCh: + sc.noteBodyRead(m.st, m.n) + case <-settingsTimer.C: + sc.logf("timeout waiting for SETTINGS frames from %v", sc.conn.RemoteAddr()) + return + case <-sc.shutdownTimerCh: + sc.vlogf("GOAWAY close timer fired; closing conn from %v", sc.conn.RemoteAddr()) + return + case fn := <-sc.testHookCh: + fn(loopNum) + } + } +} + +// readPreface reads the ClientPreface greeting from the peer +// or returns an error on timeout or an invalid greeting. +func (sc *serverConn) readPreface() error { + errc := make(chan error, 1) + go func() { + // Read the client preface + buf := make([]byte, len(ClientPreface)) + if _, err := io.ReadFull(sc.conn, buf); err != nil { + errc <- err + } else if !bytes.Equal(buf, clientPreface) { + errc <- fmt.Errorf("bogus greeting %q", buf) + } else { + errc <- nil + } + }() + timer := time.NewTimer(prefaceTimeout) // TODO: configurable on *Server? + defer timer.Stop() + select { + case <-timer.C: + return errors.New("timeout waiting for client preface") + case err := <-errc: + if err == nil { + if VerboseLogs { + sc.vlogf("http2: server: client %v said hello", sc.conn.RemoteAddr()) + } + } + return err + } +} + +var errChanPool = sync.Pool{ + New: func() interface{} { return make(chan error, 1) }, +} + +var writeDataPool = sync.Pool{ + New: func() interface{} { return new(writeData) }, +} + +// writeDataFromHandler writes DATA response frames from a handler on +// the given stream. +func (sc *serverConn) writeDataFromHandler(stream *stream, data []byte, endStream bool) error { + ch := errChanPool.Get().(chan error) + writeArg := writeDataPool.Get().(*writeData) + *writeArg = writeData{stream.id, data, endStream} + err := sc.writeFrameFromHandler(frameWriteMsg{ + write: writeArg, + stream: stream, + done: ch, + }) + if err != nil { + return err + } + var frameWriteDone bool // the frame write is done (successfully or not) + select { + case err = <-ch: + frameWriteDone = true + case <-sc.doneServing: + return errClientDisconnected + case <-stream.cw: + // If both ch and stream.cw were ready (as might + // happen on the final Write after an http.Handler + // ends), prefer the write result. Otherwise this + // might just be us successfully closing the stream. + // The writeFrameAsync and serve goroutines guarantee + // that the ch send will happen before the stream.cw + // close. + select { + case err = <-ch: + frameWriteDone = true + default: + return errStreamClosed + } + } + errChanPool.Put(ch) + if frameWriteDone { + writeDataPool.Put(writeArg) + } + return err +} + +// writeFrameFromHandler sends wm to sc.wantWriteFrameCh, but aborts +// if the connection has gone away. +// +// This must not be run from the serve goroutine itself, else it might +// deadlock writing to sc.wantWriteFrameCh (which is only mildly +// buffered and is read by serve itself). If you're on the serve +// goroutine, call writeFrame instead. +func (sc *serverConn) writeFrameFromHandler(wm frameWriteMsg) error { + sc.serveG.checkNotOn() // NOT + select { + case sc.wantWriteFrameCh <- wm: + return nil + case <-sc.doneServing: + // Serve loop is gone. + // Client has closed their connection to the server. + return errClientDisconnected + } +} + +// writeFrame schedules a frame to write and sends it if there's nothing +// already being written. +// +// There is no pushback here (the serve goroutine never blocks). It's +// the http.Handlers that block, waiting for their previous frames to +// make it onto the wire +// +// If you're not on the serve goroutine, use writeFrameFromHandler instead. +func (sc *serverConn) writeFrame(wm frameWriteMsg) { + sc.serveG.check() + sc.writeSched.add(wm) + sc.scheduleFrameWrite() +} + +// startFrameWrite starts a goroutine to write wm (in a separate +// goroutine since that might block on the network), and updates the +// serve goroutine's state about the world, updated from info in wm. +func (sc *serverConn) startFrameWrite(wm frameWriteMsg) { + sc.serveG.check() + if sc.writingFrame { + panic("internal error: can only be writing one frame at a time") + } + + st := wm.stream + if st != nil { + switch st.state { + case stateHalfClosedLocal: + panic("internal error: attempt to send frame on half-closed-local stream") + case stateClosed: + if st.sentReset || st.gotReset { + // Skip this frame. + sc.scheduleFrameWrite() + return + } + panic(fmt.Sprintf("internal error: attempt to send a write %v on a closed stream", wm)) + } + } + + sc.writingFrame = true + sc.needsFrameFlush = true + go sc.writeFrameAsync(wm) +} + +// errHandlerPanicked is the error given to any callers blocked in a read from +// Request.Body when the main goroutine panics. Since most handlers read in the +// the main ServeHTTP goroutine, this will show up rarely. +var errHandlerPanicked = errors.New("http2: handler panicked") + +// wroteFrame is called on the serve goroutine with the result of +// whatever happened on writeFrameAsync. +func (sc *serverConn) wroteFrame(res frameWriteResult) { + sc.serveG.check() + if !sc.writingFrame { + panic("internal error: expected to be already writing a frame") + } + sc.writingFrame = false + + wm := res.wm + st := wm.stream + + closeStream := endsStream(wm.write) + + if _, ok := wm.write.(handlerPanicRST); ok { + sc.closeStream(st, errHandlerPanicked) + } + + // Reply (if requested) to the blocked ServeHTTP goroutine. + if ch := wm.done; ch != nil { + select { + case ch <- res.err: + default: + panic(fmt.Sprintf("unbuffered done channel passed in for type %T", wm.write)) + } + } + wm.write = nil // prevent use (assume it's tainted after wm.done send) + + if closeStream { + if st == nil { + panic("internal error: expecting non-nil stream") + } + switch st.state { + case stateOpen: + // Here we would go to stateHalfClosedLocal in + // theory, but since our handler is done and + // the net/http package provides no mechanism + // for finishing writing to a ResponseWriter + // while still reading data (see possible TODO + // at top of this file), we go into closed + // state here anyway, after telling the peer + // we're hanging up on them. + st.state = stateHalfClosedLocal // won't last long, but necessary for closeStream via resetStream + errCancel := StreamError{st.id, ErrCodeCancel} + sc.resetStream(errCancel) + case stateHalfClosedRemote: + sc.closeStream(st, errHandlerComplete) + } + } + + sc.scheduleFrameWrite() +} + +// scheduleFrameWrite tickles the frame writing scheduler. +// +// If a frame is already being written, nothing happens. This will be called again +// when the frame is done being written. +// +// If a frame isn't being written we need to send one, the best frame +// to send is selected, preferring first things that aren't +// stream-specific (e.g. ACKing settings), and then finding the +// highest priority stream. +// +// If a frame isn't being written and there's nothing else to send, we +// flush the write buffer. +func (sc *serverConn) scheduleFrameWrite() { + sc.serveG.check() + if sc.writingFrame { + return + } + if sc.needToSendGoAway { + sc.needToSendGoAway = false + sc.startFrameWrite(frameWriteMsg{ + write: &writeGoAway{ + maxStreamID: sc.maxStreamID, + code: sc.goAwayCode, + }, + }) + return + } + if sc.needToSendSettingsAck { + sc.needToSendSettingsAck = false + sc.startFrameWrite(frameWriteMsg{write: writeSettingsAck{}}) + return + } + if !sc.inGoAway { + if wm, ok := sc.writeSched.take(); ok { + sc.startFrameWrite(wm) + return + } + } + if sc.needsFrameFlush { + sc.startFrameWrite(frameWriteMsg{write: flushFrameWriter{}}) + sc.needsFrameFlush = false // after startFrameWrite, since it sets this true + return + } +} + +func (sc *serverConn) goAway(code ErrCode) { + sc.serveG.check() + if sc.inGoAway { + return + } + if code != ErrCodeNo { + sc.shutDownIn(250 * time.Millisecond) + } else { + // TODO: configurable + sc.shutDownIn(1 * time.Second) + } + sc.inGoAway = true + sc.needToSendGoAway = true + sc.goAwayCode = code + sc.scheduleFrameWrite() +} + +func (sc *serverConn) shutDownIn(d time.Duration) { + sc.serveG.check() + sc.shutdownTimer = time.NewTimer(d) + sc.shutdownTimerCh = sc.shutdownTimer.C +} + +func (sc *serverConn) resetStream(se StreamError) { + sc.serveG.check() + sc.writeFrame(frameWriteMsg{write: se}) + if st, ok := sc.streams[se.StreamID]; ok { + st.sentReset = true + sc.closeStream(st, se) + } +} + +// processFrameFromReader processes the serve loop's read from readFrameCh from the +// frame-reading goroutine. +// processFrameFromReader returns whether the connection should be kept open. +func (sc *serverConn) processFrameFromReader(res readFrameResult) bool { + sc.serveG.check() + err := res.err + if err != nil { + if err == ErrFrameTooLarge { + sc.goAway(ErrCodeFrameSize) + return true // goAway will close the loop + } + clientGone := err == io.EOF || err == io.ErrUnexpectedEOF || isClosedConnError(err) + if clientGone { + // TODO: could we also get into this state if + // the peer does a half close + // (e.g. CloseWrite) because they're done + // sending frames but they're still wanting + // our open replies? Investigate. + // TODO: add CloseWrite to crypto/tls.Conn first + // so we have a way to test this? I suppose + // just for testing we could have a non-TLS mode. + return false + } + } else { + f := res.f + if VerboseLogs { + sc.vlogf("http2: server read frame %v", summarizeFrame(f)) + } + err = sc.processFrame(f) + if err == nil { + return true + } + } + + switch ev := err.(type) { + case StreamError: + sc.resetStream(ev) + return true + case goAwayFlowError: + sc.goAway(ErrCodeFlowControl) + return true + case ConnectionError: + sc.logf("http2: server connection error from %v: %v", sc.conn.RemoteAddr(), ev) + sc.goAway(ErrCode(ev)) + return true // goAway will handle shutdown + default: + if res.err != nil { + sc.vlogf("http2: server closing client connection; error reading frame from client %s: %v", sc.conn.RemoteAddr(), err) + } else { + sc.logf("http2: server closing client connection: %v", err) + } + return false + } +} + +func (sc *serverConn) processFrame(f Frame) error { + sc.serveG.check() + + // First frame received must be SETTINGS. + if !sc.sawFirstSettings { + if _, ok := f.(*SettingsFrame); !ok { + return ConnectionError(ErrCodeProtocol) + } + sc.sawFirstSettings = true + } + + switch f := f.(type) { + case *SettingsFrame: + return sc.processSettings(f) + case *MetaHeadersFrame: + return sc.processHeaders(f) + case *WindowUpdateFrame: + return sc.processWindowUpdate(f) + case *PingFrame: + return sc.processPing(f) + case *DataFrame: + return sc.processData(f) + case *RSTStreamFrame: + return sc.processResetStream(f) + case *PriorityFrame: + return sc.processPriority(f) + case *PushPromiseFrame: + // A client cannot push. Thus, servers MUST treat the receipt of a PUSH_PROMISE + // frame as a connection error (Section 5.4.1) of type PROTOCOL_ERROR. + return ConnectionError(ErrCodeProtocol) + default: + sc.vlogf("http2: server ignoring frame: %v", f.Header()) + return nil + } +} + +func (sc *serverConn) processPing(f *PingFrame) error { + sc.serveG.check() + if f.IsAck() { + // 6.7 PING: " An endpoint MUST NOT respond to PING frames + // containing this flag." + return nil + } + if f.StreamID != 0 { + // "PING frames are not associated with any individual + // stream. If a PING frame is received with a stream + // identifier field value other than 0x0, the recipient MUST + // respond with a connection error (Section 5.4.1) of type + // PROTOCOL_ERROR." + return ConnectionError(ErrCodeProtocol) + } + sc.writeFrame(frameWriteMsg{write: writePingAck{f}}) + return nil +} + +func (sc *serverConn) processWindowUpdate(f *WindowUpdateFrame) error { + sc.serveG.check() + switch { + case f.StreamID != 0: // stream-level flow control + st := sc.streams[f.StreamID] + if st == nil { + // "WINDOW_UPDATE can be sent by a peer that has sent a + // frame bearing the END_STREAM flag. This means that a + // receiver could receive a WINDOW_UPDATE frame on a "half + // closed (remote)" or "closed" stream. A receiver MUST + // NOT treat this as an error, see Section 5.1." + return nil + } + if !st.flow.add(int32(f.Increment)) { + return StreamError{f.StreamID, ErrCodeFlowControl} + } + default: // connection-level flow control + if !sc.flow.add(int32(f.Increment)) { + return goAwayFlowError{} + } + } + sc.scheduleFrameWrite() + return nil +} + +func (sc *serverConn) processResetStream(f *RSTStreamFrame) error { + sc.serveG.check() + + state, st := sc.state(f.StreamID) + if state == stateIdle { + // 6.4 "RST_STREAM frames MUST NOT be sent for a + // stream in the "idle" state. If a RST_STREAM frame + // identifying an idle stream is received, the + // recipient MUST treat this as a connection error + // (Section 5.4.1) of type PROTOCOL_ERROR. + return ConnectionError(ErrCodeProtocol) + } + if st != nil { + st.gotReset = true + sc.closeStream(st, StreamError{f.StreamID, f.ErrCode}) + } + return nil +} + +func (sc *serverConn) closeStream(st *stream, err error) { + sc.serveG.check() + if st.state == stateIdle || st.state == stateClosed { + panic(fmt.Sprintf("invariant; can't close stream in state %v", st.state)) + } + st.state = stateClosed + sc.curOpenStreams-- + if sc.curOpenStreams == 0 { + sc.setConnState(http.StateIdle) + } + delete(sc.streams, st.id) + if p := st.body; p != nil { + p.CloseWithError(err) + } + st.cw.Close() // signals Handler's CloseNotifier, unblocks writes, etc + sc.writeSched.forgetStream(st.id) +} + +func (sc *serverConn) processSettings(f *SettingsFrame) error { + sc.serveG.check() + if f.IsAck() { + sc.unackedSettings-- + if sc.unackedSettings < 0 { + // Why is the peer ACKing settings we never sent? + // The spec doesn't mention this case, but + // hang up on them anyway. + return ConnectionError(ErrCodeProtocol) + } + return nil + } + if err := f.ForeachSetting(sc.processSetting); err != nil { + return err + } + sc.needToSendSettingsAck = true + sc.scheduleFrameWrite() + return nil +} + +func (sc *serverConn) processSetting(s Setting) error { + sc.serveG.check() + if err := s.Valid(); err != nil { + return err + } + if VerboseLogs { + sc.vlogf("http2: server processing setting %v", s) + } + switch s.ID { + case SettingHeaderTableSize: + sc.headerTableSize = s.Val + sc.hpackEncoder.SetMaxDynamicTableSize(s.Val) + case SettingEnablePush: + sc.pushEnabled = s.Val != 0 + case SettingMaxConcurrentStreams: + sc.clientMaxStreams = s.Val + case SettingInitialWindowSize: + return sc.processSettingInitialWindowSize(s.Val) + case SettingMaxFrameSize: + sc.writeSched.maxFrameSize = s.Val + case SettingMaxHeaderListSize: + sc.peerMaxHeaderListSize = s.Val + default: + // Unknown setting: "An endpoint that receives a SETTINGS + // frame with any unknown or unsupported identifier MUST + // ignore that setting." + if VerboseLogs { + sc.vlogf("http2: server ignoring unknown setting %v", s) + } + } + return nil +} + +func (sc *serverConn) processSettingInitialWindowSize(val uint32) error { + sc.serveG.check() + // Note: val already validated to be within range by + // processSetting's Valid call. + + // "A SETTINGS frame can alter the initial flow control window + // size for all current streams. When the value of + // SETTINGS_INITIAL_WINDOW_SIZE changes, a receiver MUST + // adjust the size of all stream flow control windows that it + // maintains by the difference between the new value and the + // old value." + old := sc.initialWindowSize + sc.initialWindowSize = int32(val) + growth := sc.initialWindowSize - old // may be negative + for _, st := range sc.streams { + if !st.flow.add(growth) { + // 6.9.2 Initial Flow Control Window Size + // "An endpoint MUST treat a change to + // SETTINGS_INITIAL_WINDOW_SIZE that causes any flow + // control window to exceed the maximum size as a + // connection error (Section 5.4.1) of type + // FLOW_CONTROL_ERROR." + return ConnectionError(ErrCodeFlowControl) + } + } + return nil +} + +func (sc *serverConn) processData(f *DataFrame) error { + sc.serveG.check() + // "If a DATA frame is received whose stream is not in "open" + // or "half closed (local)" state, the recipient MUST respond + // with a stream error (Section 5.4.2) of type STREAM_CLOSED." + id := f.Header().StreamID + st, ok := sc.streams[id] + if !ok || st.state != stateOpen || st.gotTrailerHeader { + // This includes sending a RST_STREAM if the stream is + // in stateHalfClosedLocal (which currently means that + // the http.Handler returned, so it's done reading & + // done writing). Try to stop the client from sending + // more DATA. + return StreamError{id, ErrCodeStreamClosed} + } + if st.body == nil { + panic("internal error: should have a body in this state") + } + data := f.Data() + + // Sender sending more than they'd declared? + if st.declBodyBytes != -1 && st.bodyBytes+int64(len(data)) > st.declBodyBytes { + st.body.CloseWithError(fmt.Errorf("sender tried to send more than declared Content-Length of %d bytes", st.declBodyBytes)) + return StreamError{id, ErrCodeStreamClosed} + } + if len(data) > 0 { + // Check whether the client has flow control quota. + if int(st.inflow.available()) < len(data) { + return StreamError{id, ErrCodeFlowControl} + } + st.inflow.take(int32(len(data))) + wrote, err := st.body.Write(data) + if err != nil { + return StreamError{id, ErrCodeStreamClosed} + } + if wrote != len(data) { + panic("internal error: bad Writer") + } + st.bodyBytes += int64(len(data)) + } + if f.StreamEnded() { + st.endStream() + } + return nil +} + +// endStream closes a Request.Body's pipe. It is called when a DATA +// frame says a request body is over (or after trailers). +func (st *stream) endStream() { + sc := st.sc + sc.serveG.check() + + if st.declBodyBytes != -1 && st.declBodyBytes != st.bodyBytes { + st.body.CloseWithError(fmt.Errorf("request declared a Content-Length of %d but only wrote %d bytes", + st.declBodyBytes, st.bodyBytes)) + } else { + st.body.closeWithErrorAndCode(io.EOF, st.copyTrailersToHandlerRequest) + st.body.CloseWithError(io.EOF) + } + st.state = stateHalfClosedRemote +} + +// copyTrailersToHandlerRequest is run in the Handler's goroutine in +// its Request.Body.Read just before it gets io.EOF. +func (st *stream) copyTrailersToHandlerRequest() { + for k, vv := range st.trailer { + if _, ok := st.reqTrailer[k]; ok { + // Only copy it over it was pre-declared. + st.reqTrailer[k] = vv + } + } +} + +func (sc *serverConn) processHeaders(f *MetaHeadersFrame) error { + sc.serveG.check() + id := f.Header().StreamID + if sc.inGoAway { + // Ignore. + return nil + } + // http://http2.github.io/http2-spec/#rfc.section.5.1.1 + // Streams initiated by a client MUST use odd-numbered stream + // identifiers. [...] An endpoint that receives an unexpected + // stream identifier MUST respond with a connection error + // (Section 5.4.1) of type PROTOCOL_ERROR. + if id%2 != 1 { + return ConnectionError(ErrCodeProtocol) + } + // A HEADERS frame can be used to create a new stream or + // send a trailer for an open one. If we already have a stream + // open, let it process its own HEADERS frame (trailers at this + // point, if it's valid). + st := sc.streams[f.Header().StreamID] + if st != nil { + return st.processTrailerHeaders(f) + } + + // [...] The identifier of a newly established stream MUST be + // numerically greater than all streams that the initiating + // endpoint has opened or reserved. [...] An endpoint that + // receives an unexpected stream identifier MUST respond with + // a connection error (Section 5.4.1) of type PROTOCOL_ERROR. + if id <= sc.maxStreamID { + return ConnectionError(ErrCodeProtocol) + } + sc.maxStreamID = id + + st = &stream{ + sc: sc, + id: id, + state: stateOpen, + } + if f.StreamEnded() { + st.state = stateHalfClosedRemote + } + st.cw.Init() + + st.flow.conn = &sc.flow // link to conn-level counter + st.flow.add(sc.initialWindowSize) + st.inflow.conn = &sc.inflow // link to conn-level counter + st.inflow.add(initialWindowSize) // TODO: update this when we send a higher initial window size in the initial settings + + sc.streams[id] = st + if f.HasPriority() { + adjustStreamPriority(sc.streams, st.id, f.Priority) + } + sc.curOpenStreams++ + if sc.curOpenStreams == 1 { + sc.setConnState(http.StateActive) + } + if sc.curOpenStreams > sc.advMaxStreams { + // "Endpoints MUST NOT exceed the limit set by their + // peer. An endpoint that receives a HEADERS frame + // that causes their advertised concurrent stream + // limit to be exceeded MUST treat this as a stream + // error (Section 5.4.2) of type PROTOCOL_ERROR or + // REFUSED_STREAM." + if sc.unackedSettings == 0 { + // They should know better. + return StreamError{st.id, ErrCodeProtocol} + } + // Assume it's a network race, where they just haven't + // received our last SETTINGS update. But actually + // this can't happen yet, because we don't yet provide + // a way for users to adjust server parameters at + // runtime. + return StreamError{st.id, ErrCodeRefusedStream} + } + + rw, req, err := sc.newWriterAndRequest(st, f) + if err != nil { + return err + } + st.reqTrailer = req.Trailer + if st.reqTrailer != nil { + st.trailer = make(http.Header) + } + st.body = req.Body.(*requestBody).pipe // may be nil + st.declBodyBytes = req.ContentLength + + handler := sc.handler.ServeHTTP + if f.Truncated { + // Their header list was too long. Send a 431 error. + handler = handleHeaderListTooLong + } + + go sc.runHandler(rw, req, handler) + return nil +} + +func (st *stream) processTrailerHeaders(f *MetaHeadersFrame) error { + sc := st.sc + sc.serveG.check() + if st.gotTrailerHeader { + return ConnectionError(ErrCodeProtocol) + } + st.gotTrailerHeader = true + if !f.StreamEnded() { + return StreamError{st.id, ErrCodeProtocol} + } + + if len(f.PseudoFields()) > 0 { + return StreamError{st.id, ErrCodeProtocol} + } + if st.trailer != nil { + for _, hf := range f.RegularFields() { + key := sc.canonicalHeader(hf.Name) + st.trailer[key] = append(st.trailer[key], hf.Value) + } + } + st.endStream() + return nil +} + +func (sc *serverConn) processPriority(f *PriorityFrame) error { + adjustStreamPriority(sc.streams, f.StreamID, f.PriorityParam) + return nil +} + +func adjustStreamPriority(streams map[uint32]*stream, streamID uint32, priority PriorityParam) { + st, ok := streams[streamID] + if !ok { + // TODO: not quite correct (this streamID might + // already exist in the dep tree, but be closed), but + // close enough for now. + return + } + st.weight = priority.Weight + parent := streams[priority.StreamDep] // might be nil + if parent == st { + // if client tries to set this stream to be the parent of itself + // ignore and keep going + return + } + + // section 5.3.3: If a stream is made dependent on one of its + // own dependencies, the formerly dependent stream is first + // moved to be dependent on the reprioritized stream's previous + // parent. The moved dependency retains its weight. + for piter := parent; piter != nil; piter = piter.parent { + if piter == st { + parent.parent = st.parent + break + } + } + st.parent = parent + if priority.Exclusive && (st.parent != nil || priority.StreamDep == 0) { + for _, openStream := range streams { + if openStream != st && openStream.parent == st.parent { + openStream.parent = st + } + } + } +} + +func (sc *serverConn) newWriterAndRequest(st *stream, f *MetaHeadersFrame) (*responseWriter, *http.Request, error) { + sc.serveG.check() + + method := f.PseudoValue("method") + path := f.PseudoValue("path") + scheme := f.PseudoValue("scheme") + authority := f.PseudoValue("authority") + + isConnect := method == "CONNECT" + if isConnect { + if path != "" || scheme != "" || authority == "" { + return nil, nil, StreamError{f.StreamID, ErrCodeProtocol} + } + } else if method == "" || path == "" || + (scheme != "https" && scheme != "http") { + // See 8.1.2.6 Malformed Requests and Responses: + // + // Malformed requests or responses that are detected + // MUST be treated as a stream error (Section 5.4.2) + // of type PROTOCOL_ERROR." + // + // 8.1.2.3 Request Pseudo-Header Fields + // "All HTTP/2 requests MUST include exactly one valid + // value for the :method, :scheme, and :path + // pseudo-header fields" + return nil, nil, StreamError{f.StreamID, ErrCodeProtocol} + } + + bodyOpen := !f.StreamEnded() + if method == "HEAD" && bodyOpen { + // HEAD requests can't have bodies + return nil, nil, StreamError{f.StreamID, ErrCodeProtocol} + } + var tlsState *tls.ConnectionState // nil if not scheme https + + if scheme == "https" { + tlsState = sc.tlsState + } + + header := make(http.Header) + for _, hf := range f.RegularFields() { + header.Add(sc.canonicalHeader(hf.Name), hf.Value) + } + + if authority == "" { + authority = header.Get("Host") + } + needsContinue := header.Get("Expect") == "100-continue" + if needsContinue { + header.Del("Expect") + } + // Merge Cookie headers into one "; "-delimited value. + if cookies := header["Cookie"]; len(cookies) > 1 { + header.Set("Cookie", strings.Join(cookies, "; ")) + } + + // Setup Trailers + var trailer http.Header + for _, v := range header["Trailer"] { + for _, key := range strings.Split(v, ",") { + key = http.CanonicalHeaderKey(strings.TrimSpace(key)) + switch key { + case "Transfer-Encoding", "Trailer", "Content-Length": + // Bogus. (copy of http1 rules) + // Ignore. + default: + if trailer == nil { + trailer = make(http.Header) + } + trailer[key] = nil + } + } + } + delete(header, "Trailer") + + body := &requestBody{ + conn: sc, + stream: st, + needsContinue: needsContinue, + } + var url_ *url.URL + var requestURI string + if isConnect { + url_ = &url.URL{Host: authority} + requestURI = authority // mimic HTTP/1 server behavior + } else { + var err error + url_, err = url.ParseRequestURI(path) + if err != nil { + return nil, nil, StreamError{f.StreamID, ErrCodeProtocol} + } + requestURI = path + } + req := &http.Request{ + Method: method, + URL: url_, + RemoteAddr: sc.remoteAddrStr, + Header: header, + RequestURI: requestURI, + Proto: "HTTP/2.0", + ProtoMajor: 2, + ProtoMinor: 0, + TLS: tlsState, + Host: authority, + Body: body, + Trailer: trailer, + } + if bodyOpen { + body.pipe = &pipe{ + b: &fixedBuffer{buf: make([]byte, initialWindowSize)}, // TODO: garbage + } + + if vv, ok := header["Content-Length"]; ok { + req.ContentLength, _ = strconv.ParseInt(vv[0], 10, 64) + } else { + req.ContentLength = -1 + } + } + + rws := responseWriterStatePool.Get().(*responseWriterState) + bwSave := rws.bw + *rws = responseWriterState{} // zero all the fields + rws.conn = sc + rws.bw = bwSave + rws.bw.Reset(chunkWriter{rws}) + rws.stream = st + rws.req = req + rws.body = body + + rw := &responseWriter{rws: rws} + return rw, req, nil +} + +// Run on its own goroutine. +func (sc *serverConn) runHandler(rw *responseWriter, req *http.Request, handler func(http.ResponseWriter, *http.Request)) { + didPanic := true + defer func() { + if didPanic { + e := recover() + // Same as net/http: + const size = 64 << 10 + buf := make([]byte, size) + buf = buf[:runtime.Stack(buf, false)] + sc.writeFrameFromHandler(frameWriteMsg{ + write: handlerPanicRST{rw.rws.stream.id}, + stream: rw.rws.stream, + }) + sc.logf("http2: panic serving %v: %v\n%s", sc.conn.RemoteAddr(), e, buf) + return + } + rw.handlerDone() + }() + handler(rw, req) + didPanic = false +} + +func handleHeaderListTooLong(w http.ResponseWriter, r *http.Request) { + // 10.5.1 Limits on Header Block Size: + // .. "A server that receives a larger header block than it is + // willing to handle can send an HTTP 431 (Request Header Fields Too + // Large) status code" + const statusRequestHeaderFieldsTooLarge = 431 // only in Go 1.6+ + w.WriteHeader(statusRequestHeaderFieldsTooLarge) + io.WriteString(w, "

HTTP Error 431

Request Header Field(s) Too Large

") +} + +// called from handler goroutines. +// h may be nil. +func (sc *serverConn) writeHeaders(st *stream, headerData *writeResHeaders) error { + sc.serveG.checkNotOn() // NOT on + var errc chan error + if headerData.h != nil { + // If there's a header map (which we don't own), so we have to block on + // waiting for this frame to be written, so an http.Flush mid-handler + // writes out the correct value of keys, before a handler later potentially + // mutates it. + errc = errChanPool.Get().(chan error) + } + if err := sc.writeFrameFromHandler(frameWriteMsg{ + write: headerData, + stream: st, + done: errc, + }); err != nil { + return err + } + if errc != nil { + select { + case err := <-errc: + errChanPool.Put(errc) + return err + case <-sc.doneServing: + return errClientDisconnected + case <-st.cw: + return errStreamClosed + } + } + return nil +} + +// called from handler goroutines. +func (sc *serverConn) write100ContinueHeaders(st *stream) { + sc.writeFrameFromHandler(frameWriteMsg{ + write: write100ContinueHeadersFrame{st.id}, + stream: st, + }) +} + +// A bodyReadMsg tells the server loop that the http.Handler read n +// bytes of the DATA from the client on the given stream. +type bodyReadMsg struct { + st *stream + n int +} + +// called from handler goroutines. +// Notes that the handler for the given stream ID read n bytes of its body +// and schedules flow control tokens to be sent. +func (sc *serverConn) noteBodyReadFromHandler(st *stream, n int) { + sc.serveG.checkNotOn() // NOT on + select { + case sc.bodyReadCh <- bodyReadMsg{st, n}: + case <-sc.doneServing: + } +} + +func (sc *serverConn) noteBodyRead(st *stream, n int) { + sc.serveG.check() + sc.sendWindowUpdate(nil, n) // conn-level + if st.state != stateHalfClosedRemote && st.state != stateClosed { + // Don't send this WINDOW_UPDATE if the stream is closed + // remotely. + sc.sendWindowUpdate(st, n) + } +} + +// st may be nil for conn-level +func (sc *serverConn) sendWindowUpdate(st *stream, n int) { + sc.serveG.check() + // "The legal range for the increment to the flow control + // window is 1 to 2^31-1 (2,147,483,647) octets." + // A Go Read call on 64-bit machines could in theory read + // a larger Read than this. Very unlikely, but we handle it here + // rather than elsewhere for now. + const maxUint31 = 1<<31 - 1 + for n >= maxUint31 { + sc.sendWindowUpdate32(st, maxUint31) + n -= maxUint31 + } + sc.sendWindowUpdate32(st, int32(n)) +} + +// st may be nil for conn-level +func (sc *serverConn) sendWindowUpdate32(st *stream, n int32) { + sc.serveG.check() + if n == 0 { + return + } + if n < 0 { + panic("negative update") + } + var streamID uint32 + if st != nil { + streamID = st.id + } + sc.writeFrame(frameWriteMsg{ + write: writeWindowUpdate{streamID: streamID, n: uint32(n)}, + stream: st, + }) + var ok bool + if st == nil { + ok = sc.inflow.add(n) + } else { + ok = st.inflow.add(n) + } + if !ok { + panic("internal error; sent too many window updates without decrements?") + } +} + +type requestBody struct { + stream *stream + conn *serverConn + closed bool + pipe *pipe // non-nil if we have a HTTP entity message body + needsContinue bool // need to send a 100-continue +} + +func (b *requestBody) Close() error { + if b.pipe != nil { + b.pipe.CloseWithError(errClosedBody) + } + b.closed = true + return nil +} + +func (b *requestBody) Read(p []byte) (n int, err error) { + if b.needsContinue { + b.needsContinue = false + b.conn.write100ContinueHeaders(b.stream) + } + if b.pipe == nil { + return 0, io.EOF + } + n, err = b.pipe.Read(p) + if n > 0 { + b.conn.noteBodyReadFromHandler(b.stream, n) + } + return +} + +// responseWriter is the http.ResponseWriter implementation. It's +// intentionally small (1 pointer wide) to minimize garbage. The +// responseWriterState pointer inside is zeroed at the end of a +// request (in handlerDone) and calls on the responseWriter thereafter +// simply crash (caller's mistake), but the much larger responseWriterState +// and buffers are reused between multiple requests. +type responseWriter struct { + rws *responseWriterState +} + +// Optional http.ResponseWriter interfaces implemented. +var ( + _ http.CloseNotifier = (*responseWriter)(nil) + _ http.Flusher = (*responseWriter)(nil) + _ stringWriter = (*responseWriter)(nil) +) + +type responseWriterState struct { + // immutable within a request: + stream *stream + req *http.Request + body *requestBody // to close at end of request, if DATA frames didn't + conn *serverConn + + // TODO: adjust buffer writing sizes based on server config, frame size updates from peer, etc + bw *bufio.Writer // writing to a chunkWriter{this *responseWriterState} + + // mutated by http.Handler goroutine: + handlerHeader http.Header // nil until called + snapHeader http.Header // snapshot of handlerHeader at WriteHeader time + trailers []string // set in writeChunk + status int // status code passed to WriteHeader + wroteHeader bool // WriteHeader called (explicitly or implicitly). Not necessarily sent to user yet. + sentHeader bool // have we sent the header frame? + handlerDone bool // handler has finished + + sentContentLen int64 // non-zero if handler set a Content-Length header + wroteBytes int64 + + closeNotifierMu sync.Mutex // guards closeNotifierCh + closeNotifierCh chan bool // nil until first used +} + +type chunkWriter struct{ rws *responseWriterState } + +func (cw chunkWriter) Write(p []byte) (n int, err error) { return cw.rws.writeChunk(p) } + +func (rws *responseWriterState) hasTrailers() bool { return len(rws.trailers) != 0 } + +// declareTrailer is called for each Trailer header when the +// response header is written. It notes that a header will need to be +// written in the trailers at the end of the response. +func (rws *responseWriterState) declareTrailer(k string) { + k = http.CanonicalHeaderKey(k) + switch k { + case "Transfer-Encoding", "Content-Length", "Trailer": + // Forbidden by RFC 2616 14.40. + return + } + if !strSliceContains(rws.trailers, k) { + rws.trailers = append(rws.trailers, k) + } +} + +// writeChunk writes chunks from the bufio.Writer. But because +// bufio.Writer may bypass its chunking, sometimes p may be +// arbitrarily large. +// +// writeChunk is also responsible (on the first chunk) for sending the +// HEADER response. +func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) { + if !rws.wroteHeader { + rws.writeHeader(200) + } + + isHeadResp := rws.req.Method == "HEAD" + if !rws.sentHeader { + rws.sentHeader = true + var ctype, clen string + if clen = rws.snapHeader.Get("Content-Length"); clen != "" { + rws.snapHeader.Del("Content-Length") + clen64, err := strconv.ParseInt(clen, 10, 64) + if err == nil && clen64 >= 0 { + rws.sentContentLen = clen64 + } else { + clen = "" + } + } + if clen == "" && rws.handlerDone && bodyAllowedForStatus(rws.status) && (len(p) > 0 || !isHeadResp) { + clen = strconv.Itoa(len(p)) + } + _, hasContentType := rws.snapHeader["Content-Type"] + if !hasContentType && bodyAllowedForStatus(rws.status) { + ctype = http.DetectContentType(p) + } + var date string + if _, ok := rws.snapHeader["Date"]; !ok { + // TODO(bradfitz): be faster here, like net/http? measure. + date = time.Now().UTC().Format(http.TimeFormat) + } + + for _, v := range rws.snapHeader["Trailer"] { + foreachHeaderElement(v, rws.declareTrailer) + } + + endStream := (rws.handlerDone && !rws.hasTrailers() && len(p) == 0) || isHeadResp + err = rws.conn.writeHeaders(rws.stream, &writeResHeaders{ + streamID: rws.stream.id, + httpResCode: rws.status, + h: rws.snapHeader, + endStream: endStream, + contentType: ctype, + contentLength: clen, + date: date, + }) + if err != nil { + return 0, err + } + if endStream { + return 0, nil + } + } + if isHeadResp { + return len(p), nil + } + if len(p) == 0 && !rws.handlerDone { + return 0, nil + } + + if rws.handlerDone { + rws.promoteUndeclaredTrailers() + } + + endStream := rws.handlerDone && !rws.hasTrailers() + if len(p) > 0 || endStream { + // only send a 0 byte DATA frame if we're ending the stream. + if err := rws.conn.writeDataFromHandler(rws.stream, p, endStream); err != nil { + return 0, err + } + } + + if rws.handlerDone && rws.hasTrailers() { + err = rws.conn.writeHeaders(rws.stream, &writeResHeaders{ + streamID: rws.stream.id, + h: rws.handlerHeader, + trailers: rws.trailers, + endStream: true, + }) + return len(p), err + } + return len(p), nil +} + +// TrailerPrefix is a magic prefix for ResponseWriter.Header map keys +// that, if present, signals that the map entry is actually for +// the response trailers, and not the response headers. The prefix +// is stripped after the ServeHTTP call finishes and the values are +// sent in the trailers. +// +// This mechanism is intended only for trailers that are not known +// prior to the headers being written. If the set of trailers is fixed +// or known before the header is written, the normal Go trailers mechanism +// is preferred: +// https://golang.org/pkg/net/http/#ResponseWriter +// https://golang.org/pkg/net/http/#example_ResponseWriter_trailers +const TrailerPrefix = "Trailer:" + +// promoteUndeclaredTrailers permits http.Handlers to set trailers +// after the header has already been flushed. Because the Go +// ResponseWriter interface has no way to set Trailers (only the +// Header), and because we didn't want to expand the ResponseWriter +// interface, and because nobody used trailers, and because RFC 2616 +// says you SHOULD (but not must) predeclare any trailers in the +// header, the official ResponseWriter rules said trailers in Go must +// be predeclared, and then we reuse the same ResponseWriter.Header() +// map to mean both Headers and Trailers. When it's time to write the +// Trailers, we pick out the fields of Headers that were declared as +// trailers. That worked for a while, until we found the first major +// user of Trailers in the wild: gRPC (using them only over http2), +// and gRPC libraries permit setting trailers mid-stream without +// predeclarnig them. So: change of plans. We still permit the old +// way, but we also permit this hack: if a Header() key begins with +// "Trailer:", the suffix of that key is a Trailer. Because ':' is an +// invalid token byte anyway, there is no ambiguity. (And it's already +// filtered out) It's mildly hacky, but not terrible. +// +// This method runs after the Handler is done and promotes any Header +// fields to be trailers. +func (rws *responseWriterState) promoteUndeclaredTrailers() { + for k, vv := range rws.handlerHeader { + if !strings.HasPrefix(k, TrailerPrefix) { + continue + } + trailerKey := strings.TrimPrefix(k, TrailerPrefix) + rws.declareTrailer(trailerKey) + rws.handlerHeader[http.CanonicalHeaderKey(trailerKey)] = vv + } + sort.Strings(rws.trailers) +} + +func (w *responseWriter) Flush() { + rws := w.rws + if rws == nil { + panic("Header called after Handler finished") + } + if rws.bw.Buffered() > 0 { + if err := rws.bw.Flush(); err != nil { + // Ignore the error. The frame writer already knows. + return + } + } else { + // The bufio.Writer won't call chunkWriter.Write + // (writeChunk with zero bytes, so we have to do it + // ourselves to force the HTTP response header and/or + // final DATA frame (with END_STREAM) to be sent. + rws.writeChunk(nil) + } +} + +func (w *responseWriter) CloseNotify() <-chan bool { + rws := w.rws + if rws == nil { + panic("CloseNotify called after Handler finished") + } + rws.closeNotifierMu.Lock() + ch := rws.closeNotifierCh + if ch == nil { + ch = make(chan bool, 1) + rws.closeNotifierCh = ch + go func() { + rws.stream.cw.Wait() // wait for close + ch <- true + }() + } + rws.closeNotifierMu.Unlock() + return ch +} + +func (w *responseWriter) Header() http.Header { + rws := w.rws + if rws == nil { + panic("Header called after Handler finished") + } + if rws.handlerHeader == nil { + rws.handlerHeader = make(http.Header) + } + return rws.handlerHeader +} + +func (w *responseWriter) WriteHeader(code int) { + rws := w.rws + if rws == nil { + panic("WriteHeader called after Handler finished") + } + rws.writeHeader(code) +} + +func (rws *responseWriterState) writeHeader(code int) { + if !rws.wroteHeader { + rws.wroteHeader = true + rws.status = code + if len(rws.handlerHeader) > 0 { + rws.snapHeader = cloneHeader(rws.handlerHeader) + } + } +} + +func cloneHeader(h http.Header) http.Header { + h2 := make(http.Header, len(h)) + for k, vv := range h { + vv2 := make([]string, len(vv)) + copy(vv2, vv) + h2[k] = vv2 + } + return h2 +} + +// The Life Of A Write is like this: +// +// * Handler calls w.Write or w.WriteString -> +// * -> rws.bw (*bufio.Writer) -> +// * (Handler migth call Flush) +// * -> chunkWriter{rws} +// * -> responseWriterState.writeChunk(p []byte) +// * -> responseWriterState.writeChunk (most of the magic; see comment there) +func (w *responseWriter) Write(p []byte) (n int, err error) { + return w.write(len(p), p, "") +} + +func (w *responseWriter) WriteString(s string) (n int, err error) { + return w.write(len(s), nil, s) +} + +// either dataB or dataS is non-zero. +func (w *responseWriter) write(lenData int, dataB []byte, dataS string) (n int, err error) { + rws := w.rws + if rws == nil { + panic("Write called after Handler finished") + } + if !rws.wroteHeader { + w.WriteHeader(200) + } + if !bodyAllowedForStatus(rws.status) { + return 0, http.ErrBodyNotAllowed + } + rws.wroteBytes += int64(len(dataB)) + int64(len(dataS)) // only one can be set + if rws.sentContentLen != 0 && rws.wroteBytes > rws.sentContentLen { + // TODO: send a RST_STREAM + return 0, errors.New("http2: handler wrote more than declared Content-Length") + } + + if dataB != nil { + return rws.bw.Write(dataB) + } else { + return rws.bw.WriteString(dataS) + } +} + +func (w *responseWriter) handlerDone() { + rws := w.rws + rws.handlerDone = true + w.Flush() + w.rws = nil + responseWriterStatePool.Put(rws) +} + +// foreachHeaderElement splits v according to the "#rule" construction +// in RFC 2616 section 2.1 and calls fn for each non-empty element. +func foreachHeaderElement(v string, fn func(string)) { + v = textproto.TrimString(v) + if v == "" { + return + } + if !strings.Contains(v, ",") { + fn(v) + return + } + for _, f := range strings.Split(v, ",") { + if f = textproto.TrimString(f); f != "" { + fn(f) + } + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/transport.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/transport.go new file mode 100644 index 00000000000..7fe267bb302 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/transport.go @@ -0,0 +1,1666 @@ +// Copyright 2015 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. + +// Transport code. + +package http2 + +import ( + "bufio" + "bytes" + "compress/gzip" + "crypto/tls" + "errors" + "fmt" + "io" + "io/ioutil" + "log" + "net" + "net/http" + "sort" + "strconv" + "strings" + "sync" + "time" + + "golang.org/x/net/http2/hpack" +) + +const ( + // transportDefaultConnFlow is how many connection-level flow control + // tokens we give the server at start-up, past the default 64k. + transportDefaultConnFlow = 1 << 30 + + // transportDefaultStreamFlow is how many stream-level flow + // control tokens we announce to the peer, and how many bytes + // we buffer per stream. + transportDefaultStreamFlow = 4 << 20 + + // transportDefaultStreamMinRefresh is the minimum number of bytes we'll send + // a stream-level WINDOW_UPDATE for at a time. + transportDefaultStreamMinRefresh = 4 << 10 + + defaultUserAgent = "Go-http-client/2.0" +) + +// Transport is an HTTP/2 Transport. +// +// A Transport internally caches connections to servers. It is safe +// for concurrent use by multiple goroutines. +type Transport struct { + // DialTLS specifies an optional dial function for creating + // TLS connections for requests. + // + // If DialTLS is nil, tls.Dial is used. + // + // If the returned net.Conn has a ConnectionState method like tls.Conn, + // it will be used to set http.Response.TLS. + DialTLS func(network, addr string, cfg *tls.Config) (net.Conn, error) + + // TLSClientConfig specifies the TLS configuration to use with + // tls.Client. If nil, the default configuration is used. + TLSClientConfig *tls.Config + + // ConnPool optionally specifies an alternate connection pool to use. + // If nil, the default is used. + ConnPool ClientConnPool + + // DisableCompression, if true, prevents the Transport from + // requesting compression with an "Accept-Encoding: gzip" + // request header when the Request contains no existing + // Accept-Encoding value. If the Transport requests gzip on + // its own and gets a gzipped response, it's transparently + // decoded in the Response.Body. However, if the user + // explicitly requested gzip it is not automatically + // uncompressed. + DisableCompression bool + + // MaxHeaderListSize is the http2 SETTINGS_MAX_HEADER_LIST_SIZE to + // send in the initial settings frame. It is how many bytes + // of response headers are allow. Unlike the http2 spec, zero here + // means to use a default limit (currently 10MB). If you actually + // want to advertise an ulimited value to the peer, Transport + // interprets the highest possible value here (0xffffffff or 1<<32-1) + // to mean no limit. + MaxHeaderListSize uint32 + + // t1, if non-nil, is the standard library Transport using + // this transport. Its settings are used (but not its + // RoundTrip method, etc). + t1 *http.Transport + + connPoolOnce sync.Once + connPoolOrDef ClientConnPool // non-nil version of ConnPool +} + +func (t *Transport) maxHeaderListSize() uint32 { + if t.MaxHeaderListSize == 0 { + return 10 << 20 + } + if t.MaxHeaderListSize == 0xffffffff { + return 0 + } + return t.MaxHeaderListSize +} + +func (t *Transport) disableCompression() bool { + return t.DisableCompression || (t.t1 != nil && t.t1.DisableCompression) +} + +var errTransportVersion = errors.New("http2: ConfigureTransport is only supported starting at Go 1.6") + +// ConfigureTransport configures a net/http HTTP/1 Transport to use HTTP/2. +// It requires Go 1.6 or later and returns an error if the net/http package is too old +// or if t1 has already been HTTP/2-enabled. +func ConfigureTransport(t1 *http.Transport) error { + _, err := configureTransport(t1) // in configure_transport.go (go1.6) or not_go16.go + return err +} + +func (t *Transport) connPool() ClientConnPool { + t.connPoolOnce.Do(t.initConnPool) + return t.connPoolOrDef +} + +func (t *Transport) initConnPool() { + if t.ConnPool != nil { + t.connPoolOrDef = t.ConnPool + } else { + t.connPoolOrDef = &clientConnPool{t: t} + } +} + +// ClientConn is the state of a single HTTP/2 client connection to an +// HTTP/2 server. +type ClientConn struct { + t *Transport + tconn net.Conn // usually *tls.Conn, except specialized impls + tlsState *tls.ConnectionState // nil only for specialized impls + + // readLoop goroutine fields: + readerDone chan struct{} // closed on error + readerErr error // set before readerDone is closed + + mu sync.Mutex // guards following + cond *sync.Cond // hold mu; broadcast on flow/closed changes + flow flow // our conn-level flow control quota (cs.flow is per stream) + inflow flow // peer's conn-level flow control + closed bool + goAway *GoAwayFrame // if non-nil, the GoAwayFrame we received + streams map[uint32]*clientStream // client-initiated + nextStreamID uint32 + bw *bufio.Writer + br *bufio.Reader + fr *Framer + // Settings from peer: + maxFrameSize uint32 + maxConcurrentStreams uint32 + initialWindowSize uint32 + hbuf bytes.Buffer // HPACK encoder writes into this + henc *hpack.Encoder + freeBuf [][]byte + + wmu sync.Mutex // held while writing; acquire AFTER mu if holding both + werr error // first write error that has occurred +} + +// clientStream is the state for a single HTTP/2 stream. One of these +// is created for each Transport.RoundTrip call. +type clientStream struct { + cc *ClientConn + req *http.Request + ID uint32 + resc chan resAndError + bufPipe pipe // buffered pipe with the flow-controlled response payload + requestedGzip bool + + flow flow // guarded by cc.mu + inflow flow // guarded by cc.mu + bytesRemain int64 // -1 means unknown; owned by transportResponseBody.Read + readErr error // sticky read error; owned by transportResponseBody.Read + stopReqBody error // if non-nil, stop writing req body; guarded by cc.mu + + peerReset chan struct{} // closed on peer reset + resetErr error // populated before peerReset is closed + + done chan struct{} // closed when stream remove from cc.streams map; close calls guarded by cc.mu + + // owned by clientConnReadLoop: + pastHeaders bool // got first MetaHeadersFrame (actual headers) + pastTrailers bool // got optional second MetaHeadersFrame (trailers) + + trailer http.Header // accumulated trailers + resTrailer *http.Header // client's Response.Trailer +} + +// awaitRequestCancel runs in its own goroutine and waits for the user +// to either cancel a RoundTrip request (using the provided +// Request.Cancel channel), or for the request to be done (any way it +// might be removed from the cc.streams map: peer reset, successful +// completion, TCP connection breakage, etc) +func (cs *clientStream) awaitRequestCancel(cancel <-chan struct{}) { + if cancel == nil { + return + } + select { + case <-cancel: + cs.bufPipe.CloseWithError(errRequestCanceled) + cs.cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) + case <-cs.done: + } +} + +// checkReset reports any error sent in a RST_STREAM frame by the +// server. +func (cs *clientStream) checkReset() error { + select { + case <-cs.peerReset: + return cs.resetErr + default: + return nil + } +} + +func (cs *clientStream) abortRequestBodyWrite(err error) { + if err == nil { + panic("nil error") + } + cc := cs.cc + cc.mu.Lock() + cs.stopReqBody = err + cc.cond.Broadcast() + cc.mu.Unlock() +} + +type stickyErrWriter struct { + w io.Writer + err *error +} + +func (sew stickyErrWriter) Write(p []byte) (n int, err error) { + if *sew.err != nil { + return 0, *sew.err + } + n, err = sew.w.Write(p) + *sew.err = err + return +} + +var ErrNoCachedConn = errors.New("http2: no cached connection was available") + +// RoundTripOpt are options for the Transport.RoundTripOpt method. +type RoundTripOpt struct { + // OnlyCachedConn controls whether RoundTripOpt may + // create a new TCP connection. If set true and + // no cached connection is available, RoundTripOpt + // will return ErrNoCachedConn. + OnlyCachedConn bool +} + +func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) { + return t.RoundTripOpt(req, RoundTripOpt{}) +} + +// authorityAddr returns a given authority (a host/IP, or host:port / ip:port) +// and returns a host:port. The port 443 is added if needed. +func authorityAddr(authority string) (addr string) { + if _, _, err := net.SplitHostPort(authority); err == nil { + return authority + } + return net.JoinHostPort(authority, "443") +} + +// RoundTripOpt is like RoundTrip, but takes options. +func (t *Transport) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Response, error) { + if req.URL.Scheme != "https" { + return nil, errors.New("http2: unsupported scheme") + } + + addr := authorityAddr(req.URL.Host) + for { + cc, err := t.connPool().GetClientConn(req, addr) + if err != nil { + t.vlogf("http2: Transport failed to get client conn for %s: %v", addr, err) + return nil, err + } + res, err := cc.RoundTrip(req) + if shouldRetryRequest(req, err) { + continue + } + if err != nil { + t.vlogf("RoundTrip failure: %v", err) + return nil, err + } + return res, nil + } +} + +// CloseIdleConnections closes any connections which were previously +// connected from previous requests but are now sitting idle. +// It does not interrupt any connections currently in use. +func (t *Transport) CloseIdleConnections() { + if cp, ok := t.connPool().(*clientConnPool); ok { + cp.closeIdleConnections() + } +} + +var ( + errClientConnClosed = errors.New("http2: client conn is closed") + errClientConnUnusable = errors.New("http2: client conn not usable") +) + +func shouldRetryRequest(req *http.Request, err error) bool { + // TODO: retry GET requests (no bodies) more aggressively, if shutdown + // before response. + return err == errClientConnUnusable +} + +func (t *Transport) dialClientConn(addr string) (*ClientConn, error) { + host, _, err := net.SplitHostPort(addr) + if err != nil { + return nil, err + } + tconn, err := t.dialTLS()("tcp", addr, t.newTLSConfig(host)) + if err != nil { + return nil, err + } + return t.NewClientConn(tconn) +} + +func (t *Transport) newTLSConfig(host string) *tls.Config { + cfg := new(tls.Config) + if t.TLSClientConfig != nil { + *cfg = *t.TLSClientConfig + } + if !strSliceContains(cfg.NextProtos, NextProtoTLS) { + cfg.NextProtos = append([]string{NextProtoTLS}, cfg.NextProtos...) + } + if cfg.ServerName == "" { + cfg.ServerName = host + } + return cfg +} + +func (t *Transport) dialTLS() func(string, string, *tls.Config) (net.Conn, error) { + if t.DialTLS != nil { + return t.DialTLS + } + return t.dialTLSDefault +} + +func (t *Transport) dialTLSDefault(network, addr string, cfg *tls.Config) (net.Conn, error) { + cn, err := tls.Dial(network, addr, cfg) + if err != nil { + return nil, err + } + if err := cn.Handshake(); err != nil { + return nil, err + } + if !cfg.InsecureSkipVerify { + if err := cn.VerifyHostname(cfg.ServerName); err != nil { + return nil, err + } + } + state := cn.ConnectionState() + if p := state.NegotiatedProtocol; p != NextProtoTLS { + return nil, fmt.Errorf("http2: unexpected ALPN protocol %q; want %q", p, NextProtoTLS) + } + if !state.NegotiatedProtocolIsMutual { + return nil, errors.New("http2: could not negotiate protocol mutually") + } + return cn, nil +} + +// disableKeepAlives reports whether connections should be closed as +// soon as possible after handling the first request. +func (t *Transport) disableKeepAlives() bool { + return t.t1 != nil && t.t1.DisableKeepAlives +} + +func (t *Transport) NewClientConn(c net.Conn) (*ClientConn, error) { + if VerboseLogs { + t.vlogf("http2: Transport creating client conn to %v", c.RemoteAddr()) + } + if _, err := c.Write(clientPreface); err != nil { + t.vlogf("client preface write error: %v", err) + return nil, err + } + + cc := &ClientConn{ + t: t, + tconn: c, + readerDone: make(chan struct{}), + nextStreamID: 1, + maxFrameSize: 16 << 10, // spec default + initialWindowSize: 65535, // spec default + maxConcurrentStreams: 1000, // "infinite", per spec. 1000 seems good enough. + streams: make(map[uint32]*clientStream), + } + cc.cond = sync.NewCond(&cc.mu) + cc.flow.add(int32(initialWindowSize)) + + // TODO: adjust this writer size to account for frame size + + // MTU + crypto/tls record padding. + cc.bw = bufio.NewWriter(stickyErrWriter{c, &cc.werr}) + cc.br = bufio.NewReader(c) + cc.fr = NewFramer(cc.bw, cc.br) + cc.fr.ReadMetaHeaders = hpack.NewDecoder(initialHeaderTableSize, nil) + cc.fr.MaxHeaderListSize = t.maxHeaderListSize() + + // TODO: SetMaxDynamicTableSize, SetMaxDynamicTableSizeLimit on + // henc in response to SETTINGS frames? + cc.henc = hpack.NewEncoder(&cc.hbuf) + + if cs, ok := c.(connectionStater); ok { + state := cs.ConnectionState() + cc.tlsState = &state + } + + initialSettings := []Setting{ + Setting{ID: SettingEnablePush, Val: 0}, + Setting{ID: SettingInitialWindowSize, Val: transportDefaultStreamFlow}, + } + if max := t.maxHeaderListSize(); max != 0 { + initialSettings = append(initialSettings, Setting{ID: SettingMaxHeaderListSize, Val: max}) + } + cc.fr.WriteSettings(initialSettings...) + cc.fr.WriteWindowUpdate(0, transportDefaultConnFlow) + cc.inflow.add(transportDefaultConnFlow + initialWindowSize) + cc.bw.Flush() + if cc.werr != nil { + return nil, cc.werr + } + + // Read the obligatory SETTINGS frame + f, err := cc.fr.ReadFrame() + if err != nil { + return nil, err + } + sf, ok := f.(*SettingsFrame) + if !ok { + return nil, fmt.Errorf("expected settings frame, got: %T", f) + } + cc.fr.WriteSettingsAck() + cc.bw.Flush() + + sf.ForeachSetting(func(s Setting) error { + switch s.ID { + case SettingMaxFrameSize: + cc.maxFrameSize = s.Val + case SettingMaxConcurrentStreams: + cc.maxConcurrentStreams = s.Val + case SettingInitialWindowSize: + cc.initialWindowSize = s.Val + default: + // TODO(bradfitz): handle more; at least SETTINGS_HEADER_TABLE_SIZE? + t.vlogf("Unhandled Setting: %v", s) + } + return nil + }) + + go cc.readLoop() + return cc, nil +} + +func (cc *ClientConn) setGoAway(f *GoAwayFrame) { + cc.mu.Lock() + defer cc.mu.Unlock() + cc.goAway = f +} + +func (cc *ClientConn) CanTakeNewRequest() bool { + cc.mu.Lock() + defer cc.mu.Unlock() + return cc.canTakeNewRequestLocked() +} + +func (cc *ClientConn) canTakeNewRequestLocked() bool { + return cc.goAway == nil && !cc.closed && + int64(len(cc.streams)+1) < int64(cc.maxConcurrentStreams) && + cc.nextStreamID < 2147483647 +} + +func (cc *ClientConn) closeIfIdle() { + cc.mu.Lock() + if len(cc.streams) > 0 { + cc.mu.Unlock() + return + } + cc.closed = true + // TODO: do clients send GOAWAY too? maybe? Just Close: + cc.mu.Unlock() + + cc.tconn.Close() +} + +const maxAllocFrameSize = 512 << 10 + +// frameBuffer returns a scratch buffer suitable for writing DATA frames. +// They're capped at the min of the peer's max frame size or 512KB +// (kinda arbitrarily), but definitely capped so we don't allocate 4GB +// bufers. +func (cc *ClientConn) frameScratchBuffer() []byte { + cc.mu.Lock() + size := cc.maxFrameSize + if size > maxAllocFrameSize { + size = maxAllocFrameSize + } + for i, buf := range cc.freeBuf { + if len(buf) >= int(size) { + cc.freeBuf[i] = nil + cc.mu.Unlock() + return buf[:size] + } + } + cc.mu.Unlock() + return make([]byte, size) +} + +func (cc *ClientConn) putFrameScratchBuffer(buf []byte) { + cc.mu.Lock() + defer cc.mu.Unlock() + const maxBufs = 4 // arbitrary; 4 concurrent requests per conn? investigate. + if len(cc.freeBuf) < maxBufs { + cc.freeBuf = append(cc.freeBuf, buf) + return + } + for i, old := range cc.freeBuf { + if old == nil { + cc.freeBuf[i] = buf + return + } + } + // forget about it. +} + +// errRequestCanceled is a copy of net/http's errRequestCanceled because it's not +// exported. At least they'll be DeepEqual for h1-vs-h2 comparisons tests. +var errRequestCanceled = errors.New("net/http: request canceled") + +func commaSeparatedTrailers(req *http.Request) (string, error) { + keys := make([]string, 0, len(req.Trailer)) + for k := range req.Trailer { + k = http.CanonicalHeaderKey(k) + switch k { + case "Transfer-Encoding", "Trailer", "Content-Length": + return "", &badStringError{"invalid Trailer key", k} + } + keys = append(keys, k) + } + if len(keys) > 0 { + sort.Strings(keys) + // TODO: could do better allocation-wise here, but trailers are rare, + // so being lazy for now. + return strings.Join(keys, ","), nil + } + return "", nil +} + +func (cc *ClientConn) responseHeaderTimeout() time.Duration { + if cc.t.t1 != nil { + return cc.t.t1.ResponseHeaderTimeout + } + // No way to do this (yet?) with just an http2.Transport. Probably + // no need. Request.Cancel this is the new way. We only need to support + // this for compatibility with the old http.Transport fields when + // we're doing transparent http2. + return 0 +} + +// checkConnHeaders checks whether req has any invalid connection-level headers. +// per RFC 7540 section 8.1.2.2: Connection-Specific Header Fields. +// Certain headers are special-cased as okay but not transmitted later. +func checkConnHeaders(req *http.Request) error { + if v := req.Header.Get("Upgrade"); v != "" { + return errors.New("http2: invalid Upgrade request header") + } + if v := req.Header.Get("Transfer-Encoding"); (v != "" && v != "chunked") || len(req.Header["Transfer-Encoding"]) > 1 { + return errors.New("http2: invalid Transfer-Encoding request header") + } + if v := req.Header.Get("Connection"); (v != "" && v != "close" && v != "keep-alive") || len(req.Header["Connection"]) > 1 { + return errors.New("http2: invalid Connection request header") + } + return nil +} + +func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) { + if err := checkConnHeaders(req); err != nil { + return nil, err + } + + trailers, err := commaSeparatedTrailers(req) + if err != nil { + return nil, err + } + hasTrailers := trailers != "" + + var body io.Reader = req.Body + contentLen := req.ContentLength + if req.Body != nil && contentLen == 0 { + // Test to see if it's actually zero or just unset. + var buf [1]byte + n, rerr := io.ReadFull(body, buf[:]) + if rerr != nil && rerr != io.EOF { + contentLen = -1 + body = errorReader{rerr} + } else if n == 1 { + // Oh, guess there is data in this Body Reader after all. + // The ContentLength field just wasn't set. + // Stich the Body back together again, re-attaching our + // consumed byte. + contentLen = -1 + body = io.MultiReader(bytes.NewReader(buf[:]), body) + } else { + // Body is actually empty. + body = nil + } + } + + cc.mu.Lock() + if cc.closed || !cc.canTakeNewRequestLocked() { + cc.mu.Unlock() + return nil, errClientConnUnusable + } + + cs := cc.newStream() + cs.req = req + hasBody := body != nil + + // TODO(bradfitz): this is a copy of the logic in net/http. Unify somewhere? + if !cc.t.disableCompression() && + req.Header.Get("Accept-Encoding") == "" && + req.Header.Get("Range") == "" && + req.Method != "HEAD" { + // Request gzip only, not deflate. Deflate is ambiguous and + // not as universally supported anyway. + // See: http://www.gzip.org/zlib/zlib_faq.html#faq38 + // + // Note that we don't request this for HEAD requests, + // due to a bug in nginx: + // http://trac.nginx.org/nginx/ticket/358 + // https://golang.org/issue/5522 + // + // We don't request gzip if the request is for a range, since + // auto-decoding a portion of a gzipped document will just fail + // anyway. See https://golang.org/issue/8923 + cs.requestedGzip = true + } + + // we send: HEADERS{1}, CONTINUATION{0,} + DATA{0,} (DATA is + // sent by writeRequestBody below, along with any Trailers, + // again in form HEADERS{1}, CONTINUATION{0,}) + hdrs := cc.encodeHeaders(req, cs.requestedGzip, trailers, contentLen) + cc.wmu.Lock() + endStream := !hasBody && !hasTrailers + werr := cc.writeHeaders(cs.ID, endStream, hdrs) + cc.wmu.Unlock() + cc.mu.Unlock() + + if werr != nil { + if hasBody { + req.Body.Close() // per RoundTripper contract + } + cc.forgetStreamID(cs.ID) + // Don't bother sending a RST_STREAM (our write already failed; + // no need to keep writing) + return nil, werr + } + + var respHeaderTimer <-chan time.Time + var bodyCopyErrc chan error // result of body copy + if hasBody { + bodyCopyErrc = make(chan error, 1) + go func() { + bodyCopyErrc <- cs.writeRequestBody(body, req.Body) + }() + } else { + if d := cc.responseHeaderTimeout(); d != 0 { + timer := time.NewTimer(d) + defer timer.Stop() + respHeaderTimer = timer.C + } + } + + readLoopResCh := cs.resc + requestCanceledCh := requestCancel(req) + bodyWritten := false + + for { + select { + case re := <-readLoopResCh: + res := re.res + if re.err != nil || res.StatusCode > 299 { + // On error or status code 3xx, 4xx, 5xx, etc abort any + // ongoing write, assuming that the server doesn't care + // about our request body. If the server replied with 1xx or + // 2xx, however, then assume the server DOES potentially + // want our body (e.g. full-duplex streaming: + // golang.org/issue/13444). If it turns out the server + // doesn't, they'll RST_STREAM us soon enough. This is a + // heuristic to avoid adding knobs to Transport. Hopefully + // we can keep it. + cs.abortRequestBodyWrite(errStopReqBodyWrite) + } + if re.err != nil { + cc.forgetStreamID(cs.ID) + return nil, re.err + } + res.Request = req + res.TLS = cc.tlsState + return res, nil + case <-respHeaderTimer: + cc.forgetStreamID(cs.ID) + if !hasBody || bodyWritten { + cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) + } else { + cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel) + } + return nil, errTimeout + case <-requestCanceledCh: + cc.forgetStreamID(cs.ID) + if !hasBody || bodyWritten { + cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) + } else { + cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel) + } + return nil, errRequestCanceled + case <-cs.peerReset: + // processResetStream already removed the + // stream from the streams map; no need for + // forgetStreamID. + return nil, cs.resetErr + case err := <-bodyCopyErrc: + if err != nil { + return nil, err + } + bodyWritten = true + if d := cc.responseHeaderTimeout(); d != 0 { + timer := time.NewTimer(d) + defer timer.Stop() + respHeaderTimer = timer.C + } + } + } +} + +// requires cc.wmu be held +func (cc *ClientConn) writeHeaders(streamID uint32, endStream bool, hdrs []byte) error { + first := true // first frame written (HEADERS is first, then CONTINUATION) + frameSize := int(cc.maxFrameSize) + for len(hdrs) > 0 && cc.werr == nil { + chunk := hdrs + if len(chunk) > frameSize { + chunk = chunk[:frameSize] + } + hdrs = hdrs[len(chunk):] + endHeaders := len(hdrs) == 0 + if first { + cc.fr.WriteHeaders(HeadersFrameParam{ + StreamID: streamID, + BlockFragment: chunk, + EndStream: endStream, + EndHeaders: endHeaders, + }) + first = false + } else { + cc.fr.WriteContinuation(streamID, endHeaders, chunk) + } + } + // TODO(bradfitz): this Flush could potentially block (as + // could the WriteHeaders call(s) above), which means they + // wouldn't respond to Request.Cancel being readable. That's + // rare, but this should probably be in a goroutine. + cc.bw.Flush() + return cc.werr +} + +// internal error values; they don't escape to callers +var ( + // abort request body write; don't send cancel + errStopReqBodyWrite = errors.New("http2: aborting request body write") + + // abort request body write, but send stream reset of cancel. + errStopReqBodyWriteAndCancel = errors.New("http2: canceling request") +) + +func (cs *clientStream) writeRequestBody(body io.Reader, bodyCloser io.Closer) (err error) { + cc := cs.cc + sentEnd := false // whether we sent the final DATA frame w/ END_STREAM + buf := cc.frameScratchBuffer() + defer cc.putFrameScratchBuffer(buf) + + defer func() { + // TODO: write h12Compare test showing whether + // Request.Body is closed by the Transport, + // and in multiple cases: server replies <=299 and >299 + // while still writing request body + cerr := bodyCloser.Close() + if err == nil { + err = cerr + } + }() + + req := cs.req + hasTrailers := req.Trailer != nil + + var sawEOF bool + for !sawEOF { + n, err := body.Read(buf) + if err == io.EOF { + sawEOF = true + err = nil + } else if err != nil { + return err + } + + remain := buf[:n] + for len(remain) > 0 && err == nil { + var allowed int32 + allowed, err = cs.awaitFlowControl(len(remain)) + switch { + case err == errStopReqBodyWrite: + return err + case err == errStopReqBodyWriteAndCancel: + cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) + return err + case err != nil: + return err + } + cc.wmu.Lock() + data := remain[:allowed] + remain = remain[allowed:] + sentEnd = sawEOF && len(remain) == 0 && !hasTrailers + err = cc.fr.WriteData(cs.ID, sentEnd, data) + if err == nil { + // TODO(bradfitz): this flush is for latency, not bandwidth. + // Most requests won't need this. Make this opt-in or opt-out? + // Use some heuristic on the body type? Nagel-like timers? + // Based on 'n'? Only last chunk of this for loop, unless flow control + // tokens are low? For now, always: + err = cc.bw.Flush() + } + cc.wmu.Unlock() + } + if err != nil { + return err + } + } + + cc.wmu.Lock() + if !sentEnd { + var trls []byte + if hasTrailers { + cc.mu.Lock() + trls = cc.encodeTrailers(req) + cc.mu.Unlock() + } + + // Avoid forgetting to send an END_STREAM if the encoded + // trailers are 0 bytes. Both results produce and END_STREAM. + if len(trls) > 0 { + err = cc.writeHeaders(cs.ID, true, trls) + } else { + err = cc.fr.WriteData(cs.ID, true, nil) + } + } + if ferr := cc.bw.Flush(); ferr != nil && err == nil { + err = ferr + } + cc.wmu.Unlock() + + return err +} + +// awaitFlowControl waits for [1, min(maxBytes, cc.cs.maxFrameSize)] flow +// control tokens from the server. +// It returns either the non-zero number of tokens taken or an error +// if the stream is dead. +func (cs *clientStream) awaitFlowControl(maxBytes int) (taken int32, err error) { + cc := cs.cc + cc.mu.Lock() + defer cc.mu.Unlock() + for { + if cc.closed { + return 0, errClientConnClosed + } + if cs.stopReqBody != nil { + return 0, cs.stopReqBody + } + if err := cs.checkReset(); err != nil { + return 0, err + } + if a := cs.flow.available(); a > 0 { + take := a + if int(take) > maxBytes { + + take = int32(maxBytes) // can't truncate int; take is int32 + } + if take > int32(cc.maxFrameSize) { + take = int32(cc.maxFrameSize) + } + cs.flow.take(take) + return take, nil + } + cc.cond.Wait() + } +} + +type badStringError struct { + what string + str string +} + +func (e *badStringError) Error() string { return fmt.Sprintf("%s %q", e.what, e.str) } + +// requires cc.mu be held. +func (cc *ClientConn) encodeHeaders(req *http.Request, addGzipHeader bool, trailers string, contentLength int64) []byte { + cc.hbuf.Reset() + + host := req.Host + if host == "" { + host = req.URL.Host + } + + // 8.1.2.3 Request Pseudo-Header Fields + // The :path pseudo-header field includes the path and query parts of the + // target URI (the path-absolute production and optionally a '?' character + // followed by the query production (see Sections 3.3 and 3.4 of + // [RFC3986]). + cc.writeHeader(":authority", host) + cc.writeHeader(":method", req.Method) + if req.Method != "CONNECT" { + cc.writeHeader(":path", req.URL.RequestURI()) + cc.writeHeader(":scheme", "https") + } + if trailers != "" { + cc.writeHeader("trailer", trailers) + } + + var didUA bool + for k, vv := range req.Header { + lowKey := strings.ToLower(k) + switch lowKey { + case "host", "content-length": + // Host is :authority, already sent. + // Content-Length is automatic, set below. + continue + case "connection", "proxy-connection", "transfer-encoding", "upgrade": + // Per 8.1.2.2 Connection-Specific Header + // Fields, don't send connection-specific + // fields. We deal with these earlier in + // RoundTrip, deciding whether they're + // error-worthy, but we don't want to mutate + // the user's *Request so at this point, just + // skip over them at this point. + continue + case "user-agent": + // Match Go's http1 behavior: at most one + // User-Agent. If set to nil or empty string, + // then omit it. Otherwise if not mentioned, + // include the default (below). + didUA = true + if len(vv) < 1 { + continue + } + vv = vv[:1] + if vv[0] == "" { + continue + } + } + for _, v := range vv { + cc.writeHeader(lowKey, v) + } + } + if shouldSendReqContentLength(req.Method, contentLength) { + cc.writeHeader("content-length", strconv.FormatInt(contentLength, 10)) + } + if addGzipHeader { + cc.writeHeader("accept-encoding", "gzip") + } + if !didUA { + cc.writeHeader("user-agent", defaultUserAgent) + } + return cc.hbuf.Bytes() +} + +// shouldSendReqContentLength reports whether the http2.Transport should send +// a "content-length" request header. This logic is basically a copy of the net/http +// transferWriter.shouldSendContentLength. +// The contentLength is the corrected contentLength (so 0 means actually 0, not unknown). +// -1 means unknown. +func shouldSendReqContentLength(method string, contentLength int64) bool { + if contentLength > 0 { + return true + } + if contentLength < 0 { + return false + } + // For zero bodies, whether we send a content-length depends on the method. + // It also kinda doesn't matter for http2 either way, with END_STREAM. + switch method { + case "POST", "PUT", "PATCH": + return true + default: + return false + } +} + +// requires cc.mu be held. +func (cc *ClientConn) encodeTrailers(req *http.Request) []byte { + cc.hbuf.Reset() + for k, vv := range req.Trailer { + // Transfer-Encoding, etc.. have already been filter at the + // start of RoundTrip + lowKey := strings.ToLower(k) + for _, v := range vv { + cc.writeHeader(lowKey, v) + } + } + return cc.hbuf.Bytes() +} + +func (cc *ClientConn) writeHeader(name, value string) { + if VerboseLogs { + log.Printf("http2: Transport encoding header %q = %q", name, value) + } + cc.henc.WriteField(hpack.HeaderField{Name: name, Value: value}) +} + +type resAndError struct { + res *http.Response + err error +} + +// requires cc.mu be held. +func (cc *ClientConn) newStream() *clientStream { + cs := &clientStream{ + cc: cc, + ID: cc.nextStreamID, + resc: make(chan resAndError, 1), + peerReset: make(chan struct{}), + done: make(chan struct{}), + } + cs.flow.add(int32(cc.initialWindowSize)) + cs.flow.setConnFlow(&cc.flow) + cs.inflow.add(transportDefaultStreamFlow) + cs.inflow.setConnFlow(&cc.inflow) + cc.nextStreamID += 2 + cc.streams[cs.ID] = cs + return cs +} + +func (cc *ClientConn) forgetStreamID(id uint32) { + cc.streamByID(id, true) +} + +func (cc *ClientConn) streamByID(id uint32, andRemove bool) *clientStream { + cc.mu.Lock() + defer cc.mu.Unlock() + cs := cc.streams[id] + if andRemove && cs != nil && !cc.closed { + delete(cc.streams, id) + close(cs.done) + } + return cs +} + +// clientConnReadLoop is the state owned by the clientConn's frame-reading readLoop. +type clientConnReadLoop struct { + cc *ClientConn + activeRes map[uint32]*clientStream // keyed by streamID + closeWhenIdle bool +} + +// readLoop runs in its own goroutine and reads and dispatches frames. +func (cc *ClientConn) readLoop() { + rl := &clientConnReadLoop{ + cc: cc, + activeRes: make(map[uint32]*clientStream), + } + + defer rl.cleanup() + cc.readerErr = rl.run() + if ce, ok := cc.readerErr.(ConnectionError); ok { + cc.wmu.Lock() + cc.fr.WriteGoAway(0, ErrCode(ce), nil) + cc.wmu.Unlock() + } +} + +func (rl *clientConnReadLoop) cleanup() { + cc := rl.cc + defer cc.tconn.Close() + defer cc.t.connPool().MarkDead(cc) + defer close(cc.readerDone) + + // Close any response bodies if the server closes prematurely. + // TODO: also do this if we've written the headers but not + // gotten a response yet. + err := cc.readerErr + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + cc.mu.Lock() + for _, cs := range rl.activeRes { + cs.bufPipe.CloseWithError(err) + } + for _, cs := range cc.streams { + select { + case cs.resc <- resAndError{err: err}: + default: + } + close(cs.done) + } + cc.closed = true + cc.cond.Broadcast() + cc.mu.Unlock() +} + +func (rl *clientConnReadLoop) run() error { + cc := rl.cc + rl.closeWhenIdle = cc.t.disableKeepAlives() + gotReply := false // ever saw a reply + for { + f, err := cc.fr.ReadFrame() + if err != nil { + cc.vlogf("Transport readFrame error: (%T) %v", err, err) + } + if se, ok := err.(StreamError); ok { + if cs := cc.streamByID(se.StreamID, true /*ended; remove it*/); cs != nil { + rl.endStreamError(cs, cc.fr.errDetail) + } + continue + } else if err != nil { + return err + } + if VerboseLogs { + cc.vlogf("http2: Transport received %s", summarizeFrame(f)) + } + maybeIdle := false // whether frame might transition us to idle + + switch f := f.(type) { + case *MetaHeadersFrame: + err = rl.processHeaders(f) + maybeIdle = true + gotReply = true + case *DataFrame: + err = rl.processData(f) + maybeIdle = true + case *GoAwayFrame: + err = rl.processGoAway(f) + maybeIdle = true + case *RSTStreamFrame: + err = rl.processResetStream(f) + maybeIdle = true + case *SettingsFrame: + err = rl.processSettings(f) + case *PushPromiseFrame: + err = rl.processPushPromise(f) + case *WindowUpdateFrame: + err = rl.processWindowUpdate(f) + case *PingFrame: + err = rl.processPing(f) + default: + cc.logf("Transport: unhandled response frame type %T", f) + } + if err != nil { + return err + } + if rl.closeWhenIdle && gotReply && maybeIdle && len(rl.activeRes) == 0 { + cc.closeIfIdle() + } + } +} + +func (rl *clientConnReadLoop) processHeaders(f *MetaHeadersFrame) error { + cc := rl.cc + cs := cc.streamByID(f.StreamID, f.StreamEnded()) + if cs == nil { + // We'd get here if we canceled a request while the + // server had its response still in flight. So if this + // was just something we canceled, ignore it. + return nil + } + if !cs.pastHeaders { + cs.pastHeaders = true + } else { + return rl.processTrailers(cs, f) + } + + res, err := rl.handleResponse(cs, f) + if err != nil { + if _, ok := err.(ConnectionError); ok { + return err + } + // Any other error type is a stream error. + cs.cc.writeStreamReset(f.StreamID, ErrCodeProtocol, err) + cs.resc <- resAndError{err: err} + return nil // return nil from process* funcs to keep conn alive + } + if res == nil { + // (nil, nil) special case. See handleResponse docs. + return nil + } + if res.Body != noBody { + rl.activeRes[cs.ID] = cs + } + cs.resTrailer = &res.Trailer + cs.resc <- resAndError{res: res} + return nil +} + +// may return error types nil, or ConnectionError. Any other error value +// is a StreamError of type ErrCodeProtocol. The returned error in that case +// is the detail. +// +// As a special case, handleResponse may return (nil, nil) to skip the +// frame (currently only used for 100 expect continue). This special +// case is going away after Issue 13851 is fixed. +func (rl *clientConnReadLoop) handleResponse(cs *clientStream, f *MetaHeadersFrame) (*http.Response, error) { + if f.Truncated { + return nil, errResponseHeaderListSize + } + + status := f.PseudoValue("status") + if status == "" { + return nil, errors.New("missing status pseudo header") + } + statusCode, err := strconv.Atoi(status) + if err != nil { + return nil, errors.New("malformed non-numeric status pseudo header") + } + + if statusCode == 100 { + // Just skip 100-continue response headers for now. + // TODO: golang.org/issue/13851 for doing it properly. + cs.pastHeaders = false // do it all again + return nil, nil + } + + header := make(http.Header) + res := &http.Response{ + Proto: "HTTP/2.0", + ProtoMajor: 2, + Header: header, + StatusCode: statusCode, + Status: status + " " + http.StatusText(statusCode), + } + for _, hf := range f.RegularFields() { + key := http.CanonicalHeaderKey(hf.Name) + if key == "Trailer" { + t := res.Trailer + if t == nil { + t = make(http.Header) + res.Trailer = t + } + foreachHeaderElement(hf.Value, func(v string) { + t[http.CanonicalHeaderKey(v)] = nil + }) + } else { + header[key] = append(header[key], hf.Value) + } + } + + streamEnded := f.StreamEnded() + if !streamEnded || cs.req.Method == "HEAD" { + res.ContentLength = -1 + if clens := res.Header["Content-Length"]; len(clens) == 1 { + if clen64, err := strconv.ParseInt(clens[0], 10, 64); err == nil { + res.ContentLength = clen64 + } else { + // TODO: care? unlike http/1, it won't mess up our framing, so it's + // more safe smuggling-wise to ignore. + } + } else if len(clens) > 1 { + // TODO: care? unlike http/1, it won't mess up our framing, so it's + // more safe smuggling-wise to ignore. + } + } + + if streamEnded { + res.Body = noBody + return res, nil + } + + buf := new(bytes.Buffer) // TODO(bradfitz): recycle this garbage + cs.bufPipe = pipe{b: buf} + cs.bytesRemain = res.ContentLength + res.Body = transportResponseBody{cs} + go cs.awaitRequestCancel(requestCancel(cs.req)) + + if cs.requestedGzip && res.Header.Get("Content-Encoding") == "gzip" { + res.Header.Del("Content-Encoding") + res.Header.Del("Content-Length") + res.ContentLength = -1 + res.Body = &gzipReader{body: res.Body} + } + return res, nil +} + +func (rl *clientConnReadLoop) processTrailers(cs *clientStream, f *MetaHeadersFrame) error { + if cs.pastTrailers { + // Too many HEADERS frames for this stream. + return ConnectionError(ErrCodeProtocol) + } + cs.pastTrailers = true + if !f.StreamEnded() { + // We expect that any headers for trailers also + // has END_STREAM. + return ConnectionError(ErrCodeProtocol) + } + if len(f.PseudoFields()) > 0 { + // No pseudo header fields are defined for trailers. + // TODO: ConnectionError might be overly harsh? Check. + return ConnectionError(ErrCodeProtocol) + } + + trailer := make(http.Header) + for _, hf := range f.RegularFields() { + key := http.CanonicalHeaderKey(hf.Name) + trailer[key] = append(trailer[key], hf.Value) + } + cs.trailer = trailer + + rl.endStream(cs) + return nil +} + +// transportResponseBody is the concrete type of Transport.RoundTrip's +// Response.Body. It is an io.ReadCloser. On Read, it reads from cs.body. +// On Close it sends RST_STREAM if EOF wasn't already seen. +type transportResponseBody struct { + cs *clientStream +} + +func (b transportResponseBody) Read(p []byte) (n int, err error) { + cs := b.cs + cc := cs.cc + + if cs.readErr != nil { + return 0, cs.readErr + } + n, err = b.cs.bufPipe.Read(p) + if cs.bytesRemain != -1 { + if int64(n) > cs.bytesRemain { + n = int(cs.bytesRemain) + if err == nil { + err = errors.New("net/http: server replied with more than declared Content-Length; truncated") + cc.writeStreamReset(cs.ID, ErrCodeProtocol, err) + } + cs.readErr = err + return int(cs.bytesRemain), err + } + cs.bytesRemain -= int64(n) + if err == io.EOF && cs.bytesRemain > 0 { + err = io.ErrUnexpectedEOF + cs.readErr = err + return n, err + } + } + if n == 0 { + // No flow control tokens to send back. + return + } + + cc.mu.Lock() + defer cc.mu.Unlock() + + var connAdd, streamAdd int32 + // Check the conn-level first, before the stream-level. + if v := cc.inflow.available(); v < transportDefaultConnFlow/2 { + connAdd = transportDefaultConnFlow - v + cc.inflow.add(connAdd) + } + if err == nil { // No need to refresh if the stream is over or failed. + if v := cs.inflow.available(); v < transportDefaultStreamFlow-transportDefaultStreamMinRefresh { + streamAdd = transportDefaultStreamFlow - v + cs.inflow.add(streamAdd) + } + } + if connAdd != 0 || streamAdd != 0 { + cc.wmu.Lock() + defer cc.wmu.Unlock() + if connAdd != 0 { + cc.fr.WriteWindowUpdate(0, mustUint31(connAdd)) + } + if streamAdd != 0 { + cc.fr.WriteWindowUpdate(cs.ID, mustUint31(streamAdd)) + } + cc.bw.Flush() + } + return +} + +var errClosedResponseBody = errors.New("http2: response body closed") + +func (b transportResponseBody) Close() error { + cs := b.cs + if cs.bufPipe.Err() != io.EOF { + // TODO: write test for this + cs.cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) + } + cs.bufPipe.BreakWithError(errClosedResponseBody) + return nil +} + +func (rl *clientConnReadLoop) processData(f *DataFrame) error { + cc := rl.cc + cs := cc.streamByID(f.StreamID, f.StreamEnded()) + if cs == nil { + cc.mu.Lock() + neverSent := cc.nextStreamID + cc.mu.Unlock() + if f.StreamID >= neverSent { + // We never asked for this. + cc.logf("http2: Transport received unsolicited DATA frame; closing connection") + return ConnectionError(ErrCodeProtocol) + } + // We probably did ask for this, but canceled. Just ignore it. + // TODO: be stricter here? only silently ignore things which + // we canceled, but not things which were closed normally + // by the peer? Tough without accumulating too much state. + return nil + } + if data := f.Data(); len(data) > 0 { + if cs.bufPipe.b == nil { + // Data frame after it's already closed? + cc.logf("http2: Transport received DATA frame for closed stream; closing connection") + return ConnectionError(ErrCodeProtocol) + } + + // Check connection-level flow control. + cc.mu.Lock() + if cs.inflow.available() >= int32(len(data)) { + cs.inflow.take(int32(len(data))) + } else { + cc.mu.Unlock() + return ConnectionError(ErrCodeFlowControl) + } + cc.mu.Unlock() + + if _, err := cs.bufPipe.Write(data); err != nil { + rl.endStreamError(cs, err) + return err + } + } + + if f.StreamEnded() { + rl.endStream(cs) + } + return nil +} + +var errInvalidTrailers = errors.New("http2: invalid trailers") + +func (rl *clientConnReadLoop) endStream(cs *clientStream) { + // TODO: check that any declared content-length matches, like + // server.go's (*stream).endStream method. + rl.endStreamError(cs, nil) +} + +func (rl *clientConnReadLoop) endStreamError(cs *clientStream, err error) { + var code func() + if err == nil { + err = io.EOF + code = cs.copyTrailers + } + cs.bufPipe.closeWithErrorAndCode(err, code) + delete(rl.activeRes, cs.ID) + if cs.req.Close || cs.req.Header.Get("Connection") == "close" { + rl.closeWhenIdle = true + } +} + +func (cs *clientStream) copyTrailers() { + for k, vv := range cs.trailer { + t := cs.resTrailer + if *t == nil { + *t = make(http.Header) + } + (*t)[k] = vv + } +} + +func (rl *clientConnReadLoop) processGoAway(f *GoAwayFrame) error { + cc := rl.cc + cc.t.connPool().MarkDead(cc) + if f.ErrCode != 0 { + // TODO: deal with GOAWAY more. particularly the error code + cc.vlogf("transport got GOAWAY with error code = %v", f.ErrCode) + } + cc.setGoAway(f) + return nil +} + +func (rl *clientConnReadLoop) processSettings(f *SettingsFrame) error { + cc := rl.cc + cc.mu.Lock() + defer cc.mu.Unlock() + return f.ForeachSetting(func(s Setting) error { + switch s.ID { + case SettingMaxFrameSize: + cc.maxFrameSize = s.Val + case SettingMaxConcurrentStreams: + cc.maxConcurrentStreams = s.Val + case SettingInitialWindowSize: + // TODO: error if this is too large. + + // TODO: adjust flow control of still-open + // frames by the difference of the old initial + // window size and this one. + cc.initialWindowSize = s.Val + default: + // TODO(bradfitz): handle more settings? SETTINGS_HEADER_TABLE_SIZE probably. + cc.vlogf("Unhandled Setting: %v", s) + } + return nil + }) +} + +func (rl *clientConnReadLoop) processWindowUpdate(f *WindowUpdateFrame) error { + cc := rl.cc + cs := cc.streamByID(f.StreamID, false) + if f.StreamID != 0 && cs == nil { + return nil + } + + cc.mu.Lock() + defer cc.mu.Unlock() + + fl := &cc.flow + if cs != nil { + fl = &cs.flow + } + if !fl.add(int32(f.Increment)) { + return ConnectionError(ErrCodeFlowControl) + } + cc.cond.Broadcast() + return nil +} + +func (rl *clientConnReadLoop) processResetStream(f *RSTStreamFrame) error { + cs := rl.cc.streamByID(f.StreamID, true) + if cs == nil { + // TODO: return error if server tries to RST_STEAM an idle stream + return nil + } + select { + case <-cs.peerReset: + // Already reset. + // This is the only goroutine + // which closes this, so there + // isn't a race. + default: + err := StreamError{cs.ID, f.ErrCode} + cs.resetErr = err + close(cs.peerReset) + cs.bufPipe.CloseWithError(err) + cs.cc.cond.Broadcast() // wake up checkReset via clientStream.awaitFlowControl + } + delete(rl.activeRes, cs.ID) + return nil +} + +func (rl *clientConnReadLoop) processPing(f *PingFrame) error { + if f.IsAck() { + // 6.7 PING: " An endpoint MUST NOT respond to PING frames + // containing this flag." + return nil + } + cc := rl.cc + cc.wmu.Lock() + defer cc.wmu.Unlock() + if err := cc.fr.WritePing(true, f.Data); err != nil { + return err + } + return cc.bw.Flush() +} + +func (rl *clientConnReadLoop) processPushPromise(f *PushPromiseFrame) error { + // We told the peer we don't want them. + // Spec says: + // "PUSH_PROMISE MUST NOT be sent if the SETTINGS_ENABLE_PUSH + // setting of the peer endpoint is set to 0. An endpoint that + // has set this setting and has received acknowledgement MUST + // treat the receipt of a PUSH_PROMISE frame as a connection + // error (Section 5.4.1) of type PROTOCOL_ERROR." + return ConnectionError(ErrCodeProtocol) +} + +func (cc *ClientConn) writeStreamReset(streamID uint32, code ErrCode, err error) { + // TODO: do something with err? send it as a debug frame to the peer? + // But that's only in GOAWAY. Invent a new frame type? Is there one already? + cc.wmu.Lock() + cc.fr.WriteRSTStream(streamID, code) + cc.bw.Flush() + cc.wmu.Unlock() +} + +var ( + errResponseHeaderListSize = errors.New("http2: response header list larger than advertised limit") + errPseudoTrailers = errors.New("http2: invalid pseudo header in trailers") +) + +func (cc *ClientConn) logf(format string, args ...interface{}) { + cc.t.logf(format, args...) +} + +func (cc *ClientConn) vlogf(format string, args ...interface{}) { + cc.t.vlogf(format, args...) +} + +func (t *Transport) vlogf(format string, args ...interface{}) { + if VerboseLogs { + t.logf(format, args...) + } +} + +func (t *Transport) logf(format string, args ...interface{}) { + log.Printf(format, args...) +} + +var noBody io.ReadCloser = ioutil.NopCloser(bytes.NewReader(nil)) + +func strSliceContains(ss []string, s string) bool { + for _, v := range ss { + if v == s { + return true + } + } + return false +} + +type erringRoundTripper struct{ err error } + +func (rt erringRoundTripper) RoundTrip(*http.Request) (*http.Response, error) { return nil, rt.err } + +// gzipReader wraps a response body so it can lazily +// call gzip.NewReader on the first call to Read +type gzipReader struct { + body io.ReadCloser // underlying Response.Body + zr *gzip.Reader // lazily-initialized gzip reader + zerr error // sticky error +} + +func (gz *gzipReader) Read(p []byte) (n int, err error) { + if gz.zerr != nil { + return 0, gz.zerr + } + if gz.zr == nil { + gz.zr, err = gzip.NewReader(gz.body) + if err != nil { + gz.zerr = err + return 0, err + } + } + return gz.zr.Read(p) +} + +func (gz *gzipReader) Close() error { + return gz.body.Close() +} + +type errorReader struct{ err error } + +func (r errorReader) Read(p []byte) (int, error) { return 0, r.err } diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/write.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/write.go new file mode 100644 index 00000000000..5297a4bfe3d --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/write.go @@ -0,0 +1,263 @@ +// Copyright 2014 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 http2 + +import ( + "bytes" + "fmt" + "log" + "net/http" + "sort" + "time" + + "golang.org/x/net/http2/hpack" +) + +// writeFramer is implemented by any type that is used to write frames. +type writeFramer interface { + writeFrame(writeContext) error +} + +// writeContext is the interface needed by the various frame writer +// types below. All the writeFrame methods below are scheduled via the +// frame writing scheduler (see writeScheduler in writesched.go). +// +// This interface is implemented by *serverConn. +// +// TODO: decide whether to a) use this in the client code (which didn't +// end up using this yet, because it has a simpler design, not +// currently implementing priorities), or b) delete this and +// make the server code a bit more concrete. +type writeContext interface { + Framer() *Framer + Flush() error + CloseConn() error + // HeaderEncoder returns an HPACK encoder that writes to the + // returned buffer. + HeaderEncoder() (*hpack.Encoder, *bytes.Buffer) +} + +// endsStream reports whether the given frame writer w will locally +// close the stream. +func endsStream(w writeFramer) bool { + switch v := w.(type) { + case *writeData: + return v.endStream + case *writeResHeaders: + return v.endStream + case nil: + // This can only happen if the caller reuses w after it's + // been intentionally nil'ed out to prevent use. Keep this + // here to catch future refactoring breaking it. + panic("endsStream called on nil writeFramer") + } + return false +} + +type flushFrameWriter struct{} + +func (flushFrameWriter) writeFrame(ctx writeContext) error { + return ctx.Flush() +} + +type writeSettings []Setting + +func (s writeSettings) writeFrame(ctx writeContext) error { + return ctx.Framer().WriteSettings([]Setting(s)...) +} + +type writeGoAway struct { + maxStreamID uint32 + code ErrCode +} + +func (p *writeGoAway) writeFrame(ctx writeContext) error { + err := ctx.Framer().WriteGoAway(p.maxStreamID, p.code, nil) + if p.code != 0 { + ctx.Flush() // ignore error: we're hanging up on them anyway + time.Sleep(50 * time.Millisecond) + ctx.CloseConn() + } + return err +} + +type writeData struct { + streamID uint32 + p []byte + endStream bool +} + +func (w *writeData) String() string { + return fmt.Sprintf("writeData(stream=%d, p=%d, endStream=%v)", w.streamID, len(w.p), w.endStream) +} + +func (w *writeData) writeFrame(ctx writeContext) error { + return ctx.Framer().WriteData(w.streamID, w.endStream, w.p) +} + +// handlerPanicRST is the message sent from handler goroutines when +// the handler panics. +type handlerPanicRST struct { + StreamID uint32 +} + +func (hp handlerPanicRST) writeFrame(ctx writeContext) error { + return ctx.Framer().WriteRSTStream(hp.StreamID, ErrCodeInternal) +} + +func (se StreamError) writeFrame(ctx writeContext) error { + return ctx.Framer().WriteRSTStream(se.StreamID, se.Code) +} + +type writePingAck struct{ pf *PingFrame } + +func (w writePingAck) writeFrame(ctx writeContext) error { + return ctx.Framer().WritePing(true, w.pf.Data) +} + +type writeSettingsAck struct{} + +func (writeSettingsAck) writeFrame(ctx writeContext) error { + return ctx.Framer().WriteSettingsAck() +} + +// writeResHeaders is a request to write a HEADERS and 0+ CONTINUATION frames +// for HTTP response headers or trailers from a server handler. +type writeResHeaders struct { + streamID uint32 + httpResCode int // 0 means no ":status" line + h http.Header // may be nil + trailers []string // if non-nil, which keys of h to write. nil means all. + endStream bool + + date string + contentType string + contentLength string +} + +func encKV(enc *hpack.Encoder, k, v string) { + if VerboseLogs { + log.Printf("http2: server encoding header %q = %q", k, v) + } + enc.WriteField(hpack.HeaderField{Name: k, Value: v}) +} + +func (w *writeResHeaders) writeFrame(ctx writeContext) error { + enc, buf := ctx.HeaderEncoder() + buf.Reset() + + if w.httpResCode != 0 { + encKV(enc, ":status", httpCodeString(w.httpResCode)) + } + + encodeHeaders(enc, w.h, w.trailers) + + if w.contentType != "" { + encKV(enc, "content-type", w.contentType) + } + if w.contentLength != "" { + encKV(enc, "content-length", w.contentLength) + } + if w.date != "" { + encKV(enc, "date", w.date) + } + + headerBlock := buf.Bytes() + if len(headerBlock) == 0 && w.trailers == nil { + panic("unexpected empty hpack") + } + + // For now we're lazy and just pick the minimum MAX_FRAME_SIZE + // that all peers must support (16KB). Later we could care + // more and send larger frames if the peer advertised it, but + // there's little point. Most headers are small anyway (so we + // generally won't have CONTINUATION frames), and extra frames + // only waste 9 bytes anyway. + const maxFrameSize = 16384 + + first := true + for len(headerBlock) > 0 { + frag := headerBlock + if len(frag) > maxFrameSize { + frag = frag[:maxFrameSize] + } + headerBlock = headerBlock[len(frag):] + endHeaders := len(headerBlock) == 0 + var err error + if first { + first = false + err = ctx.Framer().WriteHeaders(HeadersFrameParam{ + StreamID: w.streamID, + BlockFragment: frag, + EndStream: w.endStream, + EndHeaders: endHeaders, + }) + } else { + err = ctx.Framer().WriteContinuation(w.streamID, endHeaders, frag) + } + if err != nil { + return err + } + } + return nil +} + +type write100ContinueHeadersFrame struct { + streamID uint32 +} + +func (w write100ContinueHeadersFrame) writeFrame(ctx writeContext) error { + enc, buf := ctx.HeaderEncoder() + buf.Reset() + encKV(enc, ":status", "100") + return ctx.Framer().WriteHeaders(HeadersFrameParam{ + StreamID: w.streamID, + BlockFragment: buf.Bytes(), + EndStream: false, + EndHeaders: true, + }) +} + +type writeWindowUpdate struct { + streamID uint32 // or 0 for conn-level + n uint32 +} + +func (wu writeWindowUpdate) writeFrame(ctx writeContext) error { + return ctx.Framer().WriteWindowUpdate(wu.streamID, wu.n) +} + +func encodeHeaders(enc *hpack.Encoder, h http.Header, keys []string) { + // TODO: garbage. pool sorters like http1? hot path for 1 key? + if keys == nil { + keys = make([]string, 0, len(h)) + for k := range h { + keys = append(keys, k) + } + sort.Strings(keys) + } + for _, k := range keys { + vv := h[k] + k = lowerHeader(k) + if !validHeaderFieldName(k) { + // TODO: return an error? golang.org/issue/14048 + // For now just omit it. + continue + } + isTE := k == "transfer-encoding" + for _, v := range vv { + if !validHeaderFieldValue(v) { + // TODO: return an error? golang.org/issue/14048 + // For now just omit it. + continue + } + // TODO: more of "8.1.2.2 Connection-Specific Header Fields" + if isTE && v != "trailers" { + continue + } + encKV(enc, k, v) + } + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/writesched.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/writesched.go new file mode 100644 index 00000000000..c24316ce7b2 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/writesched.go @@ -0,0 +1,283 @@ +// Copyright 2014 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 http2 + +import "fmt" + +// frameWriteMsg is a request to write a frame. +type frameWriteMsg struct { + // write is the interface value that does the writing, once the + // writeScheduler (below) has decided to select this frame + // to write. The write functions are all defined in write.go. + write writeFramer + + stream *stream // used for prioritization. nil for non-stream frames. + + // done, if non-nil, must be a buffered channel with space for + // 1 message and is sent the return value from write (or an + // earlier error) when the frame has been written. + done chan error +} + +// for debugging only: +func (wm frameWriteMsg) String() string { + var streamID uint32 + if wm.stream != nil { + streamID = wm.stream.id + } + var des string + if s, ok := wm.write.(fmt.Stringer); ok { + des = s.String() + } else { + des = fmt.Sprintf("%T", wm.write) + } + return fmt.Sprintf("[frameWriteMsg stream=%d, ch=%v, type: %v]", streamID, wm.done != nil, des) +} + +// writeScheduler tracks pending frames to write, priorities, and decides +// the next one to use. It is not thread-safe. +type writeScheduler struct { + // zero are frames not associated with a specific stream. + // They're sent before any stream-specific freams. + zero writeQueue + + // maxFrameSize is the maximum size of a DATA frame + // we'll write. Must be non-zero and between 16K-16M. + maxFrameSize uint32 + + // sq contains the stream-specific queues, keyed by stream ID. + // when a stream is idle, it's deleted from the map. + sq map[uint32]*writeQueue + + // canSend is a slice of memory that's reused between frame + // scheduling decisions to hold the list of writeQueues (from sq) + // which have enough flow control data to send. After canSend is + // built, the best is selected. + canSend []*writeQueue + + // pool of empty queues for reuse. + queuePool []*writeQueue +} + +func (ws *writeScheduler) putEmptyQueue(q *writeQueue) { + if len(q.s) != 0 { + panic("queue must be empty") + } + ws.queuePool = append(ws.queuePool, q) +} + +func (ws *writeScheduler) getEmptyQueue() *writeQueue { + ln := len(ws.queuePool) + if ln == 0 { + return new(writeQueue) + } + q := ws.queuePool[ln-1] + ws.queuePool = ws.queuePool[:ln-1] + return q +} + +func (ws *writeScheduler) empty() bool { return ws.zero.empty() && len(ws.sq) == 0 } + +func (ws *writeScheduler) add(wm frameWriteMsg) { + st := wm.stream + if st == nil { + ws.zero.push(wm) + } else { + ws.streamQueue(st.id).push(wm) + } +} + +func (ws *writeScheduler) streamQueue(streamID uint32) *writeQueue { + if q, ok := ws.sq[streamID]; ok { + return q + } + if ws.sq == nil { + ws.sq = make(map[uint32]*writeQueue) + } + q := ws.getEmptyQueue() + ws.sq[streamID] = q + return q +} + +// take returns the most important frame to write and removes it from the scheduler. +// It is illegal to call this if the scheduler is empty or if there are no connection-level +// flow control bytes available. +func (ws *writeScheduler) take() (wm frameWriteMsg, ok bool) { + if ws.maxFrameSize == 0 { + panic("internal error: ws.maxFrameSize not initialized or invalid") + } + + // If there any frames not associated with streams, prefer those first. + // These are usually SETTINGS, etc. + if !ws.zero.empty() { + return ws.zero.shift(), true + } + if len(ws.sq) == 0 { + return + } + + // Next, prioritize frames on streams that aren't DATA frames (no cost). + for id, q := range ws.sq { + if q.firstIsNoCost() { + return ws.takeFrom(id, q) + } + } + + // Now, all that remains are DATA frames with non-zero bytes to + // send. So pick the best one. + if len(ws.canSend) != 0 { + panic("should be empty") + } + for _, q := range ws.sq { + if n := ws.streamWritableBytes(q); n > 0 { + ws.canSend = append(ws.canSend, q) + } + } + if len(ws.canSend) == 0 { + return + } + defer ws.zeroCanSend() + + // TODO: find the best queue + q := ws.canSend[0] + + return ws.takeFrom(q.streamID(), q) +} + +// zeroCanSend is defered from take. +func (ws *writeScheduler) zeroCanSend() { + for i := range ws.canSend { + ws.canSend[i] = nil + } + ws.canSend = ws.canSend[:0] +} + +// streamWritableBytes returns the number of DATA bytes we could write +// from the given queue's stream, if this stream/queue were +// selected. It is an error to call this if q's head isn't a +// *writeData. +func (ws *writeScheduler) streamWritableBytes(q *writeQueue) int32 { + wm := q.head() + ret := wm.stream.flow.available() // max we can write + if ret == 0 { + return 0 + } + if int32(ws.maxFrameSize) < ret { + ret = int32(ws.maxFrameSize) + } + if ret == 0 { + panic("internal error: ws.maxFrameSize not initialized or invalid") + } + wd := wm.write.(*writeData) + if len(wd.p) < int(ret) { + ret = int32(len(wd.p)) + } + return ret +} + +func (ws *writeScheduler) takeFrom(id uint32, q *writeQueue) (wm frameWriteMsg, ok bool) { + wm = q.head() + // If the first item in this queue costs flow control tokens + // and we don't have enough, write as much as we can. + if wd, ok := wm.write.(*writeData); ok && len(wd.p) > 0 { + allowed := wm.stream.flow.available() // max we can write + if allowed == 0 { + // No quota available. Caller can try the next stream. + return frameWriteMsg{}, false + } + if int32(ws.maxFrameSize) < allowed { + allowed = int32(ws.maxFrameSize) + } + // TODO: further restrict the allowed size, because even if + // the peer says it's okay to write 16MB data frames, we might + // want to write smaller ones to properly weight competing + // streams' priorities. + + if len(wd.p) > int(allowed) { + wm.stream.flow.take(allowed) + chunk := wd.p[:allowed] + wd.p = wd.p[allowed:] + // Make up a new write message of a valid size, rather + // than shifting one off the queue. + return frameWriteMsg{ + stream: wm.stream, + write: &writeData{ + streamID: wd.streamID, + p: chunk, + // even if the original had endStream set, there + // arebytes remaining because len(wd.p) > allowed, + // so we know endStream is false: + endStream: false, + }, + // our caller is blocking on the final DATA frame, not + // these intermediates, so no need to wait: + done: nil, + }, true + } + wm.stream.flow.take(int32(len(wd.p))) + } + + q.shift() + if q.empty() { + ws.putEmptyQueue(q) + delete(ws.sq, id) + } + return wm, true +} + +func (ws *writeScheduler) forgetStream(id uint32) { + q, ok := ws.sq[id] + if !ok { + return + } + delete(ws.sq, id) + + // But keep it for others later. + for i := range q.s { + q.s[i] = frameWriteMsg{} + } + q.s = q.s[:0] + ws.putEmptyQueue(q) +} + +type writeQueue struct { + s []frameWriteMsg +} + +// streamID returns the stream ID for a non-empty stream-specific queue. +func (q *writeQueue) streamID() uint32 { return q.s[0].stream.id } + +func (q *writeQueue) empty() bool { return len(q.s) == 0 } + +func (q *writeQueue) push(wm frameWriteMsg) { + q.s = append(q.s, wm) +} + +// head returns the next item that would be removed by shift. +func (q *writeQueue) head() frameWriteMsg { + if len(q.s) == 0 { + panic("invalid use of queue") + } + return q.s[0] +} + +func (q *writeQueue) shift() frameWriteMsg { + if len(q.s) == 0 { + panic("invalid use of queue") + } + wm := q.s[0] + // TODO: less copy-happy queue. + copy(q.s, q.s[1:]) + q.s[len(q.s)-1] = frameWriteMsg{} + q.s = q.s[:len(q.s)-1] + return wm +} + +func (q *writeQueue) firstIsNoCost() bool { + if df, ok := q.s[0].write.(*writeData); ok { + return len(df.p) == 0 + } + return true +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/internal/timeseries/timeseries.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/internal/timeseries/timeseries.go new file mode 100644 index 00000000000..1119f344822 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/internal/timeseries/timeseries.go @@ -0,0 +1,525 @@ +// Copyright 2015 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 timeseries implements a time series structure for stats collection. +package timeseries // import "golang.org/x/net/internal/timeseries" + +import ( + "fmt" + "log" + "time" +) + +const ( + timeSeriesNumBuckets = 64 + minuteHourSeriesNumBuckets = 60 +) + +var timeSeriesResolutions = []time.Duration{ + 1 * time.Second, + 10 * time.Second, + 1 * time.Minute, + 10 * time.Minute, + 1 * time.Hour, + 6 * time.Hour, + 24 * time.Hour, // 1 day + 7 * 24 * time.Hour, // 1 week + 4 * 7 * 24 * time.Hour, // 4 weeks + 16 * 7 * 24 * time.Hour, // 16 weeks +} + +var minuteHourSeriesResolutions = []time.Duration{ + 1 * time.Second, + 1 * time.Minute, +} + +// An Observable is a kind of data that can be aggregated in a time series. +type Observable interface { + Multiply(ratio float64) // Multiplies the data in self by a given ratio + Add(other Observable) // Adds the data from a different observation to self + Clear() // Clears the observation so it can be reused. + CopyFrom(other Observable) // Copies the contents of a given observation to self +} + +// Float attaches the methods of Observable to a float64. +type Float float64 + +// NewFloat returns a Float. +func NewFloat() Observable { + f := Float(0) + return &f +} + +// String returns the float as a string. +func (f *Float) String() string { return fmt.Sprintf("%g", f.Value()) } + +// Value returns the float's value. +func (f *Float) Value() float64 { return float64(*f) } + +func (f *Float) Multiply(ratio float64) { *f *= Float(ratio) } + +func (f *Float) Add(other Observable) { + o := other.(*Float) + *f += *o +} + +func (f *Float) Clear() { *f = 0 } + +func (f *Float) CopyFrom(other Observable) { + o := other.(*Float) + *f = *o +} + +// A Clock tells the current time. +type Clock interface { + Time() time.Time +} + +type defaultClock int + +var defaultClockInstance defaultClock + +func (defaultClock) Time() time.Time { return time.Now() } + +// Information kept per level. Each level consists of a circular list of +// observations. The start of the level may be derived from end and the +// len(buckets) * sizeInMillis. +type tsLevel struct { + oldest int // index to oldest bucketed Observable + newest int // index to newest bucketed Observable + end time.Time // end timestamp for this level + size time.Duration // duration of the bucketed Observable + buckets []Observable // collections of observations + provider func() Observable // used for creating new Observable +} + +func (l *tsLevel) Clear() { + l.oldest = 0 + l.newest = len(l.buckets) - 1 + l.end = time.Time{} + for i := range l.buckets { + if l.buckets[i] != nil { + l.buckets[i].Clear() + l.buckets[i] = nil + } + } +} + +func (l *tsLevel) InitLevel(size time.Duration, numBuckets int, f func() Observable) { + l.size = size + l.provider = f + l.buckets = make([]Observable, numBuckets) +} + +// Keeps a sequence of levels. Each level is responsible for storing data at +// a given resolution. For example, the first level stores data at a one +// minute resolution while the second level stores data at a one hour +// resolution. + +// Each level is represented by a sequence of buckets. Each bucket spans an +// interval equal to the resolution of the level. New observations are added +// to the last bucket. +type timeSeries struct { + provider func() Observable // make more Observable + numBuckets int // number of buckets in each level + levels []*tsLevel // levels of bucketed Observable + lastAdd time.Time // time of last Observable tracked + total Observable // convenient aggregation of all Observable + clock Clock // Clock for getting current time + pending Observable // observations not yet bucketed + pendingTime time.Time // what time are we keeping in pending + dirty bool // if there are pending observations +} + +// init initializes a level according to the supplied criteria. +func (ts *timeSeries) init(resolutions []time.Duration, f func() Observable, numBuckets int, clock Clock) { + ts.provider = f + ts.numBuckets = numBuckets + ts.clock = clock + ts.levels = make([]*tsLevel, len(resolutions)) + + for i := range resolutions { + if i > 0 && resolutions[i-1] >= resolutions[i] { + log.Print("timeseries: resolutions must be monotonically increasing") + break + } + newLevel := new(tsLevel) + newLevel.InitLevel(resolutions[i], ts.numBuckets, ts.provider) + ts.levels[i] = newLevel + } + + ts.Clear() +} + +// Clear removes all observations from the time series. +func (ts *timeSeries) Clear() { + ts.lastAdd = time.Time{} + ts.total = ts.resetObservation(ts.total) + ts.pending = ts.resetObservation(ts.pending) + ts.pendingTime = time.Time{} + ts.dirty = false + + for i := range ts.levels { + ts.levels[i].Clear() + } +} + +// Add records an observation at the current time. +func (ts *timeSeries) Add(observation Observable) { + ts.AddWithTime(observation, ts.clock.Time()) +} + +// AddWithTime records an observation at the specified time. +func (ts *timeSeries) AddWithTime(observation Observable, t time.Time) { + + smallBucketDuration := ts.levels[0].size + + if t.After(ts.lastAdd) { + ts.lastAdd = t + } + + if t.After(ts.pendingTime) { + ts.advance(t) + ts.mergePendingUpdates() + ts.pendingTime = ts.levels[0].end + ts.pending.CopyFrom(observation) + ts.dirty = true + } else if t.After(ts.pendingTime.Add(-1 * smallBucketDuration)) { + // The observation is close enough to go into the pending bucket. + // This compensates for clock skewing and small scheduling delays + // by letting the update stay in the fast path. + ts.pending.Add(observation) + ts.dirty = true + } else { + ts.mergeValue(observation, t) + } +} + +// mergeValue inserts the observation at the specified time in the past into all levels. +func (ts *timeSeries) mergeValue(observation Observable, t time.Time) { + for _, level := range ts.levels { + index := (ts.numBuckets - 1) - int(level.end.Sub(t)/level.size) + if 0 <= index && index < ts.numBuckets { + bucketNumber := (level.oldest + index) % ts.numBuckets + if level.buckets[bucketNumber] == nil { + level.buckets[bucketNumber] = level.provider() + } + level.buckets[bucketNumber].Add(observation) + } + } + ts.total.Add(observation) +} + +// mergePendingUpdates applies the pending updates into all levels. +func (ts *timeSeries) mergePendingUpdates() { + if ts.dirty { + ts.mergeValue(ts.pending, ts.pendingTime) + ts.pending = ts.resetObservation(ts.pending) + ts.dirty = false + } +} + +// advance cycles the buckets at each level until the latest bucket in +// each level can hold the time specified. +func (ts *timeSeries) advance(t time.Time) { + if !t.After(ts.levels[0].end) { + return + } + for i := 0; i < len(ts.levels); i++ { + level := ts.levels[i] + if !level.end.Before(t) { + break + } + + // If the time is sufficiently far, just clear the level and advance + // directly. + if !t.Before(level.end.Add(level.size * time.Duration(ts.numBuckets))) { + for _, b := range level.buckets { + ts.resetObservation(b) + } + level.end = time.Unix(0, (t.UnixNano()/level.size.Nanoseconds())*level.size.Nanoseconds()) + } + + for t.After(level.end) { + level.end = level.end.Add(level.size) + level.newest = level.oldest + level.oldest = (level.oldest + 1) % ts.numBuckets + ts.resetObservation(level.buckets[level.newest]) + } + + t = level.end + } +} + +// Latest returns the sum of the num latest buckets from the level. +func (ts *timeSeries) Latest(level, num int) Observable { + now := ts.clock.Time() + if ts.levels[0].end.Before(now) { + ts.advance(now) + } + + ts.mergePendingUpdates() + + result := ts.provider() + l := ts.levels[level] + index := l.newest + + for i := 0; i < num; i++ { + if l.buckets[index] != nil { + result.Add(l.buckets[index]) + } + if index == 0 { + index = ts.numBuckets + } + index-- + } + + return result +} + +// LatestBuckets returns a copy of the num latest buckets from level. +func (ts *timeSeries) LatestBuckets(level, num int) []Observable { + if level < 0 || level > len(ts.levels) { + log.Print("timeseries: bad level argument: ", level) + return nil + } + if num < 0 || num >= ts.numBuckets { + log.Print("timeseries: bad num argument: ", num) + return nil + } + + results := make([]Observable, num) + now := ts.clock.Time() + if ts.levels[0].end.Before(now) { + ts.advance(now) + } + + ts.mergePendingUpdates() + + l := ts.levels[level] + index := l.newest + + for i := 0; i < num; i++ { + result := ts.provider() + results[i] = result + if l.buckets[index] != nil { + result.CopyFrom(l.buckets[index]) + } + + if index == 0 { + index = ts.numBuckets + } + index -= 1 + } + return results +} + +// ScaleBy updates observations by scaling by factor. +func (ts *timeSeries) ScaleBy(factor float64) { + for _, l := range ts.levels { + for i := 0; i < ts.numBuckets; i++ { + l.buckets[i].Multiply(factor) + } + } + + ts.total.Multiply(factor) + ts.pending.Multiply(factor) +} + +// Range returns the sum of observations added over the specified time range. +// If start or finish times don't fall on bucket boundaries of the same +// level, then return values are approximate answers. +func (ts *timeSeries) Range(start, finish time.Time) Observable { + return ts.ComputeRange(start, finish, 1)[0] +} + +// Recent returns the sum of observations from the last delta. +func (ts *timeSeries) Recent(delta time.Duration) Observable { + now := ts.clock.Time() + return ts.Range(now.Add(-delta), now) +} + +// Total returns the total of all observations. +func (ts *timeSeries) Total() Observable { + ts.mergePendingUpdates() + return ts.total +} + +// ComputeRange computes a specified number of values into a slice using +// the observations recorded over the specified time period. The return +// values are approximate if the start or finish times don't fall on the +// bucket boundaries at the same level or if the number of buckets spanning +// the range is not an integral multiple of num. +func (ts *timeSeries) ComputeRange(start, finish time.Time, num int) []Observable { + if start.After(finish) { + log.Printf("timeseries: start > finish, %v>%v", start, finish) + return nil + } + + if num < 0 { + log.Printf("timeseries: num < 0, %v", num) + return nil + } + + results := make([]Observable, num) + + for _, l := range ts.levels { + if !start.Before(l.end.Add(-l.size * time.Duration(ts.numBuckets))) { + ts.extract(l, start, finish, num, results) + return results + } + } + + // Failed to find a level that covers the desired range. So just + // extract from the last level, even if it doesn't cover the entire + // desired range. + ts.extract(ts.levels[len(ts.levels)-1], start, finish, num, results) + + return results +} + +// RecentList returns the specified number of values in slice over the most +// recent time period of the specified range. +func (ts *timeSeries) RecentList(delta time.Duration, num int) []Observable { + if delta < 0 { + return nil + } + now := ts.clock.Time() + return ts.ComputeRange(now.Add(-delta), now, num) +} + +// extract returns a slice of specified number of observations from a given +// level over a given range. +func (ts *timeSeries) extract(l *tsLevel, start, finish time.Time, num int, results []Observable) { + ts.mergePendingUpdates() + + srcInterval := l.size + dstInterval := finish.Sub(start) / time.Duration(num) + dstStart := start + srcStart := l.end.Add(-srcInterval * time.Duration(ts.numBuckets)) + + srcIndex := 0 + + // Where should scanning start? + if dstStart.After(srcStart) { + advance := dstStart.Sub(srcStart) / srcInterval + srcIndex += int(advance) + srcStart = srcStart.Add(advance * srcInterval) + } + + // The i'th value is computed as show below. + // interval = (finish/start)/num + // i'th value = sum of observation in range + // [ start + i * interval, + // start + (i + 1) * interval ) + for i := 0; i < num; i++ { + results[i] = ts.resetObservation(results[i]) + dstEnd := dstStart.Add(dstInterval) + for srcIndex < ts.numBuckets && srcStart.Before(dstEnd) { + srcEnd := srcStart.Add(srcInterval) + if srcEnd.After(ts.lastAdd) { + srcEnd = ts.lastAdd + } + + if !srcEnd.Before(dstStart) { + srcValue := l.buckets[(srcIndex+l.oldest)%ts.numBuckets] + if !srcStart.Before(dstStart) && !srcEnd.After(dstEnd) { + // dst completely contains src. + if srcValue != nil { + results[i].Add(srcValue) + } + } else { + // dst partially overlaps src. + overlapStart := maxTime(srcStart, dstStart) + overlapEnd := minTime(srcEnd, dstEnd) + base := srcEnd.Sub(srcStart) + fraction := overlapEnd.Sub(overlapStart).Seconds() / base.Seconds() + + used := ts.provider() + if srcValue != nil { + used.CopyFrom(srcValue) + } + used.Multiply(fraction) + results[i].Add(used) + } + + if srcEnd.After(dstEnd) { + break + } + } + srcIndex++ + srcStart = srcStart.Add(srcInterval) + } + dstStart = dstStart.Add(dstInterval) + } +} + +// resetObservation clears the content so the struct may be reused. +func (ts *timeSeries) resetObservation(observation Observable) Observable { + if observation == nil { + observation = ts.provider() + } else { + observation.Clear() + } + return observation +} + +// TimeSeries tracks data at granularities from 1 second to 16 weeks. +type TimeSeries struct { + timeSeries +} + +// NewTimeSeries creates a new TimeSeries using the function provided for creating new Observable. +func NewTimeSeries(f func() Observable) *TimeSeries { + return NewTimeSeriesWithClock(f, defaultClockInstance) +} + +// NewTimeSeriesWithClock creates a new TimeSeries using the function provided for creating new Observable and the clock for +// assigning timestamps. +func NewTimeSeriesWithClock(f func() Observable, clock Clock) *TimeSeries { + ts := new(TimeSeries) + ts.timeSeries.init(timeSeriesResolutions, f, timeSeriesNumBuckets, clock) + return ts +} + +// MinuteHourSeries tracks data at granularities of 1 minute and 1 hour. +type MinuteHourSeries struct { + timeSeries +} + +// NewMinuteHourSeries creates a new MinuteHourSeries using the function provided for creating new Observable. +func NewMinuteHourSeries(f func() Observable) *MinuteHourSeries { + return NewMinuteHourSeriesWithClock(f, defaultClockInstance) +} + +// NewMinuteHourSeriesWithClock creates a new MinuteHourSeries using the function provided for creating new Observable and the clock for +// assigning timestamps. +func NewMinuteHourSeriesWithClock(f func() Observable, clock Clock) *MinuteHourSeries { + ts := new(MinuteHourSeries) + ts.timeSeries.init(minuteHourSeriesResolutions, f, + minuteHourSeriesNumBuckets, clock) + return ts +} + +func (ts *MinuteHourSeries) Minute() Observable { + return ts.timeSeries.Latest(0, 60) +} + +func (ts *MinuteHourSeries) Hour() Observable { + return ts.timeSeries.Latest(1, 60) +} + +func minTime(a, b time.Time) time.Time { + if a.Before(b) { + return a + } + return b +} + +func maxTime(a, b time.Time) time.Time { + if a.After(b) { + return a + } + return b +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/events.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/events.go new file mode 100644 index 00000000000..e66c7e32828 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/events.go @@ -0,0 +1,524 @@ +// Copyright 2015 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 trace + +import ( + "bytes" + "fmt" + "html/template" + "io" + "log" + "net/http" + "runtime" + "sort" + "strconv" + "strings" + "sync" + "sync/atomic" + "text/tabwriter" + "time" +) + +var eventsTmpl = template.Must(template.New("events").Funcs(template.FuncMap{ + "elapsed": elapsed, + "trimSpace": strings.TrimSpace, +}).Parse(eventsHTML)) + +const maxEventsPerLog = 100 + +type bucket struct { + MaxErrAge time.Duration + String string +} + +var buckets = []bucket{ + {0, "total"}, + {10 * time.Second, "errs<10s"}, + {1 * time.Minute, "errs<1m"}, + {10 * time.Minute, "errs<10m"}, + {1 * time.Hour, "errs<1h"}, + {10 * time.Hour, "errs<10h"}, + {24000 * time.Hour, "errors"}, +} + +// RenderEvents renders the HTML page typically served at /debug/events. +// It does not do any auth checking; see AuthRequest for the default auth check +// used by the handler registered on http.DefaultServeMux. +// req may be nil. +func RenderEvents(w http.ResponseWriter, req *http.Request, sensitive bool) { + now := time.Now() + data := &struct { + Families []string // family names + Buckets []bucket + Counts [][]int // eventLog count per family/bucket + + // Set when a bucket has been selected. + Family string + Bucket int + EventLogs eventLogs + Expanded bool + }{ + Buckets: buckets, + } + + data.Families = make([]string, 0, len(families)) + famMu.RLock() + for name := range families { + data.Families = append(data.Families, name) + } + famMu.RUnlock() + sort.Strings(data.Families) + + // Count the number of eventLogs in each family for each error age. + data.Counts = make([][]int, len(data.Families)) + for i, name := range data.Families { + // TODO(sameer): move this loop under the family lock. + f := getEventFamily(name) + data.Counts[i] = make([]int, len(data.Buckets)) + for j, b := range data.Buckets { + data.Counts[i][j] = f.Count(now, b.MaxErrAge) + } + } + + if req != nil { + var ok bool + data.Family, data.Bucket, ok = parseEventsArgs(req) + if !ok { + // No-op + } else { + data.EventLogs = getEventFamily(data.Family).Copy(now, buckets[data.Bucket].MaxErrAge) + } + if data.EventLogs != nil { + defer data.EventLogs.Free() + sort.Sort(data.EventLogs) + } + if exp, err := strconv.ParseBool(req.FormValue("exp")); err == nil { + data.Expanded = exp + } + } + + famMu.RLock() + defer famMu.RUnlock() + if err := eventsTmpl.Execute(w, data); err != nil { + log.Printf("net/trace: Failed executing template: %v", err) + } +} + +func parseEventsArgs(req *http.Request) (fam string, b int, ok bool) { + fam, bStr := req.FormValue("fam"), req.FormValue("b") + if fam == "" || bStr == "" { + return "", 0, false + } + b, err := strconv.Atoi(bStr) + if err != nil || b < 0 || b >= len(buckets) { + return "", 0, false + } + return fam, b, true +} + +// An EventLog provides a log of events associated with a specific object. +type EventLog interface { + // Printf formats its arguments with fmt.Sprintf and adds the + // result to the event log. + Printf(format string, a ...interface{}) + + // Errorf is like Printf, but it marks this event as an error. + Errorf(format string, a ...interface{}) + + // Finish declares that this event log is complete. + // The event log should not be used after calling this method. + Finish() +} + +// NewEventLog returns a new EventLog with the specified family name +// and title. +func NewEventLog(family, title string) EventLog { + el := newEventLog() + el.ref() + el.Family, el.Title = family, title + el.Start = time.Now() + el.events = make([]logEntry, 0, maxEventsPerLog) + el.stack = make([]uintptr, 32) + n := runtime.Callers(2, el.stack) + el.stack = el.stack[:n] + + getEventFamily(family).add(el) + return el +} + +func (el *eventLog) Finish() { + getEventFamily(el.Family).remove(el) + el.unref() // matches ref in New +} + +var ( + famMu sync.RWMutex + families = make(map[string]*eventFamily) // family name => family +) + +func getEventFamily(fam string) *eventFamily { + famMu.Lock() + defer famMu.Unlock() + f := families[fam] + if f == nil { + f = &eventFamily{} + families[fam] = f + } + return f +} + +type eventFamily struct { + mu sync.RWMutex + eventLogs eventLogs +} + +func (f *eventFamily) add(el *eventLog) { + f.mu.Lock() + f.eventLogs = append(f.eventLogs, el) + f.mu.Unlock() +} + +func (f *eventFamily) remove(el *eventLog) { + f.mu.Lock() + defer f.mu.Unlock() + for i, el0 := range f.eventLogs { + if el == el0 { + copy(f.eventLogs[i:], f.eventLogs[i+1:]) + f.eventLogs = f.eventLogs[:len(f.eventLogs)-1] + return + } + } +} + +func (f *eventFamily) Count(now time.Time, maxErrAge time.Duration) (n int) { + f.mu.RLock() + defer f.mu.RUnlock() + for _, el := range f.eventLogs { + if el.hasRecentError(now, maxErrAge) { + n++ + } + } + return +} + +func (f *eventFamily) Copy(now time.Time, maxErrAge time.Duration) (els eventLogs) { + f.mu.RLock() + defer f.mu.RUnlock() + els = make(eventLogs, 0, len(f.eventLogs)) + for _, el := range f.eventLogs { + if el.hasRecentError(now, maxErrAge) { + el.ref() + els = append(els, el) + } + } + return +} + +type eventLogs []*eventLog + +// Free calls unref on each element of the list. +func (els eventLogs) Free() { + for _, el := range els { + el.unref() + } +} + +// eventLogs may be sorted in reverse chronological order. +func (els eventLogs) Len() int { return len(els) } +func (els eventLogs) Less(i, j int) bool { return els[i].Start.After(els[j].Start) } +func (els eventLogs) Swap(i, j int) { els[i], els[j] = els[j], els[i] } + +// A logEntry is a timestamped log entry in an event log. +type logEntry struct { + When time.Time + Elapsed time.Duration // since previous event in log + NewDay bool // whether this event is on a different day to the previous event + What string + IsErr bool +} + +// WhenString returns a string representation of the elapsed time of the event. +// It will include the date if midnight was crossed. +func (e logEntry) WhenString() string { + if e.NewDay { + return e.When.Format("2006/01/02 15:04:05.000000") + } + return e.When.Format("15:04:05.000000") +} + +// An eventLog represents an active event log. +type eventLog struct { + // Family is the top-level grouping of event logs to which this belongs. + Family string + + // Title is the title of this event log. + Title string + + // Timing information. + Start time.Time + + // Call stack where this event log was created. + stack []uintptr + + // Append-only sequence of events. + // + // TODO(sameer): change this to a ring buffer to avoid the array copy + // when we hit maxEventsPerLog. + mu sync.RWMutex + events []logEntry + LastErrorTime time.Time + discarded int + + refs int32 // how many buckets this is in +} + +func (el *eventLog) reset() { + // Clear all but the mutex. Mutexes may not be copied, even when unlocked. + el.Family = "" + el.Title = "" + el.Start = time.Time{} + el.stack = nil + el.events = nil + el.LastErrorTime = time.Time{} + el.discarded = 0 + el.refs = 0 +} + +func (el *eventLog) hasRecentError(now time.Time, maxErrAge time.Duration) bool { + if maxErrAge == 0 { + return true + } + el.mu.RLock() + defer el.mu.RUnlock() + return now.Sub(el.LastErrorTime) < maxErrAge +} + +// delta returns the elapsed time since the last event or the log start, +// and whether it spans midnight. +// L >= el.mu +func (el *eventLog) delta(t time.Time) (time.Duration, bool) { + if len(el.events) == 0 { + return t.Sub(el.Start), false + } + prev := el.events[len(el.events)-1].When + return t.Sub(prev), prev.Day() != t.Day() + +} + +func (el *eventLog) Printf(format string, a ...interface{}) { + el.printf(false, format, a...) +} + +func (el *eventLog) Errorf(format string, a ...interface{}) { + el.printf(true, format, a...) +} + +func (el *eventLog) printf(isErr bool, format string, a ...interface{}) { + e := logEntry{When: time.Now(), IsErr: isErr, What: fmt.Sprintf(format, a...)} + el.mu.Lock() + e.Elapsed, e.NewDay = el.delta(e.When) + if len(el.events) < maxEventsPerLog { + el.events = append(el.events, e) + } else { + // Discard the oldest event. + if el.discarded == 0 { + // el.discarded starts at two to count for the event it + // is replacing, plus the next one that we are about to + // drop. + el.discarded = 2 + } else { + el.discarded++ + } + // TODO(sameer): if this causes allocations on a critical path, + // change eventLog.What to be a fmt.Stringer, as in trace.go. + el.events[0].What = fmt.Sprintf("(%d events discarded)", el.discarded) + // The timestamp of the discarded meta-event should be + // the time of the last event it is representing. + el.events[0].When = el.events[1].When + copy(el.events[1:], el.events[2:]) + el.events[maxEventsPerLog-1] = e + } + if e.IsErr { + el.LastErrorTime = e.When + } + el.mu.Unlock() +} + +func (el *eventLog) ref() { + atomic.AddInt32(&el.refs, 1) +} + +func (el *eventLog) unref() { + if atomic.AddInt32(&el.refs, -1) == 0 { + freeEventLog(el) + } +} + +func (el *eventLog) When() string { + return el.Start.Format("2006/01/02 15:04:05.000000") +} + +func (el *eventLog) ElapsedTime() string { + elapsed := time.Since(el.Start) + return fmt.Sprintf("%.6f", elapsed.Seconds()) +} + +func (el *eventLog) Stack() string { + buf := new(bytes.Buffer) + tw := tabwriter.NewWriter(buf, 1, 8, 1, '\t', 0) + printStackRecord(tw, el.stack) + tw.Flush() + return buf.String() +} + +// printStackRecord prints the function + source line information +// for a single stack trace. +// Adapted from runtime/pprof/pprof.go. +func printStackRecord(w io.Writer, stk []uintptr) { + for _, pc := range stk { + f := runtime.FuncForPC(pc) + if f == nil { + continue + } + file, line := f.FileLine(pc) + name := f.Name() + // Hide runtime.goexit and any runtime functions at the beginning. + if strings.HasPrefix(name, "runtime.") { + continue + } + fmt.Fprintf(w, "# %s\t%s:%d\n", name, file, line) + } +} + +func (el *eventLog) Events() []logEntry { + el.mu.RLock() + defer el.mu.RUnlock() + return el.events +} + +// freeEventLogs is a freelist of *eventLog +var freeEventLogs = make(chan *eventLog, 1000) + +// newEventLog returns a event log ready to use. +func newEventLog() *eventLog { + select { + case el := <-freeEventLogs: + return el + default: + return new(eventLog) + } +} + +// freeEventLog adds el to freeEventLogs if there's room. +// This is non-blocking. +func freeEventLog(el *eventLog) { + el.reset() + select { + case freeEventLogs <- el: + default: + } +} + +const eventsHTML = ` + + + events + + + + +

/debug/events

+ + + {{range $i, $fam := .Families}} + + + + {{range $j, $bucket := $.Buckets}} + {{$n := index $.Counts $i $j}} + + {{end}} + + {{end}} +
{{$fam}} + {{if $n}}{{end}} + [{{$n}} {{$bucket.String}}] + {{if $n}}{{end}} +
+ +{{if $.EventLogs}} +
+

Family: {{$.Family}}

+ +{{if $.Expanded}}{{end}} +[Summary]{{if $.Expanded}}{{end}} + +{{if not $.Expanded}}{{end}} +[Expanded]{{if not $.Expanded}}{{end}} + + + + {{range $el := $.EventLogs}} + + + + + {{if $.Expanded}} + + + + + + {{range $el.Events}} + + + + + + {{end}} + {{end}} + {{end}} +
WhenElapsed
{{$el.When}}{{$el.ElapsedTime}}{{$el.Title}} +
{{$el.Stack|trimSpace}}
{{.WhenString}}{{elapsed .Elapsed}}.{{if .IsErr}}E{{else}}.{{end}}. {{.What}}
+{{end}} + + +` diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/histogram.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/histogram.go new file mode 100644 index 00000000000..bb42aa5320d --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/histogram.go @@ -0,0 +1,356 @@ +// Copyright 2015 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 trace + +// This file implements histogramming for RPC statistics collection. + +import ( + "bytes" + "fmt" + "html/template" + "log" + "math" + + "golang.org/x/net/internal/timeseries" +) + +const ( + bucketCount = 38 +) + +// histogram keeps counts of values in buckets that are spaced +// out in powers of 2: 0-1, 2-3, 4-7... +// histogram implements timeseries.Observable +type histogram struct { + sum int64 // running total of measurements + sumOfSquares float64 // square of running total + buckets []int64 // bucketed values for histogram + value int // holds a single value as an optimization + valueCount int64 // number of values recorded for single value +} + +// AddMeasurement records a value measurement observation to the histogram. +func (h *histogram) addMeasurement(value int64) { + // TODO: assert invariant + h.sum += value + h.sumOfSquares += float64(value) * float64(value) + + bucketIndex := getBucket(value) + + if h.valueCount == 0 || (h.valueCount > 0 && h.value == bucketIndex) { + h.value = bucketIndex + h.valueCount++ + } else { + h.allocateBuckets() + h.buckets[bucketIndex]++ + } +} + +func (h *histogram) allocateBuckets() { + if h.buckets == nil { + h.buckets = make([]int64, bucketCount) + h.buckets[h.value] = h.valueCount + h.value = 0 + h.valueCount = -1 + } +} + +func log2(i int64) int { + n := 0 + for ; i >= 0x100; i >>= 8 { + n += 8 + } + for ; i > 0; i >>= 1 { + n += 1 + } + return n +} + +func getBucket(i int64) (index int) { + index = log2(i) - 1 + if index < 0 { + index = 0 + } + if index >= bucketCount { + index = bucketCount - 1 + } + return +} + +// Total returns the number of recorded observations. +func (h *histogram) total() (total int64) { + if h.valueCount >= 0 { + total = h.valueCount + } + for _, val := range h.buckets { + total += int64(val) + } + return +} + +// Average returns the average value of recorded observations. +func (h *histogram) average() float64 { + t := h.total() + if t == 0 { + return 0 + } + return float64(h.sum) / float64(t) +} + +// Variance returns the variance of recorded observations. +func (h *histogram) variance() float64 { + t := float64(h.total()) + if t == 0 { + return 0 + } + s := float64(h.sum) / t + return h.sumOfSquares/t - s*s +} + +// StandardDeviation returns the standard deviation of recorded observations. +func (h *histogram) standardDeviation() float64 { + return math.Sqrt(h.variance()) +} + +// PercentileBoundary estimates the value that the given fraction of recorded +// observations are less than. +func (h *histogram) percentileBoundary(percentile float64) int64 { + total := h.total() + + // Corner cases (make sure result is strictly less than Total()) + if total == 0 { + return 0 + } else if total == 1 { + return int64(h.average()) + } + + percentOfTotal := round(float64(total) * percentile) + var runningTotal int64 + + for i := range h.buckets { + value := h.buckets[i] + runningTotal += value + if runningTotal == percentOfTotal { + // We hit an exact bucket boundary. If the next bucket has data, it is a + // good estimate of the value. If the bucket is empty, we interpolate the + // midpoint between the next bucket's boundary and the next non-zero + // bucket. If the remaining buckets are all empty, then we use the + // boundary for the next bucket as the estimate. + j := uint8(i + 1) + min := bucketBoundary(j) + if runningTotal < total { + for h.buckets[j] == 0 { + j++ + } + } + max := bucketBoundary(j) + return min + round(float64(max-min)/2) + } else if runningTotal > percentOfTotal { + // The value is in this bucket. Interpolate the value. + delta := runningTotal - percentOfTotal + percentBucket := float64(value-delta) / float64(value) + bucketMin := bucketBoundary(uint8(i)) + nextBucketMin := bucketBoundary(uint8(i + 1)) + bucketSize := nextBucketMin - bucketMin + return bucketMin + round(percentBucket*float64(bucketSize)) + } + } + return bucketBoundary(bucketCount - 1) +} + +// Median returns the estimated median of the observed values. +func (h *histogram) median() int64 { + return h.percentileBoundary(0.5) +} + +// Add adds other to h. +func (h *histogram) Add(other timeseries.Observable) { + o := other.(*histogram) + if o.valueCount == 0 { + // Other histogram is empty + } else if h.valueCount >= 0 && o.valueCount > 0 && h.value == o.value { + // Both have a single bucketed value, aggregate them + h.valueCount += o.valueCount + } else { + // Two different values necessitate buckets in this histogram + h.allocateBuckets() + if o.valueCount >= 0 { + h.buckets[o.value] += o.valueCount + } else { + for i := range h.buckets { + h.buckets[i] += o.buckets[i] + } + } + } + h.sumOfSquares += o.sumOfSquares + h.sum += o.sum +} + +// Clear resets the histogram to an empty state, removing all observed values. +func (h *histogram) Clear() { + h.buckets = nil + h.value = 0 + h.valueCount = 0 + h.sum = 0 + h.sumOfSquares = 0 +} + +// CopyFrom copies from other, which must be a *histogram, into h. +func (h *histogram) CopyFrom(other timeseries.Observable) { + o := other.(*histogram) + if o.valueCount == -1 { + h.allocateBuckets() + copy(h.buckets, o.buckets) + } + h.sum = o.sum + h.sumOfSquares = o.sumOfSquares + h.value = o.value + h.valueCount = o.valueCount +} + +// Multiply scales the histogram by the specified ratio. +func (h *histogram) Multiply(ratio float64) { + if h.valueCount == -1 { + for i := range h.buckets { + h.buckets[i] = int64(float64(h.buckets[i]) * ratio) + } + } else { + h.valueCount = int64(float64(h.valueCount) * ratio) + } + h.sum = int64(float64(h.sum) * ratio) + h.sumOfSquares = h.sumOfSquares * ratio +} + +// New creates a new histogram. +func (h *histogram) New() timeseries.Observable { + r := new(histogram) + r.Clear() + return r +} + +func (h *histogram) String() string { + return fmt.Sprintf("%d, %f, %d, %d, %v", + h.sum, h.sumOfSquares, h.value, h.valueCount, h.buckets) +} + +// round returns the closest int64 to the argument +func round(in float64) int64 { + return int64(math.Floor(in + 0.5)) +} + +// bucketBoundary returns the first value in the bucket. +func bucketBoundary(bucket uint8) int64 { + if bucket == 0 { + return 0 + } + return 1 << bucket +} + +// bucketData holds data about a specific bucket for use in distTmpl. +type bucketData struct { + Lower, Upper int64 + N int64 + Pct, CumulativePct float64 + GraphWidth int +} + +// data holds data about a Distribution for use in distTmpl. +type data struct { + Buckets []*bucketData + Count, Median int64 + Mean, StandardDeviation float64 +} + +// maxHTMLBarWidth is the maximum width of the HTML bar for visualizing buckets. +const maxHTMLBarWidth = 350.0 + +// newData returns data representing h for use in distTmpl. +func (h *histogram) newData() *data { + // Force the allocation of buckets to simplify the rendering implementation + h.allocateBuckets() + // We scale the bars on the right so that the largest bar is + // maxHTMLBarWidth pixels in width. + maxBucket := int64(0) + for _, n := range h.buckets { + if n > maxBucket { + maxBucket = n + } + } + total := h.total() + barsizeMult := maxHTMLBarWidth / float64(maxBucket) + var pctMult float64 + if total == 0 { + pctMult = 1.0 + } else { + pctMult = 100.0 / float64(total) + } + + buckets := make([]*bucketData, len(h.buckets)) + runningTotal := int64(0) + for i, n := range h.buckets { + if n == 0 { + continue + } + runningTotal += n + var upperBound int64 + if i < bucketCount-1 { + upperBound = bucketBoundary(uint8(i + 1)) + } else { + upperBound = math.MaxInt64 + } + buckets[i] = &bucketData{ + Lower: bucketBoundary(uint8(i)), + Upper: upperBound, + N: n, + Pct: float64(n) * pctMult, + CumulativePct: float64(runningTotal) * pctMult, + GraphWidth: int(float64(n) * barsizeMult), + } + } + return &data{ + Buckets: buckets, + Count: total, + Median: h.median(), + Mean: h.average(), + StandardDeviation: h.standardDeviation(), + } +} + +func (h *histogram) html() template.HTML { + buf := new(bytes.Buffer) + if err := distTmpl.Execute(buf, h.newData()); err != nil { + buf.Reset() + log.Printf("net/trace: couldn't execute template: %v", err) + } + return template.HTML(buf.String()) +} + +// Input: data +var distTmpl = template.Must(template.New("distTmpl").Parse(` + + + + + + + +
Count: {{.Count}}Mean: {{printf "%.0f" .Mean}}StdDev: {{printf "%.0f" .StandardDeviation}}Median: {{.Median}}
+
+ +{{range $b := .Buckets}} +{{if $b}} + + + + + + + + + +{{end}} +{{end}} +
[{{.Lower}},{{.Upper}}){{.N}}{{printf "%#.3f" .Pct}}%{{printf "%#.3f" .CumulativePct}}%
+`)) diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/trace.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/trace.go new file mode 100644 index 00000000000..0767c8c69d9 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/trace.go @@ -0,0 +1,1059 @@ +// Copyright 2015 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 trace implements tracing of requests and long-lived objects. +It exports HTTP interfaces on /debug/requests and /debug/events. + +A trace.Trace provides tracing for short-lived objects, usually requests. +A request handler might be implemented like this: + + func fooHandler(w http.ResponseWriter, req *http.Request) { + tr := trace.New("mypkg.Foo", req.URL.Path) + defer tr.Finish() + ... + tr.LazyPrintf("some event %q happened", str) + ... + if err := somethingImportant(); err != nil { + tr.LazyPrintf("somethingImportant failed: %v", err) + tr.SetError() + } + } + +The /debug/requests HTTP endpoint organizes the traces by family, +errors, and duration. It also provides histogram of request duration +for each family. + +A trace.EventLog provides tracing for long-lived objects, such as RPC +connections. + + // A Fetcher fetches URL paths for a single domain. + type Fetcher struct { + domain string + events trace.EventLog + } + + func NewFetcher(domain string) *Fetcher { + return &Fetcher{ + domain, + trace.NewEventLog("mypkg.Fetcher", domain), + } + } + + func (f *Fetcher) Fetch(path string) (string, error) { + resp, err := http.Get("http://" + f.domain + "/" + path) + if err != nil { + f.events.Errorf("Get(%q) = %v", path, err) + return "", err + } + f.events.Printf("Get(%q) = %s", path, resp.Status) + ... + } + + func (f *Fetcher) Close() error { + f.events.Finish() + return nil + } + +The /debug/events HTTP endpoint organizes the event logs by family and +by time since the last error. The expanded view displays recent log +entries and the log's call stack. +*/ +package trace // import "golang.org/x/net/trace" + +import ( + "bytes" + "fmt" + "html/template" + "io" + "log" + "net" + "net/http" + "runtime" + "sort" + "strconv" + "sync" + "sync/atomic" + "time" + + "golang.org/x/net/context" + "golang.org/x/net/internal/timeseries" +) + +// DebugUseAfterFinish controls whether to debug uses of Trace values after finishing. +// FOR DEBUGGING ONLY. This will slow down the program. +var DebugUseAfterFinish = false + +// AuthRequest determines whether a specific request is permitted to load the +// /debug/requests or /debug/events pages. +// +// It returns two bools; the first indicates whether the page may be viewed at all, +// and the second indicates whether sensitive events will be shown. +// +// AuthRequest may be replaced by a program to customise its authorisation requirements. +// +// The default AuthRequest function returns (true, true) iff the request comes from localhost/127.0.0.1/[::1]. +var AuthRequest = func(req *http.Request) (any, sensitive bool) { + host, _, err := net.SplitHostPort(req.RemoteAddr) + switch { + case err != nil: // Badly formed address; fail closed. + return false, false + case host == "localhost" || host == "127.0.0.1" || host == "::1": + return true, true + default: + return false, false + } +} + +func init() { + http.HandleFunc("/debug/requests", func(w http.ResponseWriter, req *http.Request) { + any, sensitive := AuthRequest(req) + if !any { + http.Error(w, "not allowed", http.StatusUnauthorized) + return + } + w.Header().Set("Content-Type", "text/html; charset=utf-8") + Render(w, req, sensitive) + }) + http.HandleFunc("/debug/events", func(w http.ResponseWriter, req *http.Request) { + any, sensitive := AuthRequest(req) + if !any { + http.Error(w, "not allowed", http.StatusUnauthorized) + return + } + w.Header().Set("Content-Type", "text/html; charset=utf-8") + RenderEvents(w, req, sensitive) + }) +} + +// Render renders the HTML page typically served at /debug/requests. +// It does not do any auth checking; see AuthRequest for the default auth check +// used by the handler registered on http.DefaultServeMux. +// req may be nil. +func Render(w io.Writer, req *http.Request, sensitive bool) { + data := &struct { + Families []string + ActiveTraceCount map[string]int + CompletedTraces map[string]*family + + // Set when a bucket has been selected. + Traces traceList + Family string + Bucket int + Expanded bool + Traced bool + Active bool + ShowSensitive bool // whether to show sensitive events + + Histogram template.HTML + HistogramWindow string // e.g. "last minute", "last hour", "all time" + + // If non-zero, the set of traces is a partial set, + // and this is the total number. + Total int + }{ + CompletedTraces: completedTraces, + } + + data.ShowSensitive = sensitive + if req != nil { + // Allow show_sensitive=0 to force hiding of sensitive data for testing. + // This only goes one way; you can't use show_sensitive=1 to see things. + if req.FormValue("show_sensitive") == "0" { + data.ShowSensitive = false + } + + if exp, err := strconv.ParseBool(req.FormValue("exp")); err == nil { + data.Expanded = exp + } + if exp, err := strconv.ParseBool(req.FormValue("rtraced")); err == nil { + data.Traced = exp + } + } + + completedMu.RLock() + data.Families = make([]string, 0, len(completedTraces)) + for fam := range completedTraces { + data.Families = append(data.Families, fam) + } + completedMu.RUnlock() + sort.Strings(data.Families) + + // We are careful here to minimize the time spent locking activeMu, + // since that lock is required every time an RPC starts and finishes. + data.ActiveTraceCount = make(map[string]int, len(data.Families)) + activeMu.RLock() + for fam, s := range activeTraces { + data.ActiveTraceCount[fam] = s.Len() + } + activeMu.RUnlock() + + var ok bool + data.Family, data.Bucket, ok = parseArgs(req) + switch { + case !ok: + // No-op + case data.Bucket == -1: + data.Active = true + n := data.ActiveTraceCount[data.Family] + data.Traces = getActiveTraces(data.Family) + if len(data.Traces) < n { + data.Total = n + } + case data.Bucket < bucketsPerFamily: + if b := lookupBucket(data.Family, data.Bucket); b != nil { + data.Traces = b.Copy(data.Traced) + } + default: + if f := getFamily(data.Family, false); f != nil { + var obs timeseries.Observable + f.LatencyMu.RLock() + switch o := data.Bucket - bucketsPerFamily; o { + case 0: + obs = f.Latency.Minute() + data.HistogramWindow = "last minute" + case 1: + obs = f.Latency.Hour() + data.HistogramWindow = "last hour" + case 2: + obs = f.Latency.Total() + data.HistogramWindow = "all time" + } + f.LatencyMu.RUnlock() + if obs != nil { + data.Histogram = obs.(*histogram).html() + } + } + } + + if data.Traces != nil { + defer data.Traces.Free() + sort.Sort(data.Traces) + } + + completedMu.RLock() + defer completedMu.RUnlock() + if err := pageTmpl.ExecuteTemplate(w, "Page", data); err != nil { + log.Printf("net/trace: Failed executing template: %v", err) + } +} + +func parseArgs(req *http.Request) (fam string, b int, ok bool) { + if req == nil { + return "", 0, false + } + fam, bStr := req.FormValue("fam"), req.FormValue("b") + if fam == "" || bStr == "" { + return "", 0, false + } + b, err := strconv.Atoi(bStr) + if err != nil || b < -1 { + return "", 0, false + } + + return fam, b, true +} + +func lookupBucket(fam string, b int) *traceBucket { + f := getFamily(fam, false) + if f == nil || b < 0 || b >= len(f.Buckets) { + return nil + } + return f.Buckets[b] +} + +type contextKeyT string + +var contextKey = contextKeyT("golang.org/x/net/trace.Trace") + +// NewContext returns a copy of the parent context +// and associates it with a Trace. +func NewContext(ctx context.Context, tr Trace) context.Context { + return context.WithValue(ctx, contextKey, tr) +} + +// FromContext returns the Trace bound to the context, if any. +func FromContext(ctx context.Context) (tr Trace, ok bool) { + tr, ok = ctx.Value(contextKey).(Trace) + return +} + +// Trace represents an active request. +type Trace interface { + // LazyLog adds x to the event log. It will be evaluated each time the + // /debug/requests page is rendered. Any memory referenced by x will be + // pinned until the trace is finished and later discarded. + LazyLog(x fmt.Stringer, sensitive bool) + + // LazyPrintf evaluates its arguments with fmt.Sprintf each time the + // /debug/requests page is rendered. Any memory referenced by a will be + // pinned until the trace is finished and later discarded. + LazyPrintf(format string, a ...interface{}) + + // SetError declares that this trace resulted in an error. + SetError() + + // SetRecycler sets a recycler for the trace. + // f will be called for each event passed to LazyLog at a time when + // it is no longer required, whether while the trace is still active + // and the event is discarded, or when a completed trace is discarded. + SetRecycler(f func(interface{})) + + // SetTraceInfo sets the trace info for the trace. + // This is currently unused. + SetTraceInfo(traceID, spanID uint64) + + // SetMaxEvents sets the maximum number of events that will be stored + // in the trace. This has no effect if any events have already been + // added to the trace. + SetMaxEvents(m int) + + // Finish declares that this trace is complete. + // The trace should not be used after calling this method. + Finish() +} + +type lazySprintf struct { + format string + a []interface{} +} + +func (l *lazySprintf) String() string { + return fmt.Sprintf(l.format, l.a...) +} + +// New returns a new Trace with the specified family and title. +func New(family, title string) Trace { + tr := newTrace() + tr.ref() + tr.Family, tr.Title = family, title + tr.Start = time.Now() + tr.events = make([]event, 0, maxEventsPerTrace) + + activeMu.RLock() + s := activeTraces[tr.Family] + activeMu.RUnlock() + if s == nil { + activeMu.Lock() + s = activeTraces[tr.Family] // check again + if s == nil { + s = new(traceSet) + activeTraces[tr.Family] = s + } + activeMu.Unlock() + } + s.Add(tr) + + // Trigger allocation of the completed trace structure for this family. + // This will cause the family to be present in the request page during + // the first trace of this family. We don't care about the return value, + // nor is there any need for this to run inline, so we execute it in its + // own goroutine, but only if the family isn't allocated yet. + completedMu.RLock() + if _, ok := completedTraces[tr.Family]; !ok { + go allocFamily(tr.Family) + } + completedMu.RUnlock() + + return tr +} + +func (tr *trace) Finish() { + tr.Elapsed = time.Now().Sub(tr.Start) + if DebugUseAfterFinish { + buf := make([]byte, 4<<10) // 4 KB should be enough + n := runtime.Stack(buf, false) + tr.finishStack = buf[:n] + } + + activeMu.RLock() + m := activeTraces[tr.Family] + activeMu.RUnlock() + m.Remove(tr) + + f := getFamily(tr.Family, true) + for _, b := range f.Buckets { + if b.Cond.match(tr) { + b.Add(tr) + } + } + // Add a sample of elapsed time as microseconds to the family's timeseries + h := new(histogram) + h.addMeasurement(tr.Elapsed.Nanoseconds() / 1e3) + f.LatencyMu.Lock() + f.Latency.Add(h) + f.LatencyMu.Unlock() + + tr.unref() // matches ref in New +} + +const ( + bucketsPerFamily = 9 + tracesPerBucket = 10 + maxActiveTraces = 20 // Maximum number of active traces to show. + maxEventsPerTrace = 10 + numHistogramBuckets = 38 +) + +var ( + // The active traces. + activeMu sync.RWMutex + activeTraces = make(map[string]*traceSet) // family -> traces + + // Families of completed traces. + completedMu sync.RWMutex + completedTraces = make(map[string]*family) // family -> traces +) + +type traceSet struct { + mu sync.RWMutex + m map[*trace]bool + + // We could avoid the entire map scan in FirstN by having a slice of all the traces + // ordered by start time, and an index into that from the trace struct, with a periodic + // repack of the slice after enough traces finish; we could also use a skip list or similar. + // However, that would shift some of the expense from /debug/requests time to RPC time, + // which is probably the wrong trade-off. +} + +func (ts *traceSet) Len() int { + ts.mu.RLock() + defer ts.mu.RUnlock() + return len(ts.m) +} + +func (ts *traceSet) Add(tr *trace) { + ts.mu.Lock() + if ts.m == nil { + ts.m = make(map[*trace]bool) + } + ts.m[tr] = true + ts.mu.Unlock() +} + +func (ts *traceSet) Remove(tr *trace) { + ts.mu.Lock() + delete(ts.m, tr) + ts.mu.Unlock() +} + +// FirstN returns the first n traces ordered by time. +func (ts *traceSet) FirstN(n int) traceList { + ts.mu.RLock() + defer ts.mu.RUnlock() + + if n > len(ts.m) { + n = len(ts.m) + } + trl := make(traceList, 0, n) + + // Fast path for when no selectivity is needed. + if n == len(ts.m) { + for tr := range ts.m { + tr.ref() + trl = append(trl, tr) + } + sort.Sort(trl) + return trl + } + + // Pick the oldest n traces. + // This is inefficient. See the comment in the traceSet struct. + for tr := range ts.m { + // Put the first n traces into trl in the order they occur. + // When we have n, sort trl, and thereafter maintain its order. + if len(trl) < n { + tr.ref() + trl = append(trl, tr) + if len(trl) == n { + // This is guaranteed to happen exactly once during this loop. + sort.Sort(trl) + } + continue + } + if tr.Start.After(trl[n-1].Start) { + continue + } + + // Find where to insert this one. + tr.ref() + i := sort.Search(n, func(i int) bool { return trl[i].Start.After(tr.Start) }) + trl[n-1].unref() + copy(trl[i+1:], trl[i:]) + trl[i] = tr + } + + return trl +} + +func getActiveTraces(fam string) traceList { + activeMu.RLock() + s := activeTraces[fam] + activeMu.RUnlock() + if s == nil { + return nil + } + return s.FirstN(maxActiveTraces) +} + +func getFamily(fam string, allocNew bool) *family { + completedMu.RLock() + f := completedTraces[fam] + completedMu.RUnlock() + if f == nil && allocNew { + f = allocFamily(fam) + } + return f +} + +func allocFamily(fam string) *family { + completedMu.Lock() + defer completedMu.Unlock() + f := completedTraces[fam] + if f == nil { + f = newFamily() + completedTraces[fam] = f + } + return f +} + +// family represents a set of trace buckets and associated latency information. +type family struct { + // traces may occur in multiple buckets. + Buckets [bucketsPerFamily]*traceBucket + + // latency time series + LatencyMu sync.RWMutex + Latency *timeseries.MinuteHourSeries +} + +func newFamily() *family { + return &family{ + Buckets: [bucketsPerFamily]*traceBucket{ + {Cond: minCond(0)}, + {Cond: minCond(50 * time.Millisecond)}, + {Cond: minCond(100 * time.Millisecond)}, + {Cond: minCond(200 * time.Millisecond)}, + {Cond: minCond(500 * time.Millisecond)}, + {Cond: minCond(1 * time.Second)}, + {Cond: minCond(10 * time.Second)}, + {Cond: minCond(100 * time.Second)}, + {Cond: errorCond{}}, + }, + Latency: timeseries.NewMinuteHourSeries(func() timeseries.Observable { return new(histogram) }), + } +} + +// traceBucket represents a size-capped bucket of historic traces, +// along with a condition for a trace to belong to the bucket. +type traceBucket struct { + Cond cond + + // Ring buffer implementation of a fixed-size FIFO queue. + mu sync.RWMutex + buf [tracesPerBucket]*trace + start int // < tracesPerBucket + length int // <= tracesPerBucket +} + +func (b *traceBucket) Add(tr *trace) { + b.mu.Lock() + defer b.mu.Unlock() + + i := b.start + b.length + if i >= tracesPerBucket { + i -= tracesPerBucket + } + if b.length == tracesPerBucket { + // "Remove" an element from the bucket. + b.buf[i].unref() + b.start++ + if b.start == tracesPerBucket { + b.start = 0 + } + } + b.buf[i] = tr + if b.length < tracesPerBucket { + b.length++ + } + tr.ref() +} + +// Copy returns a copy of the traces in the bucket. +// If tracedOnly is true, only the traces with trace information will be returned. +// The logs will be ref'd before returning; the caller should call +// the Free method when it is done with them. +// TODO(dsymonds): keep track of traced requests in separate buckets. +func (b *traceBucket) Copy(tracedOnly bool) traceList { + b.mu.RLock() + defer b.mu.RUnlock() + + trl := make(traceList, 0, b.length) + for i, x := 0, b.start; i < b.length; i++ { + tr := b.buf[x] + if !tracedOnly || tr.spanID != 0 { + tr.ref() + trl = append(trl, tr) + } + x++ + if x == b.length { + x = 0 + } + } + return trl +} + +func (b *traceBucket) Empty() bool { + b.mu.RLock() + defer b.mu.RUnlock() + return b.length == 0 +} + +// cond represents a condition on a trace. +type cond interface { + match(t *trace) bool + String() string +} + +type minCond time.Duration + +func (m minCond) match(t *trace) bool { return t.Elapsed >= time.Duration(m) } +func (m minCond) String() string { return fmt.Sprintf("≥%gs", time.Duration(m).Seconds()) } + +type errorCond struct{} + +func (e errorCond) match(t *trace) bool { return t.IsError } +func (e errorCond) String() string { return "errors" } + +type traceList []*trace + +// Free calls unref on each element of the list. +func (trl traceList) Free() { + for _, t := range trl { + t.unref() + } +} + +// traceList may be sorted in reverse chronological order. +func (trl traceList) Len() int { return len(trl) } +func (trl traceList) Less(i, j int) bool { return trl[i].Start.After(trl[j].Start) } +func (trl traceList) Swap(i, j int) { trl[i], trl[j] = trl[j], trl[i] } + +// An event is a timestamped log entry in a trace. +type event struct { + When time.Time + Elapsed time.Duration // since previous event in trace + NewDay bool // whether this event is on a different day to the previous event + Recyclable bool // whether this event was passed via LazyLog + What interface{} // string or fmt.Stringer + Sensitive bool // whether this event contains sensitive information +} + +// WhenString returns a string representation of the elapsed time of the event. +// It will include the date if midnight was crossed. +func (e event) WhenString() string { + if e.NewDay { + return e.When.Format("2006/01/02 15:04:05.000000") + } + return e.When.Format("15:04:05.000000") +} + +// discarded represents a number of discarded events. +// It is stored as *discarded to make it easier to update in-place. +type discarded int + +func (d *discarded) String() string { + return fmt.Sprintf("(%d events discarded)", int(*d)) +} + +// trace represents an active or complete request, +// either sent or received by this program. +type trace struct { + // Family is the top-level grouping of traces to which this belongs. + Family string + + // Title is the title of this trace. + Title string + + // Timing information. + Start time.Time + Elapsed time.Duration // zero while active + + // Trace information if non-zero. + traceID uint64 + spanID uint64 + + // Whether this trace resulted in an error. + IsError bool + + // Append-only sequence of events (modulo discards). + mu sync.RWMutex + events []event + + refs int32 // how many buckets this is in + recycler func(interface{}) + disc discarded // scratch space to avoid allocation + + finishStack []byte // where finish was called, if DebugUseAfterFinish is set +} + +func (tr *trace) reset() { + // Clear all but the mutex. Mutexes may not be copied, even when unlocked. + tr.Family = "" + tr.Title = "" + tr.Start = time.Time{} + tr.Elapsed = 0 + tr.traceID = 0 + tr.spanID = 0 + tr.IsError = false + tr.events = nil + tr.refs = 0 + tr.recycler = nil + tr.disc = 0 + tr.finishStack = nil +} + +// delta returns the elapsed time since the last event or the trace start, +// and whether it spans midnight. +// L >= tr.mu +func (tr *trace) delta(t time.Time) (time.Duration, bool) { + if len(tr.events) == 0 { + return t.Sub(tr.Start), false + } + prev := tr.events[len(tr.events)-1].When + return t.Sub(prev), prev.Day() != t.Day() +} + +func (tr *trace) addEvent(x interface{}, recyclable, sensitive bool) { + if DebugUseAfterFinish && tr.finishStack != nil { + buf := make([]byte, 4<<10) // 4 KB should be enough + n := runtime.Stack(buf, false) + log.Printf("net/trace: trace used after finish:\nFinished at:\n%s\nUsed at:\n%s", tr.finishStack, buf[:n]) + } + + /* + NOTE TO DEBUGGERS + + If you are here because your program panicked in this code, + it is almost definitely the fault of code using this package, + and very unlikely to be the fault of this code. + + The most likely scenario is that some code elsewhere is using + a requestz.Trace after its Finish method is called. + You can temporarily set the DebugUseAfterFinish var + to help discover where that is; do not leave that var set, + since it makes this package much less efficient. + */ + + e := event{When: time.Now(), What: x, Recyclable: recyclable, Sensitive: sensitive} + tr.mu.Lock() + e.Elapsed, e.NewDay = tr.delta(e.When) + if len(tr.events) < cap(tr.events) { + tr.events = append(tr.events, e) + } else { + // Discard the middle events. + di := int((cap(tr.events) - 1) / 2) + if d, ok := tr.events[di].What.(*discarded); ok { + (*d)++ + } else { + // disc starts at two to count for the event it is replacing, + // plus the next one that we are about to drop. + tr.disc = 2 + if tr.recycler != nil && tr.events[di].Recyclable { + go tr.recycler(tr.events[di].What) + } + tr.events[di].What = &tr.disc + } + // The timestamp of the discarded meta-event should be + // the time of the last event it is representing. + tr.events[di].When = tr.events[di+1].When + + if tr.recycler != nil && tr.events[di+1].Recyclable { + go tr.recycler(tr.events[di+1].What) + } + copy(tr.events[di+1:], tr.events[di+2:]) + tr.events[cap(tr.events)-1] = e + } + tr.mu.Unlock() +} + +func (tr *trace) LazyLog(x fmt.Stringer, sensitive bool) { + tr.addEvent(x, true, sensitive) +} + +func (tr *trace) LazyPrintf(format string, a ...interface{}) { + tr.addEvent(&lazySprintf{format, a}, false, false) +} + +func (tr *trace) SetError() { tr.IsError = true } + +func (tr *trace) SetRecycler(f func(interface{})) { + tr.recycler = f +} + +func (tr *trace) SetTraceInfo(traceID, spanID uint64) { + tr.traceID, tr.spanID = traceID, spanID +} + +func (tr *trace) SetMaxEvents(m int) { + // Always keep at least three events: first, discarded count, last. + if len(tr.events) == 0 && m > 3 { + tr.events = make([]event, 0, m) + } +} + +func (tr *trace) ref() { + atomic.AddInt32(&tr.refs, 1) +} + +func (tr *trace) unref() { + if atomic.AddInt32(&tr.refs, -1) == 0 { + if tr.recycler != nil { + // freeTrace clears tr, so we hold tr.recycler and tr.events here. + go func(f func(interface{}), es []event) { + for _, e := range es { + if e.Recyclable { + f(e.What) + } + } + }(tr.recycler, tr.events) + } + + freeTrace(tr) + } +} + +func (tr *trace) When() string { + return tr.Start.Format("2006/01/02 15:04:05.000000") +} + +func (tr *trace) ElapsedTime() string { + t := tr.Elapsed + if t == 0 { + // Active trace. + t = time.Since(tr.Start) + } + return fmt.Sprintf("%.6f", t.Seconds()) +} + +func (tr *trace) Events() []event { + tr.mu.RLock() + defer tr.mu.RUnlock() + return tr.events +} + +var traceFreeList = make(chan *trace, 1000) // TODO(dsymonds): Use sync.Pool? + +// newTrace returns a trace ready to use. +func newTrace() *trace { + select { + case tr := <-traceFreeList: + return tr + default: + return new(trace) + } +} + +// freeTrace adds tr to traceFreeList if there's room. +// This is non-blocking. +func freeTrace(tr *trace) { + if DebugUseAfterFinish { + return // never reuse + } + tr.reset() + select { + case traceFreeList <- tr: + default: + } +} + +func elapsed(d time.Duration) string { + b := []byte(fmt.Sprintf("%.6f", d.Seconds())) + + // For subsecond durations, blank all zeros before decimal point, + // and all zeros between the decimal point and the first non-zero digit. + if d < time.Second { + dot := bytes.IndexByte(b, '.') + for i := 0; i < dot; i++ { + b[i] = ' ' + } + for i := dot + 1; i < len(b); i++ { + if b[i] == '0' { + b[i] = ' ' + } else { + break + } + } + } + + return string(b) +} + +var pageTmpl = template.Must(template.New("Page").Funcs(template.FuncMap{ + "elapsed": elapsed, + "add": func(a, b int) int { return a + b }, +}).Parse(pageHTML)) + +const pageHTML = ` +{{template "Prolog" .}} +{{template "StatusTable" .}} +{{template "Epilog" .}} + +{{define "Prolog"}} + + + /debug/requests + + + + +

/debug/requests

+{{end}} {{/* end of Prolog */}} + +{{define "StatusTable"}} + + {{range $fam := .Families}} + + + + {{$n := index $.ActiveTraceCount $fam}} + + + {{$f := index $.CompletedTraces $fam}} + {{range $i, $b := $f.Buckets}} + {{$empty := $b.Empty}} + + {{end}} + + {{$nb := len $f.Buckets}} + + + + + + {{end}} +
{{$fam}} + {{if $n}}{{end}} + [{{$n}} active] + {{if $n}}{{end}} + + {{if not $empty}}{{end}} + [{{.Cond}}] + {{if not $empty}}{{end}} + + [minute] + + [hour] + + [total] +
+{{end}} {{/* end of StatusTable */}} + +{{define "Epilog"}} +{{if $.Traces}} +
+

Family: {{$.Family}}

+ +{{if or $.Expanded $.Traced}} + [Normal/Summary] +{{else}} + [Normal/Summary] +{{end}} + +{{if or (not $.Expanded) $.Traced}} + [Normal/Expanded] +{{else}} + [Normal/Expanded] +{{end}} + +{{if not $.Active}} + {{if or $.Expanded (not $.Traced)}} + [Traced/Summary] + {{else}} + [Traced/Summary] + {{end}} + {{if or (not $.Expanded) (not $.Traced)}} + [Traced/Expanded] + {{else}} + [Traced/Expanded] + {{end}} +{{end}} + +{{if $.Total}} +

Showing {{len $.Traces}} of {{$.Total}} traces.

+{{end}} + + + + + {{range $tr := $.Traces}} + + + + + {{/* TODO: include traceID/spanID */}} + + {{if $.Expanded}} + {{range $tr.Events}} + + + + + + {{end}} + {{end}} + {{end}} +
+ {{if $.Active}}Active{{else}}Completed{{end}} Requests +
WhenElapsed (s)
{{$tr.When}}{{$tr.ElapsedTime}}{{$tr.Title}}
{{.WhenString}}{{elapsed .Elapsed}}{{if or $.ShowSensitive (not .Sensitive)}}... {{.What}}{{else}}[redacted]{{end}}
+{{end}} {{/* if $.Traces */}} + +{{if $.Histogram}} +

Latency (µs) of {{$.Family}} over {{$.HistogramWindow}}

+{{$.Histogram}} +{{end}} {{/* if $.Histogram */}} + + + +{{end}} {{/* end of Epilog */}} +` diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/text/LICENSE b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/text/LICENSE new file mode 100644 index 00000000000..6a66aea5eaf --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/text/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 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/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/text/secure/bidirule/bidirule.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/text/secure/bidirule/bidirule.go new file mode 100644 index 00000000000..a7161bdd9b6 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/text/secure/bidirule/bidirule.go @@ -0,0 +1,342 @@ +// Copyright 2016 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 bidirule implements the Bidi Rule defined by RFC 5893. +// +// This package is under development. The API may change without notice and +// without preserving backward compatibility. +package bidirule + +import ( + "errors" + "unicode/utf8" + + "golang.org/x/text/transform" + "golang.org/x/text/unicode/bidi" +) + +// This file contains an implementation of RFC 5893: Right-to-Left Scripts for +// Internationalized Domain Names for Applications (IDNA) +// +// A label is an individual component of a domain name. Labels are usually +// shown separated by dots; for example, the domain name "www.example.com" is +// composed of three labels: "www", "example", and "com". +// +// An RTL label is a label that contains at least one character of class R, AL, +// or AN. An LTR label is any label that is not an RTL label. +// +// A "Bidi domain name" is a domain name that contains at least one RTL label. +// +// The following guarantees can be made based on the above: +// +// o In a domain name consisting of only labels that satisfy the rule, +// the requirements of Section 3 are satisfied. Note that even LTR +// labels and pure ASCII labels have to be tested. +// +// o In a domain name consisting of only LDH labels (as defined in the +// Definitions document [RFC5890]) and labels that satisfy the rule, +// the requirements of Section 3 are satisfied as long as a label +// that starts with an ASCII digit does not come after a +// right-to-left label. +// +// No guarantee is given for other combinations. + +// ErrInvalid indicates a label is invalid according to the Bidi Rule. +var ErrInvalid = errors.New("bidirule: failed Bidi Rule") + +type ruleState uint8 + +const ( + ruleInitial ruleState = iota + ruleLTR + ruleLTRFinal + ruleRTL + ruleRTLFinal + ruleInvalid +) + +type ruleTransition struct { + next ruleState + mask uint16 +} + +var transitions = [...][2]ruleTransition{ + // [2.1] The first character must be a character with Bidi property L, R, or + // AL. If it has the R or AL property, it is an RTL label; if it has the L + // property, it is an LTR label. + ruleInitial: { + {ruleLTRFinal, 1 << bidi.L}, + {ruleRTLFinal, 1< 0, sets runtime.MemProfileRate") + + options = &imports.Options{ + TabWidth: 8, + TabIndent: true, + Comments: true, + Fragment: true, + } + exitCode = 0 +) + +func init() { + flag.BoolVar(&options.AllErrors, "e", false, "report all errors (not just the first 10 on different lines)") + flag.StringVar(&imports.LocalPrefix, "local", "", "put imports beginning with this string after 3rd-party packages") +} + +func report(err error) { + scanner.PrintError(os.Stderr, err) + exitCode = 2 +} + +func usage() { + fmt.Fprintf(os.Stderr, "usage: goimports [flags] [path ...]\n") + flag.PrintDefaults() + os.Exit(2) +} + +func isGoFile(f os.FileInfo) bool { + // ignore non-Go files + name := f.Name() + return !f.IsDir() && !strings.HasPrefix(name, ".") && strings.HasSuffix(name, ".go") +} + +// argumentType is which mode goimports was invoked as. +type argumentType int + +const ( + // fromStdin means the user is piping their source into goimports. + fromStdin argumentType = iota + + // singleArg is the common case from editors, when goimports is run on + // a single file. + singleArg + + // multipleArg is when the user ran "goimports file1.go file2.go" + // or ran goimports on a directory tree. + multipleArg +) + +func processFile(filename string, in io.Reader, out io.Writer, argType argumentType) error { + opt := options + if argType == fromStdin { + nopt := *options + nopt.Fragment = true + opt = &nopt + } + + if in == nil { + f, err := os.Open(filename) + if err != nil { + return err + } + defer f.Close() + in = f + } + + src, err := ioutil.ReadAll(in) + if err != nil { + return err + } + + target := filename + if *srcdir != "" { + // Determine whether the provided -srcdirc is a directory or file + // and then use it to override the target. + // + // See https://github.com/dominikh/go-mode.el/issues/146 + if isFile(*srcdir) { + if argType == multipleArg { + return errors.New("-srcdir value can't be a file when passing multiple arguments or when walking directories") + } + target = *srcdir + } else if argType == singleArg && strings.HasSuffix(*srcdir, ".go") && !isDir(*srcdir) { + // For a file which doesn't exist on disk yet, but might shortly. + // e.g. user in editor opens $DIR/newfile.go and newfile.go doesn't yet exist on disk. + // The goimports on-save hook writes the buffer to a temp file + // first and runs goimports before the actual save to newfile.go. + // The editor's buffer is named "newfile.go" so that is passed to goimports as: + // goimports -srcdir=/gopath/src/pkg/newfile.go /tmp/gofmtXXXXXXXX.go + // and then the editor reloads the result from the tmp file and writes + // it to newfile.go. + target = *srcdir + } else { + // Pretend that file is from *srcdir in order to decide + // visible imports correctly. + target = filepath.Join(*srcdir, filepath.Base(filename)) + } + } + + res, err := imports.Process(target, src, opt) + if err != nil { + return err + } + + if !bytes.Equal(src, res) { + // formatting has changed + if *list { + fmt.Fprintln(out, filename) + } + if *write { + err = ioutil.WriteFile(filename, res, 0) + if err != nil { + return err + } + } + if *doDiff { + data, err := diff(src, res) + if err != nil { + return fmt.Errorf("computing diff: %s", err) + } + fmt.Printf("diff %s gofmt/%s\n", filename, filename) + out.Write(data) + } + } + + if !*list && !*write && !*doDiff { + _, err = out.Write(res) + } + + return err +} + +func visitFile(path string, f os.FileInfo, err error) error { + if err == nil && isGoFile(f) { + err = processFile(path, nil, os.Stdout, multipleArg) + } + if err != nil { + report(err) + } + return nil +} + +func walkDir(path string) { + filepath.Walk(path, visitFile) +} + +func main() { + runtime.GOMAXPROCS(runtime.NumCPU()) + + // call gofmtMain in a separate function + // so that it can use defer and have them + // run before the exit. + gofmtMain() + os.Exit(exitCode) +} + +// parseFlags parses command line flags and returns the paths to process. +// It's a var so that custom implementations can replace it in other files. +var parseFlags = func() []string { + flag.BoolVar(&verbose, "v", false, "verbose logging") + + flag.Parse() + return flag.Args() +} + +func bufferedFileWriter(dest string) (w io.Writer, close func()) { + f, err := os.Create(dest) + if err != nil { + log.Fatal(err) + } + bw := bufio.NewWriter(f) + return bw, func() { + if err := bw.Flush(); err != nil { + log.Fatalf("error flushing %v: %v", dest, err) + } + if err := f.Close(); err != nil { + log.Fatal(err) + } + } +} + +func gofmtMain() { + flag.Usage = usage + paths := parseFlags() + + if *cpuProfile != "" { + bw, flush := bufferedFileWriter(*cpuProfile) + pprof.StartCPUProfile(bw) + defer flush() + defer pprof.StopCPUProfile() + } + // doTrace is a conditionally compiled wrapper around runtime/trace. It is + // used to allow goimports to compile under gccgo, which does not support + // runtime/trace. See https://golang.org/issue/15544. + defer doTrace()() + if *memProfileRate > 0 { + runtime.MemProfileRate = *memProfileRate + bw, flush := bufferedFileWriter(*memProfile) + defer func() { + runtime.GC() // materialize all statistics + if err := pprof.WriteHeapProfile(bw); err != nil { + log.Fatal(err) + } + flush() + }() + } + + if verbose { + log.SetFlags(log.LstdFlags | log.Lmicroseconds) + imports.Debug = true + } + if options.TabWidth < 0 { + fmt.Fprintf(os.Stderr, "negative tabwidth %d\n", options.TabWidth) + exitCode = 2 + return + } + + if len(paths) == 0 { + if err := processFile("", os.Stdin, os.Stdout, fromStdin); err != nil { + report(err) + } + return + } + + argType := singleArg + if len(paths) > 1 { + argType = multipleArg + } + + for _, path := range paths { + switch dir, err := os.Stat(path); { + case err != nil: + report(err) + case dir.IsDir(): + walkDir(path) + default: + if err := processFile(path, nil, os.Stdout, argType); err != nil { + report(err) + } + } + } +} + +func diff(b1, b2 []byte) (data []byte, err error) { + f1, err := ioutil.TempFile("", "gofmt") + if err != nil { + return + } + defer os.Remove(f1.Name()) + defer f1.Close() + + f2, err := ioutil.TempFile("", "gofmt") + if err != nil { + return + } + defer os.Remove(f2.Name()) + defer f2.Close() + + f1.Write(b1) + f2.Write(b2) + + data, err = exec.Command("diff", "-u", f1.Name(), f2.Name()).CombinedOutput() + if len(data) > 0 { + // diff exits with a non-zero status when the files don't match. + // Ignore that failure as long as we get output. + err = nil + } + return +} + +// isFile reports whether name is a file. +func isFile(name string) bool { + fi, err := os.Stat(name) + return err == nil && fi.Mode().IsRegular() +} + +// isDir reports whether name is a directory. +func isDir(name string) bool { + fi, err := os.Stat(name) + return err == nil && fi.IsDir() +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/cmd/goimports/goimports_gc.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/cmd/goimports/goimports_gc.go new file mode 100644 index 00000000000..21d867eaab5 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/cmd/goimports/goimports_gc.go @@ -0,0 +1,26 @@ +// Copyright 2016 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. + +// +build gc + +package main + +import ( + "flag" + "runtime/trace" +) + +var traceProfile = flag.String("trace", "", "trace profile output") + +func doTrace() func() { + if *traceProfile != "" { + bw, flush := bufferedFileWriter(*traceProfile) + trace.Start(bw) + return func() { + flush() + trace.Stop() + } + } + return func() {} +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/cmd/goimports/goimports_not_gc.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/cmd/goimports/goimports_not_gc.go new file mode 100644 index 00000000000..f5531ceb317 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/cmd/goimports/goimports_not_gc.go @@ -0,0 +1,11 @@ +// Copyright 2016 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. + +// +build !gc + +package main + +func doTrace() func() { + return func() {} +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/enclosing.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/enclosing.go new file mode 100644 index 00000000000..6b7052b892c --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/enclosing.go @@ -0,0 +1,627 @@ +// Copyright 2013 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 astutil + +// This file defines utilities for working with source positions. + +import ( + "fmt" + "go/ast" + "go/token" + "sort" +) + +// PathEnclosingInterval returns the node that encloses the source +// interval [start, end), and all its ancestors up to the AST root. +// +// The definition of "enclosing" used by this function considers +// additional whitespace abutting a node to be enclosed by it. +// In this example: +// +// z := x + y // add them +// <-A-> +// <----B-----> +// +// the ast.BinaryExpr(+) node is considered to enclose interval B +// even though its [Pos()..End()) is actually only interval A. +// This behaviour makes user interfaces more tolerant of imperfect +// input. +// +// This function treats tokens as nodes, though they are not included +// in the result. e.g. PathEnclosingInterval("+") returns the +// enclosing ast.BinaryExpr("x + y"). +// +// If start==end, the 1-char interval following start is used instead. +// +// The 'exact' result is true if the interval contains only path[0] +// and perhaps some adjacent whitespace. It is false if the interval +// overlaps multiple children of path[0], or if it contains only +// interior whitespace of path[0]. +// In this example: +// +// z := x + y // add them +// <--C--> <---E--> +// ^ +// D +// +// intervals C, D and E are inexact. C is contained by the +// z-assignment statement, because it spans three of its children (:=, +// x, +). So too is the 1-char interval D, because it contains only +// interior whitespace of the assignment. E is considered interior +// whitespace of the BlockStmt containing the assignment. +// +// Precondition: [start, end) both lie within the same file as root. +// TODO(adonovan): return (nil, false) in this case and remove precond. +// Requires FileSet; see loader.tokenFileContainsPos. +// +// Postcondition: path is never nil; it always contains at least 'root'. +// +func PathEnclosingInterval(root *ast.File, start, end token.Pos) (path []ast.Node, exact bool) { + // fmt.Printf("EnclosingInterval %d %d\n", start, end) // debugging + + // Precondition: node.[Pos..End) and adjoining whitespace contain [start, end). + var visit func(node ast.Node) bool + visit = func(node ast.Node) bool { + path = append(path, node) + + nodePos := node.Pos() + nodeEnd := node.End() + + // fmt.Printf("visit(%T, %d, %d)\n", node, nodePos, nodeEnd) // debugging + + // Intersect [start, end) with interval of node. + if start < nodePos { + start = nodePos + } + if end > nodeEnd { + end = nodeEnd + } + + // Find sole child that contains [start, end). + children := childrenOf(node) + l := len(children) + for i, child := range children { + // [childPos, childEnd) is unaugmented interval of child. + childPos := child.Pos() + childEnd := child.End() + + // [augPos, augEnd) is whitespace-augmented interval of child. + augPos := childPos + augEnd := childEnd + if i > 0 { + augPos = children[i-1].End() // start of preceding whitespace + } + if i < l-1 { + nextChildPos := children[i+1].Pos() + // Does [start, end) lie between child and next child? + if start >= augEnd && end <= nextChildPos { + return false // inexact match + } + augEnd = nextChildPos // end of following whitespace + } + + // fmt.Printf("\tchild %d: [%d..%d)\tcontains interval [%d..%d)?\n", + // i, augPos, augEnd, start, end) // debugging + + // Does augmented child strictly contain [start, end)? + if augPos <= start && end <= augEnd { + _, isToken := child.(tokenNode) + return isToken || visit(child) + } + + // Does [start, end) overlap multiple children? + // i.e. left-augmented child contains start + // but LR-augmented child does not contain end. + if start < childEnd && end > augEnd { + break + } + } + + // No single child contained [start, end), + // so node is the result. Is it exact? + + // (It's tempting to put this condition before the + // child loop, but it gives the wrong result in the + // case where a node (e.g. ExprStmt) and its sole + // child have equal intervals.) + if start == nodePos && end == nodeEnd { + return true // exact match + } + + return false // inexact: overlaps multiple children + } + + if start > end { + start, end = end, start + } + + if start < root.End() && end > root.Pos() { + if start == end { + end = start + 1 // empty interval => interval of size 1 + } + exact = visit(root) + + // Reverse the path: + for i, l := 0, len(path); i < l/2; i++ { + path[i], path[l-1-i] = path[l-1-i], path[i] + } + } else { + // Selection lies within whitespace preceding the + // first (or following the last) declaration in the file. + // The result nonetheless always includes the ast.File. + path = append(path, root) + } + + return +} + +// tokenNode is a dummy implementation of ast.Node for a single token. +// They are used transiently by PathEnclosingInterval but never escape +// this package. +// +type tokenNode struct { + pos token.Pos + end token.Pos +} + +func (n tokenNode) Pos() token.Pos { + return n.pos +} + +func (n tokenNode) End() token.Pos { + return n.end +} + +func tok(pos token.Pos, len int) ast.Node { + return tokenNode{pos, pos + token.Pos(len)} +} + +// childrenOf returns the direct non-nil children of ast.Node n. +// It may include fake ast.Node implementations for bare tokens. +// it is not safe to call (e.g.) ast.Walk on such nodes. +// +func childrenOf(n ast.Node) []ast.Node { + var children []ast.Node + + // First add nodes for all true subtrees. + ast.Inspect(n, func(node ast.Node) bool { + if node == n { // push n + return true // recur + } + if node != nil { // push child + children = append(children, node) + } + return false // no recursion + }) + + // Then add fake Nodes for bare tokens. + switch n := n.(type) { + case *ast.ArrayType: + children = append(children, + tok(n.Lbrack, len("[")), + tok(n.Elt.End(), len("]"))) + + case *ast.AssignStmt: + children = append(children, + tok(n.TokPos, len(n.Tok.String()))) + + case *ast.BasicLit: + children = append(children, + tok(n.ValuePos, len(n.Value))) + + case *ast.BinaryExpr: + children = append(children, tok(n.OpPos, len(n.Op.String()))) + + case *ast.BlockStmt: + children = append(children, + tok(n.Lbrace, len("{")), + tok(n.Rbrace, len("}"))) + + case *ast.BranchStmt: + children = append(children, + tok(n.TokPos, len(n.Tok.String()))) + + case *ast.CallExpr: + children = append(children, + tok(n.Lparen, len("(")), + tok(n.Rparen, len(")"))) + if n.Ellipsis != 0 { + children = append(children, tok(n.Ellipsis, len("..."))) + } + + case *ast.CaseClause: + if n.List == nil { + children = append(children, + tok(n.Case, len("default"))) + } else { + children = append(children, + tok(n.Case, len("case"))) + } + children = append(children, tok(n.Colon, len(":"))) + + case *ast.ChanType: + switch n.Dir { + case ast.RECV: + children = append(children, tok(n.Begin, len("<-chan"))) + case ast.SEND: + children = append(children, tok(n.Begin, len("chan<-"))) + case ast.RECV | ast.SEND: + children = append(children, tok(n.Begin, len("chan"))) + } + + case *ast.CommClause: + if n.Comm == nil { + children = append(children, + tok(n.Case, len("default"))) + } else { + children = append(children, + tok(n.Case, len("case"))) + } + children = append(children, tok(n.Colon, len(":"))) + + case *ast.Comment: + // nop + + case *ast.CommentGroup: + // nop + + case *ast.CompositeLit: + children = append(children, + tok(n.Lbrace, len("{")), + tok(n.Rbrace, len("{"))) + + case *ast.DeclStmt: + // nop + + case *ast.DeferStmt: + children = append(children, + tok(n.Defer, len("defer"))) + + case *ast.Ellipsis: + children = append(children, + tok(n.Ellipsis, len("..."))) + + case *ast.EmptyStmt: + // nop + + case *ast.ExprStmt: + // nop + + case *ast.Field: + // TODO(adonovan): Field.{Doc,Comment,Tag}? + + case *ast.FieldList: + children = append(children, + tok(n.Opening, len("(")), + tok(n.Closing, len(")"))) + + case *ast.File: + // TODO test: Doc + children = append(children, + tok(n.Package, len("package"))) + + case *ast.ForStmt: + children = append(children, + tok(n.For, len("for"))) + + case *ast.FuncDecl: + // TODO(adonovan): FuncDecl.Comment? + + // Uniquely, FuncDecl breaks the invariant that + // preorder traversal yields tokens in lexical order: + // in fact, FuncDecl.Recv precedes FuncDecl.Type.Func. + // + // As a workaround, we inline the case for FuncType + // here and order things correctly. + // + children = nil // discard ast.Walk(FuncDecl) info subtrees + children = append(children, tok(n.Type.Func, len("func"))) + if n.Recv != nil { + children = append(children, n.Recv) + } + children = append(children, n.Name) + if n.Type.Params != nil { + children = append(children, n.Type.Params) + } + if n.Type.Results != nil { + children = append(children, n.Type.Results) + } + if n.Body != nil { + children = append(children, n.Body) + } + + case *ast.FuncLit: + // nop + + case *ast.FuncType: + if n.Func != 0 { + children = append(children, + tok(n.Func, len("func"))) + } + + case *ast.GenDecl: + children = append(children, + tok(n.TokPos, len(n.Tok.String()))) + if n.Lparen != 0 { + children = append(children, + tok(n.Lparen, len("(")), + tok(n.Rparen, len(")"))) + } + + case *ast.GoStmt: + children = append(children, + tok(n.Go, len("go"))) + + case *ast.Ident: + children = append(children, + tok(n.NamePos, len(n.Name))) + + case *ast.IfStmt: + children = append(children, + tok(n.If, len("if"))) + + case *ast.ImportSpec: + // TODO(adonovan): ImportSpec.{Doc,EndPos}? + + case *ast.IncDecStmt: + children = append(children, + tok(n.TokPos, len(n.Tok.String()))) + + case *ast.IndexExpr: + children = append(children, + tok(n.Lbrack, len("{")), + tok(n.Rbrack, len("}"))) + + case *ast.InterfaceType: + children = append(children, + tok(n.Interface, len("interface"))) + + case *ast.KeyValueExpr: + children = append(children, + tok(n.Colon, len(":"))) + + case *ast.LabeledStmt: + children = append(children, + tok(n.Colon, len(":"))) + + case *ast.MapType: + children = append(children, + tok(n.Map, len("map"))) + + case *ast.ParenExpr: + children = append(children, + tok(n.Lparen, len("(")), + tok(n.Rparen, len(")"))) + + case *ast.RangeStmt: + children = append(children, + tok(n.For, len("for")), + tok(n.TokPos, len(n.Tok.String()))) + + case *ast.ReturnStmt: + children = append(children, + tok(n.Return, len("return"))) + + case *ast.SelectStmt: + children = append(children, + tok(n.Select, len("select"))) + + case *ast.SelectorExpr: + // nop + + case *ast.SendStmt: + children = append(children, + tok(n.Arrow, len("<-"))) + + case *ast.SliceExpr: + children = append(children, + tok(n.Lbrack, len("[")), + tok(n.Rbrack, len("]"))) + + case *ast.StarExpr: + children = append(children, tok(n.Star, len("*"))) + + case *ast.StructType: + children = append(children, tok(n.Struct, len("struct"))) + + case *ast.SwitchStmt: + children = append(children, tok(n.Switch, len("switch"))) + + case *ast.TypeAssertExpr: + children = append(children, + tok(n.Lparen-1, len(".")), + tok(n.Lparen, len("(")), + tok(n.Rparen, len(")"))) + + case *ast.TypeSpec: + // TODO(adonovan): TypeSpec.{Doc,Comment}? + + case *ast.TypeSwitchStmt: + children = append(children, tok(n.Switch, len("switch"))) + + case *ast.UnaryExpr: + children = append(children, tok(n.OpPos, len(n.Op.String()))) + + case *ast.ValueSpec: + // TODO(adonovan): ValueSpec.{Doc,Comment}? + + case *ast.BadDecl, *ast.BadExpr, *ast.BadStmt: + // nop + } + + // TODO(adonovan): opt: merge the logic of ast.Inspect() into + // the switch above so we can make interleaved callbacks for + // both Nodes and Tokens in the right order and avoid the need + // to sort. + sort.Sort(byPos(children)) + + return children +} + +type byPos []ast.Node + +func (sl byPos) Len() int { + return len(sl) +} +func (sl byPos) Less(i, j int) bool { + return sl[i].Pos() < sl[j].Pos() +} +func (sl byPos) Swap(i, j int) { + sl[i], sl[j] = sl[j], sl[i] +} + +// NodeDescription returns a description of the concrete type of n suitable +// for a user interface. +// +// TODO(adonovan): in some cases (e.g. Field, FieldList, Ident, +// StarExpr) we could be much more specific given the path to the AST +// root. Perhaps we should do that. +// +func NodeDescription(n ast.Node) string { + switch n := n.(type) { + case *ast.ArrayType: + return "array type" + case *ast.AssignStmt: + return "assignment" + case *ast.BadDecl: + return "bad declaration" + case *ast.BadExpr: + return "bad expression" + case *ast.BadStmt: + return "bad statement" + case *ast.BasicLit: + return "basic literal" + case *ast.BinaryExpr: + return fmt.Sprintf("binary %s operation", n.Op) + case *ast.BlockStmt: + return "block" + case *ast.BranchStmt: + switch n.Tok { + case token.BREAK: + return "break statement" + case token.CONTINUE: + return "continue statement" + case token.GOTO: + return "goto statement" + case token.FALLTHROUGH: + return "fall-through statement" + } + case *ast.CallExpr: + if len(n.Args) == 1 && !n.Ellipsis.IsValid() { + return "function call (or conversion)" + } + return "function call" + case *ast.CaseClause: + return "case clause" + case *ast.ChanType: + return "channel type" + case *ast.CommClause: + return "communication clause" + case *ast.Comment: + return "comment" + case *ast.CommentGroup: + return "comment group" + case *ast.CompositeLit: + return "composite literal" + case *ast.DeclStmt: + return NodeDescription(n.Decl) + " statement" + case *ast.DeferStmt: + return "defer statement" + case *ast.Ellipsis: + return "ellipsis" + case *ast.EmptyStmt: + return "empty statement" + case *ast.ExprStmt: + return "expression statement" + case *ast.Field: + // Can be any of these: + // struct {x, y int} -- struct field(s) + // struct {T} -- anon struct field + // interface {I} -- interface embedding + // interface {f()} -- interface method + // func (A) func(B) C -- receiver, param(s), result(s) + return "field/method/parameter" + case *ast.FieldList: + return "field/method/parameter list" + case *ast.File: + return "source file" + case *ast.ForStmt: + return "for loop" + case *ast.FuncDecl: + return "function declaration" + case *ast.FuncLit: + return "function literal" + case *ast.FuncType: + return "function type" + case *ast.GenDecl: + switch n.Tok { + case token.IMPORT: + return "import declaration" + case token.CONST: + return "constant declaration" + case token.TYPE: + return "type declaration" + case token.VAR: + return "variable declaration" + } + case *ast.GoStmt: + return "go statement" + case *ast.Ident: + return "identifier" + case *ast.IfStmt: + return "if statement" + case *ast.ImportSpec: + return "import specification" + case *ast.IncDecStmt: + if n.Tok == token.INC { + return "increment statement" + } + return "decrement statement" + case *ast.IndexExpr: + return "index expression" + case *ast.InterfaceType: + return "interface type" + case *ast.KeyValueExpr: + return "key/value association" + case *ast.LabeledStmt: + return "statement label" + case *ast.MapType: + return "map type" + case *ast.Package: + return "package" + case *ast.ParenExpr: + return "parenthesized " + NodeDescription(n.X) + case *ast.RangeStmt: + return "range loop" + case *ast.ReturnStmt: + return "return statement" + case *ast.SelectStmt: + return "select statement" + case *ast.SelectorExpr: + return "selector" + case *ast.SendStmt: + return "channel send" + case *ast.SliceExpr: + return "slice expression" + case *ast.StarExpr: + return "*-operation" // load/store expr or pointer type + case *ast.StructType: + return "struct type" + case *ast.SwitchStmt: + return "switch statement" + case *ast.TypeAssertExpr: + return "type assertion" + case *ast.TypeSpec: + return "type specification" + case *ast.TypeSwitchStmt: + return "type switch" + case *ast.UnaryExpr: + return fmt.Sprintf("unary %s operation", n.Op) + case *ast.ValueSpec: + return "value specification" + + } + panic(fmt.Sprintf("unexpected node type: %T", n)) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/imports.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/imports.go new file mode 100644 index 00000000000..2e81f4d3ae2 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/imports.go @@ -0,0 +1,449 @@ +// Copyright 2013 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 astutil contains common utilities for working with the Go AST. +package astutil // import "golang.org/x/tools/go/ast/astutil" + +import ( + "fmt" + "go/ast" + "go/token" + "strconv" + "strings" +) + +// AddImport adds the import path to the file f, if absent. +func AddImport(fset *token.FileSet, f *ast.File, ipath string) (added bool) { + return AddNamedImport(fset, f, "", ipath) +} + +// AddNamedImport adds the import path to the file f, if absent. +// If name is not empty, it is used to rename the import. +// +// For example, calling +// AddNamedImport(fset, f, "pathpkg", "path") +// adds +// import pathpkg "path" +func AddNamedImport(fset *token.FileSet, f *ast.File, name, ipath string) (added bool) { + if imports(f, ipath) { + return false + } + + newImport := &ast.ImportSpec{ + Path: &ast.BasicLit{ + Kind: token.STRING, + Value: strconv.Quote(ipath), + }, + } + if name != "" { + newImport.Name = &ast.Ident{Name: name} + } + + // Find an import decl to add to. + // The goal is to find an existing import + // whose import path has the longest shared + // prefix with ipath. + var ( + bestMatch = -1 // length of longest shared prefix + lastImport = -1 // index in f.Decls of the file's final import decl + impDecl *ast.GenDecl // import decl containing the best match + impIndex = -1 // spec index in impDecl containing the best match + ) + for i, decl := range f.Decls { + gen, ok := decl.(*ast.GenDecl) + if ok && gen.Tok == token.IMPORT { + lastImport = i + // Do not add to import "C", to avoid disrupting the + // association with its doc comment, breaking cgo. + if declImports(gen, "C") { + continue + } + + // Match an empty import decl if that's all that is available. + if len(gen.Specs) == 0 && bestMatch == -1 { + impDecl = gen + } + + // Compute longest shared prefix with imports in this group. + for j, spec := range gen.Specs { + impspec := spec.(*ast.ImportSpec) + n := matchLen(importPath(impspec), ipath) + if n > bestMatch { + bestMatch = n + impDecl = gen + impIndex = j + } + } + } + } + + // If no import decl found, add one after the last import. + if impDecl == nil { + impDecl = &ast.GenDecl{ + Tok: token.IMPORT, + } + if lastImport >= 0 { + impDecl.TokPos = f.Decls[lastImport].End() + } else { + // There are no existing imports. + // Our new import goes after the package declaration and after + // the comment, if any, that starts on the same line as the + // package declaration. + impDecl.TokPos = f.Package + + file := fset.File(f.Package) + pkgLine := file.Line(f.Package) + for _, c := range f.Comments { + if file.Line(c.Pos()) > pkgLine { + break + } + impDecl.TokPos = c.End() + } + } + f.Decls = append(f.Decls, nil) + copy(f.Decls[lastImport+2:], f.Decls[lastImport+1:]) + f.Decls[lastImport+1] = impDecl + } + + // Insert new import at insertAt. + insertAt := 0 + if impIndex >= 0 { + // insert after the found import + insertAt = impIndex + 1 + } + impDecl.Specs = append(impDecl.Specs, nil) + copy(impDecl.Specs[insertAt+1:], impDecl.Specs[insertAt:]) + impDecl.Specs[insertAt] = newImport + pos := impDecl.Pos() + if insertAt > 0 { + // If there is a comment after an existing import, preserve the comment + // position by adding the new import after the comment. + if spec, ok := impDecl.Specs[insertAt-1].(*ast.ImportSpec); ok && spec.Comment != nil { + pos = spec.Comment.End() + } else { + // Assign same position as the previous import, + // so that the sorter sees it as being in the same block. + pos = impDecl.Specs[insertAt-1].Pos() + } + } + if newImport.Name != nil { + newImport.Name.NamePos = pos + } + newImport.Path.ValuePos = pos + newImport.EndPos = pos + + // Clean up parens. impDecl contains at least one spec. + if len(impDecl.Specs) == 1 { + // Remove unneeded parens. + impDecl.Lparen = token.NoPos + } else if !impDecl.Lparen.IsValid() { + // impDecl needs parens added. + impDecl.Lparen = impDecl.Specs[0].Pos() + } + + f.Imports = append(f.Imports, newImport) + + if len(f.Decls) <= 1 { + return true + } + + // Merge all the import declarations into the first one. + var first *ast.GenDecl + for i := 0; i < len(f.Decls); i++ { + decl := f.Decls[i] + gen, ok := decl.(*ast.GenDecl) + if !ok || gen.Tok != token.IMPORT || declImports(gen, "C") { + continue + } + if first == nil { + first = gen + continue // Don't touch the first one. + } + // We now know there is more than one package in this import + // declaration. Ensure that it ends up parenthesized. + first.Lparen = first.Pos() + // Move the imports of the other import declaration to the first one. + for _, spec := range gen.Specs { + spec.(*ast.ImportSpec).Path.ValuePos = first.Pos() + first.Specs = append(first.Specs, spec) + } + f.Decls = append(f.Decls[:i], f.Decls[i+1:]...) + i-- + } + + return true +} + +// DeleteImport deletes the import path from the file f, if present. +func DeleteImport(fset *token.FileSet, f *ast.File, path string) (deleted bool) { + return DeleteNamedImport(fset, f, "", path) +} + +// DeleteNamedImport deletes the import with the given name and path from the file f, if present. +func DeleteNamedImport(fset *token.FileSet, f *ast.File, name, path string) (deleted bool) { + var delspecs []*ast.ImportSpec + var delcomments []*ast.CommentGroup + + // Find the import nodes that import path, if any. + for i := 0; i < len(f.Decls); i++ { + decl := f.Decls[i] + gen, ok := decl.(*ast.GenDecl) + if !ok || gen.Tok != token.IMPORT { + continue + } + for j := 0; j < len(gen.Specs); j++ { + spec := gen.Specs[j] + impspec := spec.(*ast.ImportSpec) + if impspec.Name == nil && name != "" { + continue + } + if impspec.Name != nil && impspec.Name.Name != name { + continue + } + if importPath(impspec) != path { + continue + } + + // We found an import spec that imports path. + // Delete it. + delspecs = append(delspecs, impspec) + deleted = true + copy(gen.Specs[j:], gen.Specs[j+1:]) + gen.Specs = gen.Specs[:len(gen.Specs)-1] + + // If this was the last import spec in this decl, + // delete the decl, too. + if len(gen.Specs) == 0 { + copy(f.Decls[i:], f.Decls[i+1:]) + f.Decls = f.Decls[:len(f.Decls)-1] + i-- + break + } else if len(gen.Specs) == 1 { + if impspec.Doc != nil { + delcomments = append(delcomments, impspec.Doc) + } + if impspec.Comment != nil { + delcomments = append(delcomments, impspec.Comment) + } + for _, cg := range f.Comments { + // Found comment on the same line as the import spec. + if cg.End() < impspec.Pos() && fset.Position(cg.End()).Line == fset.Position(impspec.Pos()).Line { + delcomments = append(delcomments, cg) + break + } + } + + gen.Lparen = token.NoPos // drop parens + spec := gen.Specs[0].(*ast.ImportSpec) + if spec.Doc != nil { + // Move the documentation above the import statement. + gen.TokPos = spec.Doc.End() + 1 + } + + for _, cg := range f.Comments { + if cg.End() < spec.Pos() && fset.Position(cg.End()).Line == fset.Position(spec.Pos()).Line { + for fset.Position(gen.TokPos).Line != fset.Position(spec.Pos()).Line { + fset.File(gen.TokPos).MergeLine(fset.Position(gen.TokPos).Line) + } + break + } + } + } + if j > 0 { + lastImpspec := gen.Specs[j-1].(*ast.ImportSpec) + lastLine := fset.Position(lastImpspec.Path.ValuePos).Line + line := fset.Position(impspec.Path.ValuePos).Line + + // We deleted an entry but now there may be + // a blank line-sized hole where the import was. + if line-lastLine > 1 { + // There was a blank line immediately preceding the deleted import, + // so there's no need to close the hole. + // Do nothing. + } else { + // There was no blank line. Close the hole. + fset.File(gen.Rparen).MergeLine(line) + } + } + j-- + } + } + + // Delete imports from f.Imports. + for i := 0; i < len(f.Imports); i++ { + imp := f.Imports[i] + for j, del := range delspecs { + if imp == del { + copy(f.Imports[i:], f.Imports[i+1:]) + f.Imports = f.Imports[:len(f.Imports)-1] + copy(delspecs[j:], delspecs[j+1:]) + delspecs = delspecs[:len(delspecs)-1] + i-- + break + } + } + } + + // Delete comments from f.Comments. + for i := 0; i < len(f.Comments); i++ { + cg := f.Comments[i] + for j, del := range delcomments { + if cg == del { + copy(f.Comments[i:], f.Comments[i+1:]) + f.Comments = f.Comments[:len(f.Comments)-1] + copy(delcomments[j:], delcomments[j+1:]) + delcomments = delcomments[:len(delcomments)-1] + i-- + break + } + } + } + + if len(delspecs) > 0 { + panic(fmt.Sprintf("deleted specs from Decls but not Imports: %v", delspecs)) + } + + return +} + +// RewriteImport rewrites any import of path oldPath to path newPath. +func RewriteImport(fset *token.FileSet, f *ast.File, oldPath, newPath string) (rewrote bool) { + for _, imp := range f.Imports { + if importPath(imp) == oldPath { + rewrote = true + // record old End, because the default is to compute + // it using the length of imp.Path.Value. + imp.EndPos = imp.End() + imp.Path.Value = strconv.Quote(newPath) + } + } + return +} + +// UsesImport reports whether a given import is used. +func UsesImport(f *ast.File, path string) (used bool) { + spec := importSpec(f, path) + if spec == nil { + return + } + + name := spec.Name.String() + switch name { + case "": + // If the package name is not explicitly specified, + // make an educated guess. This is not guaranteed to be correct. + lastSlash := strings.LastIndex(path, "/") + if lastSlash == -1 { + name = path + } else { + name = path[lastSlash+1:] + } + case "_", ".": + // Not sure if this import is used - err on the side of caution. + return true + } + + ast.Walk(visitFn(func(n ast.Node) { + sel, ok := n.(*ast.SelectorExpr) + if ok && isTopName(sel.X, name) { + used = true + } + }), f) + + return +} + +type visitFn func(node ast.Node) + +func (fn visitFn) Visit(node ast.Node) ast.Visitor { + fn(node) + return fn +} + +// imports returns true if f imports path. +func imports(f *ast.File, path string) bool { + return importSpec(f, path) != nil +} + +// importSpec returns the import spec if f imports path, +// or nil otherwise. +func importSpec(f *ast.File, path string) *ast.ImportSpec { + for _, s := range f.Imports { + if importPath(s) == path { + return s + } + } + return nil +} + +// importPath returns the unquoted import path of s, +// or "" if the path is not properly quoted. +func importPath(s *ast.ImportSpec) string { + t, err := strconv.Unquote(s.Path.Value) + if err == nil { + return t + } + return "" +} + +// declImports reports whether gen contains an import of path. +func declImports(gen *ast.GenDecl, path string) bool { + if gen.Tok != token.IMPORT { + return false + } + for _, spec := range gen.Specs { + impspec := spec.(*ast.ImportSpec) + if importPath(impspec) == path { + return true + } + } + return false +} + +// matchLen returns the length of the longest path segment prefix shared by x and y. +func matchLen(x, y string) int { + n := 0 + for i := 0; i < len(x) && i < len(y) && x[i] == y[i]; i++ { + if x[i] == '/' { + n++ + } + } + return n +} + +// isTopName returns true if n is a top-level unresolved identifier with the given name. +func isTopName(n ast.Expr, name string) bool { + id, ok := n.(*ast.Ident) + return ok && id.Name == name && id.Obj == nil +} + +// Imports returns the file imports grouped by paragraph. +func Imports(fset *token.FileSet, f *ast.File) [][]*ast.ImportSpec { + var groups [][]*ast.ImportSpec + + for _, decl := range f.Decls { + genDecl, ok := decl.(*ast.GenDecl) + if !ok || genDecl.Tok != token.IMPORT { + break + } + + group := []*ast.ImportSpec{} + + var lastLine int + for _, spec := range genDecl.Specs { + importSpec := spec.(*ast.ImportSpec) + pos := importSpec.Path.ValuePos + line := fset.Position(pos).Line + if lastLine > 0 && pos > 0 && line-lastLine > 1 { + groups = append(groups, group) + group = []*ast.ImportSpec{} + } + group = append(group, importSpec) + lastLine = line + } + groups = append(groups, group) + } + + return groups +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/util.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/util.go new file mode 100644 index 00000000000..7630629824a --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/util.go @@ -0,0 +1,14 @@ +package astutil + +import "go/ast" + +// Unparen returns e with any enclosing parentheses stripped. +func Unparen(e ast.Expr) ast.Expr { + for { + p, ok := e.(*ast.ParenExpr) + if !ok { + return e + } + e = p.X + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk.go new file mode 100644 index 00000000000..157c79225b4 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk.go @@ -0,0 +1,172 @@ +// Copyright 2016 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. + +// A faster implementation of filepath.Walk. +// +// filepath.Walk's design necessarily calls os.Lstat on each file, +// even if the caller needs less info. And goimports only need to know +// the type of each file. The kernel interface provides the type in +// the Readdir call but the standard library ignored it. +// fastwalk_unix.go contains a fork of the syscall routines. +// +// See golang.org/issue/16399 + +package imports + +import ( + "errors" + "os" + "path/filepath" + "runtime" +) + +// traverseLink is a sentinel error for fastWalk, similar to filepath.SkipDir. +var traverseLink = errors.New("traverse symlink, assuming target is a directory") + +// fastWalk walks the file tree rooted at root, calling walkFn for +// each file or directory in the tree, including root. +// +// If fastWalk returns filepath.SkipDir, the directory is skipped. +// +// Unlike filepath.Walk: +// * file stat calls must be done by the user. +// The only provided metadata is the file type, which does not include +// any permission bits. +// * multiple goroutines stat the filesystem concurrently. The provided +// walkFn must be safe for concurrent use. +// * fastWalk can follow symlinks if walkFn returns the traverseLink +// sentinel error. It is the walkFn's responsibility to prevent +// fastWalk from going into symlink cycles. +func fastWalk(root string, walkFn func(path string, typ os.FileMode) error) error { + // TODO(bradfitz): make numWorkers configurable? We used a + // minimum of 4 to give the kernel more info about multiple + // things we want, in hopes its I/O scheduling can take + // advantage of that. Hopefully most are in cache. Maybe 4 is + // even too low of a minimum. Profile more. + numWorkers := 4 + if n := runtime.NumCPU(); n > numWorkers { + numWorkers = n + } + w := &walker{ + fn: walkFn, + enqueuec: make(chan walkItem, numWorkers), // buffered for performance + workc: make(chan walkItem, numWorkers), // buffered for performance + donec: make(chan struct{}), + + // buffered for correctness & not leaking goroutines: + resc: make(chan error, numWorkers), + } + defer close(w.donec) + // TODO(bradfitz): start the workers as needed? maybe not worth it. + for i := 0; i < numWorkers; i++ { + go w.doWork() + } + todo := []walkItem{{dir: root}} + out := 0 + for { + workc := w.workc + var workItem walkItem + if len(todo) == 0 { + workc = nil + } else { + workItem = todo[len(todo)-1] + } + select { + case workc <- workItem: + todo = todo[:len(todo)-1] + out++ + case it := <-w.enqueuec: + todo = append(todo, it) + case err := <-w.resc: + out-- + if err != nil { + return err + } + if out == 0 && len(todo) == 0 { + // It's safe to quit here, as long as the buffered + // enqueue channel isn't also readable, which might + // happen if the worker sends both another unit of + // work and its result before the other select was + // scheduled and both w.resc and w.enqueuec were + // readable. + select { + case it := <-w.enqueuec: + todo = append(todo, it) + default: + return nil + } + } + } + } +} + +// doWork reads directories as instructed (via workc) and runs the +// user's callback function. +func (w *walker) doWork() { + for { + select { + case <-w.donec: + return + case it := <-w.workc: + w.resc <- w.walk(it.dir, !it.callbackDone) + } + } +} + +type walker struct { + fn func(path string, typ os.FileMode) error + + donec chan struct{} // closed on fastWalk's return + workc chan walkItem // to workers + enqueuec chan walkItem // from workers + resc chan error // from workers +} + +type walkItem struct { + dir string + callbackDone bool // callback already called; don't do it again +} + +func (w *walker) enqueue(it walkItem) { + select { + case w.enqueuec <- it: + case <-w.donec: + } +} + +func (w *walker) onDirEnt(dirName, baseName string, typ os.FileMode) error { + joined := dirName + string(os.PathSeparator) + baseName + if typ == os.ModeDir { + w.enqueue(walkItem{dir: joined}) + return nil + } + + err := w.fn(joined, typ) + if typ == os.ModeSymlink { + if err == traverseLink { + // Set callbackDone so we don't call it twice for both the + // symlink-as-symlink and the symlink-as-directory later: + w.enqueue(walkItem{dir: joined, callbackDone: true}) + return nil + } + if err == filepath.SkipDir { + // Permit SkipDir on symlinks too. + return nil + } + } + return err +} +func (w *walker) walk(root string, runUserCallback bool) error { + if runUserCallback { + err := w.fn(root, os.ModeDir) + if err == filepath.SkipDir { + return nil + } + if err != nil { + return err + } + } + + return readDir(root, w.onDirEnt) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_dirent_fileno.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_dirent_fileno.go new file mode 100644 index 00000000000..f1fd64949db --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_dirent_fileno.go @@ -0,0 +1,13 @@ +// Copyright 2016 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. + +// +build freebsd openbsd netbsd + +package imports + +import "syscall" + +func direntInode(dirent *syscall.Dirent) uint64 { + return uint64(dirent.Fileno) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_dirent_ino.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_dirent_ino.go new file mode 100644 index 00000000000..ee85bc4dd4d --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_dirent_ino.go @@ -0,0 +1,13 @@ +// Copyright 2016 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. + +// +build linux,!appengine darwin + +package imports + +import "syscall" + +func direntInode(dirent *syscall.Dirent) uint64 { + return uint64(dirent.Ino) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_portable.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_portable.go new file mode 100644 index 00000000000..6c2658347d1 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_portable.go @@ -0,0 +1,29 @@ +// Copyright 2016 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. + +// +build appengine !linux,!darwin,!freebsd,!openbsd,!netbsd + +package imports + +import ( + "io/ioutil" + "os" +) + +// readDir calls fn for each directory entry in dirName. +// It does not descend into directories or follow symlinks. +// If fn returns a non-nil error, readDir returns with that error +// immediately. +func readDir(dirName string, fn func(dirName, entName string, typ os.FileMode) error) error { + fis, err := ioutil.ReadDir(dirName) + if err != nil { + return err + } + for _, fi := range fis { + if err := fn(dirName, fi.Name(), fi.Mode()&os.ModeType); err != nil { + return err + } + } + return nil +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_unix.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_unix.go new file mode 100644 index 00000000000..5854233db92 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_unix.go @@ -0,0 +1,122 @@ +// Copyright 2016 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. + +// +build linux,!appengine darwin freebsd openbsd netbsd + +package imports + +import ( + "bytes" + "fmt" + "os" + "syscall" + "unsafe" +) + +const blockSize = 8 << 10 + +// unknownFileMode is a sentinel (and bogus) os.FileMode +// value used to represent a syscall.DT_UNKNOWN Dirent.Type. +const unknownFileMode os.FileMode = os.ModeNamedPipe | os.ModeSocket | os.ModeDevice + +func readDir(dirName string, fn func(dirName, entName string, typ os.FileMode) error) error { + fd, err := syscall.Open(dirName, 0, 0) + if err != nil { + return err + } + defer syscall.Close(fd) + + // The buffer must be at least a block long. + buf := make([]byte, blockSize) // stack-allocated; doesn't escape + bufp := 0 // starting read position in buf + nbuf := 0 // end valid data in buf + for { + if bufp >= nbuf { + bufp = 0 + nbuf, err = syscall.ReadDirent(fd, buf) + if err != nil { + return os.NewSyscallError("readdirent", err) + } + if nbuf <= 0 { + return nil + } + } + consumed, name, typ := parseDirEnt(buf[bufp:nbuf]) + bufp += consumed + if name == "" || name == "." || name == ".." { + continue + } + // Fallback for filesystems (like old XFS) that don't + // support Dirent.Type and have DT_UNKNOWN (0) there + // instead. + if typ == unknownFileMode { + fi, err := os.Lstat(dirName + "/" + name) + if err != nil { + // It got deleted in the meantime. + if os.IsNotExist(err) { + continue + } + return err + } + typ = fi.Mode() & os.ModeType + } + if err := fn(dirName, name, typ); err != nil { + return err + } + } +} + +func parseDirEnt(buf []byte) (consumed int, name string, typ os.FileMode) { + // golang.org/issue/15653 + dirent := (*syscall.Dirent)(unsafe.Pointer(&buf[0])) + if v := unsafe.Offsetof(dirent.Reclen) + unsafe.Sizeof(dirent.Reclen); uintptr(len(buf)) < v { + panic(fmt.Sprintf("buf size of %d smaller than dirent header size %d", len(buf), v)) + } + if len(buf) < int(dirent.Reclen) { + panic(fmt.Sprintf("buf size %d < record length %d", len(buf), dirent.Reclen)) + } + consumed = int(dirent.Reclen) + if direntInode(dirent) == 0 { // File absent in directory. + return + } + switch dirent.Type { + case syscall.DT_REG: + typ = 0 + case syscall.DT_DIR: + typ = os.ModeDir + case syscall.DT_LNK: + typ = os.ModeSymlink + case syscall.DT_BLK: + typ = os.ModeDevice + case syscall.DT_FIFO: + typ = os.ModeNamedPipe + case syscall.DT_SOCK: + typ = os.ModeSocket + case syscall.DT_UNKNOWN: + typ = unknownFileMode + default: + // Skip weird things. + // It's probably a DT_WHT (http://lwn.net/Articles/325369/) + // or something. Revisit if/when this package is moved outside + // of goimports. goimports only cares about regular files, + // symlinks, and directories. + return + } + + nameBuf := (*[unsafe.Sizeof(dirent.Name)]byte)(unsafe.Pointer(&dirent.Name[0])) + nameLen := bytes.IndexByte(nameBuf[:], 0) + if nameLen < 0 { + panic("failed to find terminating 0 byte in dirent") + } + + // Special cases for common things: + if nameLen == 1 && nameBuf[0] == '.' { + name = "." + } else if nameLen == 2 && nameBuf[0] == '.' && nameBuf[1] == '.' { + name = ".." + } else { + name = string(nameBuf[:nameLen]) + } + return +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fix.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fix.go new file mode 100644 index 00000000000..c74bdd2c02e --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fix.go @@ -0,0 +1,978 @@ +// Copyright 2013 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 imports + +import ( + "bufio" + "bytes" + "fmt" + "go/ast" + "go/build" + "go/parser" + "go/token" + "io/ioutil" + "log" + "os" + "path" + "path/filepath" + "sort" + "strings" + "sync" + + "golang.org/x/tools/go/ast/astutil" +) + +// Debug controls verbose logging. +var Debug = false + +var ( + inTests = false // set true by fix_test.go; if false, no need to use testMu + testMu sync.RWMutex // guards globals reset by tests; used only if inTests +) + +// If set, LocalPrefix instructs Process to sort import paths with the given +// prefix into another group after 3rd-party packages. +var LocalPrefix string + +// importToGroup is a list of functions which map from an import path to +// a group number. +var importToGroup = []func(importPath string) (num int, ok bool){ + func(importPath string) (num int, ok bool) { + if LocalPrefix != "" && strings.HasPrefix(importPath, LocalPrefix) { + return 3, true + } + return + }, + func(importPath string) (num int, ok bool) { + if strings.HasPrefix(importPath, "appengine") { + return 2, true + } + return + }, + func(importPath string) (num int, ok bool) { + if strings.Contains(importPath, ".") { + return 1, true + } + return + }, +} + +func importGroup(importPath string) int { + for _, fn := range importToGroup { + if n, ok := fn(importPath); ok { + return n + } + } + return 0 +} + +// packageInfo is a summary of features found in a package. +type packageInfo struct { + Globals map[string]bool // symbol => true +} + +// dirPackageInfo gets information from other files in the package. +func dirPackageInfo(srcDir, filename string) (*packageInfo, error) { + considerTests := strings.HasSuffix(filename, "_test.go") + + // Handle file from stdin + if _, err := os.Stat(filename); err != nil { + if os.IsNotExist(err) { + return &packageInfo{}, nil + } + return nil, err + } + + fileBase := filepath.Base(filename) + packageFileInfos, err := ioutil.ReadDir(srcDir) + if err != nil { + return nil, err + } + + info := &packageInfo{Globals: make(map[string]bool)} + for _, fi := range packageFileInfos { + if fi.Name() == fileBase || !strings.HasSuffix(fi.Name(), ".go") { + continue + } + if !considerTests && strings.HasSuffix(fi.Name(), "_test.go") { + continue + } + + fileSet := token.NewFileSet() + root, err := parser.ParseFile(fileSet, filepath.Join(srcDir, fi.Name()), nil, 0) + if err != nil { + continue + } + + for _, decl := range root.Decls { + genDecl, ok := decl.(*ast.GenDecl) + if !ok { + continue + } + + for _, spec := range genDecl.Specs { + valueSpec, ok := spec.(*ast.ValueSpec) + if !ok { + continue + } + info.Globals[valueSpec.Names[0].Name] = true + } + } + } + return info, nil +} + +func fixImports(fset *token.FileSet, f *ast.File, filename string) (added []string, err error) { + // refs are a set of possible package references currently unsatisfied by imports. + // first key: either base package (e.g. "fmt") or renamed package + // second key: referenced package symbol (e.g. "Println") + refs := make(map[string]map[string]bool) + + // decls are the current package imports. key is base package or renamed package. + decls := make(map[string]*ast.ImportSpec) + + abs, err := filepath.Abs(filename) + if err != nil { + return nil, err + } + srcDir := filepath.Dir(abs) + if Debug { + log.Printf("fixImports(filename=%q), abs=%q, srcDir=%q ...", filename, abs, srcDir) + } + + var packageInfo *packageInfo + var loadedPackageInfo bool + + // collect potential uses of packages. + var visitor visitFn + visitor = visitFn(func(node ast.Node) ast.Visitor { + if node == nil { + return visitor + } + switch v := node.(type) { + case *ast.ImportSpec: + if v.Name != nil { + decls[v.Name.Name] = v + break + } + ipath := strings.Trim(v.Path.Value, `"`) + if ipath == "C" { + break + } + local := importPathToName(ipath, srcDir) + decls[local] = v + case *ast.SelectorExpr: + xident, ok := v.X.(*ast.Ident) + if !ok { + break + } + if xident.Obj != nil { + // if the parser can resolve it, it's not a package ref + break + } + pkgName := xident.Name + if refs[pkgName] == nil { + refs[pkgName] = make(map[string]bool) + } + if !loadedPackageInfo { + loadedPackageInfo = true + packageInfo, _ = dirPackageInfo(srcDir, filename) + } + if decls[pkgName] == nil && (packageInfo == nil || !packageInfo.Globals[pkgName]) { + refs[pkgName][v.Sel.Name] = true + } + } + return visitor + }) + ast.Walk(visitor, f) + + // Nil out any unused ImportSpecs, to be removed in following passes + unusedImport := map[string]string{} + for pkg, is := range decls { + if refs[pkg] == nil && pkg != "_" && pkg != "." { + name := "" + if is.Name != nil { + name = is.Name.Name + } + unusedImport[strings.Trim(is.Path.Value, `"`)] = name + } + } + for ipath, name := range unusedImport { + if ipath == "C" { + // Don't remove cgo stuff. + continue + } + astutil.DeleteNamedImport(fset, f, name, ipath) + } + + for pkgName, symbols := range refs { + if len(symbols) == 0 { + // skip over packages already imported + delete(refs, pkgName) + } + } + + // Search for imports matching potential package references. + searches := 0 + type result struct { + ipath string // import path (if err == nil) + name string // optional name to rename import as + err error + } + results := make(chan result) + for pkgName, symbols := range refs { + go func(pkgName string, symbols map[string]bool) { + ipath, rename, err := findImport(pkgName, symbols, filename) + r := result{ipath: ipath, err: err} + if rename { + r.name = pkgName + } + results <- r + }(pkgName, symbols) + searches++ + } + for i := 0; i < searches; i++ { + result := <-results + if result.err != nil { + return nil, result.err + } + if result.ipath != "" { + if result.name != "" { + astutil.AddNamedImport(fset, f, result.name, result.ipath) + } else { + astutil.AddImport(fset, f, result.ipath) + } + added = append(added, result.ipath) + } + } + + return added, nil +} + +// importPathToName returns the package name for the given import path. +var importPathToName func(importPath, srcDir string) (packageName string) = importPathToNameGoPath + +// importPathToNameBasic assumes the package name is the base of import path. +func importPathToNameBasic(importPath, srcDir string) (packageName string) { + return path.Base(importPath) +} + +// importPathToNameGoPath finds out the actual package name, as declared in its .go files. +// If there's a problem, it falls back to using importPathToNameBasic. +func importPathToNameGoPath(importPath, srcDir string) (packageName string) { + // Fast path for standard library without going to disk. + if pkg, ok := stdImportPackage[importPath]; ok { + return pkg + } + + pkgName, err := importPathToNameGoPathParse(importPath, srcDir) + if Debug { + log.Printf("importPathToNameGoPathParse(%q, srcDir=%q) = %q, %v", importPath, srcDir, pkgName, err) + } + if err == nil { + return pkgName + } + return importPathToNameBasic(importPath, srcDir) +} + +// importPathToNameGoPathParse is a faster version of build.Import if +// the only thing desired is the package name. It uses build.FindOnly +// to find the directory and then only parses one file in the package, +// trusting that the files in the directory are consistent. +func importPathToNameGoPathParse(importPath, srcDir string) (packageName string, err error) { + buildPkg, err := build.Import(importPath, srcDir, build.FindOnly) + if err != nil { + return "", err + } + d, err := os.Open(buildPkg.Dir) + if err != nil { + return "", err + } + names, err := d.Readdirnames(-1) + d.Close() + if err != nil { + return "", err + } + sort.Strings(names) // to have predictable behavior + var lastErr error + var nfile int + for _, name := range names { + if !strings.HasSuffix(name, ".go") { + continue + } + if strings.HasSuffix(name, "_test.go") { + continue + } + nfile++ + fullFile := filepath.Join(buildPkg.Dir, name) + + fset := token.NewFileSet() + f, err := parser.ParseFile(fset, fullFile, nil, parser.PackageClauseOnly) + if err != nil { + lastErr = err + continue + } + pkgName := f.Name.Name + if pkgName == "documentation" { + // Special case from go/build.ImportDir, not + // handled by ctx.MatchFile. + continue + } + if pkgName == "main" { + // Also skip package main, assuming it's a +build ignore generator or example. + // Since you can't import a package main anyway, there's no harm here. + continue + } + return pkgName, nil + } + if lastErr != nil { + return "", lastErr + } + return "", fmt.Errorf("no importable package found in %d Go files", nfile) +} + +var stdImportPackage = map[string]string{} // "net/http" => "http" + +func init() { + // Nothing in the standard library has a package name not + // matching its import base name. + for _, pkg := range stdlib { + if _, ok := stdImportPackage[pkg]; !ok { + stdImportPackage[pkg] = path.Base(pkg) + } + } +} + +// Directory-scanning state. +var ( + // scanGoRootOnce guards calling scanGoRoot (for $GOROOT) + scanGoRootOnce sync.Once + // scanGoPathOnce guards calling scanGoPath (for $GOPATH) + scanGoPathOnce sync.Once + + // populateIgnoreOnce guards calling populateIgnore + populateIgnoreOnce sync.Once + ignoredDirs []os.FileInfo + + dirScanMu sync.RWMutex + dirScan map[string]*pkg // abs dir path => *pkg +) + +type pkg struct { + dir string // absolute file path to pkg directory ("/usr/lib/go/src/net/http") + importPath string // full pkg import path ("net/http", "foo/bar/vendor/a/b") + importPathShort string // vendorless import path ("net/http", "a/b") +} + +// byImportPathShortLength sorts by the short import path length, breaking ties on the +// import string itself. +type byImportPathShortLength []*pkg + +func (s byImportPathShortLength) Len() int { return len(s) } +func (s byImportPathShortLength) Less(i, j int) bool { + vi, vj := s[i].importPathShort, s[j].importPathShort + return len(vi) < len(vj) || (len(vi) == len(vj) && vi < vj) + +} +func (s byImportPathShortLength) Swap(i, j int) { s[i], s[j] = s[j], s[i] } + +// gate is a semaphore for limiting concurrency. +type gate chan struct{} + +func (g gate) enter() { g <- struct{}{} } +func (g gate) leave() { <-g } + +var visitedSymlinks struct { + sync.Mutex + m map[string]struct{} +} + +// guarded by populateIgnoreOnce; populates ignoredDirs. +func populateIgnore() { + for _, srcDir := range build.Default.SrcDirs() { + if srcDir == filepath.Join(build.Default.GOROOT, "src") { + continue + } + populateIgnoredDirs(srcDir) + } +} + +// populateIgnoredDirs reads an optional config file at /.goimportsignore +// of relative directories to ignore when scanning for go files. +// The provided path is one of the $GOPATH entries with "src" appended. +func populateIgnoredDirs(path string) { + file := filepath.Join(path, ".goimportsignore") + slurp, err := ioutil.ReadFile(file) + if Debug { + if err != nil { + log.Print(err) + } else { + log.Printf("Read %s", file) + } + } + if err != nil { + return + } + bs := bufio.NewScanner(bytes.NewReader(slurp)) + for bs.Scan() { + line := strings.TrimSpace(bs.Text()) + if line == "" || strings.HasPrefix(line, "#") { + continue + } + full := filepath.Join(path, line) + if fi, err := os.Stat(full); err == nil { + ignoredDirs = append(ignoredDirs, fi) + if Debug { + log.Printf("Directory added to ignore list: %s", full) + } + } else if Debug { + log.Printf("Error statting entry in .goimportsignore: %v", err) + } + } +} + +func skipDir(fi os.FileInfo) bool { + for _, ignoredDir := range ignoredDirs { + if os.SameFile(fi, ignoredDir) { + return true + } + } + return false +} + +// shouldTraverse reports whether the symlink fi should, found in dir, +// should be followed. It makes sure symlinks were never visited +// before to avoid symlink loops. +func shouldTraverse(dir string, fi os.FileInfo) bool { + path := filepath.Join(dir, fi.Name()) + target, err := filepath.EvalSymlinks(path) + if err != nil { + if !os.IsNotExist(err) { + fmt.Fprintln(os.Stderr, err) + } + return false + } + ts, err := os.Stat(target) + if err != nil { + fmt.Fprintln(os.Stderr, err) + return false + } + if !ts.IsDir() { + return false + } + if skipDir(ts) { + return false + } + + realParent, err := filepath.EvalSymlinks(dir) + if err != nil { + fmt.Fprint(os.Stderr, err) + return false + } + realPath := filepath.Join(realParent, fi.Name()) + visitedSymlinks.Lock() + defer visitedSymlinks.Unlock() + if visitedSymlinks.m == nil { + visitedSymlinks.m = make(map[string]struct{}) + } + if _, ok := visitedSymlinks.m[realPath]; ok { + return false + } + visitedSymlinks.m[realPath] = struct{}{} + return true +} + +var testHookScanDir = func(dir string) {} + +var scanGoRootDone = make(chan struct{}) // closed when scanGoRoot is done + +func scanGoRoot() { + go func() { + scanGoDirs(true) + close(scanGoRootDone) + }() +} + +func scanGoPath() { scanGoDirs(false) } + +func scanGoDirs(goRoot bool) { + if Debug { + which := "$GOROOT" + if !goRoot { + which = "$GOPATH" + } + log.Printf("scanning " + which) + defer log.Printf("scanned " + which) + } + dirScanMu.Lock() + if dirScan == nil { + dirScan = make(map[string]*pkg) + } + dirScanMu.Unlock() + + for _, srcDir := range build.Default.SrcDirs() { + isGoroot := srcDir == filepath.Join(build.Default.GOROOT, "src") + if isGoroot != goRoot { + continue + } + testHookScanDir(srcDir) + walkFn := func(path string, typ os.FileMode) error { + dir := filepath.Dir(path) + if typ.IsRegular() { + if dir == srcDir { + // Doesn't make sense to have regular files + // directly in your $GOPATH/src or $GOROOT/src. + return nil + } + if !strings.HasSuffix(path, ".go") { + return nil + } + dirScanMu.Lock() + if _, dup := dirScan[dir]; !dup { + importpath := filepath.ToSlash(dir[len(srcDir)+len("/"):]) + dirScan[dir] = &pkg{ + importPath: importpath, + importPathShort: vendorlessImportPath(importpath), + dir: dir, + } + } + dirScanMu.Unlock() + return nil + } + if typ == os.ModeDir { + base := filepath.Base(path) + if base == "" || base[0] == '.' || base[0] == '_' || + base == "testdata" || base == "node_modules" { + return filepath.SkipDir + } + fi, err := os.Lstat(path) + if err == nil && skipDir(fi) { + if Debug { + log.Printf("skipping directory %q under %s", fi.Name(), dir) + } + return filepath.SkipDir + } + return nil + } + if typ == os.ModeSymlink { + base := filepath.Base(path) + if strings.HasPrefix(base, ".#") { + // Emacs noise. + return nil + } + fi, err := os.Lstat(path) + if err != nil { + // Just ignore it. + return nil + } + if shouldTraverse(dir, fi) { + return traverseLink + } + } + return nil + } + if err := fastWalk(srcDir, walkFn); err != nil { + log.Printf("goimports: scanning directory %v: %v", srcDir, err) + } + } +} + +// vendorlessImportPath returns the devendorized version of the provided import path. +// e.g. "foo/bar/vendor/a/b" => "a/b" +func vendorlessImportPath(ipath string) string { + // Devendorize for use in import statement. + if i := strings.LastIndex(ipath, "/vendor/"); i >= 0 { + return ipath[i+len("/vendor/"):] + } + if strings.HasPrefix(ipath, "vendor/") { + return ipath[len("vendor/"):] + } + return ipath +} + +// loadExports returns the set of exported symbols in the package at dir. +// It returns nil on error or if the package name in dir does not match expectPackage. +var loadExports func(expectPackage, dir string) map[string]bool = loadExportsGoPath + +func loadExportsGoPath(expectPackage, dir string) map[string]bool { + if Debug { + log.Printf("loading exports in dir %s (seeking package %s)", dir, expectPackage) + } + exports := make(map[string]bool) + + ctx := build.Default + + // ReadDir is like ioutil.ReadDir, but only returns *.go files + // and filters out _test.go files since they're not relevant + // and only slow things down. + ctx.ReadDir = func(dir string) (notTests []os.FileInfo, err error) { + all, err := ioutil.ReadDir(dir) + if err != nil { + return nil, err + } + notTests = all[:0] + for _, fi := range all { + name := fi.Name() + if strings.HasSuffix(name, ".go") && !strings.HasSuffix(name, "_test.go") { + notTests = append(notTests, fi) + } + } + return notTests, nil + } + + files, err := ctx.ReadDir(dir) + if err != nil { + log.Print(err) + return nil + } + + fset := token.NewFileSet() + + for _, fi := range files { + match, err := ctx.MatchFile(dir, fi.Name()) + if err != nil || !match { + continue + } + fullFile := filepath.Join(dir, fi.Name()) + f, err := parser.ParseFile(fset, fullFile, nil, 0) + if err != nil { + if Debug { + log.Printf("Parsing %s: %v", fullFile, err) + } + return nil + } + pkgName := f.Name.Name + if pkgName == "documentation" { + // Special case from go/build.ImportDir, not + // handled by ctx.MatchFile. + continue + } + if pkgName != expectPackage { + if Debug { + log.Printf("scan of dir %v is not expected package %v (actually %v)", dir, expectPackage, pkgName) + } + return nil + } + for name := range f.Scope.Objects { + if ast.IsExported(name) { + exports[name] = true + } + } + } + + if Debug { + exportList := make([]string, 0, len(exports)) + for k := range exports { + exportList = append(exportList, k) + } + sort.Strings(exportList) + log.Printf("loaded exports in dir %v (package %v): %v", dir, expectPackage, strings.Join(exportList, ", ")) + } + return exports +} + +// findImport searches for a package with the given symbols. +// If no package is found, findImport returns ("", false, nil) +// +// This is declared as a variable rather than a function so goimports +// can be easily extended by adding a file with an init function. +// +// The rename value tells goimports whether to use the package name as +// a local qualifier in an import. For example, if findImports("pkg", +// "X") returns ("foo/bar", rename=true), then goimports adds the +// import line: +// import pkg "foo/bar" +// to satisfy uses of pkg.X in the file. +var findImport func(pkgName string, symbols map[string]bool, filename string) (foundPkg string, rename bool, err error) = findImportGoPath + +// findImportGoPath is the normal implementation of findImport. +// (Some companies have their own internally.) +func findImportGoPath(pkgName string, symbols map[string]bool, filename string) (foundPkg string, rename bool, err error) { + if inTests { + testMu.RLock() + defer testMu.RUnlock() + } + + // Fast path for the standard library. + // In the common case we hopefully never have to scan the GOPATH, which can + // be slow with moving disks. + if pkg, rename, ok := findImportStdlib(pkgName, symbols); ok { + return pkg, rename, nil + } + if pkgName == "rand" && symbols["Read"] { + // Special-case rand.Read. + // + // If findImportStdlib didn't find it above, don't go + // searching for it, lest it find and pick math/rand + // in GOROOT (new as of Go 1.6) + // + // crypto/rand is the safer choice. + return "", false, nil + } + + // TODO(sameer): look at the import lines for other Go files in the + // local directory, since the user is likely to import the same packages + // in the current Go file. Return rename=true when the other Go files + // use a renamed package that's also used in the current file. + + // Read all the $GOPATH/src/.goimportsignore files before scanning directories. + populateIgnoreOnce.Do(populateIgnore) + + // Start scanning the $GOROOT asynchronously, then run the + // GOPATH scan synchronously if needed, and then wait for the + // $GOROOT to finish. + // + // TODO(bradfitz): run each $GOPATH entry async. But nobody + // really has more than one anyway, so low priority. + scanGoRootOnce.Do(scanGoRoot) // async + if !fileInDir(filename, build.Default.GOROOT) { + scanGoPathOnce.Do(scanGoPath) // blocking + } + <-scanGoRootDone + + // Find candidate packages, looking only at their directory names first. + var candidates []*pkg + for _, pkg := range dirScan { + if pkgIsCandidate(filename, pkgName, pkg) { + candidates = append(candidates, pkg) + } + } + + // Sort the candidates by their import package length, + // assuming that shorter package names are better than long + // ones. Note that this sorts by the de-vendored name, so + // there's no "penalty" for vendoring. + sort.Sort(byImportPathShortLength(candidates)) + if Debug { + for i, pkg := range candidates { + log.Printf("%s candidate %d/%d: %v", pkgName, i+1, len(candidates), pkg.importPathShort) + } + } + + // Collect exports for packages with matching names. + + done := make(chan struct{}) // closed when we find the answer + defer close(done) + + rescv := make([]chan *pkg, len(candidates)) + for i := range candidates { + rescv[i] = make(chan *pkg) + } + const maxConcurrentPackageImport = 4 + loadExportsSem := make(chan struct{}, maxConcurrentPackageImport) + + go func() { + for i, pkg := range candidates { + select { + case loadExportsSem <- struct{}{}: + select { + case <-done: + default: + } + case <-done: + return + } + pkg := pkg + resc := rescv[i] + go func() { + if inTests { + testMu.RLock() + defer testMu.RUnlock() + } + defer func() { <-loadExportsSem }() + exports := loadExports(pkgName, pkg.dir) + + // If it doesn't have the right + // symbols, send nil to mean no match. + for symbol := range symbols { + if !exports[symbol] { + pkg = nil + break + } + } + select { + case resc <- pkg: + case <-done: + } + }() + } + }() + for _, resc := range rescv { + pkg := <-resc + if pkg == nil { + continue + } + // If the package name in the source doesn't match the import path's base, + // return true so the rewriter adds a name (import foo "github.com/bar/go-foo") + needsRename := path.Base(pkg.importPath) != pkgName + return pkg.importPathShort, needsRename, nil + } + return "", false, nil +} + +// pkgIsCandidate reports whether pkg is a candidate for satisfying the +// finding which package pkgIdent in the file named by filename is trying +// to refer to. +// +// This check is purely lexical and is meant to be as fast as possible +// because it's run over all $GOPATH directories to filter out poor +// candidates in order to limit the CPU and I/O later parsing the +// exports in candidate packages. +// +// filename is the file being formatted. +// pkgIdent is the package being searched for, like "client" (if +// searching for "client.New") +func pkgIsCandidate(filename, pkgIdent string, pkg *pkg) bool { + // Check "internal" and "vendor" visibility: + if !canUse(filename, pkg.dir) { + return false + } + + // Speed optimization to minimize disk I/O: + // the last two components on disk must contain the + // package name somewhere. + // + // This permits mismatch naming like directory + // "go-foo" being package "foo", or "pkg.v3" being "pkg", + // or directory "google.golang.org/api/cloudbilling/v1" + // being package "cloudbilling", but doesn't + // permit a directory "foo" to be package + // "bar", which is strongly discouraged + // anyway. There's no reason goimports needs + // to be slow just to accomodate that. + lastTwo := lastTwoComponents(pkg.importPathShort) + if strings.Contains(lastTwo, pkgIdent) { + return true + } + if hasHyphenOrUpperASCII(lastTwo) && !hasHyphenOrUpperASCII(pkgIdent) { + lastTwo = lowerASCIIAndRemoveHyphen(lastTwo) + if strings.Contains(lastTwo, pkgIdent) { + return true + } + } + + return false +} + +func hasHyphenOrUpperASCII(s string) bool { + for i := 0; i < len(s); i++ { + b := s[i] + if b == '-' || ('A' <= b && b <= 'Z') { + return true + } + } + return false +} + +func lowerASCIIAndRemoveHyphen(s string) (ret string) { + buf := make([]byte, 0, len(s)) + for i := 0; i < len(s); i++ { + b := s[i] + switch { + case b == '-': + continue + case 'A' <= b && b <= 'Z': + buf = append(buf, b+('a'-'A')) + default: + buf = append(buf, b) + } + } + return string(buf) +} + +// canUse reports whether the package in dir is usable from filename, +// respecting the Go "internal" and "vendor" visibility rules. +func canUse(filename, dir string) bool { + // Fast path check, before any allocations. If it doesn't contain vendor + // or internal, it's not tricky: + // Note that this can false-negative on directories like "notinternal", + // but we check it correctly below. This is just a fast path. + if !strings.Contains(dir, "vendor") && !strings.Contains(dir, "internal") { + return true + } + + dirSlash := filepath.ToSlash(dir) + if !strings.Contains(dirSlash, "/vendor/") && !strings.Contains(dirSlash, "/internal/") && !strings.HasSuffix(dirSlash, "/internal") { + return true + } + // Vendor or internal directory only visible from children of parent. + // That means the path from the current directory to the target directory + // can contain ../vendor or ../internal but not ../foo/vendor or ../foo/internal + // or bar/vendor or bar/internal. + // After stripping all the leading ../, the only okay place to see vendor or internal + // is at the very beginning of the path. + absfile, err := filepath.Abs(filename) + if err != nil { + return false + } + absdir, err := filepath.Abs(dir) + if err != nil { + return false + } + rel, err := filepath.Rel(absfile, absdir) + if err != nil { + return false + } + relSlash := filepath.ToSlash(rel) + if i := strings.LastIndex(relSlash, "../"); i >= 0 { + relSlash = relSlash[i+len("../"):] + } + return !strings.Contains(relSlash, "/vendor/") && !strings.Contains(relSlash, "/internal/") && !strings.HasSuffix(relSlash, "/internal") +} + +// lastTwoComponents returns at most the last two path components +// of v, using either / or \ as the path separator. +func lastTwoComponents(v string) string { + nslash := 0 + for i := len(v) - 1; i >= 0; i-- { + if v[i] == '/' || v[i] == '\\' { + nslash++ + if nslash == 2 { + return v[i:] + } + } + } + return v +} + +type visitFn func(node ast.Node) ast.Visitor + +func (fn visitFn) Visit(node ast.Node) ast.Visitor { + return fn(node) +} + +func findImportStdlib(shortPkg string, symbols map[string]bool) (importPath string, rename, ok bool) { + for symbol := range symbols { + key := shortPkg + "." + symbol + path := stdlib[key] + if path == "" { + if key == "rand.Read" { + continue + } + return "", false, false + } + if importPath != "" && importPath != path { + // Ambiguous. Symbols pointed to different things. + return "", false, false + } + importPath = path + } + if importPath == "" && shortPkg == "rand" && symbols["Read"] { + return "crypto/rand", false, true + } + return importPath, false, importPath != "" +} + +// fileInDir reports whether the provided file path looks like +// it's in dir. (without hitting the filesystem) +func fileInDir(file, dir string) bool { + rest := strings.TrimPrefix(file, dir) + if len(rest) == len(file) { + // dir is not a prefix of file. + return false + } + // Check for boundary: either nothing (file == dir), or a slash. + return len(rest) == 0 || rest[0] == '/' || rest[0] == '\\' +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/imports.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/imports.go new file mode 100644 index 00000000000..c26c1946a6b --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/imports.go @@ -0,0 +1,289 @@ +// Copyright 2013 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:generate go run mkstdlib.go + +// Package imports implements a Go pretty-printer (like package "go/format") +// that also adds or removes import statements as necessary. +package imports // import "golang.org/x/tools/imports" + +import ( + "bufio" + "bytes" + "fmt" + "go/ast" + "go/format" + "go/parser" + "go/printer" + "go/token" + "io" + "regexp" + "strconv" + "strings" + + "golang.org/x/tools/go/ast/astutil" +) + +// Options specifies options for processing files. +type Options struct { + Fragment bool // Accept fragment of a source file (no package statement) + AllErrors bool // Report all errors (not just the first 10 on different lines) + + Comments bool // Print comments (true if nil *Options provided) + TabIndent bool // Use tabs for indent (true if nil *Options provided) + TabWidth int // Tab width (8 if nil *Options provided) + + FormatOnly bool // Disable the insertion and deletion of imports +} + +// Process formats and adjusts imports for the provided file. +// If opt is nil the defaults are used. +// +// Note that filename's directory influences which imports can be chosen, +// so it is important that filename be accurate. +// To process data ``as if'' it were in filename, pass the data as a non-nil src. +func Process(filename string, src []byte, opt *Options) ([]byte, error) { + if opt == nil { + opt = &Options{Comments: true, TabIndent: true, TabWidth: 8} + } + + fileSet := token.NewFileSet() + file, adjust, err := parse(fileSet, filename, src, opt) + if err != nil { + return nil, err + } + + if !opt.FormatOnly { + _, err = fixImports(fileSet, file, filename) + if err != nil { + return nil, err + } + } + + sortImports(fileSet, file) + imps := astutil.Imports(fileSet, file) + + var spacesBefore []string // import paths we need spaces before + for _, impSection := range imps { + // Within each block of contiguous imports, see if any + // import lines are in different group numbers. If so, + // we'll need to put a space between them so it's + // compatible with gofmt. + lastGroup := -1 + for _, importSpec := range impSection { + importPath, _ := strconv.Unquote(importSpec.Path.Value) + groupNum := importGroup(importPath) + if groupNum != lastGroup && lastGroup != -1 { + spacesBefore = append(spacesBefore, importPath) + } + lastGroup = groupNum + } + + } + + printerMode := printer.UseSpaces + if opt.TabIndent { + printerMode |= printer.TabIndent + } + printConfig := &printer.Config{Mode: printerMode, Tabwidth: opt.TabWidth} + + var buf bytes.Buffer + err = printConfig.Fprint(&buf, fileSet, file) + if err != nil { + return nil, err + } + out := buf.Bytes() + if adjust != nil { + out = adjust(src, out) + } + if len(spacesBefore) > 0 { + out = addImportSpaces(bytes.NewReader(out), spacesBefore) + } + + out, err = format.Source(out) + if err != nil { + return nil, err + } + return out, nil +} + +// parse parses src, which was read from filename, +// as a Go source file or statement list. +func parse(fset *token.FileSet, filename string, src []byte, opt *Options) (*ast.File, func(orig, src []byte) []byte, error) { + parserMode := parser.Mode(0) + if opt.Comments { + parserMode |= parser.ParseComments + } + if opt.AllErrors { + parserMode |= parser.AllErrors + } + + // Try as whole source file. + file, err := parser.ParseFile(fset, filename, src, parserMode) + if err == nil { + return file, nil, nil + } + // If the error is that the source file didn't begin with a + // package line and we accept fragmented input, fall through to + // try as a source fragment. Stop and return on any other error. + if !opt.Fragment || !strings.Contains(err.Error(), "expected 'package'") { + return nil, nil, err + } + + // If this is a declaration list, make it a source file + // by inserting a package clause. + // Insert using a ;, not a newline, so that the line numbers + // in psrc match the ones in src. + psrc := append([]byte("package main;"), src...) + file, err = parser.ParseFile(fset, filename, psrc, parserMode) + if err == nil { + // If a main function exists, we will assume this is a main + // package and leave the file. + if containsMainFunc(file) { + return file, nil, nil + } + + adjust := func(orig, src []byte) []byte { + // Remove the package clause. + // Gofmt has turned the ; into a \n. + src = src[len("package main\n"):] + return matchSpace(orig, src) + } + return file, adjust, nil + } + // If the error is that the source file didn't begin with a + // declaration, fall through to try as a statement list. + // Stop and return on any other error. + if !strings.Contains(err.Error(), "expected declaration") { + return nil, nil, err + } + + // If this is a statement list, make it a source file + // by inserting a package clause and turning the list + // into a function body. This handles expressions too. + // Insert using a ;, not a newline, so that the line numbers + // in fsrc match the ones in src. + fsrc := append(append([]byte("package p; func _() {"), src...), '}') + file, err = parser.ParseFile(fset, filename, fsrc, parserMode) + if err == nil { + adjust := func(orig, src []byte) []byte { + // Remove the wrapping. + // Gofmt has turned the ; into a \n\n. + src = src[len("package p\n\nfunc _() {"):] + src = src[:len(src)-len("}\n")] + // Gofmt has also indented the function body one level. + // Remove that indent. + src = bytes.Replace(src, []byte("\n\t"), []byte("\n"), -1) + return matchSpace(orig, src) + } + return file, adjust, nil + } + + // Failed, and out of options. + return nil, nil, err +} + +// containsMainFunc checks if a file contains a function declaration with the +// function signature 'func main()' +func containsMainFunc(file *ast.File) bool { + for _, decl := range file.Decls { + if f, ok := decl.(*ast.FuncDecl); ok { + if f.Name.Name != "main" { + continue + } + + if len(f.Type.Params.List) != 0 { + continue + } + + if f.Type.Results != nil && len(f.Type.Results.List) != 0 { + continue + } + + return true + } + } + + return false +} + +func cutSpace(b []byte) (before, middle, after []byte) { + i := 0 + for i < len(b) && (b[i] == ' ' || b[i] == '\t' || b[i] == '\n') { + i++ + } + j := len(b) + for j > 0 && (b[j-1] == ' ' || b[j-1] == '\t' || b[j-1] == '\n') { + j-- + } + if i <= j { + return b[:i], b[i:j], b[j:] + } + return nil, nil, b[j:] +} + +// matchSpace reformats src to use the same space context as orig. +// 1) If orig begins with blank lines, matchSpace inserts them at the beginning of src. +// 2) matchSpace copies the indentation of the first non-blank line in orig +// to every non-blank line in src. +// 3) matchSpace copies the trailing space from orig and uses it in place +// of src's trailing space. +func matchSpace(orig []byte, src []byte) []byte { + before, _, after := cutSpace(orig) + i := bytes.LastIndex(before, []byte{'\n'}) + before, indent := before[:i+1], before[i+1:] + + _, src, _ = cutSpace(src) + + var b bytes.Buffer + b.Write(before) + for len(src) > 0 { + line := src + if i := bytes.IndexByte(line, '\n'); i >= 0 { + line, src = line[:i+1], line[i+1:] + } else { + src = nil + } + if len(line) > 0 && line[0] != '\n' { // not blank + b.Write(indent) + } + b.Write(line) + } + b.Write(after) + return b.Bytes() +} + +var impLine = regexp.MustCompile(`^\s+(?:[\w\.]+\s+)?"(.+)"`) + +func addImportSpaces(r io.Reader, breaks []string) []byte { + var out bytes.Buffer + sc := bufio.NewScanner(r) + inImports := false + done := false + for sc.Scan() { + s := sc.Text() + + if !inImports && !done && strings.HasPrefix(s, "import") { + inImports = true + } + if inImports && (strings.HasPrefix(s, "var") || + strings.HasPrefix(s, "func") || + strings.HasPrefix(s, "const") || + strings.HasPrefix(s, "type")) { + done = true + inImports = false + } + if inImports && len(breaks) > 0 { + if m := impLine.FindStringSubmatch(s); m != nil { + if m[1] == string(breaks[0]) { + out.WriteByte('\n') + breaks = breaks[1:] + } + } + } + + fmt.Fprintln(&out, s) + } + return out.Bytes() +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/mkindex.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/mkindex.go new file mode 100644 index 00000000000..755e2394f2d --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/mkindex.go @@ -0,0 +1,173 @@ +// +build ignore + +// Copyright 2013 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. + +// Command mkindex creates the file "pkgindex.go" containing an index of the Go +// standard library. The file is intended to be built as part of the imports +// package, so that the package may be used in environments where a GOROOT is +// not available (such as App Engine). +package main + +import ( + "bytes" + "fmt" + "go/ast" + "go/build" + "go/format" + "go/parser" + "go/token" + "io/ioutil" + "log" + "os" + "path" + "path/filepath" + "strings" +) + +var ( + pkgIndex = make(map[string][]pkg) + exports = make(map[string]map[string]bool) +) + +func main() { + // Don't use GOPATH. + ctx := build.Default + ctx.GOPATH = "" + + // Populate pkgIndex global from GOROOT. + for _, path := range ctx.SrcDirs() { + f, err := os.Open(path) + if err != nil { + log.Print(err) + continue + } + children, err := f.Readdir(-1) + f.Close() + if err != nil { + log.Print(err) + continue + } + for _, child := range children { + if child.IsDir() { + loadPkg(path, child.Name()) + } + } + } + // Populate exports global. + for _, ps := range pkgIndex { + for _, p := range ps { + e := loadExports(p.dir) + if e != nil { + exports[p.dir] = e + } + } + } + + // Construct source file. + var buf bytes.Buffer + fmt.Fprint(&buf, pkgIndexHead) + fmt.Fprintf(&buf, "var pkgIndexMaster = %#v\n", pkgIndex) + fmt.Fprintf(&buf, "var exportsMaster = %#v\n", exports) + src := buf.Bytes() + + // Replace main.pkg type name with pkg. + src = bytes.Replace(src, []byte("main.pkg"), []byte("pkg"), -1) + // Replace actual GOROOT with "/go". + src = bytes.Replace(src, []byte(ctx.GOROOT), []byte("/go"), -1) + // Add some line wrapping. + src = bytes.Replace(src, []byte("}, "), []byte("},\n"), -1) + src = bytes.Replace(src, []byte("true, "), []byte("true,\n"), -1) + + var err error + src, err = format.Source(src) + if err != nil { + log.Fatal(err) + } + + // Write out source file. + err = ioutil.WriteFile("pkgindex.go", src, 0644) + if err != nil { + log.Fatal(err) + } +} + +const pkgIndexHead = `package imports + +func init() { + pkgIndexOnce.Do(func() { + pkgIndex.m = pkgIndexMaster + }) + loadExports = func(dir string) map[string]bool { + return exportsMaster[dir] + } +} +` + +type pkg struct { + importpath string // full pkg import path, e.g. "net/http" + dir string // absolute file path to pkg directory e.g. "/usr/lib/go/src/fmt" +} + +var fset = token.NewFileSet() + +func loadPkg(root, importpath string) { + shortName := path.Base(importpath) + if shortName == "testdata" { + return + } + + dir := filepath.Join(root, importpath) + pkgIndex[shortName] = append(pkgIndex[shortName], pkg{ + importpath: importpath, + dir: dir, + }) + + pkgDir, err := os.Open(dir) + if err != nil { + return + } + children, err := pkgDir.Readdir(-1) + pkgDir.Close() + if err != nil { + return + } + for _, child := range children { + name := child.Name() + if name == "" { + continue + } + if c := name[0]; c == '.' || ('0' <= c && c <= '9') { + continue + } + if child.IsDir() { + loadPkg(root, filepath.Join(importpath, name)) + } + } +} + +func loadExports(dir string) map[string]bool { + exports := make(map[string]bool) + buildPkg, err := build.ImportDir(dir, 0) + if err != nil { + if strings.Contains(err.Error(), "no buildable Go source files in") { + return nil + } + log.Printf("could not import %q: %v", dir, err) + return nil + } + for _, file := range buildPkg.GoFiles { + f, err := parser.ParseFile(fset, filepath.Join(dir, file), nil, 0) + if err != nil { + log.Printf("could not parse %q: %v", file, err) + continue + } + for name := range f.Scope.Objects { + if ast.IsExported(name) { + exports[name] = true + } + } + } + return exports +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/mkstdlib.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/mkstdlib.go new file mode 100644 index 00000000000..1e559e9f504 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/mkstdlib.go @@ -0,0 +1,103 @@ +// +build ignore + +// mkstdlib generates the zstdlib.go file, containing the Go standard +// library API symbols. It's baked into the binary to avoid scanning +// GOPATH in the common case. +package main + +import ( + "bufio" + "bytes" + "fmt" + "go/format" + "io" + "io/ioutil" + "log" + "os" + "path" + "path/filepath" + "regexp" + "sort" + "strings" +) + +func mustOpen(name string) io.Reader { + f, err := os.Open(name) + if err != nil { + log.Fatal(err) + } + return f +} + +func api(base string) string { + return filepath.Join(os.Getenv("GOROOT"), "api", base) +} + +var sym = regexp.MustCompile(`^pkg (\S+).*?, (?:var|func|type|const) ([A-Z]\w*)`) + +func main() { + var buf bytes.Buffer + outf := func(format string, args ...interface{}) { + fmt.Fprintf(&buf, format, args...) + } + outf("// AUTO-GENERATED BY mkstdlib.go\n\n") + outf("package imports\n") + outf("var stdlib = map[string]string{\n") + f := io.MultiReader( + mustOpen(api("go1.txt")), + mustOpen(api("go1.1.txt")), + mustOpen(api("go1.2.txt")), + mustOpen(api("go1.3.txt")), + mustOpen(api("go1.4.txt")), + mustOpen(api("go1.5.txt")), + mustOpen(api("go1.6.txt")), + mustOpen(api("go1.7.txt")), + ) + sc := bufio.NewScanner(f) + fullImport := map[string]string{} // "zip.NewReader" => "archive/zip" + ambiguous := map[string]bool{} + var keys []string + for sc.Scan() { + l := sc.Text() + has := func(v string) bool { return strings.Contains(l, v) } + if has("struct, ") || has("interface, ") || has(", method (") { + continue + } + if m := sym.FindStringSubmatch(l); m != nil { + full := m[1] + key := path.Base(full) + "." + m[2] + if exist, ok := fullImport[key]; ok { + if exist != full { + ambiguous[key] = true + } + } else { + fullImport[key] = full + keys = append(keys, key) + } + } + } + if err := sc.Err(); err != nil { + log.Fatal(err) + } + sort.Strings(keys) + for _, key := range keys { + if ambiguous[key] { + outf("\t// %q is ambiguous\n", key) + } else { + outf("\t%q: %q,\n", key, fullImport[key]) + } + } + outf("\n") + for _, sym := range [...]string{"Alignof", "ArbitraryType", "Offsetof", "Pointer", "Sizeof"} { + outf("\t%q: %q,\n", "unsafe."+sym, "unsafe") + } + outf("}\n") + fmtbuf, err := format.Source(buf.Bytes()) + if err != nil { + log.Fatal(err) + } + err = ioutil.WriteFile("zstdlib.go", fmtbuf, 0666) + if err != nil { + log.Fatal(err) + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/sortimports.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/sortimports.go new file mode 100644 index 00000000000..653afc51776 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/sortimports.go @@ -0,0 +1,212 @@ +// Copyright 2013 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. + +// Hacked up copy of go/ast/import.go + +package imports + +import ( + "go/ast" + "go/token" + "sort" + "strconv" +) + +// sortImports sorts runs of consecutive import lines in import blocks in f. +// It also removes duplicate imports when it is possible to do so without data loss. +func sortImports(fset *token.FileSet, f *ast.File) { + for i, d := range f.Decls { + d, ok := d.(*ast.GenDecl) + if !ok || d.Tok != token.IMPORT { + // Not an import declaration, so we're done. + // Imports are always first. + break + } + + if len(d.Specs) == 0 { + // Empty import block, remove it. + f.Decls = append(f.Decls[:i], f.Decls[i+1:]...) + } + + if !d.Lparen.IsValid() { + // Not a block: sorted by default. + continue + } + + // Identify and sort runs of specs on successive lines. + i := 0 + specs := d.Specs[:0] + for j, s := range d.Specs { + if j > i && fset.Position(s.Pos()).Line > 1+fset.Position(d.Specs[j-1].End()).Line { + // j begins a new run. End this one. + specs = append(specs, sortSpecs(fset, f, d.Specs[i:j])...) + i = j + } + } + specs = append(specs, sortSpecs(fset, f, d.Specs[i:])...) + d.Specs = specs + + // Deduping can leave a blank line before the rparen; clean that up. + if len(d.Specs) > 0 { + lastSpec := d.Specs[len(d.Specs)-1] + lastLine := fset.Position(lastSpec.Pos()).Line + if rParenLine := fset.Position(d.Rparen).Line; rParenLine > lastLine+1 { + fset.File(d.Rparen).MergeLine(rParenLine - 1) + } + } + } +} + +func importPath(s ast.Spec) string { + t, err := strconv.Unquote(s.(*ast.ImportSpec).Path.Value) + if err == nil { + return t + } + return "" +} + +func importName(s ast.Spec) string { + n := s.(*ast.ImportSpec).Name + if n == nil { + return "" + } + return n.Name +} + +func importComment(s ast.Spec) string { + c := s.(*ast.ImportSpec).Comment + if c == nil { + return "" + } + return c.Text() +} + +// collapse indicates whether prev may be removed, leaving only next. +func collapse(prev, next ast.Spec) bool { + if importPath(next) != importPath(prev) || importName(next) != importName(prev) { + return false + } + return prev.(*ast.ImportSpec).Comment == nil +} + +type posSpan struct { + Start token.Pos + End token.Pos +} + +func sortSpecs(fset *token.FileSet, f *ast.File, specs []ast.Spec) []ast.Spec { + // Can't short-circuit here even if specs are already sorted, + // since they might yet need deduplication. + // A lone import, however, may be safely ignored. + if len(specs) <= 1 { + return specs + } + + // Record positions for specs. + pos := make([]posSpan, len(specs)) + for i, s := range specs { + pos[i] = posSpan{s.Pos(), s.End()} + } + + // Identify comments in this range. + // Any comment from pos[0].Start to the final line counts. + lastLine := fset.Position(pos[len(pos)-1].End).Line + cstart := len(f.Comments) + cend := len(f.Comments) + for i, g := range f.Comments { + if g.Pos() < pos[0].Start { + continue + } + if i < cstart { + cstart = i + } + if fset.Position(g.End()).Line > lastLine { + cend = i + break + } + } + comments := f.Comments[cstart:cend] + + // Assign each comment to the import spec preceding it. + importComment := map[*ast.ImportSpec][]*ast.CommentGroup{} + specIndex := 0 + for _, g := range comments { + for specIndex+1 < len(specs) && pos[specIndex+1].Start <= g.Pos() { + specIndex++ + } + s := specs[specIndex].(*ast.ImportSpec) + importComment[s] = append(importComment[s], g) + } + + // Sort the import specs by import path. + // Remove duplicates, when possible without data loss. + // Reassign the import paths to have the same position sequence. + // Reassign each comment to abut the end of its spec. + // Sort the comments by new position. + sort.Sort(byImportSpec(specs)) + + // Dedup. Thanks to our sorting, we can just consider + // adjacent pairs of imports. + deduped := specs[:0] + for i, s := range specs { + if i == len(specs)-1 || !collapse(s, specs[i+1]) { + deduped = append(deduped, s) + } else { + p := s.Pos() + fset.File(p).MergeLine(fset.Position(p).Line) + } + } + specs = deduped + + // Fix up comment positions + for i, s := range specs { + s := s.(*ast.ImportSpec) + if s.Name != nil { + s.Name.NamePos = pos[i].Start + } + s.Path.ValuePos = pos[i].Start + s.EndPos = pos[i].End + for _, g := range importComment[s] { + for _, c := range g.List { + c.Slash = pos[i].End + } + } + } + + sort.Sort(byCommentPos(comments)) + + return specs +} + +type byImportSpec []ast.Spec // slice of *ast.ImportSpec + +func (x byImportSpec) Len() int { return len(x) } +func (x byImportSpec) Swap(i, j int) { x[i], x[j] = x[j], x[i] } +func (x byImportSpec) Less(i, j int) bool { + ipath := importPath(x[i]) + jpath := importPath(x[j]) + + igroup := importGroup(ipath) + jgroup := importGroup(jpath) + if igroup != jgroup { + return igroup < jgroup + } + + if ipath != jpath { + return ipath < jpath + } + iname := importName(x[i]) + jname := importName(x[j]) + + if iname != jname { + return iname < jname + } + return importComment(x[i]) < importComment(x[j]) +} + +type byCommentPos []*ast.CommentGroup + +func (x byCommentPos) Len() int { return len(x) } +func (x byCommentPos) Swap(i, j int) { x[i], x[j] = x[j], x[i] } +func (x byCommentPos) Less(i, j int) bool { return x[i].Pos() < x[j].Pos() } diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/zstdlib.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/zstdlib.go new file mode 100644 index 00000000000..28835da0314 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/zstdlib.go @@ -0,0 +1,9289 @@ +// AUTO-GENERATED BY mkstdlib.go + +package imports + +var stdlib = map[string]string{ + "adler32.Checksum": "hash/adler32", + "adler32.New": "hash/adler32", + "adler32.Size": "hash/adler32", + "aes.BlockSize": "crypto/aes", + "aes.KeySizeError": "crypto/aes", + "aes.NewCipher": "crypto/aes", + "ascii85.CorruptInputError": "encoding/ascii85", + "ascii85.Decode": "encoding/ascii85", + "ascii85.Encode": "encoding/ascii85", + "ascii85.MaxEncodedLen": "encoding/ascii85", + "ascii85.NewDecoder": "encoding/ascii85", + "ascii85.NewEncoder": "encoding/ascii85", + "asn1.BitString": "encoding/asn1", + "asn1.ClassApplication": "encoding/asn1", + "asn1.ClassContextSpecific": "encoding/asn1", + "asn1.ClassPrivate": "encoding/asn1", + "asn1.ClassUniversal": "encoding/asn1", + "asn1.Enumerated": "encoding/asn1", + "asn1.Flag": "encoding/asn1", + "asn1.Marshal": "encoding/asn1", + "asn1.ObjectIdentifier": "encoding/asn1", + "asn1.RawContent": "encoding/asn1", + "asn1.RawValue": "encoding/asn1", + "asn1.StructuralError": "encoding/asn1", + "asn1.SyntaxError": "encoding/asn1", + "asn1.TagBitString": "encoding/asn1", + "asn1.TagBoolean": "encoding/asn1", + "asn1.TagEnum": "encoding/asn1", + "asn1.TagGeneralString": "encoding/asn1", + "asn1.TagGeneralizedTime": "encoding/asn1", + "asn1.TagIA5String": "encoding/asn1", + "asn1.TagInteger": "encoding/asn1", + "asn1.TagOID": "encoding/asn1", + "asn1.TagOctetString": "encoding/asn1", + "asn1.TagPrintableString": "encoding/asn1", + "asn1.TagSequence": "encoding/asn1", + "asn1.TagSet": "encoding/asn1", + "asn1.TagT61String": "encoding/asn1", + "asn1.TagUTCTime": "encoding/asn1", + "asn1.TagUTF8String": "encoding/asn1", + "asn1.Unmarshal": "encoding/asn1", + "asn1.UnmarshalWithParams": "encoding/asn1", + "ast.ArrayType": "go/ast", + "ast.AssignStmt": "go/ast", + "ast.Bad": "go/ast", + "ast.BadDecl": "go/ast", + "ast.BadExpr": "go/ast", + "ast.BadStmt": "go/ast", + "ast.BasicLit": "go/ast", + "ast.BinaryExpr": "go/ast", + "ast.BlockStmt": "go/ast", + "ast.BranchStmt": "go/ast", + "ast.CallExpr": "go/ast", + "ast.CaseClause": "go/ast", + "ast.ChanDir": "go/ast", + "ast.ChanType": "go/ast", + "ast.CommClause": "go/ast", + "ast.Comment": "go/ast", + "ast.CommentGroup": "go/ast", + "ast.CommentMap": "go/ast", + "ast.CompositeLit": "go/ast", + "ast.Con": "go/ast", + "ast.DeclStmt": "go/ast", + "ast.DeferStmt": "go/ast", + "ast.Ellipsis": "go/ast", + "ast.EmptyStmt": "go/ast", + "ast.ExprStmt": "go/ast", + "ast.Field": "go/ast", + "ast.FieldFilter": "go/ast", + "ast.FieldList": "go/ast", + "ast.File": "go/ast", + "ast.FileExports": "go/ast", + "ast.Filter": "go/ast", + "ast.FilterDecl": "go/ast", + "ast.FilterFile": "go/ast", + "ast.FilterFuncDuplicates": "go/ast", + "ast.FilterImportDuplicates": "go/ast", + "ast.FilterPackage": "go/ast", + "ast.FilterUnassociatedComments": "go/ast", + "ast.ForStmt": "go/ast", + "ast.Fprint": "go/ast", + "ast.Fun": "go/ast", + "ast.FuncDecl": "go/ast", + "ast.FuncLit": "go/ast", + "ast.FuncType": "go/ast", + "ast.GenDecl": "go/ast", + "ast.GoStmt": "go/ast", + "ast.Ident": "go/ast", + "ast.IfStmt": "go/ast", + "ast.ImportSpec": "go/ast", + "ast.Importer": "go/ast", + "ast.IncDecStmt": "go/ast", + "ast.IndexExpr": "go/ast", + "ast.Inspect": "go/ast", + "ast.InterfaceType": "go/ast", + "ast.IsExported": "go/ast", + "ast.KeyValueExpr": "go/ast", + "ast.LabeledStmt": "go/ast", + "ast.Lbl": "go/ast", + "ast.MapType": "go/ast", + "ast.MergeMode": "go/ast", + "ast.MergePackageFiles": "go/ast", + "ast.NewCommentMap": "go/ast", + "ast.NewIdent": "go/ast", + "ast.NewObj": "go/ast", + "ast.NewPackage": "go/ast", + "ast.NewScope": "go/ast", + "ast.Node": "go/ast", + "ast.NotNilFilter": "go/ast", + "ast.ObjKind": "go/ast", + "ast.Object": "go/ast", + "ast.Package": "go/ast", + "ast.PackageExports": "go/ast", + "ast.ParenExpr": "go/ast", + "ast.Pkg": "go/ast", + "ast.Print": "go/ast", + "ast.RECV": "go/ast", + "ast.RangeStmt": "go/ast", + "ast.ReturnStmt": "go/ast", + "ast.SEND": "go/ast", + "ast.Scope": "go/ast", + "ast.SelectStmt": "go/ast", + "ast.SelectorExpr": "go/ast", + "ast.SendStmt": "go/ast", + "ast.SliceExpr": "go/ast", + "ast.SortImports": "go/ast", + "ast.StarExpr": "go/ast", + "ast.StructType": "go/ast", + "ast.SwitchStmt": "go/ast", + "ast.Typ": "go/ast", + "ast.TypeAssertExpr": "go/ast", + "ast.TypeSpec": "go/ast", + "ast.TypeSwitchStmt": "go/ast", + "ast.UnaryExpr": "go/ast", + "ast.ValueSpec": "go/ast", + "ast.Var": "go/ast", + "ast.Visitor": "go/ast", + "ast.Walk": "go/ast", + "atomic.AddInt32": "sync/atomic", + "atomic.AddInt64": "sync/atomic", + "atomic.AddUint32": "sync/atomic", + "atomic.AddUint64": "sync/atomic", + "atomic.AddUintptr": "sync/atomic", + "atomic.CompareAndSwapInt32": "sync/atomic", + "atomic.CompareAndSwapInt64": "sync/atomic", + "atomic.CompareAndSwapPointer": "sync/atomic", + "atomic.CompareAndSwapUint32": "sync/atomic", + "atomic.CompareAndSwapUint64": "sync/atomic", + "atomic.CompareAndSwapUintptr": "sync/atomic", + "atomic.LoadInt32": "sync/atomic", + "atomic.LoadInt64": "sync/atomic", + "atomic.LoadPointer": "sync/atomic", + "atomic.LoadUint32": "sync/atomic", + "atomic.LoadUint64": "sync/atomic", + "atomic.LoadUintptr": "sync/atomic", + "atomic.StoreInt32": "sync/atomic", + "atomic.StoreInt64": "sync/atomic", + "atomic.StorePointer": "sync/atomic", + "atomic.StoreUint32": "sync/atomic", + "atomic.StoreUint64": "sync/atomic", + "atomic.StoreUintptr": "sync/atomic", + "atomic.SwapInt32": "sync/atomic", + "atomic.SwapInt64": "sync/atomic", + "atomic.SwapPointer": "sync/atomic", + "atomic.SwapUint32": "sync/atomic", + "atomic.SwapUint64": "sync/atomic", + "atomic.SwapUintptr": "sync/atomic", + "atomic.Value": "sync/atomic", + "base32.CorruptInputError": "encoding/base32", + "base32.Encoding": "encoding/base32", + "base32.HexEncoding": "encoding/base32", + "base32.NewDecoder": "encoding/base32", + "base32.NewEncoder": "encoding/base32", + "base32.NewEncoding": "encoding/base32", + "base32.StdEncoding": "encoding/base32", + "base64.CorruptInputError": "encoding/base64", + "base64.Encoding": "encoding/base64", + "base64.NewDecoder": "encoding/base64", + "base64.NewEncoder": "encoding/base64", + "base64.NewEncoding": "encoding/base64", + "base64.NoPadding": "encoding/base64", + "base64.RawStdEncoding": "encoding/base64", + "base64.RawURLEncoding": "encoding/base64", + "base64.StdEncoding": "encoding/base64", + "base64.StdPadding": "encoding/base64", + "base64.URLEncoding": "encoding/base64", + "big.Above": "math/big", + "big.Accuracy": "math/big", + "big.AwayFromZero": "math/big", + "big.Below": "math/big", + "big.ErrNaN": "math/big", + "big.Exact": "math/big", + "big.Float": "math/big", + "big.Int": "math/big", + "big.Jacobi": "math/big", + "big.MaxBase": "math/big", + "big.MaxExp": "math/big", + "big.MaxPrec": "math/big", + "big.MinExp": "math/big", + "big.NewFloat": "math/big", + "big.NewInt": "math/big", + "big.NewRat": "math/big", + "big.ParseFloat": "math/big", + "big.Rat": "math/big", + "big.RoundingMode": "math/big", + "big.ToNearestAway": "math/big", + "big.ToNearestEven": "math/big", + "big.ToNegativeInf": "math/big", + "big.ToPositiveInf": "math/big", + "big.ToZero": "math/big", + "big.Word": "math/big", + "binary.BigEndian": "encoding/binary", + "binary.ByteOrder": "encoding/binary", + "binary.LittleEndian": "encoding/binary", + "binary.MaxVarintLen16": "encoding/binary", + "binary.MaxVarintLen32": "encoding/binary", + "binary.MaxVarintLen64": "encoding/binary", + "binary.PutUvarint": "encoding/binary", + "binary.PutVarint": "encoding/binary", + "binary.Read": "encoding/binary", + "binary.ReadUvarint": "encoding/binary", + "binary.ReadVarint": "encoding/binary", + "binary.Size": "encoding/binary", + "binary.Uvarint": "encoding/binary", + "binary.Varint": "encoding/binary", + "binary.Write": "encoding/binary", + "bufio.ErrAdvanceTooFar": "bufio", + "bufio.ErrBufferFull": "bufio", + "bufio.ErrFinalToken": "bufio", + "bufio.ErrInvalidUnreadByte": "bufio", + "bufio.ErrInvalidUnreadRune": "bufio", + "bufio.ErrNegativeAdvance": "bufio", + "bufio.ErrNegativeCount": "bufio", + "bufio.ErrTooLong": "bufio", + "bufio.MaxScanTokenSize": "bufio", + "bufio.NewReadWriter": "bufio", + "bufio.NewReader": "bufio", + "bufio.NewReaderSize": "bufio", + "bufio.NewScanner": "bufio", + "bufio.NewWriter": "bufio", + "bufio.NewWriterSize": "bufio", + "bufio.ReadWriter": "bufio", + "bufio.Reader": "bufio", + "bufio.ScanBytes": "bufio", + "bufio.ScanLines": "bufio", + "bufio.ScanRunes": "bufio", + "bufio.ScanWords": "bufio", + "bufio.Scanner": "bufio", + "bufio.SplitFunc": "bufio", + "bufio.Writer": "bufio", + "build.AllowBinary": "go/build", + "build.ArchChar": "go/build", + "build.Context": "go/build", + "build.Default": "go/build", + "build.FindOnly": "go/build", + "build.IgnoreVendor": "go/build", + "build.Import": "go/build", + "build.ImportComment": "go/build", + "build.ImportDir": "go/build", + "build.ImportMode": "go/build", + "build.IsLocalImport": "go/build", + "build.MultiplePackageError": "go/build", + "build.NoGoError": "go/build", + "build.Package": "go/build", + "build.ToolDir": "go/build", + "bytes.Buffer": "bytes", + "bytes.Compare": "bytes", + "bytes.Contains": "bytes", + "bytes.ContainsAny": "bytes", + "bytes.ContainsRune": "bytes", + "bytes.Count": "bytes", + "bytes.Equal": "bytes", + "bytes.EqualFold": "bytes", + "bytes.ErrTooLarge": "bytes", + "bytes.Fields": "bytes", + "bytes.FieldsFunc": "bytes", + "bytes.HasPrefix": "bytes", + "bytes.HasSuffix": "bytes", + "bytes.Index": "bytes", + "bytes.IndexAny": "bytes", + "bytes.IndexByte": "bytes", + "bytes.IndexFunc": "bytes", + "bytes.IndexRune": "bytes", + "bytes.Join": "bytes", + "bytes.LastIndex": "bytes", + "bytes.LastIndexAny": "bytes", + "bytes.LastIndexByte": "bytes", + "bytes.LastIndexFunc": "bytes", + "bytes.Map": "bytes", + "bytes.MinRead": "bytes", + "bytes.NewBuffer": "bytes", + "bytes.NewBufferString": "bytes", + "bytes.NewReader": "bytes", + "bytes.Reader": "bytes", + "bytes.Repeat": "bytes", + "bytes.Replace": "bytes", + "bytes.Runes": "bytes", + "bytes.Split": "bytes", + "bytes.SplitAfter": "bytes", + "bytes.SplitAfterN": "bytes", + "bytes.SplitN": "bytes", + "bytes.Title": "bytes", + "bytes.ToLower": "bytes", + "bytes.ToLowerSpecial": "bytes", + "bytes.ToTitle": "bytes", + "bytes.ToTitleSpecial": "bytes", + "bytes.ToUpper": "bytes", + "bytes.ToUpperSpecial": "bytes", + "bytes.Trim": "bytes", + "bytes.TrimFunc": "bytes", + "bytes.TrimLeft": "bytes", + "bytes.TrimLeftFunc": "bytes", + "bytes.TrimPrefix": "bytes", + "bytes.TrimRight": "bytes", + "bytes.TrimRightFunc": "bytes", + "bytes.TrimSpace": "bytes", + "bytes.TrimSuffix": "bytes", + "bzip2.NewReader": "compress/bzip2", + "bzip2.StructuralError": "compress/bzip2", + "cgi.Handler": "net/http/cgi", + "cgi.Request": "net/http/cgi", + "cgi.RequestFromMap": "net/http/cgi", + "cgi.Serve": "net/http/cgi", + "cipher.AEAD": "crypto/cipher", + "cipher.Block": "crypto/cipher", + "cipher.BlockMode": "crypto/cipher", + "cipher.NewCBCDecrypter": "crypto/cipher", + "cipher.NewCBCEncrypter": "crypto/cipher", + "cipher.NewCFBDecrypter": "crypto/cipher", + "cipher.NewCFBEncrypter": "crypto/cipher", + "cipher.NewCTR": "crypto/cipher", + "cipher.NewGCM": "crypto/cipher", + "cipher.NewGCMWithNonceSize": "crypto/cipher", + "cipher.NewOFB": "crypto/cipher", + "cipher.Stream": "crypto/cipher", + "cipher.StreamReader": "crypto/cipher", + "cipher.StreamWriter": "crypto/cipher", + "cmplx.Abs": "math/cmplx", + "cmplx.Acos": "math/cmplx", + "cmplx.Acosh": "math/cmplx", + "cmplx.Asin": "math/cmplx", + "cmplx.Asinh": "math/cmplx", + "cmplx.Atan": "math/cmplx", + "cmplx.Atanh": "math/cmplx", + "cmplx.Conj": "math/cmplx", + "cmplx.Cos": "math/cmplx", + "cmplx.Cosh": "math/cmplx", + "cmplx.Cot": "math/cmplx", + "cmplx.Exp": "math/cmplx", + "cmplx.Inf": "math/cmplx", + "cmplx.IsInf": "math/cmplx", + "cmplx.IsNaN": "math/cmplx", + "cmplx.Log": "math/cmplx", + "cmplx.Log10": "math/cmplx", + "cmplx.NaN": "math/cmplx", + "cmplx.Phase": "math/cmplx", + "cmplx.Polar": "math/cmplx", + "cmplx.Pow": "math/cmplx", + "cmplx.Rect": "math/cmplx", + "cmplx.Sin": "math/cmplx", + "cmplx.Sinh": "math/cmplx", + "cmplx.Sqrt": "math/cmplx", + "cmplx.Tan": "math/cmplx", + "cmplx.Tanh": "math/cmplx", + "color.Alpha": "image/color", + "color.Alpha16": "image/color", + "color.Alpha16Model": "image/color", + "color.AlphaModel": "image/color", + "color.Black": "image/color", + "color.CMYK": "image/color", + "color.CMYKModel": "image/color", + "color.CMYKToRGB": "image/color", + "color.Color": "image/color", + "color.Gray": "image/color", + "color.Gray16": "image/color", + "color.Gray16Model": "image/color", + "color.GrayModel": "image/color", + "color.Model": "image/color", + "color.ModelFunc": "image/color", + "color.NRGBA": "image/color", + "color.NRGBA64": "image/color", + "color.NRGBA64Model": "image/color", + "color.NRGBAModel": "image/color", + "color.NYCbCrA": "image/color", + "color.NYCbCrAModel": "image/color", + "color.Opaque": "image/color", + "color.Palette": "image/color", + "color.RGBA": "image/color", + "color.RGBA64": "image/color", + "color.RGBA64Model": "image/color", + "color.RGBAModel": "image/color", + "color.RGBToCMYK": "image/color", + "color.RGBToYCbCr": "image/color", + "color.Transparent": "image/color", + "color.White": "image/color", + "color.YCbCr": "image/color", + "color.YCbCrModel": "image/color", + "color.YCbCrToRGB": "image/color", + "constant.BinaryOp": "go/constant", + "constant.BitLen": "go/constant", + "constant.Bool": "go/constant", + "constant.BoolVal": "go/constant", + "constant.Bytes": "go/constant", + "constant.Compare": "go/constant", + "constant.Complex": "go/constant", + "constant.Denom": "go/constant", + "constant.Float": "go/constant", + "constant.Float32Val": "go/constant", + "constant.Float64Val": "go/constant", + "constant.Imag": "go/constant", + "constant.Int": "go/constant", + "constant.Int64Val": "go/constant", + "constant.Kind": "go/constant", + "constant.MakeBool": "go/constant", + "constant.MakeFloat64": "go/constant", + "constant.MakeFromBytes": "go/constant", + "constant.MakeFromLiteral": "go/constant", + "constant.MakeImag": "go/constant", + "constant.MakeInt64": "go/constant", + "constant.MakeString": "go/constant", + "constant.MakeUint64": "go/constant", + "constant.MakeUnknown": "go/constant", + "constant.Num": "go/constant", + "constant.Real": "go/constant", + "constant.Shift": "go/constant", + "constant.Sign": "go/constant", + "constant.String": "go/constant", + "constant.StringVal": "go/constant", + "constant.ToComplex": "go/constant", + "constant.ToFloat": "go/constant", + "constant.ToInt": "go/constant", + "constant.Uint64Val": "go/constant", + "constant.UnaryOp": "go/constant", + "constant.Unknown": "go/constant", + "context.Background": "context", + "context.CancelFunc": "context", + "context.Canceled": "context", + "context.Context": "context", + "context.DeadlineExceeded": "context", + "context.TODO": "context", + "context.WithCancel": "context", + "context.WithDeadline": "context", + "context.WithTimeout": "context", + "context.WithValue": "context", + "cookiejar.Jar": "net/http/cookiejar", + "cookiejar.New": "net/http/cookiejar", + "cookiejar.Options": "net/http/cookiejar", + "cookiejar.PublicSuffixList": "net/http/cookiejar", + "crc32.Castagnoli": "hash/crc32", + "crc32.Checksum": "hash/crc32", + "crc32.ChecksumIEEE": "hash/crc32", + "crc32.IEEE": "hash/crc32", + "crc32.IEEETable": "hash/crc32", + "crc32.Koopman": "hash/crc32", + "crc32.MakeTable": "hash/crc32", + "crc32.New": "hash/crc32", + "crc32.NewIEEE": "hash/crc32", + "crc32.Size": "hash/crc32", + "crc32.Table": "hash/crc32", + "crc32.Update": "hash/crc32", + "crc64.Checksum": "hash/crc64", + "crc64.ECMA": "hash/crc64", + "crc64.ISO": "hash/crc64", + "crc64.MakeTable": "hash/crc64", + "crc64.New": "hash/crc64", + "crc64.Size": "hash/crc64", + "crc64.Table": "hash/crc64", + "crc64.Update": "hash/crc64", + "crypto.Decrypter": "crypto", + "crypto.DecrypterOpts": "crypto", + "crypto.Hash": "crypto", + "crypto.MD4": "crypto", + "crypto.MD5": "crypto", + "crypto.MD5SHA1": "crypto", + "crypto.PrivateKey": "crypto", + "crypto.PublicKey": "crypto", + "crypto.RIPEMD160": "crypto", + "crypto.RegisterHash": "crypto", + "crypto.SHA1": "crypto", + "crypto.SHA224": "crypto", + "crypto.SHA256": "crypto", + "crypto.SHA384": "crypto", + "crypto.SHA3_224": "crypto", + "crypto.SHA3_256": "crypto", + "crypto.SHA3_384": "crypto", + "crypto.SHA3_512": "crypto", + "crypto.SHA512": "crypto", + "crypto.SHA512_224": "crypto", + "crypto.SHA512_256": "crypto", + "crypto.Signer": "crypto", + "crypto.SignerOpts": "crypto", + "csv.ErrBareQuote": "encoding/csv", + "csv.ErrFieldCount": "encoding/csv", + "csv.ErrQuote": "encoding/csv", + "csv.ErrTrailingComma": "encoding/csv", + "csv.NewReader": "encoding/csv", + "csv.NewWriter": "encoding/csv", + "csv.ParseError": "encoding/csv", + "csv.Reader": "encoding/csv", + "csv.Writer": "encoding/csv", + "debug.FreeOSMemory": "runtime/debug", + "debug.GCStats": "runtime/debug", + "debug.PrintStack": "runtime/debug", + "debug.ReadGCStats": "runtime/debug", + "debug.SetGCPercent": "runtime/debug", + "debug.SetMaxStack": "runtime/debug", + "debug.SetMaxThreads": "runtime/debug", + "debug.SetPanicOnFault": "runtime/debug", + "debug.SetTraceback": "runtime/debug", + "debug.Stack": "runtime/debug", + "debug.WriteHeapDump": "runtime/debug", + "des.BlockSize": "crypto/des", + "des.KeySizeError": "crypto/des", + "des.NewCipher": "crypto/des", + "des.NewTripleDESCipher": "crypto/des", + "doc.AllDecls": "go/doc", + "doc.AllMethods": "go/doc", + "doc.Example": "go/doc", + "doc.Examples": "go/doc", + "doc.Filter": "go/doc", + "doc.Func": "go/doc", + "doc.IllegalPrefixes": "go/doc", + "doc.Mode": "go/doc", + "doc.New": "go/doc", + "doc.Note": "go/doc", + "doc.Package": "go/doc", + "doc.Synopsis": "go/doc", + "doc.ToHTML": "go/doc", + "doc.ToText": "go/doc", + "doc.Type": "go/doc", + "doc.Value": "go/doc", + "draw.Draw": "image/draw", + "draw.DrawMask": "image/draw", + "draw.Drawer": "image/draw", + "draw.FloydSteinberg": "image/draw", + "draw.Image": "image/draw", + "draw.Op": "image/draw", + "draw.Over": "image/draw", + "draw.Quantizer": "image/draw", + "draw.Src": "image/draw", + "driver.Bool": "database/sql/driver", + "driver.ColumnConverter": "database/sql/driver", + "driver.Conn": "database/sql/driver", + "driver.DefaultParameterConverter": "database/sql/driver", + "driver.Driver": "database/sql/driver", + "driver.ErrBadConn": "database/sql/driver", + "driver.ErrSkip": "database/sql/driver", + "driver.Execer": "database/sql/driver", + "driver.Int32": "database/sql/driver", + "driver.IsScanValue": "database/sql/driver", + "driver.IsValue": "database/sql/driver", + "driver.NotNull": "database/sql/driver", + "driver.Null": "database/sql/driver", + "driver.Queryer": "database/sql/driver", + "driver.Result": "database/sql/driver", + "driver.ResultNoRows": "database/sql/driver", + "driver.Rows": "database/sql/driver", + "driver.RowsAffected": "database/sql/driver", + "driver.Stmt": "database/sql/driver", + "driver.String": "database/sql/driver", + "driver.Tx": "database/sql/driver", + "driver.Value": "database/sql/driver", + "driver.ValueConverter": "database/sql/driver", + "driver.Valuer": "database/sql/driver", + "dsa.ErrInvalidPublicKey": "crypto/dsa", + "dsa.GenerateKey": "crypto/dsa", + "dsa.GenerateParameters": "crypto/dsa", + "dsa.L1024N160": "crypto/dsa", + "dsa.L2048N224": "crypto/dsa", + "dsa.L2048N256": "crypto/dsa", + "dsa.L3072N256": "crypto/dsa", + "dsa.ParameterSizes": "crypto/dsa", + "dsa.Parameters": "crypto/dsa", + "dsa.PrivateKey": "crypto/dsa", + "dsa.PublicKey": "crypto/dsa", + "dsa.Sign": "crypto/dsa", + "dsa.Verify": "crypto/dsa", + "dwarf.AddrType": "debug/dwarf", + "dwarf.ArrayType": "debug/dwarf", + "dwarf.Attr": "debug/dwarf", + "dwarf.AttrAbstractOrigin": "debug/dwarf", + "dwarf.AttrAccessibility": "debug/dwarf", + "dwarf.AttrAddrClass": "debug/dwarf", + "dwarf.AttrAllocated": "debug/dwarf", + "dwarf.AttrArtificial": "debug/dwarf", + "dwarf.AttrAssociated": "debug/dwarf", + "dwarf.AttrBaseTypes": "debug/dwarf", + "dwarf.AttrBitOffset": "debug/dwarf", + "dwarf.AttrBitSize": "debug/dwarf", + "dwarf.AttrByteSize": "debug/dwarf", + "dwarf.AttrCallColumn": "debug/dwarf", + "dwarf.AttrCallFile": "debug/dwarf", + "dwarf.AttrCallLine": "debug/dwarf", + "dwarf.AttrCalling": "debug/dwarf", + "dwarf.AttrCommonRef": "debug/dwarf", + "dwarf.AttrCompDir": "debug/dwarf", + "dwarf.AttrConstValue": "debug/dwarf", + "dwarf.AttrContainingType": "debug/dwarf", + "dwarf.AttrCount": "debug/dwarf", + "dwarf.AttrDataLocation": "debug/dwarf", + "dwarf.AttrDataMemberLoc": "debug/dwarf", + "dwarf.AttrDeclColumn": "debug/dwarf", + "dwarf.AttrDeclFile": "debug/dwarf", + "dwarf.AttrDeclLine": "debug/dwarf", + "dwarf.AttrDeclaration": "debug/dwarf", + "dwarf.AttrDefaultValue": "debug/dwarf", + "dwarf.AttrDescription": "debug/dwarf", + "dwarf.AttrDiscr": "debug/dwarf", + "dwarf.AttrDiscrList": "debug/dwarf", + "dwarf.AttrDiscrValue": "debug/dwarf", + "dwarf.AttrEncoding": "debug/dwarf", + "dwarf.AttrEntrypc": "debug/dwarf", + "dwarf.AttrExtension": "debug/dwarf", + "dwarf.AttrExternal": "debug/dwarf", + "dwarf.AttrFrameBase": "debug/dwarf", + "dwarf.AttrFriend": "debug/dwarf", + "dwarf.AttrHighpc": "debug/dwarf", + "dwarf.AttrIdentifierCase": "debug/dwarf", + "dwarf.AttrImport": "debug/dwarf", + "dwarf.AttrInline": "debug/dwarf", + "dwarf.AttrIsOptional": "debug/dwarf", + "dwarf.AttrLanguage": "debug/dwarf", + "dwarf.AttrLocation": "debug/dwarf", + "dwarf.AttrLowerBound": "debug/dwarf", + "dwarf.AttrLowpc": "debug/dwarf", + "dwarf.AttrMacroInfo": "debug/dwarf", + "dwarf.AttrName": "debug/dwarf", + "dwarf.AttrNamelistItem": "debug/dwarf", + "dwarf.AttrOrdering": "debug/dwarf", + "dwarf.AttrPriority": "debug/dwarf", + "dwarf.AttrProducer": "debug/dwarf", + "dwarf.AttrPrototyped": "debug/dwarf", + "dwarf.AttrRanges": "debug/dwarf", + "dwarf.AttrReturnAddr": "debug/dwarf", + "dwarf.AttrSegment": "debug/dwarf", + "dwarf.AttrSibling": "debug/dwarf", + "dwarf.AttrSpecification": "debug/dwarf", + "dwarf.AttrStartScope": "debug/dwarf", + "dwarf.AttrStaticLink": "debug/dwarf", + "dwarf.AttrStmtList": "debug/dwarf", + "dwarf.AttrStride": "debug/dwarf", + "dwarf.AttrStrideSize": "debug/dwarf", + "dwarf.AttrStringLength": "debug/dwarf", + "dwarf.AttrTrampoline": "debug/dwarf", + "dwarf.AttrType": "debug/dwarf", + "dwarf.AttrUpperBound": "debug/dwarf", + "dwarf.AttrUseLocation": "debug/dwarf", + "dwarf.AttrUseUTF8": "debug/dwarf", + "dwarf.AttrVarParam": "debug/dwarf", + "dwarf.AttrVirtuality": "debug/dwarf", + "dwarf.AttrVisibility": "debug/dwarf", + "dwarf.AttrVtableElemLoc": "debug/dwarf", + "dwarf.BasicType": "debug/dwarf", + "dwarf.BoolType": "debug/dwarf", + "dwarf.CharType": "debug/dwarf", + "dwarf.Class": "debug/dwarf", + "dwarf.ClassAddress": "debug/dwarf", + "dwarf.ClassBlock": "debug/dwarf", + "dwarf.ClassConstant": "debug/dwarf", + "dwarf.ClassExprLoc": "debug/dwarf", + "dwarf.ClassFlag": "debug/dwarf", + "dwarf.ClassLinePtr": "debug/dwarf", + "dwarf.ClassLocListPtr": "debug/dwarf", + "dwarf.ClassMacPtr": "debug/dwarf", + "dwarf.ClassRangeListPtr": "debug/dwarf", + "dwarf.ClassReference": "debug/dwarf", + "dwarf.ClassReferenceAlt": "debug/dwarf", + "dwarf.ClassReferenceSig": "debug/dwarf", + "dwarf.ClassString": "debug/dwarf", + "dwarf.ClassStringAlt": "debug/dwarf", + "dwarf.ClassUnknown": "debug/dwarf", + "dwarf.CommonType": "debug/dwarf", + "dwarf.ComplexType": "debug/dwarf", + "dwarf.Data": "debug/dwarf", + "dwarf.DecodeError": "debug/dwarf", + "dwarf.DotDotDotType": "debug/dwarf", + "dwarf.Entry": "debug/dwarf", + "dwarf.EnumType": "debug/dwarf", + "dwarf.EnumValue": "debug/dwarf", + "dwarf.ErrUnknownPC": "debug/dwarf", + "dwarf.Field": "debug/dwarf", + "dwarf.FloatType": "debug/dwarf", + "dwarf.FuncType": "debug/dwarf", + "dwarf.IntType": "debug/dwarf", + "dwarf.LineEntry": "debug/dwarf", + "dwarf.LineFile": "debug/dwarf", + "dwarf.LineReader": "debug/dwarf", + "dwarf.LineReaderPos": "debug/dwarf", + "dwarf.New": "debug/dwarf", + "dwarf.Offset": "debug/dwarf", + "dwarf.PtrType": "debug/dwarf", + "dwarf.QualType": "debug/dwarf", + "dwarf.Reader": "debug/dwarf", + "dwarf.StructField": "debug/dwarf", + "dwarf.StructType": "debug/dwarf", + "dwarf.Tag": "debug/dwarf", + "dwarf.TagAccessDeclaration": "debug/dwarf", + "dwarf.TagArrayType": "debug/dwarf", + "dwarf.TagBaseType": "debug/dwarf", + "dwarf.TagCatchDwarfBlock": "debug/dwarf", + "dwarf.TagClassType": "debug/dwarf", + "dwarf.TagCommonDwarfBlock": "debug/dwarf", + "dwarf.TagCommonInclusion": "debug/dwarf", + "dwarf.TagCompileUnit": "debug/dwarf", + "dwarf.TagCondition": "debug/dwarf", + "dwarf.TagConstType": "debug/dwarf", + "dwarf.TagConstant": "debug/dwarf", + "dwarf.TagDwarfProcedure": "debug/dwarf", + "dwarf.TagEntryPoint": "debug/dwarf", + "dwarf.TagEnumerationType": "debug/dwarf", + "dwarf.TagEnumerator": "debug/dwarf", + "dwarf.TagFileType": "debug/dwarf", + "dwarf.TagFormalParameter": "debug/dwarf", + "dwarf.TagFriend": "debug/dwarf", + "dwarf.TagImportedDeclaration": "debug/dwarf", + "dwarf.TagImportedModule": "debug/dwarf", + "dwarf.TagImportedUnit": "debug/dwarf", + "dwarf.TagInheritance": "debug/dwarf", + "dwarf.TagInlinedSubroutine": "debug/dwarf", + "dwarf.TagInterfaceType": "debug/dwarf", + "dwarf.TagLabel": "debug/dwarf", + "dwarf.TagLexDwarfBlock": "debug/dwarf", + "dwarf.TagMember": "debug/dwarf", + "dwarf.TagModule": "debug/dwarf", + "dwarf.TagMutableType": "debug/dwarf", + "dwarf.TagNamelist": "debug/dwarf", + "dwarf.TagNamelistItem": "debug/dwarf", + "dwarf.TagNamespace": "debug/dwarf", + "dwarf.TagPackedType": "debug/dwarf", + "dwarf.TagPartialUnit": "debug/dwarf", + "dwarf.TagPointerType": "debug/dwarf", + "dwarf.TagPtrToMemberType": "debug/dwarf", + "dwarf.TagReferenceType": "debug/dwarf", + "dwarf.TagRestrictType": "debug/dwarf", + "dwarf.TagRvalueReferenceType": "debug/dwarf", + "dwarf.TagSetType": "debug/dwarf", + "dwarf.TagSharedType": "debug/dwarf", + "dwarf.TagStringType": "debug/dwarf", + "dwarf.TagStructType": "debug/dwarf", + "dwarf.TagSubprogram": "debug/dwarf", + "dwarf.TagSubrangeType": "debug/dwarf", + "dwarf.TagSubroutineType": "debug/dwarf", + "dwarf.TagTemplateAlias": "debug/dwarf", + "dwarf.TagTemplateTypeParameter": "debug/dwarf", + "dwarf.TagTemplateValueParameter": "debug/dwarf", + "dwarf.TagThrownType": "debug/dwarf", + "dwarf.TagTryDwarfBlock": "debug/dwarf", + "dwarf.TagTypeUnit": "debug/dwarf", + "dwarf.TagTypedef": "debug/dwarf", + "dwarf.TagUnionType": "debug/dwarf", + "dwarf.TagUnspecifiedParameters": "debug/dwarf", + "dwarf.TagUnspecifiedType": "debug/dwarf", + "dwarf.TagVariable": "debug/dwarf", + "dwarf.TagVariant": "debug/dwarf", + "dwarf.TagVariantPart": "debug/dwarf", + "dwarf.TagVolatileType": "debug/dwarf", + "dwarf.TagWithStmt": "debug/dwarf", + "dwarf.Type": "debug/dwarf", + "dwarf.TypedefType": "debug/dwarf", + "dwarf.UcharType": "debug/dwarf", + "dwarf.UintType": "debug/dwarf", + "dwarf.UnspecifiedType": "debug/dwarf", + "dwarf.VoidType": "debug/dwarf", + "ecdsa.GenerateKey": "crypto/ecdsa", + "ecdsa.PrivateKey": "crypto/ecdsa", + "ecdsa.PublicKey": "crypto/ecdsa", + "ecdsa.Sign": "crypto/ecdsa", + "ecdsa.Verify": "crypto/ecdsa", + "elf.ARM_MAGIC_TRAMP_NUMBER": "debug/elf", + "elf.COMPRESS_HIOS": "debug/elf", + "elf.COMPRESS_HIPROC": "debug/elf", + "elf.COMPRESS_LOOS": "debug/elf", + "elf.COMPRESS_LOPROC": "debug/elf", + "elf.COMPRESS_ZLIB": "debug/elf", + "elf.Chdr32": "debug/elf", + "elf.Chdr64": "debug/elf", + "elf.Class": "debug/elf", + "elf.CompressionType": "debug/elf", + "elf.DF_BIND_NOW": "debug/elf", + "elf.DF_ORIGIN": "debug/elf", + "elf.DF_STATIC_TLS": "debug/elf", + "elf.DF_SYMBOLIC": "debug/elf", + "elf.DF_TEXTREL": "debug/elf", + "elf.DT_BIND_NOW": "debug/elf", + "elf.DT_DEBUG": "debug/elf", + "elf.DT_ENCODING": "debug/elf", + "elf.DT_FINI": "debug/elf", + "elf.DT_FINI_ARRAY": "debug/elf", + "elf.DT_FINI_ARRAYSZ": "debug/elf", + "elf.DT_FLAGS": "debug/elf", + "elf.DT_HASH": "debug/elf", + "elf.DT_HIOS": "debug/elf", + "elf.DT_HIPROC": "debug/elf", + "elf.DT_INIT": "debug/elf", + "elf.DT_INIT_ARRAY": "debug/elf", + "elf.DT_INIT_ARRAYSZ": "debug/elf", + "elf.DT_JMPREL": "debug/elf", + "elf.DT_LOOS": "debug/elf", + "elf.DT_LOPROC": "debug/elf", + "elf.DT_NEEDED": "debug/elf", + "elf.DT_NULL": "debug/elf", + "elf.DT_PLTGOT": "debug/elf", + "elf.DT_PLTREL": "debug/elf", + "elf.DT_PLTRELSZ": "debug/elf", + "elf.DT_PREINIT_ARRAY": "debug/elf", + "elf.DT_PREINIT_ARRAYSZ": "debug/elf", + "elf.DT_REL": "debug/elf", + "elf.DT_RELA": "debug/elf", + "elf.DT_RELAENT": "debug/elf", + "elf.DT_RELASZ": "debug/elf", + "elf.DT_RELENT": "debug/elf", + "elf.DT_RELSZ": "debug/elf", + "elf.DT_RPATH": "debug/elf", + "elf.DT_RUNPATH": "debug/elf", + "elf.DT_SONAME": "debug/elf", + "elf.DT_STRSZ": "debug/elf", + "elf.DT_STRTAB": "debug/elf", + "elf.DT_SYMBOLIC": "debug/elf", + "elf.DT_SYMENT": "debug/elf", + "elf.DT_SYMTAB": "debug/elf", + "elf.DT_TEXTREL": "debug/elf", + "elf.DT_VERNEED": "debug/elf", + "elf.DT_VERNEEDNUM": "debug/elf", + "elf.DT_VERSYM": "debug/elf", + "elf.Data": "debug/elf", + "elf.Dyn32": "debug/elf", + "elf.Dyn64": "debug/elf", + "elf.DynFlag": "debug/elf", + "elf.DynTag": "debug/elf", + "elf.EI_ABIVERSION": "debug/elf", + "elf.EI_CLASS": "debug/elf", + "elf.EI_DATA": "debug/elf", + "elf.EI_NIDENT": "debug/elf", + "elf.EI_OSABI": "debug/elf", + "elf.EI_PAD": "debug/elf", + "elf.EI_VERSION": "debug/elf", + "elf.ELFCLASS32": "debug/elf", + "elf.ELFCLASS64": "debug/elf", + "elf.ELFCLASSNONE": "debug/elf", + "elf.ELFDATA2LSB": "debug/elf", + "elf.ELFDATA2MSB": "debug/elf", + "elf.ELFDATANONE": "debug/elf", + "elf.ELFMAG": "debug/elf", + "elf.ELFOSABI_86OPEN": "debug/elf", + "elf.ELFOSABI_AIX": "debug/elf", + "elf.ELFOSABI_ARM": "debug/elf", + "elf.ELFOSABI_FREEBSD": "debug/elf", + "elf.ELFOSABI_HPUX": "debug/elf", + "elf.ELFOSABI_HURD": "debug/elf", + "elf.ELFOSABI_IRIX": "debug/elf", + "elf.ELFOSABI_LINUX": "debug/elf", + "elf.ELFOSABI_MODESTO": "debug/elf", + "elf.ELFOSABI_NETBSD": "debug/elf", + "elf.ELFOSABI_NONE": "debug/elf", + "elf.ELFOSABI_NSK": "debug/elf", + "elf.ELFOSABI_OPENBSD": "debug/elf", + "elf.ELFOSABI_OPENVMS": "debug/elf", + "elf.ELFOSABI_SOLARIS": "debug/elf", + "elf.ELFOSABI_STANDALONE": "debug/elf", + "elf.ELFOSABI_TRU64": "debug/elf", + "elf.EM_386": "debug/elf", + "elf.EM_486": "debug/elf", + "elf.EM_68HC12": "debug/elf", + "elf.EM_68K": "debug/elf", + "elf.EM_860": "debug/elf", + "elf.EM_88K": "debug/elf", + "elf.EM_960": "debug/elf", + "elf.EM_AARCH64": "debug/elf", + "elf.EM_ALPHA": "debug/elf", + "elf.EM_ALPHA_STD": "debug/elf", + "elf.EM_ARC": "debug/elf", + "elf.EM_ARM": "debug/elf", + "elf.EM_COLDFIRE": "debug/elf", + "elf.EM_FR20": "debug/elf", + "elf.EM_H8S": "debug/elf", + "elf.EM_H8_300": "debug/elf", + "elf.EM_H8_300H": "debug/elf", + "elf.EM_H8_500": "debug/elf", + "elf.EM_IA_64": "debug/elf", + "elf.EM_M32": "debug/elf", + "elf.EM_ME16": "debug/elf", + "elf.EM_MIPS": "debug/elf", + "elf.EM_MIPS_RS3_LE": "debug/elf", + "elf.EM_MIPS_RS4_BE": "debug/elf", + "elf.EM_MIPS_X": "debug/elf", + "elf.EM_MMA": "debug/elf", + "elf.EM_NCPU": "debug/elf", + "elf.EM_NDR1": "debug/elf", + "elf.EM_NONE": "debug/elf", + "elf.EM_PARISC": "debug/elf", + "elf.EM_PCP": "debug/elf", + "elf.EM_PPC": "debug/elf", + "elf.EM_PPC64": "debug/elf", + "elf.EM_RCE": "debug/elf", + "elf.EM_RH32": "debug/elf", + "elf.EM_S370": "debug/elf", + "elf.EM_S390": "debug/elf", + "elf.EM_SH": "debug/elf", + "elf.EM_SPARC": "debug/elf", + "elf.EM_SPARC32PLUS": "debug/elf", + "elf.EM_SPARCV9": "debug/elf", + "elf.EM_ST100": "debug/elf", + "elf.EM_STARCORE": "debug/elf", + "elf.EM_TINYJ": "debug/elf", + "elf.EM_TRICORE": "debug/elf", + "elf.EM_V800": "debug/elf", + "elf.EM_VPP500": "debug/elf", + "elf.EM_X86_64": "debug/elf", + "elf.ET_CORE": "debug/elf", + "elf.ET_DYN": "debug/elf", + "elf.ET_EXEC": "debug/elf", + "elf.ET_HIOS": "debug/elf", + "elf.ET_HIPROC": "debug/elf", + "elf.ET_LOOS": "debug/elf", + "elf.ET_LOPROC": "debug/elf", + "elf.ET_NONE": "debug/elf", + "elf.ET_REL": "debug/elf", + "elf.EV_CURRENT": "debug/elf", + "elf.EV_NONE": "debug/elf", + "elf.ErrNoSymbols": "debug/elf", + "elf.File": "debug/elf", + "elf.FileHeader": "debug/elf", + "elf.FormatError": "debug/elf", + "elf.Header32": "debug/elf", + "elf.Header64": "debug/elf", + "elf.ImportedSymbol": "debug/elf", + "elf.Machine": "debug/elf", + "elf.NT_FPREGSET": "debug/elf", + "elf.NT_PRPSINFO": "debug/elf", + "elf.NT_PRSTATUS": "debug/elf", + "elf.NType": "debug/elf", + "elf.NewFile": "debug/elf", + "elf.OSABI": "debug/elf", + "elf.Open": "debug/elf", + "elf.PF_MASKOS": "debug/elf", + "elf.PF_MASKPROC": "debug/elf", + "elf.PF_R": "debug/elf", + "elf.PF_W": "debug/elf", + "elf.PF_X": "debug/elf", + "elf.PT_DYNAMIC": "debug/elf", + "elf.PT_HIOS": "debug/elf", + "elf.PT_HIPROC": "debug/elf", + "elf.PT_INTERP": "debug/elf", + "elf.PT_LOAD": "debug/elf", + "elf.PT_LOOS": "debug/elf", + "elf.PT_LOPROC": "debug/elf", + "elf.PT_NOTE": "debug/elf", + "elf.PT_NULL": "debug/elf", + "elf.PT_PHDR": "debug/elf", + "elf.PT_SHLIB": "debug/elf", + "elf.PT_TLS": "debug/elf", + "elf.Prog": "debug/elf", + "elf.Prog32": "debug/elf", + "elf.Prog64": "debug/elf", + "elf.ProgFlag": "debug/elf", + "elf.ProgHeader": "debug/elf", + "elf.ProgType": "debug/elf", + "elf.R_386": "debug/elf", + "elf.R_386_32": "debug/elf", + "elf.R_386_COPY": "debug/elf", + "elf.R_386_GLOB_DAT": "debug/elf", + "elf.R_386_GOT32": "debug/elf", + "elf.R_386_GOTOFF": "debug/elf", + "elf.R_386_GOTPC": "debug/elf", + "elf.R_386_JMP_SLOT": "debug/elf", + "elf.R_386_NONE": "debug/elf", + "elf.R_386_PC32": "debug/elf", + "elf.R_386_PLT32": "debug/elf", + "elf.R_386_RELATIVE": "debug/elf", + "elf.R_386_TLS_DTPMOD32": "debug/elf", + "elf.R_386_TLS_DTPOFF32": "debug/elf", + "elf.R_386_TLS_GD": "debug/elf", + "elf.R_386_TLS_GD_32": "debug/elf", + "elf.R_386_TLS_GD_CALL": "debug/elf", + "elf.R_386_TLS_GD_POP": "debug/elf", + "elf.R_386_TLS_GD_PUSH": "debug/elf", + "elf.R_386_TLS_GOTIE": "debug/elf", + "elf.R_386_TLS_IE": "debug/elf", + "elf.R_386_TLS_IE_32": "debug/elf", + "elf.R_386_TLS_LDM": "debug/elf", + "elf.R_386_TLS_LDM_32": "debug/elf", + "elf.R_386_TLS_LDM_CALL": "debug/elf", + "elf.R_386_TLS_LDM_POP": "debug/elf", + "elf.R_386_TLS_LDM_PUSH": "debug/elf", + "elf.R_386_TLS_LDO_32": "debug/elf", + "elf.R_386_TLS_LE": "debug/elf", + "elf.R_386_TLS_LE_32": "debug/elf", + "elf.R_386_TLS_TPOFF": "debug/elf", + "elf.R_386_TLS_TPOFF32": "debug/elf", + "elf.R_390": "debug/elf", + "elf.R_390_12": "debug/elf", + "elf.R_390_16": "debug/elf", + "elf.R_390_20": "debug/elf", + "elf.R_390_32": "debug/elf", + "elf.R_390_64": "debug/elf", + "elf.R_390_8": "debug/elf", + "elf.R_390_COPY": "debug/elf", + "elf.R_390_GLOB_DAT": "debug/elf", + "elf.R_390_GOT12": "debug/elf", + "elf.R_390_GOT16": "debug/elf", + "elf.R_390_GOT20": "debug/elf", + "elf.R_390_GOT32": "debug/elf", + "elf.R_390_GOT64": "debug/elf", + "elf.R_390_GOTENT": "debug/elf", + "elf.R_390_GOTOFF": "debug/elf", + "elf.R_390_GOTOFF16": "debug/elf", + "elf.R_390_GOTOFF64": "debug/elf", + "elf.R_390_GOTPC": "debug/elf", + "elf.R_390_GOTPCDBL": "debug/elf", + "elf.R_390_GOTPLT12": "debug/elf", + "elf.R_390_GOTPLT16": "debug/elf", + "elf.R_390_GOTPLT20": "debug/elf", + "elf.R_390_GOTPLT32": "debug/elf", + "elf.R_390_GOTPLT64": "debug/elf", + "elf.R_390_GOTPLTENT": "debug/elf", + "elf.R_390_GOTPLTOFF16": "debug/elf", + "elf.R_390_GOTPLTOFF32": "debug/elf", + "elf.R_390_GOTPLTOFF64": "debug/elf", + "elf.R_390_JMP_SLOT": "debug/elf", + "elf.R_390_NONE": "debug/elf", + "elf.R_390_PC16": "debug/elf", + "elf.R_390_PC16DBL": "debug/elf", + "elf.R_390_PC32": "debug/elf", + "elf.R_390_PC32DBL": "debug/elf", + "elf.R_390_PC64": "debug/elf", + "elf.R_390_PLT16DBL": "debug/elf", + "elf.R_390_PLT32": "debug/elf", + "elf.R_390_PLT32DBL": "debug/elf", + "elf.R_390_PLT64": "debug/elf", + "elf.R_390_RELATIVE": "debug/elf", + "elf.R_390_TLS_DTPMOD": "debug/elf", + "elf.R_390_TLS_DTPOFF": "debug/elf", + "elf.R_390_TLS_GD32": "debug/elf", + "elf.R_390_TLS_GD64": "debug/elf", + "elf.R_390_TLS_GDCALL": "debug/elf", + "elf.R_390_TLS_GOTIE12": "debug/elf", + "elf.R_390_TLS_GOTIE20": "debug/elf", + "elf.R_390_TLS_GOTIE32": "debug/elf", + "elf.R_390_TLS_GOTIE64": "debug/elf", + "elf.R_390_TLS_IE32": "debug/elf", + "elf.R_390_TLS_IE64": "debug/elf", + "elf.R_390_TLS_IEENT": "debug/elf", + "elf.R_390_TLS_LDCALL": "debug/elf", + "elf.R_390_TLS_LDM32": "debug/elf", + "elf.R_390_TLS_LDM64": "debug/elf", + "elf.R_390_TLS_LDO32": "debug/elf", + "elf.R_390_TLS_LDO64": "debug/elf", + "elf.R_390_TLS_LE32": "debug/elf", + "elf.R_390_TLS_LE64": "debug/elf", + "elf.R_390_TLS_LOAD": "debug/elf", + "elf.R_390_TLS_TPOFF": "debug/elf", + "elf.R_AARCH64": "debug/elf", + "elf.R_AARCH64_ABS16": "debug/elf", + "elf.R_AARCH64_ABS32": "debug/elf", + "elf.R_AARCH64_ABS64": "debug/elf", + "elf.R_AARCH64_ADD_ABS_LO12_NC": "debug/elf", + "elf.R_AARCH64_ADR_GOT_PAGE": "debug/elf", + "elf.R_AARCH64_ADR_PREL_LO21": "debug/elf", + "elf.R_AARCH64_ADR_PREL_PG_HI21": "debug/elf", + "elf.R_AARCH64_ADR_PREL_PG_HI21_NC": "debug/elf", + "elf.R_AARCH64_CALL26": "debug/elf", + "elf.R_AARCH64_CONDBR19": "debug/elf", + "elf.R_AARCH64_COPY": "debug/elf", + "elf.R_AARCH64_GLOB_DAT": "debug/elf", + "elf.R_AARCH64_GOT_LD_PREL19": "debug/elf", + "elf.R_AARCH64_IRELATIVE": "debug/elf", + "elf.R_AARCH64_JUMP26": "debug/elf", + "elf.R_AARCH64_JUMP_SLOT": "debug/elf", + "elf.R_AARCH64_LD64_GOT_LO12_NC": "debug/elf", + "elf.R_AARCH64_LDST128_ABS_LO12_NC": "debug/elf", + "elf.R_AARCH64_LDST16_ABS_LO12_NC": "debug/elf", + "elf.R_AARCH64_LDST32_ABS_LO12_NC": "debug/elf", + "elf.R_AARCH64_LDST64_ABS_LO12_NC": "debug/elf", + "elf.R_AARCH64_LDST8_ABS_LO12_NC": "debug/elf", + "elf.R_AARCH64_LD_PREL_LO19": "debug/elf", + "elf.R_AARCH64_MOVW_SABS_G0": "debug/elf", + "elf.R_AARCH64_MOVW_SABS_G1": "debug/elf", + "elf.R_AARCH64_MOVW_SABS_G2": "debug/elf", + "elf.R_AARCH64_MOVW_UABS_G0": "debug/elf", + "elf.R_AARCH64_MOVW_UABS_G0_NC": "debug/elf", + "elf.R_AARCH64_MOVW_UABS_G1": "debug/elf", + "elf.R_AARCH64_MOVW_UABS_G1_NC": "debug/elf", + "elf.R_AARCH64_MOVW_UABS_G2": "debug/elf", + "elf.R_AARCH64_MOVW_UABS_G2_NC": "debug/elf", + "elf.R_AARCH64_MOVW_UABS_G3": "debug/elf", + "elf.R_AARCH64_NONE": "debug/elf", + "elf.R_AARCH64_NULL": "debug/elf", + "elf.R_AARCH64_P32_ABS16": "debug/elf", + "elf.R_AARCH64_P32_ABS32": "debug/elf", + "elf.R_AARCH64_P32_ADD_ABS_LO12_NC": "debug/elf", + "elf.R_AARCH64_P32_ADR_GOT_PAGE": "debug/elf", + "elf.R_AARCH64_P32_ADR_PREL_LO21": "debug/elf", + "elf.R_AARCH64_P32_ADR_PREL_PG_HI21": "debug/elf", + "elf.R_AARCH64_P32_CALL26": "debug/elf", + "elf.R_AARCH64_P32_CONDBR19": "debug/elf", + "elf.R_AARCH64_P32_COPY": "debug/elf", + "elf.R_AARCH64_P32_GLOB_DAT": "debug/elf", + "elf.R_AARCH64_P32_GOT_LD_PREL19": "debug/elf", + "elf.R_AARCH64_P32_IRELATIVE": "debug/elf", + "elf.R_AARCH64_P32_JUMP26": "debug/elf", + "elf.R_AARCH64_P32_JUMP_SLOT": "debug/elf", + "elf.R_AARCH64_P32_LD32_GOT_LO12_NC": "debug/elf", + "elf.R_AARCH64_P32_LDST128_ABS_LO12_NC": "debug/elf", + "elf.R_AARCH64_P32_LDST16_ABS_LO12_NC": "debug/elf", + "elf.R_AARCH64_P32_LDST32_ABS_LO12_NC": "debug/elf", + "elf.R_AARCH64_P32_LDST64_ABS_LO12_NC": "debug/elf", + "elf.R_AARCH64_P32_LDST8_ABS_LO12_NC": "debug/elf", + "elf.R_AARCH64_P32_LD_PREL_LO19": "debug/elf", + "elf.R_AARCH64_P32_MOVW_SABS_G0": "debug/elf", + "elf.R_AARCH64_P32_MOVW_UABS_G0": "debug/elf", + "elf.R_AARCH64_P32_MOVW_UABS_G0_NC": "debug/elf", + "elf.R_AARCH64_P32_MOVW_UABS_G1": "debug/elf", + "elf.R_AARCH64_P32_PREL16": "debug/elf", + "elf.R_AARCH64_P32_PREL32": "debug/elf", + "elf.R_AARCH64_P32_RELATIVE": "debug/elf", + "elf.R_AARCH64_P32_TLSDESC": "debug/elf", + "elf.R_AARCH64_P32_TLSDESC_ADD_LO12_NC": "debug/elf", + "elf.R_AARCH64_P32_TLSDESC_ADR_PAGE21": "debug/elf", + "elf.R_AARCH64_P32_TLSDESC_ADR_PREL21": "debug/elf", + "elf.R_AARCH64_P32_TLSDESC_CALL": "debug/elf", + "elf.R_AARCH64_P32_TLSDESC_LD32_LO12_NC": "debug/elf", + "elf.R_AARCH64_P32_TLSDESC_LD_PREL19": "debug/elf", + "elf.R_AARCH64_P32_TLSGD_ADD_LO12_NC": "debug/elf", + "elf.R_AARCH64_P32_TLSGD_ADR_PAGE21": "debug/elf", + "elf.R_AARCH64_P32_TLSIE_ADR_GOTTPREL_PAGE21": "debug/elf", + "elf.R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC": "debug/elf", + "elf.R_AARCH64_P32_TLSIE_LD_GOTTPREL_PREL19": "debug/elf", + "elf.R_AARCH64_P32_TLSLE_ADD_TPREL_HI12": "debug/elf", + "elf.R_AARCH64_P32_TLSLE_ADD_TPREL_LO12": "debug/elf", + "elf.R_AARCH64_P32_TLSLE_ADD_TPREL_LO12_NC": "debug/elf", + "elf.R_AARCH64_P32_TLSLE_MOVW_TPREL_G0": "debug/elf", + "elf.R_AARCH64_P32_TLSLE_MOVW_TPREL_G0_NC": "debug/elf", + "elf.R_AARCH64_P32_TLSLE_MOVW_TPREL_G1": "debug/elf", + "elf.R_AARCH64_P32_TLS_DTPMOD": "debug/elf", + "elf.R_AARCH64_P32_TLS_DTPREL": "debug/elf", + "elf.R_AARCH64_P32_TLS_TPREL": "debug/elf", + "elf.R_AARCH64_P32_TSTBR14": "debug/elf", + "elf.R_AARCH64_PREL16": "debug/elf", + "elf.R_AARCH64_PREL32": "debug/elf", + "elf.R_AARCH64_PREL64": "debug/elf", + "elf.R_AARCH64_RELATIVE": "debug/elf", + "elf.R_AARCH64_TLSDESC": "debug/elf", + "elf.R_AARCH64_TLSDESC_ADD": "debug/elf", + "elf.R_AARCH64_TLSDESC_ADD_LO12_NC": "debug/elf", + "elf.R_AARCH64_TLSDESC_ADR_PAGE21": "debug/elf", + "elf.R_AARCH64_TLSDESC_ADR_PREL21": "debug/elf", + "elf.R_AARCH64_TLSDESC_CALL": "debug/elf", + "elf.R_AARCH64_TLSDESC_LD64_LO12_NC": "debug/elf", + "elf.R_AARCH64_TLSDESC_LDR": "debug/elf", + "elf.R_AARCH64_TLSDESC_LD_PREL19": "debug/elf", + "elf.R_AARCH64_TLSDESC_OFF_G0_NC": "debug/elf", + "elf.R_AARCH64_TLSDESC_OFF_G1": "debug/elf", + "elf.R_AARCH64_TLSGD_ADD_LO12_NC": "debug/elf", + "elf.R_AARCH64_TLSGD_ADR_PAGE21": "debug/elf", + "elf.R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21": "debug/elf", + "elf.R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC": "debug/elf", + "elf.R_AARCH64_TLSIE_LD_GOTTPREL_PREL19": "debug/elf", + "elf.R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC": "debug/elf", + "elf.R_AARCH64_TLSIE_MOVW_GOTTPREL_G1": "debug/elf", + "elf.R_AARCH64_TLSLE_ADD_TPREL_HI12": "debug/elf", + "elf.R_AARCH64_TLSLE_ADD_TPREL_LO12": "debug/elf", + "elf.R_AARCH64_TLSLE_ADD_TPREL_LO12_NC": "debug/elf", + "elf.R_AARCH64_TLSLE_MOVW_TPREL_G0": "debug/elf", + "elf.R_AARCH64_TLSLE_MOVW_TPREL_G0_NC": "debug/elf", + "elf.R_AARCH64_TLSLE_MOVW_TPREL_G1": "debug/elf", + "elf.R_AARCH64_TLSLE_MOVW_TPREL_G1_NC": "debug/elf", + "elf.R_AARCH64_TLSLE_MOVW_TPREL_G2": "debug/elf", + "elf.R_AARCH64_TLS_DTPMOD64": "debug/elf", + "elf.R_AARCH64_TLS_DTPREL64": "debug/elf", + "elf.R_AARCH64_TLS_TPREL64": "debug/elf", + "elf.R_AARCH64_TSTBR14": "debug/elf", + "elf.R_ALPHA": "debug/elf", + "elf.R_ALPHA_BRADDR": "debug/elf", + "elf.R_ALPHA_COPY": "debug/elf", + "elf.R_ALPHA_GLOB_DAT": "debug/elf", + "elf.R_ALPHA_GPDISP": "debug/elf", + "elf.R_ALPHA_GPREL32": "debug/elf", + "elf.R_ALPHA_GPRELHIGH": "debug/elf", + "elf.R_ALPHA_GPRELLOW": "debug/elf", + "elf.R_ALPHA_GPVALUE": "debug/elf", + "elf.R_ALPHA_HINT": "debug/elf", + "elf.R_ALPHA_IMMED_BR_HI32": "debug/elf", + "elf.R_ALPHA_IMMED_GP_16": "debug/elf", + "elf.R_ALPHA_IMMED_GP_HI32": "debug/elf", + "elf.R_ALPHA_IMMED_LO32": "debug/elf", + "elf.R_ALPHA_IMMED_SCN_HI32": "debug/elf", + "elf.R_ALPHA_JMP_SLOT": "debug/elf", + "elf.R_ALPHA_LITERAL": "debug/elf", + "elf.R_ALPHA_LITUSE": "debug/elf", + "elf.R_ALPHA_NONE": "debug/elf", + "elf.R_ALPHA_OP_PRSHIFT": "debug/elf", + "elf.R_ALPHA_OP_PSUB": "debug/elf", + "elf.R_ALPHA_OP_PUSH": "debug/elf", + "elf.R_ALPHA_OP_STORE": "debug/elf", + "elf.R_ALPHA_REFLONG": "debug/elf", + "elf.R_ALPHA_REFQUAD": "debug/elf", + "elf.R_ALPHA_RELATIVE": "debug/elf", + "elf.R_ALPHA_SREL16": "debug/elf", + "elf.R_ALPHA_SREL32": "debug/elf", + "elf.R_ALPHA_SREL64": "debug/elf", + "elf.R_ARM": "debug/elf", + "elf.R_ARM_ABS12": "debug/elf", + "elf.R_ARM_ABS16": "debug/elf", + "elf.R_ARM_ABS32": "debug/elf", + "elf.R_ARM_ABS8": "debug/elf", + "elf.R_ARM_AMP_VCALL9": "debug/elf", + "elf.R_ARM_COPY": "debug/elf", + "elf.R_ARM_GLOB_DAT": "debug/elf", + "elf.R_ARM_GNU_VTENTRY": "debug/elf", + "elf.R_ARM_GNU_VTINHERIT": "debug/elf", + "elf.R_ARM_GOT32": "debug/elf", + "elf.R_ARM_GOTOFF": "debug/elf", + "elf.R_ARM_GOTPC": "debug/elf", + "elf.R_ARM_JUMP_SLOT": "debug/elf", + "elf.R_ARM_NONE": "debug/elf", + "elf.R_ARM_PC13": "debug/elf", + "elf.R_ARM_PC24": "debug/elf", + "elf.R_ARM_PLT32": "debug/elf", + "elf.R_ARM_RABS32": "debug/elf", + "elf.R_ARM_RBASE": "debug/elf", + "elf.R_ARM_REL32": "debug/elf", + "elf.R_ARM_RELATIVE": "debug/elf", + "elf.R_ARM_RPC24": "debug/elf", + "elf.R_ARM_RREL32": "debug/elf", + "elf.R_ARM_RSBREL32": "debug/elf", + "elf.R_ARM_SBREL32": "debug/elf", + "elf.R_ARM_SWI24": "debug/elf", + "elf.R_ARM_THM_ABS5": "debug/elf", + "elf.R_ARM_THM_PC22": "debug/elf", + "elf.R_ARM_THM_PC8": "debug/elf", + "elf.R_ARM_THM_RPC22": "debug/elf", + "elf.R_ARM_THM_SWI8": "debug/elf", + "elf.R_ARM_THM_XPC22": "debug/elf", + "elf.R_ARM_XPC25": "debug/elf", + "elf.R_INFO": "debug/elf", + "elf.R_INFO32": "debug/elf", + "elf.R_MIPS": "debug/elf", + "elf.R_MIPS_16": "debug/elf", + "elf.R_MIPS_26": "debug/elf", + "elf.R_MIPS_32": "debug/elf", + "elf.R_MIPS_64": "debug/elf", + "elf.R_MIPS_ADD_IMMEDIATE": "debug/elf", + "elf.R_MIPS_CALL16": "debug/elf", + "elf.R_MIPS_CALL_HI16": "debug/elf", + "elf.R_MIPS_CALL_LO16": "debug/elf", + "elf.R_MIPS_DELETE": "debug/elf", + "elf.R_MIPS_GOT16": "debug/elf", + "elf.R_MIPS_GOT_DISP": "debug/elf", + "elf.R_MIPS_GOT_HI16": "debug/elf", + "elf.R_MIPS_GOT_LO16": "debug/elf", + "elf.R_MIPS_GOT_OFST": "debug/elf", + "elf.R_MIPS_GOT_PAGE": "debug/elf", + "elf.R_MIPS_GPREL16": "debug/elf", + "elf.R_MIPS_GPREL32": "debug/elf", + "elf.R_MIPS_HI16": "debug/elf", + "elf.R_MIPS_HIGHER": "debug/elf", + "elf.R_MIPS_HIGHEST": "debug/elf", + "elf.R_MIPS_INSERT_A": "debug/elf", + "elf.R_MIPS_INSERT_B": "debug/elf", + "elf.R_MIPS_JALR": "debug/elf", + "elf.R_MIPS_LITERAL": "debug/elf", + "elf.R_MIPS_LO16": "debug/elf", + "elf.R_MIPS_NONE": "debug/elf", + "elf.R_MIPS_PC16": "debug/elf", + "elf.R_MIPS_PJUMP": "debug/elf", + "elf.R_MIPS_REL16": "debug/elf", + "elf.R_MIPS_REL32": "debug/elf", + "elf.R_MIPS_RELGOT": "debug/elf", + "elf.R_MIPS_SCN_DISP": "debug/elf", + "elf.R_MIPS_SHIFT5": "debug/elf", + "elf.R_MIPS_SHIFT6": "debug/elf", + "elf.R_MIPS_SUB": "debug/elf", + "elf.R_MIPS_TLS_DTPMOD32": "debug/elf", + "elf.R_MIPS_TLS_DTPMOD64": "debug/elf", + "elf.R_MIPS_TLS_DTPREL32": "debug/elf", + "elf.R_MIPS_TLS_DTPREL64": "debug/elf", + "elf.R_MIPS_TLS_DTPREL_HI16": "debug/elf", + "elf.R_MIPS_TLS_DTPREL_LO16": "debug/elf", + "elf.R_MIPS_TLS_GD": "debug/elf", + "elf.R_MIPS_TLS_GOTTPREL": "debug/elf", + "elf.R_MIPS_TLS_LDM": "debug/elf", + "elf.R_MIPS_TLS_TPREL32": "debug/elf", + "elf.R_MIPS_TLS_TPREL64": "debug/elf", + "elf.R_MIPS_TLS_TPREL_HI16": "debug/elf", + "elf.R_MIPS_TLS_TPREL_LO16": "debug/elf", + "elf.R_PPC": "debug/elf", + "elf.R_PPC64": "debug/elf", + "elf.R_PPC64_ADDR14": "debug/elf", + "elf.R_PPC64_ADDR14_BRNTAKEN": "debug/elf", + "elf.R_PPC64_ADDR14_BRTAKEN": "debug/elf", + "elf.R_PPC64_ADDR16": "debug/elf", + "elf.R_PPC64_ADDR16_DS": "debug/elf", + "elf.R_PPC64_ADDR16_HA": "debug/elf", + "elf.R_PPC64_ADDR16_HI": "debug/elf", + "elf.R_PPC64_ADDR16_HIGHER": "debug/elf", + "elf.R_PPC64_ADDR16_HIGHERA": "debug/elf", + "elf.R_PPC64_ADDR16_HIGHEST": "debug/elf", + "elf.R_PPC64_ADDR16_HIGHESTA": "debug/elf", + "elf.R_PPC64_ADDR16_LO": "debug/elf", + "elf.R_PPC64_ADDR16_LO_DS": "debug/elf", + "elf.R_PPC64_ADDR24": "debug/elf", + "elf.R_PPC64_ADDR32": "debug/elf", + "elf.R_PPC64_ADDR64": "debug/elf", + "elf.R_PPC64_DTPMOD64": "debug/elf", + "elf.R_PPC64_DTPREL16": "debug/elf", + "elf.R_PPC64_DTPREL16_DS": "debug/elf", + "elf.R_PPC64_DTPREL16_HA": "debug/elf", + "elf.R_PPC64_DTPREL16_HI": "debug/elf", + "elf.R_PPC64_DTPREL16_HIGHER": "debug/elf", + "elf.R_PPC64_DTPREL16_HIGHERA": "debug/elf", + "elf.R_PPC64_DTPREL16_HIGHEST": "debug/elf", + "elf.R_PPC64_DTPREL16_HIGHESTA": "debug/elf", + "elf.R_PPC64_DTPREL16_LO": "debug/elf", + "elf.R_PPC64_DTPREL16_LO_DS": "debug/elf", + "elf.R_PPC64_DTPREL64": "debug/elf", + "elf.R_PPC64_GOT16": "debug/elf", + "elf.R_PPC64_GOT16_DS": "debug/elf", + "elf.R_PPC64_GOT16_HA": "debug/elf", + "elf.R_PPC64_GOT16_HI": "debug/elf", + "elf.R_PPC64_GOT16_LO": "debug/elf", + "elf.R_PPC64_GOT16_LO_DS": "debug/elf", + "elf.R_PPC64_GOT_DTPREL16_DS": "debug/elf", + "elf.R_PPC64_GOT_DTPREL16_HA": "debug/elf", + "elf.R_PPC64_GOT_DTPREL16_HI": "debug/elf", + "elf.R_PPC64_GOT_DTPREL16_LO_DS": "debug/elf", + "elf.R_PPC64_GOT_TLSGD16": "debug/elf", + "elf.R_PPC64_GOT_TLSGD16_HA": "debug/elf", + "elf.R_PPC64_GOT_TLSGD16_HI": "debug/elf", + "elf.R_PPC64_GOT_TLSGD16_LO": "debug/elf", + "elf.R_PPC64_GOT_TLSLD16": "debug/elf", + "elf.R_PPC64_GOT_TLSLD16_HA": "debug/elf", + "elf.R_PPC64_GOT_TLSLD16_HI": "debug/elf", + "elf.R_PPC64_GOT_TLSLD16_LO": "debug/elf", + "elf.R_PPC64_GOT_TPREL16_DS": "debug/elf", + "elf.R_PPC64_GOT_TPREL16_HA": "debug/elf", + "elf.R_PPC64_GOT_TPREL16_HI": "debug/elf", + "elf.R_PPC64_GOT_TPREL16_LO_DS": "debug/elf", + "elf.R_PPC64_JMP_SLOT": "debug/elf", + "elf.R_PPC64_NONE": "debug/elf", + "elf.R_PPC64_REL14": "debug/elf", + "elf.R_PPC64_REL14_BRNTAKEN": "debug/elf", + "elf.R_PPC64_REL14_BRTAKEN": "debug/elf", + "elf.R_PPC64_REL16": "debug/elf", + "elf.R_PPC64_REL16_HA": "debug/elf", + "elf.R_PPC64_REL16_HI": "debug/elf", + "elf.R_PPC64_REL16_LO": "debug/elf", + "elf.R_PPC64_REL24": "debug/elf", + "elf.R_PPC64_REL32": "debug/elf", + "elf.R_PPC64_REL64": "debug/elf", + "elf.R_PPC64_TLS": "debug/elf", + "elf.R_PPC64_TLSGD": "debug/elf", + "elf.R_PPC64_TLSLD": "debug/elf", + "elf.R_PPC64_TOC": "debug/elf", + "elf.R_PPC64_TOC16": "debug/elf", + "elf.R_PPC64_TOC16_DS": "debug/elf", + "elf.R_PPC64_TOC16_HA": "debug/elf", + "elf.R_PPC64_TOC16_HI": "debug/elf", + "elf.R_PPC64_TOC16_LO": "debug/elf", + "elf.R_PPC64_TOC16_LO_DS": "debug/elf", + "elf.R_PPC64_TPREL16": "debug/elf", + "elf.R_PPC64_TPREL16_DS": "debug/elf", + "elf.R_PPC64_TPREL16_HA": "debug/elf", + "elf.R_PPC64_TPREL16_HI": "debug/elf", + "elf.R_PPC64_TPREL16_HIGHER": "debug/elf", + "elf.R_PPC64_TPREL16_HIGHERA": "debug/elf", + "elf.R_PPC64_TPREL16_HIGHEST": "debug/elf", + "elf.R_PPC64_TPREL16_HIGHESTA": "debug/elf", + "elf.R_PPC64_TPREL16_LO": "debug/elf", + "elf.R_PPC64_TPREL16_LO_DS": "debug/elf", + "elf.R_PPC64_TPREL64": "debug/elf", + "elf.R_PPC_ADDR14": "debug/elf", + "elf.R_PPC_ADDR14_BRNTAKEN": "debug/elf", + "elf.R_PPC_ADDR14_BRTAKEN": "debug/elf", + "elf.R_PPC_ADDR16": "debug/elf", + "elf.R_PPC_ADDR16_HA": "debug/elf", + "elf.R_PPC_ADDR16_HI": "debug/elf", + "elf.R_PPC_ADDR16_LO": "debug/elf", + "elf.R_PPC_ADDR24": "debug/elf", + "elf.R_PPC_ADDR32": "debug/elf", + "elf.R_PPC_COPY": "debug/elf", + "elf.R_PPC_DTPMOD32": "debug/elf", + "elf.R_PPC_DTPREL16": "debug/elf", + "elf.R_PPC_DTPREL16_HA": "debug/elf", + "elf.R_PPC_DTPREL16_HI": "debug/elf", + "elf.R_PPC_DTPREL16_LO": "debug/elf", + "elf.R_PPC_DTPREL32": "debug/elf", + "elf.R_PPC_EMB_BIT_FLD": "debug/elf", + "elf.R_PPC_EMB_MRKREF": "debug/elf", + "elf.R_PPC_EMB_NADDR16": "debug/elf", + "elf.R_PPC_EMB_NADDR16_HA": "debug/elf", + "elf.R_PPC_EMB_NADDR16_HI": "debug/elf", + "elf.R_PPC_EMB_NADDR16_LO": "debug/elf", + "elf.R_PPC_EMB_NADDR32": "debug/elf", + "elf.R_PPC_EMB_RELSDA": "debug/elf", + "elf.R_PPC_EMB_RELSEC16": "debug/elf", + "elf.R_PPC_EMB_RELST_HA": "debug/elf", + "elf.R_PPC_EMB_RELST_HI": "debug/elf", + "elf.R_PPC_EMB_RELST_LO": "debug/elf", + "elf.R_PPC_EMB_SDA21": "debug/elf", + "elf.R_PPC_EMB_SDA2I16": "debug/elf", + "elf.R_PPC_EMB_SDA2REL": "debug/elf", + "elf.R_PPC_EMB_SDAI16": "debug/elf", + "elf.R_PPC_GLOB_DAT": "debug/elf", + "elf.R_PPC_GOT16": "debug/elf", + "elf.R_PPC_GOT16_HA": "debug/elf", + "elf.R_PPC_GOT16_HI": "debug/elf", + "elf.R_PPC_GOT16_LO": "debug/elf", + "elf.R_PPC_GOT_TLSGD16": "debug/elf", + "elf.R_PPC_GOT_TLSGD16_HA": "debug/elf", + "elf.R_PPC_GOT_TLSGD16_HI": "debug/elf", + "elf.R_PPC_GOT_TLSGD16_LO": "debug/elf", + "elf.R_PPC_GOT_TLSLD16": "debug/elf", + "elf.R_PPC_GOT_TLSLD16_HA": "debug/elf", + "elf.R_PPC_GOT_TLSLD16_HI": "debug/elf", + "elf.R_PPC_GOT_TLSLD16_LO": "debug/elf", + "elf.R_PPC_GOT_TPREL16": "debug/elf", + "elf.R_PPC_GOT_TPREL16_HA": "debug/elf", + "elf.R_PPC_GOT_TPREL16_HI": "debug/elf", + "elf.R_PPC_GOT_TPREL16_LO": "debug/elf", + "elf.R_PPC_JMP_SLOT": "debug/elf", + "elf.R_PPC_LOCAL24PC": "debug/elf", + "elf.R_PPC_NONE": "debug/elf", + "elf.R_PPC_PLT16_HA": "debug/elf", + "elf.R_PPC_PLT16_HI": "debug/elf", + "elf.R_PPC_PLT16_LO": "debug/elf", + "elf.R_PPC_PLT32": "debug/elf", + "elf.R_PPC_PLTREL24": "debug/elf", + "elf.R_PPC_PLTREL32": "debug/elf", + "elf.R_PPC_REL14": "debug/elf", + "elf.R_PPC_REL14_BRNTAKEN": "debug/elf", + "elf.R_PPC_REL14_BRTAKEN": "debug/elf", + "elf.R_PPC_REL24": "debug/elf", + "elf.R_PPC_REL32": "debug/elf", + "elf.R_PPC_RELATIVE": "debug/elf", + "elf.R_PPC_SDAREL16": "debug/elf", + "elf.R_PPC_SECTOFF": "debug/elf", + "elf.R_PPC_SECTOFF_HA": "debug/elf", + "elf.R_PPC_SECTOFF_HI": "debug/elf", + "elf.R_PPC_SECTOFF_LO": "debug/elf", + "elf.R_PPC_TLS": "debug/elf", + "elf.R_PPC_TPREL16": "debug/elf", + "elf.R_PPC_TPREL16_HA": "debug/elf", + "elf.R_PPC_TPREL16_HI": "debug/elf", + "elf.R_PPC_TPREL16_LO": "debug/elf", + "elf.R_PPC_TPREL32": "debug/elf", + "elf.R_PPC_UADDR16": "debug/elf", + "elf.R_PPC_UADDR32": "debug/elf", + "elf.R_SPARC": "debug/elf", + "elf.R_SPARC_10": "debug/elf", + "elf.R_SPARC_11": "debug/elf", + "elf.R_SPARC_13": "debug/elf", + "elf.R_SPARC_16": "debug/elf", + "elf.R_SPARC_22": "debug/elf", + "elf.R_SPARC_32": "debug/elf", + "elf.R_SPARC_5": "debug/elf", + "elf.R_SPARC_6": "debug/elf", + "elf.R_SPARC_64": "debug/elf", + "elf.R_SPARC_7": "debug/elf", + "elf.R_SPARC_8": "debug/elf", + "elf.R_SPARC_COPY": "debug/elf", + "elf.R_SPARC_DISP16": "debug/elf", + "elf.R_SPARC_DISP32": "debug/elf", + "elf.R_SPARC_DISP64": "debug/elf", + "elf.R_SPARC_DISP8": "debug/elf", + "elf.R_SPARC_GLOB_DAT": "debug/elf", + "elf.R_SPARC_GLOB_JMP": "debug/elf", + "elf.R_SPARC_GOT10": "debug/elf", + "elf.R_SPARC_GOT13": "debug/elf", + "elf.R_SPARC_GOT22": "debug/elf", + "elf.R_SPARC_H44": "debug/elf", + "elf.R_SPARC_HH22": "debug/elf", + "elf.R_SPARC_HI22": "debug/elf", + "elf.R_SPARC_HIPLT22": "debug/elf", + "elf.R_SPARC_HIX22": "debug/elf", + "elf.R_SPARC_HM10": "debug/elf", + "elf.R_SPARC_JMP_SLOT": "debug/elf", + "elf.R_SPARC_L44": "debug/elf", + "elf.R_SPARC_LM22": "debug/elf", + "elf.R_SPARC_LO10": "debug/elf", + "elf.R_SPARC_LOPLT10": "debug/elf", + "elf.R_SPARC_LOX10": "debug/elf", + "elf.R_SPARC_M44": "debug/elf", + "elf.R_SPARC_NONE": "debug/elf", + "elf.R_SPARC_OLO10": "debug/elf", + "elf.R_SPARC_PC10": "debug/elf", + "elf.R_SPARC_PC22": "debug/elf", + "elf.R_SPARC_PCPLT10": "debug/elf", + "elf.R_SPARC_PCPLT22": "debug/elf", + "elf.R_SPARC_PCPLT32": "debug/elf", + "elf.R_SPARC_PC_HH22": "debug/elf", + "elf.R_SPARC_PC_HM10": "debug/elf", + "elf.R_SPARC_PC_LM22": "debug/elf", + "elf.R_SPARC_PLT32": "debug/elf", + "elf.R_SPARC_PLT64": "debug/elf", + "elf.R_SPARC_REGISTER": "debug/elf", + "elf.R_SPARC_RELATIVE": "debug/elf", + "elf.R_SPARC_UA16": "debug/elf", + "elf.R_SPARC_UA32": "debug/elf", + "elf.R_SPARC_UA64": "debug/elf", + "elf.R_SPARC_WDISP16": "debug/elf", + "elf.R_SPARC_WDISP19": "debug/elf", + "elf.R_SPARC_WDISP22": "debug/elf", + "elf.R_SPARC_WDISP30": "debug/elf", + "elf.R_SPARC_WPLT30": "debug/elf", + "elf.R_SYM32": "debug/elf", + "elf.R_SYM64": "debug/elf", + "elf.R_TYPE32": "debug/elf", + "elf.R_TYPE64": "debug/elf", + "elf.R_X86_64": "debug/elf", + "elf.R_X86_64_16": "debug/elf", + "elf.R_X86_64_32": "debug/elf", + "elf.R_X86_64_32S": "debug/elf", + "elf.R_X86_64_64": "debug/elf", + "elf.R_X86_64_8": "debug/elf", + "elf.R_X86_64_COPY": "debug/elf", + "elf.R_X86_64_DTPMOD64": "debug/elf", + "elf.R_X86_64_DTPOFF32": "debug/elf", + "elf.R_X86_64_DTPOFF64": "debug/elf", + "elf.R_X86_64_GLOB_DAT": "debug/elf", + "elf.R_X86_64_GOT32": "debug/elf", + "elf.R_X86_64_GOTPCREL": "debug/elf", + "elf.R_X86_64_GOTTPOFF": "debug/elf", + "elf.R_X86_64_JMP_SLOT": "debug/elf", + "elf.R_X86_64_NONE": "debug/elf", + "elf.R_X86_64_PC16": "debug/elf", + "elf.R_X86_64_PC32": "debug/elf", + "elf.R_X86_64_PC8": "debug/elf", + "elf.R_X86_64_PLT32": "debug/elf", + "elf.R_X86_64_RELATIVE": "debug/elf", + "elf.R_X86_64_TLSGD": "debug/elf", + "elf.R_X86_64_TLSLD": "debug/elf", + "elf.R_X86_64_TPOFF32": "debug/elf", + "elf.R_X86_64_TPOFF64": "debug/elf", + "elf.Rel32": "debug/elf", + "elf.Rel64": "debug/elf", + "elf.Rela32": "debug/elf", + "elf.Rela64": "debug/elf", + "elf.SHF_ALLOC": "debug/elf", + "elf.SHF_COMPRESSED": "debug/elf", + "elf.SHF_EXECINSTR": "debug/elf", + "elf.SHF_GROUP": "debug/elf", + "elf.SHF_INFO_LINK": "debug/elf", + "elf.SHF_LINK_ORDER": "debug/elf", + "elf.SHF_MASKOS": "debug/elf", + "elf.SHF_MASKPROC": "debug/elf", + "elf.SHF_MERGE": "debug/elf", + "elf.SHF_OS_NONCONFORMING": "debug/elf", + "elf.SHF_STRINGS": "debug/elf", + "elf.SHF_TLS": "debug/elf", + "elf.SHF_WRITE": "debug/elf", + "elf.SHN_ABS": "debug/elf", + "elf.SHN_COMMON": "debug/elf", + "elf.SHN_HIOS": "debug/elf", + "elf.SHN_HIPROC": "debug/elf", + "elf.SHN_HIRESERVE": "debug/elf", + "elf.SHN_LOOS": "debug/elf", + "elf.SHN_LOPROC": "debug/elf", + "elf.SHN_LORESERVE": "debug/elf", + "elf.SHN_UNDEF": "debug/elf", + "elf.SHN_XINDEX": "debug/elf", + "elf.SHT_DYNAMIC": "debug/elf", + "elf.SHT_DYNSYM": "debug/elf", + "elf.SHT_FINI_ARRAY": "debug/elf", + "elf.SHT_GNU_ATTRIBUTES": "debug/elf", + "elf.SHT_GNU_HASH": "debug/elf", + "elf.SHT_GNU_LIBLIST": "debug/elf", + "elf.SHT_GNU_VERDEF": "debug/elf", + "elf.SHT_GNU_VERNEED": "debug/elf", + "elf.SHT_GNU_VERSYM": "debug/elf", + "elf.SHT_GROUP": "debug/elf", + "elf.SHT_HASH": "debug/elf", + "elf.SHT_HIOS": "debug/elf", + "elf.SHT_HIPROC": "debug/elf", + "elf.SHT_HIUSER": "debug/elf", + "elf.SHT_INIT_ARRAY": "debug/elf", + "elf.SHT_LOOS": "debug/elf", + "elf.SHT_LOPROC": "debug/elf", + "elf.SHT_LOUSER": "debug/elf", + "elf.SHT_NOBITS": "debug/elf", + "elf.SHT_NOTE": "debug/elf", + "elf.SHT_NULL": "debug/elf", + "elf.SHT_PREINIT_ARRAY": "debug/elf", + "elf.SHT_PROGBITS": "debug/elf", + "elf.SHT_REL": "debug/elf", + "elf.SHT_RELA": "debug/elf", + "elf.SHT_SHLIB": "debug/elf", + "elf.SHT_STRTAB": "debug/elf", + "elf.SHT_SYMTAB": "debug/elf", + "elf.SHT_SYMTAB_SHNDX": "debug/elf", + "elf.STB_GLOBAL": "debug/elf", + "elf.STB_HIOS": "debug/elf", + "elf.STB_HIPROC": "debug/elf", + "elf.STB_LOCAL": "debug/elf", + "elf.STB_LOOS": "debug/elf", + "elf.STB_LOPROC": "debug/elf", + "elf.STB_WEAK": "debug/elf", + "elf.STT_COMMON": "debug/elf", + "elf.STT_FILE": "debug/elf", + "elf.STT_FUNC": "debug/elf", + "elf.STT_HIOS": "debug/elf", + "elf.STT_HIPROC": "debug/elf", + "elf.STT_LOOS": "debug/elf", + "elf.STT_LOPROC": "debug/elf", + "elf.STT_NOTYPE": "debug/elf", + "elf.STT_OBJECT": "debug/elf", + "elf.STT_SECTION": "debug/elf", + "elf.STT_TLS": "debug/elf", + "elf.STV_DEFAULT": "debug/elf", + "elf.STV_HIDDEN": "debug/elf", + "elf.STV_INTERNAL": "debug/elf", + "elf.STV_PROTECTED": "debug/elf", + "elf.ST_BIND": "debug/elf", + "elf.ST_INFO": "debug/elf", + "elf.ST_TYPE": "debug/elf", + "elf.ST_VISIBILITY": "debug/elf", + "elf.Section": "debug/elf", + "elf.Section32": "debug/elf", + "elf.Section64": "debug/elf", + "elf.SectionFlag": "debug/elf", + "elf.SectionHeader": "debug/elf", + "elf.SectionIndex": "debug/elf", + "elf.SectionType": "debug/elf", + "elf.Sym32": "debug/elf", + "elf.Sym32Size": "debug/elf", + "elf.Sym64": "debug/elf", + "elf.Sym64Size": "debug/elf", + "elf.SymBind": "debug/elf", + "elf.SymType": "debug/elf", + "elf.SymVis": "debug/elf", + "elf.Symbol": "debug/elf", + "elf.Type": "debug/elf", + "elf.Version": "debug/elf", + "elliptic.Curve": "crypto/elliptic", + "elliptic.CurveParams": "crypto/elliptic", + "elliptic.GenerateKey": "crypto/elliptic", + "elliptic.Marshal": "crypto/elliptic", + "elliptic.P224": "crypto/elliptic", + "elliptic.P256": "crypto/elliptic", + "elliptic.P384": "crypto/elliptic", + "elliptic.P521": "crypto/elliptic", + "elliptic.Unmarshal": "crypto/elliptic", + "encoding.BinaryMarshaler": "encoding", + "encoding.BinaryUnmarshaler": "encoding", + "encoding.TextMarshaler": "encoding", + "encoding.TextUnmarshaler": "encoding", + "errors.New": "errors", + "exec.Cmd": "os/exec", + "exec.Command": "os/exec", + "exec.CommandContext": "os/exec", + "exec.ErrNotFound": "os/exec", + "exec.Error": "os/exec", + "exec.ExitError": "os/exec", + "exec.LookPath": "os/exec", + "expvar.Do": "expvar", + "expvar.Float": "expvar", + "expvar.Func": "expvar", + "expvar.Get": "expvar", + "expvar.Int": "expvar", + "expvar.KeyValue": "expvar", + "expvar.Map": "expvar", + "expvar.NewFloat": "expvar", + "expvar.NewInt": "expvar", + "expvar.NewMap": "expvar", + "expvar.NewString": "expvar", + "expvar.Publish": "expvar", + "expvar.String": "expvar", + "expvar.Var": "expvar", + "fcgi.ErrConnClosed": "net/http/fcgi", + "fcgi.ErrRequestAborted": "net/http/fcgi", + "fcgi.Serve": "net/http/fcgi", + "filepath.Abs": "path/filepath", + "filepath.Base": "path/filepath", + "filepath.Clean": "path/filepath", + "filepath.Dir": "path/filepath", + "filepath.ErrBadPattern": "path/filepath", + "filepath.EvalSymlinks": "path/filepath", + "filepath.Ext": "path/filepath", + "filepath.FromSlash": "path/filepath", + "filepath.Glob": "path/filepath", + "filepath.HasPrefix": "path/filepath", + "filepath.IsAbs": "path/filepath", + "filepath.Join": "path/filepath", + "filepath.ListSeparator": "path/filepath", + "filepath.Match": "path/filepath", + "filepath.Rel": "path/filepath", + "filepath.Separator": "path/filepath", + "filepath.SkipDir": "path/filepath", + "filepath.Split": "path/filepath", + "filepath.SplitList": "path/filepath", + "filepath.ToSlash": "path/filepath", + "filepath.VolumeName": "path/filepath", + "filepath.Walk": "path/filepath", + "filepath.WalkFunc": "path/filepath", + "flag.Arg": "flag", + "flag.Args": "flag", + "flag.Bool": "flag", + "flag.BoolVar": "flag", + "flag.CommandLine": "flag", + "flag.ContinueOnError": "flag", + "flag.Duration": "flag", + "flag.DurationVar": "flag", + "flag.ErrHelp": "flag", + "flag.ErrorHandling": "flag", + "flag.ExitOnError": "flag", + "flag.Flag": "flag", + "flag.FlagSet": "flag", + "flag.Float64": "flag", + "flag.Float64Var": "flag", + "flag.Getter": "flag", + "flag.Int": "flag", + "flag.Int64": "flag", + "flag.Int64Var": "flag", + "flag.IntVar": "flag", + "flag.Lookup": "flag", + "flag.NArg": "flag", + "flag.NFlag": "flag", + "flag.NewFlagSet": "flag", + "flag.PanicOnError": "flag", + "flag.Parse": "flag", + "flag.Parsed": "flag", + "flag.PrintDefaults": "flag", + "flag.Set": "flag", + "flag.String": "flag", + "flag.StringVar": "flag", + "flag.Uint": "flag", + "flag.Uint64": "flag", + "flag.Uint64Var": "flag", + "flag.UintVar": "flag", + "flag.UnquoteUsage": "flag", + "flag.Usage": "flag", + "flag.Value": "flag", + "flag.Var": "flag", + "flag.Visit": "flag", + "flag.VisitAll": "flag", + "flate.BestCompression": "compress/flate", + "flate.BestSpeed": "compress/flate", + "flate.CorruptInputError": "compress/flate", + "flate.DefaultCompression": "compress/flate", + "flate.HuffmanOnly": "compress/flate", + "flate.InternalError": "compress/flate", + "flate.NewReader": "compress/flate", + "flate.NewReaderDict": "compress/flate", + "flate.NewWriter": "compress/flate", + "flate.NewWriterDict": "compress/flate", + "flate.NoCompression": "compress/flate", + "flate.ReadError": "compress/flate", + "flate.Reader": "compress/flate", + "flate.Resetter": "compress/flate", + "flate.WriteError": "compress/flate", + "flate.Writer": "compress/flate", + "fmt.Errorf": "fmt", + "fmt.Formatter": "fmt", + "fmt.Fprint": "fmt", + "fmt.Fprintf": "fmt", + "fmt.Fprintln": "fmt", + "fmt.Fscan": "fmt", + "fmt.Fscanf": "fmt", + "fmt.Fscanln": "fmt", + "fmt.GoStringer": "fmt", + "fmt.Print": "fmt", + "fmt.Printf": "fmt", + "fmt.Println": "fmt", + "fmt.Scan": "fmt", + "fmt.ScanState": "fmt", + "fmt.Scanf": "fmt", + "fmt.Scanln": "fmt", + "fmt.Scanner": "fmt", + "fmt.Sprint": "fmt", + "fmt.Sprintf": "fmt", + "fmt.Sprintln": "fmt", + "fmt.Sscan": "fmt", + "fmt.Sscanf": "fmt", + "fmt.Sscanln": "fmt", + "fmt.State": "fmt", + "fmt.Stringer": "fmt", + "fnv.New32": "hash/fnv", + "fnv.New32a": "hash/fnv", + "fnv.New64": "hash/fnv", + "fnv.New64a": "hash/fnv", + "format.Node": "go/format", + "format.Source": "go/format", + "gif.Decode": "image/gif", + "gif.DecodeAll": "image/gif", + "gif.DecodeConfig": "image/gif", + "gif.DisposalBackground": "image/gif", + "gif.DisposalNone": "image/gif", + "gif.DisposalPrevious": "image/gif", + "gif.Encode": "image/gif", + "gif.EncodeAll": "image/gif", + "gif.GIF": "image/gif", + "gif.Options": "image/gif", + "gob.CommonType": "encoding/gob", + "gob.Decoder": "encoding/gob", + "gob.Encoder": "encoding/gob", + "gob.GobDecoder": "encoding/gob", + "gob.GobEncoder": "encoding/gob", + "gob.NewDecoder": "encoding/gob", + "gob.NewEncoder": "encoding/gob", + "gob.Register": "encoding/gob", + "gob.RegisterName": "encoding/gob", + "gosym.DecodingError": "debug/gosym", + "gosym.Func": "debug/gosym", + "gosym.LineTable": "debug/gosym", + "gosym.NewLineTable": "debug/gosym", + "gosym.NewTable": "debug/gosym", + "gosym.Obj": "debug/gosym", + "gosym.Sym": "debug/gosym", + "gosym.Table": "debug/gosym", + "gosym.UnknownFileError": "debug/gosym", + "gosym.UnknownLineError": "debug/gosym", + "gzip.BestCompression": "compress/gzip", + "gzip.BestSpeed": "compress/gzip", + "gzip.DefaultCompression": "compress/gzip", + "gzip.ErrChecksum": "compress/gzip", + "gzip.ErrHeader": "compress/gzip", + "gzip.Header": "compress/gzip", + "gzip.NewReader": "compress/gzip", + "gzip.NewWriter": "compress/gzip", + "gzip.NewWriterLevel": "compress/gzip", + "gzip.NoCompression": "compress/gzip", + "gzip.Reader": "compress/gzip", + "gzip.Writer": "compress/gzip", + "hash.Hash": "hash", + "hash.Hash32": "hash", + "hash.Hash64": "hash", + "heap.Fix": "container/heap", + "heap.Init": "container/heap", + "heap.Interface": "container/heap", + "heap.Pop": "container/heap", + "heap.Push": "container/heap", + "heap.Remove": "container/heap", + "hex.Decode": "encoding/hex", + "hex.DecodeString": "encoding/hex", + "hex.DecodedLen": "encoding/hex", + "hex.Dump": "encoding/hex", + "hex.Dumper": "encoding/hex", + "hex.Encode": "encoding/hex", + "hex.EncodeToString": "encoding/hex", + "hex.EncodedLen": "encoding/hex", + "hex.ErrLength": "encoding/hex", + "hex.InvalidByteError": "encoding/hex", + "hmac.Equal": "crypto/hmac", + "hmac.New": "crypto/hmac", + "html.EscapeString": "html", + "html.UnescapeString": "html", + "http.CanonicalHeaderKey": "net/http", + "http.Client": "net/http", + "http.CloseNotifier": "net/http", + "http.ConnState": "net/http", + "http.Cookie": "net/http", + "http.CookieJar": "net/http", + "http.DefaultClient": "net/http", + "http.DefaultMaxHeaderBytes": "net/http", + "http.DefaultMaxIdleConnsPerHost": "net/http", + "http.DefaultServeMux": "net/http", + "http.DefaultTransport": "net/http", + "http.DetectContentType": "net/http", + "http.Dir": "net/http", + "http.ErrBodyNotAllowed": "net/http", + "http.ErrBodyReadAfterClose": "net/http", + "http.ErrContentLength": "net/http", + "http.ErrHandlerTimeout": "net/http", + "http.ErrHeaderTooLong": "net/http", + "http.ErrHijacked": "net/http", + "http.ErrLineTooLong": "net/http", + "http.ErrMissingBoundary": "net/http", + "http.ErrMissingContentLength": "net/http", + "http.ErrMissingFile": "net/http", + "http.ErrNoCookie": "net/http", + "http.ErrNoLocation": "net/http", + "http.ErrNotMultipart": "net/http", + "http.ErrNotSupported": "net/http", + "http.ErrShortBody": "net/http", + "http.ErrSkipAltProtocol": "net/http", + "http.ErrUnexpectedTrailer": "net/http", + "http.ErrUseLastResponse": "net/http", + "http.ErrWriteAfterFlush": "net/http", + "http.Error": "net/http", + "http.File": "net/http", + "http.FileServer": "net/http", + "http.FileSystem": "net/http", + "http.Flusher": "net/http", + "http.Get": "net/http", + "http.Handle": "net/http", + "http.HandleFunc": "net/http", + "http.Handler": "net/http", + "http.HandlerFunc": "net/http", + "http.Head": "net/http", + "http.Header": "net/http", + "http.Hijacker": "net/http", + "http.ListenAndServe": "net/http", + "http.ListenAndServeTLS": "net/http", + "http.LocalAddrContextKey": "net/http", + "http.MaxBytesReader": "net/http", + "http.MethodConnect": "net/http", + "http.MethodDelete": "net/http", + "http.MethodGet": "net/http", + "http.MethodHead": "net/http", + "http.MethodOptions": "net/http", + "http.MethodPatch": "net/http", + "http.MethodPost": "net/http", + "http.MethodPut": "net/http", + "http.MethodTrace": "net/http", + "http.NewFileTransport": "net/http", + "http.NewRequest": "net/http", + "http.NewServeMux": "net/http", + "http.NotFound": "net/http", + "http.NotFoundHandler": "net/http", + "http.ParseHTTPVersion": "net/http", + "http.ParseTime": "net/http", + "http.Post": "net/http", + "http.PostForm": "net/http", + "http.ProtocolError": "net/http", + "http.ProxyFromEnvironment": "net/http", + "http.ProxyURL": "net/http", + "http.ReadRequest": "net/http", + "http.ReadResponse": "net/http", + "http.Redirect": "net/http", + "http.RedirectHandler": "net/http", + "http.Request": "net/http", + "http.Response": "net/http", + "http.ResponseWriter": "net/http", + "http.RoundTripper": "net/http", + "http.Serve": "net/http", + "http.ServeContent": "net/http", + "http.ServeFile": "net/http", + "http.ServeMux": "net/http", + "http.Server": "net/http", + "http.ServerContextKey": "net/http", + "http.SetCookie": "net/http", + "http.StateActive": "net/http", + "http.StateClosed": "net/http", + "http.StateHijacked": "net/http", + "http.StateIdle": "net/http", + "http.StateNew": "net/http", + "http.StatusAccepted": "net/http", + "http.StatusAlreadyReported": "net/http", + "http.StatusBadGateway": "net/http", + "http.StatusBadRequest": "net/http", + "http.StatusConflict": "net/http", + "http.StatusContinue": "net/http", + "http.StatusCreated": "net/http", + "http.StatusExpectationFailed": "net/http", + "http.StatusFailedDependency": "net/http", + "http.StatusForbidden": "net/http", + "http.StatusFound": "net/http", + "http.StatusGatewayTimeout": "net/http", + "http.StatusGone": "net/http", + "http.StatusHTTPVersionNotSupported": "net/http", + "http.StatusIMUsed": "net/http", + "http.StatusInsufficientStorage": "net/http", + "http.StatusInternalServerError": "net/http", + "http.StatusLengthRequired": "net/http", + "http.StatusLocked": "net/http", + "http.StatusLoopDetected": "net/http", + "http.StatusMethodNotAllowed": "net/http", + "http.StatusMovedPermanently": "net/http", + "http.StatusMultiStatus": "net/http", + "http.StatusMultipleChoices": "net/http", + "http.StatusNetworkAuthenticationRequired": "net/http", + "http.StatusNoContent": "net/http", + "http.StatusNonAuthoritativeInfo": "net/http", + "http.StatusNotAcceptable": "net/http", + "http.StatusNotExtended": "net/http", + "http.StatusNotFound": "net/http", + "http.StatusNotImplemented": "net/http", + "http.StatusNotModified": "net/http", + "http.StatusOK": "net/http", + "http.StatusPartialContent": "net/http", + "http.StatusPaymentRequired": "net/http", + "http.StatusPermanentRedirect": "net/http", + "http.StatusPreconditionFailed": "net/http", + "http.StatusPreconditionRequired": "net/http", + "http.StatusProcessing": "net/http", + "http.StatusProxyAuthRequired": "net/http", + "http.StatusRequestEntityTooLarge": "net/http", + "http.StatusRequestHeaderFieldsTooLarge": "net/http", + "http.StatusRequestTimeout": "net/http", + "http.StatusRequestURITooLong": "net/http", + "http.StatusRequestedRangeNotSatisfiable": "net/http", + "http.StatusResetContent": "net/http", + "http.StatusSeeOther": "net/http", + "http.StatusServiceUnavailable": "net/http", + "http.StatusSwitchingProtocols": "net/http", + "http.StatusTeapot": "net/http", + "http.StatusTemporaryRedirect": "net/http", + "http.StatusText": "net/http", + "http.StatusTooManyRequests": "net/http", + "http.StatusUnauthorized": "net/http", + "http.StatusUnavailableForLegalReasons": "net/http", + "http.StatusUnprocessableEntity": "net/http", + "http.StatusUnsupportedMediaType": "net/http", + "http.StatusUpgradeRequired": "net/http", + "http.StatusUseProxy": "net/http", + "http.StatusVariantAlsoNegotiates": "net/http", + "http.StripPrefix": "net/http", + "http.TimeFormat": "net/http", + "http.TimeoutHandler": "net/http", + "http.Transport": "net/http", + "httptest.DefaultRemoteAddr": "net/http/httptest", + "httptest.NewRecorder": "net/http/httptest", + "httptest.NewRequest": "net/http/httptest", + "httptest.NewServer": "net/http/httptest", + "httptest.NewTLSServer": "net/http/httptest", + "httptest.NewUnstartedServer": "net/http/httptest", + "httptest.ResponseRecorder": "net/http/httptest", + "httptest.Server": "net/http/httptest", + "httptrace.ClientTrace": "net/http/httptrace", + "httptrace.ContextClientTrace": "net/http/httptrace", + "httptrace.DNSDoneInfo": "net/http/httptrace", + "httptrace.DNSStartInfo": "net/http/httptrace", + "httptrace.GotConnInfo": "net/http/httptrace", + "httptrace.WithClientTrace": "net/http/httptrace", + "httptrace.WroteRequestInfo": "net/http/httptrace", + "httputil.BufferPool": "net/http/httputil", + "httputil.ClientConn": "net/http/httputil", + "httputil.DumpRequest": "net/http/httputil", + "httputil.DumpRequestOut": "net/http/httputil", + "httputil.DumpResponse": "net/http/httputil", + "httputil.ErrClosed": "net/http/httputil", + "httputil.ErrLineTooLong": "net/http/httputil", + "httputil.ErrPersistEOF": "net/http/httputil", + "httputil.ErrPipeline": "net/http/httputil", + "httputil.NewChunkedReader": "net/http/httputil", + "httputil.NewChunkedWriter": "net/http/httputil", + "httputil.NewClientConn": "net/http/httputil", + "httputil.NewProxyClientConn": "net/http/httputil", + "httputil.NewServerConn": "net/http/httputil", + "httputil.NewSingleHostReverseProxy": "net/http/httputil", + "httputil.ReverseProxy": "net/http/httputil", + "httputil.ServerConn": "net/http/httputil", + "image.Alpha": "image", + "image.Alpha16": "image", + "image.Black": "image", + "image.CMYK": "image", + "image.Config": "image", + "image.Decode": "image", + "image.DecodeConfig": "image", + "image.ErrFormat": "image", + "image.Gray": "image", + "image.Gray16": "image", + "image.Image": "image", + "image.NRGBA": "image", + "image.NRGBA64": "image", + "image.NYCbCrA": "image", + "image.NewAlpha": "image", + "image.NewAlpha16": "image", + "image.NewCMYK": "image", + "image.NewGray": "image", + "image.NewGray16": "image", + "image.NewNRGBA": "image", + "image.NewNRGBA64": "image", + "image.NewNYCbCrA": "image", + "image.NewPaletted": "image", + "image.NewRGBA": "image", + "image.NewRGBA64": "image", + "image.NewUniform": "image", + "image.NewYCbCr": "image", + "image.Opaque": "image", + "image.Paletted": "image", + "image.PalettedImage": "image", + "image.Point": "image", + "image.Pt": "image", + "image.RGBA": "image", + "image.RGBA64": "image", + "image.Rect": "image", + "image.Rectangle": "image", + "image.RegisterFormat": "image", + "image.Transparent": "image", + "image.Uniform": "image", + "image.White": "image", + "image.YCbCr": "image", + "image.YCbCrSubsampleRatio": "image", + "image.YCbCrSubsampleRatio410": "image", + "image.YCbCrSubsampleRatio411": "image", + "image.YCbCrSubsampleRatio420": "image", + "image.YCbCrSubsampleRatio422": "image", + "image.YCbCrSubsampleRatio440": "image", + "image.YCbCrSubsampleRatio444": "image", + "image.ZP": "image", + "image.ZR": "image", + "importer.Default": "go/importer", + "importer.For": "go/importer", + "importer.Lookup": "go/importer", + "io.ByteReader": "io", + "io.ByteScanner": "io", + "io.ByteWriter": "io", + "io.Closer": "io", + "io.Copy": "io", + "io.CopyBuffer": "io", + "io.CopyN": "io", + "io.EOF": "io", + "io.ErrClosedPipe": "io", + "io.ErrNoProgress": "io", + "io.ErrShortBuffer": "io", + "io.ErrShortWrite": "io", + "io.ErrUnexpectedEOF": "io", + "io.LimitReader": "io", + "io.LimitedReader": "io", + "io.MultiReader": "io", + "io.MultiWriter": "io", + "io.NewSectionReader": "io", + "io.Pipe": "io", + "io.PipeReader": "io", + "io.PipeWriter": "io", + "io.ReadAtLeast": "io", + "io.ReadCloser": "io", + "io.ReadFull": "io", + "io.ReadSeeker": "io", + "io.ReadWriteCloser": "io", + "io.ReadWriteSeeker": "io", + "io.ReadWriter": "io", + "io.Reader": "io", + "io.ReaderAt": "io", + "io.ReaderFrom": "io", + "io.RuneReader": "io", + "io.RuneScanner": "io", + "io.SectionReader": "io", + "io.SeekCurrent": "io", + "io.SeekEnd": "io", + "io.SeekStart": "io", + "io.Seeker": "io", + "io.TeeReader": "io", + "io.WriteCloser": "io", + "io.WriteSeeker": "io", + "io.WriteString": "io", + "io.Writer": "io", + "io.WriterAt": "io", + "io.WriterTo": "io", + "iotest.DataErrReader": "testing/iotest", + "iotest.ErrTimeout": "testing/iotest", + "iotest.HalfReader": "testing/iotest", + "iotest.NewReadLogger": "testing/iotest", + "iotest.NewWriteLogger": "testing/iotest", + "iotest.OneByteReader": "testing/iotest", + "iotest.TimeoutReader": "testing/iotest", + "iotest.TruncateWriter": "testing/iotest", + "ioutil.Discard": "io/ioutil", + "ioutil.NopCloser": "io/ioutil", + "ioutil.ReadAll": "io/ioutil", + "ioutil.ReadDir": "io/ioutil", + "ioutil.ReadFile": "io/ioutil", + "ioutil.TempDir": "io/ioutil", + "ioutil.TempFile": "io/ioutil", + "ioutil.WriteFile": "io/ioutil", + "jpeg.Decode": "image/jpeg", + "jpeg.DecodeConfig": "image/jpeg", + "jpeg.DefaultQuality": "image/jpeg", + "jpeg.Encode": "image/jpeg", + "jpeg.FormatError": "image/jpeg", + "jpeg.Options": "image/jpeg", + "jpeg.Reader": "image/jpeg", + "jpeg.UnsupportedError": "image/jpeg", + "json.Compact": "encoding/json", + "json.Decoder": "encoding/json", + "json.Delim": "encoding/json", + "json.Encoder": "encoding/json", + "json.HTMLEscape": "encoding/json", + "json.Indent": "encoding/json", + "json.InvalidUTF8Error": "encoding/json", + "json.InvalidUnmarshalError": "encoding/json", + "json.Marshal": "encoding/json", + "json.MarshalIndent": "encoding/json", + "json.Marshaler": "encoding/json", + "json.MarshalerError": "encoding/json", + "json.NewDecoder": "encoding/json", + "json.NewEncoder": "encoding/json", + "json.Number": "encoding/json", + "json.RawMessage": "encoding/json", + "json.SyntaxError": "encoding/json", + "json.Token": "encoding/json", + "json.Unmarshal": "encoding/json", + "json.UnmarshalFieldError": "encoding/json", + "json.UnmarshalTypeError": "encoding/json", + "json.Unmarshaler": "encoding/json", + "json.UnsupportedTypeError": "encoding/json", + "json.UnsupportedValueError": "encoding/json", + "jsonrpc.Dial": "net/rpc/jsonrpc", + "jsonrpc.NewClient": "net/rpc/jsonrpc", + "jsonrpc.NewClientCodec": "net/rpc/jsonrpc", + "jsonrpc.NewServerCodec": "net/rpc/jsonrpc", + "jsonrpc.ServeConn": "net/rpc/jsonrpc", + "list.Element": "container/list", + "list.List": "container/list", + "list.New": "container/list", + "log.Fatal": "log", + "log.Fatalf": "log", + "log.Fatalln": "log", + "log.Flags": "log", + "log.LUTC": "log", + "log.Ldate": "log", + "log.Llongfile": "log", + "log.Lmicroseconds": "log", + "log.Logger": "log", + "log.Lshortfile": "log", + "log.LstdFlags": "log", + "log.Ltime": "log", + "log.New": "log", + "log.Output": "log", + "log.Panic": "log", + "log.Panicf": "log", + "log.Panicln": "log", + "log.Prefix": "log", + "log.Print": "log", + "log.Printf": "log", + "log.Println": "log", + "log.SetFlags": "log", + "log.SetOutput": "log", + "log.SetPrefix": "log", + "lzw.LSB": "compress/lzw", + "lzw.MSB": "compress/lzw", + "lzw.NewReader": "compress/lzw", + "lzw.NewWriter": "compress/lzw", + "lzw.Order": "compress/lzw", + "macho.Cpu": "debug/macho", + "macho.Cpu386": "debug/macho", + "macho.CpuAmd64": "debug/macho", + "macho.CpuArm": "debug/macho", + "macho.CpuPpc": "debug/macho", + "macho.CpuPpc64": "debug/macho", + "macho.Dylib": "debug/macho", + "macho.DylibCmd": "debug/macho", + "macho.Dysymtab": "debug/macho", + "macho.DysymtabCmd": "debug/macho", + "macho.ErrNotFat": "debug/macho", + "macho.FatArch": "debug/macho", + "macho.FatArchHeader": "debug/macho", + "macho.FatFile": "debug/macho", + "macho.File": "debug/macho", + "macho.FileHeader": "debug/macho", + "macho.FormatError": "debug/macho", + "macho.Load": "debug/macho", + "macho.LoadBytes": "debug/macho", + "macho.LoadCmd": "debug/macho", + "macho.LoadCmdDylib": "debug/macho", + "macho.LoadCmdDylinker": "debug/macho", + "macho.LoadCmdDysymtab": "debug/macho", + "macho.LoadCmdSegment": "debug/macho", + "macho.LoadCmdSegment64": "debug/macho", + "macho.LoadCmdSymtab": "debug/macho", + "macho.LoadCmdThread": "debug/macho", + "macho.LoadCmdUnixThread": "debug/macho", + "macho.Magic32": "debug/macho", + "macho.Magic64": "debug/macho", + "macho.MagicFat": "debug/macho", + "macho.NewFatFile": "debug/macho", + "macho.NewFile": "debug/macho", + "macho.Nlist32": "debug/macho", + "macho.Nlist64": "debug/macho", + "macho.Open": "debug/macho", + "macho.OpenFat": "debug/macho", + "macho.Regs386": "debug/macho", + "macho.RegsAMD64": "debug/macho", + "macho.Section": "debug/macho", + "macho.Section32": "debug/macho", + "macho.Section64": "debug/macho", + "macho.SectionHeader": "debug/macho", + "macho.Segment": "debug/macho", + "macho.Segment32": "debug/macho", + "macho.Segment64": "debug/macho", + "macho.SegmentHeader": "debug/macho", + "macho.Symbol": "debug/macho", + "macho.Symtab": "debug/macho", + "macho.SymtabCmd": "debug/macho", + "macho.Thread": "debug/macho", + "macho.Type": "debug/macho", + "macho.TypeBundle": "debug/macho", + "macho.TypeDylib": "debug/macho", + "macho.TypeExec": "debug/macho", + "macho.TypeObj": "debug/macho", + "mail.Address": "net/mail", + "mail.AddressParser": "net/mail", + "mail.ErrHeaderNotPresent": "net/mail", + "mail.Header": "net/mail", + "mail.Message": "net/mail", + "mail.ParseAddress": "net/mail", + "mail.ParseAddressList": "net/mail", + "mail.ReadMessage": "net/mail", + "math.Abs": "math", + "math.Acos": "math", + "math.Acosh": "math", + "math.Asin": "math", + "math.Asinh": "math", + "math.Atan": "math", + "math.Atan2": "math", + "math.Atanh": "math", + "math.Cbrt": "math", + "math.Ceil": "math", + "math.Copysign": "math", + "math.Cos": "math", + "math.Cosh": "math", + "math.Dim": "math", + "math.E": "math", + "math.Erf": "math", + "math.Erfc": "math", + "math.Exp": "math", + "math.Exp2": "math", + "math.Expm1": "math", + "math.Float32bits": "math", + "math.Float32frombits": "math", + "math.Float64bits": "math", + "math.Float64frombits": "math", + "math.Floor": "math", + "math.Frexp": "math", + "math.Gamma": "math", + "math.Hypot": "math", + "math.Ilogb": "math", + "math.Inf": "math", + "math.IsInf": "math", + "math.IsNaN": "math", + "math.J0": "math", + "math.J1": "math", + "math.Jn": "math", + "math.Ldexp": "math", + "math.Lgamma": "math", + "math.Ln10": "math", + "math.Ln2": "math", + "math.Log": "math", + "math.Log10": "math", + "math.Log10E": "math", + "math.Log1p": "math", + "math.Log2": "math", + "math.Log2E": "math", + "math.Logb": "math", + "math.Max": "math", + "math.MaxFloat32": "math", + "math.MaxFloat64": "math", + "math.MaxInt16": "math", + "math.MaxInt32": "math", + "math.MaxInt64": "math", + "math.MaxInt8": "math", + "math.MaxUint16": "math", + "math.MaxUint32": "math", + "math.MaxUint64": "math", + "math.MaxUint8": "math", + "math.Min": "math", + "math.MinInt16": "math", + "math.MinInt32": "math", + "math.MinInt64": "math", + "math.MinInt8": "math", + "math.Mod": "math", + "math.Modf": "math", + "math.NaN": "math", + "math.Nextafter": "math", + "math.Nextafter32": "math", + "math.Phi": "math", + "math.Pi": "math", + "math.Pow": "math", + "math.Pow10": "math", + "math.Remainder": "math", + "math.Signbit": "math", + "math.Sin": "math", + "math.Sincos": "math", + "math.Sinh": "math", + "math.SmallestNonzeroFloat32": "math", + "math.SmallestNonzeroFloat64": "math", + "math.Sqrt": "math", + "math.Sqrt2": "math", + "math.SqrtE": "math", + "math.SqrtPhi": "math", + "math.SqrtPi": "math", + "math.Tan": "math", + "math.Tanh": "math", + "math.Trunc": "math", + "math.Y0": "math", + "math.Y1": "math", + "math.Yn": "math", + "md5.BlockSize": "crypto/md5", + "md5.New": "crypto/md5", + "md5.Size": "crypto/md5", + "md5.Sum": "crypto/md5", + "mime.AddExtensionType": "mime", + "mime.BEncoding": "mime", + "mime.ExtensionsByType": "mime", + "mime.FormatMediaType": "mime", + "mime.ParseMediaType": "mime", + "mime.QEncoding": "mime", + "mime.TypeByExtension": "mime", + "mime.WordDecoder": "mime", + "mime.WordEncoder": "mime", + "multipart.File": "mime/multipart", + "multipart.FileHeader": "mime/multipart", + "multipart.Form": "mime/multipart", + "multipart.NewReader": "mime/multipart", + "multipart.NewWriter": "mime/multipart", + "multipart.Part": "mime/multipart", + "multipart.Reader": "mime/multipart", + "multipart.Writer": "mime/multipart", + "net.Addr": "net", + "net.AddrError": "net", + "net.CIDRMask": "net", + "net.Conn": "net", + "net.DNSConfigError": "net", + "net.DNSError": "net", + "net.Dial": "net", + "net.DialIP": "net", + "net.DialTCP": "net", + "net.DialTimeout": "net", + "net.DialUDP": "net", + "net.DialUnix": "net", + "net.Dialer": "net", + "net.ErrWriteToConnected": "net", + "net.Error": "net", + "net.FileConn": "net", + "net.FileListener": "net", + "net.FilePacketConn": "net", + "net.FlagBroadcast": "net", + "net.FlagLoopback": "net", + "net.FlagMulticast": "net", + "net.FlagPointToPoint": "net", + "net.FlagUp": "net", + "net.Flags": "net", + "net.HardwareAddr": "net", + "net.IP": "net", + "net.IPAddr": "net", + "net.IPConn": "net", + "net.IPMask": "net", + "net.IPNet": "net", + "net.IPv4": "net", + "net.IPv4Mask": "net", + "net.IPv4allrouter": "net", + "net.IPv4allsys": "net", + "net.IPv4bcast": "net", + "net.IPv4len": "net", + "net.IPv4zero": "net", + "net.IPv6interfacelocalallnodes": "net", + "net.IPv6len": "net", + "net.IPv6linklocalallnodes": "net", + "net.IPv6linklocalallrouters": "net", + "net.IPv6loopback": "net", + "net.IPv6unspecified": "net", + "net.IPv6zero": "net", + "net.Interface": "net", + "net.InterfaceAddrs": "net", + "net.InterfaceByIndex": "net", + "net.InterfaceByName": "net", + "net.Interfaces": "net", + "net.InvalidAddrError": "net", + "net.JoinHostPort": "net", + "net.Listen": "net", + "net.ListenIP": "net", + "net.ListenMulticastUDP": "net", + "net.ListenPacket": "net", + "net.ListenTCP": "net", + "net.ListenUDP": "net", + "net.ListenUnix": "net", + "net.ListenUnixgram": "net", + "net.Listener": "net", + "net.LookupAddr": "net", + "net.LookupCNAME": "net", + "net.LookupHost": "net", + "net.LookupIP": "net", + "net.LookupMX": "net", + "net.LookupNS": "net", + "net.LookupPort": "net", + "net.LookupSRV": "net", + "net.LookupTXT": "net", + "net.MX": "net", + "net.NS": "net", + "net.OpError": "net", + "net.PacketConn": "net", + "net.ParseCIDR": "net", + "net.ParseError": "net", + "net.ParseIP": "net", + "net.ParseMAC": "net", + "net.Pipe": "net", + "net.ResolveIPAddr": "net", + "net.ResolveTCPAddr": "net", + "net.ResolveUDPAddr": "net", + "net.ResolveUnixAddr": "net", + "net.SRV": "net", + "net.SplitHostPort": "net", + "net.TCPAddr": "net", + "net.TCPConn": "net", + "net.TCPListener": "net", + "net.UDPAddr": "net", + "net.UDPConn": "net", + "net.UnixAddr": "net", + "net.UnixConn": "net", + "net.UnixListener": "net", + "net.UnknownNetworkError": "net", + "os.Args": "os", + "os.Chdir": "os", + "os.Chmod": "os", + "os.Chown": "os", + "os.Chtimes": "os", + "os.Clearenv": "os", + "os.Create": "os", + "os.DevNull": "os", + "os.Environ": "os", + "os.ErrExist": "os", + "os.ErrInvalid": "os", + "os.ErrNotExist": "os", + "os.ErrPermission": "os", + "os.Exit": "os", + "os.Expand": "os", + "os.ExpandEnv": "os", + "os.File": "os", + "os.FileInfo": "os", + "os.FileMode": "os", + "os.FindProcess": "os", + "os.Getegid": "os", + "os.Getenv": "os", + "os.Geteuid": "os", + "os.Getgid": "os", + "os.Getgroups": "os", + "os.Getpagesize": "os", + "os.Getpid": "os", + "os.Getppid": "os", + "os.Getuid": "os", + "os.Getwd": "os", + "os.Hostname": "os", + "os.Interrupt": "os", + "os.IsExist": "os", + "os.IsNotExist": "os", + "os.IsPathSeparator": "os", + "os.IsPermission": "os", + "os.Kill": "os", + "os.Lchown": "os", + "os.Link": "os", + "os.LinkError": "os", + "os.LookupEnv": "os", + "os.Lstat": "os", + "os.Mkdir": "os", + "os.MkdirAll": "os", + "os.ModeAppend": "os", + "os.ModeCharDevice": "os", + "os.ModeDevice": "os", + "os.ModeDir": "os", + "os.ModeExclusive": "os", + "os.ModeNamedPipe": "os", + "os.ModePerm": "os", + "os.ModeSetgid": "os", + "os.ModeSetuid": "os", + "os.ModeSocket": "os", + "os.ModeSticky": "os", + "os.ModeSymlink": "os", + "os.ModeTemporary": "os", + "os.ModeType": "os", + "os.NewFile": "os", + "os.NewSyscallError": "os", + "os.O_APPEND": "os", + "os.O_CREATE": "os", + "os.O_EXCL": "os", + "os.O_RDONLY": "os", + "os.O_RDWR": "os", + "os.O_SYNC": "os", + "os.O_TRUNC": "os", + "os.O_WRONLY": "os", + "os.Open": "os", + "os.OpenFile": "os", + "os.PathError": "os", + "os.PathListSeparator": "os", + "os.PathSeparator": "os", + "os.Pipe": "os", + "os.ProcAttr": "os", + "os.Process": "os", + "os.ProcessState": "os", + "os.Readlink": "os", + "os.Remove": "os", + "os.RemoveAll": "os", + "os.Rename": "os", + "os.SEEK_CUR": "os", + "os.SEEK_END": "os", + "os.SEEK_SET": "os", + "os.SameFile": "os", + "os.Setenv": "os", + "os.Signal": "os", + "os.StartProcess": "os", + "os.Stat": "os", + "os.Stderr": "os", + "os.Stdin": "os", + "os.Stdout": "os", + "os.Symlink": "os", + "os.SyscallError": "os", + "os.TempDir": "os", + "os.Truncate": "os", + "os.Unsetenv": "os", + "palette.Plan9": "image/color/palette", + "palette.WebSafe": "image/color/palette", + "parse.ActionNode": "text/template/parse", + "parse.BoolNode": "text/template/parse", + "parse.BranchNode": "text/template/parse", + "parse.ChainNode": "text/template/parse", + "parse.CommandNode": "text/template/parse", + "parse.DotNode": "text/template/parse", + "parse.FieldNode": "text/template/parse", + "parse.IdentifierNode": "text/template/parse", + "parse.IfNode": "text/template/parse", + "parse.IsEmptyTree": "text/template/parse", + "parse.ListNode": "text/template/parse", + "parse.New": "text/template/parse", + "parse.NewIdentifier": "text/template/parse", + "parse.NilNode": "text/template/parse", + "parse.Node": "text/template/parse", + "parse.NodeAction": "text/template/parse", + "parse.NodeBool": "text/template/parse", + "parse.NodeChain": "text/template/parse", + "parse.NodeCommand": "text/template/parse", + "parse.NodeDot": "text/template/parse", + "parse.NodeField": "text/template/parse", + "parse.NodeIdentifier": "text/template/parse", + "parse.NodeIf": "text/template/parse", + "parse.NodeList": "text/template/parse", + "parse.NodeNil": "text/template/parse", + "parse.NodeNumber": "text/template/parse", + "parse.NodePipe": "text/template/parse", + "parse.NodeRange": "text/template/parse", + "parse.NodeString": "text/template/parse", + "parse.NodeTemplate": "text/template/parse", + "parse.NodeText": "text/template/parse", + "parse.NodeType": "text/template/parse", + "parse.NodeVariable": "text/template/parse", + "parse.NodeWith": "text/template/parse", + "parse.NumberNode": "text/template/parse", + "parse.Parse": "text/template/parse", + "parse.PipeNode": "text/template/parse", + "parse.Pos": "text/template/parse", + "parse.RangeNode": "text/template/parse", + "parse.StringNode": "text/template/parse", + "parse.TemplateNode": "text/template/parse", + "parse.TextNode": "text/template/parse", + "parse.Tree": "text/template/parse", + "parse.VariableNode": "text/template/parse", + "parse.WithNode": "text/template/parse", + "parser.AllErrors": "go/parser", + "parser.DeclarationErrors": "go/parser", + "parser.ImportsOnly": "go/parser", + "parser.Mode": "go/parser", + "parser.PackageClauseOnly": "go/parser", + "parser.ParseComments": "go/parser", + "parser.ParseDir": "go/parser", + "parser.ParseExpr": "go/parser", + "parser.ParseExprFrom": "go/parser", + "parser.ParseFile": "go/parser", + "parser.SpuriousErrors": "go/parser", + "parser.Trace": "go/parser", + "path.Base": "path", + "path.Clean": "path", + "path.Dir": "path", + "path.ErrBadPattern": "path", + "path.Ext": "path", + "path.IsAbs": "path", + "path.Join": "path", + "path.Match": "path", + "path.Split": "path", + "pe.COFFSymbol": "debug/pe", + "pe.COFFSymbolSize": "debug/pe", + "pe.DataDirectory": "debug/pe", + "pe.File": "debug/pe", + "pe.FileHeader": "debug/pe", + "pe.FormatError": "debug/pe", + "pe.IMAGE_FILE_MACHINE_AM33": "debug/pe", + "pe.IMAGE_FILE_MACHINE_AMD64": "debug/pe", + "pe.IMAGE_FILE_MACHINE_ARM": "debug/pe", + "pe.IMAGE_FILE_MACHINE_EBC": "debug/pe", + "pe.IMAGE_FILE_MACHINE_I386": "debug/pe", + "pe.IMAGE_FILE_MACHINE_IA64": "debug/pe", + "pe.IMAGE_FILE_MACHINE_M32R": "debug/pe", + "pe.IMAGE_FILE_MACHINE_MIPS16": "debug/pe", + "pe.IMAGE_FILE_MACHINE_MIPSFPU": "debug/pe", + "pe.IMAGE_FILE_MACHINE_MIPSFPU16": "debug/pe", + "pe.IMAGE_FILE_MACHINE_POWERPC": "debug/pe", + "pe.IMAGE_FILE_MACHINE_POWERPCFP": "debug/pe", + "pe.IMAGE_FILE_MACHINE_R4000": "debug/pe", + "pe.IMAGE_FILE_MACHINE_SH3": "debug/pe", + "pe.IMAGE_FILE_MACHINE_SH3DSP": "debug/pe", + "pe.IMAGE_FILE_MACHINE_SH4": "debug/pe", + "pe.IMAGE_FILE_MACHINE_SH5": "debug/pe", + "pe.IMAGE_FILE_MACHINE_THUMB": "debug/pe", + "pe.IMAGE_FILE_MACHINE_UNKNOWN": "debug/pe", + "pe.IMAGE_FILE_MACHINE_WCEMIPSV2": "debug/pe", + "pe.ImportDirectory": "debug/pe", + "pe.NewFile": "debug/pe", + "pe.Open": "debug/pe", + "pe.OptionalHeader32": "debug/pe", + "pe.OptionalHeader64": "debug/pe", + "pe.Section": "debug/pe", + "pe.SectionHeader": "debug/pe", + "pe.SectionHeader32": "debug/pe", + "pe.Symbol": "debug/pe", + "pem.Block": "encoding/pem", + "pem.Decode": "encoding/pem", + "pem.Encode": "encoding/pem", + "pem.EncodeToMemory": "encoding/pem", + "pkix.AlgorithmIdentifier": "crypto/x509/pkix", + "pkix.AttributeTypeAndValue": "crypto/x509/pkix", + "pkix.AttributeTypeAndValueSET": "crypto/x509/pkix", + "pkix.CertificateList": "crypto/x509/pkix", + "pkix.Extension": "crypto/x509/pkix", + "pkix.Name": "crypto/x509/pkix", + "pkix.RDNSequence": "crypto/x509/pkix", + "pkix.RelativeDistinguishedNameSET": "crypto/x509/pkix", + "pkix.RevokedCertificate": "crypto/x509/pkix", + "pkix.TBSCertificateList": "crypto/x509/pkix", + "plan9obj.File": "debug/plan9obj", + "plan9obj.FileHeader": "debug/plan9obj", + "plan9obj.Magic386": "debug/plan9obj", + "plan9obj.Magic64": "debug/plan9obj", + "plan9obj.MagicAMD64": "debug/plan9obj", + "plan9obj.MagicARM": "debug/plan9obj", + "plan9obj.NewFile": "debug/plan9obj", + "plan9obj.Open": "debug/plan9obj", + "plan9obj.Section": "debug/plan9obj", + "plan9obj.SectionHeader": "debug/plan9obj", + "plan9obj.Sym": "debug/plan9obj", + "png.BestCompression": "image/png", + "png.BestSpeed": "image/png", + "png.CompressionLevel": "image/png", + "png.Decode": "image/png", + "png.DecodeConfig": "image/png", + "png.DefaultCompression": "image/png", + "png.Encode": "image/png", + "png.Encoder": "image/png", + "png.FormatError": "image/png", + "png.NoCompression": "image/png", + "png.UnsupportedError": "image/png", + "pprof.Cmdline": "net/http/pprof", + "pprof.Handler": "net/http/pprof", + "pprof.Index": "net/http/pprof", + "pprof.Lookup": "runtime/pprof", + "pprof.NewProfile": "runtime/pprof", + // "pprof.Profile" is ambiguous + "pprof.Profiles": "runtime/pprof", + "pprof.StartCPUProfile": "runtime/pprof", + "pprof.StopCPUProfile": "runtime/pprof", + "pprof.Symbol": "net/http/pprof", + "pprof.Trace": "net/http/pprof", + "pprof.WriteHeapProfile": "runtime/pprof", + "printer.CommentedNode": "go/printer", + "printer.Config": "go/printer", + "printer.Fprint": "go/printer", + "printer.Mode": "go/printer", + "printer.RawFormat": "go/printer", + "printer.SourcePos": "go/printer", + "printer.TabIndent": "go/printer", + "printer.UseSpaces": "go/printer", + "quick.Check": "testing/quick", + "quick.CheckEqual": "testing/quick", + "quick.CheckEqualError": "testing/quick", + "quick.CheckError": "testing/quick", + "quick.Config": "testing/quick", + "quick.Generator": "testing/quick", + "quick.SetupError": "testing/quick", + "quick.Value": "testing/quick", + "quotedprintable.NewReader": "mime/quotedprintable", + "quotedprintable.NewWriter": "mime/quotedprintable", + "quotedprintable.Reader": "mime/quotedprintable", + "quotedprintable.Writer": "mime/quotedprintable", + "rand.ExpFloat64": "math/rand", + "rand.Float32": "math/rand", + "rand.Float64": "math/rand", + // "rand.Int" is ambiguous + "rand.Int31": "math/rand", + "rand.Int31n": "math/rand", + "rand.Int63": "math/rand", + "rand.Int63n": "math/rand", + "rand.Intn": "math/rand", + "rand.New": "math/rand", + "rand.NewSource": "math/rand", + "rand.NewZipf": "math/rand", + "rand.NormFloat64": "math/rand", + "rand.Perm": "math/rand", + "rand.Prime": "crypto/rand", + "rand.Rand": "math/rand", + // "rand.Read" is ambiguous + "rand.Reader": "crypto/rand", + "rand.Seed": "math/rand", + "rand.Source": "math/rand", + "rand.Uint32": "math/rand", + "rand.Zipf": "math/rand", + "rc4.Cipher": "crypto/rc4", + "rc4.KeySizeError": "crypto/rc4", + "rc4.NewCipher": "crypto/rc4", + "reflect.Append": "reflect", + "reflect.AppendSlice": "reflect", + "reflect.Array": "reflect", + "reflect.ArrayOf": "reflect", + "reflect.Bool": "reflect", + "reflect.BothDir": "reflect", + "reflect.Chan": "reflect", + "reflect.ChanDir": "reflect", + "reflect.ChanOf": "reflect", + "reflect.Complex128": "reflect", + "reflect.Complex64": "reflect", + "reflect.Copy": "reflect", + "reflect.DeepEqual": "reflect", + "reflect.Float32": "reflect", + "reflect.Float64": "reflect", + "reflect.Func": "reflect", + "reflect.FuncOf": "reflect", + "reflect.Indirect": "reflect", + "reflect.Int": "reflect", + "reflect.Int16": "reflect", + "reflect.Int32": "reflect", + "reflect.Int64": "reflect", + "reflect.Int8": "reflect", + "reflect.Interface": "reflect", + "reflect.Invalid": "reflect", + "reflect.Kind": "reflect", + "reflect.MakeChan": "reflect", + "reflect.MakeFunc": "reflect", + "reflect.MakeMap": "reflect", + "reflect.MakeSlice": "reflect", + "reflect.Map": "reflect", + "reflect.MapOf": "reflect", + "reflect.Method": "reflect", + "reflect.New": "reflect", + "reflect.NewAt": "reflect", + "reflect.Ptr": "reflect", + "reflect.PtrTo": "reflect", + "reflect.RecvDir": "reflect", + "reflect.Select": "reflect", + "reflect.SelectCase": "reflect", + "reflect.SelectDefault": "reflect", + "reflect.SelectDir": "reflect", + "reflect.SelectRecv": "reflect", + "reflect.SelectSend": "reflect", + "reflect.SendDir": "reflect", + "reflect.Slice": "reflect", + "reflect.SliceHeader": "reflect", + "reflect.SliceOf": "reflect", + "reflect.String": "reflect", + "reflect.StringHeader": "reflect", + "reflect.Struct": "reflect", + "reflect.StructField": "reflect", + "reflect.StructOf": "reflect", + "reflect.StructTag": "reflect", + "reflect.TypeOf": "reflect", + "reflect.Uint": "reflect", + "reflect.Uint16": "reflect", + "reflect.Uint32": "reflect", + "reflect.Uint64": "reflect", + "reflect.Uint8": "reflect", + "reflect.Uintptr": "reflect", + "reflect.UnsafePointer": "reflect", + "reflect.Value": "reflect", + "reflect.ValueError": "reflect", + "reflect.ValueOf": "reflect", + "reflect.Zero": "reflect", + "regexp.Compile": "regexp", + "regexp.CompilePOSIX": "regexp", + "regexp.Match": "regexp", + "regexp.MatchReader": "regexp", + "regexp.MatchString": "regexp", + "regexp.MustCompile": "regexp", + "regexp.MustCompilePOSIX": "regexp", + "regexp.QuoteMeta": "regexp", + "regexp.Regexp": "regexp", + "ring.New": "container/ring", + "ring.Ring": "container/ring", + "rpc.Accept": "net/rpc", + "rpc.Call": "net/rpc", + "rpc.Client": "net/rpc", + "rpc.ClientCodec": "net/rpc", + "rpc.DefaultDebugPath": "net/rpc", + "rpc.DefaultRPCPath": "net/rpc", + "rpc.DefaultServer": "net/rpc", + "rpc.Dial": "net/rpc", + "rpc.DialHTTP": "net/rpc", + "rpc.DialHTTPPath": "net/rpc", + "rpc.ErrShutdown": "net/rpc", + "rpc.HandleHTTP": "net/rpc", + "rpc.NewClient": "net/rpc", + "rpc.NewClientWithCodec": "net/rpc", + "rpc.NewServer": "net/rpc", + "rpc.Register": "net/rpc", + "rpc.RegisterName": "net/rpc", + "rpc.Request": "net/rpc", + "rpc.Response": "net/rpc", + "rpc.ServeCodec": "net/rpc", + "rpc.ServeConn": "net/rpc", + "rpc.ServeRequest": "net/rpc", + "rpc.Server": "net/rpc", + "rpc.ServerCodec": "net/rpc", + "rpc.ServerError": "net/rpc", + "rsa.CRTValue": "crypto/rsa", + "rsa.DecryptOAEP": "crypto/rsa", + "rsa.DecryptPKCS1v15": "crypto/rsa", + "rsa.DecryptPKCS1v15SessionKey": "crypto/rsa", + "rsa.EncryptOAEP": "crypto/rsa", + "rsa.EncryptPKCS1v15": "crypto/rsa", + "rsa.ErrDecryption": "crypto/rsa", + "rsa.ErrMessageTooLong": "crypto/rsa", + "rsa.ErrVerification": "crypto/rsa", + "rsa.GenerateKey": "crypto/rsa", + "rsa.GenerateMultiPrimeKey": "crypto/rsa", + "rsa.OAEPOptions": "crypto/rsa", + "rsa.PKCS1v15DecryptOptions": "crypto/rsa", + "rsa.PSSOptions": "crypto/rsa", + "rsa.PSSSaltLengthAuto": "crypto/rsa", + "rsa.PSSSaltLengthEqualsHash": "crypto/rsa", + "rsa.PrecomputedValues": "crypto/rsa", + "rsa.PrivateKey": "crypto/rsa", + "rsa.PublicKey": "crypto/rsa", + "rsa.SignPKCS1v15": "crypto/rsa", + "rsa.SignPSS": "crypto/rsa", + "rsa.VerifyPKCS1v15": "crypto/rsa", + "rsa.VerifyPSS": "crypto/rsa", + "runtime.BlockProfile": "runtime", + "runtime.BlockProfileRecord": "runtime", + "runtime.Breakpoint": "runtime", + "runtime.CPUProfile": "runtime", + "runtime.Caller": "runtime", + "runtime.Callers": "runtime", + "runtime.CallersFrames": "runtime", + "runtime.Compiler": "runtime", + "runtime.Error": "runtime", + "runtime.Frame": "runtime", + "runtime.Frames": "runtime", + "runtime.Func": "runtime", + "runtime.FuncForPC": "runtime", + "runtime.GC": "runtime", + "runtime.GOARCH": "runtime", + "runtime.GOMAXPROCS": "runtime", + "runtime.GOOS": "runtime", + "runtime.GOROOT": "runtime", + "runtime.Goexit": "runtime", + "runtime.GoroutineProfile": "runtime", + "runtime.Gosched": "runtime", + "runtime.KeepAlive": "runtime", + "runtime.LockOSThread": "runtime", + "runtime.MemProfile": "runtime", + "runtime.MemProfileRate": "runtime", + "runtime.MemProfileRecord": "runtime", + "runtime.MemStats": "runtime", + "runtime.NumCPU": "runtime", + "runtime.NumCgoCall": "runtime", + "runtime.NumGoroutine": "runtime", + "runtime.ReadMemStats": "runtime", + "runtime.ReadTrace": "runtime", + "runtime.SetBlockProfileRate": "runtime", + "runtime.SetCPUProfileRate": "runtime", + "runtime.SetCgoTraceback": "runtime", + "runtime.SetFinalizer": "runtime", + "runtime.Stack": "runtime", + "runtime.StackRecord": "runtime", + "runtime.StartTrace": "runtime", + "runtime.StopTrace": "runtime", + "runtime.ThreadCreateProfile": "runtime", + "runtime.TypeAssertionError": "runtime", + "runtime.UnlockOSThread": "runtime", + "runtime.Version": "runtime", + "scanner.Char": "text/scanner", + "scanner.Comment": "text/scanner", + "scanner.EOF": "text/scanner", + "scanner.Error": "go/scanner", + "scanner.ErrorHandler": "go/scanner", + "scanner.ErrorList": "go/scanner", + "scanner.Float": "text/scanner", + "scanner.GoTokens": "text/scanner", + "scanner.GoWhitespace": "text/scanner", + "scanner.Ident": "text/scanner", + "scanner.Int": "text/scanner", + "scanner.Mode": "go/scanner", + "scanner.Position": "text/scanner", + "scanner.PrintError": "go/scanner", + "scanner.RawString": "text/scanner", + "scanner.ScanChars": "text/scanner", + // "scanner.ScanComments" is ambiguous + "scanner.ScanFloats": "text/scanner", + "scanner.ScanIdents": "text/scanner", + "scanner.ScanInts": "text/scanner", + "scanner.ScanRawStrings": "text/scanner", + "scanner.ScanStrings": "text/scanner", + // "scanner.Scanner" is ambiguous + "scanner.SkipComments": "text/scanner", + "scanner.String": "text/scanner", + "scanner.TokenString": "text/scanner", + "sha1.BlockSize": "crypto/sha1", + "sha1.New": "crypto/sha1", + "sha1.Size": "crypto/sha1", + "sha1.Sum": "crypto/sha1", + "sha256.BlockSize": "crypto/sha256", + "sha256.New": "crypto/sha256", + "sha256.New224": "crypto/sha256", + "sha256.Size": "crypto/sha256", + "sha256.Size224": "crypto/sha256", + "sha256.Sum224": "crypto/sha256", + "sha256.Sum256": "crypto/sha256", + "sha512.BlockSize": "crypto/sha512", + "sha512.New": "crypto/sha512", + "sha512.New384": "crypto/sha512", + "sha512.New512_224": "crypto/sha512", + "sha512.New512_256": "crypto/sha512", + "sha512.Size": "crypto/sha512", + "sha512.Size224": "crypto/sha512", + "sha512.Size256": "crypto/sha512", + "sha512.Size384": "crypto/sha512", + "sha512.Sum384": "crypto/sha512", + "sha512.Sum512": "crypto/sha512", + "sha512.Sum512_224": "crypto/sha512", + "sha512.Sum512_256": "crypto/sha512", + "signal.Ignore": "os/signal", + "signal.Notify": "os/signal", + "signal.Reset": "os/signal", + "signal.Stop": "os/signal", + "smtp.Auth": "net/smtp", + "smtp.CRAMMD5Auth": "net/smtp", + "smtp.Client": "net/smtp", + "smtp.Dial": "net/smtp", + "smtp.NewClient": "net/smtp", + "smtp.PlainAuth": "net/smtp", + "smtp.SendMail": "net/smtp", + "smtp.ServerInfo": "net/smtp", + "sort.Float64Slice": "sort", + "sort.Float64s": "sort", + "sort.Float64sAreSorted": "sort", + "sort.IntSlice": "sort", + "sort.Interface": "sort", + "sort.Ints": "sort", + "sort.IntsAreSorted": "sort", + "sort.IsSorted": "sort", + "sort.Reverse": "sort", + "sort.Search": "sort", + "sort.SearchFloat64s": "sort", + "sort.SearchInts": "sort", + "sort.SearchStrings": "sort", + "sort.Sort": "sort", + "sort.Stable": "sort", + "sort.StringSlice": "sort", + "sort.Strings": "sort", + "sort.StringsAreSorted": "sort", + "sql.DB": "database/sql", + "sql.DBStats": "database/sql", + "sql.Drivers": "database/sql", + "sql.ErrNoRows": "database/sql", + "sql.ErrTxDone": "database/sql", + "sql.NullBool": "database/sql", + "sql.NullFloat64": "database/sql", + "sql.NullInt64": "database/sql", + "sql.NullString": "database/sql", + "sql.Open": "database/sql", + "sql.RawBytes": "database/sql", + "sql.Register": "database/sql", + "sql.Result": "database/sql", + "sql.Row": "database/sql", + "sql.Rows": "database/sql", + "sql.Scanner": "database/sql", + "sql.Stmt": "database/sql", + "sql.Tx": "database/sql", + "strconv.AppendBool": "strconv", + "strconv.AppendFloat": "strconv", + "strconv.AppendInt": "strconv", + "strconv.AppendQuote": "strconv", + "strconv.AppendQuoteRune": "strconv", + "strconv.AppendQuoteRuneToASCII": "strconv", + "strconv.AppendQuoteRuneToGraphic": "strconv", + "strconv.AppendQuoteToASCII": "strconv", + "strconv.AppendQuoteToGraphic": "strconv", + "strconv.AppendUint": "strconv", + "strconv.Atoi": "strconv", + "strconv.CanBackquote": "strconv", + "strconv.ErrRange": "strconv", + "strconv.ErrSyntax": "strconv", + "strconv.FormatBool": "strconv", + "strconv.FormatFloat": "strconv", + "strconv.FormatInt": "strconv", + "strconv.FormatUint": "strconv", + "strconv.IntSize": "strconv", + "strconv.IsGraphic": "strconv", + "strconv.IsPrint": "strconv", + "strconv.Itoa": "strconv", + "strconv.NumError": "strconv", + "strconv.ParseBool": "strconv", + "strconv.ParseFloat": "strconv", + "strconv.ParseInt": "strconv", + "strconv.ParseUint": "strconv", + "strconv.Quote": "strconv", + "strconv.QuoteRune": "strconv", + "strconv.QuoteRuneToASCII": "strconv", + "strconv.QuoteRuneToGraphic": "strconv", + "strconv.QuoteToASCII": "strconv", + "strconv.QuoteToGraphic": "strconv", + "strconv.Unquote": "strconv", + "strconv.UnquoteChar": "strconv", + "strings.Compare": "strings", + "strings.Contains": "strings", + "strings.ContainsAny": "strings", + "strings.ContainsRune": "strings", + "strings.Count": "strings", + "strings.EqualFold": "strings", + "strings.Fields": "strings", + "strings.FieldsFunc": "strings", + "strings.HasPrefix": "strings", + "strings.HasSuffix": "strings", + "strings.Index": "strings", + "strings.IndexAny": "strings", + "strings.IndexByte": "strings", + "strings.IndexFunc": "strings", + "strings.IndexRune": "strings", + "strings.Join": "strings", + "strings.LastIndex": "strings", + "strings.LastIndexAny": "strings", + "strings.LastIndexByte": "strings", + "strings.LastIndexFunc": "strings", + "strings.Map": "strings", + "strings.NewReader": "strings", + "strings.NewReplacer": "strings", + "strings.Reader": "strings", + "strings.Repeat": "strings", + "strings.Replace": "strings", + "strings.Replacer": "strings", + "strings.Split": "strings", + "strings.SplitAfter": "strings", + "strings.SplitAfterN": "strings", + "strings.SplitN": "strings", + "strings.Title": "strings", + "strings.ToLower": "strings", + "strings.ToLowerSpecial": "strings", + "strings.ToTitle": "strings", + "strings.ToTitleSpecial": "strings", + "strings.ToUpper": "strings", + "strings.ToUpperSpecial": "strings", + "strings.Trim": "strings", + "strings.TrimFunc": "strings", + "strings.TrimLeft": "strings", + "strings.TrimLeftFunc": "strings", + "strings.TrimPrefix": "strings", + "strings.TrimRight": "strings", + "strings.TrimRightFunc": "strings", + "strings.TrimSpace": "strings", + "strings.TrimSuffix": "strings", + "subtle.ConstantTimeByteEq": "crypto/subtle", + "subtle.ConstantTimeCompare": "crypto/subtle", + "subtle.ConstantTimeCopy": "crypto/subtle", + "subtle.ConstantTimeEq": "crypto/subtle", + "subtle.ConstantTimeLessOrEq": "crypto/subtle", + "subtle.ConstantTimeSelect": "crypto/subtle", + "suffixarray.Index": "index/suffixarray", + "suffixarray.New": "index/suffixarray", + "sync.Cond": "sync", + "sync.Locker": "sync", + "sync.Mutex": "sync", + "sync.NewCond": "sync", + "sync.Once": "sync", + "sync.Pool": "sync", + "sync.RWMutex": "sync", + "sync.WaitGroup": "sync", + "syntax.ClassNL": "regexp/syntax", + "syntax.Compile": "regexp/syntax", + "syntax.DotNL": "regexp/syntax", + "syntax.EmptyBeginLine": "regexp/syntax", + "syntax.EmptyBeginText": "regexp/syntax", + "syntax.EmptyEndLine": "regexp/syntax", + "syntax.EmptyEndText": "regexp/syntax", + "syntax.EmptyNoWordBoundary": "regexp/syntax", + "syntax.EmptyOp": "regexp/syntax", + "syntax.EmptyOpContext": "regexp/syntax", + "syntax.EmptyWordBoundary": "regexp/syntax", + "syntax.ErrInternalError": "regexp/syntax", + "syntax.ErrInvalidCharClass": "regexp/syntax", + "syntax.ErrInvalidCharRange": "regexp/syntax", + "syntax.ErrInvalidEscape": "regexp/syntax", + "syntax.ErrInvalidNamedCapture": "regexp/syntax", + "syntax.ErrInvalidPerlOp": "regexp/syntax", + "syntax.ErrInvalidRepeatOp": "regexp/syntax", + "syntax.ErrInvalidRepeatSize": "regexp/syntax", + "syntax.ErrInvalidUTF8": "regexp/syntax", + "syntax.ErrMissingBracket": "regexp/syntax", + "syntax.ErrMissingParen": "regexp/syntax", + "syntax.ErrMissingRepeatArgument": "regexp/syntax", + "syntax.ErrTrailingBackslash": "regexp/syntax", + "syntax.ErrUnexpectedParen": "regexp/syntax", + "syntax.Error": "regexp/syntax", + "syntax.ErrorCode": "regexp/syntax", + "syntax.Flags": "regexp/syntax", + "syntax.FoldCase": "regexp/syntax", + "syntax.Inst": "regexp/syntax", + "syntax.InstAlt": "regexp/syntax", + "syntax.InstAltMatch": "regexp/syntax", + "syntax.InstCapture": "regexp/syntax", + "syntax.InstEmptyWidth": "regexp/syntax", + "syntax.InstFail": "regexp/syntax", + "syntax.InstMatch": "regexp/syntax", + "syntax.InstNop": "regexp/syntax", + "syntax.InstOp": "regexp/syntax", + "syntax.InstRune": "regexp/syntax", + "syntax.InstRune1": "regexp/syntax", + "syntax.InstRuneAny": "regexp/syntax", + "syntax.InstRuneAnyNotNL": "regexp/syntax", + "syntax.IsWordChar": "regexp/syntax", + "syntax.Literal": "regexp/syntax", + "syntax.MatchNL": "regexp/syntax", + "syntax.NonGreedy": "regexp/syntax", + "syntax.OneLine": "regexp/syntax", + "syntax.Op": "regexp/syntax", + "syntax.OpAlternate": "regexp/syntax", + "syntax.OpAnyChar": "regexp/syntax", + "syntax.OpAnyCharNotNL": "regexp/syntax", + "syntax.OpBeginLine": "regexp/syntax", + "syntax.OpBeginText": "regexp/syntax", + "syntax.OpCapture": "regexp/syntax", + "syntax.OpCharClass": "regexp/syntax", + "syntax.OpConcat": "regexp/syntax", + "syntax.OpEmptyMatch": "regexp/syntax", + "syntax.OpEndLine": "regexp/syntax", + "syntax.OpEndText": "regexp/syntax", + "syntax.OpLiteral": "regexp/syntax", + "syntax.OpNoMatch": "regexp/syntax", + "syntax.OpNoWordBoundary": "regexp/syntax", + "syntax.OpPlus": "regexp/syntax", + "syntax.OpQuest": "regexp/syntax", + "syntax.OpRepeat": "regexp/syntax", + "syntax.OpStar": "regexp/syntax", + "syntax.OpWordBoundary": "regexp/syntax", + "syntax.POSIX": "regexp/syntax", + "syntax.Parse": "regexp/syntax", + "syntax.Perl": "regexp/syntax", + "syntax.PerlX": "regexp/syntax", + "syntax.Prog": "regexp/syntax", + "syntax.Regexp": "regexp/syntax", + "syntax.Simple": "regexp/syntax", + "syntax.UnicodeGroups": "regexp/syntax", + "syntax.WasDollar": "regexp/syntax", + "syscall.AF_ALG": "syscall", + "syscall.AF_APPLETALK": "syscall", + "syscall.AF_ARP": "syscall", + "syscall.AF_ASH": "syscall", + "syscall.AF_ATM": "syscall", + "syscall.AF_ATMPVC": "syscall", + "syscall.AF_ATMSVC": "syscall", + "syscall.AF_AX25": "syscall", + "syscall.AF_BLUETOOTH": "syscall", + "syscall.AF_BRIDGE": "syscall", + "syscall.AF_CAIF": "syscall", + "syscall.AF_CAN": "syscall", + "syscall.AF_CCITT": "syscall", + "syscall.AF_CHAOS": "syscall", + "syscall.AF_CNT": "syscall", + "syscall.AF_COIP": "syscall", + "syscall.AF_DATAKIT": "syscall", + "syscall.AF_DECnet": "syscall", + "syscall.AF_DLI": "syscall", + "syscall.AF_E164": "syscall", + "syscall.AF_ECMA": "syscall", + "syscall.AF_ECONET": "syscall", + "syscall.AF_ENCAP": "syscall", + "syscall.AF_FILE": "syscall", + "syscall.AF_HYLINK": "syscall", + "syscall.AF_IEEE80211": "syscall", + "syscall.AF_IEEE802154": "syscall", + "syscall.AF_IMPLINK": "syscall", + "syscall.AF_INET": "syscall", + "syscall.AF_INET6": "syscall", + "syscall.AF_INET6_SDP": "syscall", + "syscall.AF_INET_SDP": "syscall", + "syscall.AF_IPX": "syscall", + "syscall.AF_IRDA": "syscall", + "syscall.AF_ISDN": "syscall", + "syscall.AF_ISO": "syscall", + "syscall.AF_IUCV": "syscall", + "syscall.AF_KEY": "syscall", + "syscall.AF_LAT": "syscall", + "syscall.AF_LINK": "syscall", + "syscall.AF_LLC": "syscall", + "syscall.AF_LOCAL": "syscall", + "syscall.AF_MAX": "syscall", + "syscall.AF_MPLS": "syscall", + "syscall.AF_NATM": "syscall", + "syscall.AF_NDRV": "syscall", + "syscall.AF_NETBEUI": "syscall", + "syscall.AF_NETBIOS": "syscall", + "syscall.AF_NETGRAPH": "syscall", + "syscall.AF_NETLINK": "syscall", + "syscall.AF_NETROM": "syscall", + "syscall.AF_NS": "syscall", + "syscall.AF_OROUTE": "syscall", + "syscall.AF_OSI": "syscall", + "syscall.AF_PACKET": "syscall", + "syscall.AF_PHONET": "syscall", + "syscall.AF_PPP": "syscall", + "syscall.AF_PPPOX": "syscall", + "syscall.AF_PUP": "syscall", + "syscall.AF_RDS": "syscall", + "syscall.AF_RESERVED_36": "syscall", + "syscall.AF_ROSE": "syscall", + "syscall.AF_ROUTE": "syscall", + "syscall.AF_RXRPC": "syscall", + "syscall.AF_SCLUSTER": "syscall", + "syscall.AF_SECURITY": "syscall", + "syscall.AF_SIP": "syscall", + "syscall.AF_SLOW": "syscall", + "syscall.AF_SNA": "syscall", + "syscall.AF_SYSTEM": "syscall", + "syscall.AF_TIPC": "syscall", + "syscall.AF_UNIX": "syscall", + "syscall.AF_UNSPEC": "syscall", + "syscall.AF_VENDOR00": "syscall", + "syscall.AF_VENDOR01": "syscall", + "syscall.AF_VENDOR02": "syscall", + "syscall.AF_VENDOR03": "syscall", + "syscall.AF_VENDOR04": "syscall", + "syscall.AF_VENDOR05": "syscall", + "syscall.AF_VENDOR06": "syscall", + "syscall.AF_VENDOR07": "syscall", + "syscall.AF_VENDOR08": "syscall", + "syscall.AF_VENDOR09": "syscall", + "syscall.AF_VENDOR10": "syscall", + "syscall.AF_VENDOR11": "syscall", + "syscall.AF_VENDOR12": "syscall", + "syscall.AF_VENDOR13": "syscall", + "syscall.AF_VENDOR14": "syscall", + "syscall.AF_VENDOR15": "syscall", + "syscall.AF_VENDOR16": "syscall", + "syscall.AF_VENDOR17": "syscall", + "syscall.AF_VENDOR18": "syscall", + "syscall.AF_VENDOR19": "syscall", + "syscall.AF_VENDOR20": "syscall", + "syscall.AF_VENDOR21": "syscall", + "syscall.AF_VENDOR22": "syscall", + "syscall.AF_VENDOR23": "syscall", + "syscall.AF_VENDOR24": "syscall", + "syscall.AF_VENDOR25": "syscall", + "syscall.AF_VENDOR26": "syscall", + "syscall.AF_VENDOR27": "syscall", + "syscall.AF_VENDOR28": "syscall", + "syscall.AF_VENDOR29": "syscall", + "syscall.AF_VENDOR30": "syscall", + "syscall.AF_VENDOR31": "syscall", + "syscall.AF_VENDOR32": "syscall", + "syscall.AF_VENDOR33": "syscall", + "syscall.AF_VENDOR34": "syscall", + "syscall.AF_VENDOR35": "syscall", + "syscall.AF_VENDOR36": "syscall", + "syscall.AF_VENDOR37": "syscall", + "syscall.AF_VENDOR38": "syscall", + "syscall.AF_VENDOR39": "syscall", + "syscall.AF_VENDOR40": "syscall", + "syscall.AF_VENDOR41": "syscall", + "syscall.AF_VENDOR42": "syscall", + "syscall.AF_VENDOR43": "syscall", + "syscall.AF_VENDOR44": "syscall", + "syscall.AF_VENDOR45": "syscall", + "syscall.AF_VENDOR46": "syscall", + "syscall.AF_VENDOR47": "syscall", + "syscall.AF_WANPIPE": "syscall", + "syscall.AF_X25": "syscall", + "syscall.AI_CANONNAME": "syscall", + "syscall.AI_NUMERICHOST": "syscall", + "syscall.AI_PASSIVE": "syscall", + "syscall.APPLICATION_ERROR": "syscall", + "syscall.ARPHRD_ADAPT": "syscall", + "syscall.ARPHRD_APPLETLK": "syscall", + "syscall.ARPHRD_ARCNET": "syscall", + "syscall.ARPHRD_ASH": "syscall", + "syscall.ARPHRD_ATM": "syscall", + "syscall.ARPHRD_AX25": "syscall", + "syscall.ARPHRD_BIF": "syscall", + "syscall.ARPHRD_CHAOS": "syscall", + "syscall.ARPHRD_CISCO": "syscall", + "syscall.ARPHRD_CSLIP": "syscall", + "syscall.ARPHRD_CSLIP6": "syscall", + "syscall.ARPHRD_DDCMP": "syscall", + "syscall.ARPHRD_DLCI": "syscall", + "syscall.ARPHRD_ECONET": "syscall", + "syscall.ARPHRD_EETHER": "syscall", + "syscall.ARPHRD_ETHER": "syscall", + "syscall.ARPHRD_EUI64": "syscall", + "syscall.ARPHRD_FCAL": "syscall", + "syscall.ARPHRD_FCFABRIC": "syscall", + "syscall.ARPHRD_FCPL": "syscall", + "syscall.ARPHRD_FCPP": "syscall", + "syscall.ARPHRD_FDDI": "syscall", + "syscall.ARPHRD_FRAD": "syscall", + "syscall.ARPHRD_FRELAY": "syscall", + "syscall.ARPHRD_HDLC": "syscall", + "syscall.ARPHRD_HIPPI": "syscall", + "syscall.ARPHRD_HWX25": "syscall", + "syscall.ARPHRD_IEEE1394": "syscall", + "syscall.ARPHRD_IEEE802": "syscall", + "syscall.ARPHRD_IEEE80211": "syscall", + "syscall.ARPHRD_IEEE80211_PRISM": "syscall", + "syscall.ARPHRD_IEEE80211_RADIOTAP": "syscall", + "syscall.ARPHRD_IEEE802154": "syscall", + "syscall.ARPHRD_IEEE802154_PHY": "syscall", + "syscall.ARPHRD_IEEE802_TR": "syscall", + "syscall.ARPHRD_INFINIBAND": "syscall", + "syscall.ARPHRD_IPDDP": "syscall", + "syscall.ARPHRD_IPGRE": "syscall", + "syscall.ARPHRD_IRDA": "syscall", + "syscall.ARPHRD_LAPB": "syscall", + "syscall.ARPHRD_LOCALTLK": "syscall", + "syscall.ARPHRD_LOOPBACK": "syscall", + "syscall.ARPHRD_METRICOM": "syscall", + "syscall.ARPHRD_NETROM": "syscall", + "syscall.ARPHRD_NONE": "syscall", + "syscall.ARPHRD_PIMREG": "syscall", + "syscall.ARPHRD_PPP": "syscall", + "syscall.ARPHRD_PRONET": "syscall", + "syscall.ARPHRD_RAWHDLC": "syscall", + "syscall.ARPHRD_ROSE": "syscall", + "syscall.ARPHRD_RSRVD": "syscall", + "syscall.ARPHRD_SIT": "syscall", + "syscall.ARPHRD_SKIP": "syscall", + "syscall.ARPHRD_SLIP": "syscall", + "syscall.ARPHRD_SLIP6": "syscall", + "syscall.ARPHRD_STRIP": "syscall", + "syscall.ARPHRD_TUNNEL": "syscall", + "syscall.ARPHRD_TUNNEL6": "syscall", + "syscall.ARPHRD_VOID": "syscall", + "syscall.ARPHRD_X25": "syscall", + "syscall.AUTHTYPE_CLIENT": "syscall", + "syscall.AUTHTYPE_SERVER": "syscall", + "syscall.Accept": "syscall", + "syscall.Accept4": "syscall", + "syscall.AcceptEx": "syscall", + "syscall.Access": "syscall", + "syscall.Acct": "syscall", + "syscall.AddrinfoW": "syscall", + "syscall.Adjtime": "syscall", + "syscall.Adjtimex": "syscall", + "syscall.AttachLsf": "syscall", + "syscall.B0": "syscall", + "syscall.B1000000": "syscall", + "syscall.B110": "syscall", + "syscall.B115200": "syscall", + "syscall.B1152000": "syscall", + "syscall.B1200": "syscall", + "syscall.B134": "syscall", + "syscall.B14400": "syscall", + "syscall.B150": "syscall", + "syscall.B1500000": "syscall", + "syscall.B1800": "syscall", + "syscall.B19200": "syscall", + "syscall.B200": "syscall", + "syscall.B2000000": "syscall", + "syscall.B230400": "syscall", + "syscall.B2400": "syscall", + "syscall.B2500000": "syscall", + "syscall.B28800": "syscall", + "syscall.B300": "syscall", + "syscall.B3000000": "syscall", + "syscall.B3500000": "syscall", + "syscall.B38400": "syscall", + "syscall.B4000000": "syscall", + "syscall.B460800": "syscall", + "syscall.B4800": "syscall", + "syscall.B50": "syscall", + "syscall.B500000": "syscall", + "syscall.B57600": "syscall", + "syscall.B576000": "syscall", + "syscall.B600": "syscall", + "syscall.B7200": "syscall", + "syscall.B75": "syscall", + "syscall.B76800": "syscall", + "syscall.B921600": "syscall", + "syscall.B9600": "syscall", + "syscall.BASE_PROTOCOL": "syscall", + "syscall.BIOCFEEDBACK": "syscall", + "syscall.BIOCFLUSH": "syscall", + "syscall.BIOCGBLEN": "syscall", + "syscall.BIOCGDIRECTION": "syscall", + "syscall.BIOCGDIRFILT": "syscall", + "syscall.BIOCGDLT": "syscall", + "syscall.BIOCGDLTLIST": "syscall", + "syscall.BIOCGETBUFMODE": "syscall", + "syscall.BIOCGETIF": "syscall", + "syscall.BIOCGETZMAX": "syscall", + "syscall.BIOCGFEEDBACK": "syscall", + "syscall.BIOCGFILDROP": "syscall", + "syscall.BIOCGHDRCMPLT": "syscall", + "syscall.BIOCGRSIG": "syscall", + "syscall.BIOCGRTIMEOUT": "syscall", + "syscall.BIOCGSEESENT": "syscall", + "syscall.BIOCGSTATS": "syscall", + "syscall.BIOCGSTATSOLD": "syscall", + "syscall.BIOCGTSTAMP": "syscall", + "syscall.BIOCIMMEDIATE": "syscall", + "syscall.BIOCLOCK": "syscall", + "syscall.BIOCPROMISC": "syscall", + "syscall.BIOCROTZBUF": "syscall", + "syscall.BIOCSBLEN": "syscall", + "syscall.BIOCSDIRECTION": "syscall", + "syscall.BIOCSDIRFILT": "syscall", + "syscall.BIOCSDLT": "syscall", + "syscall.BIOCSETBUFMODE": "syscall", + "syscall.BIOCSETF": "syscall", + "syscall.BIOCSETFNR": "syscall", + "syscall.BIOCSETIF": "syscall", + "syscall.BIOCSETWF": "syscall", + "syscall.BIOCSETZBUF": "syscall", + "syscall.BIOCSFEEDBACK": "syscall", + "syscall.BIOCSFILDROP": "syscall", + "syscall.BIOCSHDRCMPLT": "syscall", + "syscall.BIOCSRSIG": "syscall", + "syscall.BIOCSRTIMEOUT": "syscall", + "syscall.BIOCSSEESENT": "syscall", + "syscall.BIOCSTCPF": "syscall", + "syscall.BIOCSTSTAMP": "syscall", + "syscall.BIOCSUDPF": "syscall", + "syscall.BIOCVERSION": "syscall", + "syscall.BPF_A": "syscall", + "syscall.BPF_ABS": "syscall", + "syscall.BPF_ADD": "syscall", + "syscall.BPF_ALIGNMENT": "syscall", + "syscall.BPF_ALIGNMENT32": "syscall", + "syscall.BPF_ALU": "syscall", + "syscall.BPF_AND": "syscall", + "syscall.BPF_B": "syscall", + "syscall.BPF_BUFMODE_BUFFER": "syscall", + "syscall.BPF_BUFMODE_ZBUF": "syscall", + "syscall.BPF_DFLTBUFSIZE": "syscall", + "syscall.BPF_DIRECTION_IN": "syscall", + "syscall.BPF_DIRECTION_OUT": "syscall", + "syscall.BPF_DIV": "syscall", + "syscall.BPF_H": "syscall", + "syscall.BPF_IMM": "syscall", + "syscall.BPF_IND": "syscall", + "syscall.BPF_JA": "syscall", + "syscall.BPF_JEQ": "syscall", + "syscall.BPF_JGE": "syscall", + "syscall.BPF_JGT": "syscall", + "syscall.BPF_JMP": "syscall", + "syscall.BPF_JSET": "syscall", + "syscall.BPF_K": "syscall", + "syscall.BPF_LD": "syscall", + "syscall.BPF_LDX": "syscall", + "syscall.BPF_LEN": "syscall", + "syscall.BPF_LSH": "syscall", + "syscall.BPF_MAJOR_VERSION": "syscall", + "syscall.BPF_MAXBUFSIZE": "syscall", + "syscall.BPF_MAXINSNS": "syscall", + "syscall.BPF_MEM": "syscall", + "syscall.BPF_MEMWORDS": "syscall", + "syscall.BPF_MINBUFSIZE": "syscall", + "syscall.BPF_MINOR_VERSION": "syscall", + "syscall.BPF_MISC": "syscall", + "syscall.BPF_MSH": "syscall", + "syscall.BPF_MUL": "syscall", + "syscall.BPF_NEG": "syscall", + "syscall.BPF_OR": "syscall", + "syscall.BPF_RELEASE": "syscall", + "syscall.BPF_RET": "syscall", + "syscall.BPF_RSH": "syscall", + "syscall.BPF_ST": "syscall", + "syscall.BPF_STX": "syscall", + "syscall.BPF_SUB": "syscall", + "syscall.BPF_TAX": "syscall", + "syscall.BPF_TXA": "syscall", + "syscall.BPF_T_BINTIME": "syscall", + "syscall.BPF_T_BINTIME_FAST": "syscall", + "syscall.BPF_T_BINTIME_MONOTONIC": "syscall", + "syscall.BPF_T_BINTIME_MONOTONIC_FAST": "syscall", + "syscall.BPF_T_FAST": "syscall", + "syscall.BPF_T_FLAG_MASK": "syscall", + "syscall.BPF_T_FORMAT_MASK": "syscall", + "syscall.BPF_T_MICROTIME": "syscall", + "syscall.BPF_T_MICROTIME_FAST": "syscall", + "syscall.BPF_T_MICROTIME_MONOTONIC": "syscall", + "syscall.BPF_T_MICROTIME_MONOTONIC_FAST": "syscall", + "syscall.BPF_T_MONOTONIC": "syscall", + "syscall.BPF_T_MONOTONIC_FAST": "syscall", + "syscall.BPF_T_NANOTIME": "syscall", + "syscall.BPF_T_NANOTIME_FAST": "syscall", + "syscall.BPF_T_NANOTIME_MONOTONIC": "syscall", + "syscall.BPF_T_NANOTIME_MONOTONIC_FAST": "syscall", + "syscall.BPF_T_NONE": "syscall", + "syscall.BPF_T_NORMAL": "syscall", + "syscall.BPF_W": "syscall", + "syscall.BPF_X": "syscall", + "syscall.BRKINT": "syscall", + "syscall.Bind": "syscall", + "syscall.BindToDevice": "syscall", + "syscall.BpfBuflen": "syscall", + "syscall.BpfDatalink": "syscall", + "syscall.BpfHdr": "syscall", + "syscall.BpfHeadercmpl": "syscall", + "syscall.BpfInsn": "syscall", + "syscall.BpfInterface": "syscall", + "syscall.BpfJump": "syscall", + "syscall.BpfProgram": "syscall", + "syscall.BpfStat": "syscall", + "syscall.BpfStats": "syscall", + "syscall.BpfStmt": "syscall", + "syscall.BpfTimeout": "syscall", + "syscall.BpfTimeval": "syscall", + "syscall.BpfVersion": "syscall", + "syscall.BpfZbuf": "syscall", + "syscall.BpfZbufHeader": "syscall", + "syscall.ByHandleFileInformation": "syscall", + "syscall.BytePtrFromString": "syscall", + "syscall.ByteSliceFromString": "syscall", + "syscall.CCR0_FLUSH": "syscall", + "syscall.CERT_CHAIN_POLICY_AUTHENTICODE": "syscall", + "syscall.CERT_CHAIN_POLICY_AUTHENTICODE_TS": "syscall", + "syscall.CERT_CHAIN_POLICY_BASE": "syscall", + "syscall.CERT_CHAIN_POLICY_BASIC_CONSTRAINTS": "syscall", + "syscall.CERT_CHAIN_POLICY_EV": "syscall", + "syscall.CERT_CHAIN_POLICY_MICROSOFT_ROOT": "syscall", + "syscall.CERT_CHAIN_POLICY_NT_AUTH": "syscall", + "syscall.CERT_CHAIN_POLICY_SSL": "syscall", + "syscall.CERT_E_CN_NO_MATCH": "syscall", + "syscall.CERT_E_EXPIRED": "syscall", + "syscall.CERT_E_PURPOSE": "syscall", + "syscall.CERT_E_ROLE": "syscall", + "syscall.CERT_E_UNTRUSTEDROOT": "syscall", + "syscall.CERT_STORE_ADD_ALWAYS": "syscall", + "syscall.CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG": "syscall", + "syscall.CERT_STORE_PROV_MEMORY": "syscall", + "syscall.CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT": "syscall", + "syscall.CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT": "syscall", + "syscall.CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT": "syscall", + "syscall.CERT_TRUST_HAS_NOT_SUPPORTED_CRITICAL_EXT": "syscall", + "syscall.CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT": "syscall", + "syscall.CERT_TRUST_INVALID_BASIC_CONSTRAINTS": "syscall", + "syscall.CERT_TRUST_INVALID_EXTENSION": "syscall", + "syscall.CERT_TRUST_INVALID_NAME_CONSTRAINTS": "syscall", + "syscall.CERT_TRUST_INVALID_POLICY_CONSTRAINTS": "syscall", + "syscall.CERT_TRUST_IS_CYCLIC": "syscall", + "syscall.CERT_TRUST_IS_EXPLICIT_DISTRUST": "syscall", + "syscall.CERT_TRUST_IS_NOT_SIGNATURE_VALID": "syscall", + "syscall.CERT_TRUST_IS_NOT_TIME_VALID": "syscall", + "syscall.CERT_TRUST_IS_NOT_VALID_FOR_USAGE": "syscall", + "syscall.CERT_TRUST_IS_OFFLINE_REVOCATION": "syscall", + "syscall.CERT_TRUST_IS_REVOKED": "syscall", + "syscall.CERT_TRUST_IS_UNTRUSTED_ROOT": "syscall", + "syscall.CERT_TRUST_NO_ERROR": "syscall", + "syscall.CERT_TRUST_NO_ISSUANCE_CHAIN_POLICY": "syscall", + "syscall.CERT_TRUST_REVOCATION_STATUS_UNKNOWN": "syscall", + "syscall.CFLUSH": "syscall", + "syscall.CLOCAL": "syscall", + "syscall.CLONE_CHILD_CLEARTID": "syscall", + "syscall.CLONE_CHILD_SETTID": "syscall", + "syscall.CLONE_CSIGNAL": "syscall", + "syscall.CLONE_DETACHED": "syscall", + "syscall.CLONE_FILES": "syscall", + "syscall.CLONE_FS": "syscall", + "syscall.CLONE_IO": "syscall", + "syscall.CLONE_NEWIPC": "syscall", + "syscall.CLONE_NEWNET": "syscall", + "syscall.CLONE_NEWNS": "syscall", + "syscall.CLONE_NEWPID": "syscall", + "syscall.CLONE_NEWUSER": "syscall", + "syscall.CLONE_NEWUTS": "syscall", + "syscall.CLONE_PARENT": "syscall", + "syscall.CLONE_PARENT_SETTID": "syscall", + "syscall.CLONE_PID": "syscall", + "syscall.CLONE_PTRACE": "syscall", + "syscall.CLONE_SETTLS": "syscall", + "syscall.CLONE_SIGHAND": "syscall", + "syscall.CLONE_SYSVSEM": "syscall", + "syscall.CLONE_THREAD": "syscall", + "syscall.CLONE_UNTRACED": "syscall", + "syscall.CLONE_VFORK": "syscall", + "syscall.CLONE_VM": "syscall", + "syscall.CPUID_CFLUSH": "syscall", + "syscall.CREAD": "syscall", + "syscall.CREATE_ALWAYS": "syscall", + "syscall.CREATE_NEW": "syscall", + "syscall.CREATE_NEW_PROCESS_GROUP": "syscall", + "syscall.CREATE_UNICODE_ENVIRONMENT": "syscall", + "syscall.CRYPT_DEFAULT_CONTAINER_OPTIONAL": "syscall", + "syscall.CRYPT_DELETEKEYSET": "syscall", + "syscall.CRYPT_MACHINE_KEYSET": "syscall", + "syscall.CRYPT_NEWKEYSET": "syscall", + "syscall.CRYPT_SILENT": "syscall", + "syscall.CRYPT_VERIFYCONTEXT": "syscall", + "syscall.CS5": "syscall", + "syscall.CS6": "syscall", + "syscall.CS7": "syscall", + "syscall.CS8": "syscall", + "syscall.CSIZE": "syscall", + "syscall.CSTART": "syscall", + "syscall.CSTATUS": "syscall", + "syscall.CSTOP": "syscall", + "syscall.CSTOPB": "syscall", + "syscall.CSUSP": "syscall", + "syscall.CTL_MAXNAME": "syscall", + "syscall.CTL_NET": "syscall", + "syscall.CTL_QUERY": "syscall", + "syscall.CTRL_BREAK_EVENT": "syscall", + "syscall.CTRL_C_EVENT": "syscall", + "syscall.CancelIo": "syscall", + "syscall.CancelIoEx": "syscall", + "syscall.CertAddCertificateContextToStore": "syscall", + "syscall.CertChainContext": "syscall", + "syscall.CertChainElement": "syscall", + "syscall.CertChainPara": "syscall", + "syscall.CertChainPolicyPara": "syscall", + "syscall.CertChainPolicyStatus": "syscall", + "syscall.CertCloseStore": "syscall", + "syscall.CertContext": "syscall", + "syscall.CertCreateCertificateContext": "syscall", + "syscall.CertEnhKeyUsage": "syscall", + "syscall.CertEnumCertificatesInStore": "syscall", + "syscall.CertFreeCertificateChain": "syscall", + "syscall.CertFreeCertificateContext": "syscall", + "syscall.CertGetCertificateChain": "syscall", + "syscall.CertOpenStore": "syscall", + "syscall.CertOpenSystemStore": "syscall", + "syscall.CertRevocationInfo": "syscall", + "syscall.CertSimpleChain": "syscall", + "syscall.CertTrustStatus": "syscall", + "syscall.CertUsageMatch": "syscall", + "syscall.CertVerifyCertificateChainPolicy": "syscall", + "syscall.Chdir": "syscall", + "syscall.CheckBpfVersion": "syscall", + "syscall.Chflags": "syscall", + "syscall.Chmod": "syscall", + "syscall.Chown": "syscall", + "syscall.Chroot": "syscall", + "syscall.Clearenv": "syscall", + "syscall.Close": "syscall", + "syscall.CloseHandle": "syscall", + "syscall.CloseOnExec": "syscall", + "syscall.Closesocket": "syscall", + "syscall.CmsgLen": "syscall", + "syscall.CmsgSpace": "syscall", + "syscall.Cmsghdr": "syscall", + "syscall.CommandLineToArgv": "syscall", + "syscall.ComputerName": "syscall", + "syscall.Connect": "syscall", + "syscall.ConnectEx": "syscall", + "syscall.ConvertSidToStringSid": "syscall", + "syscall.ConvertStringSidToSid": "syscall", + "syscall.CopySid": "syscall", + "syscall.Creat": "syscall", + "syscall.CreateDirectory": "syscall", + "syscall.CreateFile": "syscall", + "syscall.CreateFileMapping": "syscall", + "syscall.CreateHardLink": "syscall", + "syscall.CreateIoCompletionPort": "syscall", + "syscall.CreatePipe": "syscall", + "syscall.CreateProcess": "syscall", + "syscall.CreateSymbolicLink": "syscall", + "syscall.CreateToolhelp32Snapshot": "syscall", + "syscall.Credential": "syscall", + "syscall.CryptAcquireContext": "syscall", + "syscall.CryptGenRandom": "syscall", + "syscall.CryptReleaseContext": "syscall", + "syscall.DIOCBSFLUSH": "syscall", + "syscall.DIOCOSFPFLUSH": "syscall", + "syscall.DLL": "syscall", + "syscall.DLLError": "syscall", + "syscall.DLT_A429": "syscall", + "syscall.DLT_A653_ICM": "syscall", + "syscall.DLT_AIRONET_HEADER": "syscall", + "syscall.DLT_AOS": "syscall", + "syscall.DLT_APPLE_IP_OVER_IEEE1394": "syscall", + "syscall.DLT_ARCNET": "syscall", + "syscall.DLT_ARCNET_LINUX": "syscall", + "syscall.DLT_ATM_CLIP": "syscall", + "syscall.DLT_ATM_RFC1483": "syscall", + "syscall.DLT_AURORA": "syscall", + "syscall.DLT_AX25": "syscall", + "syscall.DLT_AX25_KISS": "syscall", + "syscall.DLT_BACNET_MS_TP": "syscall", + "syscall.DLT_BLUETOOTH_HCI_H4": "syscall", + "syscall.DLT_BLUETOOTH_HCI_H4_WITH_PHDR": "syscall", + "syscall.DLT_CAN20B": "syscall", + "syscall.DLT_CAN_SOCKETCAN": "syscall", + "syscall.DLT_CHAOS": "syscall", + "syscall.DLT_CHDLC": "syscall", + "syscall.DLT_CISCO_IOS": "syscall", + "syscall.DLT_C_HDLC": "syscall", + "syscall.DLT_C_HDLC_WITH_DIR": "syscall", + "syscall.DLT_DBUS": "syscall", + "syscall.DLT_DECT": "syscall", + "syscall.DLT_DOCSIS": "syscall", + "syscall.DLT_DVB_CI": "syscall", + "syscall.DLT_ECONET": "syscall", + "syscall.DLT_EN10MB": "syscall", + "syscall.DLT_EN3MB": "syscall", + "syscall.DLT_ENC": "syscall", + "syscall.DLT_ERF": "syscall", + "syscall.DLT_ERF_ETH": "syscall", + "syscall.DLT_ERF_POS": "syscall", + "syscall.DLT_FC_2": "syscall", + "syscall.DLT_FC_2_WITH_FRAME_DELIMS": "syscall", + "syscall.DLT_FDDI": "syscall", + "syscall.DLT_FLEXRAY": "syscall", + "syscall.DLT_FRELAY": "syscall", + "syscall.DLT_FRELAY_WITH_DIR": "syscall", + "syscall.DLT_GCOM_SERIAL": "syscall", + "syscall.DLT_GCOM_T1E1": "syscall", + "syscall.DLT_GPF_F": "syscall", + "syscall.DLT_GPF_T": "syscall", + "syscall.DLT_GPRS_LLC": "syscall", + "syscall.DLT_GSMTAP_ABIS": "syscall", + "syscall.DLT_GSMTAP_UM": "syscall", + "syscall.DLT_HDLC": "syscall", + "syscall.DLT_HHDLC": "syscall", + "syscall.DLT_HIPPI": "syscall", + "syscall.DLT_IBM_SN": "syscall", + "syscall.DLT_IBM_SP": "syscall", + "syscall.DLT_IEEE802": "syscall", + "syscall.DLT_IEEE802_11": "syscall", + "syscall.DLT_IEEE802_11_RADIO": "syscall", + "syscall.DLT_IEEE802_11_RADIO_AVS": "syscall", + "syscall.DLT_IEEE802_15_4": "syscall", + "syscall.DLT_IEEE802_15_4_LINUX": "syscall", + "syscall.DLT_IEEE802_15_4_NOFCS": "syscall", + "syscall.DLT_IEEE802_15_4_NONASK_PHY": "syscall", + "syscall.DLT_IEEE802_16_MAC_CPS": "syscall", + "syscall.DLT_IEEE802_16_MAC_CPS_RADIO": "syscall", + "syscall.DLT_IPFILTER": "syscall", + "syscall.DLT_IPMB": "syscall", + "syscall.DLT_IPMB_LINUX": "syscall", + "syscall.DLT_IPNET": "syscall", + "syscall.DLT_IPOIB": "syscall", + "syscall.DLT_IPV4": "syscall", + "syscall.DLT_IPV6": "syscall", + "syscall.DLT_IP_OVER_FC": "syscall", + "syscall.DLT_JUNIPER_ATM1": "syscall", + "syscall.DLT_JUNIPER_ATM2": "syscall", + "syscall.DLT_JUNIPER_ATM_CEMIC": "syscall", + "syscall.DLT_JUNIPER_CHDLC": "syscall", + "syscall.DLT_JUNIPER_ES": "syscall", + "syscall.DLT_JUNIPER_ETHER": "syscall", + "syscall.DLT_JUNIPER_FIBRECHANNEL": "syscall", + "syscall.DLT_JUNIPER_FRELAY": "syscall", + "syscall.DLT_JUNIPER_GGSN": "syscall", + "syscall.DLT_JUNIPER_ISM": "syscall", + "syscall.DLT_JUNIPER_MFR": "syscall", + "syscall.DLT_JUNIPER_MLFR": "syscall", + "syscall.DLT_JUNIPER_MLPPP": "syscall", + "syscall.DLT_JUNIPER_MONITOR": "syscall", + "syscall.DLT_JUNIPER_PIC_PEER": "syscall", + "syscall.DLT_JUNIPER_PPP": "syscall", + "syscall.DLT_JUNIPER_PPPOE": "syscall", + "syscall.DLT_JUNIPER_PPPOE_ATM": "syscall", + "syscall.DLT_JUNIPER_SERVICES": "syscall", + "syscall.DLT_JUNIPER_SRX_E2E": "syscall", + "syscall.DLT_JUNIPER_ST": "syscall", + "syscall.DLT_JUNIPER_VP": "syscall", + "syscall.DLT_JUNIPER_VS": "syscall", + "syscall.DLT_LAPB_WITH_DIR": "syscall", + "syscall.DLT_LAPD": "syscall", + "syscall.DLT_LIN": "syscall", + "syscall.DLT_LINUX_EVDEV": "syscall", + "syscall.DLT_LINUX_IRDA": "syscall", + "syscall.DLT_LINUX_LAPD": "syscall", + "syscall.DLT_LINUX_PPP_WITHDIRECTION": "syscall", + "syscall.DLT_LINUX_SLL": "syscall", + "syscall.DLT_LOOP": "syscall", + "syscall.DLT_LTALK": "syscall", + "syscall.DLT_MATCHING_MAX": "syscall", + "syscall.DLT_MATCHING_MIN": "syscall", + "syscall.DLT_MFR": "syscall", + "syscall.DLT_MOST": "syscall", + "syscall.DLT_MPEG_2_TS": "syscall", + "syscall.DLT_MPLS": "syscall", + "syscall.DLT_MTP2": "syscall", + "syscall.DLT_MTP2_WITH_PHDR": "syscall", + "syscall.DLT_MTP3": "syscall", + "syscall.DLT_MUX27010": "syscall", + "syscall.DLT_NETANALYZER": "syscall", + "syscall.DLT_NETANALYZER_TRANSPARENT": "syscall", + "syscall.DLT_NFC_LLCP": "syscall", + "syscall.DLT_NFLOG": "syscall", + "syscall.DLT_NG40": "syscall", + "syscall.DLT_NULL": "syscall", + "syscall.DLT_PCI_EXP": "syscall", + "syscall.DLT_PFLOG": "syscall", + "syscall.DLT_PFSYNC": "syscall", + "syscall.DLT_PPI": "syscall", + "syscall.DLT_PPP": "syscall", + "syscall.DLT_PPP_BSDOS": "syscall", + "syscall.DLT_PPP_ETHER": "syscall", + "syscall.DLT_PPP_PPPD": "syscall", + "syscall.DLT_PPP_SERIAL": "syscall", + "syscall.DLT_PPP_WITH_DIR": "syscall", + "syscall.DLT_PPP_WITH_DIRECTION": "syscall", + "syscall.DLT_PRISM_HEADER": "syscall", + "syscall.DLT_PRONET": "syscall", + "syscall.DLT_RAIF1": "syscall", + "syscall.DLT_RAW": "syscall", + "syscall.DLT_RAWAF_MASK": "syscall", + "syscall.DLT_RIO": "syscall", + "syscall.DLT_SCCP": "syscall", + "syscall.DLT_SITA": "syscall", + "syscall.DLT_SLIP": "syscall", + "syscall.DLT_SLIP_BSDOS": "syscall", + "syscall.DLT_STANAG_5066_D_PDU": "syscall", + "syscall.DLT_SUNATM": "syscall", + "syscall.DLT_SYMANTEC_FIREWALL": "syscall", + "syscall.DLT_TZSP": "syscall", + "syscall.DLT_USB": "syscall", + "syscall.DLT_USB_LINUX": "syscall", + "syscall.DLT_USB_LINUX_MMAPPED": "syscall", + "syscall.DLT_USER0": "syscall", + "syscall.DLT_USER1": "syscall", + "syscall.DLT_USER10": "syscall", + "syscall.DLT_USER11": "syscall", + "syscall.DLT_USER12": "syscall", + "syscall.DLT_USER13": "syscall", + "syscall.DLT_USER14": "syscall", + "syscall.DLT_USER15": "syscall", + "syscall.DLT_USER2": "syscall", + "syscall.DLT_USER3": "syscall", + "syscall.DLT_USER4": "syscall", + "syscall.DLT_USER5": "syscall", + "syscall.DLT_USER6": "syscall", + "syscall.DLT_USER7": "syscall", + "syscall.DLT_USER8": "syscall", + "syscall.DLT_USER9": "syscall", + "syscall.DLT_WIHART": "syscall", + "syscall.DLT_X2E_SERIAL": "syscall", + "syscall.DLT_X2E_XORAYA": "syscall", + "syscall.DNSMXData": "syscall", + "syscall.DNSPTRData": "syscall", + "syscall.DNSRecord": "syscall", + "syscall.DNSSRVData": "syscall", + "syscall.DNSTXTData": "syscall", + "syscall.DNS_INFO_NO_RECORDS": "syscall", + "syscall.DNS_TYPE_A": "syscall", + "syscall.DNS_TYPE_A6": "syscall", + "syscall.DNS_TYPE_AAAA": "syscall", + "syscall.DNS_TYPE_ADDRS": "syscall", + "syscall.DNS_TYPE_AFSDB": "syscall", + "syscall.DNS_TYPE_ALL": "syscall", + "syscall.DNS_TYPE_ANY": "syscall", + "syscall.DNS_TYPE_ATMA": "syscall", + "syscall.DNS_TYPE_AXFR": "syscall", + "syscall.DNS_TYPE_CERT": "syscall", + "syscall.DNS_TYPE_CNAME": "syscall", + "syscall.DNS_TYPE_DHCID": "syscall", + "syscall.DNS_TYPE_DNAME": "syscall", + "syscall.DNS_TYPE_DNSKEY": "syscall", + "syscall.DNS_TYPE_DS": "syscall", + "syscall.DNS_TYPE_EID": "syscall", + "syscall.DNS_TYPE_GID": "syscall", + "syscall.DNS_TYPE_GPOS": "syscall", + "syscall.DNS_TYPE_HINFO": "syscall", + "syscall.DNS_TYPE_ISDN": "syscall", + "syscall.DNS_TYPE_IXFR": "syscall", + "syscall.DNS_TYPE_KEY": "syscall", + "syscall.DNS_TYPE_KX": "syscall", + "syscall.DNS_TYPE_LOC": "syscall", + "syscall.DNS_TYPE_MAILA": "syscall", + "syscall.DNS_TYPE_MAILB": "syscall", + "syscall.DNS_TYPE_MB": "syscall", + "syscall.DNS_TYPE_MD": "syscall", + "syscall.DNS_TYPE_MF": "syscall", + "syscall.DNS_TYPE_MG": "syscall", + "syscall.DNS_TYPE_MINFO": "syscall", + "syscall.DNS_TYPE_MR": "syscall", + "syscall.DNS_TYPE_MX": "syscall", + "syscall.DNS_TYPE_NAPTR": "syscall", + "syscall.DNS_TYPE_NBSTAT": "syscall", + "syscall.DNS_TYPE_NIMLOC": "syscall", + "syscall.DNS_TYPE_NS": "syscall", + "syscall.DNS_TYPE_NSAP": "syscall", + "syscall.DNS_TYPE_NSAPPTR": "syscall", + "syscall.DNS_TYPE_NSEC": "syscall", + "syscall.DNS_TYPE_NULL": "syscall", + "syscall.DNS_TYPE_NXT": "syscall", + "syscall.DNS_TYPE_OPT": "syscall", + "syscall.DNS_TYPE_PTR": "syscall", + "syscall.DNS_TYPE_PX": "syscall", + "syscall.DNS_TYPE_RP": "syscall", + "syscall.DNS_TYPE_RRSIG": "syscall", + "syscall.DNS_TYPE_RT": "syscall", + "syscall.DNS_TYPE_SIG": "syscall", + "syscall.DNS_TYPE_SINK": "syscall", + "syscall.DNS_TYPE_SOA": "syscall", + "syscall.DNS_TYPE_SRV": "syscall", + "syscall.DNS_TYPE_TEXT": "syscall", + "syscall.DNS_TYPE_TKEY": "syscall", + "syscall.DNS_TYPE_TSIG": "syscall", + "syscall.DNS_TYPE_UID": "syscall", + "syscall.DNS_TYPE_UINFO": "syscall", + "syscall.DNS_TYPE_UNSPEC": "syscall", + "syscall.DNS_TYPE_WINS": "syscall", + "syscall.DNS_TYPE_WINSR": "syscall", + "syscall.DNS_TYPE_WKS": "syscall", + "syscall.DNS_TYPE_X25": "syscall", + "syscall.DT_BLK": "syscall", + "syscall.DT_CHR": "syscall", + "syscall.DT_DIR": "syscall", + "syscall.DT_FIFO": "syscall", + "syscall.DT_LNK": "syscall", + "syscall.DT_REG": "syscall", + "syscall.DT_SOCK": "syscall", + "syscall.DT_UNKNOWN": "syscall", + "syscall.DT_WHT": "syscall", + "syscall.DUPLICATE_CLOSE_SOURCE": "syscall", + "syscall.DUPLICATE_SAME_ACCESS": "syscall", + "syscall.DeleteFile": "syscall", + "syscall.DetachLsf": "syscall", + "syscall.DeviceIoControl": "syscall", + "syscall.Dirent": "syscall", + "syscall.DnsNameCompare": "syscall", + "syscall.DnsQuery": "syscall", + "syscall.DnsRecordListFree": "syscall", + "syscall.DnsSectionAdditional": "syscall", + "syscall.DnsSectionAnswer": "syscall", + "syscall.DnsSectionAuthority": "syscall", + "syscall.DnsSectionQuestion": "syscall", + "syscall.Dup": "syscall", + "syscall.Dup2": "syscall", + "syscall.Dup3": "syscall", + "syscall.DuplicateHandle": "syscall", + "syscall.E2BIG": "syscall", + "syscall.EACCES": "syscall", + "syscall.EADDRINUSE": "syscall", + "syscall.EADDRNOTAVAIL": "syscall", + "syscall.EADV": "syscall", + "syscall.EAFNOSUPPORT": "syscall", + "syscall.EAGAIN": "syscall", + "syscall.EALREADY": "syscall", + "syscall.EAUTH": "syscall", + "syscall.EBADARCH": "syscall", + "syscall.EBADE": "syscall", + "syscall.EBADEXEC": "syscall", + "syscall.EBADF": "syscall", + "syscall.EBADFD": "syscall", + "syscall.EBADMACHO": "syscall", + "syscall.EBADMSG": "syscall", + "syscall.EBADR": "syscall", + "syscall.EBADRPC": "syscall", + "syscall.EBADRQC": "syscall", + "syscall.EBADSLT": "syscall", + "syscall.EBFONT": "syscall", + "syscall.EBUSY": "syscall", + "syscall.ECANCELED": "syscall", + "syscall.ECAPMODE": "syscall", + "syscall.ECHILD": "syscall", + "syscall.ECHO": "syscall", + "syscall.ECHOCTL": "syscall", + "syscall.ECHOE": "syscall", + "syscall.ECHOK": "syscall", + "syscall.ECHOKE": "syscall", + "syscall.ECHONL": "syscall", + "syscall.ECHOPRT": "syscall", + "syscall.ECHRNG": "syscall", + "syscall.ECOMM": "syscall", + "syscall.ECONNABORTED": "syscall", + "syscall.ECONNREFUSED": "syscall", + "syscall.ECONNRESET": "syscall", + "syscall.EDEADLK": "syscall", + "syscall.EDEADLOCK": "syscall", + "syscall.EDESTADDRREQ": "syscall", + "syscall.EDEVERR": "syscall", + "syscall.EDOM": "syscall", + "syscall.EDOOFUS": "syscall", + "syscall.EDOTDOT": "syscall", + "syscall.EDQUOT": "syscall", + "syscall.EEXIST": "syscall", + "syscall.EFAULT": "syscall", + "syscall.EFBIG": "syscall", + "syscall.EFER_LMA": "syscall", + "syscall.EFER_LME": "syscall", + "syscall.EFER_NXE": "syscall", + "syscall.EFER_SCE": "syscall", + "syscall.EFTYPE": "syscall", + "syscall.EHOSTDOWN": "syscall", + "syscall.EHOSTUNREACH": "syscall", + "syscall.EHWPOISON": "syscall", + "syscall.EIDRM": "syscall", + "syscall.EILSEQ": "syscall", + "syscall.EINPROGRESS": "syscall", + "syscall.EINTR": "syscall", + "syscall.EINVAL": "syscall", + "syscall.EIO": "syscall", + "syscall.EIPSEC": "syscall", + "syscall.EISCONN": "syscall", + "syscall.EISDIR": "syscall", + "syscall.EISNAM": "syscall", + "syscall.EKEYEXPIRED": "syscall", + "syscall.EKEYREJECTED": "syscall", + "syscall.EKEYREVOKED": "syscall", + "syscall.EL2HLT": "syscall", + "syscall.EL2NSYNC": "syscall", + "syscall.EL3HLT": "syscall", + "syscall.EL3RST": "syscall", + "syscall.ELAST": "syscall", + "syscall.ELF_NGREG": "syscall", + "syscall.ELF_PRARGSZ": "syscall", + "syscall.ELIBACC": "syscall", + "syscall.ELIBBAD": "syscall", + "syscall.ELIBEXEC": "syscall", + "syscall.ELIBMAX": "syscall", + "syscall.ELIBSCN": "syscall", + "syscall.ELNRNG": "syscall", + "syscall.ELOOP": "syscall", + "syscall.EMEDIUMTYPE": "syscall", + "syscall.EMFILE": "syscall", + "syscall.EMLINK": "syscall", + "syscall.EMSGSIZE": "syscall", + "syscall.EMT_TAGOVF": "syscall", + "syscall.EMULTIHOP": "syscall", + "syscall.EMUL_ENABLED": "syscall", + "syscall.EMUL_LINUX": "syscall", + "syscall.EMUL_LINUX32": "syscall", + "syscall.EMUL_MAXID": "syscall", + "syscall.EMUL_NATIVE": "syscall", + "syscall.ENAMETOOLONG": "syscall", + "syscall.ENAVAIL": "syscall", + "syscall.ENDRUNDISC": "syscall", + "syscall.ENEEDAUTH": "syscall", + "syscall.ENETDOWN": "syscall", + "syscall.ENETRESET": "syscall", + "syscall.ENETUNREACH": "syscall", + "syscall.ENFILE": "syscall", + "syscall.ENOANO": "syscall", + "syscall.ENOATTR": "syscall", + "syscall.ENOBUFS": "syscall", + "syscall.ENOCSI": "syscall", + "syscall.ENODATA": "syscall", + "syscall.ENODEV": "syscall", + "syscall.ENOENT": "syscall", + "syscall.ENOEXEC": "syscall", + "syscall.ENOKEY": "syscall", + "syscall.ENOLCK": "syscall", + "syscall.ENOLINK": "syscall", + "syscall.ENOMEDIUM": "syscall", + "syscall.ENOMEM": "syscall", + "syscall.ENOMSG": "syscall", + "syscall.ENONET": "syscall", + "syscall.ENOPKG": "syscall", + "syscall.ENOPOLICY": "syscall", + "syscall.ENOPROTOOPT": "syscall", + "syscall.ENOSPC": "syscall", + "syscall.ENOSR": "syscall", + "syscall.ENOSTR": "syscall", + "syscall.ENOSYS": "syscall", + "syscall.ENOTBLK": "syscall", + "syscall.ENOTCAPABLE": "syscall", + "syscall.ENOTCONN": "syscall", + "syscall.ENOTDIR": "syscall", + "syscall.ENOTEMPTY": "syscall", + "syscall.ENOTNAM": "syscall", + "syscall.ENOTRECOVERABLE": "syscall", + "syscall.ENOTSOCK": "syscall", + "syscall.ENOTSUP": "syscall", + "syscall.ENOTTY": "syscall", + "syscall.ENOTUNIQ": "syscall", + "syscall.ENXIO": "syscall", + "syscall.EN_SW_CTL_INF": "syscall", + "syscall.EN_SW_CTL_PREC": "syscall", + "syscall.EN_SW_CTL_ROUND": "syscall", + "syscall.EN_SW_DATACHAIN": "syscall", + "syscall.EN_SW_DENORM": "syscall", + "syscall.EN_SW_INVOP": "syscall", + "syscall.EN_SW_OVERFLOW": "syscall", + "syscall.EN_SW_PRECLOSS": "syscall", + "syscall.EN_SW_UNDERFLOW": "syscall", + "syscall.EN_SW_ZERODIV": "syscall", + "syscall.EOPNOTSUPP": "syscall", + "syscall.EOVERFLOW": "syscall", + "syscall.EOWNERDEAD": "syscall", + "syscall.EPERM": "syscall", + "syscall.EPFNOSUPPORT": "syscall", + "syscall.EPIPE": "syscall", + "syscall.EPOLLERR": "syscall", + "syscall.EPOLLET": "syscall", + "syscall.EPOLLHUP": "syscall", + "syscall.EPOLLIN": "syscall", + "syscall.EPOLLMSG": "syscall", + "syscall.EPOLLONESHOT": "syscall", + "syscall.EPOLLOUT": "syscall", + "syscall.EPOLLPRI": "syscall", + "syscall.EPOLLRDBAND": "syscall", + "syscall.EPOLLRDHUP": "syscall", + "syscall.EPOLLRDNORM": "syscall", + "syscall.EPOLLWRBAND": "syscall", + "syscall.EPOLLWRNORM": "syscall", + "syscall.EPOLL_CLOEXEC": "syscall", + "syscall.EPOLL_CTL_ADD": "syscall", + "syscall.EPOLL_CTL_DEL": "syscall", + "syscall.EPOLL_CTL_MOD": "syscall", + "syscall.EPOLL_NONBLOCK": "syscall", + "syscall.EPROCLIM": "syscall", + "syscall.EPROCUNAVAIL": "syscall", + "syscall.EPROGMISMATCH": "syscall", + "syscall.EPROGUNAVAIL": "syscall", + "syscall.EPROTO": "syscall", + "syscall.EPROTONOSUPPORT": "syscall", + "syscall.EPROTOTYPE": "syscall", + "syscall.EPWROFF": "syscall", + "syscall.ERANGE": "syscall", + "syscall.EREMCHG": "syscall", + "syscall.EREMOTE": "syscall", + "syscall.EREMOTEIO": "syscall", + "syscall.ERESTART": "syscall", + "syscall.ERFKILL": "syscall", + "syscall.EROFS": "syscall", + "syscall.ERPCMISMATCH": "syscall", + "syscall.ERROR_ACCESS_DENIED": "syscall", + "syscall.ERROR_ALREADY_EXISTS": "syscall", + "syscall.ERROR_BROKEN_PIPE": "syscall", + "syscall.ERROR_BUFFER_OVERFLOW": "syscall", + "syscall.ERROR_ENVVAR_NOT_FOUND": "syscall", + "syscall.ERROR_FILE_EXISTS": "syscall", + "syscall.ERROR_FILE_NOT_FOUND": "syscall", + "syscall.ERROR_HANDLE_EOF": "syscall", + "syscall.ERROR_INSUFFICIENT_BUFFER": "syscall", + "syscall.ERROR_IO_PENDING": "syscall", + "syscall.ERROR_MOD_NOT_FOUND": "syscall", + "syscall.ERROR_MORE_DATA": "syscall", + "syscall.ERROR_NETNAME_DELETED": "syscall", + "syscall.ERROR_NOT_FOUND": "syscall", + "syscall.ERROR_NO_MORE_FILES": "syscall", + "syscall.ERROR_OPERATION_ABORTED": "syscall", + "syscall.ERROR_PATH_NOT_FOUND": "syscall", + "syscall.ERROR_PRIVILEGE_NOT_HELD": "syscall", + "syscall.ERROR_PROC_NOT_FOUND": "syscall", + "syscall.ESHLIBVERS": "syscall", + "syscall.ESHUTDOWN": "syscall", + "syscall.ESOCKTNOSUPPORT": "syscall", + "syscall.ESPIPE": "syscall", + "syscall.ESRCH": "syscall", + "syscall.ESRMNT": "syscall", + "syscall.ESTALE": "syscall", + "syscall.ESTRPIPE": "syscall", + "syscall.ETHERCAP_JUMBO_MTU": "syscall", + "syscall.ETHERCAP_VLAN_HWTAGGING": "syscall", + "syscall.ETHERCAP_VLAN_MTU": "syscall", + "syscall.ETHERMIN": "syscall", + "syscall.ETHERMTU": "syscall", + "syscall.ETHERMTU_JUMBO": "syscall", + "syscall.ETHERTYPE_8023": "syscall", + "syscall.ETHERTYPE_AARP": "syscall", + "syscall.ETHERTYPE_ACCTON": "syscall", + "syscall.ETHERTYPE_AEONIC": "syscall", + "syscall.ETHERTYPE_ALPHA": "syscall", + "syscall.ETHERTYPE_AMBER": "syscall", + "syscall.ETHERTYPE_AMOEBA": "syscall", + "syscall.ETHERTYPE_AOE": "syscall", + "syscall.ETHERTYPE_APOLLO": "syscall", + "syscall.ETHERTYPE_APOLLODOMAIN": "syscall", + "syscall.ETHERTYPE_APPLETALK": "syscall", + "syscall.ETHERTYPE_APPLITEK": "syscall", + "syscall.ETHERTYPE_ARGONAUT": "syscall", + "syscall.ETHERTYPE_ARP": "syscall", + "syscall.ETHERTYPE_AT": "syscall", + "syscall.ETHERTYPE_ATALK": "syscall", + "syscall.ETHERTYPE_ATOMIC": "syscall", + "syscall.ETHERTYPE_ATT": "syscall", + "syscall.ETHERTYPE_ATTSTANFORD": "syscall", + "syscall.ETHERTYPE_AUTOPHON": "syscall", + "syscall.ETHERTYPE_AXIS": "syscall", + "syscall.ETHERTYPE_BCLOOP": "syscall", + "syscall.ETHERTYPE_BOFL": "syscall", + "syscall.ETHERTYPE_CABLETRON": "syscall", + "syscall.ETHERTYPE_CHAOS": "syscall", + "syscall.ETHERTYPE_COMDESIGN": "syscall", + "syscall.ETHERTYPE_COMPUGRAPHIC": "syscall", + "syscall.ETHERTYPE_COUNTERPOINT": "syscall", + "syscall.ETHERTYPE_CRONUS": "syscall", + "syscall.ETHERTYPE_CRONUSVLN": "syscall", + "syscall.ETHERTYPE_DCA": "syscall", + "syscall.ETHERTYPE_DDE": "syscall", + "syscall.ETHERTYPE_DEBNI": "syscall", + "syscall.ETHERTYPE_DECAM": "syscall", + "syscall.ETHERTYPE_DECCUST": "syscall", + "syscall.ETHERTYPE_DECDIAG": "syscall", + "syscall.ETHERTYPE_DECDNS": "syscall", + "syscall.ETHERTYPE_DECDTS": "syscall", + "syscall.ETHERTYPE_DECEXPER": "syscall", + "syscall.ETHERTYPE_DECLAST": "syscall", + "syscall.ETHERTYPE_DECLTM": "syscall", + "syscall.ETHERTYPE_DECMUMPS": "syscall", + "syscall.ETHERTYPE_DECNETBIOS": "syscall", + "syscall.ETHERTYPE_DELTACON": "syscall", + "syscall.ETHERTYPE_DIDDLE": "syscall", + "syscall.ETHERTYPE_DLOG1": "syscall", + "syscall.ETHERTYPE_DLOG2": "syscall", + "syscall.ETHERTYPE_DN": "syscall", + "syscall.ETHERTYPE_DOGFIGHT": "syscall", + "syscall.ETHERTYPE_DSMD": "syscall", + "syscall.ETHERTYPE_ECMA": "syscall", + "syscall.ETHERTYPE_ENCRYPT": "syscall", + "syscall.ETHERTYPE_ES": "syscall", + "syscall.ETHERTYPE_EXCELAN": "syscall", + "syscall.ETHERTYPE_EXPERDATA": "syscall", + "syscall.ETHERTYPE_FLIP": "syscall", + "syscall.ETHERTYPE_FLOWCONTROL": "syscall", + "syscall.ETHERTYPE_FRARP": "syscall", + "syscall.ETHERTYPE_GENDYN": "syscall", + "syscall.ETHERTYPE_HAYES": "syscall", + "syscall.ETHERTYPE_HIPPI_FP": "syscall", + "syscall.ETHERTYPE_HITACHI": "syscall", + "syscall.ETHERTYPE_HP": "syscall", + "syscall.ETHERTYPE_IEEEPUP": "syscall", + "syscall.ETHERTYPE_IEEEPUPAT": "syscall", + "syscall.ETHERTYPE_IMLBL": "syscall", + "syscall.ETHERTYPE_IMLBLDIAG": "syscall", + "syscall.ETHERTYPE_IP": "syscall", + "syscall.ETHERTYPE_IPAS": "syscall", + "syscall.ETHERTYPE_IPV6": "syscall", + "syscall.ETHERTYPE_IPX": "syscall", + "syscall.ETHERTYPE_IPXNEW": "syscall", + "syscall.ETHERTYPE_KALPANA": "syscall", + "syscall.ETHERTYPE_LANBRIDGE": "syscall", + "syscall.ETHERTYPE_LANPROBE": "syscall", + "syscall.ETHERTYPE_LAT": "syscall", + "syscall.ETHERTYPE_LBACK": "syscall", + "syscall.ETHERTYPE_LITTLE": "syscall", + "syscall.ETHERTYPE_LLDP": "syscall", + "syscall.ETHERTYPE_LOGICRAFT": "syscall", + "syscall.ETHERTYPE_LOOPBACK": "syscall", + "syscall.ETHERTYPE_MATRA": "syscall", + "syscall.ETHERTYPE_MAX": "syscall", + "syscall.ETHERTYPE_MERIT": "syscall", + "syscall.ETHERTYPE_MICP": "syscall", + "syscall.ETHERTYPE_MOPDL": "syscall", + "syscall.ETHERTYPE_MOPRC": "syscall", + "syscall.ETHERTYPE_MOTOROLA": "syscall", + "syscall.ETHERTYPE_MPLS": "syscall", + "syscall.ETHERTYPE_MPLS_MCAST": "syscall", + "syscall.ETHERTYPE_MUMPS": "syscall", + "syscall.ETHERTYPE_NBPCC": "syscall", + "syscall.ETHERTYPE_NBPCLAIM": "syscall", + "syscall.ETHERTYPE_NBPCLREQ": "syscall", + "syscall.ETHERTYPE_NBPCLRSP": "syscall", + "syscall.ETHERTYPE_NBPCREQ": "syscall", + "syscall.ETHERTYPE_NBPCRSP": "syscall", + "syscall.ETHERTYPE_NBPDG": "syscall", + "syscall.ETHERTYPE_NBPDGB": "syscall", + "syscall.ETHERTYPE_NBPDLTE": "syscall", + "syscall.ETHERTYPE_NBPRAR": "syscall", + "syscall.ETHERTYPE_NBPRAS": "syscall", + "syscall.ETHERTYPE_NBPRST": "syscall", + "syscall.ETHERTYPE_NBPSCD": "syscall", + "syscall.ETHERTYPE_NBPVCD": "syscall", + "syscall.ETHERTYPE_NBS": "syscall", + "syscall.ETHERTYPE_NCD": "syscall", + "syscall.ETHERTYPE_NESTAR": "syscall", + "syscall.ETHERTYPE_NETBEUI": "syscall", + "syscall.ETHERTYPE_NOVELL": "syscall", + "syscall.ETHERTYPE_NS": "syscall", + "syscall.ETHERTYPE_NSAT": "syscall", + "syscall.ETHERTYPE_NSCOMPAT": "syscall", + "syscall.ETHERTYPE_NTRAILER": "syscall", + "syscall.ETHERTYPE_OS9": "syscall", + "syscall.ETHERTYPE_OS9NET": "syscall", + "syscall.ETHERTYPE_PACER": "syscall", + "syscall.ETHERTYPE_PAE": "syscall", + "syscall.ETHERTYPE_PCS": "syscall", + "syscall.ETHERTYPE_PLANNING": "syscall", + "syscall.ETHERTYPE_PPP": "syscall", + "syscall.ETHERTYPE_PPPOE": "syscall", + "syscall.ETHERTYPE_PPPOEDISC": "syscall", + "syscall.ETHERTYPE_PRIMENTS": "syscall", + "syscall.ETHERTYPE_PUP": "syscall", + "syscall.ETHERTYPE_PUPAT": "syscall", + "syscall.ETHERTYPE_QINQ": "syscall", + "syscall.ETHERTYPE_RACAL": "syscall", + "syscall.ETHERTYPE_RATIONAL": "syscall", + "syscall.ETHERTYPE_RAWFR": "syscall", + "syscall.ETHERTYPE_RCL": "syscall", + "syscall.ETHERTYPE_RDP": "syscall", + "syscall.ETHERTYPE_RETIX": "syscall", + "syscall.ETHERTYPE_REVARP": "syscall", + "syscall.ETHERTYPE_SCA": "syscall", + "syscall.ETHERTYPE_SECTRA": "syscall", + "syscall.ETHERTYPE_SECUREDATA": "syscall", + "syscall.ETHERTYPE_SGITW": "syscall", + "syscall.ETHERTYPE_SG_BOUNCE": "syscall", + "syscall.ETHERTYPE_SG_DIAG": "syscall", + "syscall.ETHERTYPE_SG_NETGAMES": "syscall", + "syscall.ETHERTYPE_SG_RESV": "syscall", + "syscall.ETHERTYPE_SIMNET": "syscall", + "syscall.ETHERTYPE_SLOW": "syscall", + "syscall.ETHERTYPE_SLOWPROTOCOLS": "syscall", + "syscall.ETHERTYPE_SNA": "syscall", + "syscall.ETHERTYPE_SNMP": "syscall", + "syscall.ETHERTYPE_SONIX": "syscall", + "syscall.ETHERTYPE_SPIDER": "syscall", + "syscall.ETHERTYPE_SPRITE": "syscall", + "syscall.ETHERTYPE_STP": "syscall", + "syscall.ETHERTYPE_TALARIS": "syscall", + "syscall.ETHERTYPE_TALARISMC": "syscall", + "syscall.ETHERTYPE_TCPCOMP": "syscall", + "syscall.ETHERTYPE_TCPSM": "syscall", + "syscall.ETHERTYPE_TEC": "syscall", + "syscall.ETHERTYPE_TIGAN": "syscall", + "syscall.ETHERTYPE_TRAIL": "syscall", + "syscall.ETHERTYPE_TRANSETHER": "syscall", + "syscall.ETHERTYPE_TYMSHARE": "syscall", + "syscall.ETHERTYPE_UBBST": "syscall", + "syscall.ETHERTYPE_UBDEBUG": "syscall", + "syscall.ETHERTYPE_UBDIAGLOOP": "syscall", + "syscall.ETHERTYPE_UBDL": "syscall", + "syscall.ETHERTYPE_UBNIU": "syscall", + "syscall.ETHERTYPE_UBNMC": "syscall", + "syscall.ETHERTYPE_VALID": "syscall", + "syscall.ETHERTYPE_VARIAN": "syscall", + "syscall.ETHERTYPE_VAXELN": "syscall", + "syscall.ETHERTYPE_VEECO": "syscall", + "syscall.ETHERTYPE_VEXP": "syscall", + "syscall.ETHERTYPE_VGLAB": "syscall", + "syscall.ETHERTYPE_VINES": "syscall", + "syscall.ETHERTYPE_VINESECHO": "syscall", + "syscall.ETHERTYPE_VINESLOOP": "syscall", + "syscall.ETHERTYPE_VITAL": "syscall", + "syscall.ETHERTYPE_VLAN": "syscall", + "syscall.ETHERTYPE_VLTLMAN": "syscall", + "syscall.ETHERTYPE_VPROD": "syscall", + "syscall.ETHERTYPE_VURESERVED": "syscall", + "syscall.ETHERTYPE_WATERLOO": "syscall", + "syscall.ETHERTYPE_WELLFLEET": "syscall", + "syscall.ETHERTYPE_X25": "syscall", + "syscall.ETHERTYPE_X75": "syscall", + "syscall.ETHERTYPE_XNSSM": "syscall", + "syscall.ETHERTYPE_XTP": "syscall", + "syscall.ETHER_ADDR_LEN": "syscall", + "syscall.ETHER_ALIGN": "syscall", + "syscall.ETHER_CRC_LEN": "syscall", + "syscall.ETHER_CRC_POLY_BE": "syscall", + "syscall.ETHER_CRC_POLY_LE": "syscall", + "syscall.ETHER_HDR_LEN": "syscall", + "syscall.ETHER_MAX_DIX_LEN": "syscall", + "syscall.ETHER_MAX_LEN": "syscall", + "syscall.ETHER_MAX_LEN_JUMBO": "syscall", + "syscall.ETHER_MIN_LEN": "syscall", + "syscall.ETHER_PPPOE_ENCAP_LEN": "syscall", + "syscall.ETHER_TYPE_LEN": "syscall", + "syscall.ETHER_VLAN_ENCAP_LEN": "syscall", + "syscall.ETH_P_1588": "syscall", + "syscall.ETH_P_8021Q": "syscall", + "syscall.ETH_P_802_2": "syscall", + "syscall.ETH_P_802_3": "syscall", + "syscall.ETH_P_AARP": "syscall", + "syscall.ETH_P_ALL": "syscall", + "syscall.ETH_P_AOE": "syscall", + "syscall.ETH_P_ARCNET": "syscall", + "syscall.ETH_P_ARP": "syscall", + "syscall.ETH_P_ATALK": "syscall", + "syscall.ETH_P_ATMFATE": "syscall", + "syscall.ETH_P_ATMMPOA": "syscall", + "syscall.ETH_P_AX25": "syscall", + "syscall.ETH_P_BPQ": "syscall", + "syscall.ETH_P_CAIF": "syscall", + "syscall.ETH_P_CAN": "syscall", + "syscall.ETH_P_CONTROL": "syscall", + "syscall.ETH_P_CUST": "syscall", + "syscall.ETH_P_DDCMP": "syscall", + "syscall.ETH_P_DEC": "syscall", + "syscall.ETH_P_DIAG": "syscall", + "syscall.ETH_P_DNA_DL": "syscall", + "syscall.ETH_P_DNA_RC": "syscall", + "syscall.ETH_P_DNA_RT": "syscall", + "syscall.ETH_P_DSA": "syscall", + "syscall.ETH_P_ECONET": "syscall", + "syscall.ETH_P_EDSA": "syscall", + "syscall.ETH_P_FCOE": "syscall", + "syscall.ETH_P_FIP": "syscall", + "syscall.ETH_P_HDLC": "syscall", + "syscall.ETH_P_IEEE802154": "syscall", + "syscall.ETH_P_IEEEPUP": "syscall", + "syscall.ETH_P_IEEEPUPAT": "syscall", + "syscall.ETH_P_IP": "syscall", + "syscall.ETH_P_IPV6": "syscall", + "syscall.ETH_P_IPX": "syscall", + "syscall.ETH_P_IRDA": "syscall", + "syscall.ETH_P_LAT": "syscall", + "syscall.ETH_P_LINK_CTL": "syscall", + "syscall.ETH_P_LOCALTALK": "syscall", + "syscall.ETH_P_LOOP": "syscall", + "syscall.ETH_P_MOBITEX": "syscall", + "syscall.ETH_P_MPLS_MC": "syscall", + "syscall.ETH_P_MPLS_UC": "syscall", + "syscall.ETH_P_PAE": "syscall", + "syscall.ETH_P_PAUSE": "syscall", + "syscall.ETH_P_PHONET": "syscall", + "syscall.ETH_P_PPPTALK": "syscall", + "syscall.ETH_P_PPP_DISC": "syscall", + "syscall.ETH_P_PPP_MP": "syscall", + "syscall.ETH_P_PPP_SES": "syscall", + "syscall.ETH_P_PUP": "syscall", + "syscall.ETH_P_PUPAT": "syscall", + "syscall.ETH_P_RARP": "syscall", + "syscall.ETH_P_SCA": "syscall", + "syscall.ETH_P_SLOW": "syscall", + "syscall.ETH_P_SNAP": "syscall", + "syscall.ETH_P_TEB": "syscall", + "syscall.ETH_P_TIPC": "syscall", + "syscall.ETH_P_TRAILER": "syscall", + "syscall.ETH_P_TR_802_2": "syscall", + "syscall.ETH_P_WAN_PPP": "syscall", + "syscall.ETH_P_WCCP": "syscall", + "syscall.ETH_P_X25": "syscall", + "syscall.ETIME": "syscall", + "syscall.ETIMEDOUT": "syscall", + "syscall.ETOOMANYREFS": "syscall", + "syscall.ETXTBSY": "syscall", + "syscall.EUCLEAN": "syscall", + "syscall.EUNATCH": "syscall", + "syscall.EUSERS": "syscall", + "syscall.EVFILT_AIO": "syscall", + "syscall.EVFILT_FS": "syscall", + "syscall.EVFILT_LIO": "syscall", + "syscall.EVFILT_MACHPORT": "syscall", + "syscall.EVFILT_PROC": "syscall", + "syscall.EVFILT_READ": "syscall", + "syscall.EVFILT_SIGNAL": "syscall", + "syscall.EVFILT_SYSCOUNT": "syscall", + "syscall.EVFILT_THREADMARKER": "syscall", + "syscall.EVFILT_TIMER": "syscall", + "syscall.EVFILT_USER": "syscall", + "syscall.EVFILT_VM": "syscall", + "syscall.EVFILT_VNODE": "syscall", + "syscall.EVFILT_WRITE": "syscall", + "syscall.EV_ADD": "syscall", + "syscall.EV_CLEAR": "syscall", + "syscall.EV_DELETE": "syscall", + "syscall.EV_DISABLE": "syscall", + "syscall.EV_DISPATCH": "syscall", + "syscall.EV_DROP": "syscall", + "syscall.EV_ENABLE": "syscall", + "syscall.EV_EOF": "syscall", + "syscall.EV_ERROR": "syscall", + "syscall.EV_FLAG0": "syscall", + "syscall.EV_FLAG1": "syscall", + "syscall.EV_ONESHOT": "syscall", + "syscall.EV_OOBAND": "syscall", + "syscall.EV_POLL": "syscall", + "syscall.EV_RECEIPT": "syscall", + "syscall.EV_SYSFLAGS": "syscall", + "syscall.EWINDOWS": "syscall", + "syscall.EWOULDBLOCK": "syscall", + "syscall.EXDEV": "syscall", + "syscall.EXFULL": "syscall", + "syscall.EXTA": "syscall", + "syscall.EXTB": "syscall", + "syscall.EXTPROC": "syscall", + "syscall.Environ": "syscall", + "syscall.EpollCreate": "syscall", + "syscall.EpollCreate1": "syscall", + "syscall.EpollCtl": "syscall", + "syscall.EpollEvent": "syscall", + "syscall.EpollWait": "syscall", + "syscall.Errno": "syscall", + "syscall.EscapeArg": "syscall", + "syscall.Exchangedata": "syscall", + "syscall.Exec": "syscall", + "syscall.Exit": "syscall", + "syscall.ExitProcess": "syscall", + "syscall.FD_CLOEXEC": "syscall", + "syscall.FD_SETSIZE": "syscall", + "syscall.FILE_ACTION_ADDED": "syscall", + "syscall.FILE_ACTION_MODIFIED": "syscall", + "syscall.FILE_ACTION_REMOVED": "syscall", + "syscall.FILE_ACTION_RENAMED_NEW_NAME": "syscall", + "syscall.FILE_ACTION_RENAMED_OLD_NAME": "syscall", + "syscall.FILE_APPEND_DATA": "syscall", + "syscall.FILE_ATTRIBUTE_ARCHIVE": "syscall", + "syscall.FILE_ATTRIBUTE_DIRECTORY": "syscall", + "syscall.FILE_ATTRIBUTE_HIDDEN": "syscall", + "syscall.FILE_ATTRIBUTE_NORMAL": "syscall", + "syscall.FILE_ATTRIBUTE_READONLY": "syscall", + "syscall.FILE_ATTRIBUTE_REPARSE_POINT": "syscall", + "syscall.FILE_ATTRIBUTE_SYSTEM": "syscall", + "syscall.FILE_BEGIN": "syscall", + "syscall.FILE_CURRENT": "syscall", + "syscall.FILE_END": "syscall", + "syscall.FILE_FLAG_BACKUP_SEMANTICS": "syscall", + "syscall.FILE_FLAG_OPEN_REPARSE_POINT": "syscall", + "syscall.FILE_FLAG_OVERLAPPED": "syscall", + "syscall.FILE_LIST_DIRECTORY": "syscall", + "syscall.FILE_MAP_COPY": "syscall", + "syscall.FILE_MAP_EXECUTE": "syscall", + "syscall.FILE_MAP_READ": "syscall", + "syscall.FILE_MAP_WRITE": "syscall", + "syscall.FILE_NOTIFY_CHANGE_ATTRIBUTES": "syscall", + "syscall.FILE_NOTIFY_CHANGE_CREATION": "syscall", + "syscall.FILE_NOTIFY_CHANGE_DIR_NAME": "syscall", + "syscall.FILE_NOTIFY_CHANGE_FILE_NAME": "syscall", + "syscall.FILE_NOTIFY_CHANGE_LAST_ACCESS": "syscall", + "syscall.FILE_NOTIFY_CHANGE_LAST_WRITE": "syscall", + "syscall.FILE_NOTIFY_CHANGE_SIZE": "syscall", + "syscall.FILE_SHARE_DELETE": "syscall", + "syscall.FILE_SHARE_READ": "syscall", + "syscall.FILE_SHARE_WRITE": "syscall", + "syscall.FILE_SKIP_COMPLETION_PORT_ON_SUCCESS": "syscall", + "syscall.FILE_SKIP_SET_EVENT_ON_HANDLE": "syscall", + "syscall.FILE_TYPE_CHAR": "syscall", + "syscall.FILE_TYPE_DISK": "syscall", + "syscall.FILE_TYPE_PIPE": "syscall", + "syscall.FILE_TYPE_REMOTE": "syscall", + "syscall.FILE_TYPE_UNKNOWN": "syscall", + "syscall.FILE_WRITE_ATTRIBUTES": "syscall", + "syscall.FLUSHO": "syscall", + "syscall.FORMAT_MESSAGE_ALLOCATE_BUFFER": "syscall", + "syscall.FORMAT_MESSAGE_ARGUMENT_ARRAY": "syscall", + "syscall.FORMAT_MESSAGE_FROM_HMODULE": "syscall", + "syscall.FORMAT_MESSAGE_FROM_STRING": "syscall", + "syscall.FORMAT_MESSAGE_FROM_SYSTEM": "syscall", + "syscall.FORMAT_MESSAGE_IGNORE_INSERTS": "syscall", + "syscall.FORMAT_MESSAGE_MAX_WIDTH_MASK": "syscall", + "syscall.FSCTL_GET_REPARSE_POINT": "syscall", + "syscall.F_ADDFILESIGS": "syscall", + "syscall.F_ADDSIGS": "syscall", + "syscall.F_ALLOCATEALL": "syscall", + "syscall.F_ALLOCATECONTIG": "syscall", + "syscall.F_CANCEL": "syscall", + "syscall.F_CHKCLEAN": "syscall", + "syscall.F_CLOSEM": "syscall", + "syscall.F_DUP2FD": "syscall", + "syscall.F_DUP2FD_CLOEXEC": "syscall", + "syscall.F_DUPFD": "syscall", + "syscall.F_DUPFD_CLOEXEC": "syscall", + "syscall.F_EXLCK": "syscall", + "syscall.F_FLUSH_DATA": "syscall", + "syscall.F_FREEZE_FS": "syscall", + "syscall.F_FSCTL": "syscall", + "syscall.F_FSDIRMASK": "syscall", + "syscall.F_FSIN": "syscall", + "syscall.F_FSINOUT": "syscall", + "syscall.F_FSOUT": "syscall", + "syscall.F_FSPRIV": "syscall", + "syscall.F_FSVOID": "syscall", + "syscall.F_FULLFSYNC": "syscall", + "syscall.F_GETFD": "syscall", + "syscall.F_GETFL": "syscall", + "syscall.F_GETLEASE": "syscall", + "syscall.F_GETLK": "syscall", + "syscall.F_GETLK64": "syscall", + "syscall.F_GETLKPID": "syscall", + "syscall.F_GETNOSIGPIPE": "syscall", + "syscall.F_GETOWN": "syscall", + "syscall.F_GETOWN_EX": "syscall", + "syscall.F_GETPATH": "syscall", + "syscall.F_GETPATH_MTMINFO": "syscall", + "syscall.F_GETPIPE_SZ": "syscall", + "syscall.F_GETPROTECTIONCLASS": "syscall", + "syscall.F_GETSIG": "syscall", + "syscall.F_GLOBAL_NOCACHE": "syscall", + "syscall.F_LOCK": "syscall", + "syscall.F_LOG2PHYS": "syscall", + "syscall.F_LOG2PHYS_EXT": "syscall", + "syscall.F_MARKDEPENDENCY": "syscall", + "syscall.F_MAXFD": "syscall", + "syscall.F_NOCACHE": "syscall", + "syscall.F_NODIRECT": "syscall", + "syscall.F_NOTIFY": "syscall", + "syscall.F_OGETLK": "syscall", + "syscall.F_OK": "syscall", + "syscall.F_OSETLK": "syscall", + "syscall.F_OSETLKW": "syscall", + "syscall.F_PARAM_MASK": "syscall", + "syscall.F_PARAM_MAX": "syscall", + "syscall.F_PATHPKG_CHECK": "syscall", + "syscall.F_PEOFPOSMODE": "syscall", + "syscall.F_PREALLOCATE": "syscall", + "syscall.F_RDADVISE": "syscall", + "syscall.F_RDAHEAD": "syscall", + "syscall.F_RDLCK": "syscall", + "syscall.F_READAHEAD": "syscall", + "syscall.F_READBOOTSTRAP": "syscall", + "syscall.F_SETBACKINGSTORE": "syscall", + "syscall.F_SETFD": "syscall", + "syscall.F_SETFL": "syscall", + "syscall.F_SETLEASE": "syscall", + "syscall.F_SETLK": "syscall", + "syscall.F_SETLK64": "syscall", + "syscall.F_SETLKW": "syscall", + "syscall.F_SETLKW64": "syscall", + "syscall.F_SETLK_REMOTE": "syscall", + "syscall.F_SETNOSIGPIPE": "syscall", + "syscall.F_SETOWN": "syscall", + "syscall.F_SETOWN_EX": "syscall", + "syscall.F_SETPIPE_SZ": "syscall", + "syscall.F_SETPROTECTIONCLASS": "syscall", + "syscall.F_SETSIG": "syscall", + "syscall.F_SETSIZE": "syscall", + "syscall.F_SHLCK": "syscall", + "syscall.F_TEST": "syscall", + "syscall.F_THAW_FS": "syscall", + "syscall.F_TLOCK": "syscall", + "syscall.F_ULOCK": "syscall", + "syscall.F_UNLCK": "syscall", + "syscall.F_UNLCKSYS": "syscall", + "syscall.F_VOLPOSMODE": "syscall", + "syscall.F_WRITEBOOTSTRAP": "syscall", + "syscall.F_WRLCK": "syscall", + "syscall.Faccessat": "syscall", + "syscall.Fallocate": "syscall", + "syscall.Fbootstraptransfer_t": "syscall", + "syscall.Fchdir": "syscall", + "syscall.Fchflags": "syscall", + "syscall.Fchmod": "syscall", + "syscall.Fchmodat": "syscall", + "syscall.Fchown": "syscall", + "syscall.Fchownat": "syscall", + "syscall.FcntlFlock": "syscall", + "syscall.FdSet": "syscall", + "syscall.Fdatasync": "syscall", + "syscall.FileNotifyInformation": "syscall", + "syscall.Filetime": "syscall", + "syscall.FindClose": "syscall", + "syscall.FindFirstFile": "syscall", + "syscall.FindNextFile": "syscall", + "syscall.Flock": "syscall", + "syscall.Flock_t": "syscall", + "syscall.FlushBpf": "syscall", + "syscall.FlushFileBuffers": "syscall", + "syscall.FlushViewOfFile": "syscall", + "syscall.ForkExec": "syscall", + "syscall.ForkLock": "syscall", + "syscall.FormatMessage": "syscall", + "syscall.Fpathconf": "syscall", + "syscall.FreeAddrInfoW": "syscall", + "syscall.FreeEnvironmentStrings": "syscall", + "syscall.FreeLibrary": "syscall", + "syscall.Fsid": "syscall", + "syscall.Fstat": "syscall", + "syscall.Fstatfs": "syscall", + "syscall.Fstore_t": "syscall", + "syscall.Fsync": "syscall", + "syscall.Ftruncate": "syscall", + "syscall.FullPath": "syscall", + "syscall.Futimes": "syscall", + "syscall.Futimesat": "syscall", + "syscall.GENERIC_ALL": "syscall", + "syscall.GENERIC_EXECUTE": "syscall", + "syscall.GENERIC_READ": "syscall", + "syscall.GENERIC_WRITE": "syscall", + "syscall.GUID": "syscall", + "syscall.GetAcceptExSockaddrs": "syscall", + "syscall.GetAdaptersInfo": "syscall", + "syscall.GetAddrInfoW": "syscall", + "syscall.GetCommandLine": "syscall", + "syscall.GetComputerName": "syscall", + "syscall.GetConsoleMode": "syscall", + "syscall.GetCurrentDirectory": "syscall", + "syscall.GetCurrentProcess": "syscall", + "syscall.GetEnvironmentStrings": "syscall", + "syscall.GetEnvironmentVariable": "syscall", + "syscall.GetExitCodeProcess": "syscall", + "syscall.GetFileAttributes": "syscall", + "syscall.GetFileAttributesEx": "syscall", + "syscall.GetFileExInfoStandard": "syscall", + "syscall.GetFileExMaxInfoLevel": "syscall", + "syscall.GetFileInformationByHandle": "syscall", + "syscall.GetFileType": "syscall", + "syscall.GetFullPathName": "syscall", + "syscall.GetHostByName": "syscall", + "syscall.GetIfEntry": "syscall", + "syscall.GetLastError": "syscall", + "syscall.GetLengthSid": "syscall", + "syscall.GetLongPathName": "syscall", + "syscall.GetProcAddress": "syscall", + "syscall.GetProcessTimes": "syscall", + "syscall.GetProtoByName": "syscall", + "syscall.GetQueuedCompletionStatus": "syscall", + "syscall.GetServByName": "syscall", + "syscall.GetShortPathName": "syscall", + "syscall.GetStartupInfo": "syscall", + "syscall.GetStdHandle": "syscall", + "syscall.GetSystemTimeAsFileTime": "syscall", + "syscall.GetTempPath": "syscall", + "syscall.GetTimeZoneInformation": "syscall", + "syscall.GetTokenInformation": "syscall", + "syscall.GetUserNameEx": "syscall", + "syscall.GetUserProfileDirectory": "syscall", + "syscall.GetVersion": "syscall", + "syscall.Getcwd": "syscall", + "syscall.Getdents": "syscall", + "syscall.Getdirentries": "syscall", + "syscall.Getdtablesize": "syscall", + "syscall.Getegid": "syscall", + "syscall.Getenv": "syscall", + "syscall.Geteuid": "syscall", + "syscall.Getfsstat": "syscall", + "syscall.Getgid": "syscall", + "syscall.Getgroups": "syscall", + "syscall.Getpagesize": "syscall", + "syscall.Getpeername": "syscall", + "syscall.Getpgid": "syscall", + "syscall.Getpgrp": "syscall", + "syscall.Getpid": "syscall", + "syscall.Getppid": "syscall", + "syscall.Getpriority": "syscall", + "syscall.Getrlimit": "syscall", + "syscall.Getrusage": "syscall", + "syscall.Getsid": "syscall", + "syscall.Getsockname": "syscall", + "syscall.Getsockopt": "syscall", + "syscall.GetsockoptByte": "syscall", + "syscall.GetsockoptICMPv6Filter": "syscall", + "syscall.GetsockoptIPMreq": "syscall", + "syscall.GetsockoptIPMreqn": "syscall", + "syscall.GetsockoptIPv6MTUInfo": "syscall", + "syscall.GetsockoptIPv6Mreq": "syscall", + "syscall.GetsockoptInet4Addr": "syscall", + "syscall.GetsockoptInt": "syscall", + "syscall.GetsockoptUcred": "syscall", + "syscall.Gettid": "syscall", + "syscall.Gettimeofday": "syscall", + "syscall.Getuid": "syscall", + "syscall.Getwd": "syscall", + "syscall.Getxattr": "syscall", + "syscall.HANDLE_FLAG_INHERIT": "syscall", + "syscall.HKEY_CLASSES_ROOT": "syscall", + "syscall.HKEY_CURRENT_CONFIG": "syscall", + "syscall.HKEY_CURRENT_USER": "syscall", + "syscall.HKEY_DYN_DATA": "syscall", + "syscall.HKEY_LOCAL_MACHINE": "syscall", + "syscall.HKEY_PERFORMANCE_DATA": "syscall", + "syscall.HKEY_USERS": "syscall", + "syscall.HUPCL": "syscall", + "syscall.Handle": "syscall", + "syscall.Hostent": "syscall", + "syscall.ICANON": "syscall", + "syscall.ICMP6_FILTER": "syscall", + "syscall.ICMPV6_FILTER": "syscall", + "syscall.ICMPv6Filter": "syscall", + "syscall.ICRNL": "syscall", + "syscall.IEXTEN": "syscall", + "syscall.IFAN_ARRIVAL": "syscall", + "syscall.IFAN_DEPARTURE": "syscall", + "syscall.IFA_ADDRESS": "syscall", + "syscall.IFA_ANYCAST": "syscall", + "syscall.IFA_BROADCAST": "syscall", + "syscall.IFA_CACHEINFO": "syscall", + "syscall.IFA_F_DADFAILED": "syscall", + "syscall.IFA_F_DEPRECATED": "syscall", + "syscall.IFA_F_HOMEADDRESS": "syscall", + "syscall.IFA_F_NODAD": "syscall", + "syscall.IFA_F_OPTIMISTIC": "syscall", + "syscall.IFA_F_PERMANENT": "syscall", + "syscall.IFA_F_SECONDARY": "syscall", + "syscall.IFA_F_TEMPORARY": "syscall", + "syscall.IFA_F_TENTATIVE": "syscall", + "syscall.IFA_LABEL": "syscall", + "syscall.IFA_LOCAL": "syscall", + "syscall.IFA_MAX": "syscall", + "syscall.IFA_MULTICAST": "syscall", + "syscall.IFA_ROUTE": "syscall", + "syscall.IFA_UNSPEC": "syscall", + "syscall.IFF_ALLMULTI": "syscall", + "syscall.IFF_ALTPHYS": "syscall", + "syscall.IFF_AUTOMEDIA": "syscall", + "syscall.IFF_BROADCAST": "syscall", + "syscall.IFF_CANTCHANGE": "syscall", + "syscall.IFF_CANTCONFIG": "syscall", + "syscall.IFF_DEBUG": "syscall", + "syscall.IFF_DRV_OACTIVE": "syscall", + "syscall.IFF_DRV_RUNNING": "syscall", + "syscall.IFF_DYING": "syscall", + "syscall.IFF_DYNAMIC": "syscall", + "syscall.IFF_LINK0": "syscall", + "syscall.IFF_LINK1": "syscall", + "syscall.IFF_LINK2": "syscall", + "syscall.IFF_LOOPBACK": "syscall", + "syscall.IFF_MASTER": "syscall", + "syscall.IFF_MONITOR": "syscall", + "syscall.IFF_MULTICAST": "syscall", + "syscall.IFF_NOARP": "syscall", + "syscall.IFF_NOTRAILERS": "syscall", + "syscall.IFF_NO_PI": "syscall", + "syscall.IFF_OACTIVE": "syscall", + "syscall.IFF_ONE_QUEUE": "syscall", + "syscall.IFF_POINTOPOINT": "syscall", + "syscall.IFF_POINTTOPOINT": "syscall", + "syscall.IFF_PORTSEL": "syscall", + "syscall.IFF_PPROMISC": "syscall", + "syscall.IFF_PROMISC": "syscall", + "syscall.IFF_RENAMING": "syscall", + "syscall.IFF_RUNNING": "syscall", + "syscall.IFF_SIMPLEX": "syscall", + "syscall.IFF_SLAVE": "syscall", + "syscall.IFF_SMART": "syscall", + "syscall.IFF_STATICARP": "syscall", + "syscall.IFF_TAP": "syscall", + "syscall.IFF_TUN": "syscall", + "syscall.IFF_TUN_EXCL": "syscall", + "syscall.IFF_UP": "syscall", + "syscall.IFF_VNET_HDR": "syscall", + "syscall.IFLA_ADDRESS": "syscall", + "syscall.IFLA_BROADCAST": "syscall", + "syscall.IFLA_COST": "syscall", + "syscall.IFLA_IFALIAS": "syscall", + "syscall.IFLA_IFNAME": "syscall", + "syscall.IFLA_LINK": "syscall", + "syscall.IFLA_LINKINFO": "syscall", + "syscall.IFLA_LINKMODE": "syscall", + "syscall.IFLA_MAP": "syscall", + "syscall.IFLA_MASTER": "syscall", + "syscall.IFLA_MAX": "syscall", + "syscall.IFLA_MTU": "syscall", + "syscall.IFLA_NET_NS_PID": "syscall", + "syscall.IFLA_OPERSTATE": "syscall", + "syscall.IFLA_PRIORITY": "syscall", + "syscall.IFLA_PROTINFO": "syscall", + "syscall.IFLA_QDISC": "syscall", + "syscall.IFLA_STATS": "syscall", + "syscall.IFLA_TXQLEN": "syscall", + "syscall.IFLA_UNSPEC": "syscall", + "syscall.IFLA_WEIGHT": "syscall", + "syscall.IFLA_WIRELESS": "syscall", + "syscall.IFNAMSIZ": "syscall", + "syscall.IFT_1822": "syscall", + "syscall.IFT_A12MPPSWITCH": "syscall", + "syscall.IFT_AAL2": "syscall", + "syscall.IFT_AAL5": "syscall", + "syscall.IFT_ADSL": "syscall", + "syscall.IFT_AFLANE8023": "syscall", + "syscall.IFT_AFLANE8025": "syscall", + "syscall.IFT_ARAP": "syscall", + "syscall.IFT_ARCNET": "syscall", + "syscall.IFT_ARCNETPLUS": "syscall", + "syscall.IFT_ASYNC": "syscall", + "syscall.IFT_ATM": "syscall", + "syscall.IFT_ATMDXI": "syscall", + "syscall.IFT_ATMFUNI": "syscall", + "syscall.IFT_ATMIMA": "syscall", + "syscall.IFT_ATMLOGICAL": "syscall", + "syscall.IFT_ATMRADIO": "syscall", + "syscall.IFT_ATMSUBINTERFACE": "syscall", + "syscall.IFT_ATMVCIENDPT": "syscall", + "syscall.IFT_ATMVIRTUAL": "syscall", + "syscall.IFT_BGPPOLICYACCOUNTING": "syscall", + "syscall.IFT_BLUETOOTH": "syscall", + "syscall.IFT_BRIDGE": "syscall", + "syscall.IFT_BSC": "syscall", + "syscall.IFT_CARP": "syscall", + "syscall.IFT_CCTEMUL": "syscall", + "syscall.IFT_CELLULAR": "syscall", + "syscall.IFT_CEPT": "syscall", + "syscall.IFT_CES": "syscall", + "syscall.IFT_CHANNEL": "syscall", + "syscall.IFT_CNR": "syscall", + "syscall.IFT_COFFEE": "syscall", + "syscall.IFT_COMPOSITELINK": "syscall", + "syscall.IFT_DCN": "syscall", + "syscall.IFT_DIGITALPOWERLINE": "syscall", + "syscall.IFT_DIGITALWRAPPEROVERHEADCHANNEL": "syscall", + "syscall.IFT_DLSW": "syscall", + "syscall.IFT_DOCSCABLEDOWNSTREAM": "syscall", + "syscall.IFT_DOCSCABLEMACLAYER": "syscall", + "syscall.IFT_DOCSCABLEUPSTREAM": "syscall", + "syscall.IFT_DOCSCABLEUPSTREAMCHANNEL": "syscall", + "syscall.IFT_DS0": "syscall", + "syscall.IFT_DS0BUNDLE": "syscall", + "syscall.IFT_DS1FDL": "syscall", + "syscall.IFT_DS3": "syscall", + "syscall.IFT_DTM": "syscall", + "syscall.IFT_DUMMY": "syscall", + "syscall.IFT_DVBASILN": "syscall", + "syscall.IFT_DVBASIOUT": "syscall", + "syscall.IFT_DVBRCCDOWNSTREAM": "syscall", + "syscall.IFT_DVBRCCMACLAYER": "syscall", + "syscall.IFT_DVBRCCUPSTREAM": "syscall", + "syscall.IFT_ECONET": "syscall", + "syscall.IFT_ENC": "syscall", + "syscall.IFT_EON": "syscall", + "syscall.IFT_EPLRS": "syscall", + "syscall.IFT_ESCON": "syscall", + "syscall.IFT_ETHER": "syscall", + "syscall.IFT_FAITH": "syscall", + "syscall.IFT_FAST": "syscall", + "syscall.IFT_FASTETHER": "syscall", + "syscall.IFT_FASTETHERFX": "syscall", + "syscall.IFT_FDDI": "syscall", + "syscall.IFT_FIBRECHANNEL": "syscall", + "syscall.IFT_FRAMERELAYINTERCONNECT": "syscall", + "syscall.IFT_FRAMERELAYMPI": "syscall", + "syscall.IFT_FRDLCIENDPT": "syscall", + "syscall.IFT_FRELAY": "syscall", + "syscall.IFT_FRELAYDCE": "syscall", + "syscall.IFT_FRF16MFRBUNDLE": "syscall", + "syscall.IFT_FRFORWARD": "syscall", + "syscall.IFT_G703AT2MB": "syscall", + "syscall.IFT_G703AT64K": "syscall", + "syscall.IFT_GIF": "syscall", + "syscall.IFT_GIGABITETHERNET": "syscall", + "syscall.IFT_GR303IDT": "syscall", + "syscall.IFT_GR303RDT": "syscall", + "syscall.IFT_H323GATEKEEPER": "syscall", + "syscall.IFT_H323PROXY": "syscall", + "syscall.IFT_HDH1822": "syscall", + "syscall.IFT_HDLC": "syscall", + "syscall.IFT_HDSL2": "syscall", + "syscall.IFT_HIPERLAN2": "syscall", + "syscall.IFT_HIPPI": "syscall", + "syscall.IFT_HIPPIINTERFACE": "syscall", + "syscall.IFT_HOSTPAD": "syscall", + "syscall.IFT_HSSI": "syscall", + "syscall.IFT_HY": "syscall", + "syscall.IFT_IBM370PARCHAN": "syscall", + "syscall.IFT_IDSL": "syscall", + "syscall.IFT_IEEE1394": "syscall", + "syscall.IFT_IEEE80211": "syscall", + "syscall.IFT_IEEE80212": "syscall", + "syscall.IFT_IEEE8023ADLAG": "syscall", + "syscall.IFT_IFGSN": "syscall", + "syscall.IFT_IMT": "syscall", + "syscall.IFT_INFINIBAND": "syscall", + "syscall.IFT_INTERLEAVE": "syscall", + "syscall.IFT_IP": "syscall", + "syscall.IFT_IPFORWARD": "syscall", + "syscall.IFT_IPOVERATM": "syscall", + "syscall.IFT_IPOVERCDLC": "syscall", + "syscall.IFT_IPOVERCLAW": "syscall", + "syscall.IFT_IPSWITCH": "syscall", + "syscall.IFT_IPXIP": "syscall", + "syscall.IFT_ISDN": "syscall", + "syscall.IFT_ISDNBASIC": "syscall", + "syscall.IFT_ISDNPRIMARY": "syscall", + "syscall.IFT_ISDNS": "syscall", + "syscall.IFT_ISDNU": "syscall", + "syscall.IFT_ISO88022LLC": "syscall", + "syscall.IFT_ISO88023": "syscall", + "syscall.IFT_ISO88024": "syscall", + "syscall.IFT_ISO88025": "syscall", + "syscall.IFT_ISO88025CRFPINT": "syscall", + "syscall.IFT_ISO88025DTR": "syscall", + "syscall.IFT_ISO88025FIBER": "syscall", + "syscall.IFT_ISO88026": "syscall", + "syscall.IFT_ISUP": "syscall", + "syscall.IFT_L2VLAN": "syscall", + "syscall.IFT_L3IPVLAN": "syscall", + "syscall.IFT_L3IPXVLAN": "syscall", + "syscall.IFT_LAPB": "syscall", + "syscall.IFT_LAPD": "syscall", + "syscall.IFT_LAPF": "syscall", + "syscall.IFT_LINEGROUP": "syscall", + "syscall.IFT_LOCALTALK": "syscall", + "syscall.IFT_LOOP": "syscall", + "syscall.IFT_MEDIAMAILOVERIP": "syscall", + "syscall.IFT_MFSIGLINK": "syscall", + "syscall.IFT_MIOX25": "syscall", + "syscall.IFT_MODEM": "syscall", + "syscall.IFT_MPC": "syscall", + "syscall.IFT_MPLS": "syscall", + "syscall.IFT_MPLSTUNNEL": "syscall", + "syscall.IFT_MSDSL": "syscall", + "syscall.IFT_MVL": "syscall", + "syscall.IFT_MYRINET": "syscall", + "syscall.IFT_NFAS": "syscall", + "syscall.IFT_NSIP": "syscall", + "syscall.IFT_OPTICALCHANNEL": "syscall", + "syscall.IFT_OPTICALTRANSPORT": "syscall", + "syscall.IFT_OTHER": "syscall", + "syscall.IFT_P10": "syscall", + "syscall.IFT_P80": "syscall", + "syscall.IFT_PARA": "syscall", + "syscall.IFT_PDP": "syscall", + "syscall.IFT_PFLOG": "syscall", + "syscall.IFT_PFLOW": "syscall", + "syscall.IFT_PFSYNC": "syscall", + "syscall.IFT_PLC": "syscall", + "syscall.IFT_PON155": "syscall", + "syscall.IFT_PON622": "syscall", + "syscall.IFT_POS": "syscall", + "syscall.IFT_PPP": "syscall", + "syscall.IFT_PPPMULTILINKBUNDLE": "syscall", + "syscall.IFT_PROPATM": "syscall", + "syscall.IFT_PROPBWAP2MP": "syscall", + "syscall.IFT_PROPCNLS": "syscall", + "syscall.IFT_PROPDOCSWIRELESSDOWNSTREAM": "syscall", + "syscall.IFT_PROPDOCSWIRELESSMACLAYER": "syscall", + "syscall.IFT_PROPDOCSWIRELESSUPSTREAM": "syscall", + "syscall.IFT_PROPMUX": "syscall", + "syscall.IFT_PROPVIRTUAL": "syscall", + "syscall.IFT_PROPWIRELESSP2P": "syscall", + "syscall.IFT_PTPSERIAL": "syscall", + "syscall.IFT_PVC": "syscall", + "syscall.IFT_Q2931": "syscall", + "syscall.IFT_QLLC": "syscall", + "syscall.IFT_RADIOMAC": "syscall", + "syscall.IFT_RADSL": "syscall", + "syscall.IFT_REACHDSL": "syscall", + "syscall.IFT_RFC1483": "syscall", + "syscall.IFT_RS232": "syscall", + "syscall.IFT_RSRB": "syscall", + "syscall.IFT_SDLC": "syscall", + "syscall.IFT_SDSL": "syscall", + "syscall.IFT_SHDSL": "syscall", + "syscall.IFT_SIP": "syscall", + "syscall.IFT_SIPSIG": "syscall", + "syscall.IFT_SIPTG": "syscall", + "syscall.IFT_SLIP": "syscall", + "syscall.IFT_SMDSDXI": "syscall", + "syscall.IFT_SMDSICIP": "syscall", + "syscall.IFT_SONET": "syscall", + "syscall.IFT_SONETOVERHEADCHANNEL": "syscall", + "syscall.IFT_SONETPATH": "syscall", + "syscall.IFT_SONETVT": "syscall", + "syscall.IFT_SRP": "syscall", + "syscall.IFT_SS7SIGLINK": "syscall", + "syscall.IFT_STACKTOSTACK": "syscall", + "syscall.IFT_STARLAN": "syscall", + "syscall.IFT_STF": "syscall", + "syscall.IFT_T1": "syscall", + "syscall.IFT_TDLC": "syscall", + "syscall.IFT_TELINK": "syscall", + "syscall.IFT_TERMPAD": "syscall", + "syscall.IFT_TR008": "syscall", + "syscall.IFT_TRANSPHDLC": "syscall", + "syscall.IFT_TUNNEL": "syscall", + "syscall.IFT_ULTRA": "syscall", + "syscall.IFT_USB": "syscall", + "syscall.IFT_V11": "syscall", + "syscall.IFT_V35": "syscall", + "syscall.IFT_V36": "syscall", + "syscall.IFT_V37": "syscall", + "syscall.IFT_VDSL": "syscall", + "syscall.IFT_VIRTUALIPADDRESS": "syscall", + "syscall.IFT_VIRTUALTG": "syscall", + "syscall.IFT_VOICEDID": "syscall", + "syscall.IFT_VOICEEM": "syscall", + "syscall.IFT_VOICEEMFGD": "syscall", + "syscall.IFT_VOICEENCAP": "syscall", + "syscall.IFT_VOICEFGDEANA": "syscall", + "syscall.IFT_VOICEFXO": "syscall", + "syscall.IFT_VOICEFXS": "syscall", + "syscall.IFT_VOICEOVERATM": "syscall", + "syscall.IFT_VOICEOVERCABLE": "syscall", + "syscall.IFT_VOICEOVERFRAMERELAY": "syscall", + "syscall.IFT_VOICEOVERIP": "syscall", + "syscall.IFT_X213": "syscall", + "syscall.IFT_X25": "syscall", + "syscall.IFT_X25DDN": "syscall", + "syscall.IFT_X25HUNTGROUP": "syscall", + "syscall.IFT_X25MLP": "syscall", + "syscall.IFT_X25PLE": "syscall", + "syscall.IFT_XETHER": "syscall", + "syscall.IGNBRK": "syscall", + "syscall.IGNCR": "syscall", + "syscall.IGNORE": "syscall", + "syscall.IGNPAR": "syscall", + "syscall.IMAXBEL": "syscall", + "syscall.INFINITE": "syscall", + "syscall.INLCR": "syscall", + "syscall.INPCK": "syscall", + "syscall.INVALID_FILE_ATTRIBUTES": "syscall", + "syscall.IN_ACCESS": "syscall", + "syscall.IN_ALL_EVENTS": "syscall", + "syscall.IN_ATTRIB": "syscall", + "syscall.IN_CLASSA_HOST": "syscall", + "syscall.IN_CLASSA_MAX": "syscall", + "syscall.IN_CLASSA_NET": "syscall", + "syscall.IN_CLASSA_NSHIFT": "syscall", + "syscall.IN_CLASSB_HOST": "syscall", + "syscall.IN_CLASSB_MAX": "syscall", + "syscall.IN_CLASSB_NET": "syscall", + "syscall.IN_CLASSB_NSHIFT": "syscall", + "syscall.IN_CLASSC_HOST": "syscall", + "syscall.IN_CLASSC_NET": "syscall", + "syscall.IN_CLASSC_NSHIFT": "syscall", + "syscall.IN_CLASSD_HOST": "syscall", + "syscall.IN_CLASSD_NET": "syscall", + "syscall.IN_CLASSD_NSHIFT": "syscall", + "syscall.IN_CLOEXEC": "syscall", + "syscall.IN_CLOSE": "syscall", + "syscall.IN_CLOSE_NOWRITE": "syscall", + "syscall.IN_CLOSE_WRITE": "syscall", + "syscall.IN_CREATE": "syscall", + "syscall.IN_DELETE": "syscall", + "syscall.IN_DELETE_SELF": "syscall", + "syscall.IN_DONT_FOLLOW": "syscall", + "syscall.IN_EXCL_UNLINK": "syscall", + "syscall.IN_IGNORED": "syscall", + "syscall.IN_ISDIR": "syscall", + "syscall.IN_LINKLOCALNETNUM": "syscall", + "syscall.IN_LOOPBACKNET": "syscall", + "syscall.IN_MASK_ADD": "syscall", + "syscall.IN_MODIFY": "syscall", + "syscall.IN_MOVE": "syscall", + "syscall.IN_MOVED_FROM": "syscall", + "syscall.IN_MOVED_TO": "syscall", + "syscall.IN_MOVE_SELF": "syscall", + "syscall.IN_NONBLOCK": "syscall", + "syscall.IN_ONESHOT": "syscall", + "syscall.IN_ONLYDIR": "syscall", + "syscall.IN_OPEN": "syscall", + "syscall.IN_Q_OVERFLOW": "syscall", + "syscall.IN_RFC3021_HOST": "syscall", + "syscall.IN_RFC3021_MASK": "syscall", + "syscall.IN_RFC3021_NET": "syscall", + "syscall.IN_RFC3021_NSHIFT": "syscall", + "syscall.IN_UNMOUNT": "syscall", + "syscall.IOC_IN": "syscall", + "syscall.IOC_INOUT": "syscall", + "syscall.IOC_OUT": "syscall", + "syscall.IOC_VENDOR": "syscall", + "syscall.IOC_WS2": "syscall", + "syscall.IO_REPARSE_TAG_SYMLINK": "syscall", + "syscall.IPMreq": "syscall", + "syscall.IPMreqn": "syscall", + "syscall.IPPROTO_3PC": "syscall", + "syscall.IPPROTO_ADFS": "syscall", + "syscall.IPPROTO_AH": "syscall", + "syscall.IPPROTO_AHIP": "syscall", + "syscall.IPPROTO_APES": "syscall", + "syscall.IPPROTO_ARGUS": "syscall", + "syscall.IPPROTO_AX25": "syscall", + "syscall.IPPROTO_BHA": "syscall", + "syscall.IPPROTO_BLT": "syscall", + "syscall.IPPROTO_BRSATMON": "syscall", + "syscall.IPPROTO_CARP": "syscall", + "syscall.IPPROTO_CFTP": "syscall", + "syscall.IPPROTO_CHAOS": "syscall", + "syscall.IPPROTO_CMTP": "syscall", + "syscall.IPPROTO_COMP": "syscall", + "syscall.IPPROTO_CPHB": "syscall", + "syscall.IPPROTO_CPNX": "syscall", + "syscall.IPPROTO_DCCP": "syscall", + "syscall.IPPROTO_DDP": "syscall", + "syscall.IPPROTO_DGP": "syscall", + "syscall.IPPROTO_DIVERT": "syscall", + "syscall.IPPROTO_DIVERT_INIT": "syscall", + "syscall.IPPROTO_DIVERT_RESP": "syscall", + "syscall.IPPROTO_DONE": "syscall", + "syscall.IPPROTO_DSTOPTS": "syscall", + "syscall.IPPROTO_EGP": "syscall", + "syscall.IPPROTO_EMCON": "syscall", + "syscall.IPPROTO_ENCAP": "syscall", + "syscall.IPPROTO_EON": "syscall", + "syscall.IPPROTO_ESP": "syscall", + "syscall.IPPROTO_ETHERIP": "syscall", + "syscall.IPPROTO_FRAGMENT": "syscall", + "syscall.IPPROTO_GGP": "syscall", + "syscall.IPPROTO_GMTP": "syscall", + "syscall.IPPROTO_GRE": "syscall", + "syscall.IPPROTO_HELLO": "syscall", + "syscall.IPPROTO_HMP": "syscall", + "syscall.IPPROTO_HOPOPTS": "syscall", + "syscall.IPPROTO_ICMP": "syscall", + "syscall.IPPROTO_ICMPV6": "syscall", + "syscall.IPPROTO_IDP": "syscall", + "syscall.IPPROTO_IDPR": "syscall", + "syscall.IPPROTO_IDRP": "syscall", + "syscall.IPPROTO_IGMP": "syscall", + "syscall.IPPROTO_IGP": "syscall", + "syscall.IPPROTO_IGRP": "syscall", + "syscall.IPPROTO_IL": "syscall", + "syscall.IPPROTO_INLSP": "syscall", + "syscall.IPPROTO_INP": "syscall", + "syscall.IPPROTO_IP": "syscall", + "syscall.IPPROTO_IPCOMP": "syscall", + "syscall.IPPROTO_IPCV": "syscall", + "syscall.IPPROTO_IPEIP": "syscall", + "syscall.IPPROTO_IPIP": "syscall", + "syscall.IPPROTO_IPPC": "syscall", + "syscall.IPPROTO_IPV4": "syscall", + "syscall.IPPROTO_IPV6": "syscall", + "syscall.IPPROTO_IPV6_ICMP": "syscall", + "syscall.IPPROTO_IRTP": "syscall", + "syscall.IPPROTO_KRYPTOLAN": "syscall", + "syscall.IPPROTO_LARP": "syscall", + "syscall.IPPROTO_LEAF1": "syscall", + "syscall.IPPROTO_LEAF2": "syscall", + "syscall.IPPROTO_MAX": "syscall", + "syscall.IPPROTO_MAXID": "syscall", + "syscall.IPPROTO_MEAS": "syscall", + "syscall.IPPROTO_MH": "syscall", + "syscall.IPPROTO_MHRP": "syscall", + "syscall.IPPROTO_MICP": "syscall", + "syscall.IPPROTO_MOBILE": "syscall", + "syscall.IPPROTO_MPLS": "syscall", + "syscall.IPPROTO_MTP": "syscall", + "syscall.IPPROTO_MUX": "syscall", + "syscall.IPPROTO_ND": "syscall", + "syscall.IPPROTO_NHRP": "syscall", + "syscall.IPPROTO_NONE": "syscall", + "syscall.IPPROTO_NSP": "syscall", + "syscall.IPPROTO_NVPII": "syscall", + "syscall.IPPROTO_OLD_DIVERT": "syscall", + "syscall.IPPROTO_OSPFIGP": "syscall", + "syscall.IPPROTO_PFSYNC": "syscall", + "syscall.IPPROTO_PGM": "syscall", + "syscall.IPPROTO_PIGP": "syscall", + "syscall.IPPROTO_PIM": "syscall", + "syscall.IPPROTO_PRM": "syscall", + "syscall.IPPROTO_PUP": "syscall", + "syscall.IPPROTO_PVP": "syscall", + "syscall.IPPROTO_RAW": "syscall", + "syscall.IPPROTO_RCCMON": "syscall", + "syscall.IPPROTO_RDP": "syscall", + "syscall.IPPROTO_ROUTING": "syscall", + "syscall.IPPROTO_RSVP": "syscall", + "syscall.IPPROTO_RVD": "syscall", + "syscall.IPPROTO_SATEXPAK": "syscall", + "syscall.IPPROTO_SATMON": "syscall", + "syscall.IPPROTO_SCCSP": "syscall", + "syscall.IPPROTO_SCTP": "syscall", + "syscall.IPPROTO_SDRP": "syscall", + "syscall.IPPROTO_SEND": "syscall", + "syscall.IPPROTO_SEP": "syscall", + "syscall.IPPROTO_SKIP": "syscall", + "syscall.IPPROTO_SPACER": "syscall", + "syscall.IPPROTO_SRPC": "syscall", + "syscall.IPPROTO_ST": "syscall", + "syscall.IPPROTO_SVMTP": "syscall", + "syscall.IPPROTO_SWIPE": "syscall", + "syscall.IPPROTO_TCF": "syscall", + "syscall.IPPROTO_TCP": "syscall", + "syscall.IPPROTO_TLSP": "syscall", + "syscall.IPPROTO_TP": "syscall", + "syscall.IPPROTO_TPXX": "syscall", + "syscall.IPPROTO_TRUNK1": "syscall", + "syscall.IPPROTO_TRUNK2": "syscall", + "syscall.IPPROTO_TTP": "syscall", + "syscall.IPPROTO_UDP": "syscall", + "syscall.IPPROTO_UDPLITE": "syscall", + "syscall.IPPROTO_VINES": "syscall", + "syscall.IPPROTO_VISA": "syscall", + "syscall.IPPROTO_VMTP": "syscall", + "syscall.IPPROTO_VRRP": "syscall", + "syscall.IPPROTO_WBEXPAK": "syscall", + "syscall.IPPROTO_WBMON": "syscall", + "syscall.IPPROTO_WSN": "syscall", + "syscall.IPPROTO_XNET": "syscall", + "syscall.IPPROTO_XTP": "syscall", + "syscall.IPV6_2292DSTOPTS": "syscall", + "syscall.IPV6_2292HOPLIMIT": "syscall", + "syscall.IPV6_2292HOPOPTS": "syscall", + "syscall.IPV6_2292NEXTHOP": "syscall", + "syscall.IPV6_2292PKTINFO": "syscall", + "syscall.IPV6_2292PKTOPTIONS": "syscall", + "syscall.IPV6_2292RTHDR": "syscall", + "syscall.IPV6_ADDRFORM": "syscall", + "syscall.IPV6_ADD_MEMBERSHIP": "syscall", + "syscall.IPV6_AUTHHDR": "syscall", + "syscall.IPV6_AUTH_LEVEL": "syscall", + "syscall.IPV6_AUTOFLOWLABEL": "syscall", + "syscall.IPV6_BINDANY": "syscall", + "syscall.IPV6_BINDV6ONLY": "syscall", + "syscall.IPV6_BOUND_IF": "syscall", + "syscall.IPV6_CHECKSUM": "syscall", + "syscall.IPV6_DEFAULT_MULTICAST_HOPS": "syscall", + "syscall.IPV6_DEFAULT_MULTICAST_LOOP": "syscall", + "syscall.IPV6_DEFHLIM": "syscall", + "syscall.IPV6_DONTFRAG": "syscall", + "syscall.IPV6_DROP_MEMBERSHIP": "syscall", + "syscall.IPV6_DSTOPTS": "syscall", + "syscall.IPV6_ESP_NETWORK_LEVEL": "syscall", + "syscall.IPV6_ESP_TRANS_LEVEL": "syscall", + "syscall.IPV6_FAITH": "syscall", + "syscall.IPV6_FLOWINFO_MASK": "syscall", + "syscall.IPV6_FLOWLABEL_MASK": "syscall", + "syscall.IPV6_FRAGTTL": "syscall", + "syscall.IPV6_FW_ADD": "syscall", + "syscall.IPV6_FW_DEL": "syscall", + "syscall.IPV6_FW_FLUSH": "syscall", + "syscall.IPV6_FW_GET": "syscall", + "syscall.IPV6_FW_ZERO": "syscall", + "syscall.IPV6_HLIMDEC": "syscall", + "syscall.IPV6_HOPLIMIT": "syscall", + "syscall.IPV6_HOPOPTS": "syscall", + "syscall.IPV6_IPCOMP_LEVEL": "syscall", + "syscall.IPV6_IPSEC_POLICY": "syscall", + "syscall.IPV6_JOIN_ANYCAST": "syscall", + "syscall.IPV6_JOIN_GROUP": "syscall", + "syscall.IPV6_LEAVE_ANYCAST": "syscall", + "syscall.IPV6_LEAVE_GROUP": "syscall", + "syscall.IPV6_MAXHLIM": "syscall", + "syscall.IPV6_MAXOPTHDR": "syscall", + "syscall.IPV6_MAXPACKET": "syscall", + "syscall.IPV6_MAX_GROUP_SRC_FILTER": "syscall", + "syscall.IPV6_MAX_MEMBERSHIPS": "syscall", + "syscall.IPV6_MAX_SOCK_SRC_FILTER": "syscall", + "syscall.IPV6_MIN_MEMBERSHIPS": "syscall", + "syscall.IPV6_MMTU": "syscall", + "syscall.IPV6_MSFILTER": "syscall", + "syscall.IPV6_MTU": "syscall", + "syscall.IPV6_MTU_DISCOVER": "syscall", + "syscall.IPV6_MULTICAST_HOPS": "syscall", + "syscall.IPV6_MULTICAST_IF": "syscall", + "syscall.IPV6_MULTICAST_LOOP": "syscall", + "syscall.IPV6_NEXTHOP": "syscall", + "syscall.IPV6_OPTIONS": "syscall", + "syscall.IPV6_PATHMTU": "syscall", + "syscall.IPV6_PIPEX": "syscall", + "syscall.IPV6_PKTINFO": "syscall", + "syscall.IPV6_PMTUDISC_DO": "syscall", + "syscall.IPV6_PMTUDISC_DONT": "syscall", + "syscall.IPV6_PMTUDISC_PROBE": "syscall", + "syscall.IPV6_PMTUDISC_WANT": "syscall", + "syscall.IPV6_PORTRANGE": "syscall", + "syscall.IPV6_PORTRANGE_DEFAULT": "syscall", + "syscall.IPV6_PORTRANGE_HIGH": "syscall", + "syscall.IPV6_PORTRANGE_LOW": "syscall", + "syscall.IPV6_PREFER_TEMPADDR": "syscall", + "syscall.IPV6_RECVDSTOPTS": "syscall", + "syscall.IPV6_RECVDSTPORT": "syscall", + "syscall.IPV6_RECVERR": "syscall", + "syscall.IPV6_RECVHOPLIMIT": "syscall", + "syscall.IPV6_RECVHOPOPTS": "syscall", + "syscall.IPV6_RECVPATHMTU": "syscall", + "syscall.IPV6_RECVPKTINFO": "syscall", + "syscall.IPV6_RECVRTHDR": "syscall", + "syscall.IPV6_RECVTCLASS": "syscall", + "syscall.IPV6_ROUTER_ALERT": "syscall", + "syscall.IPV6_RTABLE": "syscall", + "syscall.IPV6_RTHDR": "syscall", + "syscall.IPV6_RTHDRDSTOPTS": "syscall", + "syscall.IPV6_RTHDR_LOOSE": "syscall", + "syscall.IPV6_RTHDR_STRICT": "syscall", + "syscall.IPV6_RTHDR_TYPE_0": "syscall", + "syscall.IPV6_RXDSTOPTS": "syscall", + "syscall.IPV6_RXHOPOPTS": "syscall", + "syscall.IPV6_SOCKOPT_RESERVED1": "syscall", + "syscall.IPV6_TCLASS": "syscall", + "syscall.IPV6_UNICAST_HOPS": "syscall", + "syscall.IPV6_USE_MIN_MTU": "syscall", + "syscall.IPV6_V6ONLY": "syscall", + "syscall.IPV6_VERSION": "syscall", + "syscall.IPV6_VERSION_MASK": "syscall", + "syscall.IPV6_XFRM_POLICY": "syscall", + "syscall.IP_ADD_MEMBERSHIP": "syscall", + "syscall.IP_ADD_SOURCE_MEMBERSHIP": "syscall", + "syscall.IP_AUTH_LEVEL": "syscall", + "syscall.IP_BINDANY": "syscall", + "syscall.IP_BLOCK_SOURCE": "syscall", + "syscall.IP_BOUND_IF": "syscall", + "syscall.IP_DEFAULT_MULTICAST_LOOP": "syscall", + "syscall.IP_DEFAULT_MULTICAST_TTL": "syscall", + "syscall.IP_DF": "syscall", + "syscall.IP_DIVERTFL": "syscall", + "syscall.IP_DONTFRAG": "syscall", + "syscall.IP_DROP_MEMBERSHIP": "syscall", + "syscall.IP_DROP_SOURCE_MEMBERSHIP": "syscall", + "syscall.IP_DUMMYNET3": "syscall", + "syscall.IP_DUMMYNET_CONFIGURE": "syscall", + "syscall.IP_DUMMYNET_DEL": "syscall", + "syscall.IP_DUMMYNET_FLUSH": "syscall", + "syscall.IP_DUMMYNET_GET": "syscall", + "syscall.IP_EF": "syscall", + "syscall.IP_ERRORMTU": "syscall", + "syscall.IP_ESP_NETWORK_LEVEL": "syscall", + "syscall.IP_ESP_TRANS_LEVEL": "syscall", + "syscall.IP_FAITH": "syscall", + "syscall.IP_FREEBIND": "syscall", + "syscall.IP_FW3": "syscall", + "syscall.IP_FW_ADD": "syscall", + "syscall.IP_FW_DEL": "syscall", + "syscall.IP_FW_FLUSH": "syscall", + "syscall.IP_FW_GET": "syscall", + "syscall.IP_FW_NAT_CFG": "syscall", + "syscall.IP_FW_NAT_DEL": "syscall", + "syscall.IP_FW_NAT_GET_CONFIG": "syscall", + "syscall.IP_FW_NAT_GET_LOG": "syscall", + "syscall.IP_FW_RESETLOG": "syscall", + "syscall.IP_FW_TABLE_ADD": "syscall", + "syscall.IP_FW_TABLE_DEL": "syscall", + "syscall.IP_FW_TABLE_FLUSH": "syscall", + "syscall.IP_FW_TABLE_GETSIZE": "syscall", + "syscall.IP_FW_TABLE_LIST": "syscall", + "syscall.IP_FW_ZERO": "syscall", + "syscall.IP_HDRINCL": "syscall", + "syscall.IP_IPCOMP_LEVEL": "syscall", + "syscall.IP_IPSECFLOWINFO": "syscall", + "syscall.IP_IPSEC_LOCAL_AUTH": "syscall", + "syscall.IP_IPSEC_LOCAL_CRED": "syscall", + "syscall.IP_IPSEC_LOCAL_ID": "syscall", + "syscall.IP_IPSEC_POLICY": "syscall", + "syscall.IP_IPSEC_REMOTE_AUTH": "syscall", + "syscall.IP_IPSEC_REMOTE_CRED": "syscall", + "syscall.IP_IPSEC_REMOTE_ID": "syscall", + "syscall.IP_MAXPACKET": "syscall", + "syscall.IP_MAX_GROUP_SRC_FILTER": "syscall", + "syscall.IP_MAX_MEMBERSHIPS": "syscall", + "syscall.IP_MAX_SOCK_MUTE_FILTER": "syscall", + "syscall.IP_MAX_SOCK_SRC_FILTER": "syscall", + "syscall.IP_MAX_SOURCE_FILTER": "syscall", + "syscall.IP_MF": "syscall", + "syscall.IP_MINFRAGSIZE": "syscall", + "syscall.IP_MINTTL": "syscall", + "syscall.IP_MIN_MEMBERSHIPS": "syscall", + "syscall.IP_MSFILTER": "syscall", + "syscall.IP_MSS": "syscall", + "syscall.IP_MTU": "syscall", + "syscall.IP_MTU_DISCOVER": "syscall", + "syscall.IP_MULTICAST_IF": "syscall", + "syscall.IP_MULTICAST_IFINDEX": "syscall", + "syscall.IP_MULTICAST_LOOP": "syscall", + "syscall.IP_MULTICAST_TTL": "syscall", + "syscall.IP_MULTICAST_VIF": "syscall", + "syscall.IP_NAT__XXX": "syscall", + "syscall.IP_OFFMASK": "syscall", + "syscall.IP_OLD_FW_ADD": "syscall", + "syscall.IP_OLD_FW_DEL": "syscall", + "syscall.IP_OLD_FW_FLUSH": "syscall", + "syscall.IP_OLD_FW_GET": "syscall", + "syscall.IP_OLD_FW_RESETLOG": "syscall", + "syscall.IP_OLD_FW_ZERO": "syscall", + "syscall.IP_ONESBCAST": "syscall", + "syscall.IP_OPTIONS": "syscall", + "syscall.IP_ORIGDSTADDR": "syscall", + "syscall.IP_PASSSEC": "syscall", + "syscall.IP_PIPEX": "syscall", + "syscall.IP_PKTINFO": "syscall", + "syscall.IP_PKTOPTIONS": "syscall", + "syscall.IP_PMTUDISC": "syscall", + "syscall.IP_PMTUDISC_DO": "syscall", + "syscall.IP_PMTUDISC_DONT": "syscall", + "syscall.IP_PMTUDISC_PROBE": "syscall", + "syscall.IP_PMTUDISC_WANT": "syscall", + "syscall.IP_PORTRANGE": "syscall", + "syscall.IP_PORTRANGE_DEFAULT": "syscall", + "syscall.IP_PORTRANGE_HIGH": "syscall", + "syscall.IP_PORTRANGE_LOW": "syscall", + "syscall.IP_RECVDSTADDR": "syscall", + "syscall.IP_RECVDSTPORT": "syscall", + "syscall.IP_RECVERR": "syscall", + "syscall.IP_RECVIF": "syscall", + "syscall.IP_RECVOPTS": "syscall", + "syscall.IP_RECVORIGDSTADDR": "syscall", + "syscall.IP_RECVPKTINFO": "syscall", + "syscall.IP_RECVRETOPTS": "syscall", + "syscall.IP_RECVRTABLE": "syscall", + "syscall.IP_RECVTOS": "syscall", + "syscall.IP_RECVTTL": "syscall", + "syscall.IP_RETOPTS": "syscall", + "syscall.IP_RF": "syscall", + "syscall.IP_ROUTER_ALERT": "syscall", + "syscall.IP_RSVP_OFF": "syscall", + "syscall.IP_RSVP_ON": "syscall", + "syscall.IP_RSVP_VIF_OFF": "syscall", + "syscall.IP_RSVP_VIF_ON": "syscall", + "syscall.IP_RTABLE": "syscall", + "syscall.IP_SENDSRCADDR": "syscall", + "syscall.IP_STRIPHDR": "syscall", + "syscall.IP_TOS": "syscall", + "syscall.IP_TRAFFIC_MGT_BACKGROUND": "syscall", + "syscall.IP_TRANSPARENT": "syscall", + "syscall.IP_TTL": "syscall", + "syscall.IP_UNBLOCK_SOURCE": "syscall", + "syscall.IP_XFRM_POLICY": "syscall", + "syscall.IPv6MTUInfo": "syscall", + "syscall.IPv6Mreq": "syscall", + "syscall.ISIG": "syscall", + "syscall.ISTRIP": "syscall", + "syscall.IUCLC": "syscall", + "syscall.IUTF8": "syscall", + "syscall.IXANY": "syscall", + "syscall.IXOFF": "syscall", + "syscall.IXON": "syscall", + "syscall.IfAddrmsg": "syscall", + "syscall.IfAnnounceMsghdr": "syscall", + "syscall.IfData": "syscall", + "syscall.IfInfomsg": "syscall", + "syscall.IfMsghdr": "syscall", + "syscall.IfaMsghdr": "syscall", + "syscall.IfmaMsghdr": "syscall", + "syscall.IfmaMsghdr2": "syscall", + "syscall.ImplementsGetwd": "syscall", + "syscall.Inet4Pktinfo": "syscall", + "syscall.Inet6Pktinfo": "syscall", + "syscall.InotifyAddWatch": "syscall", + "syscall.InotifyEvent": "syscall", + "syscall.InotifyInit": "syscall", + "syscall.InotifyInit1": "syscall", + "syscall.InotifyRmWatch": "syscall", + "syscall.InterfaceAddrMessage": "syscall", + "syscall.InterfaceAnnounceMessage": "syscall", + "syscall.InterfaceInfo": "syscall", + "syscall.InterfaceMessage": "syscall", + "syscall.InterfaceMulticastAddrMessage": "syscall", + "syscall.InvalidHandle": "syscall", + "syscall.Ioperm": "syscall", + "syscall.Iopl": "syscall", + "syscall.Iovec": "syscall", + "syscall.IpAdapterInfo": "syscall", + "syscall.IpAddrString": "syscall", + "syscall.IpAddressString": "syscall", + "syscall.IpMaskString": "syscall", + "syscall.Issetugid": "syscall", + "syscall.KEY_ALL_ACCESS": "syscall", + "syscall.KEY_CREATE_LINK": "syscall", + "syscall.KEY_CREATE_SUB_KEY": "syscall", + "syscall.KEY_ENUMERATE_SUB_KEYS": "syscall", + "syscall.KEY_EXECUTE": "syscall", + "syscall.KEY_NOTIFY": "syscall", + "syscall.KEY_QUERY_VALUE": "syscall", + "syscall.KEY_READ": "syscall", + "syscall.KEY_SET_VALUE": "syscall", + "syscall.KEY_WOW64_32KEY": "syscall", + "syscall.KEY_WOW64_64KEY": "syscall", + "syscall.KEY_WRITE": "syscall", + "syscall.Kevent": "syscall", + "syscall.Kevent_t": "syscall", + "syscall.Kill": "syscall", + "syscall.Klogctl": "syscall", + "syscall.Kqueue": "syscall", + "syscall.LANG_ENGLISH": "syscall", + "syscall.LAYERED_PROTOCOL": "syscall", + "syscall.LCNT_OVERLOAD_FLUSH": "syscall", + "syscall.LINUX_REBOOT_CMD_CAD_OFF": "syscall", + "syscall.LINUX_REBOOT_CMD_CAD_ON": "syscall", + "syscall.LINUX_REBOOT_CMD_HALT": "syscall", + "syscall.LINUX_REBOOT_CMD_KEXEC": "syscall", + "syscall.LINUX_REBOOT_CMD_POWER_OFF": "syscall", + "syscall.LINUX_REBOOT_CMD_RESTART": "syscall", + "syscall.LINUX_REBOOT_CMD_RESTART2": "syscall", + "syscall.LINUX_REBOOT_CMD_SW_SUSPEND": "syscall", + "syscall.LINUX_REBOOT_MAGIC1": "syscall", + "syscall.LINUX_REBOOT_MAGIC2": "syscall", + "syscall.LOCK_EX": "syscall", + "syscall.LOCK_NB": "syscall", + "syscall.LOCK_SH": "syscall", + "syscall.LOCK_UN": "syscall", + "syscall.LazyDLL": "syscall", + "syscall.LazyProc": "syscall", + "syscall.Lchown": "syscall", + "syscall.Linger": "syscall", + "syscall.Link": "syscall", + "syscall.Listen": "syscall", + "syscall.Listxattr": "syscall", + "syscall.LoadCancelIoEx": "syscall", + "syscall.LoadConnectEx": "syscall", + "syscall.LoadCreateSymbolicLink": "syscall", + "syscall.LoadDLL": "syscall", + "syscall.LoadGetAddrInfo": "syscall", + "syscall.LoadLibrary": "syscall", + "syscall.LoadSetFileCompletionNotificationModes": "syscall", + "syscall.LocalFree": "syscall", + "syscall.Log2phys_t": "syscall", + "syscall.LookupAccountName": "syscall", + "syscall.LookupAccountSid": "syscall", + "syscall.LookupSID": "syscall", + "syscall.LsfJump": "syscall", + "syscall.LsfSocket": "syscall", + "syscall.LsfStmt": "syscall", + "syscall.Lstat": "syscall", + "syscall.MADV_AUTOSYNC": "syscall", + "syscall.MADV_CAN_REUSE": "syscall", + "syscall.MADV_CORE": "syscall", + "syscall.MADV_DOFORK": "syscall", + "syscall.MADV_DONTFORK": "syscall", + "syscall.MADV_DONTNEED": "syscall", + "syscall.MADV_FREE": "syscall", + "syscall.MADV_FREE_REUSABLE": "syscall", + "syscall.MADV_FREE_REUSE": "syscall", + "syscall.MADV_HUGEPAGE": "syscall", + "syscall.MADV_HWPOISON": "syscall", + "syscall.MADV_MERGEABLE": "syscall", + "syscall.MADV_NOCORE": "syscall", + "syscall.MADV_NOHUGEPAGE": "syscall", + "syscall.MADV_NORMAL": "syscall", + "syscall.MADV_NOSYNC": "syscall", + "syscall.MADV_PROTECT": "syscall", + "syscall.MADV_RANDOM": "syscall", + "syscall.MADV_REMOVE": "syscall", + "syscall.MADV_SEQUENTIAL": "syscall", + "syscall.MADV_SPACEAVAIL": "syscall", + "syscall.MADV_UNMERGEABLE": "syscall", + "syscall.MADV_WILLNEED": "syscall", + "syscall.MADV_ZERO_WIRED_PAGES": "syscall", + "syscall.MAP_32BIT": "syscall", + "syscall.MAP_ALIGNED_SUPER": "syscall", + "syscall.MAP_ALIGNMENT_16MB": "syscall", + "syscall.MAP_ALIGNMENT_1TB": "syscall", + "syscall.MAP_ALIGNMENT_256TB": "syscall", + "syscall.MAP_ALIGNMENT_4GB": "syscall", + "syscall.MAP_ALIGNMENT_64KB": "syscall", + "syscall.MAP_ALIGNMENT_64PB": "syscall", + "syscall.MAP_ALIGNMENT_MASK": "syscall", + "syscall.MAP_ALIGNMENT_SHIFT": "syscall", + "syscall.MAP_ANON": "syscall", + "syscall.MAP_ANONYMOUS": "syscall", + "syscall.MAP_COPY": "syscall", + "syscall.MAP_DENYWRITE": "syscall", + "syscall.MAP_EXECUTABLE": "syscall", + "syscall.MAP_FILE": "syscall", + "syscall.MAP_FIXED": "syscall", + "syscall.MAP_FLAGMASK": "syscall", + "syscall.MAP_GROWSDOWN": "syscall", + "syscall.MAP_HASSEMAPHORE": "syscall", + "syscall.MAP_HUGETLB": "syscall", + "syscall.MAP_INHERIT": "syscall", + "syscall.MAP_INHERIT_COPY": "syscall", + "syscall.MAP_INHERIT_DEFAULT": "syscall", + "syscall.MAP_INHERIT_DONATE_COPY": "syscall", + "syscall.MAP_INHERIT_NONE": "syscall", + "syscall.MAP_INHERIT_SHARE": "syscall", + "syscall.MAP_JIT": "syscall", + "syscall.MAP_LOCKED": "syscall", + "syscall.MAP_NOCACHE": "syscall", + "syscall.MAP_NOCORE": "syscall", + "syscall.MAP_NOEXTEND": "syscall", + "syscall.MAP_NONBLOCK": "syscall", + "syscall.MAP_NORESERVE": "syscall", + "syscall.MAP_NOSYNC": "syscall", + "syscall.MAP_POPULATE": "syscall", + "syscall.MAP_PREFAULT_READ": "syscall", + "syscall.MAP_PRIVATE": "syscall", + "syscall.MAP_RENAME": "syscall", + "syscall.MAP_RESERVED0080": "syscall", + "syscall.MAP_RESERVED0100": "syscall", + "syscall.MAP_SHARED": "syscall", + "syscall.MAP_STACK": "syscall", + "syscall.MAP_TRYFIXED": "syscall", + "syscall.MAP_TYPE": "syscall", + "syscall.MAP_WIRED": "syscall", + "syscall.MAXIMUM_REPARSE_DATA_BUFFER_SIZE": "syscall", + "syscall.MAXLEN_IFDESCR": "syscall", + "syscall.MAXLEN_PHYSADDR": "syscall", + "syscall.MAX_ADAPTER_ADDRESS_LENGTH": "syscall", + "syscall.MAX_ADAPTER_DESCRIPTION_LENGTH": "syscall", + "syscall.MAX_ADAPTER_NAME_LENGTH": "syscall", + "syscall.MAX_COMPUTERNAME_LENGTH": "syscall", + "syscall.MAX_INTERFACE_NAME_LEN": "syscall", + "syscall.MAX_LONG_PATH": "syscall", + "syscall.MAX_PATH": "syscall", + "syscall.MAX_PROTOCOL_CHAIN": "syscall", + "syscall.MCL_CURRENT": "syscall", + "syscall.MCL_FUTURE": "syscall", + "syscall.MNT_DETACH": "syscall", + "syscall.MNT_EXPIRE": "syscall", + "syscall.MNT_FORCE": "syscall", + "syscall.MSG_BCAST": "syscall", + "syscall.MSG_CMSG_CLOEXEC": "syscall", + "syscall.MSG_COMPAT": "syscall", + "syscall.MSG_CONFIRM": "syscall", + "syscall.MSG_CONTROLMBUF": "syscall", + "syscall.MSG_CTRUNC": "syscall", + "syscall.MSG_DONTROUTE": "syscall", + "syscall.MSG_DONTWAIT": "syscall", + "syscall.MSG_EOF": "syscall", + "syscall.MSG_EOR": "syscall", + "syscall.MSG_ERRQUEUE": "syscall", + "syscall.MSG_FASTOPEN": "syscall", + "syscall.MSG_FIN": "syscall", + "syscall.MSG_FLUSH": "syscall", + "syscall.MSG_HAVEMORE": "syscall", + "syscall.MSG_HOLD": "syscall", + "syscall.MSG_IOVUSRSPACE": "syscall", + "syscall.MSG_LENUSRSPACE": "syscall", + "syscall.MSG_MCAST": "syscall", + "syscall.MSG_MORE": "syscall", + "syscall.MSG_NAMEMBUF": "syscall", + "syscall.MSG_NBIO": "syscall", + "syscall.MSG_NEEDSA": "syscall", + "syscall.MSG_NOSIGNAL": "syscall", + "syscall.MSG_NOTIFICATION": "syscall", + "syscall.MSG_OOB": "syscall", + "syscall.MSG_PEEK": "syscall", + "syscall.MSG_PROXY": "syscall", + "syscall.MSG_RCVMORE": "syscall", + "syscall.MSG_RST": "syscall", + "syscall.MSG_SEND": "syscall", + "syscall.MSG_SYN": "syscall", + "syscall.MSG_TRUNC": "syscall", + "syscall.MSG_TRYHARD": "syscall", + "syscall.MSG_USERFLAGS": "syscall", + "syscall.MSG_WAITALL": "syscall", + "syscall.MSG_WAITFORONE": "syscall", + "syscall.MSG_WAITSTREAM": "syscall", + "syscall.MS_ACTIVE": "syscall", + "syscall.MS_ASYNC": "syscall", + "syscall.MS_BIND": "syscall", + "syscall.MS_DEACTIVATE": "syscall", + "syscall.MS_DIRSYNC": "syscall", + "syscall.MS_INVALIDATE": "syscall", + "syscall.MS_I_VERSION": "syscall", + "syscall.MS_KERNMOUNT": "syscall", + "syscall.MS_KILLPAGES": "syscall", + "syscall.MS_MANDLOCK": "syscall", + "syscall.MS_MGC_MSK": "syscall", + "syscall.MS_MGC_VAL": "syscall", + "syscall.MS_MOVE": "syscall", + "syscall.MS_NOATIME": "syscall", + "syscall.MS_NODEV": "syscall", + "syscall.MS_NODIRATIME": "syscall", + "syscall.MS_NOEXEC": "syscall", + "syscall.MS_NOSUID": "syscall", + "syscall.MS_NOUSER": "syscall", + "syscall.MS_POSIXACL": "syscall", + "syscall.MS_PRIVATE": "syscall", + "syscall.MS_RDONLY": "syscall", + "syscall.MS_REC": "syscall", + "syscall.MS_RELATIME": "syscall", + "syscall.MS_REMOUNT": "syscall", + "syscall.MS_RMT_MASK": "syscall", + "syscall.MS_SHARED": "syscall", + "syscall.MS_SILENT": "syscall", + "syscall.MS_SLAVE": "syscall", + "syscall.MS_STRICTATIME": "syscall", + "syscall.MS_SYNC": "syscall", + "syscall.MS_SYNCHRONOUS": "syscall", + "syscall.MS_UNBINDABLE": "syscall", + "syscall.Madvise": "syscall", + "syscall.MapViewOfFile": "syscall", + "syscall.MaxTokenInfoClass": "syscall", + "syscall.Mclpool": "syscall", + "syscall.MibIfRow": "syscall", + "syscall.Mkdir": "syscall", + "syscall.Mkdirat": "syscall", + "syscall.Mkfifo": "syscall", + "syscall.Mknod": "syscall", + "syscall.Mknodat": "syscall", + "syscall.Mlock": "syscall", + "syscall.Mlockall": "syscall", + "syscall.Mmap": "syscall", + "syscall.Mount": "syscall", + "syscall.MoveFile": "syscall", + "syscall.Mprotect": "syscall", + "syscall.Msghdr": "syscall", + "syscall.Munlock": "syscall", + "syscall.Munlockall": "syscall", + "syscall.Munmap": "syscall", + "syscall.MustLoadDLL": "syscall", + "syscall.NAME_MAX": "syscall", + "syscall.NETLINK_ADD_MEMBERSHIP": "syscall", + "syscall.NETLINK_AUDIT": "syscall", + "syscall.NETLINK_BROADCAST_ERROR": "syscall", + "syscall.NETLINK_CONNECTOR": "syscall", + "syscall.NETLINK_DNRTMSG": "syscall", + "syscall.NETLINK_DROP_MEMBERSHIP": "syscall", + "syscall.NETLINK_ECRYPTFS": "syscall", + "syscall.NETLINK_FIB_LOOKUP": "syscall", + "syscall.NETLINK_FIREWALL": "syscall", + "syscall.NETLINK_GENERIC": "syscall", + "syscall.NETLINK_INET_DIAG": "syscall", + "syscall.NETLINK_IP6_FW": "syscall", + "syscall.NETLINK_ISCSI": "syscall", + "syscall.NETLINK_KOBJECT_UEVENT": "syscall", + "syscall.NETLINK_NETFILTER": "syscall", + "syscall.NETLINK_NFLOG": "syscall", + "syscall.NETLINK_NO_ENOBUFS": "syscall", + "syscall.NETLINK_PKTINFO": "syscall", + "syscall.NETLINK_RDMA": "syscall", + "syscall.NETLINK_ROUTE": "syscall", + "syscall.NETLINK_SCSITRANSPORT": "syscall", + "syscall.NETLINK_SELINUX": "syscall", + "syscall.NETLINK_UNUSED": "syscall", + "syscall.NETLINK_USERSOCK": "syscall", + "syscall.NETLINK_XFRM": "syscall", + "syscall.NET_RT_DUMP": "syscall", + "syscall.NET_RT_DUMP2": "syscall", + "syscall.NET_RT_FLAGS": "syscall", + "syscall.NET_RT_IFLIST": "syscall", + "syscall.NET_RT_IFLIST2": "syscall", + "syscall.NET_RT_IFLISTL": "syscall", + "syscall.NET_RT_IFMALIST": "syscall", + "syscall.NET_RT_MAXID": "syscall", + "syscall.NET_RT_OIFLIST": "syscall", + "syscall.NET_RT_OOIFLIST": "syscall", + "syscall.NET_RT_STAT": "syscall", + "syscall.NET_RT_STATS": "syscall", + "syscall.NET_RT_TABLE": "syscall", + "syscall.NET_RT_TRASH": "syscall", + "syscall.NLA_ALIGNTO": "syscall", + "syscall.NLA_F_NESTED": "syscall", + "syscall.NLA_F_NET_BYTEORDER": "syscall", + "syscall.NLA_HDRLEN": "syscall", + "syscall.NLMSG_ALIGNTO": "syscall", + "syscall.NLMSG_DONE": "syscall", + "syscall.NLMSG_ERROR": "syscall", + "syscall.NLMSG_HDRLEN": "syscall", + "syscall.NLMSG_MIN_TYPE": "syscall", + "syscall.NLMSG_NOOP": "syscall", + "syscall.NLMSG_OVERRUN": "syscall", + "syscall.NLM_F_ACK": "syscall", + "syscall.NLM_F_APPEND": "syscall", + "syscall.NLM_F_ATOMIC": "syscall", + "syscall.NLM_F_CREATE": "syscall", + "syscall.NLM_F_DUMP": "syscall", + "syscall.NLM_F_ECHO": "syscall", + "syscall.NLM_F_EXCL": "syscall", + "syscall.NLM_F_MATCH": "syscall", + "syscall.NLM_F_MULTI": "syscall", + "syscall.NLM_F_REPLACE": "syscall", + "syscall.NLM_F_REQUEST": "syscall", + "syscall.NLM_F_ROOT": "syscall", + "syscall.NOFLSH": "syscall", + "syscall.NOTE_ABSOLUTE": "syscall", + "syscall.NOTE_ATTRIB": "syscall", + "syscall.NOTE_CHILD": "syscall", + "syscall.NOTE_DELETE": "syscall", + "syscall.NOTE_EOF": "syscall", + "syscall.NOTE_EXEC": "syscall", + "syscall.NOTE_EXIT": "syscall", + "syscall.NOTE_EXITSTATUS": "syscall", + "syscall.NOTE_EXTEND": "syscall", + "syscall.NOTE_FFAND": "syscall", + "syscall.NOTE_FFCOPY": "syscall", + "syscall.NOTE_FFCTRLMASK": "syscall", + "syscall.NOTE_FFLAGSMASK": "syscall", + "syscall.NOTE_FFNOP": "syscall", + "syscall.NOTE_FFOR": "syscall", + "syscall.NOTE_FORK": "syscall", + "syscall.NOTE_LINK": "syscall", + "syscall.NOTE_LOWAT": "syscall", + "syscall.NOTE_NONE": "syscall", + "syscall.NOTE_NSECONDS": "syscall", + "syscall.NOTE_PCTRLMASK": "syscall", + "syscall.NOTE_PDATAMASK": "syscall", + "syscall.NOTE_REAP": "syscall", + "syscall.NOTE_RENAME": "syscall", + "syscall.NOTE_RESOURCEEND": "syscall", + "syscall.NOTE_REVOKE": "syscall", + "syscall.NOTE_SECONDS": "syscall", + "syscall.NOTE_SIGNAL": "syscall", + "syscall.NOTE_TRACK": "syscall", + "syscall.NOTE_TRACKERR": "syscall", + "syscall.NOTE_TRIGGER": "syscall", + "syscall.NOTE_TRUNCATE": "syscall", + "syscall.NOTE_USECONDS": "syscall", + "syscall.NOTE_VM_ERROR": "syscall", + "syscall.NOTE_VM_PRESSURE": "syscall", + "syscall.NOTE_VM_PRESSURE_SUDDEN_TERMINATE": "syscall", + "syscall.NOTE_VM_PRESSURE_TERMINATE": "syscall", + "syscall.NOTE_WRITE": "syscall", + "syscall.NameCanonical": "syscall", + "syscall.NameCanonicalEx": "syscall", + "syscall.NameDisplay": "syscall", + "syscall.NameDnsDomain": "syscall", + "syscall.NameFullyQualifiedDN": "syscall", + "syscall.NameSamCompatible": "syscall", + "syscall.NameServicePrincipal": "syscall", + "syscall.NameUniqueId": "syscall", + "syscall.NameUnknown": "syscall", + "syscall.NameUserPrincipal": "syscall", + "syscall.Nanosleep": "syscall", + "syscall.NetApiBufferFree": "syscall", + "syscall.NetGetJoinInformation": "syscall", + "syscall.NetSetupDomainName": "syscall", + "syscall.NetSetupUnjoined": "syscall", + "syscall.NetSetupUnknownStatus": "syscall", + "syscall.NetSetupWorkgroupName": "syscall", + "syscall.NetUserGetInfo": "syscall", + "syscall.NetlinkMessage": "syscall", + "syscall.NetlinkRIB": "syscall", + "syscall.NetlinkRouteAttr": "syscall", + "syscall.NetlinkRouteRequest": "syscall", + "syscall.NewCallback": "syscall", + "syscall.NewCallbackCDecl": "syscall", + "syscall.NewLazyDLL": "syscall", + "syscall.NlAttr": "syscall", + "syscall.NlMsgerr": "syscall", + "syscall.NlMsghdr": "syscall", + "syscall.NsecToFiletime": "syscall", + "syscall.NsecToTimespec": "syscall", + "syscall.NsecToTimeval": "syscall", + "syscall.Ntohs": "syscall", + "syscall.OCRNL": "syscall", + "syscall.OFDEL": "syscall", + "syscall.OFILL": "syscall", + "syscall.OFIOGETBMAP": "syscall", + "syscall.OID_PKIX_KP_SERVER_AUTH": "syscall", + "syscall.OID_SERVER_GATED_CRYPTO": "syscall", + "syscall.OID_SGC_NETSCAPE": "syscall", + "syscall.OLCUC": "syscall", + "syscall.ONLCR": "syscall", + "syscall.ONLRET": "syscall", + "syscall.ONOCR": "syscall", + "syscall.ONOEOT": "syscall", + "syscall.OPEN_ALWAYS": "syscall", + "syscall.OPEN_EXISTING": "syscall", + "syscall.OPOST": "syscall", + "syscall.O_ACCMODE": "syscall", + "syscall.O_ALERT": "syscall", + "syscall.O_ALT_IO": "syscall", + "syscall.O_APPEND": "syscall", + "syscall.O_ASYNC": "syscall", + "syscall.O_CLOEXEC": "syscall", + "syscall.O_CREAT": "syscall", + "syscall.O_DIRECT": "syscall", + "syscall.O_DIRECTORY": "syscall", + "syscall.O_DSYNC": "syscall", + "syscall.O_EVTONLY": "syscall", + "syscall.O_EXCL": "syscall", + "syscall.O_EXEC": "syscall", + "syscall.O_EXLOCK": "syscall", + "syscall.O_FSYNC": "syscall", + "syscall.O_LARGEFILE": "syscall", + "syscall.O_NDELAY": "syscall", + "syscall.O_NOATIME": "syscall", + "syscall.O_NOCTTY": "syscall", + "syscall.O_NOFOLLOW": "syscall", + "syscall.O_NONBLOCK": "syscall", + "syscall.O_NOSIGPIPE": "syscall", + "syscall.O_POPUP": "syscall", + "syscall.O_RDONLY": "syscall", + "syscall.O_RDWR": "syscall", + "syscall.O_RSYNC": "syscall", + "syscall.O_SHLOCK": "syscall", + "syscall.O_SYMLINK": "syscall", + "syscall.O_SYNC": "syscall", + "syscall.O_TRUNC": "syscall", + "syscall.O_TTY_INIT": "syscall", + "syscall.O_WRONLY": "syscall", + "syscall.Open": "syscall", + "syscall.OpenCurrentProcessToken": "syscall", + "syscall.OpenProcess": "syscall", + "syscall.OpenProcessToken": "syscall", + "syscall.Openat": "syscall", + "syscall.Overlapped": "syscall", + "syscall.PACKET_ADD_MEMBERSHIP": "syscall", + "syscall.PACKET_BROADCAST": "syscall", + "syscall.PACKET_DROP_MEMBERSHIP": "syscall", + "syscall.PACKET_FASTROUTE": "syscall", + "syscall.PACKET_HOST": "syscall", + "syscall.PACKET_LOOPBACK": "syscall", + "syscall.PACKET_MR_ALLMULTI": "syscall", + "syscall.PACKET_MR_MULTICAST": "syscall", + "syscall.PACKET_MR_PROMISC": "syscall", + "syscall.PACKET_MULTICAST": "syscall", + "syscall.PACKET_OTHERHOST": "syscall", + "syscall.PACKET_OUTGOING": "syscall", + "syscall.PACKET_RECV_OUTPUT": "syscall", + "syscall.PACKET_RX_RING": "syscall", + "syscall.PACKET_STATISTICS": "syscall", + "syscall.PAGE_EXECUTE_READ": "syscall", + "syscall.PAGE_EXECUTE_READWRITE": "syscall", + "syscall.PAGE_EXECUTE_WRITECOPY": "syscall", + "syscall.PAGE_READONLY": "syscall", + "syscall.PAGE_READWRITE": "syscall", + "syscall.PAGE_WRITECOPY": "syscall", + "syscall.PARENB": "syscall", + "syscall.PARMRK": "syscall", + "syscall.PARODD": "syscall", + "syscall.PENDIN": "syscall", + "syscall.PFL_HIDDEN": "syscall", + "syscall.PFL_MATCHES_PROTOCOL_ZERO": "syscall", + "syscall.PFL_MULTIPLE_PROTO_ENTRIES": "syscall", + "syscall.PFL_NETWORKDIRECT_PROVIDER": "syscall", + "syscall.PFL_RECOMMENDED_PROTO_ENTRY": "syscall", + "syscall.PF_FLUSH": "syscall", + "syscall.PKCS_7_ASN_ENCODING": "syscall", + "syscall.PMC5_PIPELINE_FLUSH": "syscall", + "syscall.PRIO_PGRP": "syscall", + "syscall.PRIO_PROCESS": "syscall", + "syscall.PRIO_USER": "syscall", + "syscall.PRI_IOFLUSH": "syscall", + "syscall.PROCESS_QUERY_INFORMATION": "syscall", + "syscall.PROCESS_TERMINATE": "syscall", + "syscall.PROT_EXEC": "syscall", + "syscall.PROT_GROWSDOWN": "syscall", + "syscall.PROT_GROWSUP": "syscall", + "syscall.PROT_NONE": "syscall", + "syscall.PROT_READ": "syscall", + "syscall.PROT_WRITE": "syscall", + "syscall.PROV_DH_SCHANNEL": "syscall", + "syscall.PROV_DSS": "syscall", + "syscall.PROV_DSS_DH": "syscall", + "syscall.PROV_EC_ECDSA_FULL": "syscall", + "syscall.PROV_EC_ECDSA_SIG": "syscall", + "syscall.PROV_EC_ECNRA_FULL": "syscall", + "syscall.PROV_EC_ECNRA_SIG": "syscall", + "syscall.PROV_FORTEZZA": "syscall", + "syscall.PROV_INTEL_SEC": "syscall", + "syscall.PROV_MS_EXCHANGE": "syscall", + "syscall.PROV_REPLACE_OWF": "syscall", + "syscall.PROV_RNG": "syscall", + "syscall.PROV_RSA_AES": "syscall", + "syscall.PROV_RSA_FULL": "syscall", + "syscall.PROV_RSA_SCHANNEL": "syscall", + "syscall.PROV_RSA_SIG": "syscall", + "syscall.PROV_SPYRUS_LYNKS": "syscall", + "syscall.PROV_SSL": "syscall", + "syscall.PR_CAPBSET_DROP": "syscall", + "syscall.PR_CAPBSET_READ": "syscall", + "syscall.PR_CLEAR_SECCOMP_FILTER": "syscall", + "syscall.PR_ENDIAN_BIG": "syscall", + "syscall.PR_ENDIAN_LITTLE": "syscall", + "syscall.PR_ENDIAN_PPC_LITTLE": "syscall", + "syscall.PR_FPEMU_NOPRINT": "syscall", + "syscall.PR_FPEMU_SIGFPE": "syscall", + "syscall.PR_FP_EXC_ASYNC": "syscall", + "syscall.PR_FP_EXC_DISABLED": "syscall", + "syscall.PR_FP_EXC_DIV": "syscall", + "syscall.PR_FP_EXC_INV": "syscall", + "syscall.PR_FP_EXC_NONRECOV": "syscall", + "syscall.PR_FP_EXC_OVF": "syscall", + "syscall.PR_FP_EXC_PRECISE": "syscall", + "syscall.PR_FP_EXC_RES": "syscall", + "syscall.PR_FP_EXC_SW_ENABLE": "syscall", + "syscall.PR_FP_EXC_UND": "syscall", + "syscall.PR_GET_DUMPABLE": "syscall", + "syscall.PR_GET_ENDIAN": "syscall", + "syscall.PR_GET_FPEMU": "syscall", + "syscall.PR_GET_FPEXC": "syscall", + "syscall.PR_GET_KEEPCAPS": "syscall", + "syscall.PR_GET_NAME": "syscall", + "syscall.PR_GET_PDEATHSIG": "syscall", + "syscall.PR_GET_SECCOMP": "syscall", + "syscall.PR_GET_SECCOMP_FILTER": "syscall", + "syscall.PR_GET_SECUREBITS": "syscall", + "syscall.PR_GET_TIMERSLACK": "syscall", + "syscall.PR_GET_TIMING": "syscall", + "syscall.PR_GET_TSC": "syscall", + "syscall.PR_GET_UNALIGN": "syscall", + "syscall.PR_MCE_KILL": "syscall", + "syscall.PR_MCE_KILL_CLEAR": "syscall", + "syscall.PR_MCE_KILL_DEFAULT": "syscall", + "syscall.PR_MCE_KILL_EARLY": "syscall", + "syscall.PR_MCE_KILL_GET": "syscall", + "syscall.PR_MCE_KILL_LATE": "syscall", + "syscall.PR_MCE_KILL_SET": "syscall", + "syscall.PR_SECCOMP_FILTER_EVENT": "syscall", + "syscall.PR_SECCOMP_FILTER_SYSCALL": "syscall", + "syscall.PR_SET_DUMPABLE": "syscall", + "syscall.PR_SET_ENDIAN": "syscall", + "syscall.PR_SET_FPEMU": "syscall", + "syscall.PR_SET_FPEXC": "syscall", + "syscall.PR_SET_KEEPCAPS": "syscall", + "syscall.PR_SET_NAME": "syscall", + "syscall.PR_SET_PDEATHSIG": "syscall", + "syscall.PR_SET_PTRACER": "syscall", + "syscall.PR_SET_SECCOMP": "syscall", + "syscall.PR_SET_SECCOMP_FILTER": "syscall", + "syscall.PR_SET_SECUREBITS": "syscall", + "syscall.PR_SET_TIMERSLACK": "syscall", + "syscall.PR_SET_TIMING": "syscall", + "syscall.PR_SET_TSC": "syscall", + "syscall.PR_SET_UNALIGN": "syscall", + "syscall.PR_TASK_PERF_EVENTS_DISABLE": "syscall", + "syscall.PR_TASK_PERF_EVENTS_ENABLE": "syscall", + "syscall.PR_TIMING_STATISTICAL": "syscall", + "syscall.PR_TIMING_TIMESTAMP": "syscall", + "syscall.PR_TSC_ENABLE": "syscall", + "syscall.PR_TSC_SIGSEGV": "syscall", + "syscall.PR_UNALIGN_NOPRINT": "syscall", + "syscall.PR_UNALIGN_SIGBUS": "syscall", + "syscall.PTRACE_ARCH_PRCTL": "syscall", + "syscall.PTRACE_ATTACH": "syscall", + "syscall.PTRACE_CONT": "syscall", + "syscall.PTRACE_DETACH": "syscall", + "syscall.PTRACE_EVENT_CLONE": "syscall", + "syscall.PTRACE_EVENT_EXEC": "syscall", + "syscall.PTRACE_EVENT_EXIT": "syscall", + "syscall.PTRACE_EVENT_FORK": "syscall", + "syscall.PTRACE_EVENT_VFORK": "syscall", + "syscall.PTRACE_EVENT_VFORK_DONE": "syscall", + "syscall.PTRACE_GETCRUNCHREGS": "syscall", + "syscall.PTRACE_GETEVENTMSG": "syscall", + "syscall.PTRACE_GETFPREGS": "syscall", + "syscall.PTRACE_GETFPXREGS": "syscall", + "syscall.PTRACE_GETHBPREGS": "syscall", + "syscall.PTRACE_GETREGS": "syscall", + "syscall.PTRACE_GETREGSET": "syscall", + "syscall.PTRACE_GETSIGINFO": "syscall", + "syscall.PTRACE_GETVFPREGS": "syscall", + "syscall.PTRACE_GETWMMXREGS": "syscall", + "syscall.PTRACE_GET_THREAD_AREA": "syscall", + "syscall.PTRACE_KILL": "syscall", + "syscall.PTRACE_OLDSETOPTIONS": "syscall", + "syscall.PTRACE_O_MASK": "syscall", + "syscall.PTRACE_O_TRACECLONE": "syscall", + "syscall.PTRACE_O_TRACEEXEC": "syscall", + "syscall.PTRACE_O_TRACEEXIT": "syscall", + "syscall.PTRACE_O_TRACEFORK": "syscall", + "syscall.PTRACE_O_TRACESYSGOOD": "syscall", + "syscall.PTRACE_O_TRACEVFORK": "syscall", + "syscall.PTRACE_O_TRACEVFORKDONE": "syscall", + "syscall.PTRACE_PEEKDATA": "syscall", + "syscall.PTRACE_PEEKTEXT": "syscall", + "syscall.PTRACE_PEEKUSR": "syscall", + "syscall.PTRACE_POKEDATA": "syscall", + "syscall.PTRACE_POKETEXT": "syscall", + "syscall.PTRACE_POKEUSR": "syscall", + "syscall.PTRACE_SETCRUNCHREGS": "syscall", + "syscall.PTRACE_SETFPREGS": "syscall", + "syscall.PTRACE_SETFPXREGS": "syscall", + "syscall.PTRACE_SETHBPREGS": "syscall", + "syscall.PTRACE_SETOPTIONS": "syscall", + "syscall.PTRACE_SETREGS": "syscall", + "syscall.PTRACE_SETREGSET": "syscall", + "syscall.PTRACE_SETSIGINFO": "syscall", + "syscall.PTRACE_SETVFPREGS": "syscall", + "syscall.PTRACE_SETWMMXREGS": "syscall", + "syscall.PTRACE_SET_SYSCALL": "syscall", + "syscall.PTRACE_SET_THREAD_AREA": "syscall", + "syscall.PTRACE_SINGLEBLOCK": "syscall", + "syscall.PTRACE_SINGLESTEP": "syscall", + "syscall.PTRACE_SYSCALL": "syscall", + "syscall.PTRACE_SYSEMU": "syscall", + "syscall.PTRACE_SYSEMU_SINGLESTEP": "syscall", + "syscall.PTRACE_TRACEME": "syscall", + "syscall.PT_ATTACH": "syscall", + "syscall.PT_ATTACHEXC": "syscall", + "syscall.PT_CONTINUE": "syscall", + "syscall.PT_DATA_ADDR": "syscall", + "syscall.PT_DENY_ATTACH": "syscall", + "syscall.PT_DETACH": "syscall", + "syscall.PT_FIRSTMACH": "syscall", + "syscall.PT_FORCEQUOTA": "syscall", + "syscall.PT_KILL": "syscall", + "syscall.PT_MASK": "syscall", + "syscall.PT_READ_D": "syscall", + "syscall.PT_READ_I": "syscall", + "syscall.PT_READ_U": "syscall", + "syscall.PT_SIGEXC": "syscall", + "syscall.PT_STEP": "syscall", + "syscall.PT_TEXT_ADDR": "syscall", + "syscall.PT_TEXT_END_ADDR": "syscall", + "syscall.PT_THUPDATE": "syscall", + "syscall.PT_TRACE_ME": "syscall", + "syscall.PT_WRITE_D": "syscall", + "syscall.PT_WRITE_I": "syscall", + "syscall.PT_WRITE_U": "syscall", + "syscall.ParseDirent": "syscall", + "syscall.ParseNetlinkMessage": "syscall", + "syscall.ParseNetlinkRouteAttr": "syscall", + "syscall.ParseRoutingMessage": "syscall", + "syscall.ParseRoutingSockaddr": "syscall", + "syscall.ParseSocketControlMessage": "syscall", + "syscall.ParseUnixCredentials": "syscall", + "syscall.ParseUnixRights": "syscall", + "syscall.PathMax": "syscall", + "syscall.Pathconf": "syscall", + "syscall.Pause": "syscall", + "syscall.Pipe": "syscall", + "syscall.Pipe2": "syscall", + "syscall.PivotRoot": "syscall", + "syscall.PostQueuedCompletionStatus": "syscall", + "syscall.Pread": "syscall", + "syscall.Proc": "syscall", + "syscall.ProcAttr": "syscall", + "syscall.Process32First": "syscall", + "syscall.Process32Next": "syscall", + "syscall.ProcessEntry32": "syscall", + "syscall.ProcessInformation": "syscall", + "syscall.Protoent": "syscall", + "syscall.PtraceAttach": "syscall", + "syscall.PtraceCont": "syscall", + "syscall.PtraceDetach": "syscall", + "syscall.PtraceGetEventMsg": "syscall", + "syscall.PtraceGetRegs": "syscall", + "syscall.PtracePeekData": "syscall", + "syscall.PtracePeekText": "syscall", + "syscall.PtracePokeData": "syscall", + "syscall.PtracePokeText": "syscall", + "syscall.PtraceRegs": "syscall", + "syscall.PtraceSetOptions": "syscall", + "syscall.PtraceSetRegs": "syscall", + "syscall.PtraceSingleStep": "syscall", + "syscall.PtraceSyscall": "syscall", + "syscall.Pwrite": "syscall", + "syscall.REG_BINARY": "syscall", + "syscall.REG_DWORD": "syscall", + "syscall.REG_DWORD_BIG_ENDIAN": "syscall", + "syscall.REG_DWORD_LITTLE_ENDIAN": "syscall", + "syscall.REG_EXPAND_SZ": "syscall", + "syscall.REG_FULL_RESOURCE_DESCRIPTOR": "syscall", + "syscall.REG_LINK": "syscall", + "syscall.REG_MULTI_SZ": "syscall", + "syscall.REG_NONE": "syscall", + "syscall.REG_QWORD": "syscall", + "syscall.REG_QWORD_LITTLE_ENDIAN": "syscall", + "syscall.REG_RESOURCE_LIST": "syscall", + "syscall.REG_RESOURCE_REQUIREMENTS_LIST": "syscall", + "syscall.REG_SZ": "syscall", + "syscall.RLIMIT_AS": "syscall", + "syscall.RLIMIT_CORE": "syscall", + "syscall.RLIMIT_CPU": "syscall", + "syscall.RLIMIT_DATA": "syscall", + "syscall.RLIMIT_FSIZE": "syscall", + "syscall.RLIMIT_NOFILE": "syscall", + "syscall.RLIMIT_STACK": "syscall", + "syscall.RLIM_INFINITY": "syscall", + "syscall.RTAX_ADVMSS": "syscall", + "syscall.RTAX_AUTHOR": "syscall", + "syscall.RTAX_BRD": "syscall", + "syscall.RTAX_CWND": "syscall", + "syscall.RTAX_DST": "syscall", + "syscall.RTAX_FEATURES": "syscall", + "syscall.RTAX_FEATURE_ALLFRAG": "syscall", + "syscall.RTAX_FEATURE_ECN": "syscall", + "syscall.RTAX_FEATURE_SACK": "syscall", + "syscall.RTAX_FEATURE_TIMESTAMP": "syscall", + "syscall.RTAX_GATEWAY": "syscall", + "syscall.RTAX_GENMASK": "syscall", + "syscall.RTAX_HOPLIMIT": "syscall", + "syscall.RTAX_IFA": "syscall", + "syscall.RTAX_IFP": "syscall", + "syscall.RTAX_INITCWND": "syscall", + "syscall.RTAX_INITRWND": "syscall", + "syscall.RTAX_LABEL": "syscall", + "syscall.RTAX_LOCK": "syscall", + "syscall.RTAX_MAX": "syscall", + "syscall.RTAX_MTU": "syscall", + "syscall.RTAX_NETMASK": "syscall", + "syscall.RTAX_REORDERING": "syscall", + "syscall.RTAX_RTO_MIN": "syscall", + "syscall.RTAX_RTT": "syscall", + "syscall.RTAX_RTTVAR": "syscall", + "syscall.RTAX_SRC": "syscall", + "syscall.RTAX_SRCMASK": "syscall", + "syscall.RTAX_SSTHRESH": "syscall", + "syscall.RTAX_TAG": "syscall", + "syscall.RTAX_UNSPEC": "syscall", + "syscall.RTAX_WINDOW": "syscall", + "syscall.RTA_ALIGNTO": "syscall", + "syscall.RTA_AUTHOR": "syscall", + "syscall.RTA_BRD": "syscall", + "syscall.RTA_CACHEINFO": "syscall", + "syscall.RTA_DST": "syscall", + "syscall.RTA_FLOW": "syscall", + "syscall.RTA_GATEWAY": "syscall", + "syscall.RTA_GENMASK": "syscall", + "syscall.RTA_IFA": "syscall", + "syscall.RTA_IFP": "syscall", + "syscall.RTA_IIF": "syscall", + "syscall.RTA_LABEL": "syscall", + "syscall.RTA_MAX": "syscall", + "syscall.RTA_METRICS": "syscall", + "syscall.RTA_MULTIPATH": "syscall", + "syscall.RTA_NETMASK": "syscall", + "syscall.RTA_OIF": "syscall", + "syscall.RTA_PREFSRC": "syscall", + "syscall.RTA_PRIORITY": "syscall", + "syscall.RTA_SRC": "syscall", + "syscall.RTA_SRCMASK": "syscall", + "syscall.RTA_TABLE": "syscall", + "syscall.RTA_TAG": "syscall", + "syscall.RTA_UNSPEC": "syscall", + "syscall.RTCF_DIRECTSRC": "syscall", + "syscall.RTCF_DOREDIRECT": "syscall", + "syscall.RTCF_LOG": "syscall", + "syscall.RTCF_MASQ": "syscall", + "syscall.RTCF_NAT": "syscall", + "syscall.RTCF_VALVE": "syscall", + "syscall.RTF_ADDRCLASSMASK": "syscall", + "syscall.RTF_ADDRCONF": "syscall", + "syscall.RTF_ALLONLINK": "syscall", + "syscall.RTF_ANNOUNCE": "syscall", + "syscall.RTF_BLACKHOLE": "syscall", + "syscall.RTF_BROADCAST": "syscall", + "syscall.RTF_CACHE": "syscall", + "syscall.RTF_CLONED": "syscall", + "syscall.RTF_CLONING": "syscall", + "syscall.RTF_CONDEMNED": "syscall", + "syscall.RTF_DEFAULT": "syscall", + "syscall.RTF_DELCLONE": "syscall", + "syscall.RTF_DONE": "syscall", + "syscall.RTF_DYNAMIC": "syscall", + "syscall.RTF_FLOW": "syscall", + "syscall.RTF_FMASK": "syscall", + "syscall.RTF_GATEWAY": "syscall", + "syscall.RTF_GWFLAG_COMPAT": "syscall", + "syscall.RTF_HOST": "syscall", + "syscall.RTF_IFREF": "syscall", + "syscall.RTF_IFSCOPE": "syscall", + "syscall.RTF_INTERFACE": "syscall", + "syscall.RTF_IRTT": "syscall", + "syscall.RTF_LINKRT": "syscall", + "syscall.RTF_LLDATA": "syscall", + "syscall.RTF_LLINFO": "syscall", + "syscall.RTF_LOCAL": "syscall", + "syscall.RTF_MASK": "syscall", + "syscall.RTF_MODIFIED": "syscall", + "syscall.RTF_MPATH": "syscall", + "syscall.RTF_MPLS": "syscall", + "syscall.RTF_MSS": "syscall", + "syscall.RTF_MTU": "syscall", + "syscall.RTF_MULTICAST": "syscall", + "syscall.RTF_NAT": "syscall", + "syscall.RTF_NOFORWARD": "syscall", + "syscall.RTF_NONEXTHOP": "syscall", + "syscall.RTF_NOPMTUDISC": "syscall", + "syscall.RTF_PERMANENT_ARP": "syscall", + "syscall.RTF_PINNED": "syscall", + "syscall.RTF_POLICY": "syscall", + "syscall.RTF_PRCLONING": "syscall", + "syscall.RTF_PROTO1": "syscall", + "syscall.RTF_PROTO2": "syscall", + "syscall.RTF_PROTO3": "syscall", + "syscall.RTF_REINSTATE": "syscall", + "syscall.RTF_REJECT": "syscall", + "syscall.RTF_RNH_LOCKED": "syscall", + "syscall.RTF_SOURCE": "syscall", + "syscall.RTF_SRC": "syscall", + "syscall.RTF_STATIC": "syscall", + "syscall.RTF_STICKY": "syscall", + "syscall.RTF_THROW": "syscall", + "syscall.RTF_TUNNEL": "syscall", + "syscall.RTF_UP": "syscall", + "syscall.RTF_USETRAILERS": "syscall", + "syscall.RTF_WASCLONED": "syscall", + "syscall.RTF_WINDOW": "syscall", + "syscall.RTF_XRESOLVE": "syscall", + "syscall.RTM_ADD": "syscall", + "syscall.RTM_BASE": "syscall", + "syscall.RTM_CHANGE": "syscall", + "syscall.RTM_CHGADDR": "syscall", + "syscall.RTM_DELACTION": "syscall", + "syscall.RTM_DELADDR": "syscall", + "syscall.RTM_DELADDRLABEL": "syscall", + "syscall.RTM_DELETE": "syscall", + "syscall.RTM_DELLINK": "syscall", + "syscall.RTM_DELMADDR": "syscall", + "syscall.RTM_DELNEIGH": "syscall", + "syscall.RTM_DELQDISC": "syscall", + "syscall.RTM_DELROUTE": "syscall", + "syscall.RTM_DELRULE": "syscall", + "syscall.RTM_DELTCLASS": "syscall", + "syscall.RTM_DELTFILTER": "syscall", + "syscall.RTM_DESYNC": "syscall", + "syscall.RTM_F_CLONED": "syscall", + "syscall.RTM_F_EQUALIZE": "syscall", + "syscall.RTM_F_NOTIFY": "syscall", + "syscall.RTM_F_PREFIX": "syscall", + "syscall.RTM_GET": "syscall", + "syscall.RTM_GET2": "syscall", + "syscall.RTM_GETACTION": "syscall", + "syscall.RTM_GETADDR": "syscall", + "syscall.RTM_GETADDRLABEL": "syscall", + "syscall.RTM_GETANYCAST": "syscall", + "syscall.RTM_GETDCB": "syscall", + "syscall.RTM_GETLINK": "syscall", + "syscall.RTM_GETMULTICAST": "syscall", + "syscall.RTM_GETNEIGH": "syscall", + "syscall.RTM_GETNEIGHTBL": "syscall", + "syscall.RTM_GETQDISC": "syscall", + "syscall.RTM_GETROUTE": "syscall", + "syscall.RTM_GETRULE": "syscall", + "syscall.RTM_GETTCLASS": "syscall", + "syscall.RTM_GETTFILTER": "syscall", + "syscall.RTM_IEEE80211": "syscall", + "syscall.RTM_IFANNOUNCE": "syscall", + "syscall.RTM_IFINFO": "syscall", + "syscall.RTM_IFINFO2": "syscall", + "syscall.RTM_LLINFO_UPD": "syscall", + "syscall.RTM_LOCK": "syscall", + "syscall.RTM_LOSING": "syscall", + "syscall.RTM_MAX": "syscall", + "syscall.RTM_MAXSIZE": "syscall", + "syscall.RTM_MISS": "syscall", + "syscall.RTM_NEWACTION": "syscall", + "syscall.RTM_NEWADDR": "syscall", + "syscall.RTM_NEWADDRLABEL": "syscall", + "syscall.RTM_NEWLINK": "syscall", + "syscall.RTM_NEWMADDR": "syscall", + "syscall.RTM_NEWMADDR2": "syscall", + "syscall.RTM_NEWNDUSEROPT": "syscall", + "syscall.RTM_NEWNEIGH": "syscall", + "syscall.RTM_NEWNEIGHTBL": "syscall", + "syscall.RTM_NEWPREFIX": "syscall", + "syscall.RTM_NEWQDISC": "syscall", + "syscall.RTM_NEWROUTE": "syscall", + "syscall.RTM_NEWRULE": "syscall", + "syscall.RTM_NEWTCLASS": "syscall", + "syscall.RTM_NEWTFILTER": "syscall", + "syscall.RTM_NR_FAMILIES": "syscall", + "syscall.RTM_NR_MSGTYPES": "syscall", + "syscall.RTM_OIFINFO": "syscall", + "syscall.RTM_OLDADD": "syscall", + "syscall.RTM_OLDDEL": "syscall", + "syscall.RTM_OOIFINFO": "syscall", + "syscall.RTM_REDIRECT": "syscall", + "syscall.RTM_RESOLVE": "syscall", + "syscall.RTM_RTTUNIT": "syscall", + "syscall.RTM_SETDCB": "syscall", + "syscall.RTM_SETGATE": "syscall", + "syscall.RTM_SETLINK": "syscall", + "syscall.RTM_SETNEIGHTBL": "syscall", + "syscall.RTM_VERSION": "syscall", + "syscall.RTNH_ALIGNTO": "syscall", + "syscall.RTNH_F_DEAD": "syscall", + "syscall.RTNH_F_ONLINK": "syscall", + "syscall.RTNH_F_PERVASIVE": "syscall", + "syscall.RTNLGRP_IPV4_IFADDR": "syscall", + "syscall.RTNLGRP_IPV4_MROUTE": "syscall", + "syscall.RTNLGRP_IPV4_ROUTE": "syscall", + "syscall.RTNLGRP_IPV4_RULE": "syscall", + "syscall.RTNLGRP_IPV6_IFADDR": "syscall", + "syscall.RTNLGRP_IPV6_IFINFO": "syscall", + "syscall.RTNLGRP_IPV6_MROUTE": "syscall", + "syscall.RTNLGRP_IPV6_PREFIX": "syscall", + "syscall.RTNLGRP_IPV6_ROUTE": "syscall", + "syscall.RTNLGRP_IPV6_RULE": "syscall", + "syscall.RTNLGRP_LINK": "syscall", + "syscall.RTNLGRP_ND_USEROPT": "syscall", + "syscall.RTNLGRP_NEIGH": "syscall", + "syscall.RTNLGRP_NONE": "syscall", + "syscall.RTNLGRP_NOTIFY": "syscall", + "syscall.RTNLGRP_TC": "syscall", + "syscall.RTN_ANYCAST": "syscall", + "syscall.RTN_BLACKHOLE": "syscall", + "syscall.RTN_BROADCAST": "syscall", + "syscall.RTN_LOCAL": "syscall", + "syscall.RTN_MAX": "syscall", + "syscall.RTN_MULTICAST": "syscall", + "syscall.RTN_NAT": "syscall", + "syscall.RTN_PROHIBIT": "syscall", + "syscall.RTN_THROW": "syscall", + "syscall.RTN_UNICAST": "syscall", + "syscall.RTN_UNREACHABLE": "syscall", + "syscall.RTN_UNSPEC": "syscall", + "syscall.RTN_XRESOLVE": "syscall", + "syscall.RTPROT_BIRD": "syscall", + "syscall.RTPROT_BOOT": "syscall", + "syscall.RTPROT_DHCP": "syscall", + "syscall.RTPROT_DNROUTED": "syscall", + "syscall.RTPROT_GATED": "syscall", + "syscall.RTPROT_KERNEL": "syscall", + "syscall.RTPROT_MRT": "syscall", + "syscall.RTPROT_NTK": "syscall", + "syscall.RTPROT_RA": "syscall", + "syscall.RTPROT_REDIRECT": "syscall", + "syscall.RTPROT_STATIC": "syscall", + "syscall.RTPROT_UNSPEC": "syscall", + "syscall.RTPROT_XORP": "syscall", + "syscall.RTPROT_ZEBRA": "syscall", + "syscall.RTV_EXPIRE": "syscall", + "syscall.RTV_HOPCOUNT": "syscall", + "syscall.RTV_MTU": "syscall", + "syscall.RTV_RPIPE": "syscall", + "syscall.RTV_RTT": "syscall", + "syscall.RTV_RTTVAR": "syscall", + "syscall.RTV_SPIPE": "syscall", + "syscall.RTV_SSTHRESH": "syscall", + "syscall.RTV_WEIGHT": "syscall", + "syscall.RT_CACHING_CONTEXT": "syscall", + "syscall.RT_CLASS_DEFAULT": "syscall", + "syscall.RT_CLASS_LOCAL": "syscall", + "syscall.RT_CLASS_MAIN": "syscall", + "syscall.RT_CLASS_MAX": "syscall", + "syscall.RT_CLASS_UNSPEC": "syscall", + "syscall.RT_DEFAULT_FIB": "syscall", + "syscall.RT_NORTREF": "syscall", + "syscall.RT_SCOPE_HOST": "syscall", + "syscall.RT_SCOPE_LINK": "syscall", + "syscall.RT_SCOPE_NOWHERE": "syscall", + "syscall.RT_SCOPE_SITE": "syscall", + "syscall.RT_SCOPE_UNIVERSE": "syscall", + "syscall.RT_TABLEID_MAX": "syscall", + "syscall.RT_TABLE_COMPAT": "syscall", + "syscall.RT_TABLE_DEFAULT": "syscall", + "syscall.RT_TABLE_LOCAL": "syscall", + "syscall.RT_TABLE_MAIN": "syscall", + "syscall.RT_TABLE_MAX": "syscall", + "syscall.RT_TABLE_UNSPEC": "syscall", + "syscall.RUSAGE_CHILDREN": "syscall", + "syscall.RUSAGE_SELF": "syscall", + "syscall.RUSAGE_THREAD": "syscall", + "syscall.Radvisory_t": "syscall", + "syscall.RawSockaddr": "syscall", + "syscall.RawSockaddrAny": "syscall", + "syscall.RawSockaddrDatalink": "syscall", + "syscall.RawSockaddrInet4": "syscall", + "syscall.RawSockaddrInet6": "syscall", + "syscall.RawSockaddrLinklayer": "syscall", + "syscall.RawSockaddrNetlink": "syscall", + "syscall.RawSockaddrUnix": "syscall", + "syscall.RawSyscall": "syscall", + "syscall.RawSyscall6": "syscall", + "syscall.Read": "syscall", + "syscall.ReadConsole": "syscall", + "syscall.ReadDirectoryChanges": "syscall", + "syscall.ReadDirent": "syscall", + "syscall.ReadFile": "syscall", + "syscall.Readlink": "syscall", + "syscall.Reboot": "syscall", + "syscall.Recvfrom": "syscall", + "syscall.Recvmsg": "syscall", + "syscall.RegCloseKey": "syscall", + "syscall.RegEnumKeyEx": "syscall", + "syscall.RegOpenKeyEx": "syscall", + "syscall.RegQueryInfoKey": "syscall", + "syscall.RegQueryValueEx": "syscall", + "syscall.RemoveDirectory": "syscall", + "syscall.Removexattr": "syscall", + "syscall.Rename": "syscall", + "syscall.Renameat": "syscall", + "syscall.Revoke": "syscall", + "syscall.Rlimit": "syscall", + "syscall.Rmdir": "syscall", + "syscall.RouteMessage": "syscall", + "syscall.RouteRIB": "syscall", + "syscall.RtAttr": "syscall", + "syscall.RtGenmsg": "syscall", + "syscall.RtMetrics": "syscall", + "syscall.RtMsg": "syscall", + "syscall.RtMsghdr": "syscall", + "syscall.RtNexthop": "syscall", + "syscall.Rusage": "syscall", + "syscall.SCM_BINTIME": "syscall", + "syscall.SCM_CREDENTIALS": "syscall", + "syscall.SCM_CREDS": "syscall", + "syscall.SCM_RIGHTS": "syscall", + "syscall.SCM_TIMESTAMP": "syscall", + "syscall.SCM_TIMESTAMPING": "syscall", + "syscall.SCM_TIMESTAMPNS": "syscall", + "syscall.SCM_TIMESTAMP_MONOTONIC": "syscall", + "syscall.SHUT_RD": "syscall", + "syscall.SHUT_RDWR": "syscall", + "syscall.SHUT_WR": "syscall", + "syscall.SID": "syscall", + "syscall.SIDAndAttributes": "syscall", + "syscall.SIGABRT": "syscall", + "syscall.SIGALRM": "syscall", + "syscall.SIGBUS": "syscall", + "syscall.SIGCHLD": "syscall", + "syscall.SIGCLD": "syscall", + "syscall.SIGCONT": "syscall", + "syscall.SIGEMT": "syscall", + "syscall.SIGFPE": "syscall", + "syscall.SIGHUP": "syscall", + "syscall.SIGILL": "syscall", + "syscall.SIGINFO": "syscall", + "syscall.SIGINT": "syscall", + "syscall.SIGIO": "syscall", + "syscall.SIGIOT": "syscall", + "syscall.SIGKILL": "syscall", + "syscall.SIGLIBRT": "syscall", + "syscall.SIGLWP": "syscall", + "syscall.SIGPIPE": "syscall", + "syscall.SIGPOLL": "syscall", + "syscall.SIGPROF": "syscall", + "syscall.SIGPWR": "syscall", + "syscall.SIGQUIT": "syscall", + "syscall.SIGSEGV": "syscall", + "syscall.SIGSTKFLT": "syscall", + "syscall.SIGSTOP": "syscall", + "syscall.SIGSYS": "syscall", + "syscall.SIGTERM": "syscall", + "syscall.SIGTHR": "syscall", + "syscall.SIGTRAP": "syscall", + "syscall.SIGTSTP": "syscall", + "syscall.SIGTTIN": "syscall", + "syscall.SIGTTOU": "syscall", + "syscall.SIGUNUSED": "syscall", + "syscall.SIGURG": "syscall", + "syscall.SIGUSR1": "syscall", + "syscall.SIGUSR2": "syscall", + "syscall.SIGVTALRM": "syscall", + "syscall.SIGWINCH": "syscall", + "syscall.SIGXCPU": "syscall", + "syscall.SIGXFSZ": "syscall", + "syscall.SIOCADDDLCI": "syscall", + "syscall.SIOCADDMULTI": "syscall", + "syscall.SIOCADDRT": "syscall", + "syscall.SIOCAIFADDR": "syscall", + "syscall.SIOCAIFGROUP": "syscall", + "syscall.SIOCALIFADDR": "syscall", + "syscall.SIOCARPIPLL": "syscall", + "syscall.SIOCATMARK": "syscall", + "syscall.SIOCAUTOADDR": "syscall", + "syscall.SIOCAUTONETMASK": "syscall", + "syscall.SIOCBRDGADD": "syscall", + "syscall.SIOCBRDGADDS": "syscall", + "syscall.SIOCBRDGARL": "syscall", + "syscall.SIOCBRDGDADDR": "syscall", + "syscall.SIOCBRDGDEL": "syscall", + "syscall.SIOCBRDGDELS": "syscall", + "syscall.SIOCBRDGFLUSH": "syscall", + "syscall.SIOCBRDGFRL": "syscall", + "syscall.SIOCBRDGGCACHE": "syscall", + "syscall.SIOCBRDGGFD": "syscall", + "syscall.SIOCBRDGGHT": "syscall", + "syscall.SIOCBRDGGIFFLGS": "syscall", + "syscall.SIOCBRDGGMA": "syscall", + "syscall.SIOCBRDGGPARAM": "syscall", + "syscall.SIOCBRDGGPRI": "syscall", + "syscall.SIOCBRDGGRL": "syscall", + "syscall.SIOCBRDGGSIFS": "syscall", + "syscall.SIOCBRDGGTO": "syscall", + "syscall.SIOCBRDGIFS": "syscall", + "syscall.SIOCBRDGRTS": "syscall", + "syscall.SIOCBRDGSADDR": "syscall", + "syscall.SIOCBRDGSCACHE": "syscall", + "syscall.SIOCBRDGSFD": "syscall", + "syscall.SIOCBRDGSHT": "syscall", + "syscall.SIOCBRDGSIFCOST": "syscall", + "syscall.SIOCBRDGSIFFLGS": "syscall", + "syscall.SIOCBRDGSIFPRIO": "syscall", + "syscall.SIOCBRDGSMA": "syscall", + "syscall.SIOCBRDGSPRI": "syscall", + "syscall.SIOCBRDGSPROTO": "syscall", + "syscall.SIOCBRDGSTO": "syscall", + "syscall.SIOCBRDGSTXHC": "syscall", + "syscall.SIOCDARP": "syscall", + "syscall.SIOCDELDLCI": "syscall", + "syscall.SIOCDELMULTI": "syscall", + "syscall.SIOCDELRT": "syscall", + "syscall.SIOCDEVPRIVATE": "syscall", + "syscall.SIOCDIFADDR": "syscall", + "syscall.SIOCDIFGROUP": "syscall", + "syscall.SIOCDIFPHYADDR": "syscall", + "syscall.SIOCDLIFADDR": "syscall", + "syscall.SIOCDRARP": "syscall", + "syscall.SIOCGARP": "syscall", + "syscall.SIOCGDRVSPEC": "syscall", + "syscall.SIOCGETKALIVE": "syscall", + "syscall.SIOCGETLABEL": "syscall", + "syscall.SIOCGETPFLOW": "syscall", + "syscall.SIOCGETPFSYNC": "syscall", + "syscall.SIOCGETSGCNT": "syscall", + "syscall.SIOCGETVIFCNT": "syscall", + "syscall.SIOCGETVLAN": "syscall", + "syscall.SIOCGHIWAT": "syscall", + "syscall.SIOCGIFADDR": "syscall", + "syscall.SIOCGIFADDRPREF": "syscall", + "syscall.SIOCGIFALIAS": "syscall", + "syscall.SIOCGIFALTMTU": "syscall", + "syscall.SIOCGIFASYNCMAP": "syscall", + "syscall.SIOCGIFBOND": "syscall", + "syscall.SIOCGIFBR": "syscall", + "syscall.SIOCGIFBRDADDR": "syscall", + "syscall.SIOCGIFCAP": "syscall", + "syscall.SIOCGIFCONF": "syscall", + "syscall.SIOCGIFCOUNT": "syscall", + "syscall.SIOCGIFDATA": "syscall", + "syscall.SIOCGIFDESCR": "syscall", + "syscall.SIOCGIFDEVMTU": "syscall", + "syscall.SIOCGIFDLT": "syscall", + "syscall.SIOCGIFDSTADDR": "syscall", + "syscall.SIOCGIFENCAP": "syscall", + "syscall.SIOCGIFFIB": "syscall", + "syscall.SIOCGIFFLAGS": "syscall", + "syscall.SIOCGIFGATTR": "syscall", + "syscall.SIOCGIFGENERIC": "syscall", + "syscall.SIOCGIFGMEMB": "syscall", + "syscall.SIOCGIFGROUP": "syscall", + "syscall.SIOCGIFHARDMTU": "syscall", + "syscall.SIOCGIFHWADDR": "syscall", + "syscall.SIOCGIFINDEX": "syscall", + "syscall.SIOCGIFKPI": "syscall", + "syscall.SIOCGIFMAC": "syscall", + "syscall.SIOCGIFMAP": "syscall", + "syscall.SIOCGIFMEDIA": "syscall", + "syscall.SIOCGIFMEM": "syscall", + "syscall.SIOCGIFMETRIC": "syscall", + "syscall.SIOCGIFMTU": "syscall", + "syscall.SIOCGIFNAME": "syscall", + "syscall.SIOCGIFNETMASK": "syscall", + "syscall.SIOCGIFPDSTADDR": "syscall", + "syscall.SIOCGIFPFLAGS": "syscall", + "syscall.SIOCGIFPHYS": "syscall", + "syscall.SIOCGIFPRIORITY": "syscall", + "syscall.SIOCGIFPSRCADDR": "syscall", + "syscall.SIOCGIFRDOMAIN": "syscall", + "syscall.SIOCGIFRTLABEL": "syscall", + "syscall.SIOCGIFSLAVE": "syscall", + "syscall.SIOCGIFSTATUS": "syscall", + "syscall.SIOCGIFTIMESLOT": "syscall", + "syscall.SIOCGIFTXQLEN": "syscall", + "syscall.SIOCGIFVLAN": "syscall", + "syscall.SIOCGIFWAKEFLAGS": "syscall", + "syscall.SIOCGIFXFLAGS": "syscall", + "syscall.SIOCGLIFADDR": "syscall", + "syscall.SIOCGLIFPHYADDR": "syscall", + "syscall.SIOCGLIFPHYRTABLE": "syscall", + "syscall.SIOCGLIFPHYTTL": "syscall", + "syscall.SIOCGLINKSTR": "syscall", + "syscall.SIOCGLOWAT": "syscall", + "syscall.SIOCGPGRP": "syscall", + "syscall.SIOCGPRIVATE_0": "syscall", + "syscall.SIOCGPRIVATE_1": "syscall", + "syscall.SIOCGRARP": "syscall", + "syscall.SIOCGSPPPPARAMS": "syscall", + "syscall.SIOCGSTAMP": "syscall", + "syscall.SIOCGSTAMPNS": "syscall", + "syscall.SIOCGVH": "syscall", + "syscall.SIOCGVNETID": "syscall", + "syscall.SIOCIFCREATE": "syscall", + "syscall.SIOCIFCREATE2": "syscall", + "syscall.SIOCIFDESTROY": "syscall", + "syscall.SIOCIFGCLONERS": "syscall", + "syscall.SIOCINITIFADDR": "syscall", + "syscall.SIOCPROTOPRIVATE": "syscall", + "syscall.SIOCRSLVMULTI": "syscall", + "syscall.SIOCRTMSG": "syscall", + "syscall.SIOCSARP": "syscall", + "syscall.SIOCSDRVSPEC": "syscall", + "syscall.SIOCSETKALIVE": "syscall", + "syscall.SIOCSETLABEL": "syscall", + "syscall.SIOCSETPFLOW": "syscall", + "syscall.SIOCSETPFSYNC": "syscall", + "syscall.SIOCSETVLAN": "syscall", + "syscall.SIOCSHIWAT": "syscall", + "syscall.SIOCSIFADDR": "syscall", + "syscall.SIOCSIFADDRPREF": "syscall", + "syscall.SIOCSIFALTMTU": "syscall", + "syscall.SIOCSIFASYNCMAP": "syscall", + "syscall.SIOCSIFBOND": "syscall", + "syscall.SIOCSIFBR": "syscall", + "syscall.SIOCSIFBRDADDR": "syscall", + "syscall.SIOCSIFCAP": "syscall", + "syscall.SIOCSIFDESCR": "syscall", + "syscall.SIOCSIFDSTADDR": "syscall", + "syscall.SIOCSIFENCAP": "syscall", + "syscall.SIOCSIFFIB": "syscall", + "syscall.SIOCSIFFLAGS": "syscall", + "syscall.SIOCSIFGATTR": "syscall", + "syscall.SIOCSIFGENERIC": "syscall", + "syscall.SIOCSIFHWADDR": "syscall", + "syscall.SIOCSIFHWBROADCAST": "syscall", + "syscall.SIOCSIFKPI": "syscall", + "syscall.SIOCSIFLINK": "syscall", + "syscall.SIOCSIFLLADDR": "syscall", + "syscall.SIOCSIFMAC": "syscall", + "syscall.SIOCSIFMAP": "syscall", + "syscall.SIOCSIFMEDIA": "syscall", + "syscall.SIOCSIFMEM": "syscall", + "syscall.SIOCSIFMETRIC": "syscall", + "syscall.SIOCSIFMTU": "syscall", + "syscall.SIOCSIFNAME": "syscall", + "syscall.SIOCSIFNETMASK": "syscall", + "syscall.SIOCSIFPFLAGS": "syscall", + "syscall.SIOCSIFPHYADDR": "syscall", + "syscall.SIOCSIFPHYS": "syscall", + "syscall.SIOCSIFPRIORITY": "syscall", + "syscall.SIOCSIFRDOMAIN": "syscall", + "syscall.SIOCSIFRTLABEL": "syscall", + "syscall.SIOCSIFRVNET": "syscall", + "syscall.SIOCSIFSLAVE": "syscall", + "syscall.SIOCSIFTIMESLOT": "syscall", + "syscall.SIOCSIFTXQLEN": "syscall", + "syscall.SIOCSIFVLAN": "syscall", + "syscall.SIOCSIFVNET": "syscall", + "syscall.SIOCSIFXFLAGS": "syscall", + "syscall.SIOCSLIFPHYADDR": "syscall", + "syscall.SIOCSLIFPHYRTABLE": "syscall", + "syscall.SIOCSLIFPHYTTL": "syscall", + "syscall.SIOCSLINKSTR": "syscall", + "syscall.SIOCSLOWAT": "syscall", + "syscall.SIOCSPGRP": "syscall", + "syscall.SIOCSRARP": "syscall", + "syscall.SIOCSSPPPPARAMS": "syscall", + "syscall.SIOCSVH": "syscall", + "syscall.SIOCSVNETID": "syscall", + "syscall.SIOCZIFDATA": "syscall", + "syscall.SIO_GET_EXTENSION_FUNCTION_POINTER": "syscall", + "syscall.SIO_GET_INTERFACE_LIST": "syscall", + "syscall.SIO_KEEPALIVE_VALS": "syscall", + "syscall.SIO_UDP_CONNRESET": "syscall", + "syscall.SOCK_CLOEXEC": "syscall", + "syscall.SOCK_DCCP": "syscall", + "syscall.SOCK_DGRAM": "syscall", + "syscall.SOCK_FLAGS_MASK": "syscall", + "syscall.SOCK_MAXADDRLEN": "syscall", + "syscall.SOCK_NONBLOCK": "syscall", + "syscall.SOCK_NOSIGPIPE": "syscall", + "syscall.SOCK_PACKET": "syscall", + "syscall.SOCK_RAW": "syscall", + "syscall.SOCK_RDM": "syscall", + "syscall.SOCK_SEQPACKET": "syscall", + "syscall.SOCK_STREAM": "syscall", + "syscall.SOL_AAL": "syscall", + "syscall.SOL_ATM": "syscall", + "syscall.SOL_DECNET": "syscall", + "syscall.SOL_ICMPV6": "syscall", + "syscall.SOL_IP": "syscall", + "syscall.SOL_IPV6": "syscall", + "syscall.SOL_IRDA": "syscall", + "syscall.SOL_PACKET": "syscall", + "syscall.SOL_RAW": "syscall", + "syscall.SOL_SOCKET": "syscall", + "syscall.SOL_TCP": "syscall", + "syscall.SOL_X25": "syscall", + "syscall.SOMAXCONN": "syscall", + "syscall.SO_ACCEPTCONN": "syscall", + "syscall.SO_ACCEPTFILTER": "syscall", + "syscall.SO_ATTACH_FILTER": "syscall", + "syscall.SO_BINDANY": "syscall", + "syscall.SO_BINDTODEVICE": "syscall", + "syscall.SO_BINTIME": "syscall", + "syscall.SO_BROADCAST": "syscall", + "syscall.SO_BSDCOMPAT": "syscall", + "syscall.SO_DEBUG": "syscall", + "syscall.SO_DETACH_FILTER": "syscall", + "syscall.SO_DOMAIN": "syscall", + "syscall.SO_DONTROUTE": "syscall", + "syscall.SO_DONTTRUNC": "syscall", + "syscall.SO_ERROR": "syscall", + "syscall.SO_KEEPALIVE": "syscall", + "syscall.SO_LABEL": "syscall", + "syscall.SO_LINGER": "syscall", + "syscall.SO_LINGER_SEC": "syscall", + "syscall.SO_LISTENINCQLEN": "syscall", + "syscall.SO_LISTENQLEN": "syscall", + "syscall.SO_LISTENQLIMIT": "syscall", + "syscall.SO_MARK": "syscall", + "syscall.SO_NETPROC": "syscall", + "syscall.SO_NKE": "syscall", + "syscall.SO_NOADDRERR": "syscall", + "syscall.SO_NOHEADER": "syscall", + "syscall.SO_NOSIGPIPE": "syscall", + "syscall.SO_NOTIFYCONFLICT": "syscall", + "syscall.SO_NO_CHECK": "syscall", + "syscall.SO_NO_DDP": "syscall", + "syscall.SO_NO_OFFLOAD": "syscall", + "syscall.SO_NP_EXTENSIONS": "syscall", + "syscall.SO_NREAD": "syscall", + "syscall.SO_NWRITE": "syscall", + "syscall.SO_OOBINLINE": "syscall", + "syscall.SO_OVERFLOWED": "syscall", + "syscall.SO_PASSCRED": "syscall", + "syscall.SO_PASSSEC": "syscall", + "syscall.SO_PEERCRED": "syscall", + "syscall.SO_PEERLABEL": "syscall", + "syscall.SO_PEERNAME": "syscall", + "syscall.SO_PEERSEC": "syscall", + "syscall.SO_PRIORITY": "syscall", + "syscall.SO_PROTOCOL": "syscall", + "syscall.SO_PROTOTYPE": "syscall", + "syscall.SO_RANDOMPORT": "syscall", + "syscall.SO_RCVBUF": "syscall", + "syscall.SO_RCVBUFFORCE": "syscall", + "syscall.SO_RCVLOWAT": "syscall", + "syscall.SO_RCVTIMEO": "syscall", + "syscall.SO_RESTRICTIONS": "syscall", + "syscall.SO_RESTRICT_DENYIN": "syscall", + "syscall.SO_RESTRICT_DENYOUT": "syscall", + "syscall.SO_RESTRICT_DENYSET": "syscall", + "syscall.SO_REUSEADDR": "syscall", + "syscall.SO_REUSEPORT": "syscall", + "syscall.SO_REUSESHAREUID": "syscall", + "syscall.SO_RTABLE": "syscall", + "syscall.SO_RXQ_OVFL": "syscall", + "syscall.SO_SECURITY_AUTHENTICATION": "syscall", + "syscall.SO_SECURITY_ENCRYPTION_NETWORK": "syscall", + "syscall.SO_SECURITY_ENCRYPTION_TRANSPORT": "syscall", + "syscall.SO_SETFIB": "syscall", + "syscall.SO_SNDBUF": "syscall", + "syscall.SO_SNDBUFFORCE": "syscall", + "syscall.SO_SNDLOWAT": "syscall", + "syscall.SO_SNDTIMEO": "syscall", + "syscall.SO_SPLICE": "syscall", + "syscall.SO_TIMESTAMP": "syscall", + "syscall.SO_TIMESTAMPING": "syscall", + "syscall.SO_TIMESTAMPNS": "syscall", + "syscall.SO_TIMESTAMP_MONOTONIC": "syscall", + "syscall.SO_TYPE": "syscall", + "syscall.SO_UPCALLCLOSEWAIT": "syscall", + "syscall.SO_UPDATE_ACCEPT_CONTEXT": "syscall", + "syscall.SO_UPDATE_CONNECT_CONTEXT": "syscall", + "syscall.SO_USELOOPBACK": "syscall", + "syscall.SO_USER_COOKIE": "syscall", + "syscall.SO_VENDOR": "syscall", + "syscall.SO_WANTMORE": "syscall", + "syscall.SO_WANTOOBFLAG": "syscall", + "syscall.SSLExtraCertChainPolicyPara": "syscall", + "syscall.STANDARD_RIGHTS_ALL": "syscall", + "syscall.STANDARD_RIGHTS_EXECUTE": "syscall", + "syscall.STANDARD_RIGHTS_READ": "syscall", + "syscall.STANDARD_RIGHTS_REQUIRED": "syscall", + "syscall.STANDARD_RIGHTS_WRITE": "syscall", + "syscall.STARTF_USESHOWWINDOW": "syscall", + "syscall.STARTF_USESTDHANDLES": "syscall", + "syscall.STD_ERROR_HANDLE": "syscall", + "syscall.STD_INPUT_HANDLE": "syscall", + "syscall.STD_OUTPUT_HANDLE": "syscall", + "syscall.SUBLANG_ENGLISH_US": "syscall", + "syscall.SW_FORCEMINIMIZE": "syscall", + "syscall.SW_HIDE": "syscall", + "syscall.SW_MAXIMIZE": "syscall", + "syscall.SW_MINIMIZE": "syscall", + "syscall.SW_NORMAL": "syscall", + "syscall.SW_RESTORE": "syscall", + "syscall.SW_SHOW": "syscall", + "syscall.SW_SHOWDEFAULT": "syscall", + "syscall.SW_SHOWMAXIMIZED": "syscall", + "syscall.SW_SHOWMINIMIZED": "syscall", + "syscall.SW_SHOWMINNOACTIVE": "syscall", + "syscall.SW_SHOWNA": "syscall", + "syscall.SW_SHOWNOACTIVATE": "syscall", + "syscall.SW_SHOWNORMAL": "syscall", + "syscall.SYMBOLIC_LINK_FLAG_DIRECTORY": "syscall", + "syscall.SYNCHRONIZE": "syscall", + "syscall.SYSCTL_VERSION": "syscall", + "syscall.SYSCTL_VERS_0": "syscall", + "syscall.SYSCTL_VERS_1": "syscall", + "syscall.SYSCTL_VERS_MASK": "syscall", + "syscall.SYS_ABORT2": "syscall", + "syscall.SYS_ACCEPT": "syscall", + "syscall.SYS_ACCEPT4": "syscall", + "syscall.SYS_ACCEPT_NOCANCEL": "syscall", + "syscall.SYS_ACCESS": "syscall", + "syscall.SYS_ACCESS_EXTENDED": "syscall", + "syscall.SYS_ACCT": "syscall", + "syscall.SYS_ADD_KEY": "syscall", + "syscall.SYS_ADD_PROFIL": "syscall", + "syscall.SYS_ADJFREQ": "syscall", + "syscall.SYS_ADJTIME": "syscall", + "syscall.SYS_ADJTIMEX": "syscall", + "syscall.SYS_AFS_SYSCALL": "syscall", + "syscall.SYS_AIO_CANCEL": "syscall", + "syscall.SYS_AIO_ERROR": "syscall", + "syscall.SYS_AIO_FSYNC": "syscall", + "syscall.SYS_AIO_READ": "syscall", + "syscall.SYS_AIO_RETURN": "syscall", + "syscall.SYS_AIO_SUSPEND": "syscall", + "syscall.SYS_AIO_SUSPEND_NOCANCEL": "syscall", + "syscall.SYS_AIO_WRITE": "syscall", + "syscall.SYS_ALARM": "syscall", + "syscall.SYS_ARCH_PRCTL": "syscall", + "syscall.SYS_ARM_FADVISE64_64": "syscall", + "syscall.SYS_ARM_SYNC_FILE_RANGE": "syscall", + "syscall.SYS_ATGETMSG": "syscall", + "syscall.SYS_ATPGETREQ": "syscall", + "syscall.SYS_ATPGETRSP": "syscall", + "syscall.SYS_ATPSNDREQ": "syscall", + "syscall.SYS_ATPSNDRSP": "syscall", + "syscall.SYS_ATPUTMSG": "syscall", + "syscall.SYS_ATSOCKET": "syscall", + "syscall.SYS_AUDIT": "syscall", + "syscall.SYS_AUDITCTL": "syscall", + "syscall.SYS_AUDITON": "syscall", + "syscall.SYS_AUDIT_SESSION_JOIN": "syscall", + "syscall.SYS_AUDIT_SESSION_PORT": "syscall", + "syscall.SYS_AUDIT_SESSION_SELF": "syscall", + "syscall.SYS_BDFLUSH": "syscall", + "syscall.SYS_BIND": "syscall", + "syscall.SYS_BINDAT": "syscall", + "syscall.SYS_BREAK": "syscall", + "syscall.SYS_BRK": "syscall", + "syscall.SYS_BSDTHREAD_CREATE": "syscall", + "syscall.SYS_BSDTHREAD_REGISTER": "syscall", + "syscall.SYS_BSDTHREAD_TERMINATE": "syscall", + "syscall.SYS_CAPGET": "syscall", + "syscall.SYS_CAPSET": "syscall", + "syscall.SYS_CAP_ENTER": "syscall", + "syscall.SYS_CAP_FCNTLS_GET": "syscall", + "syscall.SYS_CAP_FCNTLS_LIMIT": "syscall", + "syscall.SYS_CAP_GETMODE": "syscall", + "syscall.SYS_CAP_GETRIGHTS": "syscall", + "syscall.SYS_CAP_IOCTLS_GET": "syscall", + "syscall.SYS_CAP_IOCTLS_LIMIT": "syscall", + "syscall.SYS_CAP_NEW": "syscall", + "syscall.SYS_CAP_RIGHTS_GET": "syscall", + "syscall.SYS_CAP_RIGHTS_LIMIT": "syscall", + "syscall.SYS_CHDIR": "syscall", + "syscall.SYS_CHFLAGS": "syscall", + "syscall.SYS_CHFLAGSAT": "syscall", + "syscall.SYS_CHMOD": "syscall", + "syscall.SYS_CHMOD_EXTENDED": "syscall", + "syscall.SYS_CHOWN": "syscall", + "syscall.SYS_CHOWN32": "syscall", + "syscall.SYS_CHROOT": "syscall", + "syscall.SYS_CHUD": "syscall", + "syscall.SYS_CLOCK_ADJTIME": "syscall", + "syscall.SYS_CLOCK_GETCPUCLOCKID2": "syscall", + "syscall.SYS_CLOCK_GETRES": "syscall", + "syscall.SYS_CLOCK_GETTIME": "syscall", + "syscall.SYS_CLOCK_NANOSLEEP": "syscall", + "syscall.SYS_CLOCK_SETTIME": "syscall", + "syscall.SYS_CLONE": "syscall", + "syscall.SYS_CLOSE": "syscall", + "syscall.SYS_CLOSEFROM": "syscall", + "syscall.SYS_CLOSE_NOCANCEL": "syscall", + "syscall.SYS_CONNECT": "syscall", + "syscall.SYS_CONNECTAT": "syscall", + "syscall.SYS_CONNECT_NOCANCEL": "syscall", + "syscall.SYS_COPYFILE": "syscall", + "syscall.SYS_CPUSET": "syscall", + "syscall.SYS_CPUSET_GETAFFINITY": "syscall", + "syscall.SYS_CPUSET_GETID": "syscall", + "syscall.SYS_CPUSET_SETAFFINITY": "syscall", + "syscall.SYS_CPUSET_SETID": "syscall", + "syscall.SYS_CREAT": "syscall", + "syscall.SYS_CREATE_MODULE": "syscall", + "syscall.SYS_CSOPS": "syscall", + "syscall.SYS_DELETE": "syscall", + "syscall.SYS_DELETE_MODULE": "syscall", + "syscall.SYS_DUP": "syscall", + "syscall.SYS_DUP2": "syscall", + "syscall.SYS_DUP3": "syscall", + "syscall.SYS_EACCESS": "syscall", + "syscall.SYS_EPOLL_CREATE": "syscall", + "syscall.SYS_EPOLL_CREATE1": "syscall", + "syscall.SYS_EPOLL_CTL": "syscall", + "syscall.SYS_EPOLL_CTL_OLD": "syscall", + "syscall.SYS_EPOLL_PWAIT": "syscall", + "syscall.SYS_EPOLL_WAIT": "syscall", + "syscall.SYS_EPOLL_WAIT_OLD": "syscall", + "syscall.SYS_EVENTFD": "syscall", + "syscall.SYS_EVENTFD2": "syscall", + "syscall.SYS_EXCHANGEDATA": "syscall", + "syscall.SYS_EXECVE": "syscall", + "syscall.SYS_EXIT": "syscall", + "syscall.SYS_EXIT_GROUP": "syscall", + "syscall.SYS_EXTATTRCTL": "syscall", + "syscall.SYS_EXTATTR_DELETE_FD": "syscall", + "syscall.SYS_EXTATTR_DELETE_FILE": "syscall", + "syscall.SYS_EXTATTR_DELETE_LINK": "syscall", + "syscall.SYS_EXTATTR_GET_FD": "syscall", + "syscall.SYS_EXTATTR_GET_FILE": "syscall", + "syscall.SYS_EXTATTR_GET_LINK": "syscall", + "syscall.SYS_EXTATTR_LIST_FD": "syscall", + "syscall.SYS_EXTATTR_LIST_FILE": "syscall", + "syscall.SYS_EXTATTR_LIST_LINK": "syscall", + "syscall.SYS_EXTATTR_SET_FD": "syscall", + "syscall.SYS_EXTATTR_SET_FILE": "syscall", + "syscall.SYS_EXTATTR_SET_LINK": "syscall", + "syscall.SYS_FACCESSAT": "syscall", + "syscall.SYS_FADVISE64": "syscall", + "syscall.SYS_FADVISE64_64": "syscall", + "syscall.SYS_FALLOCATE": "syscall", + "syscall.SYS_FANOTIFY_INIT": "syscall", + "syscall.SYS_FANOTIFY_MARK": "syscall", + "syscall.SYS_FCHDIR": "syscall", + "syscall.SYS_FCHFLAGS": "syscall", + "syscall.SYS_FCHMOD": "syscall", + "syscall.SYS_FCHMODAT": "syscall", + "syscall.SYS_FCHMOD_EXTENDED": "syscall", + "syscall.SYS_FCHOWN": "syscall", + "syscall.SYS_FCHOWN32": "syscall", + "syscall.SYS_FCHOWNAT": "syscall", + "syscall.SYS_FCHROOT": "syscall", + "syscall.SYS_FCNTL": "syscall", + "syscall.SYS_FCNTL64": "syscall", + "syscall.SYS_FCNTL_NOCANCEL": "syscall", + "syscall.SYS_FDATASYNC": "syscall", + "syscall.SYS_FEXECVE": "syscall", + "syscall.SYS_FFCLOCK_GETCOUNTER": "syscall", + "syscall.SYS_FFCLOCK_GETESTIMATE": "syscall", + "syscall.SYS_FFCLOCK_SETESTIMATE": "syscall", + "syscall.SYS_FFSCTL": "syscall", + "syscall.SYS_FGETATTRLIST": "syscall", + "syscall.SYS_FGETXATTR": "syscall", + "syscall.SYS_FHOPEN": "syscall", + "syscall.SYS_FHSTAT": "syscall", + "syscall.SYS_FHSTATFS": "syscall", + "syscall.SYS_FILEPORT_MAKEFD": "syscall", + "syscall.SYS_FILEPORT_MAKEPORT": "syscall", + "syscall.SYS_FKTRACE": "syscall", + "syscall.SYS_FLISTXATTR": "syscall", + "syscall.SYS_FLOCK": "syscall", + "syscall.SYS_FORK": "syscall", + "syscall.SYS_FPATHCONF": "syscall", + "syscall.SYS_FREEBSD6_FTRUNCATE": "syscall", + "syscall.SYS_FREEBSD6_LSEEK": "syscall", + "syscall.SYS_FREEBSD6_MMAP": "syscall", + "syscall.SYS_FREEBSD6_PREAD": "syscall", + "syscall.SYS_FREEBSD6_PWRITE": "syscall", + "syscall.SYS_FREEBSD6_TRUNCATE": "syscall", + "syscall.SYS_FREMOVEXATTR": "syscall", + "syscall.SYS_FSCTL": "syscall", + "syscall.SYS_FSETATTRLIST": "syscall", + "syscall.SYS_FSETXATTR": "syscall", + "syscall.SYS_FSGETPATH": "syscall", + "syscall.SYS_FSTAT": "syscall", + "syscall.SYS_FSTAT64": "syscall", + "syscall.SYS_FSTAT64_EXTENDED": "syscall", + "syscall.SYS_FSTATAT": "syscall", + "syscall.SYS_FSTATAT64": "syscall", + "syscall.SYS_FSTATFS": "syscall", + "syscall.SYS_FSTATFS64": "syscall", + "syscall.SYS_FSTATV": "syscall", + "syscall.SYS_FSTATVFS1": "syscall", + "syscall.SYS_FSTAT_EXTENDED": "syscall", + "syscall.SYS_FSYNC": "syscall", + "syscall.SYS_FSYNC_NOCANCEL": "syscall", + "syscall.SYS_FSYNC_RANGE": "syscall", + "syscall.SYS_FTIME": "syscall", + "syscall.SYS_FTRUNCATE": "syscall", + "syscall.SYS_FTRUNCATE64": "syscall", + "syscall.SYS_FUTEX": "syscall", + "syscall.SYS_FUTIMENS": "syscall", + "syscall.SYS_FUTIMES": "syscall", + "syscall.SYS_FUTIMESAT": "syscall", + "syscall.SYS_GETATTRLIST": "syscall", + "syscall.SYS_GETAUDIT": "syscall", + "syscall.SYS_GETAUDIT_ADDR": "syscall", + "syscall.SYS_GETAUID": "syscall", + "syscall.SYS_GETCONTEXT": "syscall", + "syscall.SYS_GETCPU": "syscall", + "syscall.SYS_GETCWD": "syscall", + "syscall.SYS_GETDENTS": "syscall", + "syscall.SYS_GETDENTS64": "syscall", + "syscall.SYS_GETDIRENTRIES": "syscall", + "syscall.SYS_GETDIRENTRIES64": "syscall", + "syscall.SYS_GETDIRENTRIESATTR": "syscall", + "syscall.SYS_GETDTABLECOUNT": "syscall", + "syscall.SYS_GETDTABLESIZE": "syscall", + "syscall.SYS_GETEGID": "syscall", + "syscall.SYS_GETEGID32": "syscall", + "syscall.SYS_GETEUID": "syscall", + "syscall.SYS_GETEUID32": "syscall", + "syscall.SYS_GETFH": "syscall", + "syscall.SYS_GETFSSTAT": "syscall", + "syscall.SYS_GETFSSTAT64": "syscall", + "syscall.SYS_GETGID": "syscall", + "syscall.SYS_GETGID32": "syscall", + "syscall.SYS_GETGROUPS": "syscall", + "syscall.SYS_GETGROUPS32": "syscall", + "syscall.SYS_GETHOSTUUID": "syscall", + "syscall.SYS_GETITIMER": "syscall", + "syscall.SYS_GETLCID": "syscall", + "syscall.SYS_GETLOGIN": "syscall", + "syscall.SYS_GETLOGINCLASS": "syscall", + "syscall.SYS_GETPEERNAME": "syscall", + "syscall.SYS_GETPGID": "syscall", + "syscall.SYS_GETPGRP": "syscall", + "syscall.SYS_GETPID": "syscall", + "syscall.SYS_GETPMSG": "syscall", + "syscall.SYS_GETPPID": "syscall", + "syscall.SYS_GETPRIORITY": "syscall", + "syscall.SYS_GETRESGID": "syscall", + "syscall.SYS_GETRESGID32": "syscall", + "syscall.SYS_GETRESUID": "syscall", + "syscall.SYS_GETRESUID32": "syscall", + "syscall.SYS_GETRLIMIT": "syscall", + "syscall.SYS_GETRTABLE": "syscall", + "syscall.SYS_GETRUSAGE": "syscall", + "syscall.SYS_GETSGROUPS": "syscall", + "syscall.SYS_GETSID": "syscall", + "syscall.SYS_GETSOCKNAME": "syscall", + "syscall.SYS_GETSOCKOPT": "syscall", + "syscall.SYS_GETTHRID": "syscall", + "syscall.SYS_GETTID": "syscall", + "syscall.SYS_GETTIMEOFDAY": "syscall", + "syscall.SYS_GETUID": "syscall", + "syscall.SYS_GETUID32": "syscall", + "syscall.SYS_GETVFSSTAT": "syscall", + "syscall.SYS_GETWGROUPS": "syscall", + "syscall.SYS_GETXATTR": "syscall", + "syscall.SYS_GET_KERNEL_SYMS": "syscall", + "syscall.SYS_GET_MEMPOLICY": "syscall", + "syscall.SYS_GET_ROBUST_LIST": "syscall", + "syscall.SYS_GET_THREAD_AREA": "syscall", + "syscall.SYS_GTTY": "syscall", + "syscall.SYS_IDENTITYSVC": "syscall", + "syscall.SYS_IDLE": "syscall", + "syscall.SYS_INITGROUPS": "syscall", + "syscall.SYS_INIT_MODULE": "syscall", + "syscall.SYS_INOTIFY_ADD_WATCH": "syscall", + "syscall.SYS_INOTIFY_INIT": "syscall", + "syscall.SYS_INOTIFY_INIT1": "syscall", + "syscall.SYS_INOTIFY_RM_WATCH": "syscall", + "syscall.SYS_IOCTL": "syscall", + "syscall.SYS_IOPERM": "syscall", + "syscall.SYS_IOPL": "syscall", + "syscall.SYS_IOPOLICYSYS": "syscall", + "syscall.SYS_IOPRIO_GET": "syscall", + "syscall.SYS_IOPRIO_SET": "syscall", + "syscall.SYS_IO_CANCEL": "syscall", + "syscall.SYS_IO_DESTROY": "syscall", + "syscall.SYS_IO_GETEVENTS": "syscall", + "syscall.SYS_IO_SETUP": "syscall", + "syscall.SYS_IO_SUBMIT": "syscall", + "syscall.SYS_IPC": "syscall", + "syscall.SYS_ISSETUGID": "syscall", + "syscall.SYS_JAIL": "syscall", + "syscall.SYS_JAIL_ATTACH": "syscall", + "syscall.SYS_JAIL_GET": "syscall", + "syscall.SYS_JAIL_REMOVE": "syscall", + "syscall.SYS_JAIL_SET": "syscall", + "syscall.SYS_KDEBUG_TRACE": "syscall", + "syscall.SYS_KENV": "syscall", + "syscall.SYS_KEVENT": "syscall", + "syscall.SYS_KEVENT64": "syscall", + "syscall.SYS_KEXEC_LOAD": "syscall", + "syscall.SYS_KEYCTL": "syscall", + "syscall.SYS_KILL": "syscall", + "syscall.SYS_KLDFIND": "syscall", + "syscall.SYS_KLDFIRSTMOD": "syscall", + "syscall.SYS_KLDLOAD": "syscall", + "syscall.SYS_KLDNEXT": "syscall", + "syscall.SYS_KLDSTAT": "syscall", + "syscall.SYS_KLDSYM": "syscall", + "syscall.SYS_KLDUNLOAD": "syscall", + "syscall.SYS_KLDUNLOADF": "syscall", + "syscall.SYS_KQUEUE": "syscall", + "syscall.SYS_KQUEUE1": "syscall", + "syscall.SYS_KTIMER_CREATE": "syscall", + "syscall.SYS_KTIMER_DELETE": "syscall", + "syscall.SYS_KTIMER_GETOVERRUN": "syscall", + "syscall.SYS_KTIMER_GETTIME": "syscall", + "syscall.SYS_KTIMER_SETTIME": "syscall", + "syscall.SYS_KTRACE": "syscall", + "syscall.SYS_LCHFLAGS": "syscall", + "syscall.SYS_LCHMOD": "syscall", + "syscall.SYS_LCHOWN": "syscall", + "syscall.SYS_LCHOWN32": "syscall", + "syscall.SYS_LGETFH": "syscall", + "syscall.SYS_LGETXATTR": "syscall", + "syscall.SYS_LINK": "syscall", + "syscall.SYS_LINKAT": "syscall", + "syscall.SYS_LIO_LISTIO": "syscall", + "syscall.SYS_LISTEN": "syscall", + "syscall.SYS_LISTXATTR": "syscall", + "syscall.SYS_LLISTXATTR": "syscall", + "syscall.SYS_LOCK": "syscall", + "syscall.SYS_LOOKUP_DCOOKIE": "syscall", + "syscall.SYS_LPATHCONF": "syscall", + "syscall.SYS_LREMOVEXATTR": "syscall", + "syscall.SYS_LSEEK": "syscall", + "syscall.SYS_LSETXATTR": "syscall", + "syscall.SYS_LSTAT": "syscall", + "syscall.SYS_LSTAT64": "syscall", + "syscall.SYS_LSTAT64_EXTENDED": "syscall", + "syscall.SYS_LSTATV": "syscall", + "syscall.SYS_LSTAT_EXTENDED": "syscall", + "syscall.SYS_LUTIMES": "syscall", + "syscall.SYS_MAC_SYSCALL": "syscall", + "syscall.SYS_MADVISE": "syscall", + "syscall.SYS_MADVISE1": "syscall", + "syscall.SYS_MAXSYSCALL": "syscall", + "syscall.SYS_MBIND": "syscall", + "syscall.SYS_MIGRATE_PAGES": "syscall", + "syscall.SYS_MINCORE": "syscall", + "syscall.SYS_MINHERIT": "syscall", + "syscall.SYS_MKCOMPLEX": "syscall", + "syscall.SYS_MKDIR": "syscall", + "syscall.SYS_MKDIRAT": "syscall", + "syscall.SYS_MKDIR_EXTENDED": "syscall", + "syscall.SYS_MKFIFO": "syscall", + "syscall.SYS_MKFIFOAT": "syscall", + "syscall.SYS_MKFIFO_EXTENDED": "syscall", + "syscall.SYS_MKNOD": "syscall", + "syscall.SYS_MKNODAT": "syscall", + "syscall.SYS_MLOCK": "syscall", + "syscall.SYS_MLOCKALL": "syscall", + "syscall.SYS_MMAP": "syscall", + "syscall.SYS_MMAP2": "syscall", + "syscall.SYS_MODCTL": "syscall", + "syscall.SYS_MODFIND": "syscall", + "syscall.SYS_MODFNEXT": "syscall", + "syscall.SYS_MODIFY_LDT": "syscall", + "syscall.SYS_MODNEXT": "syscall", + "syscall.SYS_MODSTAT": "syscall", + "syscall.SYS_MODWATCH": "syscall", + "syscall.SYS_MOUNT": "syscall", + "syscall.SYS_MOVE_PAGES": "syscall", + "syscall.SYS_MPROTECT": "syscall", + "syscall.SYS_MPX": "syscall", + "syscall.SYS_MQUERY": "syscall", + "syscall.SYS_MQ_GETSETATTR": "syscall", + "syscall.SYS_MQ_NOTIFY": "syscall", + "syscall.SYS_MQ_OPEN": "syscall", + "syscall.SYS_MQ_TIMEDRECEIVE": "syscall", + "syscall.SYS_MQ_TIMEDSEND": "syscall", + "syscall.SYS_MQ_UNLINK": "syscall", + "syscall.SYS_MREMAP": "syscall", + "syscall.SYS_MSGCTL": "syscall", + "syscall.SYS_MSGGET": "syscall", + "syscall.SYS_MSGRCV": "syscall", + "syscall.SYS_MSGRCV_NOCANCEL": "syscall", + "syscall.SYS_MSGSND": "syscall", + "syscall.SYS_MSGSND_NOCANCEL": "syscall", + "syscall.SYS_MSGSYS": "syscall", + "syscall.SYS_MSYNC": "syscall", + "syscall.SYS_MSYNC_NOCANCEL": "syscall", + "syscall.SYS_MUNLOCK": "syscall", + "syscall.SYS_MUNLOCKALL": "syscall", + "syscall.SYS_MUNMAP": "syscall", + "syscall.SYS_NAME_TO_HANDLE_AT": "syscall", + "syscall.SYS_NANOSLEEP": "syscall", + "syscall.SYS_NEWFSTATAT": "syscall", + "syscall.SYS_NFSCLNT": "syscall", + "syscall.SYS_NFSSERVCTL": "syscall", + "syscall.SYS_NFSSVC": "syscall", + "syscall.SYS_NFSTAT": "syscall", + "syscall.SYS_NICE": "syscall", + "syscall.SYS_NLSTAT": "syscall", + "syscall.SYS_NMOUNT": "syscall", + "syscall.SYS_NSTAT": "syscall", + "syscall.SYS_NTP_ADJTIME": "syscall", + "syscall.SYS_NTP_GETTIME": "syscall", + "syscall.SYS_OABI_SYSCALL_BASE": "syscall", + "syscall.SYS_OBREAK": "syscall", + "syscall.SYS_OLDFSTAT": "syscall", + "syscall.SYS_OLDLSTAT": "syscall", + "syscall.SYS_OLDOLDUNAME": "syscall", + "syscall.SYS_OLDSTAT": "syscall", + "syscall.SYS_OLDUNAME": "syscall", + "syscall.SYS_OPEN": "syscall", + "syscall.SYS_OPENAT": "syscall", + "syscall.SYS_OPENBSD_POLL": "syscall", + "syscall.SYS_OPEN_BY_HANDLE_AT": "syscall", + "syscall.SYS_OPEN_EXTENDED": "syscall", + "syscall.SYS_OPEN_NOCANCEL": "syscall", + "syscall.SYS_OVADVISE": "syscall", + "syscall.SYS_PACCEPT": "syscall", + "syscall.SYS_PATHCONF": "syscall", + "syscall.SYS_PAUSE": "syscall", + "syscall.SYS_PCICONFIG_IOBASE": "syscall", + "syscall.SYS_PCICONFIG_READ": "syscall", + "syscall.SYS_PCICONFIG_WRITE": "syscall", + "syscall.SYS_PDFORK": "syscall", + "syscall.SYS_PDGETPID": "syscall", + "syscall.SYS_PDKILL": "syscall", + "syscall.SYS_PERF_EVENT_OPEN": "syscall", + "syscall.SYS_PERSONALITY": "syscall", + "syscall.SYS_PID_HIBERNATE": "syscall", + "syscall.SYS_PID_RESUME": "syscall", + "syscall.SYS_PID_SHUTDOWN_SOCKETS": "syscall", + "syscall.SYS_PID_SUSPEND": "syscall", + "syscall.SYS_PIPE": "syscall", + "syscall.SYS_PIPE2": "syscall", + "syscall.SYS_PIVOT_ROOT": "syscall", + "syscall.SYS_PMC_CONTROL": "syscall", + "syscall.SYS_PMC_GET_INFO": "syscall", + "syscall.SYS_POLL": "syscall", + "syscall.SYS_POLLTS": "syscall", + "syscall.SYS_POLL_NOCANCEL": "syscall", + "syscall.SYS_POSIX_FADVISE": "syscall", + "syscall.SYS_POSIX_FALLOCATE": "syscall", + "syscall.SYS_POSIX_OPENPT": "syscall", + "syscall.SYS_POSIX_SPAWN": "syscall", + "syscall.SYS_PPOLL": "syscall", + "syscall.SYS_PRCTL": "syscall", + "syscall.SYS_PREAD": "syscall", + "syscall.SYS_PREAD64": "syscall", + "syscall.SYS_PREADV": "syscall", + "syscall.SYS_PREAD_NOCANCEL": "syscall", + "syscall.SYS_PRLIMIT64": "syscall", + "syscall.SYS_PROCCTL": "syscall", + "syscall.SYS_PROCESS_POLICY": "syscall", + "syscall.SYS_PROCESS_VM_READV": "syscall", + "syscall.SYS_PROCESS_VM_WRITEV": "syscall", + "syscall.SYS_PROC_INFO": "syscall", + "syscall.SYS_PROF": "syscall", + "syscall.SYS_PROFIL": "syscall", + "syscall.SYS_PSELECT": "syscall", + "syscall.SYS_PSELECT6": "syscall", + "syscall.SYS_PSET_ASSIGN": "syscall", + "syscall.SYS_PSET_CREATE": "syscall", + "syscall.SYS_PSET_DESTROY": "syscall", + "syscall.SYS_PSYNCH_CVBROAD": "syscall", + "syscall.SYS_PSYNCH_CVCLRPREPOST": "syscall", + "syscall.SYS_PSYNCH_CVSIGNAL": "syscall", + "syscall.SYS_PSYNCH_CVWAIT": "syscall", + "syscall.SYS_PSYNCH_MUTEXDROP": "syscall", + "syscall.SYS_PSYNCH_MUTEXWAIT": "syscall", + "syscall.SYS_PSYNCH_RW_DOWNGRADE": "syscall", + "syscall.SYS_PSYNCH_RW_LONGRDLOCK": "syscall", + "syscall.SYS_PSYNCH_RW_RDLOCK": "syscall", + "syscall.SYS_PSYNCH_RW_UNLOCK": "syscall", + "syscall.SYS_PSYNCH_RW_UNLOCK2": "syscall", + "syscall.SYS_PSYNCH_RW_UPGRADE": "syscall", + "syscall.SYS_PSYNCH_RW_WRLOCK": "syscall", + "syscall.SYS_PSYNCH_RW_YIELDWRLOCK": "syscall", + "syscall.SYS_PTRACE": "syscall", + "syscall.SYS_PUTPMSG": "syscall", + "syscall.SYS_PWRITE": "syscall", + "syscall.SYS_PWRITE64": "syscall", + "syscall.SYS_PWRITEV": "syscall", + "syscall.SYS_PWRITE_NOCANCEL": "syscall", + "syscall.SYS_QUERY_MODULE": "syscall", + "syscall.SYS_QUOTACTL": "syscall", + "syscall.SYS_RASCTL": "syscall", + "syscall.SYS_RCTL_ADD_RULE": "syscall", + "syscall.SYS_RCTL_GET_LIMITS": "syscall", + "syscall.SYS_RCTL_GET_RACCT": "syscall", + "syscall.SYS_RCTL_GET_RULES": "syscall", + "syscall.SYS_RCTL_REMOVE_RULE": "syscall", + "syscall.SYS_READ": "syscall", + "syscall.SYS_READAHEAD": "syscall", + "syscall.SYS_READDIR": "syscall", + "syscall.SYS_READLINK": "syscall", + "syscall.SYS_READLINKAT": "syscall", + "syscall.SYS_READV": "syscall", + "syscall.SYS_READV_NOCANCEL": "syscall", + "syscall.SYS_READ_NOCANCEL": "syscall", + "syscall.SYS_REBOOT": "syscall", + "syscall.SYS_RECV": "syscall", + "syscall.SYS_RECVFROM": "syscall", + "syscall.SYS_RECVFROM_NOCANCEL": "syscall", + "syscall.SYS_RECVMMSG": "syscall", + "syscall.SYS_RECVMSG": "syscall", + "syscall.SYS_RECVMSG_NOCANCEL": "syscall", + "syscall.SYS_REMAP_FILE_PAGES": "syscall", + "syscall.SYS_REMOVEXATTR": "syscall", + "syscall.SYS_RENAME": "syscall", + "syscall.SYS_RENAMEAT": "syscall", + "syscall.SYS_REQUEST_KEY": "syscall", + "syscall.SYS_RESTART_SYSCALL": "syscall", + "syscall.SYS_REVOKE": "syscall", + "syscall.SYS_RFORK": "syscall", + "syscall.SYS_RMDIR": "syscall", + "syscall.SYS_RTPRIO": "syscall", + "syscall.SYS_RTPRIO_THREAD": "syscall", + "syscall.SYS_RT_SIGACTION": "syscall", + "syscall.SYS_RT_SIGPENDING": "syscall", + "syscall.SYS_RT_SIGPROCMASK": "syscall", + "syscall.SYS_RT_SIGQUEUEINFO": "syscall", + "syscall.SYS_RT_SIGRETURN": "syscall", + "syscall.SYS_RT_SIGSUSPEND": "syscall", + "syscall.SYS_RT_SIGTIMEDWAIT": "syscall", + "syscall.SYS_RT_TGSIGQUEUEINFO": "syscall", + "syscall.SYS_SBRK": "syscall", + "syscall.SYS_SCHED_GETAFFINITY": "syscall", + "syscall.SYS_SCHED_GETPARAM": "syscall", + "syscall.SYS_SCHED_GETSCHEDULER": "syscall", + "syscall.SYS_SCHED_GET_PRIORITY_MAX": "syscall", + "syscall.SYS_SCHED_GET_PRIORITY_MIN": "syscall", + "syscall.SYS_SCHED_RR_GET_INTERVAL": "syscall", + "syscall.SYS_SCHED_SETAFFINITY": "syscall", + "syscall.SYS_SCHED_SETPARAM": "syscall", + "syscall.SYS_SCHED_SETSCHEDULER": "syscall", + "syscall.SYS_SCHED_YIELD": "syscall", + "syscall.SYS_SCTP_GENERIC_RECVMSG": "syscall", + "syscall.SYS_SCTP_GENERIC_SENDMSG": "syscall", + "syscall.SYS_SCTP_GENERIC_SENDMSG_IOV": "syscall", + "syscall.SYS_SCTP_PEELOFF": "syscall", + "syscall.SYS_SEARCHFS": "syscall", + "syscall.SYS_SECURITY": "syscall", + "syscall.SYS_SELECT": "syscall", + "syscall.SYS_SELECT_NOCANCEL": "syscall", + "syscall.SYS_SEMCONFIG": "syscall", + "syscall.SYS_SEMCTL": "syscall", + "syscall.SYS_SEMGET": "syscall", + "syscall.SYS_SEMOP": "syscall", + "syscall.SYS_SEMSYS": "syscall", + "syscall.SYS_SEMTIMEDOP": "syscall", + "syscall.SYS_SEM_CLOSE": "syscall", + "syscall.SYS_SEM_DESTROY": "syscall", + "syscall.SYS_SEM_GETVALUE": "syscall", + "syscall.SYS_SEM_INIT": "syscall", + "syscall.SYS_SEM_OPEN": "syscall", + "syscall.SYS_SEM_POST": "syscall", + "syscall.SYS_SEM_TRYWAIT": "syscall", + "syscall.SYS_SEM_UNLINK": "syscall", + "syscall.SYS_SEM_WAIT": "syscall", + "syscall.SYS_SEM_WAIT_NOCANCEL": "syscall", + "syscall.SYS_SEND": "syscall", + "syscall.SYS_SENDFILE": "syscall", + "syscall.SYS_SENDFILE64": "syscall", + "syscall.SYS_SENDMMSG": "syscall", + "syscall.SYS_SENDMSG": "syscall", + "syscall.SYS_SENDMSG_NOCANCEL": "syscall", + "syscall.SYS_SENDTO": "syscall", + "syscall.SYS_SENDTO_NOCANCEL": "syscall", + "syscall.SYS_SETATTRLIST": "syscall", + "syscall.SYS_SETAUDIT": "syscall", + "syscall.SYS_SETAUDIT_ADDR": "syscall", + "syscall.SYS_SETAUID": "syscall", + "syscall.SYS_SETCONTEXT": "syscall", + "syscall.SYS_SETDOMAINNAME": "syscall", + "syscall.SYS_SETEGID": "syscall", + "syscall.SYS_SETEUID": "syscall", + "syscall.SYS_SETFIB": "syscall", + "syscall.SYS_SETFSGID": "syscall", + "syscall.SYS_SETFSGID32": "syscall", + "syscall.SYS_SETFSUID": "syscall", + "syscall.SYS_SETFSUID32": "syscall", + "syscall.SYS_SETGID": "syscall", + "syscall.SYS_SETGID32": "syscall", + "syscall.SYS_SETGROUPS": "syscall", + "syscall.SYS_SETGROUPS32": "syscall", + "syscall.SYS_SETHOSTNAME": "syscall", + "syscall.SYS_SETITIMER": "syscall", + "syscall.SYS_SETLCID": "syscall", + "syscall.SYS_SETLOGIN": "syscall", + "syscall.SYS_SETLOGINCLASS": "syscall", + "syscall.SYS_SETNS": "syscall", + "syscall.SYS_SETPGID": "syscall", + "syscall.SYS_SETPRIORITY": "syscall", + "syscall.SYS_SETPRIVEXEC": "syscall", + "syscall.SYS_SETREGID": "syscall", + "syscall.SYS_SETREGID32": "syscall", + "syscall.SYS_SETRESGID": "syscall", + "syscall.SYS_SETRESGID32": "syscall", + "syscall.SYS_SETRESUID": "syscall", + "syscall.SYS_SETRESUID32": "syscall", + "syscall.SYS_SETREUID": "syscall", + "syscall.SYS_SETREUID32": "syscall", + "syscall.SYS_SETRLIMIT": "syscall", + "syscall.SYS_SETRTABLE": "syscall", + "syscall.SYS_SETSGROUPS": "syscall", + "syscall.SYS_SETSID": "syscall", + "syscall.SYS_SETSOCKOPT": "syscall", + "syscall.SYS_SETTID": "syscall", + "syscall.SYS_SETTID_WITH_PID": "syscall", + "syscall.SYS_SETTIMEOFDAY": "syscall", + "syscall.SYS_SETUID": "syscall", + "syscall.SYS_SETUID32": "syscall", + "syscall.SYS_SETWGROUPS": "syscall", + "syscall.SYS_SETXATTR": "syscall", + "syscall.SYS_SET_MEMPOLICY": "syscall", + "syscall.SYS_SET_ROBUST_LIST": "syscall", + "syscall.SYS_SET_THREAD_AREA": "syscall", + "syscall.SYS_SET_TID_ADDRESS": "syscall", + "syscall.SYS_SGETMASK": "syscall", + "syscall.SYS_SHARED_REGION_CHECK_NP": "syscall", + "syscall.SYS_SHARED_REGION_MAP_AND_SLIDE_NP": "syscall", + "syscall.SYS_SHMAT": "syscall", + "syscall.SYS_SHMCTL": "syscall", + "syscall.SYS_SHMDT": "syscall", + "syscall.SYS_SHMGET": "syscall", + "syscall.SYS_SHMSYS": "syscall", + "syscall.SYS_SHM_OPEN": "syscall", + "syscall.SYS_SHM_UNLINK": "syscall", + "syscall.SYS_SHUTDOWN": "syscall", + "syscall.SYS_SIGACTION": "syscall", + "syscall.SYS_SIGALTSTACK": "syscall", + "syscall.SYS_SIGNAL": "syscall", + "syscall.SYS_SIGNALFD": "syscall", + "syscall.SYS_SIGNALFD4": "syscall", + "syscall.SYS_SIGPENDING": "syscall", + "syscall.SYS_SIGPROCMASK": "syscall", + "syscall.SYS_SIGQUEUE": "syscall", + "syscall.SYS_SIGQUEUEINFO": "syscall", + "syscall.SYS_SIGRETURN": "syscall", + "syscall.SYS_SIGSUSPEND": "syscall", + "syscall.SYS_SIGSUSPEND_NOCANCEL": "syscall", + "syscall.SYS_SIGTIMEDWAIT": "syscall", + "syscall.SYS_SIGWAIT": "syscall", + "syscall.SYS_SIGWAITINFO": "syscall", + "syscall.SYS_SOCKET": "syscall", + "syscall.SYS_SOCKETCALL": "syscall", + "syscall.SYS_SOCKETPAIR": "syscall", + "syscall.SYS_SPLICE": "syscall", + "syscall.SYS_SSETMASK": "syscall", + "syscall.SYS_SSTK": "syscall", + "syscall.SYS_STACK_SNAPSHOT": "syscall", + "syscall.SYS_STAT": "syscall", + "syscall.SYS_STAT64": "syscall", + "syscall.SYS_STAT64_EXTENDED": "syscall", + "syscall.SYS_STATFS": "syscall", + "syscall.SYS_STATFS64": "syscall", + "syscall.SYS_STATV": "syscall", + "syscall.SYS_STATVFS1": "syscall", + "syscall.SYS_STAT_EXTENDED": "syscall", + "syscall.SYS_STIME": "syscall", + "syscall.SYS_STTY": "syscall", + "syscall.SYS_SWAPCONTEXT": "syscall", + "syscall.SYS_SWAPCTL": "syscall", + "syscall.SYS_SWAPOFF": "syscall", + "syscall.SYS_SWAPON": "syscall", + "syscall.SYS_SYMLINK": "syscall", + "syscall.SYS_SYMLINKAT": "syscall", + "syscall.SYS_SYNC": "syscall", + "syscall.SYS_SYNCFS": "syscall", + "syscall.SYS_SYNC_FILE_RANGE": "syscall", + "syscall.SYS_SYSARCH": "syscall", + "syscall.SYS_SYSCALL": "syscall", + "syscall.SYS_SYSCALL_BASE": "syscall", + "syscall.SYS_SYSFS": "syscall", + "syscall.SYS_SYSINFO": "syscall", + "syscall.SYS_SYSLOG": "syscall", + "syscall.SYS_TEE": "syscall", + "syscall.SYS_TGKILL": "syscall", + "syscall.SYS_THREAD_SELFID": "syscall", + "syscall.SYS_THR_CREATE": "syscall", + "syscall.SYS_THR_EXIT": "syscall", + "syscall.SYS_THR_KILL": "syscall", + "syscall.SYS_THR_KILL2": "syscall", + "syscall.SYS_THR_NEW": "syscall", + "syscall.SYS_THR_SELF": "syscall", + "syscall.SYS_THR_SET_NAME": "syscall", + "syscall.SYS_THR_SUSPEND": "syscall", + "syscall.SYS_THR_WAKE": "syscall", + "syscall.SYS_TIME": "syscall", + "syscall.SYS_TIMERFD_CREATE": "syscall", + "syscall.SYS_TIMERFD_GETTIME": "syscall", + "syscall.SYS_TIMERFD_SETTIME": "syscall", + "syscall.SYS_TIMER_CREATE": "syscall", + "syscall.SYS_TIMER_DELETE": "syscall", + "syscall.SYS_TIMER_GETOVERRUN": "syscall", + "syscall.SYS_TIMER_GETTIME": "syscall", + "syscall.SYS_TIMER_SETTIME": "syscall", + "syscall.SYS_TIMES": "syscall", + "syscall.SYS_TKILL": "syscall", + "syscall.SYS_TRUNCATE": "syscall", + "syscall.SYS_TRUNCATE64": "syscall", + "syscall.SYS_TUXCALL": "syscall", + "syscall.SYS_UGETRLIMIT": "syscall", + "syscall.SYS_ULIMIT": "syscall", + "syscall.SYS_UMASK": "syscall", + "syscall.SYS_UMASK_EXTENDED": "syscall", + "syscall.SYS_UMOUNT": "syscall", + "syscall.SYS_UMOUNT2": "syscall", + "syscall.SYS_UNAME": "syscall", + "syscall.SYS_UNDELETE": "syscall", + "syscall.SYS_UNLINK": "syscall", + "syscall.SYS_UNLINKAT": "syscall", + "syscall.SYS_UNMOUNT": "syscall", + "syscall.SYS_UNSHARE": "syscall", + "syscall.SYS_USELIB": "syscall", + "syscall.SYS_USTAT": "syscall", + "syscall.SYS_UTIME": "syscall", + "syscall.SYS_UTIMENSAT": "syscall", + "syscall.SYS_UTIMES": "syscall", + "syscall.SYS_UTRACE": "syscall", + "syscall.SYS_UUIDGEN": "syscall", + "syscall.SYS_VADVISE": "syscall", + "syscall.SYS_VFORK": "syscall", + "syscall.SYS_VHANGUP": "syscall", + "syscall.SYS_VM86": "syscall", + "syscall.SYS_VM86OLD": "syscall", + "syscall.SYS_VMSPLICE": "syscall", + "syscall.SYS_VM_PRESSURE_MONITOR": "syscall", + "syscall.SYS_VSERVER": "syscall", + "syscall.SYS_WAIT4": "syscall", + "syscall.SYS_WAIT4_NOCANCEL": "syscall", + "syscall.SYS_WAIT6": "syscall", + "syscall.SYS_WAITEVENT": "syscall", + "syscall.SYS_WAITID": "syscall", + "syscall.SYS_WAITID_NOCANCEL": "syscall", + "syscall.SYS_WAITPID": "syscall", + "syscall.SYS_WATCHEVENT": "syscall", + "syscall.SYS_WORKQ_KERNRETURN": "syscall", + "syscall.SYS_WORKQ_OPEN": "syscall", + "syscall.SYS_WRITE": "syscall", + "syscall.SYS_WRITEV": "syscall", + "syscall.SYS_WRITEV_NOCANCEL": "syscall", + "syscall.SYS_WRITE_NOCANCEL": "syscall", + "syscall.SYS_YIELD": "syscall", + "syscall.SYS__LLSEEK": "syscall", + "syscall.SYS__LWP_CONTINUE": "syscall", + "syscall.SYS__LWP_CREATE": "syscall", + "syscall.SYS__LWP_CTL": "syscall", + "syscall.SYS__LWP_DETACH": "syscall", + "syscall.SYS__LWP_EXIT": "syscall", + "syscall.SYS__LWP_GETNAME": "syscall", + "syscall.SYS__LWP_GETPRIVATE": "syscall", + "syscall.SYS__LWP_KILL": "syscall", + "syscall.SYS__LWP_PARK": "syscall", + "syscall.SYS__LWP_SELF": "syscall", + "syscall.SYS__LWP_SETNAME": "syscall", + "syscall.SYS__LWP_SETPRIVATE": "syscall", + "syscall.SYS__LWP_SUSPEND": "syscall", + "syscall.SYS__LWP_UNPARK": "syscall", + "syscall.SYS__LWP_UNPARK_ALL": "syscall", + "syscall.SYS__LWP_WAIT": "syscall", + "syscall.SYS__LWP_WAKEUP": "syscall", + "syscall.SYS__NEWSELECT": "syscall", + "syscall.SYS__PSET_BIND": "syscall", + "syscall.SYS__SCHED_GETAFFINITY": "syscall", + "syscall.SYS__SCHED_GETPARAM": "syscall", + "syscall.SYS__SCHED_SETAFFINITY": "syscall", + "syscall.SYS__SCHED_SETPARAM": "syscall", + "syscall.SYS__SYSCTL": "syscall", + "syscall.SYS__UMTX_LOCK": "syscall", + "syscall.SYS__UMTX_OP": "syscall", + "syscall.SYS__UMTX_UNLOCK": "syscall", + "syscall.SYS___ACL_ACLCHECK_FD": "syscall", + "syscall.SYS___ACL_ACLCHECK_FILE": "syscall", + "syscall.SYS___ACL_ACLCHECK_LINK": "syscall", + "syscall.SYS___ACL_DELETE_FD": "syscall", + "syscall.SYS___ACL_DELETE_FILE": "syscall", + "syscall.SYS___ACL_DELETE_LINK": "syscall", + "syscall.SYS___ACL_GET_FD": "syscall", + "syscall.SYS___ACL_GET_FILE": "syscall", + "syscall.SYS___ACL_GET_LINK": "syscall", + "syscall.SYS___ACL_SET_FD": "syscall", + "syscall.SYS___ACL_SET_FILE": "syscall", + "syscall.SYS___ACL_SET_LINK": "syscall", + "syscall.SYS___CLONE": "syscall", + "syscall.SYS___DISABLE_THREADSIGNAL": "syscall", + "syscall.SYS___GETCWD": "syscall", + "syscall.SYS___GETLOGIN": "syscall", + "syscall.SYS___GET_TCB": "syscall", + "syscall.SYS___MAC_EXECVE": "syscall", + "syscall.SYS___MAC_GETFSSTAT": "syscall", + "syscall.SYS___MAC_GET_FD": "syscall", + "syscall.SYS___MAC_GET_FILE": "syscall", + "syscall.SYS___MAC_GET_LCID": "syscall", + "syscall.SYS___MAC_GET_LCTX": "syscall", + "syscall.SYS___MAC_GET_LINK": "syscall", + "syscall.SYS___MAC_GET_MOUNT": "syscall", + "syscall.SYS___MAC_GET_PID": "syscall", + "syscall.SYS___MAC_GET_PROC": "syscall", + "syscall.SYS___MAC_MOUNT": "syscall", + "syscall.SYS___MAC_SET_FD": "syscall", + "syscall.SYS___MAC_SET_FILE": "syscall", + "syscall.SYS___MAC_SET_LCTX": "syscall", + "syscall.SYS___MAC_SET_LINK": "syscall", + "syscall.SYS___MAC_SET_PROC": "syscall", + "syscall.SYS___MAC_SYSCALL": "syscall", + "syscall.SYS___OLD_SEMWAIT_SIGNAL": "syscall", + "syscall.SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL": "syscall", + "syscall.SYS___POSIX_CHOWN": "syscall", + "syscall.SYS___POSIX_FCHOWN": "syscall", + "syscall.SYS___POSIX_LCHOWN": "syscall", + "syscall.SYS___POSIX_RENAME": "syscall", + "syscall.SYS___PTHREAD_CANCELED": "syscall", + "syscall.SYS___PTHREAD_CHDIR": "syscall", + "syscall.SYS___PTHREAD_FCHDIR": "syscall", + "syscall.SYS___PTHREAD_KILL": "syscall", + "syscall.SYS___PTHREAD_MARKCANCEL": "syscall", + "syscall.SYS___PTHREAD_SIGMASK": "syscall", + "syscall.SYS___QUOTACTL": "syscall", + "syscall.SYS___SEMCTL": "syscall", + "syscall.SYS___SEMWAIT_SIGNAL": "syscall", + "syscall.SYS___SEMWAIT_SIGNAL_NOCANCEL": "syscall", + "syscall.SYS___SETLOGIN": "syscall", + "syscall.SYS___SETUGID": "syscall", + "syscall.SYS___SET_TCB": "syscall", + "syscall.SYS___SIGACTION_SIGTRAMP": "syscall", + "syscall.SYS___SIGTIMEDWAIT": "syscall", + "syscall.SYS___SIGWAIT": "syscall", + "syscall.SYS___SIGWAIT_NOCANCEL": "syscall", + "syscall.SYS___SYSCTL": "syscall", + "syscall.SYS___TFORK": "syscall", + "syscall.SYS___THREXIT": "syscall", + "syscall.SYS___THRSIGDIVERT": "syscall", + "syscall.SYS___THRSLEEP": "syscall", + "syscall.SYS___THRWAKEUP": "syscall", + "syscall.S_ARCH1": "syscall", + "syscall.S_ARCH2": "syscall", + "syscall.S_BLKSIZE": "syscall", + "syscall.S_IEXEC": "syscall", + "syscall.S_IFBLK": "syscall", + "syscall.S_IFCHR": "syscall", + "syscall.S_IFDIR": "syscall", + "syscall.S_IFIFO": "syscall", + "syscall.S_IFLNK": "syscall", + "syscall.S_IFMT": "syscall", + "syscall.S_IFREG": "syscall", + "syscall.S_IFSOCK": "syscall", + "syscall.S_IFWHT": "syscall", + "syscall.S_IREAD": "syscall", + "syscall.S_IRGRP": "syscall", + "syscall.S_IROTH": "syscall", + "syscall.S_IRUSR": "syscall", + "syscall.S_IRWXG": "syscall", + "syscall.S_IRWXO": "syscall", + "syscall.S_IRWXU": "syscall", + "syscall.S_ISGID": "syscall", + "syscall.S_ISTXT": "syscall", + "syscall.S_ISUID": "syscall", + "syscall.S_ISVTX": "syscall", + "syscall.S_IWGRP": "syscall", + "syscall.S_IWOTH": "syscall", + "syscall.S_IWRITE": "syscall", + "syscall.S_IWUSR": "syscall", + "syscall.S_IXGRP": "syscall", + "syscall.S_IXOTH": "syscall", + "syscall.S_IXUSR": "syscall", + "syscall.S_LOGIN_SET": "syscall", + "syscall.SecurityAttributes": "syscall", + "syscall.Seek": "syscall", + "syscall.Select": "syscall", + "syscall.Sendfile": "syscall", + "syscall.Sendmsg": "syscall", + "syscall.SendmsgN": "syscall", + "syscall.Sendto": "syscall", + "syscall.Servent": "syscall", + "syscall.SetBpf": "syscall", + "syscall.SetBpfBuflen": "syscall", + "syscall.SetBpfDatalink": "syscall", + "syscall.SetBpfHeadercmpl": "syscall", + "syscall.SetBpfImmediate": "syscall", + "syscall.SetBpfInterface": "syscall", + "syscall.SetBpfPromisc": "syscall", + "syscall.SetBpfTimeout": "syscall", + "syscall.SetCurrentDirectory": "syscall", + "syscall.SetEndOfFile": "syscall", + "syscall.SetEnvironmentVariable": "syscall", + "syscall.SetFileAttributes": "syscall", + "syscall.SetFileCompletionNotificationModes": "syscall", + "syscall.SetFilePointer": "syscall", + "syscall.SetFileTime": "syscall", + "syscall.SetHandleInformation": "syscall", + "syscall.SetKevent": "syscall", + "syscall.SetLsfPromisc": "syscall", + "syscall.SetNonblock": "syscall", + "syscall.Setdomainname": "syscall", + "syscall.Setegid": "syscall", + "syscall.Setenv": "syscall", + "syscall.Seteuid": "syscall", + "syscall.Setfsgid": "syscall", + "syscall.Setfsuid": "syscall", + "syscall.Setgid": "syscall", + "syscall.Setgroups": "syscall", + "syscall.Sethostname": "syscall", + "syscall.Setlogin": "syscall", + "syscall.Setpgid": "syscall", + "syscall.Setpriority": "syscall", + "syscall.Setprivexec": "syscall", + "syscall.Setregid": "syscall", + "syscall.Setresgid": "syscall", + "syscall.Setresuid": "syscall", + "syscall.Setreuid": "syscall", + "syscall.Setrlimit": "syscall", + "syscall.Setsid": "syscall", + "syscall.Setsockopt": "syscall", + "syscall.SetsockoptByte": "syscall", + "syscall.SetsockoptICMPv6Filter": "syscall", + "syscall.SetsockoptIPMreq": "syscall", + "syscall.SetsockoptIPMreqn": "syscall", + "syscall.SetsockoptIPv6Mreq": "syscall", + "syscall.SetsockoptInet4Addr": "syscall", + "syscall.SetsockoptInt": "syscall", + "syscall.SetsockoptLinger": "syscall", + "syscall.SetsockoptString": "syscall", + "syscall.SetsockoptTimeval": "syscall", + "syscall.Settimeofday": "syscall", + "syscall.Setuid": "syscall", + "syscall.Setxattr": "syscall", + "syscall.Shutdown": "syscall", + "syscall.SidTypeAlias": "syscall", + "syscall.SidTypeComputer": "syscall", + "syscall.SidTypeDeletedAccount": "syscall", + "syscall.SidTypeDomain": "syscall", + "syscall.SidTypeGroup": "syscall", + "syscall.SidTypeInvalid": "syscall", + "syscall.SidTypeLabel": "syscall", + "syscall.SidTypeUnknown": "syscall", + "syscall.SidTypeUser": "syscall", + "syscall.SidTypeWellKnownGroup": "syscall", + "syscall.Signal": "syscall", + "syscall.SizeofBpfHdr": "syscall", + "syscall.SizeofBpfInsn": "syscall", + "syscall.SizeofBpfProgram": "syscall", + "syscall.SizeofBpfStat": "syscall", + "syscall.SizeofBpfVersion": "syscall", + "syscall.SizeofBpfZbuf": "syscall", + "syscall.SizeofBpfZbufHeader": "syscall", + "syscall.SizeofCmsghdr": "syscall", + "syscall.SizeofICMPv6Filter": "syscall", + "syscall.SizeofIPMreq": "syscall", + "syscall.SizeofIPMreqn": "syscall", + "syscall.SizeofIPv6MTUInfo": "syscall", + "syscall.SizeofIPv6Mreq": "syscall", + "syscall.SizeofIfAddrmsg": "syscall", + "syscall.SizeofIfAnnounceMsghdr": "syscall", + "syscall.SizeofIfData": "syscall", + "syscall.SizeofIfInfomsg": "syscall", + "syscall.SizeofIfMsghdr": "syscall", + "syscall.SizeofIfaMsghdr": "syscall", + "syscall.SizeofIfmaMsghdr": "syscall", + "syscall.SizeofIfmaMsghdr2": "syscall", + "syscall.SizeofInet4Pktinfo": "syscall", + "syscall.SizeofInet6Pktinfo": "syscall", + "syscall.SizeofInotifyEvent": "syscall", + "syscall.SizeofLinger": "syscall", + "syscall.SizeofMsghdr": "syscall", + "syscall.SizeofNlAttr": "syscall", + "syscall.SizeofNlMsgerr": "syscall", + "syscall.SizeofNlMsghdr": "syscall", + "syscall.SizeofRtAttr": "syscall", + "syscall.SizeofRtGenmsg": "syscall", + "syscall.SizeofRtMetrics": "syscall", + "syscall.SizeofRtMsg": "syscall", + "syscall.SizeofRtMsghdr": "syscall", + "syscall.SizeofRtNexthop": "syscall", + "syscall.SizeofSockFilter": "syscall", + "syscall.SizeofSockFprog": "syscall", + "syscall.SizeofSockaddrAny": "syscall", + "syscall.SizeofSockaddrDatalink": "syscall", + "syscall.SizeofSockaddrInet4": "syscall", + "syscall.SizeofSockaddrInet6": "syscall", + "syscall.SizeofSockaddrLinklayer": "syscall", + "syscall.SizeofSockaddrNetlink": "syscall", + "syscall.SizeofSockaddrUnix": "syscall", + "syscall.SizeofTCPInfo": "syscall", + "syscall.SizeofUcred": "syscall", + "syscall.SlicePtrFromStrings": "syscall", + "syscall.SockFilter": "syscall", + "syscall.SockFprog": "syscall", + "syscall.SockaddrDatalink": "syscall", + "syscall.SockaddrGen": "syscall", + "syscall.SockaddrInet4": "syscall", + "syscall.SockaddrInet6": "syscall", + "syscall.SockaddrLinklayer": "syscall", + "syscall.SockaddrNetlink": "syscall", + "syscall.SockaddrUnix": "syscall", + "syscall.Socket": "syscall", + "syscall.SocketControlMessage": "syscall", + "syscall.SocketDisableIPv6": "syscall", + "syscall.Socketpair": "syscall", + "syscall.Splice": "syscall", + "syscall.StartProcess": "syscall", + "syscall.StartupInfo": "syscall", + "syscall.Stat": "syscall", + "syscall.Stat_t": "syscall", + "syscall.Statfs": "syscall", + "syscall.Statfs_t": "syscall", + "syscall.Stderr": "syscall", + "syscall.Stdin": "syscall", + "syscall.Stdout": "syscall", + "syscall.StringBytePtr": "syscall", + "syscall.StringByteSlice": "syscall", + "syscall.StringSlicePtr": "syscall", + "syscall.StringToSid": "syscall", + "syscall.StringToUTF16": "syscall", + "syscall.StringToUTF16Ptr": "syscall", + "syscall.Symlink": "syscall", + "syscall.Sync": "syscall", + "syscall.SyncFileRange": "syscall", + "syscall.SysProcAttr": "syscall", + "syscall.SysProcIDMap": "syscall", + "syscall.Syscall": "syscall", + "syscall.Syscall12": "syscall", + "syscall.Syscall15": "syscall", + "syscall.Syscall6": "syscall", + "syscall.Syscall9": "syscall", + "syscall.Sysctl": "syscall", + "syscall.SysctlUint32": "syscall", + "syscall.Sysctlnode": "syscall", + "syscall.Sysinfo": "syscall", + "syscall.Sysinfo_t": "syscall", + "syscall.Systemtime": "syscall", + "syscall.TCGETS": "syscall", + "syscall.TCIFLUSH": "syscall", + "syscall.TCIOFLUSH": "syscall", + "syscall.TCOFLUSH": "syscall", + "syscall.TCPInfo": "syscall", + "syscall.TCPKeepalive": "syscall", + "syscall.TCP_CA_NAME_MAX": "syscall", + "syscall.TCP_CONGCTL": "syscall", + "syscall.TCP_CONGESTION": "syscall", + "syscall.TCP_CONNECTIONTIMEOUT": "syscall", + "syscall.TCP_CORK": "syscall", + "syscall.TCP_DEFER_ACCEPT": "syscall", + "syscall.TCP_INFO": "syscall", + "syscall.TCP_KEEPALIVE": "syscall", + "syscall.TCP_KEEPCNT": "syscall", + "syscall.TCP_KEEPIDLE": "syscall", + "syscall.TCP_KEEPINIT": "syscall", + "syscall.TCP_KEEPINTVL": "syscall", + "syscall.TCP_LINGER2": "syscall", + "syscall.TCP_MAXBURST": "syscall", + "syscall.TCP_MAXHLEN": "syscall", + "syscall.TCP_MAXOLEN": "syscall", + "syscall.TCP_MAXSEG": "syscall", + "syscall.TCP_MAXWIN": "syscall", + "syscall.TCP_MAX_SACK": "syscall", + "syscall.TCP_MAX_WINSHIFT": "syscall", + "syscall.TCP_MD5SIG": "syscall", + "syscall.TCP_MD5SIG_MAXKEYLEN": "syscall", + "syscall.TCP_MINMSS": "syscall", + "syscall.TCP_MINMSSOVERLOAD": "syscall", + "syscall.TCP_MSS": "syscall", + "syscall.TCP_NODELAY": "syscall", + "syscall.TCP_NOOPT": "syscall", + "syscall.TCP_NOPUSH": "syscall", + "syscall.TCP_NSTATES": "syscall", + "syscall.TCP_QUICKACK": "syscall", + "syscall.TCP_RXT_CONNDROPTIME": "syscall", + "syscall.TCP_RXT_FINDROP": "syscall", + "syscall.TCP_SACK_ENABLE": "syscall", + "syscall.TCP_SYNCNT": "syscall", + "syscall.TCP_VENDOR": "syscall", + "syscall.TCP_WINDOW_CLAMP": "syscall", + "syscall.TCSAFLUSH": "syscall", + "syscall.TCSETS": "syscall", + "syscall.TF_DISCONNECT": "syscall", + "syscall.TF_REUSE_SOCKET": "syscall", + "syscall.TF_USE_DEFAULT_WORKER": "syscall", + "syscall.TF_USE_KERNEL_APC": "syscall", + "syscall.TF_USE_SYSTEM_THREAD": "syscall", + "syscall.TF_WRITE_BEHIND": "syscall", + "syscall.TH32CS_INHERIT": "syscall", + "syscall.TH32CS_SNAPALL": "syscall", + "syscall.TH32CS_SNAPHEAPLIST": "syscall", + "syscall.TH32CS_SNAPMODULE": "syscall", + "syscall.TH32CS_SNAPMODULE32": "syscall", + "syscall.TH32CS_SNAPPROCESS": "syscall", + "syscall.TH32CS_SNAPTHREAD": "syscall", + "syscall.TIME_ZONE_ID_DAYLIGHT": "syscall", + "syscall.TIME_ZONE_ID_STANDARD": "syscall", + "syscall.TIME_ZONE_ID_UNKNOWN": "syscall", + "syscall.TIOCCBRK": "syscall", + "syscall.TIOCCDTR": "syscall", + "syscall.TIOCCONS": "syscall", + "syscall.TIOCDCDTIMESTAMP": "syscall", + "syscall.TIOCDRAIN": "syscall", + "syscall.TIOCDSIMICROCODE": "syscall", + "syscall.TIOCEXCL": "syscall", + "syscall.TIOCEXT": "syscall", + "syscall.TIOCFLAG_CDTRCTS": "syscall", + "syscall.TIOCFLAG_CLOCAL": "syscall", + "syscall.TIOCFLAG_CRTSCTS": "syscall", + "syscall.TIOCFLAG_MDMBUF": "syscall", + "syscall.TIOCFLAG_PPS": "syscall", + "syscall.TIOCFLAG_SOFTCAR": "syscall", + "syscall.TIOCFLUSH": "syscall", + "syscall.TIOCGDEV": "syscall", + "syscall.TIOCGDRAINWAIT": "syscall", + "syscall.TIOCGETA": "syscall", + "syscall.TIOCGETD": "syscall", + "syscall.TIOCGFLAGS": "syscall", + "syscall.TIOCGICOUNT": "syscall", + "syscall.TIOCGLCKTRMIOS": "syscall", + "syscall.TIOCGLINED": "syscall", + "syscall.TIOCGPGRP": "syscall", + "syscall.TIOCGPTN": "syscall", + "syscall.TIOCGQSIZE": "syscall", + "syscall.TIOCGRANTPT": "syscall", + "syscall.TIOCGRS485": "syscall", + "syscall.TIOCGSERIAL": "syscall", + "syscall.TIOCGSID": "syscall", + "syscall.TIOCGSIZE": "syscall", + "syscall.TIOCGSOFTCAR": "syscall", + "syscall.TIOCGTSTAMP": "syscall", + "syscall.TIOCGWINSZ": "syscall", + "syscall.TIOCINQ": "syscall", + "syscall.TIOCIXOFF": "syscall", + "syscall.TIOCIXON": "syscall", + "syscall.TIOCLINUX": "syscall", + "syscall.TIOCMBIC": "syscall", + "syscall.TIOCMBIS": "syscall", + "syscall.TIOCMGDTRWAIT": "syscall", + "syscall.TIOCMGET": "syscall", + "syscall.TIOCMIWAIT": "syscall", + "syscall.TIOCMODG": "syscall", + "syscall.TIOCMODS": "syscall", + "syscall.TIOCMSDTRWAIT": "syscall", + "syscall.TIOCMSET": "syscall", + "syscall.TIOCM_CAR": "syscall", + "syscall.TIOCM_CD": "syscall", + "syscall.TIOCM_CTS": "syscall", + "syscall.TIOCM_DCD": "syscall", + "syscall.TIOCM_DSR": "syscall", + "syscall.TIOCM_DTR": "syscall", + "syscall.TIOCM_LE": "syscall", + "syscall.TIOCM_RI": "syscall", + "syscall.TIOCM_RNG": "syscall", + "syscall.TIOCM_RTS": "syscall", + "syscall.TIOCM_SR": "syscall", + "syscall.TIOCM_ST": "syscall", + "syscall.TIOCNOTTY": "syscall", + "syscall.TIOCNXCL": "syscall", + "syscall.TIOCOUTQ": "syscall", + "syscall.TIOCPKT": "syscall", + "syscall.TIOCPKT_DATA": "syscall", + "syscall.TIOCPKT_DOSTOP": "syscall", + "syscall.TIOCPKT_FLUSHREAD": "syscall", + "syscall.TIOCPKT_FLUSHWRITE": "syscall", + "syscall.TIOCPKT_IOCTL": "syscall", + "syscall.TIOCPKT_NOSTOP": "syscall", + "syscall.TIOCPKT_START": "syscall", + "syscall.TIOCPKT_STOP": "syscall", + "syscall.TIOCPTMASTER": "syscall", + "syscall.TIOCPTMGET": "syscall", + "syscall.TIOCPTSNAME": "syscall", + "syscall.TIOCPTYGNAME": "syscall", + "syscall.TIOCPTYGRANT": "syscall", + "syscall.TIOCPTYUNLK": "syscall", + "syscall.TIOCRCVFRAME": "syscall", + "syscall.TIOCREMOTE": "syscall", + "syscall.TIOCSBRK": "syscall", + "syscall.TIOCSCONS": "syscall", + "syscall.TIOCSCTTY": "syscall", + "syscall.TIOCSDRAINWAIT": "syscall", + "syscall.TIOCSDTR": "syscall", + "syscall.TIOCSERCONFIG": "syscall", + "syscall.TIOCSERGETLSR": "syscall", + "syscall.TIOCSERGETMULTI": "syscall", + "syscall.TIOCSERGSTRUCT": "syscall", + "syscall.TIOCSERGWILD": "syscall", + "syscall.TIOCSERSETMULTI": "syscall", + "syscall.TIOCSERSWILD": "syscall", + "syscall.TIOCSER_TEMT": "syscall", + "syscall.TIOCSETA": "syscall", + "syscall.TIOCSETAF": "syscall", + "syscall.TIOCSETAW": "syscall", + "syscall.TIOCSETD": "syscall", + "syscall.TIOCSFLAGS": "syscall", + "syscall.TIOCSIG": "syscall", + "syscall.TIOCSLCKTRMIOS": "syscall", + "syscall.TIOCSLINED": "syscall", + "syscall.TIOCSPGRP": "syscall", + "syscall.TIOCSPTLCK": "syscall", + "syscall.TIOCSQSIZE": "syscall", + "syscall.TIOCSRS485": "syscall", + "syscall.TIOCSSERIAL": "syscall", + "syscall.TIOCSSIZE": "syscall", + "syscall.TIOCSSOFTCAR": "syscall", + "syscall.TIOCSTART": "syscall", + "syscall.TIOCSTAT": "syscall", + "syscall.TIOCSTI": "syscall", + "syscall.TIOCSTOP": "syscall", + "syscall.TIOCSTSTAMP": "syscall", + "syscall.TIOCSWINSZ": "syscall", + "syscall.TIOCTIMESTAMP": "syscall", + "syscall.TIOCUCNTL": "syscall", + "syscall.TIOCVHANGUP": "syscall", + "syscall.TIOCXMTFRAME": "syscall", + "syscall.TOKEN_ADJUST_DEFAULT": "syscall", + "syscall.TOKEN_ADJUST_GROUPS": "syscall", + "syscall.TOKEN_ADJUST_PRIVILEGES": "syscall", + "syscall.TOKEN_ALL_ACCESS": "syscall", + "syscall.TOKEN_ASSIGN_PRIMARY": "syscall", + "syscall.TOKEN_DUPLICATE": "syscall", + "syscall.TOKEN_EXECUTE": "syscall", + "syscall.TOKEN_IMPERSONATE": "syscall", + "syscall.TOKEN_QUERY": "syscall", + "syscall.TOKEN_QUERY_SOURCE": "syscall", + "syscall.TOKEN_READ": "syscall", + "syscall.TOKEN_WRITE": "syscall", + "syscall.TOSTOP": "syscall", + "syscall.TRUNCATE_EXISTING": "syscall", + "syscall.TUNATTACHFILTER": "syscall", + "syscall.TUNDETACHFILTER": "syscall", + "syscall.TUNGETFEATURES": "syscall", + "syscall.TUNGETIFF": "syscall", + "syscall.TUNGETSNDBUF": "syscall", + "syscall.TUNGETVNETHDRSZ": "syscall", + "syscall.TUNSETDEBUG": "syscall", + "syscall.TUNSETGROUP": "syscall", + "syscall.TUNSETIFF": "syscall", + "syscall.TUNSETLINK": "syscall", + "syscall.TUNSETNOCSUM": "syscall", + "syscall.TUNSETOFFLOAD": "syscall", + "syscall.TUNSETOWNER": "syscall", + "syscall.TUNSETPERSIST": "syscall", + "syscall.TUNSETSNDBUF": "syscall", + "syscall.TUNSETTXFILTER": "syscall", + "syscall.TUNSETVNETHDRSZ": "syscall", + "syscall.Tee": "syscall", + "syscall.TerminateProcess": "syscall", + "syscall.Termios": "syscall", + "syscall.Tgkill": "syscall", + "syscall.Time": "syscall", + "syscall.Time_t": "syscall", + "syscall.Times": "syscall", + "syscall.Timespec": "syscall", + "syscall.TimespecToNsec": "syscall", + "syscall.Timeval": "syscall", + "syscall.Timeval32": "syscall", + "syscall.TimevalToNsec": "syscall", + "syscall.Timex": "syscall", + "syscall.Timezoneinformation": "syscall", + "syscall.Tms": "syscall", + "syscall.Token": "syscall", + "syscall.TokenAccessInformation": "syscall", + "syscall.TokenAuditPolicy": "syscall", + "syscall.TokenDefaultDacl": "syscall", + "syscall.TokenElevation": "syscall", + "syscall.TokenElevationType": "syscall", + "syscall.TokenGroups": "syscall", + "syscall.TokenGroupsAndPrivileges": "syscall", + "syscall.TokenHasRestrictions": "syscall", + "syscall.TokenImpersonationLevel": "syscall", + "syscall.TokenIntegrityLevel": "syscall", + "syscall.TokenLinkedToken": "syscall", + "syscall.TokenLogonSid": "syscall", + "syscall.TokenMandatoryPolicy": "syscall", + "syscall.TokenOrigin": "syscall", + "syscall.TokenOwner": "syscall", + "syscall.TokenPrimaryGroup": "syscall", + "syscall.TokenPrivileges": "syscall", + "syscall.TokenRestrictedSids": "syscall", + "syscall.TokenSandBoxInert": "syscall", + "syscall.TokenSessionId": "syscall", + "syscall.TokenSessionReference": "syscall", + "syscall.TokenSource": "syscall", + "syscall.TokenStatistics": "syscall", + "syscall.TokenType": "syscall", + "syscall.TokenUIAccess": "syscall", + "syscall.TokenUser": "syscall", + "syscall.TokenVirtualizationAllowed": "syscall", + "syscall.TokenVirtualizationEnabled": "syscall", + "syscall.Tokenprimarygroup": "syscall", + "syscall.Tokenuser": "syscall", + "syscall.TranslateAccountName": "syscall", + "syscall.TranslateName": "syscall", + "syscall.TransmitFile": "syscall", + "syscall.TransmitFileBuffers": "syscall", + "syscall.Truncate": "syscall", + "syscall.USAGE_MATCH_TYPE_AND": "syscall", + "syscall.USAGE_MATCH_TYPE_OR": "syscall", + "syscall.UTF16FromString": "syscall", + "syscall.UTF16PtrFromString": "syscall", + "syscall.UTF16ToString": "syscall", + "syscall.Ucred": "syscall", + "syscall.Umask": "syscall", + "syscall.Uname": "syscall", + "syscall.Undelete": "syscall", + "syscall.UnixCredentials": "syscall", + "syscall.UnixRights": "syscall", + "syscall.Unlink": "syscall", + "syscall.Unlinkat": "syscall", + "syscall.UnmapViewOfFile": "syscall", + "syscall.Unmount": "syscall", + "syscall.Unsetenv": "syscall", + "syscall.Unshare": "syscall", + "syscall.UserInfo10": "syscall", + "syscall.Ustat": "syscall", + "syscall.Ustat_t": "syscall", + "syscall.Utimbuf": "syscall", + "syscall.Utime": "syscall", + "syscall.Utimes": "syscall", + "syscall.UtimesNano": "syscall", + "syscall.Utsname": "syscall", + "syscall.VDISCARD": "syscall", + "syscall.VDSUSP": "syscall", + "syscall.VEOF": "syscall", + "syscall.VEOL": "syscall", + "syscall.VEOL2": "syscall", + "syscall.VERASE": "syscall", + "syscall.VERASE2": "syscall", + "syscall.VINTR": "syscall", + "syscall.VKILL": "syscall", + "syscall.VLNEXT": "syscall", + "syscall.VMIN": "syscall", + "syscall.VQUIT": "syscall", + "syscall.VREPRINT": "syscall", + "syscall.VSTART": "syscall", + "syscall.VSTATUS": "syscall", + "syscall.VSTOP": "syscall", + "syscall.VSUSP": "syscall", + "syscall.VSWTC": "syscall", + "syscall.VT0": "syscall", + "syscall.VT1": "syscall", + "syscall.VTDLY": "syscall", + "syscall.VTIME": "syscall", + "syscall.VWERASE": "syscall", + "syscall.VirtualLock": "syscall", + "syscall.VirtualUnlock": "syscall", + "syscall.WAIT_ABANDONED": "syscall", + "syscall.WAIT_FAILED": "syscall", + "syscall.WAIT_OBJECT_0": "syscall", + "syscall.WAIT_TIMEOUT": "syscall", + "syscall.WALL": "syscall", + "syscall.WALLSIG": "syscall", + "syscall.WALTSIG": "syscall", + "syscall.WCLONE": "syscall", + "syscall.WCONTINUED": "syscall", + "syscall.WCOREFLAG": "syscall", + "syscall.WEXITED": "syscall", + "syscall.WLINUXCLONE": "syscall", + "syscall.WNOHANG": "syscall", + "syscall.WNOTHREAD": "syscall", + "syscall.WNOWAIT": "syscall", + "syscall.WNOZOMBIE": "syscall", + "syscall.WOPTSCHECKED": "syscall", + "syscall.WORDSIZE": "syscall", + "syscall.WSABuf": "syscall", + "syscall.WSACleanup": "syscall", + "syscall.WSADESCRIPTION_LEN": "syscall", + "syscall.WSAData": "syscall", + "syscall.WSAEACCES": "syscall", + "syscall.WSAECONNRESET": "syscall", + "syscall.WSAEnumProtocols": "syscall", + "syscall.WSAID_CONNECTEX": "syscall", + "syscall.WSAIoctl": "syscall", + "syscall.WSAPROTOCOL_LEN": "syscall", + "syscall.WSAProtocolChain": "syscall", + "syscall.WSAProtocolInfo": "syscall", + "syscall.WSARecv": "syscall", + "syscall.WSARecvFrom": "syscall", + "syscall.WSASYS_STATUS_LEN": "syscall", + "syscall.WSASend": "syscall", + "syscall.WSASendTo": "syscall", + "syscall.WSASendto": "syscall", + "syscall.WSAStartup": "syscall", + "syscall.WSTOPPED": "syscall", + "syscall.WTRAPPED": "syscall", + "syscall.WUNTRACED": "syscall", + "syscall.Wait4": "syscall", + "syscall.WaitForSingleObject": "syscall", + "syscall.WaitStatus": "syscall", + "syscall.Win32FileAttributeData": "syscall", + "syscall.Win32finddata": "syscall", + "syscall.Write": "syscall", + "syscall.WriteConsole": "syscall", + "syscall.WriteFile": "syscall", + "syscall.X509_ASN_ENCODING": "syscall", + "syscall.XCASE": "syscall", + "syscall.XP1_CONNECTIONLESS": "syscall", + "syscall.XP1_CONNECT_DATA": "syscall", + "syscall.XP1_DISCONNECT_DATA": "syscall", + "syscall.XP1_EXPEDITED_DATA": "syscall", + "syscall.XP1_GRACEFUL_CLOSE": "syscall", + "syscall.XP1_GUARANTEED_DELIVERY": "syscall", + "syscall.XP1_GUARANTEED_ORDER": "syscall", + "syscall.XP1_IFS_HANDLES": "syscall", + "syscall.XP1_MESSAGE_ORIENTED": "syscall", + "syscall.XP1_MULTIPOINT_CONTROL_PLANE": "syscall", + "syscall.XP1_MULTIPOINT_DATA_PLANE": "syscall", + "syscall.XP1_PARTIAL_MESSAGE": "syscall", + "syscall.XP1_PSEUDO_STREAM": "syscall", + "syscall.XP1_QOS_SUPPORTED": "syscall", + "syscall.XP1_SAN_SUPPORT_SDP": "syscall", + "syscall.XP1_SUPPORT_BROADCAST": "syscall", + "syscall.XP1_SUPPORT_MULTIPOINT": "syscall", + "syscall.XP1_UNI_RECV": "syscall", + "syscall.XP1_UNI_SEND": "syscall", + "syslog.Dial": "log/syslog", + "syslog.LOG_ALERT": "log/syslog", + "syslog.LOG_AUTH": "log/syslog", + "syslog.LOG_AUTHPRIV": "log/syslog", + "syslog.LOG_CRIT": "log/syslog", + "syslog.LOG_CRON": "log/syslog", + "syslog.LOG_DAEMON": "log/syslog", + "syslog.LOG_DEBUG": "log/syslog", + "syslog.LOG_EMERG": "log/syslog", + "syslog.LOG_ERR": "log/syslog", + "syslog.LOG_FTP": "log/syslog", + "syslog.LOG_INFO": "log/syslog", + "syslog.LOG_KERN": "log/syslog", + "syslog.LOG_LOCAL0": "log/syslog", + "syslog.LOG_LOCAL1": "log/syslog", + "syslog.LOG_LOCAL2": "log/syslog", + "syslog.LOG_LOCAL3": "log/syslog", + "syslog.LOG_LOCAL4": "log/syslog", + "syslog.LOG_LOCAL5": "log/syslog", + "syslog.LOG_LOCAL6": "log/syslog", + "syslog.LOG_LOCAL7": "log/syslog", + "syslog.LOG_LPR": "log/syslog", + "syslog.LOG_MAIL": "log/syslog", + "syslog.LOG_NEWS": "log/syslog", + "syslog.LOG_NOTICE": "log/syslog", + "syslog.LOG_SYSLOG": "log/syslog", + "syslog.LOG_USER": "log/syslog", + "syslog.LOG_UUCP": "log/syslog", + "syslog.LOG_WARNING": "log/syslog", + "syslog.New": "log/syslog", + "syslog.NewLogger": "log/syslog", + "syslog.Priority": "log/syslog", + "syslog.Writer": "log/syslog", + "tabwriter.AlignRight": "text/tabwriter", + "tabwriter.Debug": "text/tabwriter", + "tabwriter.DiscardEmptyColumns": "text/tabwriter", + "tabwriter.Escape": "text/tabwriter", + "tabwriter.FilterHTML": "text/tabwriter", + "tabwriter.NewWriter": "text/tabwriter", + "tabwriter.StripEscape": "text/tabwriter", + "tabwriter.TabIndent": "text/tabwriter", + "tabwriter.Writer": "text/tabwriter", + "tar.ErrFieldTooLong": "archive/tar", + "tar.ErrHeader": "archive/tar", + "tar.ErrWriteAfterClose": "archive/tar", + "tar.ErrWriteTooLong": "archive/tar", + "tar.FileInfoHeader": "archive/tar", + "tar.Header": "archive/tar", + "tar.NewReader": "archive/tar", + "tar.NewWriter": "archive/tar", + "tar.Reader": "archive/tar", + "tar.TypeBlock": "archive/tar", + "tar.TypeChar": "archive/tar", + "tar.TypeCont": "archive/tar", + "tar.TypeDir": "archive/tar", + "tar.TypeFifo": "archive/tar", + "tar.TypeGNULongLink": "archive/tar", + "tar.TypeGNULongName": "archive/tar", + "tar.TypeGNUSparse": "archive/tar", + "tar.TypeLink": "archive/tar", + "tar.TypeReg": "archive/tar", + "tar.TypeRegA": "archive/tar", + "tar.TypeSymlink": "archive/tar", + "tar.TypeXGlobalHeader": "archive/tar", + "tar.TypeXHeader": "archive/tar", + "tar.Writer": "archive/tar", + "template.CSS": "html/template", + "template.ErrAmbigContext": "html/template", + "template.ErrBadHTML": "html/template", + "template.ErrBranchEnd": "html/template", + "template.ErrEndContext": "html/template", + "template.ErrNoSuchTemplate": "html/template", + "template.ErrOutputContext": "html/template", + "template.ErrPartialCharset": "html/template", + "template.ErrPartialEscape": "html/template", + "template.ErrRangeLoopReentry": "html/template", + "template.ErrSlashAmbig": "html/template", + "template.Error": "html/template", + "template.ErrorCode": "html/template", + "template.ExecError": "text/template", + // "template.FuncMap" is ambiguous + "template.HTML": "html/template", + "template.HTMLAttr": "html/template", + // "template.HTMLEscape" is ambiguous + // "template.HTMLEscapeString" is ambiguous + // "template.HTMLEscaper" is ambiguous + // "template.IsTrue" is ambiguous + "template.JS": "html/template", + // "template.JSEscape" is ambiguous + // "template.JSEscapeString" is ambiguous + // "template.JSEscaper" is ambiguous + "template.JSStr": "html/template", + // "template.Must" is ambiguous + // "template.New" is ambiguous + "template.OK": "html/template", + // "template.ParseFiles" is ambiguous + // "template.ParseGlob" is ambiguous + // "template.Template" is ambiguous + "template.URL": "html/template", + // "template.URLQueryEscaper" is ambiguous + "testing.AllocsPerRun": "testing", + "testing.B": "testing", + "testing.Benchmark": "testing", + "testing.BenchmarkResult": "testing", + "testing.Cover": "testing", + "testing.CoverBlock": "testing", + "testing.Coverage": "testing", + "testing.InternalBenchmark": "testing", + "testing.InternalExample": "testing", + "testing.InternalTest": "testing", + "testing.M": "testing", + "testing.Main": "testing", + "testing.MainStart": "testing", + "testing.PB": "testing", + "testing.RegisterCover": "testing", + "testing.RunBenchmarks": "testing", + "testing.RunExamples": "testing", + "testing.RunTests": "testing", + "testing.Short": "testing", + "testing.T": "testing", + "testing.Verbose": "testing", + "textproto.CanonicalMIMEHeaderKey": "net/textproto", + "textproto.Conn": "net/textproto", + "textproto.Dial": "net/textproto", + "textproto.Error": "net/textproto", + "textproto.MIMEHeader": "net/textproto", + "textproto.NewConn": "net/textproto", + "textproto.NewReader": "net/textproto", + "textproto.NewWriter": "net/textproto", + "textproto.Pipeline": "net/textproto", + "textproto.ProtocolError": "net/textproto", + "textproto.Reader": "net/textproto", + "textproto.TrimBytes": "net/textproto", + "textproto.TrimString": "net/textproto", + "textproto.Writer": "net/textproto", + "time.ANSIC": "time", + "time.After": "time", + "time.AfterFunc": "time", + "time.April": "time", + "time.August": "time", + "time.Date": "time", + "time.December": "time", + "time.Duration": "time", + "time.February": "time", + "time.FixedZone": "time", + "time.Friday": "time", + "time.Hour": "time", + "time.January": "time", + "time.July": "time", + "time.June": "time", + "time.Kitchen": "time", + "time.LoadLocation": "time", + "time.Local": "time", + "time.Location": "time", + "time.March": "time", + "time.May": "time", + "time.Microsecond": "time", + "time.Millisecond": "time", + "time.Minute": "time", + "time.Monday": "time", + "time.Month": "time", + "time.Nanosecond": "time", + "time.NewTicker": "time", + "time.NewTimer": "time", + "time.November": "time", + "time.Now": "time", + "time.October": "time", + "time.Parse": "time", + "time.ParseDuration": "time", + "time.ParseError": "time", + "time.ParseInLocation": "time", + "time.RFC1123": "time", + "time.RFC1123Z": "time", + "time.RFC3339": "time", + "time.RFC3339Nano": "time", + "time.RFC822": "time", + "time.RFC822Z": "time", + "time.RFC850": "time", + "time.RubyDate": "time", + "time.Saturday": "time", + "time.Second": "time", + "time.September": "time", + "time.Since": "time", + "time.Sleep": "time", + "time.Stamp": "time", + "time.StampMicro": "time", + "time.StampMilli": "time", + "time.StampNano": "time", + "time.Sunday": "time", + "time.Thursday": "time", + "time.Tick": "time", + "time.Ticker": "time", + "time.Time": "time", + "time.Timer": "time", + "time.Tuesday": "time", + "time.UTC": "time", + "time.Unix": "time", + "time.UnixDate": "time", + "time.Wednesday": "time", + "time.Weekday": "time", + "tls.Certificate": "crypto/tls", + "tls.Client": "crypto/tls", + "tls.ClientAuthType": "crypto/tls", + "tls.ClientHelloInfo": "crypto/tls", + "tls.ClientSessionCache": "crypto/tls", + "tls.ClientSessionState": "crypto/tls", + "tls.Config": "crypto/tls", + "tls.Conn": "crypto/tls", + "tls.ConnectionState": "crypto/tls", + "tls.CurveID": "crypto/tls", + "tls.CurveP256": "crypto/tls", + "tls.CurveP384": "crypto/tls", + "tls.CurveP521": "crypto/tls", + "tls.Dial": "crypto/tls", + "tls.DialWithDialer": "crypto/tls", + "tls.Listen": "crypto/tls", + "tls.LoadX509KeyPair": "crypto/tls", + "tls.NewLRUClientSessionCache": "crypto/tls", + "tls.NewListener": "crypto/tls", + "tls.NoClientCert": "crypto/tls", + "tls.RecordHeaderError": "crypto/tls", + "tls.RenegotiateFreelyAsClient": "crypto/tls", + "tls.RenegotiateNever": "crypto/tls", + "tls.RenegotiateOnceAsClient": "crypto/tls", + "tls.RenegotiationSupport": "crypto/tls", + "tls.RequestClientCert": "crypto/tls", + "tls.RequireAndVerifyClientCert": "crypto/tls", + "tls.RequireAnyClientCert": "crypto/tls", + "tls.Server": "crypto/tls", + "tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA": "crypto/tls", + "tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256": "crypto/tls", + "tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA": "crypto/tls", + "tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384": "crypto/tls", + "tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA": "crypto/tls", + "tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA": "crypto/tls", + "tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA": "crypto/tls", + "tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256": "crypto/tls", + "tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA": "crypto/tls", + "tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384": "crypto/tls", + "tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA": "crypto/tls", + "tls.TLS_FALLBACK_SCSV": "crypto/tls", + "tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA": "crypto/tls", + "tls.TLS_RSA_WITH_AES_128_CBC_SHA": "crypto/tls", + "tls.TLS_RSA_WITH_AES_128_GCM_SHA256": "crypto/tls", + "tls.TLS_RSA_WITH_AES_256_CBC_SHA": "crypto/tls", + "tls.TLS_RSA_WITH_AES_256_GCM_SHA384": "crypto/tls", + "tls.TLS_RSA_WITH_RC4_128_SHA": "crypto/tls", + "tls.VerifyClientCertIfGiven": "crypto/tls", + "tls.VersionSSL30": "crypto/tls", + "tls.VersionTLS10": "crypto/tls", + "tls.VersionTLS11": "crypto/tls", + "tls.VersionTLS12": "crypto/tls", + "tls.X509KeyPair": "crypto/tls", + "token.ADD": "go/token", + "token.ADD_ASSIGN": "go/token", + "token.AND": "go/token", + "token.AND_ASSIGN": "go/token", + "token.AND_NOT": "go/token", + "token.AND_NOT_ASSIGN": "go/token", + "token.ARROW": "go/token", + "token.ASSIGN": "go/token", + "token.BREAK": "go/token", + "token.CASE": "go/token", + "token.CHAN": "go/token", + "token.CHAR": "go/token", + "token.COLON": "go/token", + "token.COMMA": "go/token", + "token.COMMENT": "go/token", + "token.CONST": "go/token", + "token.CONTINUE": "go/token", + "token.DEC": "go/token", + "token.DEFAULT": "go/token", + "token.DEFER": "go/token", + "token.DEFINE": "go/token", + "token.ELLIPSIS": "go/token", + "token.ELSE": "go/token", + "token.EOF": "go/token", + "token.EQL": "go/token", + "token.FALLTHROUGH": "go/token", + "token.FLOAT": "go/token", + "token.FOR": "go/token", + "token.FUNC": "go/token", + "token.File": "go/token", + "token.FileSet": "go/token", + "token.GEQ": "go/token", + "token.GO": "go/token", + "token.GOTO": "go/token", + "token.GTR": "go/token", + "token.HighestPrec": "go/token", + "token.IDENT": "go/token", + "token.IF": "go/token", + "token.ILLEGAL": "go/token", + "token.IMAG": "go/token", + "token.IMPORT": "go/token", + "token.INC": "go/token", + "token.INT": "go/token", + "token.INTERFACE": "go/token", + "token.LAND": "go/token", + "token.LBRACE": "go/token", + "token.LBRACK": "go/token", + "token.LEQ": "go/token", + "token.LOR": "go/token", + "token.LPAREN": "go/token", + "token.LSS": "go/token", + "token.Lookup": "go/token", + "token.LowestPrec": "go/token", + "token.MAP": "go/token", + "token.MUL": "go/token", + "token.MUL_ASSIGN": "go/token", + "token.NEQ": "go/token", + "token.NOT": "go/token", + "token.NewFileSet": "go/token", + "token.NoPos": "go/token", + "token.OR": "go/token", + "token.OR_ASSIGN": "go/token", + "token.PACKAGE": "go/token", + "token.PERIOD": "go/token", + "token.Pos": "go/token", + "token.Position": "go/token", + "token.QUO": "go/token", + "token.QUO_ASSIGN": "go/token", + "token.RANGE": "go/token", + "token.RBRACE": "go/token", + "token.RBRACK": "go/token", + "token.REM": "go/token", + "token.REM_ASSIGN": "go/token", + "token.RETURN": "go/token", + "token.RPAREN": "go/token", + "token.SELECT": "go/token", + "token.SEMICOLON": "go/token", + "token.SHL": "go/token", + "token.SHL_ASSIGN": "go/token", + "token.SHR": "go/token", + "token.SHR_ASSIGN": "go/token", + "token.STRING": "go/token", + "token.STRUCT": "go/token", + "token.SUB": "go/token", + "token.SUB_ASSIGN": "go/token", + "token.SWITCH": "go/token", + "token.TYPE": "go/token", + "token.Token": "go/token", + "token.UnaryPrec": "go/token", + "token.VAR": "go/token", + "token.XOR": "go/token", + "token.XOR_ASSIGN": "go/token", + "trace.Start": "runtime/trace", + "trace.Stop": "runtime/trace", + "types.Array": "go/types", + "types.AssertableTo": "go/types", + "types.AssignableTo": "go/types", + "types.Basic": "go/types", + "types.BasicInfo": "go/types", + "types.BasicKind": "go/types", + "types.Bool": "go/types", + "types.Builtin": "go/types", + "types.Byte": "go/types", + "types.Chan": "go/types", + "types.ChanDir": "go/types", + "types.Checker": "go/types", + "types.Comparable": "go/types", + "types.Complex128": "go/types", + "types.Complex64": "go/types", + "types.Config": "go/types", + "types.Const": "go/types", + "types.ConvertibleTo": "go/types", + "types.DefPredeclaredTestFuncs": "go/types", + "types.Error": "go/types", + "types.Eval": "go/types", + "types.ExprString": "go/types", + "types.FieldVal": "go/types", + "types.Float32": "go/types", + "types.Float64": "go/types", + "types.Func": "go/types", + "types.Id": "go/types", + "types.Identical": "go/types", + "types.Implements": "go/types", + "types.ImportMode": "go/types", + "types.Importer": "go/types", + "types.ImporterFrom": "go/types", + "types.Info": "go/types", + "types.Initializer": "go/types", + "types.Int": "go/types", + "types.Int16": "go/types", + "types.Int32": "go/types", + "types.Int64": "go/types", + "types.Int8": "go/types", + "types.Interface": "go/types", + "types.Invalid": "go/types", + "types.IsBoolean": "go/types", + "types.IsComplex": "go/types", + "types.IsConstType": "go/types", + "types.IsFloat": "go/types", + "types.IsInteger": "go/types", + "types.IsInterface": "go/types", + "types.IsNumeric": "go/types", + "types.IsOrdered": "go/types", + "types.IsString": "go/types", + "types.IsUnsigned": "go/types", + "types.IsUntyped": "go/types", + "types.Label": "go/types", + "types.LookupFieldOrMethod": "go/types", + "types.Map": "go/types", + "types.MethodExpr": "go/types", + "types.MethodSet": "go/types", + "types.MethodVal": "go/types", + "types.MissingMethod": "go/types", + "types.Named": "go/types", + "types.NewArray": "go/types", + "types.NewChan": "go/types", + "types.NewChecker": "go/types", + "types.NewConst": "go/types", + "types.NewField": "go/types", + "types.NewFunc": "go/types", + "types.NewInterface": "go/types", + "types.NewLabel": "go/types", + "types.NewMap": "go/types", + "types.NewMethodSet": "go/types", + "types.NewNamed": "go/types", + "types.NewPackage": "go/types", + "types.NewParam": "go/types", + "types.NewPkgName": "go/types", + "types.NewPointer": "go/types", + "types.NewScope": "go/types", + "types.NewSignature": "go/types", + "types.NewSlice": "go/types", + "types.NewStruct": "go/types", + "types.NewTuple": "go/types", + "types.NewTypeName": "go/types", + "types.NewVar": "go/types", + "types.Nil": "go/types", + "types.ObjectString": "go/types", + "types.Package": "go/types", + "types.PkgName": "go/types", + "types.Pointer": "go/types", + "types.Qualifier": "go/types", + "types.RecvOnly": "go/types", + "types.RelativeTo": "go/types", + "types.Rune": "go/types", + "types.Scope": "go/types", + "types.Selection": "go/types", + "types.SelectionKind": "go/types", + "types.SelectionString": "go/types", + "types.SendOnly": "go/types", + "types.SendRecv": "go/types", + "types.Signature": "go/types", + "types.Sizes": "go/types", + "types.Slice": "go/types", + "types.StdSizes": "go/types", + "types.String": "go/types", + "types.Struct": "go/types", + "types.Tuple": "go/types", + "types.Typ": "go/types", + "types.Type": "go/types", + "types.TypeAndValue": "go/types", + "types.TypeName": "go/types", + "types.TypeString": "go/types", + "types.Uint": "go/types", + "types.Uint16": "go/types", + "types.Uint32": "go/types", + "types.Uint64": "go/types", + "types.Uint8": "go/types", + "types.Uintptr": "go/types", + "types.Universe": "go/types", + "types.Unsafe": "go/types", + "types.UnsafePointer": "go/types", + "types.UntypedBool": "go/types", + "types.UntypedComplex": "go/types", + "types.UntypedFloat": "go/types", + "types.UntypedInt": "go/types", + "types.UntypedNil": "go/types", + "types.UntypedRune": "go/types", + "types.UntypedString": "go/types", + "types.Var": "go/types", + "types.WriteExpr": "go/types", + "types.WriteSignature": "go/types", + "types.WriteType": "go/types", + "unicode.ASCII_Hex_Digit": "unicode", + "unicode.Adlam": "unicode", + "unicode.Ahom": "unicode", + "unicode.Anatolian_Hieroglyphs": "unicode", + "unicode.Arabic": "unicode", + "unicode.Armenian": "unicode", + "unicode.Avestan": "unicode", + "unicode.AzeriCase": "unicode", + "unicode.Balinese": "unicode", + "unicode.Bamum": "unicode", + "unicode.Bassa_Vah": "unicode", + "unicode.Batak": "unicode", + "unicode.Bengali": "unicode", + "unicode.Bhaiksuki": "unicode", + "unicode.Bidi_Control": "unicode", + "unicode.Bopomofo": "unicode", + "unicode.Brahmi": "unicode", + "unicode.Braille": "unicode", + "unicode.Buginese": "unicode", + "unicode.Buhid": "unicode", + "unicode.C": "unicode", + "unicode.Canadian_Aboriginal": "unicode", + "unicode.Carian": "unicode", + "unicode.CaseRange": "unicode", + "unicode.CaseRanges": "unicode", + "unicode.Categories": "unicode", + "unicode.Caucasian_Albanian": "unicode", + "unicode.Cc": "unicode", + "unicode.Cf": "unicode", + "unicode.Chakma": "unicode", + "unicode.Cham": "unicode", + "unicode.Cherokee": "unicode", + "unicode.Co": "unicode", + "unicode.Common": "unicode", + "unicode.Coptic": "unicode", + "unicode.Cs": "unicode", + "unicode.Cuneiform": "unicode", + "unicode.Cypriot": "unicode", + "unicode.Cyrillic": "unicode", + "unicode.Dash": "unicode", + "unicode.Deprecated": "unicode", + "unicode.Deseret": "unicode", + "unicode.Devanagari": "unicode", + "unicode.Diacritic": "unicode", + "unicode.Digit": "unicode", + "unicode.Duployan": "unicode", + "unicode.Egyptian_Hieroglyphs": "unicode", + "unicode.Elbasan": "unicode", + "unicode.Ethiopic": "unicode", + "unicode.Extender": "unicode", + "unicode.FoldCategory": "unicode", + "unicode.FoldScript": "unicode", + "unicode.Georgian": "unicode", + "unicode.Glagolitic": "unicode", + "unicode.Gothic": "unicode", + "unicode.Grantha": "unicode", + "unicode.GraphicRanges": "unicode", + "unicode.Greek": "unicode", + "unicode.Gujarati": "unicode", + "unicode.Gurmukhi": "unicode", + "unicode.Han": "unicode", + "unicode.Hangul": "unicode", + "unicode.Hanunoo": "unicode", + "unicode.Hatran": "unicode", + "unicode.Hebrew": "unicode", + "unicode.Hex_Digit": "unicode", + "unicode.Hiragana": "unicode", + "unicode.Hyphen": "unicode", + "unicode.IDS_Binary_Operator": "unicode", + "unicode.IDS_Trinary_Operator": "unicode", + "unicode.Ideographic": "unicode", + "unicode.Imperial_Aramaic": "unicode", + "unicode.In": "unicode", + "unicode.Inherited": "unicode", + "unicode.Inscriptional_Pahlavi": "unicode", + "unicode.Inscriptional_Parthian": "unicode", + "unicode.Is": "unicode", + "unicode.IsControl": "unicode", + "unicode.IsDigit": "unicode", + "unicode.IsGraphic": "unicode", + "unicode.IsLetter": "unicode", + "unicode.IsLower": "unicode", + "unicode.IsMark": "unicode", + "unicode.IsNumber": "unicode", + "unicode.IsOneOf": "unicode", + "unicode.IsPrint": "unicode", + "unicode.IsPunct": "unicode", + "unicode.IsSpace": "unicode", + "unicode.IsSymbol": "unicode", + "unicode.IsTitle": "unicode", + "unicode.IsUpper": "unicode", + "unicode.Javanese": "unicode", + "unicode.Join_Control": "unicode", + "unicode.Kaithi": "unicode", + "unicode.Kannada": "unicode", + "unicode.Katakana": "unicode", + "unicode.Kayah_Li": "unicode", + "unicode.Kharoshthi": "unicode", + "unicode.Khmer": "unicode", + "unicode.Khojki": "unicode", + "unicode.Khudawadi": "unicode", + "unicode.L": "unicode", + "unicode.Lao": "unicode", + "unicode.Latin": "unicode", + "unicode.Lepcha": "unicode", + "unicode.Letter": "unicode", + "unicode.Limbu": "unicode", + "unicode.Linear_A": "unicode", + "unicode.Linear_B": "unicode", + "unicode.Lisu": "unicode", + "unicode.Ll": "unicode", + "unicode.Lm": "unicode", + "unicode.Lo": "unicode", + "unicode.Logical_Order_Exception": "unicode", + "unicode.Lower": "unicode", + "unicode.LowerCase": "unicode", + "unicode.Lt": "unicode", + "unicode.Lu": "unicode", + "unicode.Lycian": "unicode", + "unicode.Lydian": "unicode", + "unicode.M": "unicode", + "unicode.Mahajani": "unicode", + "unicode.Malayalam": "unicode", + "unicode.Mandaic": "unicode", + "unicode.Manichaean": "unicode", + "unicode.Marchen": "unicode", + "unicode.Mark": "unicode", + "unicode.MaxASCII": "unicode", + "unicode.MaxCase": "unicode", + "unicode.MaxLatin1": "unicode", + "unicode.MaxRune": "unicode", + "unicode.Mc": "unicode", + "unicode.Me": "unicode", + "unicode.Meetei_Mayek": "unicode", + "unicode.Mende_Kikakui": "unicode", + "unicode.Meroitic_Cursive": "unicode", + "unicode.Meroitic_Hieroglyphs": "unicode", + "unicode.Miao": "unicode", + "unicode.Mn": "unicode", + "unicode.Modi": "unicode", + "unicode.Mongolian": "unicode", + "unicode.Mro": "unicode", + "unicode.Multani": "unicode", + "unicode.Myanmar": "unicode", + "unicode.N": "unicode", + "unicode.Nabataean": "unicode", + "unicode.Nd": "unicode", + "unicode.New_Tai_Lue": "unicode", + "unicode.Newa": "unicode", + "unicode.Nko": "unicode", + "unicode.Nl": "unicode", + "unicode.No": "unicode", + "unicode.Noncharacter_Code_Point": "unicode", + "unicode.Number": "unicode", + "unicode.Ogham": "unicode", + "unicode.Ol_Chiki": "unicode", + "unicode.Old_Hungarian": "unicode", + "unicode.Old_Italic": "unicode", + "unicode.Old_North_Arabian": "unicode", + "unicode.Old_Permic": "unicode", + "unicode.Old_Persian": "unicode", + "unicode.Old_South_Arabian": "unicode", + "unicode.Old_Turkic": "unicode", + "unicode.Oriya": "unicode", + "unicode.Osage": "unicode", + "unicode.Osmanya": "unicode", + "unicode.Other": "unicode", + "unicode.Other_Alphabetic": "unicode", + "unicode.Other_Default_Ignorable_Code_Point": "unicode", + "unicode.Other_Grapheme_Extend": "unicode", + "unicode.Other_ID_Continue": "unicode", + "unicode.Other_ID_Start": "unicode", + "unicode.Other_Lowercase": "unicode", + "unicode.Other_Math": "unicode", + "unicode.Other_Uppercase": "unicode", + "unicode.P": "unicode", + "unicode.Pahawh_Hmong": "unicode", + "unicode.Palmyrene": "unicode", + "unicode.Pattern_Syntax": "unicode", + "unicode.Pattern_White_Space": "unicode", + "unicode.Pau_Cin_Hau": "unicode", + "unicode.Pc": "unicode", + "unicode.Pd": "unicode", + "unicode.Pe": "unicode", + "unicode.Pf": "unicode", + "unicode.Phags_Pa": "unicode", + "unicode.Phoenician": "unicode", + "unicode.Pi": "unicode", + "unicode.Po": "unicode", + "unicode.Prepended_Concatenation_Mark": "unicode", + "unicode.PrintRanges": "unicode", + "unicode.Properties": "unicode", + "unicode.Ps": "unicode", + "unicode.Psalter_Pahlavi": "unicode", + "unicode.Punct": "unicode", + "unicode.Quotation_Mark": "unicode", + "unicode.Radical": "unicode", + "unicode.Range16": "unicode", + "unicode.Range32": "unicode", + "unicode.RangeTable": "unicode", + "unicode.Rejang": "unicode", + "unicode.ReplacementChar": "unicode", + "unicode.Runic": "unicode", + "unicode.S": "unicode", + "unicode.STerm": "unicode", + "unicode.Samaritan": "unicode", + "unicode.Saurashtra": "unicode", + "unicode.Sc": "unicode", + "unicode.Scripts": "unicode", + "unicode.Sentence_Terminal": "unicode", + "unicode.Sharada": "unicode", + "unicode.Shavian": "unicode", + "unicode.Siddham": "unicode", + "unicode.SignWriting": "unicode", + "unicode.SimpleFold": "unicode", + "unicode.Sinhala": "unicode", + "unicode.Sk": "unicode", + "unicode.Sm": "unicode", + "unicode.So": "unicode", + "unicode.Soft_Dotted": "unicode", + "unicode.Sora_Sompeng": "unicode", + "unicode.Space": "unicode", + "unicode.SpecialCase": "unicode", + "unicode.Sundanese": "unicode", + "unicode.Syloti_Nagri": "unicode", + "unicode.Symbol": "unicode", + "unicode.Syriac": "unicode", + "unicode.Tagalog": "unicode", + "unicode.Tagbanwa": "unicode", + "unicode.Tai_Le": "unicode", + "unicode.Tai_Tham": "unicode", + "unicode.Tai_Viet": "unicode", + "unicode.Takri": "unicode", + "unicode.Tamil": "unicode", + "unicode.Tangut": "unicode", + "unicode.Telugu": "unicode", + "unicode.Terminal_Punctuation": "unicode", + "unicode.Thaana": "unicode", + "unicode.Thai": "unicode", + "unicode.Tibetan": "unicode", + "unicode.Tifinagh": "unicode", + "unicode.Tirhuta": "unicode", + "unicode.Title": "unicode", + "unicode.TitleCase": "unicode", + "unicode.To": "unicode", + "unicode.ToLower": "unicode", + "unicode.ToTitle": "unicode", + "unicode.ToUpper": "unicode", + "unicode.TurkishCase": "unicode", + "unicode.Ugaritic": "unicode", + "unicode.Unified_Ideograph": "unicode", + "unicode.Upper": "unicode", + "unicode.UpperCase": "unicode", + "unicode.UpperLower": "unicode", + "unicode.Vai": "unicode", + "unicode.Variation_Selector": "unicode", + "unicode.Version": "unicode", + "unicode.Warang_Citi": "unicode", + "unicode.White_Space": "unicode", + "unicode.Yi": "unicode", + "unicode.Z": "unicode", + "unicode.Zl": "unicode", + "unicode.Zp": "unicode", + "unicode.Zs": "unicode", + "url.Error": "net/url", + "url.EscapeError": "net/url", + "url.InvalidHostError": "net/url", + "url.Parse": "net/url", + "url.ParseQuery": "net/url", + "url.ParseRequestURI": "net/url", + "url.QueryEscape": "net/url", + "url.QueryUnescape": "net/url", + "url.URL": "net/url", + "url.User": "net/url", + "url.UserPassword": "net/url", + "url.Userinfo": "net/url", + "url.Values": "net/url", + "user.Current": "os/user", + "user.Group": "os/user", + "user.Lookup": "os/user", + "user.LookupGroup": "os/user", + "user.LookupGroupId": "os/user", + "user.LookupId": "os/user", + "user.UnknownGroupError": "os/user", + "user.UnknownGroupIdError": "os/user", + "user.UnknownUserError": "os/user", + "user.UnknownUserIdError": "os/user", + "user.User": "os/user", + "utf16.Decode": "unicode/utf16", + "utf16.DecodeRune": "unicode/utf16", + "utf16.Encode": "unicode/utf16", + "utf16.EncodeRune": "unicode/utf16", + "utf16.IsSurrogate": "unicode/utf16", + "utf8.DecodeLastRune": "unicode/utf8", + "utf8.DecodeLastRuneInString": "unicode/utf8", + "utf8.DecodeRune": "unicode/utf8", + "utf8.DecodeRuneInString": "unicode/utf8", + "utf8.EncodeRune": "unicode/utf8", + "utf8.FullRune": "unicode/utf8", + "utf8.FullRuneInString": "unicode/utf8", + "utf8.MaxRune": "unicode/utf8", + "utf8.RuneCount": "unicode/utf8", + "utf8.RuneCountInString": "unicode/utf8", + "utf8.RuneError": "unicode/utf8", + "utf8.RuneLen": "unicode/utf8", + "utf8.RuneSelf": "unicode/utf8", + "utf8.RuneStart": "unicode/utf8", + "utf8.UTFMax": "unicode/utf8", + "utf8.Valid": "unicode/utf8", + "utf8.ValidRune": "unicode/utf8", + "utf8.ValidString": "unicode/utf8", + "x509.CANotAuthorizedForThisName": "crypto/x509", + "x509.CertPool": "crypto/x509", + "x509.Certificate": "crypto/x509", + "x509.CertificateInvalidError": "crypto/x509", + "x509.CertificateRequest": "crypto/x509", + "x509.ConstraintViolationError": "crypto/x509", + "x509.CreateCertificate": "crypto/x509", + "x509.CreateCertificateRequest": "crypto/x509", + "x509.DSA": "crypto/x509", + "x509.DSAWithSHA1": "crypto/x509", + "x509.DSAWithSHA256": "crypto/x509", + "x509.DecryptPEMBlock": "crypto/x509", + "x509.ECDSA": "crypto/x509", + "x509.ECDSAWithSHA1": "crypto/x509", + "x509.ECDSAWithSHA256": "crypto/x509", + "x509.ECDSAWithSHA384": "crypto/x509", + "x509.ECDSAWithSHA512": "crypto/x509", + "x509.EncryptPEMBlock": "crypto/x509", + "x509.ErrUnsupportedAlgorithm": "crypto/x509", + "x509.Expired": "crypto/x509", + "x509.ExtKeyUsage": "crypto/x509", + "x509.ExtKeyUsageAny": "crypto/x509", + "x509.ExtKeyUsageClientAuth": "crypto/x509", + "x509.ExtKeyUsageCodeSigning": "crypto/x509", + "x509.ExtKeyUsageEmailProtection": "crypto/x509", + "x509.ExtKeyUsageIPSECEndSystem": "crypto/x509", + "x509.ExtKeyUsageIPSECTunnel": "crypto/x509", + "x509.ExtKeyUsageIPSECUser": "crypto/x509", + "x509.ExtKeyUsageMicrosoftServerGatedCrypto": "crypto/x509", + "x509.ExtKeyUsageNetscapeServerGatedCrypto": "crypto/x509", + "x509.ExtKeyUsageOCSPSigning": "crypto/x509", + "x509.ExtKeyUsageServerAuth": "crypto/x509", + "x509.ExtKeyUsageTimeStamping": "crypto/x509", + "x509.HostnameError": "crypto/x509", + "x509.IncompatibleUsage": "crypto/x509", + "x509.IncorrectPasswordError": "crypto/x509", + "x509.InsecureAlgorithmError": "crypto/x509", + "x509.InvalidReason": "crypto/x509", + "x509.IsEncryptedPEMBlock": "crypto/x509", + "x509.KeyUsage": "crypto/x509", + "x509.KeyUsageCRLSign": "crypto/x509", + "x509.KeyUsageCertSign": "crypto/x509", + "x509.KeyUsageContentCommitment": "crypto/x509", + "x509.KeyUsageDataEncipherment": "crypto/x509", + "x509.KeyUsageDecipherOnly": "crypto/x509", + "x509.KeyUsageDigitalSignature": "crypto/x509", + "x509.KeyUsageEncipherOnly": "crypto/x509", + "x509.KeyUsageKeyAgreement": "crypto/x509", + "x509.KeyUsageKeyEncipherment": "crypto/x509", + "x509.MD2WithRSA": "crypto/x509", + "x509.MD5WithRSA": "crypto/x509", + "x509.MarshalECPrivateKey": "crypto/x509", + "x509.MarshalPKCS1PrivateKey": "crypto/x509", + "x509.MarshalPKIXPublicKey": "crypto/x509", + "x509.NewCertPool": "crypto/x509", + "x509.NotAuthorizedToSign": "crypto/x509", + "x509.PEMCipher": "crypto/x509", + "x509.PEMCipher3DES": "crypto/x509", + "x509.PEMCipherAES128": "crypto/x509", + "x509.PEMCipherAES192": "crypto/x509", + "x509.PEMCipherAES256": "crypto/x509", + "x509.PEMCipherDES": "crypto/x509", + "x509.ParseCRL": "crypto/x509", + "x509.ParseCertificate": "crypto/x509", + "x509.ParseCertificateRequest": "crypto/x509", + "x509.ParseCertificates": "crypto/x509", + "x509.ParseDERCRL": "crypto/x509", + "x509.ParseECPrivateKey": "crypto/x509", + "x509.ParsePKCS1PrivateKey": "crypto/x509", + "x509.ParsePKCS8PrivateKey": "crypto/x509", + "x509.ParsePKIXPublicKey": "crypto/x509", + "x509.PublicKeyAlgorithm": "crypto/x509", + "x509.RSA": "crypto/x509", + "x509.SHA1WithRSA": "crypto/x509", + "x509.SHA256WithRSA": "crypto/x509", + "x509.SHA384WithRSA": "crypto/x509", + "x509.SHA512WithRSA": "crypto/x509", + "x509.SignatureAlgorithm": "crypto/x509", + "x509.SystemCertPool": "crypto/x509", + "x509.SystemRootsError": "crypto/x509", + "x509.TooManyIntermediates": "crypto/x509", + "x509.UnhandledCriticalExtension": "crypto/x509", + "x509.UnknownAuthorityError": "crypto/x509", + "x509.UnknownPublicKeyAlgorithm": "crypto/x509", + "x509.UnknownSignatureAlgorithm": "crypto/x509", + "x509.VerifyOptions": "crypto/x509", + "xml.Attr": "encoding/xml", + "xml.CharData": "encoding/xml", + "xml.Comment": "encoding/xml", + "xml.CopyToken": "encoding/xml", + "xml.Decoder": "encoding/xml", + "xml.Directive": "encoding/xml", + "xml.Encoder": "encoding/xml", + "xml.EndElement": "encoding/xml", + "xml.Escape": "encoding/xml", + "xml.EscapeText": "encoding/xml", + "xml.HTMLAutoClose": "encoding/xml", + "xml.HTMLEntity": "encoding/xml", + "xml.Header": "encoding/xml", + "xml.Marshal": "encoding/xml", + "xml.MarshalIndent": "encoding/xml", + "xml.Marshaler": "encoding/xml", + "xml.MarshalerAttr": "encoding/xml", + "xml.Name": "encoding/xml", + "xml.NewDecoder": "encoding/xml", + "xml.NewEncoder": "encoding/xml", + "xml.ProcInst": "encoding/xml", + "xml.StartElement": "encoding/xml", + "xml.SyntaxError": "encoding/xml", + "xml.TagPathError": "encoding/xml", + "xml.Token": "encoding/xml", + "xml.Unmarshal": "encoding/xml", + "xml.UnmarshalError": "encoding/xml", + "xml.Unmarshaler": "encoding/xml", + "xml.UnmarshalerAttr": "encoding/xml", + "xml.UnsupportedTypeError": "encoding/xml", + "zip.Compressor": "archive/zip", + "zip.Decompressor": "archive/zip", + "zip.Deflate": "archive/zip", + "zip.ErrAlgorithm": "archive/zip", + "zip.ErrChecksum": "archive/zip", + "zip.ErrFormat": "archive/zip", + "zip.File": "archive/zip", + "zip.FileHeader": "archive/zip", + "zip.FileInfoHeader": "archive/zip", + "zip.NewReader": "archive/zip", + "zip.NewWriter": "archive/zip", + "zip.OpenReader": "archive/zip", + "zip.ReadCloser": "archive/zip", + "zip.Reader": "archive/zip", + "zip.RegisterCompressor": "archive/zip", + "zip.RegisterDecompressor": "archive/zip", + "zip.Store": "archive/zip", + "zip.Writer": "archive/zip", + "zlib.BestCompression": "compress/zlib", + "zlib.BestSpeed": "compress/zlib", + "zlib.DefaultCompression": "compress/zlib", + "zlib.ErrChecksum": "compress/zlib", + "zlib.ErrDictionary": "compress/zlib", + "zlib.ErrHeader": "compress/zlib", + "zlib.NewReader": "compress/zlib", + "zlib.NewReaderDict": "compress/zlib", + "zlib.NewWriter": "compress/zlib", + "zlib.NewWriterLevel": "compress/zlib", + "zlib.NewWriterLevelDict": "compress/zlib", + "zlib.NoCompression": "compress/zlib", + "zlib.Resetter": "compress/zlib", + "zlib.Writer": "compress/zlib", + + "unsafe.Alignof": "unsafe", + "unsafe.ArbitraryType": "unsafe", + "unsafe.Offsetof": "unsafe", + "unsafe.Pointer": "unsafe", + "unsafe.Sizeof": "unsafe", +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/LICENSE b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/LICENSE new file mode 100644 index 00000000000..f4988b45079 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/LICENSE @@ -0,0 +1,28 @@ +Copyright 2014, Google Inc. +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/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/PATENTS b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/PATENTS new file mode 100644 index 00000000000..69b47959fab --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the gRPC 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 gRPC, 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 gRPC. 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 gRPC or any code incorporated within this +implementation of gRPC 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 gRPC +shall terminate as of the date such litigation is filed. diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/backoff.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/backoff.go new file mode 100644 index 00000000000..c99024ee302 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/backoff.go @@ -0,0 +1,80 @@ +package grpc + +import ( + "math/rand" + "time" +) + +// DefaultBackoffConfig uses values specified for backoff in +// https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md. +var ( + DefaultBackoffConfig = BackoffConfig{ + MaxDelay: 120 * time.Second, + baseDelay: 1.0 * time.Second, + factor: 1.6, + jitter: 0.2, + } +) + +// backoffStrategy defines the methodology for backing off after a grpc +// connection failure. +// +// This is unexported until the gRPC project decides whether or not to allow +// alternative backoff strategies. Once a decision is made, this type and its +// method may be exported. +type backoffStrategy interface { + // backoff returns the amount of time to wait before the next retry given + // the number of consecutive failures. + backoff(retries int) time.Duration +} + +// BackoffConfig defines the parameters for the default gRPC backoff strategy. +type BackoffConfig struct { + // MaxDelay is the upper bound of backoff delay. + MaxDelay time.Duration + + // TODO(stevvooe): The following fields are not exported, as allowing + // changes would violate the current gRPC specification for backoff. If + // gRPC decides to allow more interesting backoff strategies, these fields + // may be opened up in the future. + + // baseDelay is the amount of time to wait before retrying after the first + // failure. + baseDelay time.Duration + + // factor is applied to the backoff after each retry. + factor float64 + + // jitter provides a range to randomize backoff delays. + jitter float64 +} + +func setDefaults(bc *BackoffConfig) { + md := bc.MaxDelay + *bc = DefaultBackoffConfig + + if md > 0 { + bc.MaxDelay = md + } +} + +func (bc BackoffConfig) backoff(retries int) time.Duration { + if retries == 0 { + return bc.baseDelay + } + backoff, max := float64(bc.baseDelay), float64(bc.MaxDelay) + for backoff < max && retries > 0 { + backoff *= bc.factor + retries-- + } + if backoff > max { + backoff = max + } + // Randomize backoff delays so that if a cluster of requests start at + // the same time, they won't operate in lockstep. + backoff *= 1 + bc.jitter*(rand.Float64()*2-1) + if backoff < 0 { + return 0 + } + return time.Duration(backoff) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/balancer.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/balancer.go new file mode 100644 index 00000000000..9d943fbadae --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/balancer.go @@ -0,0 +1,400 @@ +/* + * + * Copyright 2016, Google Inc. + * 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. + * + */ + +package grpc + +import ( + "fmt" + "sync" + + "golang.org/x/net/context" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/naming" +) + +// Address represents a server the client connects to. +// This is the EXPERIMENTAL API and may be changed or extended in the future. +type Address struct { + // Addr is the server address on which a connection will be established. + Addr string + // Metadata is the information associated with Addr, which may be used + // to make load balancing decision. + Metadata interface{} +} + +// BalancerConfig specifies the configurations for Balancer. +type BalancerConfig struct { + // DialCreds is the transport credential the Balancer implementation can + // use to dial to a remote load balancer server. The Balancer implementations + // can ignore this if it does not need to talk to another party securely. + DialCreds credentials.TransportCredentials +} + +// BalancerGetOptions configures a Get call. +// This is the EXPERIMENTAL API and may be changed or extended in the future. +type BalancerGetOptions struct { + // BlockingWait specifies whether Get should block when there is no + // connected address. + BlockingWait bool +} + +// Balancer chooses network addresses for RPCs. +// This is the EXPERIMENTAL API and may be changed or extended in the future. +type Balancer interface { + // Start does the initialization work to bootstrap a Balancer. For example, + // this function may start the name resolution and watch the updates. It will + // be called when dialing. + Start(target string, config BalancerConfig) error + // Up informs the Balancer that gRPC has a connection to the server at + // addr. It returns down which is called once the connection to addr gets + // lost or closed. + // TODO: It is not clear how to construct and take advantage of the meaningful error + // parameter for down. Need realistic demands to guide. + Up(addr Address) (down func(error)) + // Get gets the address of a server for the RPC corresponding to ctx. + // i) If it returns a connected address, gRPC internals issues the RPC on the + // connection to this address; + // ii) If it returns an address on which the connection is under construction + // (initiated by Notify(...)) but not connected, gRPC internals + // * fails RPC if the RPC is fail-fast and connection is in the TransientFailure or + // Shutdown state; + // or + // * issues RPC on the connection otherwise. + // iii) If it returns an address on which the connection does not exist, gRPC + // internals treats it as an error and will fail the corresponding RPC. + // + // Therefore, the following is the recommended rule when writing a custom Balancer. + // If opts.BlockingWait is true, it should return a connected address or + // block if there is no connected address. It should respect the timeout or + // cancellation of ctx when blocking. If opts.BlockingWait is false (for fail-fast + // RPCs), it should return an address it has notified via Notify(...) immediately + // instead of blocking. + // + // The function returns put which is called once the rpc has completed or failed. + // put can collect and report RPC stats to a remote load balancer. + // + // This function should only return the errors Balancer cannot recover by itself. + // gRPC internals will fail the RPC if an error is returned. + Get(ctx context.Context, opts BalancerGetOptions) (addr Address, put func(), err error) + // Notify returns a channel that is used by gRPC internals to watch the addresses + // gRPC needs to connect. The addresses might be from a name resolver or remote + // load balancer. gRPC internals will compare it with the existing connected + // addresses. If the address Balancer notified is not in the existing connected + // addresses, gRPC starts to connect the address. If an address in the existing + // connected addresses is not in the notification list, the corresponding connection + // is shutdown gracefully. Otherwise, there are no operations to take. Note that + // the Address slice must be the full list of the Addresses which should be connected. + // It is NOT delta. + Notify() <-chan []Address + // Close shuts down the balancer. + Close() error +} + +// downErr implements net.Error. It is constructed by gRPC internals and passed to the down +// call of Balancer. +type downErr struct { + timeout bool + temporary bool + desc string +} + +func (e downErr) Error() string { return e.desc } +func (e downErr) Timeout() bool { return e.timeout } +func (e downErr) Temporary() bool { return e.temporary } + +func downErrorf(timeout, temporary bool, format string, a ...interface{}) downErr { + return downErr{ + timeout: timeout, + temporary: temporary, + desc: fmt.Sprintf(format, a...), + } +} + +// RoundRobin returns a Balancer that selects addresses round-robin. It uses r to watch +// the name resolution updates and updates the addresses available correspondingly. +func RoundRobin(r naming.Resolver) Balancer { + return &roundRobin{r: r} +} + +type addrInfo struct { + addr Address + connected bool +} + +type roundRobin struct { + r naming.Resolver + w naming.Watcher + addrs []*addrInfo // all the addresses the client should potentially connect + mu sync.Mutex + addrCh chan []Address // the channel to notify gRPC internals the list of addresses the client should connect to. + next int // index of the next address to return for Get() + waitCh chan struct{} // the channel to block when there is no connected address available + done bool // The Balancer is closed. +} + +func (rr *roundRobin) watchAddrUpdates() error { + updates, err := rr.w.Next() + if err != nil { + grpclog.Printf("grpc: the naming watcher stops working due to %v.\n", err) + return err + } + rr.mu.Lock() + defer rr.mu.Unlock() + for _, update := range updates { + addr := Address{ + Addr: update.Addr, + Metadata: update.Metadata, + } + switch update.Op { + case naming.Add: + var exist bool + for _, v := range rr.addrs { + if addr == v.addr { + exist = true + grpclog.Println("grpc: The name resolver wanted to add an existing address: ", addr) + break + } + } + if exist { + continue + } + rr.addrs = append(rr.addrs, &addrInfo{addr: addr}) + case naming.Delete: + for i, v := range rr.addrs { + if addr == v.addr { + copy(rr.addrs[i:], rr.addrs[i+1:]) + rr.addrs = rr.addrs[:len(rr.addrs)-1] + break + } + } + default: + grpclog.Println("Unknown update.Op ", update.Op) + } + } + // Make a copy of rr.addrs and write it onto rr.addrCh so that gRPC internals gets notified. + open := make([]Address, len(rr.addrs)) + for i, v := range rr.addrs { + open[i] = v.addr + } + if rr.done { + return ErrClientConnClosing + } + rr.addrCh <- open + return nil +} + +func (rr *roundRobin) Start(target string, config BalancerConfig) error { + rr.mu.Lock() + defer rr.mu.Unlock() + if rr.done { + return ErrClientConnClosing + } + if rr.r == nil { + // If there is no name resolver installed, it is not needed to + // do name resolution. In this case, target is added into rr.addrs + // as the only address available and rr.addrCh stays nil. + rr.addrs = append(rr.addrs, &addrInfo{addr: Address{Addr: target}}) + return nil + } + w, err := rr.r.Resolve(target) + if err != nil { + return err + } + rr.w = w + rr.addrCh = make(chan []Address) + go func() { + for { + if err := rr.watchAddrUpdates(); err != nil { + return + } + } + }() + return nil +} + +// Up sets the connected state of addr and sends notification if there are pending +// Get() calls. +func (rr *roundRobin) Up(addr Address) func(error) { + rr.mu.Lock() + defer rr.mu.Unlock() + var cnt int + for _, a := range rr.addrs { + if a.addr == addr { + if a.connected { + return nil + } + a.connected = true + } + if a.connected { + cnt++ + } + } + // addr is only one which is connected. Notify the Get() callers who are blocking. + if cnt == 1 && rr.waitCh != nil { + close(rr.waitCh) + rr.waitCh = nil + } + return func(err error) { + rr.down(addr, err) + } +} + +// down unsets the connected state of addr. +func (rr *roundRobin) down(addr Address, err error) { + rr.mu.Lock() + defer rr.mu.Unlock() + for _, a := range rr.addrs { + if addr == a.addr { + a.connected = false + break + } + } +} + +// Get returns the next addr in the rotation. +func (rr *roundRobin) Get(ctx context.Context, opts BalancerGetOptions) (addr Address, put func(), err error) { + var ch chan struct{} + rr.mu.Lock() + if rr.done { + rr.mu.Unlock() + err = ErrClientConnClosing + return + } + + if len(rr.addrs) > 0 { + if rr.next >= len(rr.addrs) { + rr.next = 0 + } + next := rr.next + for { + a := rr.addrs[next] + next = (next + 1) % len(rr.addrs) + if a.connected { + addr = a.addr + rr.next = next + rr.mu.Unlock() + return + } + if next == rr.next { + // Has iterated all the possible address but none is connected. + break + } + } + } + if !opts.BlockingWait { + if len(rr.addrs) == 0 { + rr.mu.Unlock() + err = Errorf(codes.Unavailable, "there is no address available") + return + } + // Returns the next addr on rr.addrs for failfast RPCs. + addr = rr.addrs[rr.next].addr + rr.next++ + rr.mu.Unlock() + return + } + // Wait on rr.waitCh for non-failfast RPCs. + if rr.waitCh == nil { + ch = make(chan struct{}) + rr.waitCh = ch + } else { + ch = rr.waitCh + } + rr.mu.Unlock() + for { + select { + case <-ctx.Done(): + err = ctx.Err() + return + case <-ch: + rr.mu.Lock() + if rr.done { + rr.mu.Unlock() + err = ErrClientConnClosing + return + } + + if len(rr.addrs) > 0 { + if rr.next >= len(rr.addrs) { + rr.next = 0 + } + next := rr.next + for { + a := rr.addrs[next] + next = (next + 1) % len(rr.addrs) + if a.connected { + addr = a.addr + rr.next = next + rr.mu.Unlock() + return + } + if next == rr.next { + // Has iterated all the possible address but none is connected. + break + } + } + } + // The newly added addr got removed by Down() again. + if rr.waitCh == nil { + ch = make(chan struct{}) + rr.waitCh = ch + } else { + ch = rr.waitCh + } + rr.mu.Unlock() + } + } +} + +func (rr *roundRobin) Notify() <-chan []Address { + return rr.addrCh +} + +func (rr *roundRobin) Close() error { + rr.mu.Lock() + defer rr.mu.Unlock() + rr.done = true + if rr.w != nil { + rr.w.Close() + } + if rr.waitCh != nil { + close(rr.waitCh) + rr.waitCh = nil + } + if rr.addrCh != nil { + close(rr.addrCh) + } + return nil +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/call.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/call.go new file mode 100644 index 00000000000..c1588c6375c --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/call.go @@ -0,0 +1,289 @@ +/* + * + * Copyright 2014, Google Inc. + * 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. + * + */ + +package grpc + +import ( + "bytes" + "io" + "time" + + "golang.org/x/net/context" + "golang.org/x/net/trace" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/peer" + "google.golang.org/grpc/stats" + "google.golang.org/grpc/transport" +) + +// recvResponse receives and parses an RPC response. +// On error, it returns the error and indicates whether the call should be retried. +// +// TODO(zhaoq): Check whether the received message sequence is valid. +// TODO ctx is used for stats collection and processing. It is the context passed from the application. +func recvResponse(ctx context.Context, dopts dialOptions, t transport.ClientTransport, c *callInfo, stream *transport.Stream, reply interface{}) (err error) { + // Try to acquire header metadata from the server if there is any. + defer func() { + if err != nil { + if _, ok := err.(transport.ConnectionError); !ok { + t.CloseStream(stream, err) + } + } + }() + c.headerMD, err = stream.Header() + if err != nil { + return + } + p := &parser{r: stream} + var inPayload *stats.InPayload + if dopts.copts.StatsHandler != nil { + inPayload = &stats.InPayload{ + Client: true, + } + } + for { + if err = recv(p, dopts.codec, stream, dopts.dc, reply, dopts.maxMsgSize, inPayload); err != nil { + if err == io.EOF { + break + } + return + } + } + if inPayload != nil && err == io.EOF && stream.StatusCode() == codes.OK { + // TODO in the current implementation, inTrailer may be handled before inPayload in some cases. + // Fix the order if necessary. + dopts.copts.StatsHandler.HandleRPC(ctx, inPayload) + } + c.trailerMD = stream.Trailer() + if peer, ok := peer.FromContext(stream.Context()); ok { + c.peer = peer + } + return nil +} + +// sendRequest writes out various information of an RPC such as Context and Message. +func sendRequest(ctx context.Context, dopts dialOptions, compressor Compressor, callHdr *transport.CallHdr, t transport.ClientTransport, args interface{}, opts *transport.Options) (_ *transport.Stream, err error) { + stream, err := t.NewStream(ctx, callHdr) + if err != nil { + return nil, err + } + defer func() { + if err != nil { + // If err is connection error, t will be closed, no need to close stream here. + if _, ok := err.(transport.ConnectionError); !ok { + t.CloseStream(stream, err) + } + } + }() + var ( + cbuf *bytes.Buffer + outPayload *stats.OutPayload + ) + if compressor != nil { + cbuf = new(bytes.Buffer) + } + if dopts.copts.StatsHandler != nil { + outPayload = &stats.OutPayload{ + Client: true, + } + } + outBuf, err := encode(dopts.codec, args, compressor, cbuf, outPayload) + if err != nil { + return nil, Errorf(codes.Internal, "grpc: %v", err) + } + err = t.Write(stream, outBuf, opts) + if err == nil && outPayload != nil { + outPayload.SentTime = time.Now() + dopts.copts.StatsHandler.HandleRPC(ctx, outPayload) + } + // t.NewStream(...) could lead to an early rejection of the RPC (e.g., the service/method + // does not exist.) so that t.Write could get io.EOF from wait(...). Leave the following + // recvResponse to get the final status. + if err != nil && err != io.EOF { + return nil, err + } + // Sent successfully. + return stream, nil +} + +// Invoke sends the RPC request on the wire and returns after response is received. +// Invoke is called by generated code. Also users can call Invoke directly when it +// is really needed in their use cases. +func Invoke(ctx context.Context, method string, args, reply interface{}, cc *ClientConn, opts ...CallOption) error { + if cc.dopts.unaryInt != nil { + return cc.dopts.unaryInt(ctx, method, args, reply, cc, invoke, opts...) + } + return invoke(ctx, method, args, reply, cc, opts...) +} + +func invoke(ctx context.Context, method string, args, reply interface{}, cc *ClientConn, opts ...CallOption) (e error) { + c := defaultCallInfo + if mc, ok := cc.getMethodConfig(method); ok { + c.failFast = !mc.WaitForReady + if mc.Timeout > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, mc.Timeout) + defer cancel() + } + } + for _, o := range opts { + if err := o.before(&c); err != nil { + return toRPCErr(err) + } + } + defer func() { + for _, o := range opts { + o.after(&c) + } + }() + if EnableTracing { + c.traceInfo.tr = trace.New("grpc.Sent."+methodFamily(method), method) + defer c.traceInfo.tr.Finish() + c.traceInfo.firstLine.client = true + if deadline, ok := ctx.Deadline(); ok { + c.traceInfo.firstLine.deadline = deadline.Sub(time.Now()) + } + c.traceInfo.tr.LazyLog(&c.traceInfo.firstLine, false) + // TODO(dsymonds): Arrange for c.traceInfo.firstLine.remoteAddr to be set. + defer func() { + if e != nil { + c.traceInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{e}}, true) + c.traceInfo.tr.SetError() + } + }() + } + sh := cc.dopts.copts.StatsHandler + if sh != nil { + ctx = sh.TagRPC(ctx, &stats.RPCTagInfo{FullMethodName: method}) + begin := &stats.Begin{ + Client: true, + BeginTime: time.Now(), + FailFast: c.failFast, + } + sh.HandleRPC(ctx, begin) + } + defer func() { + if sh != nil { + end := &stats.End{ + Client: true, + EndTime: time.Now(), + Error: e, + } + sh.HandleRPC(ctx, end) + } + }() + topts := &transport.Options{ + Last: true, + Delay: false, + } + for { + var ( + err error + t transport.ClientTransport + stream *transport.Stream + // Record the put handler from Balancer.Get(...). It is called once the + // RPC has completed or failed. + put func() + ) + // TODO(zhaoq): Need a formal spec of fail-fast. + callHdr := &transport.CallHdr{ + Host: cc.authority, + Method: method, + } + if cc.dopts.cp != nil { + callHdr.SendCompress = cc.dopts.cp.Type() + } + + gopts := BalancerGetOptions{ + BlockingWait: !c.failFast, + } + t, put, err = cc.getTransport(ctx, gopts) + if err != nil { + // TODO(zhaoq): Probably revisit the error handling. + if _, ok := err.(*rpcError); ok { + return err + } + if err == errConnClosing || err == errConnUnavailable { + if c.failFast { + return Errorf(codes.Unavailable, "%v", err) + } + continue + } + // All the other errors are treated as Internal errors. + return Errorf(codes.Internal, "%v", err) + } + if c.traceInfo.tr != nil { + c.traceInfo.tr.LazyLog(&payload{sent: true, msg: args}, true) + } + stream, err = sendRequest(ctx, cc.dopts, cc.dopts.cp, callHdr, t, args, topts) + if err != nil { + if put != nil { + put() + put = nil + } + // Retry a non-failfast RPC when + // i) there is a connection error; or + // ii) the server started to drain before this RPC was initiated. + if _, ok := err.(transport.ConnectionError); ok || err == transport.ErrStreamDrain { + if c.failFast { + return toRPCErr(err) + } + continue + } + return toRPCErr(err) + } + err = recvResponse(ctx, cc.dopts, t, &c, stream, reply) + if err != nil { + if put != nil { + put() + put = nil + } + if _, ok := err.(transport.ConnectionError); ok || err == transport.ErrStreamDrain { + if c.failFast { + return toRPCErr(err) + } + continue + } + return toRPCErr(err) + } + if c.traceInfo.tr != nil { + c.traceInfo.tr.LazyLog(&payload{sent: false, msg: reply}, true) + } + t.CloseStream(stream, nil) + if put != nil { + put() + put = nil + } + return Errorf(stream.StatusCode(), "%s", stream.StatusDesc()) + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/clientconn.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/clientconn.go new file mode 100644 index 00000000000..9858fe574d7 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/clientconn.go @@ -0,0 +1,1006 @@ +/* + * + * Copyright 2014, Google Inc. + * 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. + * + */ + +package grpc + +import ( + "errors" + "fmt" + "math" + "net" + "strings" + "sync" + "time" + + "golang.org/x/net/context" + "golang.org/x/net/trace" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/keepalive" + "google.golang.org/grpc/stats" + "google.golang.org/grpc/transport" +) + +var ( + // ErrClientConnClosing indicates that the operation is illegal because + // the ClientConn is closing. + ErrClientConnClosing = errors.New("grpc: the client connection is closing") + // ErrClientConnTimeout indicates that the ClientConn cannot establish the + // underlying connections within the specified timeout. + // DEPRECATED: Please use context.DeadlineExceeded instead. This error will be + // removed in Q1 2017. + ErrClientConnTimeout = errors.New("grpc: timed out when dialing") + + // errNoTransportSecurity indicates that there is no transport security + // being set for ClientConn. Users should either set one or explicitly + // call WithInsecure DialOption to disable security. + errNoTransportSecurity = errors.New("grpc: no transport security set (use grpc.WithInsecure() explicitly or set credentials)") + // errTransportCredentialsMissing indicates that users want to transmit security + // information (e.g., oauth2 token) which requires secure connection on an insecure + // connection. + errTransportCredentialsMissing = errors.New("grpc: the credentials require transport level security (use grpc.WithTransportCredentials() to set)") + // errCredentialsConflict indicates that grpc.WithTransportCredentials() + // and grpc.WithInsecure() are both called for a connection. + errCredentialsConflict = errors.New("grpc: transport credentials are set for an insecure connection (grpc.WithTransportCredentials() and grpc.WithInsecure() are both called)") + // errNetworkIO indicates that the connection is down due to some network I/O error. + errNetworkIO = errors.New("grpc: failed with network I/O error") + // errConnDrain indicates that the connection starts to be drained and does not accept any new RPCs. + errConnDrain = errors.New("grpc: the connection is drained") + // errConnClosing indicates that the connection is closing. + errConnClosing = errors.New("grpc: the connection is closing") + // errConnUnavailable indicates that the connection is unavailable. + errConnUnavailable = errors.New("grpc: the connection is unavailable") + errNoAddr = errors.New("grpc: there is no address available to dial") + // minimum time to give a connection to complete + minConnectTimeout = 20 * time.Second +) + +// dialOptions configure a Dial call. dialOptions are set by the DialOption +// values passed to Dial. +type dialOptions struct { + unaryInt UnaryClientInterceptor + streamInt StreamClientInterceptor + codec Codec + cp Compressor + dc Decompressor + bs backoffStrategy + balancer Balancer + block bool + insecure bool + timeout time.Duration + scChan <-chan ServiceConfig + copts transport.ConnectOptions + maxMsgSize int +} + +const defaultClientMaxMsgSize = math.MaxInt32 + +// DialOption configures how we set up the connection. +type DialOption func(*dialOptions) + +// WithMaxMsgSize returns a DialOption which sets the maximum message size the client can receive. +func WithMaxMsgSize(s int) DialOption { + return func(o *dialOptions) { + o.maxMsgSize = s + } +} + +// WithCodec returns a DialOption which sets a codec for message marshaling and unmarshaling. +func WithCodec(c Codec) DialOption { + return func(o *dialOptions) { + o.codec = c + } +} + +// WithCompressor returns a DialOption which sets a CompressorGenerator for generating message +// compressor. +func WithCompressor(cp Compressor) DialOption { + return func(o *dialOptions) { + o.cp = cp + } +} + +// WithDecompressor returns a DialOption which sets a DecompressorGenerator for generating +// message decompressor. +func WithDecompressor(dc Decompressor) DialOption { + return func(o *dialOptions) { + o.dc = dc + } +} + +// WithBalancer returns a DialOption which sets a load balancer. +func WithBalancer(b Balancer) DialOption { + return func(o *dialOptions) { + o.balancer = b + } +} + +// WithServiceConfig returns a DialOption which has a channel to read the service configuration. +func WithServiceConfig(c <-chan ServiceConfig) DialOption { + return func(o *dialOptions) { + o.scChan = c + } +} + +// WithBackoffMaxDelay configures the dialer to use the provided maximum delay +// when backing off after failed connection attempts. +func WithBackoffMaxDelay(md time.Duration) DialOption { + return WithBackoffConfig(BackoffConfig{MaxDelay: md}) +} + +// WithBackoffConfig configures the dialer to use the provided backoff +// parameters after connection failures. +// +// Use WithBackoffMaxDelay until more parameters on BackoffConfig are opened up +// for use. +func WithBackoffConfig(b BackoffConfig) DialOption { + // Set defaults to ensure that provided BackoffConfig is valid and + // unexported fields get default values. + setDefaults(&b) + return withBackoff(b) +} + +// withBackoff sets the backoff strategy used for retries after a +// failed connection attempt. +// +// This can be exported if arbitrary backoff strategies are allowed by gRPC. +func withBackoff(bs backoffStrategy) DialOption { + return func(o *dialOptions) { + o.bs = bs + } +} + +// WithBlock returns a DialOption which makes caller of Dial blocks until the underlying +// connection is up. Without this, Dial returns immediately and connecting the server +// happens in background. +func WithBlock() DialOption { + return func(o *dialOptions) { + o.block = true + } +} + +// WithInsecure returns a DialOption which disables transport security for this ClientConn. +// Note that transport security is required unless WithInsecure is set. +func WithInsecure() DialOption { + return func(o *dialOptions) { + o.insecure = true + } +} + +// WithTransportCredentials returns a DialOption which configures a +// connection level security credentials (e.g., TLS/SSL). +func WithTransportCredentials(creds credentials.TransportCredentials) DialOption { + return func(o *dialOptions) { + o.copts.TransportCredentials = creds + } +} + +// WithPerRPCCredentials returns a DialOption which sets +// credentials which will place auth state on each outbound RPC. +func WithPerRPCCredentials(creds credentials.PerRPCCredentials) DialOption { + return func(o *dialOptions) { + o.copts.PerRPCCredentials = append(o.copts.PerRPCCredentials, creds) + } +} + +// WithTimeout returns a DialOption that configures a timeout for dialing a ClientConn +// initially. This is valid if and only if WithBlock() is present. +func WithTimeout(d time.Duration) DialOption { + return func(o *dialOptions) { + o.timeout = d + } +} + +// WithDialer returns a DialOption that specifies a function to use for dialing network addresses. +// If FailOnNonTempDialError() is set to true, and an error is returned by f, gRPC checks the error's +// Temporary() method to decide if it should try to reconnect to the network address. +func WithDialer(f func(string, time.Duration) (net.Conn, error)) DialOption { + return func(o *dialOptions) { + o.copts.Dialer = func(ctx context.Context, addr string) (net.Conn, error) { + if deadline, ok := ctx.Deadline(); ok { + return f(addr, deadline.Sub(time.Now())) + } + return f(addr, 0) + } + } +} + +// WithStatsHandler returns a DialOption that specifies the stats handler +// for all the RPCs and underlying network connections in this ClientConn. +func WithStatsHandler(h stats.Handler) DialOption { + return func(o *dialOptions) { + o.copts.StatsHandler = h + } +} + +// FailOnNonTempDialError returns a DialOption that specified if gRPC fails on non-temporary dial errors. +// If f is true, and dialer returns a non-temporary error, gRPC will fail the connection to the network +// address and won't try to reconnect. +// The default value of FailOnNonTempDialError is false. +// This is an EXPERIMENTAL API. +func FailOnNonTempDialError(f bool) DialOption { + return func(o *dialOptions) { + o.copts.FailOnNonTempDialError = f + } +} + +// WithUserAgent returns a DialOption that specifies a user agent string for all the RPCs. +func WithUserAgent(s string) DialOption { + return func(o *dialOptions) { + o.copts.UserAgent = s + } +} + +// WithKeepaliveParams returns a DialOption that specifies keepalive paramaters for the client transport. +func WithKeepaliveParams(kp keepalive.ClientParameters) DialOption { + return func(o *dialOptions) { + o.copts.KeepaliveParams = kp + } +} + +// WithUnaryInterceptor returns a DialOption that specifies the interceptor for unary RPCs. +func WithUnaryInterceptor(f UnaryClientInterceptor) DialOption { + return func(o *dialOptions) { + o.unaryInt = f + } +} + +// WithStreamInterceptor returns a DialOption that specifies the interceptor for streaming RPCs. +func WithStreamInterceptor(f StreamClientInterceptor) DialOption { + return func(o *dialOptions) { + o.streamInt = f + } +} + +// WithAuthority returns a DialOption that specifies the value to be used as +// the :authority pseudo-header. This value only works with WithInsecure and +// has no effect if TransportCredentials are present. +func WithAuthority(a string) DialOption { + return func(o *dialOptions) { + o.copts.Authority = a + } +} + +// Dial creates a client connection to the given target. +func Dial(target string, opts ...DialOption) (*ClientConn, error) { + return DialContext(context.Background(), target, opts...) +} + +// DialContext creates a client connection to the given target. ctx can be used to +// cancel or expire the pending connecting. Once this function returns, the +// cancellation and expiration of ctx will be noop. Users should call ClientConn.Close +// to terminate all the pending operations after this function returns. +// This is the EXPERIMENTAL API. +func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *ClientConn, err error) { + cc := &ClientConn{ + target: target, + conns: make(map[Address]*addrConn), + } + cc.ctx, cc.cancel = context.WithCancel(context.Background()) + cc.dopts.maxMsgSize = defaultClientMaxMsgSize + for _, opt := range opts { + opt(&cc.dopts) + } + + grpcUA := "grpc-go/" + Version + if cc.dopts.copts.UserAgent != "" { + cc.dopts.copts.UserAgent += " " + grpcUA + } else { + cc.dopts.copts.UserAgent = grpcUA + } + + if cc.dopts.timeout > 0 { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, cc.dopts.timeout) + defer cancel() + } + + defer func() { + select { + case <-ctx.Done(): + conn, err = nil, ctx.Err() + default: + } + + if err != nil { + cc.Close() + } + }() + + if cc.dopts.scChan != nil { + // Wait for the initial service config. + select { + case sc, ok := <-cc.dopts.scChan: + if ok { + cc.sc = sc + } + case <-ctx.Done(): + return nil, ctx.Err() + } + } + // Set defaults. + if cc.dopts.codec == nil { + cc.dopts.codec = protoCodec{} + } + if cc.dopts.bs == nil { + cc.dopts.bs = DefaultBackoffConfig + } + creds := cc.dopts.copts.TransportCredentials + if creds != nil && creds.Info().ServerName != "" { + cc.authority = creds.Info().ServerName + } else if cc.dopts.insecure && cc.dopts.copts.Authority != "" { + cc.authority = cc.dopts.copts.Authority + } else { + colonPos := strings.LastIndex(target, ":") + if colonPos == -1 { + colonPos = len(target) + } + cc.authority = target[:colonPos] + } + var ok bool + waitC := make(chan error, 1) + go func() { + var addrs []Address + if cc.dopts.balancer == nil && cc.sc.LB != nil { + cc.dopts.balancer = cc.sc.LB + } + if cc.dopts.balancer == nil { + // Connect to target directly if balancer is nil. + addrs = append(addrs, Address{Addr: target}) + } else { + var credsClone credentials.TransportCredentials + if creds != nil { + credsClone = creds.Clone() + } + config := BalancerConfig{ + DialCreds: credsClone, + } + if err := cc.dopts.balancer.Start(target, config); err != nil { + waitC <- err + return + } + ch := cc.dopts.balancer.Notify() + if ch == nil { + // There is no name resolver installed. + addrs = append(addrs, Address{Addr: target}) + } else { + addrs, ok = <-ch + if !ok || len(addrs) == 0 { + waitC <- errNoAddr + return + } + } + } + for _, a := range addrs { + if err := cc.resetAddrConn(a, false, nil); err != nil { + waitC <- err + return + } + } + close(waitC) + }() + select { + case <-ctx.Done(): + return nil, ctx.Err() + case err := <-waitC: + if err != nil { + return nil, err + } + } + + // If balancer is nil or balancer.Notify() is nil, ok will be false here. + // The lbWatcher goroutine will not be created. + if ok { + go cc.lbWatcher() + } + + if cc.dopts.scChan != nil { + go cc.scWatcher() + } + return cc, nil +} + +// ConnectivityState indicates the state of a client connection. +type ConnectivityState int + +const ( + // Idle indicates the ClientConn is idle. + Idle ConnectivityState = iota + // Connecting indicates the ClienConn is connecting. + Connecting + // Ready indicates the ClientConn is ready for work. + Ready + // TransientFailure indicates the ClientConn has seen a failure but expects to recover. + TransientFailure + // Shutdown indicates the ClientConn has started shutting down. + Shutdown +) + +func (s ConnectivityState) String() string { + switch s { + case Idle: + return "IDLE" + case Connecting: + return "CONNECTING" + case Ready: + return "READY" + case TransientFailure: + return "TRANSIENT_FAILURE" + case Shutdown: + return "SHUTDOWN" + default: + panic(fmt.Sprintf("unknown connectivity state: %d", s)) + } +} + +// ClientConn represents a client connection to an RPC server. +type ClientConn struct { + ctx context.Context + cancel context.CancelFunc + + target string + authority string + dopts dialOptions + + mu sync.RWMutex + sc ServiceConfig + conns map[Address]*addrConn +} + +func (cc *ClientConn) lbWatcher() { + for addrs := range cc.dopts.balancer.Notify() { + var ( + add []Address // Addresses need to setup connections. + del []*addrConn // Connections need to tear down. + ) + cc.mu.Lock() + for _, a := range addrs { + if _, ok := cc.conns[a]; !ok { + add = append(add, a) + } + } + for k, c := range cc.conns { + var keep bool + for _, a := range addrs { + if k == a { + keep = true + break + } + } + if !keep { + del = append(del, c) + delete(cc.conns, c.addr) + } + } + cc.mu.Unlock() + for _, a := range add { + cc.resetAddrConn(a, true, nil) + } + for _, c := range del { + c.tearDown(errConnDrain) + } + } +} + +func (cc *ClientConn) scWatcher() { + for { + select { + case sc, ok := <-cc.dopts.scChan: + if !ok { + return + } + cc.mu.Lock() + // TODO: load balance policy runtime change is ignored. + // We may revist this decision in the future. + cc.sc = sc + cc.mu.Unlock() + case <-cc.ctx.Done(): + return + } + } +} + +// resetAddrConn creates an addrConn for addr and adds it to cc.conns. +// If there is an old addrConn for addr, it will be torn down, using tearDownErr as the reason. +// If tearDownErr is nil, errConnDrain will be used instead. +func (cc *ClientConn) resetAddrConn(addr Address, skipWait bool, tearDownErr error) error { + ac := &addrConn{ + cc: cc, + addr: addr, + dopts: cc.dopts, + } + ac.ctx, ac.cancel = context.WithCancel(cc.ctx) + ac.stateCV = sync.NewCond(&ac.mu) + if EnableTracing { + ac.events = trace.NewEventLog("grpc.ClientConn", ac.addr.Addr) + } + if !ac.dopts.insecure { + if ac.dopts.copts.TransportCredentials == nil { + return errNoTransportSecurity + } + } else { + if ac.dopts.copts.TransportCredentials != nil { + return errCredentialsConflict + } + for _, cd := range ac.dopts.copts.PerRPCCredentials { + if cd.RequireTransportSecurity() { + return errTransportCredentialsMissing + } + } + } + // Track ac in cc. This needs to be done before any getTransport(...) is called. + cc.mu.Lock() + if cc.conns == nil { + cc.mu.Unlock() + return ErrClientConnClosing + } + stale := cc.conns[ac.addr] + cc.conns[ac.addr] = ac + cc.mu.Unlock() + if stale != nil { + // There is an addrConn alive on ac.addr already. This could be due to + // 1) a buggy Balancer notifies duplicated Addresses; + // 2) goaway was received, a new ac will replace the old ac. + // The old ac should be deleted from cc.conns, but the + // underlying transport should drain rather than close. + if tearDownErr == nil { + // tearDownErr is nil if resetAddrConn is called by + // 1) Dial + // 2) lbWatcher + // In both cases, the stale ac should drain, not close. + stale.tearDown(errConnDrain) + } else { + stale.tearDown(tearDownErr) + } + } + // skipWait may overwrite the decision in ac.dopts.block. + if ac.dopts.block && !skipWait { + if err := ac.resetTransport(false); err != nil { + if err != errConnClosing { + // Tear down ac and delete it from cc.conns. + cc.mu.Lock() + delete(cc.conns, ac.addr) + cc.mu.Unlock() + ac.tearDown(err) + } + if e, ok := err.(transport.ConnectionError); ok && !e.Temporary() { + return e.Origin() + } + return err + } + // Start to monitor the error status of transport. + go ac.transportMonitor() + } else { + // Start a goroutine connecting to the server asynchronously. + go func() { + if err := ac.resetTransport(false); err != nil { + grpclog.Printf("Failed to dial %s: %v; please retry.", ac.addr.Addr, err) + if err != errConnClosing { + // Keep this ac in cc.conns, to get the reason it's torn down. + ac.tearDown(err) + } + return + } + ac.transportMonitor() + }() + } + return nil +} + +// TODO: Avoid the locking here. +func (cc *ClientConn) getMethodConfig(method string) (m MethodConfig, ok bool) { + cc.mu.RLock() + defer cc.mu.RUnlock() + m, ok = cc.sc.Methods[method] + return +} + +func (cc *ClientConn) getTransport(ctx context.Context, opts BalancerGetOptions) (transport.ClientTransport, func(), error) { + var ( + ac *addrConn + ok bool + put func() + ) + if cc.dopts.balancer == nil { + // If balancer is nil, there should be only one addrConn available. + cc.mu.RLock() + if cc.conns == nil { + cc.mu.RUnlock() + return nil, nil, toRPCErr(ErrClientConnClosing) + } + for _, ac = range cc.conns { + // Break after the first iteration to get the first addrConn. + ok = true + break + } + cc.mu.RUnlock() + } else { + var ( + addr Address + err error + ) + addr, put, err = cc.dopts.balancer.Get(ctx, opts) + if err != nil { + return nil, nil, toRPCErr(err) + } + cc.mu.RLock() + if cc.conns == nil { + cc.mu.RUnlock() + return nil, nil, toRPCErr(ErrClientConnClosing) + } + ac, ok = cc.conns[addr] + cc.mu.RUnlock() + } + if !ok { + if put != nil { + put() + } + return nil, nil, errConnClosing + } + t, err := ac.wait(ctx, cc.dopts.balancer != nil, !opts.BlockingWait) + if err != nil { + if put != nil { + put() + } + return nil, nil, err + } + return t, put, nil +} + +// Close tears down the ClientConn and all underlying connections. +func (cc *ClientConn) Close() error { + cc.cancel() + + cc.mu.Lock() + if cc.conns == nil { + cc.mu.Unlock() + return ErrClientConnClosing + } + conns := cc.conns + cc.conns = nil + cc.mu.Unlock() + if cc.dopts.balancer != nil { + cc.dopts.balancer.Close() + } + for _, ac := range conns { + ac.tearDown(ErrClientConnClosing) + } + return nil +} + +// addrConn is a network connection to a given address. +type addrConn struct { + ctx context.Context + cancel context.CancelFunc + + cc *ClientConn + addr Address + dopts dialOptions + events trace.EventLog + + mu sync.Mutex + state ConnectivityState + stateCV *sync.Cond + down func(error) // the handler called when a connection is down. + // ready is closed and becomes nil when a new transport is up or failed + // due to timeout. + ready chan struct{} + transport transport.ClientTransport + + // The reason this addrConn is torn down. + tearDownErr error +} + +// printf records an event in ac's event log, unless ac has been closed. +// REQUIRES ac.mu is held. +func (ac *addrConn) printf(format string, a ...interface{}) { + if ac.events != nil { + ac.events.Printf(format, a...) + } +} + +// errorf records an error in ac's event log, unless ac has been closed. +// REQUIRES ac.mu is held. +func (ac *addrConn) errorf(format string, a ...interface{}) { + if ac.events != nil { + ac.events.Errorf(format, a...) + } +} + +// getState returns the connectivity state of the Conn +func (ac *addrConn) getState() ConnectivityState { + ac.mu.Lock() + defer ac.mu.Unlock() + return ac.state +} + +// waitForStateChange blocks until the state changes to something other than the sourceState. +func (ac *addrConn) waitForStateChange(ctx context.Context, sourceState ConnectivityState) (ConnectivityState, error) { + ac.mu.Lock() + defer ac.mu.Unlock() + if sourceState != ac.state { + return ac.state, nil + } + done := make(chan struct{}) + var err error + go func() { + select { + case <-ctx.Done(): + ac.mu.Lock() + err = ctx.Err() + ac.stateCV.Broadcast() + ac.mu.Unlock() + case <-done: + } + }() + defer close(done) + for sourceState == ac.state { + ac.stateCV.Wait() + if err != nil { + return ac.state, err + } + } + return ac.state, nil +} + +func (ac *addrConn) resetTransport(closeTransport bool) error { + for retries := 0; ; retries++ { + ac.mu.Lock() + ac.printf("connecting") + if ac.state == Shutdown { + // ac.tearDown(...) has been invoked. + ac.mu.Unlock() + return errConnClosing + } + if ac.down != nil { + ac.down(downErrorf(false, true, "%v", errNetworkIO)) + ac.down = nil + } + ac.state = Connecting + ac.stateCV.Broadcast() + t := ac.transport + ac.mu.Unlock() + if closeTransport && t != nil { + t.Close() + } + sleepTime := ac.dopts.bs.backoff(retries) + timeout := minConnectTimeout + if timeout < sleepTime { + timeout = sleepTime + } + ctx, cancel := context.WithTimeout(ac.ctx, timeout) + connectTime := time.Now() + sinfo := transport.TargetInfo{ + Addr: ac.addr.Addr, + Metadata: ac.addr.Metadata, + } + newTransport, err := transport.NewClientTransport(ctx, sinfo, ac.dopts.copts) + // Don't call cancel in success path due to a race in Go 1.6: + // https://github.com/golang/go/issues/15078. + if err != nil { + cancel() + + if e, ok := err.(transport.ConnectionError); ok && !e.Temporary() { + return err + } + grpclog.Printf("grpc: addrConn.resetTransport failed to create client transport: %v; Reconnecting to %v", err, ac.addr) + ac.mu.Lock() + if ac.state == Shutdown { + // ac.tearDown(...) has been invoked. + ac.mu.Unlock() + return errConnClosing + } + ac.errorf("transient failure: %v", err) + ac.state = TransientFailure + ac.stateCV.Broadcast() + if ac.ready != nil { + close(ac.ready) + ac.ready = nil + } + ac.mu.Unlock() + closeTransport = false + select { + case <-time.After(sleepTime - time.Since(connectTime)): + case <-ac.ctx.Done(): + return ac.ctx.Err() + } + continue + } + ac.mu.Lock() + ac.printf("ready") + if ac.state == Shutdown { + // ac.tearDown(...) has been invoked. + ac.mu.Unlock() + newTransport.Close() + return errConnClosing + } + ac.state = Ready + ac.stateCV.Broadcast() + ac.transport = newTransport + if ac.ready != nil { + close(ac.ready) + ac.ready = nil + } + if ac.cc.dopts.balancer != nil { + ac.down = ac.cc.dopts.balancer.Up(ac.addr) + } + ac.mu.Unlock() + return nil + } +} + +// Run in a goroutine to track the error in transport and create the +// new transport if an error happens. It returns when the channel is closing. +func (ac *addrConn) transportMonitor() { + for { + ac.mu.Lock() + t := ac.transport + ac.mu.Unlock() + select { + // This is needed to detect the teardown when + // the addrConn is idle (i.e., no RPC in flight). + case <-ac.ctx.Done(): + select { + case <-t.Error(): + t.Close() + default: + } + return + case <-t.GoAway(): + // If GoAway happens without any network I/O error, ac is closed without shutting down the + // underlying transport (the transport will be closed when all the pending RPCs finished or + // failed.). + // If GoAway and some network I/O error happen concurrently, ac and its underlying transport + // are closed. + // In both cases, a new ac is created. + select { + case <-t.Error(): + ac.cc.resetAddrConn(ac.addr, true, errNetworkIO) + default: + ac.cc.resetAddrConn(ac.addr, true, errConnDrain) + } + return + case <-t.Error(): + select { + case <-ac.ctx.Done(): + t.Close() + return + case <-t.GoAway(): + ac.cc.resetAddrConn(ac.addr, true, errNetworkIO) + return + default: + } + ac.mu.Lock() + if ac.state == Shutdown { + // ac has been shutdown. + ac.mu.Unlock() + return + } + ac.state = TransientFailure + ac.stateCV.Broadcast() + ac.mu.Unlock() + if err := ac.resetTransport(true); err != nil { + ac.mu.Lock() + ac.printf("transport exiting: %v", err) + ac.mu.Unlock() + grpclog.Printf("grpc: addrConn.transportMonitor exits due to: %v", err) + if err != errConnClosing { + // Keep this ac in cc.conns, to get the reason it's torn down. + ac.tearDown(err) + } + return + } + } + } +} + +// wait blocks until i) the new transport is up or ii) ctx is done or iii) ac is closed or +// iv) transport is in TransientFailure and there is a balancer/failfast is true. +func (ac *addrConn) wait(ctx context.Context, hasBalancer, failfast bool) (transport.ClientTransport, error) { + for { + ac.mu.Lock() + switch { + case ac.state == Shutdown: + if failfast || !hasBalancer { + // RPC is failfast or balancer is nil. This RPC should fail with ac.tearDownErr. + err := ac.tearDownErr + ac.mu.Unlock() + return nil, err + } + ac.mu.Unlock() + return nil, errConnClosing + case ac.state == Ready: + ct := ac.transport + ac.mu.Unlock() + return ct, nil + case ac.state == TransientFailure: + if failfast || hasBalancer { + ac.mu.Unlock() + return nil, errConnUnavailable + } + } + ready := ac.ready + if ready == nil { + ready = make(chan struct{}) + ac.ready = ready + } + ac.mu.Unlock() + select { + case <-ctx.Done(): + return nil, toRPCErr(ctx.Err()) + // Wait until the new transport is ready or failed. + case <-ready: + } + } +} + +// tearDown starts to tear down the addrConn. +// TODO(zhaoq): Make this synchronous to avoid unbounded memory consumption in +// some edge cases (e.g., the caller opens and closes many addrConn's in a +// tight loop. +// tearDown doesn't remove ac from ac.cc.conns. +func (ac *addrConn) tearDown(err error) { + ac.cancel() + + ac.mu.Lock() + defer ac.mu.Unlock() + if ac.down != nil { + ac.down(downErrorf(false, false, "%v", err)) + ac.down = nil + } + if err == errConnDrain && ac.transport != nil { + // GracefulClose(...) may be executed multiple times when + // i) receiving multiple GoAway frames from the server; or + // ii) there are concurrent name resolver/Balancer triggered + // address removal and GoAway. + ac.transport.GracefulClose() + } + if ac.state == Shutdown { + return + } + ac.state = Shutdown + ac.tearDownErr = err + ac.stateCV.Broadcast() + if ac.events != nil { + ac.events.Finish() + ac.events = nil + } + if ac.ready != nil { + close(ac.ready) + ac.ready = nil + } + if ac.transport != nil && err != errConnDrain { + ac.transport.Close() + } + return +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codegen.sh b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codegen.sh new file mode 100755 index 00000000000..4cdc6ba7c09 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codegen.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +# This script serves as an example to demonstrate how to generate the gRPC-Go +# interface and the related messages from .proto file. +# +# It assumes the installation of i) Google proto buffer compiler at +# https://github.com/google/protobuf (after v2.6.1) and ii) the Go codegen +# plugin at https://github.com/golang/protobuf (after 2015-02-20). If you have +# not, please install them first. +# +# We recommend running this script at $GOPATH/src. +# +# If this is not what you need, feel free to make your own scripts. Again, this +# script is for demonstration purpose. +# +proto=$1 +protoc --go_out=plugins=grpc:. $proto diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codes/code_string.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codes/code_string.go new file mode 100644 index 00000000000..e6762d08455 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codes/code_string.go @@ -0,0 +1,16 @@ +// generated by stringer -type=Code; DO NOT EDIT + +package codes + +import "fmt" + +const _Code_name = "OKCanceledUnknownInvalidArgumentDeadlineExceededNotFoundAlreadyExistsPermissionDeniedResourceExhaustedFailedPreconditionAbortedOutOfRangeUnimplementedInternalUnavailableDataLossUnauthenticated" + +var _Code_index = [...]uint8{0, 2, 10, 17, 32, 48, 56, 69, 85, 102, 120, 127, 137, 150, 158, 169, 177, 192} + +func (i Code) String() string { + if i+1 >= Code(len(_Code_index)) { + return fmt.Sprintf("Code(%d)", i) + } + return _Code_name[_Code_index[i]:_Code_index[i+1]] +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codes/codes.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codes/codes.go new file mode 100644 index 00000000000..e14b464acfd --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codes/codes.go @@ -0,0 +1,159 @@ +/* + * + * Copyright 2014, Google Inc. + * 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. + * + */ + +// Package codes defines the canonical error codes used by gRPC. It is +// consistent across various languages. +package codes // import "google.golang.org/grpc/codes" + +// A Code is an unsigned 32-bit error code as defined in the gRPC spec. +type Code uint32 + +//go:generate stringer -type=Code + +const ( + // OK is returned on success. + OK Code = 0 + + // Canceled indicates the operation was cancelled (typically by the caller). + Canceled Code = 1 + + // Unknown error. An example of where this error may be returned is + // if a Status value received from another address space belongs to + // an error-space that is not known in this address space. Also + // errors raised by APIs that do not return enough error information + // may be converted to this error. + Unknown Code = 2 + + // InvalidArgument indicates client specified an invalid argument. + // Note that this differs from FailedPrecondition. It indicates arguments + // that are problematic regardless of the state of the system + // (e.g., a malformed file name). + InvalidArgument Code = 3 + + // DeadlineExceeded means operation expired before completion. + // For operations that change the state of the system, this error may be + // returned even if the operation has completed successfully. For + // example, a successful response from a server could have been delayed + // long enough for the deadline to expire. + DeadlineExceeded Code = 4 + + // NotFound means some requested entity (e.g., file or directory) was + // not found. + NotFound Code = 5 + + // AlreadyExists means an attempt to create an entity failed because one + // already exists. + AlreadyExists Code = 6 + + // PermissionDenied indicates the caller does not have permission to + // execute the specified operation. It must not be used for rejections + // caused by exhausting some resource (use ResourceExhausted + // instead for those errors). It must not be + // used if the caller cannot be identified (use Unauthenticated + // instead for those errors). + PermissionDenied Code = 7 + + // Unauthenticated indicates the request does not have valid + // authentication credentials for the operation. + Unauthenticated Code = 16 + + // ResourceExhausted indicates some resource has been exhausted, perhaps + // a per-user quota, or perhaps the entire file system is out of space. + ResourceExhausted Code = 8 + + // FailedPrecondition indicates operation was rejected because the + // system is not in a state required for the operation's execution. + // For example, directory to be deleted may be non-empty, an rmdir + // operation is applied to a non-directory, etc. + // + // A litmus test that may help a service implementor in deciding + // between FailedPrecondition, Aborted, and Unavailable: + // (a) Use Unavailable if the client can retry just the failing call. + // (b) Use Aborted if the client should retry at a higher-level + // (e.g., restarting a read-modify-write sequence). + // (c) Use FailedPrecondition if the client should not retry until + // the system state has been explicitly fixed. E.g., if an "rmdir" + // fails because the directory is non-empty, FailedPrecondition + // should be returned since the client should not retry unless + // they have first fixed up the directory by deleting files from it. + // (d) Use FailedPrecondition if the client performs conditional + // REST Get/Update/Delete on a resource and the resource on the + // server does not match the condition. E.g., conflicting + // read-modify-write on the same resource. + FailedPrecondition Code = 9 + + // Aborted indicates the operation was aborted, typically due to a + // concurrency issue like sequencer check failures, transaction aborts, + // etc. + // + // See litmus test above for deciding between FailedPrecondition, + // Aborted, and Unavailable. + Aborted Code = 10 + + // OutOfRange means operation was attempted past the valid range. + // E.g., seeking or reading past end of file. + // + // Unlike InvalidArgument, this error indicates a problem that may + // be fixed if the system state changes. For example, a 32-bit file + // system will generate InvalidArgument if asked to read at an + // offset that is not in the range [0,2^32-1], but it will generate + // OutOfRange if asked to read from an offset past the current + // file size. + // + // There is a fair bit of overlap between FailedPrecondition and + // OutOfRange. We recommend using OutOfRange (the more specific + // error) when it applies so that callers who are iterating through + // a space can easily look for an OutOfRange error to detect when + // they are done. + OutOfRange Code = 11 + + // Unimplemented indicates operation is not implemented or not + // supported/enabled in this service. + Unimplemented Code = 12 + + // Internal errors. Means some invariants expected by underlying + // system has been broken. If you see one of these errors, + // something is very broken. + Internal Code = 13 + + // Unavailable indicates the service is currently unavailable. + // This is a most likely a transient condition and may be corrected + // by retrying with a backoff. + // + // See litmus test above for deciding between FailedPrecondition, + // Aborted, and Unavailable. + Unavailable Code = 14 + + // DataLoss indicates unrecoverable data loss or corruption. + DataLoss Code = 15 +) diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/coverage.sh b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/coverage.sh new file mode 100755 index 00000000000..b85f9181dee --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/coverage.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + + +set -e + +workdir=.cover +profile="$workdir/cover.out" +mode=set +end2endtest="google.golang.org/grpc/test" + +generate_cover_data() { + rm -rf "$workdir" + mkdir "$workdir" + + for pkg in "$@"; do + if [ $pkg == "google.golang.org/grpc" -o $pkg == "google.golang.org/grpc/transport" -o $pkg == "google.golang.org/grpc/metadata" -o $pkg == "google.golang.org/grpc/credentials" ] + then + f="$workdir/$(echo $pkg | tr / -)" + go test -covermode="$mode" -coverprofile="$f.cover" "$pkg" + go test -covermode="$mode" -coverpkg "$pkg" -coverprofile="$f.e2e.cover" "$end2endtest" + fi + done + + echo "mode: $mode" >"$profile" + grep -h -v "^mode:" "$workdir"/*.cover >>"$profile" +} + +show_cover_report() { + go tool cover -${1}="$profile" +} + +push_to_coveralls() { + goveralls -coverprofile="$profile" +} + +generate_cover_data $(go list ./...) +show_cover_report func +case "$1" in +"") + ;; +--html) + show_cover_report html ;; +--coveralls) + push_to_coveralls ;; +*) + echo >&2 "error: invalid option: $1" ;; +esac +rm -rf "$workdir" diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials.go new file mode 100644 index 00000000000..4d45c3e3c7f --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials.go @@ -0,0 +1,230 @@ +/* + * + * Copyright 2014, Google Inc. + * 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. + * + */ + +// Package credentials implements various credentials supported by gRPC library, +// which encapsulate all the state needed by a client to authenticate with a +// server and make various assertions, e.g., about the client's identity, role, +// or whether it is authorized to make a particular call. +package credentials // import "google.golang.org/grpc/credentials" + +import ( + "crypto/tls" + "crypto/x509" + "errors" + "fmt" + "io/ioutil" + "net" + "strings" + + "golang.org/x/net/context" +) + +var ( + // alpnProtoStr are the specified application level protocols for gRPC. + alpnProtoStr = []string{"h2"} +) + +// PerRPCCredentials defines the common interface for the credentials which need to +// attach security information to every RPC (e.g., oauth2). +type PerRPCCredentials interface { + // GetRequestMetadata gets the current request metadata, refreshing + // tokens if required. This should be called by the transport layer on + // each request, and the data should be populated in headers or other + // context. uri is the URI of the entry point for the request. When + // supported by the underlying implementation, ctx can be used for + // timeout and cancellation. + // TODO(zhaoq): Define the set of the qualified keys instead of leaving + // it as an arbitrary string. + GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) + // RequireTransportSecurity indicates whether the credentials requires + // transport security. + RequireTransportSecurity() bool +} + +// ProtocolInfo provides information regarding the gRPC wire protocol version, +// security protocol, security protocol version in use, server name, etc. +type ProtocolInfo struct { + // ProtocolVersion is the gRPC wire protocol version. + ProtocolVersion string + // SecurityProtocol is the security protocol in use. + SecurityProtocol string + // SecurityVersion is the security protocol version. + SecurityVersion string + // ServerName is the user-configured server name. + ServerName string +} + +// AuthInfo defines the common interface for the auth information the users are interested in. +type AuthInfo interface { + AuthType() string +} + +var ( + // ErrConnDispatched indicates that rawConn has been dispatched out of gRPC + // and the caller should not close rawConn. + ErrConnDispatched = errors.New("credentials: rawConn is dispatched out of gRPC") +) + +// TransportCredentials defines the common interface for all the live gRPC wire +// protocols and supported transport security protocols (e.g., TLS, SSL). +type TransportCredentials interface { + // ClientHandshake does the authentication handshake specified by the corresponding + // authentication protocol on rawConn for clients. It returns the authenticated + // connection and the corresponding auth information about the connection. + // Implementations must use the provided context to implement timely cancellation. + ClientHandshake(context.Context, string, net.Conn) (net.Conn, AuthInfo, error) + // ServerHandshake does the authentication handshake for servers. It returns + // the authenticated connection and the corresponding auth information about + // the connection. + ServerHandshake(net.Conn) (net.Conn, AuthInfo, error) + // Info provides the ProtocolInfo of this TransportCredentials. + Info() ProtocolInfo + // Clone makes a copy of this TransportCredentials. + Clone() TransportCredentials + // OverrideServerName overrides the server name used to verify the hostname on the returned certificates from the server. + // gRPC internals also use it to override the virtual hosting name if it is set. + // It must be called before dialing. Currently, this is only used by grpclb. + OverrideServerName(string) error +} + +// TLSInfo contains the auth information for a TLS authenticated connection. +// It implements the AuthInfo interface. +type TLSInfo struct { + State tls.ConnectionState +} + +// AuthType returns the type of TLSInfo as a string. +func (t TLSInfo) AuthType() string { + return "tls" +} + +// tlsCreds is the credentials required for authenticating a connection using TLS. +type tlsCreds struct { + // TLS configuration + config *tls.Config +} + +func (c tlsCreds) Info() ProtocolInfo { + return ProtocolInfo{ + SecurityProtocol: "tls", + SecurityVersion: "1.2", + ServerName: c.config.ServerName, + } +} + +func (c *tlsCreds) ClientHandshake(ctx context.Context, addr string, rawConn net.Conn) (_ net.Conn, _ AuthInfo, err error) { + // use local cfg to avoid clobbering ServerName if using multiple endpoints + cfg := cloneTLSConfig(c.config) + if cfg.ServerName == "" { + colonPos := strings.LastIndex(addr, ":") + if colonPos == -1 { + colonPos = len(addr) + } + cfg.ServerName = addr[:colonPos] + } + conn := tls.Client(rawConn, cfg) + errChannel := make(chan error, 1) + go func() { + errChannel <- conn.Handshake() + }() + select { + case err := <-errChannel: + if err != nil { + return nil, nil, err + } + case <-ctx.Done(): + return nil, nil, ctx.Err() + } + return conn, TLSInfo{conn.ConnectionState()}, nil +} + +func (c *tlsCreds) ServerHandshake(rawConn net.Conn) (net.Conn, AuthInfo, error) { + conn := tls.Server(rawConn, c.config) + if err := conn.Handshake(); err != nil { + return nil, nil, err + } + return conn, TLSInfo{conn.ConnectionState()}, nil +} + +func (c *tlsCreds) Clone() TransportCredentials { + return NewTLS(c.config) +} + +func (c *tlsCreds) OverrideServerName(serverNameOverride string) error { + c.config.ServerName = serverNameOverride + return nil +} + +// NewTLS uses c to construct a TransportCredentials based on TLS. +func NewTLS(c *tls.Config) TransportCredentials { + tc := &tlsCreds{cloneTLSConfig(c)} + tc.config.NextProtos = alpnProtoStr + return tc +} + +// NewClientTLSFromCert constructs a TLS from the input certificate for client. +// serverNameOverride is for testing only. If set to a non empty string, +// it will override the virtual host name of authority (e.g. :authority header field) in requests. +func NewClientTLSFromCert(cp *x509.CertPool, serverNameOverride string) TransportCredentials { + return NewTLS(&tls.Config{ServerName: serverNameOverride, RootCAs: cp}) +} + +// NewClientTLSFromFile constructs a TLS from the input certificate file for client. +// serverNameOverride is for testing only. If set to a non empty string, +// it will override the virtual host name of authority (e.g. :authority header field) in requests. +func NewClientTLSFromFile(certFile, serverNameOverride string) (TransportCredentials, error) { + b, err := ioutil.ReadFile(certFile) + if err != nil { + return nil, err + } + cp := x509.NewCertPool() + if !cp.AppendCertsFromPEM(b) { + return nil, fmt.Errorf("credentials: failed to append certificates") + } + return NewTLS(&tls.Config{ServerName: serverNameOverride, RootCAs: cp}), nil +} + +// NewServerTLSFromCert constructs a TLS from the input certificate for server. +func NewServerTLSFromCert(cert *tls.Certificate) TransportCredentials { + return NewTLS(&tls.Config{Certificates: []tls.Certificate{*cert}}) +} + +// NewServerTLSFromFile constructs a TLS from the input certificate file and key +// file for server. +func NewServerTLSFromFile(certFile, keyFile string) (TransportCredentials, error) { + cert, err := tls.LoadX509KeyPair(certFile, keyFile) + if err != nil { + return nil, err + } + return NewTLS(&tls.Config{Certificates: []tls.Certificate{cert}}), nil +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_go17.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_go17.go new file mode 100644 index 00000000000..7597b09e358 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_go17.go @@ -0,0 +1,75 @@ +// +build go1.7 +// +build !go1.8 + +/* + * + * Copyright 2016, Google Inc. + * 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. + * + */ + +package credentials + +import ( + "crypto/tls" +) + +// cloneTLSConfig returns a shallow clone of the exported +// fields of cfg, ignoring the unexported sync.Once, which +// contains a mutex and must not be copied. +// +// If cfg is nil, a new zero tls.Config is returned. +func cloneTLSConfig(cfg *tls.Config) *tls.Config { + if cfg == nil { + return &tls.Config{} + } + return &tls.Config{ + Rand: cfg.Rand, + Time: cfg.Time, + Certificates: cfg.Certificates, + NameToCertificate: cfg.NameToCertificate, + GetCertificate: cfg.GetCertificate, + RootCAs: cfg.RootCAs, + NextProtos: cfg.NextProtos, + ServerName: cfg.ServerName, + ClientAuth: cfg.ClientAuth, + ClientCAs: cfg.ClientCAs, + InsecureSkipVerify: cfg.InsecureSkipVerify, + CipherSuites: cfg.CipherSuites, + PreferServerCipherSuites: cfg.PreferServerCipherSuites, + SessionTicketsDisabled: cfg.SessionTicketsDisabled, + SessionTicketKey: cfg.SessionTicketKey, + ClientSessionCache: cfg.ClientSessionCache, + MinVersion: cfg.MinVersion, + MaxVersion: cfg.MaxVersion, + CurvePreferences: cfg.CurvePreferences, + DynamicRecordSizingDisabled: cfg.DynamicRecordSizingDisabled, + Renegotiation: cfg.Renegotiation, + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_go18.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_go18.go new file mode 100644 index 00000000000..0ecf342da84 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_go18.go @@ -0,0 +1,53 @@ +// +build go1.8 + +/* + * + * Copyright 2017, Google Inc. + * 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. + * + */ + +package credentials + +import ( + "crypto/tls" +) + +// cloneTLSConfig returns a shallow clone of the exported +// fields of cfg, ignoring the unexported sync.Once, which +// contains a mutex and must not be copied. +// +// If cfg is nil, a new zero tls.Config is returned. +func cloneTLSConfig(cfg *tls.Config) *tls.Config { + if cfg == nil { + return &tls.Config{} + } + + return cfg.Clone() +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_pre_go17.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_pre_go17.go new file mode 100644 index 00000000000..cfd40dfa34a --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_pre_go17.go @@ -0,0 +1,72 @@ +// +build !go1.7 + +/* + * + * Copyright 2016, Google Inc. + * 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. + * + */ + +package credentials + +import ( + "crypto/tls" +) + +// cloneTLSConfig returns a shallow clone of the exported +// fields of cfg, ignoring the unexported sync.Once, which +// contains a mutex and must not be copied. +// +// If cfg is nil, a new zero tls.Config is returned. +func cloneTLSConfig(cfg *tls.Config) *tls.Config { + if cfg == nil { + return &tls.Config{} + } + return &tls.Config{ + Rand: cfg.Rand, + Time: cfg.Time, + Certificates: cfg.Certificates, + NameToCertificate: cfg.NameToCertificate, + GetCertificate: cfg.GetCertificate, + RootCAs: cfg.RootCAs, + NextProtos: cfg.NextProtos, + ServerName: cfg.ServerName, + ClientAuth: cfg.ClientAuth, + ClientCAs: cfg.ClientCAs, + InsecureSkipVerify: cfg.InsecureSkipVerify, + CipherSuites: cfg.CipherSuites, + PreferServerCipherSuites: cfg.PreferServerCipherSuites, + SessionTicketsDisabled: cfg.SessionTicketsDisabled, + SessionTicketKey: cfg.SessionTicketKey, + ClientSessionCache: cfg.ClientSessionCache, + MinVersion: cfg.MinVersion, + MaxVersion: cfg.MaxVersion, + CurvePreferences: cfg.CurvePreferences, + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/doc.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/doc.go new file mode 100644 index 00000000000..a35f218852b --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/doc.go @@ -0,0 +1,6 @@ +/* +Package grpc implements an RPC system called gRPC. + +See www.grpc.io for more information about gRPC. +*/ +package grpc // import "google.golang.org/grpc" diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/grpclog/logger.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/grpclog/logger.go new file mode 100644 index 00000000000..3b2933079e9 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/grpclog/logger.go @@ -0,0 +1,93 @@ +/* + * + * Copyright 2015, Google Inc. + * 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. + * + */ + +/* +Package grpclog defines logging for grpc. +*/ +package grpclog // import "google.golang.org/grpc/grpclog" + +import ( + "log" + "os" +) + +// Use golang's standard logger by default. +// Access is not mutex-protected: do not modify except in init() +// functions. +var logger Logger = log.New(os.Stderr, "", log.LstdFlags) + +// Logger mimics golang's standard Logger as an interface. +type Logger interface { + Fatal(args ...interface{}) + Fatalf(format string, args ...interface{}) + Fatalln(args ...interface{}) + Print(args ...interface{}) + Printf(format string, args ...interface{}) + Println(args ...interface{}) +} + +// SetLogger sets the logger that is used in grpc. Call only from +// init() functions. +func SetLogger(l Logger) { + logger = l +} + +// Fatal is equivalent to Print() followed by a call to os.Exit() with a non-zero exit code. +func Fatal(args ...interface{}) { + logger.Fatal(args...) +} + +// Fatalf is equivalent to Printf() followed by a call to os.Exit() with a non-zero exit code. +func Fatalf(format string, args ...interface{}) { + logger.Fatalf(format, args...) +} + +// Fatalln is equivalent to Println() followed by a call to os.Exit()) with a non-zero exit code. +func Fatalln(args ...interface{}) { + logger.Fatalln(args...) +} + +// Print prints to the logger. Arguments are handled in the manner of fmt.Print. +func Print(args ...interface{}) { + logger.Print(args...) +} + +// Printf prints to the logger. Arguments are handled in the manner of fmt.Printf. +func Printf(format string, args ...interface{}) { + logger.Printf(format, args...) +} + +// Println prints to the logger. Arguments are handled in the manner of fmt.Println. +func Println(args ...interface{}) { + logger.Println(args...) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/interceptor.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/interceptor.go new file mode 100644 index 00000000000..8d932efed7e --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/interceptor.go @@ -0,0 +1,90 @@ +/* + * + * Copyright 2016, Google Inc. + * 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. + * + */ + +package grpc + +import ( + "golang.org/x/net/context" +) + +// UnaryInvoker is called by UnaryClientInterceptor to complete RPCs. +type UnaryInvoker func(ctx context.Context, method string, req, reply interface{}, cc *ClientConn, opts ...CallOption) error + +// UnaryClientInterceptor intercepts the execution of a unary RPC on the client. inovker is the handler to complete the RPC +// and it is the responsibility of the interceptor to call it. +// This is the EXPERIMENTAL API. +type UnaryClientInterceptor func(ctx context.Context, method string, req, reply interface{}, cc *ClientConn, invoker UnaryInvoker, opts ...CallOption) error + +// Streamer is called by StreamClientInterceptor to create a ClientStream. +type Streamer func(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (ClientStream, error) + +// StreamClientInterceptor intercepts the creation of ClientStream. It may return a custom ClientStream to intercept all I/O +// operations. streamer is the handlder to create a ClientStream and it is the responsibility of the interceptor to call it. +// This is the EXPERIMENTAL API. +type StreamClientInterceptor func(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, streamer Streamer, opts ...CallOption) (ClientStream, error) + +// UnaryServerInfo consists of various information about a unary RPC on +// server side. All per-rpc information may be mutated by the interceptor. +type UnaryServerInfo struct { + // Server is the service implementation the user provides. This is read-only. + Server interface{} + // FullMethod is the full RPC method string, i.e., /package.service/method. + FullMethod string +} + +// UnaryHandler defines the handler invoked by UnaryServerInterceptor to complete the normal +// execution of a unary RPC. +type UnaryHandler func(ctx context.Context, req interface{}) (interface{}, error) + +// UnaryServerInterceptor provides a hook to intercept the execution of a unary RPC on the server. info +// contains all the information of this RPC the interceptor can operate on. And handler is the wrapper +// of the service method implementation. It is the responsibility of the interceptor to invoke handler +// to complete the RPC. +type UnaryServerInterceptor func(ctx context.Context, req interface{}, info *UnaryServerInfo, handler UnaryHandler) (resp interface{}, err error) + +// StreamServerInfo consists of various information about a streaming RPC on +// server side. All per-rpc information may be mutated by the interceptor. +type StreamServerInfo struct { + // FullMethod is the full RPC method string, i.e., /package.service/method. + FullMethod string + // IsClientStream indicates whether the RPC is a client streaming RPC. + IsClientStream bool + // IsServerStream indicates whether the RPC is a server streaming RPC. + IsServerStream bool +} + +// StreamServerInterceptor provides a hook to intercept the execution of a streaming RPC on the server. +// info contains all the information of this RPC the interceptor can operate on. And handler is the +// service method implementation. It is the responsibility of the interceptor to invoke handler to +// complete the RPC. +type StreamServerInterceptor func(srv interface{}, ss ServerStream, info *StreamServerInfo, handler StreamHandler) error diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/internal/internal.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/internal/internal.go new file mode 100644 index 00000000000..5489143a85c --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/internal/internal.go @@ -0,0 +1,49 @@ +/* + * Copyright 2016, Google Inc. + * 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. + * + */ + +// Package internal contains gRPC-internal code for testing, to avoid polluting +// the godoc of the top-level grpc package. +package internal + +// TestingCloseConns closes all existing transports but keeps +// grpcServer.lis accepting new connections. +// +// The provided grpcServer must be of type *grpc.Server. It is untyped +// for circular dependency reasons. +var TestingCloseConns func(grpcServer interface{}) + +// TestingUseHandlerImpl enables the http.Handler-based server implementation. +// It must be called before Serve and requires TLS credentials. +// +// The provided grpcServer must be of type *grpc.Server. It is untyped +// for circular dependency reasons. +var TestingUseHandlerImpl func(grpcServer interface{}) diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/keepalive/keepalive.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/keepalive/keepalive.go new file mode 100644 index 00000000000..20672e49d90 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/keepalive/keepalive.go @@ -0,0 +1,52 @@ +/* + * + * Copyright 2017, Google Inc. + * 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. + * + */ + +// Package keepalive defines configurable parameters for point-to-point healthcheck. +package keepalive + +import ( + "time" +) + +// ClientParameters is used to set keepalive parameters on the client-side. +// These configure how the client will actively probe to notice when a connection broken +// and to cause activity so intermediaries are aware the connection is still in use. +type ClientParameters struct { + // After a duration of this time if the client doesn't see any activity it pings the server to see if the transport is still alive. + Time time.Duration // The current default value is infinity. + // After having pinged for keepalive check, the client waits for a duration of Timeout and if no activity is seen even after that + // the connection is closed. + Timeout time.Duration // The current default value is 20 seconds. + // If true, client runs keepalive checks even with no active RPCs. + PermitWithoutStream bool +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/metadata/metadata.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/metadata/metadata.go new file mode 100644 index 00000000000..73323950286 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/metadata/metadata.go @@ -0,0 +1,152 @@ +/* + * + * Copyright 2014, Google Inc. + * 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. + * + */ + +// Package metadata define the structure of the metadata supported by gRPC library. +// Please refer to http://www.grpc.io/docs/guides/wire.html for more information about custom-metadata. +package metadata // import "google.golang.org/grpc/metadata" + +import ( + "encoding/base64" + "fmt" + "strings" + + "golang.org/x/net/context" +) + +const ( + binHdrSuffix = "-bin" +) + +// encodeKeyValue encodes key and value qualified for transmission via gRPC. +// Transmitting binary headers violates HTTP/2 spec. +// TODO(zhaoq): Maybe check if k is ASCII also. +func encodeKeyValue(k, v string) (string, string) { + k = strings.ToLower(k) + if strings.HasSuffix(k, binHdrSuffix) { + val := base64.StdEncoding.EncodeToString([]byte(v)) + v = string(val) + } + return k, v +} + +// DecodeKeyValue returns the original key and value corresponding to the +// encoded data in k, v. +// If k is a binary header and v contains comma, v is split on comma before decoded, +// and the decoded v will be joined with comma before returned. +func DecodeKeyValue(k, v string) (string, string, error) { + if !strings.HasSuffix(k, binHdrSuffix) { + return k, v, nil + } + vvs := strings.Split(v, ",") + for i, vv := range vvs { + val, err := base64.StdEncoding.DecodeString(vv) + if err != nil { + return "", "", err + } + vvs[i] = string(val) + } + return k, strings.Join(vvs, ","), nil +} + +// MD is a mapping from metadata keys to values. Users should use the following +// two convenience functions New and Pairs to generate MD. +type MD map[string][]string + +// New creates a MD from given key-value map. +// Keys are automatically converted to lowercase. And for keys having "-bin" as suffix, their values will be applied Base64 encoding. +func New(m map[string]string) MD { + md := MD{} + for k, v := range m { + key, val := encodeKeyValue(k, v) + md[key] = append(md[key], val) + } + return md +} + +// Pairs returns an MD formed by the mapping of key, value ... +// Pairs panics if len(kv) is odd. +// Keys are automatically converted to lowercase. And for keys having "-bin" as suffix, their values will be appplied Base64 encoding. +func Pairs(kv ...string) MD { + if len(kv)%2 == 1 { + panic(fmt.Sprintf("metadata: Pairs got the odd number of input pairs for metadata: %d", len(kv))) + } + md := MD{} + var k string + for i, s := range kv { + if i%2 == 0 { + k = s + continue + } + key, val := encodeKeyValue(k, s) + md[key] = append(md[key], val) + } + return md +} + +// Len returns the number of items in md. +func (md MD) Len() int { + return len(md) +} + +// Copy returns a copy of md. +func (md MD) Copy() MD { + return Join(md) +} + +// Join joins any number of MDs into a single MD. +// The order of values for each key is determined by the order in which +// the MDs containing those values are presented to Join. +func Join(mds ...MD) MD { + out := MD{} + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return out +} + +type mdKey struct{} + +// NewContext creates a new context with md attached. +func NewContext(ctx context.Context, md MD) context.Context { + return context.WithValue(ctx, mdKey{}, md) +} + +// FromContext returns the MD in ctx if it exists. +// The returned md should be immutable, writing to it may cause races. +// Modification should be made to the copies of the returned md. +func FromContext(ctx context.Context) (md MD, ok bool) { + md, ok = ctx.Value(mdKey{}).(MD) + return +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/naming/naming.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/naming/naming.go new file mode 100644 index 00000000000..c2e0871e6f8 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/naming/naming.go @@ -0,0 +1,74 @@ +/* + * + * Copyright 2014, Google Inc. + * 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. + * + */ + +// Package naming defines the naming API and related data structures for gRPC. +// The interface is EXPERIMENTAL and may be suject to change. +package naming + +// Operation defines the corresponding operations for a name resolution change. +type Operation uint8 + +const ( + // Add indicates a new address is added. + Add Operation = iota + // Delete indicates an exisiting address is deleted. + Delete +) + +// Update defines a name resolution update. Notice that it is not valid having both +// empty string Addr and nil Metadata in an Update. +type Update struct { + // Op indicates the operation of the update. + Op Operation + // Addr is the updated address. It is empty string if there is no address update. + Addr string + // Metadata is the updated metadata. It is nil if there is no metadata update. + // Metadata is not required for a custom naming implementation. + Metadata interface{} +} + +// Resolver creates a Watcher for a target to track its resolution changes. +type Resolver interface { + // Resolve creates a Watcher for target. + Resolve(target string) (Watcher, error) +} + +// Watcher watches for the updates on the specified target. +type Watcher interface { + // Next blocks until an update or error happens. It may return one or more + // updates. The first call should get the full set of the results. It should + // return an error if and only if Watcher cannot recover. + Next() ([]*Update, error) + // Close closes the Watcher. + Close() +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/peer/peer.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/peer/peer.go new file mode 100644 index 00000000000..bfa6205ba9e --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/peer/peer.go @@ -0,0 +1,65 @@ +/* + * + * Copyright 2014, Google Inc. + * 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. + * + */ + +// Package peer defines various peer information associated with RPCs and +// corresponding utils. +package peer + +import ( + "net" + + "golang.org/x/net/context" + "google.golang.org/grpc/credentials" +) + +// Peer contains the information of the peer for an RPC. +type Peer struct { + // Addr is the peer address. + Addr net.Addr + // AuthInfo is the authentication information of the transport. + // It is nil if there is no transport security being used. + AuthInfo credentials.AuthInfo +} + +type peerKey struct{} + +// NewContext creates a new context with peer information attached. +func NewContext(ctx context.Context, p *Peer) context.Context { + return context.WithValue(ctx, peerKey{}, p) +} + +// FromContext returns the peer information in ctx if it exists. +func FromContext(ctx context.Context) (p *Peer, ok bool) { + p, ok = ctx.Value(peerKey{}).(*Peer) + return +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/rpc_util.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/rpc_util.go new file mode 100644 index 00000000000..28aab0a3f98 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/rpc_util.go @@ -0,0 +1,532 @@ +/* + * + * Copyright 2014, Google Inc. + * 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. + * + */ + +package grpc + +import ( + "bytes" + "compress/gzip" + "encoding/binary" + "fmt" + "io" + "io/ioutil" + "math" + "os" + "time" + + "github.com/golang/protobuf/proto" + "golang.org/x/net/context" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/peer" + "google.golang.org/grpc/stats" + "google.golang.org/grpc/transport" +) + +// Codec defines the interface gRPC uses to encode and decode messages. +type Codec interface { + // Marshal returns the wire format of v. + Marshal(v interface{}) ([]byte, error) + // Unmarshal parses the wire format into v. + Unmarshal(data []byte, v interface{}) error + // String returns the name of the Codec implementation. The returned + // string will be used as part of content type in transmission. + String() string +} + +// protoCodec is a Codec implementation with protobuf. It is the default codec for gRPC. +type protoCodec struct{} + +func (protoCodec) Marshal(v interface{}) ([]byte, error) { + return proto.Marshal(v.(proto.Message)) +} + +func (protoCodec) Unmarshal(data []byte, v interface{}) error { + return proto.Unmarshal(data, v.(proto.Message)) +} + +func (protoCodec) String() string { + return "proto" +} + +// Compressor defines the interface gRPC uses to compress a message. +type Compressor interface { + // Do compresses p into w. + Do(w io.Writer, p []byte) error + // Type returns the compression algorithm the Compressor uses. + Type() string +} + +// NewGZIPCompressor creates a Compressor based on GZIP. +func NewGZIPCompressor() Compressor { + return &gzipCompressor{} +} + +type gzipCompressor struct { +} + +func (c *gzipCompressor) Do(w io.Writer, p []byte) error { + z := gzip.NewWriter(w) + if _, err := z.Write(p); err != nil { + return err + } + return z.Close() +} + +func (c *gzipCompressor) Type() string { + return "gzip" +} + +// Decompressor defines the interface gRPC uses to decompress a message. +type Decompressor interface { + // Do reads the data from r and uncompress them. + Do(r io.Reader) ([]byte, error) + // Type returns the compression algorithm the Decompressor uses. + Type() string +} + +type gzipDecompressor struct { +} + +// NewGZIPDecompressor creates a Decompressor based on GZIP. +func NewGZIPDecompressor() Decompressor { + return &gzipDecompressor{} +} + +func (d *gzipDecompressor) Do(r io.Reader) ([]byte, error) { + z, err := gzip.NewReader(r) + if err != nil { + return nil, err + } + defer z.Close() + return ioutil.ReadAll(z) +} + +func (d *gzipDecompressor) Type() string { + return "gzip" +} + +// callInfo contains all related configuration and information about an RPC. +type callInfo struct { + failFast bool + headerMD metadata.MD + trailerMD metadata.MD + peer *peer.Peer + traceInfo traceInfo // in trace.go +} + +var defaultCallInfo = callInfo{failFast: true} + +// CallOption configures a Call before it starts or extracts information from +// a Call after it completes. +type CallOption interface { + // before is called before the call is sent to any server. If before + // returns a non-nil error, the RPC fails with that error. + before(*callInfo) error + + // after is called after the call has completed. after cannot return an + // error, so any failures should be reported via output parameters. + after(*callInfo) +} + +type beforeCall func(c *callInfo) error + +func (o beforeCall) before(c *callInfo) error { return o(c) } +func (o beforeCall) after(c *callInfo) {} + +type afterCall func(c *callInfo) + +func (o afterCall) before(c *callInfo) error { return nil } +func (o afterCall) after(c *callInfo) { o(c) } + +// Header returns a CallOptions that retrieves the header metadata +// for a unary RPC. +func Header(md *metadata.MD) CallOption { + return afterCall(func(c *callInfo) { + *md = c.headerMD + }) +} + +// Trailer returns a CallOptions that retrieves the trailer metadata +// for a unary RPC. +func Trailer(md *metadata.MD) CallOption { + return afterCall(func(c *callInfo) { + *md = c.trailerMD + }) +} + +// Peer returns a CallOption that retrieves peer information for a +// unary RPC. +func Peer(peer *peer.Peer) CallOption { + return afterCall(func(c *callInfo) { + *peer = *c.peer + }) +} + +// FailFast configures the action to take when an RPC is attempted on broken +// connections or unreachable servers. If failfast is true, the RPC will fail +// immediately. Otherwise, the RPC client will block the call until a +// connection is available (or the call is canceled or times out) and will retry +// the call if it fails due to a transient error. Please refer to +// https://github.com/grpc/grpc/blob/master/doc/fail_fast.md. Note: failFast is default to true. +func FailFast(failFast bool) CallOption { + return beforeCall(func(c *callInfo) error { + c.failFast = failFast + return nil + }) +} + +// The format of the payload: compressed or not? +type payloadFormat uint8 + +const ( + compressionNone payloadFormat = iota // no compression + compressionMade +) + +// parser reads complete gRPC messages from the underlying reader. +type parser struct { + // r is the underlying reader. + // See the comment on recvMsg for the permissible + // error types. + r io.Reader + + // The header of a gRPC message. Find more detail + // at http://www.grpc.io/docs/guides/wire.html. + header [5]byte +} + +// recvMsg reads a complete gRPC message from the stream. +// +// It returns the message and its payload (compression/encoding) +// format. The caller owns the returned msg memory. +// +// If there is an error, possible values are: +// * io.EOF, when no messages remain +// * io.ErrUnexpectedEOF +// * of type transport.ConnectionError +// * of type transport.StreamError +// No other error values or types must be returned, which also means +// that the underlying io.Reader must not return an incompatible +// error. +func (p *parser) recvMsg(maxMsgSize int) (pf payloadFormat, msg []byte, err error) { + if _, err := io.ReadFull(p.r, p.header[:]); err != nil { + return 0, nil, err + } + + pf = payloadFormat(p.header[0]) + length := binary.BigEndian.Uint32(p.header[1:]) + + if length == 0 { + return pf, nil, nil + } + if length > uint32(maxMsgSize) { + return 0, nil, Errorf(codes.Internal, "grpc: received message length %d exceeding the max size %d", length, maxMsgSize) + } + // TODO(bradfitz,zhaoq): garbage. reuse buffer after proto decoding instead + // of making it for each message: + msg = make([]byte, int(length)) + if _, err := io.ReadFull(p.r, msg); err != nil { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + return 0, nil, err + } + return pf, msg, nil +} + +// encode serializes msg and prepends the message header. If msg is nil, it +// generates the message header of 0 message length. +func encode(c Codec, msg interface{}, cp Compressor, cbuf *bytes.Buffer, outPayload *stats.OutPayload) ([]byte, error) { + var ( + b []byte + length uint + ) + if msg != nil { + var err error + // TODO(zhaoq): optimize to reduce memory alloc and copying. + b, err = c.Marshal(msg) + if err != nil { + return nil, err + } + if outPayload != nil { + outPayload.Payload = msg + // TODO truncate large payload. + outPayload.Data = b + outPayload.Length = len(b) + } + if cp != nil { + if err := cp.Do(cbuf, b); err != nil { + return nil, err + } + b = cbuf.Bytes() + } + length = uint(len(b)) + } + if length > math.MaxUint32 { + return nil, Errorf(codes.InvalidArgument, "grpc: message too large (%d bytes)", length) + } + + const ( + payloadLen = 1 + sizeLen = 4 + ) + + var buf = make([]byte, payloadLen+sizeLen+len(b)) + + // Write payload format + if cp == nil { + buf[0] = byte(compressionNone) + } else { + buf[0] = byte(compressionMade) + } + // Write length of b into buf + binary.BigEndian.PutUint32(buf[1:], uint32(length)) + // Copy encoded msg to buf + copy(buf[5:], b) + + if outPayload != nil { + outPayload.WireLength = len(buf) + } + + return buf, nil +} + +func checkRecvPayload(pf payloadFormat, recvCompress string, dc Decompressor) error { + switch pf { + case compressionNone: + case compressionMade: + if dc == nil || recvCompress != dc.Type() { + return Errorf(codes.Unimplemented, "grpc: Decompressor is not installed for grpc-encoding %q", recvCompress) + } + default: + return Errorf(codes.Internal, "grpc: received unexpected payload format %d", pf) + } + return nil +} + +func recv(p *parser, c Codec, s *transport.Stream, dc Decompressor, m interface{}, maxMsgSize int, inPayload *stats.InPayload) error { + pf, d, err := p.recvMsg(maxMsgSize) + if err != nil { + return err + } + if inPayload != nil { + inPayload.WireLength = len(d) + } + if err := checkRecvPayload(pf, s.RecvCompress(), dc); err != nil { + return err + } + if pf == compressionMade { + d, err = dc.Do(bytes.NewReader(d)) + if err != nil { + return Errorf(codes.Internal, "grpc: failed to decompress the received message %v", err) + } + } + if len(d) > maxMsgSize { + // TODO: Revisit the error code. Currently keep it consistent with java + // implementation. + return Errorf(codes.Internal, "grpc: received a message of %d bytes exceeding %d limit", len(d), maxMsgSize) + } + if err := c.Unmarshal(d, m); err != nil { + return Errorf(codes.Internal, "grpc: failed to unmarshal the received message %v", err) + } + if inPayload != nil { + inPayload.RecvTime = time.Now() + inPayload.Payload = m + // TODO truncate large payload. + inPayload.Data = d + inPayload.Length = len(d) + } + return nil +} + +// rpcError defines the status from an RPC. +type rpcError struct { + code codes.Code + desc string +} + +func (e *rpcError) Error() string { + return fmt.Sprintf("rpc error: code = %s desc = %s", e.code, e.desc) +} + +// Code returns the error code for err if it was produced by the rpc system. +// Otherwise, it returns codes.Unknown. +func Code(err error) codes.Code { + if err == nil { + return codes.OK + } + if e, ok := err.(*rpcError); ok { + return e.code + } + return codes.Unknown +} + +// ErrorDesc returns the error description of err if it was produced by the rpc system. +// Otherwise, it returns err.Error() or empty string when err is nil. +func ErrorDesc(err error) string { + if err == nil { + return "" + } + if e, ok := err.(*rpcError); ok { + return e.desc + } + return err.Error() +} + +// Errorf returns an error containing an error code and a description; +// Errorf returns nil if c is OK. +func Errorf(c codes.Code, format string, a ...interface{}) error { + if c == codes.OK { + return nil + } + return &rpcError{ + code: c, + desc: fmt.Sprintf(format, a...), + } +} + +// toRPCErr converts an error into a rpcError. +func toRPCErr(err error) error { + switch e := err.(type) { + case *rpcError: + return err + case transport.StreamError: + return &rpcError{ + code: e.Code, + desc: e.Desc, + } + case transport.ConnectionError: + return &rpcError{ + code: codes.Internal, + desc: e.Desc, + } + default: + switch err { + case context.DeadlineExceeded: + return &rpcError{ + code: codes.DeadlineExceeded, + desc: err.Error(), + } + case context.Canceled: + return &rpcError{ + code: codes.Canceled, + desc: err.Error(), + } + case ErrClientConnClosing: + return &rpcError{ + code: codes.FailedPrecondition, + desc: err.Error(), + } + } + + } + return Errorf(codes.Unknown, "%v", err) +} + +// convertCode converts a standard Go error into its canonical code. Note that +// this is only used to translate the error returned by the server applications. +func convertCode(err error) codes.Code { + switch err { + case nil: + return codes.OK + case io.EOF: + return codes.OutOfRange + case io.ErrClosedPipe, io.ErrNoProgress, io.ErrShortBuffer, io.ErrShortWrite, io.ErrUnexpectedEOF: + return codes.FailedPrecondition + case os.ErrInvalid: + return codes.InvalidArgument + case context.Canceled: + return codes.Canceled + case context.DeadlineExceeded: + return codes.DeadlineExceeded + } + switch { + case os.IsExist(err): + return codes.AlreadyExists + case os.IsNotExist(err): + return codes.NotFound + case os.IsPermission(err): + return codes.PermissionDenied + } + return codes.Unknown +} + +// MethodConfig defines the configuration recommended by the service providers for a +// particular method. +// This is EXPERIMENTAL and subject to change. +type MethodConfig struct { + // WaitForReady indicates whether RPCs sent to this method should wait until + // the connection is ready by default (!failfast). The value specified via the + // gRPC client API will override the value set here. + WaitForReady bool + // Timeout is the default timeout for RPCs sent to this method. The actual + // deadline used will be the minimum of the value specified here and the value + // set by the application via the gRPC client API. If either one is not set, + // then the other will be used. If neither is set, then the RPC has no deadline. + Timeout time.Duration + // MaxReqSize is the maximum allowed payload size for an individual request in a + // stream (client->server) in bytes. The size which is measured is the serialized + // payload after per-message compression (but before stream compression) in bytes. + // The actual value used is the minumum of the value specified here and the value set + // by the application via the gRPC client API. If either one is not set, then the other + // will be used. If neither is set, then the built-in default is used. + // TODO: support this. + MaxReqSize uint32 + // MaxRespSize is the maximum allowed payload size for an individual response in a + // stream (server->client) in bytes. + // TODO: support this. + MaxRespSize uint32 +} + +// ServiceConfig is provided by the service provider and contains parameters for how +// clients that connect to the service should behave. +// This is EXPERIMENTAL and subject to change. +type ServiceConfig struct { + // LB is the load balancer the service providers recommends. The balancer specified + // via grpc.WithBalancer will override this. + LB Balancer + // Methods contains a map for the methods in this service. + Methods map[string]MethodConfig +} + +// SupportPackageIsVersion4 is referenced from generated protocol buffer files +// to assert that that code is compatible with this version of the grpc package. +// +// This constant may be renamed in the future if a change in the generated code +// requires a synchronised update of grpc-go and protoc-gen-go. This constant +// should not be referenced from any other code. +const SupportPackageIsVersion4 = true + +// Version is the current grpc version. +const Version = "1.2.1" diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/server.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/server.go new file mode 100644 index 00000000000..157f35eea50 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/server.go @@ -0,0 +1,1085 @@ +/* + * + * Copyright 2014, Google Inc. + * 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. + * + */ + +package grpc + +import ( + "bytes" + "errors" + "fmt" + "io" + "net" + "net/http" + "reflect" + "runtime" + "strings" + "sync" + "time" + + "golang.org/x/net/context" + "golang.org/x/net/http2" + "golang.org/x/net/trace" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/stats" + "google.golang.org/grpc/tap" + "google.golang.org/grpc/transport" +) + +type methodHandler func(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor UnaryServerInterceptor) (interface{}, error) + +// MethodDesc represents an RPC service's method specification. +type MethodDesc struct { + MethodName string + Handler methodHandler +} + +// ServiceDesc represents an RPC service's specification. +type ServiceDesc struct { + ServiceName string + // The pointer to the service interface. Used to check whether the user + // provided implementation satisfies the interface requirements. + HandlerType interface{} + Methods []MethodDesc + Streams []StreamDesc + Metadata interface{} +} + +// service consists of the information of the server serving this service and +// the methods in this service. +type service struct { + server interface{} // the server for service methods + md map[string]*MethodDesc + sd map[string]*StreamDesc + mdata interface{} +} + +// Server is a gRPC server to serve RPC requests. +type Server struct { + opts options + + mu sync.Mutex // guards following + lis map[net.Listener]bool + conns map[io.Closer]bool + drain bool + ctx context.Context + cancel context.CancelFunc + // A CondVar to let GracefulStop() blocks until all the pending RPCs are finished + // and all the transport goes away. + cv *sync.Cond + m map[string]*service // service name -> service info + events trace.EventLog +} + +type options struct { + creds credentials.TransportCredentials + codec Codec + cp Compressor + dc Decompressor + maxMsgSize int + unaryInt UnaryServerInterceptor + streamInt StreamServerInterceptor + inTapHandle tap.ServerInHandle + statsHandler stats.Handler + maxConcurrentStreams uint32 + useHandlerImpl bool // use http.Handler-based server + unknownStreamDesc *StreamDesc +} + +var defaultMaxMsgSize = 1024 * 1024 * 4 // use 4MB as the default message size limit + +// A ServerOption sets options. +type ServerOption func(*options) + +// CustomCodec returns a ServerOption that sets a codec for message marshaling and unmarshaling. +func CustomCodec(codec Codec) ServerOption { + return func(o *options) { + o.codec = codec + } +} + +// RPCCompressor returns a ServerOption that sets a compressor for outbound messages. +func RPCCompressor(cp Compressor) ServerOption { + return func(o *options) { + o.cp = cp + } +} + +// RPCDecompressor returns a ServerOption that sets a decompressor for inbound messages. +func RPCDecompressor(dc Decompressor) ServerOption { + return func(o *options) { + o.dc = dc + } +} + +// MaxMsgSize returns a ServerOption to set the max message size in bytes for inbound mesages. +// If this is not set, gRPC uses the default 4MB. +func MaxMsgSize(m int) ServerOption { + return func(o *options) { + o.maxMsgSize = m + } +} + +// MaxConcurrentStreams returns a ServerOption that will apply a limit on the number +// of concurrent streams to each ServerTransport. +func MaxConcurrentStreams(n uint32) ServerOption { + return func(o *options) { + o.maxConcurrentStreams = n + } +} + +// Creds returns a ServerOption that sets credentials for server connections. +func Creds(c credentials.TransportCredentials) ServerOption { + return func(o *options) { + o.creds = c + } +} + +// UnaryInterceptor returns a ServerOption that sets the UnaryServerInterceptor for the +// server. Only one unary interceptor can be installed. The construction of multiple +// interceptors (e.g., chaining) can be implemented at the caller. +func UnaryInterceptor(i UnaryServerInterceptor) ServerOption { + return func(o *options) { + if o.unaryInt != nil { + panic("The unary server interceptor has been set.") + } + o.unaryInt = i + } +} + +// StreamInterceptor returns a ServerOption that sets the StreamServerInterceptor for the +// server. Only one stream interceptor can be installed. +func StreamInterceptor(i StreamServerInterceptor) ServerOption { + return func(o *options) { + if o.streamInt != nil { + panic("The stream server interceptor has been set.") + } + o.streamInt = i + } +} + +// InTapHandle returns a ServerOption that sets the tap handle for all the server +// transport to be created. Only one can be installed. +func InTapHandle(h tap.ServerInHandle) ServerOption { + return func(o *options) { + if o.inTapHandle != nil { + panic("The tap handle has been set.") + } + o.inTapHandle = h + } +} + +// StatsHandler returns a ServerOption that sets the stats handler for the server. +func StatsHandler(h stats.Handler) ServerOption { + return func(o *options) { + o.statsHandler = h + } +} + +// UnknownServiceHandler returns a ServerOption that allows for adding a custom +// unknown service handler. The provided method is a bidi-streaming RPC service +// handler that will be invoked instead of returning the the "unimplemented" gRPC +// error whenever a request is received for an unregistered service or method. +// The handling function has full access to the Context of the request and the +// stream, and the invocation passes through interceptors. +func UnknownServiceHandler(streamHandler StreamHandler) ServerOption { + return func(o *options) { + o.unknownStreamDesc = &StreamDesc{ + StreamName: "unknown_service_handler", + Handler: streamHandler, + // We need to assume that the users of the streamHandler will want to use both. + ClientStreams: true, + ServerStreams: true, + } + } +} + +// NewServer creates a gRPC server which has no service registered and has not +// started to accept requests yet. +func NewServer(opt ...ServerOption) *Server { + var opts options + opts.maxMsgSize = defaultMaxMsgSize + for _, o := range opt { + o(&opts) + } + if opts.codec == nil { + // Set the default codec. + opts.codec = protoCodec{} + } + s := &Server{ + lis: make(map[net.Listener]bool), + opts: opts, + conns: make(map[io.Closer]bool), + m: make(map[string]*service), + } + s.cv = sync.NewCond(&s.mu) + s.ctx, s.cancel = context.WithCancel(context.Background()) + if EnableTracing { + _, file, line, _ := runtime.Caller(1) + s.events = trace.NewEventLog("grpc.Server", fmt.Sprintf("%s:%d", file, line)) + } + return s +} + +// printf records an event in s's event log, unless s has been stopped. +// REQUIRES s.mu is held. +func (s *Server) printf(format string, a ...interface{}) { + if s.events != nil { + s.events.Printf(format, a...) + } +} + +// errorf records an error in s's event log, unless s has been stopped. +// REQUIRES s.mu is held. +func (s *Server) errorf(format string, a ...interface{}) { + if s.events != nil { + s.events.Errorf(format, a...) + } +} + +// RegisterService register a service and its implementation to the gRPC +// server. Called from the IDL generated code. This must be called before +// invoking Serve. +func (s *Server) RegisterService(sd *ServiceDesc, ss interface{}) { + ht := reflect.TypeOf(sd.HandlerType).Elem() + st := reflect.TypeOf(ss) + if !st.Implements(ht) { + grpclog.Fatalf("grpc: Server.RegisterService found the handler of type %v that does not satisfy %v", st, ht) + } + s.register(sd, ss) +} + +func (s *Server) register(sd *ServiceDesc, ss interface{}) { + s.mu.Lock() + defer s.mu.Unlock() + s.printf("RegisterService(%q)", sd.ServiceName) + if _, ok := s.m[sd.ServiceName]; ok { + grpclog.Fatalf("grpc: Server.RegisterService found duplicate service registration for %q", sd.ServiceName) + } + srv := &service{ + server: ss, + md: make(map[string]*MethodDesc), + sd: make(map[string]*StreamDesc), + mdata: sd.Metadata, + } + for i := range sd.Methods { + d := &sd.Methods[i] + srv.md[d.MethodName] = d + } + for i := range sd.Streams { + d := &sd.Streams[i] + srv.sd[d.StreamName] = d + } + s.m[sd.ServiceName] = srv +} + +// MethodInfo contains the information of an RPC including its method name and type. +type MethodInfo struct { + // Name is the method name only, without the service name or package name. + Name string + // IsClientStream indicates whether the RPC is a client streaming RPC. + IsClientStream bool + // IsServerStream indicates whether the RPC is a server streaming RPC. + IsServerStream bool +} + +// ServiceInfo contains unary RPC method info, streaming RPC methid info and metadata for a service. +type ServiceInfo struct { + Methods []MethodInfo + // Metadata is the metadata specified in ServiceDesc when registering service. + Metadata interface{} +} + +// GetServiceInfo returns a map from service names to ServiceInfo. +// Service names include the package names, in the form of .. +func (s *Server) GetServiceInfo() map[string]ServiceInfo { + ret := make(map[string]ServiceInfo) + for n, srv := range s.m { + methods := make([]MethodInfo, 0, len(srv.md)+len(srv.sd)) + for m := range srv.md { + methods = append(methods, MethodInfo{ + Name: m, + IsClientStream: false, + IsServerStream: false, + }) + } + for m, d := range srv.sd { + methods = append(methods, MethodInfo{ + Name: m, + IsClientStream: d.ClientStreams, + IsServerStream: d.ServerStreams, + }) + } + + ret[n] = ServiceInfo{ + Methods: methods, + Metadata: srv.mdata, + } + } + return ret +} + +var ( + // ErrServerStopped indicates that the operation is now illegal because of + // the server being stopped. + ErrServerStopped = errors.New("grpc: the server has been stopped") +) + +func (s *Server) useTransportAuthenticator(rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) { + if s.opts.creds == nil { + return rawConn, nil, nil + } + return s.opts.creds.ServerHandshake(rawConn) +} + +// Serve accepts incoming connections on the listener lis, creating a new +// ServerTransport and service goroutine for each. The service goroutines +// read gRPC requests and then call the registered handlers to reply to them. +// Serve returns when lis.Accept fails with fatal errors. lis will be closed when +// this method returns. +// Serve always returns non-nil error. +func (s *Server) Serve(lis net.Listener) error { + s.mu.Lock() + s.printf("serving") + if s.lis == nil { + s.mu.Unlock() + lis.Close() + return ErrServerStopped + } + s.lis[lis] = true + s.mu.Unlock() + defer func() { + s.mu.Lock() + if s.lis != nil && s.lis[lis] { + lis.Close() + delete(s.lis, lis) + } + s.mu.Unlock() + }() + + var tempDelay time.Duration // how long to sleep on accept failure + + for { + rawConn, err := lis.Accept() + if err != nil { + if ne, ok := err.(interface { + Temporary() bool + }); ok && ne.Temporary() { + if tempDelay == 0 { + tempDelay = 5 * time.Millisecond + } else { + tempDelay *= 2 + } + if max := 1 * time.Second; tempDelay > max { + tempDelay = max + } + s.mu.Lock() + s.printf("Accept error: %v; retrying in %v", err, tempDelay) + s.mu.Unlock() + select { + case <-time.After(tempDelay): + case <-s.ctx.Done(): + } + continue + } + s.mu.Lock() + s.printf("done serving; Accept = %v", err) + s.mu.Unlock() + return err + } + tempDelay = 0 + // Start a new goroutine to deal with rawConn + // so we don't stall this Accept loop goroutine. + go s.handleRawConn(rawConn) + } +} + +// handleRawConn is run in its own goroutine and handles a just-accepted +// connection that has not had any I/O performed on it yet. +func (s *Server) handleRawConn(rawConn net.Conn) { + conn, authInfo, err := s.useTransportAuthenticator(rawConn) + if err != nil { + s.mu.Lock() + s.errorf("ServerHandshake(%q) failed: %v", rawConn.RemoteAddr(), err) + s.mu.Unlock() + grpclog.Printf("grpc: Server.Serve failed to complete security handshake from %q: %v", rawConn.RemoteAddr(), err) + // If serverHandShake returns ErrConnDispatched, keep rawConn open. + if err != credentials.ErrConnDispatched { + rawConn.Close() + } + return + } + + s.mu.Lock() + if s.conns == nil { + s.mu.Unlock() + conn.Close() + return + } + s.mu.Unlock() + + if s.opts.useHandlerImpl { + s.serveUsingHandler(conn) + } else { + s.serveHTTP2Transport(conn, authInfo) + } +} + +// serveHTTP2Transport sets up a http/2 transport (using the +// gRPC http2 server transport in transport/http2_server.go) and +// serves streams on it. +// This is run in its own goroutine (it does network I/O in +// transport.NewServerTransport). +func (s *Server) serveHTTP2Transport(c net.Conn, authInfo credentials.AuthInfo) { + config := &transport.ServerConfig{ + MaxStreams: s.opts.maxConcurrentStreams, + AuthInfo: authInfo, + InTapHandle: s.opts.inTapHandle, + StatsHandler: s.opts.statsHandler, + } + st, err := transport.NewServerTransport("http2", c, config) + if err != nil { + s.mu.Lock() + s.errorf("NewServerTransport(%q) failed: %v", c.RemoteAddr(), err) + s.mu.Unlock() + c.Close() + grpclog.Println("grpc: Server.Serve failed to create ServerTransport: ", err) + return + } + if !s.addConn(st) { + st.Close() + return + } + s.serveStreams(st) +} + +func (s *Server) serveStreams(st transport.ServerTransport) { + defer s.removeConn(st) + defer st.Close() + var wg sync.WaitGroup + st.HandleStreams(func(stream *transport.Stream) { + wg.Add(1) + go func() { + defer wg.Done() + s.handleStream(st, stream, s.traceInfo(st, stream)) + }() + }, func(ctx context.Context, method string) context.Context { + if !EnableTracing { + return ctx + } + tr := trace.New("grpc.Recv."+methodFamily(method), method) + return trace.NewContext(ctx, tr) + }) + wg.Wait() +} + +var _ http.Handler = (*Server)(nil) + +// serveUsingHandler is called from handleRawConn when s is configured +// to handle requests via the http.Handler interface. It sets up a +// net/http.Server to handle the just-accepted conn. The http.Server +// is configured to route all incoming requests (all HTTP/2 streams) +// to ServeHTTP, which creates a new ServerTransport for each stream. +// serveUsingHandler blocks until conn closes. +// +// This codepath is only used when Server.TestingUseHandlerImpl has +// been configured. This lets the end2end tests exercise the ServeHTTP +// method as one of the environment types. +// +// conn is the *tls.Conn that's already been authenticated. +func (s *Server) serveUsingHandler(conn net.Conn) { + if !s.addConn(conn) { + conn.Close() + return + } + defer s.removeConn(conn) + h2s := &http2.Server{ + MaxConcurrentStreams: s.opts.maxConcurrentStreams, + } + h2s.ServeConn(conn, &http2.ServeConnOpts{ + Handler: s, + }) +} + +func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { + st, err := transport.NewServerHandlerTransport(w, r) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + if !s.addConn(st) { + st.Close() + return + } + defer s.removeConn(st) + s.serveStreams(st) +} + +// traceInfo returns a traceInfo and associates it with stream, if tracing is enabled. +// If tracing is not enabled, it returns nil. +func (s *Server) traceInfo(st transport.ServerTransport, stream *transport.Stream) (trInfo *traceInfo) { + tr, ok := trace.FromContext(stream.Context()) + if !ok { + return nil + } + + trInfo = &traceInfo{ + tr: tr, + } + trInfo.firstLine.client = false + trInfo.firstLine.remoteAddr = st.RemoteAddr() + + if dl, ok := stream.Context().Deadline(); ok { + trInfo.firstLine.deadline = dl.Sub(time.Now()) + } + return trInfo +} + +func (s *Server) addConn(c io.Closer) bool { + s.mu.Lock() + defer s.mu.Unlock() + if s.conns == nil || s.drain { + return false + } + s.conns[c] = true + return true +} + +func (s *Server) removeConn(c io.Closer) { + s.mu.Lock() + defer s.mu.Unlock() + if s.conns != nil { + delete(s.conns, c) + s.cv.Broadcast() + } +} + +func (s *Server) sendResponse(t transport.ServerTransport, stream *transport.Stream, msg interface{}, cp Compressor, opts *transport.Options) error { + var ( + cbuf *bytes.Buffer + outPayload *stats.OutPayload + ) + if cp != nil { + cbuf = new(bytes.Buffer) + } + if s.opts.statsHandler != nil { + outPayload = &stats.OutPayload{} + } + p, err := encode(s.opts.codec, msg, cp, cbuf, outPayload) + if err != nil { + // This typically indicates a fatal issue (e.g., memory + // corruption or hardware faults) the application program + // cannot handle. + // + // TODO(zhaoq): There exist other options also such as only closing the + // faulty stream locally and remotely (Other streams can keep going). Find + // the optimal option. + grpclog.Fatalf("grpc: Server failed to encode response %v", err) + } + err = t.Write(stream, p, opts) + if err == nil && outPayload != nil { + outPayload.SentTime = time.Now() + s.opts.statsHandler.HandleRPC(stream.Context(), outPayload) + } + return err +} + +func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.Stream, srv *service, md *MethodDesc, trInfo *traceInfo) (err error) { + sh := s.opts.statsHandler + if sh != nil { + begin := &stats.Begin{ + BeginTime: time.Now(), + } + sh.HandleRPC(stream.Context(), begin) + } + defer func() { + if sh != nil { + end := &stats.End{ + EndTime: time.Now(), + } + if err != nil && err != io.EOF { + end.Error = toRPCErr(err) + } + sh.HandleRPC(stream.Context(), end) + } + }() + if trInfo != nil { + defer trInfo.tr.Finish() + trInfo.firstLine.client = false + trInfo.tr.LazyLog(&trInfo.firstLine, false) + defer func() { + if err != nil && err != io.EOF { + trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) + trInfo.tr.SetError() + } + }() + } + if s.opts.cp != nil { + // NOTE: this needs to be ahead of all handling, https://github.com/grpc/grpc-go/issues/686. + stream.SetSendCompress(s.opts.cp.Type()) + } + p := &parser{r: stream} + for { + pf, req, err := p.recvMsg(s.opts.maxMsgSize) + if err == io.EOF { + // The entire stream is done (for unary RPC only). + return err + } + if err == io.ErrUnexpectedEOF { + err = Errorf(codes.Internal, io.ErrUnexpectedEOF.Error()) + } + if err != nil { + switch err := err.(type) { + case *rpcError: + if e := t.WriteStatus(stream, err.code, err.desc); e != nil { + grpclog.Printf("grpc: Server.processUnaryRPC failed to write status %v", e) + } + case transport.ConnectionError: + // Nothing to do here. + case transport.StreamError: + if e := t.WriteStatus(stream, err.Code, err.Desc); e != nil { + grpclog.Printf("grpc: Server.processUnaryRPC failed to write status %v", e) + } + default: + panic(fmt.Sprintf("grpc: Unexpected error (%T) from recvMsg: %v", err, err)) + } + return err + } + + if err := checkRecvPayload(pf, stream.RecvCompress(), s.opts.dc); err != nil { + switch err := err.(type) { + case *rpcError: + if e := t.WriteStatus(stream, err.code, err.desc); e != nil { + grpclog.Printf("grpc: Server.processUnaryRPC failed to write status %v", e) + } + return err + default: + if e := t.WriteStatus(stream, codes.Internal, err.Error()); e != nil { + grpclog.Printf("grpc: Server.processUnaryRPC failed to write status %v", e) + } + // TODO checkRecvPayload always return RPC error. Add a return here if necessary. + } + } + var inPayload *stats.InPayload + if sh != nil { + inPayload = &stats.InPayload{ + RecvTime: time.Now(), + } + } + statusCode := codes.OK + statusDesc := "" + df := func(v interface{}) error { + if inPayload != nil { + inPayload.WireLength = len(req) + } + if pf == compressionMade { + var err error + req, err = s.opts.dc.Do(bytes.NewReader(req)) + if err != nil { + if err := t.WriteStatus(stream, codes.Internal, err.Error()); err != nil { + grpclog.Printf("grpc: Server.processUnaryRPC failed to write status %v", err) + } + return Errorf(codes.Internal, err.Error()) + } + } + if len(req) > s.opts.maxMsgSize { + // TODO: Revisit the error code. Currently keep it consistent with + // java implementation. + statusCode = codes.Internal + statusDesc = fmt.Sprintf("grpc: server received a message of %d bytes exceeding %d limit", len(req), s.opts.maxMsgSize) + } + if err := s.opts.codec.Unmarshal(req, v); err != nil { + return err + } + if inPayload != nil { + inPayload.Payload = v + inPayload.Data = req + inPayload.Length = len(req) + sh.HandleRPC(stream.Context(), inPayload) + } + if trInfo != nil { + trInfo.tr.LazyLog(&payload{sent: false, msg: v}, true) + } + return nil + } + reply, appErr := md.Handler(srv.server, stream.Context(), df, s.opts.unaryInt) + if appErr != nil { + if err, ok := appErr.(*rpcError); ok { + statusCode = err.code + statusDesc = err.desc + } else { + statusCode = convertCode(appErr) + statusDesc = appErr.Error() + } + if trInfo != nil && statusCode != codes.OK { + trInfo.tr.LazyLog(stringer(statusDesc), true) + trInfo.tr.SetError() + } + if err := t.WriteStatus(stream, statusCode, statusDesc); err != nil { + grpclog.Printf("grpc: Server.processUnaryRPC failed to write status: %v", err) + } + return Errorf(statusCode, statusDesc) + } + if trInfo != nil { + trInfo.tr.LazyLog(stringer("OK"), false) + } + opts := &transport.Options{ + Last: true, + Delay: false, + } + if err := s.sendResponse(t, stream, reply, s.opts.cp, opts); err != nil { + switch err := err.(type) { + case transport.ConnectionError: + // Nothing to do here. + case transport.StreamError: + statusCode = err.Code + statusDesc = err.Desc + default: + statusCode = codes.Unknown + statusDesc = err.Error() + } + return err + } + if trInfo != nil { + trInfo.tr.LazyLog(&payload{sent: true, msg: reply}, true) + } + errWrite := t.WriteStatus(stream, statusCode, statusDesc) + if statusCode != codes.OK { + return Errorf(statusCode, statusDesc) + } + return errWrite + } +} + +func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transport.Stream, srv *service, sd *StreamDesc, trInfo *traceInfo) (err error) { + sh := s.opts.statsHandler + if sh != nil { + begin := &stats.Begin{ + BeginTime: time.Now(), + } + sh.HandleRPC(stream.Context(), begin) + } + defer func() { + if sh != nil { + end := &stats.End{ + EndTime: time.Now(), + } + if err != nil && err != io.EOF { + end.Error = toRPCErr(err) + } + sh.HandleRPC(stream.Context(), end) + } + }() + if s.opts.cp != nil { + stream.SetSendCompress(s.opts.cp.Type()) + } + ss := &serverStream{ + t: t, + s: stream, + p: &parser{r: stream}, + codec: s.opts.codec, + cp: s.opts.cp, + dc: s.opts.dc, + maxMsgSize: s.opts.maxMsgSize, + trInfo: trInfo, + statsHandler: sh, + } + if ss.cp != nil { + ss.cbuf = new(bytes.Buffer) + } + if trInfo != nil { + trInfo.tr.LazyLog(&trInfo.firstLine, false) + defer func() { + ss.mu.Lock() + if err != nil && err != io.EOF { + ss.trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) + ss.trInfo.tr.SetError() + } + ss.trInfo.tr.Finish() + ss.trInfo.tr = nil + ss.mu.Unlock() + }() + } + var appErr error + var server interface{} + if srv != nil { + server = srv.server + } + if s.opts.streamInt == nil { + appErr = sd.Handler(server, ss) + } else { + info := &StreamServerInfo{ + FullMethod: stream.Method(), + IsClientStream: sd.ClientStreams, + IsServerStream: sd.ServerStreams, + } + appErr = s.opts.streamInt(server, ss, info, sd.Handler) + } + if appErr != nil { + if err, ok := appErr.(*rpcError); ok { + ss.statusCode = err.code + ss.statusDesc = err.desc + } else if err, ok := appErr.(transport.StreamError); ok { + ss.statusCode = err.Code + ss.statusDesc = err.Desc + } else { + ss.statusCode = convertCode(appErr) + ss.statusDesc = appErr.Error() + } + } + if trInfo != nil { + ss.mu.Lock() + if ss.statusCode != codes.OK { + ss.trInfo.tr.LazyLog(stringer(ss.statusDesc), true) + ss.trInfo.tr.SetError() + } else { + ss.trInfo.tr.LazyLog(stringer("OK"), false) + } + ss.mu.Unlock() + } + errWrite := t.WriteStatus(ss.s, ss.statusCode, ss.statusDesc) + if ss.statusCode != codes.OK { + return Errorf(ss.statusCode, ss.statusDesc) + } + return errWrite + +} + +func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Stream, trInfo *traceInfo) { + sm := stream.Method() + if sm != "" && sm[0] == '/' { + sm = sm[1:] + } + pos := strings.LastIndex(sm, "/") + if pos == -1 { + if trInfo != nil { + trInfo.tr.LazyLog(&fmtStringer{"Malformed method name %q", []interface{}{sm}}, true) + trInfo.tr.SetError() + } + errDesc := fmt.Sprintf("malformed method name: %q", stream.Method()) + if err := t.WriteStatus(stream, codes.InvalidArgument, errDesc); err != nil { + if trInfo != nil { + trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) + trInfo.tr.SetError() + } + grpclog.Printf("grpc: Server.handleStream failed to write status: %v", err) + } + if trInfo != nil { + trInfo.tr.Finish() + } + return + } + service := sm[:pos] + method := sm[pos+1:] + srv, ok := s.m[service] + if !ok { + if unknownDesc := s.opts.unknownStreamDesc; unknownDesc != nil { + s.processStreamingRPC(t, stream, nil, unknownDesc, trInfo) + return + } + if trInfo != nil { + trInfo.tr.LazyLog(&fmtStringer{"Unknown service %v", []interface{}{service}}, true) + trInfo.tr.SetError() + } + errDesc := fmt.Sprintf("unknown service %v", service) + if err := t.WriteStatus(stream, codes.Unimplemented, errDesc); err != nil { + if trInfo != nil { + trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) + trInfo.tr.SetError() + } + grpclog.Printf("grpc: Server.handleStream failed to write status: %v", err) + } + if trInfo != nil { + trInfo.tr.Finish() + } + return + } + // Unary RPC or Streaming RPC? + if md, ok := srv.md[method]; ok { + s.processUnaryRPC(t, stream, srv, md, trInfo) + return + } + if sd, ok := srv.sd[method]; ok { + s.processStreamingRPC(t, stream, srv, sd, trInfo) + return + } + if trInfo != nil { + trInfo.tr.LazyLog(&fmtStringer{"Unknown method %v", []interface{}{method}}, true) + trInfo.tr.SetError() + } + if unknownDesc := s.opts.unknownStreamDesc; unknownDesc != nil { + s.processStreamingRPC(t, stream, nil, unknownDesc, trInfo) + return + } + errDesc := fmt.Sprintf("unknown method %v", method) + if err := t.WriteStatus(stream, codes.Unimplemented, errDesc); err != nil { + if trInfo != nil { + trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) + trInfo.tr.SetError() + } + grpclog.Printf("grpc: Server.handleStream failed to write status: %v", err) + } + if trInfo != nil { + trInfo.tr.Finish() + } +} + +// Stop stops the gRPC server. It immediately closes all open +// connections and listeners. +// It cancels all active RPCs on the server side and the corresponding +// pending RPCs on the client side will get notified by connection +// errors. +func (s *Server) Stop() { + s.mu.Lock() + listeners := s.lis + s.lis = nil + st := s.conns + s.conns = nil + // interrupt GracefulStop if Stop and GracefulStop are called concurrently. + s.cv.Broadcast() + s.mu.Unlock() + + for lis := range listeners { + lis.Close() + } + for c := range st { + c.Close() + } + + s.mu.Lock() + s.cancel() + if s.events != nil { + s.events.Finish() + s.events = nil + } + s.mu.Unlock() +} + +// GracefulStop stops the gRPC server gracefully. It stops the server to accept new +// connections and RPCs and blocks until all the pending RPCs are finished. +func (s *Server) GracefulStop() { + s.mu.Lock() + defer s.mu.Unlock() + if s.conns == nil { + return + } + for lis := range s.lis { + lis.Close() + } + s.lis = nil + s.cancel() + if !s.drain { + for c := range s.conns { + c.(transport.ServerTransport).Drain() + } + s.drain = true + } + for len(s.conns) != 0 { + s.cv.Wait() + } + s.conns = nil + if s.events != nil { + s.events.Finish() + s.events = nil + } +} + +func init() { + internal.TestingCloseConns = func(arg interface{}) { + arg.(*Server).testingCloseConns() + } + internal.TestingUseHandlerImpl = func(arg interface{}) { + arg.(*Server).opts.useHandlerImpl = true + } +} + +// testingCloseConns closes all existing transports but keeps s.lis +// accepting new connections. +func (s *Server) testingCloseConns() { + s.mu.Lock() + for c := range s.conns { + c.Close() + delete(s.conns, c) + } + s.mu.Unlock() +} + +// SetHeader sets the header metadata. +// When called multiple times, all the provided metadata will be merged. +// All the metadata will be sent out when one of the following happens: +// - grpc.SendHeader() is called; +// - The first response is sent out; +// - An RPC status is sent out (error or success). +func SetHeader(ctx context.Context, md metadata.MD) error { + if md.Len() == 0 { + return nil + } + stream, ok := transport.StreamFromContext(ctx) + if !ok { + return Errorf(codes.Internal, "grpc: failed to fetch the stream from the context %v", ctx) + } + return stream.SetHeader(md) +} + +// SendHeader sends header metadata. It may be called at most once. +// The provided md and headers set by SetHeader() will be sent. +func SendHeader(ctx context.Context, md metadata.MD) error { + stream, ok := transport.StreamFromContext(ctx) + if !ok { + return Errorf(codes.Internal, "grpc: failed to fetch the stream from the context %v", ctx) + } + t := stream.ServerTransport() + if t == nil { + grpclog.Fatalf("grpc: SendHeader: %v has no ServerTransport to send header metadata.", stream) + } + if err := t.WriteHeader(stream, md); err != nil { + return toRPCErr(err) + } + return nil +} + +// SetTrailer sets the trailer metadata that will be sent when an RPC returns. +// When called more than once, all the provided metadata will be merged. +func SetTrailer(ctx context.Context, md metadata.MD) error { + if md.Len() == 0 { + return nil + } + stream, ok := transport.StreamFromContext(ctx) + if !ok { + return Errorf(codes.Internal, "grpc: failed to fetch the stream from the context %v", ctx) + } + return stream.SetTrailer(md) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stats/handlers.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stats/handlers.go new file mode 100644 index 00000000000..26e1a8e2f08 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stats/handlers.go @@ -0,0 +1,76 @@ +/* + * + * Copyright 2016, Google Inc. + * 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. + * + */ + +package stats + +import ( + "net" + + "golang.org/x/net/context" +) + +// ConnTagInfo defines the relevant information needed by connection context tagger. +type ConnTagInfo struct { + // RemoteAddr is the remote address of the corresponding connection. + RemoteAddr net.Addr + // LocalAddr is the local address of the corresponding connection. + LocalAddr net.Addr + // TODO add QOS related fields. +} + +// RPCTagInfo defines the relevant information needed by RPC context tagger. +type RPCTagInfo struct { + // FullMethodName is the RPC method in the format of /package.service/method. + FullMethodName string +} + +// Handler defines the interface for the related stats handling (e.g., RPCs, connections). +type Handler interface { + // TagRPC can attach some information to the given context. + // The returned context is used in the rest lifetime of the RPC. + TagRPC(context.Context, *RPCTagInfo) context.Context + // HandleRPC processes the RPC stats. + HandleRPC(context.Context, RPCStats) + + // TagConn can attach some information to the given context. + // The returned context will be used for stats handling. + // For conn stats handling, the context used in HandleConn for this + // connection will be derived from the context returned. + // For RPC stats handling, + // - On server side, the context used in HandleRPC for all RPCs on this + // connection will be derived from the context returned. + // - On client side, the context is not derived from the context returned. + TagConn(context.Context, *ConnTagInfo) context.Context + // HandleConn processes the Conn stats. + HandleConn(context.Context, ConnStats) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stats/stats.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stats/stats.go new file mode 100644 index 00000000000..a82448a68bb --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stats/stats.go @@ -0,0 +1,223 @@ +/* + * + * Copyright 2016, Google Inc. + * 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. + * + */ + +// Package stats is for collecting and reporting various network and RPC stats. +// This package is for monitoring purpose only. All fields are read-only. +// All APIs are experimental. +package stats // import "google.golang.org/grpc/stats" + +import ( + "net" + "time" +) + +// RPCStats contains stats information about RPCs. +type RPCStats interface { + isRPCStats() + // IsClient returns true if this RPCStats is from client side. + IsClient() bool +} + +// Begin contains stats when an RPC begins. +// FailFast are only valid if Client is true. +type Begin struct { + // Client is true if this Begin is from client side. + Client bool + // BeginTime is the time when the RPC begins. + BeginTime time.Time + // FailFast indicates if this RPC is failfast. + FailFast bool +} + +// IsClient indicates if this is from client side. +func (s *Begin) IsClient() bool { return s.Client } + +func (s *Begin) isRPCStats() {} + +// InPayload contains the information for an incoming payload. +type InPayload struct { + // Client is true if this InPayload is from client side. + Client bool + // Payload is the payload with original type. + Payload interface{} + // Data is the serialized message payload. + Data []byte + // Length is the length of uncompressed data. + Length int + // WireLength is the length of data on wire (compressed, signed, encrypted). + WireLength int + // RecvTime is the time when the payload is received. + RecvTime time.Time +} + +// IsClient indicates if this is from client side. +func (s *InPayload) IsClient() bool { return s.Client } + +func (s *InPayload) isRPCStats() {} + +// InHeader contains stats when a header is received. +// FullMethod, addresses and Compression are only valid if Client is false. +type InHeader struct { + // Client is true if this InHeader is from client side. + Client bool + // WireLength is the wire length of header. + WireLength int + + // FullMethod is the full RPC method string, i.e., /package.service/method. + FullMethod string + // RemoteAddr is the remote address of the corresponding connection. + RemoteAddr net.Addr + // LocalAddr is the local address of the corresponding connection. + LocalAddr net.Addr + // Compression is the compression algorithm used for the RPC. + Compression string +} + +// IsClient indicates if this is from client side. +func (s *InHeader) IsClient() bool { return s.Client } + +func (s *InHeader) isRPCStats() {} + +// InTrailer contains stats when a trailer is received. +type InTrailer struct { + // Client is true if this InTrailer is from client side. + Client bool + // WireLength is the wire length of trailer. + WireLength int +} + +// IsClient indicates if this is from client side. +func (s *InTrailer) IsClient() bool { return s.Client } + +func (s *InTrailer) isRPCStats() {} + +// OutPayload contains the information for an outgoing payload. +type OutPayload struct { + // Client is true if this OutPayload is from client side. + Client bool + // Payload is the payload with original type. + Payload interface{} + // Data is the serialized message payload. + Data []byte + // Length is the length of uncompressed data. + Length int + // WireLength is the length of data on wire (compressed, signed, encrypted). + WireLength int + // SentTime is the time when the payload is sent. + SentTime time.Time +} + +// IsClient indicates if this is from client side. +func (s *OutPayload) IsClient() bool { return s.Client } + +func (s *OutPayload) isRPCStats() {} + +// OutHeader contains stats when a header is sent. +// FullMethod, addresses and Compression are only valid if Client is true. +type OutHeader struct { + // Client is true if this OutHeader is from client side. + Client bool + // WireLength is the wire length of header. + WireLength int + + // FullMethod is the full RPC method string, i.e., /package.service/method. + FullMethod string + // RemoteAddr is the remote address of the corresponding connection. + RemoteAddr net.Addr + // LocalAddr is the local address of the corresponding connection. + LocalAddr net.Addr + // Compression is the compression algorithm used for the RPC. + Compression string +} + +// IsClient indicates if this is from client side. +func (s *OutHeader) IsClient() bool { return s.Client } + +func (s *OutHeader) isRPCStats() {} + +// OutTrailer contains stats when a trailer is sent. +type OutTrailer struct { + // Client is true if this OutTrailer is from client side. + Client bool + // WireLength is the wire length of trailer. + WireLength int +} + +// IsClient indicates if this is from client side. +func (s *OutTrailer) IsClient() bool { return s.Client } + +func (s *OutTrailer) isRPCStats() {} + +// End contains stats when an RPC ends. +type End struct { + // Client is true if this End is from client side. + Client bool + // EndTime is the time when the RPC ends. + EndTime time.Time + // Error is the error just happened. Its type is gRPC error. + Error error +} + +// IsClient indicates if this is from client side. +func (s *End) IsClient() bool { return s.Client } + +func (s *End) isRPCStats() {} + +// ConnStats contains stats information about connections. +type ConnStats interface { + isConnStats() + // IsClient returns true if this ConnStats is from client side. + IsClient() bool +} + +// ConnBegin contains the stats of a connection when it is established. +type ConnBegin struct { + // Client is true if this ConnBegin is from client side. + Client bool +} + +// IsClient indicates if this is from client side. +func (s *ConnBegin) IsClient() bool { return s.Client } + +func (s *ConnBegin) isConnStats() {} + +// ConnEnd contains the stats of a connection when it ends. +type ConnEnd struct { + // Client is true if this ConnEnd is from client side. + Client bool +} + +// IsClient indicates if this is from client side. +func (s *ConnEnd) IsClient() bool { return s.Client } + +func (s *ConnEnd) isConnStats() {} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stream.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stream.go new file mode 100644 index 00000000000..0ef2077ce25 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stream.go @@ -0,0 +1,626 @@ +/* + * + * Copyright 2014, Google Inc. + * 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. + * + */ + +package grpc + +import ( + "bytes" + "errors" + "io" + "sync" + "time" + + "golang.org/x/net/context" + "golang.org/x/net/trace" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/stats" + "google.golang.org/grpc/transport" +) + +// StreamHandler defines the handler called by gRPC server to complete the +// execution of a streaming RPC. +type StreamHandler func(srv interface{}, stream ServerStream) error + +// StreamDesc represents a streaming RPC service's method specification. +type StreamDesc struct { + StreamName string + Handler StreamHandler + + // At least one of these is true. + ServerStreams bool + ClientStreams bool +} + +// Stream defines the common interface a client or server stream has to satisfy. +type Stream interface { + // Context returns the context for this stream. + Context() context.Context + // SendMsg blocks until it sends m, the stream is done or the stream + // breaks. + // On error, it aborts the stream and returns an RPC status on client + // side. On server side, it simply returns the error to the caller. + // SendMsg is called by generated code. Also Users can call SendMsg + // directly when it is really needed in their use cases. + SendMsg(m interface{}) error + // RecvMsg blocks until it receives a message or the stream is + // done. On client side, it returns io.EOF when the stream is done. On + // any other error, it aborts the stream and returns an RPC status. On + // server side, it simply returns the error to the caller. + RecvMsg(m interface{}) error +} + +// ClientStream defines the interface a client stream has to satisfy. +type ClientStream interface { + // Header returns the header metadata received from the server if there + // is any. It blocks if the metadata is not ready to read. + Header() (metadata.MD, error) + // Trailer returns the trailer metadata from the server, if there is any. + // It must only be called after stream.CloseAndRecv has returned, or + // stream.Recv has returned a non-nil error (including io.EOF). + Trailer() metadata.MD + // CloseSend closes the send direction of the stream. It closes the stream + // when non-nil error is met. + CloseSend() error + Stream +} + +// NewClientStream creates a new Stream for the client side. This is called +// by generated code. +func NewClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (_ ClientStream, err error) { + if cc.dopts.streamInt != nil { + return cc.dopts.streamInt(ctx, desc, cc, method, newClientStream, opts...) + } + return newClientStream(ctx, desc, cc, method, opts...) +} + +func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (_ ClientStream, err error) { + var ( + t transport.ClientTransport + s *transport.Stream + put func() + cancel context.CancelFunc + ) + c := defaultCallInfo + if mc, ok := cc.getMethodConfig(method); ok { + c.failFast = !mc.WaitForReady + if mc.Timeout > 0 { + ctx, cancel = context.WithTimeout(ctx, mc.Timeout) + } + } + for _, o := range opts { + if err := o.before(&c); err != nil { + return nil, toRPCErr(err) + } + } + callHdr := &transport.CallHdr{ + Host: cc.authority, + Method: method, + Flush: desc.ServerStreams && desc.ClientStreams, + } + if cc.dopts.cp != nil { + callHdr.SendCompress = cc.dopts.cp.Type() + } + var trInfo traceInfo + if EnableTracing { + trInfo.tr = trace.New("grpc.Sent."+methodFamily(method), method) + trInfo.firstLine.client = true + if deadline, ok := ctx.Deadline(); ok { + trInfo.firstLine.deadline = deadline.Sub(time.Now()) + } + trInfo.tr.LazyLog(&trInfo.firstLine, false) + ctx = trace.NewContext(ctx, trInfo.tr) + defer func() { + if err != nil { + // Need to call tr.finish() if error is returned. + // Because tr will not be returned to caller. + trInfo.tr.LazyPrintf("RPC: [%v]", err) + trInfo.tr.SetError() + trInfo.tr.Finish() + } + }() + } + sh := cc.dopts.copts.StatsHandler + if sh != nil { + ctx = sh.TagRPC(ctx, &stats.RPCTagInfo{FullMethodName: method}) + begin := &stats.Begin{ + Client: true, + BeginTime: time.Now(), + FailFast: c.failFast, + } + sh.HandleRPC(ctx, begin) + } + defer func() { + if err != nil && sh != nil { + // Only handle end stats if err != nil. + end := &stats.End{ + Client: true, + Error: err, + } + sh.HandleRPC(ctx, end) + } + }() + gopts := BalancerGetOptions{ + BlockingWait: !c.failFast, + } + for { + t, put, err = cc.getTransport(ctx, gopts) + if err != nil { + // TODO(zhaoq): Probably revisit the error handling. + if _, ok := err.(*rpcError); ok { + return nil, err + } + if err == errConnClosing || err == errConnUnavailable { + if c.failFast { + return nil, Errorf(codes.Unavailable, "%v", err) + } + continue + } + // All the other errors are treated as Internal errors. + return nil, Errorf(codes.Internal, "%v", err) + } + + s, err = t.NewStream(ctx, callHdr) + if err != nil { + if put != nil { + put() + put = nil + } + if _, ok := err.(transport.ConnectionError); ok || err == transport.ErrStreamDrain { + if c.failFast { + return nil, toRPCErr(err) + } + continue + } + return nil, toRPCErr(err) + } + break + } + cs := &clientStream{ + opts: opts, + c: c, + desc: desc, + codec: cc.dopts.codec, + cp: cc.dopts.cp, + dc: cc.dopts.dc, + maxMsgSize: cc.dopts.maxMsgSize, + cancel: cancel, + + put: put, + t: t, + s: s, + p: &parser{r: s}, + + tracing: EnableTracing, + trInfo: trInfo, + + statsCtx: ctx, + statsHandler: cc.dopts.copts.StatsHandler, + } + if cc.dopts.cp != nil { + cs.cbuf = new(bytes.Buffer) + } + // Listen on ctx.Done() to detect cancellation and s.Done() to detect normal termination + // when there is no pending I/O operations on this stream. + go func() { + select { + case <-t.Error(): + // Incur transport error, simply exit. + case <-s.Done(): + // TODO: The trace of the RPC is terminated here when there is no pending + // I/O, which is probably not the optimal solution. + if s.StatusCode() == codes.OK { + cs.finish(nil) + } else { + cs.finish(Errorf(s.StatusCode(), "%s", s.StatusDesc())) + } + cs.closeTransportStream(nil) + case <-s.GoAway(): + cs.finish(errConnDrain) + cs.closeTransportStream(errConnDrain) + case <-s.Context().Done(): + err := s.Context().Err() + cs.finish(err) + cs.closeTransportStream(transport.ContextErr(err)) + } + }() + return cs, nil +} + +// clientStream implements a client side Stream. +type clientStream struct { + opts []CallOption + c callInfo + t transport.ClientTransport + s *transport.Stream + p *parser + desc *StreamDesc + codec Codec + cp Compressor + cbuf *bytes.Buffer + dc Decompressor + maxMsgSize int + cancel context.CancelFunc + + tracing bool // set to EnableTracing when the clientStream is created. + + mu sync.Mutex + put func() + closed bool + // trInfo.tr is set when the clientStream is created (if EnableTracing is true), + // and is set to nil when the clientStream's finish method is called. + trInfo traceInfo + + // statsCtx keeps the user context for stats handling. + // All stats collection should use the statsCtx (instead of the stream context) + // so that all the generated stats for a particular RPC can be associated in the processing phase. + statsCtx context.Context + statsHandler stats.Handler +} + +func (cs *clientStream) Context() context.Context { + return cs.s.Context() +} + +func (cs *clientStream) Header() (metadata.MD, error) { + m, err := cs.s.Header() + if err != nil { + if _, ok := err.(transport.ConnectionError); !ok { + cs.closeTransportStream(err) + } + } + return m, err +} + +func (cs *clientStream) Trailer() metadata.MD { + return cs.s.Trailer() +} + +func (cs *clientStream) SendMsg(m interface{}) (err error) { + if cs.tracing { + cs.mu.Lock() + if cs.trInfo.tr != nil { + cs.trInfo.tr.LazyLog(&payload{sent: true, msg: m}, true) + } + cs.mu.Unlock() + } + // TODO Investigate how to signal the stats handling party. + // generate error stats if err != nil && err != io.EOF? + defer func() { + if err != nil { + cs.finish(err) + } + if err == nil { + return + } + if err == io.EOF { + // Specialize the process for server streaming. SendMesg is only called + // once when creating the stream object. io.EOF needs to be skipped when + // the rpc is early finished (before the stream object is created.). + // TODO: It is probably better to move this into the generated code. + if !cs.desc.ClientStreams && cs.desc.ServerStreams { + err = nil + } + return + } + if _, ok := err.(transport.ConnectionError); !ok { + cs.closeTransportStream(err) + } + err = toRPCErr(err) + }() + var outPayload *stats.OutPayload + if cs.statsHandler != nil { + outPayload = &stats.OutPayload{ + Client: true, + } + } + out, err := encode(cs.codec, m, cs.cp, cs.cbuf, outPayload) + defer func() { + if cs.cbuf != nil { + cs.cbuf.Reset() + } + }() + if err != nil { + return Errorf(codes.Internal, "grpc: %v", err) + } + err = cs.t.Write(cs.s, out, &transport.Options{Last: false}) + if err == nil && outPayload != nil { + outPayload.SentTime = time.Now() + cs.statsHandler.HandleRPC(cs.statsCtx, outPayload) + } + return err +} + +func (cs *clientStream) RecvMsg(m interface{}) (err error) { + defer func() { + if err != nil && cs.statsHandler != nil { + // Only generate End if err != nil. + // If err == nil, it's not the last RecvMsg. + // The last RecvMsg gets either an RPC error or io.EOF. + end := &stats.End{ + Client: true, + EndTime: time.Now(), + } + if err != io.EOF { + end.Error = toRPCErr(err) + } + cs.statsHandler.HandleRPC(cs.statsCtx, end) + } + }() + var inPayload *stats.InPayload + if cs.statsHandler != nil { + inPayload = &stats.InPayload{ + Client: true, + } + } + err = recv(cs.p, cs.codec, cs.s, cs.dc, m, cs.maxMsgSize, inPayload) + defer func() { + // err != nil indicates the termination of the stream. + if err != nil { + cs.finish(err) + } + }() + if err == nil { + if cs.tracing { + cs.mu.Lock() + if cs.trInfo.tr != nil { + cs.trInfo.tr.LazyLog(&payload{sent: false, msg: m}, true) + } + cs.mu.Unlock() + } + if inPayload != nil { + cs.statsHandler.HandleRPC(cs.statsCtx, inPayload) + } + if !cs.desc.ClientStreams || cs.desc.ServerStreams { + return + } + // Special handling for client streaming rpc. + // This recv expects EOF or errors, so we don't collect inPayload. + err = recv(cs.p, cs.codec, cs.s, cs.dc, m, cs.maxMsgSize, nil) + cs.closeTransportStream(err) + if err == nil { + return toRPCErr(errors.New("grpc: client streaming protocol violation: get , want ")) + } + if err == io.EOF { + if cs.s.StatusCode() == codes.OK { + cs.finish(err) + return nil + } + return Errorf(cs.s.StatusCode(), "%s", cs.s.StatusDesc()) + } + return toRPCErr(err) + } + if _, ok := err.(transport.ConnectionError); !ok { + cs.closeTransportStream(err) + } + if err == io.EOF { + if cs.s.StatusCode() == codes.OK { + // Returns io.EOF to indicate the end of the stream. + return + } + return Errorf(cs.s.StatusCode(), "%s", cs.s.StatusDesc()) + } + return toRPCErr(err) +} + +func (cs *clientStream) CloseSend() (err error) { + err = cs.t.Write(cs.s, nil, &transport.Options{Last: true}) + defer func() { + if err != nil { + cs.finish(err) + } + }() + if err == nil || err == io.EOF { + return nil + } + if _, ok := err.(transport.ConnectionError); !ok { + cs.closeTransportStream(err) + } + err = toRPCErr(err) + return +} + +func (cs *clientStream) closeTransportStream(err error) { + cs.mu.Lock() + if cs.closed { + cs.mu.Unlock() + return + } + cs.closed = true + cs.mu.Unlock() + cs.t.CloseStream(cs.s, err) +} + +func (cs *clientStream) finish(err error) { + defer func() { + if cs.cancel != nil { + cs.cancel() + } + }() + cs.mu.Lock() + defer cs.mu.Unlock() + for _, o := range cs.opts { + o.after(&cs.c) + } + if cs.put != nil { + cs.put() + cs.put = nil + } + if !cs.tracing { + return + } + if cs.trInfo.tr != nil { + if err == nil || err == io.EOF { + cs.trInfo.tr.LazyPrintf("RPC: [OK]") + } else { + cs.trInfo.tr.LazyPrintf("RPC: [%v]", err) + cs.trInfo.tr.SetError() + } + cs.trInfo.tr.Finish() + cs.trInfo.tr = nil + } +} + +// ServerStream defines the interface a server stream has to satisfy. +type ServerStream interface { + // SetHeader sets the header metadata. It may be called multiple times. + // When call multiple times, all the provided metadata will be merged. + // All the metadata will be sent out when one of the following happens: + // - ServerStream.SendHeader() is called; + // - The first response is sent out; + // - An RPC status is sent out (error or success). + SetHeader(metadata.MD) error + // SendHeader sends the header metadata. + // The provided md and headers set by SetHeader() will be sent. + // It fails if called multiple times. + SendHeader(metadata.MD) error + // SetTrailer sets the trailer metadata which will be sent with the RPC status. + // When called more than once, all the provided metadata will be merged. + SetTrailer(metadata.MD) + Stream +} + +// serverStream implements a server side Stream. +type serverStream struct { + t transport.ServerTransport + s *transport.Stream + p *parser + codec Codec + cp Compressor + dc Decompressor + cbuf *bytes.Buffer + maxMsgSize int + statusCode codes.Code + statusDesc string + trInfo *traceInfo + + statsHandler stats.Handler + + mu sync.Mutex // protects trInfo.tr after the service handler runs. +} + +func (ss *serverStream) Context() context.Context { + return ss.s.Context() +} + +func (ss *serverStream) SetHeader(md metadata.MD) error { + if md.Len() == 0 { + return nil + } + return ss.s.SetHeader(md) +} + +func (ss *serverStream) SendHeader(md metadata.MD) error { + return ss.t.WriteHeader(ss.s, md) +} + +func (ss *serverStream) SetTrailer(md metadata.MD) { + if md.Len() == 0 { + return + } + ss.s.SetTrailer(md) + return +} + +func (ss *serverStream) SendMsg(m interface{}) (err error) { + defer func() { + if ss.trInfo != nil { + ss.mu.Lock() + if ss.trInfo.tr != nil { + if err == nil { + ss.trInfo.tr.LazyLog(&payload{sent: true, msg: m}, true) + } else { + ss.trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) + ss.trInfo.tr.SetError() + } + } + ss.mu.Unlock() + } + }() + var outPayload *stats.OutPayload + if ss.statsHandler != nil { + outPayload = &stats.OutPayload{} + } + out, err := encode(ss.codec, m, ss.cp, ss.cbuf, outPayload) + defer func() { + if ss.cbuf != nil { + ss.cbuf.Reset() + } + }() + if err != nil { + err = Errorf(codes.Internal, "grpc: %v", err) + return err + } + if err := ss.t.Write(ss.s, out, &transport.Options{Last: false}); err != nil { + return toRPCErr(err) + } + if outPayload != nil { + outPayload.SentTime = time.Now() + ss.statsHandler.HandleRPC(ss.s.Context(), outPayload) + } + return nil +} + +func (ss *serverStream) RecvMsg(m interface{}) (err error) { + defer func() { + if ss.trInfo != nil { + ss.mu.Lock() + if ss.trInfo.tr != nil { + if err == nil { + ss.trInfo.tr.LazyLog(&payload{sent: false, msg: m}, true) + } else if err != io.EOF { + ss.trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) + ss.trInfo.tr.SetError() + } + } + ss.mu.Unlock() + } + }() + var inPayload *stats.InPayload + if ss.statsHandler != nil { + inPayload = &stats.InPayload{} + } + if err := recv(ss.p, ss.codec, ss.s, ss.dc, m, ss.maxMsgSize, inPayload); err != nil { + if err == io.EOF { + return err + } + if err == io.ErrUnexpectedEOF { + err = Errorf(codes.Internal, io.ErrUnexpectedEOF.Error()) + } + return toRPCErr(err) + } + if inPayload != nil { + ss.statsHandler.HandleRPC(ss.s.Context(), inPayload) + } + return nil +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/tap/tap.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/tap/tap.go new file mode 100644 index 00000000000..0f366476742 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/tap/tap.go @@ -0,0 +1,54 @@ +/* + * + * Copyright 2016, Google Inc. + * 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. + * + */ + +// Package tap defines the function handles which are executed on the transport +// layer of gRPC-Go and related information. Everything here is EXPERIMENTAL. +package tap + +import ( + "golang.org/x/net/context" +) + +// Info defines the relevant information needed by the handles. +type Info struct { + // FullMethodName is the string of grpc method (in the format of + // /package.service/method). + FullMethodName string + // TODO: More to be added. +} + +// ServerInHandle defines the function which runs when a new stream is created +// on the server side. Note that it is executed in the per-connection I/O goroutine(s) instead +// of per-RPC goroutine. Therefore, users should NOT have any blocking/time-consuming +// work in this handle. Otherwise all the RPCs would slow down. +type ServerInHandle func(ctx context.Context, info *Info) (context.Context, error) diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/trace.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/trace.go new file mode 100644 index 00000000000..f6747e1dfa4 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/trace.go @@ -0,0 +1,119 @@ +/* + * + * Copyright 2015, Google Inc. + * 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. + * + */ + +package grpc + +import ( + "bytes" + "fmt" + "io" + "net" + "strings" + "time" + + "golang.org/x/net/trace" +) + +// EnableTracing controls whether to trace RPCs using the golang.org/x/net/trace package. +// This should only be set before any RPCs are sent or received by this program. +var EnableTracing = true + +// methodFamily returns the trace family for the given method. +// It turns "/pkg.Service/GetFoo" into "pkg.Service". +func methodFamily(m string) string { + m = strings.TrimPrefix(m, "/") // remove leading slash + if i := strings.Index(m, "/"); i >= 0 { + m = m[:i] // remove everything from second slash + } + if i := strings.LastIndex(m, "."); i >= 0 { + m = m[i+1:] // cut down to last dotted component + } + return m +} + +// traceInfo contains tracing information for an RPC. +type traceInfo struct { + tr trace.Trace + firstLine firstLine +} + +// firstLine is the first line of an RPC trace. +type firstLine struct { + client bool // whether this is a client (outgoing) RPC + remoteAddr net.Addr + deadline time.Duration // may be zero +} + +func (f *firstLine) String() string { + var line bytes.Buffer + io.WriteString(&line, "RPC: ") + if f.client { + io.WriteString(&line, "to") + } else { + io.WriteString(&line, "from") + } + fmt.Fprintf(&line, " %v deadline:", f.remoteAddr) + if f.deadline != 0 { + fmt.Fprint(&line, f.deadline) + } else { + io.WriteString(&line, "none") + } + return line.String() +} + +// payload represents an RPC request or response payload. +type payload struct { + sent bool // whether this is an outgoing payload + msg interface{} // e.g. a proto.Message + // TODO(dsymonds): add stringifying info to codec, and limit how much we hold here? +} + +func (p payload) String() string { + if p.sent { + return fmt.Sprintf("sent: %v", p.msg) + } + return fmt.Sprintf("recv: %v", p.msg) +} + +type fmtStringer struct { + format string + a []interface{} +} + +func (f *fmtStringer) String() string { + return fmt.Sprintf(f.format, f.a...) +} + +type stringer string + +func (s stringer) String() string { return string(s) } diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/control.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/control.go new file mode 100644 index 00000000000..0edbe53a700 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/control.go @@ -0,0 +1,199 @@ +/* + * + * Copyright 2014, Google Inc. + * 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. + * + */ + +package transport + +import ( + "fmt" + "math" + "sync" + "time" + + "golang.org/x/net/http2" +) + +const ( + // The default value of flow control window size in HTTP2 spec. + defaultWindowSize = 65535 + // The initial window size for flow control. + initialWindowSize = defaultWindowSize // for an RPC + initialConnWindowSize = defaultWindowSize * 16 // for a connection + infinity = time.Duration(math.MaxInt64) + defaultKeepaliveTime = infinity + defaultKeepaliveTimeout = time.Duration(20 * time.Second) + defaultMaxStreamsClient = 100 +) + +// The following defines various control items which could flow through +// the control buffer of transport. They represent different aspects of +// control tasks, e.g., flow control, settings, streaming resetting, etc. +type windowUpdate struct { + streamID uint32 + increment uint32 +} + +func (*windowUpdate) item() {} + +type settings struct { + ack bool + ss []http2.Setting +} + +func (*settings) item() {} + +type resetStream struct { + streamID uint32 + code http2.ErrCode +} + +func (*resetStream) item() {} + +type goAway struct { +} + +func (*goAway) item() {} + +type flushIO struct { +} + +func (*flushIO) item() {} + +type ping struct { + ack bool + data [8]byte +} + +func (*ping) item() {} + +// quotaPool is a pool which accumulates the quota and sends it to acquire() +// when it is available. +type quotaPool struct { + c chan int + + mu sync.Mutex + quota int +} + +// newQuotaPool creates a quotaPool which has quota q available to consume. +func newQuotaPool(q int) *quotaPool { + qb := "aPool{ + c: make(chan int, 1), + } + if q > 0 { + qb.c <- q + } else { + qb.quota = q + } + return qb +} + +// add cancels the pending quota sent on acquired, incremented by v and sends +// it back on acquire. +func (qb *quotaPool) add(v int) { + qb.mu.Lock() + defer qb.mu.Unlock() + select { + case n := <-qb.c: + qb.quota += n + default: + } + qb.quota += v + if qb.quota <= 0 { + return + } + // After the pool has been created, this is the only place that sends on + // the channel. Since mu is held at this point and any quota that was sent + // on the channel has been retrieved, we know that this code will always + // place any positive quota value on the channel. + select { + case qb.c <- qb.quota: + qb.quota = 0 + default: + } +} + +// acquire returns the channel on which available quota amounts are sent. +func (qb *quotaPool) acquire() <-chan int { + return qb.c +} + +// inFlow deals with inbound flow control +type inFlow struct { + // The inbound flow control limit for pending data. + limit uint32 + + mu sync.Mutex + // pendingData is the overall data which have been received but not been + // consumed by applications. + pendingData uint32 + // The amount of data the application has consumed but grpc has not sent + // window update for them. Used to reduce window update frequency. + pendingUpdate uint32 +} + +// onData is invoked when some data frame is received. It updates pendingData. +func (f *inFlow) onData(n uint32) error { + f.mu.Lock() + defer f.mu.Unlock() + f.pendingData += n + if f.pendingData+f.pendingUpdate > f.limit { + return fmt.Errorf("received %d-bytes data exceeding the limit %d bytes", f.pendingData+f.pendingUpdate, f.limit) + } + return nil +} + +// onRead is invoked when the application reads the data. It returns the window size +// to be sent to the peer. +func (f *inFlow) onRead(n uint32) uint32 { + f.mu.Lock() + defer f.mu.Unlock() + if f.pendingData == 0 { + return 0 + } + f.pendingData -= n + f.pendingUpdate += n + if f.pendingUpdate >= f.limit/4 { + wu := f.pendingUpdate + f.pendingUpdate = 0 + return wu + } + return 0 +} + +func (f *inFlow) resetPendingData() uint32 { + f.mu.Lock() + defer f.mu.Unlock() + n := f.pendingData + f.pendingData = 0 + return n +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/go16.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/go16.go new file mode 100644 index 00000000000..ee1c46bad57 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/go16.go @@ -0,0 +1,46 @@ +// +build go1.6,!go1.7 + +/* + * Copyright 2016, Google Inc. + * 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. + * + */ + +package transport + +import ( + "net" + + "golang.org/x/net/context" +) + +// dialContext connects to the address on the named network. +func dialContext(ctx context.Context, network, address string) (net.Conn, error) { + return (&net.Dialer{Cancel: ctx.Done()}).Dial(network, address) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/go17.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/go17.go new file mode 100644 index 00000000000..356f13ff197 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/go17.go @@ -0,0 +1,46 @@ +// +build go1.7 + +/* + * Copyright 2016, Google Inc. + * 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. + * + */ + +package transport + +import ( + "net" + + "golang.org/x/net/context" +) + +// dialContext connects to the address on the named network. +func dialContext(ctx context.Context, network, address string) (net.Conn, error) { + return (&net.Dialer{}).DialContext(ctx, network, address) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/handler_server.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/handler_server.go new file mode 100644 index 00000000000..10b6dc0b19d --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/handler_server.go @@ -0,0 +1,397 @@ +/* + * Copyright 2016, Google Inc. + * 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. + * + */ + +// This file is the implementation of a gRPC server using HTTP/2 which +// uses the standard Go http2 Server implementation (via the +// http.Handler interface), rather than speaking low-level HTTP/2 +// frames itself. It is the implementation of *grpc.Server.ServeHTTP. + +package transport + +import ( + "errors" + "fmt" + "io" + "net" + "net/http" + "strings" + "sync" + "time" + + "golang.org/x/net/context" + "golang.org/x/net/http2" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/peer" +) + +// NewServerHandlerTransport returns a ServerTransport handling gRPC +// from inside an http.Handler. It requires that the http Server +// supports HTTP/2. +func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request) (ServerTransport, error) { + if r.ProtoMajor != 2 { + return nil, errors.New("gRPC requires HTTP/2") + } + if r.Method != "POST" { + return nil, errors.New("invalid gRPC request method") + } + if !validContentType(r.Header.Get("Content-Type")) { + return nil, errors.New("invalid gRPC request content-type") + } + if _, ok := w.(http.Flusher); !ok { + return nil, errors.New("gRPC requires a ResponseWriter supporting http.Flusher") + } + if _, ok := w.(http.CloseNotifier); !ok { + return nil, errors.New("gRPC requires a ResponseWriter supporting http.CloseNotifier") + } + + st := &serverHandlerTransport{ + rw: w, + req: r, + closedCh: make(chan struct{}), + writes: make(chan func()), + } + + if v := r.Header.Get("grpc-timeout"); v != "" { + to, err := decodeTimeout(v) + if err != nil { + return nil, streamErrorf(codes.Internal, "malformed time-out: %v", err) + } + st.timeoutSet = true + st.timeout = to + } + + var metakv []string + if r.Host != "" { + metakv = append(metakv, ":authority", r.Host) + } + for k, vv := range r.Header { + k = strings.ToLower(k) + if isReservedHeader(k) && !isWhitelistedPseudoHeader(k) { + continue + } + for _, v := range vv { + if k == "user-agent" { + // user-agent is special. Copying logic of http_util.go. + if i := strings.LastIndex(v, " "); i == -1 { + // There is no application user agent string being set + continue + } else { + v = v[:i] + } + } + metakv = append(metakv, k, v) + } + } + st.headerMD = metadata.Pairs(metakv...) + + return st, nil +} + +// serverHandlerTransport is an implementation of ServerTransport +// which replies to exactly one gRPC request (exactly one HTTP request), +// using the net/http.Handler interface. This http.Handler is guaranteed +// at this point to be speaking over HTTP/2, so it's able to speak valid +// gRPC. +type serverHandlerTransport struct { + rw http.ResponseWriter + req *http.Request + timeoutSet bool + timeout time.Duration + didCommonHeaders bool + + headerMD metadata.MD + + closeOnce sync.Once + closedCh chan struct{} // closed on Close + + // writes is a channel of code to run serialized in the + // ServeHTTP (HandleStreams) goroutine. The channel is closed + // when WriteStatus is called. + writes chan func() +} + +func (ht *serverHandlerTransport) Close() error { + ht.closeOnce.Do(ht.closeCloseChanOnce) + return nil +} + +func (ht *serverHandlerTransport) closeCloseChanOnce() { close(ht.closedCh) } + +func (ht *serverHandlerTransport) RemoteAddr() net.Addr { return strAddr(ht.req.RemoteAddr) } + +// strAddr is a net.Addr backed by either a TCP "ip:port" string, or +// the empty string if unknown. +type strAddr string + +func (a strAddr) Network() string { + if a != "" { + // Per the documentation on net/http.Request.RemoteAddr, if this is + // set, it's set to the IP:port of the peer (hence, TCP): + // https://golang.org/pkg/net/http/#Request + // + // If we want to support Unix sockets later, we can + // add our own grpc-specific convention within the + // grpc codebase to set RemoteAddr to a different + // format, or probably better: we can attach it to the + // context and use that from serverHandlerTransport.RemoteAddr. + return "tcp" + } + return "" +} + +func (a strAddr) String() string { return string(a) } + +// do runs fn in the ServeHTTP goroutine. +func (ht *serverHandlerTransport) do(fn func()) error { + select { + case ht.writes <- fn: + return nil + case <-ht.closedCh: + return ErrConnClosing + } +} + +func (ht *serverHandlerTransport) WriteStatus(s *Stream, statusCode codes.Code, statusDesc string) error { + err := ht.do(func() { + ht.writeCommonHeaders(s) + + // And flush, in case no header or body has been sent yet. + // This forces a separation of headers and trailers if this is the + // first call (for example, in end2end tests's TestNoService). + ht.rw.(http.Flusher).Flush() + + h := ht.rw.Header() + h.Set("Grpc-Status", fmt.Sprintf("%d", statusCode)) + if statusDesc != "" { + h.Set("Grpc-Message", encodeGrpcMessage(statusDesc)) + } + if md := s.Trailer(); len(md) > 0 { + for k, vv := range md { + // Clients don't tolerate reading restricted headers after some non restricted ones were sent. + if isReservedHeader(k) { + continue + } + for _, v := range vv { + // http2 ResponseWriter mechanism to + // send undeclared Trailers after the + // headers have possibly been written. + h.Add(http2.TrailerPrefix+k, v) + } + } + } + }) + close(ht.writes) + return err +} + +// writeCommonHeaders sets common headers on the first write +// call (Write, WriteHeader, or WriteStatus). +func (ht *serverHandlerTransport) writeCommonHeaders(s *Stream) { + if ht.didCommonHeaders { + return + } + ht.didCommonHeaders = true + + h := ht.rw.Header() + h["Date"] = nil // suppress Date to make tests happy; TODO: restore + h.Set("Content-Type", "application/grpc") + + // Predeclare trailers we'll set later in WriteStatus (after the body). + // This is a SHOULD in the HTTP RFC, and the way you add (known) + // Trailers per the net/http.ResponseWriter contract. + // See https://golang.org/pkg/net/http/#ResponseWriter + // and https://golang.org/pkg/net/http/#example_ResponseWriter_trailers + h.Add("Trailer", "Grpc-Status") + h.Add("Trailer", "Grpc-Message") + + if s.sendCompress != "" { + h.Set("Grpc-Encoding", s.sendCompress) + } +} + +func (ht *serverHandlerTransport) Write(s *Stream, data []byte, opts *Options) error { + return ht.do(func() { + ht.writeCommonHeaders(s) + ht.rw.Write(data) + if !opts.Delay { + ht.rw.(http.Flusher).Flush() + } + }) +} + +func (ht *serverHandlerTransport) WriteHeader(s *Stream, md metadata.MD) error { + return ht.do(func() { + ht.writeCommonHeaders(s) + h := ht.rw.Header() + for k, vv := range md { + // Clients don't tolerate reading restricted headers after some non restricted ones were sent. + if isReservedHeader(k) { + continue + } + for _, v := range vv { + h.Add(k, v) + } + } + ht.rw.WriteHeader(200) + ht.rw.(http.Flusher).Flush() + }) +} + +func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), traceCtx func(context.Context, string) context.Context) { + // With this transport type there will be exactly 1 stream: this HTTP request. + + var ctx context.Context + var cancel context.CancelFunc + if ht.timeoutSet { + ctx, cancel = context.WithTimeout(context.Background(), ht.timeout) + } else { + ctx, cancel = context.WithCancel(context.Background()) + } + + // requestOver is closed when either the request's context is done + // or the status has been written via WriteStatus. + requestOver := make(chan struct{}) + + // clientGone receives a single value if peer is gone, either + // because the underlying connection is dead or because the + // peer sends an http2 RST_STREAM. + clientGone := ht.rw.(http.CloseNotifier).CloseNotify() + go func() { + select { + case <-requestOver: + return + case <-ht.closedCh: + case <-clientGone: + } + cancel() + }() + + req := ht.req + + s := &Stream{ + id: 0, // irrelevant + windowHandler: func(int) {}, // nothing + cancel: cancel, + buf: newRecvBuffer(), + st: ht, + method: req.URL.Path, + recvCompress: req.Header.Get("grpc-encoding"), + } + pr := &peer.Peer{ + Addr: ht.RemoteAddr(), + } + if req.TLS != nil { + pr.AuthInfo = credentials.TLSInfo{State: *req.TLS} + } + ctx = metadata.NewContext(ctx, ht.headerMD) + ctx = peer.NewContext(ctx, pr) + s.ctx = newContextWithStream(ctx, s) + s.dec = &recvBufferReader{ctx: s.ctx, recv: s.buf} + + // readerDone is closed when the Body.Read-ing goroutine exits. + readerDone := make(chan struct{}) + go func() { + defer close(readerDone) + + // TODO: minimize garbage, optimize recvBuffer code/ownership + const readSize = 8196 + for buf := make([]byte, readSize); ; { + n, err := req.Body.Read(buf) + if n > 0 { + s.buf.put(&recvMsg{data: buf[:n:n]}) + buf = buf[n:] + } + if err != nil { + s.buf.put(&recvMsg{err: mapRecvMsgError(err)}) + return + } + if len(buf) == 0 { + buf = make([]byte, readSize) + } + } + }() + + // startStream is provided by the *grpc.Server's serveStreams. + // It starts a goroutine serving s and exits immediately. + // The goroutine that is started is the one that then calls + // into ht, calling WriteHeader, Write, WriteStatus, Close, etc. + startStream(s) + + ht.runStream() + close(requestOver) + + // Wait for reading goroutine to finish. + req.Body.Close() + <-readerDone +} + +func (ht *serverHandlerTransport) runStream() { + for { + select { + case fn, ok := <-ht.writes: + if !ok { + return + } + fn() + case <-ht.closedCh: + return + } + } +} + +func (ht *serverHandlerTransport) Drain() { + panic("Drain() is not implemented") +} + +// mapRecvMsgError returns the non-nil err into the appropriate +// error value as expected by callers of *grpc.parser.recvMsg. +// In particular, in can only be: +// * io.EOF +// * io.ErrUnexpectedEOF +// * of type transport.ConnectionError +// * of type transport.StreamError +func mapRecvMsgError(err error) error { + if err == io.EOF || err == io.ErrUnexpectedEOF { + return err + } + if se, ok := err.(http2.StreamError); ok { + if code, ok := http2ErrConvTab[se.Code]; ok { + return StreamError{ + Code: code, + Desc: se.Error(), + } + } + } + return connectionErrorf(true, err, err.Error()) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http2_client.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http2_client.go new file mode 100644 index 00000000000..5f579b8b01b --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http2_client.go @@ -0,0 +1,1230 @@ +/* + * + * Copyright 2014, Google Inc. + * 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. + * + */ + +package transport + +import ( + "bytes" + "fmt" + "io" + "math" + "net" + "strings" + "sync" + "sync/atomic" + "time" + + "golang.org/x/net/context" + "golang.org/x/net/http2" + "golang.org/x/net/http2/hpack" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/keepalive" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/peer" + "google.golang.org/grpc/stats" +) + +// http2Client implements the ClientTransport interface with HTTP2. +type http2Client struct { + ctx context.Context + target string // server name/addr + userAgent string + md interface{} + conn net.Conn // underlying communication channel + remoteAddr net.Addr + localAddr net.Addr + authInfo credentials.AuthInfo // auth info about the connection + nextID uint32 // the next stream ID to be used + + // writableChan synchronizes write access to the transport. + // A writer acquires the write lock by sending a value on writableChan + // and releases it by receiving from writableChan. + writableChan chan int + // shutdownChan is closed when Close is called. + // Blocking operations should select on shutdownChan to avoid + // blocking forever after Close. + // TODO(zhaoq): Maybe have a channel context? + shutdownChan chan struct{} + // errorChan is closed to notify the I/O error to the caller. + errorChan chan struct{} + // goAway is closed to notify the upper layer (i.e., addrConn.transportMonitor) + // that the server sent GoAway on this transport. + goAway chan struct{} + // awakenKeepalive is used to wake up keepalive when after it has gone dormant. + awakenKeepalive chan struct{} + + framer *framer + hBuf *bytes.Buffer // the buffer for HPACK encoding + hEnc *hpack.Encoder // HPACK encoder + + // controlBuf delivers all the control related tasks (e.g., window + // updates, reset streams, and various settings) to the controller. + controlBuf *recvBuffer + fc *inFlow + // sendQuotaPool provides flow control to outbound message. + sendQuotaPool *quotaPool + // streamsQuota limits the max number of concurrent streams. + streamsQuota *quotaPool + + // The scheme used: https if TLS is on, http otherwise. + scheme string + + creds []credentials.PerRPCCredentials + + // Boolean to keep track of reading activity on transport. + // 1 is true and 0 is false. + activity uint32 // Accessed atomically. + kp keepalive.ClientParameters + + statsHandler stats.Handler + + mu sync.Mutex // guard the following variables + state transportState // the state of underlying connection + activeStreams map[uint32]*Stream + // The max number of concurrent streams + maxStreams int + // the per-stream outbound flow control window size set by the peer. + streamSendQuota uint32 + // goAwayID records the Last-Stream-ID in the GoAway frame from the server. + goAwayID uint32 + // prevGoAway ID records the Last-Stream-ID in the previous GOAway frame. + prevGoAwayID uint32 +} + +func dial(ctx context.Context, fn func(context.Context, string) (net.Conn, error), addr string) (net.Conn, error) { + if fn != nil { + return fn(ctx, addr) + } + return dialContext(ctx, "tcp", addr) +} + +func isTemporary(err error) bool { + switch err { + case io.EOF: + // Connection closures may be resolved upon retry, and are thus + // treated as temporary. + return true + case context.DeadlineExceeded: + // In Go 1.7, context.DeadlineExceeded implements Timeout(), and this + // special case is not needed. Until then, we need to keep this + // clause. + return true + } + + switch err := err.(type) { + case interface { + Temporary() bool + }: + return err.Temporary() + case interface { + Timeout() bool + }: + // Timeouts may be resolved upon retry, and are thus treated as + // temporary. + return err.Timeout() + } + return false +} + +// newHTTP2Client constructs a connected ClientTransport to addr based on HTTP2 +// and starts to receive messages on it. Non-nil error returns if construction +// fails. +func newHTTP2Client(ctx context.Context, addr TargetInfo, opts ConnectOptions) (_ ClientTransport, err error) { + scheme := "http" + conn, err := dial(ctx, opts.Dialer, addr.Addr) + if err != nil { + if opts.FailOnNonTempDialError { + return nil, connectionErrorf(isTemporary(err), err, "transport: %v", err) + } + return nil, connectionErrorf(true, err, "transport: %v", err) + } + // Any further errors will close the underlying connection + defer func(conn net.Conn) { + if err != nil { + conn.Close() + } + }(conn) + var authInfo credentials.AuthInfo + if creds := opts.TransportCredentials; creds != nil { + scheme = "https" + conn, authInfo, err = creds.ClientHandshake(ctx, addr.Addr, conn) + if err != nil { + // Credentials handshake errors are typically considered permanent + // to avoid retrying on e.g. bad certificates. + temp := isTemporary(err) + return nil, connectionErrorf(temp, err, "transport: %v", err) + } + } + kp := opts.KeepaliveParams + // Validate keepalive parameters. + if kp.Time == 0 { + kp.Time = defaultKeepaliveTime + } + if kp.Timeout == 0 { + kp.Timeout = defaultKeepaliveTimeout + } + var buf bytes.Buffer + t := &http2Client{ + ctx: ctx, + target: addr.Addr, + userAgent: opts.UserAgent, + md: addr.Metadata, + conn: conn, + remoteAddr: conn.RemoteAddr(), + localAddr: conn.LocalAddr(), + authInfo: authInfo, + // The client initiated stream id is odd starting from 1. + nextID: 1, + writableChan: make(chan int, 1), + shutdownChan: make(chan struct{}), + errorChan: make(chan struct{}), + goAway: make(chan struct{}), + awakenKeepalive: make(chan struct{}, 1), + framer: newFramer(conn), + hBuf: &buf, + hEnc: hpack.NewEncoder(&buf), + controlBuf: newRecvBuffer(), + fc: &inFlow{limit: initialConnWindowSize}, + sendQuotaPool: newQuotaPool(defaultWindowSize), + scheme: scheme, + state: reachable, + activeStreams: make(map[uint32]*Stream), + creds: opts.PerRPCCredentials, + maxStreams: defaultMaxStreamsClient, + streamsQuota: newQuotaPool(defaultMaxStreamsClient), + streamSendQuota: defaultWindowSize, + kp: kp, + statsHandler: opts.StatsHandler, + } + // Make sure awakenKeepalive can't be written upon. + // keepalive routine will make it writable, if need be. + t.awakenKeepalive <- struct{}{} + if t.statsHandler != nil { + t.ctx = t.statsHandler.TagConn(t.ctx, &stats.ConnTagInfo{ + RemoteAddr: t.remoteAddr, + LocalAddr: t.localAddr, + }) + connBegin := &stats.ConnBegin{ + Client: true, + } + t.statsHandler.HandleConn(t.ctx, connBegin) + } + // Start the reader goroutine for incoming message. Each transport has + // a dedicated goroutine which reads HTTP2 frame from network. Then it + // dispatches the frame to the corresponding stream entity. + go t.reader() + // Send connection preface to server. + n, err := t.conn.Write(clientPreface) + if err != nil { + t.Close() + return nil, connectionErrorf(true, err, "transport: %v", err) + } + if n != len(clientPreface) { + t.Close() + return nil, connectionErrorf(true, err, "transport: preface mismatch, wrote %d bytes; want %d", n, len(clientPreface)) + } + if initialWindowSize != defaultWindowSize { + err = t.framer.writeSettings(true, http2.Setting{ + ID: http2.SettingInitialWindowSize, + Val: uint32(initialWindowSize), + }) + } else { + err = t.framer.writeSettings(true) + } + if err != nil { + t.Close() + return nil, connectionErrorf(true, err, "transport: %v", err) + } + // Adjust the connection flow control window if needed. + if delta := uint32(initialConnWindowSize - defaultWindowSize); delta > 0 { + if err := t.framer.writeWindowUpdate(true, 0, delta); err != nil { + t.Close() + return nil, connectionErrorf(true, err, "transport: %v", err) + } + } + go t.controller() + if t.kp.Time != infinity { + go t.keepalive() + } + t.writableChan <- 0 + return t, nil +} + +func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr) *Stream { + // TODO(zhaoq): Handle uint32 overflow of Stream.id. + s := &Stream{ + id: t.nextID, + done: make(chan struct{}), + goAway: make(chan struct{}), + method: callHdr.Method, + sendCompress: callHdr.SendCompress, + buf: newRecvBuffer(), + fc: &inFlow{limit: initialWindowSize}, + sendQuotaPool: newQuotaPool(int(t.streamSendQuota)), + headerChan: make(chan struct{}), + } + t.nextID += 2 + s.windowHandler = func(n int) { + t.updateWindow(s, uint32(n)) + } + // The client side stream context should have exactly the same life cycle with the user provided context. + // That means, s.ctx should be read-only. And s.ctx is done iff ctx is done. + // So we use the original context here instead of creating a copy. + s.ctx = ctx + s.dec = &recvBufferReader{ + ctx: s.ctx, + goAway: s.goAway, + recv: s.buf, + } + return s +} + +// NewStream creates a stream and register it into the transport as "active" +// streams. +func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Stream, err error) { + pr := &peer.Peer{ + Addr: t.remoteAddr, + } + // Attach Auth info if there is any. + if t.authInfo != nil { + pr.AuthInfo = t.authInfo + } + userCtx := ctx + ctx = peer.NewContext(ctx, pr) + authData := make(map[string]string) + for _, c := range t.creds { + // Construct URI required to get auth request metadata. + var port string + if pos := strings.LastIndex(t.target, ":"); pos != -1 { + // Omit port if it is the default one. + if t.target[pos+1:] != "443" { + port = ":" + t.target[pos+1:] + } + } + pos := strings.LastIndex(callHdr.Method, "/") + if pos == -1 { + return nil, streamErrorf(codes.InvalidArgument, "transport: malformed method name: %q", callHdr.Method) + } + audience := "https://" + callHdr.Host + port + callHdr.Method[:pos] + data, err := c.GetRequestMetadata(ctx, audience) + if err != nil { + return nil, streamErrorf(codes.InvalidArgument, "transport: %v", err) + } + for k, v := range data { + authData[k] = v + } + } + t.mu.Lock() + if t.activeStreams == nil { + t.mu.Unlock() + return nil, ErrConnClosing + } + if t.state == draining { + t.mu.Unlock() + return nil, ErrStreamDrain + } + if t.state != reachable { + t.mu.Unlock() + return nil, ErrConnClosing + } + t.mu.Unlock() + sq, err := wait(ctx, nil, nil, t.shutdownChan, t.streamsQuota.acquire()) + if err != nil { + return nil, err + } + // Returns the quota balance back. + if sq > 1 { + t.streamsQuota.add(sq - 1) + } + if _, err := wait(ctx, nil, nil, t.shutdownChan, t.writableChan); err != nil { + // Return the quota back now because there is no stream returned to the caller. + if _, ok := err.(StreamError); ok { + t.streamsQuota.add(1) + } + return nil, err + } + t.mu.Lock() + if t.state == draining { + t.mu.Unlock() + t.streamsQuota.add(1) + // Need to make t writable again so that the rpc in flight can still proceed. + t.writableChan <- 0 + return nil, ErrStreamDrain + } + if t.state != reachable { + t.mu.Unlock() + return nil, ErrConnClosing + } + s := t.newStream(ctx, callHdr) + s.clientStatsCtx = userCtx + t.activeStreams[s.id] = s + // If the number of active streams change from 0 to 1, then check if keepalive + // has gone dormant. If so, wake it up. + if len(t.activeStreams) == 1 { + select { + case t.awakenKeepalive <- struct{}{}: + t.framer.writePing(false, false, [8]byte{}) + default: + } + } + + t.mu.Unlock() + + // HPACK encodes various headers. Note that once WriteField(...) is + // called, the corresponding headers/continuation frame has to be sent + // because hpack.Encoder is stateful. + t.hBuf.Reset() + t.hEnc.WriteField(hpack.HeaderField{Name: ":method", Value: "POST"}) + t.hEnc.WriteField(hpack.HeaderField{Name: ":scheme", Value: t.scheme}) + t.hEnc.WriteField(hpack.HeaderField{Name: ":path", Value: callHdr.Method}) + t.hEnc.WriteField(hpack.HeaderField{Name: ":authority", Value: callHdr.Host}) + t.hEnc.WriteField(hpack.HeaderField{Name: "content-type", Value: "application/grpc"}) + t.hEnc.WriteField(hpack.HeaderField{Name: "user-agent", Value: t.userAgent}) + t.hEnc.WriteField(hpack.HeaderField{Name: "te", Value: "trailers"}) + + if callHdr.SendCompress != "" { + t.hEnc.WriteField(hpack.HeaderField{Name: "grpc-encoding", Value: callHdr.SendCompress}) + } + if dl, ok := ctx.Deadline(); ok { + // Send out timeout regardless its value. The server can detect timeout context by itself. + timeout := dl.Sub(time.Now()) + t.hEnc.WriteField(hpack.HeaderField{Name: "grpc-timeout", Value: encodeTimeout(timeout)}) + } + + for k, v := range authData { + // Capital header names are illegal in HTTP/2. + k = strings.ToLower(k) + t.hEnc.WriteField(hpack.HeaderField{Name: k, Value: v}) + } + var ( + hasMD bool + endHeaders bool + ) + if md, ok := metadata.FromContext(ctx); ok { + hasMD = true + for k, v := range md { + // HTTP doesn't allow you to set pseudoheaders after non pseudoheaders were set. + if isReservedHeader(k) { + continue + } + for _, entry := range v { + t.hEnc.WriteField(hpack.HeaderField{Name: k, Value: entry}) + } + } + } + if md, ok := t.md.(*metadata.MD); ok { + for k, v := range *md { + if isReservedHeader(k) { + continue + } + for _, entry := range v { + t.hEnc.WriteField(hpack.HeaderField{Name: k, Value: entry}) + } + } + } + first := true + bufLen := t.hBuf.Len() + // Sends the headers in a single batch even when they span multiple frames. + for !endHeaders { + size := t.hBuf.Len() + if size > http2MaxFrameLen { + size = http2MaxFrameLen + } else { + endHeaders = true + } + var flush bool + if endHeaders && (hasMD || callHdr.Flush) { + flush = true + } + if first { + // Sends a HeadersFrame to server to start a new stream. + p := http2.HeadersFrameParam{ + StreamID: s.id, + BlockFragment: t.hBuf.Next(size), + EndStream: false, + EndHeaders: endHeaders, + } + // Do a force flush for the buffered frames iff it is the last headers frame + // and there is header metadata to be sent. Otherwise, there is flushing until + // the corresponding data frame is written. + err = t.framer.writeHeaders(flush, p) + first = false + } else { + // Sends Continuation frames for the leftover headers. + err = t.framer.writeContinuation(flush, s.id, endHeaders, t.hBuf.Next(size)) + } + if err != nil { + t.notifyError(err) + return nil, connectionErrorf(true, err, "transport: %v", err) + } + } + if t.statsHandler != nil { + outHeader := &stats.OutHeader{ + Client: true, + WireLength: bufLen, + FullMethod: callHdr.Method, + RemoteAddr: t.remoteAddr, + LocalAddr: t.localAddr, + Compression: callHdr.SendCompress, + } + t.statsHandler.HandleRPC(s.clientStatsCtx, outHeader) + } + t.writableChan <- 0 + return s, nil +} + +// CloseStream clears the footprint of a stream when the stream is not needed any more. +// This must not be executed in reader's goroutine. +func (t *http2Client) CloseStream(s *Stream, err error) { + t.mu.Lock() + if t.activeStreams == nil { + t.mu.Unlock() + return + } + delete(t.activeStreams, s.id) + if t.state == draining && len(t.activeStreams) == 0 { + // The transport is draining and s is the last live stream on t. + t.mu.Unlock() + t.Close() + return + } + t.mu.Unlock() + // rstStream is true in case the stream is being closed at the client-side + // and the server needs to be intimated about it by sending a RST_STREAM + // frame. + // To make sure this frame is written to the wire before the headers of the + // next stream waiting for streamsQuota, we add to streamsQuota pool only + // after having acquired the writableChan to send RST_STREAM out (look at + // the controller() routine). + var rstStream bool + var rstError http2.ErrCode + defer func() { + // In case, the client doesn't have to send RST_STREAM to server + // we can safely add back to streamsQuota pool now. + if !rstStream { + t.streamsQuota.add(1) + return + } + t.controlBuf.put(&resetStream{s.id, rstError}) + }() + s.mu.Lock() + rstStream = s.rstStream + rstError = s.rstError + if q := s.fc.resetPendingData(); q > 0 { + if n := t.fc.onRead(q); n > 0 { + t.controlBuf.put(&windowUpdate{0, n}) + } + } + if s.state == streamDone { + s.mu.Unlock() + return + } + if !s.headerDone { + close(s.headerChan) + s.headerDone = true + } + s.state = streamDone + s.mu.Unlock() + if _, ok := err.(StreamError); ok { + rstStream = true + rstError = http2.ErrCodeCancel + } +} + +// Close kicks off the shutdown process of the transport. This should be called +// only once on a transport. Once it is called, the transport should not be +// accessed any more. +func (t *http2Client) Close() (err error) { + t.mu.Lock() + if t.state == closing { + t.mu.Unlock() + return + } + if t.state == reachable || t.state == draining { + close(t.errorChan) + } + t.state = closing + t.mu.Unlock() + close(t.shutdownChan) + err = t.conn.Close() + t.mu.Lock() + streams := t.activeStreams + t.activeStreams = nil + t.mu.Unlock() + // Notify all active streams. + for _, s := range streams { + s.mu.Lock() + if !s.headerDone { + close(s.headerChan) + s.headerDone = true + } + s.mu.Unlock() + s.write(recvMsg{err: ErrConnClosing}) + } + if t.statsHandler != nil { + connEnd := &stats.ConnEnd{ + Client: true, + } + t.statsHandler.HandleConn(t.ctx, connEnd) + } + return +} + +func (t *http2Client) GracefulClose() error { + t.mu.Lock() + switch t.state { + case unreachable: + // The server may close the connection concurrently. t is not available for + // any streams. Close it now. + t.mu.Unlock() + t.Close() + return nil + case closing: + t.mu.Unlock() + return nil + } + // Notify the streams which were initiated after the server sent GOAWAY. + select { + case <-t.goAway: + n := t.prevGoAwayID + if n == 0 && t.nextID > 1 { + n = t.nextID - 2 + } + m := t.goAwayID + 2 + if m == 2 { + m = 1 + } + for i := m; i <= n; i += 2 { + if s, ok := t.activeStreams[i]; ok { + close(s.goAway) + } + } + default: + } + if t.state == draining { + t.mu.Unlock() + return nil + } + t.state = draining + active := len(t.activeStreams) + t.mu.Unlock() + if active == 0 { + return t.Close() + } + return nil +} + +// Write formats the data into HTTP2 data frame(s) and sends it out. The caller +// should proceed only if Write returns nil. +// TODO(zhaoq): opts.Delay is ignored in this implementation. Support it later +// if it improves the performance. +func (t *http2Client) Write(s *Stream, data []byte, opts *Options) error { + r := bytes.NewBuffer(data) + for { + var p []byte + if r.Len() > 0 { + size := http2MaxFrameLen + // Wait until the stream has some quota to send the data. + sq, err := wait(s.ctx, s.done, s.goAway, t.shutdownChan, s.sendQuotaPool.acquire()) + if err != nil { + return err + } + // Wait until the transport has some quota to send the data. + tq, err := wait(s.ctx, s.done, s.goAway, t.shutdownChan, t.sendQuotaPool.acquire()) + if err != nil { + return err + } + if sq < size { + size = sq + } + if tq < size { + size = tq + } + p = r.Next(size) + ps := len(p) + if ps < sq { + // Overbooked stream quota. Return it back. + s.sendQuotaPool.add(sq - ps) + } + if ps < tq { + // Overbooked transport quota. Return it back. + t.sendQuotaPool.add(tq - ps) + } + } + var ( + endStream bool + forceFlush bool + ) + if opts.Last && r.Len() == 0 { + endStream = true + } + // Indicate there is a writer who is about to write a data frame. + t.framer.adjustNumWriters(1) + // Got some quota. Try to acquire writing privilege on the transport. + if _, err := wait(s.ctx, s.done, s.goAway, t.shutdownChan, t.writableChan); err != nil { + if _, ok := err.(StreamError); ok || err == io.EOF { + // Return the connection quota back. + t.sendQuotaPool.add(len(p)) + } + if t.framer.adjustNumWriters(-1) == 0 { + // This writer is the last one in this batch and has the + // responsibility to flush the buffered frames. It queues + // a flush request to controlBuf instead of flushing directly + // in order to avoid the race with other writing or flushing. + t.controlBuf.put(&flushIO{}) + } + return err + } + select { + case <-s.ctx.Done(): + t.sendQuotaPool.add(len(p)) + if t.framer.adjustNumWriters(-1) == 0 { + t.controlBuf.put(&flushIO{}) + } + t.writableChan <- 0 + return ContextErr(s.ctx.Err()) + default: + } + if r.Len() == 0 && t.framer.adjustNumWriters(0) == 1 { + // Do a force flush iff this is last frame for the entire gRPC message + // and the caller is the only writer at this moment. + forceFlush = true + } + // If WriteData fails, all the pending streams will be handled + // by http2Client.Close(). No explicit CloseStream() needs to be + // invoked. + if err := t.framer.writeData(forceFlush, s.id, endStream, p); err != nil { + t.notifyError(err) + return connectionErrorf(true, err, "transport: %v", err) + } + if t.framer.adjustNumWriters(-1) == 0 { + t.framer.flushWrite() + } + t.writableChan <- 0 + if r.Len() == 0 { + break + } + } + if !opts.Last { + return nil + } + s.mu.Lock() + if s.state != streamDone { + s.state = streamWriteDone + } + s.mu.Unlock() + return nil +} + +func (t *http2Client) getStream(f http2.Frame) (*Stream, bool) { + t.mu.Lock() + defer t.mu.Unlock() + s, ok := t.activeStreams[f.Header().StreamID] + return s, ok +} + +// updateWindow adjusts the inbound quota for the stream and the transport. +// Window updates will deliver to the controller for sending when +// the cumulative quota exceeds the corresponding threshold. +func (t *http2Client) updateWindow(s *Stream, n uint32) { + s.mu.Lock() + defer s.mu.Unlock() + if s.state == streamDone { + return + } + if w := t.fc.onRead(n); w > 0 { + t.controlBuf.put(&windowUpdate{0, w}) + } + if w := s.fc.onRead(n); w > 0 { + t.controlBuf.put(&windowUpdate{s.id, w}) + } +} + +func (t *http2Client) handleData(f *http2.DataFrame) { + size := f.Header().Length + if err := t.fc.onData(uint32(size)); err != nil { + t.notifyError(connectionErrorf(true, err, "%v", err)) + return + } + // Select the right stream to dispatch. + s, ok := t.getStream(f) + if !ok { + if w := t.fc.onRead(uint32(size)); w > 0 { + t.controlBuf.put(&windowUpdate{0, w}) + } + return + } + if size > 0 { + if f.Header().Flags.Has(http2.FlagDataPadded) { + if w := t.fc.onRead(uint32(size) - uint32(len(f.Data()))); w > 0 { + t.controlBuf.put(&windowUpdate{0, w}) + } + } + s.mu.Lock() + if s.state == streamDone { + s.mu.Unlock() + // The stream has been closed. Release the corresponding quota. + if w := t.fc.onRead(uint32(size)); w > 0 { + t.controlBuf.put(&windowUpdate{0, w}) + } + return + } + if err := s.fc.onData(uint32(size)); err != nil { + s.state = streamDone + s.statusCode = codes.Internal + s.statusDesc = err.Error() + s.rstStream = true + s.rstError = http2.ErrCodeFlowControl + close(s.done) + s.mu.Unlock() + s.write(recvMsg{err: io.EOF}) + return + } + if f.Header().Flags.Has(http2.FlagDataPadded) { + if w := s.fc.onRead(uint32(size) - uint32(len(f.Data()))); w > 0 { + t.controlBuf.put(&windowUpdate{s.id, w}) + } + } + s.mu.Unlock() + // TODO(bradfitz, zhaoq): A copy is required here because there is no + // guarantee f.Data() is consumed before the arrival of next frame. + // Can this copy be eliminated? + if len(f.Data()) > 0 { + data := make([]byte, len(f.Data())) + copy(data, f.Data()) + s.write(recvMsg{data: data}) + } + } + // The server has closed the stream without sending trailers. Record that + // the read direction is closed, and set the status appropriately. + if f.FrameHeader.Flags.Has(http2.FlagDataEndStream) { + s.mu.Lock() + if s.state == streamDone { + s.mu.Unlock() + return + } + s.state = streamDone + s.statusCode = codes.Internal + s.statusDesc = "server closed the stream without sending trailers" + close(s.done) + s.mu.Unlock() + s.write(recvMsg{err: io.EOF}) + } +} + +func (t *http2Client) handleRSTStream(f *http2.RSTStreamFrame) { + s, ok := t.getStream(f) + if !ok { + return + } + s.mu.Lock() + if s.state == streamDone { + s.mu.Unlock() + return + } + s.state = streamDone + if !s.headerDone { + close(s.headerChan) + s.headerDone = true + } + s.statusCode, ok = http2ErrConvTab[http2.ErrCode(f.ErrCode)] + if !ok { + grpclog.Println("transport: http2Client.handleRSTStream found no mapped gRPC status for the received http2 error ", f.ErrCode) + s.statusCode = codes.Unknown + } + s.statusDesc = fmt.Sprintf("stream terminated by RST_STREAM with error code: %d", f.ErrCode) + close(s.done) + s.mu.Unlock() + s.write(recvMsg{err: io.EOF}) +} + +func (t *http2Client) handleSettings(f *http2.SettingsFrame) { + if f.IsAck() { + return + } + var ss []http2.Setting + f.ForeachSetting(func(s http2.Setting) error { + ss = append(ss, s) + return nil + }) + // The settings will be applied once the ack is sent. + t.controlBuf.put(&settings{ack: true, ss: ss}) +} + +func (t *http2Client) handlePing(f *http2.PingFrame) { + if f.IsAck() { // Do nothing. + return + } + pingAck := &ping{ack: true} + copy(pingAck.data[:], f.Data[:]) + t.controlBuf.put(pingAck) +} + +func (t *http2Client) handleGoAway(f *http2.GoAwayFrame) { + t.mu.Lock() + if t.state == reachable || t.state == draining { + if f.LastStreamID > 0 && f.LastStreamID%2 != 1 { + t.mu.Unlock() + t.notifyError(connectionErrorf(true, nil, "received illegal http2 GOAWAY frame: stream ID %d is even", f.LastStreamID)) + return + } + select { + case <-t.goAway: + id := t.goAwayID + // t.goAway has been closed (i.e.,multiple GoAways). + if id < f.LastStreamID { + t.mu.Unlock() + t.notifyError(connectionErrorf(true, nil, "received illegal http2 GOAWAY frame: previously recv GOAWAY frame with LastStramID %d, currently recv %d", id, f.LastStreamID)) + return + } + t.prevGoAwayID = id + t.goAwayID = f.LastStreamID + t.mu.Unlock() + return + default: + } + t.goAwayID = f.LastStreamID + close(t.goAway) + } + t.mu.Unlock() +} + +func (t *http2Client) handleWindowUpdate(f *http2.WindowUpdateFrame) { + id := f.Header().StreamID + incr := f.Increment + if id == 0 { + t.sendQuotaPool.add(int(incr)) + return + } + if s, ok := t.getStream(f); ok { + s.sendQuotaPool.add(int(incr)) + } +} + +// operateHeaders takes action on the decoded headers. +func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { + s, ok := t.getStream(frame) + if !ok { + return + } + var state decodeState + for _, hf := range frame.Fields { + state.processHeaderField(hf) + } + if state.err != nil { + s.mu.Lock() + if !s.headerDone { + close(s.headerChan) + s.headerDone = true + } + s.mu.Unlock() + s.write(recvMsg{err: state.err}) + // Something wrong. Stops reading even when there is remaining. + return + } + + endStream := frame.StreamEnded() + var isHeader bool + defer func() { + if t.statsHandler != nil { + if isHeader { + inHeader := &stats.InHeader{ + Client: true, + WireLength: int(frame.Header().Length), + } + t.statsHandler.HandleRPC(s.clientStatsCtx, inHeader) + } else { + inTrailer := &stats.InTrailer{ + Client: true, + WireLength: int(frame.Header().Length), + } + t.statsHandler.HandleRPC(s.clientStatsCtx, inTrailer) + } + } + }() + + s.mu.Lock() + if !endStream { + s.recvCompress = state.encoding + } + if !s.headerDone { + if !endStream && len(state.mdata) > 0 { + s.header = state.mdata + } + close(s.headerChan) + s.headerDone = true + isHeader = true + } + if !endStream || s.state == streamDone { + s.mu.Unlock() + return + } + + if len(state.mdata) > 0 { + s.trailer = state.mdata + } + s.statusCode = state.statusCode + s.statusDesc = state.statusDesc + close(s.done) + s.state = streamDone + s.mu.Unlock() + s.write(recvMsg{err: io.EOF}) +} + +func handleMalformedHTTP2(s *Stream, err error) { + s.mu.Lock() + if !s.headerDone { + close(s.headerChan) + s.headerDone = true + } + s.mu.Unlock() + s.write(recvMsg{err: err}) +} + +// reader runs as a separate goroutine in charge of reading data from network +// connection. +// +// TODO(zhaoq): currently one reader per transport. Investigate whether this is +// optimal. +// TODO(zhaoq): Check the validity of the incoming frame sequence. +func (t *http2Client) reader() { + // Check the validity of server preface. + frame, err := t.framer.readFrame() + if err != nil { + t.notifyError(err) + return + } + atomic.CompareAndSwapUint32(&t.activity, 0, 1) + sf, ok := frame.(*http2.SettingsFrame) + if !ok { + t.notifyError(err) + return + } + t.handleSettings(sf) + + // loop to keep reading incoming messages on this transport. + for { + frame, err := t.framer.readFrame() + atomic.CompareAndSwapUint32(&t.activity, 0, 1) + if err != nil { + // Abort an active stream if the http2.Framer returns a + // http2.StreamError. This can happen only if the server's response + // is malformed http2. + if se, ok := err.(http2.StreamError); ok { + t.mu.Lock() + s := t.activeStreams[se.StreamID] + t.mu.Unlock() + if s != nil { + // use error detail to provide better err message + handleMalformedHTTP2(s, streamErrorf(http2ErrConvTab[se.Code], "%v", t.framer.errorDetail())) + } + continue + } else { + // Transport error. + t.notifyError(err) + return + } + } + switch frame := frame.(type) { + case *http2.MetaHeadersFrame: + t.operateHeaders(frame) + case *http2.DataFrame: + t.handleData(frame) + case *http2.RSTStreamFrame: + t.handleRSTStream(frame) + case *http2.SettingsFrame: + t.handleSettings(frame) + case *http2.PingFrame: + t.handlePing(frame) + case *http2.GoAwayFrame: + t.handleGoAway(frame) + case *http2.WindowUpdateFrame: + t.handleWindowUpdate(frame) + default: + grpclog.Printf("transport: http2Client.reader got unhandled frame type %v.", frame) + } + } +} + +func (t *http2Client) applySettings(ss []http2.Setting) { + for _, s := range ss { + switch s.ID { + case http2.SettingMaxConcurrentStreams: + // TODO(zhaoq): This is a hack to avoid significant refactoring of the + // code to deal with the unrealistic int32 overflow. Probably will try + // to find a better way to handle this later. + if s.Val > math.MaxInt32 { + s.Val = math.MaxInt32 + } + t.mu.Lock() + ms := t.maxStreams + t.maxStreams = int(s.Val) + t.mu.Unlock() + t.streamsQuota.add(int(s.Val) - ms) + case http2.SettingInitialWindowSize: + t.mu.Lock() + for _, stream := range t.activeStreams { + // Adjust the sending quota for each stream. + stream.sendQuotaPool.add(int(s.Val - t.streamSendQuota)) + } + t.streamSendQuota = s.Val + t.mu.Unlock() + } + } +} + +// controller running in a separate goroutine takes charge of sending control +// frames (e.g., window update, reset stream, setting, etc.) to the server. +func (t *http2Client) controller() { + for { + select { + case i := <-t.controlBuf.get(): + t.controlBuf.load() + select { + case <-t.writableChan: + switch i := i.(type) { + case *windowUpdate: + t.framer.writeWindowUpdate(true, i.streamID, i.increment) + case *settings: + if i.ack { + t.framer.writeSettingsAck(true) + t.applySettings(i.ss) + } else { + t.framer.writeSettings(true, i.ss...) + } + case *resetStream: + // If the server needs to be to intimated about stream closing, + // then we need to make sure the RST_STREAM frame is written to + // the wire before the headers of the next stream waiting on + // streamQuota. We ensure this by adding to the streamsQuota pool + // only after having acquired the writableChan to send RST_STREAM. + t.streamsQuota.add(1) + t.framer.writeRSTStream(true, i.streamID, i.code) + case *flushIO: + t.framer.flushWrite() + case *ping: + t.framer.writePing(true, i.ack, i.data) + default: + grpclog.Printf("transport: http2Client.controller got unexpected item type %v\n", i) + } + t.writableChan <- 0 + continue + case <-t.shutdownChan: + return + } + case <-t.shutdownChan: + return + } + } +} + +// keepalive running in a separate goroutune makes sure the connection is alive by sending pings. +func (t *http2Client) keepalive() { + p := &ping{data: [8]byte{}} + timer := time.NewTimer(t.kp.Time) + for { + select { + case <-timer.C: + if atomic.CompareAndSwapUint32(&t.activity, 1, 0) { + timer.Reset(t.kp.Time) + continue + } + // Check if keepalive should go dormant. + t.mu.Lock() + if len(t.activeStreams) < 1 && !t.kp.PermitWithoutStream { + // Make awakenKeepalive writable. + <-t.awakenKeepalive + t.mu.Unlock() + select { + case <-t.awakenKeepalive: + // If the control gets here a ping has been sent + // need to reset the timer with keepalive.Timeout. + case <-t.shutdownChan: + return + } + } else { + t.mu.Unlock() + // Send ping. + t.controlBuf.put(p) + } + + // By the time control gets here a ping has been sent one way or the other. + timer.Reset(t.kp.Timeout) + select { + case <-timer.C: + if atomic.CompareAndSwapUint32(&t.activity, 1, 0) { + timer.Reset(t.kp.Time) + continue + } + t.Close() + return + case <-t.shutdownChan: + if !timer.Stop() { + <-timer.C + } + return + } + case <-t.shutdownChan: + if !timer.Stop() { + <-timer.C + } + return + } + } +} + +func (t *http2Client) Error() <-chan struct{} { + return t.errorChan +} + +func (t *http2Client) GoAway() <-chan struct{} { + return t.goAway +} + +func (t *http2Client) notifyError(err error) { + t.mu.Lock() + // make sure t.errorChan is closed only once. + if t.state == draining { + t.mu.Unlock() + t.Close() + return + } + if t.state == reachable { + t.state = unreachable + close(t.errorChan) + grpclog.Printf("transport: http2Client.notifyError got notified that the client transport was broken %v.", err) + } + t.mu.Unlock() +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http2_server.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http2_server.go new file mode 100644 index 00000000000..f5c590f438f --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http2_server.go @@ -0,0 +1,847 @@ +/* + * + * Copyright 2014, Google Inc. + * 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. + * + */ + +package transport + +import ( + "bytes" + "errors" + "io" + "math" + "net" + "strconv" + "sync" + + "golang.org/x/net/context" + "golang.org/x/net/http2" + "golang.org/x/net/http2/hpack" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/peer" + "google.golang.org/grpc/stats" + "google.golang.org/grpc/tap" +) + +// ErrIllegalHeaderWrite indicates that setting header is illegal because of +// the stream's state. +var ErrIllegalHeaderWrite = errors.New("transport: the stream is done or WriteHeader was already called") + +// http2Server implements the ServerTransport interface with HTTP2. +type http2Server struct { + ctx context.Context + conn net.Conn + remoteAddr net.Addr + localAddr net.Addr + maxStreamID uint32 // max stream ID ever seen + authInfo credentials.AuthInfo // auth info about the connection + inTapHandle tap.ServerInHandle + // writableChan synchronizes write access to the transport. + // A writer acquires the write lock by receiving a value on writableChan + // and releases it by sending on writableChan. + writableChan chan int + // shutdownChan is closed when Close is called. + // Blocking operations should select on shutdownChan to avoid + // blocking forever after Close. + shutdownChan chan struct{} + framer *framer + hBuf *bytes.Buffer // the buffer for HPACK encoding + hEnc *hpack.Encoder // HPACK encoder + + // The max number of concurrent streams. + maxStreams uint32 + // controlBuf delivers all the control related tasks (e.g., window + // updates, reset streams, and various settings) to the controller. + controlBuf *recvBuffer + fc *inFlow + // sendQuotaPool provides flow control to outbound message. + sendQuotaPool *quotaPool + + stats stats.Handler + + mu sync.Mutex // guard the following + state transportState + activeStreams map[uint32]*Stream + // the per-stream outbound flow control window size set by the peer. + streamSendQuota uint32 +} + +// newHTTP2Server constructs a ServerTransport based on HTTP2. ConnectionError is +// returned if something goes wrong. +func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err error) { + framer := newFramer(conn) + // Send initial settings as connection preface to client. + var settings []http2.Setting + // TODO(zhaoq): Have a better way to signal "no limit" because 0 is + // permitted in the HTTP2 spec. + maxStreams := config.MaxStreams + if maxStreams == 0 { + maxStreams = math.MaxUint32 + } else { + settings = append(settings, http2.Setting{ + ID: http2.SettingMaxConcurrentStreams, + Val: maxStreams, + }) + } + if initialWindowSize != defaultWindowSize { + settings = append(settings, http2.Setting{ + ID: http2.SettingInitialWindowSize, + Val: uint32(initialWindowSize)}) + } + if err := framer.writeSettings(true, settings...); err != nil { + return nil, connectionErrorf(true, err, "transport: %v", err) + } + // Adjust the connection flow control window if needed. + if delta := uint32(initialConnWindowSize - defaultWindowSize); delta > 0 { + if err := framer.writeWindowUpdate(true, 0, delta); err != nil { + return nil, connectionErrorf(true, err, "transport: %v", err) + } + } + var buf bytes.Buffer + t := &http2Server{ + ctx: context.Background(), + conn: conn, + remoteAddr: conn.RemoteAddr(), + localAddr: conn.LocalAddr(), + authInfo: config.AuthInfo, + framer: framer, + hBuf: &buf, + hEnc: hpack.NewEncoder(&buf), + maxStreams: maxStreams, + inTapHandle: config.InTapHandle, + controlBuf: newRecvBuffer(), + fc: &inFlow{limit: initialConnWindowSize}, + sendQuotaPool: newQuotaPool(defaultWindowSize), + state: reachable, + writableChan: make(chan int, 1), + shutdownChan: make(chan struct{}), + activeStreams: make(map[uint32]*Stream), + streamSendQuota: defaultWindowSize, + stats: config.StatsHandler, + } + if t.stats != nil { + t.ctx = t.stats.TagConn(t.ctx, &stats.ConnTagInfo{ + RemoteAddr: t.remoteAddr, + LocalAddr: t.localAddr, + }) + connBegin := &stats.ConnBegin{} + t.stats.HandleConn(t.ctx, connBegin) + } + go t.controller() + t.writableChan <- 0 + return t, nil +} + +// operateHeader takes action on the decoded headers. +func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(*Stream), traceCtx func(context.Context, string) context.Context) (close bool) { + buf := newRecvBuffer() + s := &Stream{ + id: frame.Header().StreamID, + st: t, + buf: buf, + fc: &inFlow{limit: initialWindowSize}, + } + + var state decodeState + for _, hf := range frame.Fields { + state.processHeaderField(hf) + } + if err := state.err; err != nil { + if se, ok := err.(StreamError); ok { + t.controlBuf.put(&resetStream{s.id, statusCodeConvTab[se.Code]}) + } + return + } + + if frame.StreamEnded() { + // s is just created by the caller. No lock needed. + s.state = streamReadDone + } + s.recvCompress = state.encoding + if state.timeoutSet { + s.ctx, s.cancel = context.WithTimeout(t.ctx, state.timeout) + } else { + s.ctx, s.cancel = context.WithCancel(t.ctx) + } + pr := &peer.Peer{ + Addr: t.remoteAddr, + } + // Attach Auth info if there is any. + if t.authInfo != nil { + pr.AuthInfo = t.authInfo + } + s.ctx = peer.NewContext(s.ctx, pr) + // Cache the current stream to the context so that the server application + // can find out. Required when the server wants to send some metadata + // back to the client (unary call only). + s.ctx = newContextWithStream(s.ctx, s) + // Attach the received metadata to the context. + if len(state.mdata) > 0 { + s.ctx = metadata.NewContext(s.ctx, state.mdata) + } + + s.dec = &recvBufferReader{ + ctx: s.ctx, + recv: s.buf, + } + s.recvCompress = state.encoding + s.method = state.method + if t.inTapHandle != nil { + var err error + info := &tap.Info{ + FullMethodName: state.method, + } + s.ctx, err = t.inTapHandle(s.ctx, info) + if err != nil { + // TODO: Log the real error. + t.controlBuf.put(&resetStream{s.id, http2.ErrCodeRefusedStream}) + return + } + } + t.mu.Lock() + if t.state != reachable { + t.mu.Unlock() + return + } + if uint32(len(t.activeStreams)) >= t.maxStreams { + t.mu.Unlock() + t.controlBuf.put(&resetStream{s.id, http2.ErrCodeRefusedStream}) + return + } + if s.id%2 != 1 || s.id <= t.maxStreamID { + t.mu.Unlock() + // illegal gRPC stream id. + grpclog.Println("transport: http2Server.HandleStreams received an illegal stream id: ", s.id) + return true + } + t.maxStreamID = s.id + s.sendQuotaPool = newQuotaPool(int(t.streamSendQuota)) + t.activeStreams[s.id] = s + t.mu.Unlock() + s.windowHandler = func(n int) { + t.updateWindow(s, uint32(n)) + } + s.ctx = traceCtx(s.ctx, s.method) + if t.stats != nil { + s.ctx = t.stats.TagRPC(s.ctx, &stats.RPCTagInfo{FullMethodName: s.method}) + inHeader := &stats.InHeader{ + FullMethod: s.method, + RemoteAddr: t.remoteAddr, + LocalAddr: t.localAddr, + Compression: s.recvCompress, + WireLength: int(frame.Header().Length), + } + t.stats.HandleRPC(s.ctx, inHeader) + } + handle(s) + return +} + +// HandleStreams receives incoming streams using the given handler. This is +// typically run in a separate goroutine. +// traceCtx attaches trace to ctx and returns the new context. +func (t *http2Server) HandleStreams(handle func(*Stream), traceCtx func(context.Context, string) context.Context) { + // Check the validity of client preface. + preface := make([]byte, len(clientPreface)) + if _, err := io.ReadFull(t.conn, preface); err != nil { + grpclog.Printf("transport: http2Server.HandleStreams failed to receive the preface from client: %v", err) + t.Close() + return + } + if !bytes.Equal(preface, clientPreface) { + grpclog.Printf("transport: http2Server.HandleStreams received bogus greeting from client: %q", preface) + t.Close() + return + } + + frame, err := t.framer.readFrame() + if err == io.EOF || err == io.ErrUnexpectedEOF { + t.Close() + return + } + if err != nil { + grpclog.Printf("transport: http2Server.HandleStreams failed to read frame: %v", err) + t.Close() + return + } + sf, ok := frame.(*http2.SettingsFrame) + if !ok { + grpclog.Printf("transport: http2Server.HandleStreams saw invalid preface type %T from client", frame) + t.Close() + return + } + t.handleSettings(sf) + + for { + frame, err := t.framer.readFrame() + if err != nil { + if se, ok := err.(http2.StreamError); ok { + t.mu.Lock() + s := t.activeStreams[se.StreamID] + t.mu.Unlock() + if s != nil { + t.closeStream(s) + } + t.controlBuf.put(&resetStream{se.StreamID, se.Code}) + continue + } + if err == io.EOF || err == io.ErrUnexpectedEOF { + t.Close() + return + } + grpclog.Printf("transport: http2Server.HandleStreams failed to read frame: %v", err) + t.Close() + return + } + switch frame := frame.(type) { + case *http2.MetaHeadersFrame: + if t.operateHeaders(frame, handle, traceCtx) { + t.Close() + break + } + case *http2.DataFrame: + t.handleData(frame) + case *http2.RSTStreamFrame: + t.handleRSTStream(frame) + case *http2.SettingsFrame: + t.handleSettings(frame) + case *http2.PingFrame: + t.handlePing(frame) + case *http2.WindowUpdateFrame: + t.handleWindowUpdate(frame) + case *http2.GoAwayFrame: + // TODO: Handle GoAway from the client appropriately. + default: + grpclog.Printf("transport: http2Server.HandleStreams found unhandled frame type %v.", frame) + } + } +} + +func (t *http2Server) getStream(f http2.Frame) (*Stream, bool) { + t.mu.Lock() + defer t.mu.Unlock() + if t.activeStreams == nil { + // The transport is closing. + return nil, false + } + s, ok := t.activeStreams[f.Header().StreamID] + if !ok { + // The stream is already done. + return nil, false + } + return s, true +} + +// updateWindow adjusts the inbound quota for the stream and the transport. +// Window updates will deliver to the controller for sending when +// the cumulative quota exceeds the corresponding threshold. +func (t *http2Server) updateWindow(s *Stream, n uint32) { + s.mu.Lock() + defer s.mu.Unlock() + if s.state == streamDone { + return + } + if w := t.fc.onRead(n); w > 0 { + t.controlBuf.put(&windowUpdate{0, w}) + } + if w := s.fc.onRead(n); w > 0 { + t.controlBuf.put(&windowUpdate{s.id, w}) + } +} + +func (t *http2Server) handleData(f *http2.DataFrame) { + size := f.Header().Length + if err := t.fc.onData(uint32(size)); err != nil { + grpclog.Printf("transport: http2Server %v", err) + t.Close() + return + } + // Select the right stream to dispatch. + s, ok := t.getStream(f) + if !ok { + if w := t.fc.onRead(uint32(size)); w > 0 { + t.controlBuf.put(&windowUpdate{0, w}) + } + return + } + if size > 0 { + if f.Header().Flags.Has(http2.FlagDataPadded) { + if w := t.fc.onRead(uint32(size) - uint32(len(f.Data()))); w > 0 { + t.controlBuf.put(&windowUpdate{0, w}) + } + } + s.mu.Lock() + if s.state == streamDone { + s.mu.Unlock() + // The stream has been closed. Release the corresponding quota. + if w := t.fc.onRead(uint32(size)); w > 0 { + t.controlBuf.put(&windowUpdate{0, w}) + } + return + } + if err := s.fc.onData(uint32(size)); err != nil { + s.mu.Unlock() + t.closeStream(s) + t.controlBuf.put(&resetStream{s.id, http2.ErrCodeFlowControl}) + return + } + if f.Header().Flags.Has(http2.FlagDataPadded) { + if w := s.fc.onRead(uint32(size) - uint32(len(f.Data()))); w > 0 { + t.controlBuf.put(&windowUpdate{s.id, w}) + } + } + s.mu.Unlock() + // TODO(bradfitz, zhaoq): A copy is required here because there is no + // guarantee f.Data() is consumed before the arrival of next frame. + // Can this copy be eliminated? + if len(f.Data()) > 0 { + data := make([]byte, len(f.Data())) + copy(data, f.Data()) + s.write(recvMsg{data: data}) + } + } + if f.Header().Flags.Has(http2.FlagDataEndStream) { + // Received the end of stream from the client. + s.mu.Lock() + if s.state != streamDone { + s.state = streamReadDone + } + s.mu.Unlock() + s.write(recvMsg{err: io.EOF}) + } +} + +func (t *http2Server) handleRSTStream(f *http2.RSTStreamFrame) { + s, ok := t.getStream(f) + if !ok { + return + } + t.closeStream(s) +} + +func (t *http2Server) handleSettings(f *http2.SettingsFrame) { + if f.IsAck() { + return + } + var ss []http2.Setting + f.ForeachSetting(func(s http2.Setting) error { + ss = append(ss, s) + return nil + }) + // The settings will be applied once the ack is sent. + t.controlBuf.put(&settings{ack: true, ss: ss}) +} + +func (t *http2Server) handlePing(f *http2.PingFrame) { + if f.IsAck() { // Do nothing. + return + } + pingAck := &ping{ack: true} + copy(pingAck.data[:], f.Data[:]) + t.controlBuf.put(pingAck) +} + +func (t *http2Server) handleWindowUpdate(f *http2.WindowUpdateFrame) { + id := f.Header().StreamID + incr := f.Increment + if id == 0 { + t.sendQuotaPool.add(int(incr)) + return + } + if s, ok := t.getStream(f); ok { + s.sendQuotaPool.add(int(incr)) + } +} + +func (t *http2Server) writeHeaders(s *Stream, b *bytes.Buffer, endStream bool) error { + first := true + endHeaders := false + var err error + // Sends the headers in a single batch. + for !endHeaders { + size := t.hBuf.Len() + if size > http2MaxFrameLen { + size = http2MaxFrameLen + } else { + endHeaders = true + } + if first { + p := http2.HeadersFrameParam{ + StreamID: s.id, + BlockFragment: b.Next(size), + EndStream: endStream, + EndHeaders: endHeaders, + } + err = t.framer.writeHeaders(endHeaders, p) + first = false + } else { + err = t.framer.writeContinuation(endHeaders, s.id, endHeaders, b.Next(size)) + } + if err != nil { + t.Close() + return connectionErrorf(true, err, "transport: %v", err) + } + } + return nil +} + +// WriteHeader sends the header metedata md back to the client. +func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error { + s.mu.Lock() + if s.headerOk || s.state == streamDone { + s.mu.Unlock() + return ErrIllegalHeaderWrite + } + s.headerOk = true + if md.Len() > 0 { + if s.header.Len() > 0 { + s.header = metadata.Join(s.header, md) + } else { + s.header = md + } + } + md = s.header + s.mu.Unlock() + if _, err := wait(s.ctx, nil, nil, t.shutdownChan, t.writableChan); err != nil { + return err + } + t.hBuf.Reset() + t.hEnc.WriteField(hpack.HeaderField{Name: ":status", Value: "200"}) + t.hEnc.WriteField(hpack.HeaderField{Name: "content-type", Value: "application/grpc"}) + if s.sendCompress != "" { + t.hEnc.WriteField(hpack.HeaderField{Name: "grpc-encoding", Value: s.sendCompress}) + } + for k, v := range md { + if isReservedHeader(k) { + // Clients don't tolerate reading restricted headers after some non restricted ones were sent. + continue + } + for _, entry := range v { + t.hEnc.WriteField(hpack.HeaderField{Name: k, Value: entry}) + } + } + bufLen := t.hBuf.Len() + if err := t.writeHeaders(s, t.hBuf, false); err != nil { + return err + } + if t.stats != nil { + outHeader := &stats.OutHeader{ + WireLength: bufLen, + } + t.stats.HandleRPC(s.Context(), outHeader) + } + t.writableChan <- 0 + return nil +} + +// WriteStatus sends stream status to the client and terminates the stream. +// There is no further I/O operations being able to perform on this stream. +// TODO(zhaoq): Now it indicates the end of entire stream. Revisit if early +// OK is adopted. +func (t *http2Server) WriteStatus(s *Stream, statusCode codes.Code, statusDesc string) error { + var headersSent, hasHeader bool + s.mu.Lock() + if s.state == streamDone { + s.mu.Unlock() + return nil + } + if s.headerOk { + headersSent = true + } + if s.header.Len() > 0 { + hasHeader = true + } + s.mu.Unlock() + + if !headersSent && hasHeader { + t.WriteHeader(s, nil) + headersSent = true + } + + if _, err := wait(s.ctx, nil, nil, t.shutdownChan, t.writableChan); err != nil { + return err + } + t.hBuf.Reset() + if !headersSent { + t.hEnc.WriteField(hpack.HeaderField{Name: ":status", Value: "200"}) + t.hEnc.WriteField(hpack.HeaderField{Name: "content-type", Value: "application/grpc"}) + } + t.hEnc.WriteField( + hpack.HeaderField{ + Name: "grpc-status", + Value: strconv.Itoa(int(statusCode)), + }) + t.hEnc.WriteField(hpack.HeaderField{Name: "grpc-message", Value: encodeGrpcMessage(statusDesc)}) + // Attach the trailer metadata. + for k, v := range s.trailer { + // Clients don't tolerate reading restricted headers after some non restricted ones were sent. + if isReservedHeader(k) { + continue + } + for _, entry := range v { + t.hEnc.WriteField(hpack.HeaderField{Name: k, Value: entry}) + } + } + bufLen := t.hBuf.Len() + if err := t.writeHeaders(s, t.hBuf, true); err != nil { + t.Close() + return err + } + if t.stats != nil { + outTrailer := &stats.OutTrailer{ + WireLength: bufLen, + } + t.stats.HandleRPC(s.Context(), outTrailer) + } + t.closeStream(s) + t.writableChan <- 0 + return nil +} + +// Write converts the data into HTTP2 data frame and sends it out. Non-nil error +// is returns if it fails (e.g., framing error, transport error). +func (t *http2Server) Write(s *Stream, data []byte, opts *Options) error { + // TODO(zhaoq): Support multi-writers for a single stream. + var writeHeaderFrame bool + s.mu.Lock() + if s.state == streamDone { + s.mu.Unlock() + return streamErrorf(codes.Unknown, "the stream has been done") + } + if !s.headerOk { + writeHeaderFrame = true + } + s.mu.Unlock() + if writeHeaderFrame { + t.WriteHeader(s, nil) + } + r := bytes.NewBuffer(data) + for { + if r.Len() == 0 { + return nil + } + size := http2MaxFrameLen + // Wait until the stream has some quota to send the data. + sq, err := wait(s.ctx, nil, nil, t.shutdownChan, s.sendQuotaPool.acquire()) + if err != nil { + return err + } + // Wait until the transport has some quota to send the data. + tq, err := wait(s.ctx, nil, nil, t.shutdownChan, t.sendQuotaPool.acquire()) + if err != nil { + return err + } + if sq < size { + size = sq + } + if tq < size { + size = tq + } + p := r.Next(size) + ps := len(p) + if ps < sq { + // Overbooked stream quota. Return it back. + s.sendQuotaPool.add(sq - ps) + } + if ps < tq { + // Overbooked transport quota. Return it back. + t.sendQuotaPool.add(tq - ps) + } + t.framer.adjustNumWriters(1) + // Got some quota. Try to acquire writing privilege on the + // transport. + if _, err := wait(s.ctx, nil, nil, t.shutdownChan, t.writableChan); err != nil { + if _, ok := err.(StreamError); ok { + // Return the connection quota back. + t.sendQuotaPool.add(ps) + } + if t.framer.adjustNumWriters(-1) == 0 { + // This writer is the last one in this batch and has the + // responsibility to flush the buffered frames. It queues + // a flush request to controlBuf instead of flushing directly + // in order to avoid the race with other writing or flushing. + t.controlBuf.put(&flushIO{}) + } + return err + } + select { + case <-s.ctx.Done(): + t.sendQuotaPool.add(ps) + if t.framer.adjustNumWriters(-1) == 0 { + t.controlBuf.put(&flushIO{}) + } + t.writableChan <- 0 + return ContextErr(s.ctx.Err()) + default: + } + var forceFlush bool + if r.Len() == 0 && t.framer.adjustNumWriters(0) == 1 && !opts.Last { + forceFlush = true + } + if err := t.framer.writeData(forceFlush, s.id, false, p); err != nil { + t.Close() + return connectionErrorf(true, err, "transport: %v", err) + } + if t.framer.adjustNumWriters(-1) == 0 { + t.framer.flushWrite() + } + t.writableChan <- 0 + } + +} + +func (t *http2Server) applySettings(ss []http2.Setting) { + for _, s := range ss { + if s.ID == http2.SettingInitialWindowSize { + t.mu.Lock() + defer t.mu.Unlock() + for _, stream := range t.activeStreams { + stream.sendQuotaPool.add(int(s.Val - t.streamSendQuota)) + } + t.streamSendQuota = s.Val + } + + } +} + +// controller running in a separate goroutine takes charge of sending control +// frames (e.g., window update, reset stream, setting, etc.) to the server. +func (t *http2Server) controller() { + for { + select { + case i := <-t.controlBuf.get(): + t.controlBuf.load() + select { + case <-t.writableChan: + switch i := i.(type) { + case *windowUpdate: + t.framer.writeWindowUpdate(true, i.streamID, i.increment) + case *settings: + if i.ack { + t.framer.writeSettingsAck(true) + t.applySettings(i.ss) + } else { + t.framer.writeSettings(true, i.ss...) + } + case *resetStream: + t.framer.writeRSTStream(true, i.streamID, i.code) + case *goAway: + t.mu.Lock() + if t.state == closing { + t.mu.Unlock() + // The transport is closing. + return + } + sid := t.maxStreamID + t.state = draining + t.mu.Unlock() + t.framer.writeGoAway(true, sid, http2.ErrCodeNo, nil) + case *flushIO: + t.framer.flushWrite() + case *ping: + t.framer.writePing(true, i.ack, i.data) + default: + grpclog.Printf("transport: http2Server.controller got unexpected item type %v\n", i) + } + t.writableChan <- 0 + continue + case <-t.shutdownChan: + return + } + case <-t.shutdownChan: + return + } + } +} + +// Close starts shutting down the http2Server transport. +// TODO(zhaoq): Now the destruction is not blocked on any pending streams. This +// could cause some resource issue. Revisit this later. +func (t *http2Server) Close() (err error) { + t.mu.Lock() + if t.state == closing { + t.mu.Unlock() + return errors.New("transport: Close() was already called") + } + t.state = closing + streams := t.activeStreams + t.activeStreams = nil + t.mu.Unlock() + close(t.shutdownChan) + err = t.conn.Close() + // Cancel all active streams. + for _, s := range streams { + s.cancel() + } + if t.stats != nil { + connEnd := &stats.ConnEnd{} + t.stats.HandleConn(t.ctx, connEnd) + } + return +} + +// closeStream clears the footprint of a stream when the stream is not needed +// any more. +func (t *http2Server) closeStream(s *Stream) { + t.mu.Lock() + delete(t.activeStreams, s.id) + if t.state == draining && len(t.activeStreams) == 0 { + defer t.Close() + } + t.mu.Unlock() + // In case stream sending and receiving are invoked in separate + // goroutines (e.g., bi-directional streaming), cancel needs to be + // called to interrupt the potential blocking on other goroutines. + s.cancel() + s.mu.Lock() + if q := s.fc.resetPendingData(); q > 0 { + if w := t.fc.onRead(q); w > 0 { + t.controlBuf.put(&windowUpdate{0, w}) + } + } + if s.state == streamDone { + s.mu.Unlock() + return + } + s.state = streamDone + s.mu.Unlock() +} + +func (t *http2Server) RemoteAddr() net.Addr { + return t.remoteAddr +} + +func (t *http2Server) Drain() { + t.controlBuf.put(&goAway{}) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http_util.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http_util.go new file mode 100644 index 00000000000..6ce43c332e6 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http_util.go @@ -0,0 +1,511 @@ +/* + * + * Copyright 2014, Google Inc. + * 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. + * + */ + +package transport + +import ( + "bufio" + "bytes" + "fmt" + "io" + "net" + "strconv" + "strings" + "sync/atomic" + "time" + + "golang.org/x/net/http2" + "golang.org/x/net/http2/hpack" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" +) + +const ( + // http2MaxFrameLen specifies the max length of a HTTP2 frame. + http2MaxFrameLen = 16384 // 16KB frame + // http://http2.github.io/http2-spec/#SettingValues + http2InitHeaderTableSize = 4096 + // http2IOBufSize specifies the buffer size for sending frames. + http2IOBufSize = 32 * 1024 +) + +var ( + clientPreface = []byte(http2.ClientPreface) + http2ErrConvTab = map[http2.ErrCode]codes.Code{ + http2.ErrCodeNo: codes.Internal, + http2.ErrCodeProtocol: codes.Internal, + http2.ErrCodeInternal: codes.Internal, + http2.ErrCodeFlowControl: codes.ResourceExhausted, + http2.ErrCodeSettingsTimeout: codes.Internal, + http2.ErrCodeStreamClosed: codes.Internal, + http2.ErrCodeFrameSize: codes.Internal, + http2.ErrCodeRefusedStream: codes.Unavailable, + http2.ErrCodeCancel: codes.Canceled, + http2.ErrCodeCompression: codes.Internal, + http2.ErrCodeConnect: codes.Internal, + http2.ErrCodeEnhanceYourCalm: codes.ResourceExhausted, + http2.ErrCodeInadequateSecurity: codes.PermissionDenied, + http2.ErrCodeHTTP11Required: codes.FailedPrecondition, + } + statusCodeConvTab = map[codes.Code]http2.ErrCode{ + codes.Internal: http2.ErrCodeInternal, + codes.Canceled: http2.ErrCodeCancel, + codes.Unavailable: http2.ErrCodeRefusedStream, + codes.ResourceExhausted: http2.ErrCodeEnhanceYourCalm, + codes.PermissionDenied: http2.ErrCodeInadequateSecurity, + } +) + +// Records the states during HPACK decoding. Must be reset once the +// decoding of the entire headers are finished. +type decodeState struct { + err error // first error encountered decoding + + encoding string + // statusCode caches the stream status received from the trailer + // the server sent. Client side only. + statusCode codes.Code + statusDesc string + // Server side only fields. + timeoutSet bool + timeout time.Duration + method string + // key-value metadata map from the peer. + mdata map[string][]string +} + +// isReservedHeader checks whether hdr belongs to HTTP2 headers +// reserved by gRPC protocol. Any other headers are classified as the +// user-specified metadata. +func isReservedHeader(hdr string) bool { + if hdr != "" && hdr[0] == ':' { + return true + } + switch hdr { + case "content-type", + "grpc-message-type", + "grpc-encoding", + "grpc-message", + "grpc-status", + "grpc-timeout", + "te": + return true + default: + return false + } +} + +// isWhitelistedPseudoHeader checks whether hdr belongs to HTTP2 pseudoheaders +// that should be propagated into metadata visible to users. +func isWhitelistedPseudoHeader(hdr string) bool { + switch hdr { + case ":authority": + return true + default: + return false + } +} + +func (d *decodeState) setErr(err error) { + if d.err == nil { + d.err = err + } +} + +func validContentType(t string) bool { + e := "application/grpc" + if !strings.HasPrefix(t, e) { + return false + } + // Support variations on the content-type + // (e.g. "application/grpc+blah", "application/grpc;blah"). + if len(t) > len(e) && t[len(e)] != '+' && t[len(e)] != ';' { + return false + } + return true +} + +func (d *decodeState) processHeaderField(f hpack.HeaderField) { + switch f.Name { + case "content-type": + if !validContentType(f.Value) { + d.setErr(streamErrorf(codes.FailedPrecondition, "transport: received the unexpected content-type %q", f.Value)) + return + } + case "grpc-encoding": + d.encoding = f.Value + case "grpc-status": + code, err := strconv.Atoi(f.Value) + if err != nil { + d.setErr(streamErrorf(codes.Internal, "transport: malformed grpc-status: %v", err)) + return + } + d.statusCode = codes.Code(code) + case "grpc-message": + d.statusDesc = decodeGrpcMessage(f.Value) + case "grpc-timeout": + d.timeoutSet = true + var err error + d.timeout, err = decodeTimeout(f.Value) + if err != nil { + d.setErr(streamErrorf(codes.Internal, "transport: malformed time-out: %v", err)) + return + } + case ":path": + d.method = f.Value + default: + if !isReservedHeader(f.Name) || isWhitelistedPseudoHeader(f.Name) { + if f.Name == "user-agent" { + i := strings.LastIndex(f.Value, " ") + if i == -1 { + // There is no application user agent string being set. + return + } + // Extract the application user agent string. + f.Value = f.Value[:i] + } + if d.mdata == nil { + d.mdata = make(map[string][]string) + } + k, v, err := metadata.DecodeKeyValue(f.Name, f.Value) + if err != nil { + grpclog.Printf("Failed to decode (%q, %q): %v", f.Name, f.Value, err) + return + } + d.mdata[k] = append(d.mdata[k], v) + } + } +} + +type timeoutUnit uint8 + +const ( + hour timeoutUnit = 'H' + minute timeoutUnit = 'M' + second timeoutUnit = 'S' + millisecond timeoutUnit = 'm' + microsecond timeoutUnit = 'u' + nanosecond timeoutUnit = 'n' +) + +func timeoutUnitToDuration(u timeoutUnit) (d time.Duration, ok bool) { + switch u { + case hour: + return time.Hour, true + case minute: + return time.Minute, true + case second: + return time.Second, true + case millisecond: + return time.Millisecond, true + case microsecond: + return time.Microsecond, true + case nanosecond: + return time.Nanosecond, true + default: + } + return +} + +const maxTimeoutValue int64 = 100000000 - 1 + +// div does integer division and round-up the result. Note that this is +// equivalent to (d+r-1)/r but has less chance to overflow. +func div(d, r time.Duration) int64 { + if m := d % r; m > 0 { + return int64(d/r + 1) + } + return int64(d / r) +} + +// TODO(zhaoq): It is the simplistic and not bandwidth efficient. Improve it. +func encodeTimeout(t time.Duration) string { + if t <= 0 { + return "0n" + } + if d := div(t, time.Nanosecond); d <= maxTimeoutValue { + return strconv.FormatInt(d, 10) + "n" + } + if d := div(t, time.Microsecond); d <= maxTimeoutValue { + return strconv.FormatInt(d, 10) + "u" + } + if d := div(t, time.Millisecond); d <= maxTimeoutValue { + return strconv.FormatInt(d, 10) + "m" + } + if d := div(t, time.Second); d <= maxTimeoutValue { + return strconv.FormatInt(d, 10) + "S" + } + if d := div(t, time.Minute); d <= maxTimeoutValue { + return strconv.FormatInt(d, 10) + "M" + } + // Note that maxTimeoutValue * time.Hour > MaxInt64. + return strconv.FormatInt(div(t, time.Hour), 10) + "H" +} + +func decodeTimeout(s string) (time.Duration, error) { + size := len(s) + if size < 2 { + return 0, fmt.Errorf("transport: timeout string is too short: %q", s) + } + unit := timeoutUnit(s[size-1]) + d, ok := timeoutUnitToDuration(unit) + if !ok { + return 0, fmt.Errorf("transport: timeout unit is not recognized: %q", s) + } + t, err := strconv.ParseInt(s[:size-1], 10, 64) + if err != nil { + return 0, err + } + return d * time.Duration(t), nil +} + +const ( + spaceByte = ' ' + tildaByte = '~' + percentByte = '%' +) + +// encodeGrpcMessage is used to encode status code in header field +// "grpc-message". +// It checks to see if each individual byte in msg is an +// allowable byte, and then either percent encoding or passing it through. +// When percent encoding, the byte is converted into hexadecimal notation +// with a '%' prepended. +func encodeGrpcMessage(msg string) string { + if msg == "" { + return "" + } + lenMsg := len(msg) + for i := 0; i < lenMsg; i++ { + c := msg[i] + if !(c >= spaceByte && c < tildaByte && c != percentByte) { + return encodeGrpcMessageUnchecked(msg) + } + } + return msg +} + +func encodeGrpcMessageUnchecked(msg string) string { + var buf bytes.Buffer + lenMsg := len(msg) + for i := 0; i < lenMsg; i++ { + c := msg[i] + if c >= spaceByte && c < tildaByte && c != percentByte { + buf.WriteByte(c) + } else { + buf.WriteString(fmt.Sprintf("%%%02X", c)) + } + } + return buf.String() +} + +// decodeGrpcMessage decodes the msg encoded by encodeGrpcMessage. +func decodeGrpcMessage(msg string) string { + if msg == "" { + return "" + } + lenMsg := len(msg) + for i := 0; i < lenMsg; i++ { + if msg[i] == percentByte && i+2 < lenMsg { + return decodeGrpcMessageUnchecked(msg) + } + } + return msg +} + +func decodeGrpcMessageUnchecked(msg string) string { + var buf bytes.Buffer + lenMsg := len(msg) + for i := 0; i < lenMsg; i++ { + c := msg[i] + if c == percentByte && i+2 < lenMsg { + parsed, err := strconv.ParseUint(msg[i+1:i+3], 16, 8) + if err != nil { + buf.WriteByte(c) + } else { + buf.WriteByte(byte(parsed)) + i += 2 + } + } else { + buf.WriteByte(c) + } + } + return buf.String() +} + +type framer struct { + numWriters int32 + reader io.Reader + writer *bufio.Writer + fr *http2.Framer +} + +func newFramer(conn net.Conn) *framer { + f := &framer{ + reader: bufio.NewReaderSize(conn, http2IOBufSize), + writer: bufio.NewWriterSize(conn, http2IOBufSize), + } + f.fr = http2.NewFramer(f.writer, f.reader) + f.fr.ReadMetaHeaders = hpack.NewDecoder(http2InitHeaderTableSize, nil) + return f +} + +func (f *framer) adjustNumWriters(i int32) int32 { + return atomic.AddInt32(&f.numWriters, i) +} + +// The following writeXXX functions can only be called when the caller gets +// unblocked from writableChan channel (i.e., owns the privilege to write). + +func (f *framer) writeContinuation(forceFlush bool, streamID uint32, endHeaders bool, headerBlockFragment []byte) error { + if err := f.fr.WriteContinuation(streamID, endHeaders, headerBlockFragment); err != nil { + return err + } + if forceFlush { + return f.writer.Flush() + } + return nil +} + +func (f *framer) writeData(forceFlush bool, streamID uint32, endStream bool, data []byte) error { + if err := f.fr.WriteData(streamID, endStream, data); err != nil { + return err + } + if forceFlush { + return f.writer.Flush() + } + return nil +} + +func (f *framer) writeGoAway(forceFlush bool, maxStreamID uint32, code http2.ErrCode, debugData []byte) error { + if err := f.fr.WriteGoAway(maxStreamID, code, debugData); err != nil { + return err + } + if forceFlush { + return f.writer.Flush() + } + return nil +} + +func (f *framer) writeHeaders(forceFlush bool, p http2.HeadersFrameParam) error { + if err := f.fr.WriteHeaders(p); err != nil { + return err + } + if forceFlush { + return f.writer.Flush() + } + return nil +} + +func (f *framer) writePing(forceFlush, ack bool, data [8]byte) error { + if err := f.fr.WritePing(ack, data); err != nil { + return err + } + if forceFlush { + return f.writer.Flush() + } + return nil +} + +func (f *framer) writePriority(forceFlush bool, streamID uint32, p http2.PriorityParam) error { + if err := f.fr.WritePriority(streamID, p); err != nil { + return err + } + if forceFlush { + return f.writer.Flush() + } + return nil +} + +func (f *framer) writePushPromise(forceFlush bool, p http2.PushPromiseParam) error { + if err := f.fr.WritePushPromise(p); err != nil { + return err + } + if forceFlush { + return f.writer.Flush() + } + return nil +} + +func (f *framer) writeRSTStream(forceFlush bool, streamID uint32, code http2.ErrCode) error { + if err := f.fr.WriteRSTStream(streamID, code); err != nil { + return err + } + if forceFlush { + return f.writer.Flush() + } + return nil +} + +func (f *framer) writeSettings(forceFlush bool, settings ...http2.Setting) error { + if err := f.fr.WriteSettings(settings...); err != nil { + return err + } + if forceFlush { + return f.writer.Flush() + } + return nil +} + +func (f *framer) writeSettingsAck(forceFlush bool) error { + if err := f.fr.WriteSettingsAck(); err != nil { + return err + } + if forceFlush { + return f.writer.Flush() + } + return nil +} + +func (f *framer) writeWindowUpdate(forceFlush bool, streamID, incr uint32) error { + if err := f.fr.WriteWindowUpdate(streamID, incr); err != nil { + return err + } + if forceFlush { + return f.writer.Flush() + } + return nil +} + +func (f *framer) flushWrite() error { + return f.writer.Flush() +} + +func (f *framer) readFrame() (http2.Frame, error) { + return f.fr.ReadFrame() +} + +func (f *framer) errorDetail() error { + return f.fr.ErrorDetail() +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/pre_go16.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/pre_go16.go new file mode 100644 index 00000000000..33d91c17c4e --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/pre_go16.go @@ -0,0 +1,51 @@ +// +build !go1.6 + +/* + * Copyright 2016, Google Inc. + * 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. + * + */ + +package transport + +import ( + "net" + "time" + + "golang.org/x/net/context" +) + +// dialContext connects to the address on the named network. +func dialContext(ctx context.Context, network, address string) (net.Conn, error) { + var dialer net.Dialer + if deadline, ok := ctx.Deadline(); ok { + dialer.Timeout = deadline.Sub(time.Now()) + } + return dialer.Dial(network, address) +} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/transport.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/transport.go new file mode 100644 index 00000000000..0fc4c146f90 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/transport.go @@ -0,0 +1,626 @@ +/* + * + * Copyright 2014, Google Inc. + * 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. + * + */ + +/* +Package transport defines and implements message oriented communication channel +to complete various transactions (e.g., an RPC). +*/ +package transport // import "google.golang.org/grpc/transport" + +import ( + "bytes" + "fmt" + "io" + "net" + "sync" + + "golang.org/x/net/context" + "golang.org/x/net/http2" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/keepalive" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/stats" + "google.golang.org/grpc/tap" +) + +// recvMsg represents the received msg from the transport. All transport +// protocol specific info has been removed. +type recvMsg struct { + data []byte + // nil: received some data + // io.EOF: stream is completed. data is nil. + // other non-nil error: transport failure. data is nil. + err error +} + +func (*recvMsg) item() {} + +// All items in an out of a recvBuffer should be the same type. +type item interface { + item() +} + +// recvBuffer is an unbounded channel of item. +type recvBuffer struct { + c chan item + mu sync.Mutex + backlog []item +} + +func newRecvBuffer() *recvBuffer { + b := &recvBuffer{ + c: make(chan item, 1), + } + return b +} + +func (b *recvBuffer) put(r item) { + b.mu.Lock() + defer b.mu.Unlock() + if len(b.backlog) == 0 { + select { + case b.c <- r: + return + default: + } + } + b.backlog = append(b.backlog, r) +} + +func (b *recvBuffer) load() { + b.mu.Lock() + defer b.mu.Unlock() + if len(b.backlog) > 0 { + select { + case b.c <- b.backlog[0]: + b.backlog = b.backlog[1:] + default: + } + } +} + +// get returns the channel that receives an item in the buffer. +// +// Upon receipt of an item, the caller should call load to send another +// item onto the channel if there is any. +func (b *recvBuffer) get() <-chan item { + return b.c +} + +// recvBufferReader implements io.Reader interface to read the data from +// recvBuffer. +type recvBufferReader struct { + ctx context.Context + goAway chan struct{} + recv *recvBuffer + last *bytes.Reader // Stores the remaining data in the previous calls. + err error +} + +// Read reads the next len(p) bytes from last. If last is drained, it tries to +// read additional data from recv. It blocks if there no additional data available +// in recv. If Read returns any non-nil error, it will continue to return that error. +func (r *recvBufferReader) Read(p []byte) (n int, err error) { + if r.err != nil { + return 0, r.err + } + defer func() { r.err = err }() + if r.last != nil && r.last.Len() > 0 { + // Read remaining data left in last call. + return r.last.Read(p) + } + select { + case <-r.ctx.Done(): + return 0, ContextErr(r.ctx.Err()) + case <-r.goAway: + return 0, ErrStreamDrain + case i := <-r.recv.get(): + r.recv.load() + m := i.(*recvMsg) + if m.err != nil { + return 0, m.err + } + r.last = bytes.NewReader(m.data) + return r.last.Read(p) + } +} + +type streamState uint8 + +const ( + streamActive streamState = iota + streamWriteDone // EndStream sent + streamReadDone // EndStream received + streamDone // the entire stream is finished. +) + +// Stream represents an RPC in the transport layer. +type Stream struct { + id uint32 + // nil for client side Stream. + st ServerTransport + // clientStatsCtx keeps the user context for stats handling. + // It's only valid on client side. Server side stats context is same as s.ctx. + // All client side stats collection should use the clientStatsCtx (instead of the stream context) + // so that all the generated stats for a particular RPC can be associated in the processing phase. + clientStatsCtx context.Context + // ctx is the associated context of the stream. + ctx context.Context + // cancel is always nil for client side Stream. + cancel context.CancelFunc + // done is closed when the final status arrives. + done chan struct{} + // goAway is closed when the server sent GoAways signal before this stream was initiated. + goAway chan struct{} + // method records the associated RPC method of the stream. + method string + recvCompress string + sendCompress string + buf *recvBuffer + dec io.Reader + fc *inFlow + recvQuota uint32 + // The accumulated inbound quota pending for window update. + updateQuota uint32 + // The handler to control the window update procedure for both this + // particular stream and the associated transport. + windowHandler func(int) + + sendQuotaPool *quotaPool + // Close headerChan to indicate the end of reception of header metadata. + headerChan chan struct{} + // header caches the received header metadata. + header metadata.MD + // The key-value map of trailer metadata. + trailer metadata.MD + + mu sync.RWMutex // guard the following + // headerOK becomes true from the first header is about to send. + headerOk bool + state streamState + // true iff headerChan is closed. Used to avoid closing headerChan + // multiple times. + headerDone bool + // the status received from the server. + statusCode codes.Code + statusDesc string + // rstStream indicates whether a RST_STREAM frame needs to be sent + // to the server to signify that this stream is closing. + rstStream bool + // rstError is the error that needs to be sent along with the RST_STREAM frame. + rstError http2.ErrCode +} + +// RecvCompress returns the compression algorithm applied to the inbound +// message. It is empty string if there is no compression applied. +func (s *Stream) RecvCompress() string { + return s.recvCompress +} + +// SetSendCompress sets the compression algorithm to the stream. +func (s *Stream) SetSendCompress(str string) { + s.sendCompress = str +} + +// Done returns a chanel which is closed when it receives the final status +// from the server. +func (s *Stream) Done() <-chan struct{} { + return s.done +} + +// GoAway returns a channel which is closed when the server sent GoAways signal +// before this stream was initiated. +func (s *Stream) GoAway() <-chan struct{} { + return s.goAway +} + +// Header acquires the key-value pairs of header metadata once it +// is available. It blocks until i) the metadata is ready or ii) there is no +// header metadata or iii) the stream is cancelled/expired. +func (s *Stream) Header() (metadata.MD, error) { + select { + case <-s.ctx.Done(): + return nil, ContextErr(s.ctx.Err()) + case <-s.goAway: + return nil, ErrStreamDrain + case <-s.headerChan: + return s.header.Copy(), nil + } +} + +// Trailer returns the cached trailer metedata. Note that if it is not called +// after the entire stream is done, it could return an empty MD. Client +// side only. +func (s *Stream) Trailer() metadata.MD { + s.mu.RLock() + defer s.mu.RUnlock() + return s.trailer.Copy() +} + +// ServerTransport returns the underlying ServerTransport for the stream. +// The client side stream always returns nil. +func (s *Stream) ServerTransport() ServerTransport { + return s.st +} + +// Context returns the context of the stream. +func (s *Stream) Context() context.Context { + return s.ctx +} + +// Method returns the method for the stream. +func (s *Stream) Method() string { + return s.method +} + +// StatusCode returns statusCode received from the server. +func (s *Stream) StatusCode() codes.Code { + return s.statusCode +} + +// StatusDesc returns statusDesc received from the server. +func (s *Stream) StatusDesc() string { + return s.statusDesc +} + +// SetHeader sets the header metadata. This can be called multiple times. +// Server side only. +func (s *Stream) SetHeader(md metadata.MD) error { + s.mu.Lock() + defer s.mu.Unlock() + if s.headerOk || s.state == streamDone { + return ErrIllegalHeaderWrite + } + if md.Len() == 0 { + return nil + } + s.header = metadata.Join(s.header, md) + return nil +} + +// SetTrailer sets the trailer metadata which will be sent with the RPC status +// by the server. This can be called multiple times. Server side only. +func (s *Stream) SetTrailer(md metadata.MD) error { + if md.Len() == 0 { + return nil + } + s.mu.Lock() + defer s.mu.Unlock() + s.trailer = metadata.Join(s.trailer, md) + return nil +} + +func (s *Stream) write(m recvMsg) { + s.buf.put(&m) +} + +// Read reads all the data available for this Stream from the transport and +// passes them into the decoder, which converts them into a gRPC message stream. +// The error is io.EOF when the stream is done or another non-nil error if +// the stream broke. +func (s *Stream) Read(p []byte) (n int, err error) { + n, err = s.dec.Read(p) + if err != nil { + return + } + s.windowHandler(n) + return +} + +// GoString is implemented by Stream so context.String() won't +// race when printing %#v. +func (s *Stream) GoString() string { + return fmt.Sprintf("", s, s.method) +} + +// The key to save transport.Stream in the context. +type streamKey struct{} + +// newContextWithStream creates a new context from ctx and attaches stream +// to it. +func newContextWithStream(ctx context.Context, stream *Stream) context.Context { + return context.WithValue(ctx, streamKey{}, stream) +} + +// StreamFromContext returns the stream saved in ctx. +func StreamFromContext(ctx context.Context) (s *Stream, ok bool) { + s, ok = ctx.Value(streamKey{}).(*Stream) + return +} + +// state of transport +type transportState int + +const ( + reachable transportState = iota + unreachable + closing + draining +) + +// ServerConfig consists of all the configurations to establish a server transport. +type ServerConfig struct { + MaxStreams uint32 + AuthInfo credentials.AuthInfo + InTapHandle tap.ServerInHandle + StatsHandler stats.Handler +} + +// NewServerTransport creates a ServerTransport with conn or non-nil error +// if it fails. +func NewServerTransport(protocol string, conn net.Conn, config *ServerConfig) (ServerTransport, error) { + return newHTTP2Server(conn, config) +} + +// ConnectOptions covers all relevant options for communicating with the server. +type ConnectOptions struct { + // UserAgent is the application user agent. + UserAgent string + // Authority is the :authority pseudo-header to use. This field has no effect if + // TransportCredentials is set. + Authority string + // Dialer specifies how to dial a network address. + Dialer func(context.Context, string) (net.Conn, error) + // FailOnNonTempDialError specifies if gRPC fails on non-temporary dial errors. + FailOnNonTempDialError bool + // PerRPCCredentials stores the PerRPCCredentials required to issue RPCs. + PerRPCCredentials []credentials.PerRPCCredentials + // TransportCredentials stores the Authenticator required to setup a client connection. + TransportCredentials credentials.TransportCredentials + // KeepaliveParams stores the keepalive parameters. + KeepaliveParams keepalive.ClientParameters + // StatsHandler stores the handler for stats. + StatsHandler stats.Handler +} + +// TargetInfo contains the information of the target such as network address and metadata. +type TargetInfo struct { + Addr string + Metadata interface{} +} + +// NewClientTransport establishes the transport with the required ConnectOptions +// and returns it to the caller. +func NewClientTransport(ctx context.Context, target TargetInfo, opts ConnectOptions) (ClientTransport, error) { + return newHTTP2Client(ctx, target, opts) +} + +// Options provides additional hints and information for message +// transmission. +type Options struct { + // Last indicates whether this write is the last piece for + // this stream. + Last bool + + // Delay is a hint to the transport implementation for whether + // the data could be buffered for a batching write. The + // Transport implementation may ignore the hint. + Delay bool +} + +// CallHdr carries the information of a particular RPC. +type CallHdr struct { + // Host specifies the peer's host. + Host string + + // Method specifies the operation to perform. + Method string + + // RecvCompress specifies the compression algorithm applied on + // inbound messages. + RecvCompress string + + // SendCompress specifies the compression algorithm applied on + // outbound message. + SendCompress string + + // Flush indicates whether a new stream command should be sent + // to the peer without waiting for the first data. This is + // only a hint. The transport may modify the flush decision + // for performance purposes. + Flush bool +} + +// ClientTransport is the common interface for all gRPC client-side transport +// implementations. +type ClientTransport interface { + // Close tears down this transport. Once it returns, the transport + // should not be accessed any more. The caller must make sure this + // is called only once. + Close() error + + // GracefulClose starts to tear down the transport. It stops accepting + // new RPCs and wait the completion of the pending RPCs. + GracefulClose() error + + // Write sends the data for the given stream. A nil stream indicates + // the write is to be performed on the transport as a whole. + Write(s *Stream, data []byte, opts *Options) error + + // NewStream creates a Stream for an RPC. + NewStream(ctx context.Context, callHdr *CallHdr) (*Stream, error) + + // CloseStream clears the footprint of a stream when the stream is + // not needed any more. The err indicates the error incurred when + // CloseStream is called. Must be called when a stream is finished + // unless the associated transport is closing. + CloseStream(stream *Stream, err error) + + // Error returns a channel that is closed when some I/O error + // happens. Typically the caller should have a goroutine to monitor + // this in order to take action (e.g., close the current transport + // and create a new one) in error case. It should not return nil + // once the transport is initiated. + Error() <-chan struct{} + + // GoAway returns a channel that is closed when ClientTranspor + // receives the draining signal from the server (e.g., GOAWAY frame in + // HTTP/2). + GoAway() <-chan struct{} +} + +// ServerTransport is the common interface for all gRPC server-side transport +// implementations. +// +// Methods may be called concurrently from multiple goroutines, but +// Write methods for a given Stream will be called serially. +type ServerTransport interface { + // HandleStreams receives incoming streams using the given handler. + HandleStreams(func(*Stream), func(context.Context, string) context.Context) + + // WriteHeader sends the header metadata for the given stream. + // WriteHeader may not be called on all streams. + WriteHeader(s *Stream, md metadata.MD) error + + // Write sends the data for the given stream. + // Write may not be called on all streams. + Write(s *Stream, data []byte, opts *Options) error + + // WriteStatus sends the status of a stream to the client. + // WriteStatus is the final call made on a stream and always + // occurs. + WriteStatus(s *Stream, statusCode codes.Code, statusDesc string) error + + // Close tears down the transport. Once it is called, the transport + // should not be accessed any more. All the pending streams and their + // handlers will be terminated asynchronously. + Close() error + + // RemoteAddr returns the remote network address. + RemoteAddr() net.Addr + + // Drain notifies the client this ServerTransport stops accepting new RPCs. + Drain() +} + +// streamErrorf creates an StreamError with the specified error code and description. +func streamErrorf(c codes.Code, format string, a ...interface{}) StreamError { + return StreamError{ + Code: c, + Desc: fmt.Sprintf(format, a...), + } +} + +// connectionErrorf creates an ConnectionError with the specified error description. +func connectionErrorf(temp bool, e error, format string, a ...interface{}) ConnectionError { + return ConnectionError{ + Desc: fmt.Sprintf(format, a...), + temp: temp, + err: e, + } +} + +// ConnectionError is an error that results in the termination of the +// entire connection and the retry of all the active streams. +type ConnectionError struct { + Desc string + temp bool + err error +} + +func (e ConnectionError) Error() string { + return fmt.Sprintf("connection error: desc = %q", e.Desc) +} + +// Temporary indicates if this connection error is temporary or fatal. +func (e ConnectionError) Temporary() bool { + return e.temp +} + +// Origin returns the original error of this connection error. +func (e ConnectionError) Origin() error { + // Never return nil error here. + // If the original error is nil, return itself. + if e.err == nil { + return e + } + return e.err +} + +var ( + // ErrConnClosing indicates that the transport is closing. + ErrConnClosing = connectionErrorf(true, nil, "transport is closing") + // ErrStreamDrain indicates that the stream is rejected by the server because + // the server stops accepting new RPCs. + ErrStreamDrain = streamErrorf(codes.Unavailable, "the server stops accepting new RPCs") +) + +// StreamError is an error that only affects one stream within a connection. +type StreamError struct { + Code codes.Code + Desc string +} + +func (e StreamError) Error() string { + return fmt.Sprintf("stream error: code = %s desc = %q", e.Code, e.Desc) +} + +// ContextErr converts the error from context package into a StreamError. +func ContextErr(err error) StreamError { + switch err { + case context.DeadlineExceeded: + return streamErrorf(codes.DeadlineExceeded, "%v", err) + case context.Canceled: + return streamErrorf(codes.Canceled, "%v", err) + } + panic(fmt.Sprintf("Unexpected error from context packet: %v", err)) +} + +// wait blocks until it can receive from ctx.Done, closing, or proceed. +// If it receives from ctx.Done, it returns 0, the StreamError for ctx.Err. +// If it receives from done, it returns 0, io.EOF if ctx is not done; otherwise +// it return the StreamError for ctx.Err. +// If it receives from goAway, it returns 0, ErrStreamDrain. +// If it receives from closing, it returns 0, ErrConnClosing. +// If it receives from proceed, it returns the received integer, nil. +func wait(ctx context.Context, done, goAway, closing <-chan struct{}, proceed <-chan int) (int, error) { + select { + case <-ctx.Done(): + return 0, ContextErr(ctx.Err()) + case <-done: + // User cancellation has precedence. + select { + case <-ctx.Done(): + return 0, ContextErr(ctx.Err()) + default: + } + return 0, io.EOF + case <-goAway: + return 0, ErrStreamDrain + case <-closing: + return 0, ErrConnClosing + case i := <-proceed: + return i, nil + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/circle.yml b/_vendor/src/github.com/pingcap/kvproto/circle.yml new file mode 100644 index 00000000000..e910ff6c8be --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/circle.yml @@ -0,0 +1,51 @@ +machine: + environment: + PATH: "$HOME/.cargo/bin:$HOME/.local/bin:$PATH" + GODIST: "go1.7.3.linux-amd64.tar.gz" + LD_LIBRARY_PATH: "$LD_LIBRARY_PATH:$HOME/.local/lib" + LD_RUN_PATH: "$LD_RUN_PATH:$HOME/.local/lib" + DYLD_LIBRARY_PATH: "$DYLD_LIBRARY_PATH:$HOME/.local/lib" + LDFLAGS: "-L$HOME/.local/lib" + CPPFLAGS: "-I$HOME/.local/include" + CXXFLAGS: "-I$HOME/.local/include" + PKG_CONFIG_PATH: "$PKG_CONFIG_PATH:$HOME/.local/lib/pkgconfig" + RUSTC_DATE: "2017-03-28" + LOCAL_PREFIX: "$HOME/.local" + # used by cargo + LIBRARY_PATH: "$LIBRARY_PATH:$HOME/.local/lib" + RUST_TEST_THREADS: 1 + RUST_BACKTRACE: 1 + RUSTFLAGS: "-Dwarnings" + RUSTFMT_VERSION: "v0.6.0" + post: + - mkdir -p download + - test -e download/$GODIST || curl -o download/$GODIST https://storage.googleapis.com/golang/$GODIST + - sudo rm -rf /usr/local/go + - sudo tar -C /usr/local -xzf download/$GODIST + # Fixes: cargo under CircleCI + - sed -i 's/github/git-non-exist-hub/g' ~/.gitconfig + +dependencies: + cache_directories: + - ~/download + - ~/.multirust + - ~/.cargo + - ~/.local + pre: + # install rust/cargo + - | + if [[ ! -e $HOME/.cargo ]]; then + curl https://sh.rustup.rs -sSf | + sh -s -- --no-modify-path --default-toolchain "nightly-${RUSTC_DATE}" -y; + rustup default "nightly-${RUSTC_DATE}"; + else + rustup default "nightly-${RUSTC_DATE}"; + fi + override: + - mkdir -p $HOME/.go_project/src/github.com/$CIRCLE_PROJECT_USERNAME + - ln -fs $HOME/$CIRCLE_PROJECT_REPONAME $HOME/.go_project/src/github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME + - echo 'export GOPATH=$GOPATH:$HOME/.go_project' >> ~/.circlerc + +test: + override: + - cd $HOME/.go_project/src/github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME && make test diff --git a/_vendor/src/github.com/pingcap/kvproto/common.sh b/_vendor/src/github.com/pingcap/kvproto/common.sh new file mode 100755 index 00000000000..828afa34bae --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/common.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +check_protoc_version() { + version=$(protoc --version) + major=$(echo ${version} | sed -n -e 's/.*\([0-9]\{1,\}\)\.[0-9]\{1,\}\.[0-9]\{1,\}.*/\1/p') + minor=$(echo ${version} | sed -n -e 's/.*[0-9]\{1,\}\.\([0-9]\{1,\}\)\.[0-9]\{1,\}.*/\1/p') + if [ "$major" -gt 3 ]; then + return 0 + fi + if [ "$major" -eq 3 ] && [ "$minor" -ge 1 ]; then + return 0 + fi + echo "protoc version not match, version 3.1.x is needed, current version: ${version}" + return 1 +} + +push () { + pushd $1 >/dev/null 2>&1 +} + +pop () { + popd $1 >/dev/null 2>&1 +} + +cmd_exists () { + which "$1" 1>/dev/null 2>&1 +} diff --git a/_vendor/src/github.com/pingcap/kvproto/generate_go.sh b/_vendor/src/github.com/pingcap/kvproto/generate_go.sh new file mode 100755 index 00000000000..3c716e00863 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/generate_go.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +. ./common.sh + +if ! check_protoc_version; then + exit 1 +fi + +PROGRAM=$(basename "$0") + +if [ -z $GOPATH ]; then + printf "Error: the environment variable GOPATH is not set, please set it before running %s\n" $PROGRAM > /dev/stderr + exit 1 +fi + +GO_PREFIX_PATH=github.com/pingcap/kvproto/pkg + +gogo_protobuf_url=github.com/gogo/protobuf +GOGO_ROOT=${GOPATH}/src/${gogo_protobuf_url} +GO_OUT_M= +GO_INSTALL='go install' + +echo "install gogoproto code/generator ..." +${GO_INSTALL} ${gogo_protobuf_url}/proto +${GO_INSTALL} ${gogo_protobuf_url}/protoc-gen-gofast +${GO_INSTALL} ${gogo_protobuf_url}/gogoproto + +echo "install goimports ..." +${GO_INSTALL} golang.org/x/tools/cmd/goimports + +# add the bin path of gogoproto generator into PATH if it's missing +if ! cmd_exists protoc-gen-gofast; then + for path in $(echo "${GOPATH}" | sed -e 's/:/ /g'); do + gogo_proto_bin="${path}/bin/protoc-gen-gofast" + if [ -e "${gogo_proto_bin}" ]; then + export PATH=$(dirname "${gogo_proto_bin}"):$PATH + break + fi + done +fi + +cd proto +for file in `ls *.proto` + do + base_name=$(basename $file ".proto") + mkdir -p ../pkg/$base_name + if [ -z $GO_OUT_M ]; then + GO_OUT_M="M$file=$GO_PREFIX_PATH/$base_name" + else + GO_OUT_M="$GO_OUT_M,M$file=$GO_PREFIX_PATH/$base_name" + fi +done + +echo "generate go code..." +ret=0 +for file in `ls *.proto` + do + base_name=$(basename $file ".proto") + protoc -I.:${GOGO_ROOT}:${GOGO_ROOT}/protobuf --gofast_out=plugins=grpc,$GO_OUT_M:../pkg/$base_name $file || ret=$? + cd ../pkg/$base_name + sed -i.bak -E 's/import _ \"gogoproto\"//g' *.pb.go + sed -i.bak -E 's/import fmt \"fmt\"//g' *.pb.go + sed -i.bak -E 's/import io \"io\"//g' *.pb.go + sed -i.bak -E 's/import math \"math\"//g' *.pb.go + rm -f *.bak + goimports -w *.pb.go + cd ../../proto +done +exit $ret diff --git a/_vendor/src/github.com/pingcap/kvproto/generate_rust.sh b/_vendor/src/github.com/pingcap/kvproto/generate_rust.sh new file mode 100755 index 00000000000..c7fdfd37d95 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/generate_rust.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +. ./common.sh + +if ! check_protoc_version; then + exit 1 +fi + +# install rust-protobuf if it's missing +if ! cmd_exists protoc-gen-rust; then + echo "missing rust-protobuf, try to download/install it" + cargo install protobuf || exit 1 +fi + +if ! cmd_exists grpc_rust_plugin; then + echo "missing grpc_rust_plugin, try to download/install it" + cargo install grpcio-compiler || exit 1 +fi + +push proto +echo "generate rust code..." +gogo_protobuf_url=github.com/gogo/protobuf +GOGO_ROOT=${GOPATH}/src/github.com/gogo/protobuf +GO_INSTALL='go install' + +echo "install gogoproto code/generator ..." +${GO_INSTALL} ${gogo_protobuf_url}/proto +${GO_INSTALL} ${gogo_protobuf_url}/protoc-gen-gofast +${GO_INSTALL} ${gogo_protobuf_url}/gogoproto + +# add the bin path of gogoproto generator into PATH if it's missing +if ! cmd_exists protoc-gen-gofast; then + for path in $(echo "${GOPATH}" | sed -e 's/:/ /g'); do + gogo_proto_bin="${path}/bin/protoc-gen-gofast" + if [ -e "${gogo_proto_bin}" ]; then + export PATH=$(dirname "${gogo_proto_bin}"):$PATH + break + fi + done +fi + +protoc -I.:${GOGO_ROOT}:${GOGO_ROOT}/protobuf --rust_out ../src *.proto || exit $? +protoc -I.:${GOGO_ROOT}:${GOGO_ROOT}/protobuf --grpc_out ../src --plugin=protoc-gen-grpc=`which grpc_rust_plugin` *.proto || exit $? +pop + +push src +LIB_RS=`mktemp` +rm -f lib.rs +echo "extern crate protobuf;" > ${LIB_RS} +echo "extern crate futures;" >> ${LIB_RS} +echo "extern crate grpcio;" >> ${LIB_RS} +echo >> ${LIB_RS} +for file in `ls *.rs` + do + base_name=$(basename $file ".rs") + echo "pub mod $base_name;" >> ${LIB_RS} +done +mv ${LIB_RS} lib.rs +pop + +cargo build diff --git a/_vendor/src/github.com/pingcap/kvproto/glide.lock b/_vendor/src/github.com/pingcap/kvproto/glide.lock new file mode 100644 index 00000000000..694240803bf --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/glide.lock @@ -0,0 +1,104 @@ +hash: 59555dc62b5af00d71ef4f1f4f990d17ccad5b6d10dc89f4b2be14065247a065 +updated: 2017-04-26T11:12:14.754942661+08:00 +imports: +- name: github.com/gogo/protobuf + version: 06ec6c31ff1bac6ed4e205a547a3d72934813ef3 + subpackages: + - _conformance + - _conformance/conformance_proto + - codec + - gogoproto + - gogoreplace + - io + - jsonpb + - plugin/compare + - plugin/defaultcheck + - plugin/description + - plugin/embedcheck + - plugin/enumstringer + - plugin/equal + - plugin/face + - plugin/gostring + - plugin/grpc + - plugin/marshalto + - plugin/oneofcheck + - plugin/populate + - plugin/size + - plugin/stringer + - plugin/testgen + - plugin/union + - plugin/unmarshal + - proto + - proto/proto3_proto + - protobuf/google/protobuf + - protobuf/google/protobuf/compiler + - protobuf/protobuf + - protoc-gen-combo + - protoc-gen-gofast + - protoc-gen-gogo + - protoc-gen-gogo/descriptor + - protoc-gen-gogo/generator + - protoc-gen-gogo/grpc + - protoc-gen-gogo/plugin + - protoc-gen-gogofast + - protoc-gen-gogofaster + - protoc-gen-gogoslick + - protoc-gen-gogotypes + - protoc-gen-gostring + - protoc-min-version + - sortkeys + - types + - vanity + - vanity/command + - vanity/test + - vanity/test/fast + - vanity/test/faster + - vanity/test/slick + - version +- name: github.com/golang/protobuf + version: 8ee79997227bf9b34611aee7946ae64735e6fd93 + subpackages: + - proto +- name: github.com/juju/errors + version: 6f54ff6318409d31ff16261533ce2c8381a4fd5d +- name: github.com/pingcap/tipb + version: 1043caee48da56ffc3521406a041db8e5feac9a8 + subpackages: + - sharedbytes +- name: golang.org/x/net + version: 6acef71eb69611914f7a30939ea9f6e194c78172 + subpackages: + - context + - http2 + - http2/hpack + - internal/timeseries + - trace +- name: golang.org/x/text + version: 723492b65e225eafcba054e76ba18bb9c5ac1ea2 + subpackages: + - secure/bidirule +- name: golang.org/x/tools + version: dd796641777bce15ee87fb6bea64943b648bdcf3 + repo: https://github.com/golang/tools.git + vcs: git + subpackages: + - cmd/goimports + - go/ast/astutil + - imports +- name: google.golang.org/grpc + version: 8050b9cbc271307e5a716a9d782803d09b0d6f2d + subpackages: + - codes + - credentials + - grpclog + - internal + - keepalive + - metadata + - naming + - peer + - stats + - tap + - transport +testImports: +- name: github.com/pingcap/check + version: "" diff --git a/_vendor/src/github.com/pingcap/kvproto/glide.yaml b/_vendor/src/github.com/pingcap/kvproto/glide.yaml new file mode 100644 index 00000000000..09e9754e7d8 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/glide.yaml @@ -0,0 +1,81 @@ +package: github.com/pingcap/kvproto +import: +- package: github.com/gogo/protobuf + version: 06ec6c31ff1bac6ed4e205a547a3d72934813ef3 + subpackages: + - codec + - _conformance + - _conformance/conformance_proto + - gogoproto + - gogoreplace + - io + - jsonpb + - plugin/compare + - plugin/defaultcheck + - plugin/description + - plugin/embedcheck + - plugin/enumstringer + - plugin/equal + - plugin/face + - plugin/grpc + - plugin/gostring + - plugin/marshalto + - plugin/oneofcheck + - plugin/populate + - plugin/size + - plugin/stringer + - plugin/testgen + - plugin/union + - plugin/unmarshal + - proto + - protobuf/protobuf + - protobuf/google/protobuf + - protobuf/google/protobuf/compiler + - protoc-gen-combo + - protoc-gen-gofast + - protoc-gen-gogo + - protoc-gen-gogo/descriptor + - protoc-gen-gogofast + - protoc-gen-gogofaster + - protoc-gen-gogo/generator + - protoc-gen-gogo/grpc + - protoc-gen-gogo/plugin + - protoc-gen-gogoslick + - protoc-gen-gogotypes + - protoc-gen-gostring + - protoc-min-version + - proto/proto3_proto + - sortkeys + - types + - vanity + - vanity/command + - vanity/test + - vanity/test/fast + - vanity/test/faster + - vanity/test/slick + - version +- package: github.com/golang/protobuf + version: 8ee79997227bf9b34611aee7946ae64735e6fd93 + subpackages: + - proto +- package: github.com/juju/errors + version: 6f54ff6318409d31ff16261533ce2c8381a4fd5d +- package: golang.org/x/tools + version: dd796641777bce15ee87fb6bea64943b648bdcf3 + repo: https://github.com/golang/tools.git + vcs: git + subpackages: + - imports + - cmd/goimports + - go/ast/astutil +- package: github.com/pingcap/tipb + version: 1043caee48da56ffc3521406a041db8e5feac9a8 + subpackages: + - sharedbytes +- package: google.golang.org/grpc + version: ^1.2.1 +- package: golang.org/x/text + subpackages: + - secure/bidirule +testImport: +- package: github.com/pingcap/check diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/coprocessor/coprocessor.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/coprocessor/coprocessor.pb.go new file mode 100644 index 00000000000..cb9c785ba1e --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/pkg/coprocessor/coprocessor.pb.go @@ -0,0 +1,960 @@ +// Code generated by protoc-gen-gogo. +// source: coprocessor.proto +// DO NOT EDIT! + +/* + Package coprocessor is a generated protocol buffer package. + + It is generated from these files: + coprocessor.proto + + It has these top-level messages: + KeyRange + Request + Response +*/ +package coprocessor + +import ( + "fmt" + "io" + "math" + + proto "github.com/golang/protobuf/proto" + + errorpb "github.com/pingcap/kvproto/pkg/errorpb" + + kvrpcpb "github.com/pingcap/kvproto/pkg/kvrpcpb" + + github_com_pingcap_tipb_sharedbytes "github.com/pingcap/tipb/sharedbytes" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +// [start, end) +type KeyRange struct { + Start []byte `protobuf:"bytes,1,opt,name=start,proto3" json:"start,omitempty"` + End []byte `protobuf:"bytes,2,opt,name=end,proto3" json:"end,omitempty"` +} + +func (m *KeyRange) Reset() { *m = KeyRange{} } +func (m *KeyRange) String() string { return proto.CompactTextString(m) } +func (*KeyRange) ProtoMessage() {} +func (*KeyRange) Descriptor() ([]byte, []int) { return fileDescriptorCoprocessor, []int{0} } + +func (m *KeyRange) GetStart() []byte { + if m != nil { + return m.Start + } + return nil +} + +func (m *KeyRange) GetEnd() []byte { + if m != nil { + return m.End + } + return nil +} + +type Request struct { + Context *kvrpcpb.Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` + Tp int64 `protobuf:"varint,2,opt,name=tp,proto3" json:"tp,omitempty"` + Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` + Ranges []*KeyRange `protobuf:"bytes,4,rep,name=ranges" json:"ranges,omitempty"` +} + +func (m *Request) Reset() { *m = Request{} } +func (m *Request) String() string { return proto.CompactTextString(m) } +func (*Request) ProtoMessage() {} +func (*Request) Descriptor() ([]byte, []int) { return fileDescriptorCoprocessor, []int{1} } + +func (m *Request) GetContext() *kvrpcpb.Context { + if m != nil { + return m.Context + } + return nil +} + +func (m *Request) GetTp() int64 { + if m != nil { + return m.Tp + } + return 0 +} + +func (m *Request) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +func (m *Request) GetRanges() []*KeyRange { + if m != nil { + return m.Ranges + } + return nil +} + +type Response struct { + Data github_com_pingcap_tipb_sharedbytes.SharedBytes `protobuf:"bytes,1,opt,name=data,proto3,customtype=github.com/pingcap/tipb/sharedbytes.SharedBytes" json:"data"` + RegionError *errorpb.Error `protobuf:"bytes,2,opt,name=region_error,json=regionError" json:"region_error,omitempty"` + Locked *kvrpcpb.LockInfo `protobuf:"bytes,3,opt,name=locked" json:"locked,omitempty"` + OtherError string `protobuf:"bytes,4,opt,name=other_error,json=otherError,proto3" json:"other_error,omitempty"` +} + +func (m *Response) Reset() { *m = Response{} } +func (m *Response) String() string { return proto.CompactTextString(m) } +func (*Response) ProtoMessage() {} +func (*Response) Descriptor() ([]byte, []int) { return fileDescriptorCoprocessor, []int{2} } + +func (m *Response) GetRegionError() *errorpb.Error { + if m != nil { + return m.RegionError + } + return nil +} + +func (m *Response) GetLocked() *kvrpcpb.LockInfo { + if m != nil { + return m.Locked + } + return nil +} + +func (m *Response) GetOtherError() string { + if m != nil { + return m.OtherError + } + return "" +} + +func init() { + proto.RegisterType((*KeyRange)(nil), "coprocessor.KeyRange") + proto.RegisterType((*Request)(nil), "coprocessor.Request") + proto.RegisterType((*Response)(nil), "coprocessor.Response") +} +func (m *KeyRange) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *KeyRange) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Start) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintCoprocessor(dAtA, i, uint64(len(m.Start))) + i += copy(dAtA[i:], m.Start) + } + if len(m.End) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintCoprocessor(dAtA, i, uint64(len(m.End))) + i += copy(dAtA[i:], m.End) + } + return i, nil +} + +func (m *Request) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Request) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Context != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintCoprocessor(dAtA, i, uint64(m.Context.Size())) + n1, err := m.Context.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.Tp != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintCoprocessor(dAtA, i, uint64(m.Tp)) + } + if len(m.Data) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintCoprocessor(dAtA, i, uint64(len(m.Data))) + i += copy(dAtA[i:], m.Data) + } + if len(m.Ranges) > 0 { + for _, msg := range m.Ranges { + dAtA[i] = 0x22 + i++ + i = encodeVarintCoprocessor(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *Response) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Response) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintCoprocessor(dAtA, i, uint64(m.Data.Size())) + n2, err := m.Data.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + if m.RegionError != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintCoprocessor(dAtA, i, uint64(m.RegionError.Size())) + n3, err := m.RegionError.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if m.Locked != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintCoprocessor(dAtA, i, uint64(m.Locked.Size())) + n4, err := m.Locked.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + if len(m.OtherError) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintCoprocessor(dAtA, i, uint64(len(m.OtherError))) + i += copy(dAtA[i:], m.OtherError) + } + return i, nil +} + +func encodeFixed64Coprocessor(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Coprocessor(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintCoprocessor(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *KeyRange) Size() (n int) { + var l int + _ = l + l = len(m.Start) + if l > 0 { + n += 1 + l + sovCoprocessor(uint64(l)) + } + l = len(m.End) + if l > 0 { + n += 1 + l + sovCoprocessor(uint64(l)) + } + return n +} + +func (m *Request) Size() (n int) { + var l int + _ = l + if m.Context != nil { + l = m.Context.Size() + n += 1 + l + sovCoprocessor(uint64(l)) + } + if m.Tp != 0 { + n += 1 + sovCoprocessor(uint64(m.Tp)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovCoprocessor(uint64(l)) + } + if len(m.Ranges) > 0 { + for _, e := range m.Ranges { + l = e.Size() + n += 1 + l + sovCoprocessor(uint64(l)) + } + } + return n +} + +func (m *Response) Size() (n int) { + var l int + _ = l + l = m.Data.Size() + n += 1 + l + sovCoprocessor(uint64(l)) + if m.RegionError != nil { + l = m.RegionError.Size() + n += 1 + l + sovCoprocessor(uint64(l)) + } + if m.Locked != nil { + l = m.Locked.Size() + n += 1 + l + sovCoprocessor(uint64(l)) + } + l = len(m.OtherError) + if l > 0 { + n += 1 + l + sovCoprocessor(uint64(l)) + } + return n +} + +func sovCoprocessor(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozCoprocessor(x uint64) (n int) { + return sovCoprocessor(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *KeyRange) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoprocessor + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: KeyRange: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: KeyRange: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Start", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoprocessor + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthCoprocessor + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Start = append(m.Start[:0], dAtA[iNdEx:postIndex]...) + if m.Start == nil { + m.Start = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field End", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoprocessor + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthCoprocessor + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.End = append(m.End[:0], dAtA[iNdEx:postIndex]...) + if m.End == nil { + m.End = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCoprocessor(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCoprocessor + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Request) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoprocessor + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Request: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Request: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoprocessor + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCoprocessor + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Context == nil { + m.Context = &kvrpcpb.Context{} + } + if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Tp", wireType) + } + m.Tp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoprocessor + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Tp |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoprocessor + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthCoprocessor + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ranges", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoprocessor + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCoprocessor + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ranges = append(m.Ranges, &KeyRange{}) + if err := m.Ranges[len(m.Ranges)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCoprocessor(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCoprocessor + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Response) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoprocessor + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Response: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Response: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoprocessor + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthCoprocessor + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoprocessor + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCoprocessor + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionError == nil { + m.RegionError = &errorpb.Error{} + } + if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Locked", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoprocessor + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCoprocessor + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Locked == nil { + m.Locked = &kvrpcpb.LockInfo{} + } + if err := m.Locked.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OtherError", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoprocessor + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCoprocessor + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OtherError = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCoprocessor(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCoprocessor + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipCoprocessor(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCoprocessor + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCoprocessor + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCoprocessor + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthCoprocessor + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCoprocessor + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipCoprocessor(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthCoprocessor = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowCoprocessor = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("coprocessor.proto", fileDescriptorCoprocessor) } + +var fileDescriptorCoprocessor = []byte{ + // 379 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x51, 0xb1, 0xae, 0xda, 0x30, + 0x14, 0xc5, 0x84, 0x02, 0x75, 0x00, 0x81, 0x45, 0xa5, 0x88, 0x21, 0x20, 0x26, 0x8a, 0x54, 0x47, + 0x4d, 0x87, 0xee, 0x54, 0x1d, 0x2a, 0x3a, 0xb9, 0x1f, 0x50, 0x25, 0x8e, 0x1b, 0xa2, 0x94, 0x5c, + 0xd7, 0x36, 0xa8, 0xfc, 0x41, 0x3f, 0xa1, 0x9f, 0xc4, 0xf8, 0xa6, 0x37, 0xbc, 0x01, 0x3d, 0xf1, + 0x7e, 0xe4, 0x29, 0x4e, 0x82, 0x98, 0xee, 0xb9, 0xc7, 0xc7, 0xc7, 0xe7, 0x5e, 0xe3, 0x09, 0x07, + 0xa9, 0x80, 0x0b, 0xad, 0x41, 0x51, 0xa9, 0xc0, 0x00, 0x71, 0xef, 0xa8, 0xd9, 0x50, 0x28, 0x05, + 0x4a, 0xc6, 0xd5, 0xd9, 0x6c, 0x98, 0x1f, 0x95, 0xe4, 0xb7, 0x76, 0x9a, 0x42, 0x0a, 0x16, 0x06, + 0x25, 0xaa, 0xd8, 0x65, 0x88, 0xfb, 0x5b, 0x71, 0x62, 0x51, 0x91, 0x0a, 0x32, 0xc5, 0x6f, 0xb4, + 0x89, 0x94, 0xf1, 0xd0, 0x02, 0xad, 0x06, 0xac, 0x6a, 0xc8, 0x18, 0x3b, 0xa2, 0x48, 0xbc, 0xb6, + 0xe5, 0x4a, 0xb8, 0xfc, 0x87, 0x70, 0x8f, 0x89, 0x3f, 0x07, 0xa1, 0x0d, 0x59, 0xe3, 0x1e, 0x87, + 0xc2, 0x88, 0xbf, 0xd5, 0x2d, 0x37, 0x1c, 0xd3, 0xe6, 0xd9, 0x2f, 0x15, 0xcf, 0x1a, 0x01, 0x19, + 0xe1, 0xb6, 0x91, 0xd6, 0xc8, 0x61, 0x6d, 0x23, 0x09, 0xc1, 0x9d, 0x24, 0x32, 0x91, 0xe7, 0x58, + 0x6b, 0x8b, 0xc9, 0x07, 0xdc, 0x55, 0x65, 0x18, 0xed, 0x75, 0x16, 0xce, 0xca, 0x0d, 0xdf, 0xd1, + 0xfb, 0xa1, 0x9b, 0xa8, 0xac, 0x16, 0x2d, 0x1f, 0x11, 0xee, 0x33, 0xa1, 0x25, 0x14, 0x5a, 0x90, + 0x6d, 0xed, 0x67, 0xe3, 0x6f, 0x3e, 0x9f, 0x2f, 0xf3, 0xd6, 0xd3, 0x65, 0x1e, 0xa4, 0x99, 0xd9, + 0x1d, 0x62, 0xca, 0x61, 0x1f, 0xc8, 0xac, 0x48, 0x79, 0x24, 0x03, 0x93, 0xc9, 0x38, 0xd0, 0xbb, + 0x48, 0x89, 0x24, 0x3e, 0x19, 0xa1, 0xe9, 0x0f, 0x8b, 0x37, 0x25, 0xae, 0x83, 0x7c, 0xc4, 0x03, + 0x25, 0xd2, 0x0c, 0x8a, 0x9f, 0x76, 0xab, 0x36, 0xb6, 0x1b, 0x8e, 0x68, 0xb3, 0xe3, 0xaf, 0x65, + 0x65, 0x6e, 0xa5, 0xb1, 0x0d, 0x79, 0x8f, 0xbb, 0xbf, 0x81, 0xe7, 0x22, 0xb1, 0x13, 0xb9, 0xe1, + 0xe4, 0xb6, 0x8a, 0xef, 0xc0, 0xf3, 0x6f, 0xc5, 0x2f, 0x60, 0xb5, 0x80, 0xcc, 0xb1, 0x0b, 0x66, + 0x27, 0x54, 0x6d, 0xde, 0x59, 0xa0, 0xd5, 0x5b, 0x86, 0x2d, 0x65, 0xbd, 0x36, 0xeb, 0xf3, 0xd5, + 0x47, 0x0f, 0x57, 0x1f, 0x3d, 0x5f, 0x7d, 0xf4, 0xff, 0xc5, 0x6f, 0x61, 0x8f, 0xc3, 0x9e, 0xd6, + 0x03, 0x50, 0x93, 0xe5, 0x47, 0x9a, 0x1f, 0xed, 0x1f, 0xc6, 0x5d, 0x5b, 0x3e, 0xbd, 0x06, 0x00, + 0x00, 0xff, 0xff, 0xfa, 0xd0, 0xd4, 0xd5, 0x20, 0x02, 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/eraftpb/eraftpb.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/eraftpb/eraftpb.pb.go new file mode 100644 index 00000000000..9ff98fe0b58 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/pkg/eraftpb/eraftpb.pb.go @@ -0,0 +1,2219 @@ +// Code generated by protoc-gen-gogo. +// source: eraftpb.proto +// DO NOT EDIT! + +/* + Package eraftpb is a generated protocol buffer package. + + It is generated from these files: + eraftpb.proto + + It has these top-level messages: + Entry + SnapshotMetadata + Snapshot + Message + HardState + ConfState + ConfChange +*/ +package eraftpb + +import ( + "fmt" + "io" + "math" + + proto "github.com/golang/protobuf/proto" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type EntryType int32 + +const ( + EntryType_EntryNormal EntryType = 0 + EntryType_EntryConfChange EntryType = 1 +) + +var EntryType_name = map[int32]string{ + 0: "EntryNormal", + 1: "EntryConfChange", +} +var EntryType_value = map[string]int32{ + "EntryNormal": 0, + "EntryConfChange": 1, +} + +func (x EntryType) Enum() *EntryType { + p := new(EntryType) + *p = x + return p +} +func (x EntryType) String() string { + return proto.EnumName(EntryType_name, int32(x)) +} +func (x *EntryType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(EntryType_value, data, "EntryType") + if err != nil { + return err + } + *x = EntryType(value) + return nil +} +func (EntryType) EnumDescriptor() ([]byte, []int) { return fileDescriptorEraftpb, []int{0} } + +type MessageType int32 + +const ( + MessageType_MsgHup MessageType = 0 + MessageType_MsgBeat MessageType = 1 + MessageType_MsgPropose MessageType = 2 + MessageType_MsgAppend MessageType = 3 + MessageType_MsgAppendResponse MessageType = 4 + MessageType_MsgRequestVote MessageType = 5 + MessageType_MsgRequestVoteResponse MessageType = 6 + MessageType_MsgSnapshot MessageType = 7 + MessageType_MsgHeartbeat MessageType = 8 + MessageType_MsgHeartbeatResponse MessageType = 9 + MessageType_MsgUnreachable MessageType = 10 + MessageType_MsgSnapStatus MessageType = 11 + MessageType_MsgCheckQuorum MessageType = 12 + MessageType_MsgTransferLeader MessageType = 13 + MessageType_MsgTimeoutNow MessageType = 14 + MessageType_MsgReadIndex MessageType = 15 + MessageType_MsgReadIndexResp MessageType = 16 + MessageType_MsgRequestPreVote MessageType = 17 + MessageType_MsgRequestPreVoteResponse MessageType = 18 +) + +var MessageType_name = map[int32]string{ + 0: "MsgHup", + 1: "MsgBeat", + 2: "MsgPropose", + 3: "MsgAppend", + 4: "MsgAppendResponse", + 5: "MsgRequestVote", + 6: "MsgRequestVoteResponse", + 7: "MsgSnapshot", + 8: "MsgHeartbeat", + 9: "MsgHeartbeatResponse", + 10: "MsgUnreachable", + 11: "MsgSnapStatus", + 12: "MsgCheckQuorum", + 13: "MsgTransferLeader", + 14: "MsgTimeoutNow", + 15: "MsgReadIndex", + 16: "MsgReadIndexResp", + 17: "MsgRequestPreVote", + 18: "MsgRequestPreVoteResponse", +} +var MessageType_value = map[string]int32{ + "MsgHup": 0, + "MsgBeat": 1, + "MsgPropose": 2, + "MsgAppend": 3, + "MsgAppendResponse": 4, + "MsgRequestVote": 5, + "MsgRequestVoteResponse": 6, + "MsgSnapshot": 7, + "MsgHeartbeat": 8, + "MsgHeartbeatResponse": 9, + "MsgUnreachable": 10, + "MsgSnapStatus": 11, + "MsgCheckQuorum": 12, + "MsgTransferLeader": 13, + "MsgTimeoutNow": 14, + "MsgReadIndex": 15, + "MsgReadIndexResp": 16, + "MsgRequestPreVote": 17, + "MsgRequestPreVoteResponse": 18, +} + +func (x MessageType) Enum() *MessageType { + p := new(MessageType) + *p = x + return p +} +func (x MessageType) String() string { + return proto.EnumName(MessageType_name, int32(x)) +} +func (x *MessageType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(MessageType_value, data, "MessageType") + if err != nil { + return err + } + *x = MessageType(value) + return nil +} +func (MessageType) EnumDescriptor() ([]byte, []int) { return fileDescriptorEraftpb, []int{1} } + +type ConfChangeType int32 + +const ( + ConfChangeType_AddNode ConfChangeType = 0 + ConfChangeType_RemoveNode ConfChangeType = 1 +) + +var ConfChangeType_name = map[int32]string{ + 0: "AddNode", + 1: "RemoveNode", +} +var ConfChangeType_value = map[string]int32{ + "AddNode": 0, + "RemoveNode": 1, +} + +func (x ConfChangeType) Enum() *ConfChangeType { + p := new(ConfChangeType) + *p = x + return p +} +func (x ConfChangeType) String() string { + return proto.EnumName(ConfChangeType_name, int32(x)) +} +func (x *ConfChangeType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(ConfChangeType_value, data, "ConfChangeType") + if err != nil { + return err + } + *x = ConfChangeType(value) + return nil +} +func (ConfChangeType) EnumDescriptor() ([]byte, []int) { return fileDescriptorEraftpb, []int{2} } + +type Entry struct { + EntryType *EntryType `protobuf:"varint,1,opt,name=entry_type,json=entryType,enum=eraftpb.EntryType" json:"entry_type,omitempty"` + Term *uint64 `protobuf:"varint,2,opt,name=term" json:"term,omitempty"` + Index *uint64 `protobuf:"varint,3,opt,name=index" json:"index,omitempty"` + Data []byte `protobuf:"bytes,4,opt,name=data" json:"data,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *Entry) Reset() { *m = Entry{} } +func (m *Entry) String() string { return proto.CompactTextString(m) } +func (*Entry) ProtoMessage() {} +func (*Entry) Descriptor() ([]byte, []int) { return fileDescriptorEraftpb, []int{0} } + +func (m *Entry) GetEntryType() EntryType { + if m != nil && m.EntryType != nil { + return *m.EntryType + } + return EntryType_EntryNormal +} + +func (m *Entry) GetTerm() uint64 { + if m != nil && m.Term != nil { + return *m.Term + } + return 0 +} + +func (m *Entry) GetIndex() uint64 { + if m != nil && m.Index != nil { + return *m.Index + } + return 0 +} + +func (m *Entry) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +type SnapshotMetadata struct { + ConfState *ConfState `protobuf:"bytes,1,opt,name=conf_state,json=confState" json:"conf_state,omitempty"` + Index *uint64 `protobuf:"varint,2,opt,name=index" json:"index,omitempty"` + Term *uint64 `protobuf:"varint,3,opt,name=term" json:"term,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *SnapshotMetadata) Reset() { *m = SnapshotMetadata{} } +func (m *SnapshotMetadata) String() string { return proto.CompactTextString(m) } +func (*SnapshotMetadata) ProtoMessage() {} +func (*SnapshotMetadata) Descriptor() ([]byte, []int) { return fileDescriptorEraftpb, []int{1} } + +func (m *SnapshotMetadata) GetConfState() *ConfState { + if m != nil { + return m.ConfState + } + return nil +} + +func (m *SnapshotMetadata) GetIndex() uint64 { + if m != nil && m.Index != nil { + return *m.Index + } + return 0 +} + +func (m *SnapshotMetadata) GetTerm() uint64 { + if m != nil && m.Term != nil { + return *m.Term + } + return 0 +} + +type Snapshot struct { + Data []byte `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"` + Metadata *SnapshotMetadata `protobuf:"bytes,2,opt,name=metadata" json:"metadata,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *Snapshot) Reset() { *m = Snapshot{} } +func (m *Snapshot) String() string { return proto.CompactTextString(m) } +func (*Snapshot) ProtoMessage() {} +func (*Snapshot) Descriptor() ([]byte, []int) { return fileDescriptorEraftpb, []int{2} } + +func (m *Snapshot) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +func (m *Snapshot) GetMetadata() *SnapshotMetadata { + if m != nil { + return m.Metadata + } + return nil +} + +type Message struct { + MsgType *MessageType `protobuf:"varint,1,opt,name=msg_type,json=msgType,enum=eraftpb.MessageType" json:"msg_type,omitempty"` + To *uint64 `protobuf:"varint,2,opt,name=to" json:"to,omitempty"` + From *uint64 `protobuf:"varint,3,opt,name=from" json:"from,omitempty"` + Term *uint64 `protobuf:"varint,4,opt,name=term" json:"term,omitempty"` + LogTerm *uint64 `protobuf:"varint,5,opt,name=log_term,json=logTerm" json:"log_term,omitempty"` + Index *uint64 `protobuf:"varint,6,opt,name=index" json:"index,omitempty"` + Entries []*Entry `protobuf:"bytes,7,rep,name=entries" json:"entries,omitempty"` + Commit *uint64 `protobuf:"varint,8,opt,name=commit" json:"commit,omitempty"` + Snapshot *Snapshot `protobuf:"bytes,9,opt,name=snapshot" json:"snapshot,omitempty"` + Reject *bool `protobuf:"varint,10,opt,name=reject" json:"reject,omitempty"` + RejectHint *uint64 `protobuf:"varint,11,opt,name=reject_hint,json=rejectHint" json:"reject_hint,omitempty"` + Context []byte `protobuf:"bytes,12,opt,name=context" json:"context,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *Message) Reset() { *m = Message{} } +func (m *Message) String() string { return proto.CompactTextString(m) } +func (*Message) ProtoMessage() {} +func (*Message) Descriptor() ([]byte, []int) { return fileDescriptorEraftpb, []int{3} } + +func (m *Message) GetMsgType() MessageType { + if m != nil && m.MsgType != nil { + return *m.MsgType + } + return MessageType_MsgHup +} + +func (m *Message) GetTo() uint64 { + if m != nil && m.To != nil { + return *m.To + } + return 0 +} + +func (m *Message) GetFrom() uint64 { + if m != nil && m.From != nil { + return *m.From + } + return 0 +} + +func (m *Message) GetTerm() uint64 { + if m != nil && m.Term != nil { + return *m.Term + } + return 0 +} + +func (m *Message) GetLogTerm() uint64 { + if m != nil && m.LogTerm != nil { + return *m.LogTerm + } + return 0 +} + +func (m *Message) GetIndex() uint64 { + if m != nil && m.Index != nil { + return *m.Index + } + return 0 +} + +func (m *Message) GetEntries() []*Entry { + if m != nil { + return m.Entries + } + return nil +} + +func (m *Message) GetCommit() uint64 { + if m != nil && m.Commit != nil { + return *m.Commit + } + return 0 +} + +func (m *Message) GetSnapshot() *Snapshot { + if m != nil { + return m.Snapshot + } + return nil +} + +func (m *Message) GetReject() bool { + if m != nil && m.Reject != nil { + return *m.Reject + } + return false +} + +func (m *Message) GetRejectHint() uint64 { + if m != nil && m.RejectHint != nil { + return *m.RejectHint + } + return 0 +} + +func (m *Message) GetContext() []byte { + if m != nil { + return m.Context + } + return nil +} + +type HardState struct { + Term *uint64 `protobuf:"varint,1,opt,name=term" json:"term,omitempty"` + Vote *uint64 `protobuf:"varint,2,opt,name=vote" json:"vote,omitempty"` + Commit *uint64 `protobuf:"varint,3,opt,name=commit" json:"commit,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *HardState) Reset() { *m = HardState{} } +func (m *HardState) String() string { return proto.CompactTextString(m) } +func (*HardState) ProtoMessage() {} +func (*HardState) Descriptor() ([]byte, []int) { return fileDescriptorEraftpb, []int{4} } + +func (m *HardState) GetTerm() uint64 { + if m != nil && m.Term != nil { + return *m.Term + } + return 0 +} + +func (m *HardState) GetVote() uint64 { + if m != nil && m.Vote != nil { + return *m.Vote + } + return 0 +} + +func (m *HardState) GetCommit() uint64 { + if m != nil && m.Commit != nil { + return *m.Commit + } + return 0 +} + +type ConfState struct { + Nodes []uint64 `protobuf:"varint,1,rep,name=nodes" json:"nodes,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *ConfState) Reset() { *m = ConfState{} } +func (m *ConfState) String() string { return proto.CompactTextString(m) } +func (*ConfState) ProtoMessage() {} +func (*ConfState) Descriptor() ([]byte, []int) { return fileDescriptorEraftpb, []int{5} } + +func (m *ConfState) GetNodes() []uint64 { + if m != nil { + return m.Nodes + } + return nil +} + +type ConfChange struct { + Id *uint64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + ChangeType *ConfChangeType `protobuf:"varint,2,opt,name=change_type,json=changeType,enum=eraftpb.ConfChangeType" json:"change_type,omitempty"` + NodeId *uint64 `protobuf:"varint,3,opt,name=node_id,json=nodeId" json:"node_id,omitempty"` + Context []byte `protobuf:"bytes,4,opt,name=context" json:"context,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *ConfChange) Reset() { *m = ConfChange{} } +func (m *ConfChange) String() string { return proto.CompactTextString(m) } +func (*ConfChange) ProtoMessage() {} +func (*ConfChange) Descriptor() ([]byte, []int) { return fileDescriptorEraftpb, []int{6} } + +func (m *ConfChange) GetId() uint64 { + if m != nil && m.Id != nil { + return *m.Id + } + return 0 +} + +func (m *ConfChange) GetChangeType() ConfChangeType { + if m != nil && m.ChangeType != nil { + return *m.ChangeType + } + return ConfChangeType_AddNode +} + +func (m *ConfChange) GetNodeId() uint64 { + if m != nil && m.NodeId != nil { + return *m.NodeId + } + return 0 +} + +func (m *ConfChange) GetContext() []byte { + if m != nil { + return m.Context + } + return nil +} + +func init() { + proto.RegisterType((*Entry)(nil), "eraftpb.Entry") + proto.RegisterType((*SnapshotMetadata)(nil), "eraftpb.SnapshotMetadata") + proto.RegisterType((*Snapshot)(nil), "eraftpb.Snapshot") + proto.RegisterType((*Message)(nil), "eraftpb.Message") + proto.RegisterType((*HardState)(nil), "eraftpb.HardState") + proto.RegisterType((*ConfState)(nil), "eraftpb.ConfState") + proto.RegisterType((*ConfChange)(nil), "eraftpb.ConfChange") + proto.RegisterEnum("eraftpb.EntryType", EntryType_name, EntryType_value) + proto.RegisterEnum("eraftpb.MessageType", MessageType_name, MessageType_value) + proto.RegisterEnum("eraftpb.ConfChangeType", ConfChangeType_name, ConfChangeType_value) +} +func (m *Entry) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Entry) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.EntryType != nil { + dAtA[i] = 0x8 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(*m.EntryType)) + } + if m.Term != nil { + dAtA[i] = 0x10 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(*m.Term)) + } + if m.Index != nil { + dAtA[i] = 0x18 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(*m.Index)) + } + if m.Data != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(len(m.Data))) + i += copy(dAtA[i:], m.Data) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *SnapshotMetadata) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SnapshotMetadata) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.ConfState != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(m.ConfState.Size())) + n1, err := m.ConfState.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.Index != nil { + dAtA[i] = 0x10 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(*m.Index)) + } + if m.Term != nil { + dAtA[i] = 0x18 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(*m.Term)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Snapshot) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Snapshot) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Data != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(len(m.Data))) + i += copy(dAtA[i:], m.Data) + } + if m.Metadata != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(m.Metadata.Size())) + n2, err := m.Metadata.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Message) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Message) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.MsgType != nil { + dAtA[i] = 0x8 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(*m.MsgType)) + } + if m.To != nil { + dAtA[i] = 0x10 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(*m.To)) + } + if m.From != nil { + dAtA[i] = 0x18 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(*m.From)) + } + if m.Term != nil { + dAtA[i] = 0x20 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(*m.Term)) + } + if m.LogTerm != nil { + dAtA[i] = 0x28 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(*m.LogTerm)) + } + if m.Index != nil { + dAtA[i] = 0x30 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(*m.Index)) + } + if len(m.Entries) > 0 { + for _, msg := range m.Entries { + dAtA[i] = 0x3a + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.Commit != nil { + dAtA[i] = 0x40 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(*m.Commit)) + } + if m.Snapshot != nil { + dAtA[i] = 0x4a + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(m.Snapshot.Size())) + n3, err := m.Snapshot.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if m.Reject != nil { + dAtA[i] = 0x50 + i++ + if *m.Reject { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.RejectHint != nil { + dAtA[i] = 0x58 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(*m.RejectHint)) + } + if m.Context != nil { + dAtA[i] = 0x62 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(len(m.Context))) + i += copy(dAtA[i:], m.Context) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *HardState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HardState) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Term != nil { + dAtA[i] = 0x8 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(*m.Term)) + } + if m.Vote != nil { + dAtA[i] = 0x10 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(*m.Vote)) + } + if m.Commit != nil { + dAtA[i] = 0x18 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(*m.Commit)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *ConfState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConfState) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Nodes) > 0 { + for _, num := range m.Nodes { + dAtA[i] = 0x8 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(num)) + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *ConfChange) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConfChange) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Id != nil { + dAtA[i] = 0x8 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(*m.Id)) + } + if m.ChangeType != nil { + dAtA[i] = 0x10 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(*m.ChangeType)) + } + if m.NodeId != nil { + dAtA[i] = 0x18 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(*m.NodeId)) + } + if m.Context != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintEraftpb(dAtA, i, uint64(len(m.Context))) + i += copy(dAtA[i:], m.Context) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeFixed64Eraftpb(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Eraftpb(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintEraftpb(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *Entry) Size() (n int) { + var l int + _ = l + if m.EntryType != nil { + n += 1 + sovEraftpb(uint64(*m.EntryType)) + } + if m.Term != nil { + n += 1 + sovEraftpb(uint64(*m.Term)) + } + if m.Index != nil { + n += 1 + sovEraftpb(uint64(*m.Index)) + } + if m.Data != nil { + l = len(m.Data) + n += 1 + l + sovEraftpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SnapshotMetadata) Size() (n int) { + var l int + _ = l + if m.ConfState != nil { + l = m.ConfState.Size() + n += 1 + l + sovEraftpb(uint64(l)) + } + if m.Index != nil { + n += 1 + sovEraftpb(uint64(*m.Index)) + } + if m.Term != nil { + n += 1 + sovEraftpb(uint64(*m.Term)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Snapshot) Size() (n int) { + var l int + _ = l + if m.Data != nil { + l = len(m.Data) + n += 1 + l + sovEraftpb(uint64(l)) + } + if m.Metadata != nil { + l = m.Metadata.Size() + n += 1 + l + sovEraftpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Message) Size() (n int) { + var l int + _ = l + if m.MsgType != nil { + n += 1 + sovEraftpb(uint64(*m.MsgType)) + } + if m.To != nil { + n += 1 + sovEraftpb(uint64(*m.To)) + } + if m.From != nil { + n += 1 + sovEraftpb(uint64(*m.From)) + } + if m.Term != nil { + n += 1 + sovEraftpb(uint64(*m.Term)) + } + if m.LogTerm != nil { + n += 1 + sovEraftpb(uint64(*m.LogTerm)) + } + if m.Index != nil { + n += 1 + sovEraftpb(uint64(*m.Index)) + } + if len(m.Entries) > 0 { + for _, e := range m.Entries { + l = e.Size() + n += 1 + l + sovEraftpb(uint64(l)) + } + } + if m.Commit != nil { + n += 1 + sovEraftpb(uint64(*m.Commit)) + } + if m.Snapshot != nil { + l = m.Snapshot.Size() + n += 1 + l + sovEraftpb(uint64(l)) + } + if m.Reject != nil { + n += 2 + } + if m.RejectHint != nil { + n += 1 + sovEraftpb(uint64(*m.RejectHint)) + } + if m.Context != nil { + l = len(m.Context) + n += 1 + l + sovEraftpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HardState) Size() (n int) { + var l int + _ = l + if m.Term != nil { + n += 1 + sovEraftpb(uint64(*m.Term)) + } + if m.Vote != nil { + n += 1 + sovEraftpb(uint64(*m.Vote)) + } + if m.Commit != nil { + n += 1 + sovEraftpb(uint64(*m.Commit)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ConfState) Size() (n int) { + var l int + _ = l + if len(m.Nodes) > 0 { + for _, e := range m.Nodes { + n += 1 + sovEraftpb(uint64(e)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ConfChange) Size() (n int) { + var l int + _ = l + if m.Id != nil { + n += 1 + sovEraftpb(uint64(*m.Id)) + } + if m.ChangeType != nil { + n += 1 + sovEraftpb(uint64(*m.ChangeType)) + } + if m.NodeId != nil { + n += 1 + sovEraftpb(uint64(*m.NodeId)) + } + if m.Context != nil { + l = len(m.Context) + n += 1 + l + sovEraftpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovEraftpb(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozEraftpb(x uint64) (n int) { + return sovEraftpb(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Entry) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Entry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Entry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EntryType", wireType) + } + var v EntryType + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (EntryType(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.EntryType = &v + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Term = &v + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Index = &v + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthEraftpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEraftpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEraftpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SnapshotMetadata) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SnapshotMetadata: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SnapshotMetadata: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConfState", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEraftpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ConfState == nil { + m.ConfState = &ConfState{} + } + if err := m.ConfState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Index = &v + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Term = &v + default: + iNdEx = preIndex + skippy, err := skipEraftpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEraftpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Snapshot) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Snapshot: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Snapshot: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthEraftpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEraftpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Metadata == nil { + m.Metadata = &SnapshotMetadata{} + } + if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEraftpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEraftpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Message) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Message: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Message: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgType", wireType) + } + var v MessageType + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (MessageType(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.MsgType = &v + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field To", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.To = &v + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.From = &v + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Term = &v + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LogTerm", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.LogTerm = &v + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Index = &v + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEraftpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Entries = append(m.Entries, &Entry{}) + if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Commit", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Commit = &v + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Snapshot", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEraftpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Snapshot == nil { + m.Snapshot = &Snapshot{} + } + if err := m.Snapshot.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Reject", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.Reject = &b + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RejectHint", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.RejectHint = &v + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthEraftpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Context = append(m.Context[:0], dAtA[iNdEx:postIndex]...) + if m.Context == nil { + m.Context = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEraftpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEraftpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HardState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HardState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HardState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Term = &v + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Vote", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Vote = &v + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Commit", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Commit = &v + default: + iNdEx = preIndex + skippy, err := skipEraftpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEraftpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConfState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConfState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConfState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nodes", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Nodes = append(m.Nodes, v) + default: + iNdEx = preIndex + skippy, err := skipEraftpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEraftpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConfChange) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConfChange: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConfChange: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Id = &v + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ChangeType", wireType) + } + var v ConfChangeType + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (ConfChangeType(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.ChangeType = &v + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeId", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.NodeId = &v + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEraftpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthEraftpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Context = append(m.Context[:0], dAtA[iNdEx:postIndex]...) + if m.Context == nil { + m.Context = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEraftpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEraftpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEraftpb(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEraftpb + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEraftpb + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEraftpb + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthEraftpb + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEraftpb + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipEraftpb(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthEraftpb = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEraftpb = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("eraftpb.proto", fileDescriptorEraftpb) } + +var fileDescriptorEraftpb = []byte{ + // 785 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x54, 0x51, 0x6f, 0xe3, 0x44, + 0x10, 0xae, 0x9d, 0xb4, 0xb6, 0xc7, 0x6d, 0xba, 0x5d, 0xca, 0x9d, 0x8b, 0x44, 0x09, 0x79, 0x8a, + 0x2a, 0x5d, 0xd0, 0x55, 0x42, 0xe2, 0xf5, 0x2e, 0x42, 0xea, 0x09, 0x5c, 0x1d, 0xbe, 0x1c, 0xaf, + 0xd1, 0xd6, 0x9e, 0x38, 0xa6, 0xb1, 0xd7, 0xec, 0x6e, 0x42, 0xfb, 0x13, 0x90, 0xf8, 0x01, 0xfc, + 0x24, 0x1e, 0xf9, 0x09, 0xa8, 0x3c, 0xf0, 0x37, 0xd0, 0x6e, 0xd6, 0x8e, 0x73, 0x7d, 0x9b, 0xf9, + 0x3c, 0x3b, 0xf3, 0xcd, 0xf7, 0x4d, 0x02, 0x27, 0x28, 0xd8, 0x42, 0xd5, 0x77, 0x93, 0x5a, 0x70, + 0xc5, 0xa9, 0x67, 0xd3, 0xd1, 0x03, 0x1c, 0x7e, 0x5f, 0x29, 0xf1, 0x48, 0x5f, 0x03, 0xa0, 0x0e, + 0xe6, 0xea, 0xb1, 0xc6, 0xc8, 0x19, 0x3a, 0xe3, 0xc1, 0x35, 0x9d, 0x34, 0xaf, 0x4c, 0xcd, 0xec, + 0xb1, 0xc6, 0x24, 0xc0, 0x26, 0xa4, 0x14, 0xfa, 0x0a, 0x45, 0x19, 0xb9, 0x43, 0x67, 0xdc, 0x4f, + 0x4c, 0x4c, 0xcf, 0xe1, 0xb0, 0xa8, 0x32, 0x7c, 0x88, 0x7a, 0x06, 0xdc, 0x26, 0xba, 0x32, 0x63, + 0x8a, 0x45, 0xfd, 0xa1, 0x33, 0x3e, 0x4e, 0x4c, 0x3c, 0xe2, 0x40, 0x3e, 0x54, 0xac, 0x96, 0x4b, + 0xae, 0x62, 0x54, 0x4c, 0x63, 0x9a, 0x44, 0xca, 0xab, 0xc5, 0x5c, 0x2a, 0xa6, 0xb6, 0x24, 0xc2, + 0x0e, 0x89, 0x29, 0xaf, 0x16, 0x1f, 0xf4, 0x97, 0x24, 0x48, 0x9b, 0x70, 0x37, 0xd0, 0xfd, 0x64, + 0xa0, 0xa1, 0xd6, 0xdb, 0x51, 0x1b, 0x7d, 0x04, 0xbf, 0x19, 0xd8, 0x12, 0x72, 0x76, 0x84, 0xe8, + 0xb7, 0xe0, 0x97, 0x96, 0x88, 0x69, 0x16, 0x5e, 0x5f, 0xb4, 0xa3, 0x3f, 0x65, 0x9a, 0xb4, 0xa5, + 0xa3, 0xff, 0x5c, 0xf0, 0x62, 0x94, 0x92, 0xe5, 0x48, 0xbf, 0x01, 0xbf, 0x94, 0x79, 0x57, 0xc2, + 0xf3, 0xb6, 0x85, 0xad, 0x31, 0x22, 0x7a, 0xa5, 0xcc, 0x8d, 0x84, 0x03, 0x70, 0x15, 0xb7, 0xd4, + 0x5d, 0xc5, 0x35, 0xaf, 0x85, 0xe0, 0x2d, 0x6f, 0x1d, 0xb7, 0xbb, 0xf4, 0x3b, 0x32, 0x5f, 0x80, + 0xbf, 0xe2, 0xf9, 0xdc, 0xe0, 0x87, 0x06, 0xf7, 0x56, 0x3c, 0x9f, 0xed, 0x39, 0x70, 0xd4, 0x15, + 0x64, 0x0c, 0x9e, 0x36, 0xae, 0x40, 0x19, 0x79, 0xc3, 0xde, 0x38, 0xbc, 0x1e, 0xec, 0x7b, 0x9b, + 0x34, 0x9f, 0xe9, 0x0b, 0x38, 0x4a, 0x79, 0x59, 0x16, 0x2a, 0xf2, 0x4d, 0x03, 0x9b, 0xd1, 0x57, + 0xe0, 0x4b, 0xab, 0x42, 0x14, 0x18, 0x79, 0xce, 0x9e, 0xc9, 0x93, 0xb4, 0x25, 0xba, 0x8d, 0xc0, + 0x5f, 0x30, 0x55, 0x11, 0x0c, 0x9d, 0xb1, 0x9f, 0xd8, 0x8c, 0x7e, 0x05, 0xe1, 0x36, 0x9a, 0x2f, + 0x8b, 0x4a, 0x45, 0xa1, 0x99, 0x01, 0x5b, 0xe8, 0xa6, 0xa8, 0x14, 0x8d, 0xc0, 0x4b, 0x79, 0xa5, + 0xf0, 0x41, 0x45, 0xc7, 0xc6, 0x9d, 0x26, 0x1d, 0xfd, 0x00, 0xc1, 0x0d, 0x13, 0xd9, 0xd6, 0xf7, + 0x46, 0x15, 0xa7, 0xa3, 0x0a, 0x85, 0xfe, 0x86, 0x2b, 0x6c, 0x0e, 0x52, 0xc7, 0x9d, 0x75, 0x7a, + 0xdd, 0x75, 0x46, 0x5f, 0x43, 0x30, 0xed, 0x1e, 0x51, 0xc5, 0x33, 0x94, 0x91, 0x33, 0xec, 0x69, + 0xcd, 0x4c, 0x32, 0xfa, 0xdd, 0x01, 0xd0, 0x35, 0xd3, 0x25, 0xab, 0x72, 0xe3, 0x55, 0x91, 0xd9, + 0x79, 0x6e, 0x91, 0xd1, 0xef, 0x20, 0x4c, 0xcd, 0x97, 0xad, 0xdf, 0xae, 0xf1, 0xfb, 0xe5, 0xde, + 0xb5, 0x6e, 0x5f, 0x1a, 0xcb, 0x21, 0x6d, 0x63, 0xfa, 0x12, 0x3c, 0x3d, 0x61, 0x5e, 0x64, 0x0d, + 0x29, 0x9d, 0xbe, 0xcb, 0xba, 0xbb, 0xf7, 0xf7, 0x76, 0xbf, 0x7a, 0x0d, 0x41, 0xfb, 0x1b, 0xa4, + 0xa7, 0x10, 0x9a, 0xe4, 0x96, 0x8b, 0x92, 0xad, 0xc8, 0x01, 0xfd, 0x0c, 0x4e, 0x0d, 0xb0, 0x9b, + 0x49, 0x9c, 0xab, 0x3f, 0x7a, 0x10, 0x76, 0x8e, 0x8e, 0x02, 0x1c, 0xc5, 0x32, 0xbf, 0x59, 0xd7, + 0xe4, 0x80, 0x86, 0xe0, 0xc5, 0x32, 0x7f, 0x8b, 0x4c, 0x11, 0x87, 0x0e, 0x00, 0x62, 0x99, 0xbf, + 0x17, 0xbc, 0xe6, 0x12, 0x89, 0x4b, 0x4f, 0x20, 0x88, 0x65, 0xfe, 0xa6, 0xae, 0xb1, 0xca, 0x48, + 0x8f, 0x7e, 0x0e, 0x67, 0x6d, 0x9a, 0xa0, 0xac, 0x79, 0x25, 0x91, 0xf4, 0x29, 0x85, 0x41, 0x2c, + 0xf3, 0x04, 0x7f, 0x5d, 0xa3, 0x54, 0x3f, 0x73, 0x85, 0xe4, 0x90, 0x7e, 0x01, 0x2f, 0xf6, 0xb1, + 0xb6, 0xfe, 0x48, 0x93, 0x8e, 0x65, 0xde, 0x5c, 0x0a, 0xf1, 0x28, 0x81, 0x63, 0xcd, 0x07, 0x99, + 0x50, 0x77, 0x9a, 0x88, 0x4f, 0x23, 0x38, 0xef, 0x22, 0xed, 0xe3, 0xc0, 0x0e, 0xfb, 0x58, 0x09, + 0x64, 0xe9, 0x92, 0xdd, 0xad, 0x90, 0x00, 0x3d, 0x83, 0x13, 0xdb, 0x50, 0x9b, 0xb8, 0x96, 0x24, + 0xb4, 0x65, 0xd3, 0x25, 0xa6, 0xf7, 0x3f, 0xad, 0xb9, 0x58, 0x97, 0xe4, 0xd8, 0xd2, 0x9f, 0x09, + 0x56, 0xc9, 0x05, 0x8a, 0x1f, 0x91, 0x65, 0x28, 0xc8, 0x89, 0x7d, 0x3d, 0x2b, 0x4a, 0xe4, 0x6b, + 0x75, 0xcb, 0x7f, 0x23, 0x03, 0x4b, 0x28, 0x41, 0x96, 0xbd, 0xd3, 0xbf, 0x19, 0x72, 0x4a, 0xcf, + 0x81, 0x74, 0x11, 0x4d, 0x88, 0x10, 0xdb, 0xd1, 0x6e, 0xf9, 0x5e, 0xa0, 0x59, 0xfe, 0x8c, 0x7e, + 0x09, 0x17, 0xcf, 0xe0, 0x76, 0x05, 0x7a, 0xf5, 0x0a, 0x06, 0xfb, 0x27, 0xa1, 0x4d, 0x78, 0x93, + 0x65, 0xb7, 0x3c, 0x43, 0x72, 0xa0, 0x4d, 0x48, 0xb0, 0xe4, 0x1b, 0x34, 0xb9, 0xf3, 0xf6, 0xea, + 0xaf, 0xa7, 0x4b, 0xe7, 0xef, 0xa7, 0x4b, 0xe7, 0x9f, 0xa7, 0x4b, 0xe7, 0xcf, 0x7f, 0x2f, 0x0f, + 0x20, 0x4a, 0x79, 0x39, 0xa9, 0x8b, 0x2a, 0x4f, 0x59, 0x3d, 0x51, 0xc5, 0xfd, 0x66, 0x72, 0xbf, + 0x31, 0xff, 0xe6, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0x3a, 0xd7, 0x7c, 0x3c, 0xdd, 0x05, 0x00, + 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/errorpb/errorpb.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/errorpb/errorpb.pb.go new file mode 100644 index 00000000000..0fd66ab25a3 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/pkg/errorpb/errorpb.pb.go @@ -0,0 +1,2027 @@ +// Code generated by protoc-gen-gogo. +// source: errorpb.proto +// DO NOT EDIT! + +/* + Package errorpb is a generated protocol buffer package. + + It is generated from these files: + errorpb.proto + + It has these top-level messages: + NotLeader + StoreNotMatch + RegionNotFound + KeyNotInRegion + StaleEpoch + ServerIsBusy + StaleCommand + RaftEntryTooLarge + Error +*/ +package errorpb + +import ( + "fmt" + "io" + "math" + + proto "github.com/golang/protobuf/proto" + + metapb "github.com/pingcap/kvproto/pkg/metapb" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type NotLeader struct { + RegionId *uint64 `protobuf:"varint,1,opt,name=region_id,json=regionId" json:"region_id,omitempty"` + Leader *metapb.Peer `protobuf:"bytes,2,opt,name=leader" json:"leader,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *NotLeader) Reset() { *m = NotLeader{} } +func (m *NotLeader) String() string { return proto.CompactTextString(m) } +func (*NotLeader) ProtoMessage() {} +func (*NotLeader) Descriptor() ([]byte, []int) { return fileDescriptorErrorpb, []int{0} } + +func (m *NotLeader) GetRegionId() uint64 { + if m != nil && m.RegionId != nil { + return *m.RegionId + } + return 0 +} + +func (m *NotLeader) GetLeader() *metapb.Peer { + if m != nil { + return m.Leader + } + return nil +} + +type StoreNotMatch struct { + XXX_unrecognized []byte `json:"-"` +} + +func (m *StoreNotMatch) Reset() { *m = StoreNotMatch{} } +func (m *StoreNotMatch) String() string { return proto.CompactTextString(m) } +func (*StoreNotMatch) ProtoMessage() {} +func (*StoreNotMatch) Descriptor() ([]byte, []int) { return fileDescriptorErrorpb, []int{1} } + +type RegionNotFound struct { + RegionId *uint64 `protobuf:"varint,1,opt,name=region_id,json=regionId" json:"region_id,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *RegionNotFound) Reset() { *m = RegionNotFound{} } +func (m *RegionNotFound) String() string { return proto.CompactTextString(m) } +func (*RegionNotFound) ProtoMessage() {} +func (*RegionNotFound) Descriptor() ([]byte, []int) { return fileDescriptorErrorpb, []int{2} } + +func (m *RegionNotFound) GetRegionId() uint64 { + if m != nil && m.RegionId != nil { + return *m.RegionId + } + return 0 +} + +type KeyNotInRegion struct { + Key []byte `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + RegionId *uint64 `protobuf:"varint,2,opt,name=region_id,json=regionId" json:"region_id,omitempty"` + StartKey []byte `protobuf:"bytes,3,opt,name=start_key,json=startKey" json:"start_key,omitempty"` + EndKey []byte `protobuf:"bytes,4,opt,name=end_key,json=endKey" json:"end_key,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *KeyNotInRegion) Reset() { *m = KeyNotInRegion{} } +func (m *KeyNotInRegion) String() string { return proto.CompactTextString(m) } +func (*KeyNotInRegion) ProtoMessage() {} +func (*KeyNotInRegion) Descriptor() ([]byte, []int) { return fileDescriptorErrorpb, []int{3} } + +func (m *KeyNotInRegion) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *KeyNotInRegion) GetRegionId() uint64 { + if m != nil && m.RegionId != nil { + return *m.RegionId + } + return 0 +} + +func (m *KeyNotInRegion) GetStartKey() []byte { + if m != nil { + return m.StartKey + } + return nil +} + +func (m *KeyNotInRegion) GetEndKey() []byte { + if m != nil { + return m.EndKey + } + return nil +} + +type StaleEpoch struct { + NewRegions []*metapb.Region `protobuf:"bytes,1,rep,name=new_regions,json=newRegions" json:"new_regions,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *StaleEpoch) Reset() { *m = StaleEpoch{} } +func (m *StaleEpoch) String() string { return proto.CompactTextString(m) } +func (*StaleEpoch) ProtoMessage() {} +func (*StaleEpoch) Descriptor() ([]byte, []int) { return fileDescriptorErrorpb, []int{4} } + +func (m *StaleEpoch) GetNewRegions() []*metapb.Region { + if m != nil { + return m.NewRegions + } + return nil +} + +type ServerIsBusy struct { + Reason *string `protobuf:"bytes,1,opt,name=reason" json:"reason,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *ServerIsBusy) Reset() { *m = ServerIsBusy{} } +func (m *ServerIsBusy) String() string { return proto.CompactTextString(m) } +func (*ServerIsBusy) ProtoMessage() {} +func (*ServerIsBusy) Descriptor() ([]byte, []int) { return fileDescriptorErrorpb, []int{5} } + +func (m *ServerIsBusy) GetReason() string { + if m != nil && m.Reason != nil { + return *m.Reason + } + return "" +} + +type StaleCommand struct { + XXX_unrecognized []byte `json:"-"` +} + +func (m *StaleCommand) Reset() { *m = StaleCommand{} } +func (m *StaleCommand) String() string { return proto.CompactTextString(m) } +func (*StaleCommand) ProtoMessage() {} +func (*StaleCommand) Descriptor() ([]byte, []int) { return fileDescriptorErrorpb, []int{6} } + +type RaftEntryTooLarge struct { + RegionId *uint64 `protobuf:"varint,1,opt,name=region_id,json=regionId" json:"region_id,omitempty"` + EntrySize *uint64 `protobuf:"varint,2,opt,name=entry_size,json=entrySize" json:"entry_size,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *RaftEntryTooLarge) Reset() { *m = RaftEntryTooLarge{} } +func (m *RaftEntryTooLarge) String() string { return proto.CompactTextString(m) } +func (*RaftEntryTooLarge) ProtoMessage() {} +func (*RaftEntryTooLarge) Descriptor() ([]byte, []int) { return fileDescriptorErrorpb, []int{7} } + +func (m *RaftEntryTooLarge) GetRegionId() uint64 { + if m != nil && m.RegionId != nil { + return *m.RegionId + } + return 0 +} + +func (m *RaftEntryTooLarge) GetEntrySize() uint64 { + if m != nil && m.EntrySize != nil { + return *m.EntrySize + } + return 0 +} + +type Error struct { + Message *string `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"` + NotLeader *NotLeader `protobuf:"bytes,2,opt,name=not_leader,json=notLeader" json:"not_leader,omitempty"` + RegionNotFound *RegionNotFound `protobuf:"bytes,3,opt,name=region_not_found,json=regionNotFound" json:"region_not_found,omitempty"` + KeyNotInRegion *KeyNotInRegion `protobuf:"bytes,4,opt,name=key_not_in_region,json=keyNotInRegion" json:"key_not_in_region,omitempty"` + StaleEpoch *StaleEpoch `protobuf:"bytes,5,opt,name=stale_epoch,json=staleEpoch" json:"stale_epoch,omitempty"` + ServerIsBusy *ServerIsBusy `protobuf:"bytes,6,opt,name=server_is_busy,json=serverIsBusy" json:"server_is_busy,omitempty"` + StaleCommand *StaleCommand `protobuf:"bytes,7,opt,name=stale_command,json=staleCommand" json:"stale_command,omitempty"` + StoreNotMatch *StoreNotMatch `protobuf:"bytes,8,opt,name=store_not_match,json=storeNotMatch" json:"store_not_match,omitempty"` + RaftEntryTooLarge *RaftEntryTooLarge `protobuf:"bytes,9,opt,name=raft_entry_too_large,json=raftEntryTooLarge" json:"raft_entry_too_large,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *Error) Reset() { *m = Error{} } +func (m *Error) String() string { return proto.CompactTextString(m) } +func (*Error) ProtoMessage() {} +func (*Error) Descriptor() ([]byte, []int) { return fileDescriptorErrorpb, []int{8} } + +func (m *Error) GetMessage() string { + if m != nil && m.Message != nil { + return *m.Message + } + return "" +} + +func (m *Error) GetNotLeader() *NotLeader { + if m != nil { + return m.NotLeader + } + return nil +} + +func (m *Error) GetRegionNotFound() *RegionNotFound { + if m != nil { + return m.RegionNotFound + } + return nil +} + +func (m *Error) GetKeyNotInRegion() *KeyNotInRegion { + if m != nil { + return m.KeyNotInRegion + } + return nil +} + +func (m *Error) GetStaleEpoch() *StaleEpoch { + if m != nil { + return m.StaleEpoch + } + return nil +} + +func (m *Error) GetServerIsBusy() *ServerIsBusy { + if m != nil { + return m.ServerIsBusy + } + return nil +} + +func (m *Error) GetStaleCommand() *StaleCommand { + if m != nil { + return m.StaleCommand + } + return nil +} + +func (m *Error) GetStoreNotMatch() *StoreNotMatch { + if m != nil { + return m.StoreNotMatch + } + return nil +} + +func (m *Error) GetRaftEntryTooLarge() *RaftEntryTooLarge { + if m != nil { + return m.RaftEntryTooLarge + } + return nil +} + +func init() { + proto.RegisterType((*NotLeader)(nil), "errorpb.NotLeader") + proto.RegisterType((*StoreNotMatch)(nil), "errorpb.StoreNotMatch") + proto.RegisterType((*RegionNotFound)(nil), "errorpb.RegionNotFound") + proto.RegisterType((*KeyNotInRegion)(nil), "errorpb.KeyNotInRegion") + proto.RegisterType((*StaleEpoch)(nil), "errorpb.StaleEpoch") + proto.RegisterType((*ServerIsBusy)(nil), "errorpb.ServerIsBusy") + proto.RegisterType((*StaleCommand)(nil), "errorpb.StaleCommand") + proto.RegisterType((*RaftEntryTooLarge)(nil), "errorpb.RaftEntryTooLarge") + proto.RegisterType((*Error)(nil), "errorpb.Error") +} +func (m *NotLeader) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NotLeader) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionId != nil { + dAtA[i] = 0x8 + i++ + i = encodeVarintErrorpb(dAtA, i, uint64(*m.RegionId)) + } + if m.Leader != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintErrorpb(dAtA, i, uint64(m.Leader.Size())) + n1, err := m.Leader.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *StoreNotMatch) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StoreNotMatch) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RegionNotFound) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RegionNotFound) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionId != nil { + dAtA[i] = 0x8 + i++ + i = encodeVarintErrorpb(dAtA, i, uint64(*m.RegionId)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *KeyNotInRegion) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *KeyNotInRegion) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Key != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintErrorpb(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + if m.RegionId != nil { + dAtA[i] = 0x10 + i++ + i = encodeVarintErrorpb(dAtA, i, uint64(*m.RegionId)) + } + if m.StartKey != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintErrorpb(dAtA, i, uint64(len(m.StartKey))) + i += copy(dAtA[i:], m.StartKey) + } + if m.EndKey != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintErrorpb(dAtA, i, uint64(len(m.EndKey))) + i += copy(dAtA[i:], m.EndKey) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *StaleEpoch) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StaleEpoch) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.NewRegions) > 0 { + for _, msg := range m.NewRegions { + dAtA[i] = 0xa + i++ + i = encodeVarintErrorpb(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *ServerIsBusy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ServerIsBusy) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Reason != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintErrorpb(dAtA, i, uint64(len(*m.Reason))) + i += copy(dAtA[i:], *m.Reason) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *StaleCommand) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StaleCommand) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RaftEntryTooLarge) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RaftEntryTooLarge) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionId != nil { + dAtA[i] = 0x8 + i++ + i = encodeVarintErrorpb(dAtA, i, uint64(*m.RegionId)) + } + if m.EntrySize != nil { + dAtA[i] = 0x10 + i++ + i = encodeVarintErrorpb(dAtA, i, uint64(*m.EntrySize)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Error) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Error) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Message != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintErrorpb(dAtA, i, uint64(len(*m.Message))) + i += copy(dAtA[i:], *m.Message) + } + if m.NotLeader != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintErrorpb(dAtA, i, uint64(m.NotLeader.Size())) + n2, err := m.NotLeader.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.RegionNotFound != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintErrorpb(dAtA, i, uint64(m.RegionNotFound.Size())) + n3, err := m.RegionNotFound.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if m.KeyNotInRegion != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintErrorpb(dAtA, i, uint64(m.KeyNotInRegion.Size())) + n4, err := m.KeyNotInRegion.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + if m.StaleEpoch != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintErrorpb(dAtA, i, uint64(m.StaleEpoch.Size())) + n5, err := m.StaleEpoch.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + if m.ServerIsBusy != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintErrorpb(dAtA, i, uint64(m.ServerIsBusy.Size())) + n6, err := m.ServerIsBusy.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + if m.StaleCommand != nil { + dAtA[i] = 0x3a + i++ + i = encodeVarintErrorpb(dAtA, i, uint64(m.StaleCommand.Size())) + n7, err := m.StaleCommand.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n7 + } + if m.StoreNotMatch != nil { + dAtA[i] = 0x42 + i++ + i = encodeVarintErrorpb(dAtA, i, uint64(m.StoreNotMatch.Size())) + n8, err := m.StoreNotMatch.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n8 + } + if m.RaftEntryTooLarge != nil { + dAtA[i] = 0x4a + i++ + i = encodeVarintErrorpb(dAtA, i, uint64(m.RaftEntryTooLarge.Size())) + n9, err := m.RaftEntryTooLarge.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n9 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeFixed64Errorpb(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Errorpb(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintErrorpb(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *NotLeader) Size() (n int) { + var l int + _ = l + if m.RegionId != nil { + n += 1 + sovErrorpb(uint64(*m.RegionId)) + } + if m.Leader != nil { + l = m.Leader.Size() + n += 1 + l + sovErrorpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StoreNotMatch) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RegionNotFound) Size() (n int) { + var l int + _ = l + if m.RegionId != nil { + n += 1 + sovErrorpb(uint64(*m.RegionId)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *KeyNotInRegion) Size() (n int) { + var l int + _ = l + if m.Key != nil { + l = len(m.Key) + n += 1 + l + sovErrorpb(uint64(l)) + } + if m.RegionId != nil { + n += 1 + sovErrorpb(uint64(*m.RegionId)) + } + if m.StartKey != nil { + l = len(m.StartKey) + n += 1 + l + sovErrorpb(uint64(l)) + } + if m.EndKey != nil { + l = len(m.EndKey) + n += 1 + l + sovErrorpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StaleEpoch) Size() (n int) { + var l int + _ = l + if len(m.NewRegions) > 0 { + for _, e := range m.NewRegions { + l = e.Size() + n += 1 + l + sovErrorpb(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ServerIsBusy) Size() (n int) { + var l int + _ = l + if m.Reason != nil { + l = len(*m.Reason) + n += 1 + l + sovErrorpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StaleCommand) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RaftEntryTooLarge) Size() (n int) { + var l int + _ = l + if m.RegionId != nil { + n += 1 + sovErrorpb(uint64(*m.RegionId)) + } + if m.EntrySize != nil { + n += 1 + sovErrorpb(uint64(*m.EntrySize)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Error) Size() (n int) { + var l int + _ = l + if m.Message != nil { + l = len(*m.Message) + n += 1 + l + sovErrorpb(uint64(l)) + } + if m.NotLeader != nil { + l = m.NotLeader.Size() + n += 1 + l + sovErrorpb(uint64(l)) + } + if m.RegionNotFound != nil { + l = m.RegionNotFound.Size() + n += 1 + l + sovErrorpb(uint64(l)) + } + if m.KeyNotInRegion != nil { + l = m.KeyNotInRegion.Size() + n += 1 + l + sovErrorpb(uint64(l)) + } + if m.StaleEpoch != nil { + l = m.StaleEpoch.Size() + n += 1 + l + sovErrorpb(uint64(l)) + } + if m.ServerIsBusy != nil { + l = m.ServerIsBusy.Size() + n += 1 + l + sovErrorpb(uint64(l)) + } + if m.StaleCommand != nil { + l = m.StaleCommand.Size() + n += 1 + l + sovErrorpb(uint64(l)) + } + if m.StoreNotMatch != nil { + l = m.StoreNotMatch.Size() + n += 1 + l + sovErrorpb(uint64(l)) + } + if m.RaftEntryTooLarge != nil { + l = m.RaftEntryTooLarge.Size() + n += 1 + l + sovErrorpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovErrorpb(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozErrorpb(x uint64) (n int) { + return sovErrorpb(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *NotLeader) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NotLeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NotLeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionId", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.RegionId = &v + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Leader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthErrorpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Leader == nil { + m.Leader = &metapb.Peer{} + } + if err := m.Leader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipErrorpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthErrorpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StoreNotMatch) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StoreNotMatch: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreNotMatch: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipErrorpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthErrorpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RegionNotFound) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RegionNotFound: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RegionNotFound: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionId", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.RegionId = &v + default: + iNdEx = preIndex + skippy, err := skipErrorpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthErrorpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *KeyNotInRegion) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: KeyNotInRegion: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: KeyNotInRegion: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthErrorpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionId", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.RegionId = &v + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthErrorpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StartKey = append(m.StartKey[:0], dAtA[iNdEx:postIndex]...) + if m.StartKey == nil { + m.StartKey = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthErrorpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EndKey = append(m.EndKey[:0], dAtA[iNdEx:postIndex]...) + if m.EndKey == nil { + m.EndKey = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipErrorpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthErrorpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StaleEpoch) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StaleEpoch: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StaleEpoch: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewRegions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthErrorpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewRegions = append(m.NewRegions, &metapb.Region{}) + if err := m.NewRegions[len(m.NewRegions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipErrorpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthErrorpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ServerIsBusy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ServerIsBusy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ServerIsBusy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Reason", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthErrorpb + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.Reason = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipErrorpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthErrorpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StaleCommand) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StaleCommand: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StaleCommand: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipErrorpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthErrorpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RaftEntryTooLarge) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RaftEntryTooLarge: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RaftEntryTooLarge: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionId", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.RegionId = &v + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EntrySize", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.EntrySize = &v + default: + iNdEx = preIndex + skippy, err := skipErrorpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthErrorpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Error) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Error: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Error: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthErrorpb + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.Message = &s + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NotLeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthErrorpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.NotLeader == nil { + m.NotLeader = &NotLeader{} + } + if err := m.NotLeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionNotFound", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthErrorpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionNotFound == nil { + m.RegionNotFound = &RegionNotFound{} + } + if err := m.RegionNotFound.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeyNotInRegion", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthErrorpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.KeyNotInRegion == nil { + m.KeyNotInRegion = &KeyNotInRegion{} + } + if err := m.KeyNotInRegion.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StaleEpoch", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthErrorpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.StaleEpoch == nil { + m.StaleEpoch = &StaleEpoch{} + } + if err := m.StaleEpoch.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServerIsBusy", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthErrorpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ServerIsBusy == nil { + m.ServerIsBusy = &ServerIsBusy{} + } + if err := m.ServerIsBusy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StaleCommand", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthErrorpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.StaleCommand == nil { + m.StaleCommand = &StaleCommand{} + } + if err := m.StaleCommand.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StoreNotMatch", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthErrorpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.StoreNotMatch == nil { + m.StoreNotMatch = &StoreNotMatch{} + } + if err := m.StoreNotMatch.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RaftEntryTooLarge", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowErrorpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthErrorpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RaftEntryTooLarge == nil { + m.RaftEntryTooLarge = &RaftEntryTooLarge{} + } + if err := m.RaftEntryTooLarge.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipErrorpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthErrorpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipErrorpb(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowErrorpb + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowErrorpb + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowErrorpb + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthErrorpb + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowErrorpb + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipErrorpb(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthErrorpb = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowErrorpb = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("errorpb.proto", fileDescriptorErrorpb) } + +var fileDescriptorErrorpb = []byte{ + // 583 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x94, 0xdf, 0x6f, 0xd3, 0x30, + 0x10, 0xc7, 0xc9, 0x7e, 0xb4, 0xcb, 0x35, 0xcd, 0x36, 0x33, 0xb6, 0x68, 0x13, 0xd5, 0x14, 0x21, + 0x34, 0x21, 0x91, 0x89, 0x89, 0x27, 0x10, 0x48, 0x0c, 0x0d, 0x69, 0xea, 0x28, 0xc8, 0xe5, 0x3d, + 0xf2, 0x9a, 0x5b, 0x16, 0x75, 0xb1, 0x2b, 0xdb, 0xdd, 0x94, 0xfd, 0x23, 0xf0, 0x27, 0xf1, 0xc8, + 0x9f, 0x80, 0xc6, 0x3f, 0x82, 0xec, 0xa4, 0x6d, 0xd2, 0x87, 0xbd, 0xdd, 0x9d, 0xfd, 0x3d, 0x9f, + 0xef, 0x73, 0x36, 0x74, 0x51, 0x4a, 0x21, 0x27, 0x97, 0xd1, 0x44, 0x0a, 0x2d, 0x48, 0xbb, 0x72, + 0xf7, 0xbd, 0x1c, 0x35, 0x9b, 0x85, 0xf7, 0x77, 0x52, 0x91, 0x0a, 0x6b, 0x1e, 0x1b, 0xab, 0x8c, + 0x86, 0x03, 0x70, 0x07, 0x42, 0x5f, 0x20, 0x4b, 0x50, 0x92, 0x03, 0x70, 0x25, 0xa6, 0x99, 0xe0, + 0x71, 0x96, 0x04, 0xce, 0xa1, 0x73, 0xb4, 0x46, 0x37, 0xca, 0xc0, 0x79, 0x42, 0x5e, 0x40, 0xeb, + 0xc6, 0x6e, 0x0b, 0x56, 0x0e, 0x9d, 0xa3, 0xce, 0x89, 0x17, 0x55, 0xe9, 0xbf, 0x23, 0x4a, 0x5a, + 0xad, 0x85, 0x9b, 0xd0, 0x1d, 0x6a, 0x21, 0x71, 0x20, 0xf4, 0x57, 0xa6, 0x47, 0xd7, 0xe1, 0x6b, + 0xf0, 0xa9, 0x4d, 0x31, 0x10, 0xfa, 0x8b, 0x98, 0xf2, 0xe4, 0xd1, 0x53, 0xc2, 0x29, 0xf8, 0x7d, + 0x2c, 0x06, 0x42, 0x9f, 0xf3, 0x52, 0x46, 0xb6, 0x60, 0x75, 0x8c, 0x85, 0xdd, 0xe8, 0x51, 0x63, + 0x36, 0x13, 0xac, 0x2c, 0x95, 0x79, 0x00, 0xae, 0xd2, 0x4c, 0xea, 0xd8, 0x88, 0x56, 0xad, 0x68, + 0xc3, 0x06, 0xfa, 0x58, 0x90, 0x3d, 0x68, 0x23, 0x4f, 0xec, 0xd2, 0x9a, 0x5d, 0x6a, 0x21, 0x4f, + 0xfa, 0x58, 0x84, 0x1f, 0x00, 0x86, 0x9a, 0xdd, 0xe0, 0xd9, 0x44, 0x8c, 0xae, 0xc9, 0x31, 0x74, + 0x38, 0xde, 0xc5, 0x65, 0x4e, 0x15, 0x38, 0x87, 0xab, 0x47, 0x9d, 0x13, 0x7f, 0x76, 0xdf, 0xb2, + 0x2e, 0x0a, 0x1c, 0xef, 0x4a, 0x53, 0x85, 0x2f, 0xc1, 0x1b, 0xa2, 0xbc, 0x45, 0x79, 0xae, 0x4e, + 0xa7, 0xaa, 0x20, 0xbb, 0xd0, 0x92, 0xc8, 0x94, 0xe0, 0xb6, 0x6c, 0x97, 0x56, 0x5e, 0xe8, 0x83, + 0x67, 0x8f, 0xf9, 0x2c, 0xf2, 0x9c, 0xf1, 0x24, 0xfc, 0x06, 0xdb, 0x94, 0x5d, 0xe9, 0x33, 0xae, + 0x65, 0xf1, 0x43, 0x88, 0x0b, 0x26, 0x53, 0x7c, 0x9c, 0xc2, 0x73, 0x00, 0x34, 0xbb, 0x63, 0x95, + 0xdd, 0x63, 0x75, 0x79, 0xd7, 0x46, 0x86, 0xd9, 0x3d, 0x86, 0x3f, 0xd7, 0x60, 0xfd, 0xcc, 0xe0, + 0x27, 0x01, 0xb4, 0x73, 0x54, 0x8a, 0xa5, 0x58, 0xd5, 0x30, 0x73, 0xc9, 0x1b, 0x00, 0x2e, 0x74, + 0xdc, 0x80, 0x49, 0xa2, 0xd9, 0x0c, 0xcd, 0xa7, 0x81, 0xba, 0x7c, 0x3e, 0x18, 0x9f, 0x60, 0xab, + 0x2a, 0xc9, 0x28, 0xaf, 0x0c, 0x46, 0xdb, 0xdb, 0xce, 0xc9, 0xde, 0x5c, 0xd8, 0xa4, 0x4c, 0x7d, + 0xd9, 0xa4, 0x7e, 0x0a, 0xdb, 0x63, 0x2c, 0xac, 0x3e, 0xe3, 0x55, 0x6b, 0x2d, 0x84, 0x7a, 0x8e, + 0x26, 0x7a, 0xea, 0x8f, 0x9b, 0xa3, 0xf0, 0x16, 0x3a, 0xca, 0xb4, 0x2f, 0x46, 0x83, 0x29, 0x58, + 0xb7, 0xea, 0xa7, 0x73, 0xf5, 0x82, 0x20, 0x05, 0xb5, 0xa0, 0xf9, 0x1e, 0x7c, 0x65, 0xe1, 0xc4, + 0x99, 0x8a, 0x2f, 0xa7, 0xaa, 0x08, 0x5a, 0x56, 0xf8, 0x6c, 0x21, 0xac, 0xb1, 0xa3, 0x9e, 0xaa, + 0x93, 0x7c, 0x07, 0xdd, 0xf2, 0xc8, 0x51, 0x89, 0x2c, 0x68, 0x2f, 0x6b, 0x6b, 0x3c, 0xa9, 0xa7, + 0x6a, 0x1e, 0xf9, 0x08, 0x9b, 0xca, 0xbc, 0x05, 0x7b, 0xe9, 0xdc, 0xbc, 0x86, 0x60, 0xc3, 0xaa, + 0x77, 0x6b, 0xea, 0xda, 0x5b, 0xa1, 0x5d, 0x55, 0x77, 0x49, 0x1f, 0x76, 0x24, 0xbb, 0xd2, 0x71, + 0x09, 0x5c, 0x0b, 0x11, 0xdf, 0x98, 0x01, 0x09, 0x5c, 0x9b, 0x64, 0x7f, 0xd1, 0xf9, 0xe5, 0x11, + 0xa2, 0xdb, 0x72, 0x39, 0x74, 0xfa, 0xea, 0xf7, 0x43, 0xcf, 0xf9, 0xf3, 0xd0, 0x73, 0xfe, 0x3e, + 0xf4, 0x9c, 0x5f, 0xff, 0x7a, 0x4f, 0x20, 0x18, 0x89, 0x3c, 0x9a, 0x64, 0x3c, 0x1d, 0xb1, 0x49, + 0xa4, 0xb3, 0xf1, 0x6d, 0x34, 0xbe, 0xb5, 0x9f, 0xc2, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x65, + 0xf5, 0x06, 0x9b, 0x51, 0x04, 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/kvrpcpb/kvrpcpb.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/kvrpcpb/kvrpcpb.pb.go new file mode 100644 index 00000000000..012e6c60d4a --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/pkg/kvrpcpb/kvrpcpb.pb.go @@ -0,0 +1,10053 @@ +// Code generated by protoc-gen-gogo. +// source: kvrpcpb.proto +// DO NOT EDIT! + +/* + Package kvrpcpb is a generated protocol buffer package. + + It is generated from these files: + kvrpcpb.proto + + It has these top-level messages: + LockInfo + KeyError + Context + GetRequest + GetResponse + ScanRequest + KvPair + ScanResponse + Mutation + PrewriteRequest + PrewriteResponse + CommitRequest + CommitResponse + ImportRequest + ImportResponse + BatchRollbackRequest + BatchRollbackResponse + CleanupRequest + CleanupResponse + BatchGetRequest + BatchGetResponse + ScanLockRequest + ScanLockResponse + ResolveLockRequest + ResolveLockResponse + GCRequest + GCResponse + RawGetRequest + RawGetResponse + RawPutRequest + RawPutResponse + RawDeleteRequest + RawDeleteResponse + DeleteRangeRequest + DeleteRangeResponse + RawScanRequest + RawScanResponse + WriteInfo + ValueInfo + MvccInfo + MvccGetByKeyRequest + MvccGetByKeyResponse + MvccGetByStartTsRequest + MvccGetByStartTsResponse +*/ +package kvrpcpb + +import ( + "fmt" + "io" + "math" + + proto "github.com/golang/protobuf/proto" + + metapb "github.com/pingcap/kvproto/pkg/metapb" + + errorpb "github.com/pingcap/kvproto/pkg/errorpb" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type CommandPri int32 + +const ( + CommandPri_Normal CommandPri = 0 + CommandPri_Low CommandPri = 1 + CommandPri_High CommandPri = 2 +) + +var CommandPri_name = map[int32]string{ + 0: "Normal", + 1: "Low", + 2: "High", +} +var CommandPri_value = map[string]int32{ + "Normal": 0, + "Low": 1, + "High": 2, +} + +func (x CommandPri) String() string { + return proto.EnumName(CommandPri_name, int32(x)) +} +func (CommandPri) EnumDescriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{0} } + +type IsolationLevel int32 + +const ( + IsolationLevel_SI IsolationLevel = 0 + IsolationLevel_RC IsolationLevel = 1 +) + +var IsolationLevel_name = map[int32]string{ + 0: "SI", + 1: "RC", +} +var IsolationLevel_value = map[string]int32{ + "SI": 0, + "RC": 1, +} + +func (x IsolationLevel) String() string { + return proto.EnumName(IsolationLevel_name, int32(x)) +} +func (IsolationLevel) EnumDescriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{1} } + +type Op int32 + +const ( + Op_Put Op = 0 + Op_Del Op = 1 + Op_Lock Op = 2 + Op_Rollback Op = 3 +) + +var Op_name = map[int32]string{ + 0: "Put", + 1: "Del", + 2: "Lock", + 3: "Rollback", +} +var Op_value = map[string]int32{ + "Put": 0, + "Del": 1, + "Lock": 2, + "Rollback": 3, +} + +func (x Op) String() string { + return proto.EnumName(Op_name, int32(x)) +} +func (Op) EnumDescriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{2} } + +type LockInfo struct { + PrimaryLock []byte `protobuf:"bytes,1,opt,name=primary_lock,json=primaryLock,proto3" json:"primary_lock,omitempty"` + LockVersion uint64 `protobuf:"varint,2,opt,name=lock_version,json=lockVersion,proto3" json:"lock_version,omitempty"` + Key []byte `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` + LockTtl uint64 `protobuf:"varint,4,opt,name=lock_ttl,json=lockTtl,proto3" json:"lock_ttl,omitempty"` +} + +func (m *LockInfo) Reset() { *m = LockInfo{} } +func (m *LockInfo) String() string { return proto.CompactTextString(m) } +func (*LockInfo) ProtoMessage() {} +func (*LockInfo) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{0} } + +func (m *LockInfo) GetPrimaryLock() []byte { + if m != nil { + return m.PrimaryLock + } + return nil +} + +func (m *LockInfo) GetLockVersion() uint64 { + if m != nil { + return m.LockVersion + } + return 0 +} + +func (m *LockInfo) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *LockInfo) GetLockTtl() uint64 { + if m != nil { + return m.LockTtl + } + return 0 +} + +type KeyError struct { + Locked *LockInfo `protobuf:"bytes,1,opt,name=locked" json:"locked,omitempty"` + Retryable string `protobuf:"bytes,2,opt,name=retryable,proto3" json:"retryable,omitempty"` + Abort string `protobuf:"bytes,3,opt,name=abort,proto3" json:"abort,omitempty"` +} + +func (m *KeyError) Reset() { *m = KeyError{} } +func (m *KeyError) String() string { return proto.CompactTextString(m) } +func (*KeyError) ProtoMessage() {} +func (*KeyError) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{1} } + +func (m *KeyError) GetLocked() *LockInfo { + if m != nil { + return m.Locked + } + return nil +} + +func (m *KeyError) GetRetryable() string { + if m != nil { + return m.Retryable + } + return "" +} + +func (m *KeyError) GetAbort() string { + if m != nil { + return m.Abort + } + return "" +} + +type Context struct { + RegionId uint64 `protobuf:"varint,1,opt,name=region_id,json=regionId,proto3" json:"region_id,omitempty"` + RegionEpoch *metapb.RegionEpoch `protobuf:"bytes,2,opt,name=region_epoch,json=regionEpoch" json:"region_epoch,omitempty"` + Peer *metapb.Peer `protobuf:"bytes,3,opt,name=peer" json:"peer,omitempty"` + Term uint64 `protobuf:"varint,5,opt,name=term,proto3" json:"term,omitempty"` + Priority CommandPri `protobuf:"varint,6,opt,name=priority,proto3,enum=kvrpcpb.CommandPri" json:"priority,omitempty"` + IsolationLevel IsolationLevel `protobuf:"varint,7,opt,name=isolation_level,json=isolationLevel,proto3,enum=kvrpcpb.IsolationLevel" json:"isolation_level,omitempty"` +} + +func (m *Context) Reset() { *m = Context{} } +func (m *Context) String() string { return proto.CompactTextString(m) } +func (*Context) ProtoMessage() {} +func (*Context) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{2} } + +func (m *Context) GetRegionId() uint64 { + if m != nil { + return m.RegionId + } + return 0 +} + +func (m *Context) GetRegionEpoch() *metapb.RegionEpoch { + if m != nil { + return m.RegionEpoch + } + return nil +} + +func (m *Context) GetPeer() *metapb.Peer { + if m != nil { + return m.Peer + } + return nil +} + +func (m *Context) GetTerm() uint64 { + if m != nil { + return m.Term + } + return 0 +} + +func (m *Context) GetPriority() CommandPri { + if m != nil { + return m.Priority + } + return CommandPri_Normal +} + +func (m *Context) GetIsolationLevel() IsolationLevel { + if m != nil { + return m.IsolationLevel + } + return IsolationLevel_SI +} + +type GetRequest struct { + Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Version uint64 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` +} + +func (m *GetRequest) Reset() { *m = GetRequest{} } +func (m *GetRequest) String() string { return proto.CompactTextString(m) } +func (*GetRequest) ProtoMessage() {} +func (*GetRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{3} } + +func (m *GetRequest) GetContext() *Context { + if m != nil { + return m.Context + } + return nil +} + +func (m *GetRequest) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *GetRequest) GetVersion() uint64 { + if m != nil { + return m.Version + } + return 0 +} + +type GetResponse struct { + RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` + Error *KeyError `protobuf:"bytes,2,opt,name=error" json:"error,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *GetResponse) Reset() { *m = GetResponse{} } +func (m *GetResponse) String() string { return proto.CompactTextString(m) } +func (*GetResponse) ProtoMessage() {} +func (*GetResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{4} } + +func (m *GetResponse) GetRegionError() *errorpb.Error { + if m != nil { + return m.RegionError + } + return nil +} + +func (m *GetResponse) GetError() *KeyError { + if m != nil { + return m.Error + } + return nil +} + +func (m *GetResponse) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +type ScanRequest struct { + Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` + StartKey []byte `protobuf:"bytes,2,opt,name=start_key,json=startKey,proto3" json:"start_key,omitempty"` + Limit uint32 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` + Version uint64 `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"` + KeyOnly bool `protobuf:"varint,5,opt,name=key_only,json=keyOnly,proto3" json:"key_only,omitempty"` +} + +func (m *ScanRequest) Reset() { *m = ScanRequest{} } +func (m *ScanRequest) String() string { return proto.CompactTextString(m) } +func (*ScanRequest) ProtoMessage() {} +func (*ScanRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{5} } + +func (m *ScanRequest) GetContext() *Context { + if m != nil { + return m.Context + } + return nil +} + +func (m *ScanRequest) GetStartKey() []byte { + if m != nil { + return m.StartKey + } + return nil +} + +func (m *ScanRequest) GetLimit() uint32 { + if m != nil { + return m.Limit + } + return 0 +} + +func (m *ScanRequest) GetVersion() uint64 { + if m != nil { + return m.Version + } + return 0 +} + +func (m *ScanRequest) GetKeyOnly() bool { + if m != nil { + return m.KeyOnly + } + return false +} + +type KvPair struct { + Error *KeyError `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *KvPair) Reset() { *m = KvPair{} } +func (m *KvPair) String() string { return proto.CompactTextString(m) } +func (*KvPair) ProtoMessage() {} +func (*KvPair) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{6} } + +func (m *KvPair) GetError() *KeyError { + if m != nil { + return m.Error + } + return nil +} + +func (m *KvPair) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *KvPair) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +type ScanResponse struct { + RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` + Pairs []*KvPair `protobuf:"bytes,2,rep,name=pairs" json:"pairs,omitempty"` +} + +func (m *ScanResponse) Reset() { *m = ScanResponse{} } +func (m *ScanResponse) String() string { return proto.CompactTextString(m) } +func (*ScanResponse) ProtoMessage() {} +func (*ScanResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{7} } + +func (m *ScanResponse) GetRegionError() *errorpb.Error { + if m != nil { + return m.RegionError + } + return nil +} + +func (m *ScanResponse) GetPairs() []*KvPair { + if m != nil { + return m.Pairs + } + return nil +} + +type Mutation struct { + Op Op `protobuf:"varint,1,opt,name=op,proto3,enum=kvrpcpb.Op" json:"op,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *Mutation) Reset() { *m = Mutation{} } +func (m *Mutation) String() string { return proto.CompactTextString(m) } +func (*Mutation) ProtoMessage() {} +func (*Mutation) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{8} } + +func (m *Mutation) GetOp() Op { + if m != nil { + return m.Op + } + return Op_Put +} + +func (m *Mutation) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *Mutation) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +type PrewriteRequest struct { + Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` + Mutations []*Mutation `protobuf:"bytes,2,rep,name=mutations" json:"mutations,omitempty"` + // primary_lock_key + PrimaryLock []byte `protobuf:"bytes,3,opt,name=primary_lock,json=primaryLock,proto3" json:"primary_lock,omitempty"` + StartVersion uint64 `protobuf:"varint,4,opt,name=start_version,json=startVersion,proto3" json:"start_version,omitempty"` + LockTtl uint64 `protobuf:"varint,5,opt,name=lock_ttl,json=lockTtl,proto3" json:"lock_ttl,omitempty"` + SkipConstraintCheck bool `protobuf:"varint,6,opt,name=skip_constraint_check,json=skipConstraintCheck,proto3" json:"skip_constraint_check,omitempty"` +} + +func (m *PrewriteRequest) Reset() { *m = PrewriteRequest{} } +func (m *PrewriteRequest) String() string { return proto.CompactTextString(m) } +func (*PrewriteRequest) ProtoMessage() {} +func (*PrewriteRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{9} } + +func (m *PrewriteRequest) GetContext() *Context { + if m != nil { + return m.Context + } + return nil +} + +func (m *PrewriteRequest) GetMutations() []*Mutation { + if m != nil { + return m.Mutations + } + return nil +} + +func (m *PrewriteRequest) GetPrimaryLock() []byte { + if m != nil { + return m.PrimaryLock + } + return nil +} + +func (m *PrewriteRequest) GetStartVersion() uint64 { + if m != nil { + return m.StartVersion + } + return 0 +} + +func (m *PrewriteRequest) GetLockTtl() uint64 { + if m != nil { + return m.LockTtl + } + return 0 +} + +func (m *PrewriteRequest) GetSkipConstraintCheck() bool { + if m != nil { + return m.SkipConstraintCheck + } + return false +} + +type PrewriteResponse struct { + RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` + Errors []*KeyError `protobuf:"bytes,2,rep,name=errors" json:"errors,omitempty"` +} + +func (m *PrewriteResponse) Reset() { *m = PrewriteResponse{} } +func (m *PrewriteResponse) String() string { return proto.CompactTextString(m) } +func (*PrewriteResponse) ProtoMessage() {} +func (*PrewriteResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{10} } + +func (m *PrewriteResponse) GetRegionError() *errorpb.Error { + if m != nil { + return m.RegionError + } + return nil +} + +func (m *PrewriteResponse) GetErrors() []*KeyError { + if m != nil { + return m.Errors + } + return nil +} + +type CommitRequest struct { + Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` + StartVersion uint64 `protobuf:"varint,2,opt,name=start_version,json=startVersion,proto3" json:"start_version,omitempty"` + Keys [][]byte `protobuf:"bytes,3,rep,name=keys" json:"keys,omitempty"` + CommitVersion uint64 `protobuf:"varint,4,opt,name=commit_version,json=commitVersion,proto3" json:"commit_version,omitempty"` +} + +func (m *CommitRequest) Reset() { *m = CommitRequest{} } +func (m *CommitRequest) String() string { return proto.CompactTextString(m) } +func (*CommitRequest) ProtoMessage() {} +func (*CommitRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{11} } + +func (m *CommitRequest) GetContext() *Context { + if m != nil { + return m.Context + } + return nil +} + +func (m *CommitRequest) GetStartVersion() uint64 { + if m != nil { + return m.StartVersion + } + return 0 +} + +func (m *CommitRequest) GetKeys() [][]byte { + if m != nil { + return m.Keys + } + return nil +} + +func (m *CommitRequest) GetCommitVersion() uint64 { + if m != nil { + return m.CommitVersion + } + return 0 +} + +type CommitResponse struct { + RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` + Error *KeyError `protobuf:"bytes,2,opt,name=error" json:"error,omitempty"` +} + +func (m *CommitResponse) Reset() { *m = CommitResponse{} } +func (m *CommitResponse) String() string { return proto.CompactTextString(m) } +func (*CommitResponse) ProtoMessage() {} +func (*CommitResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{12} } + +func (m *CommitResponse) GetRegionError() *errorpb.Error { + if m != nil { + return m.RegionError + } + return nil +} + +func (m *CommitResponse) GetError() *KeyError { + if m != nil { + return m.Error + } + return nil +} + +type ImportRequest struct { + Mutations []*Mutation `protobuf:"bytes,1,rep,name=mutations" json:"mutations,omitempty"` + CommitVersion uint64 `protobuf:"varint,2,opt,name=commit_version,json=commitVersion,proto3" json:"commit_version,omitempty"` +} + +func (m *ImportRequest) Reset() { *m = ImportRequest{} } +func (m *ImportRequest) String() string { return proto.CompactTextString(m) } +func (*ImportRequest) ProtoMessage() {} +func (*ImportRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{13} } + +func (m *ImportRequest) GetMutations() []*Mutation { + if m != nil { + return m.Mutations + } + return nil +} + +func (m *ImportRequest) GetCommitVersion() uint64 { + if m != nil { + return m.CommitVersion + } + return 0 +} + +type ImportResponse struct { + RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` + Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` +} + +func (m *ImportResponse) Reset() { *m = ImportResponse{} } +func (m *ImportResponse) String() string { return proto.CompactTextString(m) } +func (*ImportResponse) ProtoMessage() {} +func (*ImportResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{14} } + +func (m *ImportResponse) GetRegionError() *errorpb.Error { + if m != nil { + return m.RegionError + } + return nil +} + +func (m *ImportResponse) GetError() string { + if m != nil { + return m.Error + } + return "" +} + +type BatchRollbackRequest struct { + Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` + StartVersion uint64 `protobuf:"varint,2,opt,name=start_version,json=startVersion,proto3" json:"start_version,omitempty"` + Keys [][]byte `protobuf:"bytes,3,rep,name=keys" json:"keys,omitempty"` +} + +func (m *BatchRollbackRequest) Reset() { *m = BatchRollbackRequest{} } +func (m *BatchRollbackRequest) String() string { return proto.CompactTextString(m) } +func (*BatchRollbackRequest) ProtoMessage() {} +func (*BatchRollbackRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{15} } + +func (m *BatchRollbackRequest) GetContext() *Context { + if m != nil { + return m.Context + } + return nil +} + +func (m *BatchRollbackRequest) GetStartVersion() uint64 { + if m != nil { + return m.StartVersion + } + return 0 +} + +func (m *BatchRollbackRequest) GetKeys() [][]byte { + if m != nil { + return m.Keys + } + return nil +} + +type BatchRollbackResponse struct { + RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` + Error *KeyError `protobuf:"bytes,2,opt,name=error" json:"error,omitempty"` +} + +func (m *BatchRollbackResponse) Reset() { *m = BatchRollbackResponse{} } +func (m *BatchRollbackResponse) String() string { return proto.CompactTextString(m) } +func (*BatchRollbackResponse) ProtoMessage() {} +func (*BatchRollbackResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{16} } + +func (m *BatchRollbackResponse) GetRegionError() *errorpb.Error { + if m != nil { + return m.RegionError + } + return nil +} + +func (m *BatchRollbackResponse) GetError() *KeyError { + if m != nil { + return m.Error + } + return nil +} + +type CleanupRequest struct { + Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + StartVersion uint64 `protobuf:"varint,3,opt,name=start_version,json=startVersion,proto3" json:"start_version,omitempty"` +} + +func (m *CleanupRequest) Reset() { *m = CleanupRequest{} } +func (m *CleanupRequest) String() string { return proto.CompactTextString(m) } +func (*CleanupRequest) ProtoMessage() {} +func (*CleanupRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{17} } + +func (m *CleanupRequest) GetContext() *Context { + if m != nil { + return m.Context + } + return nil +} + +func (m *CleanupRequest) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *CleanupRequest) GetStartVersion() uint64 { + if m != nil { + return m.StartVersion + } + return 0 +} + +type CleanupResponse struct { + RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` + Error *KeyError `protobuf:"bytes,2,opt,name=error" json:"error,omitempty"` + CommitVersion uint64 `protobuf:"varint,3,opt,name=commit_version,json=commitVersion,proto3" json:"commit_version,omitempty"` +} + +func (m *CleanupResponse) Reset() { *m = CleanupResponse{} } +func (m *CleanupResponse) String() string { return proto.CompactTextString(m) } +func (*CleanupResponse) ProtoMessage() {} +func (*CleanupResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{18} } + +func (m *CleanupResponse) GetRegionError() *errorpb.Error { + if m != nil { + return m.RegionError + } + return nil +} + +func (m *CleanupResponse) GetError() *KeyError { + if m != nil { + return m.Error + } + return nil +} + +func (m *CleanupResponse) GetCommitVersion() uint64 { + if m != nil { + return m.CommitVersion + } + return 0 +} + +type BatchGetRequest struct { + Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` + Keys [][]byte `protobuf:"bytes,2,rep,name=keys" json:"keys,omitempty"` + Version uint64 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` +} + +func (m *BatchGetRequest) Reset() { *m = BatchGetRequest{} } +func (m *BatchGetRequest) String() string { return proto.CompactTextString(m) } +func (*BatchGetRequest) ProtoMessage() {} +func (*BatchGetRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{19} } + +func (m *BatchGetRequest) GetContext() *Context { + if m != nil { + return m.Context + } + return nil +} + +func (m *BatchGetRequest) GetKeys() [][]byte { + if m != nil { + return m.Keys + } + return nil +} + +func (m *BatchGetRequest) GetVersion() uint64 { + if m != nil { + return m.Version + } + return 0 +} + +type BatchGetResponse struct { + RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` + Pairs []*KvPair `protobuf:"bytes,2,rep,name=pairs" json:"pairs,omitempty"` +} + +func (m *BatchGetResponse) Reset() { *m = BatchGetResponse{} } +func (m *BatchGetResponse) String() string { return proto.CompactTextString(m) } +func (*BatchGetResponse) ProtoMessage() {} +func (*BatchGetResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{20} } + +func (m *BatchGetResponse) GetRegionError() *errorpb.Error { + if m != nil { + return m.RegionError + } + return nil +} + +func (m *BatchGetResponse) GetPairs() []*KvPair { + if m != nil { + return m.Pairs + } + return nil +} + +type ScanLockRequest struct { + Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` + MaxVersion uint64 `protobuf:"varint,2,opt,name=max_version,json=maxVersion,proto3" json:"max_version,omitempty"` +} + +func (m *ScanLockRequest) Reset() { *m = ScanLockRequest{} } +func (m *ScanLockRequest) String() string { return proto.CompactTextString(m) } +func (*ScanLockRequest) ProtoMessage() {} +func (*ScanLockRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{21} } + +func (m *ScanLockRequest) GetContext() *Context { + if m != nil { + return m.Context + } + return nil +} + +func (m *ScanLockRequest) GetMaxVersion() uint64 { + if m != nil { + return m.MaxVersion + } + return 0 +} + +type ScanLockResponse struct { + RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` + Error *KeyError `protobuf:"bytes,2,opt,name=error" json:"error,omitempty"` + Locks []*LockInfo `protobuf:"bytes,3,rep,name=locks" json:"locks,omitempty"` +} + +func (m *ScanLockResponse) Reset() { *m = ScanLockResponse{} } +func (m *ScanLockResponse) String() string { return proto.CompactTextString(m) } +func (*ScanLockResponse) ProtoMessage() {} +func (*ScanLockResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{22} } + +func (m *ScanLockResponse) GetRegionError() *errorpb.Error { + if m != nil { + return m.RegionError + } + return nil +} + +func (m *ScanLockResponse) GetError() *KeyError { + if m != nil { + return m.Error + } + return nil +} + +func (m *ScanLockResponse) GetLocks() []*LockInfo { + if m != nil { + return m.Locks + } + return nil +} + +type ResolveLockRequest struct { + Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` + StartVersion uint64 `protobuf:"varint,2,opt,name=start_version,json=startVersion,proto3" json:"start_version,omitempty"` + // If the txn is rolled back, do not set it. + CommitVersion uint64 `protobuf:"varint,3,opt,name=commit_version,json=commitVersion,proto3" json:"commit_version,omitempty"` +} + +func (m *ResolveLockRequest) Reset() { *m = ResolveLockRequest{} } +func (m *ResolveLockRequest) String() string { return proto.CompactTextString(m) } +func (*ResolveLockRequest) ProtoMessage() {} +func (*ResolveLockRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{23} } + +func (m *ResolveLockRequest) GetContext() *Context { + if m != nil { + return m.Context + } + return nil +} + +func (m *ResolveLockRequest) GetStartVersion() uint64 { + if m != nil { + return m.StartVersion + } + return 0 +} + +func (m *ResolveLockRequest) GetCommitVersion() uint64 { + if m != nil { + return m.CommitVersion + } + return 0 +} + +type ResolveLockResponse struct { + RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` + Error *KeyError `protobuf:"bytes,2,opt,name=error" json:"error,omitempty"` +} + +func (m *ResolveLockResponse) Reset() { *m = ResolveLockResponse{} } +func (m *ResolveLockResponse) String() string { return proto.CompactTextString(m) } +func (*ResolveLockResponse) ProtoMessage() {} +func (*ResolveLockResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{24} } + +func (m *ResolveLockResponse) GetRegionError() *errorpb.Error { + if m != nil { + return m.RegionError + } + return nil +} + +func (m *ResolveLockResponse) GetError() *KeyError { + if m != nil { + return m.Error + } + return nil +} + +type GCRequest struct { + Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` + SafePoint uint64 `protobuf:"varint,2,opt,name=safe_point,json=safePoint,proto3" json:"safe_point,omitempty"` +} + +func (m *GCRequest) Reset() { *m = GCRequest{} } +func (m *GCRequest) String() string { return proto.CompactTextString(m) } +func (*GCRequest) ProtoMessage() {} +func (*GCRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{25} } + +func (m *GCRequest) GetContext() *Context { + if m != nil { + return m.Context + } + return nil +} + +func (m *GCRequest) GetSafePoint() uint64 { + if m != nil { + return m.SafePoint + } + return 0 +} + +type GCResponse struct { + RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` + Error *KeyError `protobuf:"bytes,2,opt,name=error" json:"error,omitempty"` +} + +func (m *GCResponse) Reset() { *m = GCResponse{} } +func (m *GCResponse) String() string { return proto.CompactTextString(m) } +func (*GCResponse) ProtoMessage() {} +func (*GCResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{26} } + +func (m *GCResponse) GetRegionError() *errorpb.Error { + if m != nil { + return m.RegionError + } + return nil +} + +func (m *GCResponse) GetError() *KeyError { + if m != nil { + return m.Error + } + return nil +} + +type RawGetRequest struct { + Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` +} + +func (m *RawGetRequest) Reset() { *m = RawGetRequest{} } +func (m *RawGetRequest) String() string { return proto.CompactTextString(m) } +func (*RawGetRequest) ProtoMessage() {} +func (*RawGetRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{27} } + +func (m *RawGetRequest) GetContext() *Context { + if m != nil { + return m.Context + } + return nil +} + +func (m *RawGetRequest) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +type RawGetResponse struct { + RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` + Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *RawGetResponse) Reset() { *m = RawGetResponse{} } +func (m *RawGetResponse) String() string { return proto.CompactTextString(m) } +func (*RawGetResponse) ProtoMessage() {} +func (*RawGetResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{28} } + +func (m *RawGetResponse) GetRegionError() *errorpb.Error { + if m != nil { + return m.RegionError + } + return nil +} + +func (m *RawGetResponse) GetError() string { + if m != nil { + return m.Error + } + return "" +} + +func (m *RawGetResponse) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +type RawPutRequest struct { + Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *RawPutRequest) Reset() { *m = RawPutRequest{} } +func (m *RawPutRequest) String() string { return proto.CompactTextString(m) } +func (*RawPutRequest) ProtoMessage() {} +func (*RawPutRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{29} } + +func (m *RawPutRequest) GetContext() *Context { + if m != nil { + return m.Context + } + return nil +} + +func (m *RawPutRequest) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *RawPutRequest) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +type RawPutResponse struct { + RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` + Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` +} + +func (m *RawPutResponse) Reset() { *m = RawPutResponse{} } +func (m *RawPutResponse) String() string { return proto.CompactTextString(m) } +func (*RawPutResponse) ProtoMessage() {} +func (*RawPutResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{30} } + +func (m *RawPutResponse) GetRegionError() *errorpb.Error { + if m != nil { + return m.RegionError + } + return nil +} + +func (m *RawPutResponse) GetError() string { + if m != nil { + return m.Error + } + return "" +} + +type RawDeleteRequest struct { + Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` +} + +func (m *RawDeleteRequest) Reset() { *m = RawDeleteRequest{} } +func (m *RawDeleteRequest) String() string { return proto.CompactTextString(m) } +func (*RawDeleteRequest) ProtoMessage() {} +func (*RawDeleteRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{31} } + +func (m *RawDeleteRequest) GetContext() *Context { + if m != nil { + return m.Context + } + return nil +} + +func (m *RawDeleteRequest) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +type RawDeleteResponse struct { + RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` + Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` +} + +func (m *RawDeleteResponse) Reset() { *m = RawDeleteResponse{} } +func (m *RawDeleteResponse) String() string { return proto.CompactTextString(m) } +func (*RawDeleteResponse) ProtoMessage() {} +func (*RawDeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{32} } + +func (m *RawDeleteResponse) GetRegionError() *errorpb.Error { + if m != nil { + return m.RegionError + } + return nil +} + +func (m *RawDeleteResponse) GetError() string { + if m != nil { + return m.Error + } + return "" +} + +type DeleteRangeRequest struct { + Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` + StartKey []byte `protobuf:"bytes,2,opt,name=start_key,json=startKey,proto3" json:"start_key,omitempty"` + EndKey []byte `protobuf:"bytes,3,opt,name=end_key,json=endKey,proto3" json:"end_key,omitempty"` +} + +func (m *DeleteRangeRequest) Reset() { *m = DeleteRangeRequest{} } +func (m *DeleteRangeRequest) String() string { return proto.CompactTextString(m) } +func (*DeleteRangeRequest) ProtoMessage() {} +func (*DeleteRangeRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{33} } + +func (m *DeleteRangeRequest) GetContext() *Context { + if m != nil { + return m.Context + } + return nil +} + +func (m *DeleteRangeRequest) GetStartKey() []byte { + if m != nil { + return m.StartKey + } + return nil +} + +func (m *DeleteRangeRequest) GetEndKey() []byte { + if m != nil { + return m.EndKey + } + return nil +} + +type DeleteRangeResponse struct { + RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` + Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` +} + +func (m *DeleteRangeResponse) Reset() { *m = DeleteRangeResponse{} } +func (m *DeleteRangeResponse) String() string { return proto.CompactTextString(m) } +func (*DeleteRangeResponse) ProtoMessage() {} +func (*DeleteRangeResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{34} } + +func (m *DeleteRangeResponse) GetRegionError() *errorpb.Error { + if m != nil { + return m.RegionError + } + return nil +} + +func (m *DeleteRangeResponse) GetError() string { + if m != nil { + return m.Error + } + return "" +} + +type RawScanRequest struct { + Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` + StartKey []byte `protobuf:"bytes,2,opt,name=start_key,json=startKey,proto3" json:"start_key,omitempty"` + Limit uint32 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` +} + +func (m *RawScanRequest) Reset() { *m = RawScanRequest{} } +func (m *RawScanRequest) String() string { return proto.CompactTextString(m) } +func (*RawScanRequest) ProtoMessage() {} +func (*RawScanRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{35} } + +func (m *RawScanRequest) GetContext() *Context { + if m != nil { + return m.Context + } + return nil +} + +func (m *RawScanRequest) GetStartKey() []byte { + if m != nil { + return m.StartKey + } + return nil +} + +func (m *RawScanRequest) GetLimit() uint32 { + if m != nil { + return m.Limit + } + return 0 +} + +type RawScanResponse struct { + RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` + Kvs []*KvPair `protobuf:"bytes,2,rep,name=kvs" json:"kvs,omitempty"` +} + +func (m *RawScanResponse) Reset() { *m = RawScanResponse{} } +func (m *RawScanResponse) String() string { return proto.CompactTextString(m) } +func (*RawScanResponse) ProtoMessage() {} +func (*RawScanResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{36} } + +func (m *RawScanResponse) GetRegionError() *errorpb.Error { + if m != nil { + return m.RegionError + } + return nil +} + +func (m *RawScanResponse) GetKvs() []*KvPair { + if m != nil { + return m.Kvs + } + return nil +} + +type WriteInfo struct { + StartTs uint64 `protobuf:"varint,1,opt,name=start_ts,json=startTs,proto3" json:"start_ts,omitempty"` + Type Op `protobuf:"varint,2,opt,name=type,proto3,enum=kvrpcpb.Op" json:"type,omitempty"` + CommitTs uint64 `protobuf:"varint,3,opt,name=commit_ts,json=commitTs,proto3" json:"commit_ts,omitempty"` +} + +func (m *WriteInfo) Reset() { *m = WriteInfo{} } +func (m *WriteInfo) String() string { return proto.CompactTextString(m) } +func (*WriteInfo) ProtoMessage() {} +func (*WriteInfo) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{37} } + +func (m *WriteInfo) GetStartTs() uint64 { + if m != nil { + return m.StartTs + } + return 0 +} + +func (m *WriteInfo) GetType() Op { + if m != nil { + return m.Type + } + return Op_Put +} + +func (m *WriteInfo) GetCommitTs() uint64 { + if m != nil { + return m.CommitTs + } + return 0 +} + +type ValueInfo struct { + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + Ts uint64 `protobuf:"varint,2,opt,name=ts,proto3" json:"ts,omitempty"` + IsShortValue bool `protobuf:"varint,3,opt,name=is_short_value,json=isShortValue,proto3" json:"is_short_value,omitempty"` +} + +func (m *ValueInfo) Reset() { *m = ValueInfo{} } +func (m *ValueInfo) String() string { return proto.CompactTextString(m) } +func (*ValueInfo) ProtoMessage() {} +func (*ValueInfo) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{38} } + +func (m *ValueInfo) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +func (m *ValueInfo) GetTs() uint64 { + if m != nil { + return m.Ts + } + return 0 +} + +func (m *ValueInfo) GetIsShortValue() bool { + if m != nil { + return m.IsShortValue + } + return false +} + +type MvccInfo struct { + Lock *LockInfo `protobuf:"bytes,1,opt,name=lock" json:"lock,omitempty"` + Writes []*WriteInfo `protobuf:"bytes,2,rep,name=writes" json:"writes,omitempty"` + Values []*ValueInfo `protobuf:"bytes,3,rep,name=values" json:"values,omitempty"` +} + +func (m *MvccInfo) Reset() { *m = MvccInfo{} } +func (m *MvccInfo) String() string { return proto.CompactTextString(m) } +func (*MvccInfo) ProtoMessage() {} +func (*MvccInfo) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{39} } + +func (m *MvccInfo) GetLock() *LockInfo { + if m != nil { + return m.Lock + } + return nil +} + +func (m *MvccInfo) GetWrites() []*WriteInfo { + if m != nil { + return m.Writes + } + return nil +} + +func (m *MvccInfo) GetValues() []*ValueInfo { + if m != nil { + return m.Values + } + return nil +} + +type MvccGetByKeyRequest struct { + Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` +} + +func (m *MvccGetByKeyRequest) Reset() { *m = MvccGetByKeyRequest{} } +func (m *MvccGetByKeyRequest) String() string { return proto.CompactTextString(m) } +func (*MvccGetByKeyRequest) ProtoMessage() {} +func (*MvccGetByKeyRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{40} } + +func (m *MvccGetByKeyRequest) GetContext() *Context { + if m != nil { + return m.Context + } + return nil +} + +func (m *MvccGetByKeyRequest) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +type MvccGetByKeyResponse struct { + RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` + Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` + Info *MvccInfo `protobuf:"bytes,3,opt,name=info" json:"info,omitempty"` +} + +func (m *MvccGetByKeyResponse) Reset() { *m = MvccGetByKeyResponse{} } +func (m *MvccGetByKeyResponse) String() string { return proto.CompactTextString(m) } +func (*MvccGetByKeyResponse) ProtoMessage() {} +func (*MvccGetByKeyResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{41} } + +func (m *MvccGetByKeyResponse) GetRegionError() *errorpb.Error { + if m != nil { + return m.RegionError + } + return nil +} + +func (m *MvccGetByKeyResponse) GetError() string { + if m != nil { + return m.Error + } + return "" +} + +func (m *MvccGetByKeyResponse) GetInfo() *MvccInfo { + if m != nil { + return m.Info + } + return nil +} + +type MvccGetByStartTsRequest struct { + Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` + StartTs uint64 `protobuf:"varint,2,opt,name=start_ts,json=startTs,proto3" json:"start_ts,omitempty"` +} + +func (m *MvccGetByStartTsRequest) Reset() { *m = MvccGetByStartTsRequest{} } +func (m *MvccGetByStartTsRequest) String() string { return proto.CompactTextString(m) } +func (*MvccGetByStartTsRequest) ProtoMessage() {} +func (*MvccGetByStartTsRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{42} } + +func (m *MvccGetByStartTsRequest) GetContext() *Context { + if m != nil { + return m.Context + } + return nil +} + +func (m *MvccGetByStartTsRequest) GetStartTs() uint64 { + if m != nil { + return m.StartTs + } + return 0 +} + +type MvccGetByStartTsResponse struct { + RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` + Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` + Key []byte `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` + Info *MvccInfo `protobuf:"bytes,4,opt,name=info" json:"info,omitempty"` +} + +func (m *MvccGetByStartTsResponse) Reset() { *m = MvccGetByStartTsResponse{} } +func (m *MvccGetByStartTsResponse) String() string { return proto.CompactTextString(m) } +func (*MvccGetByStartTsResponse) ProtoMessage() {} +func (*MvccGetByStartTsResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{43} } + +func (m *MvccGetByStartTsResponse) GetRegionError() *errorpb.Error { + if m != nil { + return m.RegionError + } + return nil +} + +func (m *MvccGetByStartTsResponse) GetError() string { + if m != nil { + return m.Error + } + return "" +} + +func (m *MvccGetByStartTsResponse) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *MvccGetByStartTsResponse) GetInfo() *MvccInfo { + if m != nil { + return m.Info + } + return nil +} + +func init() { + proto.RegisterType((*LockInfo)(nil), "kvrpcpb.LockInfo") + proto.RegisterType((*KeyError)(nil), "kvrpcpb.KeyError") + proto.RegisterType((*Context)(nil), "kvrpcpb.Context") + proto.RegisterType((*GetRequest)(nil), "kvrpcpb.GetRequest") + proto.RegisterType((*GetResponse)(nil), "kvrpcpb.GetResponse") + proto.RegisterType((*ScanRequest)(nil), "kvrpcpb.ScanRequest") + proto.RegisterType((*KvPair)(nil), "kvrpcpb.KvPair") + proto.RegisterType((*ScanResponse)(nil), "kvrpcpb.ScanResponse") + proto.RegisterType((*Mutation)(nil), "kvrpcpb.Mutation") + proto.RegisterType((*PrewriteRequest)(nil), "kvrpcpb.PrewriteRequest") + proto.RegisterType((*PrewriteResponse)(nil), "kvrpcpb.PrewriteResponse") + proto.RegisterType((*CommitRequest)(nil), "kvrpcpb.CommitRequest") + proto.RegisterType((*CommitResponse)(nil), "kvrpcpb.CommitResponse") + proto.RegisterType((*ImportRequest)(nil), "kvrpcpb.ImportRequest") + proto.RegisterType((*ImportResponse)(nil), "kvrpcpb.ImportResponse") + proto.RegisterType((*BatchRollbackRequest)(nil), "kvrpcpb.BatchRollbackRequest") + proto.RegisterType((*BatchRollbackResponse)(nil), "kvrpcpb.BatchRollbackResponse") + proto.RegisterType((*CleanupRequest)(nil), "kvrpcpb.CleanupRequest") + proto.RegisterType((*CleanupResponse)(nil), "kvrpcpb.CleanupResponse") + proto.RegisterType((*BatchGetRequest)(nil), "kvrpcpb.BatchGetRequest") + proto.RegisterType((*BatchGetResponse)(nil), "kvrpcpb.BatchGetResponse") + proto.RegisterType((*ScanLockRequest)(nil), "kvrpcpb.ScanLockRequest") + proto.RegisterType((*ScanLockResponse)(nil), "kvrpcpb.ScanLockResponse") + proto.RegisterType((*ResolveLockRequest)(nil), "kvrpcpb.ResolveLockRequest") + proto.RegisterType((*ResolveLockResponse)(nil), "kvrpcpb.ResolveLockResponse") + proto.RegisterType((*GCRequest)(nil), "kvrpcpb.GCRequest") + proto.RegisterType((*GCResponse)(nil), "kvrpcpb.GCResponse") + proto.RegisterType((*RawGetRequest)(nil), "kvrpcpb.RawGetRequest") + proto.RegisterType((*RawGetResponse)(nil), "kvrpcpb.RawGetResponse") + proto.RegisterType((*RawPutRequest)(nil), "kvrpcpb.RawPutRequest") + proto.RegisterType((*RawPutResponse)(nil), "kvrpcpb.RawPutResponse") + proto.RegisterType((*RawDeleteRequest)(nil), "kvrpcpb.RawDeleteRequest") + proto.RegisterType((*RawDeleteResponse)(nil), "kvrpcpb.RawDeleteResponse") + proto.RegisterType((*DeleteRangeRequest)(nil), "kvrpcpb.DeleteRangeRequest") + proto.RegisterType((*DeleteRangeResponse)(nil), "kvrpcpb.DeleteRangeResponse") + proto.RegisterType((*RawScanRequest)(nil), "kvrpcpb.RawScanRequest") + proto.RegisterType((*RawScanResponse)(nil), "kvrpcpb.RawScanResponse") + proto.RegisterType((*WriteInfo)(nil), "kvrpcpb.WriteInfo") + proto.RegisterType((*ValueInfo)(nil), "kvrpcpb.ValueInfo") + proto.RegisterType((*MvccInfo)(nil), "kvrpcpb.MvccInfo") + proto.RegisterType((*MvccGetByKeyRequest)(nil), "kvrpcpb.MvccGetByKeyRequest") + proto.RegisterType((*MvccGetByKeyResponse)(nil), "kvrpcpb.MvccGetByKeyResponse") + proto.RegisterType((*MvccGetByStartTsRequest)(nil), "kvrpcpb.MvccGetByStartTsRequest") + proto.RegisterType((*MvccGetByStartTsResponse)(nil), "kvrpcpb.MvccGetByStartTsResponse") + proto.RegisterEnum("kvrpcpb.CommandPri", CommandPri_name, CommandPri_value) + proto.RegisterEnum("kvrpcpb.IsolationLevel", IsolationLevel_name, IsolationLevel_value) + proto.RegisterEnum("kvrpcpb.Op", Op_name, Op_value) +} +func (m *LockInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LockInfo) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.PrimaryLock) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.PrimaryLock))) + i += copy(dAtA[i:], m.PrimaryLock) + } + if m.LockVersion != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.LockVersion)) + } + if len(m.Key) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + if m.LockTtl != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.LockTtl)) + } + return i, nil +} + +func (m *KeyError) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *KeyError) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Locked != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Locked.Size())) + n1, err := m.Locked.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if len(m.Retryable) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Retryable))) + i += copy(dAtA[i:], m.Retryable) + } + if len(m.Abort) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Abort))) + i += copy(dAtA[i:], m.Abort) + } + return i, nil +} + +func (m *Context) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Context) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionId != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionId)) + } + if m.RegionEpoch != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionEpoch.Size())) + n2, err := m.RegionEpoch.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.Peer != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Peer.Size())) + n3, err := m.Peer.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if m.Term != 0 { + dAtA[i] = 0x28 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Term)) + } + if m.Priority != 0 { + dAtA[i] = 0x30 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Priority)) + } + if m.IsolationLevel != 0 { + dAtA[i] = 0x38 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.IsolationLevel)) + } + return i, nil +} + +func (m *GetRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Context != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) + n4, err := m.Context.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + if len(m.Key) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + if m.Version != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Version)) + } + return i, nil +} + +func (m *GetResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionError != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) + n5, err := m.RegionError.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + if m.Error != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Error.Size())) + n6, err := m.Error.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + if len(m.Value) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Value))) + i += copy(dAtA[i:], m.Value) + } + return i, nil +} + +func (m *ScanRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ScanRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Context != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) + n7, err := m.Context.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n7 + } + if len(m.StartKey) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.StartKey))) + i += copy(dAtA[i:], m.StartKey) + } + if m.Limit != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Limit)) + } + if m.Version != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Version)) + } + if m.KeyOnly { + dAtA[i] = 0x28 + i++ + if m.KeyOnly { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + return i, nil +} + +func (m *KvPair) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *KvPair) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Error != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Error.Size())) + n8, err := m.Error.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n8 + } + if len(m.Key) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + if len(m.Value) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Value))) + i += copy(dAtA[i:], m.Value) + } + return i, nil +} + +func (m *ScanResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ScanResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionError != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) + n9, err := m.RegionError.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n9 + } + if len(m.Pairs) > 0 { + for _, msg := range m.Pairs { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *Mutation) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Mutation) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Op != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Op)) + } + if len(m.Key) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + if len(m.Value) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Value))) + i += copy(dAtA[i:], m.Value) + } + return i, nil +} + +func (m *PrewriteRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PrewriteRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Context != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) + n10, err := m.Context.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n10 + } + if len(m.Mutations) > 0 { + for _, msg := range m.Mutations { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.PrimaryLock) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.PrimaryLock))) + i += copy(dAtA[i:], m.PrimaryLock) + } + if m.StartVersion != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.StartVersion)) + } + if m.LockTtl != 0 { + dAtA[i] = 0x28 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.LockTtl)) + } + if m.SkipConstraintCheck { + dAtA[i] = 0x30 + i++ + if m.SkipConstraintCheck { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + return i, nil +} + +func (m *PrewriteResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PrewriteResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionError != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) + n11, err := m.RegionError.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n11 + } + if len(m.Errors) > 0 { + for _, msg := range m.Errors { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *CommitRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CommitRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Context != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) + n12, err := m.Context.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n12 + } + if m.StartVersion != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.StartVersion)) + } + if len(m.Keys) > 0 { + for _, b := range m.Keys { + dAtA[i] = 0x1a + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(b))) + i += copy(dAtA[i:], b) + } + } + if m.CommitVersion != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.CommitVersion)) + } + return i, nil +} + +func (m *CommitResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CommitResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionError != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) + n13, err := m.RegionError.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n13 + } + if m.Error != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Error.Size())) + n14, err := m.Error.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n14 + } + return i, nil +} + +func (m *ImportRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ImportRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Mutations) > 0 { + for _, msg := range m.Mutations { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.CommitVersion != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.CommitVersion)) + } + return i, nil +} + +func (m *ImportResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ImportResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionError != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) + n15, err := m.RegionError.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n15 + } + if len(m.Error) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Error))) + i += copy(dAtA[i:], m.Error) + } + return i, nil +} + +func (m *BatchRollbackRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BatchRollbackRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Context != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) + n16, err := m.Context.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n16 + } + if m.StartVersion != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.StartVersion)) + } + if len(m.Keys) > 0 { + for _, b := range m.Keys { + dAtA[i] = 0x1a + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(b))) + i += copy(dAtA[i:], b) + } + } + return i, nil +} + +func (m *BatchRollbackResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BatchRollbackResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionError != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) + n17, err := m.RegionError.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n17 + } + if m.Error != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Error.Size())) + n18, err := m.Error.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n18 + } + return i, nil +} + +func (m *CleanupRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CleanupRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Context != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) + n19, err := m.Context.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n19 + } + if len(m.Key) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + if m.StartVersion != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.StartVersion)) + } + return i, nil +} + +func (m *CleanupResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CleanupResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionError != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) + n20, err := m.RegionError.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n20 + } + if m.Error != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Error.Size())) + n21, err := m.Error.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n21 + } + if m.CommitVersion != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.CommitVersion)) + } + return i, nil +} + +func (m *BatchGetRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BatchGetRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Context != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) + n22, err := m.Context.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n22 + } + if len(m.Keys) > 0 { + for _, b := range m.Keys { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(b))) + i += copy(dAtA[i:], b) + } + } + if m.Version != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Version)) + } + return i, nil +} + +func (m *BatchGetResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BatchGetResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionError != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) + n23, err := m.RegionError.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n23 + } + if len(m.Pairs) > 0 { + for _, msg := range m.Pairs { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *ScanLockRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ScanLockRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Context != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) + n24, err := m.Context.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n24 + } + if m.MaxVersion != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.MaxVersion)) + } + return i, nil +} + +func (m *ScanLockResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ScanLockResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionError != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) + n25, err := m.RegionError.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n25 + } + if m.Error != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Error.Size())) + n26, err := m.Error.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n26 + } + if len(m.Locks) > 0 { + for _, msg := range m.Locks { + dAtA[i] = 0x1a + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *ResolveLockRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResolveLockRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Context != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) + n27, err := m.Context.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n27 + } + if m.StartVersion != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.StartVersion)) + } + if m.CommitVersion != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.CommitVersion)) + } + return i, nil +} + +func (m *ResolveLockResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResolveLockResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionError != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) + n28, err := m.RegionError.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n28 + } + if m.Error != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Error.Size())) + n29, err := m.Error.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n29 + } + return i, nil +} + +func (m *GCRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GCRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Context != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) + n30, err := m.Context.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n30 + } + if m.SafePoint != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.SafePoint)) + } + return i, nil +} + +func (m *GCResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GCResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionError != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) + n31, err := m.RegionError.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n31 + } + if m.Error != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Error.Size())) + n32, err := m.Error.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n32 + } + return i, nil +} + +func (m *RawGetRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RawGetRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Context != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) + n33, err := m.Context.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n33 + } + if len(m.Key) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + return i, nil +} + +func (m *RawGetResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RawGetResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionError != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) + n34, err := m.RegionError.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n34 + } + if len(m.Error) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Error))) + i += copy(dAtA[i:], m.Error) + } + if len(m.Value) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Value))) + i += copy(dAtA[i:], m.Value) + } + return i, nil +} + +func (m *RawPutRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RawPutRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Context != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) + n35, err := m.Context.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n35 + } + if len(m.Key) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + if len(m.Value) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Value))) + i += copy(dAtA[i:], m.Value) + } + return i, nil +} + +func (m *RawPutResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RawPutResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionError != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) + n36, err := m.RegionError.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n36 + } + if len(m.Error) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Error))) + i += copy(dAtA[i:], m.Error) + } + return i, nil +} + +func (m *RawDeleteRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RawDeleteRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Context != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) + n37, err := m.Context.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n37 + } + if len(m.Key) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + return i, nil +} + +func (m *RawDeleteResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RawDeleteResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionError != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) + n38, err := m.RegionError.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n38 + } + if len(m.Error) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Error))) + i += copy(dAtA[i:], m.Error) + } + return i, nil +} + +func (m *DeleteRangeRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteRangeRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Context != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) + n39, err := m.Context.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n39 + } + if len(m.StartKey) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.StartKey))) + i += copy(dAtA[i:], m.StartKey) + } + if len(m.EndKey) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.EndKey))) + i += copy(dAtA[i:], m.EndKey) + } + return i, nil +} + +func (m *DeleteRangeResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteRangeResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionError != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) + n40, err := m.RegionError.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n40 + } + if len(m.Error) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Error))) + i += copy(dAtA[i:], m.Error) + } + return i, nil +} + +func (m *RawScanRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RawScanRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Context != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) + n41, err := m.Context.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n41 + } + if len(m.StartKey) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.StartKey))) + i += copy(dAtA[i:], m.StartKey) + } + if m.Limit != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Limit)) + } + return i, nil +} + +func (m *RawScanResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RawScanResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionError != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) + n42, err := m.RegionError.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n42 + } + if len(m.Kvs) > 0 { + for _, msg := range m.Kvs { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *WriteInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WriteInfo) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.StartTs != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.StartTs)) + } + if m.Type != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Type)) + } + if m.CommitTs != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.CommitTs)) + } + return i, nil +} + +func (m *ValueInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ValueInfo) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Value) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Value))) + i += copy(dAtA[i:], m.Value) + } + if m.Ts != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Ts)) + } + if m.IsShortValue { + dAtA[i] = 0x18 + i++ + if m.IsShortValue { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + return i, nil +} + +func (m *MvccInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MvccInfo) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Lock != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Lock.Size())) + n43, err := m.Lock.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n43 + } + if len(m.Writes) > 0 { + for _, msg := range m.Writes { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.Values) > 0 { + for _, msg := range m.Values { + dAtA[i] = 0x1a + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *MvccGetByKeyRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MvccGetByKeyRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Context != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) + n44, err := m.Context.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n44 + } + if len(m.Key) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + return i, nil +} + +func (m *MvccGetByKeyResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MvccGetByKeyResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionError != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) + n45, err := m.RegionError.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n45 + } + if len(m.Error) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Error))) + i += copy(dAtA[i:], m.Error) + } + if m.Info != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Info.Size())) + n46, err := m.Info.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n46 + } + return i, nil +} + +func (m *MvccGetByStartTsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MvccGetByStartTsRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Context != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) + n47, err := m.Context.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n47 + } + if m.StartTs != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.StartTs)) + } + return i, nil +} + +func (m *MvccGetByStartTsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MvccGetByStartTsResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionError != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) + n48, err := m.RegionError.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n48 + } + if len(m.Error) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Error))) + i += copy(dAtA[i:], m.Error) + } + if len(m.Key) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + if m.Info != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Info.Size())) + n49, err := m.Info.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n49 + } + return i, nil +} + +func encodeFixed64Kvrpcpb(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Kvrpcpb(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintKvrpcpb(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *LockInfo) Size() (n int) { + var l int + _ = l + l = len(m.PrimaryLock) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.LockVersion != 0 { + n += 1 + sovKvrpcpb(uint64(m.LockVersion)) + } + l = len(m.Key) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.LockTtl != 0 { + n += 1 + sovKvrpcpb(uint64(m.LockTtl)) + } + return n +} + +func (m *KeyError) Size() (n int) { + var l int + _ = l + if m.Locked != nil { + l = m.Locked.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.Retryable) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.Abort) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + return n +} + +func (m *Context) Size() (n int) { + var l int + _ = l + if m.RegionId != 0 { + n += 1 + sovKvrpcpb(uint64(m.RegionId)) + } + if m.RegionEpoch != nil { + l = m.RegionEpoch.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.Peer != nil { + l = m.Peer.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.Term != 0 { + n += 1 + sovKvrpcpb(uint64(m.Term)) + } + if m.Priority != 0 { + n += 1 + sovKvrpcpb(uint64(m.Priority)) + } + if m.IsolationLevel != 0 { + n += 1 + sovKvrpcpb(uint64(m.IsolationLevel)) + } + return n +} + +func (m *GetRequest) Size() (n int) { + var l int + _ = l + if m.Context != nil { + l = m.Context.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.Key) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.Version != 0 { + n += 1 + sovKvrpcpb(uint64(m.Version)) + } + return n +} + +func (m *GetResponse) Size() (n int) { + var l int + _ = l + if m.RegionError != nil { + l = m.RegionError.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.Error != nil { + l = m.Error.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + return n +} + +func (m *ScanRequest) Size() (n int) { + var l int + _ = l + if m.Context != nil { + l = m.Context.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.StartKey) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.Limit != 0 { + n += 1 + sovKvrpcpb(uint64(m.Limit)) + } + if m.Version != 0 { + n += 1 + sovKvrpcpb(uint64(m.Version)) + } + if m.KeyOnly { + n += 2 + } + return n +} + +func (m *KvPair) Size() (n int) { + var l int + _ = l + if m.Error != nil { + l = m.Error.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.Key) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + return n +} + +func (m *ScanResponse) Size() (n int) { + var l int + _ = l + if m.RegionError != nil { + l = m.RegionError.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if len(m.Pairs) > 0 { + for _, e := range m.Pairs { + l = e.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + } + return n +} + +func (m *Mutation) Size() (n int) { + var l int + _ = l + if m.Op != 0 { + n += 1 + sovKvrpcpb(uint64(m.Op)) + } + l = len(m.Key) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + return n +} + +func (m *PrewriteRequest) Size() (n int) { + var l int + _ = l + if m.Context != nil { + l = m.Context.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if len(m.Mutations) > 0 { + for _, e := range m.Mutations { + l = e.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + } + l = len(m.PrimaryLock) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.StartVersion != 0 { + n += 1 + sovKvrpcpb(uint64(m.StartVersion)) + } + if m.LockTtl != 0 { + n += 1 + sovKvrpcpb(uint64(m.LockTtl)) + } + if m.SkipConstraintCheck { + n += 2 + } + return n +} + +func (m *PrewriteResponse) Size() (n int) { + var l int + _ = l + if m.RegionError != nil { + l = m.RegionError.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if len(m.Errors) > 0 { + for _, e := range m.Errors { + l = e.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + } + return n +} + +func (m *CommitRequest) Size() (n int) { + var l int + _ = l + if m.Context != nil { + l = m.Context.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.StartVersion != 0 { + n += 1 + sovKvrpcpb(uint64(m.StartVersion)) + } + if len(m.Keys) > 0 { + for _, b := range m.Keys { + l = len(b) + n += 1 + l + sovKvrpcpb(uint64(l)) + } + } + if m.CommitVersion != 0 { + n += 1 + sovKvrpcpb(uint64(m.CommitVersion)) + } + return n +} + +func (m *CommitResponse) Size() (n int) { + var l int + _ = l + if m.RegionError != nil { + l = m.RegionError.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.Error != nil { + l = m.Error.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + return n +} + +func (m *ImportRequest) Size() (n int) { + var l int + _ = l + if len(m.Mutations) > 0 { + for _, e := range m.Mutations { + l = e.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + } + if m.CommitVersion != 0 { + n += 1 + sovKvrpcpb(uint64(m.CommitVersion)) + } + return n +} + +func (m *ImportResponse) Size() (n int) { + var l int + _ = l + if m.RegionError != nil { + l = m.RegionError.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.Error) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + return n +} + +func (m *BatchRollbackRequest) Size() (n int) { + var l int + _ = l + if m.Context != nil { + l = m.Context.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.StartVersion != 0 { + n += 1 + sovKvrpcpb(uint64(m.StartVersion)) + } + if len(m.Keys) > 0 { + for _, b := range m.Keys { + l = len(b) + n += 1 + l + sovKvrpcpb(uint64(l)) + } + } + return n +} + +func (m *BatchRollbackResponse) Size() (n int) { + var l int + _ = l + if m.RegionError != nil { + l = m.RegionError.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.Error != nil { + l = m.Error.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + return n +} + +func (m *CleanupRequest) Size() (n int) { + var l int + _ = l + if m.Context != nil { + l = m.Context.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.Key) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.StartVersion != 0 { + n += 1 + sovKvrpcpb(uint64(m.StartVersion)) + } + return n +} + +func (m *CleanupResponse) Size() (n int) { + var l int + _ = l + if m.RegionError != nil { + l = m.RegionError.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.Error != nil { + l = m.Error.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.CommitVersion != 0 { + n += 1 + sovKvrpcpb(uint64(m.CommitVersion)) + } + return n +} + +func (m *BatchGetRequest) Size() (n int) { + var l int + _ = l + if m.Context != nil { + l = m.Context.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if len(m.Keys) > 0 { + for _, b := range m.Keys { + l = len(b) + n += 1 + l + sovKvrpcpb(uint64(l)) + } + } + if m.Version != 0 { + n += 1 + sovKvrpcpb(uint64(m.Version)) + } + return n +} + +func (m *BatchGetResponse) Size() (n int) { + var l int + _ = l + if m.RegionError != nil { + l = m.RegionError.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if len(m.Pairs) > 0 { + for _, e := range m.Pairs { + l = e.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + } + return n +} + +func (m *ScanLockRequest) Size() (n int) { + var l int + _ = l + if m.Context != nil { + l = m.Context.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.MaxVersion != 0 { + n += 1 + sovKvrpcpb(uint64(m.MaxVersion)) + } + return n +} + +func (m *ScanLockResponse) Size() (n int) { + var l int + _ = l + if m.RegionError != nil { + l = m.RegionError.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.Error != nil { + l = m.Error.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if len(m.Locks) > 0 { + for _, e := range m.Locks { + l = e.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + } + return n +} + +func (m *ResolveLockRequest) Size() (n int) { + var l int + _ = l + if m.Context != nil { + l = m.Context.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.StartVersion != 0 { + n += 1 + sovKvrpcpb(uint64(m.StartVersion)) + } + if m.CommitVersion != 0 { + n += 1 + sovKvrpcpb(uint64(m.CommitVersion)) + } + return n +} + +func (m *ResolveLockResponse) Size() (n int) { + var l int + _ = l + if m.RegionError != nil { + l = m.RegionError.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.Error != nil { + l = m.Error.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + return n +} + +func (m *GCRequest) Size() (n int) { + var l int + _ = l + if m.Context != nil { + l = m.Context.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.SafePoint != 0 { + n += 1 + sovKvrpcpb(uint64(m.SafePoint)) + } + return n +} + +func (m *GCResponse) Size() (n int) { + var l int + _ = l + if m.RegionError != nil { + l = m.RegionError.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.Error != nil { + l = m.Error.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + return n +} + +func (m *RawGetRequest) Size() (n int) { + var l int + _ = l + if m.Context != nil { + l = m.Context.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.Key) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + return n +} + +func (m *RawGetResponse) Size() (n int) { + var l int + _ = l + if m.RegionError != nil { + l = m.RegionError.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.Error) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + return n +} + +func (m *RawPutRequest) Size() (n int) { + var l int + _ = l + if m.Context != nil { + l = m.Context.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.Key) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + return n +} + +func (m *RawPutResponse) Size() (n int) { + var l int + _ = l + if m.RegionError != nil { + l = m.RegionError.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.Error) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + return n +} + +func (m *RawDeleteRequest) Size() (n int) { + var l int + _ = l + if m.Context != nil { + l = m.Context.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.Key) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + return n +} + +func (m *RawDeleteResponse) Size() (n int) { + var l int + _ = l + if m.RegionError != nil { + l = m.RegionError.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.Error) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + return n +} + +func (m *DeleteRangeRequest) Size() (n int) { + var l int + _ = l + if m.Context != nil { + l = m.Context.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.StartKey) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.EndKey) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + return n +} + +func (m *DeleteRangeResponse) Size() (n int) { + var l int + _ = l + if m.RegionError != nil { + l = m.RegionError.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.Error) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + return n +} + +func (m *RawScanRequest) Size() (n int) { + var l int + _ = l + if m.Context != nil { + l = m.Context.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.StartKey) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.Limit != 0 { + n += 1 + sovKvrpcpb(uint64(m.Limit)) + } + return n +} + +func (m *RawScanResponse) Size() (n int) { + var l int + _ = l + if m.RegionError != nil { + l = m.RegionError.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if len(m.Kvs) > 0 { + for _, e := range m.Kvs { + l = e.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + } + return n +} + +func (m *WriteInfo) Size() (n int) { + var l int + _ = l + if m.StartTs != 0 { + n += 1 + sovKvrpcpb(uint64(m.StartTs)) + } + if m.Type != 0 { + n += 1 + sovKvrpcpb(uint64(m.Type)) + } + if m.CommitTs != 0 { + n += 1 + sovKvrpcpb(uint64(m.CommitTs)) + } + return n +} + +func (m *ValueInfo) Size() (n int) { + var l int + _ = l + l = len(m.Value) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.Ts != 0 { + n += 1 + sovKvrpcpb(uint64(m.Ts)) + } + if m.IsShortValue { + n += 2 + } + return n +} + +func (m *MvccInfo) Size() (n int) { + var l int + _ = l + if m.Lock != nil { + l = m.Lock.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if len(m.Writes) > 0 { + for _, e := range m.Writes { + l = e.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + } + if len(m.Values) > 0 { + for _, e := range m.Values { + l = e.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + } + return n +} + +func (m *MvccGetByKeyRequest) Size() (n int) { + var l int + _ = l + if m.Context != nil { + l = m.Context.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.Key) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + return n +} + +func (m *MvccGetByKeyResponse) Size() (n int) { + var l int + _ = l + if m.RegionError != nil { + l = m.RegionError.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.Error) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.Info != nil { + l = m.Info.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + return n +} + +func (m *MvccGetByStartTsRequest) Size() (n int) { + var l int + _ = l + if m.Context != nil { + l = m.Context.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.StartTs != 0 { + n += 1 + sovKvrpcpb(uint64(m.StartTs)) + } + return n +} + +func (m *MvccGetByStartTsResponse) Size() (n int) { + var l int + _ = l + if m.RegionError != nil { + l = m.RegionError.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.Error) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + l = len(m.Key) + if l > 0 { + n += 1 + l + sovKvrpcpb(uint64(l)) + } + if m.Info != nil { + l = m.Info.Size() + n += 1 + l + sovKvrpcpb(uint64(l)) + } + return n +} + +func sovKvrpcpb(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozKvrpcpb(x uint64) (n int) { + return sovKvrpcpb(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *LockInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LockInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LockInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PrimaryLock", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PrimaryLock = append(m.PrimaryLock[:0], dAtA[iNdEx:postIndex]...) + if m.PrimaryLock == nil { + m.PrimaryLock = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LockVersion", wireType) + } + m.LockVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LockVersion |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LockTtl", wireType) + } + m.LockTtl = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LockTtl |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *KeyError) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: KeyError: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: KeyError: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Locked", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Locked == nil { + m.Locked = &LockInfo{} + } + if err := m.Locked.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Retryable", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Retryable = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Abort", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Abort = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Context) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Context: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Context: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionId", wireType) + } + m.RegionId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RegionId |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionEpoch", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionEpoch == nil { + m.RegionEpoch = &metapb.RegionEpoch{} + } + if err := m.RegionEpoch.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Peer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Peer == nil { + m.Peer = &metapb.Peer{} + } + if err := m.Peer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) + } + m.Term = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Term |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Priority", wireType) + } + m.Priority = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Priority |= (CommandPri(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsolationLevel", wireType) + } + m.IsolationLevel = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.IsolationLevel |= (IsolationLevel(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Context == nil { + m.Context = &Context{} + } + if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionError == nil { + m.RegionError = &errorpb.Error{} + } + if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Error == nil { + m.Error = &KeyError{} + } + if err := m.Error.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ScanRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ScanRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ScanRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Context == nil { + m.Context = &Context{} + } + if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StartKey = append(m.StartKey[:0], dAtA[iNdEx:postIndex]...) + if m.StartKey == nil { + m.StartKey = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) + } + m.Limit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Limit |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field KeyOnly", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.KeyOnly = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *KvPair) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: KvPair: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: KvPair: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Error == nil { + m.Error = &KeyError{} + } + if err := m.Error.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ScanResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ScanResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ScanResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionError == nil { + m.RegionError = &errorpb.Error{} + } + if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pairs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Pairs = append(m.Pairs, &KvPair{}) + if err := m.Pairs[len(m.Pairs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Mutation) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Mutation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Mutation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) + } + m.Op = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Op |= (Op(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PrewriteRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PrewriteRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PrewriteRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Context == nil { + m.Context = &Context{} + } + if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Mutations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Mutations = append(m.Mutations, &Mutation{}) + if err := m.Mutations[len(m.Mutations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PrimaryLock", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PrimaryLock = append(m.PrimaryLock[:0], dAtA[iNdEx:postIndex]...) + if m.PrimaryLock == nil { + m.PrimaryLock = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartVersion", wireType) + } + m.StartVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartVersion |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LockTtl", wireType) + } + m.LockTtl = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LockTtl |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SkipConstraintCheck", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.SkipConstraintCheck = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PrewriteResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PrewriteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PrewriteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionError == nil { + m.RegionError = &errorpb.Error{} + } + if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Errors", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Errors = append(m.Errors, &KeyError{}) + if err := m.Errors[len(m.Errors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CommitRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CommitRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommitRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Context == nil { + m.Context = &Context{} + } + if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartVersion", wireType) + } + m.StartVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartVersion |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Keys", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Keys = append(m.Keys, make([]byte, postIndex-iNdEx)) + copy(m.Keys[len(m.Keys)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CommitVersion", wireType) + } + m.CommitVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CommitVersion |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CommitResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CommitResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommitResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionError == nil { + m.RegionError = &errorpb.Error{} + } + if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Error == nil { + m.Error = &KeyError{} + } + if err := m.Error.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ImportRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ImportRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ImportRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Mutations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Mutations = append(m.Mutations, &Mutation{}) + if err := m.Mutations[len(m.Mutations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CommitVersion", wireType) + } + m.CommitVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CommitVersion |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ImportResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ImportResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ImportResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionError == nil { + m.RegionError = &errorpb.Error{} + } + if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Error = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BatchRollbackRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BatchRollbackRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BatchRollbackRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Context == nil { + m.Context = &Context{} + } + if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartVersion", wireType) + } + m.StartVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartVersion |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Keys", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Keys = append(m.Keys, make([]byte, postIndex-iNdEx)) + copy(m.Keys[len(m.Keys)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BatchRollbackResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BatchRollbackResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BatchRollbackResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionError == nil { + m.RegionError = &errorpb.Error{} + } + if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Error == nil { + m.Error = &KeyError{} + } + if err := m.Error.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CleanupRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CleanupRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CleanupRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Context == nil { + m.Context = &Context{} + } + if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartVersion", wireType) + } + m.StartVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartVersion |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CleanupResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CleanupResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CleanupResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionError == nil { + m.RegionError = &errorpb.Error{} + } + if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Error == nil { + m.Error = &KeyError{} + } + if err := m.Error.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CommitVersion", wireType) + } + m.CommitVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CommitVersion |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BatchGetRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BatchGetRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BatchGetRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Context == nil { + m.Context = &Context{} + } + if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Keys", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Keys = append(m.Keys, make([]byte, postIndex-iNdEx)) + copy(m.Keys[len(m.Keys)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BatchGetResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BatchGetResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BatchGetResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionError == nil { + m.RegionError = &errorpb.Error{} + } + if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pairs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Pairs = append(m.Pairs, &KvPair{}) + if err := m.Pairs[len(m.Pairs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ScanLockRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ScanLockRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ScanLockRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Context == nil { + m.Context = &Context{} + } + if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxVersion", wireType) + } + m.MaxVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxVersion |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ScanLockResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ScanLockResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ScanLockResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionError == nil { + m.RegionError = &errorpb.Error{} + } + if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Error == nil { + m.Error = &KeyError{} + } + if err := m.Error.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Locks", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Locks = append(m.Locks, &LockInfo{}) + if err := m.Locks[len(m.Locks)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResolveLockRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResolveLockRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResolveLockRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Context == nil { + m.Context = &Context{} + } + if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartVersion", wireType) + } + m.StartVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartVersion |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CommitVersion", wireType) + } + m.CommitVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CommitVersion |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResolveLockResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResolveLockResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResolveLockResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionError == nil { + m.RegionError = &errorpb.Error{} + } + if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Error == nil { + m.Error = &KeyError{} + } + if err := m.Error.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GCRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GCRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GCRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Context == nil { + m.Context = &Context{} + } + if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SafePoint", wireType) + } + m.SafePoint = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SafePoint |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GCResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GCResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GCResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionError == nil { + m.RegionError = &errorpb.Error{} + } + if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Error == nil { + m.Error = &KeyError{} + } + if err := m.Error.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RawGetRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RawGetRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RawGetRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Context == nil { + m.Context = &Context{} + } + if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RawGetResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RawGetResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RawGetResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionError == nil { + m.RegionError = &errorpb.Error{} + } + if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Error = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RawPutRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RawPutRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RawPutRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Context == nil { + m.Context = &Context{} + } + if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RawPutResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RawPutResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RawPutResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionError == nil { + m.RegionError = &errorpb.Error{} + } + if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Error = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RawDeleteRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RawDeleteRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RawDeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Context == nil { + m.Context = &Context{} + } + if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RawDeleteResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RawDeleteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RawDeleteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionError == nil { + m.RegionError = &errorpb.Error{} + } + if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Error = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteRangeRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteRangeRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteRangeRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Context == nil { + m.Context = &Context{} + } + if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StartKey = append(m.StartKey[:0], dAtA[iNdEx:postIndex]...) + if m.StartKey == nil { + m.StartKey = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EndKey = append(m.EndKey[:0], dAtA[iNdEx:postIndex]...) + if m.EndKey == nil { + m.EndKey = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteRangeResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteRangeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteRangeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionError == nil { + m.RegionError = &errorpb.Error{} + } + if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Error = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RawScanRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RawScanRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RawScanRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Context == nil { + m.Context = &Context{} + } + if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StartKey = append(m.StartKey[:0], dAtA[iNdEx:postIndex]...) + if m.StartKey == nil { + m.StartKey = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) + } + m.Limit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Limit |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RawScanResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RawScanResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RawScanResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionError == nil { + m.RegionError = &errorpb.Error{} + } + if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Kvs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Kvs = append(m.Kvs, &KvPair{}) + if err := m.Kvs[len(m.Kvs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WriteInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WriteInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WriteInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartTs", wireType) + } + m.StartTs = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartTs |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= (Op(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CommitTs", wireType) + } + m.CommitTs = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CommitTs |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ValueInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ValueInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValueInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Ts", wireType) + } + m.Ts = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Ts |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsShortValue", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.IsShortValue = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MvccInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MvccInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MvccInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Lock", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Lock == nil { + m.Lock = &LockInfo{} + } + if err := m.Lock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Writes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Writes = append(m.Writes, &WriteInfo{}) + if err := m.Writes[len(m.Writes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Values = append(m.Values, &ValueInfo{}) + if err := m.Values[len(m.Values)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MvccGetByKeyRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MvccGetByKeyRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MvccGetByKeyRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Context == nil { + m.Context = &Context{} + } + if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MvccGetByKeyResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MvccGetByKeyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MvccGetByKeyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionError == nil { + m.RegionError = &errorpb.Error{} + } + if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Error = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Info == nil { + m.Info = &MvccInfo{} + } + if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MvccGetByStartTsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MvccGetByStartTsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MvccGetByStartTsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Context == nil { + m.Context = &Context{} + } + if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartTs", wireType) + } + m.StartTs = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartTs |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MvccGetByStartTsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MvccGetByStartTsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MvccGetByStartTsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionError == nil { + m.RegionError = &errorpb.Error{} + } + if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Error = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthKvrpcpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Info == nil { + m.Info = &MvccInfo{} + } + if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipKvrpcpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthKvrpcpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipKvrpcpb(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthKvrpcpb + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipKvrpcpb(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthKvrpcpb = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowKvrpcpb = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("kvrpcpb.proto", fileDescriptorKvrpcpb) } + +var fileDescriptorKvrpcpb = []byte{ + // 1445 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x5f, 0x8f, 0xdb, 0x44, + 0x10, 0xaf, 0x1d, 0x27, 0x71, 0x26, 0xff, 0xdc, 0xbd, 0xab, 0x9a, 0xb6, 0x70, 0x4d, 0x0d, 0xa7, + 0x5e, 0x0f, 0x29, 0x15, 0x41, 0xe2, 0x19, 0x35, 0xad, 0xca, 0xf5, 0x5a, 0x2e, 0xda, 0xab, 0xae, + 0xaa, 0x84, 0x1a, 0x7c, 0xce, 0x36, 0xb1, 0xec, 0x78, 0x5d, 0x7b, 0x93, 0xab, 0x85, 0x10, 0x4f, + 0x20, 0x21, 0xf1, 0x88, 0x04, 0x42, 0xbc, 0xf0, 0xc8, 0x37, 0xe1, 0x91, 0x8f, 0x80, 0xca, 0x17, + 0x41, 0xbb, 0xfe, 0x97, 0x5c, 0x52, 0x38, 0x59, 0x69, 0x9e, 0x92, 0x9d, 0x99, 0xdd, 0x99, 0xdf, + 0xcc, 0x6f, 0x67, 0xbd, 0x0b, 0x75, 0x7b, 0xe6, 0x7b, 0xa6, 0x77, 0xda, 0xf1, 0x7c, 0xca, 0x28, + 0x2a, 0xc7, 0xc3, 0xeb, 0xb5, 0x09, 0x61, 0x46, 0x22, 0xbe, 0x5e, 0x27, 0xbe, 0x4f, 0xfd, 0x74, + 0xb8, 0x3d, 0xa2, 0x23, 0x2a, 0xfe, 0xde, 0xe5, 0xff, 0x22, 0xa9, 0xfe, 0x0d, 0xa8, 0x8f, 0xa9, + 0x69, 0x1f, 0xb8, 0x2f, 0x29, 0xba, 0x05, 0x35, 0xcf, 0xb7, 0x26, 0x86, 0x1f, 0x0e, 0x1c, 0x6a, + 0xda, 0x2d, 0xa9, 0x2d, 0xed, 0xd5, 0x70, 0x35, 0x96, 0x71, 0x33, 0x6e, 0xc2, 0x55, 0x83, 0x19, + 0xf1, 0x03, 0x8b, 0xba, 0x2d, 0xb9, 0x2d, 0xed, 0x29, 0xb8, 0xca, 0x65, 0x27, 0x91, 0x08, 0x69, + 0x50, 0xb0, 0x49, 0xd8, 0x2a, 0x88, 0xc9, 0xfc, 0x2f, 0xba, 0x06, 0xaa, 0x98, 0xc4, 0x98, 0xd3, + 0x52, 0xc4, 0x84, 0x32, 0x1f, 0x3f, 0x65, 0x8e, 0x6e, 0x81, 0x7a, 0x48, 0xc2, 0x07, 0x3c, 0x50, + 0x74, 0x07, 0x4a, 0x5c, 0x4c, 0x86, 0xc2, 0x71, 0xb5, 0x7b, 0xb9, 0x93, 0xc0, 0x4c, 0x22, 0xc4, + 0xb1, 0x01, 0x7a, 0x0f, 0x2a, 0x3e, 0x61, 0x7e, 0x68, 0x9c, 0x3a, 0x44, 0xc4, 0x50, 0xc1, 0x99, + 0x00, 0x6d, 0x43, 0xd1, 0x38, 0xa5, 0x3e, 0x13, 0x31, 0x54, 0x70, 0x34, 0xd0, 0x7f, 0x95, 0xa1, + 0xdc, 0xa3, 0x2e, 0x23, 0xaf, 0x19, 0xba, 0xc1, 0xe7, 0x8f, 0x2c, 0xea, 0x0e, 0xac, 0xc8, 0x9b, + 0x82, 0xd5, 0x48, 0x70, 0x30, 0x44, 0x9f, 0x42, 0x2d, 0x56, 0x12, 0x8f, 0x9a, 0x63, 0xb1, 0x7e, + 0xb5, 0xbb, 0xd5, 0x89, 0x93, 0x8b, 0x85, 0xee, 0x01, 0x57, 0xe1, 0xaa, 0x9f, 0x0d, 0x50, 0x1b, + 0x14, 0x8f, 0x10, 0x5f, 0x78, 0xad, 0x76, 0x6b, 0x89, 0x7d, 0x9f, 0x10, 0x1f, 0x0b, 0x0d, 0x42, + 0xa0, 0x30, 0xe2, 0x4f, 0x5a, 0x45, 0xe1, 0x51, 0xfc, 0x47, 0x77, 0x41, 0xf5, 0x7c, 0x8b, 0xfa, + 0x16, 0x0b, 0x5b, 0xa5, 0xb6, 0xb4, 0xd7, 0xe8, 0x6e, 0xa5, 0xb8, 0x7b, 0x74, 0x32, 0x31, 0xdc, + 0x61, 0xdf, 0xb7, 0x70, 0x6a, 0x84, 0x3e, 0x83, 0xa6, 0x15, 0x50, 0xc7, 0x60, 0x3c, 0x42, 0x87, + 0xcc, 0x88, 0xd3, 0x2a, 0x8b, 0x79, 0x57, 0xd3, 0x79, 0x07, 0x89, 0xfe, 0x31, 0x57, 0xe3, 0x86, + 0xb5, 0x30, 0x7e, 0xa4, 0xa8, 0x8a, 0x56, 0xe4, 0xb1, 0x1b, 0xc3, 0xc1, 0xab, 0x29, 0xf5, 0xa7, + 0x13, 0x7d, 0x08, 0xf0, 0x90, 0x30, 0x4c, 0x5e, 0x4d, 0x49, 0xc0, 0xd0, 0x3e, 0x94, 0xcd, 0x28, + 0x53, 0x71, 0x29, 0xb4, 0xb9, 0x90, 0x84, 0x1c, 0x27, 0x06, 0x49, 0xb9, 0xe5, 0xac, 0xdc, 0x2d, + 0x28, 0x27, 0xf4, 0x28, 0x44, 0xd5, 0x8e, 0x87, 0xfa, 0xb7, 0x50, 0x15, 0x5e, 0x02, 0x8f, 0xba, + 0x01, 0x41, 0x1f, 0x67, 0x89, 0xe6, 0x04, 0x88, 0x7d, 0x35, 0x3a, 0x09, 0x6f, 0x05, 0x2d, 0xd2, + 0x1c, 0x0b, 0x8e, 0xdc, 0x86, 0x62, 0x64, 0x2b, 0x9f, 0xa3, 0x48, 0xc2, 0x22, 0x1c, 0xe9, 0x39, + 0x07, 0x66, 0x86, 0x33, 0x25, 0x31, 0x0f, 0xa3, 0x81, 0xfe, 0xbb, 0x04, 0xd5, 0x63, 0xd3, 0x70, + 0xf3, 0x00, 0xbd, 0x01, 0x95, 0x80, 0x19, 0x3e, 0x1b, 0x64, 0x70, 0x55, 0x21, 0x38, 0x24, 0x21, + 0x77, 0xe7, 0x58, 0x13, 0x2b, 0xa2, 0x5c, 0x1d, 0x47, 0x83, 0xf9, 0x4c, 0x28, 0x0b, 0x99, 0xe0, + 0x5b, 0xc2, 0x26, 0xe1, 0x80, 0xba, 0x4e, 0x28, 0xd8, 0xa0, 0xe2, 0xb2, 0x4d, 0xc2, 0x23, 0xd7, + 0x09, 0xf5, 0xe7, 0x50, 0x3a, 0x9c, 0xf5, 0x0d, 0x6b, 0x0e, 0xac, 0xf4, 0x3f, 0x60, 0x97, 0x6b, + 0xb0, 0x1a, 0xfe, 0x18, 0x6a, 0x11, 0xfa, 0xfc, 0x05, 0xd8, 0x85, 0xa2, 0x67, 0x58, 0x7e, 0xd0, + 0x92, 0xdb, 0x85, 0xbd, 0x6a, 0xb7, 0x99, 0xc5, 0x24, 0x62, 0xc6, 0x91, 0x56, 0x3f, 0x02, 0xf5, + 0xc9, 0x94, 0x09, 0xce, 0xa1, 0x1b, 0x20, 0x53, 0x4f, 0xac, 0xdd, 0xe8, 0x56, 0x53, 0xfb, 0x23, + 0x0f, 0xcb, 0xd4, 0xbb, 0x70, 0xe8, 0xdf, 0xc9, 0xd0, 0xec, 0xfb, 0xe4, 0xcc, 0xb7, 0x18, 0xc9, + 0x53, 0xbd, 0xbb, 0x50, 0x99, 0xc4, 0x01, 0x25, 0xb1, 0x67, 0xf9, 0x4c, 0x42, 0xc5, 0x99, 0xcd, + 0x52, 0x33, 0x2c, 0x2c, 0x37, 0xc3, 0x0f, 0xa0, 0x1e, 0x31, 0x62, 0xb1, 0xc8, 0x35, 0x21, 0x3c, + 0xc9, 0x2a, 0x9d, 0x36, 0xbf, 0xe2, 0x42, 0xf3, 0x43, 0x5d, 0xb8, 0x12, 0xd8, 0x96, 0x37, 0x30, + 0xa9, 0x1b, 0x30, 0xdf, 0xb0, 0x5c, 0x36, 0x30, 0xc7, 0xc4, 0xb4, 0x45, 0x1f, 0x50, 0xf1, 0x16, + 0x57, 0xf6, 0x52, 0x5d, 0x8f, 0xab, 0x74, 0x0f, 0xb4, 0x2c, 0x0d, 0xf9, 0xcb, 0x78, 0x07, 0x4a, + 0x42, 0xbb, 0x9c, 0x8b, 0x94, 0x5b, 0xb1, 0x81, 0xfe, 0x87, 0x04, 0x75, 0xde, 0x88, 0xac, 0x5c, + 0xed, 0x61, 0x29, 0x47, 0xf2, 0x8a, 0x1c, 0x21, 0x50, 0x6c, 0x12, 0x06, 0xad, 0x42, 0xbb, 0xb0, + 0x57, 0xc3, 0xe2, 0x3f, 0xda, 0x85, 0x86, 0x29, 0xbc, 0x9e, 0xcb, 0x6e, 0x3d, 0x92, 0xc6, 0x53, + 0x1f, 0x29, 0x6a, 0x51, 0x2b, 0xe1, 0xd2, 0xa9, 0xe5, 0x3a, 0x74, 0xa4, 0x3b, 0xd0, 0x48, 0x42, + 0x7d, 0xf7, 0x3d, 0x46, 0x1f, 0x41, 0xfd, 0x60, 0xe2, 0x51, 0x3f, 0x4d, 0xcc, 0x02, 0xc9, 0xa4, + 0x0b, 0x90, 0x6c, 0x19, 0xa4, 0xbc, 0x02, 0xa4, 0xfe, 0x1c, 0x1a, 0x89, 0xa3, 0xfc, 0xb0, 0xb6, + 0xe7, 0x61, 0x55, 0x12, 0x0c, 0x5f, 0xc3, 0xf6, 0x3d, 0x83, 0x99, 0x63, 0x4c, 0x1d, 0xe7, 0xd4, + 0x30, 0xed, 0x4d, 0xd6, 0x58, 0x0f, 0xe0, 0xca, 0x39, 0xe7, 0x1b, 0xa8, 0x5a, 0x00, 0x8d, 0x9e, + 0x43, 0x0c, 0x77, 0xea, 0xad, 0xe7, 0xb8, 0x5b, 0x42, 0x5f, 0x58, 0x46, 0xaf, 0xff, 0x24, 0x41, + 0x33, 0xf5, 0xba, 0x81, 0xe3, 0x6f, 0x99, 0x58, 0x85, 0x55, 0xc4, 0xb2, 0xa1, 0x29, 0x0a, 0x90, + 0xf3, 0xec, 0x4f, 0x6a, 0x2a, 0xcf, 0xed, 0xdb, 0xb7, 0x9f, 0xfe, 0x0e, 0x68, 0x99, 0xb3, 0x77, + 0x7e, 0x02, 0xbd, 0x80, 0x26, 0x3f, 0xeb, 0x78, 0xa3, 0xce, 0x03, 0xed, 0x26, 0x54, 0x27, 0xc6, + 0xeb, 0x73, 0x8c, 0x86, 0x89, 0xf1, 0x3a, 0x49, 0xdd, 0xcf, 0x12, 0x68, 0x99, 0x83, 0x0d, 0x94, + 0xf4, 0x36, 0x14, 0xf9, 0xc1, 0x11, 0xed, 0xa0, 0x95, 0x5f, 0xc7, 0x91, 0x5e, 0xff, 0x51, 0x02, + 0x84, 0x49, 0x40, 0x9d, 0x19, 0xc9, 0x8b, 0xfe, 0x42, 0x3b, 0xfa, 0x82, 0x1c, 0x7b, 0x05, 0x5b, + 0x0b, 0xd1, 0x6c, 0x60, 0x8b, 0x9f, 0x40, 0xe5, 0x61, 0x2f, 0x0f, 0xee, 0xf7, 0x01, 0x02, 0xe3, + 0x25, 0x19, 0x78, 0xd4, 0x72, 0x59, 0x0c, 0xba, 0xc2, 0x25, 0x7d, 0x2e, 0xd0, 0xc7, 0x00, 0x7c, + 0xdd, 0x0d, 0x20, 0x78, 0x02, 0x75, 0x6c, 0x9c, 0xad, 0xeb, 0x93, 0x5c, 0xa7, 0xd0, 0x48, 0x96, + 0x5b, 0xf3, 0x01, 0xf2, 0x96, 0xcf, 0x35, 0x53, 0xc4, 0xdf, 0x9f, 0xae, 0xe9, 0x4a, 0xb1, 0xda, + 0xc9, 0x73, 0x81, 0x4a, 0x38, 0x59, 0xf7, 0xb1, 0xd8, 0x07, 0x0d, 0x1b, 0x67, 0xf7, 0x89, 0x43, + 0xf2, 0x7d, 0x6e, 0x2e, 0x97, 0xe0, 0x4b, 0xb8, 0x3c, 0xb7, 0xe2, 0xba, 0xe3, 0x9d, 0x01, 0x8a, + 0x97, 0x36, 0xdc, 0x11, 0x59, 0xfb, 0xf5, 0xe6, 0x2a, 0x94, 0x89, 0x3b, 0x1c, 0x64, 0xf7, 0xfa, + 0x12, 0x71, 0x87, 0x87, 0x24, 0xd4, 0x5f, 0xc0, 0xd6, 0x82, 0xdf, 0x75, 0xe3, 0x8a, 0x88, 0xbb, + 0xb9, 0x2b, 0x9b, 0x3e, 0x82, 0x66, 0xea, 0x30, 0x3f, 0x98, 0x5b, 0x50, 0xb0, 0x67, 0x6f, 0x3d, + 0xa1, 0xb8, 0x4e, 0x1f, 0x42, 0xe5, 0x19, 0xff, 0x8a, 0x17, 0x2f, 0x2f, 0xd7, 0x20, 0x8a, 0x6b, + 0xc0, 0x82, 0xf8, 0x39, 0xa2, 0x2c, 0xc6, 0x4f, 0x03, 0x74, 0x13, 0x14, 0x16, 0x7a, 0xd1, 0x2b, + 0xc7, 0xb9, 0xfb, 0x93, 0x50, 0x70, 0x90, 0x71, 0x1b, 0x66, 0x41, 0xdc, 0x81, 0xd5, 0x48, 0xf0, + 0x34, 0xd0, 0x9f, 0x41, 0xe5, 0x84, 0xef, 0x15, 0xe1, 0x25, 0xdd, 0x45, 0xd2, 0xdc, 0x2e, 0x42, + 0x0d, 0x90, 0x59, 0x10, 0xf7, 0x3a, 0x99, 0x05, 0xe8, 0x43, 0x68, 0x58, 0xc1, 0x20, 0x18, 0x53, + 0xde, 0xfe, 0xd3, 0x4d, 0xa7, 0xe2, 0x9a, 0x15, 0x1c, 0x73, 0xa1, 0x58, 0x4f, 0xff, 0x41, 0x02, + 0xf5, 0xc9, 0xcc, 0x34, 0xc5, 0xc2, 0xbb, 0xa0, 0xa4, 0x0f, 0x46, 0x2b, 0x4f, 0x26, 0xa1, 0x46, + 0xfb, 0x50, 0x12, 0x17, 0x97, 0x24, 0x31, 0x28, 0x35, 0x4c, 0x33, 0x81, 0x63, 0x0b, 0x6e, 0x2b, + 0x9c, 0x27, 0xc7, 0x5d, 0x66, 0x9b, 0xe2, 0xc1, 0xb1, 0x85, 0x7e, 0x0c, 0x5b, 0x3c, 0x94, 0x87, + 0x84, 0xdd, 0x0b, 0x0f, 0x49, 0xb8, 0x9e, 0xfd, 0xfa, 0xbd, 0x04, 0xdb, 0x8b, 0xab, 0xae, 0xbb, + 0x73, 0xee, 0x82, 0x62, 0xb9, 0x2f, 0x69, 0xfc, 0x5e, 0x34, 0x77, 0x51, 0x88, 0xd3, 0x8a, 0x85, + 0x5a, 0xff, 0x0a, 0xae, 0xa6, 0x71, 0x1c, 0x47, 0xa4, 0xc8, 0x83, 0x70, 0x9e, 0x62, 0xf2, 0x02, + 0xc5, 0xf4, 0xdf, 0x24, 0x68, 0x2d, 0xbb, 0x58, 0x37, 0xdc, 0xe5, 0x77, 0xc1, 0x24, 0x01, 0xca, + 0x7f, 0x26, 0x60, 0xff, 0x23, 0x80, 0xec, 0x21, 0x0c, 0x01, 0x94, 0xbe, 0xa0, 0xfe, 0xc4, 0x70, + 0xb4, 0x4b, 0xa8, 0x0c, 0x85, 0xc7, 0xf4, 0x4c, 0x93, 0x90, 0x0a, 0xca, 0xe7, 0xd6, 0x68, 0xac, + 0xc9, 0xfb, 0x6d, 0x68, 0x2c, 0xbe, 0x7e, 0xa1, 0x12, 0xc8, 0xc7, 0x07, 0xda, 0x25, 0xfe, 0x8b, + 0x7b, 0x9a, 0xb4, 0xdf, 0x01, 0xf9, 0xc8, 0xe3, 0x53, 0xfb, 0x53, 0x16, 0xad, 0x71, 0x9f, 0x38, + 0xd1, 0x1a, 0x9c, 0xaf, 0x9a, 0x8c, 0x6a, 0xa0, 0x26, 0x37, 0x12, 0xad, 0x70, 0x6f, 0xff, 0xcf, + 0x37, 0x3b, 0xd2, 0x5f, 0x6f, 0x76, 0xa4, 0xbf, 0xdf, 0xec, 0x48, 0xbf, 0xfc, 0xb3, 0x73, 0x09, + 0x5a, 0x26, 0x9d, 0x74, 0x3c, 0xcb, 0x1d, 0x99, 0x86, 0xd7, 0x61, 0x96, 0x3d, 0xeb, 0xd8, 0x33, + 0xf1, 0x9a, 0x7a, 0x5a, 0x12, 0x3f, 0x9f, 0xfc, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x76, 0x89, + 0x7e, 0xa1, 0x15, 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/metapb/metapb.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/metapb/metapb.pb.go index ed950209e5d..782798e0e30 100644 --- a/_vendor/src/github.com/pingcap/kvproto/pkg/metapb/metapb.pb.go +++ b/_vendor/src/github.com/pingcap/kvproto/pkg/metapb/metapb.pb.go @@ -1453,7 +1453,7 @@ func init() { proto.RegisterFile("metapb.proto", fileDescriptorMetapb) } var fileDescriptorMetapb = []byte{ // 463 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x52, 0xcd, 0x6e, 0xd3, 0x40, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x52, 0xcd, 0x6e, 0xd3, 0x40, 0x10, 0xce, 0xe6, 0xc7, 0x4e, 0xc6, 0x6e, 0x15, 0x2d, 0x15, 0x58, 0x45, 0x72, 0x2c, 0x9f, 0xac, 0x1c, 0x0c, 0xea, 0x81, 0x1b, 0x12, 0x6a, 0xc5, 0x01, 0x15, 0x01, 0x72, 0x81, 0xab, 0xe5, 0xd8, 0x93, 0x60, 0xc5, 0xf6, 0x5a, 0xbb, 0x1b, 0xab, 0x7d, 0x13, 0x78, 0x0b, 0x1e, 0xa3, 0x47, 0x9e, diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/pdpb/pdpb.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/pdpb/pdpb.pb.go index da0ede880a7..2039c377514 100644 --- a/_vendor/src/github.com/pingcap/kvproto/pkg/pdpb/pdpb.pb.go +++ b/_vendor/src/github.com/pingcap/kvproto/pkg/pdpb/pdpb.pb.go @@ -781,6 +781,8 @@ type RegionHeartbeatRequest struct { // Keys read/written during this period. KeysWritten uint64 `protobuf:"varint,8,opt,name=keys_written,json=keysWritten,proto3" json:"keys_written,omitempty"` KeysRead uint64 `protobuf:"varint,9,opt,name=keys_read,json=keysRead,proto3" json:"keys_read,omitempty"` + // Approximate region size. + ApproximateSize uint64 `protobuf:"varint,10,opt,name=approximate_size,json=approximateSize,proto3" json:"approximate_size,omitempty"` } func (m *RegionHeartbeatRequest) Reset() { *m = RegionHeartbeatRequest{} } @@ -851,6 +853,13 @@ func (m *RegionHeartbeatRequest) GetKeysRead() uint64 { return 0 } +func (m *RegionHeartbeatRequest) GetApproximateSize() uint64 { + if m != nil { + return m.ApproximateSize + } + return 0 +} + type ChangePeer struct { Peer *metapb.Peer `protobuf:"bytes,1,opt,name=peer" json:"peer,omitempty"` // FIXME: replace with actual ConfChangeType once eraftpb uses proto3. @@ -1097,6 +1106,10 @@ type StoreStats struct { BytesWritten uint64 `protobuf:"varint,11,opt,name=bytes_written,json=bytesWritten,proto3" json:"bytes_written,omitempty"` // Keys written for the store. KeysWritten uint64 `protobuf:"varint,12,opt,name=keys_written,json=keysWritten,proto3" json:"keys_written,omitempty"` + // Bytes read for the store. + BytesRead uint64 `protobuf:"varint,13,opt,name=bytes_read,json=bytesRead,proto3" json:"bytes_read,omitempty"` + // Keys read for the store. + KeysRead uint64 `protobuf:"varint,14,opt,name=keys_read,json=keysRead,proto3" json:"keys_read,omitempty"` } func (m *StoreStats) Reset() { *m = StoreStats{} } @@ -1188,6 +1201,20 @@ func (m *StoreStats) GetKeysWritten() uint64 { return 0 } +func (m *StoreStats) GetBytesRead() uint64 { + if m != nil { + return m.BytesRead + } + return 0 +} + +func (m *StoreStats) GetKeysRead() uint64 { + if m != nil { + return m.KeysRead + } + return 0 +} + type StoreHeartbeatRequest struct { Header *RequestHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` Stats *StoreStats `protobuf:"bytes,2,opt,name=stats" json:"stats,omitempty"` @@ -2909,6 +2936,11 @@ func (m *RegionHeartbeatRequest) MarshalTo(dAtA []byte) (int, error) { i++ i = encodeVarintPdpb(dAtA, i, uint64(m.KeysRead)) } + if m.ApproximateSize != 0 { + dAtA[i] = 0x50 + i++ + i = encodeVarintPdpb(dAtA, i, uint64(m.ApproximateSize)) + } return i, nil } @@ -3290,6 +3322,16 @@ func (m *StoreStats) MarshalTo(dAtA []byte) (int, error) { i++ i = encodeVarintPdpb(dAtA, i, uint64(m.KeysWritten)) } + if m.BytesRead != 0 { + dAtA[i] = 0x68 + i++ + i = encodeVarintPdpb(dAtA, i, uint64(m.BytesRead)) + } + if m.KeysRead != 0 { + dAtA[i] = 0x70 + i++ + i = encodeVarintPdpb(dAtA, i, uint64(m.KeysRead)) + } return i, nil } @@ -3788,6 +3830,9 @@ func (m *RegionHeartbeatRequest) Size() (n int) { if m.KeysRead != 0 { n += 1 + sovPdpb(uint64(m.KeysRead)) } + if m.ApproximateSize != 0 { + n += 1 + sovPdpb(uint64(m.ApproximateSize)) + } return n } @@ -3944,6 +3989,12 @@ func (m *StoreStats) Size() (n int) { if m.KeysWritten != 0 { n += 1 + sovPdpb(uint64(m.KeysWritten)) } + if m.BytesRead != 0 { + n += 1 + sovPdpb(uint64(m.BytesRead)) + } + if m.KeysRead != 0 { + n += 1 + sovPdpb(uint64(m.KeysRead)) + } return n } @@ -7115,6 +7166,25 @@ func (m *RegionHeartbeatRequest) Unmarshal(dAtA []byte) error { break } } + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ApproximateSize", wireType) + } + m.ApproximateSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ApproximateSize |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipPdpb(dAtA[iNdEx:]) @@ -8325,6 +8395,44 @@ func (m *StoreStats) Unmarshal(dAtA []byte) error { break } } + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BytesRead", wireType) + } + m.BytesRead = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BytesRead |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 14: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field KeysRead", wireType) + } + m.KeysRead = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.KeysRead |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipPdpb(dAtA[iNdEx:]) @@ -8653,113 +8761,115 @@ var ( func init() { proto.RegisterFile("pdpb.proto", fileDescriptorPdpb) } var fileDescriptorPdpb = []byte{ - // 1725 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x6e, 0x1b, 0xc9, - 0x11, 0xd6, 0xf0, 0x9f, 0xc5, 0x5f, 0xb7, 0x65, 0x69, 0x96, 0xb6, 0x14, 0x6d, 0x7b, 0x11, 0x38, - 0xce, 0x9a, 0xf1, 0x2a, 0x48, 0x10, 0x60, 0xb1, 0xc1, 0x52, 0x3f, 0x5e, 0x0b, 0x5e, 0x8b, 0x42, - 0x93, 0x8b, 0xc5, 0x5e, 0xc2, 0x0c, 0x39, 0x6d, 0x6a, 0x22, 0x72, 0x66, 0x76, 0xba, 0x29, 0x81, - 0x7b, 0xca, 0x29, 0x97, 0x04, 0x48, 0x4e, 0x41, 0x5e, 0x23, 0x0f, 0x90, 0x7b, 0x8e, 0x79, 0x84, - 0xc0, 0x79, 0x8b, 0x9c, 0x82, 0xfe, 0x99, 0xe1, 0xcc, 0x90, 0x72, 0x94, 0x71, 0xf6, 0xc4, 0xe9, - 0xaa, 0xea, 0xaf, 0xab, 0xbe, 0xae, 0xea, 0xee, 0x22, 0x80, 0x6f, 0xfb, 0xe3, 0xae, 0x1f, 0x78, - 0xdc, 0x43, 0x05, 0xf1, 0xdd, 0xa9, 0xcf, 0x29, 0xb7, 0x42, 0x59, 0x67, 0x7b, 0xea, 0x4d, 0x3d, - 0xf9, 0xf9, 0x13, 0xf1, 0xa5, 0xa4, 0xb8, 0x0b, 0x0d, 0x42, 0xbf, 0x5d, 0x50, 0xc6, 0x5f, 0x52, - 0xcb, 0xa6, 0x01, 0xda, 0x03, 0x98, 0xcc, 0x16, 0x8c, 0xd3, 0x60, 0xe4, 0xd8, 0xa6, 0x71, 0x60, - 0x3c, 0x29, 0x90, 0xaa, 0x96, 0x9c, 0xd9, 0x98, 0x40, 0x93, 0x50, 0xe6, 0x7b, 0x2e, 0xa3, 0x77, - 0x9a, 0x80, 0x3e, 0x84, 0x22, 0x0d, 0x02, 0x2f, 0x30, 0x73, 0x07, 0xc6, 0x93, 0xda, 0x61, 0xad, - 0x2b, 0xdd, 0x3c, 0x15, 0x22, 0xa2, 0x34, 0xf8, 0x05, 0x14, 0xe5, 0x18, 0x3d, 0x86, 0x02, 0x5f, - 0xfa, 0x54, 0x82, 0x34, 0x0f, 0x5b, 0x31, 0xd3, 0xe1, 0xd2, 0xa7, 0x44, 0x2a, 0x91, 0x09, 0xe5, - 0x39, 0x65, 0xcc, 0x9a, 0x52, 0x09, 0x59, 0x25, 0xe1, 0x10, 0xf7, 0x01, 0x86, 0xcc, 0xd3, 0xe1, - 0xa0, 0x1f, 0x43, 0xe9, 0x52, 0x7a, 0x28, 0xe1, 0x6a, 0x87, 0xf7, 0x15, 0x5c, 0x22, 0x5a, 0xa2, - 0x4d, 0xd0, 0x36, 0x14, 0x27, 0xde, 0xc2, 0xe5, 0x12, 0xb2, 0x41, 0xd4, 0x00, 0xf7, 0xa0, 0x3a, - 0x74, 0xe6, 0x94, 0x71, 0x6b, 0xee, 0xa3, 0x0e, 0x54, 0xfc, 0xcb, 0x25, 0x73, 0x26, 0xd6, 0x4c, - 0x22, 0xe6, 0x49, 0x34, 0x16, 0x3e, 0xcd, 0xbc, 0xa9, 0x54, 0xe5, 0xa4, 0x2a, 0x1c, 0xe2, 0xdf, - 0x1a, 0x50, 0x93, 0x4e, 0x29, 0xce, 0xd0, 0xc7, 0x29, 0xaf, 0xb6, 0x43, 0xaf, 0xe2, 0x9c, 0xbe, - 0xdb, 0x2d, 0xf4, 0x0c, 0xaa, 0x3c, 0x74, 0xcb, 0xcc, 0x4b, 0x18, 0xcd, 0x55, 0xe4, 0x2d, 0x59, - 0x59, 0xe0, 0x3f, 0x18, 0xd0, 0x3e, 0xf2, 0x3c, 0xce, 0x78, 0x60, 0xf9, 0x99, 0xd8, 0x79, 0x0c, - 0x45, 0xc6, 0xbd, 0x80, 0xea, 0x3d, 0x6c, 0x74, 0x75, 0x62, 0x0d, 0x84, 0x90, 0x28, 0x1d, 0xfa, - 0x21, 0x94, 0x02, 0x3a, 0x75, 0x3c, 0x57, 0xbb, 0xd4, 0x0c, 0xad, 0x88, 0x94, 0x12, 0xad, 0xc5, - 0x3d, 0xb8, 0x17, 0xf3, 0x26, 0x0b, 0x2d, 0xf8, 0x04, 0x1e, 0x9c, 0xb1, 0x08, 0xc4, 0xa7, 0x76, - 0x96, 0xa8, 0xf0, 0x6f, 0x60, 0x27, 0x8d, 0x92, 0x69, 0x93, 0x30, 0xd4, 0xc7, 0x31, 0x14, 0x49, - 0x52, 0x85, 0x24, 0x64, 0xf8, 0x33, 0x68, 0xf6, 0x66, 0x33, 0x6f, 0x72, 0x76, 0x92, 0xc9, 0xd5, - 0x3e, 0xb4, 0xa2, 0xe9, 0x99, 0x7c, 0x6c, 0x42, 0xce, 0x51, 0x9e, 0x15, 0x48, 0xce, 0xb1, 0xf1, - 0x37, 0xd0, 0xfa, 0x82, 0x72, 0xb5, 0x7f, 0x59, 0x32, 0xe2, 0x03, 0xa8, 0xc8, 0x5d, 0x1f, 0x45, - 0xa8, 0x65, 0x39, 0x3e, 0xb3, 0x31, 0x85, 0xf6, 0x0a, 0x3a, 0x93, 0xb3, 0x77, 0x49, 0x37, 0x3c, - 0x81, 0xd6, 0xc5, 0xe2, 0x3d, 0x22, 0xb8, 0xd3, 0x22, 0x9f, 0x43, 0x7b, 0xb5, 0x48, 0xa6, 0x54, - 0xfd, 0x95, 0x64, 0x43, 0x97, 0x40, 0x16, 0x3f, 0xf7, 0x00, 0x54, 0xe1, 0x8c, 0xae, 0xe8, 0x52, - 0x3a, 0x5b, 0x27, 0x55, 0x25, 0x79, 0x45, 0x97, 0xf8, 0x8f, 0x06, 0xdc, 0x8b, 0x2d, 0x90, 0x89, - 0xef, 0x55, 0xe5, 0xe6, 0xde, 0x55, 0xb9, 0xe8, 0x23, 0x28, 0xcd, 0x14, 0xaa, 0xaa, 0xf0, 0x7a, - 0x68, 0x77, 0x41, 0x05, 0x9a, 0xd2, 0xe1, 0x5f, 0xc3, 0x76, 0xe4, 0xd0, 0xd1, 0x32, 0x5b, 0xc2, - 0xa3, 0x87, 0xa0, 0x63, 0x5c, 0x25, 0x58, 0x45, 0x09, 0xce, 0x6c, 0xfc, 0x02, 0x76, 0xbf, 0xa0, - 0xfc, 0x58, 0x5d, 0x31, 0xc7, 0x9e, 0xfb, 0xc6, 0x99, 0x66, 0xaa, 0x2a, 0x06, 0xe6, 0x3a, 0x4e, - 0x26, 0x06, 0x7f, 0x04, 0x65, 0x7d, 0xe3, 0x69, 0x0a, 0x5b, 0x21, 0x35, 0x1a, 0x9d, 0x84, 0x7a, - 0xfc, 0x2d, 0xec, 0x5e, 0x2c, 0xde, 0xdf, 0xf9, 0xff, 0x65, 0xc9, 0x97, 0x60, 0xae, 0x2f, 0x99, - 0x29, 0x9b, 0x6f, 0xa0, 0xf4, 0x9a, 0xce, 0xc7, 0x34, 0x40, 0x08, 0x0a, 0xae, 0x35, 0x57, 0x57, - 0x75, 0x95, 0xc8, 0x6f, 0xb1, 0x69, 0x73, 0xa9, 0x8d, 0x6d, 0x9a, 0x12, 0x9c, 0xd9, 0x42, 0xe9, - 0x53, 0x1a, 0x8c, 0x16, 0xc1, 0x8c, 0x99, 0xf9, 0x83, 0xfc, 0x93, 0x2a, 0xa9, 0x08, 0xc1, 0x57, - 0xc1, 0x8c, 0xa1, 0x1f, 0x40, 0x6d, 0x32, 0x73, 0xa8, 0xcb, 0x95, 0xba, 0x20, 0xd5, 0xa0, 0x44, - 0xc2, 0x00, 0x7f, 0x2e, 0xb3, 0x5c, 0xad, 0xcd, 0x32, 0x6d, 0xf6, 0x9f, 0x0c, 0x40, 0x71, 0x88, - 0x8c, 0x95, 0x52, 0x56, 0x01, 0x31, 0x33, 0x77, 0x90, 0x97, 0x25, 0x20, 0xcd, 0x15, 0x2a, 0x09, - 0x95, 0x1b, 0x2a, 0x25, 0x6e, 0x16, 0x56, 0xca, 0x05, 0x54, 0x45, 0xe5, 0x0c, 0xb8, 0xc5, 0x19, - 0x3a, 0x80, 0x82, 0xa0, 0x43, 0xbb, 0x91, 0x2c, 0x2d, 0xa9, 0x41, 0x1f, 0x42, 0xdd, 0xf6, 0x6e, - 0xdc, 0x11, 0xa3, 0x13, 0xcf, 0xb5, 0x99, 0x66, 0xb8, 0x26, 0x64, 0x03, 0x25, 0xc2, 0xff, 0xce, - 0xc1, 0x8e, 0xaa, 0xbc, 0x97, 0xd4, 0x0a, 0xf8, 0x98, 0x5a, 0x3c, 0x53, 0x72, 0xfd, 0x5f, 0x4f, - 0x04, 0xd4, 0x05, 0x90, 0x8e, 0x8b, 0x28, 0xd4, 0xe6, 0x46, 0x0f, 0x96, 0x28, 0x7e, 0x52, 0x15, - 0x26, 0x62, 0xc8, 0xd0, 0x27, 0xd0, 0xf0, 0xa9, 0x6b, 0x3b, 0xee, 0x54, 0x4f, 0x29, 0x6a, 0xae, - 0xe3, 0xe0, 0x75, 0x6d, 0xa2, 0xa6, 0x3c, 0x86, 0xc6, 0x78, 0xc9, 0x29, 0x1b, 0xdd, 0x04, 0x0e, - 0xe7, 0xd4, 0x35, 0x4b, 0x92, 0x9c, 0xba, 0x14, 0x7e, 0xad, 0x64, 0xe2, 0x28, 0x55, 0x46, 0x01, - 0xb5, 0x6c, 0xb3, 0xac, 0x5e, 0xaa, 0x52, 0x42, 0xa8, 0x25, 0x5e, 0xaa, 0xf5, 0x2b, 0xba, 0x5c, - 0x41, 0x54, 0x14, 0xbf, 0x42, 0x16, 0x22, 0x3c, 0x84, 0xaa, 0x34, 0x91, 0x00, 0x55, 0x95, 0xe1, - 0x42, 0x20, 0xe6, 0x63, 0x0a, 0x70, 0x7c, 0x69, 0xb9, 0x53, 0x2a, 0x5c, 0xba, 0xc3, 0x7e, 0xfe, - 0x0c, 0x6a, 0x13, 0x69, 0x3f, 0x92, 0x8f, 0xde, 0x9c, 0x7c, 0xf4, 0xea, 0xfc, 0x13, 0x55, 0xaa, - 0xc0, 0xe4, 0xcb, 0x17, 0x26, 0xd1, 0x37, 0x3e, 0x84, 0xe6, 0x30, 0xb0, 0x5c, 0xf6, 0x86, 0x06, - 0x5f, 0x2a, 0x7e, 0xff, 0xeb, 0x52, 0xf8, 0x6f, 0x39, 0xd8, 0x5d, 0xcb, 0x8b, 0x4c, 0x15, 0xf0, - 0x49, 0xe4, 0xb4, 0x5c, 0x52, 0xa5, 0x47, 0x5b, 0x3b, 0x1d, 0x45, 0x1f, 0x3a, 0x2c, 0x99, 0xf8, - 0x0c, 0x5a, 0x5c, 0x3b, 0x3c, 0x4a, 0x64, 0x8b, 0x5e, 0x29, 0x19, 0x0d, 0x69, 0xf2, 0x64, 0x74, - 0x89, 0xab, 0xa0, 0x90, 0xbc, 0x0a, 0xd0, 0xcf, 0xa1, 0xae, 0x95, 0xd4, 0xf7, 0x26, 0x97, 0x66, - 0x51, 0xe7, 0x76, 0x22, 0x5d, 0x4f, 0x85, 0x8a, 0xd4, 0x82, 0xd5, 0x00, 0x3d, 0x83, 0x1a, 0xb7, - 0x82, 0x29, 0xe5, 0x2a, 0x8c, 0xd2, 0x06, 0xe6, 0x40, 0x19, 0x88, 0x6f, 0xfc, 0x06, 0x5a, 0x3d, - 0x76, 0x35, 0xf0, 0x67, 0xce, 0xf7, 0x5a, 0x4f, 0xf8, 0x77, 0x06, 0xb4, 0x57, 0x0b, 0x65, 0x7c, - 0x8d, 0x36, 0x5c, 0x7a, 0x33, 0x4a, 0xdf, 0x9e, 0x35, 0x97, 0xde, 0x90, 0x90, 0xb5, 0x03, 0xa8, - 0x0b, 0x1b, 0x79, 0x1e, 0x3b, 0xb6, 0x3a, 0x8e, 0x0b, 0x04, 0x5c, 0x7a, 0x23, 0xa2, 0x3d, 0xb3, - 0x19, 0xfe, 0xbd, 0x01, 0x88, 0x50, 0xdf, 0x0b, 0x78, 0xf6, 0xa0, 0x31, 0x14, 0x66, 0xf4, 0x0d, - 0xbf, 0x25, 0x64, 0xa9, 0x43, 0x1f, 0x41, 0x31, 0x70, 0xa6, 0x97, 0xfc, 0x96, 0x9e, 0x41, 0x29, - 0xf1, 0x31, 0xdc, 0x4f, 0x38, 0x93, 0xe9, 0xee, 0xfa, 0x6b, 0x1e, 0x40, 0xbe, 0xe4, 0xd4, 0x79, - 0x1b, 0x7f, 0xc1, 0x1a, 0x89, 0x17, 0xac, 0xe8, 0xf4, 0x26, 0x96, 0x6f, 0x4d, 0x1c, 0xbe, 0x0c, - 0xaf, 0xb1, 0x70, 0x8c, 0x1e, 0x41, 0xd5, 0xba, 0xb6, 0x9c, 0x99, 0x35, 0x9e, 0x51, 0xe9, 0x74, - 0x81, 0xac, 0x04, 0xe2, 0x08, 0xd1, 0xc4, 0xab, 0xb6, 0xad, 0x20, 0xdb, 0x36, 0x9d, 0x79, 0xc7, - 0xb2, 0x79, 0xfb, 0x18, 0x10, 0xd3, 0x87, 0x1b, 0x73, 0x2d, 0x5f, 0x1b, 0x16, 0xa5, 0x61, 0x5b, - 0x6b, 0x06, 0xae, 0xe5, 0x2b, 0xeb, 0xe7, 0xb0, 0x1d, 0xd0, 0x09, 0x75, 0xae, 0x53, 0xf6, 0x25, - 0x69, 0x8f, 0x22, 0xdd, 0x6a, 0xc6, 0x1e, 0x00, 0xe3, 0x56, 0xc0, 0x47, 0xa2, 0x01, 0x94, 0x87, - 0x5c, 0x83, 0x54, 0xa5, 0x44, 0x34, 0x87, 0xa8, 0x0b, 0xf7, 0x2d, 0xdf, 0x9f, 0x2d, 0x53, 0x78, - 0x15, 0x69, 0x77, 0x2f, 0x54, 0xad, 0xe0, 0x76, 0xa1, 0xec, 0xb0, 0xd1, 0x78, 0xc1, 0x96, 0xf2, - 0xbc, 0xab, 0x90, 0x92, 0xc3, 0x8e, 0x16, 0x6c, 0x29, 0xca, 0x72, 0xc1, 0xa8, 0x3d, 0x62, 0xce, - 0x77, 0xd4, 0x04, 0xc5, 0x92, 0x10, 0x0c, 0x9c, 0xef, 0xe8, 0xfa, 0x71, 0x5c, 0xdb, 0x70, 0x1c, - 0xa7, 0xcf, 0xdb, 0xfa, 0xda, 0x79, 0x8b, 0x67, 0xf0, 0x40, 0x6e, 0xd9, 0xfb, 0xde, 0x66, 0x45, - 0x26, 0xf6, 0x3c, 0x79, 0x5a, 0xad, 0x72, 0x81, 0x28, 0x35, 0x7e, 0x01, 0x3b, 0xe9, 0xd5, 0xb2, - 0x64, 0xda, 0x53, 0x0a, 0xd5, 0xe8, 0x4f, 0x0b, 0x54, 0x82, 0x5c, 0xff, 0x55, 0x7b, 0x0b, 0xd5, - 0xa0, 0xfc, 0xd5, 0xf9, 0xab, 0xf3, 0xfe, 0xd7, 0xe7, 0x6d, 0x03, 0x6d, 0x43, 0xfb, 0xbc, 0x3f, - 0x1c, 0x1d, 0xf5, 0xfb, 0xc3, 0xc1, 0x90, 0xf4, 0x2e, 0x2e, 0x4e, 0x4f, 0xda, 0x39, 0x74, 0x1f, - 0x5a, 0x83, 0x61, 0x9f, 0x9c, 0x8e, 0x86, 0xfd, 0xd7, 0x47, 0x83, 0x61, 0xff, 0xfc, 0xb4, 0x9d, - 0x47, 0x26, 0x6c, 0xf7, 0xbe, 0x24, 0xa7, 0xbd, 0x93, 0x6f, 0x92, 0xe6, 0x85, 0xa7, 0xcf, 0xa0, - 0x99, 0xbc, 0x26, 0xc4, 0x1a, 0x3d, 0xdb, 0x3e, 0xf7, 0x6c, 0xda, 0xde, 0x42, 0x4d, 0x00, 0x42, - 0xe7, 0xde, 0x35, 0x95, 0x63, 0xe3, 0xf0, 0xcf, 0x15, 0xc8, 0x5d, 0x9c, 0xa0, 0x1e, 0xc0, 0xea, - 0x19, 0x84, 0x76, 0x55, 0x20, 0x6b, 0x6f, 0xab, 0x8e, 0xb9, 0xae, 0x50, 0xb1, 0xe2, 0x2d, 0xf4, - 0x1c, 0xf2, 0x43, 0xe6, 0x21, 0xcd, 0xe3, 0xea, 0x2f, 0x97, 0xce, 0xbd, 0x98, 0x24, 0xb4, 0x7e, - 0x62, 0x3c, 0x37, 0xd0, 0x2f, 0xa1, 0x1a, 0x35, 0xda, 0x68, 0x47, 0x59, 0xa5, 0xff, 0x92, 0xe8, - 0xec, 0xae, 0xc9, 0xa3, 0x15, 0x5f, 0x43, 0x33, 0xd9, 0xaa, 0xa3, 0x87, 0xca, 0x78, 0xe3, 0xdf, - 0x00, 0x9d, 0x47, 0x9b, 0x95, 0x11, 0xdc, 0x2f, 0xa0, 0xac, 0xdb, 0x69, 0xa4, 0x77, 0x32, 0xd9, - 0x9c, 0x77, 0x1e, 0xa4, 0xa4, 0xd1, 0xcc, 0x4f, 0xa1, 0x12, 0x36, 0xb7, 0xe8, 0x41, 0x44, 0x51, - 0xbc, 0x0b, 0xed, 0xec, 0xa4, 0xc5, 0xf1, 0xc9, 0x61, 0x37, 0x19, 0x4e, 0x4e, 0xb5, 0xb0, 0xe1, - 0xe4, 0x74, 0xd3, 0xa9, 0x28, 0x48, 0x26, 0x67, 0x48, 0xc1, 0xc6, 0x02, 0x09, 0x29, 0xd8, 0x9c, - 0xcf, 0x78, 0x0b, 0x0d, 0xa1, 0x95, 0x7a, 0x10, 0xa0, 0x47, 0x61, 0x52, 0x6f, 0x7a, 0x3f, 0x76, - 0xf6, 0x6e, 0xd1, 0xa6, 0xf7, 0x39, 0xea, 0xfd, 0xd0, 0x8a, 0x88, 0x44, 0xfb, 0xdb, 0xd9, 0x5d, - 0x93, 0x47, 0x5e, 0xbd, 0x80, 0x46, 0xa2, 0x77, 0x44, 0x9d, 0x94, 0x6d, 0xac, 0xa1, 0x7c, 0x17, - 0xce, 0xa7, 0x50, 0x09, 0xaf, 0xd1, 0x90, 0xe9, 0xd4, 0xfd, 0x1d, 0x32, 0x9d, 0xbe, 0x6d, 0xf1, - 0x16, 0x3a, 0x81, 0x5a, 0xec, 0xb6, 0x41, 0x66, 0x18, 0x78, 0xfa, 0x36, 0xec, 0x7c, 0xb0, 0x41, - 0x13, 0xa1, 0x0c, 0x64, 0xe3, 0x9f, 0x68, 0xba, 0xd0, 0x5e, 0xe4, 0xf1, 0xa6, 0xfe, 0xaf, 0xb3, - 0x7f, 0x9b, 0x3a, 0x0e, 0x9a, 0xee, 0xe4, 0x42, 0xd0, 0x5b, 0x9a, 0xca, 0x10, 0xf4, 0xb6, 0x06, - 0x10, 0x6f, 0x1d, 0x3d, 0xfd, 0xfb, 0xdb, 0x7d, 0xe3, 0x1f, 0x6f, 0xf7, 0x8d, 0x7f, 0xbe, 0xdd, - 0x37, 0xfe, 0xf2, 0xaf, 0xfd, 0x2d, 0x30, 0x27, 0xde, 0xbc, 0xeb, 0x3b, 0xee, 0x74, 0x62, 0xf9, - 0x5d, 0xee, 0x5c, 0x5d, 0x77, 0xaf, 0xae, 0xe5, 0xdf, 0xc5, 0xe3, 0x92, 0xfc, 0xf9, 0xe9, 0x7f, - 0x02, 0x00, 0x00, 0xff, 0xff, 0x9e, 0xdd, 0x36, 0xc7, 0x6d, 0x16, 0x00, 0x00, + // 1757 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x4b, 0x6f, 0x1b, 0xc9, + 0x11, 0xd6, 0xf0, 0xcd, 0xe2, 0xd3, 0x6d, 0x59, 0x9a, 0xa5, 0x2d, 0x45, 0xdb, 0x5e, 0x04, 0x5e, + 0x67, 0xcd, 0x78, 0x15, 0x24, 0x08, 0xb0, 0xd8, 0x60, 0xa9, 0x87, 0xd7, 0x82, 0xd7, 0xa2, 0xd0, + 0xe4, 0x62, 0xb1, 0x97, 0x30, 0x43, 0x4e, 0x9b, 0x9a, 0x88, 0x9c, 0x99, 0x9d, 0x6e, 0x4a, 0xa1, + 0x4f, 0x39, 0xe5, 0x92, 0x00, 0xc9, 0x29, 0xc8, 0x1f, 0xc8, 0xcf, 0xc8, 0x3d, 0xc7, 0xfc, 0x84, + 0xc0, 0x39, 0xe7, 0x3f, 0x04, 0xfd, 0x98, 0xe1, 0xcc, 0x90, 0x72, 0x9c, 0x71, 0xf6, 0x44, 0x76, + 0x55, 0xf5, 0xd7, 0x55, 0xd5, 0xf5, 0xe8, 0x1a, 0x00, 0xdf, 0xf6, 0xc7, 0x5d, 0x3f, 0xf0, 0xb8, + 0x87, 0x0a, 0xe2, 0x7f, 0xa7, 0x3e, 0xa7, 0xdc, 0x0a, 0x69, 0x9d, 0xed, 0xa9, 0x37, 0xf5, 0xe4, + 0xdf, 0x1f, 0x8b, 0x7f, 0x8a, 0x8a, 0xbb, 0xd0, 0x20, 0xf4, 0xbb, 0x05, 0x65, 0xfc, 0x39, 0xb5, + 0x6c, 0x1a, 0xa0, 0x3d, 0x80, 0xc9, 0x6c, 0xc1, 0x38, 0x0d, 0x46, 0x8e, 0x6d, 0x1a, 0x07, 0xc6, + 0xa3, 0x02, 0xa9, 0x6a, 0xca, 0x99, 0x8d, 0x09, 0x34, 0x09, 0x65, 0xbe, 0xe7, 0x32, 0xfa, 0x4e, + 0x1b, 0xd0, 0x87, 0x50, 0xa4, 0x41, 0xe0, 0x05, 0x66, 0xee, 0xc0, 0x78, 0x54, 0x3b, 0xac, 0x75, + 0xa5, 0x9a, 0xa7, 0x82, 0x44, 0x14, 0x07, 0x3f, 0x83, 0xa2, 0x5c, 0xa3, 0x87, 0x50, 0xe0, 0x4b, + 0x9f, 0x4a, 0x90, 0xe6, 0x61, 0x2b, 0x26, 0x3a, 0x5c, 0xfa, 0x94, 0x48, 0x26, 0x32, 0xa1, 0x3c, + 0xa7, 0x8c, 0x59, 0x53, 0x2a, 0x21, 0xab, 0x24, 0x5c, 0xe2, 0x3e, 0xc0, 0x90, 0x79, 0xda, 0x1c, + 0xf4, 0x23, 0x28, 0x5d, 0x4a, 0x0d, 0x25, 0x5c, 0xed, 0xf0, 0xae, 0x82, 0x4b, 0x58, 0x4b, 0xb4, + 0x08, 0xda, 0x86, 0xe2, 0xc4, 0x5b, 0xb8, 0x5c, 0x42, 0x36, 0x88, 0x5a, 0xe0, 0x1e, 0x54, 0x87, + 0xce, 0x9c, 0x32, 0x6e, 0xcd, 0x7d, 0xd4, 0x81, 0x8a, 0x7f, 0xb9, 0x64, 0xce, 0xc4, 0x9a, 0x49, + 0xc4, 0x3c, 0x89, 0xd6, 0x42, 0xa7, 0x99, 0x37, 0x95, 0xac, 0x9c, 0x64, 0x85, 0x4b, 0xfc, 0x5b, + 0x03, 0x6a, 0x52, 0x29, 0xe5, 0x33, 0xf4, 0x49, 0x4a, 0xab, 0xed, 0x50, 0xab, 0xb8, 0x4f, 0xdf, + 0xae, 0x16, 0x7a, 0x02, 0x55, 0x1e, 0xaa, 0x65, 0xe6, 0x25, 0x8c, 0xf6, 0x55, 0xa4, 0x2d, 0x59, + 0x49, 0xe0, 0x3f, 0x18, 0xd0, 0x3e, 0xf2, 0x3c, 0xce, 0x78, 0x60, 0xf9, 0x99, 0xbc, 0xf3, 0x10, + 0x8a, 0x8c, 0x7b, 0x01, 0xd5, 0x77, 0xd8, 0xe8, 0xea, 0xc0, 0x1a, 0x08, 0x22, 0x51, 0x3c, 0xf4, + 0x43, 0x28, 0x05, 0x74, 0xea, 0x78, 0xae, 0x56, 0xa9, 0x19, 0x4a, 0x11, 0x49, 0x25, 0x9a, 0x8b, + 0x7b, 0x70, 0x27, 0xa6, 0x4d, 0x16, 0xb7, 0xe0, 0x13, 0xb8, 0x77, 0xc6, 0x22, 0x10, 0x9f, 0xda, + 0x59, 0xac, 0xc2, 0xbf, 0x86, 0x9d, 0x34, 0x4a, 0xa6, 0x4b, 0xc2, 0x50, 0x1f, 0xc7, 0x50, 0xa4, + 0x93, 0x2a, 0x24, 0x41, 0xc3, 0x9f, 0x43, 0xb3, 0x37, 0x9b, 0x79, 0x93, 0xb3, 0x93, 0x4c, 0xaa, + 0xf6, 0xa1, 0x15, 0x6d, 0xcf, 0xa4, 0x63, 0x13, 0x72, 0x8e, 0xd2, 0xac, 0x40, 0x72, 0x8e, 0x8d, + 0xbf, 0x85, 0xd6, 0x97, 0x94, 0xab, 0xfb, 0xcb, 0x12, 0x11, 0x1f, 0x40, 0x45, 0xde, 0xfa, 0x28, + 0x42, 0x2d, 0xcb, 0xf5, 0x99, 0x8d, 0x29, 0xb4, 0x57, 0xd0, 0x99, 0x94, 0x7d, 0x97, 0x70, 0xc3, + 0x13, 0x68, 0x5d, 0x2c, 0xde, 0xc3, 0x82, 0x77, 0x3a, 0xe4, 0x0b, 0x68, 0xaf, 0x0e, 0xc9, 0x14, + 0xaa, 0xbf, 0x94, 0xde, 0xd0, 0x29, 0x90, 0x45, 0xcf, 0x3d, 0x00, 0x95, 0x38, 0xa3, 0x2b, 0xba, + 0x94, 0xca, 0xd6, 0x49, 0x55, 0x51, 0x5e, 0xd0, 0x25, 0xfe, 0xa3, 0x01, 0x77, 0x62, 0x07, 0x64, + 0xf2, 0xf7, 0x2a, 0x73, 0x73, 0x6f, 0xcb, 0x5c, 0xf4, 0x11, 0x94, 0x66, 0x0a, 0x55, 0x65, 0x78, + 0x3d, 0x94, 0xbb, 0xa0, 0x02, 0x4d, 0xf1, 0xf0, 0xaf, 0x60, 0x3b, 0x52, 0xe8, 0x68, 0x99, 0x2d, + 0xe0, 0xd1, 0x7d, 0xd0, 0x36, 0xae, 0x02, 0xac, 0xa2, 0x08, 0x67, 0x36, 0x7e, 0x06, 0xbb, 0x5f, + 0x52, 0x7e, 0xac, 0x5a, 0xcc, 0xb1, 0xe7, 0xbe, 0x72, 0xa6, 0x99, 0xb2, 0x8a, 0x81, 0xb9, 0x8e, + 0x93, 0xc9, 0x83, 0x1f, 0x43, 0x59, 0x77, 0x3c, 0xed, 0xc2, 0x56, 0xe8, 0x1a, 0x8d, 0x4e, 0x42, + 0x3e, 0xfe, 0x0e, 0x76, 0x2f, 0x16, 0xef, 0xaf, 0xfc, 0xff, 0x72, 0xe4, 0x73, 0x30, 0xd7, 0x8f, + 0xcc, 0x14, 0xcd, 0x37, 0x50, 0x7a, 0x49, 0xe7, 0x63, 0x1a, 0x20, 0x04, 0x05, 0xd7, 0x9a, 0xab, + 0x56, 0x5d, 0x25, 0xf2, 0xbf, 0xb8, 0xb4, 0xb9, 0xe4, 0xc6, 0x2e, 0x4d, 0x11, 0xce, 0x6c, 0xc1, + 0xf4, 0x29, 0x0d, 0x46, 0x8b, 0x60, 0xc6, 0xcc, 0xfc, 0x41, 0xfe, 0x51, 0x95, 0x54, 0x04, 0xe1, + 0xeb, 0x60, 0xc6, 0xd0, 0x0f, 0xa0, 0x36, 0x99, 0x39, 0xd4, 0xe5, 0x8a, 0x5d, 0x90, 0x6c, 0x50, + 0x24, 0x21, 0x80, 0xbf, 0x90, 0x51, 0xae, 0xce, 0x66, 0x99, 0x2e, 0xfb, 0x4f, 0x06, 0xa0, 0x38, + 0x44, 0xc6, 0x4c, 0x29, 0x2b, 0x83, 0x98, 0x99, 0x3b, 0xc8, 0xcb, 0x14, 0x90, 0xe2, 0x0a, 0x95, + 0x84, 0xcc, 0x0d, 0x99, 0x12, 0x17, 0x0b, 0x33, 0xe5, 0x02, 0xaa, 0x22, 0x73, 0x06, 0xdc, 0xe2, + 0x0c, 0x1d, 0x40, 0x41, 0xb8, 0x43, 0xab, 0x91, 0x4c, 0x2d, 0xc9, 0x41, 0x1f, 0x42, 0xdd, 0xf6, + 0x6e, 0xdc, 0x11, 0xa3, 0x13, 0xcf, 0xb5, 0x99, 0xf6, 0x70, 0x4d, 0xd0, 0x06, 0x8a, 0x84, 0xff, + 0x9a, 0x87, 0x1d, 0x95, 0x79, 0xcf, 0xa9, 0x15, 0xf0, 0x31, 0xb5, 0x78, 0xa6, 0xe0, 0xfa, 0xbf, + 0x56, 0x04, 0xd4, 0x05, 0x90, 0x8a, 0x0b, 0x2b, 0xd4, 0xe5, 0x46, 0x0f, 0x96, 0xc8, 0x7e, 0x52, + 0x15, 0x22, 0x62, 0xc9, 0xd0, 0xa7, 0xd0, 0xf0, 0xa9, 0x6b, 0x3b, 0xee, 0x54, 0x6f, 0x29, 0x6a, + 0x5f, 0xc7, 0xc1, 0xeb, 0x5a, 0x44, 0x6d, 0x79, 0x08, 0x8d, 0xf1, 0x92, 0x53, 0x36, 0xba, 0x09, + 0x1c, 0xce, 0xa9, 0x6b, 0x96, 0xa4, 0x73, 0xea, 0x92, 0xf8, 0x8d, 0xa2, 0x89, 0x52, 0xaa, 0x84, + 0x02, 0x6a, 0xd9, 0x66, 0x59, 0xbd, 0x54, 0x25, 0x85, 0x50, 0x4b, 0xbc, 0x54, 0xeb, 0x57, 0x74, + 0xb9, 0x82, 0xa8, 0x28, 0xff, 0x0a, 0x5a, 0x88, 0x70, 0x1f, 0xaa, 0x52, 0x44, 0x02, 0x54, 0x55, + 0x84, 0x0b, 0x82, 0xdc, 0xff, 0x31, 0xb4, 0x2d, 0xdf, 0x0f, 0xbc, 0xdf, 0x38, 0x73, 0x8b, 0xd3, + 0x11, 0x73, 0x5e, 0x53, 0x13, 0xa4, 0x4c, 0x2b, 0x46, 0x1f, 0x38, 0xaf, 0x29, 0xa6, 0x00, 0xc7, + 0x97, 0x96, 0x3b, 0xa5, 0x42, 0xfb, 0x77, 0xb8, 0xfa, 0x9f, 0x42, 0x6d, 0x22, 0xe5, 0x47, 0xf2, + 0x7d, 0x9c, 0x93, 0xef, 0x63, 0x1d, 0xaa, 0x22, 0xa1, 0x15, 0x98, 0x7c, 0x24, 0xc3, 0x24, 0xfa, + 0x8f, 0x0f, 0xa1, 0x39, 0x0c, 0x2c, 0x97, 0xbd, 0xa2, 0xc1, 0x57, 0xea, 0x2a, 0xfe, 0xeb, 0x51, + 0xf8, 0x6f, 0x39, 0xd8, 0x5d, 0x0b, 0xa1, 0x4c, 0xc9, 0xf2, 0x69, 0xa4, 0xb4, 0x3c, 0x52, 0x45, + 0x52, 0x5b, 0x2b, 0x1d, 0x59, 0x1f, 0x2a, 0x2c, 0x3d, 0xf1, 0x39, 0xb4, 0xb8, 0x56, 0x78, 0x94, + 0x08, 0x2c, 0x7d, 0x52, 0xd2, 0x1a, 0xd2, 0xe4, 0x49, 0xeb, 0x12, 0x5d, 0xa3, 0x90, 0xec, 0x1a, + 0xe8, 0x67, 0x50, 0xd7, 0x4c, 0xea, 0x7b, 0x93, 0x4b, 0xb3, 0xa8, 0xd3, 0x20, 0x11, 0xd9, 0xa7, + 0x82, 0x45, 0x6a, 0xc1, 0x6a, 0x81, 0x9e, 0x40, 0x8d, 0x5b, 0xc1, 0x94, 0x72, 0x65, 0x46, 0x69, + 0x83, 0xe7, 0x40, 0x09, 0x88, 0xff, 0xf8, 0x15, 0xb4, 0x7a, 0xec, 0x6a, 0xe0, 0xcf, 0x9c, 0xef, + 0x35, 0xf5, 0xf0, 0xef, 0x0c, 0x68, 0xaf, 0x0e, 0xca, 0xf8, 0x70, 0x6d, 0xb8, 0xf4, 0x66, 0x94, + 0x6e, 0xb4, 0x35, 0x97, 0xde, 0x90, 0xd0, 0x6b, 0x07, 0x50, 0x17, 0x32, 0xb2, 0x74, 0x3b, 0xb6, + 0xaa, 0xdc, 0x05, 0x02, 0x2e, 0xbd, 0x11, 0xd6, 0x9e, 0xd9, 0x0c, 0xff, 0xde, 0x00, 0x44, 0xa8, + 0xef, 0x05, 0x3c, 0xbb, 0xd1, 0x18, 0x0a, 0x33, 0xfa, 0x8a, 0xdf, 0x62, 0xb2, 0xe4, 0xa1, 0x8f, + 0xa0, 0x18, 0x38, 0xd3, 0x4b, 0x7e, 0xcb, 0x78, 0xa1, 0x98, 0xf8, 0x18, 0xee, 0x26, 0x94, 0xc9, + 0xd4, 0xe6, 0xfe, 0x9d, 0x07, 0x90, 0x8f, 0x3e, 0x55, 0x9a, 0xe3, 0x8f, 0x5d, 0x23, 0xf1, 0xd8, + 0x15, 0x43, 0xe1, 0xc4, 0xf2, 0xad, 0x89, 0xc3, 0x97, 0x61, 0xc7, 0x0b, 0xd7, 0xe8, 0x01, 0x54, + 0xad, 0x6b, 0xcb, 0x99, 0x59, 0xe3, 0x19, 0x95, 0x4a, 0x17, 0xc8, 0x8a, 0x20, 0xaa, 0x8d, 0x76, + 0xbc, 0x9a, 0xf0, 0x0a, 0x72, 0xc2, 0xd3, 0x91, 0x77, 0x2c, 0xe7, 0xbc, 0x4f, 0x00, 0x31, 0x5d, + 0x07, 0x99, 0x6b, 0xf9, 0x5a, 0xb0, 0x28, 0x05, 0xdb, 0x9a, 0x33, 0x70, 0x2d, 0x5f, 0x49, 0x3f, + 0x85, 0xed, 0x80, 0x4e, 0xa8, 0x73, 0x9d, 0x92, 0x2f, 0x49, 0x79, 0x14, 0xf1, 0x56, 0x3b, 0xf6, + 0x00, 0x18, 0xb7, 0x02, 0x3e, 0x12, 0xb3, 0xa2, 0xac, 0x87, 0x0d, 0x52, 0x95, 0x14, 0x31, 0x47, + 0xa2, 0x2e, 0xdc, 0xb5, 0x7c, 0x7f, 0xb6, 0x4c, 0xe1, 0x55, 0xa4, 0xdc, 0x9d, 0x90, 0xb5, 0x82, + 0xdb, 0x85, 0xb2, 0xc3, 0x46, 0xe3, 0x05, 0x5b, 0xca, 0xd2, 0x58, 0x21, 0x25, 0x87, 0x1d, 0x2d, + 0xd8, 0x52, 0xa4, 0xe5, 0x82, 0x51, 0x3b, 0x5e, 0x11, 0x2b, 0x82, 0x20, 0x4a, 0xe1, 0x7a, 0xe5, + 0xae, 0x6d, 0xa8, 0xdc, 0xe9, 0xd2, 0x5c, 0x5f, 0x2f, 0xcd, 0xc9, 0xe2, 0xde, 0x48, 0x17, 0xf7, + 0x44, 0xe5, 0x6e, 0x26, 0x2b, 0x37, 0x9e, 0xc1, 0x3d, 0x79, 0xdd, 0xef, 0xdb, 0x34, 0x8b, 0x4c, + 0xc4, 0x4b, 0xb2, 0xd2, 0xad, 0xe2, 0x88, 0x28, 0x36, 0x7e, 0x06, 0x3b, 0xe9, 0xd3, 0xb2, 0x44, + 0xe9, 0x63, 0x0a, 0xd5, 0xe8, 0xdb, 0x08, 0x2a, 0x41, 0xae, 0xff, 0xa2, 0xbd, 0x85, 0x6a, 0x50, + 0xfe, 0xfa, 0xfc, 0xc5, 0x79, 0xff, 0x9b, 0xf3, 0xb6, 0x81, 0xb6, 0xa1, 0x7d, 0xde, 0x1f, 0x8e, + 0x8e, 0xfa, 0xfd, 0xe1, 0x60, 0x48, 0x7a, 0x17, 0x17, 0xa7, 0x27, 0xed, 0x1c, 0xba, 0x0b, 0xad, + 0xc1, 0xb0, 0x4f, 0x4e, 0x47, 0xc3, 0xfe, 0xcb, 0xa3, 0xc1, 0xb0, 0x7f, 0x7e, 0xda, 0xce, 0x23, + 0x13, 0xb6, 0x7b, 0x5f, 0x91, 0xd3, 0xde, 0xc9, 0xb7, 0x49, 0xf1, 0xc2, 0xe3, 0x27, 0xd0, 0x4c, + 0xb6, 0x18, 0x71, 0x46, 0xcf, 0xb6, 0xcf, 0x3d, 0x9b, 0xb6, 0xb7, 0x50, 0x13, 0x80, 0xd0, 0xb9, + 0x77, 0x4d, 0xe5, 0xda, 0x38, 0xfc, 0x73, 0x05, 0x72, 0x17, 0x27, 0xa8, 0x07, 0xb0, 0x7a, 0x6d, + 0xa1, 0x5d, 0x65, 0xc8, 0xda, 0x13, 0xae, 0x63, 0xae, 0x33, 0x94, 0xad, 0x78, 0x0b, 0x3d, 0x85, + 0xfc, 0x90, 0x79, 0x48, 0xfb, 0x71, 0xf5, 0x65, 0xa7, 0x73, 0x27, 0x46, 0x09, 0xa5, 0x1f, 0x19, + 0x4f, 0x0d, 0xf4, 0x0b, 0xa8, 0x46, 0xf3, 0x3c, 0xda, 0x51, 0x52, 0xe9, 0x2f, 0x1f, 0x9d, 0xdd, + 0x35, 0x7a, 0x74, 0xe2, 0x4b, 0x68, 0x26, 0xbf, 0x08, 0xa0, 0xfb, 0x4a, 0x78, 0xe3, 0xd7, 0x86, + 0xce, 0x83, 0xcd, 0xcc, 0x08, 0xee, 0xe7, 0x50, 0xd6, 0x53, 0x3b, 0xd2, 0x37, 0x99, 0xfc, 0x06, + 0xd0, 0xb9, 0x97, 0xa2, 0x46, 0x3b, 0x3f, 0x83, 0x4a, 0x38, 0x43, 0xa3, 0x7b, 0x91, 0x8b, 0xe2, + 0xc3, 0x6e, 0x67, 0x27, 0x4d, 0x8e, 0x6f, 0x0e, 0x87, 0xd6, 0x70, 0x73, 0x6a, 0x52, 0x0e, 0x37, + 0xa7, 0x67, 0x5b, 0xe5, 0x82, 0x64, 0x70, 0x86, 0x2e, 0xd8, 0x98, 0x20, 0xa1, 0x0b, 0x36, 0xc7, + 0x33, 0xde, 0x42, 0x43, 0x68, 0xa5, 0x1e, 0x13, 0xe8, 0x41, 0x18, 0xd4, 0x9b, 0x9e, 0xa9, 0x9d, + 0xbd, 0x5b, 0xb8, 0xe9, 0x7b, 0x8e, 0x46, 0x4c, 0xb4, 0x72, 0x44, 0x62, 0xca, 0xee, 0xec, 0xae, + 0xd1, 0x23, 0xad, 0x9e, 0x41, 0x23, 0x31, 0xa2, 0xa2, 0x4e, 0x4a, 0x36, 0x36, 0xb7, 0xbe, 0x0d, + 0xe7, 0x33, 0xa8, 0x84, 0x2d, 0x38, 0xf4, 0x74, 0xaa, 0xf7, 0x87, 0x9e, 0x4e, 0x77, 0x6a, 0xbc, + 0x85, 0x4e, 0xa0, 0x16, 0xeb, 0x54, 0xc8, 0x0c, 0x0d, 0x4f, 0x77, 0xd2, 0xce, 0x07, 0x1b, 0x38, + 0x11, 0xca, 0x40, 0x7e, 0x5f, 0x48, 0xcc, 0x76, 0x68, 0x2f, 0xd2, 0x78, 0xd3, 0x98, 0xd9, 0xd9, + 0xbf, 0x8d, 0x1d, 0x07, 0x4d, 0x0f, 0x8c, 0x21, 0xe8, 0x2d, 0xb3, 0x6b, 0x08, 0x7a, 0xdb, 0x9c, + 0x89, 0xb7, 0x8e, 0x1e, 0xff, 0xfd, 0xcd, 0xbe, 0xf1, 0x8f, 0x37, 0xfb, 0xc6, 0x3f, 0xdf, 0xec, + 0x1b, 0x7f, 0xf9, 0xd7, 0xfe, 0x16, 0x98, 0x13, 0x6f, 0xde, 0xf5, 0x1d, 0x77, 0x3a, 0xb1, 0xfc, + 0x2e, 0x77, 0xae, 0xae, 0xbb, 0x57, 0xd7, 0xf2, 0xab, 0xf4, 0xb8, 0x24, 0x7f, 0x7e, 0xf2, 0x9f, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x20, 0xf4, 0x81, 0xa3, 0xd4, 0x16, 0x00, 0x00, } diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/raft_cmdpb/raft_cmdpb.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/raft_cmdpb/raft_cmdpb.pb.go new file mode 100644 index 00000000000..764f0a85410 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/pkg/raft_cmdpb/raft_cmdpb.pb.go @@ -0,0 +1,7803 @@ +// Code generated by protoc-gen-gogo. +// source: raft_cmdpb.proto +// DO NOT EDIT! + +/* + Package raft_cmdpb is a generated protocol buffer package. + + It is generated from these files: + raft_cmdpb.proto + + It has these top-level messages: + GetRequest + GetResponse + PutRequest + PutResponse + DeleteRequest + DeleteResponse + DeleteRangeRequest + DeleteRangeResponse + SnapRequest + SnapResponse + PrewriteRequest + PrewriteResponse + Request + Response + ChangePeerRequest + ChangePeerResponse + SplitRequest + SplitResponse + CompactLogRequest + CompactLogResponse + TransferLeaderRequest + TransferLeaderResponse + VerifyHashRequest + VerifyHashResponse + AdminRequest + AdminResponse + RegionLeaderRequest + RegionLeaderResponse + RegionDetailRequest + RegionDetailResponse + StatusRequest + StatusResponse + RaftRequestHeader + RaftResponseHeader + RaftCmdRequest + RaftCmdResponse +*/ +package raft_cmdpb + +import ( + "fmt" + "io" + "math" + + proto "github.com/golang/protobuf/proto" + + metapb "github.com/pingcap/kvproto/pkg/metapb" + + errorpb "github.com/pingcap/kvproto/pkg/errorpb" + + eraftpb "github.com/pingcap/kvproto/pkg/eraftpb" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type CmdType int32 + +const ( + CmdType_Invalid CmdType = 0 + CmdType_Get CmdType = 1 + CmdType_Put CmdType = 3 + CmdType_Delete CmdType = 4 + CmdType_Snap CmdType = 5 + CmdType_Prewrite CmdType = 6 + CmdType_DeleteRange CmdType = 7 +) + +var CmdType_name = map[int32]string{ + 0: "Invalid", + 1: "Get", + 3: "Put", + 4: "Delete", + 5: "Snap", + 6: "Prewrite", + 7: "DeleteRange", +} +var CmdType_value = map[string]int32{ + "Invalid": 0, + "Get": 1, + "Put": 3, + "Delete": 4, + "Snap": 5, + "Prewrite": 6, + "DeleteRange": 7, +} + +func (x CmdType) Enum() *CmdType { + p := new(CmdType) + *p = x + return p +} +func (x CmdType) String() string { + return proto.EnumName(CmdType_name, int32(x)) +} +func (x *CmdType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(CmdType_value, data, "CmdType") + if err != nil { + return err + } + *x = CmdType(value) + return nil +} +func (CmdType) EnumDescriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{0} } + +type AdminCmdType int32 + +const ( + AdminCmdType_InvalidAdmin AdminCmdType = 0 + AdminCmdType_ChangePeer AdminCmdType = 1 + AdminCmdType_Split AdminCmdType = 2 + AdminCmdType_CompactLog AdminCmdType = 3 + AdminCmdType_TransferLeader AdminCmdType = 4 + AdminCmdType_ComputeHash AdminCmdType = 5 + AdminCmdType_VerifyHash AdminCmdType = 6 +) + +var AdminCmdType_name = map[int32]string{ + 0: "InvalidAdmin", + 1: "ChangePeer", + 2: "Split", + 3: "CompactLog", + 4: "TransferLeader", + 5: "ComputeHash", + 6: "VerifyHash", +} +var AdminCmdType_value = map[string]int32{ + "InvalidAdmin": 0, + "ChangePeer": 1, + "Split": 2, + "CompactLog": 3, + "TransferLeader": 4, + "ComputeHash": 5, + "VerifyHash": 6, +} + +func (x AdminCmdType) Enum() *AdminCmdType { + p := new(AdminCmdType) + *p = x + return p +} +func (x AdminCmdType) String() string { + return proto.EnumName(AdminCmdType_name, int32(x)) +} +func (x *AdminCmdType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(AdminCmdType_value, data, "AdminCmdType") + if err != nil { + return err + } + *x = AdminCmdType(value) + return nil +} +func (AdminCmdType) EnumDescriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{1} } + +type StatusCmdType int32 + +const ( + StatusCmdType_InvalidStatus StatusCmdType = 0 + StatusCmdType_RegionLeader StatusCmdType = 1 + StatusCmdType_RegionDetail StatusCmdType = 2 +) + +var StatusCmdType_name = map[int32]string{ + 0: "InvalidStatus", + 1: "RegionLeader", + 2: "RegionDetail", +} +var StatusCmdType_value = map[string]int32{ + "InvalidStatus": 0, + "RegionLeader": 1, + "RegionDetail": 2, +} + +func (x StatusCmdType) Enum() *StatusCmdType { + p := new(StatusCmdType) + *p = x + return p +} +func (x StatusCmdType) String() string { + return proto.EnumName(StatusCmdType_name, int32(x)) +} +func (x *StatusCmdType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(StatusCmdType_value, data, "StatusCmdType") + if err != nil { + return err + } + *x = StatusCmdType(value) + return nil +} +func (StatusCmdType) EnumDescriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{2} } + +type GetRequest struct { + Cf *string `protobuf:"bytes,1,opt,name=cf" json:"cf,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *GetRequest) Reset() { *m = GetRequest{} } +func (m *GetRequest) String() string { return proto.CompactTextString(m) } +func (*GetRequest) ProtoMessage() {} +func (*GetRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{0} } + +func (m *GetRequest) GetCf() string { + if m != nil && m.Cf != nil { + return *m.Cf + } + return "" +} + +func (m *GetRequest) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +type GetResponse struct { + Value []byte `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *GetResponse) Reset() { *m = GetResponse{} } +func (m *GetResponse) String() string { return proto.CompactTextString(m) } +func (*GetResponse) ProtoMessage() {} +func (*GetResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{1} } + +func (m *GetResponse) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +type PutRequest struct { + Cf *string `protobuf:"bytes,1,opt,name=cf" json:"cf,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value" json:"value,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *PutRequest) Reset() { *m = PutRequest{} } +func (m *PutRequest) String() string { return proto.CompactTextString(m) } +func (*PutRequest) ProtoMessage() {} +func (*PutRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{2} } + +func (m *PutRequest) GetCf() string { + if m != nil && m.Cf != nil { + return *m.Cf + } + return "" +} + +func (m *PutRequest) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *PutRequest) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +type PutResponse struct { + XXX_unrecognized []byte `json:"-"` +} + +func (m *PutResponse) Reset() { *m = PutResponse{} } +func (m *PutResponse) String() string { return proto.CompactTextString(m) } +func (*PutResponse) ProtoMessage() {} +func (*PutResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{3} } + +type DeleteRequest struct { + Cf *string `protobuf:"bytes,1,opt,name=cf" json:"cf,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } +func (m *DeleteRequest) String() string { return proto.CompactTextString(m) } +func (*DeleteRequest) ProtoMessage() {} +func (*DeleteRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{4} } + +func (m *DeleteRequest) GetCf() string { + if m != nil && m.Cf != nil { + return *m.Cf + } + return "" +} + +func (m *DeleteRequest) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +type DeleteResponse struct { + XXX_unrecognized []byte `json:"-"` +} + +func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } +func (m *DeleteResponse) String() string { return proto.CompactTextString(m) } +func (*DeleteResponse) ProtoMessage() {} +func (*DeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{5} } + +type DeleteRangeRequest struct { + Cf *string `protobuf:"bytes,1,opt,name=cf" json:"cf,omitempty"` + StartKey []byte `protobuf:"bytes,2,opt,name=start_key,json=startKey" json:"start_key,omitempty"` + EndKey []byte `protobuf:"bytes,3,opt,name=end_key,json=endKey" json:"end_key,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *DeleteRangeRequest) Reset() { *m = DeleteRangeRequest{} } +func (m *DeleteRangeRequest) String() string { return proto.CompactTextString(m) } +func (*DeleteRangeRequest) ProtoMessage() {} +func (*DeleteRangeRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{6} } + +func (m *DeleteRangeRequest) GetCf() string { + if m != nil && m.Cf != nil { + return *m.Cf + } + return "" +} + +func (m *DeleteRangeRequest) GetStartKey() []byte { + if m != nil { + return m.StartKey + } + return nil +} + +func (m *DeleteRangeRequest) GetEndKey() []byte { + if m != nil { + return m.EndKey + } + return nil +} + +type DeleteRangeResponse struct { + XXX_unrecognized []byte `json:"-"` +} + +func (m *DeleteRangeResponse) Reset() { *m = DeleteRangeResponse{} } +func (m *DeleteRangeResponse) String() string { return proto.CompactTextString(m) } +func (*DeleteRangeResponse) ProtoMessage() {} +func (*DeleteRangeResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{7} } + +type SnapRequest struct { + XXX_unrecognized []byte `json:"-"` +} + +func (m *SnapRequest) Reset() { *m = SnapRequest{} } +func (m *SnapRequest) String() string { return proto.CompactTextString(m) } +func (*SnapRequest) ProtoMessage() {} +func (*SnapRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{8} } + +type SnapResponse struct { + Region *metapb.Region `protobuf:"bytes,1,opt,name=region" json:"region,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *SnapResponse) Reset() { *m = SnapResponse{} } +func (m *SnapResponse) String() string { return proto.CompactTextString(m) } +func (*SnapResponse) ProtoMessage() {} +func (*SnapResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{9} } + +func (m *SnapResponse) GetRegion() *metapb.Region { + if m != nil { + return m.Region + } + return nil +} + +type PrewriteRequest struct { + Key []byte `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + Lock []byte `protobuf:"bytes,3,opt,name=lock" json:"lock,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *PrewriteRequest) Reset() { *m = PrewriteRequest{} } +func (m *PrewriteRequest) String() string { return proto.CompactTextString(m) } +func (*PrewriteRequest) ProtoMessage() {} +func (*PrewriteRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{10} } + +func (m *PrewriteRequest) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *PrewriteRequest) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +func (m *PrewriteRequest) GetLock() []byte { + if m != nil { + return m.Lock + } + return nil +} + +type PrewriteResponse struct { + XXX_unrecognized []byte `json:"-"` +} + +func (m *PrewriteResponse) Reset() { *m = PrewriteResponse{} } +func (m *PrewriteResponse) String() string { return proto.CompactTextString(m) } +func (*PrewriteResponse) ProtoMessage() {} +func (*PrewriteResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{11} } + +type Request struct { + CmdType *CmdType `protobuf:"varint,1,opt,name=cmd_type,json=cmdType,enum=raft_cmdpb.CmdType" json:"cmd_type,omitempty"` + Get *GetRequest `protobuf:"bytes,2,opt,name=get" json:"get,omitempty"` + Put *PutRequest `protobuf:"bytes,4,opt,name=put" json:"put,omitempty"` + Delete *DeleteRequest `protobuf:"bytes,5,opt,name=delete" json:"delete,omitempty"` + Snap *SnapRequest `protobuf:"bytes,6,opt,name=snap" json:"snap,omitempty"` + Prewrite *PrewriteRequest `protobuf:"bytes,7,opt,name=prewrite" json:"prewrite,omitempty"` + DeleteRange *DeleteRangeRequest `protobuf:"bytes,8,opt,name=delete_range,json=deleteRange" json:"delete_range,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *Request) Reset() { *m = Request{} } +func (m *Request) String() string { return proto.CompactTextString(m) } +func (*Request) ProtoMessage() {} +func (*Request) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{12} } + +func (m *Request) GetCmdType() CmdType { + if m != nil && m.CmdType != nil { + return *m.CmdType + } + return CmdType_Invalid +} + +func (m *Request) GetGet() *GetRequest { + if m != nil { + return m.Get + } + return nil +} + +func (m *Request) GetPut() *PutRequest { + if m != nil { + return m.Put + } + return nil +} + +func (m *Request) GetDelete() *DeleteRequest { + if m != nil { + return m.Delete + } + return nil +} + +func (m *Request) GetSnap() *SnapRequest { + if m != nil { + return m.Snap + } + return nil +} + +func (m *Request) GetPrewrite() *PrewriteRequest { + if m != nil { + return m.Prewrite + } + return nil +} + +func (m *Request) GetDeleteRange() *DeleteRangeRequest { + if m != nil { + return m.DeleteRange + } + return nil +} + +type Response struct { + CmdType *CmdType `protobuf:"varint,1,opt,name=cmd_type,json=cmdType,enum=raft_cmdpb.CmdType" json:"cmd_type,omitempty"` + Get *GetResponse `protobuf:"bytes,2,opt,name=get" json:"get,omitempty"` + Put *PutResponse `protobuf:"bytes,4,opt,name=put" json:"put,omitempty"` + Delete *DeleteResponse `protobuf:"bytes,5,opt,name=delete" json:"delete,omitempty"` + Snap *SnapResponse `protobuf:"bytes,6,opt,name=snap" json:"snap,omitempty"` + Prewrite *PrewriteResponse `protobuf:"bytes,7,opt,name=prewrite" json:"prewrite,omitempty"` + DelteRange *DeleteRangeResponse `protobuf:"bytes,8,opt,name=delte_range,json=delteRange" json:"delte_range,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *Response) Reset() { *m = Response{} } +func (m *Response) String() string { return proto.CompactTextString(m) } +func (*Response) ProtoMessage() {} +func (*Response) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{13} } + +func (m *Response) GetCmdType() CmdType { + if m != nil && m.CmdType != nil { + return *m.CmdType + } + return CmdType_Invalid +} + +func (m *Response) GetGet() *GetResponse { + if m != nil { + return m.Get + } + return nil +} + +func (m *Response) GetPut() *PutResponse { + if m != nil { + return m.Put + } + return nil +} + +func (m *Response) GetDelete() *DeleteResponse { + if m != nil { + return m.Delete + } + return nil +} + +func (m *Response) GetSnap() *SnapResponse { + if m != nil { + return m.Snap + } + return nil +} + +func (m *Response) GetPrewrite() *PrewriteResponse { + if m != nil { + return m.Prewrite + } + return nil +} + +func (m *Response) GetDelteRange() *DeleteRangeResponse { + if m != nil { + return m.DelteRange + } + return nil +} + +type ChangePeerRequest struct { + // This can be only called in internal RaftStore now. + ChangeType *eraftpb.ConfChangeType `protobuf:"varint,1,opt,name=change_type,json=changeType,enum=eraftpb.ConfChangeType" json:"change_type,omitempty"` + Peer *metapb.Peer `protobuf:"bytes,2,opt,name=peer" json:"peer,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *ChangePeerRequest) Reset() { *m = ChangePeerRequest{} } +func (m *ChangePeerRequest) String() string { return proto.CompactTextString(m) } +func (*ChangePeerRequest) ProtoMessage() {} +func (*ChangePeerRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{14} } + +func (m *ChangePeerRequest) GetChangeType() eraftpb.ConfChangeType { + if m != nil && m.ChangeType != nil { + return *m.ChangeType + } + return eraftpb.ConfChangeType_AddNode +} + +func (m *ChangePeerRequest) GetPeer() *metapb.Peer { + if m != nil { + return m.Peer + } + return nil +} + +type ChangePeerResponse struct { + Region *metapb.Region `protobuf:"bytes,1,opt,name=region" json:"region,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *ChangePeerResponse) Reset() { *m = ChangePeerResponse{} } +func (m *ChangePeerResponse) String() string { return proto.CompactTextString(m) } +func (*ChangePeerResponse) ProtoMessage() {} +func (*ChangePeerResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{15} } + +func (m *ChangePeerResponse) GetRegion() *metapb.Region { + if m != nil { + return m.Region + } + return nil +} + +type SplitRequest struct { + // This can be only called in internal RaftStore now. + // The split_key must be in the been splitting region. + SplitKey []byte `protobuf:"bytes,1,opt,name=split_key,json=splitKey" json:"split_key,omitempty"` + // We split the region into two, first uses the origin + // parent region id, and the second uses the new_region_id. + // We must guarantee that the new_region_id is global unique. + NewRegionId *uint64 `protobuf:"varint,2,opt,name=new_region_id,json=newRegionId" json:"new_region_id,omitempty"` + // The peer ids for the new split region. + NewPeerIds []uint64 `protobuf:"varint,3,rep,name=new_peer_ids,json=newPeerIds" json:"new_peer_ids,omitempty"` + // If true, right region derive the origin region_id, + // left region use new_region_id. + RightDerive *bool `protobuf:"varint,4,opt,name=right_derive,json=rightDerive" json:"right_derive,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *SplitRequest) Reset() { *m = SplitRequest{} } +func (m *SplitRequest) String() string { return proto.CompactTextString(m) } +func (*SplitRequest) ProtoMessage() {} +func (*SplitRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{16} } + +func (m *SplitRequest) GetSplitKey() []byte { + if m != nil { + return m.SplitKey + } + return nil +} + +func (m *SplitRequest) GetNewRegionId() uint64 { + if m != nil && m.NewRegionId != nil { + return *m.NewRegionId + } + return 0 +} + +func (m *SplitRequest) GetNewPeerIds() []uint64 { + if m != nil { + return m.NewPeerIds + } + return nil +} + +func (m *SplitRequest) GetRightDerive() bool { + if m != nil && m.RightDerive != nil { + return *m.RightDerive + } + return false +} + +type SplitResponse struct { + Left *metapb.Region `protobuf:"bytes,1,opt,name=left" json:"left,omitempty"` + Right *metapb.Region `protobuf:"bytes,2,opt,name=right" json:"right,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *SplitResponse) Reset() { *m = SplitResponse{} } +func (m *SplitResponse) String() string { return proto.CompactTextString(m) } +func (*SplitResponse) ProtoMessage() {} +func (*SplitResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{17} } + +func (m *SplitResponse) GetLeft() *metapb.Region { + if m != nil { + return m.Left + } + return nil +} + +func (m *SplitResponse) GetRight() *metapb.Region { + if m != nil { + return m.Right + } + return nil +} + +type CompactLogRequest struct { + CompactIndex *uint64 `protobuf:"varint,1,opt,name=compact_index,json=compactIndex" json:"compact_index,omitempty"` + CompactTerm *uint64 `protobuf:"varint,2,opt,name=compact_term,json=compactTerm" json:"compact_term,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *CompactLogRequest) Reset() { *m = CompactLogRequest{} } +func (m *CompactLogRequest) String() string { return proto.CompactTextString(m) } +func (*CompactLogRequest) ProtoMessage() {} +func (*CompactLogRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{18} } + +func (m *CompactLogRequest) GetCompactIndex() uint64 { + if m != nil && m.CompactIndex != nil { + return *m.CompactIndex + } + return 0 +} + +func (m *CompactLogRequest) GetCompactTerm() uint64 { + if m != nil && m.CompactTerm != nil { + return *m.CompactTerm + } + return 0 +} + +type CompactLogResponse struct { + XXX_unrecognized []byte `json:"-"` +} + +func (m *CompactLogResponse) Reset() { *m = CompactLogResponse{} } +func (m *CompactLogResponse) String() string { return proto.CompactTextString(m) } +func (*CompactLogResponse) ProtoMessage() {} +func (*CompactLogResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{19} } + +type TransferLeaderRequest struct { + Peer *metapb.Peer `protobuf:"bytes,1,opt,name=peer" json:"peer,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *TransferLeaderRequest) Reset() { *m = TransferLeaderRequest{} } +func (m *TransferLeaderRequest) String() string { return proto.CompactTextString(m) } +func (*TransferLeaderRequest) ProtoMessage() {} +func (*TransferLeaderRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{20} } + +func (m *TransferLeaderRequest) GetPeer() *metapb.Peer { + if m != nil { + return m.Peer + } + return nil +} + +type TransferLeaderResponse struct { + XXX_unrecognized []byte `json:"-"` +} + +func (m *TransferLeaderResponse) Reset() { *m = TransferLeaderResponse{} } +func (m *TransferLeaderResponse) String() string { return proto.CompactTextString(m) } +func (*TransferLeaderResponse) ProtoMessage() {} +func (*TransferLeaderResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{21} } + +type VerifyHashRequest struct { + Index *uint64 `protobuf:"varint,1,opt,name=index" json:"index,omitempty"` + Hash []byte `protobuf:"bytes,2,opt,name=hash" json:"hash,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *VerifyHashRequest) Reset() { *m = VerifyHashRequest{} } +func (m *VerifyHashRequest) String() string { return proto.CompactTextString(m) } +func (*VerifyHashRequest) ProtoMessage() {} +func (*VerifyHashRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{22} } + +func (m *VerifyHashRequest) GetIndex() uint64 { + if m != nil && m.Index != nil { + return *m.Index + } + return 0 +} + +func (m *VerifyHashRequest) GetHash() []byte { + if m != nil { + return m.Hash + } + return nil +} + +type VerifyHashResponse struct { + XXX_unrecognized []byte `json:"-"` +} + +func (m *VerifyHashResponse) Reset() { *m = VerifyHashResponse{} } +func (m *VerifyHashResponse) String() string { return proto.CompactTextString(m) } +func (*VerifyHashResponse) ProtoMessage() {} +func (*VerifyHashResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{23} } + +type AdminRequest struct { + CmdType *AdminCmdType `protobuf:"varint,1,opt,name=cmd_type,json=cmdType,enum=raft_cmdpb.AdminCmdType" json:"cmd_type,omitempty"` + ChangePeer *ChangePeerRequest `protobuf:"bytes,2,opt,name=change_peer,json=changePeer" json:"change_peer,omitempty"` + Split *SplitRequest `protobuf:"bytes,3,opt,name=split" json:"split,omitempty"` + CompactLog *CompactLogRequest `protobuf:"bytes,4,opt,name=compact_log,json=compactLog" json:"compact_log,omitempty"` + TransferLeader *TransferLeaderRequest `protobuf:"bytes,5,opt,name=transfer_leader,json=transferLeader" json:"transfer_leader,omitempty"` + VerifyHash *VerifyHashRequest `protobuf:"bytes,6,opt,name=verify_hash,json=verifyHash" json:"verify_hash,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *AdminRequest) Reset() { *m = AdminRequest{} } +func (m *AdminRequest) String() string { return proto.CompactTextString(m) } +func (*AdminRequest) ProtoMessage() {} +func (*AdminRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{24} } + +func (m *AdminRequest) GetCmdType() AdminCmdType { + if m != nil && m.CmdType != nil { + return *m.CmdType + } + return AdminCmdType_InvalidAdmin +} + +func (m *AdminRequest) GetChangePeer() *ChangePeerRequest { + if m != nil { + return m.ChangePeer + } + return nil +} + +func (m *AdminRequest) GetSplit() *SplitRequest { + if m != nil { + return m.Split + } + return nil +} + +func (m *AdminRequest) GetCompactLog() *CompactLogRequest { + if m != nil { + return m.CompactLog + } + return nil +} + +func (m *AdminRequest) GetTransferLeader() *TransferLeaderRequest { + if m != nil { + return m.TransferLeader + } + return nil +} + +func (m *AdminRequest) GetVerifyHash() *VerifyHashRequest { + if m != nil { + return m.VerifyHash + } + return nil +} + +type AdminResponse struct { + CmdType *AdminCmdType `protobuf:"varint,1,opt,name=cmd_type,json=cmdType,enum=raft_cmdpb.AdminCmdType" json:"cmd_type,omitempty"` + ChangePeer *ChangePeerResponse `protobuf:"bytes,2,opt,name=change_peer,json=changePeer" json:"change_peer,omitempty"` + Split *SplitResponse `protobuf:"bytes,3,opt,name=split" json:"split,omitempty"` + CompactLog *CompactLogResponse `protobuf:"bytes,4,opt,name=compact_log,json=compactLog" json:"compact_log,omitempty"` + TransferLeader *TransferLeaderResponse `protobuf:"bytes,5,opt,name=transfer_leader,json=transferLeader" json:"transfer_leader,omitempty"` + VerifyHash *VerifyHashResponse `protobuf:"bytes,6,opt,name=verify_hash,json=verifyHash" json:"verify_hash,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *AdminResponse) Reset() { *m = AdminResponse{} } +func (m *AdminResponse) String() string { return proto.CompactTextString(m) } +func (*AdminResponse) ProtoMessage() {} +func (*AdminResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{25} } + +func (m *AdminResponse) GetCmdType() AdminCmdType { + if m != nil && m.CmdType != nil { + return *m.CmdType + } + return AdminCmdType_InvalidAdmin +} + +func (m *AdminResponse) GetChangePeer() *ChangePeerResponse { + if m != nil { + return m.ChangePeer + } + return nil +} + +func (m *AdminResponse) GetSplit() *SplitResponse { + if m != nil { + return m.Split + } + return nil +} + +func (m *AdminResponse) GetCompactLog() *CompactLogResponse { + if m != nil { + return m.CompactLog + } + return nil +} + +func (m *AdminResponse) GetTransferLeader() *TransferLeaderResponse { + if m != nil { + return m.TransferLeader + } + return nil +} + +func (m *AdminResponse) GetVerifyHash() *VerifyHashResponse { + if m != nil { + return m.VerifyHash + } + return nil +} + +// For get the leader of the region. +type RegionLeaderRequest struct { + XXX_unrecognized []byte `json:"-"` +} + +func (m *RegionLeaderRequest) Reset() { *m = RegionLeaderRequest{} } +func (m *RegionLeaderRequest) String() string { return proto.CompactTextString(m) } +func (*RegionLeaderRequest) ProtoMessage() {} +func (*RegionLeaderRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{26} } + +type RegionLeaderResponse struct { + Leader *metapb.Peer `protobuf:"bytes,1,opt,name=leader" json:"leader,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *RegionLeaderResponse) Reset() { *m = RegionLeaderResponse{} } +func (m *RegionLeaderResponse) String() string { return proto.CompactTextString(m) } +func (*RegionLeaderResponse) ProtoMessage() {} +func (*RegionLeaderResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{27} } + +func (m *RegionLeaderResponse) GetLeader() *metapb.Peer { + if m != nil { + return m.Leader + } + return nil +} + +// For getting more information of the region. +// We add some admin operations (ChangePeer, Split...) into the pb job list, +// then pd server will peek the first one, handle it and then pop it from the job lib. +// But sometimes, the pd server may crash before popping. When another pd server +// starts and finds the job is running but not finished, it will first check whether +// the raft server already has handled this job. +// E,g, for ChangePeer, if we add Peer10 into region1 and find region1 has already had +// Peer10, we can think this ChangePeer is finished, and can pop this job from job list +// directly. +type RegionDetailRequest struct { + XXX_unrecognized []byte `json:"-"` +} + +func (m *RegionDetailRequest) Reset() { *m = RegionDetailRequest{} } +func (m *RegionDetailRequest) String() string { return proto.CompactTextString(m) } +func (*RegionDetailRequest) ProtoMessage() {} +func (*RegionDetailRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{28} } + +type RegionDetailResponse struct { + Region *metapb.Region `protobuf:"bytes,1,opt,name=region" json:"region,omitempty"` + Leader *metapb.Peer `protobuf:"bytes,2,opt,name=leader" json:"leader,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *RegionDetailResponse) Reset() { *m = RegionDetailResponse{} } +func (m *RegionDetailResponse) String() string { return proto.CompactTextString(m) } +func (*RegionDetailResponse) ProtoMessage() {} +func (*RegionDetailResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{29} } + +func (m *RegionDetailResponse) GetRegion() *metapb.Region { + if m != nil { + return m.Region + } + return nil +} + +func (m *RegionDetailResponse) GetLeader() *metapb.Peer { + if m != nil { + return m.Leader + } + return nil +} + +type StatusRequest struct { + CmdType *StatusCmdType `protobuf:"varint,1,opt,name=cmd_type,json=cmdType,enum=raft_cmdpb.StatusCmdType" json:"cmd_type,omitempty"` + RegionLeader *RegionLeaderRequest `protobuf:"bytes,2,opt,name=region_leader,json=regionLeader" json:"region_leader,omitempty"` + RegionDetail *RegionDetailRequest `protobuf:"bytes,3,opt,name=region_detail,json=regionDetail" json:"region_detail,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *StatusRequest) Reset() { *m = StatusRequest{} } +func (m *StatusRequest) String() string { return proto.CompactTextString(m) } +func (*StatusRequest) ProtoMessage() {} +func (*StatusRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{30} } + +func (m *StatusRequest) GetCmdType() StatusCmdType { + if m != nil && m.CmdType != nil { + return *m.CmdType + } + return StatusCmdType_InvalidStatus +} + +func (m *StatusRequest) GetRegionLeader() *RegionLeaderRequest { + if m != nil { + return m.RegionLeader + } + return nil +} + +func (m *StatusRequest) GetRegionDetail() *RegionDetailRequest { + if m != nil { + return m.RegionDetail + } + return nil +} + +type StatusResponse struct { + CmdType *StatusCmdType `protobuf:"varint,1,opt,name=cmd_type,json=cmdType,enum=raft_cmdpb.StatusCmdType" json:"cmd_type,omitempty"` + RegionLeader *RegionLeaderResponse `protobuf:"bytes,2,opt,name=region_leader,json=regionLeader" json:"region_leader,omitempty"` + RegionDetail *RegionDetailResponse `protobuf:"bytes,3,opt,name=region_detail,json=regionDetail" json:"region_detail,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *StatusResponse) Reset() { *m = StatusResponse{} } +func (m *StatusResponse) String() string { return proto.CompactTextString(m) } +func (*StatusResponse) ProtoMessage() {} +func (*StatusResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{31} } + +func (m *StatusResponse) GetCmdType() StatusCmdType { + if m != nil && m.CmdType != nil { + return *m.CmdType + } + return StatusCmdType_InvalidStatus +} + +func (m *StatusResponse) GetRegionLeader() *RegionLeaderResponse { + if m != nil { + return m.RegionLeader + } + return nil +} + +func (m *StatusResponse) GetRegionDetail() *RegionDetailResponse { + if m != nil { + return m.RegionDetail + } + return nil +} + +type RaftRequestHeader struct { + RegionId *uint64 `protobuf:"varint,1,opt,name=region_id,json=regionId" json:"region_id,omitempty"` + Peer *metapb.Peer `protobuf:"bytes,2,opt,name=peer" json:"peer,omitempty"` + // true for read linearization + ReadQuorum *bool `protobuf:"varint,3,opt,name=read_quorum,json=readQuorum" json:"read_quorum,omitempty"` + // 16 bytes, to distinguish request. + Uuid []byte `protobuf:"bytes,4,opt,name=uuid" json:"uuid,omitempty"` + RegionEpoch *metapb.RegionEpoch `protobuf:"bytes,5,opt,name=region_epoch,json=regionEpoch" json:"region_epoch,omitempty"` + Term *uint64 `protobuf:"varint,6,opt,name=term" json:"term,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *RaftRequestHeader) Reset() { *m = RaftRequestHeader{} } +func (m *RaftRequestHeader) String() string { return proto.CompactTextString(m) } +func (*RaftRequestHeader) ProtoMessage() {} +func (*RaftRequestHeader) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{32} } + +func (m *RaftRequestHeader) GetRegionId() uint64 { + if m != nil && m.RegionId != nil { + return *m.RegionId + } + return 0 +} + +func (m *RaftRequestHeader) GetPeer() *metapb.Peer { + if m != nil { + return m.Peer + } + return nil +} + +func (m *RaftRequestHeader) GetReadQuorum() bool { + if m != nil && m.ReadQuorum != nil { + return *m.ReadQuorum + } + return false +} + +func (m *RaftRequestHeader) GetUuid() []byte { + if m != nil { + return m.Uuid + } + return nil +} + +func (m *RaftRequestHeader) GetRegionEpoch() *metapb.RegionEpoch { + if m != nil { + return m.RegionEpoch + } + return nil +} + +func (m *RaftRequestHeader) GetTerm() uint64 { + if m != nil && m.Term != nil { + return *m.Term + } + return 0 +} + +type RaftResponseHeader struct { + Error *errorpb.Error `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"` + Uuid []byte `protobuf:"bytes,2,opt,name=uuid" json:"uuid,omitempty"` + CurrentTerm *uint64 `protobuf:"varint,3,opt,name=current_term,json=currentTerm" json:"current_term,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *RaftResponseHeader) Reset() { *m = RaftResponseHeader{} } +func (m *RaftResponseHeader) String() string { return proto.CompactTextString(m) } +func (*RaftResponseHeader) ProtoMessage() {} +func (*RaftResponseHeader) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{33} } + +func (m *RaftResponseHeader) GetError() *errorpb.Error { + if m != nil { + return m.Error + } + return nil +} + +func (m *RaftResponseHeader) GetUuid() []byte { + if m != nil { + return m.Uuid + } + return nil +} + +func (m *RaftResponseHeader) GetCurrentTerm() uint64 { + if m != nil && m.CurrentTerm != nil { + return *m.CurrentTerm + } + return 0 +} + +type RaftCmdRequest struct { + Header *RaftRequestHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + // We can't enclose normal requests and administrator request + // at same time. + Requests []*Request `protobuf:"bytes,2,rep,name=requests" json:"requests,omitempty"` + AdminRequest *AdminRequest `protobuf:"bytes,3,opt,name=admin_request,json=adminRequest" json:"admin_request,omitempty"` + StatusRequest *StatusRequest `protobuf:"bytes,4,opt,name=status_request,json=statusRequest" json:"status_request,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *RaftCmdRequest) Reset() { *m = RaftCmdRequest{} } +func (m *RaftCmdRequest) String() string { return proto.CompactTextString(m) } +func (*RaftCmdRequest) ProtoMessage() {} +func (*RaftCmdRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{34} } + +func (m *RaftCmdRequest) GetHeader() *RaftRequestHeader { + if m != nil { + return m.Header + } + return nil +} + +func (m *RaftCmdRequest) GetRequests() []*Request { + if m != nil { + return m.Requests + } + return nil +} + +func (m *RaftCmdRequest) GetAdminRequest() *AdminRequest { + if m != nil { + return m.AdminRequest + } + return nil +} + +func (m *RaftCmdRequest) GetStatusRequest() *StatusRequest { + if m != nil { + return m.StatusRequest + } + return nil +} + +type RaftCmdResponse struct { + Header *RaftResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Responses []*Response `protobuf:"bytes,2,rep,name=responses" json:"responses,omitempty"` + AdminResponse *AdminResponse `protobuf:"bytes,3,opt,name=admin_response,json=adminResponse" json:"admin_response,omitempty"` + StatusResponse *StatusResponse `protobuf:"bytes,4,opt,name=status_response,json=statusResponse" json:"status_response,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *RaftCmdResponse) Reset() { *m = RaftCmdResponse{} } +func (m *RaftCmdResponse) String() string { return proto.CompactTextString(m) } +func (*RaftCmdResponse) ProtoMessage() {} +func (*RaftCmdResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{35} } + +func (m *RaftCmdResponse) GetHeader() *RaftResponseHeader { + if m != nil { + return m.Header + } + return nil +} + +func (m *RaftCmdResponse) GetResponses() []*Response { + if m != nil { + return m.Responses + } + return nil +} + +func (m *RaftCmdResponse) GetAdminResponse() *AdminResponse { + if m != nil { + return m.AdminResponse + } + return nil +} + +func (m *RaftCmdResponse) GetStatusResponse() *StatusResponse { + if m != nil { + return m.StatusResponse + } + return nil +} + +func init() { + proto.RegisterType((*GetRequest)(nil), "raft_cmdpb.GetRequest") + proto.RegisterType((*GetResponse)(nil), "raft_cmdpb.GetResponse") + proto.RegisterType((*PutRequest)(nil), "raft_cmdpb.PutRequest") + proto.RegisterType((*PutResponse)(nil), "raft_cmdpb.PutResponse") + proto.RegisterType((*DeleteRequest)(nil), "raft_cmdpb.DeleteRequest") + proto.RegisterType((*DeleteResponse)(nil), "raft_cmdpb.DeleteResponse") + proto.RegisterType((*DeleteRangeRequest)(nil), "raft_cmdpb.DeleteRangeRequest") + proto.RegisterType((*DeleteRangeResponse)(nil), "raft_cmdpb.DeleteRangeResponse") + proto.RegisterType((*SnapRequest)(nil), "raft_cmdpb.SnapRequest") + proto.RegisterType((*SnapResponse)(nil), "raft_cmdpb.SnapResponse") + proto.RegisterType((*PrewriteRequest)(nil), "raft_cmdpb.PrewriteRequest") + proto.RegisterType((*PrewriteResponse)(nil), "raft_cmdpb.PrewriteResponse") + proto.RegisterType((*Request)(nil), "raft_cmdpb.Request") + proto.RegisterType((*Response)(nil), "raft_cmdpb.Response") + proto.RegisterType((*ChangePeerRequest)(nil), "raft_cmdpb.ChangePeerRequest") + proto.RegisterType((*ChangePeerResponse)(nil), "raft_cmdpb.ChangePeerResponse") + proto.RegisterType((*SplitRequest)(nil), "raft_cmdpb.SplitRequest") + proto.RegisterType((*SplitResponse)(nil), "raft_cmdpb.SplitResponse") + proto.RegisterType((*CompactLogRequest)(nil), "raft_cmdpb.CompactLogRequest") + proto.RegisterType((*CompactLogResponse)(nil), "raft_cmdpb.CompactLogResponse") + proto.RegisterType((*TransferLeaderRequest)(nil), "raft_cmdpb.TransferLeaderRequest") + proto.RegisterType((*TransferLeaderResponse)(nil), "raft_cmdpb.TransferLeaderResponse") + proto.RegisterType((*VerifyHashRequest)(nil), "raft_cmdpb.VerifyHashRequest") + proto.RegisterType((*VerifyHashResponse)(nil), "raft_cmdpb.VerifyHashResponse") + proto.RegisterType((*AdminRequest)(nil), "raft_cmdpb.AdminRequest") + proto.RegisterType((*AdminResponse)(nil), "raft_cmdpb.AdminResponse") + proto.RegisterType((*RegionLeaderRequest)(nil), "raft_cmdpb.RegionLeaderRequest") + proto.RegisterType((*RegionLeaderResponse)(nil), "raft_cmdpb.RegionLeaderResponse") + proto.RegisterType((*RegionDetailRequest)(nil), "raft_cmdpb.RegionDetailRequest") + proto.RegisterType((*RegionDetailResponse)(nil), "raft_cmdpb.RegionDetailResponse") + proto.RegisterType((*StatusRequest)(nil), "raft_cmdpb.StatusRequest") + proto.RegisterType((*StatusResponse)(nil), "raft_cmdpb.StatusResponse") + proto.RegisterType((*RaftRequestHeader)(nil), "raft_cmdpb.RaftRequestHeader") + proto.RegisterType((*RaftResponseHeader)(nil), "raft_cmdpb.RaftResponseHeader") + proto.RegisterType((*RaftCmdRequest)(nil), "raft_cmdpb.RaftCmdRequest") + proto.RegisterType((*RaftCmdResponse)(nil), "raft_cmdpb.RaftCmdResponse") + proto.RegisterEnum("raft_cmdpb.CmdType", CmdType_name, CmdType_value) + proto.RegisterEnum("raft_cmdpb.AdminCmdType", AdminCmdType_name, AdminCmdType_value) + proto.RegisterEnum("raft_cmdpb.StatusCmdType", StatusCmdType_name, StatusCmdType_value) +} +func (m *GetRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Cf != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(*m.Cf))) + i += copy(dAtA[i:], *m.Cf) + } + if m.Key != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *GetResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Value != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.Value))) + i += copy(dAtA[i:], m.Value) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *PutRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PutRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Cf != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(*m.Cf))) + i += copy(dAtA[i:], *m.Cf) + } + if m.Key != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + if m.Value != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.Value))) + i += copy(dAtA[i:], m.Value) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *PutResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PutResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *DeleteRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Cf != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(*m.Cf))) + i += copy(dAtA[i:], *m.Cf) + } + if m.Key != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *DeleteResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *DeleteRangeRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteRangeRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Cf != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(*m.Cf))) + i += copy(dAtA[i:], *m.Cf) + } + if m.StartKey != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.StartKey))) + i += copy(dAtA[i:], m.StartKey) + } + if m.EndKey != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.EndKey))) + i += copy(dAtA[i:], m.EndKey) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *DeleteRangeResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteRangeResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *SnapRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SnapRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *SnapResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SnapResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Region != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Region.Size())) + n1, err := m.Region.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *PrewriteRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PrewriteRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Key != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + if m.Value != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.Value))) + i += copy(dAtA[i:], m.Value) + } + if m.Lock != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.Lock))) + i += copy(dAtA[i:], m.Lock) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *PrewriteResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PrewriteResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Request) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Request) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.CmdType != nil { + dAtA[i] = 0x8 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.CmdType)) + } + if m.Get != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Get.Size())) + n2, err := m.Get.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.Put != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Put.Size())) + n3, err := m.Put.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if m.Delete != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Delete.Size())) + n4, err := m.Delete.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + if m.Snap != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Snap.Size())) + n5, err := m.Snap.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + if m.Prewrite != nil { + dAtA[i] = 0x3a + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Prewrite.Size())) + n6, err := m.Prewrite.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + if m.DeleteRange != nil { + dAtA[i] = 0x42 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.DeleteRange.Size())) + n7, err := m.DeleteRange.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n7 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *Response) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Response) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.CmdType != nil { + dAtA[i] = 0x8 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.CmdType)) + } + if m.Get != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Get.Size())) + n8, err := m.Get.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n8 + } + if m.Put != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Put.Size())) + n9, err := m.Put.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n9 + } + if m.Delete != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Delete.Size())) + n10, err := m.Delete.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n10 + } + if m.Snap != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Snap.Size())) + n11, err := m.Snap.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n11 + } + if m.Prewrite != nil { + dAtA[i] = 0x3a + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Prewrite.Size())) + n12, err := m.Prewrite.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n12 + } + if m.DelteRange != nil { + dAtA[i] = 0x42 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.DelteRange.Size())) + n13, err := m.DelteRange.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n13 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *ChangePeerRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ChangePeerRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.ChangeType != nil { + dAtA[i] = 0x8 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.ChangeType)) + } + if m.Peer != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Peer.Size())) + n14, err := m.Peer.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n14 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *ChangePeerResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ChangePeerResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Region != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Region.Size())) + n15, err := m.Region.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n15 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *SplitRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SplitRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.SplitKey != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.SplitKey))) + i += copy(dAtA[i:], m.SplitKey) + } + if m.NewRegionId != nil { + dAtA[i] = 0x10 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.NewRegionId)) + } + if len(m.NewPeerIds) > 0 { + for _, num := range m.NewPeerIds { + dAtA[i] = 0x18 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(num)) + } + } + if m.RightDerive != nil { + dAtA[i] = 0x20 + i++ + if *m.RightDerive { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *SplitResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SplitResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Left != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Left.Size())) + n16, err := m.Left.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n16 + } + if m.Right != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Right.Size())) + n17, err := m.Right.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n17 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *CompactLogRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CompactLogRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.CompactIndex != nil { + dAtA[i] = 0x8 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.CompactIndex)) + } + if m.CompactTerm != nil { + dAtA[i] = 0x10 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.CompactTerm)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *CompactLogResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CompactLogResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *TransferLeaderRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TransferLeaderRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Peer != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Peer.Size())) + n18, err := m.Peer.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n18 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *TransferLeaderResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TransferLeaderResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *VerifyHashRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VerifyHashRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Index != nil { + dAtA[i] = 0x8 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.Index)) + } + if m.Hash != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.Hash))) + i += copy(dAtA[i:], m.Hash) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *VerifyHashResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VerifyHashResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *AdminRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AdminRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.CmdType != nil { + dAtA[i] = 0x8 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.CmdType)) + } + if m.ChangePeer != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.ChangePeer.Size())) + n19, err := m.ChangePeer.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n19 + } + if m.Split != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Split.Size())) + n20, err := m.Split.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n20 + } + if m.CompactLog != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.CompactLog.Size())) + n21, err := m.CompactLog.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n21 + } + if m.TransferLeader != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.TransferLeader.Size())) + n22, err := m.TransferLeader.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n22 + } + if m.VerifyHash != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.VerifyHash.Size())) + n23, err := m.VerifyHash.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n23 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *AdminResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AdminResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.CmdType != nil { + dAtA[i] = 0x8 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.CmdType)) + } + if m.ChangePeer != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.ChangePeer.Size())) + n24, err := m.ChangePeer.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n24 + } + if m.Split != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Split.Size())) + n25, err := m.Split.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n25 + } + if m.CompactLog != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.CompactLog.Size())) + n26, err := m.CompactLog.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n26 + } + if m.TransferLeader != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.TransferLeader.Size())) + n27, err := m.TransferLeader.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n27 + } + if m.VerifyHash != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.VerifyHash.Size())) + n28, err := m.VerifyHash.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n28 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RegionLeaderRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RegionLeaderRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RegionLeaderResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RegionLeaderResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Leader != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Leader.Size())) + n29, err := m.Leader.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n29 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RegionDetailRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RegionDetailRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RegionDetailResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RegionDetailResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Region != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Region.Size())) + n30, err := m.Region.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n30 + } + if m.Leader != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Leader.Size())) + n31, err := m.Leader.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n31 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *StatusRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StatusRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.CmdType != nil { + dAtA[i] = 0x8 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.CmdType)) + } + if m.RegionLeader != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.RegionLeader.Size())) + n32, err := m.RegionLeader.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n32 + } + if m.RegionDetail != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.RegionDetail.Size())) + n33, err := m.RegionDetail.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n33 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *StatusResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StatusResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.CmdType != nil { + dAtA[i] = 0x8 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.CmdType)) + } + if m.RegionLeader != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.RegionLeader.Size())) + n34, err := m.RegionLeader.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n34 + } + if m.RegionDetail != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.RegionDetail.Size())) + n35, err := m.RegionDetail.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n35 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RaftRequestHeader) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RaftRequestHeader) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionId != nil { + dAtA[i] = 0x8 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.RegionId)) + } + if m.Peer != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Peer.Size())) + n36, err := m.Peer.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n36 + } + if m.ReadQuorum != nil { + dAtA[i] = 0x18 + i++ + if *m.ReadQuorum { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.Uuid != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.Uuid))) + i += copy(dAtA[i:], m.Uuid) + } + if m.RegionEpoch != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.RegionEpoch.Size())) + n37, err := m.RegionEpoch.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n37 + } + if m.Term != nil { + dAtA[i] = 0x30 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.Term)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RaftResponseHeader) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RaftResponseHeader) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Error != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Error.Size())) + n38, err := m.Error.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n38 + } + if m.Uuid != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.Uuid))) + i += copy(dAtA[i:], m.Uuid) + } + if m.CurrentTerm != nil { + dAtA[i] = 0x18 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.CurrentTerm)) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RaftCmdRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RaftCmdRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Header != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Header.Size())) + n39, err := m.Header.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n39 + } + if len(m.Requests) > 0 { + for _, msg := range m.Requests { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.AdminRequest != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.AdminRequest.Size())) + n40, err := m.AdminRequest.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n40 + } + if m.StatusRequest != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.StatusRequest.Size())) + n41, err := m.StatusRequest.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n41 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *RaftCmdResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RaftCmdResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Header != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Header.Size())) + n42, err := m.Header.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n42 + } + if len(m.Responses) > 0 { + for _, msg := range m.Responses { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.AdminResponse != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.AdminResponse.Size())) + n43, err := m.AdminResponse.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n43 + } + if m.StatusResponse != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.StatusResponse.Size())) + n44, err := m.StatusResponse.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n44 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeFixed64RaftCmdpb(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32RaftCmdpb(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintRaftCmdpb(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *GetRequest) Size() (n int) { + var l int + _ = l + if m.Cf != nil { + l = len(*m.Cf) + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.Key != nil { + l = len(m.Key) + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetResponse) Size() (n int) { + var l int + _ = l + if m.Value != nil { + l = len(m.Value) + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PutRequest) Size() (n int) { + var l int + _ = l + if m.Cf != nil { + l = len(*m.Cf) + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.Key != nil { + l = len(m.Key) + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.Value != nil { + l = len(m.Value) + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PutResponse) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteRequest) Size() (n int) { + var l int + _ = l + if m.Cf != nil { + l = len(*m.Cf) + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.Key != nil { + l = len(m.Key) + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteResponse) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteRangeRequest) Size() (n int) { + var l int + _ = l + if m.Cf != nil { + l = len(*m.Cf) + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.StartKey != nil { + l = len(m.StartKey) + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.EndKey != nil { + l = len(m.EndKey) + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *DeleteRangeResponse) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SnapRequest) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SnapResponse) Size() (n int) { + var l int + _ = l + if m.Region != nil { + l = m.Region.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PrewriteRequest) Size() (n int) { + var l int + _ = l + if m.Key != nil { + l = len(m.Key) + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.Value != nil { + l = len(m.Value) + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.Lock != nil { + l = len(m.Lock) + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PrewriteResponse) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Request) Size() (n int) { + var l int + _ = l + if m.CmdType != nil { + n += 1 + sovRaftCmdpb(uint64(*m.CmdType)) + } + if m.Get != nil { + l = m.Get.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.Put != nil { + l = m.Put.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.Delete != nil { + l = m.Delete.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.Snap != nil { + l = m.Snap.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.Prewrite != nil { + l = m.Prewrite.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.DeleteRange != nil { + l = m.DeleteRange.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Response) Size() (n int) { + var l int + _ = l + if m.CmdType != nil { + n += 1 + sovRaftCmdpb(uint64(*m.CmdType)) + } + if m.Get != nil { + l = m.Get.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.Put != nil { + l = m.Put.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.Delete != nil { + l = m.Delete.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.Snap != nil { + l = m.Snap.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.Prewrite != nil { + l = m.Prewrite.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.DelteRange != nil { + l = m.DelteRange.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ChangePeerRequest) Size() (n int) { + var l int + _ = l + if m.ChangeType != nil { + n += 1 + sovRaftCmdpb(uint64(*m.ChangeType)) + } + if m.Peer != nil { + l = m.Peer.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ChangePeerResponse) Size() (n int) { + var l int + _ = l + if m.Region != nil { + l = m.Region.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SplitRequest) Size() (n int) { + var l int + _ = l + if m.SplitKey != nil { + l = len(m.SplitKey) + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.NewRegionId != nil { + n += 1 + sovRaftCmdpb(uint64(*m.NewRegionId)) + } + if len(m.NewPeerIds) > 0 { + for _, e := range m.NewPeerIds { + n += 1 + sovRaftCmdpb(uint64(e)) + } + } + if m.RightDerive != nil { + n += 2 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SplitResponse) Size() (n int) { + var l int + _ = l + if m.Left != nil { + l = m.Left.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.Right != nil { + l = m.Right.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CompactLogRequest) Size() (n int) { + var l int + _ = l + if m.CompactIndex != nil { + n += 1 + sovRaftCmdpb(uint64(*m.CompactIndex)) + } + if m.CompactTerm != nil { + n += 1 + sovRaftCmdpb(uint64(*m.CompactTerm)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CompactLogResponse) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *TransferLeaderRequest) Size() (n int) { + var l int + _ = l + if m.Peer != nil { + l = m.Peer.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *TransferLeaderResponse) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *VerifyHashRequest) Size() (n int) { + var l int + _ = l + if m.Index != nil { + n += 1 + sovRaftCmdpb(uint64(*m.Index)) + } + if m.Hash != nil { + l = len(m.Hash) + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *VerifyHashResponse) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *AdminRequest) Size() (n int) { + var l int + _ = l + if m.CmdType != nil { + n += 1 + sovRaftCmdpb(uint64(*m.CmdType)) + } + if m.ChangePeer != nil { + l = m.ChangePeer.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.Split != nil { + l = m.Split.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.CompactLog != nil { + l = m.CompactLog.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.TransferLeader != nil { + l = m.TransferLeader.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.VerifyHash != nil { + l = m.VerifyHash.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *AdminResponse) Size() (n int) { + var l int + _ = l + if m.CmdType != nil { + n += 1 + sovRaftCmdpb(uint64(*m.CmdType)) + } + if m.ChangePeer != nil { + l = m.ChangePeer.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.Split != nil { + l = m.Split.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.CompactLog != nil { + l = m.CompactLog.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.TransferLeader != nil { + l = m.TransferLeader.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.VerifyHash != nil { + l = m.VerifyHash.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RegionLeaderRequest) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RegionLeaderResponse) Size() (n int) { + var l int + _ = l + if m.Leader != nil { + l = m.Leader.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RegionDetailRequest) Size() (n int) { + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RegionDetailResponse) Size() (n int) { + var l int + _ = l + if m.Region != nil { + l = m.Region.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.Leader != nil { + l = m.Leader.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StatusRequest) Size() (n int) { + var l int + _ = l + if m.CmdType != nil { + n += 1 + sovRaftCmdpb(uint64(*m.CmdType)) + } + if m.RegionLeader != nil { + l = m.RegionLeader.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.RegionDetail != nil { + l = m.RegionDetail.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StatusResponse) Size() (n int) { + var l int + _ = l + if m.CmdType != nil { + n += 1 + sovRaftCmdpb(uint64(*m.CmdType)) + } + if m.RegionLeader != nil { + l = m.RegionLeader.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.RegionDetail != nil { + l = m.RegionDetail.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RaftRequestHeader) Size() (n int) { + var l int + _ = l + if m.RegionId != nil { + n += 1 + sovRaftCmdpb(uint64(*m.RegionId)) + } + if m.Peer != nil { + l = m.Peer.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.ReadQuorum != nil { + n += 2 + } + if m.Uuid != nil { + l = len(m.Uuid) + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.RegionEpoch != nil { + l = m.RegionEpoch.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.Term != nil { + n += 1 + sovRaftCmdpb(uint64(*m.Term)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RaftResponseHeader) Size() (n int) { + var l int + _ = l + if m.Error != nil { + l = m.Error.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.Uuid != nil { + l = len(m.Uuid) + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.CurrentTerm != nil { + n += 1 + sovRaftCmdpb(uint64(*m.CurrentTerm)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RaftCmdRequest) Size() (n int) { + var l int + _ = l + if m.Header != nil { + l = m.Header.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if len(m.Requests) > 0 { + for _, e := range m.Requests { + l = e.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + } + if m.AdminRequest != nil { + l = m.AdminRequest.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.StatusRequest != nil { + l = m.StatusRequest.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RaftCmdResponse) Size() (n int) { + var l int + _ = l + if m.Header != nil { + l = m.Header.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if len(m.Responses) > 0 { + for _, e := range m.Responses { + l = e.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + } + if m.AdminResponse != nil { + l = m.AdminResponse.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.StatusResponse != nil { + l = m.StatusResponse.Size() + n += 1 + l + sovRaftCmdpb(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovRaftCmdpb(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozRaftCmdpb(x uint64) (n int) { + return sovRaftCmdpb(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GetRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cf", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.Cf = &s + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PutRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PutRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PutRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cf", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.Cf = &s + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PutResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PutResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PutResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cf", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.Cf = &s + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteRangeRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteRangeRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteRangeRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cf", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.Cf = &s + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StartKey = append(m.StartKey[:0], dAtA[iNdEx:postIndex]...) + if m.StartKey == nil { + m.StartKey = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EndKey = append(m.EndKey[:0], dAtA[iNdEx:postIndex]...) + if m.EndKey == nil { + m.EndKey = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteRangeResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteRangeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteRangeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SnapRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SnapRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SnapRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SnapResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SnapResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SnapResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Region", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Region == nil { + m.Region = &metapb.Region{} + } + if err := m.Region.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PrewriteRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PrewriteRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PrewriteRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Lock", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Lock = append(m.Lock[:0], dAtA[iNdEx:postIndex]...) + if m.Lock == nil { + m.Lock = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PrewriteResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PrewriteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PrewriteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Request) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Request: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Request: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CmdType", wireType) + } + var v CmdType + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (CmdType(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.CmdType = &v + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Get", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Get == nil { + m.Get = &GetRequest{} + } + if err := m.Get.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Put", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Put == nil { + m.Put = &PutRequest{} + } + if err := m.Put.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delete", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Delete == nil { + m.Delete = &DeleteRequest{} + } + if err := m.Delete.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Snap", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Snap == nil { + m.Snap = &SnapRequest{} + } + if err := m.Snap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Prewrite", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Prewrite == nil { + m.Prewrite = &PrewriteRequest{} + } + if err := m.Prewrite.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DeleteRange", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DeleteRange == nil { + m.DeleteRange = &DeleteRangeRequest{} + } + if err := m.DeleteRange.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Response) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Response: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Response: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CmdType", wireType) + } + var v CmdType + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (CmdType(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.CmdType = &v + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Get", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Get == nil { + m.Get = &GetResponse{} + } + if err := m.Get.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Put", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Put == nil { + m.Put = &PutResponse{} + } + if err := m.Put.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delete", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Delete == nil { + m.Delete = &DeleteResponse{} + } + if err := m.Delete.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Snap", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Snap == nil { + m.Snap = &SnapResponse{} + } + if err := m.Snap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Prewrite", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Prewrite == nil { + m.Prewrite = &PrewriteResponse{} + } + if err := m.Prewrite.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelteRange", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DelteRange == nil { + m.DelteRange = &DeleteRangeResponse{} + } + if err := m.DelteRange.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ChangePeerRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ChangePeerRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ChangePeerRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ChangeType", wireType) + } + var v eraftpb.ConfChangeType + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (eraftpb.ConfChangeType(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.ChangeType = &v + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Peer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Peer == nil { + m.Peer = &metapb.Peer{} + } + if err := m.Peer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ChangePeerResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ChangePeerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ChangePeerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Region", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Region == nil { + m.Region = &metapb.Region{} + } + if err := m.Region.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SplitRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SplitRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SplitRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SplitKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SplitKey = append(m.SplitKey[:0], dAtA[iNdEx:postIndex]...) + if m.SplitKey == nil { + m.SplitKey = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NewRegionId", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.NewRegionId = &v + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NewPeerIds", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.NewPeerIds = append(m.NewPeerIds, v) + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RightDerive", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.RightDerive = &b + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SplitResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SplitResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SplitResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Left", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Left == nil { + m.Left = &metapb.Region{} + } + if err := m.Left.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Right", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Right == nil { + m.Right = &metapb.Region{} + } + if err := m.Right.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CompactLogRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CompactLogRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CompactLogRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CompactIndex", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.CompactIndex = &v + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CompactTerm", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.CompactTerm = &v + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CompactLogResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CompactLogResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CompactLogResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TransferLeaderRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TransferLeaderRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TransferLeaderRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Peer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Peer == nil { + m.Peer = &metapb.Peer{} + } + if err := m.Peer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TransferLeaderResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TransferLeaderResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TransferLeaderResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *VerifyHashRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: VerifyHashRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VerifyHashRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Index = &v + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *VerifyHashResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: VerifyHashResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VerifyHashResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AdminRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AdminRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AdminRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CmdType", wireType) + } + var v AdminCmdType + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (AdminCmdType(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.CmdType = &v + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChangePeer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ChangePeer == nil { + m.ChangePeer = &ChangePeerRequest{} + } + if err := m.ChangePeer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Split", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Split == nil { + m.Split = &SplitRequest{} + } + if err := m.Split.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CompactLog", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CompactLog == nil { + m.CompactLog = &CompactLogRequest{} + } + if err := m.CompactLog.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TransferLeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TransferLeader == nil { + m.TransferLeader = &TransferLeaderRequest{} + } + if err := m.TransferLeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHash", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHash == nil { + m.VerifyHash = &VerifyHashRequest{} + } + if err := m.VerifyHash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AdminResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AdminResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AdminResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CmdType", wireType) + } + var v AdminCmdType + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (AdminCmdType(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.CmdType = &v + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChangePeer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ChangePeer == nil { + m.ChangePeer = &ChangePeerResponse{} + } + if err := m.ChangePeer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Split", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Split == nil { + m.Split = &SplitResponse{} + } + if err := m.Split.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CompactLog", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CompactLog == nil { + m.CompactLog = &CompactLogResponse{} + } + if err := m.CompactLog.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TransferLeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TransferLeader == nil { + m.TransferLeader = &TransferLeaderResponse{} + } + if err := m.TransferLeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VerifyHash", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VerifyHash == nil { + m.VerifyHash = &VerifyHashResponse{} + } + if err := m.VerifyHash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RegionLeaderRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RegionLeaderRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RegionLeaderRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RegionLeaderResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RegionLeaderResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RegionLeaderResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Leader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Leader == nil { + m.Leader = &metapb.Peer{} + } + if err := m.Leader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RegionDetailRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RegionDetailRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RegionDetailRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RegionDetailResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RegionDetailResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RegionDetailResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Region", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Region == nil { + m.Region = &metapb.Region{} + } + if err := m.Region.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Leader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Leader == nil { + m.Leader = &metapb.Peer{} + } + if err := m.Leader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StatusRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StatusRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StatusRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CmdType", wireType) + } + var v StatusCmdType + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (StatusCmdType(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.CmdType = &v + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionLeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionLeader == nil { + m.RegionLeader = &RegionLeaderRequest{} + } + if err := m.RegionLeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionDetail", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionDetail == nil { + m.RegionDetail = &RegionDetailRequest{} + } + if err := m.RegionDetail.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StatusResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StatusResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StatusResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CmdType", wireType) + } + var v StatusCmdType + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (StatusCmdType(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.CmdType = &v + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionLeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionLeader == nil { + m.RegionLeader = &RegionLeaderResponse{} + } + if err := m.RegionLeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionDetail", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionDetail == nil { + m.RegionDetail = &RegionDetailResponse{} + } + if err := m.RegionDetail.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RaftRequestHeader) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RaftRequestHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RaftRequestHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionId", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.RegionId = &v + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Peer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Peer == nil { + m.Peer = &metapb.Peer{} + } + if err := m.Peer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ReadQuorum", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.ReadQuorum = &b + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Uuid", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Uuid = append(m.Uuid[:0], dAtA[iNdEx:postIndex]...) + if m.Uuid == nil { + m.Uuid = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionEpoch", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionEpoch == nil { + m.RegionEpoch = &metapb.RegionEpoch{} + } + if err := m.RegionEpoch.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Term = &v + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RaftResponseHeader) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RaftResponseHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RaftResponseHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Error == nil { + m.Error = &errorpb.Error{} + } + if err := m.Error.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Uuid", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Uuid = append(m.Uuid[:0], dAtA[iNdEx:postIndex]...) + if m.Uuid == nil { + m.Uuid = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentTerm", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.CurrentTerm = &v + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RaftCmdRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RaftCmdRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RaftCmdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Header == nil { + m.Header = &RaftRequestHeader{} + } + if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Requests", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Requests = append(m.Requests, &Request{}) + if err := m.Requests[len(m.Requests)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AdminRequest", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.AdminRequest == nil { + m.AdminRequest = &AdminRequest{} + } + if err := m.AdminRequest.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StatusRequest", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.StatusRequest == nil { + m.StatusRequest = &StatusRequest{} + } + if err := m.StatusRequest.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RaftCmdResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RaftCmdResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RaftCmdResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Header == nil { + m.Header = &RaftResponseHeader{} + } + if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Responses", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Responses = append(m.Responses, &Response{}) + if err := m.Responses[len(m.Responses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AdminResponse", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.AdminResponse == nil { + m.AdminResponse = &AdminResponse{} + } + if err := m.AdminResponse.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StatusResponse", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftCmdpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.StatusResponse == nil { + m.StatusResponse = &StatusResponse{} + } + if err := m.StatusResponse.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftCmdpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipRaftCmdpb(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthRaftCmdpb + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRaftCmdpb + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipRaftCmdpb(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthRaftCmdpb = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRaftCmdpb = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("raft_cmdpb.proto", fileDescriptorRaftCmdpb) } + +var fileDescriptorRaftCmdpb = []byte{ + // 1570 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x58, 0x5f, 0x73, 0xdb, 0xc4, + 0x16, 0x8f, 0xfc, 0x3f, 0xc7, 0xb2, 0xa3, 0x6c, 0xd2, 0xc6, 0x6d, 0xef, 0x75, 0x5d, 0xb5, 0x73, + 0x27, 0xcd, 0xbd, 0xe3, 0x4e, 0x73, 0xa1, 0x94, 0x99, 0x96, 0xb6, 0x24, 0xa1, 0x0d, 0x2d, 0x33, + 0x61, 0xdb, 0x61, 0x06, 0x18, 0x46, 0x23, 0xac, 0x75, 0xa2, 0x89, 0x2d, 0xab, 0x92, 0x9c, 0x90, + 0x37, 0x1e, 0xe0, 0x1b, 0xf0, 0xc0, 0x47, 0xe2, 0x11, 0x06, 0x3e, 0x00, 0x53, 0x9e, 0x78, 0xe1, + 0x9d, 0x27, 0x98, 0xdd, 0x3d, 0x2b, 0xad, 0x6c, 0xb9, 0xb4, 0x7d, 0xca, 0xee, 0xd9, 0xb3, 0xe7, + 0xcf, 0xef, 0x77, 0xf6, 0x1c, 0x2b, 0x60, 0x45, 0xee, 0x30, 0x71, 0x06, 0x63, 0x2f, 0xfc, 0xb2, + 0x1f, 0x46, 0x93, 0x64, 0x42, 0x20, 0x93, 0x5c, 0x34, 0xc7, 0x2c, 0x71, 0xd5, 0xc9, 0xc5, 0x16, + 0x8b, 0xa2, 0x49, 0xa4, 0x6f, 0xdd, 0x61, 0xa2, 0xb6, 0x76, 0x1f, 0xe0, 0x21, 0x4b, 0x28, 0x7b, + 0x3e, 0x65, 0x71, 0x42, 0xda, 0x50, 0x1a, 0x0c, 0x3b, 0x46, 0xcf, 0xd8, 0x5c, 0xa6, 0xa5, 0xc1, + 0x90, 0x58, 0x50, 0x3e, 0x66, 0x67, 0x9d, 0x52, 0xcf, 0xd8, 0x34, 0x29, 0x5f, 0xda, 0x57, 0xa1, + 0x29, 0xf4, 0xe3, 0x70, 0x12, 0xc4, 0x8c, 0xac, 0x43, 0xf5, 0xc4, 0x1d, 0x4d, 0x99, 0xb8, 0x63, + 0x52, 0xb9, 0xb1, 0x77, 0x01, 0x0e, 0xa6, 0xaf, 0x6e, 0x34, 0xb3, 0x52, 0xd6, 0xad, 0xb4, 0xa0, + 0x29, 0xac, 0x48, 0x57, 0xf6, 0x4d, 0x68, 0xed, 0xb2, 0x11, 0x4b, 0xd8, 0xab, 0x07, 0x6b, 0x41, + 0x5b, 0x5d, 0x41, 0x23, 0x9f, 0x01, 0x41, 0x89, 0x1b, 0x1c, 0x2e, 0xb4, 0x74, 0x09, 0x96, 0xe3, + 0xc4, 0x8d, 0x12, 0x27, 0xb3, 0xd7, 0x10, 0x82, 0xc7, 0xec, 0x8c, 0x6c, 0x40, 0x9d, 0x05, 0x9e, + 0x38, 0x92, 0xe1, 0xd6, 0x58, 0xe0, 0x3d, 0x66, 0x67, 0xf6, 0x39, 0x58, 0xcb, 0xd9, 0x46, 0x97, + 0x2d, 0x68, 0x3e, 0x0d, 0xdc, 0x10, 0x7d, 0xd9, 0xb7, 0xc0, 0x94, 0x5b, 0x44, 0xf0, 0x3f, 0x50, + 0x8b, 0xd8, 0xa1, 0x3f, 0x09, 0x84, 0xff, 0xe6, 0x76, 0xbb, 0x8f, 0xec, 0x51, 0x21, 0xa5, 0x78, + 0x6a, 0x7f, 0x04, 0x2b, 0x07, 0x11, 0x3b, 0x8d, 0xfc, 0x0c, 0x00, 0x4c, 0xd8, 0x28, 0x00, 0xb2, + 0xa4, 0x01, 0x49, 0x08, 0x54, 0x46, 0x93, 0xc1, 0x31, 0x86, 0x2b, 0xd6, 0x36, 0x01, 0x2b, 0x33, + 0x87, 0x91, 0xfe, 0x5e, 0x82, 0xba, 0xb2, 0xdd, 0x87, 0xc6, 0x60, 0xec, 0x39, 0xc9, 0x59, 0x28, + 0xb9, 0x6d, 0x6f, 0xaf, 0xf5, 0xb5, 0xa2, 0xdb, 0x19, 0x7b, 0xcf, 0xce, 0x42, 0x46, 0xeb, 0x03, + 0xb9, 0x20, 0x9b, 0x50, 0x3e, 0x64, 0x89, 0xf0, 0xdb, 0xdc, 0x3e, 0xaf, 0xab, 0x66, 0xe5, 0x45, + 0xb9, 0x0a, 0xd7, 0x0c, 0xa7, 0x49, 0xa7, 0x32, 0xaf, 0x99, 0xd5, 0x0c, 0xe5, 0x2a, 0xe4, 0x26, + 0xd4, 0x3c, 0x01, 0x68, 0xa7, 0x2a, 0x94, 0x2f, 0xe8, 0xca, 0xb9, 0x5a, 0xa0, 0xa8, 0x48, 0xfe, + 0x0b, 0x95, 0x38, 0x70, 0xc3, 0x4e, 0x4d, 0x5c, 0xd8, 0xd0, 0x2f, 0x68, 0x24, 0x50, 0xa1, 0x44, + 0xde, 0x81, 0x46, 0x88, 0x18, 0x74, 0xea, 0xe2, 0xc2, 0xa5, 0x5c, 0x38, 0x79, 0xb8, 0x69, 0xaa, + 0x4c, 0x1e, 0x80, 0x29, 0xfd, 0x39, 0x11, 0xa7, 0xba, 0xd3, 0x10, 0x97, 0xbb, 0x05, 0xe1, 0x69, + 0x55, 0x46, 0x9b, 0x5e, 0x26, 0xb3, 0xff, 0x28, 0x41, 0x23, 0xad, 0x81, 0xd7, 0x05, 0xfb, 0xba, + 0x0e, 0xf6, 0xc6, 0x1c, 0xd8, 0xd2, 0xaa, 0x44, 0xfb, 0xba, 0x8e, 0xf6, 0xc6, 0x1c, 0xda, 0x4a, + 0x95, 0xc3, 0xbd, 0x3d, 0x03, 0xf7, 0xc5, 0x22, 0xb8, 0xf1, 0x82, 0xc2, 0xfb, 0x7f, 0x39, 0xbc, + 0x3b, 0xf3, 0x78, 0xa3, 0xbe, 0x04, 0xfc, 0xf6, 0x1c, 0xe0, 0xff, 0x2a, 0x06, 0x1c, 0x6f, 0x65, + 0x88, 0xdf, 0x07, 0x8e, 0xde, 0x0c, 0xe0, 0x97, 0x17, 0x02, 0x8e, 0xf7, 0x41, 0xdc, 0x91, 0x80, + 0x4f, 0x60, 0x75, 0xe7, 0x88, 0xaf, 0x0e, 0x18, 0x8b, 0x54, 0x95, 0xdf, 0x86, 0xe6, 0x40, 0x08, + 0x75, 0xec, 0x37, 0xfa, 0xaa, 0x45, 0xee, 0x4c, 0x82, 0xa1, 0xbc, 0x24, 0xf0, 0x87, 0x41, 0xba, + 0x26, 0x3d, 0xa8, 0x84, 0x8c, 0x45, 0xc8, 0x81, 0xa9, 0x1e, 0xad, 0x30, 0x2e, 0x4e, 0xec, 0x3b, + 0x40, 0x74, 0x87, 0xaf, 0xf9, 0xdc, 0xbf, 0x33, 0xc0, 0x7c, 0x1a, 0x8e, 0xfc, 0xb4, 0x8b, 0xf2, + 0x9e, 0xc4, 0xf7, 0x4e, 0xf6, 0xe4, 0x1b, 0x42, 0xc0, 0x7b, 0x92, 0x0d, 0xad, 0x80, 0x9d, 0x3a, + 0xf2, 0xae, 0xe3, 0x7b, 0x22, 0xac, 0x0a, 0x6d, 0x06, 0xec, 0x54, 0xda, 0xdd, 0xf7, 0x48, 0x0f, + 0x4c, 0xae, 0xc3, 0x63, 0x73, 0x7c, 0x2f, 0xee, 0x94, 0x7b, 0xe5, 0xcd, 0x0a, 0x85, 0x80, 0x9d, + 0xf2, 0x00, 0xf7, 0xbd, 0x98, 0x5c, 0x01, 0x33, 0xf2, 0x0f, 0x8f, 0x12, 0xc7, 0x63, 0x91, 0x7f, + 0xc2, 0x44, 0xd1, 0x34, 0x68, 0x53, 0xc8, 0x76, 0x85, 0xc8, 0xfe, 0x14, 0x5a, 0x18, 0x15, 0xe6, + 0x63, 0x43, 0x65, 0xc4, 0x86, 0xc9, 0x82, 0x6c, 0xc4, 0x19, 0xb9, 0x06, 0x55, 0x61, 0x03, 0xc1, + 0x9a, 0x55, 0x92, 0x87, 0xf6, 0xe7, 0xb0, 0xba, 0x33, 0x19, 0x87, 0xee, 0x20, 0x79, 0x32, 0x39, + 0x54, 0x59, 0x5f, 0x85, 0xd6, 0x40, 0x0a, 0x1d, 0x3f, 0xf0, 0xd8, 0x57, 0xc2, 0x4f, 0x85, 0x9a, + 0x28, 0xdc, 0xe7, 0x32, 0x1e, 0xb7, 0x52, 0x4a, 0x58, 0x34, 0x56, 0xc9, 0xa3, 0xec, 0x19, 0x8b, + 0xc6, 0xf6, 0x3a, 0x10, 0xdd, 0x38, 0x36, 0xbc, 0x77, 0xe1, 0xdc, 0xb3, 0xc8, 0x0d, 0xe2, 0x21, + 0x8b, 0x9e, 0x30, 0xd7, 0xcb, 0xea, 0x42, 0xb1, 0x6b, 0x2c, 0x64, 0xb7, 0x03, 0xe7, 0x67, 0xaf, + 0xa2, 0xd1, 0xbb, 0xb0, 0xfa, 0x09, 0x8b, 0xfc, 0xe1, 0xd9, 0x23, 0x37, 0x3e, 0x52, 0x06, 0xd7, + 0xa1, 0xaa, 0xc7, 0x2f, 0x37, 0xbc, 0x31, 0x1f, 0xb9, 0xf1, 0x11, 0x76, 0x6b, 0xb1, 0xe6, 0x91, + 0xea, 0xd7, 0xd1, 0xe8, 0x5f, 0x25, 0x30, 0x1f, 0x78, 0x63, 0x3f, 0x50, 0x06, 0xff, 0x3f, 0xd7, + 0x32, 0x72, 0x8f, 0x4f, 0xe8, 0xce, 0xf5, 0x8d, 0xf7, 0xd2, 0x72, 0xd7, 0x6a, 0xf7, 0xdf, 0xb9, + 0x56, 0x33, 0xfb, 0x44, 0x54, 0xd1, 0x73, 0x11, 0xe9, 0x43, 0x55, 0x94, 0x9c, 0x98, 0x24, 0xb3, + 0xcf, 0x5d, 0x2b, 0x56, 0x2a, 0xd5, 0x84, 0x3f, 0x24, 0x66, 0x34, 0x39, 0xc4, 0x26, 0x94, 0xf7, + 0x37, 0xcb, 0x38, 0x85, 0x41, 0x2a, 0x22, 0x1f, 0xc2, 0x4a, 0x82, 0x20, 0x3b, 0x23, 0x81, 0x32, + 0xb6, 0xa6, 0x2b, 0xba, 0x8d, 0x42, 0x0a, 0x69, 0x3b, 0xc9, 0x89, 0x79, 0x2c, 0x27, 0x02, 0x57, + 0x47, 0x40, 0x5e, 0x9b, 0x8f, 0x65, 0x8e, 0x35, 0x0a, 0x27, 0xa9, 0xc8, 0xfe, 0xb6, 0x0c, 0x2d, + 0x64, 0x00, 0x4b, 0xff, 0x8d, 0x28, 0xb8, 0x57, 0x44, 0x41, 0x77, 0x11, 0x05, 0xaa, 0x8f, 0x69, + 0x1c, 0xdc, 0xc8, 0x73, 0x70, 0xa1, 0x80, 0x03, 0xbc, 0x85, 0x24, 0xdc, 0x2b, 0x22, 0xa1, 0xbb, + 0x88, 0x84, 0xd4, 0x63, 0xc6, 0xc2, 0xe3, 0x45, 0x2c, 0xd8, 0x2f, 0x63, 0x01, 0x0d, 0xcd, 0xd2, + 0x70, 0xaf, 0x88, 0x86, 0xee, 0x22, 0x1a, 0x54, 0x34, 0x1a, 0x0f, 0xe7, 0x60, 0x4d, 0xf6, 0x8d, + 0x1c, 0xdd, 0xf6, 0x1d, 0x58, 0xcf, 0x8b, 0x91, 0xa4, 0x6b, 0x50, 0xc3, 0x98, 0x8b, 0xde, 0x32, + 0x9e, 0x65, 0x46, 0x77, 0x59, 0xe2, 0xfa, 0x23, 0x65, 0xd4, 0x53, 0x46, 0x95, 0xf8, 0xf5, 0x9a, + 0xb8, 0xe6, 0xbc, 0xf4, 0x12, 0xe7, 0x3f, 0x19, 0xd0, 0x7a, 0x9a, 0xb8, 0xc9, 0x34, 0x56, 0x8f, + 0xfb, 0xad, 0xb9, 0xca, 0xca, 0xd3, 0x2c, 0x94, 0xe7, 0x4a, 0x6b, 0x17, 0x5a, 0x38, 0x00, 0x72, + 0x4e, 0x73, 0x53, 0xb2, 0x00, 0x3a, 0x6a, 0x46, 0x9a, 0x50, 0xb3, 0xe2, 0x89, 0xa4, 0xb1, 0xce, + 0x0a, 0xac, 0xe4, 0xb0, 0x52, 0x56, 0xa4, 0xd0, 0xfe, 0xc5, 0x80, 0xb6, 0xca, 0x09, 0x41, 0x7b, + 0xb3, 0xa4, 0xf6, 0x8a, 0x93, 0xea, 0x2d, 0x4e, 0x0a, 0x6b, 0x26, 0x9f, 0xd5, 0x5e, 0x71, 0x56, + 0xbd, 0xc5, 0x59, 0xe5, 0xcd, 0x60, 0x5a, 0x3f, 0x1b, 0xb0, 0x4a, 0xdd, 0xa1, 0xea, 0x73, 0x8f, + 0xa4, 0xf1, 0x4b, 0xb0, 0x9c, 0x4d, 0x5e, 0xd9, 0xe0, 0x1b, 0x51, 0x36, 0x76, 0xff, 0xe1, 0x87, + 0x02, 0xb9, 0x0c, 0xcd, 0x88, 0xb9, 0x9e, 0xf3, 0x7c, 0x3a, 0x89, 0xa6, 0x63, 0x11, 0x59, 0x83, + 0x02, 0x17, 0x7d, 0x2c, 0x24, 0x7c, 0x4c, 0x4c, 0xa7, 0xbe, 0x27, 0x9e, 0xae, 0x49, 0xc5, 0x9a, + 0xdc, 0x02, 0x8c, 0xcc, 0x61, 0xe1, 0x64, 0x70, 0x84, 0x2f, 0x72, 0x2d, 0x5f, 0x88, 0x7b, 0xfc, + 0x88, 0x36, 0xa3, 0x6c, 0xc3, 0x6d, 0x89, 0x19, 0x59, 0x13, 0x61, 0x8a, 0xb5, 0xfd, 0x1c, 0x88, + 0x4c, 0x4a, 0xe6, 0x8c, 0x59, 0x5d, 0x83, 0xaa, 0xf8, 0x72, 0x4c, 0x6b, 0x5c, 0x7d, 0x47, 0xee, + 0xf1, 0xbf, 0x54, 0x1e, 0xa6, 0xb1, 0x95, 0xb4, 0xd8, 0xf8, 0x3c, 0x9e, 0x46, 0x11, 0x0b, 0x70, + 0x1e, 0x97, 0x71, 0x1e, 0x4b, 0x99, 0x98, 0xc7, 0x7f, 0x1a, 0xd0, 0xe6, 0x3e, 0x77, 0xc6, 0x9e, + 0x2a, 0xfa, 0xb7, 0xa1, 0x76, 0xa4, 0xbf, 0xd4, 0x5c, 0x6f, 0x9e, 0x03, 0x9d, 0xa2, 0x32, 0xb9, + 0x01, 0x8d, 0x48, 0x1e, 0xc4, 0x9d, 0x52, 0xaf, 0x2c, 0x40, 0xc8, 0x91, 0x8a, 0x3f, 0xde, 0x95, + 0x12, 0xb9, 0x0b, 0x2d, 0x97, 0xb7, 0x66, 0x07, 0x25, 0x45, 0xc3, 0x4c, 0x1f, 0xb5, 0xd4, 0x74, + 0xf5, 0xc1, 0x7b, 0x1f, 0xda, 0xb1, 0x28, 0xd5, 0xf4, 0x7e, 0xa5, 0xa0, 0x11, 0xeb, 0xcf, 0x99, + 0xb6, 0x62, 0x7d, 0x6b, 0x7f, 0x53, 0x82, 0x95, 0x34, 0x77, 0x7c, 0x1c, 0xb7, 0x66, 0x92, 0xef, + 0xce, 0x27, 0xaf, 0x93, 0x93, 0x66, 0xbf, 0xcd, 0x4b, 0x4f, 0x9e, 0xa8, 0xf4, 0xd7, 0xf3, 0xe9, + 0x63, 0x1d, 0x67, 0x6a, 0x3c, 0x03, 0x05, 0x80, 0x14, 0x15, 0x8d, 0x92, 0xdc, 0xa8, 0xa3, 0x2d, + 0x37, 0x37, 0xf9, 0x76, 0x60, 0x25, 0xc5, 0x00, 0x4d, 0x54, 0xe6, 0x3f, 0x19, 0xf2, 0xef, 0x9f, + 0xb6, 0xe3, 0xdc, 0x7e, 0xeb, 0x0b, 0xa8, 0xe3, 0x6b, 0x27, 0x4d, 0xa8, 0xef, 0x07, 0x27, 0xee, + 0xc8, 0xf7, 0xac, 0x25, 0x52, 0x87, 0xf2, 0x43, 0x96, 0x58, 0x06, 0x5f, 0x1c, 0x4c, 0x13, 0xab, + 0x4c, 0x00, 0x6a, 0xf2, 0xd7, 0xbd, 0x55, 0x21, 0x0d, 0xa8, 0xf0, 0x0f, 0x0b, 0xab, 0x4a, 0x4c, + 0x68, 0xa8, 0x0f, 0x06, 0xab, 0x46, 0x56, 0xa0, 0xa9, 0x7d, 0x01, 0x58, 0xf5, 0xad, 0xaf, 0x0d, + 0xfc, 0xc5, 0xa4, 0x9c, 0x58, 0x60, 0xa2, 0x13, 0x21, 0xb6, 0x96, 0x48, 0x1b, 0x20, 0x1b, 0xb6, + 0x96, 0x41, 0x96, 0xa1, 0x2a, 0x26, 0xa8, 0x55, 0x12, 0x47, 0xe9, 0x04, 0xb4, 0xca, 0x84, 0x40, + 0x3b, 0x3f, 0xe0, 0xac, 0x0a, 0x77, 0xc9, 0x75, 0xa6, 0x09, 0xe3, 0x83, 0xc9, 0xaa, 0xf2, 0x4b, + 0xd9, 0xf0, 0xb2, 0x6a, 0x5b, 0x1f, 0xa8, 0xbe, 0xae, 0x42, 0x58, 0x85, 0x16, 0x86, 0x20, 0xe5, + 0xd6, 0x12, 0x8f, 0x4a, 0x6f, 0x5f, 0x96, 0x91, 0x49, 0x64, 0xcf, 0xb1, 0x4a, 0xef, 0x6f, 0xfd, + 0xf0, 0xa2, 0x6b, 0xfc, 0xf8, 0xa2, 0x6b, 0xfc, 0xfa, 0xa2, 0x6b, 0x7c, 0xff, 0x5b, 0x77, 0x09, + 0x3a, 0x83, 0xc9, 0xb8, 0x1f, 0xfa, 0xc1, 0xe1, 0xc0, 0x0d, 0xfb, 0x89, 0x7f, 0x7c, 0xd2, 0x3f, + 0x3e, 0x11, 0xff, 0xcf, 0xf9, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x1b, 0xa8, 0x27, 0x52, 0x1a, 0x12, + 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/raft_serverpb/raft_serverpb.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/raft_serverpb/raft_serverpb.pb.go new file mode 100644 index 00000000000..18cabe2072c --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/pkg/raft_serverpb/raft_serverpb.pb.go @@ -0,0 +1,2690 @@ +// Code generated by protoc-gen-gogo. +// source: raft_serverpb.proto +// DO NOT EDIT! + +/* + Package raft_serverpb is a generated protocol buffer package. + + It is generated from these files: + raft_serverpb.proto + + It has these top-level messages: + RaftMessage + RaftTruncatedState + SnapshotCFFile + SnapshotMeta + SnapshotChunk + Done + KeyValue + RaftSnapshotData + StoreIdent + RaftLocalState + RaftApplyState + RegionLocalState +*/ +package raft_serverpb + +import ( + "fmt" + "io" + "math" + + proto "github.com/golang/protobuf/proto" + + eraftpb "github.com/pingcap/kvproto/pkg/eraftpb" + + metapb "github.com/pingcap/kvproto/pkg/metapb" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type PeerState int32 + +const ( + PeerState_Normal PeerState = 0 + PeerState_Applying PeerState = 1 + PeerState_Tombstone PeerState = 2 +) + +var PeerState_name = map[int32]string{ + 0: "Normal", + 1: "Applying", + 2: "Tombstone", +} +var PeerState_value = map[string]int32{ + "Normal": 0, + "Applying": 1, + "Tombstone": 2, +} + +func (x PeerState) String() string { + return proto.EnumName(PeerState_name, int32(x)) +} +func (PeerState) EnumDescriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{0} } + +type RaftMessage struct { + RegionId uint64 `protobuf:"varint,1,opt,name=region_id,json=regionId,proto3" json:"region_id,omitempty"` + FromPeer *metapb.Peer `protobuf:"bytes,2,opt,name=from_peer,json=fromPeer" json:"from_peer,omitempty"` + ToPeer *metapb.Peer `protobuf:"bytes,3,opt,name=to_peer,json=toPeer" json:"to_peer,omitempty"` + Message *eraftpb.Message `protobuf:"bytes,4,opt,name=message" json:"message,omitempty"` + RegionEpoch *metapb.RegionEpoch `protobuf:"bytes,5,opt,name=region_epoch,json=regionEpoch" json:"region_epoch,omitempty"` + // true means to_peer is a tombstone peer and it should remove itself. + IsTombstone bool `protobuf:"varint,6,opt,name=is_tombstone,json=isTombstone,proto3" json:"is_tombstone,omitempty"` + // Region key range [start_key, end_key). + StartKey []byte `protobuf:"bytes,7,opt,name=start_key,json=startKey,proto3" json:"start_key,omitempty"` + EndKey []byte `protobuf:"bytes,8,opt,name=end_key,json=endKey,proto3" json:"end_key,omitempty"` +} + +func (m *RaftMessage) Reset() { *m = RaftMessage{} } +func (m *RaftMessage) String() string { return proto.CompactTextString(m) } +func (*RaftMessage) ProtoMessage() {} +func (*RaftMessage) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{0} } + +func (m *RaftMessage) GetRegionId() uint64 { + if m != nil { + return m.RegionId + } + return 0 +} + +func (m *RaftMessage) GetFromPeer() *metapb.Peer { + if m != nil { + return m.FromPeer + } + return nil +} + +func (m *RaftMessage) GetToPeer() *metapb.Peer { + if m != nil { + return m.ToPeer + } + return nil +} + +func (m *RaftMessage) GetMessage() *eraftpb.Message { + if m != nil { + return m.Message + } + return nil +} + +func (m *RaftMessage) GetRegionEpoch() *metapb.RegionEpoch { + if m != nil { + return m.RegionEpoch + } + return nil +} + +func (m *RaftMessage) GetIsTombstone() bool { + if m != nil { + return m.IsTombstone + } + return false +} + +func (m *RaftMessage) GetStartKey() []byte { + if m != nil { + return m.StartKey + } + return nil +} + +func (m *RaftMessage) GetEndKey() []byte { + if m != nil { + return m.EndKey + } + return nil +} + +type RaftTruncatedState struct { + Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` + Term uint64 `protobuf:"varint,2,opt,name=term,proto3" json:"term,omitempty"` +} + +func (m *RaftTruncatedState) Reset() { *m = RaftTruncatedState{} } +func (m *RaftTruncatedState) String() string { return proto.CompactTextString(m) } +func (*RaftTruncatedState) ProtoMessage() {} +func (*RaftTruncatedState) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{1} } + +func (m *RaftTruncatedState) GetIndex() uint64 { + if m != nil { + return m.Index + } + return 0 +} + +func (m *RaftTruncatedState) GetTerm() uint64 { + if m != nil { + return m.Term + } + return 0 +} + +type SnapshotCFFile struct { + Cf string `protobuf:"bytes,1,opt,name=cf,proto3" json:"cf,omitempty"` + Size_ uint64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` + Checksum uint32 `protobuf:"varint,3,opt,name=checksum,proto3" json:"checksum,omitempty"` +} + +func (m *SnapshotCFFile) Reset() { *m = SnapshotCFFile{} } +func (m *SnapshotCFFile) String() string { return proto.CompactTextString(m) } +func (*SnapshotCFFile) ProtoMessage() {} +func (*SnapshotCFFile) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{2} } + +func (m *SnapshotCFFile) GetCf() string { + if m != nil { + return m.Cf + } + return "" +} + +func (m *SnapshotCFFile) GetSize_() uint64 { + if m != nil { + return m.Size_ + } + return 0 +} + +func (m *SnapshotCFFile) GetChecksum() uint32 { + if m != nil { + return m.Checksum + } + return 0 +} + +type SnapshotMeta struct { + CfFiles []*SnapshotCFFile `protobuf:"bytes,1,rep,name=cf_files,json=cfFiles" json:"cf_files,omitempty"` +} + +func (m *SnapshotMeta) Reset() { *m = SnapshotMeta{} } +func (m *SnapshotMeta) String() string { return proto.CompactTextString(m) } +func (*SnapshotMeta) ProtoMessage() {} +func (*SnapshotMeta) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{3} } + +func (m *SnapshotMeta) GetCfFiles() []*SnapshotCFFile { + if m != nil { + return m.CfFiles + } + return nil +} + +type SnapshotChunk struct { + Message *RaftMessage `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` +} + +func (m *SnapshotChunk) Reset() { *m = SnapshotChunk{} } +func (m *SnapshotChunk) String() string { return proto.CompactTextString(m) } +func (*SnapshotChunk) ProtoMessage() {} +func (*SnapshotChunk) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{4} } + +func (m *SnapshotChunk) GetMessage() *RaftMessage { + if m != nil { + return m.Message + } + return nil +} + +func (m *SnapshotChunk) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +type Done struct { +} + +func (m *Done) Reset() { *m = Done{} } +func (m *Done) String() string { return proto.CompactTextString(m) } +func (*Done) ProtoMessage() {} +func (*Done) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{5} } + +type KeyValue struct { + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *KeyValue) Reset() { *m = KeyValue{} } +func (m *KeyValue) String() string { return proto.CompactTextString(m) } +func (*KeyValue) ProtoMessage() {} +func (*KeyValue) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{6} } + +func (m *KeyValue) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *KeyValue) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +type RaftSnapshotData struct { + Region *metapb.Region `protobuf:"bytes,1,opt,name=region" json:"region,omitempty"` + FileSize uint64 `protobuf:"varint,2,opt,name=file_size,json=fileSize,proto3" json:"file_size,omitempty"` + Data []*KeyValue `protobuf:"bytes,3,rep,name=data" json:"data,omitempty"` + Version uint64 `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"` + Meta *SnapshotMeta `protobuf:"bytes,5,opt,name=meta" json:"meta,omitempty"` +} + +func (m *RaftSnapshotData) Reset() { *m = RaftSnapshotData{} } +func (m *RaftSnapshotData) String() string { return proto.CompactTextString(m) } +func (*RaftSnapshotData) ProtoMessage() {} +func (*RaftSnapshotData) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{7} } + +func (m *RaftSnapshotData) GetRegion() *metapb.Region { + if m != nil { + return m.Region + } + return nil +} + +func (m *RaftSnapshotData) GetFileSize() uint64 { + if m != nil { + return m.FileSize + } + return 0 +} + +func (m *RaftSnapshotData) GetData() []*KeyValue { + if m != nil { + return m.Data + } + return nil +} + +func (m *RaftSnapshotData) GetVersion() uint64 { + if m != nil { + return m.Version + } + return 0 +} + +func (m *RaftSnapshotData) GetMeta() *SnapshotMeta { + if m != nil { + return m.Meta + } + return nil +} + +type StoreIdent struct { + ClusterId uint64 `protobuf:"varint,1,opt,name=cluster_id,json=clusterId,proto3" json:"cluster_id,omitempty"` + StoreId uint64 `protobuf:"varint,2,opt,name=store_id,json=storeId,proto3" json:"store_id,omitempty"` +} + +func (m *StoreIdent) Reset() { *m = StoreIdent{} } +func (m *StoreIdent) String() string { return proto.CompactTextString(m) } +func (*StoreIdent) ProtoMessage() {} +func (*StoreIdent) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{8} } + +func (m *StoreIdent) GetClusterId() uint64 { + if m != nil { + return m.ClusterId + } + return 0 +} + +func (m *StoreIdent) GetStoreId() uint64 { + if m != nil { + return m.StoreId + } + return 0 +} + +type RaftLocalState struct { + HardState *eraftpb.HardState `protobuf:"bytes,1,opt,name=hard_state,json=hardState" json:"hard_state,omitempty"` + LastIndex uint64 `protobuf:"varint,2,opt,name=last_index,json=lastIndex,proto3" json:"last_index,omitempty"` +} + +func (m *RaftLocalState) Reset() { *m = RaftLocalState{} } +func (m *RaftLocalState) String() string { return proto.CompactTextString(m) } +func (*RaftLocalState) ProtoMessage() {} +func (*RaftLocalState) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{9} } + +func (m *RaftLocalState) GetHardState() *eraftpb.HardState { + if m != nil { + return m.HardState + } + return nil +} + +func (m *RaftLocalState) GetLastIndex() uint64 { + if m != nil { + return m.LastIndex + } + return 0 +} + +type RaftApplyState struct { + AppliedIndex uint64 `protobuf:"varint,1,opt,name=applied_index,json=appliedIndex,proto3" json:"applied_index,omitempty"` + TruncatedState *RaftTruncatedState `protobuf:"bytes,2,opt,name=truncated_state,json=truncatedState" json:"truncated_state,omitempty"` +} + +func (m *RaftApplyState) Reset() { *m = RaftApplyState{} } +func (m *RaftApplyState) String() string { return proto.CompactTextString(m) } +func (*RaftApplyState) ProtoMessage() {} +func (*RaftApplyState) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{10} } + +func (m *RaftApplyState) GetAppliedIndex() uint64 { + if m != nil { + return m.AppliedIndex + } + return 0 +} + +func (m *RaftApplyState) GetTruncatedState() *RaftTruncatedState { + if m != nil { + return m.TruncatedState + } + return nil +} + +type RegionLocalState struct { + State PeerState `protobuf:"varint,1,opt,name=state,proto3,enum=raft_serverpb.PeerState" json:"state,omitempty"` + Region *metapb.Region `protobuf:"bytes,2,opt,name=region" json:"region,omitempty"` +} + +func (m *RegionLocalState) Reset() { *m = RegionLocalState{} } +func (m *RegionLocalState) String() string { return proto.CompactTextString(m) } +func (*RegionLocalState) ProtoMessage() {} +func (*RegionLocalState) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{11} } + +func (m *RegionLocalState) GetState() PeerState { + if m != nil { + return m.State + } + return PeerState_Normal +} + +func (m *RegionLocalState) GetRegion() *metapb.Region { + if m != nil { + return m.Region + } + return nil +} + +func init() { + proto.RegisterType((*RaftMessage)(nil), "raft_serverpb.RaftMessage") + proto.RegisterType((*RaftTruncatedState)(nil), "raft_serverpb.RaftTruncatedState") + proto.RegisterType((*SnapshotCFFile)(nil), "raft_serverpb.SnapshotCFFile") + proto.RegisterType((*SnapshotMeta)(nil), "raft_serverpb.SnapshotMeta") + proto.RegisterType((*SnapshotChunk)(nil), "raft_serverpb.SnapshotChunk") + proto.RegisterType((*Done)(nil), "raft_serverpb.Done") + proto.RegisterType((*KeyValue)(nil), "raft_serverpb.KeyValue") + proto.RegisterType((*RaftSnapshotData)(nil), "raft_serverpb.RaftSnapshotData") + proto.RegisterType((*StoreIdent)(nil), "raft_serverpb.StoreIdent") + proto.RegisterType((*RaftLocalState)(nil), "raft_serverpb.RaftLocalState") + proto.RegisterType((*RaftApplyState)(nil), "raft_serverpb.RaftApplyState") + proto.RegisterType((*RegionLocalState)(nil), "raft_serverpb.RegionLocalState") + proto.RegisterEnum("raft_serverpb.PeerState", PeerState_name, PeerState_value) +} +func (m *RaftMessage) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RaftMessage) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RegionId != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(m.RegionId)) + } + if m.FromPeer != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(m.FromPeer.Size())) + n1, err := m.FromPeer.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.ToPeer != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(m.ToPeer.Size())) + n2, err := m.ToPeer.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.Message != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(m.Message.Size())) + n3, err := m.Message.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if m.RegionEpoch != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(m.RegionEpoch.Size())) + n4, err := m.RegionEpoch.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + if m.IsTombstone { + dAtA[i] = 0x30 + i++ + if m.IsTombstone { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if len(m.StartKey) > 0 { + dAtA[i] = 0x3a + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(len(m.StartKey))) + i += copy(dAtA[i:], m.StartKey) + } + if len(m.EndKey) > 0 { + dAtA[i] = 0x42 + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(len(m.EndKey))) + i += copy(dAtA[i:], m.EndKey) + } + return i, nil +} + +func (m *RaftTruncatedState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RaftTruncatedState) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Index != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(m.Index)) + } + if m.Term != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(m.Term)) + } + return i, nil +} + +func (m *SnapshotCFFile) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SnapshotCFFile) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Cf) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(len(m.Cf))) + i += copy(dAtA[i:], m.Cf) + } + if m.Size_ != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(m.Size_)) + } + if m.Checksum != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(m.Checksum)) + } + return i, nil +} + +func (m *SnapshotMeta) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SnapshotMeta) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.CfFiles) > 0 { + for _, msg := range m.CfFiles { + dAtA[i] = 0xa + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *SnapshotChunk) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SnapshotChunk) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Message != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(m.Message.Size())) + n5, err := m.Message.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + if len(m.Data) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(len(m.Data))) + i += copy(dAtA[i:], m.Data) + } + return i, nil +} + +func (m *Done) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Done) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + return i, nil +} + +func (m *KeyValue) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *KeyValue) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Key) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + if len(m.Value) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(len(m.Value))) + i += copy(dAtA[i:], m.Value) + } + return i, nil +} + +func (m *RaftSnapshotData) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RaftSnapshotData) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Region != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(m.Region.Size())) + n6, err := m.Region.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + if m.FileSize != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(m.FileSize)) + } + if len(m.Data) > 0 { + for _, msg := range m.Data { + dAtA[i] = 0x1a + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.Version != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(m.Version)) + } + if m.Meta != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(m.Meta.Size())) + n7, err := m.Meta.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n7 + } + return i, nil +} + +func (m *StoreIdent) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StoreIdent) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.ClusterId != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(m.ClusterId)) + } + if m.StoreId != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(m.StoreId)) + } + return i, nil +} + +func (m *RaftLocalState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RaftLocalState) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.HardState != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(m.HardState.Size())) + n8, err := m.HardState.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n8 + } + if m.LastIndex != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(m.LastIndex)) + } + return i, nil +} + +func (m *RaftApplyState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RaftApplyState) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.AppliedIndex != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(m.AppliedIndex)) + } + if m.TruncatedState != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(m.TruncatedState.Size())) + n9, err := m.TruncatedState.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n9 + } + return i, nil +} + +func (m *RegionLocalState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RegionLocalState) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.State != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(m.State)) + } + if m.Region != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRaftServerpb(dAtA, i, uint64(m.Region.Size())) + n10, err := m.Region.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n10 + } + return i, nil +} + +func encodeFixed64RaftServerpb(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32RaftServerpb(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintRaftServerpb(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *RaftMessage) Size() (n int) { + var l int + _ = l + if m.RegionId != 0 { + n += 1 + sovRaftServerpb(uint64(m.RegionId)) + } + if m.FromPeer != nil { + l = m.FromPeer.Size() + n += 1 + l + sovRaftServerpb(uint64(l)) + } + if m.ToPeer != nil { + l = m.ToPeer.Size() + n += 1 + l + sovRaftServerpb(uint64(l)) + } + if m.Message != nil { + l = m.Message.Size() + n += 1 + l + sovRaftServerpb(uint64(l)) + } + if m.RegionEpoch != nil { + l = m.RegionEpoch.Size() + n += 1 + l + sovRaftServerpb(uint64(l)) + } + if m.IsTombstone { + n += 2 + } + l = len(m.StartKey) + if l > 0 { + n += 1 + l + sovRaftServerpb(uint64(l)) + } + l = len(m.EndKey) + if l > 0 { + n += 1 + l + sovRaftServerpb(uint64(l)) + } + return n +} + +func (m *RaftTruncatedState) Size() (n int) { + var l int + _ = l + if m.Index != 0 { + n += 1 + sovRaftServerpb(uint64(m.Index)) + } + if m.Term != 0 { + n += 1 + sovRaftServerpb(uint64(m.Term)) + } + return n +} + +func (m *SnapshotCFFile) Size() (n int) { + var l int + _ = l + l = len(m.Cf) + if l > 0 { + n += 1 + l + sovRaftServerpb(uint64(l)) + } + if m.Size_ != 0 { + n += 1 + sovRaftServerpb(uint64(m.Size_)) + } + if m.Checksum != 0 { + n += 1 + sovRaftServerpb(uint64(m.Checksum)) + } + return n +} + +func (m *SnapshotMeta) Size() (n int) { + var l int + _ = l + if len(m.CfFiles) > 0 { + for _, e := range m.CfFiles { + l = e.Size() + n += 1 + l + sovRaftServerpb(uint64(l)) + } + } + return n +} + +func (m *SnapshotChunk) Size() (n int) { + var l int + _ = l + if m.Message != nil { + l = m.Message.Size() + n += 1 + l + sovRaftServerpb(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovRaftServerpb(uint64(l)) + } + return n +} + +func (m *Done) Size() (n int) { + var l int + _ = l + return n +} + +func (m *KeyValue) Size() (n int) { + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovRaftServerpb(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovRaftServerpb(uint64(l)) + } + return n +} + +func (m *RaftSnapshotData) Size() (n int) { + var l int + _ = l + if m.Region != nil { + l = m.Region.Size() + n += 1 + l + sovRaftServerpb(uint64(l)) + } + if m.FileSize != 0 { + n += 1 + sovRaftServerpb(uint64(m.FileSize)) + } + if len(m.Data) > 0 { + for _, e := range m.Data { + l = e.Size() + n += 1 + l + sovRaftServerpb(uint64(l)) + } + } + if m.Version != 0 { + n += 1 + sovRaftServerpb(uint64(m.Version)) + } + if m.Meta != nil { + l = m.Meta.Size() + n += 1 + l + sovRaftServerpb(uint64(l)) + } + return n +} + +func (m *StoreIdent) Size() (n int) { + var l int + _ = l + if m.ClusterId != 0 { + n += 1 + sovRaftServerpb(uint64(m.ClusterId)) + } + if m.StoreId != 0 { + n += 1 + sovRaftServerpb(uint64(m.StoreId)) + } + return n +} + +func (m *RaftLocalState) Size() (n int) { + var l int + _ = l + if m.HardState != nil { + l = m.HardState.Size() + n += 1 + l + sovRaftServerpb(uint64(l)) + } + if m.LastIndex != 0 { + n += 1 + sovRaftServerpb(uint64(m.LastIndex)) + } + return n +} + +func (m *RaftApplyState) Size() (n int) { + var l int + _ = l + if m.AppliedIndex != 0 { + n += 1 + sovRaftServerpb(uint64(m.AppliedIndex)) + } + if m.TruncatedState != nil { + l = m.TruncatedState.Size() + n += 1 + l + sovRaftServerpb(uint64(l)) + } + return n +} + +func (m *RegionLocalState) Size() (n int) { + var l int + _ = l + if m.State != 0 { + n += 1 + sovRaftServerpb(uint64(m.State)) + } + if m.Region != nil { + l = m.Region.Size() + n += 1 + l + sovRaftServerpb(uint64(l)) + } + return n +} + +func sovRaftServerpb(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozRaftServerpb(x uint64) (n int) { + return sovRaftServerpb(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *RaftMessage) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RaftMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RaftMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionId", wireType) + } + m.RegionId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RegionId |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromPeer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftServerpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.FromPeer == nil { + m.FromPeer = &metapb.Peer{} + } + if err := m.FromPeer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ToPeer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftServerpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ToPeer == nil { + m.ToPeer = &metapb.Peer{} + } + if err := m.ToPeer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftServerpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Message == nil { + m.Message = &eraftpb.Message{} + } + if err := m.Message.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionEpoch", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftServerpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RegionEpoch == nil { + m.RegionEpoch = &metapb.RegionEpoch{} + } + if err := m.RegionEpoch.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsTombstone", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.IsTombstone = bool(v != 0) + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRaftServerpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StartKey = append(m.StartKey[:0], dAtA[iNdEx:postIndex]...) + if m.StartKey == nil { + m.StartKey = []byte{} + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRaftServerpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EndKey = append(m.EndKey[:0], dAtA[iNdEx:postIndex]...) + if m.EndKey == nil { + m.EndKey = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftServerpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftServerpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RaftTruncatedState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RaftTruncatedState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RaftTruncatedState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + m.Index = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Index |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) + } + m.Term = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Term |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRaftServerpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftServerpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SnapshotCFFile) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SnapshotCFFile: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SnapshotCFFile: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cf", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRaftServerpb + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Cf = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Size_", wireType) + } + m.Size_ = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Size_ |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Checksum", wireType) + } + m.Checksum = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Checksum |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRaftServerpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftServerpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SnapshotMeta) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SnapshotMeta: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SnapshotMeta: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CfFiles", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftServerpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CfFiles = append(m.CfFiles, &SnapshotCFFile{}) + if err := m.CfFiles[len(m.CfFiles)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftServerpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftServerpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SnapshotChunk) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SnapshotChunk: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SnapshotChunk: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftServerpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Message == nil { + m.Message = &RaftMessage{} + } + if err := m.Message.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRaftServerpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftServerpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftServerpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Done) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Done: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Done: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipRaftServerpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftServerpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *KeyValue) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: KeyValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: KeyValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRaftServerpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRaftServerpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftServerpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftServerpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RaftSnapshotData) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RaftSnapshotData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RaftSnapshotData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Region", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftServerpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Region == nil { + m.Region = &metapb.Region{} + } + if err := m.Region.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FileSize", wireType) + } + m.FileSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FileSize |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftServerpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data, &KeyValue{}) + if err := m.Data[len(m.Data)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Meta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftServerpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Meta == nil { + m.Meta = &SnapshotMeta{} + } + if err := m.Meta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftServerpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftServerpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StoreIdent) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StoreIdent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreIdent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ClusterId", wireType) + } + m.ClusterId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ClusterId |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StoreId", wireType) + } + m.StoreId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StoreId |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRaftServerpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftServerpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RaftLocalState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RaftLocalState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RaftLocalState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HardState", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftServerpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.HardState == nil { + m.HardState = &eraftpb.HardState{} + } + if err := m.HardState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LastIndex", wireType) + } + m.LastIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LastIndex |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRaftServerpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftServerpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RaftApplyState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RaftApplyState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RaftApplyState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AppliedIndex", wireType) + } + m.AppliedIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AppliedIndex |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TruncatedState", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftServerpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TruncatedState == nil { + m.TruncatedState = &RaftTruncatedState{} + } + if err := m.TruncatedState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftServerpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftServerpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RegionLocalState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RegionLocalState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RegionLocalState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + m.State = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.State |= (PeerState(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Region", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRaftServerpb + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Region == nil { + m.Region = &metapb.Region{} + } + if err := m.Region.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRaftServerpb(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRaftServerpb + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipRaftServerpb(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthRaftServerpb + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipRaftServerpb(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthRaftServerpb = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRaftServerpb = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("raft_serverpb.proto", fileDescriptorRaftServerpb) } + +var fileDescriptorRaftServerpb = []byte{ + // 774 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0xdb, 0x8e, 0xdb, 0x44, + 0x18, 0xae, 0xb3, 0xde, 0xc4, 0xfe, 0xe3, 0x84, 0x68, 0x8a, 0x54, 0xb3, 0x55, 0xa3, 0xd4, 0x08, + 0x14, 0x16, 0xc9, 0x88, 0x50, 0x21, 0xae, 0x90, 0x80, 0xb2, 0x6a, 0x58, 0x8a, 0xaa, 0x49, 0x85, + 0xc4, 0x95, 0x35, 0xb1, 0x7f, 0x27, 0x26, 0x3e, 0x69, 0x66, 0x12, 0x11, 0xee, 0x78, 0x0b, 0x5e, + 0x85, 0x37, 0xe0, 0x0e, 0x1e, 0x01, 0x2d, 0x2f, 0x82, 0x66, 0xc6, 0xce, 0x61, 0x55, 0x7a, 0xe5, + 0xff, 0x7c, 0xf8, 0xfe, 0xcf, 0x03, 0x0f, 0x39, 0x4b, 0x65, 0x24, 0x90, 0xef, 0x90, 0xd7, 0xcb, + 0xb0, 0xe6, 0x95, 0xac, 0xc8, 0xe0, 0xcc, 0x78, 0x35, 0x40, 0xa5, 0xb7, 0xde, 0x2b, 0xaf, 0x40, + 0xc9, 0x5a, 0x2d, 0xf8, 0xa3, 0x03, 0x7d, 0xca, 0x52, 0xf9, 0x12, 0x85, 0x60, 0x2b, 0x24, 0x8f, + 0xc1, 0xe5, 0xb8, 0xca, 0xaa, 0x32, 0xca, 0x12, 0xdf, 0x9a, 0x58, 0x53, 0x9b, 0x3a, 0xc6, 0x30, + 0x4f, 0xc8, 0x47, 0xe0, 0xa6, 0xbc, 0x2a, 0xa2, 0x1a, 0x91, 0xfb, 0x9d, 0x89, 0x35, 0xed, 0xcf, + 0xbc, 0xb0, 0x29, 0xf7, 0x0a, 0x91, 0x53, 0x47, 0xb9, 0x95, 0x44, 0x3e, 0x80, 0x9e, 0xac, 0x4c, + 0xe0, 0xc5, 0x1b, 0x02, 0xbb, 0xb2, 0xd2, 0x61, 0xd7, 0xd0, 0x2b, 0x4c, 0x67, 0xdf, 0xd6, 0x61, + 0xa3, 0xb0, 0x9d, 0xb6, 0x99, 0x88, 0xb6, 0x01, 0xe4, 0x73, 0xf0, 0x9a, 0xd1, 0xb0, 0xae, 0xe2, + 0xb5, 0x7f, 0xa9, 0x13, 0x1e, 0xb6, 0x75, 0xa9, 0xf6, 0x7d, 0xab, 0x5c, 0xb4, 0xcf, 0x8f, 0x0a, + 0x79, 0x0a, 0x5e, 0x26, 0x22, 0x59, 0x15, 0x4b, 0x21, 0xab, 0x12, 0xfd, 0xee, 0xc4, 0x9a, 0x3a, + 0xb4, 0x9f, 0x89, 0xd7, 0xad, 0x49, 0x6d, 0x2d, 0x24, 0xe3, 0x32, 0xda, 0xe0, 0xde, 0xef, 0x4d, + 0xac, 0xa9, 0x47, 0x1d, 0x6d, 0xb8, 0xc5, 0x3d, 0x79, 0x04, 0x3d, 0x2c, 0x13, 0xed, 0x72, 0xb4, + 0xab, 0x8b, 0x65, 0x72, 0x8b, 0xfb, 0xe0, 0x4b, 0x20, 0x0a, 0xba, 0xd7, 0x7c, 0x5b, 0xc6, 0x4c, + 0x62, 0xb2, 0x90, 0x4c, 0x22, 0x79, 0x17, 0x2e, 0xb3, 0x32, 0xc1, 0x5f, 0x1a, 0xf4, 0x8c, 0x42, + 0x08, 0xd8, 0x12, 0x79, 0xa1, 0x51, 0xb3, 0xa9, 0x96, 0x83, 0x57, 0x30, 0x5c, 0x94, 0xac, 0x16, + 0xeb, 0x4a, 0x7e, 0x73, 0x73, 0x93, 0xe5, 0x48, 0x86, 0xd0, 0x89, 0x53, 0x9d, 0xe8, 0xd2, 0x4e, + 0x9c, 0xaa, 0x2c, 0x91, 0xfd, 0x8a, 0x6d, 0x96, 0x92, 0xc9, 0x15, 0x38, 0xf1, 0x1a, 0xe3, 0x8d, + 0xd8, 0x16, 0x1a, 0xda, 0x01, 0x3d, 0xe8, 0xc1, 0x0b, 0xf0, 0xda, 0x8a, 0x2f, 0x51, 0x32, 0xf2, + 0x05, 0x38, 0x71, 0x1a, 0xa5, 0x59, 0x8e, 0xc2, 0xb7, 0x26, 0x17, 0xd3, 0xfe, 0xec, 0x49, 0x78, + 0xce, 0x98, 0xf3, 0x01, 0x68, 0x2f, 0x4e, 0xd5, 0x57, 0x04, 0x3f, 0xc1, 0xe0, 0xe0, 0x5a, 0x6f, + 0xcb, 0x0d, 0x79, 0x76, 0xbc, 0x94, 0xa5, 0x81, 0xbf, 0xba, 0x57, 0xe9, 0x84, 0x45, 0xc7, 0x9b, + 0x11, 0xb0, 0x13, 0x26, 0x99, 0x5e, 0xc0, 0xa3, 0x5a, 0x0e, 0xba, 0x60, 0x3f, 0xaf, 0x4a, 0x0c, + 0x66, 0xe0, 0xdc, 0xe2, 0xfe, 0x47, 0x96, 0x6f, 0x91, 0x8c, 0xe0, 0x42, 0xe1, 0x6b, 0xe9, 0x30, + 0x25, 0x2a, 0x18, 0x77, 0xca, 0xd5, 0xa4, 0x1a, 0x25, 0xf8, 0xcb, 0x82, 0x91, 0x6a, 0xd4, 0xce, + 0xf6, 0x9c, 0x49, 0x46, 0x3e, 0x84, 0xae, 0xb9, 0x77, 0x33, 0xd9, 0xf0, 0x9c, 0x12, 0xb4, 0xf1, + 0xaa, 0x2b, 0x2b, 0x28, 0xa2, 0x13, 0x48, 0x1d, 0x65, 0x58, 0x28, 0x58, 0x3f, 0x6e, 0x26, 0xbd, + 0xd0, 0x30, 0x3d, 0xba, 0xb7, 0x5c, 0x3b, 0xa8, 0x59, 0x81, 0xf8, 0xd0, 0xdb, 0x21, 0x17, 0xaa, + 0xa5, 0xad, 0xeb, 0xb4, 0x2a, 0xf9, 0x04, 0x6c, 0xd5, 0xbc, 0x21, 0xe7, 0xe3, 0xff, 0x41, 0x5b, + 0x1d, 0x87, 0xea, 0xc0, 0xe0, 0x06, 0x60, 0x21, 0x2b, 0x8e, 0xf3, 0x04, 0x4b, 0x49, 0x9e, 0x00, + 0xc4, 0xf9, 0x56, 0x48, 0xe4, 0xc7, 0xff, 0xcf, 0x6d, 0x2c, 0xf3, 0x84, 0xbc, 0x07, 0x8e, 0x50, + 0xc1, 0xca, 0x69, 0x16, 0xe8, 0x09, 0x93, 0x1c, 0x2c, 0x61, 0xa8, 0x80, 0xf9, 0xbe, 0x8a, 0x59, + 0x6e, 0x88, 0xf8, 0x29, 0xc0, 0x9a, 0xf1, 0x24, 0x12, 0x4a, 0x6b, 0xa0, 0x21, 0x87, 0xdf, 0xeb, + 0x05, 0xe3, 0x86, 0xb0, 0xd4, 0x5d, 0xb7, 0xa2, 0x6a, 0x9f, 0x33, 0x21, 0x23, 0x43, 0x60, 0xd3, + 0xc1, 0x55, 0x96, 0xb9, 0x32, 0x04, 0xbf, 0x59, 0xa6, 0xc9, 0x57, 0x75, 0x9d, 0xef, 0x4d, 0xc6, + 0xfb, 0x30, 0x60, 0x75, 0x9d, 0x67, 0x98, 0x44, 0xa7, 0xac, 0xf7, 0x1a, 0xa3, 0xce, 0x23, 0xdf, + 0xc1, 0x3b, 0xb2, 0xfd, 0x49, 0x9a, 0x71, 0xcc, 0xeb, 0xf1, 0xf4, 0x0d, 0x1c, 0x3a, 0xff, 0x9d, + 0xe8, 0x50, 0x9e, 0xe9, 0xc1, 0xcf, 0x30, 0x32, 0x67, 0x3d, 0xd9, 0x34, 0x84, 0xcb, 0xe3, 0x92, + 0xc3, 0x99, 0x7f, 0xaf, 0xaa, 0x7a, 0x69, 0x4c, 0x31, 0x13, 0x76, 0x42, 0x98, 0xce, 0xdb, 0x08, + 0x73, 0xfd, 0x0c, 0xdc, 0x43, 0x2e, 0x01, 0xe8, 0xfe, 0x50, 0xf1, 0x82, 0xe5, 0xa3, 0x07, 0xc4, + 0x03, 0x47, 0x63, 0x90, 0x95, 0xab, 0x91, 0x45, 0x06, 0xe0, 0x1e, 0x9e, 0x92, 0x51, 0xe7, 0xeb, + 0xeb, 0x3f, 0xef, 0xc6, 0xd6, 0xdf, 0x77, 0x63, 0xeb, 0x9f, 0xbb, 0xb1, 0xf5, 0xfb, 0xbf, 0xe3, + 0x07, 0xe0, 0xc7, 0x55, 0x11, 0xd6, 0x59, 0xb9, 0x8a, 0x59, 0x1d, 0xca, 0x6c, 0xb3, 0x0b, 0x37, + 0x3b, 0xfd, 0xfc, 0x2e, 0xbb, 0xfa, 0xf3, 0xd9, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x13, 0x81, + 0xd5, 0xd2, 0xc8, 0x05, 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/tikvpb/tikvpb.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/tikvpb/tikvpb.pb.go new file mode 100644 index 00000000000..f4dba945e4e --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/pkg/tikvpb/tikvpb.pb.go @@ -0,0 +1,895 @@ +// Code generated by protoc-gen-gogo. +// source: tikvpb.proto +// DO NOT EDIT! + +/* + Package tikvpb is a generated protocol buffer package. + + It is generated from these files: + tikvpb.proto + + It has these top-level messages: +*/ +package tikvpb + +import ( + "fmt" + "math" + + proto "github.com/golang/protobuf/proto" + + coprocessor "github.com/pingcap/kvproto/pkg/coprocessor" + + kvrpcpb "github.com/pingcap/kvproto/pkg/kvrpcpb" + + raft_serverpb "github.com/pingcap/kvproto/pkg/raft_serverpb" + + context "golang.org/x/net/context" + + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for Tikv service + +type TikvClient interface { + // KV commands with mvcc/txn supported. + KvGet(ctx context.Context, in *kvrpcpb.GetRequest, opts ...grpc.CallOption) (*kvrpcpb.GetResponse, error) + KvScan(ctx context.Context, in *kvrpcpb.ScanRequest, opts ...grpc.CallOption) (*kvrpcpb.ScanResponse, error) + KvPrewrite(ctx context.Context, in *kvrpcpb.PrewriteRequest, opts ...grpc.CallOption) (*kvrpcpb.PrewriteResponse, error) + KvCommit(ctx context.Context, in *kvrpcpb.CommitRequest, opts ...grpc.CallOption) (*kvrpcpb.CommitResponse, error) + KvImport(ctx context.Context, in *kvrpcpb.ImportRequest, opts ...grpc.CallOption) (*kvrpcpb.ImportResponse, error) + KvCleanup(ctx context.Context, in *kvrpcpb.CleanupRequest, opts ...grpc.CallOption) (*kvrpcpb.CleanupResponse, error) + KvBatchGet(ctx context.Context, in *kvrpcpb.BatchGetRequest, opts ...grpc.CallOption) (*kvrpcpb.BatchGetResponse, error) + KvBatchRollback(ctx context.Context, in *kvrpcpb.BatchRollbackRequest, opts ...grpc.CallOption) (*kvrpcpb.BatchRollbackResponse, error) + KvScanLock(ctx context.Context, in *kvrpcpb.ScanLockRequest, opts ...grpc.CallOption) (*kvrpcpb.ScanLockResponse, error) + KvResolveLock(ctx context.Context, in *kvrpcpb.ResolveLockRequest, opts ...grpc.CallOption) (*kvrpcpb.ResolveLockResponse, error) + KvGC(ctx context.Context, in *kvrpcpb.GCRequest, opts ...grpc.CallOption) (*kvrpcpb.GCResponse, error) + KvDeleteRange(ctx context.Context, in *kvrpcpb.DeleteRangeRequest, opts ...grpc.CallOption) (*kvrpcpb.DeleteRangeResponse, error) + // RawKV commands. + RawGet(ctx context.Context, in *kvrpcpb.RawGetRequest, opts ...grpc.CallOption) (*kvrpcpb.RawGetResponse, error) + RawPut(ctx context.Context, in *kvrpcpb.RawPutRequest, opts ...grpc.CallOption) (*kvrpcpb.RawPutResponse, error) + RawDelete(ctx context.Context, in *kvrpcpb.RawDeleteRequest, opts ...grpc.CallOption) (*kvrpcpb.RawDeleteResponse, error) + RawScan(ctx context.Context, in *kvrpcpb.RawScanRequest, opts ...grpc.CallOption) (*kvrpcpb.RawScanResponse, error) + // SQL push down commands. + Coprocessor(ctx context.Context, in *coprocessor.Request, opts ...grpc.CallOption) (*coprocessor.Response, error) + // Raft commands (tikv <-> tikv). + Raft(ctx context.Context, opts ...grpc.CallOption) (Tikv_RaftClient, error) + Snapshot(ctx context.Context, opts ...grpc.CallOption) (Tikv_SnapshotClient, error) + // transaction debugger commands. + MvccGetByKey(ctx context.Context, in *kvrpcpb.MvccGetByKeyRequest, opts ...grpc.CallOption) (*kvrpcpb.MvccGetByKeyResponse, error) + MvccGetByStartTs(ctx context.Context, in *kvrpcpb.MvccGetByStartTsRequest, opts ...grpc.CallOption) (*kvrpcpb.MvccGetByStartTsResponse, error) +} + +type tikvClient struct { + cc *grpc.ClientConn +} + +func NewTikvClient(cc *grpc.ClientConn) TikvClient { + return &tikvClient{cc} +} + +func (c *tikvClient) KvGet(ctx context.Context, in *kvrpcpb.GetRequest, opts ...grpc.CallOption) (*kvrpcpb.GetResponse, error) { + out := new(kvrpcpb.GetResponse) + err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvGet", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tikvClient) KvScan(ctx context.Context, in *kvrpcpb.ScanRequest, opts ...grpc.CallOption) (*kvrpcpb.ScanResponse, error) { + out := new(kvrpcpb.ScanResponse) + err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvScan", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tikvClient) KvPrewrite(ctx context.Context, in *kvrpcpb.PrewriteRequest, opts ...grpc.CallOption) (*kvrpcpb.PrewriteResponse, error) { + out := new(kvrpcpb.PrewriteResponse) + err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvPrewrite", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tikvClient) KvCommit(ctx context.Context, in *kvrpcpb.CommitRequest, opts ...grpc.CallOption) (*kvrpcpb.CommitResponse, error) { + out := new(kvrpcpb.CommitResponse) + err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvCommit", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tikvClient) KvImport(ctx context.Context, in *kvrpcpb.ImportRequest, opts ...grpc.CallOption) (*kvrpcpb.ImportResponse, error) { + out := new(kvrpcpb.ImportResponse) + err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvImport", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tikvClient) KvCleanup(ctx context.Context, in *kvrpcpb.CleanupRequest, opts ...grpc.CallOption) (*kvrpcpb.CleanupResponse, error) { + out := new(kvrpcpb.CleanupResponse) + err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvCleanup", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tikvClient) KvBatchGet(ctx context.Context, in *kvrpcpb.BatchGetRequest, opts ...grpc.CallOption) (*kvrpcpb.BatchGetResponse, error) { + out := new(kvrpcpb.BatchGetResponse) + err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvBatchGet", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tikvClient) KvBatchRollback(ctx context.Context, in *kvrpcpb.BatchRollbackRequest, opts ...grpc.CallOption) (*kvrpcpb.BatchRollbackResponse, error) { + out := new(kvrpcpb.BatchRollbackResponse) + err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvBatchRollback", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tikvClient) KvScanLock(ctx context.Context, in *kvrpcpb.ScanLockRequest, opts ...grpc.CallOption) (*kvrpcpb.ScanLockResponse, error) { + out := new(kvrpcpb.ScanLockResponse) + err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvScanLock", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tikvClient) KvResolveLock(ctx context.Context, in *kvrpcpb.ResolveLockRequest, opts ...grpc.CallOption) (*kvrpcpb.ResolveLockResponse, error) { + out := new(kvrpcpb.ResolveLockResponse) + err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvResolveLock", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tikvClient) KvGC(ctx context.Context, in *kvrpcpb.GCRequest, opts ...grpc.CallOption) (*kvrpcpb.GCResponse, error) { + out := new(kvrpcpb.GCResponse) + err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvGC", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tikvClient) KvDeleteRange(ctx context.Context, in *kvrpcpb.DeleteRangeRequest, opts ...grpc.CallOption) (*kvrpcpb.DeleteRangeResponse, error) { + out := new(kvrpcpb.DeleteRangeResponse) + err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvDeleteRange", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tikvClient) RawGet(ctx context.Context, in *kvrpcpb.RawGetRequest, opts ...grpc.CallOption) (*kvrpcpb.RawGetResponse, error) { + out := new(kvrpcpb.RawGetResponse) + err := grpc.Invoke(ctx, "/tikvpb.Tikv/RawGet", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tikvClient) RawPut(ctx context.Context, in *kvrpcpb.RawPutRequest, opts ...grpc.CallOption) (*kvrpcpb.RawPutResponse, error) { + out := new(kvrpcpb.RawPutResponse) + err := grpc.Invoke(ctx, "/tikvpb.Tikv/RawPut", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tikvClient) RawDelete(ctx context.Context, in *kvrpcpb.RawDeleteRequest, opts ...grpc.CallOption) (*kvrpcpb.RawDeleteResponse, error) { + out := new(kvrpcpb.RawDeleteResponse) + err := grpc.Invoke(ctx, "/tikvpb.Tikv/RawDelete", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tikvClient) RawScan(ctx context.Context, in *kvrpcpb.RawScanRequest, opts ...grpc.CallOption) (*kvrpcpb.RawScanResponse, error) { + out := new(kvrpcpb.RawScanResponse) + err := grpc.Invoke(ctx, "/tikvpb.Tikv/RawScan", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tikvClient) Coprocessor(ctx context.Context, in *coprocessor.Request, opts ...grpc.CallOption) (*coprocessor.Response, error) { + out := new(coprocessor.Response) + err := grpc.Invoke(ctx, "/tikvpb.Tikv/Coprocessor", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tikvClient) Raft(ctx context.Context, opts ...grpc.CallOption) (Tikv_RaftClient, error) { + stream, err := grpc.NewClientStream(ctx, &_Tikv_serviceDesc.Streams[0], c.cc, "/tikvpb.Tikv/Raft", opts...) + if err != nil { + return nil, err + } + x := &tikvRaftClient{stream} + return x, nil +} + +type Tikv_RaftClient interface { + Send(*raft_serverpb.RaftMessage) error + CloseAndRecv() (*raft_serverpb.Done, error) + grpc.ClientStream +} + +type tikvRaftClient struct { + grpc.ClientStream +} + +func (x *tikvRaftClient) Send(m *raft_serverpb.RaftMessage) error { + return x.ClientStream.SendMsg(m) +} + +func (x *tikvRaftClient) CloseAndRecv() (*raft_serverpb.Done, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(raft_serverpb.Done) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *tikvClient) Snapshot(ctx context.Context, opts ...grpc.CallOption) (Tikv_SnapshotClient, error) { + stream, err := grpc.NewClientStream(ctx, &_Tikv_serviceDesc.Streams[1], c.cc, "/tikvpb.Tikv/Snapshot", opts...) + if err != nil { + return nil, err + } + x := &tikvSnapshotClient{stream} + return x, nil +} + +type Tikv_SnapshotClient interface { + Send(*raft_serverpb.SnapshotChunk) error + CloseAndRecv() (*raft_serverpb.Done, error) + grpc.ClientStream +} + +type tikvSnapshotClient struct { + grpc.ClientStream +} + +func (x *tikvSnapshotClient) Send(m *raft_serverpb.SnapshotChunk) error { + return x.ClientStream.SendMsg(m) +} + +func (x *tikvSnapshotClient) CloseAndRecv() (*raft_serverpb.Done, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(raft_serverpb.Done) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *tikvClient) MvccGetByKey(ctx context.Context, in *kvrpcpb.MvccGetByKeyRequest, opts ...grpc.CallOption) (*kvrpcpb.MvccGetByKeyResponse, error) { + out := new(kvrpcpb.MvccGetByKeyResponse) + err := grpc.Invoke(ctx, "/tikvpb.Tikv/MvccGetByKey", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tikvClient) MvccGetByStartTs(ctx context.Context, in *kvrpcpb.MvccGetByStartTsRequest, opts ...grpc.CallOption) (*kvrpcpb.MvccGetByStartTsResponse, error) { + out := new(kvrpcpb.MvccGetByStartTsResponse) + err := grpc.Invoke(ctx, "/tikvpb.Tikv/MvccGetByStartTs", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Tikv service + +type TikvServer interface { + // KV commands with mvcc/txn supported. + KvGet(context.Context, *kvrpcpb.GetRequest) (*kvrpcpb.GetResponse, error) + KvScan(context.Context, *kvrpcpb.ScanRequest) (*kvrpcpb.ScanResponse, error) + KvPrewrite(context.Context, *kvrpcpb.PrewriteRequest) (*kvrpcpb.PrewriteResponse, error) + KvCommit(context.Context, *kvrpcpb.CommitRequest) (*kvrpcpb.CommitResponse, error) + KvImport(context.Context, *kvrpcpb.ImportRequest) (*kvrpcpb.ImportResponse, error) + KvCleanup(context.Context, *kvrpcpb.CleanupRequest) (*kvrpcpb.CleanupResponse, error) + KvBatchGet(context.Context, *kvrpcpb.BatchGetRequest) (*kvrpcpb.BatchGetResponse, error) + KvBatchRollback(context.Context, *kvrpcpb.BatchRollbackRequest) (*kvrpcpb.BatchRollbackResponse, error) + KvScanLock(context.Context, *kvrpcpb.ScanLockRequest) (*kvrpcpb.ScanLockResponse, error) + KvResolveLock(context.Context, *kvrpcpb.ResolveLockRequest) (*kvrpcpb.ResolveLockResponse, error) + KvGC(context.Context, *kvrpcpb.GCRequest) (*kvrpcpb.GCResponse, error) + KvDeleteRange(context.Context, *kvrpcpb.DeleteRangeRequest) (*kvrpcpb.DeleteRangeResponse, error) + // RawKV commands. + RawGet(context.Context, *kvrpcpb.RawGetRequest) (*kvrpcpb.RawGetResponse, error) + RawPut(context.Context, *kvrpcpb.RawPutRequest) (*kvrpcpb.RawPutResponse, error) + RawDelete(context.Context, *kvrpcpb.RawDeleteRequest) (*kvrpcpb.RawDeleteResponse, error) + RawScan(context.Context, *kvrpcpb.RawScanRequest) (*kvrpcpb.RawScanResponse, error) + // SQL push down commands. + Coprocessor(context.Context, *coprocessor.Request) (*coprocessor.Response, error) + // Raft commands (tikv <-> tikv). + Raft(Tikv_RaftServer) error + Snapshot(Tikv_SnapshotServer) error + // transaction debugger commands. + MvccGetByKey(context.Context, *kvrpcpb.MvccGetByKeyRequest) (*kvrpcpb.MvccGetByKeyResponse, error) + MvccGetByStartTs(context.Context, *kvrpcpb.MvccGetByStartTsRequest) (*kvrpcpb.MvccGetByStartTsResponse, error) +} + +func RegisterTikvServer(s *grpc.Server, srv TikvServer) { + s.RegisterService(&_Tikv_serviceDesc, srv) +} + +func _Tikv_KvGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(kvrpcpb.GetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TikvServer).KvGet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tikvpb.Tikv/KvGet", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TikvServer).KvGet(ctx, req.(*kvrpcpb.GetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Tikv_KvScan_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(kvrpcpb.ScanRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TikvServer).KvScan(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tikvpb.Tikv/KvScan", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TikvServer).KvScan(ctx, req.(*kvrpcpb.ScanRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Tikv_KvPrewrite_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(kvrpcpb.PrewriteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TikvServer).KvPrewrite(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tikvpb.Tikv/KvPrewrite", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TikvServer).KvPrewrite(ctx, req.(*kvrpcpb.PrewriteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Tikv_KvCommit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(kvrpcpb.CommitRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TikvServer).KvCommit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tikvpb.Tikv/KvCommit", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TikvServer).KvCommit(ctx, req.(*kvrpcpb.CommitRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Tikv_KvImport_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(kvrpcpb.ImportRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TikvServer).KvImport(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tikvpb.Tikv/KvImport", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TikvServer).KvImport(ctx, req.(*kvrpcpb.ImportRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Tikv_KvCleanup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(kvrpcpb.CleanupRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TikvServer).KvCleanup(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tikvpb.Tikv/KvCleanup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TikvServer).KvCleanup(ctx, req.(*kvrpcpb.CleanupRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Tikv_KvBatchGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(kvrpcpb.BatchGetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TikvServer).KvBatchGet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tikvpb.Tikv/KvBatchGet", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TikvServer).KvBatchGet(ctx, req.(*kvrpcpb.BatchGetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Tikv_KvBatchRollback_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(kvrpcpb.BatchRollbackRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TikvServer).KvBatchRollback(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tikvpb.Tikv/KvBatchRollback", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TikvServer).KvBatchRollback(ctx, req.(*kvrpcpb.BatchRollbackRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Tikv_KvScanLock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(kvrpcpb.ScanLockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TikvServer).KvScanLock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tikvpb.Tikv/KvScanLock", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TikvServer).KvScanLock(ctx, req.(*kvrpcpb.ScanLockRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Tikv_KvResolveLock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(kvrpcpb.ResolveLockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TikvServer).KvResolveLock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tikvpb.Tikv/KvResolveLock", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TikvServer).KvResolveLock(ctx, req.(*kvrpcpb.ResolveLockRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Tikv_KvGC_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(kvrpcpb.GCRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TikvServer).KvGC(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tikvpb.Tikv/KvGC", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TikvServer).KvGC(ctx, req.(*kvrpcpb.GCRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Tikv_KvDeleteRange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(kvrpcpb.DeleteRangeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TikvServer).KvDeleteRange(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tikvpb.Tikv/KvDeleteRange", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TikvServer).KvDeleteRange(ctx, req.(*kvrpcpb.DeleteRangeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Tikv_RawGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(kvrpcpb.RawGetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TikvServer).RawGet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tikvpb.Tikv/RawGet", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TikvServer).RawGet(ctx, req.(*kvrpcpb.RawGetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Tikv_RawPut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(kvrpcpb.RawPutRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TikvServer).RawPut(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tikvpb.Tikv/RawPut", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TikvServer).RawPut(ctx, req.(*kvrpcpb.RawPutRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Tikv_RawDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(kvrpcpb.RawDeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TikvServer).RawDelete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tikvpb.Tikv/RawDelete", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TikvServer).RawDelete(ctx, req.(*kvrpcpb.RawDeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Tikv_RawScan_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(kvrpcpb.RawScanRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TikvServer).RawScan(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tikvpb.Tikv/RawScan", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TikvServer).RawScan(ctx, req.(*kvrpcpb.RawScanRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Tikv_Coprocessor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(coprocessor.Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TikvServer).Coprocessor(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tikvpb.Tikv/Coprocessor", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TikvServer).Coprocessor(ctx, req.(*coprocessor.Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Tikv_Raft_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(TikvServer).Raft(&tikvRaftServer{stream}) +} + +type Tikv_RaftServer interface { + SendAndClose(*raft_serverpb.Done) error + Recv() (*raft_serverpb.RaftMessage, error) + grpc.ServerStream +} + +type tikvRaftServer struct { + grpc.ServerStream +} + +func (x *tikvRaftServer) SendAndClose(m *raft_serverpb.Done) error { + return x.ServerStream.SendMsg(m) +} + +func (x *tikvRaftServer) Recv() (*raft_serverpb.RaftMessage, error) { + m := new(raft_serverpb.RaftMessage) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _Tikv_Snapshot_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(TikvServer).Snapshot(&tikvSnapshotServer{stream}) +} + +type Tikv_SnapshotServer interface { + SendAndClose(*raft_serverpb.Done) error + Recv() (*raft_serverpb.SnapshotChunk, error) + grpc.ServerStream +} + +type tikvSnapshotServer struct { + grpc.ServerStream +} + +func (x *tikvSnapshotServer) SendAndClose(m *raft_serverpb.Done) error { + return x.ServerStream.SendMsg(m) +} + +func (x *tikvSnapshotServer) Recv() (*raft_serverpb.SnapshotChunk, error) { + m := new(raft_serverpb.SnapshotChunk) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _Tikv_MvccGetByKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(kvrpcpb.MvccGetByKeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TikvServer).MvccGetByKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tikvpb.Tikv/MvccGetByKey", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TikvServer).MvccGetByKey(ctx, req.(*kvrpcpb.MvccGetByKeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Tikv_MvccGetByStartTs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(kvrpcpb.MvccGetByStartTsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TikvServer).MvccGetByStartTs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tikvpb.Tikv/MvccGetByStartTs", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TikvServer).MvccGetByStartTs(ctx, req.(*kvrpcpb.MvccGetByStartTsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Tikv_serviceDesc = grpc.ServiceDesc{ + ServiceName: "tikvpb.Tikv", + HandlerType: (*TikvServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "KvGet", + Handler: _Tikv_KvGet_Handler, + }, + { + MethodName: "KvScan", + Handler: _Tikv_KvScan_Handler, + }, + { + MethodName: "KvPrewrite", + Handler: _Tikv_KvPrewrite_Handler, + }, + { + MethodName: "KvCommit", + Handler: _Tikv_KvCommit_Handler, + }, + { + MethodName: "KvImport", + Handler: _Tikv_KvImport_Handler, + }, + { + MethodName: "KvCleanup", + Handler: _Tikv_KvCleanup_Handler, + }, + { + MethodName: "KvBatchGet", + Handler: _Tikv_KvBatchGet_Handler, + }, + { + MethodName: "KvBatchRollback", + Handler: _Tikv_KvBatchRollback_Handler, + }, + { + MethodName: "KvScanLock", + Handler: _Tikv_KvScanLock_Handler, + }, + { + MethodName: "KvResolveLock", + Handler: _Tikv_KvResolveLock_Handler, + }, + { + MethodName: "KvGC", + Handler: _Tikv_KvGC_Handler, + }, + { + MethodName: "KvDeleteRange", + Handler: _Tikv_KvDeleteRange_Handler, + }, + { + MethodName: "RawGet", + Handler: _Tikv_RawGet_Handler, + }, + { + MethodName: "RawPut", + Handler: _Tikv_RawPut_Handler, + }, + { + MethodName: "RawDelete", + Handler: _Tikv_RawDelete_Handler, + }, + { + MethodName: "RawScan", + Handler: _Tikv_RawScan_Handler, + }, + { + MethodName: "Coprocessor", + Handler: _Tikv_Coprocessor_Handler, + }, + { + MethodName: "MvccGetByKey", + Handler: _Tikv_MvccGetByKey_Handler, + }, + { + MethodName: "MvccGetByStartTs", + Handler: _Tikv_MvccGetByStartTs_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Raft", + Handler: _Tikv_Raft_Handler, + ClientStreams: true, + }, + { + StreamName: "Snapshot", + Handler: _Tikv_Snapshot_Handler, + ClientStreams: true, + }, + }, + Metadata: "tikvpb.proto", +} + +func init() { proto.RegisterFile("tikvpb.proto", fileDescriptorTikvpb) } + +var fileDescriptorTikvpb = []byte{ + // 579 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x95, 0xdd, 0x8e, 0xd2, 0x4e, + 0x18, 0xc6, 0x97, 0x84, 0x3f, 0xff, 0xdd, 0xd9, 0xdd, 0xa8, 0x03, 0x2a, 0x5b, 0x77, 0x89, 0xee, + 0x91, 0xf1, 0xa0, 0xc6, 0x8f, 0xc4, 0x03, 0x3f, 0xa2, 0x94, 0x84, 0x98, 0x2e, 0x09, 0x29, 0x7b, + 0xe2, 0x91, 0x19, 0x26, 0xef, 0x02, 0x29, 0x74, 0xea, 0xcc, 0x30, 0x64, 0xaf, 0xc2, 0x53, 0x2f, + 0xc9, 0x43, 0x2f, 0xc1, 0xe0, 0x8d, 0x98, 0xb6, 0xcc, 0x74, 0x86, 0x82, 0x47, 0xb4, 0xbf, 0xe7, + 0x7d, 0x9e, 0xbe, 0xf3, 0x09, 0x3a, 0x91, 0xb3, 0x58, 0xa5, 0x63, 0x3f, 0xe5, 0x4c, 0x32, 0xdc, + 0x28, 0xde, 0xbc, 0x7b, 0x94, 0xa5, 0x9c, 0x51, 0x10, 0x82, 0xf1, 0x42, 0xf2, 0x4e, 0x63, 0xc5, + 0x53, 0xaa, 0x2b, 0xbd, 0x26, 0x27, 0x37, 0xf2, 0xab, 0x00, 0xae, 0x80, 0x1b, 0xd8, 0x9a, 0xb0, + 0x09, 0xcb, 0x1f, 0x9f, 0x67, 0x4f, 0x05, 0x7d, 0xf9, 0xfd, 0x18, 0xd5, 0xaf, 0x67, 0xb1, 0xc2, + 0xaf, 0xd1, 0x7f, 0xa1, 0xea, 0x83, 0xc4, 0x4d, 0x5f, 0x87, 0xf5, 0x41, 0x46, 0xf0, 0x6d, 0x09, + 0x42, 0x7a, 0x2d, 0x17, 0x8a, 0x94, 0x25, 0x02, 0x2e, 0x0f, 0xf0, 0x1b, 0xd4, 0x08, 0xd5, 0x88, + 0x92, 0x04, 0x97, 0x15, 0xd9, 0xab, 0xf6, 0xdd, 0xdf, 0xa2, 0xc6, 0x18, 0x20, 0x14, 0xaa, 0x21, + 0x87, 0x15, 0x9f, 0x49, 0xc0, 0x6d, 0x53, 0xa6, 0x91, 0x0e, 0x38, 0xdb, 0xa1, 0x98, 0x90, 0xf7, + 0xe8, 0x30, 0x54, 0x01, 0x5b, 0x2c, 0x66, 0x12, 0x3f, 0x30, 0x85, 0x05, 0xd0, 0x01, 0x0f, 0x2b, + 0xdc, 0xb5, 0x7f, 0x5e, 0xa4, 0x8c, 0xdb, 0xf6, 0x02, 0x54, 0xed, 0x9a, 0x1b, 0xfb, 0x47, 0x74, + 0x14, 0xaa, 0x60, 0x0e, 0x24, 0x59, 0xa6, 0xd8, 0xfa, 0x4c, 0x41, 0x74, 0x40, 0xbb, 0x2a, 0xb8, + 0x93, 0xd0, 0x25, 0x92, 0x4e, 0xb3, 0x89, 0x2f, 0x2b, 0x35, 0xaa, 0x4e, 0x42, 0xa9, 0x98, 0x90, + 0x08, 0xdd, 0xd9, 0x84, 0x44, 0x6c, 0x3e, 0x1f, 0x13, 0x1a, 0xe3, 0x0b, 0xb7, 0x5e, 0x73, 0x1d, + 0xd7, 0xd9, 0x27, 0xbb, 0x8d, 0x65, 0x2b, 0x76, 0xc5, 0x68, 0x6c, 0x35, 0xa6, 0x51, 0xb5, 0xb1, + 0x52, 0x31, 0x21, 0x57, 0xe8, 0x34, 0x54, 0x11, 0x08, 0x36, 0x57, 0x90, 0xe7, 0x3c, 0x32, 0xd5, + 0x16, 0xd5, 0x51, 0xe7, 0xbb, 0x45, 0x93, 0xf6, 0x02, 0xd5, 0x43, 0xd5, 0x0f, 0x30, 0x2e, 0x77, + 0x62, 0xa0, 0xbd, 0x4d, 0x87, 0xb9, 0x0d, 0xf4, 0x60, 0x0e, 0x12, 0x22, 0x92, 0x4c, 0xc0, 0x6a, + 0xc0, 0xa2, 0xd5, 0x06, 0x1c, 0xd1, 0xa4, 0xbd, 0x45, 0x8d, 0x88, 0xac, 0xb2, 0x85, 0x2a, 0xf7, + 0x4a, 0x01, 0xaa, 0x7b, 0x45, 0xf3, 0x2d, 0xf3, 0x70, 0xb9, 0x65, 0x1e, 0x2e, 0x77, 0x9b, 0x73, + 0x6e, 0xcc, 0x3d, 0x74, 0x14, 0x91, 0x55, 0xd1, 0x15, 0x3e, 0xb3, 0xeb, 0x36, 0x9d, 0x6e, 0x22, + 0xbc, 0x5d, 0x92, 0x49, 0xf9, 0x80, 0xfe, 0x8f, 0xc8, 0x2a, 0x3f, 0xab, 0xce, 0xb7, 0xec, 0xe3, + 0xda, 0xae, 0x0a, 0xc6, 0xff, 0x0e, 0x1d, 0x07, 0xe5, 0xc5, 0x83, 0x5b, 0xbe, 0x7d, 0x0d, 0x95, + 0xe7, 0xdd, 0xa5, 0xd6, 0x04, 0xd4, 0x23, 0x72, 0x23, 0xb1, 0xe7, 0xbb, 0x77, 0x53, 0x06, 0x07, + 0x20, 0x04, 0x99, 0x80, 0xd7, 0xdc, 0xd2, 0x7a, 0x2c, 0x81, 0xcb, 0x83, 0xa7, 0x35, 0xfc, 0x09, + 0x1d, 0x8e, 0x12, 0x92, 0x8a, 0x29, 0x93, 0xf8, 0x7c, 0xab, 0x48, 0x0b, 0xc1, 0x74, 0x99, 0xc4, + 0xfb, 0x23, 0x06, 0xe8, 0x64, 0xa0, 0x28, 0xed, 0x83, 0xec, 0xde, 0x86, 0x70, 0x8b, 0xcb, 0xd5, + 0xb6, 0xb1, 0x1e, 0xc6, 0xc5, 0x1e, 0xd5, 0x0c, 0xe7, 0x0b, 0xba, 0x6b, 0x94, 0x91, 0x24, 0x5c, + 0x5e, 0x0b, 0xfc, 0xb8, 0x6a, 0xda, 0x48, 0x3a, 0xf6, 0xc9, 0x3f, 0x2a, 0x74, 0x74, 0xf7, 0xd9, + 0xcf, 0x75, 0xa7, 0xf6, 0x6b, 0xdd, 0xa9, 0xfd, 0x5e, 0x77, 0x6a, 0x3f, 0xfe, 0x74, 0x0e, 0x50, + 0x9b, 0xb2, 0x85, 0x9f, 0xce, 0x92, 0x09, 0x25, 0xa9, 0x9f, 0xfd, 0x09, 0xf8, 0xb1, 0xca, 0x6f, + 0xef, 0x71, 0x23, 0xff, 0x79, 0xf5, 0x37, 0x00, 0x00, 0xff, 0xff, 0x04, 0xb8, 0x87, 0xcd, 0x29, + 0x06, 0x00, 0x00, +} diff --git a/_vendor/src/github.com/pingcap/kvproto/proto/coprocessor.proto b/_vendor/src/github.com/pingcap/kvproto/proto/coprocessor.proto new file mode 100644 index 00000000000..908fb087d17 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/proto/coprocessor.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; +package coprocessor; + +import "errorpb.proto"; +import "kvrpcpb.proto"; +import "gogoproto/gogo.proto"; + +option (gogoproto.marshaler_all) = true; +option (gogoproto.sizer_all) = true; +option (gogoproto.unmarshaler_all) = true; + +option java_package = "com.pingcap.tikv.kvproto"; + +// [start, end) +message KeyRange { + bytes start = 1; + bytes end = 2; +} + +message Request { + kvrpcpb.Context context = 1; + int64 tp = 2; + bytes data = 3; + repeated KeyRange ranges = 4; +} + +message Response { + bytes data = 1 [(gogoproto.customtype) = "github.com/pingcap/tipb/sharedbytes.SharedBytes", (gogoproto.nullable) = false]; + errorpb.Error region_error = 2; + kvrpcpb.LockInfo locked = 3; + string other_error = 4; +} diff --git a/_vendor/src/github.com/pingcap/kvproto/proto/eraftpb.proto b/_vendor/src/github.com/pingcap/kvproto/proto/eraftpb.proto new file mode 100644 index 00000000000..ba6fcc94b26 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/proto/eraftpb.proto @@ -0,0 +1,86 @@ +syntax = "proto2"; +package eraftpb; + +option java_package = "com.pingcap.tikv.kvproto"; + +enum EntryType { + EntryNormal = 0; + EntryConfChange = 1; +} + +message Entry { + optional EntryType entry_type = 1; + optional uint64 term = 2; + optional uint64 index = 3; + optional bytes data = 4; +} + +message SnapshotMetadata { + optional ConfState conf_state = 1; + optional uint64 index = 2; + optional uint64 term = 3; +} + +message Snapshot { + optional bytes data = 1; + optional SnapshotMetadata metadata = 2; +} + +enum MessageType { + MsgHup = 0; + MsgBeat = 1; + MsgPropose = 2; + MsgAppend = 3; + MsgAppendResponse = 4; + MsgRequestVote = 5; + MsgRequestVoteResponse = 6; + MsgSnapshot = 7; + MsgHeartbeat = 8; + MsgHeartbeatResponse = 9; + MsgUnreachable = 10; + MsgSnapStatus = 11; + MsgCheckQuorum = 12; + MsgTransferLeader = 13; + MsgTimeoutNow = 14; + MsgReadIndex = 15; + MsgReadIndexResp = 16; + MsgRequestPreVote = 17; + MsgRequestPreVoteResponse = 18; +} + +message Message { + optional MessageType msg_type = 1; + optional uint64 to = 2; + optional uint64 from = 3; + optional uint64 term = 4; + optional uint64 log_term = 5; + optional uint64 index = 6; + repeated Entry entries = 7; + optional uint64 commit = 8; + optional Snapshot snapshot = 9; + optional bool reject = 10; + optional uint64 reject_hint = 11; + optional bytes context = 12; +} + +message HardState { + optional uint64 term = 1; + optional uint64 vote = 2; + optional uint64 commit = 3; +} + +message ConfState { + repeated uint64 nodes = 1; +} + +enum ConfChangeType { + AddNode = 0; + RemoveNode = 1; +} + +message ConfChange { + optional uint64 id = 1; + optional ConfChangeType change_type = 2; + optional uint64 node_id = 3; + optional bytes context = 4; +} diff --git a/_vendor/src/github.com/pingcap/kvproto/proto/errorpb.proto b/_vendor/src/github.com/pingcap/kvproto/proto/errorpb.proto new file mode 100644 index 00000000000..32309d79e79 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/proto/errorpb.proto @@ -0,0 +1,58 @@ +syntax = "proto2"; +package errorpb; + +import "metapb.proto"; +import "gogoproto/gogo.proto"; + +option (gogoproto.marshaler_all) = true; +option (gogoproto.sizer_all) = true; +option (gogoproto.unmarshaler_all) = true; + +option java_package = "com.pingcap.tikv.kvproto"; + +message NotLeader { + optional uint64 region_id = 1; + optional metapb.Peer leader = 2; +} + +message StoreNotMatch { +} + +message RegionNotFound { + optional uint64 region_id = 1; +} + +message KeyNotInRegion { + optional bytes key = 1; + optional uint64 region_id = 2; + optional bytes start_key = 3; + optional bytes end_key = 4; +} + +message StaleEpoch { + repeated metapb.Region new_regions = 1; +} + +message ServerIsBusy { + optional string reason = 1; +} + +message StaleCommand { +} + +message RaftEntryTooLarge { + optional uint64 region_id = 1; + optional uint64 entry_size = 2; +} + +message Error { + optional string message = 1; + optional NotLeader not_leader = 2; + optional RegionNotFound region_not_found = 3; + optional KeyNotInRegion key_not_in_region = 4; + optional StaleEpoch stale_epoch = 5; + optional ServerIsBusy server_is_busy = 6; + optional StaleCommand stale_command = 7; + optional StoreNotMatch store_not_match = 8; + optional RaftEntryTooLarge raft_entry_too_large = 9; +} diff --git a/_vendor/src/github.com/pingcap/kvproto/proto/kvrpcpb.proto b/_vendor/src/github.com/pingcap/kvproto/proto/kvrpcpb.proto new file mode 100644 index 00000000000..1f482802fe9 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/proto/kvrpcpb.proto @@ -0,0 +1,292 @@ +syntax = "proto3"; +package kvrpcpb; + +import "metapb.proto"; +import "errorpb.proto"; +import "gogoproto/gogo.proto"; + +option (gogoproto.marshaler_all) = true; +option (gogoproto.sizer_all) = true; +option (gogoproto.unmarshaler_all) = true; + +option java_package = "com.pingcap.tikv.kvproto"; + +message LockInfo { + bytes primary_lock = 1; + uint64 lock_version = 2; + bytes key = 3; + uint64 lock_ttl = 4; +} + +message KeyError { + LockInfo locked = 1; // Client should backoff or cleanup the lock then retry. + string retryable = 2; // Client may restart the txn. e.g write conflict. + string abort = 3; // Client should abort the txn. +} + +enum CommandPri { + Normal = 0; // Normal must the default value + Low = 1; + High = 2; +} + +enum IsolationLevel { + SI = 0; // SI = snapshot isolation + RC = 1; // RC = read committed +} + +message Context { + reserved 4; + reserved "read_quorum"; + uint64 region_id = 1; + metapb.RegionEpoch region_epoch = 2; + metapb.Peer peer = 3; + uint64 term = 5; + CommandPri priority = 6; + IsolationLevel isolation_level = 7; +} + +message GetRequest { + Context context = 1; + bytes key = 2; + uint64 version = 3; +} + +message GetResponse { + errorpb.Error region_error = 1; + KeyError error = 2; + bytes value = 3; +} + +message ScanRequest { + Context context = 1; + bytes start_key = 2; + uint32 limit = 3; + uint64 version = 4; + bool key_only = 5; +} + +message KvPair { + KeyError error = 1; + bytes key = 2; + bytes value = 3; +} + +message ScanResponse { + errorpb.Error region_error = 1; + repeated KvPair pairs = 2; +} + +enum Op { + Put = 0; + Del = 1; + Lock = 2; + Rollback = 3; +} + +message Mutation { + Op op = 1; + bytes key = 2; + bytes value = 3; +} + +message PrewriteRequest { + Context context = 1; + repeated Mutation mutations = 2; + // primary_lock_key + bytes primary_lock = 3; + uint64 start_version = 4; + uint64 lock_ttl = 5; + bool skip_constraint_check = 6; +} + +message PrewriteResponse { + errorpb.Error region_error = 1; + repeated KeyError errors = 2; +} + +message CommitRequest { + reserved 5; + reserved "binlog"; + Context context = 1; + uint64 start_version = 2; + repeated bytes keys = 3; + uint64 commit_version = 4; +} + +message CommitResponse { + errorpb.Error region_error = 1; + KeyError error = 2; +} + +message ImportRequest { + repeated Mutation mutations = 1; + uint64 commit_version = 2; +} + +message ImportResponse { + errorpb.Error region_error = 1; + string error = 2; +} + +message BatchRollbackRequest { + Context context = 1; + uint64 start_version = 2; + repeated bytes keys = 3; +} + +message BatchRollbackResponse { + errorpb.Error region_error = 1; + KeyError error = 2; +} + +message CleanupRequest { + Context context = 1; + bytes key = 2; + uint64 start_version = 3; +} + +message CleanupResponse { + errorpb.Error region_error = 1; + KeyError error = 2; + uint64 commit_version = 3; // set this if the key is already committed +} + +message BatchGetRequest { + Context context = 1; + repeated bytes keys = 2; + uint64 version = 3; +} + +message BatchGetResponse { + errorpb.Error region_error = 1; + repeated KvPair pairs = 2; +} + +message ScanLockRequest { + Context context = 1; + uint64 max_version = 2; +} + +message ScanLockResponse { + errorpb.Error region_error = 1; + KeyError error = 2; + repeated LockInfo locks = 3; +} + +message ResolveLockRequest { + Context context = 1; + uint64 start_version = 2; + // If the txn is rolled back, do not set it. + uint64 commit_version = 3; +} + +message ResolveLockResponse { + errorpb.Error region_error = 1; + KeyError error = 2; +} + +message GCRequest { + Context context = 1; + uint64 safe_point = 2; +} + +message GCResponse { + errorpb.Error region_error = 1; + KeyError error = 2; +} + +message RawGetRequest { + Context context = 1; + bytes key = 2; +} + +message RawGetResponse { + errorpb.Error region_error = 1; + string error = 2; + bytes value = 3; +} + +message RawPutRequest { + Context context = 1; + bytes key = 2; + bytes value = 3; +} + +message RawPutResponse { + errorpb.Error region_error = 1; + string error = 2; +} + +message RawDeleteRequest { + Context context = 1; + bytes key = 2; +} + +message RawDeleteResponse { + errorpb.Error region_error = 1; + string error = 2; +} + +message DeleteRangeRequest { + Context context = 1; + bytes start_key = 2; + bytes end_key = 3; +} + +message DeleteRangeResponse { + errorpb.Error region_error = 1; + string error = 2; +} + +message RawScanRequest { + Context context = 1; + bytes start_key = 2; + uint32 limit = 3; +} + +message RawScanResponse { + errorpb.Error region_error = 1; + repeated KvPair kvs = 2; +} + +message WriteInfo { + uint64 start_ts = 1; + Op type = 2; + uint64 commit_ts = 3; +} + +message ValueInfo { + bytes value = 1; + uint64 ts = 2; + bool is_short_value = 3; +} + +message MvccInfo { + LockInfo lock = 1; + repeated WriteInfo writes = 2; + repeated ValueInfo values = 3; +} + +message MvccGetByKeyRequest { + Context context = 1; + bytes key = 2; +} + +message MvccGetByKeyResponse { + errorpb.Error region_error = 1; + string error = 2; + MvccInfo info = 3; +} + +message MvccGetByStartTsRequest { + Context context = 1; + uint64 start_ts = 2; +} + +message MvccGetByStartTsResponse { + errorpb.Error region_error = 1; + string error = 2; + bytes key = 3; + MvccInfo info = 4; +} diff --git a/_vendor/src/github.com/pingcap/kvproto/proto/metapb.proto b/_vendor/src/github.com/pingcap/kvproto/proto/metapb.proto new file mode 100644 index 00000000000..c3871c8626a --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/proto/metapb.proto @@ -0,0 +1,59 @@ +syntax = "proto2"; +package metapb; + +import "gogoproto/gogo.proto"; + +option (gogoproto.marshaler_all) = true; +option (gogoproto.sizer_all) = true; +option (gogoproto.unmarshaler_all) = true; + +option java_package = "com.pingcap.tikv.kvproto"; + +message Cluster { + optional uint64 id = 1 [(gogoproto.nullable) = false]; + // max peer count for a region. + // pd will do the auto-balance if region peer count mismatches. + optional uint32 max_peer_count = 2 [(gogoproto.nullable) = false]; + // more attributes...... +} + +enum StoreState { + Up = 0; + Offline = 1; + Tombstone = 2; +} + +// Case insensitive key/value for replica constraints. +message StoreLabel { + optional string key = 1 [(gogoproto.nullable) = false]; + optional string value = 2 [(gogoproto.nullable) = false]; +} + +message Store { + optional uint64 id = 1 [(gogoproto.nullable) = false]; + optional string address = 2 [(gogoproto.nullable) = false]; + optional StoreState state = 3 [(gogoproto.nullable) = false]; + repeated StoreLabel labels = 4; + // more attributes...... +} + +message RegionEpoch { + // Conf change version, auto increment when add or remove peer + optional uint64 conf_ver = 1 [(gogoproto.nullable) = false]; + // Region version, auto increment when split or merge + optional uint64 version = 2 [(gogoproto.nullable) = false]; +} + +message Region { + optional uint64 id = 1 [(gogoproto.nullable) = false]; + // Region key range [start_key, end_key). + optional bytes start_key = 2; + optional bytes end_key = 3; + optional RegionEpoch region_epoch = 4; + repeated Peer peers = 5; +} + +message Peer { + optional uint64 id = 1 [(gogoproto.nullable) = false]; + optional uint64 store_id = 2 [(gogoproto.nullable) = false]; +} diff --git a/_vendor/src/github.com/pingcap/kvproto/proto/pdpb.proto b/_vendor/src/github.com/pingcap/kvproto/proto/pdpb.proto new file mode 100644 index 00000000000..a901f484871 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/proto/pdpb.proto @@ -0,0 +1,341 @@ +syntax = "proto3"; +package pdpb; + +import "metapb.proto"; + +import "gogoproto/gogo.proto"; + +option (gogoproto.sizer_all) = true; +option (gogoproto.marshaler_all) = true; +option (gogoproto.unmarshaler_all) = true; + +option java_package = "com.pingcap.tikv.kvproto"; + +service PD { + // GetMembers get the member list of this cluster. It does not require + // the cluster_id in request matchs the id of this cluster. + rpc GetMembers(GetMembersRequest) returns (GetMembersResponse) {} + + rpc Tso(stream TsoRequest) returns (stream TsoResponse) {} + + rpc Bootstrap(BootstrapRequest) returns (BootstrapResponse) {} + + rpc IsBootstrapped(IsBootstrappedRequest) returns (IsBootstrappedResponse) {} + + rpc AllocID(AllocIDRequest) returns (AllocIDResponse) {} + + rpc GetStore(GetStoreRequest) returns (GetStoreResponse) {} + + rpc PutStore(PutStoreRequest) returns (PutStoreResponse) {} + + rpc StoreHeartbeat(StoreHeartbeatRequest) returns (StoreHeartbeatResponse) {} + + rpc RegionHeartbeat(stream RegionHeartbeatRequest) returns (stream RegionHeartbeatResponse) {} + + rpc GetRegion(GetRegionRequest) returns (GetRegionResponse) {} + + rpc GetRegionByID(GetRegionByIDRequest) returns (GetRegionResponse) {} + + rpc AskSplit(AskSplitRequest) returns (AskSplitResponse) {} + + rpc ReportSplit(ReportSplitRequest) returns (ReportSplitResponse) {} + + rpc GetClusterConfig(GetClusterConfigRequest) returns (GetClusterConfigResponse) {} + + rpc PutClusterConfig(PutClusterConfigRequest) returns (PutClusterConfigResponse) {} +} + +message RequestHeader { + // cluster_id is the ID of the cluster which be sent to. + uint64 cluster_id = 1; +} + +message ResponseHeader { + // cluster_id is the ID of the cluster which sent the response. + uint64 cluster_id = 1; + Error error = 2; +} + +enum ErrorType { + OK = 0; + UNKNOWN = 1; + NOT_BOOTSTRAPPED = 2; + STORE_TOMBSTONE = 3; + ALREADY_BOOTSTRAPPED = 4; +} + +message Error { + ErrorType type = 1; + string message = 2; +} + +message TsoRequest { + RequestHeader header = 1; + + uint32 count = 2; +} + +message Timestamp { + int64 physical = 1; + int64 logical = 2; +} + +message TsoResponse { + ResponseHeader header = 1; + + uint32 count = 2; + Timestamp timestamp = 3; +} + +message BootstrapRequest { + RequestHeader header = 1; + + metapb.Store store = 2; + metapb.Region region = 3; +} + +message BootstrapResponse { + ResponseHeader header = 1; +} + +message IsBootstrappedRequest { + RequestHeader header = 1; +} + +message IsBootstrappedResponse { + ResponseHeader header = 1; + + bool bootstrapped = 2; +} + +message AllocIDRequest { + RequestHeader header = 1; +} + +message AllocIDResponse { + ResponseHeader header = 1; + + uint64 id = 2; +} + +message GetStoreRequest { + RequestHeader header = 1; + + uint64 store_id = 2; +} + +message GetStoreResponse { + ResponseHeader header = 1; + + metapb.Store store = 2; +} + +message PutStoreRequest { + RequestHeader header = 1; + + metapb.Store store = 2; +} + +message PutStoreResponse { + ResponseHeader header = 1; +} + +message GetRegionRequest { + RequestHeader header = 1; + + bytes region_key = 2; +} + +message GetRegionResponse { + ResponseHeader header = 1; + + metapb.Region region = 2; + metapb.Peer leader = 3; +} + +message GetRegionByIDRequest { + RequestHeader header = 1; + + uint64 region_id = 2; +} + +// Use GetRegionResponse as the response of GetRegionByIDRequest. + +message GetClusterConfigRequest { + RequestHeader header = 1; +} + +message GetClusterConfigResponse { + ResponseHeader header = 1; + + metapb.Cluster cluster = 2; +} + +message PutClusterConfigRequest { + RequestHeader header = 1; + + metapb.Cluster cluster = 2; +} + +message PutClusterConfigResponse { + ResponseHeader header = 1; +} + +message Member { + // name is the name of the PD member. + string name = 1; + // member_id is the unique id of the PD member. + uint64 member_id = 2; + repeated string peer_urls = 3; + repeated string client_urls = 4; +} + +message GetMembersRequest { + RequestHeader header = 1; +} + +message GetMembersResponse { + ResponseHeader header = 1; + + repeated Member members = 2; + Member leader = 3; +} + +message PeerStats { + metapb.Peer peer = 1; + uint64 down_seconds = 2; +} + +message RegionHeartbeatRequest { + RequestHeader header = 1; + + metapb.Region region = 2; + // Leader Peer sending the heartbeat. + metapb.Peer leader = 3; + // Leader considers that these peers are down. + repeated PeerStats down_peers = 4; + // Pending peers are the peers that the leader can't consider as + // working followers. + repeated metapb.Peer pending_peers = 5; + // Bytes read/written during this period. + uint64 bytes_written = 6; + uint64 bytes_read = 7; + // Keys read/written during this period. + uint64 keys_written = 8; + uint64 keys_read = 9; + // Approximate region size. + uint64 approximate_size = 10; +} + +// A clone of eraftpb.ConfChangeType, it exists because proto2 enums cannot be +// used directly in proto3 syntax. +// See more: https://developers.google.com/protocol-buffers/docs/proto3#using-proto2-message-types +enum ConfChangeType { + AddNode = 0; + RemoveNode = 1; +} + +message ChangePeer { + metapb.Peer peer = 1; + // FIXME: replace with actual ConfChangeType once eraftpb uses proto3. + ConfChangeType change_type = 2; +} + +message TransferLeader { + metapb.Peer peer = 1; +} + +message RegionHeartbeatResponse { + ResponseHeader header = 1; + + // Notice, Pd only allows handling reported epoch >= current pd's. + // Leader peer reports region status with RegionHeartbeatRequest + // to pd regularly, pd will determine whether this region + // should do ChangePeer or not. + // E,g, max peer number is 3, region A, first only peer 1 in A. + // 1. Pd region state -> Peers (1), ConfVer (1). + // 2. Leader peer 1 reports region state to pd, pd finds the + // peer number is < 3, so first changes its current region + // state -> Peers (1, 2), ConfVer (1), and returns ChangePeer Adding 2. + // 3. Leader does ChangePeer, then reports Peers (1, 2), ConfVer (2), + // pd updates its state -> Peers (1, 2), ConfVer (2). + // 4. Leader may report old Peers (1), ConfVer (1) to pd before ConfChange + // finished, pd stills responses ChangePeer Adding 2, of course, we must + // guarantee the second ChangePeer can't be applied in TiKV. + ChangePeer change_peer = 2; + // Pd can return transfer_leader to let TiKV does leader transfer itself. + TransferLeader transfer_leader = 3; + // ID of the region + uint64 region_id = 4; + metapb.RegionEpoch region_epoch = 5; + // Leader of the region at the moment of the corresponding request was made. + metapb.Peer target_peer = 6; +} + +message AskSplitRequest { + RequestHeader header = 1; + + metapb.Region region = 2; +} + +message AskSplitResponse { + ResponseHeader header = 1; + + // We split the region into two, first uses the origin + // parent region id, and the second uses the new_region_id. + // We must guarantee that the new_region_id is global unique. + uint64 new_region_id = 2; + // The peer ids for the new split region. + repeated uint64 new_peer_ids = 3; +} + +message ReportSplitRequest { + RequestHeader header = 1; + + metapb.Region left = 2; + metapb.Region right = 3; +} + +message ReportSplitResponse { + ResponseHeader header = 1; +} + +message StoreStats { + uint64 store_id = 1; + // Capacity for the store. + uint64 capacity = 2; + // Available size for the store. + uint64 available = 3; + // Total region count in this store. + uint32 region_count = 4; + // Current sending snapshot count. + uint32 sending_snap_count = 5; + // Current receiving snapshot count. + uint32 receiving_snap_count = 6; + // When the store is started (unix timestamp in seconds). + uint32 start_time = 7; + // How many region is applying snapshot. + uint32 applying_snap_count = 8; + // If the store is busy + bool is_busy = 9; + // Actually used space by db + uint64 used_size = 10; + // Bytes written for the store. + uint64 bytes_written = 11; + // Keys written for the store. + uint64 keys_written = 12; + // Bytes read for the store. + uint64 bytes_read = 13; + // Keys read for the store. + uint64 keys_read = 14; +} + +message StoreHeartbeatRequest { + RequestHeader header = 1; + + StoreStats stats = 2; +} + +message StoreHeartbeatResponse { + ResponseHeader header = 1; +} diff --git a/_vendor/src/github.com/pingcap/kvproto/proto/raft_cmdpb.proto b/_vendor/src/github.com/pingcap/kvproto/proto/raft_cmdpb.proto new file mode 100644 index 00000000000..addd9fe29c7 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/proto/raft_cmdpb.proto @@ -0,0 +1,256 @@ +syntax = "proto2"; +package raft_cmdpb; + +import "metapb.proto"; +import "errorpb.proto"; +import "eraftpb.proto"; + +option java_package = "com.pingcap.tikv.kvproto"; + +message GetRequest { + optional string cf = 1; + optional bytes key = 2; +} + +message GetResponse { + optional bytes value = 1; +} + +message PutRequest { + optional string cf = 1; + optional bytes key = 2; + optional bytes value = 3; +} + +message PutResponse { + +} + +message DeleteRequest { + optional string cf = 1; + optional bytes key = 2; +} + +message DeleteResponse { + +} + +message DeleteRangeRequest { + optional string cf = 1; + optional bytes start_key = 2; + optional bytes end_key = 3; +} + +message DeleteRangeResponse { + +} + +message SnapRequest { + +} + +message SnapResponse { + optional metapb.Region region = 1; +} + +message PrewriteRequest { + optional bytes key = 1; + optional bytes value = 2; + optional bytes lock = 3; +} + +message PrewriteResponse { + +} + +enum CmdType { + Invalid = 0; + Get = 1; + Put = 3; + Delete = 4; + Snap = 5; + Prewrite = 6; + DeleteRange = 7; +} + +message Request { + optional CmdType cmd_type = 1; + optional GetRequest get = 2; + optional PutRequest put = 4; + optional DeleteRequest delete = 5; + optional SnapRequest snap = 6; + optional PrewriteRequest prewrite = 7; + optional DeleteRangeRequest delete_range = 8; +} + +message Response { + optional CmdType cmd_type = 1; + optional GetResponse get = 2; + optional PutResponse put = 4; + optional DeleteResponse delete = 5; + optional SnapResponse snap = 6; + optional PrewriteResponse prewrite = 7; + optional DeleteRangeResponse delte_range = 8; +} + +message ChangePeerRequest { + // This can be only called in internal RaftStore now. + optional eraftpb.ConfChangeType change_type = 1; + optional metapb.Peer peer = 2; +} + +message ChangePeerResponse { + optional metapb.Region region = 1; +} + +message SplitRequest { + // This can be only called in internal RaftStore now. + // The split_key must be in the been splitting region. + optional bytes split_key = 1; + // We split the region into two, first uses the origin + // parent region id, and the second uses the new_region_id. + // We must guarantee that the new_region_id is global unique. + optional uint64 new_region_id = 2; + // The peer ids for the new split region. + repeated uint64 new_peer_ids = 3; + // If true, right region derive the origin region_id, + // left region use new_region_id. + optional bool right_derive = 4; +} + +message SplitResponse { + optional metapb.Region left = 1; + optional metapb.Region right = 2; +} + +message CompactLogRequest { + optional uint64 compact_index = 1; + optional uint64 compact_term = 2; +} + +message CompactLogResponse { + +} + +message TransferLeaderRequest { + optional metapb.Peer peer = 1; +} + +message TransferLeaderResponse { +} + +message VerifyHashRequest { + optional uint64 index = 1; + optional bytes hash = 2; +} + +message VerifyHashResponse { +} + +enum AdminCmdType { + InvalidAdmin = 0; + ChangePeer = 1; + Split = 2; + CompactLog = 3; + TransferLeader = 4; + ComputeHash = 5; + VerifyHash = 6; +} + +message AdminRequest { + optional AdminCmdType cmd_type = 1; + optional ChangePeerRequest change_peer = 2; + optional SplitRequest split = 3; + optional CompactLogRequest compact_log = 4; + optional TransferLeaderRequest transfer_leader = 5; + optional VerifyHashRequest verify_hash = 6; +} + +message AdminResponse { + optional AdminCmdType cmd_type = 1; + optional ChangePeerResponse change_peer = 2; + optional SplitResponse split = 3; + optional CompactLogResponse compact_log = 4; + optional TransferLeaderResponse transfer_leader = 5; + optional VerifyHashResponse verify_hash = 6; +} + +// For get the leader of the region. +message RegionLeaderRequest { + +} + +message RegionLeaderResponse { + optional metapb.Peer leader = 1; +} + +// For getting more information of the region. +// We add some admin operations (ChangePeer, Split...) into the pb job list, +// then pd server will peek the first one, handle it and then pop it from the job lib. +// But sometimes, the pd server may crash before popping. When another pd server +// starts and finds the job is running but not finished, it will first check whether +// the raft server already has handled this job. +// E,g, for ChangePeer, if we add Peer10 into region1 and find region1 has already had +// Peer10, we can think this ChangePeer is finished, and can pop this job from job list +// directly. +message RegionDetailRequest { + +} + +message RegionDetailResponse { + optional metapb.Region region = 1; + optional metapb.Peer leader = 2; +} + + +enum StatusCmdType { + InvalidStatus = 0; + RegionLeader = 1; + RegionDetail = 2; +} + +message StatusRequest { + optional StatusCmdType cmd_type = 1; + optional RegionLeaderRequest region_leader = 2; + optional RegionDetailRequest region_detail = 3; +} + +message StatusResponse { + optional StatusCmdType cmd_type = 1; + optional RegionLeaderResponse region_leader = 2; + optional RegionDetailResponse region_detail = 3; +} + +message RaftRequestHeader { + optional uint64 region_id = 1; + optional metapb.Peer peer = 2; + // true for read linearization + optional bool read_quorum = 3; + // 16 bytes, to distinguish request. + optional bytes uuid = 4; + + optional metapb.RegionEpoch region_epoch = 5; + optional uint64 term = 6; +} + +message RaftResponseHeader { + optional errorpb.Error error = 1; + optional bytes uuid = 2; + optional uint64 current_term = 3; +} + +message RaftCmdRequest { + optional RaftRequestHeader header = 1; + // We can't enclose normal requests and administrator request + // at same time. + repeated Request requests = 2; + optional AdminRequest admin_request = 3; + optional StatusRequest status_request = 4; +} + +message RaftCmdResponse { + optional RaftResponseHeader header = 1; + repeated Response responses = 2; + optional AdminResponse admin_response = 3; + optional StatusResponse status_response = 4; +} diff --git a/_vendor/src/github.com/pingcap/kvproto/proto/raft_serverpb.proto b/_vendor/src/github.com/pingcap/kvproto/proto/raft_serverpb.proto new file mode 100644 index 00000000000..7f2e4f13a41 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/proto/raft_serverpb.proto @@ -0,0 +1,81 @@ +syntax = "proto3"; +package raft_serverpb; + +import "eraftpb.proto"; +import "metapb.proto"; + +option java_package = "com.pingcap.tikv.kvproto"; + +message RaftMessage { + uint64 region_id = 1; + metapb.Peer from_peer = 2; + metapb.Peer to_peer = 3; + eraftpb.Message message = 4; + metapb.RegionEpoch region_epoch = 5; + // true means to_peer is a tombstone peer and it should remove itself. + bool is_tombstone = 6; + // Region key range [start_key, end_key). + bytes start_key = 7; + bytes end_key = 8; +} + +message RaftTruncatedState { + uint64 index = 1; + uint64 term = 2; +} + +message SnapshotCFFile { + string cf = 1; + uint64 size = 2; + uint32 checksum = 3; +} + +message SnapshotMeta { + repeated SnapshotCFFile cf_files = 1; +} + +message SnapshotChunk { + RaftMessage message = 1; + bytes data = 2; +} + +message Done {} + +message KeyValue { + bytes key = 1; + bytes value = 2; +} + +message RaftSnapshotData { + metapb.Region region = 1; + uint64 file_size = 2; + repeated KeyValue data = 3; + uint64 version = 4; + SnapshotMeta meta = 5; +} + +message StoreIdent { + uint64 cluster_id = 1; + uint64 store_id = 2; +} + +message RaftLocalState { + eraftpb.HardState hard_state = 1; + uint64 last_index = 2; +} + +message RaftApplyState { + uint64 applied_index = 1; + RaftTruncatedState truncated_state = 2; +} + +enum PeerState { + Normal = 0; + Applying = 1; + Tombstone = 2; +} + +message RegionLocalState { + PeerState state = 1; + metapb.Region region = 2; +} diff --git a/_vendor/src/github.com/pingcap/kvproto/proto/tikvpb.proto b/_vendor/src/github.com/pingcap/kvproto/proto/tikvpb.proto new file mode 100644 index 00000000000..f725d8f9f6b --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/proto/tikvpb.proto @@ -0,0 +1,48 @@ +syntax = "proto3"; +package tikvpb; + +import "coprocessor.proto"; +import "kvrpcpb.proto"; +import "raft_serverpb.proto"; + +import "gogoproto/gogo.proto"; + +option (gogoproto.sizer_all) = true; +option (gogoproto.marshaler_all) = true; +option (gogoproto.unmarshaler_all) = true; + +option java_package = "com.pingcap.tikv.kvproto"; + +// Serve as a distributed kv database. +service Tikv { + // KV commands with mvcc/txn supported. + rpc KvGet(kvrpcpb.GetRequest) returns (kvrpcpb.GetResponse) {} + rpc KvScan(kvrpcpb.ScanRequest) returns (kvrpcpb.ScanResponse) {} + rpc KvPrewrite(kvrpcpb.PrewriteRequest) returns (kvrpcpb.PrewriteResponse) {} + rpc KvCommit(kvrpcpb.CommitRequest) returns (kvrpcpb.CommitResponse) {} + rpc KvImport(kvrpcpb.ImportRequest) returns (kvrpcpb.ImportResponse) {} + rpc KvCleanup(kvrpcpb.CleanupRequest) returns (kvrpcpb.CleanupResponse) {} + rpc KvBatchGet(kvrpcpb.BatchGetRequest) returns (kvrpcpb.BatchGetResponse) {} + rpc KvBatchRollback(kvrpcpb.BatchRollbackRequest) returns (kvrpcpb.BatchRollbackResponse) {} + rpc KvScanLock(kvrpcpb.ScanLockRequest) returns (kvrpcpb.ScanLockResponse) {} + rpc KvResolveLock(kvrpcpb.ResolveLockRequest) returns (kvrpcpb.ResolveLockResponse) {} + rpc KvGC(kvrpcpb.GCRequest) returns (kvrpcpb.GCResponse) {} + rpc KvDeleteRange(kvrpcpb.DeleteRangeRequest) returns (kvrpcpb.DeleteRangeResponse) {} + + // RawKV commands. + rpc RawGet(kvrpcpb.RawGetRequest) returns (kvrpcpb.RawGetResponse) {} + rpc RawPut(kvrpcpb.RawPutRequest) returns (kvrpcpb.RawPutResponse) {} + rpc RawDelete(kvrpcpb.RawDeleteRequest) returns (kvrpcpb.RawDeleteResponse) {} + rpc RawScan(kvrpcpb.RawScanRequest) returns (kvrpcpb.RawScanResponse) {} + + // SQL push down commands. + rpc Coprocessor(coprocessor.Request) returns (coprocessor.Response) {} + + // Raft commands (tikv <-> tikv). + rpc Raft(stream raft_serverpb.RaftMessage) returns (raft_serverpb.Done) {} + rpc Snapshot(stream raft_serverpb.SnapshotChunk) returns (raft_serverpb.Done) {} + + // transaction debugger commands. + rpc MvccGetByKey(kvrpcpb.MvccGetByKeyRequest) returns (kvrpcpb.MvccGetByKeyResponse) {} + rpc MvccGetByStartTs(kvrpcpb.MvccGetByStartTsRequest) returns (kvrpcpb.MvccGetByStartTsResponse) {} +} diff --git a/_vendor/src/github.com/pingcap/kvproto/src/coprocessor.rs b/_vendor/src/github.com/pingcap/kvproto/src/coprocessor.rs new file mode 100644 index 00000000000..e2e67f62031 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/src/coprocessor.rs @@ -0,0 +1,1045 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy)] + +#![cfg_attr(rustfmt, rustfmt_skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(PartialEq,Clone,Default)] +pub struct KeyRange { + // message fields + pub start: ::std::vec::Vec, + pub end: ::std::vec::Vec, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for KeyRange {} + +impl KeyRange { + pub fn new() -> KeyRange { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static KeyRange { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const KeyRange, + }; + unsafe { + instance.get(KeyRange::new) + } + } + + // bytes start = 1; + + pub fn clear_start(&mut self) { + self.start.clear(); + } + + // Param is passed by value, moved + pub fn set_start(&mut self, v: ::std::vec::Vec) { + self.start = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_start(&mut self) -> &mut ::std::vec::Vec { + &mut self.start + } + + // Take field + pub fn take_start(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.start, ::std::vec::Vec::new()) + } + + pub fn get_start(&self) -> &[u8] { + &self.start + } + + fn get_start_for_reflect(&self) -> &::std::vec::Vec { + &self.start + } + + fn mut_start_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.start + } + + // bytes end = 2; + + pub fn clear_end(&mut self) { + self.end.clear(); + } + + // Param is passed by value, moved + pub fn set_end(&mut self, v: ::std::vec::Vec) { + self.end = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_end(&mut self) -> &mut ::std::vec::Vec { + &mut self.end + } + + // Take field + pub fn take_end(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.end, ::std::vec::Vec::new()) + } + + pub fn get_end(&self) -> &[u8] { + &self.end + } + + fn get_end_for_reflect(&self) -> &::std::vec::Vec { + &self.end + } + + fn mut_end_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.end + } +} + +impl ::protobuf::Message for KeyRange { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.start)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.end)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.start.is_empty() { + my_size += ::protobuf::rt::bytes_size(1, &self.start); + } + if !self.end.is_empty() { + my_size += ::protobuf::rt::bytes_size(2, &self.end); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.start.is_empty() { + os.write_bytes(1, &self.start)?; + } + if !self.end.is_empty() { + os.write_bytes(2, &self.end)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for KeyRange { + fn new() -> KeyRange { + KeyRange::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "start", + KeyRange::get_start_for_reflect, + KeyRange::mut_start_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "end", + KeyRange::get_end_for_reflect, + KeyRange::mut_end_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "KeyRange", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for KeyRange { + fn clear(&mut self) { + self.clear_start(); + self.clear_end(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for KeyRange { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for KeyRange { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Request { + // message fields + pub context: ::protobuf::SingularPtrField, + pub tp: i64, + pub data: ::std::vec::Vec, + pub ranges: ::protobuf::RepeatedField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Request {} + +impl Request { + pub fn new() -> Request { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static Request { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Request, + }; + unsafe { + instance.get(Request::new) + } + } + + // .kvrpcpb.Context context = 1; + + pub fn clear_context(&mut self) { + self.context.clear(); + } + + pub fn has_context(&self) -> bool { + self.context.is_some() + } + + // Param is passed by value, moved + pub fn set_context(&mut self, v: super::kvrpcpb::Context) { + self.context = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_context(&mut self) -> &mut super::kvrpcpb::Context { + if self.context.is_none() { + self.context.set_default(); + } + self.context.as_mut().unwrap() + } + + // Take field + pub fn take_context(&mut self) -> super::kvrpcpb::Context { + self.context.take().unwrap_or_else(|| super::kvrpcpb::Context::new()) + } + + pub fn get_context(&self) -> &super::kvrpcpb::Context { + self.context.as_ref().unwrap_or_else(|| super::kvrpcpb::Context::default_instance()) + } + + fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.context + } + + fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.context + } + + // int64 tp = 2; + + pub fn clear_tp(&mut self) { + self.tp = 0; + } + + // Param is passed by value, moved + pub fn set_tp(&mut self, v: i64) { + self.tp = v; + } + + pub fn get_tp(&self) -> i64 { + self.tp + } + + fn get_tp_for_reflect(&self) -> &i64 { + &self.tp + } + + fn mut_tp_for_reflect(&mut self) -> &mut i64 { + &mut self.tp + } + + // bytes data = 3; + + pub fn clear_data(&mut self) { + self.data.clear(); + } + + // Param is passed by value, moved + pub fn set_data(&mut self, v: ::std::vec::Vec) { + self.data = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { + &mut self.data + } + + // Take field + pub fn take_data(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.data, ::std::vec::Vec::new()) + } + + pub fn get_data(&self) -> &[u8] { + &self.data + } + + fn get_data_for_reflect(&self) -> &::std::vec::Vec { + &self.data + } + + fn mut_data_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.data + } + + // repeated .coprocessor.KeyRange ranges = 4; + + pub fn clear_ranges(&mut self) { + self.ranges.clear(); + } + + // Param is passed by value, moved + pub fn set_ranges(&mut self, v: ::protobuf::RepeatedField) { + self.ranges = v; + } + + // Mutable pointer to the field. + pub fn mut_ranges(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.ranges + } + + // Take field + pub fn take_ranges(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.ranges, ::protobuf::RepeatedField::new()) + } + + pub fn get_ranges(&self) -> &[KeyRange] { + &self.ranges + } + + fn get_ranges_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.ranges + } + + fn mut_ranges_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.ranges + } +} + +impl ::protobuf::Message for Request { + fn is_initialized(&self) -> bool { + for v in &self.context { + if !v.is_initialized() { + return false; + } + }; + for v in &self.ranges { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.tp = tmp; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.data)?; + }, + 4 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.ranges)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.context.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.tp != 0 { + my_size += ::protobuf::rt::value_size(2, self.tp, ::protobuf::wire_format::WireTypeVarint); + } + if !self.data.is_empty() { + my_size += ::protobuf::rt::bytes_size(3, &self.data); + } + for value in &self.ranges { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.context.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.tp != 0 { + os.write_int64(2, self.tp)?; + } + if !self.data.is_empty() { + os.write_bytes(3, &self.data)?; + } + for v in &self.ranges { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for Request { + fn new() -> Request { + Request::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "context", + Request::get_context_for_reflect, + Request::mut_context_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "tp", + Request::get_tp_for_reflect, + Request::mut_tp_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "data", + Request::get_data_for_reflect, + Request::mut_data_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "ranges", + Request::get_ranges_for_reflect, + Request::mut_ranges_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Request", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for Request { + fn clear(&mut self) { + self.clear_context(); + self.clear_tp(); + self.clear_data(); + self.clear_ranges(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Request { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Request { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Response { + // message fields + pub data: ::std::vec::Vec, + pub region_error: ::protobuf::SingularPtrField, + pub locked: ::protobuf::SingularPtrField, + pub other_error: ::std::string::String, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Response {} + +impl Response { + pub fn new() -> Response { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static Response { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Response, + }; + unsafe { + instance.get(Response::new) + } + } + + // bytes data = 1; + + pub fn clear_data(&mut self) { + self.data.clear(); + } + + // Param is passed by value, moved + pub fn set_data(&mut self, v: ::std::vec::Vec) { + self.data = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { + &mut self.data + } + + // Take field + pub fn take_data(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.data, ::std::vec::Vec::new()) + } + + pub fn get_data(&self) -> &[u8] { + &self.data + } + + fn get_data_for_reflect(&self) -> &::std::vec::Vec { + &self.data + } + + fn mut_data_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.data + } + + // .errorpb.Error region_error = 2; + + pub fn clear_region_error(&mut self) { + self.region_error.clear(); + } + + pub fn has_region_error(&self) -> bool { + self.region_error.is_some() + } + + // Param is passed by value, moved + pub fn set_region_error(&mut self, v: super::errorpb::Error) { + self.region_error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { + if self.region_error.is_none() { + self.region_error.set_default(); + } + self.region_error.as_mut().unwrap() + } + + // Take field + pub fn take_region_error(&mut self) -> super::errorpb::Error { + self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) + } + + pub fn get_region_error(&self) -> &super::errorpb::Error { + self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) + } + + fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_error + } + + fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_error + } + + // .kvrpcpb.LockInfo locked = 3; + + pub fn clear_locked(&mut self) { + self.locked.clear(); + } + + pub fn has_locked(&self) -> bool { + self.locked.is_some() + } + + // Param is passed by value, moved + pub fn set_locked(&mut self, v: super::kvrpcpb::LockInfo) { + self.locked = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_locked(&mut self) -> &mut super::kvrpcpb::LockInfo { + if self.locked.is_none() { + self.locked.set_default(); + } + self.locked.as_mut().unwrap() + } + + // Take field + pub fn take_locked(&mut self) -> super::kvrpcpb::LockInfo { + self.locked.take().unwrap_or_else(|| super::kvrpcpb::LockInfo::new()) + } + + pub fn get_locked(&self) -> &super::kvrpcpb::LockInfo { + self.locked.as_ref().unwrap_or_else(|| super::kvrpcpb::LockInfo::default_instance()) + } + + fn get_locked_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.locked + } + + fn mut_locked_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.locked + } + + // string other_error = 4; + + pub fn clear_other_error(&mut self) { + self.other_error.clear(); + } + + // Param is passed by value, moved + pub fn set_other_error(&mut self, v: ::std::string::String) { + self.other_error = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_other_error(&mut self) -> &mut ::std::string::String { + &mut self.other_error + } + + // Take field + pub fn take_other_error(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.other_error, ::std::string::String::new()) + } + + pub fn get_other_error(&self) -> &str { + &self.other_error + } + + fn get_other_error_for_reflect(&self) -> &::std::string::String { + &self.other_error + } + + fn mut_other_error_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.other_error + } +} + +impl ::protobuf::Message for Response { + fn is_initialized(&self) -> bool { + for v in &self.region_error { + if !v.is_initialized() { + return false; + } + }; + for v in &self.locked { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.data)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.locked)?; + }, + 4 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.other_error)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.data.is_empty() { + my_size += ::protobuf::rt::bytes_size(1, &self.data); + } + if let Some(ref v) = self.region_error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.locked.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.other_error.is_empty() { + my_size += ::protobuf::rt::string_size(4, &self.other_error); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.data.is_empty() { + os.write_bytes(1, &self.data)?; + } + if let Some(ref v) = self.region_error.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.locked.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.other_error.is_empty() { + os.write_string(4, &self.other_error)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for Response { + fn new() -> Response { + Response::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "data", + Response::get_data_for_reflect, + Response::mut_data_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_error", + Response::get_region_error_for_reflect, + Response::mut_region_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "locked", + Response::get_locked_for_reflect, + Response::mut_locked_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "other_error", + Response::get_other_error_for_reflect, + Response::mut_other_error_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Response", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for Response { + fn clear(&mut self) { + self.clear_data(); + self.clear_region_error(); + self.clear_locked(); + self.clear_other_error(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Response { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Response { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x11coprocessor.proto\x12\x0bcoprocessor\x1a\rerrorpb.proto\x1a\rkvrpc\ + pb.proto\x1a\x14gogoproto/gogo.proto\"2\n\x08KeyRange\x12\x14\n\x05start\ + \x18\x01\x20\x01(\x0cR\x05start\x12\x10\n\x03end\x18\x02\x20\x01(\x0cR\ + \x03end\"\x88\x01\n\x07Request\x12*\n\x07context\x18\x01\x20\x01(\x0b2\ + \x10.kvrpcpb.ContextR\x07context\x12\x0e\n\x02tp\x18\x02\x20\x01(\x03R\ + \x02tp\x12\x12\n\x04data\x18\x03\x20\x01(\x0cR\x04data\x12-\n\x06ranges\ + \x18\x04\x20\x03(\x0b2\x15.coprocessor.KeyRangeR\x06ranges\"\xd6\x01\n\ + \x08Response\x12K\n\x04data\x18\x01\x20\x01(\x0cR\x04dataB7\xda\xde\x1f/\ + github.com/pingcap/tipb/sharedbytes.SharedBytes\xc8\xde\x1f\0\x121\n\x0c\ + region_error\x18\x02\x20\x01(\x0b2\x0e.errorpb.ErrorR\x0bregionError\x12\ + )\n\x06locked\x18\x03\x20\x01(\x0b2\x11.kvrpcpb.LockInfoR\x06locked\x12\ + \x1f\n\x0bother_error\x18\x04\x20\x01(\tR\notherErrorB&\n\x18com.pingcap\ + .tikv.kvproto\xe0\xe2\x1e\x01\xd0\xe2\x1e\x01\xc8\xe2\x1e\x01J\xde\n\n\ + \x06\x12\x04\0\0\x1f\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\ + \x12\x03\x01\x08\x13\n\t\n\x02\x03\0\x12\x03\x03\x07\x16\n\t\n\x02\x03\ + \x01\x12\x03\x04\x07\x16\n\t\n\x02\x03\x02\x12\x03\x05\x07\x1d\n\x08\n\ + \x01\x08\x12\x03\x07\0(\n\x0b\n\x04\x08\xe7\x07\0\x12\x03\x07\0(\n\x0c\n\ + \x05\x08\xe7\x07\0\x02\x12\x03\x07\x07\x20\n\r\n\x06\x08\xe7\x07\0\x02\0\ + \x12\x03\x07\x07\x20\n\x0e\n\x07\x08\xe7\x07\0\x02\0\x01\x12\x03\x07\x08\ + \x1f\n\x0c\n\x05\x08\xe7\x07\0\x03\x12\x03\x07#'\n\x08\n\x01\x08\x12\x03\ + \x08\0$\n\x0b\n\x04\x08\xe7\x07\x01\x12\x03\x08\0$\n\x0c\n\x05\x08\xe7\ + \x07\x01\x02\x12\x03\x08\x07\x1c\n\r\n\x06\x08\xe7\x07\x01\x02\0\x12\x03\ + \x08\x07\x1c\n\x0e\n\x07\x08\xe7\x07\x01\x02\0\x01\x12\x03\x08\x08\x1b\n\ + \x0c\n\x05\x08\xe7\x07\x01\x03\x12\x03\x08\x1f#\n\x08\n\x01\x08\x12\x03\ + \t\0*\n\x0b\n\x04\x08\xe7\x07\x02\x12\x03\t\0*\n\x0c\n\x05\x08\xe7\x07\ + \x02\x02\x12\x03\t\x07\"\n\r\n\x06\x08\xe7\x07\x02\x02\0\x12\x03\t\x07\"\ + \n\x0e\n\x07\x08\xe7\x07\x02\x02\0\x01\x12\x03\t\x08!\n\x0c\n\x05\x08\ + \xe7\x07\x02\x03\x12\x03\t%)\n\x08\n\x01\x08\x12\x03\x0b\01\n\x0b\n\x04\ + \x08\xe7\x07\x03\x12\x03\x0b\01\n\x0c\n\x05\x08\xe7\x07\x03\x02\x12\x03\ + \x0b\x07\x13\n\r\n\x06\x08\xe7\x07\x03\x02\0\x12\x03\x0b\x07\x13\n\x0e\n\ + \x07\x08\xe7\x07\x03\x02\0\x01\x12\x03\x0b\x07\x13\n\x0c\n\x05\x08\xe7\ + \x07\x03\x07\x12\x03\x0b\x160\n\x1a\n\x02\x04\0\x12\x04\x0e\0\x11\x01\ + \x1a\x0e\x20[start,\x20end)\n\n\n\n\x03\x04\0\x01\x12\x03\x0e\x08\x10\n\ + \x0b\n\x04\x04\0\x02\0\x12\x03\x0f\x04\x14\n\r\n\x05\x04\0\x02\0\x04\x12\ + \x04\x0f\x04\x0e\x12\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x0f\x04\t\n\x0c\ + \n\x05\x04\0\x02\0\x01\x12\x03\x0f\n\x0f\n\x0c\n\x05\x04\0\x02\0\x03\x12\ + \x03\x0f\x12\x13\n\x0b\n\x04\x04\0\x02\x01\x12\x03\x10\x04\x12\n\r\n\x05\ + \x04\0\x02\x01\x04\x12\x04\x10\x04\x0f\x14\n\x0c\n\x05\x04\0\x02\x01\x05\ + \x12\x03\x10\x04\t\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x10\n\r\n\x0c\n\ + \x05\x04\0\x02\x01\x03\x12\x03\x10\x10\x11\n\n\n\x02\x04\x01\x12\x04\x13\ + \0\x18\x01\n\n\n\x03\x04\x01\x01\x12\x03\x13\x08\x0f\n\x0b\n\x04\x04\x01\ + \x02\0\x12\x03\x14\x04\x20\n\r\n\x05\x04\x01\x02\0\x04\x12\x04\x14\x04\ + \x13\x11\n\x0c\n\x05\x04\x01\x02\0\x06\x12\x03\x14\x04\x13\n\x0c\n\x05\ + \x04\x01\x02\0\x01\x12\x03\x14\x14\x1b\n\x0c\n\x05\x04\x01\x02\0\x03\x12\ + \x03\x14\x1e\x1f\n\x0b\n\x04\x04\x01\x02\x01\x12\x03\x15\x04\x11\n\r\n\ + \x05\x04\x01\x02\x01\x04\x12\x04\x15\x04\x14\x20\n\x0c\n\x05\x04\x01\x02\ + \x01\x05\x12\x03\x15\x04\t\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\x15\n\ + \x0c\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\x15\x0f\x10\n\x0b\n\x04\x04\ + \x01\x02\x02\x12\x03\x16\x04\x13\n\r\n\x05\x04\x01\x02\x02\x04\x12\x04\ + \x16\x04\x15\x11\n\x0c\n\x05\x04\x01\x02\x02\x05\x12\x03\x16\x04\t\n\x0c\ + \n\x05\x04\x01\x02\x02\x01\x12\x03\x16\n\x0e\n\x0c\n\x05\x04\x01\x02\x02\ + \x03\x12\x03\x16\x11\x12\n\x0b\n\x04\x04\x01\x02\x03\x12\x03\x17\x04!\n\ + \x0c\n\x05\x04\x01\x02\x03\x04\x12\x03\x17\x04\x0c\n\x0c\n\x05\x04\x01\ + \x02\x03\x06\x12\x03\x17\r\x15\n\x0c\n\x05\x04\x01\x02\x03\x01\x12\x03\ + \x17\x16\x1c\n\x0c\n\x05\x04\x01\x02\x03\x03\x12\x03\x17\x1f\x20\n\n\n\ + \x02\x04\x02\x12\x04\x1a\0\x1f\x01\n\n\n\x03\x04\x02\x01\x12\x03\x1a\x08\ + \x10\n\x0b\n\x04\x04\x02\x02\0\x12\x03\x1b\x04~\n\r\n\x05\x04\x02\x02\0\ + \x04\x12\x04\x1b\x04\x1a\x12\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03\x1b\ + \x04\t\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\x1b\n\x0e\n\x0c\n\x05\x04\ + \x02\x02\0\x03\x12\x03\x1b\x11\x12\n\x0c\n\x05\x04\x02\x02\0\x08\x12\x03\ + \x1b\x13}\n\x0f\n\x08\x04\x02\x02\0\x08\xe7\x07\0\x12\x03\x1b\x14^\n\x10\ + \n\t\x04\x02\x02\0\x08\xe7\x07\0\x02\x12\x03\x1b\x14*\n\x11\n\n\x04\x02\ + \x02\0\x08\xe7\x07\0\x02\0\x12\x03\x1b\x14*\n\x12\n\x0b\x04\x02\x02\0\ + \x08\xe7\x07\0\x02\0\x01\x12\x03\x1b\x15)\n\x10\n\t\x04\x02\x02\0\x08\ + \xe7\x07\0\x07\x12\x03\x1b-^\n\x0f\n\x08\x04\x02\x02\0\x08\xe7\x07\x01\ + \x12\x03\x1b`|\n\x10\n\t\x04\x02\x02\0\x08\xe7\x07\x01\x02\x12\x03\x1b`t\ + \n\x11\n\n\x04\x02\x02\0\x08\xe7\x07\x01\x02\0\x12\x03\x1b`t\n\x12\n\x0b\ + \x04\x02\x02\0\x08\xe7\x07\x01\x02\0\x01\x12\x03\x1bas\n\x10\n\t\x04\x02\ + \x02\0\x08\xe7\x07\x01\x03\x12\x03\x1bw|\n\x0b\n\x04\x04\x02\x02\x01\x12\ + \x03\x1c\x04#\n\r\n\x05\x04\x02\x02\x01\x04\x12\x04\x1c\x04\x1b~\n\x0c\n\ + \x05\x04\x02\x02\x01\x06\x12\x03\x1c\x04\x11\n\x0c\n\x05\x04\x02\x02\x01\ + \x01\x12\x03\x1c\x12\x1e\n\x0c\n\x05\x04\x02\x02\x01\x03\x12\x03\x1c!\"\ + \n\x0b\n\x04\x04\x02\x02\x02\x12\x03\x1d\x04\x20\n\r\n\x05\x04\x02\x02\ + \x02\x04\x12\x04\x1d\x04\x1c#\n\x0c\n\x05\x04\x02\x02\x02\x06\x12\x03\ + \x1d\x04\x14\n\x0c\n\x05\x04\x02\x02\x02\x01\x12\x03\x1d\x15\x1b\n\x0c\n\ + \x05\x04\x02\x02\x02\x03\x12\x03\x1d\x1e\x1f\n\x0b\n\x04\x04\x02\x02\x03\ + \x12\x03\x1e\x04\x1b\n\r\n\x05\x04\x02\x02\x03\x04\x12\x04\x1e\x04\x1d\ + \x20\n\x0c\n\x05\x04\x02\x02\x03\x05\x12\x03\x1e\x04\n\n\x0c\n\x05\x04\ + \x02\x02\x03\x01\x12\x03\x1e\x0b\x16\n\x0c\n\x05\x04\x02\x02\x03\x03\x12\ + \x03\x1e\x19\x1ab\x06proto3\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/src/eraftpb.rs b/_vendor/src/github.com/pingcap/kvproto/src/eraftpb.rs new file mode 100644 index 00000000000..513e343da1a --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/src/eraftpb.rs @@ -0,0 +1,2797 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy)] + +#![cfg_attr(rustfmt, rustfmt_skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(PartialEq,Clone,Default)] +pub struct Entry { + // message fields + entry_type: ::std::option::Option, + term: ::std::option::Option, + index: ::std::option::Option, + data: ::protobuf::SingularField<::std::vec::Vec>, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Entry {} + +impl Entry { + pub fn new() -> Entry { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static Entry { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Entry, + }; + unsafe { + instance.get(Entry::new) + } + } + + // optional .eraftpb.EntryType entry_type = 1; + + pub fn clear_entry_type(&mut self) { + self.entry_type = ::std::option::Option::None; + } + + pub fn has_entry_type(&self) -> bool { + self.entry_type.is_some() + } + + // Param is passed by value, moved + pub fn set_entry_type(&mut self, v: EntryType) { + self.entry_type = ::std::option::Option::Some(v); + } + + pub fn get_entry_type(&self) -> EntryType { + self.entry_type.unwrap_or(EntryType::EntryNormal) + } + + fn get_entry_type_for_reflect(&self) -> &::std::option::Option { + &self.entry_type + } + + fn mut_entry_type_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.entry_type + } + + // optional uint64 term = 2; + + pub fn clear_term(&mut self) { + self.term = ::std::option::Option::None; + } + + pub fn has_term(&self) -> bool { + self.term.is_some() + } + + // Param is passed by value, moved + pub fn set_term(&mut self, v: u64) { + self.term = ::std::option::Option::Some(v); + } + + pub fn get_term(&self) -> u64 { + self.term.unwrap_or(0) + } + + fn get_term_for_reflect(&self) -> &::std::option::Option { + &self.term + } + + fn mut_term_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.term + } + + // optional uint64 index = 3; + + pub fn clear_index(&mut self) { + self.index = ::std::option::Option::None; + } + + pub fn has_index(&self) -> bool { + self.index.is_some() + } + + // Param is passed by value, moved + pub fn set_index(&mut self, v: u64) { + self.index = ::std::option::Option::Some(v); + } + + pub fn get_index(&self) -> u64 { + self.index.unwrap_or(0) + } + + fn get_index_for_reflect(&self) -> &::std::option::Option { + &self.index + } + + fn mut_index_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.index + } + + // optional bytes data = 4; + + pub fn clear_data(&mut self) { + self.data.clear(); + } + + pub fn has_data(&self) -> bool { + self.data.is_some() + } + + // Param is passed by value, moved + pub fn set_data(&mut self, v: ::std::vec::Vec) { + self.data = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { + if self.data.is_none() { + self.data.set_default(); + } + self.data.as_mut().unwrap() + } + + // Take field + pub fn take_data(&mut self) -> ::std::vec::Vec { + self.data.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub fn get_data(&self) -> &[u8] { + match self.data.as_ref() { + Some(v) => &v, + None => &[], + } + } + + fn get_data_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { + &self.data + } + + fn mut_data_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { + &mut self.data + } +} + +impl ::protobuf::Message for Entry { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_enum()?; + self.entry_type = ::std::option::Option::Some(tmp); + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.term = ::std::option::Option::Some(tmp); + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.index = ::std::option::Option::Some(tmp); + }, + 4 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.data)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.entry_type { + my_size += ::protobuf::rt::enum_size(1, v); + } + if let Some(v) = self.term { + my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.index { + my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.data.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.entry_type { + os.write_enum(1, v.value())?; + } + if let Some(v) = self.term { + os.write_uint64(2, v)?; + } + if let Some(v) = self.index { + os.write_uint64(3, v)?; + } + if let Some(ref v) = self.data.as_ref() { + os.write_bytes(4, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for Entry { + fn new() -> Entry { + Entry::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "entry_type", + Entry::get_entry_type_for_reflect, + Entry::mut_entry_type_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "term", + Entry::get_term_for_reflect, + Entry::mut_term_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "index", + Entry::get_index_for_reflect, + Entry::mut_index_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "data", + Entry::get_data_for_reflect, + Entry::mut_data_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Entry", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for Entry { + fn clear(&mut self) { + self.clear_entry_type(); + self.clear_term(); + self.clear_index(); + self.clear_data(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Entry { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Entry { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct SnapshotMetadata { + // message fields + conf_state: ::protobuf::SingularPtrField, + index: ::std::option::Option, + term: ::std::option::Option, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for SnapshotMetadata {} + +impl SnapshotMetadata { + pub fn new() -> SnapshotMetadata { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static SnapshotMetadata { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const SnapshotMetadata, + }; + unsafe { + instance.get(SnapshotMetadata::new) + } + } + + // optional .eraftpb.ConfState conf_state = 1; + + pub fn clear_conf_state(&mut self) { + self.conf_state.clear(); + } + + pub fn has_conf_state(&self) -> bool { + self.conf_state.is_some() + } + + // Param is passed by value, moved + pub fn set_conf_state(&mut self, v: ConfState) { + self.conf_state = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_conf_state(&mut self) -> &mut ConfState { + if self.conf_state.is_none() { + self.conf_state.set_default(); + } + self.conf_state.as_mut().unwrap() + } + + // Take field + pub fn take_conf_state(&mut self) -> ConfState { + self.conf_state.take().unwrap_or_else(|| ConfState::new()) + } + + pub fn get_conf_state(&self) -> &ConfState { + self.conf_state.as_ref().unwrap_or_else(|| ConfState::default_instance()) + } + + fn get_conf_state_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.conf_state + } + + fn mut_conf_state_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.conf_state + } + + // optional uint64 index = 2; + + pub fn clear_index(&mut self) { + self.index = ::std::option::Option::None; + } + + pub fn has_index(&self) -> bool { + self.index.is_some() + } + + // Param is passed by value, moved + pub fn set_index(&mut self, v: u64) { + self.index = ::std::option::Option::Some(v); + } + + pub fn get_index(&self) -> u64 { + self.index.unwrap_or(0) + } + + fn get_index_for_reflect(&self) -> &::std::option::Option { + &self.index + } + + fn mut_index_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.index + } + + // optional uint64 term = 3; + + pub fn clear_term(&mut self) { + self.term = ::std::option::Option::None; + } + + pub fn has_term(&self) -> bool { + self.term.is_some() + } + + // Param is passed by value, moved + pub fn set_term(&mut self, v: u64) { + self.term = ::std::option::Option::Some(v); + } + + pub fn get_term(&self) -> u64 { + self.term.unwrap_or(0) + } + + fn get_term_for_reflect(&self) -> &::std::option::Option { + &self.term + } + + fn mut_term_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.term + } +} + +impl ::protobuf::Message for SnapshotMetadata { + fn is_initialized(&self) -> bool { + for v in &self.conf_state { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.conf_state)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.index = ::std::option::Option::Some(tmp); + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.term = ::std::option::Option::Some(tmp); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.conf_state.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(v) = self.index { + my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.term { + my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.conf_state.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(v) = self.index { + os.write_uint64(2, v)?; + } + if let Some(v) = self.term { + os.write_uint64(3, v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for SnapshotMetadata { + fn new() -> SnapshotMetadata { + SnapshotMetadata::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "conf_state", + SnapshotMetadata::get_conf_state_for_reflect, + SnapshotMetadata::mut_conf_state_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "index", + SnapshotMetadata::get_index_for_reflect, + SnapshotMetadata::mut_index_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "term", + SnapshotMetadata::get_term_for_reflect, + SnapshotMetadata::mut_term_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "SnapshotMetadata", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for SnapshotMetadata { + fn clear(&mut self) { + self.clear_conf_state(); + self.clear_index(); + self.clear_term(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for SnapshotMetadata { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SnapshotMetadata { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Snapshot { + // message fields + data: ::protobuf::SingularField<::std::vec::Vec>, + metadata: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Snapshot {} + +impl Snapshot { + pub fn new() -> Snapshot { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static Snapshot { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Snapshot, + }; + unsafe { + instance.get(Snapshot::new) + } + } + + // optional bytes data = 1; + + pub fn clear_data(&mut self) { + self.data.clear(); + } + + pub fn has_data(&self) -> bool { + self.data.is_some() + } + + // Param is passed by value, moved + pub fn set_data(&mut self, v: ::std::vec::Vec) { + self.data = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { + if self.data.is_none() { + self.data.set_default(); + } + self.data.as_mut().unwrap() + } + + // Take field + pub fn take_data(&mut self) -> ::std::vec::Vec { + self.data.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub fn get_data(&self) -> &[u8] { + match self.data.as_ref() { + Some(v) => &v, + None => &[], + } + } + + fn get_data_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { + &self.data + } + + fn mut_data_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { + &mut self.data + } + + // optional .eraftpb.SnapshotMetadata metadata = 2; + + pub fn clear_metadata(&mut self) { + self.metadata.clear(); + } + + pub fn has_metadata(&self) -> bool { + self.metadata.is_some() + } + + // Param is passed by value, moved + pub fn set_metadata(&mut self, v: SnapshotMetadata) { + self.metadata = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_metadata(&mut self) -> &mut SnapshotMetadata { + if self.metadata.is_none() { + self.metadata.set_default(); + } + self.metadata.as_mut().unwrap() + } + + // Take field + pub fn take_metadata(&mut self) -> SnapshotMetadata { + self.metadata.take().unwrap_or_else(|| SnapshotMetadata::new()) + } + + pub fn get_metadata(&self) -> &SnapshotMetadata { + self.metadata.as_ref().unwrap_or_else(|| SnapshotMetadata::default_instance()) + } + + fn get_metadata_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.metadata + } + + fn mut_metadata_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.metadata + } +} + +impl ::protobuf::Message for Snapshot { + fn is_initialized(&self) -> bool { + for v in &self.metadata { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.data)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.metadata)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.data.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(ref v) = self.metadata.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.data.as_ref() { + os.write_bytes(1, &v)?; + } + if let Some(ref v) = self.metadata.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for Snapshot { + fn new() -> Snapshot { + Snapshot::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "data", + Snapshot::get_data_for_reflect, + Snapshot::mut_data_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "metadata", + Snapshot::get_metadata_for_reflect, + Snapshot::mut_metadata_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Snapshot", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for Snapshot { + fn clear(&mut self) { + self.clear_data(); + self.clear_metadata(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Snapshot { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Snapshot { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Message { + // message fields + msg_type: ::std::option::Option, + to: ::std::option::Option, + from: ::std::option::Option, + term: ::std::option::Option, + log_term: ::std::option::Option, + index: ::std::option::Option, + entries: ::protobuf::RepeatedField, + commit: ::std::option::Option, + snapshot: ::protobuf::SingularPtrField, + reject: ::std::option::Option, + reject_hint: ::std::option::Option, + context: ::protobuf::SingularField<::std::vec::Vec>, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Message {} + +impl Message { + pub fn new() -> Message { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static Message { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Message, + }; + unsafe { + instance.get(Message::new) + } + } + + // optional .eraftpb.MessageType msg_type = 1; + + pub fn clear_msg_type(&mut self) { + self.msg_type = ::std::option::Option::None; + } + + pub fn has_msg_type(&self) -> bool { + self.msg_type.is_some() + } + + // Param is passed by value, moved + pub fn set_msg_type(&mut self, v: MessageType) { + self.msg_type = ::std::option::Option::Some(v); + } + + pub fn get_msg_type(&self) -> MessageType { + self.msg_type.unwrap_or(MessageType::MsgHup) + } + + fn get_msg_type_for_reflect(&self) -> &::std::option::Option { + &self.msg_type + } + + fn mut_msg_type_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.msg_type + } + + // optional uint64 to = 2; + + pub fn clear_to(&mut self) { + self.to = ::std::option::Option::None; + } + + pub fn has_to(&self) -> bool { + self.to.is_some() + } + + // Param is passed by value, moved + pub fn set_to(&mut self, v: u64) { + self.to = ::std::option::Option::Some(v); + } + + pub fn get_to(&self) -> u64 { + self.to.unwrap_or(0) + } + + fn get_to_for_reflect(&self) -> &::std::option::Option { + &self.to + } + + fn mut_to_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.to + } + + // optional uint64 from = 3; + + pub fn clear_from(&mut self) { + self.from = ::std::option::Option::None; + } + + pub fn has_from(&self) -> bool { + self.from.is_some() + } + + // Param is passed by value, moved + pub fn set_from(&mut self, v: u64) { + self.from = ::std::option::Option::Some(v); + } + + pub fn get_from(&self) -> u64 { + self.from.unwrap_or(0) + } + + fn get_from_for_reflect(&self) -> &::std::option::Option { + &self.from + } + + fn mut_from_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.from + } + + // optional uint64 term = 4; + + pub fn clear_term(&mut self) { + self.term = ::std::option::Option::None; + } + + pub fn has_term(&self) -> bool { + self.term.is_some() + } + + // Param is passed by value, moved + pub fn set_term(&mut self, v: u64) { + self.term = ::std::option::Option::Some(v); + } + + pub fn get_term(&self) -> u64 { + self.term.unwrap_or(0) + } + + fn get_term_for_reflect(&self) -> &::std::option::Option { + &self.term + } + + fn mut_term_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.term + } + + // optional uint64 log_term = 5; + + pub fn clear_log_term(&mut self) { + self.log_term = ::std::option::Option::None; + } + + pub fn has_log_term(&self) -> bool { + self.log_term.is_some() + } + + // Param is passed by value, moved + pub fn set_log_term(&mut self, v: u64) { + self.log_term = ::std::option::Option::Some(v); + } + + pub fn get_log_term(&self) -> u64 { + self.log_term.unwrap_or(0) + } + + fn get_log_term_for_reflect(&self) -> &::std::option::Option { + &self.log_term + } + + fn mut_log_term_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.log_term + } + + // optional uint64 index = 6; + + pub fn clear_index(&mut self) { + self.index = ::std::option::Option::None; + } + + pub fn has_index(&self) -> bool { + self.index.is_some() + } + + // Param is passed by value, moved + pub fn set_index(&mut self, v: u64) { + self.index = ::std::option::Option::Some(v); + } + + pub fn get_index(&self) -> u64 { + self.index.unwrap_or(0) + } + + fn get_index_for_reflect(&self) -> &::std::option::Option { + &self.index + } + + fn mut_index_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.index + } + + // repeated .eraftpb.Entry entries = 7; + + pub fn clear_entries(&mut self) { + self.entries.clear(); + } + + // Param is passed by value, moved + pub fn set_entries(&mut self, v: ::protobuf::RepeatedField) { + self.entries = v; + } + + // Mutable pointer to the field. + pub fn mut_entries(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.entries + } + + // Take field + pub fn take_entries(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.entries, ::protobuf::RepeatedField::new()) + } + + pub fn get_entries(&self) -> &[Entry] { + &self.entries + } + + fn get_entries_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.entries + } + + fn mut_entries_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.entries + } + + // optional uint64 commit = 8; + + pub fn clear_commit(&mut self) { + self.commit = ::std::option::Option::None; + } + + pub fn has_commit(&self) -> bool { + self.commit.is_some() + } + + // Param is passed by value, moved + pub fn set_commit(&mut self, v: u64) { + self.commit = ::std::option::Option::Some(v); + } + + pub fn get_commit(&self) -> u64 { + self.commit.unwrap_or(0) + } + + fn get_commit_for_reflect(&self) -> &::std::option::Option { + &self.commit + } + + fn mut_commit_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.commit + } + + // optional .eraftpb.Snapshot snapshot = 9; + + pub fn clear_snapshot(&mut self) { + self.snapshot.clear(); + } + + pub fn has_snapshot(&self) -> bool { + self.snapshot.is_some() + } + + // Param is passed by value, moved + pub fn set_snapshot(&mut self, v: Snapshot) { + self.snapshot = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_snapshot(&mut self) -> &mut Snapshot { + if self.snapshot.is_none() { + self.snapshot.set_default(); + } + self.snapshot.as_mut().unwrap() + } + + // Take field + pub fn take_snapshot(&mut self) -> Snapshot { + self.snapshot.take().unwrap_or_else(|| Snapshot::new()) + } + + pub fn get_snapshot(&self) -> &Snapshot { + self.snapshot.as_ref().unwrap_or_else(|| Snapshot::default_instance()) + } + + fn get_snapshot_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.snapshot + } + + fn mut_snapshot_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.snapshot + } + + // optional bool reject = 10; + + pub fn clear_reject(&mut self) { + self.reject = ::std::option::Option::None; + } + + pub fn has_reject(&self) -> bool { + self.reject.is_some() + } + + // Param is passed by value, moved + pub fn set_reject(&mut self, v: bool) { + self.reject = ::std::option::Option::Some(v); + } + + pub fn get_reject(&self) -> bool { + self.reject.unwrap_or(false) + } + + fn get_reject_for_reflect(&self) -> &::std::option::Option { + &self.reject + } + + fn mut_reject_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.reject + } + + // optional uint64 reject_hint = 11; + + pub fn clear_reject_hint(&mut self) { + self.reject_hint = ::std::option::Option::None; + } + + pub fn has_reject_hint(&self) -> bool { + self.reject_hint.is_some() + } + + // Param is passed by value, moved + pub fn set_reject_hint(&mut self, v: u64) { + self.reject_hint = ::std::option::Option::Some(v); + } + + pub fn get_reject_hint(&self) -> u64 { + self.reject_hint.unwrap_or(0) + } + + fn get_reject_hint_for_reflect(&self) -> &::std::option::Option { + &self.reject_hint + } + + fn mut_reject_hint_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.reject_hint + } + + // optional bytes context = 12; + + pub fn clear_context(&mut self) { + self.context.clear(); + } + + pub fn has_context(&self) -> bool { + self.context.is_some() + } + + // Param is passed by value, moved + pub fn set_context(&mut self, v: ::std::vec::Vec) { + self.context = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_context(&mut self) -> &mut ::std::vec::Vec { + if self.context.is_none() { + self.context.set_default(); + } + self.context.as_mut().unwrap() + } + + // Take field + pub fn take_context(&mut self) -> ::std::vec::Vec { + self.context.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub fn get_context(&self) -> &[u8] { + match self.context.as_ref() { + Some(v) => &v, + None => &[], + } + } + + fn get_context_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { + &self.context + } + + fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { + &mut self.context + } +} + +impl ::protobuf::Message for Message { + fn is_initialized(&self) -> bool { + for v in &self.entries { + if !v.is_initialized() { + return false; + } + }; + for v in &self.snapshot { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_enum()?; + self.msg_type = ::std::option::Option::Some(tmp); + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.to = ::std::option::Option::Some(tmp); + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.from = ::std::option::Option::Some(tmp); + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.term = ::std::option::Option::Some(tmp); + }, + 5 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.log_term = ::std::option::Option::Some(tmp); + }, + 6 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.index = ::std::option::Option::Some(tmp); + }, + 7 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.entries)?; + }, + 8 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.commit = ::std::option::Option::Some(tmp); + }, + 9 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.snapshot)?; + }, + 10 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.reject = ::std::option::Option::Some(tmp); + }, + 11 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.reject_hint = ::std::option::Option::Some(tmp); + }, + 12 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.context)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.msg_type { + my_size += ::protobuf::rt::enum_size(1, v); + } + if let Some(v) = self.to { + my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.from { + my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.term { + my_size += ::protobuf::rt::value_size(4, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.log_term { + my_size += ::protobuf::rt::value_size(5, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.index { + my_size += ::protobuf::rt::value_size(6, v, ::protobuf::wire_format::WireTypeVarint); + } + for value in &self.entries { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if let Some(v) = self.commit { + my_size += ::protobuf::rt::value_size(8, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.snapshot.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(v) = self.reject { + my_size += 2; + } + if let Some(v) = self.reject_hint { + my_size += ::protobuf::rt::value_size(11, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.context.as_ref() { + my_size += ::protobuf::rt::bytes_size(12, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.msg_type { + os.write_enum(1, v.value())?; + } + if let Some(v) = self.to { + os.write_uint64(2, v)?; + } + if let Some(v) = self.from { + os.write_uint64(3, v)?; + } + if let Some(v) = self.term { + os.write_uint64(4, v)?; + } + if let Some(v) = self.log_term { + os.write_uint64(5, v)?; + } + if let Some(v) = self.index { + os.write_uint64(6, v)?; + } + for v in &self.entries { + os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if let Some(v) = self.commit { + os.write_uint64(8, v)?; + } + if let Some(ref v) = self.snapshot.as_ref() { + os.write_tag(9, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(v) = self.reject { + os.write_bool(10, v)?; + } + if let Some(v) = self.reject_hint { + os.write_uint64(11, v)?; + } + if let Some(ref v) = self.context.as_ref() { + os.write_bytes(12, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for Message { + fn new() -> Message { + Message::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "msg_type", + Message::get_msg_type_for_reflect, + Message::mut_msg_type_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "to", + Message::get_to_for_reflect, + Message::mut_to_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "from", + Message::get_from_for_reflect, + Message::mut_from_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "term", + Message::get_term_for_reflect, + Message::mut_term_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "log_term", + Message::get_log_term_for_reflect, + Message::mut_log_term_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "index", + Message::get_index_for_reflect, + Message::mut_index_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "entries", + Message::get_entries_for_reflect, + Message::mut_entries_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "commit", + Message::get_commit_for_reflect, + Message::mut_commit_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "snapshot", + Message::get_snapshot_for_reflect, + Message::mut_snapshot_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "reject", + Message::get_reject_for_reflect, + Message::mut_reject_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "reject_hint", + Message::get_reject_hint_for_reflect, + Message::mut_reject_hint_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "context", + Message::get_context_for_reflect, + Message::mut_context_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Message", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for Message { + fn clear(&mut self) { + self.clear_msg_type(); + self.clear_to(); + self.clear_from(); + self.clear_term(); + self.clear_log_term(); + self.clear_index(); + self.clear_entries(); + self.clear_commit(); + self.clear_snapshot(); + self.clear_reject(); + self.clear_reject_hint(); + self.clear_context(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Message { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Message { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct HardState { + // message fields + term: ::std::option::Option, + vote: ::std::option::Option, + commit: ::std::option::Option, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for HardState {} + +impl HardState { + pub fn new() -> HardState { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static HardState { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const HardState, + }; + unsafe { + instance.get(HardState::new) + } + } + + // optional uint64 term = 1; + + pub fn clear_term(&mut self) { + self.term = ::std::option::Option::None; + } + + pub fn has_term(&self) -> bool { + self.term.is_some() + } + + // Param is passed by value, moved + pub fn set_term(&mut self, v: u64) { + self.term = ::std::option::Option::Some(v); + } + + pub fn get_term(&self) -> u64 { + self.term.unwrap_or(0) + } + + fn get_term_for_reflect(&self) -> &::std::option::Option { + &self.term + } + + fn mut_term_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.term + } + + // optional uint64 vote = 2; + + pub fn clear_vote(&mut self) { + self.vote = ::std::option::Option::None; + } + + pub fn has_vote(&self) -> bool { + self.vote.is_some() + } + + // Param is passed by value, moved + pub fn set_vote(&mut self, v: u64) { + self.vote = ::std::option::Option::Some(v); + } + + pub fn get_vote(&self) -> u64 { + self.vote.unwrap_or(0) + } + + fn get_vote_for_reflect(&self) -> &::std::option::Option { + &self.vote + } + + fn mut_vote_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.vote + } + + // optional uint64 commit = 3; + + pub fn clear_commit(&mut self) { + self.commit = ::std::option::Option::None; + } + + pub fn has_commit(&self) -> bool { + self.commit.is_some() + } + + // Param is passed by value, moved + pub fn set_commit(&mut self, v: u64) { + self.commit = ::std::option::Option::Some(v); + } + + pub fn get_commit(&self) -> u64 { + self.commit.unwrap_or(0) + } + + fn get_commit_for_reflect(&self) -> &::std::option::Option { + &self.commit + } + + fn mut_commit_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.commit + } +} + +impl ::protobuf::Message for HardState { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.term = ::std::option::Option::Some(tmp); + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.vote = ::std::option::Option::Some(tmp); + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.commit = ::std::option::Option::Some(tmp); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.term { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.vote { + my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.commit { + my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.term { + os.write_uint64(1, v)?; + } + if let Some(v) = self.vote { + os.write_uint64(2, v)?; + } + if let Some(v) = self.commit { + os.write_uint64(3, v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for HardState { + fn new() -> HardState { + HardState::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "term", + HardState::get_term_for_reflect, + HardState::mut_term_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "vote", + HardState::get_vote_for_reflect, + HardState::mut_vote_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "commit", + HardState::get_commit_for_reflect, + HardState::mut_commit_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "HardState", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for HardState { + fn clear(&mut self) { + self.clear_term(); + self.clear_vote(); + self.clear_commit(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for HardState { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for HardState { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ConfState { + // message fields + nodes: ::std::vec::Vec, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for ConfState {} + +impl ConfState { + pub fn new() -> ConfState { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static ConfState { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ConfState, + }; + unsafe { + instance.get(ConfState::new) + } + } + + // repeated uint64 nodes = 1; + + pub fn clear_nodes(&mut self) { + self.nodes.clear(); + } + + // Param is passed by value, moved + pub fn set_nodes(&mut self, v: ::std::vec::Vec) { + self.nodes = v; + } + + // Mutable pointer to the field. + pub fn mut_nodes(&mut self) -> &mut ::std::vec::Vec { + &mut self.nodes + } + + // Take field + pub fn take_nodes(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.nodes, ::std::vec::Vec::new()) + } + + pub fn get_nodes(&self) -> &[u64] { + &self.nodes + } + + fn get_nodes_for_reflect(&self) -> &::std::vec::Vec { + &self.nodes + } + + fn mut_nodes_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.nodes + } +} + +impl ::protobuf::Message for ConfState { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_uint64_into(wire_type, is, &mut self.nodes)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.nodes { + my_size += ::protobuf::rt::value_size(1, *value, ::protobuf::wire_format::WireTypeVarint); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + for v in &self.nodes { + os.write_uint64(1, *v)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for ConfState { + fn new() -> ConfState { + ConfState::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "nodes", + ConfState::get_nodes_for_reflect, + ConfState::mut_nodes_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ConfState", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for ConfState { + fn clear(&mut self) { + self.clear_nodes(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ConfState { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ConfState { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ConfChange { + // message fields + id: ::std::option::Option, + change_type: ::std::option::Option, + node_id: ::std::option::Option, + context: ::protobuf::SingularField<::std::vec::Vec>, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for ConfChange {} + +impl ConfChange { + pub fn new() -> ConfChange { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static ConfChange { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ConfChange, + }; + unsafe { + instance.get(ConfChange::new) + } + } + + // optional uint64 id = 1; + + pub fn clear_id(&mut self) { + self.id = ::std::option::Option::None; + } + + pub fn has_id(&self) -> bool { + self.id.is_some() + } + + // Param is passed by value, moved + pub fn set_id(&mut self, v: u64) { + self.id = ::std::option::Option::Some(v); + } + + pub fn get_id(&self) -> u64 { + self.id.unwrap_or(0) + } + + fn get_id_for_reflect(&self) -> &::std::option::Option { + &self.id + } + + fn mut_id_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.id + } + + // optional .eraftpb.ConfChangeType change_type = 2; + + pub fn clear_change_type(&mut self) { + self.change_type = ::std::option::Option::None; + } + + pub fn has_change_type(&self) -> bool { + self.change_type.is_some() + } + + // Param is passed by value, moved + pub fn set_change_type(&mut self, v: ConfChangeType) { + self.change_type = ::std::option::Option::Some(v); + } + + pub fn get_change_type(&self) -> ConfChangeType { + self.change_type.unwrap_or(ConfChangeType::AddNode) + } + + fn get_change_type_for_reflect(&self) -> &::std::option::Option { + &self.change_type + } + + fn mut_change_type_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.change_type + } + + // optional uint64 node_id = 3; + + pub fn clear_node_id(&mut self) { + self.node_id = ::std::option::Option::None; + } + + pub fn has_node_id(&self) -> bool { + self.node_id.is_some() + } + + // Param is passed by value, moved + pub fn set_node_id(&mut self, v: u64) { + self.node_id = ::std::option::Option::Some(v); + } + + pub fn get_node_id(&self) -> u64 { + self.node_id.unwrap_or(0) + } + + fn get_node_id_for_reflect(&self) -> &::std::option::Option { + &self.node_id + } + + fn mut_node_id_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.node_id + } + + // optional bytes context = 4; + + pub fn clear_context(&mut self) { + self.context.clear(); + } + + pub fn has_context(&self) -> bool { + self.context.is_some() + } + + // Param is passed by value, moved + pub fn set_context(&mut self, v: ::std::vec::Vec) { + self.context = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_context(&mut self) -> &mut ::std::vec::Vec { + if self.context.is_none() { + self.context.set_default(); + } + self.context.as_mut().unwrap() + } + + // Take field + pub fn take_context(&mut self) -> ::std::vec::Vec { + self.context.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub fn get_context(&self) -> &[u8] { + match self.context.as_ref() { + Some(v) => &v, + None => &[], + } + } + + fn get_context_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { + &self.context + } + + fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { + &mut self.context + } +} + +impl ::protobuf::Message for ConfChange { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.id = ::std::option::Option::Some(tmp); + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_enum()?; + self.change_type = ::std::option::Option::Some(tmp); + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.node_id = ::std::option::Option::Some(tmp); + }, + 4 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.context)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.id { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.change_type { + my_size += ::protobuf::rt::enum_size(2, v); + } + if let Some(v) = self.node_id { + my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.context.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.id { + os.write_uint64(1, v)?; + } + if let Some(v) = self.change_type { + os.write_enum(2, v.value())?; + } + if let Some(v) = self.node_id { + os.write_uint64(3, v)?; + } + if let Some(ref v) = self.context.as_ref() { + os.write_bytes(4, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for ConfChange { + fn new() -> ConfChange { + ConfChange::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "id", + ConfChange::get_id_for_reflect, + ConfChange::mut_id_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "change_type", + ConfChange::get_change_type_for_reflect, + ConfChange::mut_change_type_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "node_id", + ConfChange::get_node_id_for_reflect, + ConfChange::mut_node_id_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "context", + ConfChange::get_context_for_reflect, + ConfChange::mut_context_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ConfChange", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for ConfChange { + fn clear(&mut self) { + self.clear_id(); + self.clear_change_type(); + self.clear_node_id(); + self.clear_context(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ConfChange { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ConfChange { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum EntryType { + EntryNormal = 0, + EntryConfChange = 1, +} + +impl ::protobuf::ProtobufEnum for EntryType { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(EntryType::EntryNormal), + 1 => ::std::option::Option::Some(EntryType::EntryConfChange), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [EntryType] = &[ + EntryType::EntryNormal, + EntryType::EntryConfChange, + ]; + values + } + + fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, + }; + unsafe { + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new("EntryType", file_descriptor_proto()) + }) + } + } +} + +impl ::std::marker::Copy for EntryType { +} + +impl ::protobuf::reflect::ProtobufValue for EntryType { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum MessageType { + MsgHup = 0, + MsgBeat = 1, + MsgPropose = 2, + MsgAppend = 3, + MsgAppendResponse = 4, + MsgRequestVote = 5, + MsgRequestVoteResponse = 6, + MsgSnapshot = 7, + MsgHeartbeat = 8, + MsgHeartbeatResponse = 9, + MsgUnreachable = 10, + MsgSnapStatus = 11, + MsgCheckQuorum = 12, + MsgTransferLeader = 13, + MsgTimeoutNow = 14, + MsgReadIndex = 15, + MsgReadIndexResp = 16, + MsgRequestPreVote = 17, + MsgRequestPreVoteResponse = 18, +} + +impl ::protobuf::ProtobufEnum for MessageType { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(MessageType::MsgHup), + 1 => ::std::option::Option::Some(MessageType::MsgBeat), + 2 => ::std::option::Option::Some(MessageType::MsgPropose), + 3 => ::std::option::Option::Some(MessageType::MsgAppend), + 4 => ::std::option::Option::Some(MessageType::MsgAppendResponse), + 5 => ::std::option::Option::Some(MessageType::MsgRequestVote), + 6 => ::std::option::Option::Some(MessageType::MsgRequestVoteResponse), + 7 => ::std::option::Option::Some(MessageType::MsgSnapshot), + 8 => ::std::option::Option::Some(MessageType::MsgHeartbeat), + 9 => ::std::option::Option::Some(MessageType::MsgHeartbeatResponse), + 10 => ::std::option::Option::Some(MessageType::MsgUnreachable), + 11 => ::std::option::Option::Some(MessageType::MsgSnapStatus), + 12 => ::std::option::Option::Some(MessageType::MsgCheckQuorum), + 13 => ::std::option::Option::Some(MessageType::MsgTransferLeader), + 14 => ::std::option::Option::Some(MessageType::MsgTimeoutNow), + 15 => ::std::option::Option::Some(MessageType::MsgReadIndex), + 16 => ::std::option::Option::Some(MessageType::MsgReadIndexResp), + 17 => ::std::option::Option::Some(MessageType::MsgRequestPreVote), + 18 => ::std::option::Option::Some(MessageType::MsgRequestPreVoteResponse), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [MessageType] = &[ + MessageType::MsgHup, + MessageType::MsgBeat, + MessageType::MsgPropose, + MessageType::MsgAppend, + MessageType::MsgAppendResponse, + MessageType::MsgRequestVote, + MessageType::MsgRequestVoteResponse, + MessageType::MsgSnapshot, + MessageType::MsgHeartbeat, + MessageType::MsgHeartbeatResponse, + MessageType::MsgUnreachable, + MessageType::MsgSnapStatus, + MessageType::MsgCheckQuorum, + MessageType::MsgTransferLeader, + MessageType::MsgTimeoutNow, + MessageType::MsgReadIndex, + MessageType::MsgReadIndexResp, + MessageType::MsgRequestPreVote, + MessageType::MsgRequestPreVoteResponse, + ]; + values + } + + fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, + }; + unsafe { + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new("MessageType", file_descriptor_proto()) + }) + } + } +} + +impl ::std::marker::Copy for MessageType { +} + +impl ::protobuf::reflect::ProtobufValue for MessageType { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum ConfChangeType { + AddNode = 0, + RemoveNode = 1, +} + +impl ::protobuf::ProtobufEnum for ConfChangeType { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(ConfChangeType::AddNode), + 1 => ::std::option::Option::Some(ConfChangeType::RemoveNode), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [ConfChangeType] = &[ + ConfChangeType::AddNode, + ConfChangeType::RemoveNode, + ]; + values + } + + fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, + }; + unsafe { + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new("ConfChangeType", file_descriptor_proto()) + }) + } + } +} + +impl ::std::marker::Copy for ConfChangeType { +} + +impl ::protobuf::reflect::ProtobufValue for ConfChangeType { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\reraftpb.proto\x12\x07eraftpb\"x\n\x05Entry\x121\n\nentry_type\x18\ + \x01\x20\x01(\x0e2\x12.eraftpb.EntryTypeR\tentryType\x12\x12\n\x04term\ + \x18\x02\x20\x01(\x04R\x04term\x12\x14\n\x05index\x18\x03\x20\x01(\x04R\ + \x05index\x12\x12\n\x04data\x18\x04\x20\x01(\x0cR\x04data\"o\n\x10Snapsh\ + otMetadata\x121\n\nconf_state\x18\x01\x20\x01(\x0b2\x12.eraftpb.ConfStat\ + eR\tconfState\x12\x14\n\x05index\x18\x02\x20\x01(\x04R\x05index\x12\x12\ + \n\x04term\x18\x03\x20\x01(\x04R\x04term\"U\n\x08Snapshot\x12\x12\n\x04d\ + ata\x18\x01\x20\x01(\x0cR\x04data\x125\n\x08metadata\x18\x02\x20\x01(\ + \x0b2\x19.eraftpb.SnapshotMetadataR\x08metadata\"\xe7\x02\n\x07Message\ + \x12/\n\x08msg_type\x18\x01\x20\x01(\x0e2\x14.eraftpb.MessageTypeR\x07ms\ + gType\x12\x0e\n\x02to\x18\x02\x20\x01(\x04R\x02to\x12\x12\n\x04from\x18\ + \x03\x20\x01(\x04R\x04from\x12\x12\n\x04term\x18\x04\x20\x01(\x04R\x04te\ + rm\x12\x19\n\x08log_term\x18\x05\x20\x01(\x04R\x07logTerm\x12\x14\n\x05i\ + ndex\x18\x06\x20\x01(\x04R\x05index\x12(\n\x07entries\x18\x07\x20\x03(\ + \x0b2\x0e.eraftpb.EntryR\x07entries\x12\x16\n\x06commit\x18\x08\x20\x01(\ + \x04R\x06commit\x12-\n\x08snapshot\x18\t\x20\x01(\x0b2\x11.eraftpb.Snaps\ + hotR\x08snapshot\x12\x16\n\x06reject\x18\n\x20\x01(\x08R\x06reject\x12\ + \x1f\n\x0breject_hint\x18\x0b\x20\x01(\x04R\nrejectHint\x12\x18\n\x07con\ + text\x18\x0c\x20\x01(\x0cR\x07context\"K\n\tHardState\x12\x12\n\x04term\ + \x18\x01\x20\x01(\x04R\x04term\x12\x12\n\x04vote\x18\x02\x20\x01(\x04R\ + \x04vote\x12\x16\n\x06commit\x18\x03\x20\x01(\x04R\x06commit\"!\n\tConfS\ + tate\x12\x14\n\x05nodes\x18\x01\x20\x03(\x04R\x05nodes\"\x89\x01\n\nConf\ + Change\x12\x0e\n\x02id\x18\x01\x20\x01(\x04R\x02id\x128\n\x0bchange_type\ + \x18\x02\x20\x01(\x0e2\x17.eraftpb.ConfChangeTypeR\nchangeType\x12\x17\n\ + \x07node_id\x18\x03\x20\x01(\x04R\x06nodeId\x12\x18\n\x07context\x18\x04\ + \x20\x01(\x0cR\x07context*1\n\tEntryType\x12\x0f\n\x0bEntryNormal\x10\0\ + \x12\x13\n\x0fEntryConfChange\x10\x01*\x8c\x03\n\x0bMessageType\x12\n\n\ + \x06MsgHup\x10\0\x12\x0b\n\x07MsgBeat\x10\x01\x12\x0e\n\nMsgPropose\x10\ + \x02\x12\r\n\tMsgAppend\x10\x03\x12\x15\n\x11MsgAppendResponse\x10\x04\ + \x12\x12\n\x0eMsgRequestVote\x10\x05\x12\x1a\n\x16MsgRequestVoteResponse\ + \x10\x06\x12\x0f\n\x0bMsgSnapshot\x10\x07\x12\x10\n\x0cMsgHeartbeat\x10\ + \x08\x12\x18\n\x14MsgHeartbeatResponse\x10\t\x12\x12\n\x0eMsgUnreachable\ + \x10\n\x12\x11\n\rMsgSnapStatus\x10\x0b\x12\x12\n\x0eMsgCheckQuorum\x10\ + \x0c\x12\x15\n\x11MsgTransferLeader\x10\r\x12\x11\n\rMsgTimeoutNow\x10\ + \x0e\x12\x10\n\x0cMsgReadIndex\x10\x0f\x12\x14\n\x10MsgReadIndexResp\x10\ + \x10\x12\x15\n\x11MsgRequestPreVote\x10\x11\x12\x1d\n\x19MsgRequestPreVo\ + teResponse\x10\x12*-\n\x0eConfChangeType\x12\x0b\n\x07AddNode\x10\0\x12\ + \x0e\n\nRemoveNode\x10\x01B\x1a\n\x18com.pingcap.tikv.kvprotoJ\xde\x19\n\ + \x06\x12\x04\0\0U\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\ + \x12\x03\x01\x08\x0f\n\x08\n\x01\x08\x12\x03\x03\01\n\x0b\n\x04\x08\xe7\ + \x07\0\x12\x03\x03\01\n\x0c\n\x05\x08\xe7\x07\0\x02\x12\x03\x03\x07\x13\ + \n\r\n\x06\x08\xe7\x07\0\x02\0\x12\x03\x03\x07\x13\n\x0e\n\x07\x08\xe7\ + \x07\0\x02\0\x01\x12\x03\x03\x07\x13\n\x0c\n\x05\x08\xe7\x07\0\x07\x12\ + \x03\x03\x160\n\n\n\x02\x05\0\x12\x04\x05\0\x08\x01\n\n\n\x03\x05\0\x01\ + \x12\x03\x05\x05\x0e\n\x0b\n\x04\x05\0\x02\0\x12\x03\x06\x04\x18\n\x0c\n\ + \x05\x05\0\x02\0\x01\x12\x03\x06\x04\x0f\n\x0c\n\x05\x05\0\x02\0\x02\x12\ + \x03\x06\x16\x17\n\x0b\n\x04\x05\0\x02\x01\x12\x03\x07\x04\x18\n\x0c\n\ + \x05\x05\0\x02\x01\x01\x12\x03\x07\x04\x13\n\x0c\n\x05\x05\0\x02\x01\x02\ + \x12\x03\x07\x16\x17\n\n\n\x02\x04\0\x12\x04\n\0\x0f\x01\n\n\n\x03\x04\0\ + \x01\x12\x03\n\x08\r\n\x0b\n\x04\x04\0\x02\0\x12\x03\x0b\x04(\n\x0c\n\ + \x05\x04\0\x02\0\x04\x12\x03\x0b\x04\x0c\n\x0c\n\x05\x04\0\x02\0\x06\x12\ + \x03\x0b\r\x16\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x0b\x18\"\n\x0c\n\x05\ + \x04\0\x02\0\x03\x12\x03\x0b&'\n\x0b\n\x04\x04\0\x02\x01\x12\x03\x0c\x04\ + (\n\x0c\n\x05\x04\0\x02\x01\x04\x12\x03\x0c\x04\x0c\n\x0c\n\x05\x04\0\ + \x02\x01\x05\x12\x03\x0c\r\x13\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x0c\ + \x18\x1c\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x0c&'\n\x0b\n\x04\x04\0\ + \x02\x02\x12\x03\r\x04(\n\x0c\n\x05\x04\0\x02\x02\x04\x12\x03\r\x04\x0c\ + \n\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\r\r\x13\n\x0c\n\x05\x04\0\x02\x02\ + \x01\x12\x03\r\x18\x1d\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x03\r&'\n\x0b\n\ + \x04\x04\0\x02\x03\x12\x03\x0e\x04(\n\x0c\n\x05\x04\0\x02\x03\x04\x12\ + \x03\x0e\x04\x0c\n\x0c\n\x05\x04\0\x02\x03\x05\x12\x03\x0e\r\x12\n\x0c\n\ + \x05\x04\0\x02\x03\x01\x12\x03\x0e\x18\x1c\n\x0c\n\x05\x04\0\x02\x03\x03\ + \x12\x03\x0e&'\n\n\n\x02\x04\x01\x12\x04\x11\0\x15\x01\n\n\n\x03\x04\x01\ + \x01\x12\x03\x11\x08\x18\n\x0b\n\x04\x04\x01\x02\0\x12\x03\x12\x04&\n\ + \x0c\n\x05\x04\x01\x02\0\x04\x12\x03\x12\x04\x0c\n\x0c\n\x05\x04\x01\x02\ + \0\x06\x12\x03\x12\r\x16\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x12\x17!\ + \n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x12$%\n\x0b\n\x04\x04\x01\x02\x01\ + \x12\x03\x13\x04&\n\x0c\n\x05\x04\x01\x02\x01\x04\x12\x03\x13\x04\x0c\n\ + \x0c\n\x05\x04\x01\x02\x01\x05\x12\x03\x13\r\x13\n\x0c\n\x05\x04\x01\x02\ + \x01\x01\x12\x03\x13\x17\x1c\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\x13\ + $%\n\x0b\n\x04\x04\x01\x02\x02\x12\x03\x14\x04&\n\x0c\n\x05\x04\x01\x02\ + \x02\x04\x12\x03\x14\x04\x0c\n\x0c\n\x05\x04\x01\x02\x02\x05\x12\x03\x14\ + \r\x13\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03\x14\x17\x1b\n\x0c\n\x05\ + \x04\x01\x02\x02\x03\x12\x03\x14$%\n\n\n\x02\x04\x02\x12\x04\x17\0\x1a\ + \x01\n\n\n\x03\x04\x02\x01\x12\x03\x17\x08\x10\n\x0b\n\x04\x04\x02\x02\0\ + \x12\x03\x18\x04+\n\x0c\n\x05\x04\x02\x02\0\x04\x12\x03\x18\x04\x0c\n\ + \x0c\n\x05\x04\x02\x02\0\x05\x12\x03\x18\r\x12\n\x0c\n\x05\x04\x02\x02\0\ + \x01\x12\x03\x18\x1e\"\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03\x18)*\n\x0b\ + \n\x04\x04\x02\x02\x01\x12\x03\x19\x04+\n\x0c\n\x05\x04\x02\x02\x01\x04\ + \x12\x03\x19\x04\x0c\n\x0c\n\x05\x04\x02\x02\x01\x06\x12\x03\x19\r\x1d\n\ + \x0c\n\x05\x04\x02\x02\x01\x01\x12\x03\x19\x1e&\n\x0c\n\x05\x04\x02\x02\ + \x01\x03\x12\x03\x19)*\n\n\n\x02\x05\x01\x12\x04\x1c\00\x01\n\n\n\x03\ + \x05\x01\x01\x12\x03\x1c\x05\x10\n\x0b\n\x04\x05\x01\x02\0\x12\x03\x1d\ + \x04\"\n\x0c\n\x05\x05\x01\x02\0\x01\x12\x03\x1d\x04\n\n\x0c\n\x05\x05\ + \x01\x02\0\x02\x12\x03\x1d\x20!\n\x0b\n\x04\x05\x01\x02\x01\x12\x03\x1e\ + \x04\"\n\x0c\n\x05\x05\x01\x02\x01\x01\x12\x03\x1e\x04\x0b\n\x0c\n\x05\ + \x05\x01\x02\x01\x02\x12\x03\x1e\x20!\n\x0b\n\x04\x05\x01\x02\x02\x12\ + \x03\x1f\x04\"\n\x0c\n\x05\x05\x01\x02\x02\x01\x12\x03\x1f\x04\x0e\n\x0c\ + \n\x05\x05\x01\x02\x02\x02\x12\x03\x1f\x20!\n\x0b\n\x04\x05\x01\x02\x03\ + \x12\x03\x20\x04\"\n\x0c\n\x05\x05\x01\x02\x03\x01\x12\x03\x20\x04\r\n\ + \x0c\n\x05\x05\x01\x02\x03\x02\x12\x03\x20\x20!\n\x0b\n\x04\x05\x01\x02\ + \x04\x12\x03!\x04\"\n\x0c\n\x05\x05\x01\x02\x04\x01\x12\x03!\x04\x15\n\ + \x0c\n\x05\x05\x01\x02\x04\x02\x12\x03!\x20!\n\x0b\n\x04\x05\x01\x02\x05\ + \x12\x03\"\x04\"\n\x0c\n\x05\x05\x01\x02\x05\x01\x12\x03\"\x04\x12\n\x0c\ + \n\x05\x05\x01\x02\x05\x02\x12\x03\"\x20!\n\x0b\n\x04\x05\x01\x02\x06\ + \x12\x03#\x04\"\n\x0c\n\x05\x05\x01\x02\x06\x01\x12\x03#\x04\x1a\n\x0c\n\ + \x05\x05\x01\x02\x06\x02\x12\x03#\x20!\n\x0b\n\x04\x05\x01\x02\x07\x12\ + \x03$\x04\"\n\x0c\n\x05\x05\x01\x02\x07\x01\x12\x03$\x04\x0f\n\x0c\n\x05\ + \x05\x01\x02\x07\x02\x12\x03$\x20!\n\x0b\n\x04\x05\x01\x02\x08\x12\x03%\ + \x04\"\n\x0c\n\x05\x05\x01\x02\x08\x01\x12\x03%\x04\x10\n\x0c\n\x05\x05\ + \x01\x02\x08\x02\x12\x03%\x20!\n\x0b\n\x04\x05\x01\x02\t\x12\x03&\x04\"\ + \n\x0c\n\x05\x05\x01\x02\t\x01\x12\x03&\x04\x18\n\x0c\n\x05\x05\x01\x02\ + \t\x02\x12\x03&\x20!\n\x0b\n\x04\x05\x01\x02\n\x12\x03'\x04#\n\x0c\n\x05\ + \x05\x01\x02\n\x01\x12\x03'\x04\x12\n\x0c\n\x05\x05\x01\x02\n\x02\x12\ + \x03'\x20\"\n\x0b\n\x04\x05\x01\x02\x0b\x12\x03(\x04#\n\x0c\n\x05\x05\ + \x01\x02\x0b\x01\x12\x03(\x04\x11\n\x0c\n\x05\x05\x01\x02\x0b\x02\x12\ + \x03(\x20\"\n\x0b\n\x04\x05\x01\x02\x0c\x12\x03)\x04#\n\x0c\n\x05\x05\ + \x01\x02\x0c\x01\x12\x03)\x04\x12\n\x0c\n\x05\x05\x01\x02\x0c\x02\x12\ + \x03)\x20\"\n\x0b\n\x04\x05\x01\x02\r\x12\x03*\x04#\n\x0c\n\x05\x05\x01\ + \x02\r\x01\x12\x03*\x04\x15\n\x0c\n\x05\x05\x01\x02\r\x02\x12\x03*\x20\"\ + \n\x0b\n\x04\x05\x01\x02\x0e\x12\x03+\x04#\n\x0c\n\x05\x05\x01\x02\x0e\ + \x01\x12\x03+\x04\x11\n\x0c\n\x05\x05\x01\x02\x0e\x02\x12\x03+\x20\"\n\ + \x0b\n\x04\x05\x01\x02\x0f\x12\x03,\x04#\n\x0c\n\x05\x05\x01\x02\x0f\x01\ + \x12\x03,\x04\x10\n\x0c\n\x05\x05\x01\x02\x0f\x02\x12\x03,\x20\"\n\x0b\n\ + \x04\x05\x01\x02\x10\x12\x03-\x04#\n\x0c\n\x05\x05\x01\x02\x10\x01\x12\ + \x03-\x04\x14\n\x0c\n\x05\x05\x01\x02\x10\x02\x12\x03-\x20\"\n\x0b\n\x04\ + \x05\x01\x02\x11\x12\x03.\x04#\n\x0c\n\x05\x05\x01\x02\x11\x01\x12\x03.\ + \x04\x15\n\x0c\n\x05\x05\x01\x02\x11\x02\x12\x03.\x20\"\n\x0b\n\x04\x05\ + \x01\x02\x12\x12\x03/\x04#\n\x0c\n\x05\x05\x01\x02\x12\x01\x12\x03/\x04\ + \x1d\n\x0c\n\x05\x05\x01\x02\x12\x02\x12\x03/\x20\"\n\n\n\x02\x04\x03\ + \x12\x042\0?\x01\n\n\n\x03\x04\x03\x01\x12\x032\x08\x0f\n\x0b\n\x04\x04\ + \x03\x02\0\x12\x033\x04,\n\x0c\n\x05\x04\x03\x02\0\x04\x12\x033\x04\x0c\ + \n\x0c\n\x05\x04\x03\x02\0\x06\x12\x033\r\x18\n\x0c\n\x05\x04\x03\x02\0\ + \x01\x12\x033\x19!\n\x0c\n\x05\x04\x03\x02\0\x03\x12\x033*+\n\x0b\n\x04\ + \x04\x03\x02\x01\x12\x034\x04,\n\x0c\n\x05\x04\x03\x02\x01\x04\x12\x034\ + \x04\x0c\n\x0c\n\x05\x04\x03\x02\x01\x05\x12\x034\r\x13\n\x0c\n\x05\x04\ + \x03\x02\x01\x01\x12\x034\x19\x1b\n\x0c\n\x05\x04\x03\x02\x01\x03\x12\ + \x034*+\n\x0b\n\x04\x04\x03\x02\x02\x12\x035\x04,\n\x0c\n\x05\x04\x03\ + \x02\x02\x04\x12\x035\x04\x0c\n\x0c\n\x05\x04\x03\x02\x02\x05\x12\x035\r\ + \x13\n\x0c\n\x05\x04\x03\x02\x02\x01\x12\x035\x19\x1d\n\x0c\n\x05\x04\ + \x03\x02\x02\x03\x12\x035*+\n\x0b\n\x04\x04\x03\x02\x03\x12\x036\x04,\n\ + \x0c\n\x05\x04\x03\x02\x03\x04\x12\x036\x04\x0c\n\x0c\n\x05\x04\x03\x02\ + \x03\x05\x12\x036\r\x13\n\x0c\n\x05\x04\x03\x02\x03\x01\x12\x036\x19\x1d\ + \n\x0c\n\x05\x04\x03\x02\x03\x03\x12\x036*+\n\x0b\n\x04\x04\x03\x02\x04\ + \x12\x037\x04,\n\x0c\n\x05\x04\x03\x02\x04\x04\x12\x037\x04\x0c\n\x0c\n\ + \x05\x04\x03\x02\x04\x05\x12\x037\r\x13\n\x0c\n\x05\x04\x03\x02\x04\x01\ + \x12\x037\x19!\n\x0c\n\x05\x04\x03\x02\x04\x03\x12\x037*+\n\x0b\n\x04\ + \x04\x03\x02\x05\x12\x038\x04,\n\x0c\n\x05\x04\x03\x02\x05\x04\x12\x038\ + \x04\x0c\n\x0c\n\x05\x04\x03\x02\x05\x05\x12\x038\r\x13\n\x0c\n\x05\x04\ + \x03\x02\x05\x01\x12\x038\x19\x1e\n\x0c\n\x05\x04\x03\x02\x05\x03\x12\ + \x038*+\n\x0b\n\x04\x04\x03\x02\x06\x12\x039\x04,\n\x0c\n\x05\x04\x03\ + \x02\x06\x04\x12\x039\x04\x0c\n\x0c\n\x05\x04\x03\x02\x06\x06\x12\x039\r\ + \x12\n\x0c\n\x05\x04\x03\x02\x06\x01\x12\x039\x19\x20\n\x0c\n\x05\x04\ + \x03\x02\x06\x03\x12\x039*+\n\x0b\n\x04\x04\x03\x02\x07\x12\x03:\x04,\n\ + \x0c\n\x05\x04\x03\x02\x07\x04\x12\x03:\x04\x0c\n\x0c\n\x05\x04\x03\x02\ + \x07\x05\x12\x03:\r\x13\n\x0c\n\x05\x04\x03\x02\x07\x01\x12\x03:\x19\x1f\ + \n\x0c\n\x05\x04\x03\x02\x07\x03\x12\x03:*+\n\x0b\n\x04\x04\x03\x02\x08\ + \x12\x03;\x04,\n\x0c\n\x05\x04\x03\x02\x08\x04\x12\x03;\x04\x0c\n\x0c\n\ + \x05\x04\x03\x02\x08\x06\x12\x03;\r\x15\n\x0c\n\x05\x04\x03\x02\x08\x01\ + \x12\x03;\x19!\n\x0c\n\x05\x04\x03\x02\x08\x03\x12\x03;*+\n\x0b\n\x04\ + \x04\x03\x02\t\x12\x03<\x04-\n\x0c\n\x05\x04\x03\x02\t\x04\x12\x03<\x04\ + \x0c\n\x0c\n\x05\x04\x03\x02\t\x05\x12\x03<\r\x11\n\x0c\n\x05\x04\x03\ + \x02\t\x01\x12\x03<\x19\x1f\n\x0c\n\x05\x04\x03\x02\t\x03\x12\x03<*,\n\ + \x0b\n\x04\x04\x03\x02\n\x12\x03=\x04-\n\x0c\n\x05\x04\x03\x02\n\x04\x12\ + \x03=\x04\x0c\n\x0c\n\x05\x04\x03\x02\n\x05\x12\x03=\r\x13\n\x0c\n\x05\ + \x04\x03\x02\n\x01\x12\x03=\x19$\n\x0c\n\x05\x04\x03\x02\n\x03\x12\x03=*\ + ,\n\x0b\n\x04\x04\x03\x02\x0b\x12\x03>\x04-\n\x0c\n\x05\x04\x03\x02\x0b\ + \x04\x12\x03>\x04\x0c\n\x0c\n\x05\x04\x03\x02\x0b\x05\x12\x03>\r\x12\n\ + \x0c\n\x05\x04\x03\x02\x0b\x01\x12\x03>\x19\x20\n\x0c\n\x05\x04\x03\x02\ + \x0b\x03\x12\x03>*,\n\n\n\x02\x04\x04\x12\x04A\0E\x01\n\n\n\x03\x04\x04\ + \x01\x12\x03A\x08\x11\n\x0b\n\x04\x04\x04\x02\0\x12\x03B\x04\x1f\n\x0c\n\ + \x05\x04\x04\x02\0\x04\x12\x03B\x04\x0c\n\x0c\n\x05\x04\x04\x02\0\x05\ + \x12\x03B\r\x13\n\x0c\n\x05\x04\x04\x02\0\x01\x12\x03B\x14\x18\n\x0c\n\ + \x05\x04\x04\x02\0\x03\x12\x03B\x1d\x1e\n\x0b\n\x04\x04\x04\x02\x01\x12\ + \x03C\x04\x1f\n\x0c\n\x05\x04\x04\x02\x01\x04\x12\x03C\x04\x0c\n\x0c\n\ + \x05\x04\x04\x02\x01\x05\x12\x03C\r\x13\n\x0c\n\x05\x04\x04\x02\x01\x01\ + \x12\x03C\x14\x18\n\x0c\n\x05\x04\x04\x02\x01\x03\x12\x03C\x1d\x1e\n\x0b\ + \n\x04\x04\x04\x02\x02\x12\x03D\x04\x1f\n\x0c\n\x05\x04\x04\x02\x02\x04\ + \x12\x03D\x04\x0c\n\x0c\n\x05\x04\x04\x02\x02\x05\x12\x03D\r\x13\n\x0c\n\ + \x05\x04\x04\x02\x02\x01\x12\x03D\x14\x1a\n\x0c\n\x05\x04\x04\x02\x02\ + \x03\x12\x03D\x1d\x1e\n\n\n\x02\x04\x05\x12\x04G\0I\x01\n\n\n\x03\x04\ + \x05\x01\x12\x03G\x08\x11\n\x0b\n\x04\x04\x05\x02\0\x12\x03H\x04\x1e\n\ + \x0c\n\x05\x04\x05\x02\0\x04\x12\x03H\x04\x0c\n\x0c\n\x05\x04\x05\x02\0\ + \x05\x12\x03H\r\x13\n\x0c\n\x05\x04\x05\x02\0\x01\x12\x03H\x14\x19\n\x0c\ + \n\x05\x04\x05\x02\0\x03\x12\x03H\x1c\x1d\n\n\n\x02\x05\x02\x12\x04K\0N\ + \x01\n\n\n\x03\x05\x02\x01\x12\x03K\x05\x13\n\x0b\n\x04\x05\x02\x02\0\ + \x12\x03L\x04\x13\n\x0c\n\x05\x05\x02\x02\0\x01\x12\x03L\x04\x0b\n\x0c\n\ + \x05\x05\x02\x02\0\x02\x12\x03L\x11\x12\n\x0b\n\x04\x05\x02\x02\x01\x12\ + \x03M\x04\x13\n\x0c\n\x05\x05\x02\x02\x01\x01\x12\x03M\x04\x0e\n\x0c\n\ + \x05\x05\x02\x02\x01\x02\x12\x03M\x11\x12\n\n\n\x02\x04\x06\x12\x04P\0U\ + \x01\n\n\n\x03\x04\x06\x01\x12\x03P\x08\x12\n\x0b\n\x04\x04\x06\x02\0\ + \x12\x03Q\x040\n\x0c\n\x05\x04\x06\x02\0\x04\x12\x03Q\x04\x0c\n\x0c\n\ + \x05\x04\x06\x02\0\x05\x12\x03Q\r\x13\n\x0c\n\x05\x04\x06\x02\0\x01\x12\ + \x03Q\x1d\x1f\n\x0c\n\x05\x04\x06\x02\0\x03\x12\x03Q./\n\x0b\n\x04\x04\ + \x06\x02\x01\x12\x03R\x040\n\x0c\n\x05\x04\x06\x02\x01\x04\x12\x03R\x04\ + \x0c\n\x0c\n\x05\x04\x06\x02\x01\x06\x12\x03R\r\x1b\n\x0c\n\x05\x04\x06\ + \x02\x01\x01\x12\x03R\x1d(\n\x0c\n\x05\x04\x06\x02\x01\x03\x12\x03R./\n\ + \x0b\n\x04\x04\x06\x02\x02\x12\x03S\x040\n\x0c\n\x05\x04\x06\x02\x02\x04\ + \x12\x03S\x04\x0c\n\x0c\n\x05\x04\x06\x02\x02\x05\x12\x03S\r\x13\n\x0c\n\ + \x05\x04\x06\x02\x02\x01\x12\x03S\x1d$\n\x0c\n\x05\x04\x06\x02\x02\x03\ + \x12\x03S./\n\x0b\n\x04\x04\x06\x02\x03\x12\x03T\x040\n\x0c\n\x05\x04\ + \x06\x02\x03\x04\x12\x03T\x04\x0c\n\x0c\n\x05\x04\x06\x02\x03\x05\x12\ + \x03T\r\x12\n\x0c\n\x05\x04\x06\x02\x03\x01\x12\x03T\x1d$\n\x0c\n\x05\ + \x04\x06\x02\x03\x03\x12\x03T./\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/src/errorpb.rs b/_vendor/src/github.com/pingcap/kvproto/src/errorpb.rs new file mode 100644 index 00000000000..369bce725b7 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/src/errorpb.rs @@ -0,0 +1,2469 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy)] + +#![cfg_attr(rustfmt, rustfmt_skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(PartialEq,Clone,Default)] +pub struct NotLeader { + // message fields + region_id: ::std::option::Option, + leader: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for NotLeader {} + +impl NotLeader { + pub fn new() -> NotLeader { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static NotLeader { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const NotLeader, + }; + unsafe { + instance.get(NotLeader::new) + } + } + + // optional uint64 region_id = 1; + + pub fn clear_region_id(&mut self) { + self.region_id = ::std::option::Option::None; + } + + pub fn has_region_id(&self) -> bool { + self.region_id.is_some() + } + + // Param is passed by value, moved + pub fn set_region_id(&mut self, v: u64) { + self.region_id = ::std::option::Option::Some(v); + } + + pub fn get_region_id(&self) -> u64 { + self.region_id.unwrap_or(0) + } + + fn get_region_id_for_reflect(&self) -> &::std::option::Option { + &self.region_id + } + + fn mut_region_id_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.region_id + } + + // optional .metapb.Peer leader = 2; + + pub fn clear_leader(&mut self) { + self.leader.clear(); + } + + pub fn has_leader(&self) -> bool { + self.leader.is_some() + } + + // Param is passed by value, moved + pub fn set_leader(&mut self, v: super::metapb::Peer) { + self.leader = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_leader(&mut self) -> &mut super::metapb::Peer { + if self.leader.is_none() { + self.leader.set_default(); + } + self.leader.as_mut().unwrap() + } + + // Take field + pub fn take_leader(&mut self) -> super::metapb::Peer { + self.leader.take().unwrap_or_else(|| super::metapb::Peer::new()) + } + + pub fn get_leader(&self) -> &super::metapb::Peer { + self.leader.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) + } + + fn get_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.leader + } + + fn mut_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.leader + } +} + +impl ::protobuf::Message for NotLeader { + fn is_initialized(&self) -> bool { + for v in &self.leader { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.region_id = ::std::option::Option::Some(tmp); + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.leader)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.region_id { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.leader.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.region_id { + os.write_uint64(1, v)?; + } + if let Some(ref v) = self.leader.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for NotLeader { + fn new() -> NotLeader { + NotLeader::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "region_id", + NotLeader::get_region_id_for_reflect, + NotLeader::mut_region_id_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "leader", + NotLeader::get_leader_for_reflect, + NotLeader::mut_leader_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "NotLeader", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for NotLeader { + fn clear(&mut self) { + self.clear_region_id(); + self.clear_leader(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for NotLeader { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for NotLeader { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct StoreNotMatch { + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for StoreNotMatch {} + +impl StoreNotMatch { + pub fn new() -> StoreNotMatch { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static StoreNotMatch { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const StoreNotMatch, + }; + unsafe { + instance.get(StoreNotMatch::new) + } + } +} + +impl ::protobuf::Message for StoreNotMatch { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for StoreNotMatch { + fn new() -> StoreNotMatch { + StoreNotMatch::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let fields = ::std::vec::Vec::new(); + ::protobuf::reflect::MessageDescriptor::new::( + "StoreNotMatch", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for StoreNotMatch { + fn clear(&mut self) { + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for StoreNotMatch { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StoreNotMatch { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RegionNotFound { + // message fields + region_id: ::std::option::Option, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RegionNotFound {} + +impl RegionNotFound { + pub fn new() -> RegionNotFound { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RegionNotFound { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RegionNotFound, + }; + unsafe { + instance.get(RegionNotFound::new) + } + } + + // optional uint64 region_id = 1; + + pub fn clear_region_id(&mut self) { + self.region_id = ::std::option::Option::None; + } + + pub fn has_region_id(&self) -> bool { + self.region_id.is_some() + } + + // Param is passed by value, moved + pub fn set_region_id(&mut self, v: u64) { + self.region_id = ::std::option::Option::Some(v); + } + + pub fn get_region_id(&self) -> u64 { + self.region_id.unwrap_or(0) + } + + fn get_region_id_for_reflect(&self) -> &::std::option::Option { + &self.region_id + } + + fn mut_region_id_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.region_id + } +} + +impl ::protobuf::Message for RegionNotFound { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.region_id = ::std::option::Option::Some(tmp); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.region_id { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.region_id { + os.write_uint64(1, v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RegionNotFound { + fn new() -> RegionNotFound { + RegionNotFound::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "region_id", + RegionNotFound::get_region_id_for_reflect, + RegionNotFound::mut_region_id_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RegionNotFound", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RegionNotFound { + fn clear(&mut self) { + self.clear_region_id(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RegionNotFound { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RegionNotFound { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct KeyNotInRegion { + // message fields + key: ::protobuf::SingularField<::std::vec::Vec>, + region_id: ::std::option::Option, + start_key: ::protobuf::SingularField<::std::vec::Vec>, + end_key: ::protobuf::SingularField<::std::vec::Vec>, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for KeyNotInRegion {} + +impl KeyNotInRegion { + pub fn new() -> KeyNotInRegion { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static KeyNotInRegion { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const KeyNotInRegion, + }; + unsafe { + instance.get(KeyNotInRegion::new) + } + } + + // optional bytes key = 1; + + pub fn clear_key(&mut self) { + self.key.clear(); + } + + pub fn has_key(&self) -> bool { + self.key.is_some() + } + + // Param is passed by value, moved + pub fn set_key(&mut self, v: ::std::vec::Vec) { + self.key = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { + if self.key.is_none() { + self.key.set_default(); + } + self.key.as_mut().unwrap() + } + + // Take field + pub fn take_key(&mut self) -> ::std::vec::Vec { + self.key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub fn get_key(&self) -> &[u8] { + match self.key.as_ref() { + Some(v) => &v, + None => &[], + } + } + + fn get_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { + &self.key + } + + fn mut_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { + &mut self.key + } + + // optional uint64 region_id = 2; + + pub fn clear_region_id(&mut self) { + self.region_id = ::std::option::Option::None; + } + + pub fn has_region_id(&self) -> bool { + self.region_id.is_some() + } + + // Param is passed by value, moved + pub fn set_region_id(&mut self, v: u64) { + self.region_id = ::std::option::Option::Some(v); + } + + pub fn get_region_id(&self) -> u64 { + self.region_id.unwrap_or(0) + } + + fn get_region_id_for_reflect(&self) -> &::std::option::Option { + &self.region_id + } + + fn mut_region_id_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.region_id + } + + // optional bytes start_key = 3; + + pub fn clear_start_key(&mut self) { + self.start_key.clear(); + } + + pub fn has_start_key(&self) -> bool { + self.start_key.is_some() + } + + // Param is passed by value, moved + pub fn set_start_key(&mut self, v: ::std::vec::Vec) { + self.start_key = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_start_key(&mut self) -> &mut ::std::vec::Vec { + if self.start_key.is_none() { + self.start_key.set_default(); + } + self.start_key.as_mut().unwrap() + } + + // Take field + pub fn take_start_key(&mut self) -> ::std::vec::Vec { + self.start_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub fn get_start_key(&self) -> &[u8] { + match self.start_key.as_ref() { + Some(v) => &v, + None => &[], + } + } + + fn get_start_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { + &self.start_key + } + + fn mut_start_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { + &mut self.start_key + } + + // optional bytes end_key = 4; + + pub fn clear_end_key(&mut self) { + self.end_key.clear(); + } + + pub fn has_end_key(&self) -> bool { + self.end_key.is_some() + } + + // Param is passed by value, moved + pub fn set_end_key(&mut self, v: ::std::vec::Vec) { + self.end_key = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_end_key(&mut self) -> &mut ::std::vec::Vec { + if self.end_key.is_none() { + self.end_key.set_default(); + } + self.end_key.as_mut().unwrap() + } + + // Take field + pub fn take_end_key(&mut self) -> ::std::vec::Vec { + self.end_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub fn get_end_key(&self) -> &[u8] { + match self.end_key.as_ref() { + Some(v) => &v, + None => &[], + } + } + + fn get_end_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { + &self.end_key + } + + fn mut_end_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { + &mut self.end_key + } +} + +impl ::protobuf::Message for KeyNotInRegion { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.key)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.region_id = ::std::option::Option::Some(tmp); + }, + 3 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.start_key)?; + }, + 4 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.end_key)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.key.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.region_id { + my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.start_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(ref v) = self.end_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.key.as_ref() { + os.write_bytes(1, &v)?; + } + if let Some(v) = self.region_id { + os.write_uint64(2, v)?; + } + if let Some(ref v) = self.start_key.as_ref() { + os.write_bytes(3, &v)?; + } + if let Some(ref v) = self.end_key.as_ref() { + os.write_bytes(4, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for KeyNotInRegion { + fn new() -> KeyNotInRegion { + KeyNotInRegion::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "key", + KeyNotInRegion::get_key_for_reflect, + KeyNotInRegion::mut_key_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "region_id", + KeyNotInRegion::get_region_id_for_reflect, + KeyNotInRegion::mut_region_id_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "start_key", + KeyNotInRegion::get_start_key_for_reflect, + KeyNotInRegion::mut_start_key_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "end_key", + KeyNotInRegion::get_end_key_for_reflect, + KeyNotInRegion::mut_end_key_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "KeyNotInRegion", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for KeyNotInRegion { + fn clear(&mut self) { + self.clear_key(); + self.clear_region_id(); + self.clear_start_key(); + self.clear_end_key(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for KeyNotInRegion { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for KeyNotInRegion { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct StaleEpoch { + // message fields + new_regions: ::protobuf::RepeatedField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for StaleEpoch {} + +impl StaleEpoch { + pub fn new() -> StaleEpoch { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static StaleEpoch { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const StaleEpoch, + }; + unsafe { + instance.get(StaleEpoch::new) + } + } + + // repeated .metapb.Region new_regions = 1; + + pub fn clear_new_regions(&mut self) { + self.new_regions.clear(); + } + + // Param is passed by value, moved + pub fn set_new_regions(&mut self, v: ::protobuf::RepeatedField) { + self.new_regions = v; + } + + // Mutable pointer to the field. + pub fn mut_new_regions(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.new_regions + } + + // Take field + pub fn take_new_regions(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.new_regions, ::protobuf::RepeatedField::new()) + } + + pub fn get_new_regions(&self) -> &[super::metapb::Region] { + &self.new_regions + } + + fn get_new_regions_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.new_regions + } + + fn mut_new_regions_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.new_regions + } +} + +impl ::protobuf::Message for StaleEpoch { + fn is_initialized(&self) -> bool { + for v in &self.new_regions { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.new_regions)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.new_regions { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + for v in &self.new_regions { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for StaleEpoch { + fn new() -> StaleEpoch { + StaleEpoch::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "new_regions", + StaleEpoch::get_new_regions_for_reflect, + StaleEpoch::mut_new_regions_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "StaleEpoch", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for StaleEpoch { + fn clear(&mut self) { + self.clear_new_regions(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for StaleEpoch { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StaleEpoch { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ServerIsBusy { + // message fields + reason: ::protobuf::SingularField<::std::string::String>, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for ServerIsBusy {} + +impl ServerIsBusy { + pub fn new() -> ServerIsBusy { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static ServerIsBusy { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ServerIsBusy, + }; + unsafe { + instance.get(ServerIsBusy::new) + } + } + + // optional string reason = 1; + + pub fn clear_reason(&mut self) { + self.reason.clear(); + } + + pub fn has_reason(&self) -> bool { + self.reason.is_some() + } + + // Param is passed by value, moved + pub fn set_reason(&mut self, v: ::std::string::String) { + self.reason = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_reason(&mut self) -> &mut ::std::string::String { + if self.reason.is_none() { + self.reason.set_default(); + } + self.reason.as_mut().unwrap() + } + + // Take field + pub fn take_reason(&mut self) -> ::std::string::String { + self.reason.take().unwrap_or_else(|| ::std::string::String::new()) + } + + pub fn get_reason(&self) -> &str { + match self.reason.as_ref() { + Some(v) => &v, + None => "", + } + } + + fn get_reason_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { + &self.reason + } + + fn mut_reason_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { + &mut self.reason + } +} + +impl ::protobuf::Message for ServerIsBusy { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.reason)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.reason.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.reason.as_ref() { + os.write_string(1, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for ServerIsBusy { + fn new() -> ServerIsBusy { + ServerIsBusy::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "reason", + ServerIsBusy::get_reason_for_reflect, + ServerIsBusy::mut_reason_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ServerIsBusy", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for ServerIsBusy { + fn clear(&mut self) { + self.clear_reason(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ServerIsBusy { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ServerIsBusy { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct StaleCommand { + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for StaleCommand {} + +impl StaleCommand { + pub fn new() -> StaleCommand { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static StaleCommand { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const StaleCommand, + }; + unsafe { + instance.get(StaleCommand::new) + } + } +} + +impl ::protobuf::Message for StaleCommand { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for StaleCommand { + fn new() -> StaleCommand { + StaleCommand::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let fields = ::std::vec::Vec::new(); + ::protobuf::reflect::MessageDescriptor::new::( + "StaleCommand", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for StaleCommand { + fn clear(&mut self) { + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for StaleCommand { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StaleCommand { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RaftEntryTooLarge { + // message fields + region_id: ::std::option::Option, + entry_size: ::std::option::Option, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RaftEntryTooLarge {} + +impl RaftEntryTooLarge { + pub fn new() -> RaftEntryTooLarge { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RaftEntryTooLarge { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RaftEntryTooLarge, + }; + unsafe { + instance.get(RaftEntryTooLarge::new) + } + } + + // optional uint64 region_id = 1; + + pub fn clear_region_id(&mut self) { + self.region_id = ::std::option::Option::None; + } + + pub fn has_region_id(&self) -> bool { + self.region_id.is_some() + } + + // Param is passed by value, moved + pub fn set_region_id(&mut self, v: u64) { + self.region_id = ::std::option::Option::Some(v); + } + + pub fn get_region_id(&self) -> u64 { + self.region_id.unwrap_or(0) + } + + fn get_region_id_for_reflect(&self) -> &::std::option::Option { + &self.region_id + } + + fn mut_region_id_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.region_id + } + + // optional uint64 entry_size = 2; + + pub fn clear_entry_size(&mut self) { + self.entry_size = ::std::option::Option::None; + } + + pub fn has_entry_size(&self) -> bool { + self.entry_size.is_some() + } + + // Param is passed by value, moved + pub fn set_entry_size(&mut self, v: u64) { + self.entry_size = ::std::option::Option::Some(v); + } + + pub fn get_entry_size(&self) -> u64 { + self.entry_size.unwrap_or(0) + } + + fn get_entry_size_for_reflect(&self) -> &::std::option::Option { + &self.entry_size + } + + fn mut_entry_size_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.entry_size + } +} + +impl ::protobuf::Message for RaftEntryTooLarge { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.region_id = ::std::option::Option::Some(tmp); + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.entry_size = ::std::option::Option::Some(tmp); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.region_id { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.entry_size { + my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.region_id { + os.write_uint64(1, v)?; + } + if let Some(v) = self.entry_size { + os.write_uint64(2, v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RaftEntryTooLarge { + fn new() -> RaftEntryTooLarge { + RaftEntryTooLarge::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "region_id", + RaftEntryTooLarge::get_region_id_for_reflect, + RaftEntryTooLarge::mut_region_id_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "entry_size", + RaftEntryTooLarge::get_entry_size_for_reflect, + RaftEntryTooLarge::mut_entry_size_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RaftEntryTooLarge", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RaftEntryTooLarge { + fn clear(&mut self) { + self.clear_region_id(); + self.clear_entry_size(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RaftEntryTooLarge { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RaftEntryTooLarge { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Error { + // message fields + message: ::protobuf::SingularField<::std::string::String>, + not_leader: ::protobuf::SingularPtrField, + region_not_found: ::protobuf::SingularPtrField, + key_not_in_region: ::protobuf::SingularPtrField, + stale_epoch: ::protobuf::SingularPtrField, + server_is_busy: ::protobuf::SingularPtrField, + stale_command: ::protobuf::SingularPtrField, + store_not_match: ::protobuf::SingularPtrField, + raft_entry_too_large: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Error {} + +impl Error { + pub fn new() -> Error { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static Error { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Error, + }; + unsafe { + instance.get(Error::new) + } + } + + // optional string message = 1; + + pub fn clear_message(&mut self) { + self.message.clear(); + } + + pub fn has_message(&self) -> bool { + self.message.is_some() + } + + // Param is passed by value, moved + pub fn set_message(&mut self, v: ::std::string::String) { + self.message = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_message(&mut self) -> &mut ::std::string::String { + if self.message.is_none() { + self.message.set_default(); + } + self.message.as_mut().unwrap() + } + + // Take field + pub fn take_message(&mut self) -> ::std::string::String { + self.message.take().unwrap_or_else(|| ::std::string::String::new()) + } + + pub fn get_message(&self) -> &str { + match self.message.as_ref() { + Some(v) => &v, + None => "", + } + } + + fn get_message_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { + &self.message + } + + fn mut_message_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { + &mut self.message + } + + // optional .errorpb.NotLeader not_leader = 2; + + pub fn clear_not_leader(&mut self) { + self.not_leader.clear(); + } + + pub fn has_not_leader(&self) -> bool { + self.not_leader.is_some() + } + + // Param is passed by value, moved + pub fn set_not_leader(&mut self, v: NotLeader) { + self.not_leader = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_not_leader(&mut self) -> &mut NotLeader { + if self.not_leader.is_none() { + self.not_leader.set_default(); + } + self.not_leader.as_mut().unwrap() + } + + // Take field + pub fn take_not_leader(&mut self) -> NotLeader { + self.not_leader.take().unwrap_or_else(|| NotLeader::new()) + } + + pub fn get_not_leader(&self) -> &NotLeader { + self.not_leader.as_ref().unwrap_or_else(|| NotLeader::default_instance()) + } + + fn get_not_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.not_leader + } + + fn mut_not_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.not_leader + } + + // optional .errorpb.RegionNotFound region_not_found = 3; + + pub fn clear_region_not_found(&mut self) { + self.region_not_found.clear(); + } + + pub fn has_region_not_found(&self) -> bool { + self.region_not_found.is_some() + } + + // Param is passed by value, moved + pub fn set_region_not_found(&mut self, v: RegionNotFound) { + self.region_not_found = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_not_found(&mut self) -> &mut RegionNotFound { + if self.region_not_found.is_none() { + self.region_not_found.set_default(); + } + self.region_not_found.as_mut().unwrap() + } + + // Take field + pub fn take_region_not_found(&mut self) -> RegionNotFound { + self.region_not_found.take().unwrap_or_else(|| RegionNotFound::new()) + } + + pub fn get_region_not_found(&self) -> &RegionNotFound { + self.region_not_found.as_ref().unwrap_or_else(|| RegionNotFound::default_instance()) + } + + fn get_region_not_found_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_not_found + } + + fn mut_region_not_found_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_not_found + } + + // optional .errorpb.KeyNotInRegion key_not_in_region = 4; + + pub fn clear_key_not_in_region(&mut self) { + self.key_not_in_region.clear(); + } + + pub fn has_key_not_in_region(&self) -> bool { + self.key_not_in_region.is_some() + } + + // Param is passed by value, moved + pub fn set_key_not_in_region(&mut self, v: KeyNotInRegion) { + self.key_not_in_region = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key_not_in_region(&mut self) -> &mut KeyNotInRegion { + if self.key_not_in_region.is_none() { + self.key_not_in_region.set_default(); + } + self.key_not_in_region.as_mut().unwrap() + } + + // Take field + pub fn take_key_not_in_region(&mut self) -> KeyNotInRegion { + self.key_not_in_region.take().unwrap_or_else(|| KeyNotInRegion::new()) + } + + pub fn get_key_not_in_region(&self) -> &KeyNotInRegion { + self.key_not_in_region.as_ref().unwrap_or_else(|| KeyNotInRegion::default_instance()) + } + + fn get_key_not_in_region_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.key_not_in_region + } + + fn mut_key_not_in_region_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.key_not_in_region + } + + // optional .errorpb.StaleEpoch stale_epoch = 5; + + pub fn clear_stale_epoch(&mut self) { + self.stale_epoch.clear(); + } + + pub fn has_stale_epoch(&self) -> bool { + self.stale_epoch.is_some() + } + + // Param is passed by value, moved + pub fn set_stale_epoch(&mut self, v: StaleEpoch) { + self.stale_epoch = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_stale_epoch(&mut self) -> &mut StaleEpoch { + if self.stale_epoch.is_none() { + self.stale_epoch.set_default(); + } + self.stale_epoch.as_mut().unwrap() + } + + // Take field + pub fn take_stale_epoch(&mut self) -> StaleEpoch { + self.stale_epoch.take().unwrap_or_else(|| StaleEpoch::new()) + } + + pub fn get_stale_epoch(&self) -> &StaleEpoch { + self.stale_epoch.as_ref().unwrap_or_else(|| StaleEpoch::default_instance()) + } + + fn get_stale_epoch_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.stale_epoch + } + + fn mut_stale_epoch_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.stale_epoch + } + + // optional .errorpb.ServerIsBusy server_is_busy = 6; + + pub fn clear_server_is_busy(&mut self) { + self.server_is_busy.clear(); + } + + pub fn has_server_is_busy(&self) -> bool { + self.server_is_busy.is_some() + } + + // Param is passed by value, moved + pub fn set_server_is_busy(&mut self, v: ServerIsBusy) { + self.server_is_busy = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_server_is_busy(&mut self) -> &mut ServerIsBusy { + if self.server_is_busy.is_none() { + self.server_is_busy.set_default(); + } + self.server_is_busy.as_mut().unwrap() + } + + // Take field + pub fn take_server_is_busy(&mut self) -> ServerIsBusy { + self.server_is_busy.take().unwrap_or_else(|| ServerIsBusy::new()) + } + + pub fn get_server_is_busy(&self) -> &ServerIsBusy { + self.server_is_busy.as_ref().unwrap_or_else(|| ServerIsBusy::default_instance()) + } + + fn get_server_is_busy_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.server_is_busy + } + + fn mut_server_is_busy_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.server_is_busy + } + + // optional .errorpb.StaleCommand stale_command = 7; + + pub fn clear_stale_command(&mut self) { + self.stale_command.clear(); + } + + pub fn has_stale_command(&self) -> bool { + self.stale_command.is_some() + } + + // Param is passed by value, moved + pub fn set_stale_command(&mut self, v: StaleCommand) { + self.stale_command = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_stale_command(&mut self) -> &mut StaleCommand { + if self.stale_command.is_none() { + self.stale_command.set_default(); + } + self.stale_command.as_mut().unwrap() + } + + // Take field + pub fn take_stale_command(&mut self) -> StaleCommand { + self.stale_command.take().unwrap_or_else(|| StaleCommand::new()) + } + + pub fn get_stale_command(&self) -> &StaleCommand { + self.stale_command.as_ref().unwrap_or_else(|| StaleCommand::default_instance()) + } + + fn get_stale_command_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.stale_command + } + + fn mut_stale_command_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.stale_command + } + + // optional .errorpb.StoreNotMatch store_not_match = 8; + + pub fn clear_store_not_match(&mut self) { + self.store_not_match.clear(); + } + + pub fn has_store_not_match(&self) -> bool { + self.store_not_match.is_some() + } + + // Param is passed by value, moved + pub fn set_store_not_match(&mut self, v: StoreNotMatch) { + self.store_not_match = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_store_not_match(&mut self) -> &mut StoreNotMatch { + if self.store_not_match.is_none() { + self.store_not_match.set_default(); + } + self.store_not_match.as_mut().unwrap() + } + + // Take field + pub fn take_store_not_match(&mut self) -> StoreNotMatch { + self.store_not_match.take().unwrap_or_else(|| StoreNotMatch::new()) + } + + pub fn get_store_not_match(&self) -> &StoreNotMatch { + self.store_not_match.as_ref().unwrap_or_else(|| StoreNotMatch::default_instance()) + } + + fn get_store_not_match_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.store_not_match + } + + fn mut_store_not_match_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.store_not_match + } + + // optional .errorpb.RaftEntryTooLarge raft_entry_too_large = 9; + + pub fn clear_raft_entry_too_large(&mut self) { + self.raft_entry_too_large.clear(); + } + + pub fn has_raft_entry_too_large(&self) -> bool { + self.raft_entry_too_large.is_some() + } + + // Param is passed by value, moved + pub fn set_raft_entry_too_large(&mut self, v: RaftEntryTooLarge) { + self.raft_entry_too_large = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_raft_entry_too_large(&mut self) -> &mut RaftEntryTooLarge { + if self.raft_entry_too_large.is_none() { + self.raft_entry_too_large.set_default(); + } + self.raft_entry_too_large.as_mut().unwrap() + } + + // Take field + pub fn take_raft_entry_too_large(&mut self) -> RaftEntryTooLarge { + self.raft_entry_too_large.take().unwrap_or_else(|| RaftEntryTooLarge::new()) + } + + pub fn get_raft_entry_too_large(&self) -> &RaftEntryTooLarge { + self.raft_entry_too_large.as_ref().unwrap_or_else(|| RaftEntryTooLarge::default_instance()) + } + + fn get_raft_entry_too_large_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.raft_entry_too_large + } + + fn mut_raft_entry_too_large_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.raft_entry_too_large + } +} + +impl ::protobuf::Message for Error { + fn is_initialized(&self) -> bool { + for v in &self.not_leader { + if !v.is_initialized() { + return false; + } + }; + for v in &self.region_not_found { + if !v.is_initialized() { + return false; + } + }; + for v in &self.key_not_in_region { + if !v.is_initialized() { + return false; + } + }; + for v in &self.stale_epoch { + if !v.is_initialized() { + return false; + } + }; + for v in &self.server_is_busy { + if !v.is_initialized() { + return false; + } + }; + for v in &self.stale_command { + if !v.is_initialized() { + return false; + } + }; + for v in &self.store_not_match { + if !v.is_initialized() { + return false; + } + }; + for v in &self.raft_entry_too_large { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.message)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.not_leader)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_not_found)?; + }, + 4 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.key_not_in_region)?; + }, + 5 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.stale_epoch)?; + }, + 6 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.server_is_busy)?; + }, + 7 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.stale_command)?; + }, + 8 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.store_not_match)?; + }, + 9 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.raft_entry_too_large)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.message.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(ref v) = self.not_leader.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.region_not_found.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.key_not_in_region.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.stale_epoch.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.server_is_busy.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.stale_command.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.store_not_match.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.raft_entry_too_large.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.message.as_ref() { + os.write_string(1, &v)?; + } + if let Some(ref v) = self.not_leader.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.region_not_found.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.key_not_in_region.as_ref() { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.stale_epoch.as_ref() { + os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.server_is_busy.as_ref() { + os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.stale_command.as_ref() { + os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.store_not_match.as_ref() { + os.write_tag(8, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.raft_entry_too_large.as_ref() { + os.write_tag(9, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for Error { + fn new() -> Error { + Error::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "message", + Error::get_message_for_reflect, + Error::mut_message_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "not_leader", + Error::get_not_leader_for_reflect, + Error::mut_not_leader_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_not_found", + Error::get_region_not_found_for_reflect, + Error::mut_region_not_found_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "key_not_in_region", + Error::get_key_not_in_region_for_reflect, + Error::mut_key_not_in_region_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "stale_epoch", + Error::get_stale_epoch_for_reflect, + Error::mut_stale_epoch_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "server_is_busy", + Error::get_server_is_busy_for_reflect, + Error::mut_server_is_busy_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "stale_command", + Error::get_stale_command_for_reflect, + Error::mut_stale_command_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "store_not_match", + Error::get_store_not_match_for_reflect, + Error::mut_store_not_match_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "raft_entry_too_large", + Error::get_raft_entry_too_large_for_reflect, + Error::mut_raft_entry_too_large_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Error", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for Error { + fn clear(&mut self) { + self.clear_message(); + self.clear_not_leader(); + self.clear_region_not_found(); + self.clear_key_not_in_region(); + self.clear_stale_epoch(); + self.clear_server_is_busy(); + self.clear_stale_command(); + self.clear_store_not_match(); + self.clear_raft_entry_too_large(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Error { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Error { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\rerrorpb.proto\x12\x07errorpb\x1a\x0cmetapb.proto\x1a\x14gogoproto/go\ + go.proto\"N\n\tNotLeader\x12\x1b\n\tregion_id\x18\x01\x20\x01(\x04R\x08r\ + egionId\x12$\n\x06leader\x18\x02\x20\x01(\x0b2\x0c.metapb.PeerR\x06leade\ + r\"\x0f\n\rStoreNotMatch\"-\n\x0eRegionNotFound\x12\x1b\n\tregion_id\x18\ + \x01\x20\x01(\x04R\x08regionId\"u\n\x0eKeyNotInRegion\x12\x10\n\x03key\ + \x18\x01\x20\x01(\x0cR\x03key\x12\x1b\n\tregion_id\x18\x02\x20\x01(\x04R\ + \x08regionId\x12\x1b\n\tstart_key\x18\x03\x20\x01(\x0cR\x08startKey\x12\ + \x17\n\x07end_key\x18\x04\x20\x01(\x0cR\x06endKey\"=\n\nStaleEpoch\x12/\ + \n\x0bnew_regions\x18\x01\x20\x03(\x0b2\x0e.metapb.RegionR\nnewRegions\"\ + &\n\x0cServerIsBusy\x12\x16\n\x06reason\x18\x01\x20\x01(\tR\x06reason\"\ + \x0e\n\x0cStaleCommand\"O\n\x11RaftEntryTooLarge\x12\x1b\n\tregion_id\ + \x18\x01\x20\x01(\x04R\x08regionId\x12\x1d\n\nentry_size\x18\x02\x20\x01\ + (\x04R\tentrySize\"\x97\x04\n\x05Error\x12\x18\n\x07message\x18\x01\x20\ + \x01(\tR\x07message\x121\n\nnot_leader\x18\x02\x20\x01(\x0b2\x12.errorpb\ + .NotLeaderR\tnotLeader\x12A\n\x10region_not_found\x18\x03\x20\x01(\x0b2\ + \x17.errorpb.RegionNotFoundR\x0eregionNotFound\x12B\n\x11key_not_in_regi\ + on\x18\x04\x20\x01(\x0b2\x17.errorpb.KeyNotInRegionR\x0ekeyNotInRegion\ + \x124\n\x0bstale_epoch\x18\x05\x20\x01(\x0b2\x13.errorpb.StaleEpochR\nst\ + aleEpoch\x12;\n\x0eserver_is_busy\x18\x06\x20\x01(\x0b2\x15.errorpb.Serv\ + erIsBusyR\x0cserverIsBusy\x12:\n\rstale_command\x18\x07\x20\x01(\x0b2\ + \x15.errorpb.StaleCommandR\x0cstaleCommand\x12>\n\x0fstore_not_match\x18\ + \x08\x20\x01(\x0b2\x16.errorpb.StoreNotMatchR\rstoreNotMatch\x12K\n\x14r\ + aft_entry_too_large\x18\t\x20\x01(\x0b2\x1a.errorpb.RaftEntryTooLargeR\ + \x11raftEntryTooLargeB&\n\x18com.pingcap.tikv.kvproto\xe0\xe2\x1e\x01\ + \xd0\xe2\x1e\x01\xc8\xe2\x1e\x01J\xb6\x0f\n\x06\x12\x04\0\09\x01\n\x08\n\ + \x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x01\x08\x0f\n\t\n\x02\ + \x03\0\x12\x03\x03\x07\x15\n\t\n\x02\x03\x01\x12\x03\x04\x07\x1d\n\x08\n\ + \x01\x08\x12\x03\x06\0(\n\x0b\n\x04\x08\xe7\x07\0\x12\x03\x06\0(\n\x0c\n\ + \x05\x08\xe7\x07\0\x02\x12\x03\x06\x07\x20\n\r\n\x06\x08\xe7\x07\0\x02\0\ + \x12\x03\x06\x07\x20\n\x0e\n\x07\x08\xe7\x07\0\x02\0\x01\x12\x03\x06\x08\ + \x1f\n\x0c\n\x05\x08\xe7\x07\0\x03\x12\x03\x06#'\n\x08\n\x01\x08\x12\x03\ + \x07\0$\n\x0b\n\x04\x08\xe7\x07\x01\x12\x03\x07\0$\n\x0c\n\x05\x08\xe7\ + \x07\x01\x02\x12\x03\x07\x07\x1c\n\r\n\x06\x08\xe7\x07\x01\x02\0\x12\x03\ + \x07\x07\x1c\n\x0e\n\x07\x08\xe7\x07\x01\x02\0\x01\x12\x03\x07\x08\x1b\n\ + \x0c\n\x05\x08\xe7\x07\x01\x03\x12\x03\x07\x1f#\n\x08\n\x01\x08\x12\x03\ + \x08\0*\n\x0b\n\x04\x08\xe7\x07\x02\x12\x03\x08\0*\n\x0c\n\x05\x08\xe7\ + \x07\x02\x02\x12\x03\x08\x07\"\n\r\n\x06\x08\xe7\x07\x02\x02\0\x12\x03\ + \x08\x07\"\n\x0e\n\x07\x08\xe7\x07\x02\x02\0\x01\x12\x03\x08\x08!\n\x0c\ + \n\x05\x08\xe7\x07\x02\x03\x12\x03\x08%)\n\x08\n\x01\x08\x12\x03\n\01\n\ + \x0b\n\x04\x08\xe7\x07\x03\x12\x03\n\01\n\x0c\n\x05\x08\xe7\x07\x03\x02\ + \x12\x03\n\x07\x13\n\r\n\x06\x08\xe7\x07\x03\x02\0\x12\x03\n\x07\x13\n\ + \x0e\n\x07\x08\xe7\x07\x03\x02\0\x01\x12\x03\n\x07\x13\n\x0c\n\x05\x08\ + \xe7\x07\x03\x07\x12\x03\n\x160\n\n\n\x02\x04\0\x12\x04\x0c\0\x0f\x01\n\ + \n\n\x03\x04\0\x01\x12\x03\x0c\x08\x11\n\x0b\n\x04\x04\0\x02\0\x12\x03\r\ + \x04'\n\x0c\n\x05\x04\0\x02\0\x04\x12\x03\r\x04\x0c\n\x0c\n\x05\x04\0\ + \x02\0\x05\x12\x03\r\r\x13\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\r\x14\x1d\ + \n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\r%&\n\x0b\n\x04\x04\0\x02\x01\x12\ + \x03\x0e\x04'\n\x0c\n\x05\x04\0\x02\x01\x04\x12\x03\x0e\x04\x0c\n\x0c\n\ + \x05\x04\0\x02\x01\x06\x12\x03\x0e\r\x18\n\x0c\n\x05\x04\0\x02\x01\x01\ + \x12\x03\x0e\x19\x1f\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x0e%&\n\n\n\ + \x02\x04\x01\x12\x04\x11\0\x12\x01\n\n\n\x03\x04\x01\x01\x12\x03\x11\x08\ + \x15\n\n\n\x02\x04\x02\x12\x04\x14\0\x16\x01\n\n\n\x03\x04\x02\x01\x12\ + \x03\x14\x08\x16\n\x0b\n\x04\x04\x02\x02\0\x12\x03\x15\x04\"\n\x0c\n\x05\ + \x04\x02\x02\0\x04\x12\x03\x15\x04\x0c\n\x0c\n\x05\x04\x02\x02\0\x05\x12\ + \x03\x15\r\x13\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\x15\x14\x1d\n\x0c\n\ + \x05\x04\x02\x02\0\x03\x12\x03\x15\x20!\n\n\n\x02\x04\x03\x12\x04\x18\0\ + \x1d\x01\n\n\n\x03\x04\x03\x01\x12\x03\x18\x08\x16\n\x0b\n\x04\x04\x03\ + \x02\0\x12\x03\x19\x04#\n\x0c\n\x05\x04\x03\x02\0\x04\x12\x03\x19\x04\ + \x0c\n\x0c\n\x05\x04\x03\x02\0\x05\x12\x03\x19\r\x12\n\x0c\n\x05\x04\x03\ + \x02\0\x01\x12\x03\x19\x13\x16\n\x0c\n\x05\x04\x03\x02\0\x03\x12\x03\x19\ + !\"\n\x0b\n\x04\x04\x03\x02\x01\x12\x03\x1a\x04#\n\x0c\n\x05\x04\x03\x02\ + \x01\x04\x12\x03\x1a\x04\x0c\n\x0c\n\x05\x04\x03\x02\x01\x05\x12\x03\x1a\ + \r\x13\n\x0c\n\x05\x04\x03\x02\x01\x01\x12\x03\x1a\x14\x1d\n\x0c\n\x05\ + \x04\x03\x02\x01\x03\x12\x03\x1a!\"\n\x0b\n\x04\x04\x03\x02\x02\x12\x03\ + \x1b\x04#\n\x0c\n\x05\x04\x03\x02\x02\x04\x12\x03\x1b\x04\x0c\n\x0c\n\ + \x05\x04\x03\x02\x02\x05\x12\x03\x1b\r\x12\n\x0c\n\x05\x04\x03\x02\x02\ + \x01\x12\x03\x1b\x13\x1c\n\x0c\n\x05\x04\x03\x02\x02\x03\x12\x03\x1b!\"\ + \n\x0b\n\x04\x04\x03\x02\x03\x12\x03\x1c\x04#\n\x0c\n\x05\x04\x03\x02\ + \x03\x04\x12\x03\x1c\x04\x0c\n\x0c\n\x05\x04\x03\x02\x03\x05\x12\x03\x1c\ + \r\x12\n\x0c\n\x05\x04\x03\x02\x03\x01\x12\x03\x1c\x13\x1a\n\x0c\n\x05\ + \x04\x03\x02\x03\x03\x12\x03\x1c!\"\n\n\n\x02\x04\x04\x12\x04\x1f\0!\x01\ + \n\n\n\x03\x04\x04\x01\x12\x03\x1f\x08\x12\n\x0b\n\x04\x04\x04\x02\0\x12\ + \x03\x20\x04+\n\x0c\n\x05\x04\x04\x02\0\x04\x12\x03\x20\x04\x0c\n\x0c\n\ + \x05\x04\x04\x02\0\x06\x12\x03\x20\r\x1a\n\x0c\n\x05\x04\x04\x02\0\x01\ + \x12\x03\x20\x1b&\n\x0c\n\x05\x04\x04\x02\0\x03\x12\x03\x20)*\n\n\n\x02\ + \x04\x05\x12\x04#\0%\x01\n\n\n\x03\x04\x05\x01\x12\x03#\x08\x14\n\x0b\n\ + \x04\x04\x05\x02\0\x12\x03$\x04\x1f\n\x0c\n\x05\x04\x05\x02\0\x04\x12\ + \x03$\x04\x0c\n\x0c\n\x05\x04\x05\x02\0\x05\x12\x03$\r\x13\n\x0c\n\x05\ + \x04\x05\x02\0\x01\x12\x03$\x14\x1a\n\x0c\n\x05\x04\x05\x02\0\x03\x12\ + \x03$\x1d\x1e\n\n\n\x02\x04\x06\x12\x04'\0(\x01\n\n\n\x03\x04\x06\x01\ + \x12\x03'\x08\x14\n\n\n\x02\x04\x07\x12\x04*\0-\x01\n\n\n\x03\x04\x07\ + \x01\x12\x03*\x08\x19\n\x0b\n\x04\x04\x07\x02\0\x12\x03+\x04#\n\x0c\n\ + \x05\x04\x07\x02\0\x04\x12\x03+\x04\x0c\n\x0c\n\x05\x04\x07\x02\0\x05\ + \x12\x03+\r\x13\n\x0c\n\x05\x04\x07\x02\0\x01\x12\x03+\x14\x1d\n\x0c\n\ + \x05\x04\x07\x02\0\x03\x12\x03+!\"\n\x0b\n\x04\x04\x07\x02\x01\x12\x03,\ + \x04#\n\x0c\n\x05\x04\x07\x02\x01\x04\x12\x03,\x04\x0c\n\x0c\n\x05\x04\ + \x07\x02\x01\x05\x12\x03,\r\x13\n\x0c\n\x05\x04\x07\x02\x01\x01\x12\x03,\ + \x14\x1e\n\x0c\n\x05\x04\x07\x02\x01\x03\x12\x03,!\"\n\n\n\x02\x04\x08\ + \x12\x04/\09\x01\n\n\n\x03\x04\x08\x01\x12\x03/\x08\r\n\x0b\n\x04\x04\ + \x08\x02\0\x12\x030\x048\n\x0c\n\x05\x04\x08\x02\0\x04\x12\x030\x04\x0c\ + \n\x0c\n\x05\x04\x08\x02\0\x05\x12\x030\r\x13\n\x0c\n\x05\x04\x08\x02\0\ + \x01\x12\x030\x14\x1b\n\x0c\n\x05\x04\x08\x02\0\x03\x12\x03067\n\x0b\n\ + \x04\x04\x08\x02\x01\x12\x031\x048\n\x0c\n\x05\x04\x08\x02\x01\x04\x12\ + \x031\x04\x0c\n\x0c\n\x05\x04\x08\x02\x01\x06\x12\x031\r\x16\n\x0c\n\x05\ + \x04\x08\x02\x01\x01\x12\x031\x17!\n\x0c\n\x05\x04\x08\x02\x01\x03\x12\ + \x03167\n\x0b\n\x04\x04\x08\x02\x02\x12\x032\x048\n\x0c\n\x05\x04\x08\ + \x02\x02\x04\x12\x032\x04\x0c\n\x0c\n\x05\x04\x08\x02\x02\x06\x12\x032\r\ + \x1b\n\x0c\n\x05\x04\x08\x02\x02\x01\x12\x032\x1c,\n\x0c\n\x05\x04\x08\ + \x02\x02\x03\x12\x03267\n\x0b\n\x04\x04\x08\x02\x03\x12\x033\x048\n\x0c\ + \n\x05\x04\x08\x02\x03\x04\x12\x033\x04\x0c\n\x0c\n\x05\x04\x08\x02\x03\ + \x06\x12\x033\r\x1b\n\x0c\n\x05\x04\x08\x02\x03\x01\x12\x033\x1c-\n\x0c\ + \n\x05\x04\x08\x02\x03\x03\x12\x03367\n\x0b\n\x04\x04\x08\x02\x04\x12\ + \x034\x048\n\x0c\n\x05\x04\x08\x02\x04\x04\x12\x034\x04\x0c\n\x0c\n\x05\ + \x04\x08\x02\x04\x06\x12\x034\r\x17\n\x0c\n\x05\x04\x08\x02\x04\x01\x12\ + \x034\x18#\n\x0c\n\x05\x04\x08\x02\x04\x03\x12\x03467\n\x0b\n\x04\x04\ + \x08\x02\x05\x12\x035\x048\n\x0c\n\x05\x04\x08\x02\x05\x04\x12\x035\x04\ + \x0c\n\x0c\n\x05\x04\x08\x02\x05\x06\x12\x035\r\x19\n\x0c\n\x05\x04\x08\ + \x02\x05\x01\x12\x035\x1a(\n\x0c\n\x05\x04\x08\x02\x05\x03\x12\x03567\n\ + \x0b\n\x04\x04\x08\x02\x06\x12\x036\x048\n\x0c\n\x05\x04\x08\x02\x06\x04\ + \x12\x036\x04\x0c\n\x0c\n\x05\x04\x08\x02\x06\x06\x12\x036\r\x19\n\x0c\n\ + \x05\x04\x08\x02\x06\x01\x12\x036\x1a'\n\x0c\n\x05\x04\x08\x02\x06\x03\ + \x12\x03667\n\x0b\n\x04\x04\x08\x02\x07\x12\x037\x048\n\x0c\n\x05\x04\ + \x08\x02\x07\x04\x12\x037\x04\x0c\n\x0c\n\x05\x04\x08\x02\x07\x06\x12\ + \x037\r\x1a\n\x0c\n\x05\x04\x08\x02\x07\x01\x12\x037\x1b*\n\x0c\n\x05\ + \x04\x08\x02\x07\x03\x12\x03767\n\x0b\n\x04\x04\x08\x02\x08\x12\x038\x04\ + 8\n\x0c\n\x05\x04\x08\x02\x08\x04\x12\x038\x04\x0c\n\x0c\n\x05\x04\x08\ + \x02\x08\x06\x12\x038\r\x1e\n\x0c\n\x05\x04\x08\x02\x08\x01\x12\x038\x1f\ + 3\n\x0c\n\x05\x04\x08\x02\x08\x03\x12\x03867\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/src/kvrpcpb.rs b/_vendor/src/github.com/pingcap/kvproto/src/kvrpcpb.rs new file mode 100644 index 00000000000..131f66d65dc --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/src/kvrpcpb.rs @@ -0,0 +1,13213 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy)] + +#![cfg_attr(rustfmt, rustfmt_skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(PartialEq,Clone,Default)] +pub struct LockInfo { + // message fields + pub primary_lock: ::std::vec::Vec, + pub lock_version: u64, + pub key: ::std::vec::Vec, + pub lock_ttl: u64, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for LockInfo {} + +impl LockInfo { + pub fn new() -> LockInfo { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static LockInfo { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const LockInfo, + }; + unsafe { + instance.get(LockInfo::new) + } + } + + // bytes primary_lock = 1; + + pub fn clear_primary_lock(&mut self) { + self.primary_lock.clear(); + } + + // Param is passed by value, moved + pub fn set_primary_lock(&mut self, v: ::std::vec::Vec) { + self.primary_lock = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_primary_lock(&mut self) -> &mut ::std::vec::Vec { + &mut self.primary_lock + } + + // Take field + pub fn take_primary_lock(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.primary_lock, ::std::vec::Vec::new()) + } + + pub fn get_primary_lock(&self) -> &[u8] { + &self.primary_lock + } + + fn get_primary_lock_for_reflect(&self) -> &::std::vec::Vec { + &self.primary_lock + } + + fn mut_primary_lock_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.primary_lock + } + + // uint64 lock_version = 2; + + pub fn clear_lock_version(&mut self) { + self.lock_version = 0; + } + + // Param is passed by value, moved + pub fn set_lock_version(&mut self, v: u64) { + self.lock_version = v; + } + + pub fn get_lock_version(&self) -> u64 { + self.lock_version + } + + fn get_lock_version_for_reflect(&self) -> &u64 { + &self.lock_version + } + + fn mut_lock_version_for_reflect(&mut self) -> &mut u64 { + &mut self.lock_version + } + + // bytes key = 3; + + pub fn clear_key(&mut self) { + self.key.clear(); + } + + // Param is passed by value, moved + pub fn set_key(&mut self, v: ::std::vec::Vec) { + self.key = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { + &mut self.key + } + + // Take field + pub fn take_key(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) + } + + pub fn get_key(&self) -> &[u8] { + &self.key + } + + fn get_key_for_reflect(&self) -> &::std::vec::Vec { + &self.key + } + + fn mut_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.key + } + + // uint64 lock_ttl = 4; + + pub fn clear_lock_ttl(&mut self) { + self.lock_ttl = 0; + } + + // Param is passed by value, moved + pub fn set_lock_ttl(&mut self, v: u64) { + self.lock_ttl = v; + } + + pub fn get_lock_ttl(&self) -> u64 { + self.lock_ttl + } + + fn get_lock_ttl_for_reflect(&self) -> &u64 { + &self.lock_ttl + } + + fn mut_lock_ttl_for_reflect(&mut self) -> &mut u64 { + &mut self.lock_ttl + } +} + +impl ::protobuf::Message for LockInfo { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.primary_lock)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.lock_version = tmp; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.lock_ttl = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.primary_lock.is_empty() { + my_size += ::protobuf::rt::bytes_size(1, &self.primary_lock); + } + if self.lock_version != 0 { + my_size += ::protobuf::rt::value_size(2, self.lock_version, ::protobuf::wire_format::WireTypeVarint); + } + if !self.key.is_empty() { + my_size += ::protobuf::rt::bytes_size(3, &self.key); + } + if self.lock_ttl != 0 { + my_size += ::protobuf::rt::value_size(4, self.lock_ttl, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.primary_lock.is_empty() { + os.write_bytes(1, &self.primary_lock)?; + } + if self.lock_version != 0 { + os.write_uint64(2, self.lock_version)?; + } + if !self.key.is_empty() { + os.write_bytes(3, &self.key)?; + } + if self.lock_ttl != 0 { + os.write_uint64(4, self.lock_ttl)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for LockInfo { + fn new() -> LockInfo { + LockInfo::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "primary_lock", + LockInfo::get_primary_lock_for_reflect, + LockInfo::mut_primary_lock_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "lock_version", + LockInfo::get_lock_version_for_reflect, + LockInfo::mut_lock_version_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "key", + LockInfo::get_key_for_reflect, + LockInfo::mut_key_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "lock_ttl", + LockInfo::get_lock_ttl_for_reflect, + LockInfo::mut_lock_ttl_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "LockInfo", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for LockInfo { + fn clear(&mut self) { + self.clear_primary_lock(); + self.clear_lock_version(); + self.clear_key(); + self.clear_lock_ttl(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for LockInfo { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LockInfo { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct KeyError { + // message fields + pub locked: ::protobuf::SingularPtrField, + pub retryable: ::std::string::String, + pub abort: ::std::string::String, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for KeyError {} + +impl KeyError { + pub fn new() -> KeyError { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static KeyError { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const KeyError, + }; + unsafe { + instance.get(KeyError::new) + } + } + + // .kvrpcpb.LockInfo locked = 1; + + pub fn clear_locked(&mut self) { + self.locked.clear(); + } + + pub fn has_locked(&self) -> bool { + self.locked.is_some() + } + + // Param is passed by value, moved + pub fn set_locked(&mut self, v: LockInfo) { + self.locked = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_locked(&mut self) -> &mut LockInfo { + if self.locked.is_none() { + self.locked.set_default(); + } + self.locked.as_mut().unwrap() + } + + // Take field + pub fn take_locked(&mut self) -> LockInfo { + self.locked.take().unwrap_or_else(|| LockInfo::new()) + } + + pub fn get_locked(&self) -> &LockInfo { + self.locked.as_ref().unwrap_or_else(|| LockInfo::default_instance()) + } + + fn get_locked_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.locked + } + + fn mut_locked_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.locked + } + + // string retryable = 2; + + pub fn clear_retryable(&mut self) { + self.retryable.clear(); + } + + // Param is passed by value, moved + pub fn set_retryable(&mut self, v: ::std::string::String) { + self.retryable = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_retryable(&mut self) -> &mut ::std::string::String { + &mut self.retryable + } + + // Take field + pub fn take_retryable(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.retryable, ::std::string::String::new()) + } + + pub fn get_retryable(&self) -> &str { + &self.retryable + } + + fn get_retryable_for_reflect(&self) -> &::std::string::String { + &self.retryable + } + + fn mut_retryable_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.retryable + } + + // string abort = 3; + + pub fn clear_abort(&mut self) { + self.abort.clear(); + } + + // Param is passed by value, moved + pub fn set_abort(&mut self, v: ::std::string::String) { + self.abort = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_abort(&mut self) -> &mut ::std::string::String { + &mut self.abort + } + + // Take field + pub fn take_abort(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.abort, ::std::string::String::new()) + } + + pub fn get_abort(&self) -> &str { + &self.abort + } + + fn get_abort_for_reflect(&self) -> &::std::string::String { + &self.abort + } + + fn mut_abort_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.abort + } +} + +impl ::protobuf::Message for KeyError { + fn is_initialized(&self) -> bool { + for v in &self.locked { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.locked)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.retryable)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.abort)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.locked.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.retryable.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.retryable); + } + if !self.abort.is_empty() { + my_size += ::protobuf::rt::string_size(3, &self.abort); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.locked.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.retryable.is_empty() { + os.write_string(2, &self.retryable)?; + } + if !self.abort.is_empty() { + os.write_string(3, &self.abort)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for KeyError { + fn new() -> KeyError { + KeyError::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "locked", + KeyError::get_locked_for_reflect, + KeyError::mut_locked_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "retryable", + KeyError::get_retryable_for_reflect, + KeyError::mut_retryable_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "abort", + KeyError::get_abort_for_reflect, + KeyError::mut_abort_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "KeyError", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for KeyError { + fn clear(&mut self) { + self.clear_locked(); + self.clear_retryable(); + self.clear_abort(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for KeyError { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for KeyError { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Context { + // message fields + pub region_id: u64, + pub region_epoch: ::protobuf::SingularPtrField, + pub peer: ::protobuf::SingularPtrField, + pub term: u64, + pub priority: CommandPri, + pub isolation_level: IsolationLevel, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Context {} + +impl Context { + pub fn new() -> Context { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static Context { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Context, + }; + unsafe { + instance.get(Context::new) + } + } + + // uint64 region_id = 1; + + pub fn clear_region_id(&mut self) { + self.region_id = 0; + } + + // Param is passed by value, moved + pub fn set_region_id(&mut self, v: u64) { + self.region_id = v; + } + + pub fn get_region_id(&self) -> u64 { + self.region_id + } + + fn get_region_id_for_reflect(&self) -> &u64 { + &self.region_id + } + + fn mut_region_id_for_reflect(&mut self) -> &mut u64 { + &mut self.region_id + } + + // .metapb.RegionEpoch region_epoch = 2; + + pub fn clear_region_epoch(&mut self) { + self.region_epoch.clear(); + } + + pub fn has_region_epoch(&self) -> bool { + self.region_epoch.is_some() + } + + // Param is passed by value, moved + pub fn set_region_epoch(&mut self, v: super::metapb::RegionEpoch) { + self.region_epoch = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_epoch(&mut self) -> &mut super::metapb::RegionEpoch { + if self.region_epoch.is_none() { + self.region_epoch.set_default(); + } + self.region_epoch.as_mut().unwrap() + } + + // Take field + pub fn take_region_epoch(&mut self) -> super::metapb::RegionEpoch { + self.region_epoch.take().unwrap_or_else(|| super::metapb::RegionEpoch::new()) + } + + pub fn get_region_epoch(&self) -> &super::metapb::RegionEpoch { + self.region_epoch.as_ref().unwrap_or_else(|| super::metapb::RegionEpoch::default_instance()) + } + + fn get_region_epoch_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_epoch + } + + fn mut_region_epoch_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_epoch + } + + // .metapb.Peer peer = 3; + + pub fn clear_peer(&mut self) { + self.peer.clear(); + } + + pub fn has_peer(&self) -> bool { + self.peer.is_some() + } + + // Param is passed by value, moved + pub fn set_peer(&mut self, v: super::metapb::Peer) { + self.peer = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_peer(&mut self) -> &mut super::metapb::Peer { + if self.peer.is_none() { + self.peer.set_default(); + } + self.peer.as_mut().unwrap() + } + + // Take field + pub fn take_peer(&mut self) -> super::metapb::Peer { + self.peer.take().unwrap_or_else(|| super::metapb::Peer::new()) + } + + pub fn get_peer(&self) -> &super::metapb::Peer { + self.peer.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) + } + + fn get_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.peer + } + + fn mut_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.peer + } + + // uint64 term = 5; + + pub fn clear_term(&mut self) { + self.term = 0; + } + + // Param is passed by value, moved + pub fn set_term(&mut self, v: u64) { + self.term = v; + } + + pub fn get_term(&self) -> u64 { + self.term + } + + fn get_term_for_reflect(&self) -> &u64 { + &self.term + } + + fn mut_term_for_reflect(&mut self) -> &mut u64 { + &mut self.term + } + + // .kvrpcpb.CommandPri priority = 6; + + pub fn clear_priority(&mut self) { + self.priority = CommandPri::Normal; + } + + // Param is passed by value, moved + pub fn set_priority(&mut self, v: CommandPri) { + self.priority = v; + } + + pub fn get_priority(&self) -> CommandPri { + self.priority + } + + fn get_priority_for_reflect(&self) -> &CommandPri { + &self.priority + } + + fn mut_priority_for_reflect(&mut self) -> &mut CommandPri { + &mut self.priority + } + + // .kvrpcpb.IsolationLevel isolation_level = 7; + + pub fn clear_isolation_level(&mut self) { + self.isolation_level = IsolationLevel::SI; + } + + // Param is passed by value, moved + pub fn set_isolation_level(&mut self, v: IsolationLevel) { + self.isolation_level = v; + } + + pub fn get_isolation_level(&self) -> IsolationLevel { + self.isolation_level + } + + fn get_isolation_level_for_reflect(&self) -> &IsolationLevel { + &self.isolation_level + } + + fn mut_isolation_level_for_reflect(&mut self) -> &mut IsolationLevel { + &mut self.isolation_level + } +} + +impl ::protobuf::Message for Context { + fn is_initialized(&self) -> bool { + for v in &self.region_epoch { + if !v.is_initialized() { + return false; + } + }; + for v in &self.peer { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.region_id = tmp; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_epoch)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.peer)?; + }, + 5 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.term = tmp; + }, + 6 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_enum()?; + self.priority = tmp; + }, + 7 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_enum()?; + self.isolation_level = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.region_id != 0 { + my_size += ::protobuf::rt::value_size(1, self.region_id, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.region_epoch.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.peer.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.term != 0 { + my_size += ::protobuf::rt::value_size(5, self.term, ::protobuf::wire_format::WireTypeVarint); + } + if self.priority != CommandPri::Normal { + my_size += ::protobuf::rt::enum_size(6, self.priority); + } + if self.isolation_level != IsolationLevel::SI { + my_size += ::protobuf::rt::enum_size(7, self.isolation_level); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.region_id != 0 { + os.write_uint64(1, self.region_id)?; + } + if let Some(ref v) = self.region_epoch.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.peer.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.term != 0 { + os.write_uint64(5, self.term)?; + } + if self.priority != CommandPri::Normal { + os.write_enum(6, self.priority.value())?; + } + if self.isolation_level != IsolationLevel::SI { + os.write_enum(7, self.isolation_level.value())?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for Context { + fn new() -> Context { + Context::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "region_id", + Context::get_region_id_for_reflect, + Context::mut_region_id_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_epoch", + Context::get_region_epoch_for_reflect, + Context::mut_region_epoch_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "peer", + Context::get_peer_for_reflect, + Context::mut_peer_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "term", + Context::get_term_for_reflect, + Context::mut_term_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "priority", + Context::get_priority_for_reflect, + Context::mut_priority_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "isolation_level", + Context::get_isolation_level_for_reflect, + Context::mut_isolation_level_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Context", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for Context { + fn clear(&mut self) { + self.clear_region_id(); + self.clear_region_epoch(); + self.clear_peer(); + self.clear_term(); + self.clear_priority(); + self.clear_isolation_level(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Context { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Context { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct GetRequest { + // message fields + pub context: ::protobuf::SingularPtrField, + pub key: ::std::vec::Vec, + pub version: u64, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for GetRequest {} + +impl GetRequest { + pub fn new() -> GetRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static GetRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const GetRequest, + }; + unsafe { + instance.get(GetRequest::new) + } + } + + // .kvrpcpb.Context context = 1; + + pub fn clear_context(&mut self) { + self.context.clear(); + } + + pub fn has_context(&self) -> bool { + self.context.is_some() + } + + // Param is passed by value, moved + pub fn set_context(&mut self, v: Context) { + self.context = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_context(&mut self) -> &mut Context { + if self.context.is_none() { + self.context.set_default(); + } + self.context.as_mut().unwrap() + } + + // Take field + pub fn take_context(&mut self) -> Context { + self.context.take().unwrap_or_else(|| Context::new()) + } + + pub fn get_context(&self) -> &Context { + self.context.as_ref().unwrap_or_else(|| Context::default_instance()) + } + + fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.context + } + + fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.context + } + + // bytes key = 2; + + pub fn clear_key(&mut self) { + self.key.clear(); + } + + // Param is passed by value, moved + pub fn set_key(&mut self, v: ::std::vec::Vec) { + self.key = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { + &mut self.key + } + + // Take field + pub fn take_key(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) + } + + pub fn get_key(&self) -> &[u8] { + &self.key + } + + fn get_key_for_reflect(&self) -> &::std::vec::Vec { + &self.key + } + + fn mut_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.key + } + + // uint64 version = 3; + + pub fn clear_version(&mut self) { + self.version = 0; + } + + // Param is passed by value, moved + pub fn set_version(&mut self, v: u64) { + self.version = v; + } + + pub fn get_version(&self) -> u64 { + self.version + } + + fn get_version_for_reflect(&self) -> &u64 { + &self.version + } + + fn mut_version_for_reflect(&mut self) -> &mut u64 { + &mut self.version + } +} + +impl ::protobuf::Message for GetRequest { + fn is_initialized(&self) -> bool { + for v in &self.context { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.version = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.context.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.key.is_empty() { + my_size += ::protobuf::rt::bytes_size(2, &self.key); + } + if self.version != 0 { + my_size += ::protobuf::rt::value_size(3, self.version, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.context.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.key.is_empty() { + os.write_bytes(2, &self.key)?; + } + if self.version != 0 { + os.write_uint64(3, self.version)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for GetRequest { + fn new() -> GetRequest { + GetRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "context", + GetRequest::get_context_for_reflect, + GetRequest::mut_context_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "key", + GetRequest::get_key_for_reflect, + GetRequest::mut_key_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "version", + GetRequest::get_version_for_reflect, + GetRequest::mut_version_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "GetRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for GetRequest { + fn clear(&mut self) { + self.clear_context(); + self.clear_key(); + self.clear_version(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for GetRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct GetResponse { + // message fields + pub region_error: ::protobuf::SingularPtrField, + pub error: ::protobuf::SingularPtrField, + pub value: ::std::vec::Vec, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for GetResponse {} + +impl GetResponse { + pub fn new() -> GetResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static GetResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const GetResponse, + }; + unsafe { + instance.get(GetResponse::new) + } + } + + // .errorpb.Error region_error = 1; + + pub fn clear_region_error(&mut self) { + self.region_error.clear(); + } + + pub fn has_region_error(&self) -> bool { + self.region_error.is_some() + } + + // Param is passed by value, moved + pub fn set_region_error(&mut self, v: super::errorpb::Error) { + self.region_error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { + if self.region_error.is_none() { + self.region_error.set_default(); + } + self.region_error.as_mut().unwrap() + } + + // Take field + pub fn take_region_error(&mut self) -> super::errorpb::Error { + self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) + } + + pub fn get_region_error(&self) -> &super::errorpb::Error { + self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) + } + + fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_error + } + + fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_error + } + + // .kvrpcpb.KeyError error = 2; + + pub fn clear_error(&mut self) { + self.error.clear(); + } + + pub fn has_error(&self) -> bool { + self.error.is_some() + } + + // Param is passed by value, moved + pub fn set_error(&mut self, v: KeyError) { + self.error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_error(&mut self) -> &mut KeyError { + if self.error.is_none() { + self.error.set_default(); + } + self.error.as_mut().unwrap() + } + + // Take field + pub fn take_error(&mut self) -> KeyError { + self.error.take().unwrap_or_else(|| KeyError::new()) + } + + pub fn get_error(&self) -> &KeyError { + self.error.as_ref().unwrap_or_else(|| KeyError::default_instance()) + } + + fn get_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.error + } + + fn mut_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.error + } + + // bytes value = 3; + + pub fn clear_value(&mut self) { + self.value.clear(); + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: ::std::vec::Vec) { + self.value = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { + &mut self.value + } + + // Take field + pub fn take_value(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.value, ::std::vec::Vec::new()) + } + + pub fn get_value(&self) -> &[u8] { + &self.value + } + + fn get_value_for_reflect(&self) -> &::std::vec::Vec { + &self.value + } + + fn mut_value_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.value + } +} + +impl ::protobuf::Message for GetResponse { + fn is_initialized(&self) -> bool { + for v in &self.region_error { + if !v.is_initialized() { + return false; + } + }; + for v in &self.error { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.error)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.value)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.region_error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.value.is_empty() { + my_size += ::protobuf::rt::bytes_size(3, &self.value); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.region_error.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.error.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.value.is_empty() { + os.write_bytes(3, &self.value)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for GetResponse { + fn new() -> GetResponse { + GetResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_error", + GetResponse::get_region_error_for_reflect, + GetResponse::mut_region_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "error", + GetResponse::get_error_for_reflect, + GetResponse::mut_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "value", + GetResponse::get_value_for_reflect, + GetResponse::mut_value_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "GetResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for GetResponse { + fn clear(&mut self) { + self.clear_region_error(); + self.clear_error(); + self.clear_value(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for GetResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ScanRequest { + // message fields + pub context: ::protobuf::SingularPtrField, + pub start_key: ::std::vec::Vec, + pub limit: u32, + pub version: u64, + pub key_only: bool, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for ScanRequest {} + +impl ScanRequest { + pub fn new() -> ScanRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static ScanRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ScanRequest, + }; + unsafe { + instance.get(ScanRequest::new) + } + } + + // .kvrpcpb.Context context = 1; + + pub fn clear_context(&mut self) { + self.context.clear(); + } + + pub fn has_context(&self) -> bool { + self.context.is_some() + } + + // Param is passed by value, moved + pub fn set_context(&mut self, v: Context) { + self.context = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_context(&mut self) -> &mut Context { + if self.context.is_none() { + self.context.set_default(); + } + self.context.as_mut().unwrap() + } + + // Take field + pub fn take_context(&mut self) -> Context { + self.context.take().unwrap_or_else(|| Context::new()) + } + + pub fn get_context(&self) -> &Context { + self.context.as_ref().unwrap_or_else(|| Context::default_instance()) + } + + fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.context + } + + fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.context + } + + // bytes start_key = 2; + + pub fn clear_start_key(&mut self) { + self.start_key.clear(); + } + + // Param is passed by value, moved + pub fn set_start_key(&mut self, v: ::std::vec::Vec) { + self.start_key = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_start_key(&mut self) -> &mut ::std::vec::Vec { + &mut self.start_key + } + + // Take field + pub fn take_start_key(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.start_key, ::std::vec::Vec::new()) + } + + pub fn get_start_key(&self) -> &[u8] { + &self.start_key + } + + fn get_start_key_for_reflect(&self) -> &::std::vec::Vec { + &self.start_key + } + + fn mut_start_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.start_key + } + + // uint32 limit = 3; + + pub fn clear_limit(&mut self) { + self.limit = 0; + } + + // Param is passed by value, moved + pub fn set_limit(&mut self, v: u32) { + self.limit = v; + } + + pub fn get_limit(&self) -> u32 { + self.limit + } + + fn get_limit_for_reflect(&self) -> &u32 { + &self.limit + } + + fn mut_limit_for_reflect(&mut self) -> &mut u32 { + &mut self.limit + } + + // uint64 version = 4; + + pub fn clear_version(&mut self) { + self.version = 0; + } + + // Param is passed by value, moved + pub fn set_version(&mut self, v: u64) { + self.version = v; + } + + pub fn get_version(&self) -> u64 { + self.version + } + + fn get_version_for_reflect(&self) -> &u64 { + &self.version + } + + fn mut_version_for_reflect(&mut self) -> &mut u64 { + &mut self.version + } + + // bool key_only = 5; + + pub fn clear_key_only(&mut self) { + self.key_only = false; + } + + // Param is passed by value, moved + pub fn set_key_only(&mut self, v: bool) { + self.key_only = v; + } + + pub fn get_key_only(&self) -> bool { + self.key_only + } + + fn get_key_only_for_reflect(&self) -> &bool { + &self.key_only + } + + fn mut_key_only_for_reflect(&mut self) -> &mut bool { + &mut self.key_only + } +} + +impl ::protobuf::Message for ScanRequest { + fn is_initialized(&self) -> bool { + for v in &self.context { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.start_key)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.limit = tmp; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.version = tmp; + }, + 5 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.key_only = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.context.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.start_key.is_empty() { + my_size += ::protobuf::rt::bytes_size(2, &self.start_key); + } + if self.limit != 0 { + my_size += ::protobuf::rt::value_size(3, self.limit, ::protobuf::wire_format::WireTypeVarint); + } + if self.version != 0 { + my_size += ::protobuf::rt::value_size(4, self.version, ::protobuf::wire_format::WireTypeVarint); + } + if self.key_only != false { + my_size += 2; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.context.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.start_key.is_empty() { + os.write_bytes(2, &self.start_key)?; + } + if self.limit != 0 { + os.write_uint32(3, self.limit)?; + } + if self.version != 0 { + os.write_uint64(4, self.version)?; + } + if self.key_only != false { + os.write_bool(5, self.key_only)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for ScanRequest { + fn new() -> ScanRequest { + ScanRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "context", + ScanRequest::get_context_for_reflect, + ScanRequest::mut_context_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "start_key", + ScanRequest::get_start_key_for_reflect, + ScanRequest::mut_start_key_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "limit", + ScanRequest::get_limit_for_reflect, + ScanRequest::mut_limit_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "version", + ScanRequest::get_version_for_reflect, + ScanRequest::mut_version_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "key_only", + ScanRequest::get_key_only_for_reflect, + ScanRequest::mut_key_only_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ScanRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for ScanRequest { + fn clear(&mut self) { + self.clear_context(); + self.clear_start_key(); + self.clear_limit(); + self.clear_version(); + self.clear_key_only(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ScanRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ScanRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct KvPair { + // message fields + pub error: ::protobuf::SingularPtrField, + pub key: ::std::vec::Vec, + pub value: ::std::vec::Vec, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for KvPair {} + +impl KvPair { + pub fn new() -> KvPair { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static KvPair { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const KvPair, + }; + unsafe { + instance.get(KvPair::new) + } + } + + // .kvrpcpb.KeyError error = 1; + + pub fn clear_error(&mut self) { + self.error.clear(); + } + + pub fn has_error(&self) -> bool { + self.error.is_some() + } + + // Param is passed by value, moved + pub fn set_error(&mut self, v: KeyError) { + self.error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_error(&mut self) -> &mut KeyError { + if self.error.is_none() { + self.error.set_default(); + } + self.error.as_mut().unwrap() + } + + // Take field + pub fn take_error(&mut self) -> KeyError { + self.error.take().unwrap_or_else(|| KeyError::new()) + } + + pub fn get_error(&self) -> &KeyError { + self.error.as_ref().unwrap_or_else(|| KeyError::default_instance()) + } + + fn get_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.error + } + + fn mut_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.error + } + + // bytes key = 2; + + pub fn clear_key(&mut self) { + self.key.clear(); + } + + // Param is passed by value, moved + pub fn set_key(&mut self, v: ::std::vec::Vec) { + self.key = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { + &mut self.key + } + + // Take field + pub fn take_key(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) + } + + pub fn get_key(&self) -> &[u8] { + &self.key + } + + fn get_key_for_reflect(&self) -> &::std::vec::Vec { + &self.key + } + + fn mut_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.key + } + + // bytes value = 3; + + pub fn clear_value(&mut self) { + self.value.clear(); + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: ::std::vec::Vec) { + self.value = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { + &mut self.value + } + + // Take field + pub fn take_value(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.value, ::std::vec::Vec::new()) + } + + pub fn get_value(&self) -> &[u8] { + &self.value + } + + fn get_value_for_reflect(&self) -> &::std::vec::Vec { + &self.value + } + + fn mut_value_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.value + } +} + +impl ::protobuf::Message for KvPair { + fn is_initialized(&self) -> bool { + for v in &self.error { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.error)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.value)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.key.is_empty() { + my_size += ::protobuf::rt::bytes_size(2, &self.key); + } + if !self.value.is_empty() { + my_size += ::protobuf::rt::bytes_size(3, &self.value); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.error.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.key.is_empty() { + os.write_bytes(2, &self.key)?; + } + if !self.value.is_empty() { + os.write_bytes(3, &self.value)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for KvPair { + fn new() -> KvPair { + KvPair::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "error", + KvPair::get_error_for_reflect, + KvPair::mut_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "key", + KvPair::get_key_for_reflect, + KvPair::mut_key_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "value", + KvPair::get_value_for_reflect, + KvPair::mut_value_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "KvPair", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for KvPair { + fn clear(&mut self) { + self.clear_error(); + self.clear_key(); + self.clear_value(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for KvPair { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for KvPair { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ScanResponse { + // message fields + pub region_error: ::protobuf::SingularPtrField, + pub pairs: ::protobuf::RepeatedField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for ScanResponse {} + +impl ScanResponse { + pub fn new() -> ScanResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static ScanResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ScanResponse, + }; + unsafe { + instance.get(ScanResponse::new) + } + } + + // .errorpb.Error region_error = 1; + + pub fn clear_region_error(&mut self) { + self.region_error.clear(); + } + + pub fn has_region_error(&self) -> bool { + self.region_error.is_some() + } + + // Param is passed by value, moved + pub fn set_region_error(&mut self, v: super::errorpb::Error) { + self.region_error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { + if self.region_error.is_none() { + self.region_error.set_default(); + } + self.region_error.as_mut().unwrap() + } + + // Take field + pub fn take_region_error(&mut self) -> super::errorpb::Error { + self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) + } + + pub fn get_region_error(&self) -> &super::errorpb::Error { + self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) + } + + fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_error + } + + fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_error + } + + // repeated .kvrpcpb.KvPair pairs = 2; + + pub fn clear_pairs(&mut self) { + self.pairs.clear(); + } + + // Param is passed by value, moved + pub fn set_pairs(&mut self, v: ::protobuf::RepeatedField) { + self.pairs = v; + } + + // Mutable pointer to the field. + pub fn mut_pairs(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.pairs + } + + // Take field + pub fn take_pairs(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.pairs, ::protobuf::RepeatedField::new()) + } + + pub fn get_pairs(&self) -> &[KvPair] { + &self.pairs + } + + fn get_pairs_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.pairs + } + + fn mut_pairs_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.pairs + } +} + +impl ::protobuf::Message for ScanResponse { + fn is_initialized(&self) -> bool { + for v in &self.region_error { + if !v.is_initialized() { + return false; + } + }; + for v in &self.pairs { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; + }, + 2 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.pairs)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.region_error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + for value in &self.pairs { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.region_error.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + for v in &self.pairs { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for ScanResponse { + fn new() -> ScanResponse { + ScanResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_error", + ScanResponse::get_region_error_for_reflect, + ScanResponse::mut_region_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "pairs", + ScanResponse::get_pairs_for_reflect, + ScanResponse::mut_pairs_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ScanResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for ScanResponse { + fn clear(&mut self) { + self.clear_region_error(); + self.clear_pairs(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ScanResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ScanResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Mutation { + // message fields + pub op: Op, + pub key: ::std::vec::Vec, + pub value: ::std::vec::Vec, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Mutation {} + +impl Mutation { + pub fn new() -> Mutation { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static Mutation { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Mutation, + }; + unsafe { + instance.get(Mutation::new) + } + } + + // .kvrpcpb.Op op = 1; + + pub fn clear_op(&mut self) { + self.op = Op::Put; + } + + // Param is passed by value, moved + pub fn set_op(&mut self, v: Op) { + self.op = v; + } + + pub fn get_op(&self) -> Op { + self.op + } + + fn get_op_for_reflect(&self) -> &Op { + &self.op + } + + fn mut_op_for_reflect(&mut self) -> &mut Op { + &mut self.op + } + + // bytes key = 2; + + pub fn clear_key(&mut self) { + self.key.clear(); + } + + // Param is passed by value, moved + pub fn set_key(&mut self, v: ::std::vec::Vec) { + self.key = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { + &mut self.key + } + + // Take field + pub fn take_key(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) + } + + pub fn get_key(&self) -> &[u8] { + &self.key + } + + fn get_key_for_reflect(&self) -> &::std::vec::Vec { + &self.key + } + + fn mut_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.key + } + + // bytes value = 3; + + pub fn clear_value(&mut self) { + self.value.clear(); + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: ::std::vec::Vec) { + self.value = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { + &mut self.value + } + + // Take field + pub fn take_value(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.value, ::std::vec::Vec::new()) + } + + pub fn get_value(&self) -> &[u8] { + &self.value + } + + fn get_value_for_reflect(&self) -> &::std::vec::Vec { + &self.value + } + + fn mut_value_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.value + } +} + +impl ::protobuf::Message for Mutation { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_enum()?; + self.op = tmp; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.value)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.op != Op::Put { + my_size += ::protobuf::rt::enum_size(1, self.op); + } + if !self.key.is_empty() { + my_size += ::protobuf::rt::bytes_size(2, &self.key); + } + if !self.value.is_empty() { + my_size += ::protobuf::rt::bytes_size(3, &self.value); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.op != Op::Put { + os.write_enum(1, self.op.value())?; + } + if !self.key.is_empty() { + os.write_bytes(2, &self.key)?; + } + if !self.value.is_empty() { + os.write_bytes(3, &self.value)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for Mutation { + fn new() -> Mutation { + Mutation::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "op", + Mutation::get_op_for_reflect, + Mutation::mut_op_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "key", + Mutation::get_key_for_reflect, + Mutation::mut_key_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "value", + Mutation::get_value_for_reflect, + Mutation::mut_value_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Mutation", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for Mutation { + fn clear(&mut self) { + self.clear_op(); + self.clear_key(); + self.clear_value(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Mutation { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Mutation { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct PrewriteRequest { + // message fields + pub context: ::protobuf::SingularPtrField, + pub mutations: ::protobuf::RepeatedField, + pub primary_lock: ::std::vec::Vec, + pub start_version: u64, + pub lock_ttl: u64, + pub skip_constraint_check: bool, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for PrewriteRequest {} + +impl PrewriteRequest { + pub fn new() -> PrewriteRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static PrewriteRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const PrewriteRequest, + }; + unsafe { + instance.get(PrewriteRequest::new) + } + } + + // .kvrpcpb.Context context = 1; + + pub fn clear_context(&mut self) { + self.context.clear(); + } + + pub fn has_context(&self) -> bool { + self.context.is_some() + } + + // Param is passed by value, moved + pub fn set_context(&mut self, v: Context) { + self.context = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_context(&mut self) -> &mut Context { + if self.context.is_none() { + self.context.set_default(); + } + self.context.as_mut().unwrap() + } + + // Take field + pub fn take_context(&mut self) -> Context { + self.context.take().unwrap_or_else(|| Context::new()) + } + + pub fn get_context(&self) -> &Context { + self.context.as_ref().unwrap_or_else(|| Context::default_instance()) + } + + fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.context + } + + fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.context + } + + // repeated .kvrpcpb.Mutation mutations = 2; + + pub fn clear_mutations(&mut self) { + self.mutations.clear(); + } + + // Param is passed by value, moved + pub fn set_mutations(&mut self, v: ::protobuf::RepeatedField) { + self.mutations = v; + } + + // Mutable pointer to the field. + pub fn mut_mutations(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.mutations + } + + // Take field + pub fn take_mutations(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.mutations, ::protobuf::RepeatedField::new()) + } + + pub fn get_mutations(&self) -> &[Mutation] { + &self.mutations + } + + fn get_mutations_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.mutations + } + + fn mut_mutations_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.mutations + } + + // bytes primary_lock = 3; + + pub fn clear_primary_lock(&mut self) { + self.primary_lock.clear(); + } + + // Param is passed by value, moved + pub fn set_primary_lock(&mut self, v: ::std::vec::Vec) { + self.primary_lock = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_primary_lock(&mut self) -> &mut ::std::vec::Vec { + &mut self.primary_lock + } + + // Take field + pub fn take_primary_lock(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.primary_lock, ::std::vec::Vec::new()) + } + + pub fn get_primary_lock(&self) -> &[u8] { + &self.primary_lock + } + + fn get_primary_lock_for_reflect(&self) -> &::std::vec::Vec { + &self.primary_lock + } + + fn mut_primary_lock_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.primary_lock + } + + // uint64 start_version = 4; + + pub fn clear_start_version(&mut self) { + self.start_version = 0; + } + + // Param is passed by value, moved + pub fn set_start_version(&mut self, v: u64) { + self.start_version = v; + } + + pub fn get_start_version(&self) -> u64 { + self.start_version + } + + fn get_start_version_for_reflect(&self) -> &u64 { + &self.start_version + } + + fn mut_start_version_for_reflect(&mut self) -> &mut u64 { + &mut self.start_version + } + + // uint64 lock_ttl = 5; + + pub fn clear_lock_ttl(&mut self) { + self.lock_ttl = 0; + } + + // Param is passed by value, moved + pub fn set_lock_ttl(&mut self, v: u64) { + self.lock_ttl = v; + } + + pub fn get_lock_ttl(&self) -> u64 { + self.lock_ttl + } + + fn get_lock_ttl_for_reflect(&self) -> &u64 { + &self.lock_ttl + } + + fn mut_lock_ttl_for_reflect(&mut self) -> &mut u64 { + &mut self.lock_ttl + } + + // bool skip_constraint_check = 6; + + pub fn clear_skip_constraint_check(&mut self) { + self.skip_constraint_check = false; + } + + // Param is passed by value, moved + pub fn set_skip_constraint_check(&mut self, v: bool) { + self.skip_constraint_check = v; + } + + pub fn get_skip_constraint_check(&self) -> bool { + self.skip_constraint_check + } + + fn get_skip_constraint_check_for_reflect(&self) -> &bool { + &self.skip_constraint_check + } + + fn mut_skip_constraint_check_for_reflect(&mut self) -> &mut bool { + &mut self.skip_constraint_check + } +} + +impl ::protobuf::Message for PrewriteRequest { + fn is_initialized(&self) -> bool { + for v in &self.context { + if !v.is_initialized() { + return false; + } + }; + for v in &self.mutations { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; + }, + 2 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.mutations)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.primary_lock)?; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.start_version = tmp; + }, + 5 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.lock_ttl = tmp; + }, + 6 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.skip_constraint_check = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.context.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + for value in &self.mutations { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if !self.primary_lock.is_empty() { + my_size += ::protobuf::rt::bytes_size(3, &self.primary_lock); + } + if self.start_version != 0 { + my_size += ::protobuf::rt::value_size(4, self.start_version, ::protobuf::wire_format::WireTypeVarint); + } + if self.lock_ttl != 0 { + my_size += ::protobuf::rt::value_size(5, self.lock_ttl, ::protobuf::wire_format::WireTypeVarint); + } + if self.skip_constraint_check != false { + my_size += 2; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.context.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + for v in &self.mutations { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if !self.primary_lock.is_empty() { + os.write_bytes(3, &self.primary_lock)?; + } + if self.start_version != 0 { + os.write_uint64(4, self.start_version)?; + } + if self.lock_ttl != 0 { + os.write_uint64(5, self.lock_ttl)?; + } + if self.skip_constraint_check != false { + os.write_bool(6, self.skip_constraint_check)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for PrewriteRequest { + fn new() -> PrewriteRequest { + PrewriteRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "context", + PrewriteRequest::get_context_for_reflect, + PrewriteRequest::mut_context_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "mutations", + PrewriteRequest::get_mutations_for_reflect, + PrewriteRequest::mut_mutations_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "primary_lock", + PrewriteRequest::get_primary_lock_for_reflect, + PrewriteRequest::mut_primary_lock_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "start_version", + PrewriteRequest::get_start_version_for_reflect, + PrewriteRequest::mut_start_version_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "lock_ttl", + PrewriteRequest::get_lock_ttl_for_reflect, + PrewriteRequest::mut_lock_ttl_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "skip_constraint_check", + PrewriteRequest::get_skip_constraint_check_for_reflect, + PrewriteRequest::mut_skip_constraint_check_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "PrewriteRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for PrewriteRequest { + fn clear(&mut self) { + self.clear_context(); + self.clear_mutations(); + self.clear_primary_lock(); + self.clear_start_version(); + self.clear_lock_ttl(); + self.clear_skip_constraint_check(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for PrewriteRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PrewriteRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct PrewriteResponse { + // message fields + pub region_error: ::protobuf::SingularPtrField, + pub errors: ::protobuf::RepeatedField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for PrewriteResponse {} + +impl PrewriteResponse { + pub fn new() -> PrewriteResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static PrewriteResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const PrewriteResponse, + }; + unsafe { + instance.get(PrewriteResponse::new) + } + } + + // .errorpb.Error region_error = 1; + + pub fn clear_region_error(&mut self) { + self.region_error.clear(); + } + + pub fn has_region_error(&self) -> bool { + self.region_error.is_some() + } + + // Param is passed by value, moved + pub fn set_region_error(&mut self, v: super::errorpb::Error) { + self.region_error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { + if self.region_error.is_none() { + self.region_error.set_default(); + } + self.region_error.as_mut().unwrap() + } + + // Take field + pub fn take_region_error(&mut self) -> super::errorpb::Error { + self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) + } + + pub fn get_region_error(&self) -> &super::errorpb::Error { + self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) + } + + fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_error + } + + fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_error + } + + // repeated .kvrpcpb.KeyError errors = 2; + + pub fn clear_errors(&mut self) { + self.errors.clear(); + } + + // Param is passed by value, moved + pub fn set_errors(&mut self, v: ::protobuf::RepeatedField) { + self.errors = v; + } + + // Mutable pointer to the field. + pub fn mut_errors(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.errors + } + + // Take field + pub fn take_errors(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.errors, ::protobuf::RepeatedField::new()) + } + + pub fn get_errors(&self) -> &[KeyError] { + &self.errors + } + + fn get_errors_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.errors + } + + fn mut_errors_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.errors + } +} + +impl ::protobuf::Message for PrewriteResponse { + fn is_initialized(&self) -> bool { + for v in &self.region_error { + if !v.is_initialized() { + return false; + } + }; + for v in &self.errors { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; + }, + 2 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.errors)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.region_error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + for value in &self.errors { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.region_error.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + for v in &self.errors { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for PrewriteResponse { + fn new() -> PrewriteResponse { + PrewriteResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_error", + PrewriteResponse::get_region_error_for_reflect, + PrewriteResponse::mut_region_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "errors", + PrewriteResponse::get_errors_for_reflect, + PrewriteResponse::mut_errors_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "PrewriteResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for PrewriteResponse { + fn clear(&mut self) { + self.clear_region_error(); + self.clear_errors(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for PrewriteResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PrewriteResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct CommitRequest { + // message fields + pub context: ::protobuf::SingularPtrField, + pub start_version: u64, + pub keys: ::protobuf::RepeatedField<::std::vec::Vec>, + pub commit_version: u64, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for CommitRequest {} + +impl CommitRequest { + pub fn new() -> CommitRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static CommitRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const CommitRequest, + }; + unsafe { + instance.get(CommitRequest::new) + } + } + + // .kvrpcpb.Context context = 1; + + pub fn clear_context(&mut self) { + self.context.clear(); + } + + pub fn has_context(&self) -> bool { + self.context.is_some() + } + + // Param is passed by value, moved + pub fn set_context(&mut self, v: Context) { + self.context = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_context(&mut self) -> &mut Context { + if self.context.is_none() { + self.context.set_default(); + } + self.context.as_mut().unwrap() + } + + // Take field + pub fn take_context(&mut self) -> Context { + self.context.take().unwrap_or_else(|| Context::new()) + } + + pub fn get_context(&self) -> &Context { + self.context.as_ref().unwrap_or_else(|| Context::default_instance()) + } + + fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.context + } + + fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.context + } + + // uint64 start_version = 2; + + pub fn clear_start_version(&mut self) { + self.start_version = 0; + } + + // Param is passed by value, moved + pub fn set_start_version(&mut self, v: u64) { + self.start_version = v; + } + + pub fn get_start_version(&self) -> u64 { + self.start_version + } + + fn get_start_version_for_reflect(&self) -> &u64 { + &self.start_version + } + + fn mut_start_version_for_reflect(&mut self) -> &mut u64 { + &mut self.start_version + } + + // repeated bytes keys = 3; + + pub fn clear_keys(&mut self) { + self.keys.clear(); + } + + // Param is passed by value, moved + pub fn set_keys(&mut self, v: ::protobuf::RepeatedField<::std::vec::Vec>) { + self.keys = v; + } + + // Mutable pointer to the field. + pub fn mut_keys(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { + &mut self.keys + } + + // Take field + pub fn take_keys(&mut self) -> ::protobuf::RepeatedField<::std::vec::Vec> { + ::std::mem::replace(&mut self.keys, ::protobuf::RepeatedField::new()) + } + + pub fn get_keys(&self) -> &[::std::vec::Vec] { + &self.keys + } + + fn get_keys_for_reflect(&self) -> &::protobuf::RepeatedField<::std::vec::Vec> { + &self.keys + } + + fn mut_keys_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { + &mut self.keys + } + + // uint64 commit_version = 4; + + pub fn clear_commit_version(&mut self) { + self.commit_version = 0; + } + + // Param is passed by value, moved + pub fn set_commit_version(&mut self, v: u64) { + self.commit_version = v; + } + + pub fn get_commit_version(&self) -> u64 { + self.commit_version + } + + fn get_commit_version_for_reflect(&self) -> &u64 { + &self.commit_version + } + + fn mut_commit_version_for_reflect(&mut self) -> &mut u64 { + &mut self.commit_version + } +} + +impl ::protobuf::Message for CommitRequest { + fn is_initialized(&self) -> bool { + for v in &self.context { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.start_version = tmp; + }, + 3 => { + ::protobuf::rt::read_repeated_bytes_into(wire_type, is, &mut self.keys)?; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.commit_version = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.context.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.start_version != 0 { + my_size += ::protobuf::rt::value_size(2, self.start_version, ::protobuf::wire_format::WireTypeVarint); + } + for value in &self.keys { + my_size += ::protobuf::rt::bytes_size(3, &value); + }; + if self.commit_version != 0 { + my_size += ::protobuf::rt::value_size(4, self.commit_version, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.context.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.start_version != 0 { + os.write_uint64(2, self.start_version)?; + } + for v in &self.keys { + os.write_bytes(3, &v)?; + }; + if self.commit_version != 0 { + os.write_uint64(4, self.commit_version)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for CommitRequest { + fn new() -> CommitRequest { + CommitRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "context", + CommitRequest::get_context_for_reflect, + CommitRequest::mut_context_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "start_version", + CommitRequest::get_start_version_for_reflect, + CommitRequest::mut_start_version_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "keys", + CommitRequest::get_keys_for_reflect, + CommitRequest::mut_keys_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "commit_version", + CommitRequest::get_commit_version_for_reflect, + CommitRequest::mut_commit_version_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "CommitRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for CommitRequest { + fn clear(&mut self) { + self.clear_context(); + self.clear_start_version(); + self.clear_keys(); + self.clear_commit_version(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for CommitRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CommitRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct CommitResponse { + // message fields + pub region_error: ::protobuf::SingularPtrField, + pub error: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for CommitResponse {} + +impl CommitResponse { + pub fn new() -> CommitResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static CommitResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const CommitResponse, + }; + unsafe { + instance.get(CommitResponse::new) + } + } + + // .errorpb.Error region_error = 1; + + pub fn clear_region_error(&mut self) { + self.region_error.clear(); + } + + pub fn has_region_error(&self) -> bool { + self.region_error.is_some() + } + + // Param is passed by value, moved + pub fn set_region_error(&mut self, v: super::errorpb::Error) { + self.region_error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { + if self.region_error.is_none() { + self.region_error.set_default(); + } + self.region_error.as_mut().unwrap() + } + + // Take field + pub fn take_region_error(&mut self) -> super::errorpb::Error { + self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) + } + + pub fn get_region_error(&self) -> &super::errorpb::Error { + self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) + } + + fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_error + } + + fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_error + } + + // .kvrpcpb.KeyError error = 2; + + pub fn clear_error(&mut self) { + self.error.clear(); + } + + pub fn has_error(&self) -> bool { + self.error.is_some() + } + + // Param is passed by value, moved + pub fn set_error(&mut self, v: KeyError) { + self.error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_error(&mut self) -> &mut KeyError { + if self.error.is_none() { + self.error.set_default(); + } + self.error.as_mut().unwrap() + } + + // Take field + pub fn take_error(&mut self) -> KeyError { + self.error.take().unwrap_or_else(|| KeyError::new()) + } + + pub fn get_error(&self) -> &KeyError { + self.error.as_ref().unwrap_or_else(|| KeyError::default_instance()) + } + + fn get_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.error + } + + fn mut_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.error + } +} + +impl ::protobuf::Message for CommitResponse { + fn is_initialized(&self) -> bool { + for v in &self.region_error { + if !v.is_initialized() { + return false; + } + }; + for v in &self.error { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.error)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.region_error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.region_error.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.error.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for CommitResponse { + fn new() -> CommitResponse { + CommitResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_error", + CommitResponse::get_region_error_for_reflect, + CommitResponse::mut_region_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "error", + CommitResponse::get_error_for_reflect, + CommitResponse::mut_error_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "CommitResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for CommitResponse { + fn clear(&mut self) { + self.clear_region_error(); + self.clear_error(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for CommitResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CommitResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ImportRequest { + // message fields + pub mutations: ::protobuf::RepeatedField, + pub commit_version: u64, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for ImportRequest {} + +impl ImportRequest { + pub fn new() -> ImportRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static ImportRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ImportRequest, + }; + unsafe { + instance.get(ImportRequest::new) + } + } + + // repeated .kvrpcpb.Mutation mutations = 1; + + pub fn clear_mutations(&mut self) { + self.mutations.clear(); + } + + // Param is passed by value, moved + pub fn set_mutations(&mut self, v: ::protobuf::RepeatedField) { + self.mutations = v; + } + + // Mutable pointer to the field. + pub fn mut_mutations(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.mutations + } + + // Take field + pub fn take_mutations(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.mutations, ::protobuf::RepeatedField::new()) + } + + pub fn get_mutations(&self) -> &[Mutation] { + &self.mutations + } + + fn get_mutations_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.mutations + } + + fn mut_mutations_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.mutations + } + + // uint64 commit_version = 2; + + pub fn clear_commit_version(&mut self) { + self.commit_version = 0; + } + + // Param is passed by value, moved + pub fn set_commit_version(&mut self, v: u64) { + self.commit_version = v; + } + + pub fn get_commit_version(&self) -> u64 { + self.commit_version + } + + fn get_commit_version_for_reflect(&self) -> &u64 { + &self.commit_version + } + + fn mut_commit_version_for_reflect(&mut self) -> &mut u64 { + &mut self.commit_version + } +} + +impl ::protobuf::Message for ImportRequest { + fn is_initialized(&self) -> bool { + for v in &self.mutations { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.mutations)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.commit_version = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.mutations { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if self.commit_version != 0 { + my_size += ::protobuf::rt::value_size(2, self.commit_version, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + for v in &self.mutations { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if self.commit_version != 0 { + os.write_uint64(2, self.commit_version)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for ImportRequest { + fn new() -> ImportRequest { + ImportRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "mutations", + ImportRequest::get_mutations_for_reflect, + ImportRequest::mut_mutations_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "commit_version", + ImportRequest::get_commit_version_for_reflect, + ImportRequest::mut_commit_version_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ImportRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for ImportRequest { + fn clear(&mut self) { + self.clear_mutations(); + self.clear_commit_version(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ImportRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ImportRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ImportResponse { + // message fields + pub region_error: ::protobuf::SingularPtrField, + pub error: ::std::string::String, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for ImportResponse {} + +impl ImportResponse { + pub fn new() -> ImportResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static ImportResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ImportResponse, + }; + unsafe { + instance.get(ImportResponse::new) + } + } + + // .errorpb.Error region_error = 1; + + pub fn clear_region_error(&mut self) { + self.region_error.clear(); + } + + pub fn has_region_error(&self) -> bool { + self.region_error.is_some() + } + + // Param is passed by value, moved + pub fn set_region_error(&mut self, v: super::errorpb::Error) { + self.region_error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { + if self.region_error.is_none() { + self.region_error.set_default(); + } + self.region_error.as_mut().unwrap() + } + + // Take field + pub fn take_region_error(&mut self) -> super::errorpb::Error { + self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) + } + + pub fn get_region_error(&self) -> &super::errorpb::Error { + self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) + } + + fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_error + } + + fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_error + } + + // string error = 2; + + pub fn clear_error(&mut self) { + self.error.clear(); + } + + // Param is passed by value, moved + pub fn set_error(&mut self, v: ::std::string::String) { + self.error = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_error(&mut self) -> &mut ::std::string::String { + &mut self.error + } + + // Take field + pub fn take_error(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.error, ::std::string::String::new()) + } + + pub fn get_error(&self) -> &str { + &self.error + } + + fn get_error_for_reflect(&self) -> &::std::string::String { + &self.error + } + + fn mut_error_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.error + } +} + +impl ::protobuf::Message for ImportResponse { + fn is_initialized(&self) -> bool { + for v in &self.region_error { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.error)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.region_error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.error.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.error); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.region_error.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.error.is_empty() { + os.write_string(2, &self.error)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for ImportResponse { + fn new() -> ImportResponse { + ImportResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_error", + ImportResponse::get_region_error_for_reflect, + ImportResponse::mut_region_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "error", + ImportResponse::get_error_for_reflect, + ImportResponse::mut_error_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ImportResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for ImportResponse { + fn clear(&mut self) { + self.clear_region_error(); + self.clear_error(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ImportResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ImportResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct BatchRollbackRequest { + // message fields + pub context: ::protobuf::SingularPtrField, + pub start_version: u64, + pub keys: ::protobuf::RepeatedField<::std::vec::Vec>, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for BatchRollbackRequest {} + +impl BatchRollbackRequest { + pub fn new() -> BatchRollbackRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static BatchRollbackRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const BatchRollbackRequest, + }; + unsafe { + instance.get(BatchRollbackRequest::new) + } + } + + // .kvrpcpb.Context context = 1; + + pub fn clear_context(&mut self) { + self.context.clear(); + } + + pub fn has_context(&self) -> bool { + self.context.is_some() + } + + // Param is passed by value, moved + pub fn set_context(&mut self, v: Context) { + self.context = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_context(&mut self) -> &mut Context { + if self.context.is_none() { + self.context.set_default(); + } + self.context.as_mut().unwrap() + } + + // Take field + pub fn take_context(&mut self) -> Context { + self.context.take().unwrap_or_else(|| Context::new()) + } + + pub fn get_context(&self) -> &Context { + self.context.as_ref().unwrap_or_else(|| Context::default_instance()) + } + + fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.context + } + + fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.context + } + + // uint64 start_version = 2; + + pub fn clear_start_version(&mut self) { + self.start_version = 0; + } + + // Param is passed by value, moved + pub fn set_start_version(&mut self, v: u64) { + self.start_version = v; + } + + pub fn get_start_version(&self) -> u64 { + self.start_version + } + + fn get_start_version_for_reflect(&self) -> &u64 { + &self.start_version + } + + fn mut_start_version_for_reflect(&mut self) -> &mut u64 { + &mut self.start_version + } + + // repeated bytes keys = 3; + + pub fn clear_keys(&mut self) { + self.keys.clear(); + } + + // Param is passed by value, moved + pub fn set_keys(&mut self, v: ::protobuf::RepeatedField<::std::vec::Vec>) { + self.keys = v; + } + + // Mutable pointer to the field. + pub fn mut_keys(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { + &mut self.keys + } + + // Take field + pub fn take_keys(&mut self) -> ::protobuf::RepeatedField<::std::vec::Vec> { + ::std::mem::replace(&mut self.keys, ::protobuf::RepeatedField::new()) + } + + pub fn get_keys(&self) -> &[::std::vec::Vec] { + &self.keys + } + + fn get_keys_for_reflect(&self) -> &::protobuf::RepeatedField<::std::vec::Vec> { + &self.keys + } + + fn mut_keys_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { + &mut self.keys + } +} + +impl ::protobuf::Message for BatchRollbackRequest { + fn is_initialized(&self) -> bool { + for v in &self.context { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.start_version = tmp; + }, + 3 => { + ::protobuf::rt::read_repeated_bytes_into(wire_type, is, &mut self.keys)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.context.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.start_version != 0 { + my_size += ::protobuf::rt::value_size(2, self.start_version, ::protobuf::wire_format::WireTypeVarint); + } + for value in &self.keys { + my_size += ::protobuf::rt::bytes_size(3, &value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.context.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.start_version != 0 { + os.write_uint64(2, self.start_version)?; + } + for v in &self.keys { + os.write_bytes(3, &v)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for BatchRollbackRequest { + fn new() -> BatchRollbackRequest { + BatchRollbackRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "context", + BatchRollbackRequest::get_context_for_reflect, + BatchRollbackRequest::mut_context_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "start_version", + BatchRollbackRequest::get_start_version_for_reflect, + BatchRollbackRequest::mut_start_version_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "keys", + BatchRollbackRequest::get_keys_for_reflect, + BatchRollbackRequest::mut_keys_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "BatchRollbackRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for BatchRollbackRequest { + fn clear(&mut self) { + self.clear_context(); + self.clear_start_version(); + self.clear_keys(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for BatchRollbackRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for BatchRollbackRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct BatchRollbackResponse { + // message fields + pub region_error: ::protobuf::SingularPtrField, + pub error: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for BatchRollbackResponse {} + +impl BatchRollbackResponse { + pub fn new() -> BatchRollbackResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static BatchRollbackResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const BatchRollbackResponse, + }; + unsafe { + instance.get(BatchRollbackResponse::new) + } + } + + // .errorpb.Error region_error = 1; + + pub fn clear_region_error(&mut self) { + self.region_error.clear(); + } + + pub fn has_region_error(&self) -> bool { + self.region_error.is_some() + } + + // Param is passed by value, moved + pub fn set_region_error(&mut self, v: super::errorpb::Error) { + self.region_error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { + if self.region_error.is_none() { + self.region_error.set_default(); + } + self.region_error.as_mut().unwrap() + } + + // Take field + pub fn take_region_error(&mut self) -> super::errorpb::Error { + self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) + } + + pub fn get_region_error(&self) -> &super::errorpb::Error { + self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) + } + + fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_error + } + + fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_error + } + + // .kvrpcpb.KeyError error = 2; + + pub fn clear_error(&mut self) { + self.error.clear(); + } + + pub fn has_error(&self) -> bool { + self.error.is_some() + } + + // Param is passed by value, moved + pub fn set_error(&mut self, v: KeyError) { + self.error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_error(&mut self) -> &mut KeyError { + if self.error.is_none() { + self.error.set_default(); + } + self.error.as_mut().unwrap() + } + + // Take field + pub fn take_error(&mut self) -> KeyError { + self.error.take().unwrap_or_else(|| KeyError::new()) + } + + pub fn get_error(&self) -> &KeyError { + self.error.as_ref().unwrap_or_else(|| KeyError::default_instance()) + } + + fn get_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.error + } + + fn mut_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.error + } +} + +impl ::protobuf::Message for BatchRollbackResponse { + fn is_initialized(&self) -> bool { + for v in &self.region_error { + if !v.is_initialized() { + return false; + } + }; + for v in &self.error { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.error)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.region_error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.region_error.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.error.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for BatchRollbackResponse { + fn new() -> BatchRollbackResponse { + BatchRollbackResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_error", + BatchRollbackResponse::get_region_error_for_reflect, + BatchRollbackResponse::mut_region_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "error", + BatchRollbackResponse::get_error_for_reflect, + BatchRollbackResponse::mut_error_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "BatchRollbackResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for BatchRollbackResponse { + fn clear(&mut self) { + self.clear_region_error(); + self.clear_error(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for BatchRollbackResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for BatchRollbackResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct CleanupRequest { + // message fields + pub context: ::protobuf::SingularPtrField, + pub key: ::std::vec::Vec, + pub start_version: u64, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for CleanupRequest {} + +impl CleanupRequest { + pub fn new() -> CleanupRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static CleanupRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const CleanupRequest, + }; + unsafe { + instance.get(CleanupRequest::new) + } + } + + // .kvrpcpb.Context context = 1; + + pub fn clear_context(&mut self) { + self.context.clear(); + } + + pub fn has_context(&self) -> bool { + self.context.is_some() + } + + // Param is passed by value, moved + pub fn set_context(&mut self, v: Context) { + self.context = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_context(&mut self) -> &mut Context { + if self.context.is_none() { + self.context.set_default(); + } + self.context.as_mut().unwrap() + } + + // Take field + pub fn take_context(&mut self) -> Context { + self.context.take().unwrap_or_else(|| Context::new()) + } + + pub fn get_context(&self) -> &Context { + self.context.as_ref().unwrap_or_else(|| Context::default_instance()) + } + + fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.context + } + + fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.context + } + + // bytes key = 2; + + pub fn clear_key(&mut self) { + self.key.clear(); + } + + // Param is passed by value, moved + pub fn set_key(&mut self, v: ::std::vec::Vec) { + self.key = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { + &mut self.key + } + + // Take field + pub fn take_key(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) + } + + pub fn get_key(&self) -> &[u8] { + &self.key + } + + fn get_key_for_reflect(&self) -> &::std::vec::Vec { + &self.key + } + + fn mut_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.key + } + + // uint64 start_version = 3; + + pub fn clear_start_version(&mut self) { + self.start_version = 0; + } + + // Param is passed by value, moved + pub fn set_start_version(&mut self, v: u64) { + self.start_version = v; + } + + pub fn get_start_version(&self) -> u64 { + self.start_version + } + + fn get_start_version_for_reflect(&self) -> &u64 { + &self.start_version + } + + fn mut_start_version_for_reflect(&mut self) -> &mut u64 { + &mut self.start_version + } +} + +impl ::protobuf::Message for CleanupRequest { + fn is_initialized(&self) -> bool { + for v in &self.context { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.start_version = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.context.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.key.is_empty() { + my_size += ::protobuf::rt::bytes_size(2, &self.key); + } + if self.start_version != 0 { + my_size += ::protobuf::rt::value_size(3, self.start_version, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.context.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.key.is_empty() { + os.write_bytes(2, &self.key)?; + } + if self.start_version != 0 { + os.write_uint64(3, self.start_version)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for CleanupRequest { + fn new() -> CleanupRequest { + CleanupRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "context", + CleanupRequest::get_context_for_reflect, + CleanupRequest::mut_context_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "key", + CleanupRequest::get_key_for_reflect, + CleanupRequest::mut_key_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "start_version", + CleanupRequest::get_start_version_for_reflect, + CleanupRequest::mut_start_version_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "CleanupRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for CleanupRequest { + fn clear(&mut self) { + self.clear_context(); + self.clear_key(); + self.clear_start_version(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for CleanupRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CleanupRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct CleanupResponse { + // message fields + pub region_error: ::protobuf::SingularPtrField, + pub error: ::protobuf::SingularPtrField, + pub commit_version: u64, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for CleanupResponse {} + +impl CleanupResponse { + pub fn new() -> CleanupResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static CleanupResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const CleanupResponse, + }; + unsafe { + instance.get(CleanupResponse::new) + } + } + + // .errorpb.Error region_error = 1; + + pub fn clear_region_error(&mut self) { + self.region_error.clear(); + } + + pub fn has_region_error(&self) -> bool { + self.region_error.is_some() + } + + // Param is passed by value, moved + pub fn set_region_error(&mut self, v: super::errorpb::Error) { + self.region_error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { + if self.region_error.is_none() { + self.region_error.set_default(); + } + self.region_error.as_mut().unwrap() + } + + // Take field + pub fn take_region_error(&mut self) -> super::errorpb::Error { + self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) + } + + pub fn get_region_error(&self) -> &super::errorpb::Error { + self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) + } + + fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_error + } + + fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_error + } + + // .kvrpcpb.KeyError error = 2; + + pub fn clear_error(&mut self) { + self.error.clear(); + } + + pub fn has_error(&self) -> bool { + self.error.is_some() + } + + // Param is passed by value, moved + pub fn set_error(&mut self, v: KeyError) { + self.error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_error(&mut self) -> &mut KeyError { + if self.error.is_none() { + self.error.set_default(); + } + self.error.as_mut().unwrap() + } + + // Take field + pub fn take_error(&mut self) -> KeyError { + self.error.take().unwrap_or_else(|| KeyError::new()) + } + + pub fn get_error(&self) -> &KeyError { + self.error.as_ref().unwrap_or_else(|| KeyError::default_instance()) + } + + fn get_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.error + } + + fn mut_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.error + } + + // uint64 commit_version = 3; + + pub fn clear_commit_version(&mut self) { + self.commit_version = 0; + } + + // Param is passed by value, moved + pub fn set_commit_version(&mut self, v: u64) { + self.commit_version = v; + } + + pub fn get_commit_version(&self) -> u64 { + self.commit_version + } + + fn get_commit_version_for_reflect(&self) -> &u64 { + &self.commit_version + } + + fn mut_commit_version_for_reflect(&mut self) -> &mut u64 { + &mut self.commit_version + } +} + +impl ::protobuf::Message for CleanupResponse { + fn is_initialized(&self) -> bool { + for v in &self.region_error { + if !v.is_initialized() { + return false; + } + }; + for v in &self.error { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.error)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.commit_version = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.region_error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.commit_version != 0 { + my_size += ::protobuf::rt::value_size(3, self.commit_version, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.region_error.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.error.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.commit_version != 0 { + os.write_uint64(3, self.commit_version)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for CleanupResponse { + fn new() -> CleanupResponse { + CleanupResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_error", + CleanupResponse::get_region_error_for_reflect, + CleanupResponse::mut_region_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "error", + CleanupResponse::get_error_for_reflect, + CleanupResponse::mut_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "commit_version", + CleanupResponse::get_commit_version_for_reflect, + CleanupResponse::mut_commit_version_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "CleanupResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for CleanupResponse { + fn clear(&mut self) { + self.clear_region_error(); + self.clear_error(); + self.clear_commit_version(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for CleanupResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CleanupResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct BatchGetRequest { + // message fields + pub context: ::protobuf::SingularPtrField, + pub keys: ::protobuf::RepeatedField<::std::vec::Vec>, + pub version: u64, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for BatchGetRequest {} + +impl BatchGetRequest { + pub fn new() -> BatchGetRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static BatchGetRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const BatchGetRequest, + }; + unsafe { + instance.get(BatchGetRequest::new) + } + } + + // .kvrpcpb.Context context = 1; + + pub fn clear_context(&mut self) { + self.context.clear(); + } + + pub fn has_context(&self) -> bool { + self.context.is_some() + } + + // Param is passed by value, moved + pub fn set_context(&mut self, v: Context) { + self.context = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_context(&mut self) -> &mut Context { + if self.context.is_none() { + self.context.set_default(); + } + self.context.as_mut().unwrap() + } + + // Take field + pub fn take_context(&mut self) -> Context { + self.context.take().unwrap_or_else(|| Context::new()) + } + + pub fn get_context(&self) -> &Context { + self.context.as_ref().unwrap_or_else(|| Context::default_instance()) + } + + fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.context + } + + fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.context + } + + // repeated bytes keys = 2; + + pub fn clear_keys(&mut self) { + self.keys.clear(); + } + + // Param is passed by value, moved + pub fn set_keys(&mut self, v: ::protobuf::RepeatedField<::std::vec::Vec>) { + self.keys = v; + } + + // Mutable pointer to the field. + pub fn mut_keys(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { + &mut self.keys + } + + // Take field + pub fn take_keys(&mut self) -> ::protobuf::RepeatedField<::std::vec::Vec> { + ::std::mem::replace(&mut self.keys, ::protobuf::RepeatedField::new()) + } + + pub fn get_keys(&self) -> &[::std::vec::Vec] { + &self.keys + } + + fn get_keys_for_reflect(&self) -> &::protobuf::RepeatedField<::std::vec::Vec> { + &self.keys + } + + fn mut_keys_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { + &mut self.keys + } + + // uint64 version = 3; + + pub fn clear_version(&mut self) { + self.version = 0; + } + + // Param is passed by value, moved + pub fn set_version(&mut self, v: u64) { + self.version = v; + } + + pub fn get_version(&self) -> u64 { + self.version + } + + fn get_version_for_reflect(&self) -> &u64 { + &self.version + } + + fn mut_version_for_reflect(&mut self) -> &mut u64 { + &mut self.version + } +} + +impl ::protobuf::Message for BatchGetRequest { + fn is_initialized(&self) -> bool { + for v in &self.context { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; + }, + 2 => { + ::protobuf::rt::read_repeated_bytes_into(wire_type, is, &mut self.keys)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.version = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.context.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + for value in &self.keys { + my_size += ::protobuf::rt::bytes_size(2, &value); + }; + if self.version != 0 { + my_size += ::protobuf::rt::value_size(3, self.version, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.context.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + for v in &self.keys { + os.write_bytes(2, &v)?; + }; + if self.version != 0 { + os.write_uint64(3, self.version)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for BatchGetRequest { + fn new() -> BatchGetRequest { + BatchGetRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "context", + BatchGetRequest::get_context_for_reflect, + BatchGetRequest::mut_context_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "keys", + BatchGetRequest::get_keys_for_reflect, + BatchGetRequest::mut_keys_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "version", + BatchGetRequest::get_version_for_reflect, + BatchGetRequest::mut_version_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "BatchGetRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for BatchGetRequest { + fn clear(&mut self) { + self.clear_context(); + self.clear_keys(); + self.clear_version(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for BatchGetRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for BatchGetRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct BatchGetResponse { + // message fields + pub region_error: ::protobuf::SingularPtrField, + pub pairs: ::protobuf::RepeatedField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for BatchGetResponse {} + +impl BatchGetResponse { + pub fn new() -> BatchGetResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static BatchGetResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const BatchGetResponse, + }; + unsafe { + instance.get(BatchGetResponse::new) + } + } + + // .errorpb.Error region_error = 1; + + pub fn clear_region_error(&mut self) { + self.region_error.clear(); + } + + pub fn has_region_error(&self) -> bool { + self.region_error.is_some() + } + + // Param is passed by value, moved + pub fn set_region_error(&mut self, v: super::errorpb::Error) { + self.region_error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { + if self.region_error.is_none() { + self.region_error.set_default(); + } + self.region_error.as_mut().unwrap() + } + + // Take field + pub fn take_region_error(&mut self) -> super::errorpb::Error { + self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) + } + + pub fn get_region_error(&self) -> &super::errorpb::Error { + self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) + } + + fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_error + } + + fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_error + } + + // repeated .kvrpcpb.KvPair pairs = 2; + + pub fn clear_pairs(&mut self) { + self.pairs.clear(); + } + + // Param is passed by value, moved + pub fn set_pairs(&mut self, v: ::protobuf::RepeatedField) { + self.pairs = v; + } + + // Mutable pointer to the field. + pub fn mut_pairs(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.pairs + } + + // Take field + pub fn take_pairs(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.pairs, ::protobuf::RepeatedField::new()) + } + + pub fn get_pairs(&self) -> &[KvPair] { + &self.pairs + } + + fn get_pairs_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.pairs + } + + fn mut_pairs_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.pairs + } +} + +impl ::protobuf::Message for BatchGetResponse { + fn is_initialized(&self) -> bool { + for v in &self.region_error { + if !v.is_initialized() { + return false; + } + }; + for v in &self.pairs { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; + }, + 2 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.pairs)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.region_error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + for value in &self.pairs { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.region_error.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + for v in &self.pairs { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for BatchGetResponse { + fn new() -> BatchGetResponse { + BatchGetResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_error", + BatchGetResponse::get_region_error_for_reflect, + BatchGetResponse::mut_region_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "pairs", + BatchGetResponse::get_pairs_for_reflect, + BatchGetResponse::mut_pairs_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "BatchGetResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for BatchGetResponse { + fn clear(&mut self) { + self.clear_region_error(); + self.clear_pairs(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for BatchGetResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for BatchGetResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ScanLockRequest { + // message fields + pub context: ::protobuf::SingularPtrField, + pub max_version: u64, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for ScanLockRequest {} + +impl ScanLockRequest { + pub fn new() -> ScanLockRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static ScanLockRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ScanLockRequest, + }; + unsafe { + instance.get(ScanLockRequest::new) + } + } + + // .kvrpcpb.Context context = 1; + + pub fn clear_context(&mut self) { + self.context.clear(); + } + + pub fn has_context(&self) -> bool { + self.context.is_some() + } + + // Param is passed by value, moved + pub fn set_context(&mut self, v: Context) { + self.context = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_context(&mut self) -> &mut Context { + if self.context.is_none() { + self.context.set_default(); + } + self.context.as_mut().unwrap() + } + + // Take field + pub fn take_context(&mut self) -> Context { + self.context.take().unwrap_or_else(|| Context::new()) + } + + pub fn get_context(&self) -> &Context { + self.context.as_ref().unwrap_or_else(|| Context::default_instance()) + } + + fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.context + } + + fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.context + } + + // uint64 max_version = 2; + + pub fn clear_max_version(&mut self) { + self.max_version = 0; + } + + // Param is passed by value, moved + pub fn set_max_version(&mut self, v: u64) { + self.max_version = v; + } + + pub fn get_max_version(&self) -> u64 { + self.max_version + } + + fn get_max_version_for_reflect(&self) -> &u64 { + &self.max_version + } + + fn mut_max_version_for_reflect(&mut self) -> &mut u64 { + &mut self.max_version + } +} + +impl ::protobuf::Message for ScanLockRequest { + fn is_initialized(&self) -> bool { + for v in &self.context { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.max_version = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.context.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.max_version != 0 { + my_size += ::protobuf::rt::value_size(2, self.max_version, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.context.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.max_version != 0 { + os.write_uint64(2, self.max_version)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for ScanLockRequest { + fn new() -> ScanLockRequest { + ScanLockRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "context", + ScanLockRequest::get_context_for_reflect, + ScanLockRequest::mut_context_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "max_version", + ScanLockRequest::get_max_version_for_reflect, + ScanLockRequest::mut_max_version_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ScanLockRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for ScanLockRequest { + fn clear(&mut self) { + self.clear_context(); + self.clear_max_version(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ScanLockRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ScanLockRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ScanLockResponse { + // message fields + pub region_error: ::protobuf::SingularPtrField, + pub error: ::protobuf::SingularPtrField, + pub locks: ::protobuf::RepeatedField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for ScanLockResponse {} + +impl ScanLockResponse { + pub fn new() -> ScanLockResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static ScanLockResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ScanLockResponse, + }; + unsafe { + instance.get(ScanLockResponse::new) + } + } + + // .errorpb.Error region_error = 1; + + pub fn clear_region_error(&mut self) { + self.region_error.clear(); + } + + pub fn has_region_error(&self) -> bool { + self.region_error.is_some() + } + + // Param is passed by value, moved + pub fn set_region_error(&mut self, v: super::errorpb::Error) { + self.region_error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { + if self.region_error.is_none() { + self.region_error.set_default(); + } + self.region_error.as_mut().unwrap() + } + + // Take field + pub fn take_region_error(&mut self) -> super::errorpb::Error { + self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) + } + + pub fn get_region_error(&self) -> &super::errorpb::Error { + self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) + } + + fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_error + } + + fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_error + } + + // .kvrpcpb.KeyError error = 2; + + pub fn clear_error(&mut self) { + self.error.clear(); + } + + pub fn has_error(&self) -> bool { + self.error.is_some() + } + + // Param is passed by value, moved + pub fn set_error(&mut self, v: KeyError) { + self.error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_error(&mut self) -> &mut KeyError { + if self.error.is_none() { + self.error.set_default(); + } + self.error.as_mut().unwrap() + } + + // Take field + pub fn take_error(&mut self) -> KeyError { + self.error.take().unwrap_or_else(|| KeyError::new()) + } + + pub fn get_error(&self) -> &KeyError { + self.error.as_ref().unwrap_or_else(|| KeyError::default_instance()) + } + + fn get_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.error + } + + fn mut_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.error + } + + // repeated .kvrpcpb.LockInfo locks = 3; + + pub fn clear_locks(&mut self) { + self.locks.clear(); + } + + // Param is passed by value, moved + pub fn set_locks(&mut self, v: ::protobuf::RepeatedField) { + self.locks = v; + } + + // Mutable pointer to the field. + pub fn mut_locks(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.locks + } + + // Take field + pub fn take_locks(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.locks, ::protobuf::RepeatedField::new()) + } + + pub fn get_locks(&self) -> &[LockInfo] { + &self.locks + } + + fn get_locks_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.locks + } + + fn mut_locks_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.locks + } +} + +impl ::protobuf::Message for ScanLockResponse { + fn is_initialized(&self) -> bool { + for v in &self.region_error { + if !v.is_initialized() { + return false; + } + }; + for v in &self.error { + if !v.is_initialized() { + return false; + } + }; + for v in &self.locks { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.error)?; + }, + 3 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.locks)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.region_error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + for value in &self.locks { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.region_error.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.error.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + for v in &self.locks { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for ScanLockResponse { + fn new() -> ScanLockResponse { + ScanLockResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_error", + ScanLockResponse::get_region_error_for_reflect, + ScanLockResponse::mut_region_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "error", + ScanLockResponse::get_error_for_reflect, + ScanLockResponse::mut_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "locks", + ScanLockResponse::get_locks_for_reflect, + ScanLockResponse::mut_locks_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ScanLockResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for ScanLockResponse { + fn clear(&mut self) { + self.clear_region_error(); + self.clear_error(); + self.clear_locks(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ScanLockResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ScanLockResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ResolveLockRequest { + // message fields + pub context: ::protobuf::SingularPtrField, + pub start_version: u64, + pub commit_version: u64, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for ResolveLockRequest {} + +impl ResolveLockRequest { + pub fn new() -> ResolveLockRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static ResolveLockRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ResolveLockRequest, + }; + unsafe { + instance.get(ResolveLockRequest::new) + } + } + + // .kvrpcpb.Context context = 1; + + pub fn clear_context(&mut self) { + self.context.clear(); + } + + pub fn has_context(&self) -> bool { + self.context.is_some() + } + + // Param is passed by value, moved + pub fn set_context(&mut self, v: Context) { + self.context = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_context(&mut self) -> &mut Context { + if self.context.is_none() { + self.context.set_default(); + } + self.context.as_mut().unwrap() + } + + // Take field + pub fn take_context(&mut self) -> Context { + self.context.take().unwrap_or_else(|| Context::new()) + } + + pub fn get_context(&self) -> &Context { + self.context.as_ref().unwrap_or_else(|| Context::default_instance()) + } + + fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.context + } + + fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.context + } + + // uint64 start_version = 2; + + pub fn clear_start_version(&mut self) { + self.start_version = 0; + } + + // Param is passed by value, moved + pub fn set_start_version(&mut self, v: u64) { + self.start_version = v; + } + + pub fn get_start_version(&self) -> u64 { + self.start_version + } + + fn get_start_version_for_reflect(&self) -> &u64 { + &self.start_version + } + + fn mut_start_version_for_reflect(&mut self) -> &mut u64 { + &mut self.start_version + } + + // uint64 commit_version = 3; + + pub fn clear_commit_version(&mut self) { + self.commit_version = 0; + } + + // Param is passed by value, moved + pub fn set_commit_version(&mut self, v: u64) { + self.commit_version = v; + } + + pub fn get_commit_version(&self) -> u64 { + self.commit_version + } + + fn get_commit_version_for_reflect(&self) -> &u64 { + &self.commit_version + } + + fn mut_commit_version_for_reflect(&mut self) -> &mut u64 { + &mut self.commit_version + } +} + +impl ::protobuf::Message for ResolveLockRequest { + fn is_initialized(&self) -> bool { + for v in &self.context { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.start_version = tmp; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.commit_version = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.context.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.start_version != 0 { + my_size += ::protobuf::rt::value_size(2, self.start_version, ::protobuf::wire_format::WireTypeVarint); + } + if self.commit_version != 0 { + my_size += ::protobuf::rt::value_size(3, self.commit_version, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.context.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.start_version != 0 { + os.write_uint64(2, self.start_version)?; + } + if self.commit_version != 0 { + os.write_uint64(3, self.commit_version)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for ResolveLockRequest { + fn new() -> ResolveLockRequest { + ResolveLockRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "context", + ResolveLockRequest::get_context_for_reflect, + ResolveLockRequest::mut_context_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "start_version", + ResolveLockRequest::get_start_version_for_reflect, + ResolveLockRequest::mut_start_version_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "commit_version", + ResolveLockRequest::get_commit_version_for_reflect, + ResolveLockRequest::mut_commit_version_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ResolveLockRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for ResolveLockRequest { + fn clear(&mut self) { + self.clear_context(); + self.clear_start_version(); + self.clear_commit_version(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ResolveLockRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ResolveLockRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ResolveLockResponse { + // message fields + pub region_error: ::protobuf::SingularPtrField, + pub error: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for ResolveLockResponse {} + +impl ResolveLockResponse { + pub fn new() -> ResolveLockResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static ResolveLockResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ResolveLockResponse, + }; + unsafe { + instance.get(ResolveLockResponse::new) + } + } + + // .errorpb.Error region_error = 1; + + pub fn clear_region_error(&mut self) { + self.region_error.clear(); + } + + pub fn has_region_error(&self) -> bool { + self.region_error.is_some() + } + + // Param is passed by value, moved + pub fn set_region_error(&mut self, v: super::errorpb::Error) { + self.region_error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { + if self.region_error.is_none() { + self.region_error.set_default(); + } + self.region_error.as_mut().unwrap() + } + + // Take field + pub fn take_region_error(&mut self) -> super::errorpb::Error { + self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) + } + + pub fn get_region_error(&self) -> &super::errorpb::Error { + self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) + } + + fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_error + } + + fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_error + } + + // .kvrpcpb.KeyError error = 2; + + pub fn clear_error(&mut self) { + self.error.clear(); + } + + pub fn has_error(&self) -> bool { + self.error.is_some() + } + + // Param is passed by value, moved + pub fn set_error(&mut self, v: KeyError) { + self.error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_error(&mut self) -> &mut KeyError { + if self.error.is_none() { + self.error.set_default(); + } + self.error.as_mut().unwrap() + } + + // Take field + pub fn take_error(&mut self) -> KeyError { + self.error.take().unwrap_or_else(|| KeyError::new()) + } + + pub fn get_error(&self) -> &KeyError { + self.error.as_ref().unwrap_or_else(|| KeyError::default_instance()) + } + + fn get_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.error + } + + fn mut_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.error + } +} + +impl ::protobuf::Message for ResolveLockResponse { + fn is_initialized(&self) -> bool { + for v in &self.region_error { + if !v.is_initialized() { + return false; + } + }; + for v in &self.error { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.error)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.region_error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.region_error.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.error.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for ResolveLockResponse { + fn new() -> ResolveLockResponse { + ResolveLockResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_error", + ResolveLockResponse::get_region_error_for_reflect, + ResolveLockResponse::mut_region_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "error", + ResolveLockResponse::get_error_for_reflect, + ResolveLockResponse::mut_error_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ResolveLockResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for ResolveLockResponse { + fn clear(&mut self) { + self.clear_region_error(); + self.clear_error(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ResolveLockResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ResolveLockResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct GCRequest { + // message fields + pub context: ::protobuf::SingularPtrField, + pub safe_point: u64, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for GCRequest {} + +impl GCRequest { + pub fn new() -> GCRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static GCRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const GCRequest, + }; + unsafe { + instance.get(GCRequest::new) + } + } + + // .kvrpcpb.Context context = 1; + + pub fn clear_context(&mut self) { + self.context.clear(); + } + + pub fn has_context(&self) -> bool { + self.context.is_some() + } + + // Param is passed by value, moved + pub fn set_context(&mut self, v: Context) { + self.context = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_context(&mut self) -> &mut Context { + if self.context.is_none() { + self.context.set_default(); + } + self.context.as_mut().unwrap() + } + + // Take field + pub fn take_context(&mut self) -> Context { + self.context.take().unwrap_or_else(|| Context::new()) + } + + pub fn get_context(&self) -> &Context { + self.context.as_ref().unwrap_or_else(|| Context::default_instance()) + } + + fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.context + } + + fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.context + } + + // uint64 safe_point = 2; + + pub fn clear_safe_point(&mut self) { + self.safe_point = 0; + } + + // Param is passed by value, moved + pub fn set_safe_point(&mut self, v: u64) { + self.safe_point = v; + } + + pub fn get_safe_point(&self) -> u64 { + self.safe_point + } + + fn get_safe_point_for_reflect(&self) -> &u64 { + &self.safe_point + } + + fn mut_safe_point_for_reflect(&mut self) -> &mut u64 { + &mut self.safe_point + } +} + +impl ::protobuf::Message for GCRequest { + fn is_initialized(&self) -> bool { + for v in &self.context { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.safe_point = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.context.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.safe_point != 0 { + my_size += ::protobuf::rt::value_size(2, self.safe_point, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.context.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.safe_point != 0 { + os.write_uint64(2, self.safe_point)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for GCRequest { + fn new() -> GCRequest { + GCRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "context", + GCRequest::get_context_for_reflect, + GCRequest::mut_context_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "safe_point", + GCRequest::get_safe_point_for_reflect, + GCRequest::mut_safe_point_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "GCRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for GCRequest { + fn clear(&mut self) { + self.clear_context(); + self.clear_safe_point(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for GCRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GCRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct GCResponse { + // message fields + pub region_error: ::protobuf::SingularPtrField, + pub error: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for GCResponse {} + +impl GCResponse { + pub fn new() -> GCResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static GCResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const GCResponse, + }; + unsafe { + instance.get(GCResponse::new) + } + } + + // .errorpb.Error region_error = 1; + + pub fn clear_region_error(&mut self) { + self.region_error.clear(); + } + + pub fn has_region_error(&self) -> bool { + self.region_error.is_some() + } + + // Param is passed by value, moved + pub fn set_region_error(&mut self, v: super::errorpb::Error) { + self.region_error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { + if self.region_error.is_none() { + self.region_error.set_default(); + } + self.region_error.as_mut().unwrap() + } + + // Take field + pub fn take_region_error(&mut self) -> super::errorpb::Error { + self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) + } + + pub fn get_region_error(&self) -> &super::errorpb::Error { + self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) + } + + fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_error + } + + fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_error + } + + // .kvrpcpb.KeyError error = 2; + + pub fn clear_error(&mut self) { + self.error.clear(); + } + + pub fn has_error(&self) -> bool { + self.error.is_some() + } + + // Param is passed by value, moved + pub fn set_error(&mut self, v: KeyError) { + self.error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_error(&mut self) -> &mut KeyError { + if self.error.is_none() { + self.error.set_default(); + } + self.error.as_mut().unwrap() + } + + // Take field + pub fn take_error(&mut self) -> KeyError { + self.error.take().unwrap_or_else(|| KeyError::new()) + } + + pub fn get_error(&self) -> &KeyError { + self.error.as_ref().unwrap_or_else(|| KeyError::default_instance()) + } + + fn get_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.error + } + + fn mut_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.error + } +} + +impl ::protobuf::Message for GCResponse { + fn is_initialized(&self) -> bool { + for v in &self.region_error { + if !v.is_initialized() { + return false; + } + }; + for v in &self.error { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.error)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.region_error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.region_error.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.error.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for GCResponse { + fn new() -> GCResponse { + GCResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_error", + GCResponse::get_region_error_for_reflect, + GCResponse::mut_region_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "error", + GCResponse::get_error_for_reflect, + GCResponse::mut_error_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "GCResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for GCResponse { + fn clear(&mut self) { + self.clear_region_error(); + self.clear_error(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for GCResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GCResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RawGetRequest { + // message fields + pub context: ::protobuf::SingularPtrField, + pub key: ::std::vec::Vec, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RawGetRequest {} + +impl RawGetRequest { + pub fn new() -> RawGetRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RawGetRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RawGetRequest, + }; + unsafe { + instance.get(RawGetRequest::new) + } + } + + // .kvrpcpb.Context context = 1; + + pub fn clear_context(&mut self) { + self.context.clear(); + } + + pub fn has_context(&self) -> bool { + self.context.is_some() + } + + // Param is passed by value, moved + pub fn set_context(&mut self, v: Context) { + self.context = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_context(&mut self) -> &mut Context { + if self.context.is_none() { + self.context.set_default(); + } + self.context.as_mut().unwrap() + } + + // Take field + pub fn take_context(&mut self) -> Context { + self.context.take().unwrap_or_else(|| Context::new()) + } + + pub fn get_context(&self) -> &Context { + self.context.as_ref().unwrap_or_else(|| Context::default_instance()) + } + + fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.context + } + + fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.context + } + + // bytes key = 2; + + pub fn clear_key(&mut self) { + self.key.clear(); + } + + // Param is passed by value, moved + pub fn set_key(&mut self, v: ::std::vec::Vec) { + self.key = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { + &mut self.key + } + + // Take field + pub fn take_key(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) + } + + pub fn get_key(&self) -> &[u8] { + &self.key + } + + fn get_key_for_reflect(&self) -> &::std::vec::Vec { + &self.key + } + + fn mut_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.key + } +} + +impl ::protobuf::Message for RawGetRequest { + fn is_initialized(&self) -> bool { + for v in &self.context { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.context.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.key.is_empty() { + my_size += ::protobuf::rt::bytes_size(2, &self.key); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.context.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.key.is_empty() { + os.write_bytes(2, &self.key)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RawGetRequest { + fn new() -> RawGetRequest { + RawGetRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "context", + RawGetRequest::get_context_for_reflect, + RawGetRequest::mut_context_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "key", + RawGetRequest::get_key_for_reflect, + RawGetRequest::mut_key_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RawGetRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RawGetRequest { + fn clear(&mut self) { + self.clear_context(); + self.clear_key(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RawGetRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RawGetRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RawGetResponse { + // message fields + pub region_error: ::protobuf::SingularPtrField, + pub error: ::std::string::String, + pub value: ::std::vec::Vec, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RawGetResponse {} + +impl RawGetResponse { + pub fn new() -> RawGetResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RawGetResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RawGetResponse, + }; + unsafe { + instance.get(RawGetResponse::new) + } + } + + // .errorpb.Error region_error = 1; + + pub fn clear_region_error(&mut self) { + self.region_error.clear(); + } + + pub fn has_region_error(&self) -> bool { + self.region_error.is_some() + } + + // Param is passed by value, moved + pub fn set_region_error(&mut self, v: super::errorpb::Error) { + self.region_error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { + if self.region_error.is_none() { + self.region_error.set_default(); + } + self.region_error.as_mut().unwrap() + } + + // Take field + pub fn take_region_error(&mut self) -> super::errorpb::Error { + self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) + } + + pub fn get_region_error(&self) -> &super::errorpb::Error { + self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) + } + + fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_error + } + + fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_error + } + + // string error = 2; + + pub fn clear_error(&mut self) { + self.error.clear(); + } + + // Param is passed by value, moved + pub fn set_error(&mut self, v: ::std::string::String) { + self.error = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_error(&mut self) -> &mut ::std::string::String { + &mut self.error + } + + // Take field + pub fn take_error(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.error, ::std::string::String::new()) + } + + pub fn get_error(&self) -> &str { + &self.error + } + + fn get_error_for_reflect(&self) -> &::std::string::String { + &self.error + } + + fn mut_error_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.error + } + + // bytes value = 3; + + pub fn clear_value(&mut self) { + self.value.clear(); + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: ::std::vec::Vec) { + self.value = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { + &mut self.value + } + + // Take field + pub fn take_value(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.value, ::std::vec::Vec::new()) + } + + pub fn get_value(&self) -> &[u8] { + &self.value + } + + fn get_value_for_reflect(&self) -> &::std::vec::Vec { + &self.value + } + + fn mut_value_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.value + } +} + +impl ::protobuf::Message for RawGetResponse { + fn is_initialized(&self) -> bool { + for v in &self.region_error { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.error)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.value)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.region_error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.error.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.error); + } + if !self.value.is_empty() { + my_size += ::protobuf::rt::bytes_size(3, &self.value); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.region_error.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.error.is_empty() { + os.write_string(2, &self.error)?; + } + if !self.value.is_empty() { + os.write_bytes(3, &self.value)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RawGetResponse { + fn new() -> RawGetResponse { + RawGetResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_error", + RawGetResponse::get_region_error_for_reflect, + RawGetResponse::mut_region_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "error", + RawGetResponse::get_error_for_reflect, + RawGetResponse::mut_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "value", + RawGetResponse::get_value_for_reflect, + RawGetResponse::mut_value_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RawGetResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RawGetResponse { + fn clear(&mut self) { + self.clear_region_error(); + self.clear_error(); + self.clear_value(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RawGetResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RawGetResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RawPutRequest { + // message fields + pub context: ::protobuf::SingularPtrField, + pub key: ::std::vec::Vec, + pub value: ::std::vec::Vec, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RawPutRequest {} + +impl RawPutRequest { + pub fn new() -> RawPutRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RawPutRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RawPutRequest, + }; + unsafe { + instance.get(RawPutRequest::new) + } + } + + // .kvrpcpb.Context context = 1; + + pub fn clear_context(&mut self) { + self.context.clear(); + } + + pub fn has_context(&self) -> bool { + self.context.is_some() + } + + // Param is passed by value, moved + pub fn set_context(&mut self, v: Context) { + self.context = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_context(&mut self) -> &mut Context { + if self.context.is_none() { + self.context.set_default(); + } + self.context.as_mut().unwrap() + } + + // Take field + pub fn take_context(&mut self) -> Context { + self.context.take().unwrap_or_else(|| Context::new()) + } + + pub fn get_context(&self) -> &Context { + self.context.as_ref().unwrap_or_else(|| Context::default_instance()) + } + + fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.context + } + + fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.context + } + + // bytes key = 2; + + pub fn clear_key(&mut self) { + self.key.clear(); + } + + // Param is passed by value, moved + pub fn set_key(&mut self, v: ::std::vec::Vec) { + self.key = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { + &mut self.key + } + + // Take field + pub fn take_key(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) + } + + pub fn get_key(&self) -> &[u8] { + &self.key + } + + fn get_key_for_reflect(&self) -> &::std::vec::Vec { + &self.key + } + + fn mut_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.key + } + + // bytes value = 3; + + pub fn clear_value(&mut self) { + self.value.clear(); + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: ::std::vec::Vec) { + self.value = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { + &mut self.value + } + + // Take field + pub fn take_value(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.value, ::std::vec::Vec::new()) + } + + pub fn get_value(&self) -> &[u8] { + &self.value + } + + fn get_value_for_reflect(&self) -> &::std::vec::Vec { + &self.value + } + + fn mut_value_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.value + } +} + +impl ::protobuf::Message for RawPutRequest { + fn is_initialized(&self) -> bool { + for v in &self.context { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.value)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.context.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.key.is_empty() { + my_size += ::protobuf::rt::bytes_size(2, &self.key); + } + if !self.value.is_empty() { + my_size += ::protobuf::rt::bytes_size(3, &self.value); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.context.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.key.is_empty() { + os.write_bytes(2, &self.key)?; + } + if !self.value.is_empty() { + os.write_bytes(3, &self.value)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RawPutRequest { + fn new() -> RawPutRequest { + RawPutRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "context", + RawPutRequest::get_context_for_reflect, + RawPutRequest::mut_context_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "key", + RawPutRequest::get_key_for_reflect, + RawPutRequest::mut_key_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "value", + RawPutRequest::get_value_for_reflect, + RawPutRequest::mut_value_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RawPutRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RawPutRequest { + fn clear(&mut self) { + self.clear_context(); + self.clear_key(); + self.clear_value(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RawPutRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RawPutRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RawPutResponse { + // message fields + pub region_error: ::protobuf::SingularPtrField, + pub error: ::std::string::String, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RawPutResponse {} + +impl RawPutResponse { + pub fn new() -> RawPutResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RawPutResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RawPutResponse, + }; + unsafe { + instance.get(RawPutResponse::new) + } + } + + // .errorpb.Error region_error = 1; + + pub fn clear_region_error(&mut self) { + self.region_error.clear(); + } + + pub fn has_region_error(&self) -> bool { + self.region_error.is_some() + } + + // Param is passed by value, moved + pub fn set_region_error(&mut self, v: super::errorpb::Error) { + self.region_error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { + if self.region_error.is_none() { + self.region_error.set_default(); + } + self.region_error.as_mut().unwrap() + } + + // Take field + pub fn take_region_error(&mut self) -> super::errorpb::Error { + self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) + } + + pub fn get_region_error(&self) -> &super::errorpb::Error { + self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) + } + + fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_error + } + + fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_error + } + + // string error = 2; + + pub fn clear_error(&mut self) { + self.error.clear(); + } + + // Param is passed by value, moved + pub fn set_error(&mut self, v: ::std::string::String) { + self.error = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_error(&mut self) -> &mut ::std::string::String { + &mut self.error + } + + // Take field + pub fn take_error(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.error, ::std::string::String::new()) + } + + pub fn get_error(&self) -> &str { + &self.error + } + + fn get_error_for_reflect(&self) -> &::std::string::String { + &self.error + } + + fn mut_error_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.error + } +} + +impl ::protobuf::Message for RawPutResponse { + fn is_initialized(&self) -> bool { + for v in &self.region_error { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.error)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.region_error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.error.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.error); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.region_error.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.error.is_empty() { + os.write_string(2, &self.error)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RawPutResponse { + fn new() -> RawPutResponse { + RawPutResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_error", + RawPutResponse::get_region_error_for_reflect, + RawPutResponse::mut_region_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "error", + RawPutResponse::get_error_for_reflect, + RawPutResponse::mut_error_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RawPutResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RawPutResponse { + fn clear(&mut self) { + self.clear_region_error(); + self.clear_error(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RawPutResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RawPutResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RawDeleteRequest { + // message fields + pub context: ::protobuf::SingularPtrField, + pub key: ::std::vec::Vec, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RawDeleteRequest {} + +impl RawDeleteRequest { + pub fn new() -> RawDeleteRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RawDeleteRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RawDeleteRequest, + }; + unsafe { + instance.get(RawDeleteRequest::new) + } + } + + // .kvrpcpb.Context context = 1; + + pub fn clear_context(&mut self) { + self.context.clear(); + } + + pub fn has_context(&self) -> bool { + self.context.is_some() + } + + // Param is passed by value, moved + pub fn set_context(&mut self, v: Context) { + self.context = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_context(&mut self) -> &mut Context { + if self.context.is_none() { + self.context.set_default(); + } + self.context.as_mut().unwrap() + } + + // Take field + pub fn take_context(&mut self) -> Context { + self.context.take().unwrap_or_else(|| Context::new()) + } + + pub fn get_context(&self) -> &Context { + self.context.as_ref().unwrap_or_else(|| Context::default_instance()) + } + + fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.context + } + + fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.context + } + + // bytes key = 2; + + pub fn clear_key(&mut self) { + self.key.clear(); + } + + // Param is passed by value, moved + pub fn set_key(&mut self, v: ::std::vec::Vec) { + self.key = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { + &mut self.key + } + + // Take field + pub fn take_key(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) + } + + pub fn get_key(&self) -> &[u8] { + &self.key + } + + fn get_key_for_reflect(&self) -> &::std::vec::Vec { + &self.key + } + + fn mut_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.key + } +} + +impl ::protobuf::Message for RawDeleteRequest { + fn is_initialized(&self) -> bool { + for v in &self.context { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.context.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.key.is_empty() { + my_size += ::protobuf::rt::bytes_size(2, &self.key); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.context.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.key.is_empty() { + os.write_bytes(2, &self.key)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RawDeleteRequest { + fn new() -> RawDeleteRequest { + RawDeleteRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "context", + RawDeleteRequest::get_context_for_reflect, + RawDeleteRequest::mut_context_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "key", + RawDeleteRequest::get_key_for_reflect, + RawDeleteRequest::mut_key_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RawDeleteRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RawDeleteRequest { + fn clear(&mut self) { + self.clear_context(); + self.clear_key(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RawDeleteRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RawDeleteRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RawDeleteResponse { + // message fields + pub region_error: ::protobuf::SingularPtrField, + pub error: ::std::string::String, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RawDeleteResponse {} + +impl RawDeleteResponse { + pub fn new() -> RawDeleteResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RawDeleteResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RawDeleteResponse, + }; + unsafe { + instance.get(RawDeleteResponse::new) + } + } + + // .errorpb.Error region_error = 1; + + pub fn clear_region_error(&mut self) { + self.region_error.clear(); + } + + pub fn has_region_error(&self) -> bool { + self.region_error.is_some() + } + + // Param is passed by value, moved + pub fn set_region_error(&mut self, v: super::errorpb::Error) { + self.region_error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { + if self.region_error.is_none() { + self.region_error.set_default(); + } + self.region_error.as_mut().unwrap() + } + + // Take field + pub fn take_region_error(&mut self) -> super::errorpb::Error { + self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) + } + + pub fn get_region_error(&self) -> &super::errorpb::Error { + self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) + } + + fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_error + } + + fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_error + } + + // string error = 2; + + pub fn clear_error(&mut self) { + self.error.clear(); + } + + // Param is passed by value, moved + pub fn set_error(&mut self, v: ::std::string::String) { + self.error = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_error(&mut self) -> &mut ::std::string::String { + &mut self.error + } + + // Take field + pub fn take_error(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.error, ::std::string::String::new()) + } + + pub fn get_error(&self) -> &str { + &self.error + } + + fn get_error_for_reflect(&self) -> &::std::string::String { + &self.error + } + + fn mut_error_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.error + } +} + +impl ::protobuf::Message for RawDeleteResponse { + fn is_initialized(&self) -> bool { + for v in &self.region_error { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.error)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.region_error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.error.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.error); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.region_error.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.error.is_empty() { + os.write_string(2, &self.error)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RawDeleteResponse { + fn new() -> RawDeleteResponse { + RawDeleteResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_error", + RawDeleteResponse::get_region_error_for_reflect, + RawDeleteResponse::mut_region_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "error", + RawDeleteResponse::get_error_for_reflect, + RawDeleteResponse::mut_error_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RawDeleteResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RawDeleteResponse { + fn clear(&mut self) { + self.clear_region_error(); + self.clear_error(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RawDeleteResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RawDeleteResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct DeleteRangeRequest { + // message fields + pub context: ::protobuf::SingularPtrField, + pub start_key: ::std::vec::Vec, + pub end_key: ::std::vec::Vec, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for DeleteRangeRequest {} + +impl DeleteRangeRequest { + pub fn new() -> DeleteRangeRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static DeleteRangeRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const DeleteRangeRequest, + }; + unsafe { + instance.get(DeleteRangeRequest::new) + } + } + + // .kvrpcpb.Context context = 1; + + pub fn clear_context(&mut self) { + self.context.clear(); + } + + pub fn has_context(&self) -> bool { + self.context.is_some() + } + + // Param is passed by value, moved + pub fn set_context(&mut self, v: Context) { + self.context = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_context(&mut self) -> &mut Context { + if self.context.is_none() { + self.context.set_default(); + } + self.context.as_mut().unwrap() + } + + // Take field + pub fn take_context(&mut self) -> Context { + self.context.take().unwrap_or_else(|| Context::new()) + } + + pub fn get_context(&self) -> &Context { + self.context.as_ref().unwrap_or_else(|| Context::default_instance()) + } + + fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.context + } + + fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.context + } + + // bytes start_key = 2; + + pub fn clear_start_key(&mut self) { + self.start_key.clear(); + } + + // Param is passed by value, moved + pub fn set_start_key(&mut self, v: ::std::vec::Vec) { + self.start_key = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_start_key(&mut self) -> &mut ::std::vec::Vec { + &mut self.start_key + } + + // Take field + pub fn take_start_key(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.start_key, ::std::vec::Vec::new()) + } + + pub fn get_start_key(&self) -> &[u8] { + &self.start_key + } + + fn get_start_key_for_reflect(&self) -> &::std::vec::Vec { + &self.start_key + } + + fn mut_start_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.start_key + } + + // bytes end_key = 3; + + pub fn clear_end_key(&mut self) { + self.end_key.clear(); + } + + // Param is passed by value, moved + pub fn set_end_key(&mut self, v: ::std::vec::Vec) { + self.end_key = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_end_key(&mut self) -> &mut ::std::vec::Vec { + &mut self.end_key + } + + // Take field + pub fn take_end_key(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.end_key, ::std::vec::Vec::new()) + } + + pub fn get_end_key(&self) -> &[u8] { + &self.end_key + } + + fn get_end_key_for_reflect(&self) -> &::std::vec::Vec { + &self.end_key + } + + fn mut_end_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.end_key + } +} + +impl ::protobuf::Message for DeleteRangeRequest { + fn is_initialized(&self) -> bool { + for v in &self.context { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.start_key)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.end_key)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.context.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.start_key.is_empty() { + my_size += ::protobuf::rt::bytes_size(2, &self.start_key); + } + if !self.end_key.is_empty() { + my_size += ::protobuf::rt::bytes_size(3, &self.end_key); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.context.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.start_key.is_empty() { + os.write_bytes(2, &self.start_key)?; + } + if !self.end_key.is_empty() { + os.write_bytes(3, &self.end_key)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for DeleteRangeRequest { + fn new() -> DeleteRangeRequest { + DeleteRangeRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "context", + DeleteRangeRequest::get_context_for_reflect, + DeleteRangeRequest::mut_context_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "start_key", + DeleteRangeRequest::get_start_key_for_reflect, + DeleteRangeRequest::mut_start_key_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "end_key", + DeleteRangeRequest::get_end_key_for_reflect, + DeleteRangeRequest::mut_end_key_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "DeleteRangeRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for DeleteRangeRequest { + fn clear(&mut self) { + self.clear_context(); + self.clear_start_key(); + self.clear_end_key(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for DeleteRangeRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DeleteRangeRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct DeleteRangeResponse { + // message fields + pub region_error: ::protobuf::SingularPtrField, + pub error: ::std::string::String, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for DeleteRangeResponse {} + +impl DeleteRangeResponse { + pub fn new() -> DeleteRangeResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static DeleteRangeResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const DeleteRangeResponse, + }; + unsafe { + instance.get(DeleteRangeResponse::new) + } + } + + // .errorpb.Error region_error = 1; + + pub fn clear_region_error(&mut self) { + self.region_error.clear(); + } + + pub fn has_region_error(&self) -> bool { + self.region_error.is_some() + } + + // Param is passed by value, moved + pub fn set_region_error(&mut self, v: super::errorpb::Error) { + self.region_error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { + if self.region_error.is_none() { + self.region_error.set_default(); + } + self.region_error.as_mut().unwrap() + } + + // Take field + pub fn take_region_error(&mut self) -> super::errorpb::Error { + self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) + } + + pub fn get_region_error(&self) -> &super::errorpb::Error { + self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) + } + + fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_error + } + + fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_error + } + + // string error = 2; + + pub fn clear_error(&mut self) { + self.error.clear(); + } + + // Param is passed by value, moved + pub fn set_error(&mut self, v: ::std::string::String) { + self.error = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_error(&mut self) -> &mut ::std::string::String { + &mut self.error + } + + // Take field + pub fn take_error(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.error, ::std::string::String::new()) + } + + pub fn get_error(&self) -> &str { + &self.error + } + + fn get_error_for_reflect(&self) -> &::std::string::String { + &self.error + } + + fn mut_error_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.error + } +} + +impl ::protobuf::Message for DeleteRangeResponse { + fn is_initialized(&self) -> bool { + for v in &self.region_error { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.error)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.region_error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.error.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.error); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.region_error.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.error.is_empty() { + os.write_string(2, &self.error)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for DeleteRangeResponse { + fn new() -> DeleteRangeResponse { + DeleteRangeResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_error", + DeleteRangeResponse::get_region_error_for_reflect, + DeleteRangeResponse::mut_region_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "error", + DeleteRangeResponse::get_error_for_reflect, + DeleteRangeResponse::mut_error_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "DeleteRangeResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for DeleteRangeResponse { + fn clear(&mut self) { + self.clear_region_error(); + self.clear_error(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for DeleteRangeResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DeleteRangeResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RawScanRequest { + // message fields + pub context: ::protobuf::SingularPtrField, + pub start_key: ::std::vec::Vec, + pub limit: u32, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RawScanRequest {} + +impl RawScanRequest { + pub fn new() -> RawScanRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RawScanRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RawScanRequest, + }; + unsafe { + instance.get(RawScanRequest::new) + } + } + + // .kvrpcpb.Context context = 1; + + pub fn clear_context(&mut self) { + self.context.clear(); + } + + pub fn has_context(&self) -> bool { + self.context.is_some() + } + + // Param is passed by value, moved + pub fn set_context(&mut self, v: Context) { + self.context = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_context(&mut self) -> &mut Context { + if self.context.is_none() { + self.context.set_default(); + } + self.context.as_mut().unwrap() + } + + // Take field + pub fn take_context(&mut self) -> Context { + self.context.take().unwrap_or_else(|| Context::new()) + } + + pub fn get_context(&self) -> &Context { + self.context.as_ref().unwrap_or_else(|| Context::default_instance()) + } + + fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.context + } + + fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.context + } + + // bytes start_key = 2; + + pub fn clear_start_key(&mut self) { + self.start_key.clear(); + } + + // Param is passed by value, moved + pub fn set_start_key(&mut self, v: ::std::vec::Vec) { + self.start_key = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_start_key(&mut self) -> &mut ::std::vec::Vec { + &mut self.start_key + } + + // Take field + pub fn take_start_key(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.start_key, ::std::vec::Vec::new()) + } + + pub fn get_start_key(&self) -> &[u8] { + &self.start_key + } + + fn get_start_key_for_reflect(&self) -> &::std::vec::Vec { + &self.start_key + } + + fn mut_start_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.start_key + } + + // uint32 limit = 3; + + pub fn clear_limit(&mut self) { + self.limit = 0; + } + + // Param is passed by value, moved + pub fn set_limit(&mut self, v: u32) { + self.limit = v; + } + + pub fn get_limit(&self) -> u32 { + self.limit + } + + fn get_limit_for_reflect(&self) -> &u32 { + &self.limit + } + + fn mut_limit_for_reflect(&mut self) -> &mut u32 { + &mut self.limit + } +} + +impl ::protobuf::Message for RawScanRequest { + fn is_initialized(&self) -> bool { + for v in &self.context { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.start_key)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.limit = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.context.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.start_key.is_empty() { + my_size += ::protobuf::rt::bytes_size(2, &self.start_key); + } + if self.limit != 0 { + my_size += ::protobuf::rt::value_size(3, self.limit, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.context.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.start_key.is_empty() { + os.write_bytes(2, &self.start_key)?; + } + if self.limit != 0 { + os.write_uint32(3, self.limit)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RawScanRequest { + fn new() -> RawScanRequest { + RawScanRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "context", + RawScanRequest::get_context_for_reflect, + RawScanRequest::mut_context_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "start_key", + RawScanRequest::get_start_key_for_reflect, + RawScanRequest::mut_start_key_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "limit", + RawScanRequest::get_limit_for_reflect, + RawScanRequest::mut_limit_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RawScanRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RawScanRequest { + fn clear(&mut self) { + self.clear_context(); + self.clear_start_key(); + self.clear_limit(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RawScanRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RawScanRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RawScanResponse { + // message fields + pub region_error: ::protobuf::SingularPtrField, + pub kvs: ::protobuf::RepeatedField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RawScanResponse {} + +impl RawScanResponse { + pub fn new() -> RawScanResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RawScanResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RawScanResponse, + }; + unsafe { + instance.get(RawScanResponse::new) + } + } + + // .errorpb.Error region_error = 1; + + pub fn clear_region_error(&mut self) { + self.region_error.clear(); + } + + pub fn has_region_error(&self) -> bool { + self.region_error.is_some() + } + + // Param is passed by value, moved + pub fn set_region_error(&mut self, v: super::errorpb::Error) { + self.region_error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { + if self.region_error.is_none() { + self.region_error.set_default(); + } + self.region_error.as_mut().unwrap() + } + + // Take field + pub fn take_region_error(&mut self) -> super::errorpb::Error { + self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) + } + + pub fn get_region_error(&self) -> &super::errorpb::Error { + self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) + } + + fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_error + } + + fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_error + } + + // repeated .kvrpcpb.KvPair kvs = 2; + + pub fn clear_kvs(&mut self) { + self.kvs.clear(); + } + + // Param is passed by value, moved + pub fn set_kvs(&mut self, v: ::protobuf::RepeatedField) { + self.kvs = v; + } + + // Mutable pointer to the field. + pub fn mut_kvs(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.kvs + } + + // Take field + pub fn take_kvs(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.kvs, ::protobuf::RepeatedField::new()) + } + + pub fn get_kvs(&self) -> &[KvPair] { + &self.kvs + } + + fn get_kvs_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.kvs + } + + fn mut_kvs_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.kvs + } +} + +impl ::protobuf::Message for RawScanResponse { + fn is_initialized(&self) -> bool { + for v in &self.region_error { + if !v.is_initialized() { + return false; + } + }; + for v in &self.kvs { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; + }, + 2 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.kvs)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.region_error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + for value in &self.kvs { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.region_error.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + for v in &self.kvs { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RawScanResponse { + fn new() -> RawScanResponse { + RawScanResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_error", + RawScanResponse::get_region_error_for_reflect, + RawScanResponse::mut_region_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "kvs", + RawScanResponse::get_kvs_for_reflect, + RawScanResponse::mut_kvs_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RawScanResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RawScanResponse { + fn clear(&mut self) { + self.clear_region_error(); + self.clear_kvs(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RawScanResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RawScanResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct WriteInfo { + // message fields + pub start_ts: u64, + pub field_type: Op, + pub commit_ts: u64, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for WriteInfo {} + +impl WriteInfo { + pub fn new() -> WriteInfo { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static WriteInfo { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const WriteInfo, + }; + unsafe { + instance.get(WriteInfo::new) + } + } + + // uint64 start_ts = 1; + + pub fn clear_start_ts(&mut self) { + self.start_ts = 0; + } + + // Param is passed by value, moved + pub fn set_start_ts(&mut self, v: u64) { + self.start_ts = v; + } + + pub fn get_start_ts(&self) -> u64 { + self.start_ts + } + + fn get_start_ts_for_reflect(&self) -> &u64 { + &self.start_ts + } + + fn mut_start_ts_for_reflect(&mut self) -> &mut u64 { + &mut self.start_ts + } + + // .kvrpcpb.Op type = 2; + + pub fn clear_field_type(&mut self) { + self.field_type = Op::Put; + } + + // Param is passed by value, moved + pub fn set_field_type(&mut self, v: Op) { + self.field_type = v; + } + + pub fn get_field_type(&self) -> Op { + self.field_type + } + + fn get_field_type_for_reflect(&self) -> &Op { + &self.field_type + } + + fn mut_field_type_for_reflect(&mut self) -> &mut Op { + &mut self.field_type + } + + // uint64 commit_ts = 3; + + pub fn clear_commit_ts(&mut self) { + self.commit_ts = 0; + } + + // Param is passed by value, moved + pub fn set_commit_ts(&mut self, v: u64) { + self.commit_ts = v; + } + + pub fn get_commit_ts(&self) -> u64 { + self.commit_ts + } + + fn get_commit_ts_for_reflect(&self) -> &u64 { + &self.commit_ts + } + + fn mut_commit_ts_for_reflect(&mut self) -> &mut u64 { + &mut self.commit_ts + } +} + +impl ::protobuf::Message for WriteInfo { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.start_ts = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_enum()?; + self.field_type = tmp; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.commit_ts = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.start_ts != 0 { + my_size += ::protobuf::rt::value_size(1, self.start_ts, ::protobuf::wire_format::WireTypeVarint); + } + if self.field_type != Op::Put { + my_size += ::protobuf::rt::enum_size(2, self.field_type); + } + if self.commit_ts != 0 { + my_size += ::protobuf::rt::value_size(3, self.commit_ts, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.start_ts != 0 { + os.write_uint64(1, self.start_ts)?; + } + if self.field_type != Op::Put { + os.write_enum(2, self.field_type.value())?; + } + if self.commit_ts != 0 { + os.write_uint64(3, self.commit_ts)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for WriteInfo { + fn new() -> WriteInfo { + WriteInfo::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "start_ts", + WriteInfo::get_start_ts_for_reflect, + WriteInfo::mut_start_ts_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "type", + WriteInfo::get_field_type_for_reflect, + WriteInfo::mut_field_type_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "commit_ts", + WriteInfo::get_commit_ts_for_reflect, + WriteInfo::mut_commit_ts_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "WriteInfo", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for WriteInfo { + fn clear(&mut self) { + self.clear_start_ts(); + self.clear_field_type(); + self.clear_commit_ts(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for WriteInfo { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for WriteInfo { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ValueInfo { + // message fields + pub value: ::std::vec::Vec, + pub ts: u64, + pub is_short_value: bool, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for ValueInfo {} + +impl ValueInfo { + pub fn new() -> ValueInfo { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static ValueInfo { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ValueInfo, + }; + unsafe { + instance.get(ValueInfo::new) + } + } + + // bytes value = 1; + + pub fn clear_value(&mut self) { + self.value.clear(); + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: ::std::vec::Vec) { + self.value = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { + &mut self.value + } + + // Take field + pub fn take_value(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.value, ::std::vec::Vec::new()) + } + + pub fn get_value(&self) -> &[u8] { + &self.value + } + + fn get_value_for_reflect(&self) -> &::std::vec::Vec { + &self.value + } + + fn mut_value_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.value + } + + // uint64 ts = 2; + + pub fn clear_ts(&mut self) { + self.ts = 0; + } + + // Param is passed by value, moved + pub fn set_ts(&mut self, v: u64) { + self.ts = v; + } + + pub fn get_ts(&self) -> u64 { + self.ts + } + + fn get_ts_for_reflect(&self) -> &u64 { + &self.ts + } + + fn mut_ts_for_reflect(&mut self) -> &mut u64 { + &mut self.ts + } + + // bool is_short_value = 3; + + pub fn clear_is_short_value(&mut self) { + self.is_short_value = false; + } + + // Param is passed by value, moved + pub fn set_is_short_value(&mut self, v: bool) { + self.is_short_value = v; + } + + pub fn get_is_short_value(&self) -> bool { + self.is_short_value + } + + fn get_is_short_value_for_reflect(&self) -> &bool { + &self.is_short_value + } + + fn mut_is_short_value_for_reflect(&mut self) -> &mut bool { + &mut self.is_short_value + } +} + +impl ::protobuf::Message for ValueInfo { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.value)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.ts = tmp; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.is_short_value = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.value.is_empty() { + my_size += ::protobuf::rt::bytes_size(1, &self.value); + } + if self.ts != 0 { + my_size += ::protobuf::rt::value_size(2, self.ts, ::protobuf::wire_format::WireTypeVarint); + } + if self.is_short_value != false { + my_size += 2; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.value.is_empty() { + os.write_bytes(1, &self.value)?; + } + if self.ts != 0 { + os.write_uint64(2, self.ts)?; + } + if self.is_short_value != false { + os.write_bool(3, self.is_short_value)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for ValueInfo { + fn new() -> ValueInfo { + ValueInfo::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "value", + ValueInfo::get_value_for_reflect, + ValueInfo::mut_value_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "ts", + ValueInfo::get_ts_for_reflect, + ValueInfo::mut_ts_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "is_short_value", + ValueInfo::get_is_short_value_for_reflect, + ValueInfo::mut_is_short_value_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ValueInfo", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for ValueInfo { + fn clear(&mut self) { + self.clear_value(); + self.clear_ts(); + self.clear_is_short_value(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ValueInfo { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ValueInfo { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct MvccInfo { + // message fields + pub lock: ::protobuf::SingularPtrField, + pub writes: ::protobuf::RepeatedField, + pub values: ::protobuf::RepeatedField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for MvccInfo {} + +impl MvccInfo { + pub fn new() -> MvccInfo { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static MvccInfo { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const MvccInfo, + }; + unsafe { + instance.get(MvccInfo::new) + } + } + + // .kvrpcpb.LockInfo lock = 1; + + pub fn clear_lock(&mut self) { + self.lock.clear(); + } + + pub fn has_lock(&self) -> bool { + self.lock.is_some() + } + + // Param is passed by value, moved + pub fn set_lock(&mut self, v: LockInfo) { + self.lock = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_lock(&mut self) -> &mut LockInfo { + if self.lock.is_none() { + self.lock.set_default(); + } + self.lock.as_mut().unwrap() + } + + // Take field + pub fn take_lock(&mut self) -> LockInfo { + self.lock.take().unwrap_or_else(|| LockInfo::new()) + } + + pub fn get_lock(&self) -> &LockInfo { + self.lock.as_ref().unwrap_or_else(|| LockInfo::default_instance()) + } + + fn get_lock_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.lock + } + + fn mut_lock_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.lock + } + + // repeated .kvrpcpb.WriteInfo writes = 2; + + pub fn clear_writes(&mut self) { + self.writes.clear(); + } + + // Param is passed by value, moved + pub fn set_writes(&mut self, v: ::protobuf::RepeatedField) { + self.writes = v; + } + + // Mutable pointer to the field. + pub fn mut_writes(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.writes + } + + // Take field + pub fn take_writes(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.writes, ::protobuf::RepeatedField::new()) + } + + pub fn get_writes(&self) -> &[WriteInfo] { + &self.writes + } + + fn get_writes_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.writes + } + + fn mut_writes_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.writes + } + + // repeated .kvrpcpb.ValueInfo values = 3; + + pub fn clear_values(&mut self) { + self.values.clear(); + } + + // Param is passed by value, moved + pub fn set_values(&mut self, v: ::protobuf::RepeatedField) { + self.values = v; + } + + // Mutable pointer to the field. + pub fn mut_values(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.values + } + + // Take field + pub fn take_values(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.values, ::protobuf::RepeatedField::new()) + } + + pub fn get_values(&self) -> &[ValueInfo] { + &self.values + } + + fn get_values_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.values + } + + fn mut_values_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.values + } +} + +impl ::protobuf::Message for MvccInfo { + fn is_initialized(&self) -> bool { + for v in &self.lock { + if !v.is_initialized() { + return false; + } + }; + for v in &self.writes { + if !v.is_initialized() { + return false; + } + }; + for v in &self.values { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.lock)?; + }, + 2 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.writes)?; + }, + 3 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.values)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.lock.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + for value in &self.writes { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.values { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.lock.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + for v in &self.writes { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.values { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for MvccInfo { + fn new() -> MvccInfo { + MvccInfo::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "lock", + MvccInfo::get_lock_for_reflect, + MvccInfo::mut_lock_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "writes", + MvccInfo::get_writes_for_reflect, + MvccInfo::mut_writes_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "values", + MvccInfo::get_values_for_reflect, + MvccInfo::mut_values_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "MvccInfo", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for MvccInfo { + fn clear(&mut self) { + self.clear_lock(); + self.clear_writes(); + self.clear_values(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for MvccInfo { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MvccInfo { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct MvccGetByKeyRequest { + // message fields + pub context: ::protobuf::SingularPtrField, + pub key: ::std::vec::Vec, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for MvccGetByKeyRequest {} + +impl MvccGetByKeyRequest { + pub fn new() -> MvccGetByKeyRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static MvccGetByKeyRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const MvccGetByKeyRequest, + }; + unsafe { + instance.get(MvccGetByKeyRequest::new) + } + } + + // .kvrpcpb.Context context = 1; + + pub fn clear_context(&mut self) { + self.context.clear(); + } + + pub fn has_context(&self) -> bool { + self.context.is_some() + } + + // Param is passed by value, moved + pub fn set_context(&mut self, v: Context) { + self.context = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_context(&mut self) -> &mut Context { + if self.context.is_none() { + self.context.set_default(); + } + self.context.as_mut().unwrap() + } + + // Take field + pub fn take_context(&mut self) -> Context { + self.context.take().unwrap_or_else(|| Context::new()) + } + + pub fn get_context(&self) -> &Context { + self.context.as_ref().unwrap_or_else(|| Context::default_instance()) + } + + fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.context + } + + fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.context + } + + // bytes key = 2; + + pub fn clear_key(&mut self) { + self.key.clear(); + } + + // Param is passed by value, moved + pub fn set_key(&mut self, v: ::std::vec::Vec) { + self.key = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { + &mut self.key + } + + // Take field + pub fn take_key(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) + } + + pub fn get_key(&self) -> &[u8] { + &self.key + } + + fn get_key_for_reflect(&self) -> &::std::vec::Vec { + &self.key + } + + fn mut_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.key + } +} + +impl ::protobuf::Message for MvccGetByKeyRequest { + fn is_initialized(&self) -> bool { + for v in &self.context { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.context.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.key.is_empty() { + my_size += ::protobuf::rt::bytes_size(2, &self.key); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.context.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.key.is_empty() { + os.write_bytes(2, &self.key)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for MvccGetByKeyRequest { + fn new() -> MvccGetByKeyRequest { + MvccGetByKeyRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "context", + MvccGetByKeyRequest::get_context_for_reflect, + MvccGetByKeyRequest::mut_context_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "key", + MvccGetByKeyRequest::get_key_for_reflect, + MvccGetByKeyRequest::mut_key_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "MvccGetByKeyRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for MvccGetByKeyRequest { + fn clear(&mut self) { + self.clear_context(); + self.clear_key(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for MvccGetByKeyRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MvccGetByKeyRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct MvccGetByKeyResponse { + // message fields + pub region_error: ::protobuf::SingularPtrField, + pub error: ::std::string::String, + pub info: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for MvccGetByKeyResponse {} + +impl MvccGetByKeyResponse { + pub fn new() -> MvccGetByKeyResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static MvccGetByKeyResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const MvccGetByKeyResponse, + }; + unsafe { + instance.get(MvccGetByKeyResponse::new) + } + } + + // .errorpb.Error region_error = 1; + + pub fn clear_region_error(&mut self) { + self.region_error.clear(); + } + + pub fn has_region_error(&self) -> bool { + self.region_error.is_some() + } + + // Param is passed by value, moved + pub fn set_region_error(&mut self, v: super::errorpb::Error) { + self.region_error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { + if self.region_error.is_none() { + self.region_error.set_default(); + } + self.region_error.as_mut().unwrap() + } + + // Take field + pub fn take_region_error(&mut self) -> super::errorpb::Error { + self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) + } + + pub fn get_region_error(&self) -> &super::errorpb::Error { + self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) + } + + fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_error + } + + fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_error + } + + // string error = 2; + + pub fn clear_error(&mut self) { + self.error.clear(); + } + + // Param is passed by value, moved + pub fn set_error(&mut self, v: ::std::string::String) { + self.error = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_error(&mut self) -> &mut ::std::string::String { + &mut self.error + } + + // Take field + pub fn take_error(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.error, ::std::string::String::new()) + } + + pub fn get_error(&self) -> &str { + &self.error + } + + fn get_error_for_reflect(&self) -> &::std::string::String { + &self.error + } + + fn mut_error_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.error + } + + // .kvrpcpb.MvccInfo info = 3; + + pub fn clear_info(&mut self) { + self.info.clear(); + } + + pub fn has_info(&self) -> bool { + self.info.is_some() + } + + // Param is passed by value, moved + pub fn set_info(&mut self, v: MvccInfo) { + self.info = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_info(&mut self) -> &mut MvccInfo { + if self.info.is_none() { + self.info.set_default(); + } + self.info.as_mut().unwrap() + } + + // Take field + pub fn take_info(&mut self) -> MvccInfo { + self.info.take().unwrap_or_else(|| MvccInfo::new()) + } + + pub fn get_info(&self) -> &MvccInfo { + self.info.as_ref().unwrap_or_else(|| MvccInfo::default_instance()) + } + + fn get_info_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.info + } + + fn mut_info_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.info + } +} + +impl ::protobuf::Message for MvccGetByKeyResponse { + fn is_initialized(&self) -> bool { + for v in &self.region_error { + if !v.is_initialized() { + return false; + } + }; + for v in &self.info { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.error)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.info)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.region_error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.error.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.error); + } + if let Some(ref v) = self.info.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.region_error.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.error.is_empty() { + os.write_string(2, &self.error)?; + } + if let Some(ref v) = self.info.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for MvccGetByKeyResponse { + fn new() -> MvccGetByKeyResponse { + MvccGetByKeyResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_error", + MvccGetByKeyResponse::get_region_error_for_reflect, + MvccGetByKeyResponse::mut_region_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "error", + MvccGetByKeyResponse::get_error_for_reflect, + MvccGetByKeyResponse::mut_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "info", + MvccGetByKeyResponse::get_info_for_reflect, + MvccGetByKeyResponse::mut_info_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "MvccGetByKeyResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for MvccGetByKeyResponse { + fn clear(&mut self) { + self.clear_region_error(); + self.clear_error(); + self.clear_info(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for MvccGetByKeyResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MvccGetByKeyResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct MvccGetByStartTsRequest { + // message fields + pub context: ::protobuf::SingularPtrField, + pub start_ts: u64, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for MvccGetByStartTsRequest {} + +impl MvccGetByStartTsRequest { + pub fn new() -> MvccGetByStartTsRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static MvccGetByStartTsRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const MvccGetByStartTsRequest, + }; + unsafe { + instance.get(MvccGetByStartTsRequest::new) + } + } + + // .kvrpcpb.Context context = 1; + + pub fn clear_context(&mut self) { + self.context.clear(); + } + + pub fn has_context(&self) -> bool { + self.context.is_some() + } + + // Param is passed by value, moved + pub fn set_context(&mut self, v: Context) { + self.context = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_context(&mut self) -> &mut Context { + if self.context.is_none() { + self.context.set_default(); + } + self.context.as_mut().unwrap() + } + + // Take field + pub fn take_context(&mut self) -> Context { + self.context.take().unwrap_or_else(|| Context::new()) + } + + pub fn get_context(&self) -> &Context { + self.context.as_ref().unwrap_or_else(|| Context::default_instance()) + } + + fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.context + } + + fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.context + } + + // uint64 start_ts = 2; + + pub fn clear_start_ts(&mut self) { + self.start_ts = 0; + } + + // Param is passed by value, moved + pub fn set_start_ts(&mut self, v: u64) { + self.start_ts = v; + } + + pub fn get_start_ts(&self) -> u64 { + self.start_ts + } + + fn get_start_ts_for_reflect(&self) -> &u64 { + &self.start_ts + } + + fn mut_start_ts_for_reflect(&mut self) -> &mut u64 { + &mut self.start_ts + } +} + +impl ::protobuf::Message for MvccGetByStartTsRequest { + fn is_initialized(&self) -> bool { + for v in &self.context { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.start_ts = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.context.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.start_ts != 0 { + my_size += ::protobuf::rt::value_size(2, self.start_ts, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.context.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.start_ts != 0 { + os.write_uint64(2, self.start_ts)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for MvccGetByStartTsRequest { + fn new() -> MvccGetByStartTsRequest { + MvccGetByStartTsRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "context", + MvccGetByStartTsRequest::get_context_for_reflect, + MvccGetByStartTsRequest::mut_context_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "start_ts", + MvccGetByStartTsRequest::get_start_ts_for_reflect, + MvccGetByStartTsRequest::mut_start_ts_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "MvccGetByStartTsRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for MvccGetByStartTsRequest { + fn clear(&mut self) { + self.clear_context(); + self.clear_start_ts(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for MvccGetByStartTsRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MvccGetByStartTsRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct MvccGetByStartTsResponse { + // message fields + pub region_error: ::protobuf::SingularPtrField, + pub error: ::std::string::String, + pub key: ::std::vec::Vec, + pub info: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for MvccGetByStartTsResponse {} + +impl MvccGetByStartTsResponse { + pub fn new() -> MvccGetByStartTsResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static MvccGetByStartTsResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const MvccGetByStartTsResponse, + }; + unsafe { + instance.get(MvccGetByStartTsResponse::new) + } + } + + // .errorpb.Error region_error = 1; + + pub fn clear_region_error(&mut self) { + self.region_error.clear(); + } + + pub fn has_region_error(&self) -> bool { + self.region_error.is_some() + } + + // Param is passed by value, moved + pub fn set_region_error(&mut self, v: super::errorpb::Error) { + self.region_error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { + if self.region_error.is_none() { + self.region_error.set_default(); + } + self.region_error.as_mut().unwrap() + } + + // Take field + pub fn take_region_error(&mut self) -> super::errorpb::Error { + self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) + } + + pub fn get_region_error(&self) -> &super::errorpb::Error { + self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) + } + + fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_error + } + + fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_error + } + + // string error = 2; + + pub fn clear_error(&mut self) { + self.error.clear(); + } + + // Param is passed by value, moved + pub fn set_error(&mut self, v: ::std::string::String) { + self.error = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_error(&mut self) -> &mut ::std::string::String { + &mut self.error + } + + // Take field + pub fn take_error(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.error, ::std::string::String::new()) + } + + pub fn get_error(&self) -> &str { + &self.error + } + + fn get_error_for_reflect(&self) -> &::std::string::String { + &self.error + } + + fn mut_error_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.error + } + + // bytes key = 3; + + pub fn clear_key(&mut self) { + self.key.clear(); + } + + // Param is passed by value, moved + pub fn set_key(&mut self, v: ::std::vec::Vec) { + self.key = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { + &mut self.key + } + + // Take field + pub fn take_key(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) + } + + pub fn get_key(&self) -> &[u8] { + &self.key + } + + fn get_key_for_reflect(&self) -> &::std::vec::Vec { + &self.key + } + + fn mut_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.key + } + + // .kvrpcpb.MvccInfo info = 4; + + pub fn clear_info(&mut self) { + self.info.clear(); + } + + pub fn has_info(&self) -> bool { + self.info.is_some() + } + + // Param is passed by value, moved + pub fn set_info(&mut self, v: MvccInfo) { + self.info = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_info(&mut self) -> &mut MvccInfo { + if self.info.is_none() { + self.info.set_default(); + } + self.info.as_mut().unwrap() + } + + // Take field + pub fn take_info(&mut self) -> MvccInfo { + self.info.take().unwrap_or_else(|| MvccInfo::new()) + } + + pub fn get_info(&self) -> &MvccInfo { + self.info.as_ref().unwrap_or_else(|| MvccInfo::default_instance()) + } + + fn get_info_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.info + } + + fn mut_info_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.info + } +} + +impl ::protobuf::Message for MvccGetByStartTsResponse { + fn is_initialized(&self) -> bool { + for v in &self.region_error { + if !v.is_initialized() { + return false; + } + }; + for v in &self.info { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.error)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; + }, + 4 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.info)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.region_error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.error.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.error); + } + if !self.key.is_empty() { + my_size += ::protobuf::rt::bytes_size(3, &self.key); + } + if let Some(ref v) = self.info.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.region_error.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.error.is_empty() { + os.write_string(2, &self.error)?; + } + if !self.key.is_empty() { + os.write_bytes(3, &self.key)?; + } + if let Some(ref v) = self.info.as_ref() { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for MvccGetByStartTsResponse { + fn new() -> MvccGetByStartTsResponse { + MvccGetByStartTsResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_error", + MvccGetByStartTsResponse::get_region_error_for_reflect, + MvccGetByStartTsResponse::mut_region_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "error", + MvccGetByStartTsResponse::get_error_for_reflect, + MvccGetByStartTsResponse::mut_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "key", + MvccGetByStartTsResponse::get_key_for_reflect, + MvccGetByStartTsResponse::mut_key_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "info", + MvccGetByStartTsResponse::get_info_for_reflect, + MvccGetByStartTsResponse::mut_info_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "MvccGetByStartTsResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for MvccGetByStartTsResponse { + fn clear(&mut self) { + self.clear_region_error(); + self.clear_error(); + self.clear_key(); + self.clear_info(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for MvccGetByStartTsResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MvccGetByStartTsResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum CommandPri { + Normal = 0, + Low = 1, + High = 2, +} + +impl ::protobuf::ProtobufEnum for CommandPri { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(CommandPri::Normal), + 1 => ::std::option::Option::Some(CommandPri::Low), + 2 => ::std::option::Option::Some(CommandPri::High), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [CommandPri] = &[ + CommandPri::Normal, + CommandPri::Low, + CommandPri::High, + ]; + values + } + + fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, + }; + unsafe { + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new("CommandPri", file_descriptor_proto()) + }) + } + } +} + +impl ::std::marker::Copy for CommandPri { +} + +impl ::std::default::Default for CommandPri { + fn default() -> Self { + CommandPri::Normal + } +} + +impl ::protobuf::reflect::ProtobufValue for CommandPri { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum IsolationLevel { + SI = 0, + RC = 1, +} + +impl ::protobuf::ProtobufEnum for IsolationLevel { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(IsolationLevel::SI), + 1 => ::std::option::Option::Some(IsolationLevel::RC), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [IsolationLevel] = &[ + IsolationLevel::SI, + IsolationLevel::RC, + ]; + values + } + + fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, + }; + unsafe { + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new("IsolationLevel", file_descriptor_proto()) + }) + } + } +} + +impl ::std::marker::Copy for IsolationLevel { +} + +impl ::std::default::Default for IsolationLevel { + fn default() -> Self { + IsolationLevel::SI + } +} + +impl ::protobuf::reflect::ProtobufValue for IsolationLevel { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum Op { + Put = 0, + Del = 1, + Lock = 2, + Rollback = 3, +} + +impl ::protobuf::ProtobufEnum for Op { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(Op::Put), + 1 => ::std::option::Option::Some(Op::Del), + 2 => ::std::option::Option::Some(Op::Lock), + 3 => ::std::option::Option::Some(Op::Rollback), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [Op] = &[ + Op::Put, + Op::Del, + Op::Lock, + Op::Rollback, + ]; + values + } + + fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, + }; + unsafe { + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new("Op", file_descriptor_proto()) + }) + } + } +} + +impl ::std::marker::Copy for Op { +} + +impl ::std::default::Default for Op { + fn default() -> Self { + Op::Put + } +} + +impl ::protobuf::reflect::ProtobufValue for Op { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\rkvrpcpb.proto\x12\x07kvrpcpb\x1a\x0cmetapb.proto\x1a\rerrorpb.proto\ + \x1a\x14gogoproto/gogo.proto\"}\n\x08LockInfo\x12!\n\x0cprimary_lock\x18\ + \x01\x20\x01(\x0cR\x0bprimaryLock\x12!\n\x0clock_version\x18\x02\x20\x01\ + (\x04R\x0blockVersion\x12\x10\n\x03key\x18\x03\x20\x01(\x0cR\x03key\x12\ + \x19\n\x08lock_ttl\x18\x04\x20\x01(\x04R\x07lockTtl\"i\n\x08KeyError\x12\ + )\n\x06locked\x18\x01\x20\x01(\x0b2\x11.kvrpcpb.LockInfoR\x06locked\x12\ + \x1c\n\tretryable\x18\x02\x20\x01(\tR\tretryable\x12\x14\n\x05abort\x18\ + \x03\x20\x01(\tR\x05abort\"\x9a\x02\n\x07Context\x12\x1b\n\tregion_id\ + \x18\x01\x20\x01(\x04R\x08regionId\x126\n\x0cregion_epoch\x18\x02\x20\ + \x01(\x0b2\x13.metapb.RegionEpochR\x0bregionEpoch\x12\x20\n\x04peer\x18\ + \x03\x20\x01(\x0b2\x0c.metapb.PeerR\x04peer\x12\x12\n\x04term\x18\x05\ + \x20\x01(\x04R\x04term\x12/\n\x08priority\x18\x06\x20\x01(\x0e2\x13.kvrp\ + cpb.CommandPriR\x08priority\x12@\n\x0fisolation_level\x18\x07\x20\x01(\ + \x0e2\x17.kvrpcpb.IsolationLevelR\x0eisolationLevelJ\x04\x08\x04\x10\x05\ + R\x0bread_quorum\"d\n\nGetRequest\x12*\n\x07context\x18\x01\x20\x01(\x0b\ + 2\x10.kvrpcpb.ContextR\x07context\x12\x10\n\x03key\x18\x02\x20\x01(\x0cR\ + \x03key\x12\x18\n\x07version\x18\x03\x20\x01(\x04R\x07version\"\x7f\n\ + \x0bGetResponse\x121\n\x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb\ + .ErrorR\x0bregionError\x12'\n\x05error\x18\x02\x20\x01(\x0b2\x11.kvrpcpb\ + .KeyErrorR\x05error\x12\x14\n\x05value\x18\x03\x20\x01(\x0cR\x05value\"\ + \xa1\x01\n\x0bScanRequest\x12*\n\x07context\x18\x01\x20\x01(\x0b2\x10.kv\ + rpcpb.ContextR\x07context\x12\x1b\n\tstart_key\x18\x02\x20\x01(\x0cR\x08\ + startKey\x12\x14\n\x05limit\x18\x03\x20\x01(\rR\x05limit\x12\x18\n\x07ve\ + rsion\x18\x04\x20\x01(\x04R\x07version\x12\x19\n\x08key_only\x18\x05\x20\ + \x01(\x08R\x07keyOnly\"Y\n\x06KvPair\x12'\n\x05error\x18\x01\x20\x01(\ + \x0b2\x11.kvrpcpb.KeyErrorR\x05error\x12\x10\n\x03key\x18\x02\x20\x01(\ + \x0cR\x03key\x12\x14\n\x05value\x18\x03\x20\x01(\x0cR\x05value\"h\n\x0cS\ + canResponse\x121\n\x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb.Err\ + orR\x0bregionError\x12%\n\x05pairs\x18\x02\x20\x03(\x0b2\x0f.kvrpcpb.KvP\ + airR\x05pairs\"O\n\x08Mutation\x12\x1b\n\x02op\x18\x01\x20\x01(\x0e2\x0b\ + .kvrpcpb.OpR\x02op\x12\x10\n\x03key\x18\x02\x20\x01(\x0cR\x03key\x12\x14\ + \n\x05value\x18\x03\x20\x01(\x0cR\x05value\"\x85\x02\n\x0fPrewriteReques\ + t\x12*\n\x07context\x18\x01\x20\x01(\x0b2\x10.kvrpcpb.ContextR\x07contex\ + t\x12/\n\tmutations\x18\x02\x20\x03(\x0b2\x11.kvrpcpb.MutationR\tmutatio\ + ns\x12!\n\x0cprimary_lock\x18\x03\x20\x01(\x0cR\x0bprimaryLock\x12#\n\rs\ + tart_version\x18\x04\x20\x01(\x04R\x0cstartVersion\x12\x19\n\x08lock_ttl\ + \x18\x05\x20\x01(\x04R\x07lockTtl\x122\n\x15skip_constraint_check\x18\ + \x06\x20\x01(\x08R\x13skipConstraintCheck\"p\n\x10PrewriteResponse\x121\ + \n\x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb.ErrorR\x0bregionErr\ + or\x12)\n\x06errors\x18\x02\x20\x03(\x0b2\x11.kvrpcpb.KeyErrorR\x06error\ + s\"\xa9\x01\n\rCommitRequest\x12*\n\x07context\x18\x01\x20\x01(\x0b2\x10\ + .kvrpcpb.ContextR\x07context\x12#\n\rstart_version\x18\x02\x20\x01(\x04R\ + \x0cstartVersion\x12\x12\n\x04keys\x18\x03\x20\x03(\x0cR\x04keys\x12%\n\ + \x0ecommit_version\x18\x04\x20\x01(\x04R\rcommitVersionJ\x04\x08\x05\x10\ + \x06R\x06binlog\"l\n\x0eCommitResponse\x121\n\x0cregion_error\x18\x01\ + \x20\x01(\x0b2\x0e.errorpb.ErrorR\x0bregionError\x12'\n\x05error\x18\x02\ + \x20\x01(\x0b2\x11.kvrpcpb.KeyErrorR\x05error\"g\n\rImportRequest\x12/\n\ + \tmutations\x18\x01\x20\x03(\x0b2\x11.kvrpcpb.MutationR\tmutations\x12%\ + \n\x0ecommit_version\x18\x02\x20\x01(\x04R\rcommitVersion\"Y\n\x0eImport\ + Response\x121\n\x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb.ErrorR\ + \x0bregionError\x12\x14\n\x05error\x18\x02\x20\x01(\tR\x05error\"{\n\x14\ + BatchRollbackRequest\x12*\n\x07context\x18\x01\x20\x01(\x0b2\x10.kvrpcpb\ + .ContextR\x07context\x12#\n\rstart_version\x18\x02\x20\x01(\x04R\x0cstar\ + tVersion\x12\x12\n\x04keys\x18\x03\x20\x03(\x0cR\x04keys\"s\n\x15BatchRo\ + llbackResponse\x121\n\x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb.\ + ErrorR\x0bregionError\x12'\n\x05error\x18\x02\x20\x01(\x0b2\x11.kvrpcpb.\ + KeyErrorR\x05error\"s\n\x0eCleanupRequest\x12*\n\x07context\x18\x01\x20\ + \x01(\x0b2\x10.kvrpcpb.ContextR\x07context\x12\x10\n\x03key\x18\x02\x20\ + \x01(\x0cR\x03key\x12#\n\rstart_version\x18\x03\x20\x01(\x04R\x0cstartVe\ + rsion\"\x94\x01\n\x0fCleanupResponse\x121\n\x0cregion_error\x18\x01\x20\ + \x01(\x0b2\x0e.errorpb.ErrorR\x0bregionError\x12'\n\x05error\x18\x02\x20\ + \x01(\x0b2\x11.kvrpcpb.KeyErrorR\x05error\x12%\n\x0ecommit_version\x18\ + \x03\x20\x01(\x04R\rcommitVersion\"k\n\x0fBatchGetRequest\x12*\n\x07cont\ + ext\x18\x01\x20\x01(\x0b2\x10.kvrpcpb.ContextR\x07context\x12\x12\n\x04k\ + eys\x18\x02\x20\x03(\x0cR\x04keys\x12\x18\n\x07version\x18\x03\x20\x01(\ + \x04R\x07version\"l\n\x10BatchGetResponse\x121\n\x0cregion_error\x18\x01\ + \x20\x01(\x0b2\x0e.errorpb.ErrorR\x0bregionError\x12%\n\x05pairs\x18\x02\ + \x20\x03(\x0b2\x0f.kvrpcpb.KvPairR\x05pairs\"^\n\x0fScanLockRequest\x12*\ + \n\x07context\x18\x01\x20\x01(\x0b2\x10.kvrpcpb.ContextR\x07context\x12\ + \x1f\n\x0bmax_version\x18\x02\x20\x01(\x04R\nmaxVersion\"\x97\x01\n\x10S\ + canLockResponse\x121\n\x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb\ + .ErrorR\x0bregionError\x12'\n\x05error\x18\x02\x20\x01(\x0b2\x11.kvrpcpb\ + .KeyErrorR\x05error\x12'\n\x05locks\x18\x03\x20\x03(\x0b2\x11.kvrpcpb.Lo\ + ckInfoR\x05locks\"\x8c\x01\n\x12ResolveLockRequest\x12*\n\x07context\x18\ + \x01\x20\x01(\x0b2\x10.kvrpcpb.ContextR\x07context\x12#\n\rstart_version\ + \x18\x02\x20\x01(\x04R\x0cstartVersion\x12%\n\x0ecommit_version\x18\x03\ + \x20\x01(\x04R\rcommitVersion\"q\n\x13ResolveLockResponse\x121\n\x0cregi\ + on_error\x18\x01\x20\x01(\x0b2\x0e.errorpb.ErrorR\x0bregionError\x12'\n\ + \x05error\x18\x02\x20\x01(\x0b2\x11.kvrpcpb.KeyErrorR\x05error\"V\n\tGCR\ + equest\x12*\n\x07context\x18\x01\x20\x01(\x0b2\x10.kvrpcpb.ContextR\x07c\ + ontext\x12\x1d\n\nsafe_point\x18\x02\x20\x01(\x04R\tsafePoint\"h\n\nGCRe\ + sponse\x121\n\x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb.ErrorR\ + \x0bregionError\x12'\n\x05error\x18\x02\x20\x01(\x0b2\x11.kvrpcpb.KeyErr\ + orR\x05error\"M\n\rRawGetRequest\x12*\n\x07context\x18\x01\x20\x01(\x0b2\ + \x10.kvrpcpb.ContextR\x07context\x12\x10\n\x03key\x18\x02\x20\x01(\x0cR\ + \x03key\"o\n\x0eRawGetResponse\x121\n\x0cregion_error\x18\x01\x20\x01(\ + \x0b2\x0e.errorpb.ErrorR\x0bregionError\x12\x14\n\x05error\x18\x02\x20\ + \x01(\tR\x05error\x12\x14\n\x05value\x18\x03\x20\x01(\x0cR\x05value\"c\n\ + \rRawPutRequest\x12*\n\x07context\x18\x01\x20\x01(\x0b2\x10.kvrpcpb.Cont\ + extR\x07context\x12\x10\n\x03key\x18\x02\x20\x01(\x0cR\x03key\x12\x14\n\ + \x05value\x18\x03\x20\x01(\x0cR\x05value\"Y\n\x0eRawPutResponse\x121\n\ + \x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb.ErrorR\x0bregionError\ + \x12\x14\n\x05error\x18\x02\x20\x01(\tR\x05error\"P\n\x10RawDeleteReques\ + t\x12*\n\x07context\x18\x01\x20\x01(\x0b2\x10.kvrpcpb.ContextR\x07contex\ + t\x12\x10\n\x03key\x18\x02\x20\x01(\x0cR\x03key\"\\\n\x11RawDeleteRespon\ + se\x121\n\x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb.ErrorR\x0bre\ + gionError\x12\x14\n\x05error\x18\x02\x20\x01(\tR\x05error\"v\n\x12Delete\ + RangeRequest\x12*\n\x07context\x18\x01\x20\x01(\x0b2\x10.kvrpcpb.Context\ + R\x07context\x12\x1b\n\tstart_key\x18\x02\x20\x01(\x0cR\x08startKey\x12\ + \x17\n\x07end_key\x18\x03\x20\x01(\x0cR\x06endKey\"^\n\x13DeleteRangeRes\ + ponse\x121\n\x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb.ErrorR\ + \x0bregionError\x12\x14\n\x05error\x18\x02\x20\x01(\tR\x05error\"o\n\x0e\ + RawScanRequest\x12*\n\x07context\x18\x01\x20\x01(\x0b2\x10.kvrpcpb.Conte\ + xtR\x07context\x12\x1b\n\tstart_key\x18\x02\x20\x01(\x0cR\x08startKey\ + \x12\x14\n\x05limit\x18\x03\x20\x01(\rR\x05limit\"g\n\x0fRawScanResponse\ + \x121\n\x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb.ErrorR\x0bregi\ + onError\x12!\n\x03kvs\x18\x02\x20\x03(\x0b2\x0f.kvrpcpb.KvPairR\x03kvs\"\ + d\n\tWriteInfo\x12\x19\n\x08start_ts\x18\x01\x20\x01(\x04R\x07startTs\ + \x12\x1f\n\x04type\x18\x02\x20\x01(\x0e2\x0b.kvrpcpb.OpR\x04type\x12\x1b\ + \n\tcommit_ts\x18\x03\x20\x01(\x04R\x08commitTs\"W\n\tValueInfo\x12\x14\ + \n\x05value\x18\x01\x20\x01(\x0cR\x05value\x12\x0e\n\x02ts\x18\x02\x20\ + \x01(\x04R\x02ts\x12$\n\x0eis_short_value\x18\x03\x20\x01(\x08R\x0cisSho\ + rtValue\"\x89\x01\n\x08MvccInfo\x12%\n\x04lock\x18\x01\x20\x01(\x0b2\x11\ + .kvrpcpb.LockInfoR\x04lock\x12*\n\x06writes\x18\x02\x20\x03(\x0b2\x12.kv\ + rpcpb.WriteInfoR\x06writes\x12*\n\x06values\x18\x03\x20\x03(\x0b2\x12.kv\ + rpcpb.ValueInfoR\x06values\"S\n\x13MvccGetByKeyRequest\x12*\n\x07context\ + \x18\x01\x20\x01(\x0b2\x10.kvrpcpb.ContextR\x07context\x12\x10\n\x03key\ + \x18\x02\x20\x01(\x0cR\x03key\"\x86\x01\n\x14MvccGetByKeyResponse\x121\n\ + \x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb.ErrorR\x0bregionError\ + \x12\x14\n\x05error\x18\x02\x20\x01(\tR\x05error\x12%\n\x04info\x18\x03\ + \x20\x01(\x0b2\x11.kvrpcpb.MvccInfoR\x04info\"`\n\x17MvccGetByStartTsReq\ + uest\x12*\n\x07context\x18\x01\x20\x01(\x0b2\x10.kvrpcpb.ContextR\x07con\ + text\x12\x19\n\x08start_ts\x18\x02\x20\x01(\x04R\x07startTs\"\x9c\x01\n\ + \x18MvccGetByStartTsResponse\x121\n\x0cregion_error\x18\x01\x20\x01(\x0b\ + 2\x0e.errorpb.ErrorR\x0bregionError\x12\x14\n\x05error\x18\x02\x20\x01(\ + \tR\x05error\x12\x10\n\x03key\x18\x03\x20\x01(\x0cR\x03key\x12%\n\x04inf\ + o\x18\x04\x20\x01(\x0b2\x11.kvrpcpb.MvccInfoR\x04info*+\n\nCommandPri\ + \x12\n\n\x06Normal\x10\0\x12\x07\n\x03Low\x10\x01\x12\x08\n\x04High\x10\ + \x02*\x20\n\x0eIsolationLevel\x12\x06\n\x02SI\x10\0\x12\x06\n\x02RC\x10\ + \x01*.\n\x02Op\x12\x07\n\x03Put\x10\0\x12\x07\n\x03Del\x10\x01\x12\x08\n\ + \x04Lock\x10\x02\x12\x0c\n\x08Rollback\x10\x03B&\n\x18com.pingcap.tikv.k\ + vproto\xd0\xe2\x1e\x01\xc8\xe2\x1e\x01\xe0\xe2\x1e\x01J\xb5Z\n\x07\x12\ + \x05\0\0\xa3\x02\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\ + \x03\x01\x08\x0f\n\t\n\x02\x03\0\x12\x03\x03\x07\x15\n\t\n\x02\x03\x01\ + \x12\x03\x04\x07\x16\n\t\n\x02\x03\x02\x12\x03\x05\x07\x1d\n\x08\n\x01\ + \x08\x12\x03\x07\0(\n\x0b\n\x04\x08\xe7\x07\0\x12\x03\x07\0(\n\x0c\n\x05\ + \x08\xe7\x07\0\x02\x12\x03\x07\x07\x20\n\r\n\x06\x08\xe7\x07\0\x02\0\x12\ + \x03\x07\x07\x20\n\x0e\n\x07\x08\xe7\x07\0\x02\0\x01\x12\x03\x07\x08\x1f\ + \n\x0c\n\x05\x08\xe7\x07\0\x03\x12\x03\x07#'\n\x08\n\x01\x08\x12\x03\x08\ + \0$\n\x0b\n\x04\x08\xe7\x07\x01\x12\x03\x08\0$\n\x0c\n\x05\x08\xe7\x07\ + \x01\x02\x12\x03\x08\x07\x1c\n\r\n\x06\x08\xe7\x07\x01\x02\0\x12\x03\x08\ + \x07\x1c\n\x0e\n\x07\x08\xe7\x07\x01\x02\0\x01\x12\x03\x08\x08\x1b\n\x0c\ + \n\x05\x08\xe7\x07\x01\x03\x12\x03\x08\x1f#\n\x08\n\x01\x08\x12\x03\t\0*\ + \n\x0b\n\x04\x08\xe7\x07\x02\x12\x03\t\0*\n\x0c\n\x05\x08\xe7\x07\x02\ + \x02\x12\x03\t\x07\"\n\r\n\x06\x08\xe7\x07\x02\x02\0\x12\x03\t\x07\"\n\ + \x0e\n\x07\x08\xe7\x07\x02\x02\0\x01\x12\x03\t\x08!\n\x0c\n\x05\x08\xe7\ + \x07\x02\x03\x12\x03\t%)\n\x08\n\x01\x08\x12\x03\x0b\01\n\x0b\n\x04\x08\ + \xe7\x07\x03\x12\x03\x0b\01\n\x0c\n\x05\x08\xe7\x07\x03\x02\x12\x03\x0b\ + \x07\x13\n\r\n\x06\x08\xe7\x07\x03\x02\0\x12\x03\x0b\x07\x13\n\x0e\n\x07\ + \x08\xe7\x07\x03\x02\0\x01\x12\x03\x0b\x07\x13\n\x0c\n\x05\x08\xe7\x07\ + \x03\x07\x12\x03\x0b\x160\n\n\n\x02\x04\0\x12\x04\r\0\x12\x01\n\n\n\x03\ + \x04\0\x01\x12\x03\r\x08\x10\n\x0b\n\x04\x04\0\x02\0\x12\x03\x0e\x04\x1b\ + \n\r\n\x05\x04\0\x02\0\x04\x12\x04\x0e\x04\r\x12\n\x0c\n\x05\x04\0\x02\0\ + \x05\x12\x03\x0e\x04\t\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x0e\n\x16\n\ + \x0c\n\x05\x04\0\x02\0\x03\x12\x03\x0e\x19\x1a\n\x0b\n\x04\x04\0\x02\x01\ + \x12\x03\x0f\x04\x1c\n\r\n\x05\x04\0\x02\x01\x04\x12\x04\x0f\x04\x0e\x1b\ + \n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\x0f\x04\n\n\x0c\n\x05\x04\0\x02\ + \x01\x01\x12\x03\x0f\x0b\x17\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x0f\ + \x1a\x1b\n\x0b\n\x04\x04\0\x02\x02\x12\x03\x10\x04\x12\n\r\n\x05\x04\0\ + \x02\x02\x04\x12\x04\x10\x04\x0f\x1c\n\x0c\n\x05\x04\0\x02\x02\x05\x12\ + \x03\x10\x04\t\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x10\n\r\n\x0c\n\x05\ + \x04\0\x02\x02\x03\x12\x03\x10\x10\x11\n\x0b\n\x04\x04\0\x02\x03\x12\x03\ + \x11\x04\x18\n\r\n\x05\x04\0\x02\x03\x04\x12\x04\x11\x04\x10\x12\n\x0c\n\ + \x05\x04\0\x02\x03\x05\x12\x03\x11\x04\n\n\x0c\n\x05\x04\0\x02\x03\x01\ + \x12\x03\x11\x0b\x13\n\x0c\n\x05\x04\0\x02\x03\x03\x12\x03\x11\x16\x17\n\ + \n\n\x02\x04\x01\x12\x04\x14\0\x18\x01\n\n\n\x03\x04\x01\x01\x12\x03\x14\ + \x08\x10\nD\n\x04\x04\x01\x02\0\x12\x03\x15\x04\x18\"7\x20Client\x20shou\ + ld\x20backoff\x20or\x20cleanup\x20the\x20lock\x20then\x20retry.\n\n\r\n\ + \x05\x04\x01\x02\0\x04\x12\x04\x15\x04\x14\x12\n\x0c\n\x05\x04\x01\x02\0\ + \x06\x12\x03\x15\x04\x0c\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x15\r\x13\ + \n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x15\x16\x17\n>\n\x04\x04\x01\x02\ + \x01\x12\x03\x16\x04\x19\"1\x20Client\x20may\x20restart\x20the\x20txn.\ + \x20e.g\x20write\x20conflict.\n\n\r\n\x05\x04\x01\x02\x01\x04\x12\x04\ + \x16\x04\x15\x18\n\x0c\n\x05\x04\x01\x02\x01\x05\x12\x03\x16\x04\n\n\x0c\ + \n\x05\x04\x01\x02\x01\x01\x12\x03\x16\x0b\x14\n\x0c\n\x05\x04\x01\x02\ + \x01\x03\x12\x03\x16\x17\x18\n+\n\x04\x04\x01\x02\x02\x12\x03\x17\x04\ + \x15\"\x1e\x20Client\x20should\x20abort\x20the\x20txn.\n\n\r\n\x05\x04\ + \x01\x02\x02\x04\x12\x04\x17\x04\x16\x19\n\x0c\n\x05\x04\x01\x02\x02\x05\ + \x12\x03\x17\x04\n\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03\x17\x0b\x10\n\ + \x0c\n\x05\x04\x01\x02\x02\x03\x12\x03\x17\x13\x14\n\n\n\x02\x05\0\x12\ + \x04\x1a\0\x1e\x01\n\n\n\x03\x05\0\x01\x12\x03\x1a\x05\x0f\n,\n\x04\x05\ + \0\x02\0\x12\x03\x1b\x04\x0f\"\x1f\x20Normal\x20must\x20the\x20default\ + \x20value\n\n\x0c\n\x05\x05\0\x02\0\x01\x12\x03\x1b\x04\n\n\x0c\n\x05\ + \x05\0\x02\0\x02\x12\x03\x1b\r\x0e\n\x0b\n\x04\x05\0\x02\x01\x12\x03\x1c\ + \x04\x0c\n\x0c\n\x05\x05\0\x02\x01\x01\x12\x03\x1c\x04\x07\n\x0c\n\x05\ + \x05\0\x02\x01\x02\x12\x03\x1c\n\x0b\n\x0b\n\x04\x05\0\x02\x02\x12\x03\ + \x1d\x04\r\n\x0c\n\x05\x05\0\x02\x02\x01\x12\x03\x1d\x04\x08\n\x0c\n\x05\ + \x05\0\x02\x02\x02\x12\x03\x1d\x0b\x0c\n\n\n\x02\x05\x01\x12\x04\x20\0#\ + \x01\n\n\n\x03\x05\x01\x01\x12\x03\x20\x05\x13\n&\n\x04\x05\x01\x02\0\ + \x12\x03!\x04\x0b\"\x19\x20SI\x20=\x20snapshot\x20isolation\n\n\x0c\n\ + \x05\x05\x01\x02\0\x01\x12\x03!\x04\x06\n\x0c\n\x05\x05\x01\x02\0\x02\ + \x12\x03!\t\n\n\"\n\x04\x05\x01\x02\x01\x12\x03\"\x04\x0b\"\x15\x20RC\ + \x20=\x20read\x20committed\n\n\x0c\n\x05\x05\x01\x02\x01\x01\x12\x03\"\ + \x04\x06\n\x0c\n\x05\x05\x01\x02\x01\x02\x12\x03\"\t\n\n\n\n\x02\x04\x02\ + \x12\x04%\0.\x01\n\n\n\x03\x04\x02\x01\x12\x03%\x08\x0f\n\n\n\x03\x04\ + \x02\t\x12\x03&\r\x0f\n\x0b\n\x04\x04\x02\t\0\x12\x03&\r\x0e\n\x0c\n\x05\ + \x04\x02\t\0\x01\x12\x03&\r\x0e\n\x0c\n\x05\x04\x02\t\0\x02\x12\x03&\r\ + \x0e\n\n\n\x03\x04\x02\n\x12\x03'\r\x1b\n\x0b\n\x04\x04\x02\n\0\x12\x03'\ + \r\x1a\n\x0b\n\x04\x04\x02\x02\0\x12\x03(\x04\x19\n\r\n\x05\x04\x02\x02\ + \0\x04\x12\x04(\x04'\x1b\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03(\x04\n\n\ + \x0c\n\x05\x04\x02\x02\0\x01\x12\x03(\x0b\x14\n\x0c\n\x05\x04\x02\x02\0\ + \x03\x12\x03(\x17\x18\n\x0b\n\x04\x04\x02\x02\x01\x12\x03)\x04(\n\r\n\ + \x05\x04\x02\x02\x01\x04\x12\x04)\x04(\x19\n\x0c\n\x05\x04\x02\x02\x01\ + \x06\x12\x03)\x04\x16\n\x0c\n\x05\x04\x02\x02\x01\x01\x12\x03)\x17#\n\ + \x0c\n\x05\x04\x02\x02\x01\x03\x12\x03)&'\n\x0b\n\x04\x04\x02\x02\x02\ + \x12\x03*\x04\x19\n\r\n\x05\x04\x02\x02\x02\x04\x12\x04*\x04)(\n\x0c\n\ + \x05\x04\x02\x02\x02\x06\x12\x03*\x04\x0f\n\x0c\n\x05\x04\x02\x02\x02\ + \x01\x12\x03*\x10\x14\n\x0c\n\x05\x04\x02\x02\x02\x03\x12\x03*\x17\x18\n\ + \x0b\n\x04\x04\x02\x02\x03\x12\x03+\x04\x14\n\r\n\x05\x04\x02\x02\x03\ + \x04\x12\x04+\x04*\x19\n\x0c\n\x05\x04\x02\x02\x03\x05\x12\x03+\x04\n\n\ + \x0c\n\x05\x04\x02\x02\x03\x01\x12\x03+\x0b\x0f\n\x0c\n\x05\x04\x02\x02\ + \x03\x03\x12\x03+\x12\x13\n\x0b\n\x04\x04\x02\x02\x04\x12\x03,\x04\x1c\n\ + \r\n\x05\x04\x02\x02\x04\x04\x12\x04,\x04+\x14\n\x0c\n\x05\x04\x02\x02\ + \x04\x06\x12\x03,\x04\x0e\n\x0c\n\x05\x04\x02\x02\x04\x01\x12\x03,\x0f\ + \x17\n\x0c\n\x05\x04\x02\x02\x04\x03\x12\x03,\x1a\x1b\n\x0b\n\x04\x04\ + \x02\x02\x05\x12\x03-\x04'\n\r\n\x05\x04\x02\x02\x05\x04\x12\x04-\x04,\ + \x1c\n\x0c\n\x05\x04\x02\x02\x05\x06\x12\x03-\x04\x12\n\x0c\n\x05\x04\ + \x02\x02\x05\x01\x12\x03-\x13\"\n\x0c\n\x05\x04\x02\x02\x05\x03\x12\x03-\ + %&\n\n\n\x02\x04\x03\x12\x040\04\x01\n\n\n\x03\x04\x03\x01\x12\x030\x08\ + \x12\n\x0b\n\x04\x04\x03\x02\0\x12\x031\x04\x18\n\r\n\x05\x04\x03\x02\0\ + \x04\x12\x041\x040\x14\n\x0c\n\x05\x04\x03\x02\0\x06\x12\x031\x04\x0b\n\ + \x0c\n\x05\x04\x03\x02\0\x01\x12\x031\x0c\x13\n\x0c\n\x05\x04\x03\x02\0\ + \x03\x12\x031\x16\x17\n\x0b\n\x04\x04\x03\x02\x01\x12\x032\x04\x12\n\r\n\ + \x05\x04\x03\x02\x01\x04\x12\x042\x041\x18\n\x0c\n\x05\x04\x03\x02\x01\ + \x05\x12\x032\x04\t\n\x0c\n\x05\x04\x03\x02\x01\x01\x12\x032\n\r\n\x0c\n\ + \x05\x04\x03\x02\x01\x03\x12\x032\x10\x11\n\x0b\n\x04\x04\x03\x02\x02\ + \x12\x033\x04\x17\n\r\n\x05\x04\x03\x02\x02\x04\x12\x043\x042\x12\n\x0c\ + \n\x05\x04\x03\x02\x02\x05\x12\x033\x04\n\n\x0c\n\x05\x04\x03\x02\x02\ + \x01\x12\x033\x0b\x12\n\x0c\n\x05\x04\x03\x02\x02\x03\x12\x033\x15\x16\n\ + \n\n\x02\x04\x04\x12\x046\0:\x01\n\n\n\x03\x04\x04\x01\x12\x036\x08\x13\ + \n\x0b\n\x04\x04\x04\x02\0\x12\x037\x04#\n\r\n\x05\x04\x04\x02\0\x04\x12\ + \x047\x046\x15\n\x0c\n\x05\x04\x04\x02\0\x06\x12\x037\x04\x11\n\x0c\n\ + \x05\x04\x04\x02\0\x01\x12\x037\x12\x1e\n\x0c\n\x05\x04\x04\x02\0\x03\ + \x12\x037!\"\n\x0b\n\x04\x04\x04\x02\x01\x12\x038\x04\x17\n\r\n\x05\x04\ + \x04\x02\x01\x04\x12\x048\x047#\n\x0c\n\x05\x04\x04\x02\x01\x06\x12\x038\ + \x04\x0c\n\x0c\n\x05\x04\x04\x02\x01\x01\x12\x038\r\x12\n\x0c\n\x05\x04\ + \x04\x02\x01\x03\x12\x038\x15\x16\n\x0b\n\x04\x04\x04\x02\x02\x12\x039\ + \x04\x14\n\r\n\x05\x04\x04\x02\x02\x04\x12\x049\x048\x17\n\x0c\n\x05\x04\ + \x04\x02\x02\x05\x12\x039\x04\t\n\x0c\n\x05\x04\x04\x02\x02\x01\x12\x039\ + \n\x0f\n\x0c\n\x05\x04\x04\x02\x02\x03\x12\x039\x12\x13\n\n\n\x02\x04\ + \x05\x12\x04<\0B\x01\n\n\n\x03\x04\x05\x01\x12\x03<\x08\x13\n\x0b\n\x04\ + \x04\x05\x02\0\x12\x03=\x04\x18\n\r\n\x05\x04\x05\x02\0\x04\x12\x04=\x04\ + <\x15\n\x0c\n\x05\x04\x05\x02\0\x06\x12\x03=\x04\x0b\n\x0c\n\x05\x04\x05\ + \x02\0\x01\x12\x03=\x0c\x13\n\x0c\n\x05\x04\x05\x02\0\x03\x12\x03=\x16\ + \x17\n\x0b\n\x04\x04\x05\x02\x01\x12\x03>\x04\x18\n\r\n\x05\x04\x05\x02\ + \x01\x04\x12\x04>\x04=\x18\n\x0c\n\x05\x04\x05\x02\x01\x05\x12\x03>\x04\ + \t\n\x0c\n\x05\x04\x05\x02\x01\x01\x12\x03>\n\x13\n\x0c\n\x05\x04\x05\ + \x02\x01\x03\x12\x03>\x16\x17\n\x0b\n\x04\x04\x05\x02\x02\x12\x03?\x04\ + \x15\n\r\n\x05\x04\x05\x02\x02\x04\x12\x04?\x04>\x18\n\x0c\n\x05\x04\x05\ + \x02\x02\x05\x12\x03?\x04\n\n\x0c\n\x05\x04\x05\x02\x02\x01\x12\x03?\x0b\ + \x10\n\x0c\n\x05\x04\x05\x02\x02\x03\x12\x03?\x13\x14\n\x0b\n\x04\x04\ + \x05\x02\x03\x12\x03@\x04\x17\n\r\n\x05\x04\x05\x02\x03\x04\x12\x04@\x04\ + ?\x15\n\x0c\n\x05\x04\x05\x02\x03\x05\x12\x03@\x04\n\n\x0c\n\x05\x04\x05\ + \x02\x03\x01\x12\x03@\x0b\x12\n\x0c\n\x05\x04\x05\x02\x03\x03\x12\x03@\ + \x15\x16\n\x0b\n\x04\x04\x05\x02\x04\x12\x03A\x04\x16\n\r\n\x05\x04\x05\ + \x02\x04\x04\x12\x04A\x04@\x17\n\x0c\n\x05\x04\x05\x02\x04\x05\x12\x03A\ + \x04\x08\n\x0c\n\x05\x04\x05\x02\x04\x01\x12\x03A\t\x11\n\x0c\n\x05\x04\ + \x05\x02\x04\x03\x12\x03A\x14\x15\n\n\n\x02\x04\x06\x12\x04D\0H\x01\n\n\ + \n\x03\x04\x06\x01\x12\x03D\x08\x0e\n\x0b\n\x04\x04\x06\x02\0\x12\x03E\ + \x04\x17\n\r\n\x05\x04\x06\x02\0\x04\x12\x04E\x04D\x10\n\x0c\n\x05\x04\ + \x06\x02\0\x06\x12\x03E\x04\x0c\n\x0c\n\x05\x04\x06\x02\0\x01\x12\x03E\r\ + \x12\n\x0c\n\x05\x04\x06\x02\0\x03\x12\x03E\x15\x16\n\x0b\n\x04\x04\x06\ + \x02\x01\x12\x03F\x04\x12\n\r\n\x05\x04\x06\x02\x01\x04\x12\x04F\x04E\ + \x17\n\x0c\n\x05\x04\x06\x02\x01\x05\x12\x03F\x04\t\n\x0c\n\x05\x04\x06\ + \x02\x01\x01\x12\x03F\n\r\n\x0c\n\x05\x04\x06\x02\x01\x03\x12\x03F\x10\ + \x11\n\x0b\n\x04\x04\x06\x02\x02\x12\x03G\x04\x14\n\r\n\x05\x04\x06\x02\ + \x02\x04\x12\x04G\x04F\x12\n\x0c\n\x05\x04\x06\x02\x02\x05\x12\x03G\x04\ + \t\n\x0c\n\x05\x04\x06\x02\x02\x01\x12\x03G\n\x0f\n\x0c\n\x05\x04\x06\ + \x02\x02\x03\x12\x03G\x12\x13\n\n\n\x02\x04\x07\x12\x04J\0M\x01\n\n\n\ + \x03\x04\x07\x01\x12\x03J\x08\x14\n\x0b\n\x04\x04\x07\x02\0\x12\x03K\x04\ + #\n\r\n\x05\x04\x07\x02\0\x04\x12\x04K\x04J\x16\n\x0c\n\x05\x04\x07\x02\ + \0\x06\x12\x03K\x04\x11\n\x0c\n\x05\x04\x07\x02\0\x01\x12\x03K\x12\x1e\n\ + \x0c\n\x05\x04\x07\x02\0\x03\x12\x03K!\"\n\x0b\n\x04\x04\x07\x02\x01\x12\ + \x03L\x04\x1e\n\x0c\n\x05\x04\x07\x02\x01\x04\x12\x03L\x04\x0c\n\x0c\n\ + \x05\x04\x07\x02\x01\x06\x12\x03L\r\x13\n\x0c\n\x05\x04\x07\x02\x01\x01\ + \x12\x03L\x14\x19\n\x0c\n\x05\x04\x07\x02\x01\x03\x12\x03L\x1c\x1d\n\n\n\ + \x02\x05\x02\x12\x04O\0T\x01\n\n\n\x03\x05\x02\x01\x12\x03O\x05\x07\n\ + \x0b\n\x04\x05\x02\x02\0\x12\x03P\x04\x0c\n\x0c\n\x05\x05\x02\x02\0\x01\ + \x12\x03P\x04\x07\n\x0c\n\x05\x05\x02\x02\0\x02\x12\x03P\n\x0b\n\x0b\n\ + \x04\x05\x02\x02\x01\x12\x03Q\x04\x0c\n\x0c\n\x05\x05\x02\x02\x01\x01\ + \x12\x03Q\x04\x07\n\x0c\n\x05\x05\x02\x02\x01\x02\x12\x03Q\n\x0b\n\x0b\n\ + \x04\x05\x02\x02\x02\x12\x03R\x04\r\n\x0c\n\x05\x05\x02\x02\x02\x01\x12\ + \x03R\x04\x08\n\x0c\n\x05\x05\x02\x02\x02\x02\x12\x03R\x0b\x0c\n\x0b\n\ + \x04\x05\x02\x02\x03\x12\x03S\x04\x11\n\x0c\n\x05\x05\x02\x02\x03\x01\ + \x12\x03S\x04\x0c\n\x0c\n\x05\x05\x02\x02\x03\x02\x12\x03S\x0f\x10\n\n\n\ + \x02\x04\x08\x12\x04V\0Z\x01\n\n\n\x03\x04\x08\x01\x12\x03V\x08\x10\n\ + \x0b\n\x04\x04\x08\x02\0\x12\x03W\x04\x0e\n\r\n\x05\x04\x08\x02\0\x04\ + \x12\x04W\x04V\x12\n\x0c\n\x05\x04\x08\x02\0\x06\x12\x03W\x04\x06\n\x0c\ + \n\x05\x04\x08\x02\0\x01\x12\x03W\x07\t\n\x0c\n\x05\x04\x08\x02\0\x03\ + \x12\x03W\x0c\r\n\x0b\n\x04\x04\x08\x02\x01\x12\x03X\x04\x12\n\r\n\x05\ + \x04\x08\x02\x01\x04\x12\x04X\x04W\x0e\n\x0c\n\x05\x04\x08\x02\x01\x05\ + \x12\x03X\x04\t\n\x0c\n\x05\x04\x08\x02\x01\x01\x12\x03X\n\r\n\x0c\n\x05\ + \x04\x08\x02\x01\x03\x12\x03X\x10\x11\n\x0b\n\x04\x04\x08\x02\x02\x12\ + \x03Y\x04\x14\n\r\n\x05\x04\x08\x02\x02\x04\x12\x04Y\x04X\x12\n\x0c\n\ + \x05\x04\x08\x02\x02\x05\x12\x03Y\x04\t\n\x0c\n\x05\x04\x08\x02\x02\x01\ + \x12\x03Y\n\x0f\n\x0c\n\x05\x04\x08\x02\x02\x03\x12\x03Y\x12\x13\n\n\n\ + \x02\x04\t\x12\x04\\\0d\x01\n\n\n\x03\x04\t\x01\x12\x03\\\x08\x17\n\x0b\ + \n\x04\x04\t\x02\0\x12\x03]\x04\x18\n\r\n\x05\x04\t\x02\0\x04\x12\x04]\ + \x04\\\x19\n\x0c\n\x05\x04\t\x02\0\x06\x12\x03]\x04\x0b\n\x0c\n\x05\x04\ + \t\x02\0\x01\x12\x03]\x0c\x13\n\x0c\n\x05\x04\t\x02\0\x03\x12\x03]\x16\ + \x17\n\x0b\n\x04\x04\t\x02\x01\x12\x03^\x04$\n\x0c\n\x05\x04\t\x02\x01\ + \x04\x12\x03^\x04\x0c\n\x0c\n\x05\x04\t\x02\x01\x06\x12\x03^\r\x15\n\x0c\ + \n\x05\x04\t\x02\x01\x01\x12\x03^\x16\x1f\n\x0c\n\x05\x04\t\x02\x01\x03\ + \x12\x03^\"#\n\x1f\n\x04\x04\t\x02\x02\x12\x03`\x04\x1b\x1a\x12\x20prima\ + ry_lock_key\n\n\r\n\x05\x04\t\x02\x02\x04\x12\x04`\x04^$\n\x0c\n\x05\x04\ + \t\x02\x02\x05\x12\x03`\x04\t\n\x0c\n\x05\x04\t\x02\x02\x01\x12\x03`\n\ + \x16\n\x0c\n\x05\x04\t\x02\x02\x03\x12\x03`\x19\x1a\n\x0b\n\x04\x04\t\ + \x02\x03\x12\x03a\x04\x1d\n\r\n\x05\x04\t\x02\x03\x04\x12\x04a\x04`\x1b\ + \n\x0c\n\x05\x04\t\x02\x03\x05\x12\x03a\x04\n\n\x0c\n\x05\x04\t\x02\x03\ + \x01\x12\x03a\x0b\x18\n\x0c\n\x05\x04\t\x02\x03\x03\x12\x03a\x1b\x1c\n\ + \x0b\n\x04\x04\t\x02\x04\x12\x03b\x04\x18\n\r\n\x05\x04\t\x02\x04\x04\ + \x12\x04b\x04a\x1d\n\x0c\n\x05\x04\t\x02\x04\x05\x12\x03b\x04\n\n\x0c\n\ + \x05\x04\t\x02\x04\x01\x12\x03b\x0b\x13\n\x0c\n\x05\x04\t\x02\x04\x03\ + \x12\x03b\x16\x17\n\x0b\n\x04\x04\t\x02\x05\x12\x03c\x04#\n\r\n\x05\x04\ + \t\x02\x05\x04\x12\x04c\x04b\x18\n\x0c\n\x05\x04\t\x02\x05\x05\x12\x03c\ + \x04\x08\n\x0c\n\x05\x04\t\x02\x05\x01\x12\x03c\t\x1e\n\x0c\n\x05\x04\t\ + \x02\x05\x03\x12\x03c!\"\n\n\n\x02\x04\n\x12\x04f\0i\x01\n\n\n\x03\x04\n\ + \x01\x12\x03f\x08\x18\n\x0b\n\x04\x04\n\x02\0\x12\x03g\x04#\n\r\n\x05\ + \x04\n\x02\0\x04\x12\x04g\x04f\x1a\n\x0c\n\x05\x04\n\x02\0\x06\x12\x03g\ + \x04\x11\n\x0c\n\x05\x04\n\x02\0\x01\x12\x03g\x12\x1e\n\x0c\n\x05\x04\n\ + \x02\0\x03\x12\x03g!\"\n\x0b\n\x04\x04\n\x02\x01\x12\x03h\x04!\n\x0c\n\ + \x05\x04\n\x02\x01\x04\x12\x03h\x04\x0c\n\x0c\n\x05\x04\n\x02\x01\x06\ + \x12\x03h\r\x15\n\x0c\n\x05\x04\n\x02\x01\x01\x12\x03h\x16\x1c\n\x0c\n\ + \x05\x04\n\x02\x01\x03\x12\x03h\x1f\x20\n\n\n\x02\x04\x0b\x12\x04k\0r\ + \x01\n\n\n\x03\x04\x0b\x01\x12\x03k\x08\x15\n\n\n\x03\x04\x0b\t\x12\x03l\ + \r\x0f\n\x0b\n\x04\x04\x0b\t\0\x12\x03l\r\x0e\n\x0c\n\x05\x04\x0b\t\0\ + \x01\x12\x03l\r\x0e\n\x0c\n\x05\x04\x0b\t\0\x02\x12\x03l\r\x0e\n\n\n\x03\ + \x04\x0b\n\x12\x03m\r\x16\n\x0b\n\x04\x04\x0b\n\0\x12\x03m\r\x15\n\x0b\n\ + \x04\x04\x0b\x02\0\x12\x03n\x04\x18\n\r\n\x05\x04\x0b\x02\0\x04\x12\x04n\ + \x04m\x16\n\x0c\n\x05\x04\x0b\x02\0\x06\x12\x03n\x04\x0b\n\x0c\n\x05\x04\ + \x0b\x02\0\x01\x12\x03n\x0c\x13\n\x0c\n\x05\x04\x0b\x02\0\x03\x12\x03n\ + \x16\x17\n\x0b\n\x04\x04\x0b\x02\x01\x12\x03o\x04\x1d\n\r\n\x05\x04\x0b\ + \x02\x01\x04\x12\x04o\x04n\x18\n\x0c\n\x05\x04\x0b\x02\x01\x05\x12\x03o\ + \x04\n\n\x0c\n\x05\x04\x0b\x02\x01\x01\x12\x03o\x0b\x18\n\x0c\n\x05\x04\ + \x0b\x02\x01\x03\x12\x03o\x1b\x1c\n\x0b\n\x04\x04\x0b\x02\x02\x12\x03p\ + \x04\x1c\n\x0c\n\x05\x04\x0b\x02\x02\x04\x12\x03p\x04\x0c\n\x0c\n\x05\ + \x04\x0b\x02\x02\x05\x12\x03p\r\x12\n\x0c\n\x05\x04\x0b\x02\x02\x01\x12\ + \x03p\x13\x17\n\x0c\n\x05\x04\x0b\x02\x02\x03\x12\x03p\x1a\x1b\n\x0b\n\ + \x04\x04\x0b\x02\x03\x12\x03q\x04\x1e\n\r\n\x05\x04\x0b\x02\x03\x04\x12\ + \x04q\x04p\x1c\n\x0c\n\x05\x04\x0b\x02\x03\x05\x12\x03q\x04\n\n\x0c\n\ + \x05\x04\x0b\x02\x03\x01\x12\x03q\x0b\x19\n\x0c\n\x05\x04\x0b\x02\x03\ + \x03\x12\x03q\x1c\x1d\n\n\n\x02\x04\x0c\x12\x04t\0w\x01\n\n\n\x03\x04\ + \x0c\x01\x12\x03t\x08\x16\n\x0b\n\x04\x04\x0c\x02\0\x12\x03u\x04#\n\r\n\ + \x05\x04\x0c\x02\0\x04\x12\x04u\x04t\x18\n\x0c\n\x05\x04\x0c\x02\0\x06\ + \x12\x03u\x04\x11\n\x0c\n\x05\x04\x0c\x02\0\x01\x12\x03u\x12\x1e\n\x0c\n\ + \x05\x04\x0c\x02\0\x03\x12\x03u!\"\n\x0b\n\x04\x04\x0c\x02\x01\x12\x03v\ + \x04\x17\n\r\n\x05\x04\x0c\x02\x01\x04\x12\x04v\x04u#\n\x0c\n\x05\x04\ + \x0c\x02\x01\x06\x12\x03v\x04\x0c\n\x0c\n\x05\x04\x0c\x02\x01\x01\x12\ + \x03v\r\x12\n\x0c\n\x05\x04\x0c\x02\x01\x03\x12\x03v\x15\x16\n\n\n\x02\ + \x04\r\x12\x04y\0|\x01\n\n\n\x03\x04\r\x01\x12\x03y\x08\x15\n\x0b\n\x04\ + \x04\r\x02\0\x12\x03z\x04$\n\x0c\n\x05\x04\r\x02\0\x04\x12\x03z\x04\x0c\ + \n\x0c\n\x05\x04\r\x02\0\x06\x12\x03z\r\x15\n\x0c\n\x05\x04\r\x02\0\x01\ + \x12\x03z\x16\x1f\n\x0c\n\x05\x04\r\x02\0\x03\x12\x03z\"#\n\x0b\n\x04\ + \x04\r\x02\x01\x12\x03{\x04\x1e\n\r\n\x05\x04\r\x02\x01\x04\x12\x04{\x04\ + z$\n\x0c\n\x05\x04\r\x02\x01\x05\x12\x03{\x04\n\n\x0c\n\x05\x04\r\x02\ + \x01\x01\x12\x03{\x0b\x19\n\x0c\n\x05\x04\r\x02\x01\x03\x12\x03{\x1c\x1d\ + \n\x0b\n\x02\x04\x0e\x12\x05~\0\x81\x01\x01\n\n\n\x03\x04\x0e\x01\x12\ + \x03~\x08\x16\n\x0b\n\x04\x04\x0e\x02\0\x12\x03\x7f\x04#\n\r\n\x05\x04\ + \x0e\x02\0\x04\x12\x04\x7f\x04~\x18\n\x0c\n\x05\x04\x0e\x02\0\x06\x12\ + \x03\x7f\x04\x11\n\x0c\n\x05\x04\x0e\x02\0\x01\x12\x03\x7f\x12\x1e\n\x0c\ + \n\x05\x04\x0e\x02\0\x03\x12\x03\x7f!\"\n\x0c\n\x04\x04\x0e\x02\x01\x12\ + \x04\x80\x01\x04\x15\n\x0e\n\x05\x04\x0e\x02\x01\x04\x12\x05\x80\x01\x04\ + \x7f#\n\r\n\x05\x04\x0e\x02\x01\x05\x12\x04\x80\x01\x04\n\n\r\n\x05\x04\ + \x0e\x02\x01\x01\x12\x04\x80\x01\x0b\x10\n\r\n\x05\x04\x0e\x02\x01\x03\ + \x12\x04\x80\x01\x13\x14\n\x0c\n\x02\x04\x0f\x12\x06\x83\x01\0\x87\x01\ + \x01\n\x0b\n\x03\x04\x0f\x01\x12\x04\x83\x01\x08\x1c\n\x0c\n\x04\x04\x0f\ + \x02\0\x12\x04\x84\x01\x04\x18\n\x0f\n\x05\x04\x0f\x02\0\x04\x12\x06\x84\ + \x01\x04\x83\x01\x1e\n\r\n\x05\x04\x0f\x02\0\x06\x12\x04\x84\x01\x04\x0b\ + \n\r\n\x05\x04\x0f\x02\0\x01\x12\x04\x84\x01\x0c\x13\n\r\n\x05\x04\x0f\ + \x02\0\x03\x12\x04\x84\x01\x16\x17\n\x0c\n\x04\x04\x0f\x02\x01\x12\x04\ + \x85\x01\x04\x1d\n\x0f\n\x05\x04\x0f\x02\x01\x04\x12\x06\x85\x01\x04\x84\ + \x01\x18\n\r\n\x05\x04\x0f\x02\x01\x05\x12\x04\x85\x01\x04\n\n\r\n\x05\ + \x04\x0f\x02\x01\x01\x12\x04\x85\x01\x0b\x18\n\r\n\x05\x04\x0f\x02\x01\ + \x03\x12\x04\x85\x01\x1b\x1c\n\x0c\n\x04\x04\x0f\x02\x02\x12\x04\x86\x01\ + \x04\x1c\n\r\n\x05\x04\x0f\x02\x02\x04\x12\x04\x86\x01\x04\x0c\n\r\n\x05\ + \x04\x0f\x02\x02\x05\x12\x04\x86\x01\r\x12\n\r\n\x05\x04\x0f\x02\x02\x01\ + \x12\x04\x86\x01\x13\x17\n\r\n\x05\x04\x0f\x02\x02\x03\x12\x04\x86\x01\ + \x1a\x1b\n\x0c\n\x02\x04\x10\x12\x06\x89\x01\0\x8c\x01\x01\n\x0b\n\x03\ + \x04\x10\x01\x12\x04\x89\x01\x08\x1d\n\x0c\n\x04\x04\x10\x02\0\x12\x04\ + \x8a\x01\x04#\n\x0f\n\x05\x04\x10\x02\0\x04\x12\x06\x8a\x01\x04\x89\x01\ + \x1f\n\r\n\x05\x04\x10\x02\0\x06\x12\x04\x8a\x01\x04\x11\n\r\n\x05\x04\ + \x10\x02\0\x01\x12\x04\x8a\x01\x12\x1e\n\r\n\x05\x04\x10\x02\0\x03\x12\ + \x04\x8a\x01!\"\n\x0c\n\x04\x04\x10\x02\x01\x12\x04\x8b\x01\x04\x17\n\ + \x0f\n\x05\x04\x10\x02\x01\x04\x12\x06\x8b\x01\x04\x8a\x01#\n\r\n\x05\ + \x04\x10\x02\x01\x06\x12\x04\x8b\x01\x04\x0c\n\r\n\x05\x04\x10\x02\x01\ + \x01\x12\x04\x8b\x01\r\x12\n\r\n\x05\x04\x10\x02\x01\x03\x12\x04\x8b\x01\ + \x15\x16\n\x0c\n\x02\x04\x11\x12\x06\x8e\x01\0\x92\x01\x01\n\x0b\n\x03\ + \x04\x11\x01\x12\x04\x8e\x01\x08\x16\n\x0c\n\x04\x04\x11\x02\0\x12\x04\ + \x8f\x01\x04\x18\n\x0f\n\x05\x04\x11\x02\0\x04\x12\x06\x8f\x01\x04\x8e\ + \x01\x18\n\r\n\x05\x04\x11\x02\0\x06\x12\x04\x8f\x01\x04\x0b\n\r\n\x05\ + \x04\x11\x02\0\x01\x12\x04\x8f\x01\x0c\x13\n\r\n\x05\x04\x11\x02\0\x03\ + \x12\x04\x8f\x01\x16\x17\n\x0c\n\x04\x04\x11\x02\x01\x12\x04\x90\x01\x04\ + \x12\n\x0f\n\x05\x04\x11\x02\x01\x04\x12\x06\x90\x01\x04\x8f\x01\x18\n\r\ + \n\x05\x04\x11\x02\x01\x05\x12\x04\x90\x01\x04\t\n\r\n\x05\x04\x11\x02\ + \x01\x01\x12\x04\x90\x01\n\r\n\r\n\x05\x04\x11\x02\x01\x03\x12\x04\x90\ + \x01\x10\x11\n\x0c\n\x04\x04\x11\x02\x02\x12\x04\x91\x01\x04\x1d\n\x0f\n\ + \x05\x04\x11\x02\x02\x04\x12\x06\x91\x01\x04\x90\x01\x12\n\r\n\x05\x04\ + \x11\x02\x02\x05\x12\x04\x91\x01\x04\n\n\r\n\x05\x04\x11\x02\x02\x01\x12\ + \x04\x91\x01\x0b\x18\n\r\n\x05\x04\x11\x02\x02\x03\x12\x04\x91\x01\x1b\ + \x1c\n\x0c\n\x02\x04\x12\x12\x06\x94\x01\0\x98\x01\x01\n\x0b\n\x03\x04\ + \x12\x01\x12\x04\x94\x01\x08\x17\n\x0c\n\x04\x04\x12\x02\0\x12\x04\x95\ + \x01\x04#\n\x0f\n\x05\x04\x12\x02\0\x04\x12\x06\x95\x01\x04\x94\x01\x19\ + \n\r\n\x05\x04\x12\x02\0\x06\x12\x04\x95\x01\x04\x11\n\r\n\x05\x04\x12\ + \x02\0\x01\x12\x04\x95\x01\x12\x1e\n\r\n\x05\x04\x12\x02\0\x03\x12\x04\ + \x95\x01!\"\n\x0c\n\x04\x04\x12\x02\x01\x12\x04\x96\x01\x04\x17\n\x0f\n\ + \x05\x04\x12\x02\x01\x04\x12\x06\x96\x01\x04\x95\x01#\n\r\n\x05\x04\x12\ + \x02\x01\x06\x12\x04\x96\x01\x04\x0c\n\r\n\x05\x04\x12\x02\x01\x01\x12\ + \x04\x96\x01\r\x12\n\r\n\x05\x04\x12\x02\x01\x03\x12\x04\x96\x01\x15\x16\ + \n8\n\x04\x04\x12\x02\x02\x12\x04\x97\x01\x04\x1e\"*\x20set\x20this\x20i\ + f\x20the\x20key\x20is\x20already\x20committed\n\n\x0f\n\x05\x04\x12\x02\ + \x02\x04\x12\x06\x97\x01\x04\x96\x01\x17\n\r\n\x05\x04\x12\x02\x02\x05\ + \x12\x04\x97\x01\x04\n\n\r\n\x05\x04\x12\x02\x02\x01\x12\x04\x97\x01\x0b\ + \x19\n\r\n\x05\x04\x12\x02\x02\x03\x12\x04\x97\x01\x1c\x1d\n\x0c\n\x02\ + \x04\x13\x12\x06\x9a\x01\0\x9e\x01\x01\n\x0b\n\x03\x04\x13\x01\x12\x04\ + \x9a\x01\x08\x17\n\x0c\n\x04\x04\x13\x02\0\x12\x04\x9b\x01\x04\x18\n\x0f\ + \n\x05\x04\x13\x02\0\x04\x12\x06\x9b\x01\x04\x9a\x01\x19\n\r\n\x05\x04\ + \x13\x02\0\x06\x12\x04\x9b\x01\x04\x0b\n\r\n\x05\x04\x13\x02\0\x01\x12\ + \x04\x9b\x01\x0c\x13\n\r\n\x05\x04\x13\x02\0\x03\x12\x04\x9b\x01\x16\x17\ + \n\x0c\n\x04\x04\x13\x02\x01\x12\x04\x9c\x01\x04\x1c\n\r\n\x05\x04\x13\ + \x02\x01\x04\x12\x04\x9c\x01\x04\x0c\n\r\n\x05\x04\x13\x02\x01\x05\x12\ + \x04\x9c\x01\r\x12\n\r\n\x05\x04\x13\x02\x01\x01\x12\x04\x9c\x01\x13\x17\ + \n\r\n\x05\x04\x13\x02\x01\x03\x12\x04\x9c\x01\x1a\x1b\n\x0c\n\x04\x04\ + \x13\x02\x02\x12\x04\x9d\x01\x04\x17\n\x0f\n\x05\x04\x13\x02\x02\x04\x12\ + \x06\x9d\x01\x04\x9c\x01\x1c\n\r\n\x05\x04\x13\x02\x02\x05\x12\x04\x9d\ + \x01\x04\n\n\r\n\x05\x04\x13\x02\x02\x01\x12\x04\x9d\x01\x0b\x12\n\r\n\ + \x05\x04\x13\x02\x02\x03\x12\x04\x9d\x01\x15\x16\n\x0c\n\x02\x04\x14\x12\ + \x06\xa0\x01\0\xa3\x01\x01\n\x0b\n\x03\x04\x14\x01\x12\x04\xa0\x01\x08\ + \x18\n\x0c\n\x04\x04\x14\x02\0\x12\x04\xa1\x01\x04#\n\x0f\n\x05\x04\x14\ + \x02\0\x04\x12\x06\xa1\x01\x04\xa0\x01\x1a\n\r\n\x05\x04\x14\x02\0\x06\ + \x12\x04\xa1\x01\x04\x11\n\r\n\x05\x04\x14\x02\0\x01\x12\x04\xa1\x01\x12\ + \x1e\n\r\n\x05\x04\x14\x02\0\x03\x12\x04\xa1\x01!\"\n\x0c\n\x04\x04\x14\ + \x02\x01\x12\x04\xa2\x01\x04\x1e\n\r\n\x05\x04\x14\x02\x01\x04\x12\x04\ + \xa2\x01\x04\x0c\n\r\n\x05\x04\x14\x02\x01\x06\x12\x04\xa2\x01\r\x13\n\r\ + \n\x05\x04\x14\x02\x01\x01\x12\x04\xa2\x01\x14\x19\n\r\n\x05\x04\x14\x02\ + \x01\x03\x12\x04\xa2\x01\x1c\x1d\n\x0c\n\x02\x04\x15\x12\x06\xa5\x01\0\ + \xa8\x01\x01\n\x0b\n\x03\x04\x15\x01\x12\x04\xa5\x01\x08\x17\n\x0c\n\x04\ + \x04\x15\x02\0\x12\x04\xa6\x01\x04\x18\n\x0f\n\x05\x04\x15\x02\0\x04\x12\ + \x06\xa6\x01\x04\xa5\x01\x19\n\r\n\x05\x04\x15\x02\0\x06\x12\x04\xa6\x01\ + \x04\x0b\n\r\n\x05\x04\x15\x02\0\x01\x12\x04\xa6\x01\x0c\x13\n\r\n\x05\ + \x04\x15\x02\0\x03\x12\x04\xa6\x01\x16\x17\n\x0c\n\x04\x04\x15\x02\x01\ + \x12\x04\xa7\x01\x04\x1b\n\x0f\n\x05\x04\x15\x02\x01\x04\x12\x06\xa7\x01\ + \x04\xa6\x01\x18\n\r\n\x05\x04\x15\x02\x01\x05\x12\x04\xa7\x01\x04\n\n\r\ + \n\x05\x04\x15\x02\x01\x01\x12\x04\xa7\x01\x0b\x16\n\r\n\x05\x04\x15\x02\ + \x01\x03\x12\x04\xa7\x01\x19\x1a\n\x0c\n\x02\x04\x16\x12\x06\xaa\x01\0\ + \xae\x01\x01\n\x0b\n\x03\x04\x16\x01\x12\x04\xaa\x01\x08\x18\n\x0c\n\x04\ + \x04\x16\x02\0\x12\x04\xab\x01\x04#\n\x0f\n\x05\x04\x16\x02\0\x04\x12\ + \x06\xab\x01\x04\xaa\x01\x1a\n\r\n\x05\x04\x16\x02\0\x06\x12\x04\xab\x01\ + \x04\x11\n\r\n\x05\x04\x16\x02\0\x01\x12\x04\xab\x01\x12\x1e\n\r\n\x05\ + \x04\x16\x02\0\x03\x12\x04\xab\x01!\"\n\x0c\n\x04\x04\x16\x02\x01\x12\ + \x04\xac\x01\x04\x17\n\x0f\n\x05\x04\x16\x02\x01\x04\x12\x06\xac\x01\x04\ + \xab\x01#\n\r\n\x05\x04\x16\x02\x01\x06\x12\x04\xac\x01\x04\x0c\n\r\n\ + \x05\x04\x16\x02\x01\x01\x12\x04\xac\x01\r\x12\n\r\n\x05\x04\x16\x02\x01\ + \x03\x12\x04\xac\x01\x15\x16\n\x0c\n\x04\x04\x16\x02\x02\x12\x04\xad\x01\ + \x04\x20\n\r\n\x05\x04\x16\x02\x02\x04\x12\x04\xad\x01\x04\x0c\n\r\n\x05\ + \x04\x16\x02\x02\x06\x12\x04\xad\x01\r\x15\n\r\n\x05\x04\x16\x02\x02\x01\ + \x12\x04\xad\x01\x16\x1b\n\r\n\x05\x04\x16\x02\x02\x03\x12\x04\xad\x01\ + \x1e\x1f\n\x0c\n\x02\x04\x17\x12\x06\xb0\x01\0\xb5\x01\x01\n\x0b\n\x03\ + \x04\x17\x01\x12\x04\xb0\x01\x08\x1a\n\x0c\n\x04\x04\x17\x02\0\x12\x04\ + \xb1\x01\x04\x18\n\x0f\n\x05\x04\x17\x02\0\x04\x12\x06\xb1\x01\x04\xb0\ + \x01\x1c\n\r\n\x05\x04\x17\x02\0\x06\x12\x04\xb1\x01\x04\x0b\n\r\n\x05\ + \x04\x17\x02\0\x01\x12\x04\xb1\x01\x0c\x13\n\r\n\x05\x04\x17\x02\0\x03\ + \x12\x04\xb1\x01\x16\x17\n\x0c\n\x04\x04\x17\x02\x01\x12\x04\xb2\x01\x04\ + \x1e\n\x0f\n\x05\x04\x17\x02\x01\x04\x12\x06\xb2\x01\x04\xb1\x01\x18\n\r\ + \n\x05\x04\x17\x02\x01\x05\x12\x04\xb2\x01\x04\n\n\r\n\x05\x04\x17\x02\ + \x01\x01\x12\x04\xb2\x01\x0b\x18\n\r\n\x05\x04\x17\x02\x01\x03\x12\x04\ + \xb2\x01\x1c\x1d\n9\n\x04\x04\x17\x02\x02\x12\x04\xb4\x01\x04\x1e\x1a+\ + \x20If\x20the\x20txn\x20is\x20rolled\x20back,\x20do\x20not\x20set\x20it.\ + \n\n\x0f\n\x05\x04\x17\x02\x02\x04\x12\x06\xb4\x01\x04\xb2\x01\x1e\n\r\n\ + \x05\x04\x17\x02\x02\x05\x12\x04\xb4\x01\x04\n\n\r\n\x05\x04\x17\x02\x02\ + \x01\x12\x04\xb4\x01\x0b\x19\n\r\n\x05\x04\x17\x02\x02\x03\x12\x04\xb4\ + \x01\x1c\x1d\n\x0c\n\x02\x04\x18\x12\x06\xb7\x01\0\xba\x01\x01\n\x0b\n\ + \x03\x04\x18\x01\x12\x04\xb7\x01\x08\x1b\n\x0c\n\x04\x04\x18\x02\0\x12\ + \x04\xb8\x01\x04#\n\x0f\n\x05\x04\x18\x02\0\x04\x12\x06\xb8\x01\x04\xb7\ + \x01\x1d\n\r\n\x05\x04\x18\x02\0\x06\x12\x04\xb8\x01\x04\x11\n\r\n\x05\ + \x04\x18\x02\0\x01\x12\x04\xb8\x01\x12\x1e\n\r\n\x05\x04\x18\x02\0\x03\ + \x12\x04\xb8\x01!\"\n\x0c\n\x04\x04\x18\x02\x01\x12\x04\xb9\x01\x04\x17\ + \n\x0f\n\x05\x04\x18\x02\x01\x04\x12\x06\xb9\x01\x04\xb8\x01#\n\r\n\x05\ + \x04\x18\x02\x01\x06\x12\x04\xb9\x01\x04\x0c\n\r\n\x05\x04\x18\x02\x01\ + \x01\x12\x04\xb9\x01\r\x12\n\r\n\x05\x04\x18\x02\x01\x03\x12\x04\xb9\x01\ + \x15\x16\n\x0c\n\x02\x04\x19\x12\x06\xbc\x01\0\xbf\x01\x01\n\x0b\n\x03\ + \x04\x19\x01\x12\x04\xbc\x01\x08\x11\n\x0c\n\x04\x04\x19\x02\0\x12\x04\ + \xbd\x01\x04\x18\n\x0f\n\x05\x04\x19\x02\0\x04\x12\x06\xbd\x01\x04\xbc\ + \x01\x13\n\r\n\x05\x04\x19\x02\0\x06\x12\x04\xbd\x01\x04\x0b\n\r\n\x05\ + \x04\x19\x02\0\x01\x12\x04\xbd\x01\x0c\x13\n\r\n\x05\x04\x19\x02\0\x03\ + \x12\x04\xbd\x01\x16\x17\n\x0c\n\x04\x04\x19\x02\x01\x12\x04\xbe\x01\x04\ + \x1a\n\x0f\n\x05\x04\x19\x02\x01\x04\x12\x06\xbe\x01\x04\xbd\x01\x18\n\r\ + \n\x05\x04\x19\x02\x01\x05\x12\x04\xbe\x01\x04\n\n\r\n\x05\x04\x19\x02\ + \x01\x01\x12\x04\xbe\x01\x0b\x15\n\r\n\x05\x04\x19\x02\x01\x03\x12\x04\ + \xbe\x01\x18\x19\n\x0c\n\x02\x04\x1a\x12\x06\xc1\x01\0\xc4\x01\x01\n\x0b\ + \n\x03\x04\x1a\x01\x12\x04\xc1\x01\x08\x12\n\x0c\n\x04\x04\x1a\x02\0\x12\ + \x04\xc2\x01\x04#\n\x0f\n\x05\x04\x1a\x02\0\x04\x12\x06\xc2\x01\x04\xc1\ + \x01\x14\n\r\n\x05\x04\x1a\x02\0\x06\x12\x04\xc2\x01\x04\x11\n\r\n\x05\ + \x04\x1a\x02\0\x01\x12\x04\xc2\x01\x12\x1e\n\r\n\x05\x04\x1a\x02\0\x03\ + \x12\x04\xc2\x01!\"\n\x0c\n\x04\x04\x1a\x02\x01\x12\x04\xc3\x01\x04\x17\ + \n\x0f\n\x05\x04\x1a\x02\x01\x04\x12\x06\xc3\x01\x04\xc2\x01#\n\r\n\x05\ + \x04\x1a\x02\x01\x06\x12\x04\xc3\x01\x04\x0c\n\r\n\x05\x04\x1a\x02\x01\ + \x01\x12\x04\xc3\x01\r\x12\n\r\n\x05\x04\x1a\x02\x01\x03\x12\x04\xc3\x01\ + \x15\x16\n\x0c\n\x02\x04\x1b\x12\x06\xc6\x01\0\xc9\x01\x01\n\x0b\n\x03\ + \x04\x1b\x01\x12\x04\xc6\x01\x08\x15\n\x0c\n\x04\x04\x1b\x02\0\x12\x04\ + \xc7\x01\x04\x18\n\x0f\n\x05\x04\x1b\x02\0\x04\x12\x06\xc7\x01\x04\xc6\ + \x01\x17\n\r\n\x05\x04\x1b\x02\0\x06\x12\x04\xc7\x01\x04\x0b\n\r\n\x05\ + \x04\x1b\x02\0\x01\x12\x04\xc7\x01\x0c\x13\n\r\n\x05\x04\x1b\x02\0\x03\ + \x12\x04\xc7\x01\x16\x17\n\x0c\n\x04\x04\x1b\x02\x01\x12\x04\xc8\x01\x04\ + \x12\n\x0f\n\x05\x04\x1b\x02\x01\x04\x12\x06\xc8\x01\x04\xc7\x01\x18\n\r\ + \n\x05\x04\x1b\x02\x01\x05\x12\x04\xc8\x01\x04\t\n\r\n\x05\x04\x1b\x02\ + \x01\x01\x12\x04\xc8\x01\n\r\n\r\n\x05\x04\x1b\x02\x01\x03\x12\x04\xc8\ + \x01\x10\x11\n\x0c\n\x02\x04\x1c\x12\x06\xcb\x01\0\xcf\x01\x01\n\x0b\n\ + \x03\x04\x1c\x01\x12\x04\xcb\x01\x08\x16\n\x0c\n\x04\x04\x1c\x02\0\x12\ + \x04\xcc\x01\x04#\n\x0f\n\x05\x04\x1c\x02\0\x04\x12\x06\xcc\x01\x04\xcb\ + \x01\x18\n\r\n\x05\x04\x1c\x02\0\x06\x12\x04\xcc\x01\x04\x11\n\r\n\x05\ + \x04\x1c\x02\0\x01\x12\x04\xcc\x01\x12\x1e\n\r\n\x05\x04\x1c\x02\0\x03\ + \x12\x04\xcc\x01!\"\n\x0c\n\x04\x04\x1c\x02\x01\x12\x04\xcd\x01\x04\x15\ + \n\x0f\n\x05\x04\x1c\x02\x01\x04\x12\x06\xcd\x01\x04\xcc\x01#\n\r\n\x05\ + \x04\x1c\x02\x01\x05\x12\x04\xcd\x01\x04\n\n\r\n\x05\x04\x1c\x02\x01\x01\ + \x12\x04\xcd\x01\x0b\x10\n\r\n\x05\x04\x1c\x02\x01\x03\x12\x04\xcd\x01\ + \x13\x14\n\x0c\n\x04\x04\x1c\x02\x02\x12\x04\xce\x01\x04\x14\n\x0f\n\x05\ + \x04\x1c\x02\x02\x04\x12\x06\xce\x01\x04\xcd\x01\x15\n\r\n\x05\x04\x1c\ + \x02\x02\x05\x12\x04\xce\x01\x04\t\n\r\n\x05\x04\x1c\x02\x02\x01\x12\x04\ + \xce\x01\n\x0f\n\r\n\x05\x04\x1c\x02\x02\x03\x12\x04\xce\x01\x12\x13\n\ + \x0c\n\x02\x04\x1d\x12\x06\xd1\x01\0\xd5\x01\x01\n\x0b\n\x03\x04\x1d\x01\ + \x12\x04\xd1\x01\x08\x15\n\x0c\n\x04\x04\x1d\x02\0\x12\x04\xd2\x01\x04\ + \x18\n\x0f\n\x05\x04\x1d\x02\0\x04\x12\x06\xd2\x01\x04\xd1\x01\x17\n\r\n\ + \x05\x04\x1d\x02\0\x06\x12\x04\xd2\x01\x04\x0b\n\r\n\x05\x04\x1d\x02\0\ + \x01\x12\x04\xd2\x01\x0c\x13\n\r\n\x05\x04\x1d\x02\0\x03\x12\x04\xd2\x01\ + \x16\x17\n\x0c\n\x04\x04\x1d\x02\x01\x12\x04\xd3\x01\x04\x12\n\x0f\n\x05\ + \x04\x1d\x02\x01\x04\x12\x06\xd3\x01\x04\xd2\x01\x18\n\r\n\x05\x04\x1d\ + \x02\x01\x05\x12\x04\xd3\x01\x04\t\n\r\n\x05\x04\x1d\x02\x01\x01\x12\x04\ + \xd3\x01\n\r\n\r\n\x05\x04\x1d\x02\x01\x03\x12\x04\xd3\x01\x10\x11\n\x0c\ + \n\x04\x04\x1d\x02\x02\x12\x04\xd4\x01\x04\x14\n\x0f\n\x05\x04\x1d\x02\ + \x02\x04\x12\x06\xd4\x01\x04\xd3\x01\x12\n\r\n\x05\x04\x1d\x02\x02\x05\ + \x12\x04\xd4\x01\x04\t\n\r\n\x05\x04\x1d\x02\x02\x01\x12\x04\xd4\x01\n\ + \x0f\n\r\n\x05\x04\x1d\x02\x02\x03\x12\x04\xd4\x01\x12\x13\n\x0c\n\x02\ + \x04\x1e\x12\x06\xd7\x01\0\xda\x01\x01\n\x0b\n\x03\x04\x1e\x01\x12\x04\ + \xd7\x01\x08\x16\n\x0c\n\x04\x04\x1e\x02\0\x12\x04\xd8\x01\x04#\n\x0f\n\ + \x05\x04\x1e\x02\0\x04\x12\x06\xd8\x01\x04\xd7\x01\x18\n\r\n\x05\x04\x1e\ + \x02\0\x06\x12\x04\xd8\x01\x04\x11\n\r\n\x05\x04\x1e\x02\0\x01\x12\x04\ + \xd8\x01\x12\x1e\n\r\n\x05\x04\x1e\x02\0\x03\x12\x04\xd8\x01!\"\n\x0c\n\ + \x04\x04\x1e\x02\x01\x12\x04\xd9\x01\x04\x15\n\x0f\n\x05\x04\x1e\x02\x01\ + \x04\x12\x06\xd9\x01\x04\xd8\x01#\n\r\n\x05\x04\x1e\x02\x01\x05\x12\x04\ + \xd9\x01\x04\n\n\r\n\x05\x04\x1e\x02\x01\x01\x12\x04\xd9\x01\x0b\x10\n\r\ + \n\x05\x04\x1e\x02\x01\x03\x12\x04\xd9\x01\x13\x14\n\x0c\n\x02\x04\x1f\ + \x12\x06\xdc\x01\0\xdf\x01\x01\n\x0b\n\x03\x04\x1f\x01\x12\x04\xdc\x01\ + \x08\x18\n\x0c\n\x04\x04\x1f\x02\0\x12\x04\xdd\x01\x04\x18\n\x0f\n\x05\ + \x04\x1f\x02\0\x04\x12\x06\xdd\x01\x04\xdc\x01\x1a\n\r\n\x05\x04\x1f\x02\ + \0\x06\x12\x04\xdd\x01\x04\x0b\n\r\n\x05\x04\x1f\x02\0\x01\x12\x04\xdd\ + \x01\x0c\x13\n\r\n\x05\x04\x1f\x02\0\x03\x12\x04\xdd\x01\x16\x17\n\x0c\n\ + \x04\x04\x1f\x02\x01\x12\x04\xde\x01\x04\x12\n\x0f\n\x05\x04\x1f\x02\x01\ + \x04\x12\x06\xde\x01\x04\xdd\x01\x18\n\r\n\x05\x04\x1f\x02\x01\x05\x12\ + \x04\xde\x01\x04\t\n\r\n\x05\x04\x1f\x02\x01\x01\x12\x04\xde\x01\n\r\n\r\ + \n\x05\x04\x1f\x02\x01\x03\x12\x04\xde\x01\x10\x11\n\x0c\n\x02\x04\x20\ + \x12\x06\xe1\x01\0\xe4\x01\x01\n\x0b\n\x03\x04\x20\x01\x12\x04\xe1\x01\ + \x08\x19\n\x0c\n\x04\x04\x20\x02\0\x12\x04\xe2\x01\x04#\n\x0f\n\x05\x04\ + \x20\x02\0\x04\x12\x06\xe2\x01\x04\xe1\x01\x1b\n\r\n\x05\x04\x20\x02\0\ + \x06\x12\x04\xe2\x01\x04\x11\n\r\n\x05\x04\x20\x02\0\x01\x12\x04\xe2\x01\ + \x12\x1e\n\r\n\x05\x04\x20\x02\0\x03\x12\x04\xe2\x01!\"\n\x0c\n\x04\x04\ + \x20\x02\x01\x12\x04\xe3\x01\x04\x15\n\x0f\n\x05\x04\x20\x02\x01\x04\x12\ + \x06\xe3\x01\x04\xe2\x01#\n\r\n\x05\x04\x20\x02\x01\x05\x12\x04\xe3\x01\ + \x04\n\n\r\n\x05\x04\x20\x02\x01\x01\x12\x04\xe3\x01\x0b\x10\n\r\n\x05\ + \x04\x20\x02\x01\x03\x12\x04\xe3\x01\x13\x14\n\x0c\n\x02\x04!\x12\x06\ + \xe6\x01\0\xea\x01\x01\n\x0b\n\x03\x04!\x01\x12\x04\xe6\x01\x08\x1a\n\ + \x0c\n\x04\x04!\x02\0\x12\x04\xe7\x01\x04\x18\n\x0f\n\x05\x04!\x02\0\x04\ + \x12\x06\xe7\x01\x04\xe6\x01\x1c\n\r\n\x05\x04!\x02\0\x06\x12\x04\xe7\ + \x01\x04\x0b\n\r\n\x05\x04!\x02\0\x01\x12\x04\xe7\x01\x0c\x13\n\r\n\x05\ + \x04!\x02\0\x03\x12\x04\xe7\x01\x16\x17\n\x0c\n\x04\x04!\x02\x01\x12\x04\ + \xe8\x01\x04\x18\n\x0f\n\x05\x04!\x02\x01\x04\x12\x06\xe8\x01\x04\xe7\ + \x01\x18\n\r\n\x05\x04!\x02\x01\x05\x12\x04\xe8\x01\x04\t\n\r\n\x05\x04!\ + \x02\x01\x01\x12\x04\xe8\x01\n\x13\n\r\n\x05\x04!\x02\x01\x03\x12\x04\ + \xe8\x01\x16\x17\n\x0c\n\x04\x04!\x02\x02\x12\x04\xe9\x01\x04\x16\n\x0f\ + \n\x05\x04!\x02\x02\x04\x12\x06\xe9\x01\x04\xe8\x01\x18\n\r\n\x05\x04!\ + \x02\x02\x05\x12\x04\xe9\x01\x04\t\n\r\n\x05\x04!\x02\x02\x01\x12\x04\ + \xe9\x01\n\x11\n\r\n\x05\x04!\x02\x02\x03\x12\x04\xe9\x01\x14\x15\n\x0c\ + \n\x02\x04\"\x12\x06\xec\x01\0\xef\x01\x01\n\x0b\n\x03\x04\"\x01\x12\x04\ + \xec\x01\x08\x1b\n\x0c\n\x04\x04\"\x02\0\x12\x04\xed\x01\x04#\n\x0f\n\ + \x05\x04\"\x02\0\x04\x12\x06\xed\x01\x04\xec\x01\x1d\n\r\n\x05\x04\"\x02\ + \0\x06\x12\x04\xed\x01\x04\x11\n\r\n\x05\x04\"\x02\0\x01\x12\x04\xed\x01\ + \x12\x1e\n\r\n\x05\x04\"\x02\0\x03\x12\x04\xed\x01!\"\n\x0c\n\x04\x04\"\ + \x02\x01\x12\x04\xee\x01\x04\x15\n\x0f\n\x05\x04\"\x02\x01\x04\x12\x06\ + \xee\x01\x04\xed\x01#\n\r\n\x05\x04\"\x02\x01\x05\x12\x04\xee\x01\x04\n\ + \n\r\n\x05\x04\"\x02\x01\x01\x12\x04\xee\x01\x0b\x10\n\r\n\x05\x04\"\x02\ + \x01\x03\x12\x04\xee\x01\x13\x14\n\x0c\n\x02\x04#\x12\x06\xf1\x01\0\xf5\ + \x01\x01\n\x0b\n\x03\x04#\x01\x12\x04\xf1\x01\x08\x16\n\x0c\n\x04\x04#\ + \x02\0\x12\x04\xf2\x01\x04\x18\n\x0f\n\x05\x04#\x02\0\x04\x12\x06\xf2\ + \x01\x04\xf1\x01\x18\n\r\n\x05\x04#\x02\0\x06\x12\x04\xf2\x01\x04\x0b\n\ + \r\n\x05\x04#\x02\0\x01\x12\x04\xf2\x01\x0c\x13\n\r\n\x05\x04#\x02\0\x03\ + \x12\x04\xf2\x01\x16\x17\n\x0c\n\x04\x04#\x02\x01\x12\x04\xf3\x01\x04\ + \x18\n\x0f\n\x05\x04#\x02\x01\x04\x12\x06\xf3\x01\x04\xf2\x01\x18\n\r\n\ + \x05\x04#\x02\x01\x05\x12\x04\xf3\x01\x04\t\n\r\n\x05\x04#\x02\x01\x01\ + \x12\x04\xf3\x01\n\x13\n\r\n\x05\x04#\x02\x01\x03\x12\x04\xf3\x01\x16\ + \x17\n\x0c\n\x04\x04#\x02\x02\x12\x04\xf4\x01\x04\x15\n\x0f\n\x05\x04#\ + \x02\x02\x04\x12\x06\xf4\x01\x04\xf3\x01\x18\n\r\n\x05\x04#\x02\x02\x05\ + \x12\x04\xf4\x01\x04\n\n\r\n\x05\x04#\x02\x02\x01\x12\x04\xf4\x01\x0b\ + \x10\n\r\n\x05\x04#\x02\x02\x03\x12\x04\xf4\x01\x13\x14\n\x0c\n\x02\x04$\ + \x12\x06\xf7\x01\0\xfa\x01\x01\n\x0b\n\x03\x04$\x01\x12\x04\xf7\x01\x08\ + \x17\n\x0c\n\x04\x04$\x02\0\x12\x04\xf8\x01\x04#\n\x0f\n\x05\x04$\x02\0\ + \x04\x12\x06\xf8\x01\x04\xf7\x01\x19\n\r\n\x05\x04$\x02\0\x06\x12\x04\ + \xf8\x01\x04\x11\n\r\n\x05\x04$\x02\0\x01\x12\x04\xf8\x01\x12\x1e\n\r\n\ + \x05\x04$\x02\0\x03\x12\x04\xf8\x01!\"\n\x0c\n\x04\x04$\x02\x01\x12\x04\ + \xf9\x01\x04\x1c\n\r\n\x05\x04$\x02\x01\x04\x12\x04\xf9\x01\x04\x0c\n\r\ + \n\x05\x04$\x02\x01\x06\x12\x04\xf9\x01\r\x13\n\r\n\x05\x04$\x02\x01\x01\ + \x12\x04\xf9\x01\x14\x17\n\r\n\x05\x04$\x02\x01\x03\x12\x04\xf9\x01\x1a\ + \x1b\n\x0c\n\x02\x04%\x12\x06\xfc\x01\0\x80\x02\x01\n\x0b\n\x03\x04%\x01\ + \x12\x04\xfc\x01\x08\x11\n\x0c\n\x04\x04%\x02\0\x12\x04\xfd\x01\x04\x18\ + \n\x0f\n\x05\x04%\x02\0\x04\x12\x06\xfd\x01\x04\xfc\x01\x13\n\r\n\x05\ + \x04%\x02\0\x05\x12\x04\xfd\x01\x04\n\n\r\n\x05\x04%\x02\0\x01\x12\x04\ + \xfd\x01\x0b\x13\n\r\n\x05\x04%\x02\0\x03\x12\x04\xfd\x01\x16\x17\n\x0c\ + \n\x04\x04%\x02\x01\x12\x04\xfe\x01\x04\x10\n\x0f\n\x05\x04%\x02\x01\x04\ + \x12\x06\xfe\x01\x04\xfd\x01\x18\n\r\n\x05\x04%\x02\x01\x06\x12\x04\xfe\ + \x01\x04\x06\n\r\n\x05\x04%\x02\x01\x01\x12\x04\xfe\x01\x07\x0b\n\r\n\ + \x05\x04%\x02\x01\x03\x12\x04\xfe\x01\x0e\x0f\n\x0c\n\x04\x04%\x02\x02\ + \x12\x04\xff\x01\x04\x19\n\x0f\n\x05\x04%\x02\x02\x04\x12\x06\xff\x01\ + \x04\xfe\x01\x10\n\r\n\x05\x04%\x02\x02\x05\x12\x04\xff\x01\x04\n\n\r\n\ + \x05\x04%\x02\x02\x01\x12\x04\xff\x01\x0b\x14\n\r\n\x05\x04%\x02\x02\x03\ + \x12\x04\xff\x01\x17\x18\n\x0c\n\x02\x04&\x12\x06\x82\x02\0\x86\x02\x01\ + \n\x0b\n\x03\x04&\x01\x12\x04\x82\x02\x08\x11\n\x0c\n\x04\x04&\x02\0\x12\ + \x04\x83\x02\x04\x14\n\x0f\n\x05\x04&\x02\0\x04\x12\x06\x83\x02\x04\x82\ + \x02\x13\n\r\n\x05\x04&\x02\0\x05\x12\x04\x83\x02\x04\t\n\r\n\x05\x04&\ + \x02\0\x01\x12\x04\x83\x02\n\x0f\n\r\n\x05\x04&\x02\0\x03\x12\x04\x83\ + \x02\x12\x13\n\x0c\n\x04\x04&\x02\x01\x12\x04\x84\x02\x04\x12\n\x0f\n\ + \x05\x04&\x02\x01\x04\x12\x06\x84\x02\x04\x83\x02\x14\n\r\n\x05\x04&\x02\ + \x01\x05\x12\x04\x84\x02\x04\n\n\r\n\x05\x04&\x02\x01\x01\x12\x04\x84\ + \x02\x0b\r\n\r\n\x05\x04&\x02\x01\x03\x12\x04\x84\x02\x10\x11\n\x0c\n\ + \x04\x04&\x02\x02\x12\x04\x85\x02\x04\x1c\n\x0f\n\x05\x04&\x02\x02\x04\ + \x12\x06\x85\x02\x04\x84\x02\x12\n\r\n\x05\x04&\x02\x02\x05\x12\x04\x85\ + \x02\x04\x08\n\r\n\x05\x04&\x02\x02\x01\x12\x04\x85\x02\t\x17\n\r\n\x05\ + \x04&\x02\x02\x03\x12\x04\x85\x02\x1a\x1b\n\x0c\n\x02\x04'\x12\x06\x88\ + \x02\0\x8c\x02\x01\n\x0b\n\x03\x04'\x01\x12\x04\x88\x02\x08\x10\n\x0c\n\ + \x04\x04'\x02\0\x12\x04\x89\x02\x04\x16\n\x0f\n\x05\x04'\x02\0\x04\x12\ + \x06\x89\x02\x04\x88\x02\x12\n\r\n\x05\x04'\x02\0\x06\x12\x04\x89\x02\ + \x04\x0c\n\r\n\x05\x04'\x02\0\x01\x12\x04\x89\x02\r\x11\n\r\n\x05\x04'\ + \x02\0\x03\x12\x04\x89\x02\x14\x15\n\x0c\n\x04\x04'\x02\x01\x12\x04\x8a\ + \x02\x04\"\n\r\n\x05\x04'\x02\x01\x04\x12\x04\x8a\x02\x04\x0c\n\r\n\x05\ + \x04'\x02\x01\x06\x12\x04\x8a\x02\r\x16\n\r\n\x05\x04'\x02\x01\x01\x12\ + \x04\x8a\x02\x17\x1d\n\r\n\x05\x04'\x02\x01\x03\x12\x04\x8a\x02\x20!\n\ + \x0c\n\x04\x04'\x02\x02\x12\x04\x8b\x02\x04\"\n\r\n\x05\x04'\x02\x02\x04\ + \x12\x04\x8b\x02\x04\x0c\n\r\n\x05\x04'\x02\x02\x06\x12\x04\x8b\x02\r\ + \x16\n\r\n\x05\x04'\x02\x02\x01\x12\x04\x8b\x02\x17\x1d\n\r\n\x05\x04'\ + \x02\x02\x03\x12\x04\x8b\x02\x20!\n\x0c\n\x02\x04(\x12\x06\x8e\x02\0\x91\ + \x02\x01\n\x0b\n\x03\x04(\x01\x12\x04\x8e\x02\x08\x1b\n\x0c\n\x04\x04(\ + \x02\0\x12\x04\x8f\x02\x04\x18\n\x0f\n\x05\x04(\x02\0\x04\x12\x06\x8f\ + \x02\x04\x8e\x02\x1d\n\r\n\x05\x04(\x02\0\x06\x12\x04\x8f\x02\x04\x0b\n\ + \r\n\x05\x04(\x02\0\x01\x12\x04\x8f\x02\x0c\x13\n\r\n\x05\x04(\x02\0\x03\ + \x12\x04\x8f\x02\x16\x17\n\x0c\n\x04\x04(\x02\x01\x12\x04\x90\x02\x04\ + \x12\n\x0f\n\x05\x04(\x02\x01\x04\x12\x06\x90\x02\x04\x8f\x02\x18\n\r\n\ + \x05\x04(\x02\x01\x05\x12\x04\x90\x02\x04\t\n\r\n\x05\x04(\x02\x01\x01\ + \x12\x04\x90\x02\n\r\n\r\n\x05\x04(\x02\x01\x03\x12\x04\x90\x02\x10\x11\ + \n\x0c\n\x02\x04)\x12\x06\x93\x02\0\x97\x02\x01\n\x0b\n\x03\x04)\x01\x12\ + \x04\x93\x02\x08\x1c\n\x0c\n\x04\x04)\x02\0\x12\x04\x94\x02\x04#\n\x0f\n\ + \x05\x04)\x02\0\x04\x12\x06\x94\x02\x04\x93\x02\x1e\n\r\n\x05\x04)\x02\0\ + \x06\x12\x04\x94\x02\x04\x11\n\r\n\x05\x04)\x02\0\x01\x12\x04\x94\x02\ + \x12\x1e\n\r\n\x05\x04)\x02\0\x03\x12\x04\x94\x02!\"\n\x0c\n\x04\x04)\ + \x02\x01\x12\x04\x95\x02\x04\x15\n\x0f\n\x05\x04)\x02\x01\x04\x12\x06\ + \x95\x02\x04\x94\x02#\n\r\n\x05\x04)\x02\x01\x05\x12\x04\x95\x02\x04\n\n\ + \r\n\x05\x04)\x02\x01\x01\x12\x04\x95\x02\x0b\x10\n\r\n\x05\x04)\x02\x01\ + \x03\x12\x04\x95\x02\x13\x14\n\x0c\n\x04\x04)\x02\x02\x12\x04\x96\x02\ + \x04\x16\n\x0f\n\x05\x04)\x02\x02\x04\x12\x06\x96\x02\x04\x95\x02\x15\n\ + \r\n\x05\x04)\x02\x02\x06\x12\x04\x96\x02\x04\x0c\n\r\n\x05\x04)\x02\x02\ + \x01\x12\x04\x96\x02\r\x11\n\r\n\x05\x04)\x02\x02\x03\x12\x04\x96\x02\ + \x14\x15\n\x0c\n\x02\x04*\x12\x06\x99\x02\0\x9c\x02\x01\n\x0b\n\x03\x04*\ + \x01\x12\x04\x99\x02\x08\x1f\n\x0c\n\x04\x04*\x02\0\x12\x04\x9a\x02\x04\ + \x18\n\x0f\n\x05\x04*\x02\0\x04\x12\x06\x9a\x02\x04\x99\x02!\n\r\n\x05\ + \x04*\x02\0\x06\x12\x04\x9a\x02\x04\x0b\n\r\n\x05\x04*\x02\0\x01\x12\x04\ + \x9a\x02\x0c\x13\n\r\n\x05\x04*\x02\0\x03\x12\x04\x9a\x02\x16\x17\n\x0c\ + \n\x04\x04*\x02\x01\x12\x04\x9b\x02\x04\x18\n\x0f\n\x05\x04*\x02\x01\x04\ + \x12\x06\x9b\x02\x04\x9a\x02\x18\n\r\n\x05\x04*\x02\x01\x05\x12\x04\x9b\ + \x02\x04\n\n\r\n\x05\x04*\x02\x01\x01\x12\x04\x9b\x02\x0b\x13\n\r\n\x05\ + \x04*\x02\x01\x03\x12\x04\x9b\x02\x16\x17\n\x0c\n\x02\x04+\x12\x06\x9e\ + \x02\0\xa3\x02\x01\n\x0b\n\x03\x04+\x01\x12\x04\x9e\x02\x08\x20\n\x0c\n\ + \x04\x04+\x02\0\x12\x04\x9f\x02\x04#\n\x0f\n\x05\x04+\x02\0\x04\x12\x06\ + \x9f\x02\x04\x9e\x02\"\n\r\n\x05\x04+\x02\0\x06\x12\x04\x9f\x02\x04\x11\ + \n\r\n\x05\x04+\x02\0\x01\x12\x04\x9f\x02\x12\x1e\n\r\n\x05\x04+\x02\0\ + \x03\x12\x04\x9f\x02!\"\n\x0c\n\x04\x04+\x02\x01\x12\x04\xa0\x02\x04\x15\ + \n\x0f\n\x05\x04+\x02\x01\x04\x12\x06\xa0\x02\x04\x9f\x02#\n\r\n\x05\x04\ + +\x02\x01\x05\x12\x04\xa0\x02\x04\n\n\r\n\x05\x04+\x02\x01\x01\x12\x04\ + \xa0\x02\x0b\x10\n\r\n\x05\x04+\x02\x01\x03\x12\x04\xa0\x02\x13\x14\n\ + \x0c\n\x04\x04+\x02\x02\x12\x04\xa1\x02\x04\x12\n\x0f\n\x05\x04+\x02\x02\ + \x04\x12\x06\xa1\x02\x04\xa0\x02\x15\n\r\n\x05\x04+\x02\x02\x05\x12\x04\ + \xa1\x02\x04\t\n\r\n\x05\x04+\x02\x02\x01\x12\x04\xa1\x02\n\r\n\r\n\x05\ + \x04+\x02\x02\x03\x12\x04\xa1\x02\x10\x11\n\x0c\n\x04\x04+\x02\x03\x12\ + \x04\xa2\x02\x04\x16\n\x0f\n\x05\x04+\x02\x03\x04\x12\x06\xa2\x02\x04\ + \xa1\x02\x12\n\r\n\x05\x04+\x02\x03\x06\x12\x04\xa2\x02\x04\x0c\n\r\n\ + \x05\x04+\x02\x03\x01\x12\x04\xa2\x02\r\x11\n\r\n\x05\x04+\x02\x03\x03\ + \x12\x04\xa2\x02\x14\x15b\x06proto3\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/src/lib.rs b/_vendor/src/github.com/pingcap/kvproto/src/lib.rs new file mode 100644 index 00000000000..12c108b34d8 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/src/lib.rs @@ -0,0 +1,15 @@ +extern crate protobuf; +extern crate futures; +extern crate grpcio; + +pub mod coprocessor; +pub mod eraftpb; +pub mod errorpb; +pub mod kvrpcpb; +pub mod metapb; +pub mod pdpb_grpc; +pub mod pdpb; +pub mod raft_cmdpb; +pub mod raft_serverpb; +pub mod tikvpb_grpc; +pub mod util; diff --git a/_vendor/src/github.com/pingcap/kvproto/src/metapb.rs b/_vendor/src/github.com/pingcap/kvproto/src/metapb.rs new file mode 100644 index 00000000000..f0006b1ae1c --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/src/metapb.rs @@ -0,0 +1,1923 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy)] + +#![cfg_attr(rustfmt, rustfmt_skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(PartialEq,Clone,Default)] +pub struct Cluster { + // message fields + id: ::std::option::Option, + max_peer_count: ::std::option::Option, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Cluster {} + +impl Cluster { + pub fn new() -> Cluster { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static Cluster { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Cluster, + }; + unsafe { + instance.get(Cluster::new) + } + } + + // optional uint64 id = 1; + + pub fn clear_id(&mut self) { + self.id = ::std::option::Option::None; + } + + pub fn has_id(&self) -> bool { + self.id.is_some() + } + + // Param is passed by value, moved + pub fn set_id(&mut self, v: u64) { + self.id = ::std::option::Option::Some(v); + } + + pub fn get_id(&self) -> u64 { + self.id.unwrap_or(0) + } + + fn get_id_for_reflect(&self) -> &::std::option::Option { + &self.id + } + + fn mut_id_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.id + } + + // optional uint32 max_peer_count = 2; + + pub fn clear_max_peer_count(&mut self) { + self.max_peer_count = ::std::option::Option::None; + } + + pub fn has_max_peer_count(&self) -> bool { + self.max_peer_count.is_some() + } + + // Param is passed by value, moved + pub fn set_max_peer_count(&mut self, v: u32) { + self.max_peer_count = ::std::option::Option::Some(v); + } + + pub fn get_max_peer_count(&self) -> u32 { + self.max_peer_count.unwrap_or(0) + } + + fn get_max_peer_count_for_reflect(&self) -> &::std::option::Option { + &self.max_peer_count + } + + fn mut_max_peer_count_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.max_peer_count + } +} + +impl ::protobuf::Message for Cluster { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.id = ::std::option::Option::Some(tmp); + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.max_peer_count = ::std::option::Option::Some(tmp); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.id { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.max_peer_count { + my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.id { + os.write_uint64(1, v)?; + } + if let Some(v) = self.max_peer_count { + os.write_uint32(2, v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for Cluster { + fn new() -> Cluster { + Cluster::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "id", + Cluster::get_id_for_reflect, + Cluster::mut_id_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "max_peer_count", + Cluster::get_max_peer_count_for_reflect, + Cluster::mut_max_peer_count_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Cluster", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for Cluster { + fn clear(&mut self) { + self.clear_id(); + self.clear_max_peer_count(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Cluster { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Cluster { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct StoreLabel { + // message fields + key: ::protobuf::SingularField<::std::string::String>, + value: ::protobuf::SingularField<::std::string::String>, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for StoreLabel {} + +impl StoreLabel { + pub fn new() -> StoreLabel { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static StoreLabel { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const StoreLabel, + }; + unsafe { + instance.get(StoreLabel::new) + } + } + + // optional string key = 1; + + pub fn clear_key(&mut self) { + self.key.clear(); + } + + pub fn has_key(&self) -> bool { + self.key.is_some() + } + + // Param is passed by value, moved + pub fn set_key(&mut self, v: ::std::string::String) { + self.key = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key(&mut self) -> &mut ::std::string::String { + if self.key.is_none() { + self.key.set_default(); + } + self.key.as_mut().unwrap() + } + + // Take field + pub fn take_key(&mut self) -> ::std::string::String { + self.key.take().unwrap_or_else(|| ::std::string::String::new()) + } + + pub fn get_key(&self) -> &str { + match self.key.as_ref() { + Some(v) => &v, + None => "", + } + } + + fn get_key_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { + &self.key + } + + fn mut_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { + &mut self.key + } + + // optional string value = 2; + + pub fn clear_value(&mut self) { + self.value.clear(); + } + + pub fn has_value(&self) -> bool { + self.value.is_some() + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: ::std::string::String) { + self.value = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_value(&mut self) -> &mut ::std::string::String { + if self.value.is_none() { + self.value.set_default(); + } + self.value.as_mut().unwrap() + } + + // Take field + pub fn take_value(&mut self) -> ::std::string::String { + self.value.take().unwrap_or_else(|| ::std::string::String::new()) + } + + pub fn get_value(&self) -> &str { + match self.value.as_ref() { + Some(v) => &v, + None => "", + } + } + + fn get_value_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { + &self.value + } + + fn mut_value_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { + &mut self.value + } +} + +impl ::protobuf::Message for StoreLabel { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.key)?; + }, + 2 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.value)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.key.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(ref v) = self.value.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.key.as_ref() { + os.write_string(1, &v)?; + } + if let Some(ref v) = self.value.as_ref() { + os.write_string(2, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for StoreLabel { + fn new() -> StoreLabel { + StoreLabel::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "key", + StoreLabel::get_key_for_reflect, + StoreLabel::mut_key_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "value", + StoreLabel::get_value_for_reflect, + StoreLabel::mut_value_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "StoreLabel", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for StoreLabel { + fn clear(&mut self) { + self.clear_key(); + self.clear_value(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for StoreLabel { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StoreLabel { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Store { + // message fields + id: ::std::option::Option, + address: ::protobuf::SingularField<::std::string::String>, + state: ::std::option::Option, + labels: ::protobuf::RepeatedField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Store {} + +impl Store { + pub fn new() -> Store { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static Store { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Store, + }; + unsafe { + instance.get(Store::new) + } + } + + // optional uint64 id = 1; + + pub fn clear_id(&mut self) { + self.id = ::std::option::Option::None; + } + + pub fn has_id(&self) -> bool { + self.id.is_some() + } + + // Param is passed by value, moved + pub fn set_id(&mut self, v: u64) { + self.id = ::std::option::Option::Some(v); + } + + pub fn get_id(&self) -> u64 { + self.id.unwrap_or(0) + } + + fn get_id_for_reflect(&self) -> &::std::option::Option { + &self.id + } + + fn mut_id_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.id + } + + // optional string address = 2; + + pub fn clear_address(&mut self) { + self.address.clear(); + } + + pub fn has_address(&self) -> bool { + self.address.is_some() + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + if self.address.is_none() { + self.address.set_default(); + } + self.address.as_mut().unwrap() + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + self.address.take().unwrap_or_else(|| ::std::string::String::new()) + } + + pub fn get_address(&self) -> &str { + match self.address.as_ref() { + Some(v) => &v, + None => "", + } + } + + fn get_address_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { + &self.address + } + + fn mut_address_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { + &mut self.address + } + + // optional .metapb.StoreState state = 3; + + pub fn clear_state(&mut self) { + self.state = ::std::option::Option::None; + } + + pub fn has_state(&self) -> bool { + self.state.is_some() + } + + // Param is passed by value, moved + pub fn set_state(&mut self, v: StoreState) { + self.state = ::std::option::Option::Some(v); + } + + pub fn get_state(&self) -> StoreState { + self.state.unwrap_or(StoreState::Up) + } + + fn get_state_for_reflect(&self) -> &::std::option::Option { + &self.state + } + + fn mut_state_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.state + } + + // repeated .metapb.StoreLabel labels = 4; + + pub fn clear_labels(&mut self) { + self.labels.clear(); + } + + // Param is passed by value, moved + pub fn set_labels(&mut self, v: ::protobuf::RepeatedField) { + self.labels = v; + } + + // Mutable pointer to the field. + pub fn mut_labels(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.labels + } + + // Take field + pub fn take_labels(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.labels, ::protobuf::RepeatedField::new()) + } + + pub fn get_labels(&self) -> &[StoreLabel] { + &self.labels + } + + fn get_labels_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.labels + } + + fn mut_labels_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.labels + } +} + +impl ::protobuf::Message for Store { + fn is_initialized(&self) -> bool { + for v in &self.labels { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.id = ::std::option::Option::Some(tmp); + }, + 2 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.address)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_enum()?; + self.state = ::std::option::Option::Some(tmp); + }, + 4 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.labels)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.id { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.address.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.state { + my_size += ::protobuf::rt::enum_size(3, v); + } + for value in &self.labels { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.id { + os.write_uint64(1, v)?; + } + if let Some(ref v) = self.address.as_ref() { + os.write_string(2, &v)?; + } + if let Some(v) = self.state { + os.write_enum(3, v.value())?; + } + for v in &self.labels { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for Store { + fn new() -> Store { + Store::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "id", + Store::get_id_for_reflect, + Store::mut_id_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "address", + Store::get_address_for_reflect, + Store::mut_address_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "state", + Store::get_state_for_reflect, + Store::mut_state_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "labels", + Store::get_labels_for_reflect, + Store::mut_labels_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Store", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for Store { + fn clear(&mut self) { + self.clear_id(); + self.clear_address(); + self.clear_state(); + self.clear_labels(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Store { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Store { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RegionEpoch { + // message fields + conf_ver: ::std::option::Option, + version: ::std::option::Option, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RegionEpoch {} + +impl RegionEpoch { + pub fn new() -> RegionEpoch { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RegionEpoch { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RegionEpoch, + }; + unsafe { + instance.get(RegionEpoch::new) + } + } + + // optional uint64 conf_ver = 1; + + pub fn clear_conf_ver(&mut self) { + self.conf_ver = ::std::option::Option::None; + } + + pub fn has_conf_ver(&self) -> bool { + self.conf_ver.is_some() + } + + // Param is passed by value, moved + pub fn set_conf_ver(&mut self, v: u64) { + self.conf_ver = ::std::option::Option::Some(v); + } + + pub fn get_conf_ver(&self) -> u64 { + self.conf_ver.unwrap_or(0) + } + + fn get_conf_ver_for_reflect(&self) -> &::std::option::Option { + &self.conf_ver + } + + fn mut_conf_ver_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.conf_ver + } + + // optional uint64 version = 2; + + pub fn clear_version(&mut self) { + self.version = ::std::option::Option::None; + } + + pub fn has_version(&self) -> bool { + self.version.is_some() + } + + // Param is passed by value, moved + pub fn set_version(&mut self, v: u64) { + self.version = ::std::option::Option::Some(v); + } + + pub fn get_version(&self) -> u64 { + self.version.unwrap_or(0) + } + + fn get_version_for_reflect(&self) -> &::std::option::Option { + &self.version + } + + fn mut_version_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.version + } +} + +impl ::protobuf::Message for RegionEpoch { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.conf_ver = ::std::option::Option::Some(tmp); + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.version = ::std::option::Option::Some(tmp); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.conf_ver { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.version { + my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.conf_ver { + os.write_uint64(1, v)?; + } + if let Some(v) = self.version { + os.write_uint64(2, v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RegionEpoch { + fn new() -> RegionEpoch { + RegionEpoch::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "conf_ver", + RegionEpoch::get_conf_ver_for_reflect, + RegionEpoch::mut_conf_ver_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "version", + RegionEpoch::get_version_for_reflect, + RegionEpoch::mut_version_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RegionEpoch", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RegionEpoch { + fn clear(&mut self) { + self.clear_conf_ver(); + self.clear_version(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RegionEpoch { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RegionEpoch { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Region { + // message fields + id: ::std::option::Option, + start_key: ::protobuf::SingularField<::std::vec::Vec>, + end_key: ::protobuf::SingularField<::std::vec::Vec>, + region_epoch: ::protobuf::SingularPtrField, + peers: ::protobuf::RepeatedField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Region {} + +impl Region { + pub fn new() -> Region { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static Region { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Region, + }; + unsafe { + instance.get(Region::new) + } + } + + // optional uint64 id = 1; + + pub fn clear_id(&mut self) { + self.id = ::std::option::Option::None; + } + + pub fn has_id(&self) -> bool { + self.id.is_some() + } + + // Param is passed by value, moved + pub fn set_id(&mut self, v: u64) { + self.id = ::std::option::Option::Some(v); + } + + pub fn get_id(&self) -> u64 { + self.id.unwrap_or(0) + } + + fn get_id_for_reflect(&self) -> &::std::option::Option { + &self.id + } + + fn mut_id_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.id + } + + // optional bytes start_key = 2; + + pub fn clear_start_key(&mut self) { + self.start_key.clear(); + } + + pub fn has_start_key(&self) -> bool { + self.start_key.is_some() + } + + // Param is passed by value, moved + pub fn set_start_key(&mut self, v: ::std::vec::Vec) { + self.start_key = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_start_key(&mut self) -> &mut ::std::vec::Vec { + if self.start_key.is_none() { + self.start_key.set_default(); + } + self.start_key.as_mut().unwrap() + } + + // Take field + pub fn take_start_key(&mut self) -> ::std::vec::Vec { + self.start_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub fn get_start_key(&self) -> &[u8] { + match self.start_key.as_ref() { + Some(v) => &v, + None => &[], + } + } + + fn get_start_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { + &self.start_key + } + + fn mut_start_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { + &mut self.start_key + } + + // optional bytes end_key = 3; + + pub fn clear_end_key(&mut self) { + self.end_key.clear(); + } + + pub fn has_end_key(&self) -> bool { + self.end_key.is_some() + } + + // Param is passed by value, moved + pub fn set_end_key(&mut self, v: ::std::vec::Vec) { + self.end_key = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_end_key(&mut self) -> &mut ::std::vec::Vec { + if self.end_key.is_none() { + self.end_key.set_default(); + } + self.end_key.as_mut().unwrap() + } + + // Take field + pub fn take_end_key(&mut self) -> ::std::vec::Vec { + self.end_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub fn get_end_key(&self) -> &[u8] { + match self.end_key.as_ref() { + Some(v) => &v, + None => &[], + } + } + + fn get_end_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { + &self.end_key + } + + fn mut_end_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { + &mut self.end_key + } + + // optional .metapb.RegionEpoch region_epoch = 4; + + pub fn clear_region_epoch(&mut self) { + self.region_epoch.clear(); + } + + pub fn has_region_epoch(&self) -> bool { + self.region_epoch.is_some() + } + + // Param is passed by value, moved + pub fn set_region_epoch(&mut self, v: RegionEpoch) { + self.region_epoch = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_epoch(&mut self) -> &mut RegionEpoch { + if self.region_epoch.is_none() { + self.region_epoch.set_default(); + } + self.region_epoch.as_mut().unwrap() + } + + // Take field + pub fn take_region_epoch(&mut self) -> RegionEpoch { + self.region_epoch.take().unwrap_or_else(|| RegionEpoch::new()) + } + + pub fn get_region_epoch(&self) -> &RegionEpoch { + self.region_epoch.as_ref().unwrap_or_else(|| RegionEpoch::default_instance()) + } + + fn get_region_epoch_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_epoch + } + + fn mut_region_epoch_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_epoch + } + + // repeated .metapb.Peer peers = 5; + + pub fn clear_peers(&mut self) { + self.peers.clear(); + } + + // Param is passed by value, moved + pub fn set_peers(&mut self, v: ::protobuf::RepeatedField) { + self.peers = v; + } + + // Mutable pointer to the field. + pub fn mut_peers(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.peers + } + + // Take field + pub fn take_peers(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.peers, ::protobuf::RepeatedField::new()) + } + + pub fn get_peers(&self) -> &[Peer] { + &self.peers + } + + fn get_peers_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.peers + } + + fn mut_peers_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.peers + } +} + +impl ::protobuf::Message for Region { + fn is_initialized(&self) -> bool { + for v in &self.region_epoch { + if !v.is_initialized() { + return false; + } + }; + for v in &self.peers { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.id = ::std::option::Option::Some(tmp); + }, + 2 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.start_key)?; + }, + 3 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.end_key)?; + }, + 4 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_epoch)?; + }, + 5 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.peers)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.id { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.start_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(ref v) = self.end_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + if let Some(ref v) = self.region_epoch.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + for value in &self.peers { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.id { + os.write_uint64(1, v)?; + } + if let Some(ref v) = self.start_key.as_ref() { + os.write_bytes(2, &v)?; + } + if let Some(ref v) = self.end_key.as_ref() { + os.write_bytes(3, &v)?; + } + if let Some(ref v) = self.region_epoch.as_ref() { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + for v in &self.peers { + os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for Region { + fn new() -> Region { + Region::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "id", + Region::get_id_for_reflect, + Region::mut_id_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "start_key", + Region::get_start_key_for_reflect, + Region::mut_start_key_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "end_key", + Region::get_end_key_for_reflect, + Region::mut_end_key_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_epoch", + Region::get_region_epoch_for_reflect, + Region::mut_region_epoch_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "peers", + Region::get_peers_for_reflect, + Region::mut_peers_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Region", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for Region { + fn clear(&mut self) { + self.clear_id(); + self.clear_start_key(); + self.clear_end_key(); + self.clear_region_epoch(); + self.clear_peers(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Region { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Region { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Peer { + // message fields + id: ::std::option::Option, + store_id: ::std::option::Option, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Peer {} + +impl Peer { + pub fn new() -> Peer { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static Peer { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Peer, + }; + unsafe { + instance.get(Peer::new) + } + } + + // optional uint64 id = 1; + + pub fn clear_id(&mut self) { + self.id = ::std::option::Option::None; + } + + pub fn has_id(&self) -> bool { + self.id.is_some() + } + + // Param is passed by value, moved + pub fn set_id(&mut self, v: u64) { + self.id = ::std::option::Option::Some(v); + } + + pub fn get_id(&self) -> u64 { + self.id.unwrap_or(0) + } + + fn get_id_for_reflect(&self) -> &::std::option::Option { + &self.id + } + + fn mut_id_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.id + } + + // optional uint64 store_id = 2; + + pub fn clear_store_id(&mut self) { + self.store_id = ::std::option::Option::None; + } + + pub fn has_store_id(&self) -> bool { + self.store_id.is_some() + } + + // Param is passed by value, moved + pub fn set_store_id(&mut self, v: u64) { + self.store_id = ::std::option::Option::Some(v); + } + + pub fn get_store_id(&self) -> u64 { + self.store_id.unwrap_or(0) + } + + fn get_store_id_for_reflect(&self) -> &::std::option::Option { + &self.store_id + } + + fn mut_store_id_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.store_id + } +} + +impl ::protobuf::Message for Peer { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.id = ::std::option::Option::Some(tmp); + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.store_id = ::std::option::Option::Some(tmp); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.id { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.store_id { + my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.id { + os.write_uint64(1, v)?; + } + if let Some(v) = self.store_id { + os.write_uint64(2, v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for Peer { + fn new() -> Peer { + Peer::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "id", + Peer::get_id_for_reflect, + Peer::mut_id_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "store_id", + Peer::get_store_id_for_reflect, + Peer::mut_store_id_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Peer", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for Peer { + fn clear(&mut self) { + self.clear_id(); + self.clear_store_id(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Peer { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Peer { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum StoreState { + Up = 0, + Offline = 1, + Tombstone = 2, +} + +impl ::protobuf::ProtobufEnum for StoreState { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(StoreState::Up), + 1 => ::std::option::Option::Some(StoreState::Offline), + 2 => ::std::option::Option::Some(StoreState::Tombstone), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [StoreState] = &[ + StoreState::Up, + StoreState::Offline, + StoreState::Tombstone, + ]; + values + } + + fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, + }; + unsafe { + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new("StoreState", file_descriptor_proto()) + }) + } + } +} + +impl ::std::marker::Copy for StoreState { +} + +impl ::protobuf::reflect::ProtobufValue for StoreState { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x0cmetapb.proto\x12\x06metapb\x1a\x14gogoproto/gogo.proto\"K\n\x07Clu\ + ster\x12\x14\n\x02id\x18\x01\x20\x01(\x04R\x02idB\x04\xc8\xde\x1f\0\x12*\ + \n\x0emax_peer_count\x18\x02\x20\x01(\rR\x0cmaxPeerCountB\x04\xc8\xde\ + \x1f\0\"@\n\nStoreLabel\x12\x16\n\x03key\x18\x01\x20\x01(\tR\x03keyB\x04\ + \xc8\xde\x1f\0\x12\x1a\n\x05value\x18\x02\x20\x01(\tR\x05valueB\x04\xc8\ + \xde\x1f\0\"\x99\x01\n\x05Store\x12\x14\n\x02id\x18\x01\x20\x01(\x04R\ + \x02idB\x04\xc8\xde\x1f\0\x12\x1e\n\x07address\x18\x02\x20\x01(\tR\x07ad\ + dressB\x04\xc8\xde\x1f\0\x12.\n\x05state\x18\x03\x20\x01(\x0e2\x12.metap\ + b.StoreStateR\x05stateB\x04\xc8\xde\x1f\0\x12*\n\x06labels\x18\x04\x20\ + \x03(\x0b2\x12.metapb.StoreLabelR\x06labels\"N\n\x0bRegionEpoch\x12\x1f\ + \n\x08conf_ver\x18\x01\x20\x01(\x04R\x07confVerB\x04\xc8\xde\x1f\0\x12\ + \x1e\n\x07version\x18\x02\x20\x01(\x04R\x07versionB\x04\xc8\xde\x1f\0\"\ + \xb0\x01\n\x06Region\x12\x14\n\x02id\x18\x01\x20\x01(\x04R\x02idB\x04\ + \xc8\xde\x1f\0\x12\x1b\n\tstart_key\x18\x02\x20\x01(\x0cR\x08startKey\ + \x12\x17\n\x07end_key\x18\x03\x20\x01(\x0cR\x06endKey\x126\n\x0cregion_e\ + poch\x18\x04\x20\x01(\x0b2\x13.metapb.RegionEpochR\x0bregionEpoch\x12\"\ + \n\x05peers\x18\x05\x20\x03(\x0b2\x0c.metapb.PeerR\x05peers\"=\n\x04Peer\ + \x12\x14\n\x02id\x18\x01\x20\x01(\x04R\x02idB\x04\xc8\xde\x1f\0\x12\x1f\ + \n\x08store_id\x18\x02\x20\x01(\x04R\x07storeIdB\x04\xc8\xde\x1f\0*0\n\n\ + StoreState\x12\x06\n\x02Up\x10\0\x12\x0b\n\x07Offline\x10\x01\x12\r\n\tT\ + ombstone\x10\x02B&\n\x18com.pingcap.tikv.kvproto\xe0\xe2\x1e\x01\xc8\xe2\ + \x1e\x01\xd0\xe2\x1e\x01J\x86\x1b\n\x06\x12\x04\0\0:\x01\n\x08\n\x01\x0c\ + \x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x01\x08\x0e\n\t\n\x02\x03\0\x12\ + \x03\x03\x07\x1d\n\x08\n\x01\x08\x12\x03\x05\0(\n\x0b\n\x04\x08\xe7\x07\ + \0\x12\x03\x05\0(\n\x0c\n\x05\x08\xe7\x07\0\x02\x12\x03\x05\x07\x20\n\r\ + \n\x06\x08\xe7\x07\0\x02\0\x12\x03\x05\x07\x20\n\x0e\n\x07\x08\xe7\x07\0\ + \x02\0\x01\x12\x03\x05\x08\x1f\n\x0c\n\x05\x08\xe7\x07\0\x03\x12\x03\x05\ + #'\n\x08\n\x01\x08\x12\x03\x06\0$\n\x0b\n\x04\x08\xe7\x07\x01\x12\x03\ + \x06\0$\n\x0c\n\x05\x08\xe7\x07\x01\x02\x12\x03\x06\x07\x1c\n\r\n\x06\ + \x08\xe7\x07\x01\x02\0\x12\x03\x06\x07\x1c\n\x0e\n\x07\x08\xe7\x07\x01\ + \x02\0\x01\x12\x03\x06\x08\x1b\n\x0c\n\x05\x08\xe7\x07\x01\x03\x12\x03\ + \x06\x1f#\n\x08\n\x01\x08\x12\x03\x07\0*\n\x0b\n\x04\x08\xe7\x07\x02\x12\ + \x03\x07\0*\n\x0c\n\x05\x08\xe7\x07\x02\x02\x12\x03\x07\x07\"\n\r\n\x06\ + \x08\xe7\x07\x02\x02\0\x12\x03\x07\x07\"\n\x0e\n\x07\x08\xe7\x07\x02\x02\ + \0\x01\x12\x03\x07\x08!\n\x0c\n\x05\x08\xe7\x07\x02\x03\x12\x03\x07%)\n\ + \x08\n\x01\x08\x12\x03\t\01\n\x0b\n\x04\x08\xe7\x07\x03\x12\x03\t\01\n\ + \x0c\n\x05\x08\xe7\x07\x03\x02\x12\x03\t\x07\x13\n\r\n\x06\x08\xe7\x07\ + \x03\x02\0\x12\x03\t\x07\x13\n\x0e\n\x07\x08\xe7\x07\x03\x02\0\x01\x12\ + \x03\t\x07\x13\n\x0c\n\x05\x08\xe7\x07\x03\x07\x12\x03\t\x160\n\n\n\x02\ + \x04\0\x12\x04\x0b\0\x11\x01\n\n\n\x03\x04\0\x01\x12\x03\x0b\x08\x0f\n\ + \x0b\n\x04\x04\0\x02\0\x12\x03\x0c\x04G\n\x0c\n\x05\x04\0\x02\0\x04\x12\ + \x03\x0c\x04\x0c\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x0c\r\x13\n\x0c\n\ + \x05\x04\0\x02\0\x01\x12\x03\x0c\x14\x16\n\x0c\n\x05\x04\0\x02\0\x03\x12\ + \x03\x0c&'\n\x0c\n\x05\x04\0\x02\0\x08\x12\x03\x0c(F\n\x0f\n\x08\x04\0\ + \x02\0\x08\xe7\x07\0\x12\x03\x0c)E\n\x10\n\t\x04\0\x02\0\x08\xe7\x07\0\ + \x02\x12\x03\x0c)=\n\x11\n\n\x04\0\x02\0\x08\xe7\x07\0\x02\0\x12\x03\x0c\ + )=\n\x12\n\x0b\x04\0\x02\0\x08\xe7\x07\0\x02\0\x01\x12\x03\x0c*<\n\x10\n\ + \t\x04\0\x02\0\x08\xe7\x07\0\x03\x12\x03\x0c@E\n\x82\x01\n\x04\x04\0\x02\ + \x01\x12\x03\x0f\x04G\x1a\\\x20max\x20peer\x20count\x20for\x20a\x20regio\ + n.\n\x20pd\x20will\x20do\x20the\x20auto-balance\x20if\x20region\x20peer\ + \x20count\x20mismatches.\n\"\x17\x20more\x20attributes......\n\n\x0c\n\ + \x05\x04\0\x02\x01\x04\x12\x03\x0f\x04\x0c\n\x0c\n\x05\x04\0\x02\x01\x05\ + \x12\x03\x0f\r\x13\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x0f\x14\"\n\x0c\ + \n\x05\x04\0\x02\x01\x03\x12\x03\x0f&'\n\x0c\n\x05\x04\0\x02\x01\x08\x12\ + \x03\x0f(F\n\x0f\n\x08\x04\0\x02\x01\x08\xe7\x07\0\x12\x03\x0f)E\n\x10\n\ + \t\x04\0\x02\x01\x08\xe7\x07\0\x02\x12\x03\x0f)=\n\x11\n\n\x04\0\x02\x01\ + \x08\xe7\x07\0\x02\0\x12\x03\x0f)=\n\x12\n\x0b\x04\0\x02\x01\x08\xe7\x07\ + \0\x02\0\x01\x12\x03\x0f*<\n\x10\n\t\x04\0\x02\x01\x08\xe7\x07\0\x03\x12\ + \x03\x0f@E\n\n\n\x02\x05\0\x12\x04\x13\0\x17\x01\n\n\n\x03\x05\0\x01\x12\ + \x03\x13\x05\x0f\n\x0b\n\x04\x05\0\x02\0\x12\x03\x14\x04\x12\n\x0c\n\x05\ + \x05\0\x02\0\x01\x12\x03\x14\x04\x06\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03\ + \x14\x10\x11\n\x0b\n\x04\x05\0\x02\x01\x12\x03\x15\x04\x12\n\x0c\n\x05\ + \x05\0\x02\x01\x01\x12\x03\x15\x04\x0b\n\x0c\n\x05\x05\0\x02\x01\x02\x12\ + \x03\x15\x10\x11\n\x0b\n\x04\x05\0\x02\x02\x12\x03\x16\x04\x12\n\x0c\n\ + \x05\x05\0\x02\x02\x01\x12\x03\x16\x04\r\n\x0c\n\x05\x05\0\x02\x02\x02\ + \x12\x03\x16\x10\x11\nA\n\x02\x04\x01\x12\x04\x1a\0\x1d\x01\x1a5\x20Case\ + \x20insensitive\x20key/value\x20for\x20replica\x20constraints.\n\n\n\n\ + \x03\x04\x01\x01\x12\x03\x1a\x08\x12\n\x0b\n\x04\x04\x01\x02\0\x12\x03\ + \x1b\x04C\n\x0c\n\x05\x04\x01\x02\0\x04\x12\x03\x1b\x04\x0c\n\x0c\n\x05\ + \x04\x01\x02\0\x05\x12\x03\x1b\r\x13\n\x0c\n\x05\x04\x01\x02\0\x01\x12\ + \x03\x1b\x14\x17\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x1b\"#\n\x0c\n\ + \x05\x04\x01\x02\0\x08\x12\x03\x1b$B\n\x0f\n\x08\x04\x01\x02\0\x08\xe7\ + \x07\0\x12\x03\x1b%A\n\x10\n\t\x04\x01\x02\0\x08\xe7\x07\0\x02\x12\x03\ + \x1b%9\n\x11\n\n\x04\x01\x02\0\x08\xe7\x07\0\x02\0\x12\x03\x1b%9\n\x12\n\ + \x0b\x04\x01\x02\0\x08\xe7\x07\0\x02\0\x01\x12\x03\x1b&8\n\x10\n\t\x04\ + \x01\x02\0\x08\xe7\x07\0\x03\x12\x03\x1b = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/src/pdpb.rs b/_vendor/src/github.com/pingcap/kvproto/src/pdpb.rs new file mode 100644 index 00000000000..866d819986f --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/src/pdpb.rs @@ -0,0 +1,11027 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy)] + +#![cfg_attr(rustfmt, rustfmt_skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(PartialEq,Clone,Default)] +pub struct RequestHeader { + // message fields + pub cluster_id: u64, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RequestHeader {} + +impl RequestHeader { + pub fn new() -> RequestHeader { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RequestHeader { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RequestHeader, + }; + unsafe { + instance.get(RequestHeader::new) + } + } + + // uint64 cluster_id = 1; + + pub fn clear_cluster_id(&mut self) { + self.cluster_id = 0; + } + + // Param is passed by value, moved + pub fn set_cluster_id(&mut self, v: u64) { + self.cluster_id = v; + } + + pub fn get_cluster_id(&self) -> u64 { + self.cluster_id + } + + fn get_cluster_id_for_reflect(&self) -> &u64 { + &self.cluster_id + } + + fn mut_cluster_id_for_reflect(&mut self) -> &mut u64 { + &mut self.cluster_id + } +} + +impl ::protobuf::Message for RequestHeader { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.cluster_id = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.cluster_id != 0 { + my_size += ::protobuf::rt::value_size(1, self.cluster_id, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.cluster_id != 0 { + os.write_uint64(1, self.cluster_id)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RequestHeader { + fn new() -> RequestHeader { + RequestHeader::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "cluster_id", + RequestHeader::get_cluster_id_for_reflect, + RequestHeader::mut_cluster_id_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RequestHeader", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RequestHeader { + fn clear(&mut self) { + self.clear_cluster_id(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RequestHeader { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RequestHeader { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ResponseHeader { + // message fields + pub cluster_id: u64, + pub error: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for ResponseHeader {} + +impl ResponseHeader { + pub fn new() -> ResponseHeader { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static ResponseHeader { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ResponseHeader, + }; + unsafe { + instance.get(ResponseHeader::new) + } + } + + // uint64 cluster_id = 1; + + pub fn clear_cluster_id(&mut self) { + self.cluster_id = 0; + } + + // Param is passed by value, moved + pub fn set_cluster_id(&mut self, v: u64) { + self.cluster_id = v; + } + + pub fn get_cluster_id(&self) -> u64 { + self.cluster_id + } + + fn get_cluster_id_for_reflect(&self) -> &u64 { + &self.cluster_id + } + + fn mut_cluster_id_for_reflect(&mut self) -> &mut u64 { + &mut self.cluster_id + } + + // .pdpb.Error error = 2; + + pub fn clear_error(&mut self) { + self.error.clear(); + } + + pub fn has_error(&self) -> bool { + self.error.is_some() + } + + // Param is passed by value, moved + pub fn set_error(&mut self, v: Error) { + self.error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_error(&mut self) -> &mut Error { + if self.error.is_none() { + self.error.set_default(); + } + self.error.as_mut().unwrap() + } + + // Take field + pub fn take_error(&mut self) -> Error { + self.error.take().unwrap_or_else(|| Error::new()) + } + + pub fn get_error(&self) -> &Error { + self.error.as_ref().unwrap_or_else(|| Error::default_instance()) + } + + fn get_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.error + } + + fn mut_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.error + } +} + +impl ::protobuf::Message for ResponseHeader { + fn is_initialized(&self) -> bool { + for v in &self.error { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.cluster_id = tmp; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.error)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.cluster_id != 0 { + my_size += ::protobuf::rt::value_size(1, self.cluster_id, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.cluster_id != 0 { + os.write_uint64(1, self.cluster_id)?; + } + if let Some(ref v) = self.error.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for ResponseHeader { + fn new() -> ResponseHeader { + ResponseHeader::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "cluster_id", + ResponseHeader::get_cluster_id_for_reflect, + ResponseHeader::mut_cluster_id_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "error", + ResponseHeader::get_error_for_reflect, + ResponseHeader::mut_error_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ResponseHeader", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for ResponseHeader { + fn clear(&mut self) { + self.clear_cluster_id(); + self.clear_error(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ResponseHeader { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ResponseHeader { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Error { + // message fields + pub field_type: ErrorType, + pub message: ::std::string::String, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Error {} + +impl Error { + pub fn new() -> Error { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static Error { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Error, + }; + unsafe { + instance.get(Error::new) + } + } + + // .pdpb.ErrorType type = 1; + + pub fn clear_field_type(&mut self) { + self.field_type = ErrorType::OK; + } + + // Param is passed by value, moved + pub fn set_field_type(&mut self, v: ErrorType) { + self.field_type = v; + } + + pub fn get_field_type(&self) -> ErrorType { + self.field_type + } + + fn get_field_type_for_reflect(&self) -> &ErrorType { + &self.field_type + } + + fn mut_field_type_for_reflect(&mut self) -> &mut ErrorType { + &mut self.field_type + } + + // string message = 2; + + pub fn clear_message(&mut self) { + self.message.clear(); + } + + // Param is passed by value, moved + pub fn set_message(&mut self, v: ::std::string::String) { + self.message = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_message(&mut self) -> &mut ::std::string::String { + &mut self.message + } + + // Take field + pub fn take_message(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.message, ::std::string::String::new()) + } + + pub fn get_message(&self) -> &str { + &self.message + } + + fn get_message_for_reflect(&self) -> &::std::string::String { + &self.message + } + + fn mut_message_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.message + } +} + +impl ::protobuf::Message for Error { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_enum()?; + self.field_type = tmp; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.message)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.field_type != ErrorType::OK { + my_size += ::protobuf::rt::enum_size(1, self.field_type); + } + if !self.message.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.message); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.field_type != ErrorType::OK { + os.write_enum(1, self.field_type.value())?; + } + if !self.message.is_empty() { + os.write_string(2, &self.message)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for Error { + fn new() -> Error { + Error::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "type", + Error::get_field_type_for_reflect, + Error::mut_field_type_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "message", + Error::get_message_for_reflect, + Error::mut_message_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Error", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for Error { + fn clear(&mut self) { + self.clear_field_type(); + self.clear_message(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Error { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Error { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct TsoRequest { + // message fields + pub header: ::protobuf::SingularPtrField, + pub count: u32, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for TsoRequest {} + +impl TsoRequest { + pub fn new() -> TsoRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static TsoRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const TsoRequest, + }; + unsafe { + instance.get(TsoRequest::new) + } + } + + // .pdpb.RequestHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: RequestHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut RequestHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> RequestHeader { + self.header.take().unwrap_or_else(|| RequestHeader::new()) + } + + pub fn get_header(&self) -> &RequestHeader { + self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } + + // uint32 count = 2; + + pub fn clear_count(&mut self) { + self.count = 0; + } + + // Param is passed by value, moved + pub fn set_count(&mut self, v: u32) { + self.count = v; + } + + pub fn get_count(&self) -> u32 { + self.count + } + + fn get_count_for_reflect(&self) -> &u32 { + &self.count + } + + fn mut_count_for_reflect(&mut self) -> &mut u32 { + &mut self.count + } +} + +impl ::protobuf::Message for TsoRequest { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.count = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.count != 0 { + my_size += ::protobuf::rt::value_size(2, self.count, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.count != 0 { + os.write_uint32(2, self.count)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for TsoRequest { + fn new() -> TsoRequest { + TsoRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + TsoRequest::get_header_for_reflect, + TsoRequest::mut_header_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "count", + TsoRequest::get_count_for_reflect, + TsoRequest::mut_count_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "TsoRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for TsoRequest { + fn clear(&mut self) { + self.clear_header(); + self.clear_count(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for TsoRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TsoRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Timestamp { + // message fields + pub physical: i64, + pub logical: i64, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Timestamp {} + +impl Timestamp { + pub fn new() -> Timestamp { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static Timestamp { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Timestamp, + }; + unsafe { + instance.get(Timestamp::new) + } + } + + // int64 physical = 1; + + pub fn clear_physical(&mut self) { + self.physical = 0; + } + + // Param is passed by value, moved + pub fn set_physical(&mut self, v: i64) { + self.physical = v; + } + + pub fn get_physical(&self) -> i64 { + self.physical + } + + fn get_physical_for_reflect(&self) -> &i64 { + &self.physical + } + + fn mut_physical_for_reflect(&mut self) -> &mut i64 { + &mut self.physical + } + + // int64 logical = 2; + + pub fn clear_logical(&mut self) { + self.logical = 0; + } + + // Param is passed by value, moved + pub fn set_logical(&mut self, v: i64) { + self.logical = v; + } + + pub fn get_logical(&self) -> i64 { + self.logical + } + + fn get_logical_for_reflect(&self) -> &i64 { + &self.logical + } + + fn mut_logical_for_reflect(&mut self) -> &mut i64 { + &mut self.logical + } +} + +impl ::protobuf::Message for Timestamp { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.physical = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.logical = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.physical != 0 { + my_size += ::protobuf::rt::value_size(1, self.physical, ::protobuf::wire_format::WireTypeVarint); + } + if self.logical != 0 { + my_size += ::protobuf::rt::value_size(2, self.logical, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.physical != 0 { + os.write_int64(1, self.physical)?; + } + if self.logical != 0 { + os.write_int64(2, self.logical)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for Timestamp { + fn new() -> Timestamp { + Timestamp::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "physical", + Timestamp::get_physical_for_reflect, + Timestamp::mut_physical_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "logical", + Timestamp::get_logical_for_reflect, + Timestamp::mut_logical_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Timestamp", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for Timestamp { + fn clear(&mut self) { + self.clear_physical(); + self.clear_logical(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Timestamp { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Timestamp { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct TsoResponse { + // message fields + pub header: ::protobuf::SingularPtrField, + pub count: u32, + pub timestamp: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for TsoResponse {} + +impl TsoResponse { + pub fn new() -> TsoResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static TsoResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const TsoResponse, + }; + unsafe { + instance.get(TsoResponse::new) + } + } + + // .pdpb.ResponseHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: ResponseHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut ResponseHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> ResponseHeader { + self.header.take().unwrap_or_else(|| ResponseHeader::new()) + } + + pub fn get_header(&self) -> &ResponseHeader { + self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } + + // uint32 count = 2; + + pub fn clear_count(&mut self) { + self.count = 0; + } + + // Param is passed by value, moved + pub fn set_count(&mut self, v: u32) { + self.count = v; + } + + pub fn get_count(&self) -> u32 { + self.count + } + + fn get_count_for_reflect(&self) -> &u32 { + &self.count + } + + fn mut_count_for_reflect(&mut self) -> &mut u32 { + &mut self.count + } + + // .pdpb.Timestamp timestamp = 3; + + pub fn clear_timestamp(&mut self) { + self.timestamp.clear(); + } + + pub fn has_timestamp(&self) -> bool { + self.timestamp.is_some() + } + + // Param is passed by value, moved + pub fn set_timestamp(&mut self, v: Timestamp) { + self.timestamp = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_timestamp(&mut self) -> &mut Timestamp { + if self.timestamp.is_none() { + self.timestamp.set_default(); + } + self.timestamp.as_mut().unwrap() + } + + // Take field + pub fn take_timestamp(&mut self) -> Timestamp { + self.timestamp.take().unwrap_or_else(|| Timestamp::new()) + } + + pub fn get_timestamp(&self) -> &Timestamp { + self.timestamp.as_ref().unwrap_or_else(|| Timestamp::default_instance()) + } + + fn get_timestamp_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.timestamp + } + + fn mut_timestamp_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.timestamp + } +} + +impl ::protobuf::Message for TsoResponse { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + for v in &self.timestamp { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.count = tmp; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.timestamp)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.count != 0 { + my_size += ::protobuf::rt::value_size(2, self.count, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.timestamp.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.count != 0 { + os.write_uint32(2, self.count)?; + } + if let Some(ref v) = self.timestamp.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for TsoResponse { + fn new() -> TsoResponse { + TsoResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + TsoResponse::get_header_for_reflect, + TsoResponse::mut_header_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "count", + TsoResponse::get_count_for_reflect, + TsoResponse::mut_count_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "timestamp", + TsoResponse::get_timestamp_for_reflect, + TsoResponse::mut_timestamp_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "TsoResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for TsoResponse { + fn clear(&mut self) { + self.clear_header(); + self.clear_count(); + self.clear_timestamp(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for TsoResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TsoResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct BootstrapRequest { + // message fields + pub header: ::protobuf::SingularPtrField, + pub store: ::protobuf::SingularPtrField, + pub region: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for BootstrapRequest {} + +impl BootstrapRequest { + pub fn new() -> BootstrapRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static BootstrapRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const BootstrapRequest, + }; + unsafe { + instance.get(BootstrapRequest::new) + } + } + + // .pdpb.RequestHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: RequestHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut RequestHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> RequestHeader { + self.header.take().unwrap_or_else(|| RequestHeader::new()) + } + + pub fn get_header(&self) -> &RequestHeader { + self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } + + // .metapb.Store store = 2; + + pub fn clear_store(&mut self) { + self.store.clear(); + } + + pub fn has_store(&self) -> bool { + self.store.is_some() + } + + // Param is passed by value, moved + pub fn set_store(&mut self, v: super::metapb::Store) { + self.store = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_store(&mut self) -> &mut super::metapb::Store { + if self.store.is_none() { + self.store.set_default(); + } + self.store.as_mut().unwrap() + } + + // Take field + pub fn take_store(&mut self) -> super::metapb::Store { + self.store.take().unwrap_or_else(|| super::metapb::Store::new()) + } + + pub fn get_store(&self) -> &super::metapb::Store { + self.store.as_ref().unwrap_or_else(|| super::metapb::Store::default_instance()) + } + + fn get_store_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.store + } + + fn mut_store_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.store + } + + // .metapb.Region region = 3; + + pub fn clear_region(&mut self) { + self.region.clear(); + } + + pub fn has_region(&self) -> bool { + self.region.is_some() + } + + // Param is passed by value, moved + pub fn set_region(&mut self, v: super::metapb::Region) { + self.region = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region(&mut self) -> &mut super::metapb::Region { + if self.region.is_none() { + self.region.set_default(); + } + self.region.as_mut().unwrap() + } + + // Take field + pub fn take_region(&mut self) -> super::metapb::Region { + self.region.take().unwrap_or_else(|| super::metapb::Region::new()) + } + + pub fn get_region(&self) -> &super::metapb::Region { + self.region.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) + } + + fn get_region_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region + } + + fn mut_region_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region + } +} + +impl ::protobuf::Message for BootstrapRequest { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + for v in &self.store { + if !v.is_initialized() { + return false; + } + }; + for v in &self.region { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.store)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.store.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.region.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.store.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.region.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for BootstrapRequest { + fn new() -> BootstrapRequest { + BootstrapRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + BootstrapRequest::get_header_for_reflect, + BootstrapRequest::mut_header_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "store", + BootstrapRequest::get_store_for_reflect, + BootstrapRequest::mut_store_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region", + BootstrapRequest::get_region_for_reflect, + BootstrapRequest::mut_region_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "BootstrapRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for BootstrapRequest { + fn clear(&mut self) { + self.clear_header(); + self.clear_store(); + self.clear_region(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for BootstrapRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for BootstrapRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct BootstrapResponse { + // message fields + pub header: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for BootstrapResponse {} + +impl BootstrapResponse { + pub fn new() -> BootstrapResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static BootstrapResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const BootstrapResponse, + }; + unsafe { + instance.get(BootstrapResponse::new) + } + } + + // .pdpb.ResponseHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: ResponseHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut ResponseHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> ResponseHeader { + self.header.take().unwrap_or_else(|| ResponseHeader::new()) + } + + pub fn get_header(&self) -> &ResponseHeader { + self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } +} + +impl ::protobuf::Message for BootstrapResponse { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for BootstrapResponse { + fn new() -> BootstrapResponse { + BootstrapResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + BootstrapResponse::get_header_for_reflect, + BootstrapResponse::mut_header_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "BootstrapResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for BootstrapResponse { + fn clear(&mut self) { + self.clear_header(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for BootstrapResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for BootstrapResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct IsBootstrappedRequest { + // message fields + pub header: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for IsBootstrappedRequest {} + +impl IsBootstrappedRequest { + pub fn new() -> IsBootstrappedRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static IsBootstrappedRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const IsBootstrappedRequest, + }; + unsafe { + instance.get(IsBootstrappedRequest::new) + } + } + + // .pdpb.RequestHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: RequestHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut RequestHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> RequestHeader { + self.header.take().unwrap_or_else(|| RequestHeader::new()) + } + + pub fn get_header(&self) -> &RequestHeader { + self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } +} + +impl ::protobuf::Message for IsBootstrappedRequest { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for IsBootstrappedRequest { + fn new() -> IsBootstrappedRequest { + IsBootstrappedRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + IsBootstrappedRequest::get_header_for_reflect, + IsBootstrappedRequest::mut_header_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "IsBootstrappedRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for IsBootstrappedRequest { + fn clear(&mut self) { + self.clear_header(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for IsBootstrappedRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for IsBootstrappedRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct IsBootstrappedResponse { + // message fields + pub header: ::protobuf::SingularPtrField, + pub bootstrapped: bool, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for IsBootstrappedResponse {} + +impl IsBootstrappedResponse { + pub fn new() -> IsBootstrappedResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static IsBootstrappedResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const IsBootstrappedResponse, + }; + unsafe { + instance.get(IsBootstrappedResponse::new) + } + } + + // .pdpb.ResponseHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: ResponseHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut ResponseHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> ResponseHeader { + self.header.take().unwrap_or_else(|| ResponseHeader::new()) + } + + pub fn get_header(&self) -> &ResponseHeader { + self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } + + // bool bootstrapped = 2; + + pub fn clear_bootstrapped(&mut self) { + self.bootstrapped = false; + } + + // Param is passed by value, moved + pub fn set_bootstrapped(&mut self, v: bool) { + self.bootstrapped = v; + } + + pub fn get_bootstrapped(&self) -> bool { + self.bootstrapped + } + + fn get_bootstrapped_for_reflect(&self) -> &bool { + &self.bootstrapped + } + + fn mut_bootstrapped_for_reflect(&mut self) -> &mut bool { + &mut self.bootstrapped + } +} + +impl ::protobuf::Message for IsBootstrappedResponse { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.bootstrapped = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.bootstrapped != false { + my_size += 2; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.bootstrapped != false { + os.write_bool(2, self.bootstrapped)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for IsBootstrappedResponse { + fn new() -> IsBootstrappedResponse { + IsBootstrappedResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + IsBootstrappedResponse::get_header_for_reflect, + IsBootstrappedResponse::mut_header_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "bootstrapped", + IsBootstrappedResponse::get_bootstrapped_for_reflect, + IsBootstrappedResponse::mut_bootstrapped_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "IsBootstrappedResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for IsBootstrappedResponse { + fn clear(&mut self) { + self.clear_header(); + self.clear_bootstrapped(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for IsBootstrappedResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for IsBootstrappedResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct AllocIDRequest { + // message fields + pub header: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for AllocIDRequest {} + +impl AllocIDRequest { + pub fn new() -> AllocIDRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static AllocIDRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const AllocIDRequest, + }; + unsafe { + instance.get(AllocIDRequest::new) + } + } + + // .pdpb.RequestHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: RequestHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut RequestHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> RequestHeader { + self.header.take().unwrap_or_else(|| RequestHeader::new()) + } + + pub fn get_header(&self) -> &RequestHeader { + self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } +} + +impl ::protobuf::Message for AllocIDRequest { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for AllocIDRequest { + fn new() -> AllocIDRequest { + AllocIDRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + AllocIDRequest::get_header_for_reflect, + AllocIDRequest::mut_header_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "AllocIDRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for AllocIDRequest { + fn clear(&mut self) { + self.clear_header(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for AllocIDRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for AllocIDRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct AllocIDResponse { + // message fields + pub header: ::protobuf::SingularPtrField, + pub id: u64, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for AllocIDResponse {} + +impl AllocIDResponse { + pub fn new() -> AllocIDResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static AllocIDResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const AllocIDResponse, + }; + unsafe { + instance.get(AllocIDResponse::new) + } + } + + // .pdpb.ResponseHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: ResponseHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut ResponseHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> ResponseHeader { + self.header.take().unwrap_or_else(|| ResponseHeader::new()) + } + + pub fn get_header(&self) -> &ResponseHeader { + self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } + + // uint64 id = 2; + + pub fn clear_id(&mut self) { + self.id = 0; + } + + // Param is passed by value, moved + pub fn set_id(&mut self, v: u64) { + self.id = v; + } + + pub fn get_id(&self) -> u64 { + self.id + } + + fn get_id_for_reflect(&self) -> &u64 { + &self.id + } + + fn mut_id_for_reflect(&mut self) -> &mut u64 { + &mut self.id + } +} + +impl ::protobuf::Message for AllocIDResponse { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.id = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.id != 0 { + my_size += ::protobuf::rt::value_size(2, self.id, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.id != 0 { + os.write_uint64(2, self.id)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for AllocIDResponse { + fn new() -> AllocIDResponse { + AllocIDResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + AllocIDResponse::get_header_for_reflect, + AllocIDResponse::mut_header_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "id", + AllocIDResponse::get_id_for_reflect, + AllocIDResponse::mut_id_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "AllocIDResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for AllocIDResponse { + fn clear(&mut self) { + self.clear_header(); + self.clear_id(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for AllocIDResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for AllocIDResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct GetStoreRequest { + // message fields + pub header: ::protobuf::SingularPtrField, + pub store_id: u64, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for GetStoreRequest {} + +impl GetStoreRequest { + pub fn new() -> GetStoreRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static GetStoreRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const GetStoreRequest, + }; + unsafe { + instance.get(GetStoreRequest::new) + } + } + + // .pdpb.RequestHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: RequestHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut RequestHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> RequestHeader { + self.header.take().unwrap_or_else(|| RequestHeader::new()) + } + + pub fn get_header(&self) -> &RequestHeader { + self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } + + // uint64 store_id = 2; + + pub fn clear_store_id(&mut self) { + self.store_id = 0; + } + + // Param is passed by value, moved + pub fn set_store_id(&mut self, v: u64) { + self.store_id = v; + } + + pub fn get_store_id(&self) -> u64 { + self.store_id + } + + fn get_store_id_for_reflect(&self) -> &u64 { + &self.store_id + } + + fn mut_store_id_for_reflect(&mut self) -> &mut u64 { + &mut self.store_id + } +} + +impl ::protobuf::Message for GetStoreRequest { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.store_id = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.store_id != 0 { + my_size += ::protobuf::rt::value_size(2, self.store_id, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.store_id != 0 { + os.write_uint64(2, self.store_id)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for GetStoreRequest { + fn new() -> GetStoreRequest { + GetStoreRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + GetStoreRequest::get_header_for_reflect, + GetStoreRequest::mut_header_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "store_id", + GetStoreRequest::get_store_id_for_reflect, + GetStoreRequest::mut_store_id_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "GetStoreRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for GetStoreRequest { + fn clear(&mut self) { + self.clear_header(); + self.clear_store_id(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for GetStoreRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetStoreRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct GetStoreResponse { + // message fields + pub header: ::protobuf::SingularPtrField, + pub store: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for GetStoreResponse {} + +impl GetStoreResponse { + pub fn new() -> GetStoreResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static GetStoreResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const GetStoreResponse, + }; + unsafe { + instance.get(GetStoreResponse::new) + } + } + + // .pdpb.ResponseHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: ResponseHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut ResponseHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> ResponseHeader { + self.header.take().unwrap_or_else(|| ResponseHeader::new()) + } + + pub fn get_header(&self) -> &ResponseHeader { + self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } + + // .metapb.Store store = 2; + + pub fn clear_store(&mut self) { + self.store.clear(); + } + + pub fn has_store(&self) -> bool { + self.store.is_some() + } + + // Param is passed by value, moved + pub fn set_store(&mut self, v: super::metapb::Store) { + self.store = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_store(&mut self) -> &mut super::metapb::Store { + if self.store.is_none() { + self.store.set_default(); + } + self.store.as_mut().unwrap() + } + + // Take field + pub fn take_store(&mut self) -> super::metapb::Store { + self.store.take().unwrap_or_else(|| super::metapb::Store::new()) + } + + pub fn get_store(&self) -> &super::metapb::Store { + self.store.as_ref().unwrap_or_else(|| super::metapb::Store::default_instance()) + } + + fn get_store_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.store + } + + fn mut_store_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.store + } +} + +impl ::protobuf::Message for GetStoreResponse { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + for v in &self.store { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.store)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.store.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.store.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for GetStoreResponse { + fn new() -> GetStoreResponse { + GetStoreResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + GetStoreResponse::get_header_for_reflect, + GetStoreResponse::mut_header_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "store", + GetStoreResponse::get_store_for_reflect, + GetStoreResponse::mut_store_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "GetStoreResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for GetStoreResponse { + fn clear(&mut self) { + self.clear_header(); + self.clear_store(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for GetStoreResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetStoreResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct PutStoreRequest { + // message fields + pub header: ::protobuf::SingularPtrField, + pub store: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for PutStoreRequest {} + +impl PutStoreRequest { + pub fn new() -> PutStoreRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static PutStoreRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const PutStoreRequest, + }; + unsafe { + instance.get(PutStoreRequest::new) + } + } + + // .pdpb.RequestHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: RequestHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut RequestHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> RequestHeader { + self.header.take().unwrap_or_else(|| RequestHeader::new()) + } + + pub fn get_header(&self) -> &RequestHeader { + self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } + + // .metapb.Store store = 2; + + pub fn clear_store(&mut self) { + self.store.clear(); + } + + pub fn has_store(&self) -> bool { + self.store.is_some() + } + + // Param is passed by value, moved + pub fn set_store(&mut self, v: super::metapb::Store) { + self.store = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_store(&mut self) -> &mut super::metapb::Store { + if self.store.is_none() { + self.store.set_default(); + } + self.store.as_mut().unwrap() + } + + // Take field + pub fn take_store(&mut self) -> super::metapb::Store { + self.store.take().unwrap_or_else(|| super::metapb::Store::new()) + } + + pub fn get_store(&self) -> &super::metapb::Store { + self.store.as_ref().unwrap_or_else(|| super::metapb::Store::default_instance()) + } + + fn get_store_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.store + } + + fn mut_store_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.store + } +} + +impl ::protobuf::Message for PutStoreRequest { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + for v in &self.store { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.store)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.store.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.store.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for PutStoreRequest { + fn new() -> PutStoreRequest { + PutStoreRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + PutStoreRequest::get_header_for_reflect, + PutStoreRequest::mut_header_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "store", + PutStoreRequest::get_store_for_reflect, + PutStoreRequest::mut_store_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "PutStoreRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for PutStoreRequest { + fn clear(&mut self) { + self.clear_header(); + self.clear_store(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for PutStoreRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PutStoreRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct PutStoreResponse { + // message fields + pub header: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for PutStoreResponse {} + +impl PutStoreResponse { + pub fn new() -> PutStoreResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static PutStoreResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const PutStoreResponse, + }; + unsafe { + instance.get(PutStoreResponse::new) + } + } + + // .pdpb.ResponseHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: ResponseHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut ResponseHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> ResponseHeader { + self.header.take().unwrap_or_else(|| ResponseHeader::new()) + } + + pub fn get_header(&self) -> &ResponseHeader { + self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } +} + +impl ::protobuf::Message for PutStoreResponse { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for PutStoreResponse { + fn new() -> PutStoreResponse { + PutStoreResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + PutStoreResponse::get_header_for_reflect, + PutStoreResponse::mut_header_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "PutStoreResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for PutStoreResponse { + fn clear(&mut self) { + self.clear_header(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for PutStoreResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PutStoreResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct GetRegionRequest { + // message fields + pub header: ::protobuf::SingularPtrField, + pub region_key: ::std::vec::Vec, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for GetRegionRequest {} + +impl GetRegionRequest { + pub fn new() -> GetRegionRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static GetRegionRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const GetRegionRequest, + }; + unsafe { + instance.get(GetRegionRequest::new) + } + } + + // .pdpb.RequestHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: RequestHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut RequestHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> RequestHeader { + self.header.take().unwrap_or_else(|| RequestHeader::new()) + } + + pub fn get_header(&self) -> &RequestHeader { + self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } + + // bytes region_key = 2; + + pub fn clear_region_key(&mut self) { + self.region_key.clear(); + } + + // Param is passed by value, moved + pub fn set_region_key(&mut self, v: ::std::vec::Vec) { + self.region_key = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_key(&mut self) -> &mut ::std::vec::Vec { + &mut self.region_key + } + + // Take field + pub fn take_region_key(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.region_key, ::std::vec::Vec::new()) + } + + pub fn get_region_key(&self) -> &[u8] { + &self.region_key + } + + fn get_region_key_for_reflect(&self) -> &::std::vec::Vec { + &self.region_key + } + + fn mut_region_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.region_key + } +} + +impl ::protobuf::Message for GetRegionRequest { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.region_key)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.region_key.is_empty() { + my_size += ::protobuf::rt::bytes_size(2, &self.region_key); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.region_key.is_empty() { + os.write_bytes(2, &self.region_key)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for GetRegionRequest { + fn new() -> GetRegionRequest { + GetRegionRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + GetRegionRequest::get_header_for_reflect, + GetRegionRequest::mut_header_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "region_key", + GetRegionRequest::get_region_key_for_reflect, + GetRegionRequest::mut_region_key_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "GetRegionRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for GetRegionRequest { + fn clear(&mut self) { + self.clear_header(); + self.clear_region_key(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for GetRegionRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetRegionRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct GetRegionResponse { + // message fields + pub header: ::protobuf::SingularPtrField, + pub region: ::protobuf::SingularPtrField, + pub leader: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for GetRegionResponse {} + +impl GetRegionResponse { + pub fn new() -> GetRegionResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static GetRegionResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const GetRegionResponse, + }; + unsafe { + instance.get(GetRegionResponse::new) + } + } + + // .pdpb.ResponseHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: ResponseHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut ResponseHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> ResponseHeader { + self.header.take().unwrap_or_else(|| ResponseHeader::new()) + } + + pub fn get_header(&self) -> &ResponseHeader { + self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } + + // .metapb.Region region = 2; + + pub fn clear_region(&mut self) { + self.region.clear(); + } + + pub fn has_region(&self) -> bool { + self.region.is_some() + } + + // Param is passed by value, moved + pub fn set_region(&mut self, v: super::metapb::Region) { + self.region = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region(&mut self) -> &mut super::metapb::Region { + if self.region.is_none() { + self.region.set_default(); + } + self.region.as_mut().unwrap() + } + + // Take field + pub fn take_region(&mut self) -> super::metapb::Region { + self.region.take().unwrap_or_else(|| super::metapb::Region::new()) + } + + pub fn get_region(&self) -> &super::metapb::Region { + self.region.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) + } + + fn get_region_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region + } + + fn mut_region_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region + } + + // .metapb.Peer leader = 3; + + pub fn clear_leader(&mut self) { + self.leader.clear(); + } + + pub fn has_leader(&self) -> bool { + self.leader.is_some() + } + + // Param is passed by value, moved + pub fn set_leader(&mut self, v: super::metapb::Peer) { + self.leader = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_leader(&mut self) -> &mut super::metapb::Peer { + if self.leader.is_none() { + self.leader.set_default(); + } + self.leader.as_mut().unwrap() + } + + // Take field + pub fn take_leader(&mut self) -> super::metapb::Peer { + self.leader.take().unwrap_or_else(|| super::metapb::Peer::new()) + } + + pub fn get_leader(&self) -> &super::metapb::Peer { + self.leader.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) + } + + fn get_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.leader + } + + fn mut_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.leader + } +} + +impl ::protobuf::Message for GetRegionResponse { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + for v in &self.region { + if !v.is_initialized() { + return false; + } + }; + for v in &self.leader { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.leader)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.region.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.leader.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.region.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.leader.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for GetRegionResponse { + fn new() -> GetRegionResponse { + GetRegionResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + GetRegionResponse::get_header_for_reflect, + GetRegionResponse::mut_header_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region", + GetRegionResponse::get_region_for_reflect, + GetRegionResponse::mut_region_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "leader", + GetRegionResponse::get_leader_for_reflect, + GetRegionResponse::mut_leader_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "GetRegionResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for GetRegionResponse { + fn clear(&mut self) { + self.clear_header(); + self.clear_region(); + self.clear_leader(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for GetRegionResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetRegionResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct GetRegionByIDRequest { + // message fields + pub header: ::protobuf::SingularPtrField, + pub region_id: u64, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for GetRegionByIDRequest {} + +impl GetRegionByIDRequest { + pub fn new() -> GetRegionByIDRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static GetRegionByIDRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const GetRegionByIDRequest, + }; + unsafe { + instance.get(GetRegionByIDRequest::new) + } + } + + // .pdpb.RequestHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: RequestHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut RequestHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> RequestHeader { + self.header.take().unwrap_or_else(|| RequestHeader::new()) + } + + pub fn get_header(&self) -> &RequestHeader { + self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } + + // uint64 region_id = 2; + + pub fn clear_region_id(&mut self) { + self.region_id = 0; + } + + // Param is passed by value, moved + pub fn set_region_id(&mut self, v: u64) { + self.region_id = v; + } + + pub fn get_region_id(&self) -> u64 { + self.region_id + } + + fn get_region_id_for_reflect(&self) -> &u64 { + &self.region_id + } + + fn mut_region_id_for_reflect(&mut self) -> &mut u64 { + &mut self.region_id + } +} + +impl ::protobuf::Message for GetRegionByIDRequest { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.region_id = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.region_id != 0 { + my_size += ::protobuf::rt::value_size(2, self.region_id, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.region_id != 0 { + os.write_uint64(2, self.region_id)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for GetRegionByIDRequest { + fn new() -> GetRegionByIDRequest { + GetRegionByIDRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + GetRegionByIDRequest::get_header_for_reflect, + GetRegionByIDRequest::mut_header_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "region_id", + GetRegionByIDRequest::get_region_id_for_reflect, + GetRegionByIDRequest::mut_region_id_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "GetRegionByIDRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for GetRegionByIDRequest { + fn clear(&mut self) { + self.clear_header(); + self.clear_region_id(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for GetRegionByIDRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetRegionByIDRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct GetClusterConfigRequest { + // message fields + pub header: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for GetClusterConfigRequest {} + +impl GetClusterConfigRequest { + pub fn new() -> GetClusterConfigRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static GetClusterConfigRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const GetClusterConfigRequest, + }; + unsafe { + instance.get(GetClusterConfigRequest::new) + } + } + + // .pdpb.RequestHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: RequestHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut RequestHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> RequestHeader { + self.header.take().unwrap_or_else(|| RequestHeader::new()) + } + + pub fn get_header(&self) -> &RequestHeader { + self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } +} + +impl ::protobuf::Message for GetClusterConfigRequest { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for GetClusterConfigRequest { + fn new() -> GetClusterConfigRequest { + GetClusterConfigRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + GetClusterConfigRequest::get_header_for_reflect, + GetClusterConfigRequest::mut_header_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "GetClusterConfigRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for GetClusterConfigRequest { + fn clear(&mut self) { + self.clear_header(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for GetClusterConfigRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetClusterConfigRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct GetClusterConfigResponse { + // message fields + pub header: ::protobuf::SingularPtrField, + pub cluster: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for GetClusterConfigResponse {} + +impl GetClusterConfigResponse { + pub fn new() -> GetClusterConfigResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static GetClusterConfigResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const GetClusterConfigResponse, + }; + unsafe { + instance.get(GetClusterConfigResponse::new) + } + } + + // .pdpb.ResponseHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: ResponseHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut ResponseHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> ResponseHeader { + self.header.take().unwrap_or_else(|| ResponseHeader::new()) + } + + pub fn get_header(&self) -> &ResponseHeader { + self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } + + // .metapb.Cluster cluster = 2; + + pub fn clear_cluster(&mut self) { + self.cluster.clear(); + } + + pub fn has_cluster(&self) -> bool { + self.cluster.is_some() + } + + // Param is passed by value, moved + pub fn set_cluster(&mut self, v: super::metapb::Cluster) { + self.cluster = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_cluster(&mut self) -> &mut super::metapb::Cluster { + if self.cluster.is_none() { + self.cluster.set_default(); + } + self.cluster.as_mut().unwrap() + } + + // Take field + pub fn take_cluster(&mut self) -> super::metapb::Cluster { + self.cluster.take().unwrap_or_else(|| super::metapb::Cluster::new()) + } + + pub fn get_cluster(&self) -> &super::metapb::Cluster { + self.cluster.as_ref().unwrap_or_else(|| super::metapb::Cluster::default_instance()) + } + + fn get_cluster_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.cluster + } + + fn mut_cluster_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.cluster + } +} + +impl ::protobuf::Message for GetClusterConfigResponse { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + for v in &self.cluster { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.cluster)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.cluster.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.cluster.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for GetClusterConfigResponse { + fn new() -> GetClusterConfigResponse { + GetClusterConfigResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + GetClusterConfigResponse::get_header_for_reflect, + GetClusterConfigResponse::mut_header_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "cluster", + GetClusterConfigResponse::get_cluster_for_reflect, + GetClusterConfigResponse::mut_cluster_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "GetClusterConfigResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for GetClusterConfigResponse { + fn clear(&mut self) { + self.clear_header(); + self.clear_cluster(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for GetClusterConfigResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetClusterConfigResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct PutClusterConfigRequest { + // message fields + pub header: ::protobuf::SingularPtrField, + pub cluster: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for PutClusterConfigRequest {} + +impl PutClusterConfigRequest { + pub fn new() -> PutClusterConfigRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static PutClusterConfigRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const PutClusterConfigRequest, + }; + unsafe { + instance.get(PutClusterConfigRequest::new) + } + } + + // .pdpb.RequestHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: RequestHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut RequestHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> RequestHeader { + self.header.take().unwrap_or_else(|| RequestHeader::new()) + } + + pub fn get_header(&self) -> &RequestHeader { + self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } + + // .metapb.Cluster cluster = 2; + + pub fn clear_cluster(&mut self) { + self.cluster.clear(); + } + + pub fn has_cluster(&self) -> bool { + self.cluster.is_some() + } + + // Param is passed by value, moved + pub fn set_cluster(&mut self, v: super::metapb::Cluster) { + self.cluster = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_cluster(&mut self) -> &mut super::metapb::Cluster { + if self.cluster.is_none() { + self.cluster.set_default(); + } + self.cluster.as_mut().unwrap() + } + + // Take field + pub fn take_cluster(&mut self) -> super::metapb::Cluster { + self.cluster.take().unwrap_or_else(|| super::metapb::Cluster::new()) + } + + pub fn get_cluster(&self) -> &super::metapb::Cluster { + self.cluster.as_ref().unwrap_or_else(|| super::metapb::Cluster::default_instance()) + } + + fn get_cluster_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.cluster + } + + fn mut_cluster_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.cluster + } +} + +impl ::protobuf::Message for PutClusterConfigRequest { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + for v in &self.cluster { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.cluster)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.cluster.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.cluster.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for PutClusterConfigRequest { + fn new() -> PutClusterConfigRequest { + PutClusterConfigRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + PutClusterConfigRequest::get_header_for_reflect, + PutClusterConfigRequest::mut_header_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "cluster", + PutClusterConfigRequest::get_cluster_for_reflect, + PutClusterConfigRequest::mut_cluster_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "PutClusterConfigRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for PutClusterConfigRequest { + fn clear(&mut self) { + self.clear_header(); + self.clear_cluster(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for PutClusterConfigRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PutClusterConfigRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct PutClusterConfigResponse { + // message fields + pub header: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for PutClusterConfigResponse {} + +impl PutClusterConfigResponse { + pub fn new() -> PutClusterConfigResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static PutClusterConfigResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const PutClusterConfigResponse, + }; + unsafe { + instance.get(PutClusterConfigResponse::new) + } + } + + // .pdpb.ResponseHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: ResponseHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut ResponseHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> ResponseHeader { + self.header.take().unwrap_or_else(|| ResponseHeader::new()) + } + + pub fn get_header(&self) -> &ResponseHeader { + self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } +} + +impl ::protobuf::Message for PutClusterConfigResponse { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for PutClusterConfigResponse { + fn new() -> PutClusterConfigResponse { + PutClusterConfigResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + PutClusterConfigResponse::get_header_for_reflect, + PutClusterConfigResponse::mut_header_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "PutClusterConfigResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for PutClusterConfigResponse { + fn clear(&mut self) { + self.clear_header(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for PutClusterConfigResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PutClusterConfigResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Member { + // message fields + pub name: ::std::string::String, + pub member_id: u64, + pub peer_urls: ::protobuf::RepeatedField<::std::string::String>, + pub client_urls: ::protobuf::RepeatedField<::std::string::String>, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Member {} + +impl Member { + pub fn new() -> Member { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static Member { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Member, + }; + unsafe { + instance.get(Member::new) + } + } + + // string name = 1; + + pub fn clear_name(&mut self) { + self.name.clear(); + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.name, ::std::string::String::new()) + } + + pub fn get_name(&self) -> &str { + &self.name + } + + fn get_name_for_reflect(&self) -> &::std::string::String { + &self.name + } + + fn mut_name_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // uint64 member_id = 2; + + pub fn clear_member_id(&mut self) { + self.member_id = 0; + } + + // Param is passed by value, moved + pub fn set_member_id(&mut self, v: u64) { + self.member_id = v; + } + + pub fn get_member_id(&self) -> u64 { + self.member_id + } + + fn get_member_id_for_reflect(&self) -> &u64 { + &self.member_id + } + + fn mut_member_id_for_reflect(&mut self) -> &mut u64 { + &mut self.member_id + } + + // repeated string peer_urls = 3; + + pub fn clear_peer_urls(&mut self) { + self.peer_urls.clear(); + } + + // Param is passed by value, moved + pub fn set_peer_urls(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.peer_urls = v; + } + + // Mutable pointer to the field. + pub fn mut_peer_urls(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.peer_urls + } + + // Take field + pub fn take_peer_urls(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.peer_urls, ::protobuf::RepeatedField::new()) + } + + pub fn get_peer_urls(&self) -> &[::std::string::String] { + &self.peer_urls + } + + fn get_peer_urls_for_reflect(&self) -> &::protobuf::RepeatedField<::std::string::String> { + &self.peer_urls + } + + fn mut_peer_urls_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.peer_urls + } + + // repeated string client_urls = 4; + + pub fn clear_client_urls(&mut self) { + self.client_urls.clear(); + } + + // Param is passed by value, moved + pub fn set_client_urls(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.client_urls = v; + } + + // Mutable pointer to the field. + pub fn mut_client_urls(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.client_urls + } + + // Take field + pub fn take_client_urls(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.client_urls, ::protobuf::RepeatedField::new()) + } + + pub fn get_client_urls(&self) -> &[::std::string::String] { + &self.client_urls + } + + fn get_client_urls_for_reflect(&self) -> &::protobuf::RepeatedField<::std::string::String> { + &self.client_urls + } + + fn mut_client_urls_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.client_urls + } +} + +impl ::protobuf::Message for Member { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.member_id = tmp; + }, + 3 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.peer_urls)?; + }, + 4 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.client_urls)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.name.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.name); + } + if self.member_id != 0 { + my_size += ::protobuf::rt::value_size(2, self.member_id, ::protobuf::wire_format::WireTypeVarint); + } + for value in &self.peer_urls { + my_size += ::protobuf::rt::string_size(3, &value); + }; + for value in &self.client_urls { + my_size += ::protobuf::rt::string_size(4, &value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.name.is_empty() { + os.write_string(1, &self.name)?; + } + if self.member_id != 0 { + os.write_uint64(2, self.member_id)?; + } + for v in &self.peer_urls { + os.write_string(3, &v)?; + }; + for v in &self.client_urls { + os.write_string(4, &v)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for Member { + fn new() -> Member { + Member::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "name", + Member::get_name_for_reflect, + Member::mut_name_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "member_id", + Member::get_member_id_for_reflect, + Member::mut_member_id_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "peer_urls", + Member::get_peer_urls_for_reflect, + Member::mut_peer_urls_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "client_urls", + Member::get_client_urls_for_reflect, + Member::mut_client_urls_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Member", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for Member { + fn clear(&mut self) { + self.clear_name(); + self.clear_member_id(); + self.clear_peer_urls(); + self.clear_client_urls(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Member { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Member { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct GetMembersRequest { + // message fields + pub header: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for GetMembersRequest {} + +impl GetMembersRequest { + pub fn new() -> GetMembersRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static GetMembersRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const GetMembersRequest, + }; + unsafe { + instance.get(GetMembersRequest::new) + } + } + + // .pdpb.RequestHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: RequestHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut RequestHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> RequestHeader { + self.header.take().unwrap_or_else(|| RequestHeader::new()) + } + + pub fn get_header(&self) -> &RequestHeader { + self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } +} + +impl ::protobuf::Message for GetMembersRequest { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for GetMembersRequest { + fn new() -> GetMembersRequest { + GetMembersRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + GetMembersRequest::get_header_for_reflect, + GetMembersRequest::mut_header_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "GetMembersRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for GetMembersRequest { + fn clear(&mut self) { + self.clear_header(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for GetMembersRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetMembersRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct GetMembersResponse { + // message fields + pub header: ::protobuf::SingularPtrField, + pub members: ::protobuf::RepeatedField, + pub leader: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for GetMembersResponse {} + +impl GetMembersResponse { + pub fn new() -> GetMembersResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static GetMembersResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const GetMembersResponse, + }; + unsafe { + instance.get(GetMembersResponse::new) + } + } + + // .pdpb.ResponseHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: ResponseHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut ResponseHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> ResponseHeader { + self.header.take().unwrap_or_else(|| ResponseHeader::new()) + } + + pub fn get_header(&self) -> &ResponseHeader { + self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } + + // repeated .pdpb.Member members = 2; + + pub fn clear_members(&mut self) { + self.members.clear(); + } + + // Param is passed by value, moved + pub fn set_members(&mut self, v: ::protobuf::RepeatedField) { + self.members = v; + } + + // Mutable pointer to the field. + pub fn mut_members(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.members + } + + // Take field + pub fn take_members(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.members, ::protobuf::RepeatedField::new()) + } + + pub fn get_members(&self) -> &[Member] { + &self.members + } + + fn get_members_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.members + } + + fn mut_members_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.members + } + + // .pdpb.Member leader = 3; + + pub fn clear_leader(&mut self) { + self.leader.clear(); + } + + pub fn has_leader(&self) -> bool { + self.leader.is_some() + } + + // Param is passed by value, moved + pub fn set_leader(&mut self, v: Member) { + self.leader = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_leader(&mut self) -> &mut Member { + if self.leader.is_none() { + self.leader.set_default(); + } + self.leader.as_mut().unwrap() + } + + // Take field + pub fn take_leader(&mut self) -> Member { + self.leader.take().unwrap_or_else(|| Member::new()) + } + + pub fn get_leader(&self) -> &Member { + self.leader.as_ref().unwrap_or_else(|| Member::default_instance()) + } + + fn get_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.leader + } + + fn mut_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.leader + } +} + +impl ::protobuf::Message for GetMembersResponse { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + for v in &self.members { + if !v.is_initialized() { + return false; + } + }; + for v in &self.leader { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + 2 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.members)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.leader)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + for value in &self.members { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if let Some(ref v) = self.leader.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + for v in &self.members { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if let Some(ref v) = self.leader.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for GetMembersResponse { + fn new() -> GetMembersResponse { + GetMembersResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + GetMembersResponse::get_header_for_reflect, + GetMembersResponse::mut_header_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "members", + GetMembersResponse::get_members_for_reflect, + GetMembersResponse::mut_members_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "leader", + GetMembersResponse::get_leader_for_reflect, + GetMembersResponse::mut_leader_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "GetMembersResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for GetMembersResponse { + fn clear(&mut self) { + self.clear_header(); + self.clear_members(); + self.clear_leader(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for GetMembersResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetMembersResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct PeerStats { + // message fields + pub peer: ::protobuf::SingularPtrField, + pub down_seconds: u64, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for PeerStats {} + +impl PeerStats { + pub fn new() -> PeerStats { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static PeerStats { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const PeerStats, + }; + unsafe { + instance.get(PeerStats::new) + } + } + + // .metapb.Peer peer = 1; + + pub fn clear_peer(&mut self) { + self.peer.clear(); + } + + pub fn has_peer(&self) -> bool { + self.peer.is_some() + } + + // Param is passed by value, moved + pub fn set_peer(&mut self, v: super::metapb::Peer) { + self.peer = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_peer(&mut self) -> &mut super::metapb::Peer { + if self.peer.is_none() { + self.peer.set_default(); + } + self.peer.as_mut().unwrap() + } + + // Take field + pub fn take_peer(&mut self) -> super::metapb::Peer { + self.peer.take().unwrap_or_else(|| super::metapb::Peer::new()) + } + + pub fn get_peer(&self) -> &super::metapb::Peer { + self.peer.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) + } + + fn get_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.peer + } + + fn mut_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.peer + } + + // uint64 down_seconds = 2; + + pub fn clear_down_seconds(&mut self) { + self.down_seconds = 0; + } + + // Param is passed by value, moved + pub fn set_down_seconds(&mut self, v: u64) { + self.down_seconds = v; + } + + pub fn get_down_seconds(&self) -> u64 { + self.down_seconds + } + + fn get_down_seconds_for_reflect(&self) -> &u64 { + &self.down_seconds + } + + fn mut_down_seconds_for_reflect(&mut self) -> &mut u64 { + &mut self.down_seconds + } +} + +impl ::protobuf::Message for PeerStats { + fn is_initialized(&self) -> bool { + for v in &self.peer { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.peer)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.down_seconds = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.peer.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.down_seconds != 0 { + my_size += ::protobuf::rt::value_size(2, self.down_seconds, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.peer.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.down_seconds != 0 { + os.write_uint64(2, self.down_seconds)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for PeerStats { + fn new() -> PeerStats { + PeerStats::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "peer", + PeerStats::get_peer_for_reflect, + PeerStats::mut_peer_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "down_seconds", + PeerStats::get_down_seconds_for_reflect, + PeerStats::mut_down_seconds_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "PeerStats", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for PeerStats { + fn clear(&mut self) { + self.clear_peer(); + self.clear_down_seconds(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for PeerStats { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PeerStats { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RegionHeartbeatRequest { + // message fields + pub header: ::protobuf::SingularPtrField, + pub region: ::protobuf::SingularPtrField, + pub leader: ::protobuf::SingularPtrField, + pub down_peers: ::protobuf::RepeatedField, + pub pending_peers: ::protobuf::RepeatedField, + pub bytes_written: u64, + pub bytes_read: u64, + pub keys_written: u64, + pub keys_read: u64, + pub approximate_size: u64, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RegionHeartbeatRequest {} + +impl RegionHeartbeatRequest { + pub fn new() -> RegionHeartbeatRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RegionHeartbeatRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RegionHeartbeatRequest, + }; + unsafe { + instance.get(RegionHeartbeatRequest::new) + } + } + + // .pdpb.RequestHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: RequestHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut RequestHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> RequestHeader { + self.header.take().unwrap_or_else(|| RequestHeader::new()) + } + + pub fn get_header(&self) -> &RequestHeader { + self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } + + // .metapb.Region region = 2; + + pub fn clear_region(&mut self) { + self.region.clear(); + } + + pub fn has_region(&self) -> bool { + self.region.is_some() + } + + // Param is passed by value, moved + pub fn set_region(&mut self, v: super::metapb::Region) { + self.region = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region(&mut self) -> &mut super::metapb::Region { + if self.region.is_none() { + self.region.set_default(); + } + self.region.as_mut().unwrap() + } + + // Take field + pub fn take_region(&mut self) -> super::metapb::Region { + self.region.take().unwrap_or_else(|| super::metapb::Region::new()) + } + + pub fn get_region(&self) -> &super::metapb::Region { + self.region.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) + } + + fn get_region_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region + } + + fn mut_region_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region + } + + // .metapb.Peer leader = 3; + + pub fn clear_leader(&mut self) { + self.leader.clear(); + } + + pub fn has_leader(&self) -> bool { + self.leader.is_some() + } + + // Param is passed by value, moved + pub fn set_leader(&mut self, v: super::metapb::Peer) { + self.leader = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_leader(&mut self) -> &mut super::metapb::Peer { + if self.leader.is_none() { + self.leader.set_default(); + } + self.leader.as_mut().unwrap() + } + + // Take field + pub fn take_leader(&mut self) -> super::metapb::Peer { + self.leader.take().unwrap_or_else(|| super::metapb::Peer::new()) + } + + pub fn get_leader(&self) -> &super::metapb::Peer { + self.leader.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) + } + + fn get_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.leader + } + + fn mut_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.leader + } + + // repeated .pdpb.PeerStats down_peers = 4; + + pub fn clear_down_peers(&mut self) { + self.down_peers.clear(); + } + + // Param is passed by value, moved + pub fn set_down_peers(&mut self, v: ::protobuf::RepeatedField) { + self.down_peers = v; + } + + // Mutable pointer to the field. + pub fn mut_down_peers(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.down_peers + } + + // Take field + pub fn take_down_peers(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.down_peers, ::protobuf::RepeatedField::new()) + } + + pub fn get_down_peers(&self) -> &[PeerStats] { + &self.down_peers + } + + fn get_down_peers_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.down_peers + } + + fn mut_down_peers_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.down_peers + } + + // repeated .metapb.Peer pending_peers = 5; + + pub fn clear_pending_peers(&mut self) { + self.pending_peers.clear(); + } + + // Param is passed by value, moved + pub fn set_pending_peers(&mut self, v: ::protobuf::RepeatedField) { + self.pending_peers = v; + } + + // Mutable pointer to the field. + pub fn mut_pending_peers(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.pending_peers + } + + // Take field + pub fn take_pending_peers(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.pending_peers, ::protobuf::RepeatedField::new()) + } + + pub fn get_pending_peers(&self) -> &[super::metapb::Peer] { + &self.pending_peers + } + + fn get_pending_peers_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.pending_peers + } + + fn mut_pending_peers_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.pending_peers + } + + // uint64 bytes_written = 6; + + pub fn clear_bytes_written(&mut self) { + self.bytes_written = 0; + } + + // Param is passed by value, moved + pub fn set_bytes_written(&mut self, v: u64) { + self.bytes_written = v; + } + + pub fn get_bytes_written(&self) -> u64 { + self.bytes_written + } + + fn get_bytes_written_for_reflect(&self) -> &u64 { + &self.bytes_written + } + + fn mut_bytes_written_for_reflect(&mut self) -> &mut u64 { + &mut self.bytes_written + } + + // uint64 bytes_read = 7; + + pub fn clear_bytes_read(&mut self) { + self.bytes_read = 0; + } + + // Param is passed by value, moved + pub fn set_bytes_read(&mut self, v: u64) { + self.bytes_read = v; + } + + pub fn get_bytes_read(&self) -> u64 { + self.bytes_read + } + + fn get_bytes_read_for_reflect(&self) -> &u64 { + &self.bytes_read + } + + fn mut_bytes_read_for_reflect(&mut self) -> &mut u64 { + &mut self.bytes_read + } + + // uint64 keys_written = 8; + + pub fn clear_keys_written(&mut self) { + self.keys_written = 0; + } + + // Param is passed by value, moved + pub fn set_keys_written(&mut self, v: u64) { + self.keys_written = v; + } + + pub fn get_keys_written(&self) -> u64 { + self.keys_written + } + + fn get_keys_written_for_reflect(&self) -> &u64 { + &self.keys_written + } + + fn mut_keys_written_for_reflect(&mut self) -> &mut u64 { + &mut self.keys_written + } + + // uint64 keys_read = 9; + + pub fn clear_keys_read(&mut self) { + self.keys_read = 0; + } + + // Param is passed by value, moved + pub fn set_keys_read(&mut self, v: u64) { + self.keys_read = v; + } + + pub fn get_keys_read(&self) -> u64 { + self.keys_read + } + + fn get_keys_read_for_reflect(&self) -> &u64 { + &self.keys_read + } + + fn mut_keys_read_for_reflect(&mut self) -> &mut u64 { + &mut self.keys_read + } + + // uint64 approximate_size = 10; + + pub fn clear_approximate_size(&mut self) { + self.approximate_size = 0; + } + + // Param is passed by value, moved + pub fn set_approximate_size(&mut self, v: u64) { + self.approximate_size = v; + } + + pub fn get_approximate_size(&self) -> u64 { + self.approximate_size + } + + fn get_approximate_size_for_reflect(&self) -> &u64 { + &self.approximate_size + } + + fn mut_approximate_size_for_reflect(&mut self) -> &mut u64 { + &mut self.approximate_size + } +} + +impl ::protobuf::Message for RegionHeartbeatRequest { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + for v in &self.region { + if !v.is_initialized() { + return false; + } + }; + for v in &self.leader { + if !v.is_initialized() { + return false; + } + }; + for v in &self.down_peers { + if !v.is_initialized() { + return false; + } + }; + for v in &self.pending_peers { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.leader)?; + }, + 4 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.down_peers)?; + }, + 5 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.pending_peers)?; + }, + 6 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.bytes_written = tmp; + }, + 7 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.bytes_read = tmp; + }, + 8 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.keys_written = tmp; + }, + 9 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.keys_read = tmp; + }, + 10 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.approximate_size = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.region.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.leader.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + for value in &self.down_peers { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.pending_peers { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if self.bytes_written != 0 { + my_size += ::protobuf::rt::value_size(6, self.bytes_written, ::protobuf::wire_format::WireTypeVarint); + } + if self.bytes_read != 0 { + my_size += ::protobuf::rt::value_size(7, self.bytes_read, ::protobuf::wire_format::WireTypeVarint); + } + if self.keys_written != 0 { + my_size += ::protobuf::rt::value_size(8, self.keys_written, ::protobuf::wire_format::WireTypeVarint); + } + if self.keys_read != 0 { + my_size += ::protobuf::rt::value_size(9, self.keys_read, ::protobuf::wire_format::WireTypeVarint); + } + if self.approximate_size != 0 { + my_size += ::protobuf::rt::value_size(10, self.approximate_size, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.region.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.leader.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + for v in &self.down_peers { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.pending_peers { + os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if self.bytes_written != 0 { + os.write_uint64(6, self.bytes_written)?; + } + if self.bytes_read != 0 { + os.write_uint64(7, self.bytes_read)?; + } + if self.keys_written != 0 { + os.write_uint64(8, self.keys_written)?; + } + if self.keys_read != 0 { + os.write_uint64(9, self.keys_read)?; + } + if self.approximate_size != 0 { + os.write_uint64(10, self.approximate_size)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RegionHeartbeatRequest { + fn new() -> RegionHeartbeatRequest { + RegionHeartbeatRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + RegionHeartbeatRequest::get_header_for_reflect, + RegionHeartbeatRequest::mut_header_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region", + RegionHeartbeatRequest::get_region_for_reflect, + RegionHeartbeatRequest::mut_region_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "leader", + RegionHeartbeatRequest::get_leader_for_reflect, + RegionHeartbeatRequest::mut_leader_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "down_peers", + RegionHeartbeatRequest::get_down_peers_for_reflect, + RegionHeartbeatRequest::mut_down_peers_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "pending_peers", + RegionHeartbeatRequest::get_pending_peers_for_reflect, + RegionHeartbeatRequest::mut_pending_peers_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "bytes_written", + RegionHeartbeatRequest::get_bytes_written_for_reflect, + RegionHeartbeatRequest::mut_bytes_written_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "bytes_read", + RegionHeartbeatRequest::get_bytes_read_for_reflect, + RegionHeartbeatRequest::mut_bytes_read_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "keys_written", + RegionHeartbeatRequest::get_keys_written_for_reflect, + RegionHeartbeatRequest::mut_keys_written_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "keys_read", + RegionHeartbeatRequest::get_keys_read_for_reflect, + RegionHeartbeatRequest::mut_keys_read_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "approximate_size", + RegionHeartbeatRequest::get_approximate_size_for_reflect, + RegionHeartbeatRequest::mut_approximate_size_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RegionHeartbeatRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RegionHeartbeatRequest { + fn clear(&mut self) { + self.clear_header(); + self.clear_region(); + self.clear_leader(); + self.clear_down_peers(); + self.clear_pending_peers(); + self.clear_bytes_written(); + self.clear_bytes_read(); + self.clear_keys_written(); + self.clear_keys_read(); + self.clear_approximate_size(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RegionHeartbeatRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RegionHeartbeatRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ChangePeer { + // message fields + pub peer: ::protobuf::SingularPtrField, + pub change_type: ConfChangeType, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for ChangePeer {} + +impl ChangePeer { + pub fn new() -> ChangePeer { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static ChangePeer { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ChangePeer, + }; + unsafe { + instance.get(ChangePeer::new) + } + } + + // .metapb.Peer peer = 1; + + pub fn clear_peer(&mut self) { + self.peer.clear(); + } + + pub fn has_peer(&self) -> bool { + self.peer.is_some() + } + + // Param is passed by value, moved + pub fn set_peer(&mut self, v: super::metapb::Peer) { + self.peer = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_peer(&mut self) -> &mut super::metapb::Peer { + if self.peer.is_none() { + self.peer.set_default(); + } + self.peer.as_mut().unwrap() + } + + // Take field + pub fn take_peer(&mut self) -> super::metapb::Peer { + self.peer.take().unwrap_or_else(|| super::metapb::Peer::new()) + } + + pub fn get_peer(&self) -> &super::metapb::Peer { + self.peer.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) + } + + fn get_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.peer + } + + fn mut_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.peer + } + + // .pdpb.ConfChangeType change_type = 2; + + pub fn clear_change_type(&mut self) { + self.change_type = ConfChangeType::AddNode; + } + + // Param is passed by value, moved + pub fn set_change_type(&mut self, v: ConfChangeType) { + self.change_type = v; + } + + pub fn get_change_type(&self) -> ConfChangeType { + self.change_type + } + + fn get_change_type_for_reflect(&self) -> &ConfChangeType { + &self.change_type + } + + fn mut_change_type_for_reflect(&mut self) -> &mut ConfChangeType { + &mut self.change_type + } +} + +impl ::protobuf::Message for ChangePeer { + fn is_initialized(&self) -> bool { + for v in &self.peer { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.peer)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_enum()?; + self.change_type = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.peer.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.change_type != ConfChangeType::AddNode { + my_size += ::protobuf::rt::enum_size(2, self.change_type); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.peer.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.change_type != ConfChangeType::AddNode { + os.write_enum(2, self.change_type.value())?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for ChangePeer { + fn new() -> ChangePeer { + ChangePeer::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "peer", + ChangePeer::get_peer_for_reflect, + ChangePeer::mut_peer_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "change_type", + ChangePeer::get_change_type_for_reflect, + ChangePeer::mut_change_type_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ChangePeer", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for ChangePeer { + fn clear(&mut self) { + self.clear_peer(); + self.clear_change_type(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ChangePeer { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ChangePeer { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct TransferLeader { + // message fields + pub peer: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for TransferLeader {} + +impl TransferLeader { + pub fn new() -> TransferLeader { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static TransferLeader { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const TransferLeader, + }; + unsafe { + instance.get(TransferLeader::new) + } + } + + // .metapb.Peer peer = 1; + + pub fn clear_peer(&mut self) { + self.peer.clear(); + } + + pub fn has_peer(&self) -> bool { + self.peer.is_some() + } + + // Param is passed by value, moved + pub fn set_peer(&mut self, v: super::metapb::Peer) { + self.peer = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_peer(&mut self) -> &mut super::metapb::Peer { + if self.peer.is_none() { + self.peer.set_default(); + } + self.peer.as_mut().unwrap() + } + + // Take field + pub fn take_peer(&mut self) -> super::metapb::Peer { + self.peer.take().unwrap_or_else(|| super::metapb::Peer::new()) + } + + pub fn get_peer(&self) -> &super::metapb::Peer { + self.peer.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) + } + + fn get_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.peer + } + + fn mut_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.peer + } +} + +impl ::protobuf::Message for TransferLeader { + fn is_initialized(&self) -> bool { + for v in &self.peer { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.peer)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.peer.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.peer.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for TransferLeader { + fn new() -> TransferLeader { + TransferLeader::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "peer", + TransferLeader::get_peer_for_reflect, + TransferLeader::mut_peer_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "TransferLeader", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for TransferLeader { + fn clear(&mut self) { + self.clear_peer(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for TransferLeader { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TransferLeader { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RegionHeartbeatResponse { + // message fields + pub header: ::protobuf::SingularPtrField, + pub change_peer: ::protobuf::SingularPtrField, + pub transfer_leader: ::protobuf::SingularPtrField, + pub region_id: u64, + pub region_epoch: ::protobuf::SingularPtrField, + pub target_peer: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RegionHeartbeatResponse {} + +impl RegionHeartbeatResponse { + pub fn new() -> RegionHeartbeatResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RegionHeartbeatResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RegionHeartbeatResponse, + }; + unsafe { + instance.get(RegionHeartbeatResponse::new) + } + } + + // .pdpb.ResponseHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: ResponseHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut ResponseHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> ResponseHeader { + self.header.take().unwrap_or_else(|| ResponseHeader::new()) + } + + pub fn get_header(&self) -> &ResponseHeader { + self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } + + // .pdpb.ChangePeer change_peer = 2; + + pub fn clear_change_peer(&mut self) { + self.change_peer.clear(); + } + + pub fn has_change_peer(&self) -> bool { + self.change_peer.is_some() + } + + // Param is passed by value, moved + pub fn set_change_peer(&mut self, v: ChangePeer) { + self.change_peer = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_change_peer(&mut self) -> &mut ChangePeer { + if self.change_peer.is_none() { + self.change_peer.set_default(); + } + self.change_peer.as_mut().unwrap() + } + + // Take field + pub fn take_change_peer(&mut self) -> ChangePeer { + self.change_peer.take().unwrap_or_else(|| ChangePeer::new()) + } + + pub fn get_change_peer(&self) -> &ChangePeer { + self.change_peer.as_ref().unwrap_or_else(|| ChangePeer::default_instance()) + } + + fn get_change_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.change_peer + } + + fn mut_change_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.change_peer + } + + // .pdpb.TransferLeader transfer_leader = 3; + + pub fn clear_transfer_leader(&mut self) { + self.transfer_leader.clear(); + } + + pub fn has_transfer_leader(&self) -> bool { + self.transfer_leader.is_some() + } + + // Param is passed by value, moved + pub fn set_transfer_leader(&mut self, v: TransferLeader) { + self.transfer_leader = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_transfer_leader(&mut self) -> &mut TransferLeader { + if self.transfer_leader.is_none() { + self.transfer_leader.set_default(); + } + self.transfer_leader.as_mut().unwrap() + } + + // Take field + pub fn take_transfer_leader(&mut self) -> TransferLeader { + self.transfer_leader.take().unwrap_or_else(|| TransferLeader::new()) + } + + pub fn get_transfer_leader(&self) -> &TransferLeader { + self.transfer_leader.as_ref().unwrap_or_else(|| TransferLeader::default_instance()) + } + + fn get_transfer_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.transfer_leader + } + + fn mut_transfer_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.transfer_leader + } + + // uint64 region_id = 4; + + pub fn clear_region_id(&mut self) { + self.region_id = 0; + } + + // Param is passed by value, moved + pub fn set_region_id(&mut self, v: u64) { + self.region_id = v; + } + + pub fn get_region_id(&self) -> u64 { + self.region_id + } + + fn get_region_id_for_reflect(&self) -> &u64 { + &self.region_id + } + + fn mut_region_id_for_reflect(&mut self) -> &mut u64 { + &mut self.region_id + } + + // .metapb.RegionEpoch region_epoch = 5; + + pub fn clear_region_epoch(&mut self) { + self.region_epoch.clear(); + } + + pub fn has_region_epoch(&self) -> bool { + self.region_epoch.is_some() + } + + // Param is passed by value, moved + pub fn set_region_epoch(&mut self, v: super::metapb::RegionEpoch) { + self.region_epoch = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_epoch(&mut self) -> &mut super::metapb::RegionEpoch { + if self.region_epoch.is_none() { + self.region_epoch.set_default(); + } + self.region_epoch.as_mut().unwrap() + } + + // Take field + pub fn take_region_epoch(&mut self) -> super::metapb::RegionEpoch { + self.region_epoch.take().unwrap_or_else(|| super::metapb::RegionEpoch::new()) + } + + pub fn get_region_epoch(&self) -> &super::metapb::RegionEpoch { + self.region_epoch.as_ref().unwrap_or_else(|| super::metapb::RegionEpoch::default_instance()) + } + + fn get_region_epoch_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_epoch + } + + fn mut_region_epoch_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_epoch + } + + // .metapb.Peer target_peer = 6; + + pub fn clear_target_peer(&mut self) { + self.target_peer.clear(); + } + + pub fn has_target_peer(&self) -> bool { + self.target_peer.is_some() + } + + // Param is passed by value, moved + pub fn set_target_peer(&mut self, v: super::metapb::Peer) { + self.target_peer = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_target_peer(&mut self) -> &mut super::metapb::Peer { + if self.target_peer.is_none() { + self.target_peer.set_default(); + } + self.target_peer.as_mut().unwrap() + } + + // Take field + pub fn take_target_peer(&mut self) -> super::metapb::Peer { + self.target_peer.take().unwrap_or_else(|| super::metapb::Peer::new()) + } + + pub fn get_target_peer(&self) -> &super::metapb::Peer { + self.target_peer.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) + } + + fn get_target_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.target_peer + } + + fn mut_target_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.target_peer + } +} + +impl ::protobuf::Message for RegionHeartbeatResponse { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + for v in &self.change_peer { + if !v.is_initialized() { + return false; + } + }; + for v in &self.transfer_leader { + if !v.is_initialized() { + return false; + } + }; + for v in &self.region_epoch { + if !v.is_initialized() { + return false; + } + }; + for v in &self.target_peer { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.change_peer)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.transfer_leader)?; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.region_id = tmp; + }, + 5 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_epoch)?; + }, + 6 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.target_peer)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.change_peer.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.transfer_leader.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.region_id != 0 { + my_size += ::protobuf::rt::value_size(4, self.region_id, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.region_epoch.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.target_peer.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.change_peer.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.transfer_leader.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.region_id != 0 { + os.write_uint64(4, self.region_id)?; + } + if let Some(ref v) = self.region_epoch.as_ref() { + os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.target_peer.as_ref() { + os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RegionHeartbeatResponse { + fn new() -> RegionHeartbeatResponse { + RegionHeartbeatResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + RegionHeartbeatResponse::get_header_for_reflect, + RegionHeartbeatResponse::mut_header_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "change_peer", + RegionHeartbeatResponse::get_change_peer_for_reflect, + RegionHeartbeatResponse::mut_change_peer_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "transfer_leader", + RegionHeartbeatResponse::get_transfer_leader_for_reflect, + RegionHeartbeatResponse::mut_transfer_leader_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "region_id", + RegionHeartbeatResponse::get_region_id_for_reflect, + RegionHeartbeatResponse::mut_region_id_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_epoch", + RegionHeartbeatResponse::get_region_epoch_for_reflect, + RegionHeartbeatResponse::mut_region_epoch_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "target_peer", + RegionHeartbeatResponse::get_target_peer_for_reflect, + RegionHeartbeatResponse::mut_target_peer_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RegionHeartbeatResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RegionHeartbeatResponse { + fn clear(&mut self) { + self.clear_header(); + self.clear_change_peer(); + self.clear_transfer_leader(); + self.clear_region_id(); + self.clear_region_epoch(); + self.clear_target_peer(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RegionHeartbeatResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RegionHeartbeatResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct AskSplitRequest { + // message fields + pub header: ::protobuf::SingularPtrField, + pub region: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for AskSplitRequest {} + +impl AskSplitRequest { + pub fn new() -> AskSplitRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static AskSplitRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const AskSplitRequest, + }; + unsafe { + instance.get(AskSplitRequest::new) + } + } + + // .pdpb.RequestHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: RequestHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut RequestHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> RequestHeader { + self.header.take().unwrap_or_else(|| RequestHeader::new()) + } + + pub fn get_header(&self) -> &RequestHeader { + self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } + + // .metapb.Region region = 2; + + pub fn clear_region(&mut self) { + self.region.clear(); + } + + pub fn has_region(&self) -> bool { + self.region.is_some() + } + + // Param is passed by value, moved + pub fn set_region(&mut self, v: super::metapb::Region) { + self.region = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region(&mut self) -> &mut super::metapb::Region { + if self.region.is_none() { + self.region.set_default(); + } + self.region.as_mut().unwrap() + } + + // Take field + pub fn take_region(&mut self) -> super::metapb::Region { + self.region.take().unwrap_or_else(|| super::metapb::Region::new()) + } + + pub fn get_region(&self) -> &super::metapb::Region { + self.region.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) + } + + fn get_region_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region + } + + fn mut_region_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region + } +} + +impl ::protobuf::Message for AskSplitRequest { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + for v in &self.region { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.region.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.region.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for AskSplitRequest { + fn new() -> AskSplitRequest { + AskSplitRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + AskSplitRequest::get_header_for_reflect, + AskSplitRequest::mut_header_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region", + AskSplitRequest::get_region_for_reflect, + AskSplitRequest::mut_region_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "AskSplitRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for AskSplitRequest { + fn clear(&mut self) { + self.clear_header(); + self.clear_region(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for AskSplitRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for AskSplitRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct AskSplitResponse { + // message fields + pub header: ::protobuf::SingularPtrField, + pub new_region_id: u64, + pub new_peer_ids: ::std::vec::Vec, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for AskSplitResponse {} + +impl AskSplitResponse { + pub fn new() -> AskSplitResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static AskSplitResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const AskSplitResponse, + }; + unsafe { + instance.get(AskSplitResponse::new) + } + } + + // .pdpb.ResponseHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: ResponseHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut ResponseHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> ResponseHeader { + self.header.take().unwrap_or_else(|| ResponseHeader::new()) + } + + pub fn get_header(&self) -> &ResponseHeader { + self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } + + // uint64 new_region_id = 2; + + pub fn clear_new_region_id(&mut self) { + self.new_region_id = 0; + } + + // Param is passed by value, moved + pub fn set_new_region_id(&mut self, v: u64) { + self.new_region_id = v; + } + + pub fn get_new_region_id(&self) -> u64 { + self.new_region_id + } + + fn get_new_region_id_for_reflect(&self) -> &u64 { + &self.new_region_id + } + + fn mut_new_region_id_for_reflect(&mut self) -> &mut u64 { + &mut self.new_region_id + } + + // repeated uint64 new_peer_ids = 3; + + pub fn clear_new_peer_ids(&mut self) { + self.new_peer_ids.clear(); + } + + // Param is passed by value, moved + pub fn set_new_peer_ids(&mut self, v: ::std::vec::Vec) { + self.new_peer_ids = v; + } + + // Mutable pointer to the field. + pub fn mut_new_peer_ids(&mut self) -> &mut ::std::vec::Vec { + &mut self.new_peer_ids + } + + // Take field + pub fn take_new_peer_ids(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.new_peer_ids, ::std::vec::Vec::new()) + } + + pub fn get_new_peer_ids(&self) -> &[u64] { + &self.new_peer_ids + } + + fn get_new_peer_ids_for_reflect(&self) -> &::std::vec::Vec { + &self.new_peer_ids + } + + fn mut_new_peer_ids_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.new_peer_ids + } +} + +impl ::protobuf::Message for AskSplitResponse { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.new_region_id = tmp; + }, + 3 => { + ::protobuf::rt::read_repeated_uint64_into(wire_type, is, &mut self.new_peer_ids)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.new_region_id != 0 { + my_size += ::protobuf::rt::value_size(2, self.new_region_id, ::protobuf::wire_format::WireTypeVarint); + } + for value in &self.new_peer_ids { + my_size += ::protobuf::rt::value_size(3, *value, ::protobuf::wire_format::WireTypeVarint); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.new_region_id != 0 { + os.write_uint64(2, self.new_region_id)?; + } + for v in &self.new_peer_ids { + os.write_uint64(3, *v)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for AskSplitResponse { + fn new() -> AskSplitResponse { + AskSplitResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + AskSplitResponse::get_header_for_reflect, + AskSplitResponse::mut_header_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "new_region_id", + AskSplitResponse::get_new_region_id_for_reflect, + AskSplitResponse::mut_new_region_id_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "new_peer_ids", + AskSplitResponse::get_new_peer_ids_for_reflect, + AskSplitResponse::mut_new_peer_ids_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "AskSplitResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for AskSplitResponse { + fn clear(&mut self) { + self.clear_header(); + self.clear_new_region_id(); + self.clear_new_peer_ids(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for AskSplitResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for AskSplitResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ReportSplitRequest { + // message fields + pub header: ::protobuf::SingularPtrField, + pub left: ::protobuf::SingularPtrField, + pub right: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for ReportSplitRequest {} + +impl ReportSplitRequest { + pub fn new() -> ReportSplitRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static ReportSplitRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ReportSplitRequest, + }; + unsafe { + instance.get(ReportSplitRequest::new) + } + } + + // .pdpb.RequestHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: RequestHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut RequestHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> RequestHeader { + self.header.take().unwrap_or_else(|| RequestHeader::new()) + } + + pub fn get_header(&self) -> &RequestHeader { + self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } + + // .metapb.Region left = 2; + + pub fn clear_left(&mut self) { + self.left.clear(); + } + + pub fn has_left(&self) -> bool { + self.left.is_some() + } + + // Param is passed by value, moved + pub fn set_left(&mut self, v: super::metapb::Region) { + self.left = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_left(&mut self) -> &mut super::metapb::Region { + if self.left.is_none() { + self.left.set_default(); + } + self.left.as_mut().unwrap() + } + + // Take field + pub fn take_left(&mut self) -> super::metapb::Region { + self.left.take().unwrap_or_else(|| super::metapb::Region::new()) + } + + pub fn get_left(&self) -> &super::metapb::Region { + self.left.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) + } + + fn get_left_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.left + } + + fn mut_left_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.left + } + + // .metapb.Region right = 3; + + pub fn clear_right(&mut self) { + self.right.clear(); + } + + pub fn has_right(&self) -> bool { + self.right.is_some() + } + + // Param is passed by value, moved + pub fn set_right(&mut self, v: super::metapb::Region) { + self.right = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_right(&mut self) -> &mut super::metapb::Region { + if self.right.is_none() { + self.right.set_default(); + } + self.right.as_mut().unwrap() + } + + // Take field + pub fn take_right(&mut self) -> super::metapb::Region { + self.right.take().unwrap_or_else(|| super::metapb::Region::new()) + } + + pub fn get_right(&self) -> &super::metapb::Region { + self.right.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) + } + + fn get_right_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.right + } + + fn mut_right_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.right + } +} + +impl ::protobuf::Message for ReportSplitRequest { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + for v in &self.left { + if !v.is_initialized() { + return false; + } + }; + for v in &self.right { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.left)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.right)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.left.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.right.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.left.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.right.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for ReportSplitRequest { + fn new() -> ReportSplitRequest { + ReportSplitRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + ReportSplitRequest::get_header_for_reflect, + ReportSplitRequest::mut_header_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "left", + ReportSplitRequest::get_left_for_reflect, + ReportSplitRequest::mut_left_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "right", + ReportSplitRequest::get_right_for_reflect, + ReportSplitRequest::mut_right_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ReportSplitRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for ReportSplitRequest { + fn clear(&mut self) { + self.clear_header(); + self.clear_left(); + self.clear_right(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ReportSplitRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ReportSplitRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ReportSplitResponse { + // message fields + pub header: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for ReportSplitResponse {} + +impl ReportSplitResponse { + pub fn new() -> ReportSplitResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static ReportSplitResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ReportSplitResponse, + }; + unsafe { + instance.get(ReportSplitResponse::new) + } + } + + // .pdpb.ResponseHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: ResponseHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut ResponseHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> ResponseHeader { + self.header.take().unwrap_or_else(|| ResponseHeader::new()) + } + + pub fn get_header(&self) -> &ResponseHeader { + self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } +} + +impl ::protobuf::Message for ReportSplitResponse { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for ReportSplitResponse { + fn new() -> ReportSplitResponse { + ReportSplitResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + ReportSplitResponse::get_header_for_reflect, + ReportSplitResponse::mut_header_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ReportSplitResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for ReportSplitResponse { + fn clear(&mut self) { + self.clear_header(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ReportSplitResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ReportSplitResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct StoreStats { + // message fields + pub store_id: u64, + pub capacity: u64, + pub available: u64, + pub region_count: u32, + pub sending_snap_count: u32, + pub receiving_snap_count: u32, + pub start_time: u32, + pub applying_snap_count: u32, + pub is_busy: bool, + pub used_size: u64, + pub bytes_written: u64, + pub keys_written: u64, + pub bytes_read: u64, + pub keys_read: u64, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for StoreStats {} + +impl StoreStats { + pub fn new() -> StoreStats { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static StoreStats { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const StoreStats, + }; + unsafe { + instance.get(StoreStats::new) + } + } + + // uint64 store_id = 1; + + pub fn clear_store_id(&mut self) { + self.store_id = 0; + } + + // Param is passed by value, moved + pub fn set_store_id(&mut self, v: u64) { + self.store_id = v; + } + + pub fn get_store_id(&self) -> u64 { + self.store_id + } + + fn get_store_id_for_reflect(&self) -> &u64 { + &self.store_id + } + + fn mut_store_id_for_reflect(&mut self) -> &mut u64 { + &mut self.store_id + } + + // uint64 capacity = 2; + + pub fn clear_capacity(&mut self) { + self.capacity = 0; + } + + // Param is passed by value, moved + pub fn set_capacity(&mut self, v: u64) { + self.capacity = v; + } + + pub fn get_capacity(&self) -> u64 { + self.capacity + } + + fn get_capacity_for_reflect(&self) -> &u64 { + &self.capacity + } + + fn mut_capacity_for_reflect(&mut self) -> &mut u64 { + &mut self.capacity + } + + // uint64 available = 3; + + pub fn clear_available(&mut self) { + self.available = 0; + } + + // Param is passed by value, moved + pub fn set_available(&mut self, v: u64) { + self.available = v; + } + + pub fn get_available(&self) -> u64 { + self.available + } + + fn get_available_for_reflect(&self) -> &u64 { + &self.available + } + + fn mut_available_for_reflect(&mut self) -> &mut u64 { + &mut self.available + } + + // uint32 region_count = 4; + + pub fn clear_region_count(&mut self) { + self.region_count = 0; + } + + // Param is passed by value, moved + pub fn set_region_count(&mut self, v: u32) { + self.region_count = v; + } + + pub fn get_region_count(&self) -> u32 { + self.region_count + } + + fn get_region_count_for_reflect(&self) -> &u32 { + &self.region_count + } + + fn mut_region_count_for_reflect(&mut self) -> &mut u32 { + &mut self.region_count + } + + // uint32 sending_snap_count = 5; + + pub fn clear_sending_snap_count(&mut self) { + self.sending_snap_count = 0; + } + + // Param is passed by value, moved + pub fn set_sending_snap_count(&mut self, v: u32) { + self.sending_snap_count = v; + } + + pub fn get_sending_snap_count(&self) -> u32 { + self.sending_snap_count + } + + fn get_sending_snap_count_for_reflect(&self) -> &u32 { + &self.sending_snap_count + } + + fn mut_sending_snap_count_for_reflect(&mut self) -> &mut u32 { + &mut self.sending_snap_count + } + + // uint32 receiving_snap_count = 6; + + pub fn clear_receiving_snap_count(&mut self) { + self.receiving_snap_count = 0; + } + + // Param is passed by value, moved + pub fn set_receiving_snap_count(&mut self, v: u32) { + self.receiving_snap_count = v; + } + + pub fn get_receiving_snap_count(&self) -> u32 { + self.receiving_snap_count + } + + fn get_receiving_snap_count_for_reflect(&self) -> &u32 { + &self.receiving_snap_count + } + + fn mut_receiving_snap_count_for_reflect(&mut self) -> &mut u32 { + &mut self.receiving_snap_count + } + + // uint32 start_time = 7; + + pub fn clear_start_time(&mut self) { + self.start_time = 0; + } + + // Param is passed by value, moved + pub fn set_start_time(&mut self, v: u32) { + self.start_time = v; + } + + pub fn get_start_time(&self) -> u32 { + self.start_time + } + + fn get_start_time_for_reflect(&self) -> &u32 { + &self.start_time + } + + fn mut_start_time_for_reflect(&mut self) -> &mut u32 { + &mut self.start_time + } + + // uint32 applying_snap_count = 8; + + pub fn clear_applying_snap_count(&mut self) { + self.applying_snap_count = 0; + } + + // Param is passed by value, moved + pub fn set_applying_snap_count(&mut self, v: u32) { + self.applying_snap_count = v; + } + + pub fn get_applying_snap_count(&self) -> u32 { + self.applying_snap_count + } + + fn get_applying_snap_count_for_reflect(&self) -> &u32 { + &self.applying_snap_count + } + + fn mut_applying_snap_count_for_reflect(&mut self) -> &mut u32 { + &mut self.applying_snap_count + } + + // bool is_busy = 9; + + pub fn clear_is_busy(&mut self) { + self.is_busy = false; + } + + // Param is passed by value, moved + pub fn set_is_busy(&mut self, v: bool) { + self.is_busy = v; + } + + pub fn get_is_busy(&self) -> bool { + self.is_busy + } + + fn get_is_busy_for_reflect(&self) -> &bool { + &self.is_busy + } + + fn mut_is_busy_for_reflect(&mut self) -> &mut bool { + &mut self.is_busy + } + + // uint64 used_size = 10; + + pub fn clear_used_size(&mut self) { + self.used_size = 0; + } + + // Param is passed by value, moved + pub fn set_used_size(&mut self, v: u64) { + self.used_size = v; + } + + pub fn get_used_size(&self) -> u64 { + self.used_size + } + + fn get_used_size_for_reflect(&self) -> &u64 { + &self.used_size + } + + fn mut_used_size_for_reflect(&mut self) -> &mut u64 { + &mut self.used_size + } + + // uint64 bytes_written = 11; + + pub fn clear_bytes_written(&mut self) { + self.bytes_written = 0; + } + + // Param is passed by value, moved + pub fn set_bytes_written(&mut self, v: u64) { + self.bytes_written = v; + } + + pub fn get_bytes_written(&self) -> u64 { + self.bytes_written + } + + fn get_bytes_written_for_reflect(&self) -> &u64 { + &self.bytes_written + } + + fn mut_bytes_written_for_reflect(&mut self) -> &mut u64 { + &mut self.bytes_written + } + + // uint64 keys_written = 12; + + pub fn clear_keys_written(&mut self) { + self.keys_written = 0; + } + + // Param is passed by value, moved + pub fn set_keys_written(&mut self, v: u64) { + self.keys_written = v; + } + + pub fn get_keys_written(&self) -> u64 { + self.keys_written + } + + fn get_keys_written_for_reflect(&self) -> &u64 { + &self.keys_written + } + + fn mut_keys_written_for_reflect(&mut self) -> &mut u64 { + &mut self.keys_written + } + + // uint64 bytes_read = 13; + + pub fn clear_bytes_read(&mut self) { + self.bytes_read = 0; + } + + // Param is passed by value, moved + pub fn set_bytes_read(&mut self, v: u64) { + self.bytes_read = v; + } + + pub fn get_bytes_read(&self) -> u64 { + self.bytes_read + } + + fn get_bytes_read_for_reflect(&self) -> &u64 { + &self.bytes_read + } + + fn mut_bytes_read_for_reflect(&mut self) -> &mut u64 { + &mut self.bytes_read + } + + // uint64 keys_read = 14; + + pub fn clear_keys_read(&mut self) { + self.keys_read = 0; + } + + // Param is passed by value, moved + pub fn set_keys_read(&mut self, v: u64) { + self.keys_read = v; + } + + pub fn get_keys_read(&self) -> u64 { + self.keys_read + } + + fn get_keys_read_for_reflect(&self) -> &u64 { + &self.keys_read + } + + fn mut_keys_read_for_reflect(&mut self) -> &mut u64 { + &mut self.keys_read + } +} + +impl ::protobuf::Message for StoreStats { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.store_id = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.capacity = tmp; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.available = tmp; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.region_count = tmp; + }, + 5 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.sending_snap_count = tmp; + }, + 6 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.receiving_snap_count = tmp; + }, + 7 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.start_time = tmp; + }, + 8 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.applying_snap_count = tmp; + }, + 9 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.is_busy = tmp; + }, + 10 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.used_size = tmp; + }, + 11 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.bytes_written = tmp; + }, + 12 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.keys_written = tmp; + }, + 13 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.bytes_read = tmp; + }, + 14 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.keys_read = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.store_id != 0 { + my_size += ::protobuf::rt::value_size(1, self.store_id, ::protobuf::wire_format::WireTypeVarint); + } + if self.capacity != 0 { + my_size += ::protobuf::rt::value_size(2, self.capacity, ::protobuf::wire_format::WireTypeVarint); + } + if self.available != 0 { + my_size += ::protobuf::rt::value_size(3, self.available, ::protobuf::wire_format::WireTypeVarint); + } + if self.region_count != 0 { + my_size += ::protobuf::rt::value_size(4, self.region_count, ::protobuf::wire_format::WireTypeVarint); + } + if self.sending_snap_count != 0 { + my_size += ::protobuf::rt::value_size(5, self.sending_snap_count, ::protobuf::wire_format::WireTypeVarint); + } + if self.receiving_snap_count != 0 { + my_size += ::protobuf::rt::value_size(6, self.receiving_snap_count, ::protobuf::wire_format::WireTypeVarint); + } + if self.start_time != 0 { + my_size += ::protobuf::rt::value_size(7, self.start_time, ::protobuf::wire_format::WireTypeVarint); + } + if self.applying_snap_count != 0 { + my_size += ::protobuf::rt::value_size(8, self.applying_snap_count, ::protobuf::wire_format::WireTypeVarint); + } + if self.is_busy != false { + my_size += 2; + } + if self.used_size != 0 { + my_size += ::protobuf::rt::value_size(10, self.used_size, ::protobuf::wire_format::WireTypeVarint); + } + if self.bytes_written != 0 { + my_size += ::protobuf::rt::value_size(11, self.bytes_written, ::protobuf::wire_format::WireTypeVarint); + } + if self.keys_written != 0 { + my_size += ::protobuf::rt::value_size(12, self.keys_written, ::protobuf::wire_format::WireTypeVarint); + } + if self.bytes_read != 0 { + my_size += ::protobuf::rt::value_size(13, self.bytes_read, ::protobuf::wire_format::WireTypeVarint); + } + if self.keys_read != 0 { + my_size += ::protobuf::rt::value_size(14, self.keys_read, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.store_id != 0 { + os.write_uint64(1, self.store_id)?; + } + if self.capacity != 0 { + os.write_uint64(2, self.capacity)?; + } + if self.available != 0 { + os.write_uint64(3, self.available)?; + } + if self.region_count != 0 { + os.write_uint32(4, self.region_count)?; + } + if self.sending_snap_count != 0 { + os.write_uint32(5, self.sending_snap_count)?; + } + if self.receiving_snap_count != 0 { + os.write_uint32(6, self.receiving_snap_count)?; + } + if self.start_time != 0 { + os.write_uint32(7, self.start_time)?; + } + if self.applying_snap_count != 0 { + os.write_uint32(8, self.applying_snap_count)?; + } + if self.is_busy != false { + os.write_bool(9, self.is_busy)?; + } + if self.used_size != 0 { + os.write_uint64(10, self.used_size)?; + } + if self.bytes_written != 0 { + os.write_uint64(11, self.bytes_written)?; + } + if self.keys_written != 0 { + os.write_uint64(12, self.keys_written)?; + } + if self.bytes_read != 0 { + os.write_uint64(13, self.bytes_read)?; + } + if self.keys_read != 0 { + os.write_uint64(14, self.keys_read)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for StoreStats { + fn new() -> StoreStats { + StoreStats::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "store_id", + StoreStats::get_store_id_for_reflect, + StoreStats::mut_store_id_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "capacity", + StoreStats::get_capacity_for_reflect, + StoreStats::mut_capacity_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "available", + StoreStats::get_available_for_reflect, + StoreStats::mut_available_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "region_count", + StoreStats::get_region_count_for_reflect, + StoreStats::mut_region_count_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "sending_snap_count", + StoreStats::get_sending_snap_count_for_reflect, + StoreStats::mut_sending_snap_count_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "receiving_snap_count", + StoreStats::get_receiving_snap_count_for_reflect, + StoreStats::mut_receiving_snap_count_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "start_time", + StoreStats::get_start_time_for_reflect, + StoreStats::mut_start_time_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "applying_snap_count", + StoreStats::get_applying_snap_count_for_reflect, + StoreStats::mut_applying_snap_count_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "is_busy", + StoreStats::get_is_busy_for_reflect, + StoreStats::mut_is_busy_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "used_size", + StoreStats::get_used_size_for_reflect, + StoreStats::mut_used_size_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "bytes_written", + StoreStats::get_bytes_written_for_reflect, + StoreStats::mut_bytes_written_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "keys_written", + StoreStats::get_keys_written_for_reflect, + StoreStats::mut_keys_written_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "bytes_read", + StoreStats::get_bytes_read_for_reflect, + StoreStats::mut_bytes_read_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "keys_read", + StoreStats::get_keys_read_for_reflect, + StoreStats::mut_keys_read_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "StoreStats", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for StoreStats { + fn clear(&mut self) { + self.clear_store_id(); + self.clear_capacity(); + self.clear_available(); + self.clear_region_count(); + self.clear_sending_snap_count(); + self.clear_receiving_snap_count(); + self.clear_start_time(); + self.clear_applying_snap_count(); + self.clear_is_busy(); + self.clear_used_size(); + self.clear_bytes_written(); + self.clear_keys_written(); + self.clear_bytes_read(); + self.clear_keys_read(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for StoreStats { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StoreStats { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct StoreHeartbeatRequest { + // message fields + pub header: ::protobuf::SingularPtrField, + pub stats: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for StoreHeartbeatRequest {} + +impl StoreHeartbeatRequest { + pub fn new() -> StoreHeartbeatRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static StoreHeartbeatRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const StoreHeartbeatRequest, + }; + unsafe { + instance.get(StoreHeartbeatRequest::new) + } + } + + // .pdpb.RequestHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: RequestHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut RequestHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> RequestHeader { + self.header.take().unwrap_or_else(|| RequestHeader::new()) + } + + pub fn get_header(&self) -> &RequestHeader { + self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } + + // .pdpb.StoreStats stats = 2; + + pub fn clear_stats(&mut self) { + self.stats.clear(); + } + + pub fn has_stats(&self) -> bool { + self.stats.is_some() + } + + // Param is passed by value, moved + pub fn set_stats(&mut self, v: StoreStats) { + self.stats = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_stats(&mut self) -> &mut StoreStats { + if self.stats.is_none() { + self.stats.set_default(); + } + self.stats.as_mut().unwrap() + } + + // Take field + pub fn take_stats(&mut self) -> StoreStats { + self.stats.take().unwrap_or_else(|| StoreStats::new()) + } + + pub fn get_stats(&self) -> &StoreStats { + self.stats.as_ref().unwrap_or_else(|| StoreStats::default_instance()) + } + + fn get_stats_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.stats + } + + fn mut_stats_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.stats + } +} + +impl ::protobuf::Message for StoreHeartbeatRequest { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + for v in &self.stats { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.stats)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.stats.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.stats.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for StoreHeartbeatRequest { + fn new() -> StoreHeartbeatRequest { + StoreHeartbeatRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + StoreHeartbeatRequest::get_header_for_reflect, + StoreHeartbeatRequest::mut_header_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "stats", + StoreHeartbeatRequest::get_stats_for_reflect, + StoreHeartbeatRequest::mut_stats_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "StoreHeartbeatRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for StoreHeartbeatRequest { + fn clear(&mut self) { + self.clear_header(); + self.clear_stats(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for StoreHeartbeatRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StoreHeartbeatRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct StoreHeartbeatResponse { + // message fields + pub header: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for StoreHeartbeatResponse {} + +impl StoreHeartbeatResponse { + pub fn new() -> StoreHeartbeatResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static StoreHeartbeatResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const StoreHeartbeatResponse, + }; + unsafe { + instance.get(StoreHeartbeatResponse::new) + } + } + + // .pdpb.ResponseHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: ResponseHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut ResponseHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> ResponseHeader { + self.header.take().unwrap_or_else(|| ResponseHeader::new()) + } + + pub fn get_header(&self) -> &ResponseHeader { + self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } +} + +impl ::protobuf::Message for StoreHeartbeatResponse { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for StoreHeartbeatResponse { + fn new() -> StoreHeartbeatResponse { + StoreHeartbeatResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + StoreHeartbeatResponse::get_header_for_reflect, + StoreHeartbeatResponse::mut_header_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "StoreHeartbeatResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for StoreHeartbeatResponse { + fn clear(&mut self) { + self.clear_header(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for StoreHeartbeatResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StoreHeartbeatResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum ErrorType { + OK = 0, + UNKNOWN = 1, + NOT_BOOTSTRAPPED = 2, + STORE_TOMBSTONE = 3, + ALREADY_BOOTSTRAPPED = 4, +} + +impl ::protobuf::ProtobufEnum for ErrorType { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(ErrorType::OK), + 1 => ::std::option::Option::Some(ErrorType::UNKNOWN), + 2 => ::std::option::Option::Some(ErrorType::NOT_BOOTSTRAPPED), + 3 => ::std::option::Option::Some(ErrorType::STORE_TOMBSTONE), + 4 => ::std::option::Option::Some(ErrorType::ALREADY_BOOTSTRAPPED), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [ErrorType] = &[ + ErrorType::OK, + ErrorType::UNKNOWN, + ErrorType::NOT_BOOTSTRAPPED, + ErrorType::STORE_TOMBSTONE, + ErrorType::ALREADY_BOOTSTRAPPED, + ]; + values + } + + fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, + }; + unsafe { + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new("ErrorType", file_descriptor_proto()) + }) + } + } +} + +impl ::std::marker::Copy for ErrorType { +} + +impl ::std::default::Default for ErrorType { + fn default() -> Self { + ErrorType::OK + } +} + +impl ::protobuf::reflect::ProtobufValue for ErrorType { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum ConfChangeType { + AddNode = 0, + RemoveNode = 1, +} + +impl ::protobuf::ProtobufEnum for ConfChangeType { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(ConfChangeType::AddNode), + 1 => ::std::option::Option::Some(ConfChangeType::RemoveNode), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [ConfChangeType] = &[ + ConfChangeType::AddNode, + ConfChangeType::RemoveNode, + ]; + values + } + + fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, + }; + unsafe { + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new("ConfChangeType", file_descriptor_proto()) + }) + } + } +} + +impl ::std::marker::Copy for ConfChangeType { +} + +impl ::std::default::Default for ConfChangeType { + fn default() -> Self { + ConfChangeType::AddNode + } +} + +impl ::protobuf::reflect::ProtobufValue for ConfChangeType { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\npdpb.proto\x12\x04pdpb\x1a\x0cmetapb.proto\x1a\x14gogoproto/gogo.pro\ + to\".\n\rRequestHeader\x12\x1d\n\ncluster_id\x18\x01\x20\x01(\x04R\tclus\ + terId\"R\n\x0eResponseHeader\x12\x1d\n\ncluster_id\x18\x01\x20\x01(\x04R\ + \tclusterId\x12!\n\x05error\x18\x02\x20\x01(\x0b2\x0b.pdpb.ErrorR\x05err\ + or\"F\n\x05Error\x12#\n\x04type\x18\x01\x20\x01(\x0e2\x0f.pdpb.ErrorType\ + R\x04type\x12\x18\n\x07message\x18\x02\x20\x01(\tR\x07message\"O\n\nTsoR\ + equest\x12+\n\x06header\x18\x01\x20\x01(\x0b2\x13.pdpb.RequestHeaderR\ + \x06header\x12\x14\n\x05count\x18\x02\x20\x01(\rR\x05count\"A\n\tTimesta\ + mp\x12\x1a\n\x08physical\x18\x01\x20\x01(\x03R\x08physical\x12\x18\n\x07\ + logical\x18\x02\x20\x01(\x03R\x07logical\"\x80\x01\n\x0bTsoResponse\x12,\ + \n\x06header\x18\x01\x20\x01(\x0b2\x14.pdpb.ResponseHeaderR\x06header\ + \x12\x14\n\x05count\x18\x02\x20\x01(\rR\x05count\x12-\n\ttimestamp\x18\ + \x03\x20\x01(\x0b2\x0f.pdpb.TimestampR\ttimestamp\"\x8c\x01\n\x10Bootstr\ + apRequest\x12+\n\x06header\x18\x01\x20\x01(\x0b2\x13.pdpb.RequestHeaderR\ + \x06header\x12#\n\x05store\x18\x02\x20\x01(\x0b2\r.metapb.StoreR\x05stor\ + e\x12&\n\x06region\x18\x03\x20\x01(\x0b2\x0e.metapb.RegionR\x06region\"A\ + \n\x11BootstrapResponse\x12,\n\x06header\x18\x01\x20\x01(\x0b2\x14.pdpb.\ + ResponseHeaderR\x06header\"D\n\x15IsBootstrappedRequest\x12+\n\x06header\ + \x18\x01\x20\x01(\x0b2\x13.pdpb.RequestHeaderR\x06header\"j\n\x16IsBoots\ + trappedResponse\x12,\n\x06header\x18\x01\x20\x01(\x0b2\x14.pdpb.Response\ + HeaderR\x06header\x12\"\n\x0cbootstrapped\x18\x02\x20\x01(\x08R\x0cboots\ + trapped\"=\n\x0eAllocIDRequest\x12+\n\x06header\x18\x01\x20\x01(\x0b2\ + \x13.pdpb.RequestHeaderR\x06header\"O\n\x0fAllocIDResponse\x12,\n\x06hea\ + der\x18\x01\x20\x01(\x0b2\x14.pdpb.ResponseHeaderR\x06header\x12\x0e\n\ + \x02id\x18\x02\x20\x01(\x04R\x02id\"Y\n\x0fGetStoreRequest\x12+\n\x06hea\ + der\x18\x01\x20\x01(\x0b2\x13.pdpb.RequestHeaderR\x06header\x12\x19\n\ + \x08store_id\x18\x02\x20\x01(\x04R\x07storeId\"e\n\x10GetStoreResponse\ + \x12,\n\x06header\x18\x01\x20\x01(\x0b2\x14.pdpb.ResponseHeaderR\x06head\ + er\x12#\n\x05store\x18\x02\x20\x01(\x0b2\r.metapb.StoreR\x05store\"c\n\ + \x0fPutStoreRequest\x12+\n\x06header\x18\x01\x20\x01(\x0b2\x13.pdpb.Requ\ + estHeaderR\x06header\x12#\n\x05store\x18\x02\x20\x01(\x0b2\r.metapb.Stor\ + eR\x05store\"@\n\x10PutStoreResponse\x12,\n\x06header\x18\x01\x20\x01(\ + \x0b2\x14.pdpb.ResponseHeaderR\x06header\"^\n\x10GetRegionRequest\x12+\n\ + \x06header\x18\x01\x20\x01(\x0b2\x13.pdpb.RequestHeaderR\x06header\x12\ + \x1d\n\nregion_key\x18\x02\x20\x01(\x0cR\tregionKey\"\x8f\x01\n\x11GetRe\ + gionResponse\x12,\n\x06header\x18\x01\x20\x01(\x0b2\x14.pdpb.ResponseHea\ + derR\x06header\x12&\n\x06region\x18\x02\x20\x01(\x0b2\x0e.metapb.RegionR\ + \x06region\x12$\n\x06leader\x18\x03\x20\x01(\x0b2\x0c.metapb.PeerR\x06le\ + ader\"`\n\x14GetRegionByIDRequest\x12+\n\x06header\x18\x01\x20\x01(\x0b2\ + \x13.pdpb.RequestHeaderR\x06header\x12\x1b\n\tregion_id\x18\x02\x20\x01(\ + \x04R\x08regionId\"F\n\x17GetClusterConfigRequest\x12+\n\x06header\x18\ + \x01\x20\x01(\x0b2\x13.pdpb.RequestHeaderR\x06header\"s\n\x18GetClusterC\ + onfigResponse\x12,\n\x06header\x18\x01\x20\x01(\x0b2\x14.pdpb.ResponseHe\ + aderR\x06header\x12)\n\x07cluster\x18\x02\x20\x01(\x0b2\x0f.metapb.Clust\ + erR\x07cluster\"q\n\x17PutClusterConfigRequest\x12+\n\x06header\x18\x01\ + \x20\x01(\x0b2\x13.pdpb.RequestHeaderR\x06header\x12)\n\x07cluster\x18\ + \x02\x20\x01(\x0b2\x0f.metapb.ClusterR\x07cluster\"H\n\x18PutClusterConf\ + igResponse\x12,\n\x06header\x18\x01\x20\x01(\x0b2\x14.pdpb.ResponseHeade\ + rR\x06header\"w\n\x06Member\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04nam\ + e\x12\x1b\n\tmember_id\x18\x02\x20\x01(\x04R\x08memberId\x12\x1b\n\tpeer\ + _urls\x18\x03\x20\x03(\tR\x08peerUrls\x12\x1f\n\x0bclient_urls\x18\x04\ + \x20\x03(\tR\nclientUrls\"@\n\x11GetMembersRequest\x12+\n\x06header\x18\ + \x01\x20\x01(\x0b2\x13.pdpb.RequestHeaderR\x06header\"\x90\x01\n\x12GetM\ + embersResponse\x12,\n\x06header\x18\x01\x20\x01(\x0b2\x14.pdpb.ResponseH\ + eaderR\x06header\x12&\n\x07members\x18\x02\x20\x03(\x0b2\x0c.pdpb.Member\ + R\x07members\x12$\n\x06leader\x18\x03\x20\x01(\x0b2\x0c.pdpb.MemberR\x06\ + leader\"P\n\tPeerStats\x12\x20\n\x04peer\x18\x01\x20\x01(\x0b2\x0c.metap\ + b.PeerR\x04peer\x12!\n\x0cdown_seconds\x18\x02\x20\x01(\x04R\x0bdownSeco\ + nds\"\xa5\x03\n\x16RegionHeartbeatRequest\x12+\n\x06header\x18\x01\x20\ + \x01(\x0b2\x13.pdpb.RequestHeaderR\x06header\x12&\n\x06region\x18\x02\ + \x20\x01(\x0b2\x0e.metapb.RegionR\x06region\x12$\n\x06leader\x18\x03\x20\ + \x01(\x0b2\x0c.metapb.PeerR\x06leader\x12.\n\ndown_peers\x18\x04\x20\x03\ + (\x0b2\x0f.pdpb.PeerStatsR\tdownPeers\x121\n\rpending_peers\x18\x05\x20\ + \x03(\x0b2\x0c.metapb.PeerR\x0cpendingPeers\x12#\n\rbytes_written\x18\ + \x06\x20\x01(\x04R\x0cbytesWritten\x12\x1d\n\nbytes_read\x18\x07\x20\x01\ + (\x04R\tbytesRead\x12!\n\x0ckeys_written\x18\x08\x20\x01(\x04R\x0bkeysWr\ + itten\x12\x1b\n\tkeys_read\x18\t\x20\x01(\x04R\x08keysRead\x12)\n\x10app\ + roximate_size\x18\n\x20\x01(\x04R\x0fapproximateSize\"e\n\nChangePeer\ + \x12\x20\n\x04peer\x18\x01\x20\x01(\x0b2\x0c.metapb.PeerR\x04peer\x125\n\ + \x0bchange_type\x18\x02\x20\x01(\x0e2\x14.pdpb.ConfChangeTypeR\nchangeTy\ + pe\"2\n\x0eTransferLeader\x12\x20\n\x04peer\x18\x01\x20\x01(\x0b2\x0c.me\ + tapb.PeerR\x04peer\"\xbd\x02\n\x17RegionHeartbeatResponse\x12,\n\x06head\ + er\x18\x01\x20\x01(\x0b2\x14.pdpb.ResponseHeaderR\x06header\x121\n\x0bch\ + ange_peer\x18\x02\x20\x01(\x0b2\x10.pdpb.ChangePeerR\nchangePeer\x12=\n\ + \x0ftransfer_leader\x18\x03\x20\x01(\x0b2\x14.pdpb.TransferLeaderR\x0etr\ + ansferLeader\x12\x1b\n\tregion_id\x18\x04\x20\x01(\x04R\x08regionId\x126\ + \n\x0cregion_epoch\x18\x05\x20\x01(\x0b2\x13.metapb.RegionEpochR\x0bregi\ + onEpoch\x12-\n\x0btarget_peer\x18\x06\x20\x01(\x0b2\x0c.metapb.PeerR\nta\ + rgetPeer\"f\n\x0fAskSplitRequest\x12+\n\x06header\x18\x01\x20\x01(\x0b2\ + \x13.pdpb.RequestHeaderR\x06header\x12&\n\x06region\x18\x02\x20\x01(\x0b\ + 2\x0e.metapb.RegionR\x06region\"\x86\x01\n\x10AskSplitResponse\x12,\n\ + \x06header\x18\x01\x20\x01(\x0b2\x14.pdpb.ResponseHeaderR\x06header\x12\ + \"\n\rnew_region_id\x18\x02\x20\x01(\x04R\x0bnewRegionId\x12\x20\n\x0cne\ + w_peer_ids\x18\x03\x20\x03(\x04R\nnewPeerIds\"\x8b\x01\n\x12ReportSplitR\ + equest\x12+\n\x06header\x18\x01\x20\x01(\x0b2\x13.pdpb.RequestHeaderR\ + \x06header\x12\"\n\x04left\x18\x02\x20\x01(\x0b2\x0e.metapb.RegionR\x04l\ + eft\x12$\n\x05right\x18\x03\x20\x01(\x0b2\x0e.metapb.RegionR\x05right\"C\ + \n\x13ReportSplitResponse\x12,\n\x06header\x18\x01\x20\x01(\x0b2\x14.pdp\ + b.ResponseHeaderR\x06header\"\xed\x03\n\nStoreStats\x12\x19\n\x08store_i\ + d\x18\x01\x20\x01(\x04R\x07storeId\x12\x1a\n\x08capacity\x18\x02\x20\x01\ + (\x04R\x08capacity\x12\x1c\n\tavailable\x18\x03\x20\x01(\x04R\tavailable\ + \x12!\n\x0cregion_count\x18\x04\x20\x01(\rR\x0bregionCount\x12,\n\x12sen\ + ding_snap_count\x18\x05\x20\x01(\rR\x10sendingSnapCount\x120\n\x14receiv\ + ing_snap_count\x18\x06\x20\x01(\rR\x12receivingSnapCount\x12\x1d\n\nstar\ + t_time\x18\x07\x20\x01(\rR\tstartTime\x12.\n\x13applying_snap_count\x18\ + \x08\x20\x01(\rR\x11applyingSnapCount\x12\x17\n\x07is_busy\x18\t\x20\x01\ + (\x08R\x06isBusy\x12\x1b\n\tused_size\x18\n\x20\x01(\x04R\x08usedSize\ + \x12#\n\rbytes_written\x18\x0b\x20\x01(\x04R\x0cbytesWritten\x12!\n\x0ck\ + eys_written\x18\x0c\x20\x01(\x04R\x0bkeysWritten\x12\x1d\n\nbytes_read\ + \x18\r\x20\x01(\x04R\tbytesRead\x12\x1b\n\tkeys_read\x18\x0e\x20\x01(\ + \x04R\x08keysRead\"l\n\x15StoreHeartbeatRequest\x12+\n\x06header\x18\x01\ + \x20\x01(\x0b2\x13.pdpb.RequestHeaderR\x06header\x12&\n\x05stats\x18\x02\ + \x20\x01(\x0b2\x10.pdpb.StoreStatsR\x05stats\"F\n\x16StoreHeartbeatRespo\ + nse\x12,\n\x06header\x18\x01\x20\x01(\x0b2\x14.pdpb.ResponseHeaderR\x06h\ + eader*e\n\tErrorType\x12\x06\n\x02OK\x10\0\x12\x0b\n\x07UNKNOWN\x10\x01\ + \x12\x14\n\x10NOT_BOOTSTRAPPED\x10\x02\x12\x13\n\x0fSTORE_TOMBSTONE\x10\ + \x03\x12\x18\n\x14ALREADY_BOOTSTRAPPED\x10\x04*-\n\x0eConfChangeType\x12\ + \x0b\n\x07AddNode\x10\0\x12\x0e\n\nRemoveNode\x10\x012\x96\x08\n\x02PD\ + \x12A\n\nGetMembers\x12\x17.pdpb.GetMembersRequest\x1a\x18.pdpb.GetMembe\ + rsResponse\"\0\x120\n\x03Tso\x12\x10.pdpb.TsoRequest\x1a\x11.pdpb.TsoRes\ + ponse\"\0(\x010\x01\x12>\n\tBootstrap\x12\x16.pdpb.BootstrapRequest\x1a\ + \x17.pdpb.BootstrapResponse\"\0\x12M\n\x0eIsBootstrapped\x12\x1b.pdpb.Is\ + BootstrappedRequest\x1a\x1c.pdpb.IsBootstrappedResponse\"\0\x128\n\x07Al\ + locID\x12\x14.pdpb.AllocIDRequest\x1a\x15.pdpb.AllocIDResponse\"\0\x12;\ + \n\x08GetStore\x12\x15.pdpb.GetStoreRequest\x1a\x16.pdpb.GetStoreRespons\ + e\"\0\x12;\n\x08PutStore\x12\x15.pdpb.PutStoreRequest\x1a\x16.pdpb.PutSt\ + oreResponse\"\0\x12M\n\x0eStoreHeartbeat\x12\x1b.pdpb.StoreHeartbeatRequ\ + est\x1a\x1c.pdpb.StoreHeartbeatResponse\"\0\x12T\n\x0fRegionHeartbeat\ + \x12\x1c.pdpb.RegionHeartbeatRequest\x1a\x1d.pdpb.RegionHeartbeatRespons\ + e\"\0(\x010\x01\x12>\n\tGetRegion\x12\x16.pdpb.GetRegionRequest\x1a\x17.\ + pdpb.GetRegionResponse\"\0\x12F\n\rGetRegionByID\x12\x1a.pdpb.GetRegionB\ + yIDRequest\x1a\x17.pdpb.GetRegionResponse\"\0\x12;\n\x08AskSplit\x12\x15\ + .pdpb.AskSplitRequest\x1a\x16.pdpb.AskSplitResponse\"\0\x12D\n\x0bReport\ + Split\x12\x18.pdpb.ReportSplitRequest\x1a\x19.pdpb.ReportSplitResponse\"\ + \0\x12S\n\x10GetClusterConfig\x12\x1d.pdpb.GetClusterConfigRequest\x1a\ + \x1e.pdpb.GetClusterConfigResponse\"\0\x12S\n\x10PutClusterConfig\x12\ + \x1d.pdpb.PutClusterConfigRequest\x1a\x1e.pdpb.PutClusterConfigResponse\ + \"\0B&\n\x18com.pingcap.tikv.kvproto\xd0\xe2\x1e\x01\xc8\xe2\x1e\x01\xe0\ + \xe2\x1e\x01J\xa5a\n\x07\x12\x05\0\0\xd4\x02\x01\n\x08\n\x01\x0c\x12\x03\ + \0\0\x12\n\x08\n\x01\x02\x12\x03\x01\x08\x0c\n\t\n\x02\x03\0\x12\x03\x03\ + \x07\x15\n\t\n\x02\x03\x01\x12\x03\x05\x07\x1d\n\x08\n\x01\x08\x12\x03\ + \x07\0$\n\x0b\n\x04\x08\xe7\x07\0\x12\x03\x07\0$\n\x0c\n\x05\x08\xe7\x07\ + \0\x02\x12\x03\x07\x07\x1c\n\r\n\x06\x08\xe7\x07\0\x02\0\x12\x03\x07\x07\ + \x1c\n\x0e\n\x07\x08\xe7\x07\0\x02\0\x01\x12\x03\x07\x08\x1b\n\x0c\n\x05\ + \x08\xe7\x07\0\x03\x12\x03\x07\x1f#\n\x08\n\x01\x08\x12\x03\x08\0(\n\x0b\ + \n\x04\x08\xe7\x07\x01\x12\x03\x08\0(\n\x0c\n\x05\x08\xe7\x07\x01\x02\ + \x12\x03\x08\x07\x20\n\r\n\x06\x08\xe7\x07\x01\x02\0\x12\x03\x08\x07\x20\ + \n\x0e\n\x07\x08\xe7\x07\x01\x02\0\x01\x12\x03\x08\x08\x1f\n\x0c\n\x05\ + \x08\xe7\x07\x01\x03\x12\x03\x08#'\n\x08\n\x01\x08\x12\x03\t\0*\n\x0b\n\ + \x04\x08\xe7\x07\x02\x12\x03\t\0*\n\x0c\n\x05\x08\xe7\x07\x02\x02\x12\ + \x03\t\x07\"\n\r\n\x06\x08\xe7\x07\x02\x02\0\x12\x03\t\x07\"\n\x0e\n\x07\ + \x08\xe7\x07\x02\x02\0\x01\x12\x03\t\x08!\n\x0c\n\x05\x08\xe7\x07\x02\ + \x03\x12\x03\t%)\n\x08\n\x01\x08\x12\x03\x0b\01\n\x0b\n\x04\x08\xe7\x07\ + \x03\x12\x03\x0b\01\n\x0c\n\x05\x08\xe7\x07\x03\x02\x12\x03\x0b\x07\x13\ + \n\r\n\x06\x08\xe7\x07\x03\x02\0\x12\x03\x0b\x07\x13\n\x0e\n\x07\x08\xe7\ + \x07\x03\x02\0\x01\x12\x03\x0b\x07\x13\n\x0c\n\x05\x08\xe7\x07\x03\x07\ + \x12\x03\x0b\x160\n\n\n\x02\x06\0\x12\x04\r\0-\x01\n\n\n\x03\x06\0\x01\ + \x12\x03\r\x08\n\n\x8c\x01\n\x04\x06\0\x02\0\x12\x03\x10\x04E\x1a\x7f\ + \x20GetMembers\x20get\x20the\x20member\x20list\x20of\x20this\x20cluster.\ + \x20It\x20does\x20not\x20require\n\x20the\x20cluster_id\x20in\x20request\ + \x20matchs\x20the\x20id\x20of\x20this\x20cluster.\n\n\x0c\n\x05\x06\0\ + \x02\0\x01\x12\x03\x10\x08\x12\n\x0c\n\x05\x06\0\x02\0\x02\x12\x03\x10\ + \x13$\n\x0c\n\x05\x06\0\x02\0\x03\x12\x03\x10/A\n\x0b\n\x04\x06\0\x02\ + \x01\x12\x03\x12\x04>\n\x0c\n\x05\x06\0\x02\x01\x01\x12\x03\x12\x08\x0b\ + \n\x0c\n\x05\x06\0\x02\x01\x05\x12\x03\x12\x0c\x12\n\x0c\n\x05\x06\0\x02\ + \x01\x02\x12\x03\x12\x13\x1d\n\x0c\n\x05\x06\0\x02\x01\x06\x12\x03\x12(.\ + \n\x0c\n\x05\x06\0\x02\x01\x03\x12\x03\x12/:\n\x0b\n\x04\x06\0\x02\x02\ + \x12\x03\x14\x04B\n\x0c\n\x05\x06\0\x02\x02\x01\x12\x03\x14\x08\x11\n\ + \x0c\n\x05\x06\0\x02\x02\x02\x12\x03\x14\x12\"\n\x0c\n\x05\x06\0\x02\x02\ + \x03\x12\x03\x14->\n\x0b\n\x04\x06\0\x02\x03\x12\x03\x16\x04Q\n\x0c\n\ + \x05\x06\0\x02\x03\x01\x12\x03\x16\x08\x16\n\x0c\n\x05\x06\0\x02\x03\x02\ + \x12\x03\x16\x17,\n\x0c\n\x05\x06\0\x02\x03\x03\x12\x03\x167M\n\x0b\n\ + \x04\x06\0\x02\x04\x12\x03\x18\x04<\n\x0c\n\x05\x06\0\x02\x04\x01\x12\ + \x03\x18\x08\x0f\n\x0c\n\x05\x06\0\x02\x04\x02\x12\x03\x18\x10\x1e\n\x0c\ + \n\x05\x06\0\x02\x04\x03\x12\x03\x18)8\n\x0b\n\x04\x06\0\x02\x05\x12\x03\ + \x1a\x04?\n\x0c\n\x05\x06\0\x02\x05\x01\x12\x03\x1a\x08\x10\n\x0c\n\x05\ + \x06\0\x02\x05\x02\x12\x03\x1a\x11\x20\n\x0c\n\x05\x06\0\x02\x05\x03\x12\ + \x03\x1a+;\n\x0b\n\x04\x06\0\x02\x06\x12\x03\x1c\x04?\n\x0c\n\x05\x06\0\ + \x02\x06\x01\x12\x03\x1c\x08\x10\n\x0c\n\x05\x06\0\x02\x06\x02\x12\x03\ + \x1c\x11\x20\n\x0c\n\x05\x06\0\x02\x06\x03\x12\x03\x1c+;\n\x0b\n\x04\x06\ + \0\x02\x07\x12\x03\x1e\x04Q\n\x0c\n\x05\x06\0\x02\x07\x01\x12\x03\x1e\ + \x08\x16\n\x0c\n\x05\x06\0\x02\x07\x02\x12\x03\x1e\x17,\n\x0c\n\x05\x06\ + \0\x02\x07\x03\x12\x03\x1e7M\n\x0b\n\x04\x06\0\x02\x08\x12\x03\x20\x04b\ + \n\x0c\n\x05\x06\0\x02\x08\x01\x12\x03\x20\x08\x17\n\x0c\n\x05\x06\0\x02\ + \x08\x05\x12\x03\x20\x18\x1e\n\x0c\n\x05\x06\0\x02\x08\x02\x12\x03\x20\ + \x1f5\n\x0c\n\x05\x06\0\x02\x08\x06\x12\x03\x20@F\n\x0c\n\x05\x06\0\x02\ + \x08\x03\x12\x03\x20G^\n\x0b\n\x04\x06\0\x02\t\x12\x03\"\x04B\n\x0c\n\ + \x05\x06\0\x02\t\x01\x12\x03\"\x08\x11\n\x0c\n\x05\x06\0\x02\t\x02\x12\ + \x03\"\x12\"\n\x0c\n\x05\x06\0\x02\t\x03\x12\x03\"->\n\x0b\n\x04\x06\0\ + \x02\n\x12\x03$\x04J\n\x0c\n\x05\x06\0\x02\n\x01\x12\x03$\x08\x15\n\x0c\ + \n\x05\x06\0\x02\n\x02\x12\x03$\x16*\n\x0c\n\x05\x06\0\x02\n\x03\x12\x03\ + $5F\n\x0b\n\x04\x06\0\x02\x0b\x12\x03&\x04?\n\x0c\n\x05\x06\0\x02\x0b\ + \x01\x12\x03&\x08\x10\n\x0c\n\x05\x06\0\x02\x0b\x02\x12\x03&\x11\x20\n\ + \x0c\n\x05\x06\0\x02\x0b\x03\x12\x03&+;\n\x0b\n\x04\x06\0\x02\x0c\x12\ + \x03(\x04H\n\x0c\n\x05\x06\0\x02\x0c\x01\x12\x03(\x08\x13\n\x0c\n\x05\ + \x06\0\x02\x0c\x02\x12\x03(\x14&\n\x0c\n\x05\x06\0\x02\x0c\x03\x12\x03(1\ + D\n\x0b\n\x04\x06\0\x02\r\x12\x03*\x04W\n\x0c\n\x05\x06\0\x02\r\x01\x12\ + \x03*\x08\x18\n\x0c\n\x05\x06\0\x02\r\x02\x12\x03*\x190\n\x0c\n\x05\x06\ + \0\x02\r\x03\x12\x03*;S\n\x0b\n\x04\x06\0\x02\x0e\x12\x03,\x04W\n\x0c\n\ + \x05\x06\0\x02\x0e\x01\x12\x03,\x08\x18\n\x0c\n\x05\x06\0\x02\x0e\x02\ + \x12\x03,\x190\n\x0c\n\x05\x06\0\x02\x0e\x03\x12\x03,;S\n\n\n\x02\x04\0\ + \x12\x04/\02\x01\n\n\n\x03\x04\0\x01\x12\x03/\x08\x15\nD\n\x04\x04\0\x02\ + \0\x12\x031\x04\x1a\x1a7\x20cluster_id\x20is\x20the\x20ID\x20of\x20the\ + \x20cluster\x20which\x20be\x20sent\x20to.\n\n\r\n\x05\x04\0\x02\0\x04\ + \x12\x041\x04/\x17\n\x0c\n\x05\x04\0\x02\0\x05\x12\x031\x04\n\n\x0c\n\ + \x05\x04\0\x02\0\x01\x12\x031\x0b\x15\n\x0c\n\x05\x04\0\x02\0\x03\x12\ + \x031\x18\x19\n\n\n\x02\x04\x01\x12\x044\08\x01\n\n\n\x03\x04\x01\x01\ + \x12\x034\x08\x16\nK\n\x04\x04\x01\x02\0\x12\x036\x04\x1a\x1a>\x20cluste\ + r_id\x20is\x20the\x20ID\x20of\x20the\x20cluster\x20which\x20sent\x20the\ + \x20response.\n\n\r\n\x05\x04\x01\x02\0\x04\x12\x046\x044\x18\n\x0c\n\ + \x05\x04\x01\x02\0\x05\x12\x036\x04\n\n\x0c\n\x05\x04\x01\x02\0\x01\x12\ + \x036\x0b\x15\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x036\x18\x19\n\x0b\n\x04\ + \x04\x01\x02\x01\x12\x037\x04\x14\n\r\n\x05\x04\x01\x02\x01\x04\x12\x047\ + \x046\x1a\n\x0c\n\x05\x04\x01\x02\x01\x06\x12\x037\x04\t\n\x0c\n\x05\x04\ + \x01\x02\x01\x01\x12\x037\n\x0f\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x037\ + \x12\x13\n\n\n\x02\x05\0\x12\x04:\0@\x01\n\n\n\x03\x05\0\x01\x12\x03:\ + \x05\x0e\n\x0b\n\x04\x05\0\x02\0\x12\x03;\x04\x0b\n\x0c\n\x05\x05\0\x02\ + \0\x01\x12\x03;\x04\x06\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03;\t\n\n\x0b\n\ + \x04\x05\0\x02\x01\x12\x03<\x04\x10\n\x0c\n\x05\x05\0\x02\x01\x01\x12\ + \x03<\x04\x0b\n\x0c\n\x05\x05\0\x02\x01\x02\x12\x03<\x0e\x0f\n\x0b\n\x04\ + \x05\0\x02\x02\x12\x03=\x04\x19\n\x0c\n\x05\x05\0\x02\x02\x01\x12\x03=\ + \x04\x14\n\x0c\n\x05\x05\0\x02\x02\x02\x12\x03=\x17\x18\n\x0b\n\x04\x05\ + \0\x02\x03\x12\x03>\x04\x18\n\x0c\n\x05\x05\0\x02\x03\x01\x12\x03>\x04\ + \x13\n\x0c\n\x05\x05\0\x02\x03\x02\x12\x03>\x16\x17\n\x0b\n\x04\x05\0\ + \x02\x04\x12\x03?\x04\x1d\n\x0c\n\x05\x05\0\x02\x04\x01\x12\x03?\x04\x18\ + \n\x0c\n\x05\x05\0\x02\x04\x02\x12\x03?\x1b\x1c\n\n\n\x02\x04\x02\x12\ + \x04B\0E\x01\n\n\n\x03\x04\x02\x01\x12\x03B\x08\r\n\x0b\n\x04\x04\x02\ + \x02\0\x12\x03C\x04\x17\n\r\n\x05\x04\x02\x02\0\x04\x12\x04C\x04B\x0f\n\ + \x0c\n\x05\x04\x02\x02\0\x06\x12\x03C\x04\r\n\x0c\n\x05\x04\x02\x02\0\ + \x01\x12\x03C\x0e\x12\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03C\x15\x16\n\ + \x0b\n\x04\x04\x02\x02\x01\x12\x03D\x04\x17\n\r\n\x05\x04\x02\x02\x01\ + \x04\x12\x04D\x04C\x17\n\x0c\n\x05\x04\x02\x02\x01\x05\x12\x03D\x04\n\n\ + \x0c\n\x05\x04\x02\x02\x01\x01\x12\x03D\x0b\x12\n\x0c\n\x05\x04\x02\x02\ + \x01\x03\x12\x03D\x15\x16\n\n\n\x02\x04\x03\x12\x04G\0K\x01\n\n\n\x03\ + \x04\x03\x01\x12\x03G\x08\x12\n\x0b\n\x04\x04\x03\x02\0\x12\x03H\x04\x1d\ + \n\r\n\x05\x04\x03\x02\0\x04\x12\x04H\x04G\x14\n\x0c\n\x05\x04\x03\x02\0\ + \x06\x12\x03H\x04\x11\n\x0c\n\x05\x04\x03\x02\0\x01\x12\x03H\x12\x18\n\ + \x0c\n\x05\x04\x03\x02\0\x03\x12\x03H\x1b\x1c\n\x0b\n\x04\x04\x03\x02\ + \x01\x12\x03J\x04\x15\n\r\n\x05\x04\x03\x02\x01\x04\x12\x04J\x04H\x1d\n\ + \x0c\n\x05\x04\x03\x02\x01\x05\x12\x03J\x04\n\n\x0c\n\x05\x04\x03\x02\ + \x01\x01\x12\x03J\x0b\x10\n\x0c\n\x05\x04\x03\x02\x01\x03\x12\x03J\x13\ + \x14\n\n\n\x02\x04\x04\x12\x04M\0P\x01\n\n\n\x03\x04\x04\x01\x12\x03M\ + \x08\x11\n\x0b\n\x04\x04\x04\x02\0\x12\x03N\x04\x17\n\r\n\x05\x04\x04\ + \x02\0\x04\x12\x04N\x04M\x13\n\x0c\n\x05\x04\x04\x02\0\x05\x12\x03N\x04\ + \t\n\x0c\n\x05\x04\x04\x02\0\x01\x12\x03N\n\x12\n\x0c\n\x05\x04\x04\x02\ + \0\x03\x12\x03N\x15\x16\n\x0b\n\x04\x04\x04\x02\x01\x12\x03O\x04\x16\n\r\ + \n\x05\x04\x04\x02\x01\x04\x12\x04O\x04N\x17\n\x0c\n\x05\x04\x04\x02\x01\ + \x05\x12\x03O\x04\t\n\x0c\n\x05\x04\x04\x02\x01\x01\x12\x03O\n\x11\n\x0c\ + \n\x05\x04\x04\x02\x01\x03\x12\x03O\x14\x15\n\n\n\x02\x04\x05\x12\x04R\0\ + W\x01\n\n\n\x03\x04\x05\x01\x12\x03R\x08\x13\n\x0b\n\x04\x04\x05\x02\0\ + \x12\x03S\x04\x1e\n\r\n\x05\x04\x05\x02\0\x04\x12\x04S\x04R\x15\n\x0c\n\ + \x05\x04\x05\x02\0\x06\x12\x03S\x04\x12\n\x0c\n\x05\x04\x05\x02\0\x01\ + \x12\x03S\x13\x19\n\x0c\n\x05\x04\x05\x02\0\x03\x12\x03S\x1c\x1d\n\x0b\n\ + \x04\x04\x05\x02\x01\x12\x03U\x04\x15\n\r\n\x05\x04\x05\x02\x01\x04\x12\ + \x04U\x04S\x1e\n\x0c\n\x05\x04\x05\x02\x01\x05\x12\x03U\x04\n\n\x0c\n\ + \x05\x04\x05\x02\x01\x01\x12\x03U\x0b\x10\n\x0c\n\x05\x04\x05\x02\x01\ + \x03\x12\x03U\x13\x14\n\x0b\n\x04\x04\x05\x02\x02\x12\x03V\x04\x1c\n\r\n\ + \x05\x04\x05\x02\x02\x04\x12\x04V\x04U\x15\n\x0c\n\x05\x04\x05\x02\x02\ + \x06\x12\x03V\x04\r\n\x0c\n\x05\x04\x05\x02\x02\x01\x12\x03V\x0e\x17\n\ + \x0c\n\x05\x04\x05\x02\x02\x03\x12\x03V\x1a\x1b\n\n\n\x02\x04\x06\x12\ + \x04Y\0^\x01\n\n\n\x03\x04\x06\x01\x12\x03Y\x08\x18\n\x0b\n\x04\x04\x06\ + \x02\0\x12\x03Z\x04\x1d\n\r\n\x05\x04\x06\x02\0\x04\x12\x04Z\x04Y\x1a\n\ + \x0c\n\x05\x04\x06\x02\0\x06\x12\x03Z\x04\x11\n\x0c\n\x05\x04\x06\x02\0\ + \x01\x12\x03Z\x12\x18\n\x0c\n\x05\x04\x06\x02\0\x03\x12\x03Z\x1b\x1c\n\ + \x0b\n\x04\x04\x06\x02\x01\x12\x03\\\x04\x1b\n\r\n\x05\x04\x06\x02\x01\ + \x04\x12\x04\\\x04Z\x1d\n\x0c\n\x05\x04\x06\x02\x01\x06\x12\x03\\\x04\ + \x10\n\x0c\n\x05\x04\x06\x02\x01\x01\x12\x03\\\x11\x16\n\x0c\n\x05\x04\ + \x06\x02\x01\x03\x12\x03\\\x19\x1a\n\x0b\n\x04\x04\x06\x02\x02\x12\x03]\ + \x04\x1d\n\r\n\x05\x04\x06\x02\x02\x04\x12\x04]\x04\\\x1b\n\x0c\n\x05\ + \x04\x06\x02\x02\x06\x12\x03]\x04\x11\n\x0c\n\x05\x04\x06\x02\x02\x01\ + \x12\x03]\x12\x18\n\x0c\n\x05\x04\x06\x02\x02\x03\x12\x03]\x1b\x1c\n\n\n\ + \x02\x04\x07\x12\x04`\0b\x01\n\n\n\x03\x04\x07\x01\x12\x03`\x08\x19\n\ + \x0b\n\x04\x04\x07\x02\0\x12\x03a\x04\x1e\n\r\n\x05\x04\x07\x02\0\x04\ + \x12\x04a\x04`\x1b\n\x0c\n\x05\x04\x07\x02\0\x06\x12\x03a\x04\x12\n\x0c\ + \n\x05\x04\x07\x02\0\x01\x12\x03a\x13\x19\n\x0c\n\x05\x04\x07\x02\0\x03\ + \x12\x03a\x1c\x1d\n\n\n\x02\x04\x08\x12\x04d\0f\x01\n\n\n\x03\x04\x08\ + \x01\x12\x03d\x08\x1d\n\x0b\n\x04\x04\x08\x02\0\x12\x03e\x04\x1d\n\r\n\ + \x05\x04\x08\x02\0\x04\x12\x04e\x04d\x1f\n\x0c\n\x05\x04\x08\x02\0\x06\ + \x12\x03e\x04\x11\n\x0c\n\x05\x04\x08\x02\0\x01\x12\x03e\x12\x18\n\x0c\n\ + \x05\x04\x08\x02\0\x03\x12\x03e\x1b\x1c\n\n\n\x02\x04\t\x12\x04h\0l\x01\ + \n\n\n\x03\x04\t\x01\x12\x03h\x08\x1e\n\x0b\n\x04\x04\t\x02\0\x12\x03i\ + \x04\x1e\n\r\n\x05\x04\t\x02\0\x04\x12\x04i\x04h\x20\n\x0c\n\x05\x04\t\ + \x02\0\x06\x12\x03i\x04\x12\n\x0c\n\x05\x04\t\x02\0\x01\x12\x03i\x13\x19\ + \n\x0c\n\x05\x04\t\x02\0\x03\x12\x03i\x1c\x1d\n\x0b\n\x04\x04\t\x02\x01\ + \x12\x03k\x04\x1a\n\r\n\x05\x04\t\x02\x01\x04\x12\x04k\x04i\x1e\n\x0c\n\ + \x05\x04\t\x02\x01\x05\x12\x03k\x04\x08\n\x0c\n\x05\x04\t\x02\x01\x01\ + \x12\x03k\t\x15\n\x0c\n\x05\x04\t\x02\x01\x03\x12\x03k\x18\x19\n\n\n\x02\ + \x04\n\x12\x04n\0p\x01\n\n\n\x03\x04\n\x01\x12\x03n\x08\x16\n\x0b\n\x04\ + \x04\n\x02\0\x12\x03o\x04\x1d\n\r\n\x05\x04\n\x02\0\x04\x12\x04o\x04n\ + \x18\n\x0c\n\x05\x04\n\x02\0\x06\x12\x03o\x04\x11\n\x0c\n\x05\x04\n\x02\ + \0\x01\x12\x03o\x12\x18\n\x0c\n\x05\x04\n\x02\0\x03\x12\x03o\x1b\x1c\n\n\ + \n\x02\x04\x0b\x12\x04r\0v\x01\n\n\n\x03\x04\x0b\x01\x12\x03r\x08\x17\n\ + \x0b\n\x04\x04\x0b\x02\0\x12\x03s\x04\x1e\n\r\n\x05\x04\x0b\x02\0\x04\ + \x12\x04s\x04r\x19\n\x0c\n\x05\x04\x0b\x02\0\x06\x12\x03s\x04\x12\n\x0c\ + \n\x05\x04\x0b\x02\0\x01\x12\x03s\x13\x19\n\x0c\n\x05\x04\x0b\x02\0\x03\ + \x12\x03s\x1c\x1d\n\x0b\n\x04\x04\x0b\x02\x01\x12\x03u\x04\x12\n\r\n\x05\ + \x04\x0b\x02\x01\x04\x12\x04u\x04s\x1e\n\x0c\n\x05\x04\x0b\x02\x01\x05\ + \x12\x03u\x04\n\n\x0c\n\x05\x04\x0b\x02\x01\x01\x12\x03u\x0b\r\n\x0c\n\ + \x05\x04\x0b\x02\x01\x03\x12\x03u\x10\x11\n\n\n\x02\x04\x0c\x12\x04x\0|\ + \x01\n\n\n\x03\x04\x0c\x01\x12\x03x\x08\x17\n\x0b\n\x04\x04\x0c\x02\0\ + \x12\x03y\x04\x1d\n\r\n\x05\x04\x0c\x02\0\x04\x12\x04y\x04x\x19\n\x0c\n\ + \x05\x04\x0c\x02\0\x06\x12\x03y\x04\x11\n\x0c\n\x05\x04\x0c\x02\0\x01\ + \x12\x03y\x12\x18\n\x0c\n\x05\x04\x0c\x02\0\x03\x12\x03y\x1b\x1c\n\x0b\n\ + \x04\x04\x0c\x02\x01\x12\x03{\x04\x18\n\r\n\x05\x04\x0c\x02\x01\x04\x12\ + \x04{\x04y\x1d\n\x0c\n\x05\x04\x0c\x02\x01\x05\x12\x03{\x04\n\n\x0c\n\ + \x05\x04\x0c\x02\x01\x01\x12\x03{\x0b\x13\n\x0c\n\x05\x04\x0c\x02\x01\ + \x03\x12\x03{\x16\x17\n\x0b\n\x02\x04\r\x12\x05~\0\x82\x01\x01\n\n\n\x03\ + \x04\r\x01\x12\x03~\x08\x18\n\x0b\n\x04\x04\r\x02\0\x12\x03\x7f\x04\x1e\ + \n\r\n\x05\x04\r\x02\0\x04\x12\x04\x7f\x04~\x1a\n\x0c\n\x05\x04\r\x02\0\ + \x06\x12\x03\x7f\x04\x12\n\x0c\n\x05\x04\r\x02\0\x01\x12\x03\x7f\x13\x19\ + \n\x0c\n\x05\x04\r\x02\0\x03\x12\x03\x7f\x1c\x1d\n\x0c\n\x04\x04\r\x02\ + \x01\x12\x04\x81\x01\x04\x1b\n\x0e\n\x05\x04\r\x02\x01\x04\x12\x05\x81\ + \x01\x04\x7f\x1e\n\r\n\x05\x04\r\x02\x01\x06\x12\x04\x81\x01\x04\x10\n\r\ + \n\x05\x04\r\x02\x01\x01\x12\x04\x81\x01\x11\x16\n\r\n\x05\x04\r\x02\x01\ + \x03\x12\x04\x81\x01\x19\x1a\n\x0c\n\x02\x04\x0e\x12\x06\x84\x01\0\x88\ + \x01\x01\n\x0b\n\x03\x04\x0e\x01\x12\x04\x84\x01\x08\x17\n\x0c\n\x04\x04\ + \x0e\x02\0\x12\x04\x85\x01\x04\x1d\n\x0f\n\x05\x04\x0e\x02\0\x04\x12\x06\ + \x85\x01\x04\x84\x01\x19\n\r\n\x05\x04\x0e\x02\0\x06\x12\x04\x85\x01\x04\ + \x11\n\r\n\x05\x04\x0e\x02\0\x01\x12\x04\x85\x01\x12\x18\n\r\n\x05\x04\ + \x0e\x02\0\x03\x12\x04\x85\x01\x1b\x1c\n\x0c\n\x04\x04\x0e\x02\x01\x12\ + \x04\x87\x01\x04\x1b\n\x0f\n\x05\x04\x0e\x02\x01\x04\x12\x06\x87\x01\x04\ + \x85\x01\x1d\n\r\n\x05\x04\x0e\x02\x01\x06\x12\x04\x87\x01\x04\x10\n\r\n\ + \x05\x04\x0e\x02\x01\x01\x12\x04\x87\x01\x11\x16\n\r\n\x05\x04\x0e\x02\ + \x01\x03\x12\x04\x87\x01\x19\x1a\n\x0c\n\x02\x04\x0f\x12\x06\x8a\x01\0\ + \x8c\x01\x01\n\x0b\n\x03\x04\x0f\x01\x12\x04\x8a\x01\x08\x18\n\x0c\n\x04\ + \x04\x0f\x02\0\x12\x04\x8b\x01\x04\x1e\n\x0f\n\x05\x04\x0f\x02\0\x04\x12\ + \x06\x8b\x01\x04\x8a\x01\x1a\n\r\n\x05\x04\x0f\x02\0\x06\x12\x04\x8b\x01\ + \x04\x12\n\r\n\x05\x04\x0f\x02\0\x01\x12\x04\x8b\x01\x13\x19\n\r\n\x05\ + \x04\x0f\x02\0\x03\x12\x04\x8b\x01\x1c\x1d\n\x0c\n\x02\x04\x10\x12\x06\ + \x8e\x01\0\x92\x01\x01\n\x0b\n\x03\x04\x10\x01\x12\x04\x8e\x01\x08\x18\n\ + \x0c\n\x04\x04\x10\x02\0\x12\x04\x8f\x01\x04\x1d\n\x0f\n\x05\x04\x10\x02\ + \0\x04\x12\x06\x8f\x01\x04\x8e\x01\x1a\n\r\n\x05\x04\x10\x02\0\x06\x12\ + \x04\x8f\x01\x04\x11\n\r\n\x05\x04\x10\x02\0\x01\x12\x04\x8f\x01\x12\x18\ + \n\r\n\x05\x04\x10\x02\0\x03\x12\x04\x8f\x01\x1b\x1c\n\x0c\n\x04\x04\x10\ + \x02\x01\x12\x04\x91\x01\x04\x19\n\x0f\n\x05\x04\x10\x02\x01\x04\x12\x06\ + \x91\x01\x04\x8f\x01\x1d\n\r\n\x05\x04\x10\x02\x01\x05\x12\x04\x91\x01\ + \x04\t\n\r\n\x05\x04\x10\x02\x01\x01\x12\x04\x91\x01\n\x14\n\r\n\x05\x04\ + \x10\x02\x01\x03\x12\x04\x91\x01\x17\x18\n\x0c\n\x02\x04\x11\x12\x06\x94\ + \x01\0\x99\x01\x01\n\x0b\n\x03\x04\x11\x01\x12\x04\x94\x01\x08\x19\n\x0c\ + \n\x04\x04\x11\x02\0\x12\x04\x95\x01\x04\x1e\n\x0f\n\x05\x04\x11\x02\0\ + \x04\x12\x06\x95\x01\x04\x94\x01\x1b\n\r\n\x05\x04\x11\x02\0\x06\x12\x04\ + \x95\x01\x04\x12\n\r\n\x05\x04\x11\x02\0\x01\x12\x04\x95\x01\x13\x19\n\r\ + \n\x05\x04\x11\x02\0\x03\x12\x04\x95\x01\x1c\x1d\n\x0c\n\x04\x04\x11\x02\ + \x01\x12\x04\x97\x01\x04\x1d\n\x0f\n\x05\x04\x11\x02\x01\x04\x12\x06\x97\ + \x01\x04\x95\x01\x1e\n\r\n\x05\x04\x11\x02\x01\x06\x12\x04\x97\x01\x04\ + \x11\n\r\n\x05\x04\x11\x02\x01\x01\x12\x04\x97\x01\x12\x18\n\r\n\x05\x04\ + \x11\x02\x01\x03\x12\x04\x97\x01\x1b\x1c\n\x0c\n\x04\x04\x11\x02\x02\x12\ + \x04\x98\x01\x04\x1b\n\x0f\n\x05\x04\x11\x02\x02\x04\x12\x06\x98\x01\x04\ + \x97\x01\x1d\n\r\n\x05\x04\x11\x02\x02\x06\x12\x04\x98\x01\x04\x0f\n\r\n\ + \x05\x04\x11\x02\x02\x01\x12\x04\x98\x01\x10\x16\n\r\n\x05\x04\x11\x02\ + \x02\x03\x12\x04\x98\x01\x19\x1a\n\x0c\n\x02\x04\x12\x12\x06\x9b\x01\0\ + \x9f\x01\x01\n\x0b\n\x03\x04\x12\x01\x12\x04\x9b\x01\x08\x1c\n\x0c\n\x04\ + \x04\x12\x02\0\x12\x04\x9c\x01\x04\x1d\n\x0f\n\x05\x04\x12\x02\0\x04\x12\ + \x06\x9c\x01\x04\x9b\x01\x1e\n\r\n\x05\x04\x12\x02\0\x06\x12\x04\x9c\x01\ + \x04\x11\n\r\n\x05\x04\x12\x02\0\x01\x12\x04\x9c\x01\x12\x18\n\r\n\x05\ + \x04\x12\x02\0\x03\x12\x04\x9c\x01\x1b\x1c\n\x0c\n\x04\x04\x12\x02\x01\ + \x12\x04\x9e\x01\x04\x19\n\x0f\n\x05\x04\x12\x02\x01\x04\x12\x06\x9e\x01\ + \x04\x9c\x01\x1d\n\r\n\x05\x04\x12\x02\x01\x05\x12\x04\x9e\x01\x04\n\n\r\ + \n\x05\x04\x12\x02\x01\x01\x12\x04\x9e\x01\x0b\x14\n\r\n\x05\x04\x12\x02\ + \x01\x03\x12\x04\x9e\x01\x17\x18\nN\n\x02\x04\x13\x12\x06\xa3\x01\0\xa5\ + \x01\x012@\x20Use\x20GetRegionResponse\x20as\x20the\x20response\x20of\ + \x20GetRegionByIDRequest.\n\n\x0b\n\x03\x04\x13\x01\x12\x04\xa3\x01\x08\ + \x1f\n\x0c\n\x04\x04\x13\x02\0\x12\x04\xa4\x01\x04\x1d\n\x0f\n\x05\x04\ + \x13\x02\0\x04\x12\x06\xa4\x01\x04\xa3\x01!\n\r\n\x05\x04\x13\x02\0\x06\ + \x12\x04\xa4\x01\x04\x11\n\r\n\x05\x04\x13\x02\0\x01\x12\x04\xa4\x01\x12\ + \x18\n\r\n\x05\x04\x13\x02\0\x03\x12\x04\xa4\x01\x1b\x1c\n\x0c\n\x02\x04\ + \x14\x12\x06\xa7\x01\0\xab\x01\x01\n\x0b\n\x03\x04\x14\x01\x12\x04\xa7\ + \x01\x08\x20\n\x0c\n\x04\x04\x14\x02\0\x12\x04\xa8\x01\x04\x1e\n\x0f\n\ + \x05\x04\x14\x02\0\x04\x12\x06\xa8\x01\x04\xa7\x01\"\n\r\n\x05\x04\x14\ + \x02\0\x06\x12\x04\xa8\x01\x04\x12\n\r\n\x05\x04\x14\x02\0\x01\x12\x04\ + \xa8\x01\x13\x19\n\r\n\x05\x04\x14\x02\0\x03\x12\x04\xa8\x01\x1c\x1d\n\ + \x0c\n\x04\x04\x14\x02\x01\x12\x04\xaa\x01\x04\x1f\n\x0f\n\x05\x04\x14\ + \x02\x01\x04\x12\x06\xaa\x01\x04\xa8\x01\x1e\n\r\n\x05\x04\x14\x02\x01\ + \x06\x12\x04\xaa\x01\x04\x12\n\r\n\x05\x04\x14\x02\x01\x01\x12\x04\xaa\ + \x01\x13\x1a\n\r\n\x05\x04\x14\x02\x01\x03\x12\x04\xaa\x01\x1d\x1e\n\x0c\ + \n\x02\x04\x15\x12\x06\xad\x01\0\xb1\x01\x01\n\x0b\n\x03\x04\x15\x01\x12\ + \x04\xad\x01\x08\x1f\n\x0c\n\x04\x04\x15\x02\0\x12\x04\xae\x01\x04\x1d\n\ + \x0f\n\x05\x04\x15\x02\0\x04\x12\x06\xae\x01\x04\xad\x01!\n\r\n\x05\x04\ + \x15\x02\0\x06\x12\x04\xae\x01\x04\x11\n\r\n\x05\x04\x15\x02\0\x01\x12\ + \x04\xae\x01\x12\x18\n\r\n\x05\x04\x15\x02\0\x03\x12\x04\xae\x01\x1b\x1c\ + \n\x0c\n\x04\x04\x15\x02\x01\x12\x04\xb0\x01\x04\x1f\n\x0f\n\x05\x04\x15\ + \x02\x01\x04\x12\x06\xb0\x01\x04\xae\x01\x1d\n\r\n\x05\x04\x15\x02\x01\ + \x06\x12\x04\xb0\x01\x04\x12\n\r\n\x05\x04\x15\x02\x01\x01\x12\x04\xb0\ + \x01\x13\x1a\n\r\n\x05\x04\x15\x02\x01\x03\x12\x04\xb0\x01\x1d\x1e\n\x0c\ + \n\x02\x04\x16\x12\x06\xb3\x01\0\xb5\x01\x01\n\x0b\n\x03\x04\x16\x01\x12\ + \x04\xb3\x01\x08\x20\n\x0c\n\x04\x04\x16\x02\0\x12\x04\xb4\x01\x04\x1e\n\ + \x0f\n\x05\x04\x16\x02\0\x04\x12\x06\xb4\x01\x04\xb3\x01\"\n\r\n\x05\x04\ + \x16\x02\0\x06\x12\x04\xb4\x01\x04\x12\n\r\n\x05\x04\x16\x02\0\x01\x12\ + \x04\xb4\x01\x13\x19\n\r\n\x05\x04\x16\x02\0\x03\x12\x04\xb4\x01\x1c\x1d\ + \n\x0c\n\x02\x04\x17\x12\x06\xb7\x01\0\xbe\x01\x01\n\x0b\n\x03\x04\x17\ + \x01\x12\x04\xb7\x01\x08\x0e\n2\n\x04\x04\x17\x02\0\x12\x04\xb9\x01\x04\ + \x14\x1a$\x20name\x20is\x20the\x20name\x20of\x20the\x20PD\x20member.\n\n\ + \x0f\n\x05\x04\x17\x02\0\x04\x12\x06\xb9\x01\x04\xb7\x01\x10\n\r\n\x05\ + \x04\x17\x02\0\x05\x12\x04\xb9\x01\x04\n\n\r\n\x05\x04\x17\x02\0\x01\x12\ + \x04\xb9\x01\x0b\x0f\n\r\n\x05\x04\x17\x02\0\x03\x12\x04\xb9\x01\x12\x13\ + \n<\n\x04\x04\x17\x02\x01\x12\x04\xbb\x01\x04\x19\x1a.\x20member_id\x20i\ + s\x20the\x20unique\x20id\x20of\x20the\x20PD\x20member.\n\n\x0f\n\x05\x04\ + \x17\x02\x01\x04\x12\x06\xbb\x01\x04\xb9\x01\x14\n\r\n\x05\x04\x17\x02\ + \x01\x05\x12\x04\xbb\x01\x04\n\n\r\n\x05\x04\x17\x02\x01\x01\x12\x04\xbb\ + \x01\x0b\x14\n\r\n\x05\x04\x17\x02\x01\x03\x12\x04\xbb\x01\x17\x18\n\x0c\ + \n\x04\x04\x17\x02\x02\x12\x04\xbc\x01\x04\"\n\r\n\x05\x04\x17\x02\x02\ + \x04\x12\x04\xbc\x01\x04\x0c\n\r\n\x05\x04\x17\x02\x02\x05\x12\x04\xbc\ + \x01\r\x13\n\r\n\x05\x04\x17\x02\x02\x01\x12\x04\xbc\x01\x14\x1d\n\r\n\ + \x05\x04\x17\x02\x02\x03\x12\x04\xbc\x01\x20!\n\x0c\n\x04\x04\x17\x02\ + \x03\x12\x04\xbd\x01\x04$\n\r\n\x05\x04\x17\x02\x03\x04\x12\x04\xbd\x01\ + \x04\x0c\n\r\n\x05\x04\x17\x02\x03\x05\x12\x04\xbd\x01\r\x13\n\r\n\x05\ + \x04\x17\x02\x03\x01\x12\x04\xbd\x01\x14\x1f\n\r\n\x05\x04\x17\x02\x03\ + \x03\x12\x04\xbd\x01\"#\n\x0c\n\x02\x04\x18\x12\x06\xc0\x01\0\xc2\x01\ + \x01\n\x0b\n\x03\x04\x18\x01\x12\x04\xc0\x01\x08\x19\n\x0c\n\x04\x04\x18\ + \x02\0\x12\x04\xc1\x01\x04\x1d\n\x0f\n\x05\x04\x18\x02\0\x04\x12\x06\xc1\ + \x01\x04\xc0\x01\x1b\n\r\n\x05\x04\x18\x02\0\x06\x12\x04\xc1\x01\x04\x11\ + \n\r\n\x05\x04\x18\x02\0\x01\x12\x04\xc1\x01\x12\x18\n\r\n\x05\x04\x18\ + \x02\0\x03\x12\x04\xc1\x01\x1b\x1c\n\x0c\n\x02\x04\x19\x12\x06\xc4\x01\0\ + \xc9\x01\x01\n\x0b\n\x03\x04\x19\x01\x12\x04\xc4\x01\x08\x1a\n\x0c\n\x04\ + \x04\x19\x02\0\x12\x04\xc5\x01\x04\x1e\n\x0f\n\x05\x04\x19\x02\0\x04\x12\ + \x06\xc5\x01\x04\xc4\x01\x1c\n\r\n\x05\x04\x19\x02\0\x06\x12\x04\xc5\x01\ + \x04\x12\n\r\n\x05\x04\x19\x02\0\x01\x12\x04\xc5\x01\x13\x19\n\r\n\x05\ + \x04\x19\x02\0\x03\x12\x04\xc5\x01\x1c\x1d\n\x0c\n\x04\x04\x19\x02\x01\ + \x12\x04\xc7\x01\x04\x20\n\r\n\x05\x04\x19\x02\x01\x04\x12\x04\xc7\x01\ + \x04\x0c\n\r\n\x05\x04\x19\x02\x01\x06\x12\x04\xc7\x01\r\x13\n\r\n\x05\ + \x04\x19\x02\x01\x01\x12\x04\xc7\x01\x14\x1b\n\r\n\x05\x04\x19\x02\x01\ + \x03\x12\x04\xc7\x01\x1e\x1f\n\x0c\n\x04\x04\x19\x02\x02\x12\x04\xc8\x01\ + \x04\x16\n\x0f\n\x05\x04\x19\x02\x02\x04\x12\x06\xc8\x01\x04\xc7\x01\x20\ + \n\r\n\x05\x04\x19\x02\x02\x06\x12\x04\xc8\x01\x04\n\n\r\n\x05\x04\x19\ + \x02\x02\x01\x12\x04\xc8\x01\x0b\x11\n\r\n\x05\x04\x19\x02\x02\x03\x12\ + \x04\xc8\x01\x14\x15\n\x0c\n\x02\x04\x1a\x12\x06\xcb\x01\0\xce\x01\x01\n\ + \x0b\n\x03\x04\x1a\x01\x12\x04\xcb\x01\x08\x11\n\x0c\n\x04\x04\x1a\x02\0\ + \x12\x04\xcc\x01\x04\x19\n\x0f\n\x05\x04\x1a\x02\0\x04\x12\x06\xcc\x01\ + \x04\xcb\x01\x13\n\r\n\x05\x04\x1a\x02\0\x06\x12\x04\xcc\x01\x04\x0f\n\r\ + \n\x05\x04\x1a\x02\0\x01\x12\x04\xcc\x01\x10\x14\n\r\n\x05\x04\x1a\x02\0\ + \x03\x12\x04\xcc\x01\x17\x18\n\x0c\n\x04\x04\x1a\x02\x01\x12\x04\xcd\x01\ + \x04\x1c\n\x0f\n\x05\x04\x1a\x02\x01\x04\x12\x06\xcd\x01\x04\xcc\x01\x19\ + \n\r\n\x05\x04\x1a\x02\x01\x05\x12\x04\xcd\x01\x04\n\n\r\n\x05\x04\x1a\ + \x02\x01\x01\x12\x04\xcd\x01\x0b\x17\n\r\n\x05\x04\x1a\x02\x01\x03\x12\ + \x04\xcd\x01\x1a\x1b\n\x0c\n\x02\x04\x1b\x12\x06\xd0\x01\0\xe3\x01\x01\n\ + \x0b\n\x03\x04\x1b\x01\x12\x04\xd0\x01\x08\x1e\n\x0c\n\x04\x04\x1b\x02\0\ + \x12\x04\xd1\x01\x04\x1d\n\x0f\n\x05\x04\x1b\x02\0\x04\x12\x06\xd1\x01\ + \x04\xd0\x01\x20\n\r\n\x05\x04\x1b\x02\0\x06\x12\x04\xd1\x01\x04\x11\n\r\ + \n\x05\x04\x1b\x02\0\x01\x12\x04\xd1\x01\x12\x18\n\r\n\x05\x04\x1b\x02\0\ + \x03\x12\x04\xd1\x01\x1b\x1c\n\x0c\n\x04\x04\x1b\x02\x01\x12\x04\xd3\x01\ + \x04\x1d\n\x0f\n\x05\x04\x1b\x02\x01\x04\x12\x06\xd3\x01\x04\xd1\x01\x1d\ + \n\r\n\x05\x04\x1b\x02\x01\x06\x12\x04\xd3\x01\x04\x11\n\r\n\x05\x04\x1b\ + \x02\x01\x01\x12\x04\xd3\x01\x12\x18\n\r\n\x05\x04\x1b\x02\x01\x03\x12\ + \x04\xd3\x01\x1b\x1c\n2\n\x04\x04\x1b\x02\x02\x12\x04\xd5\x01\x04\x1b\ + \x1a$\x20Leader\x20Peer\x20sending\x20the\x20heartbeat.\n\n\x0f\n\x05\ + \x04\x1b\x02\x02\x04\x12\x06\xd5\x01\x04\xd3\x01\x1d\n\r\n\x05\x04\x1b\ + \x02\x02\x06\x12\x04\xd5\x01\x04\x0f\n\r\n\x05\x04\x1b\x02\x02\x01\x12\ + \x04\xd5\x01\x10\x16\n\r\n\x05\x04\x1b\x02\x02\x03\x12\x04\xd5\x01\x19\ + \x1a\n;\n\x04\x04\x1b\x02\x03\x12\x04\xd7\x01\x04&\x1a-\x20Leader\x20con\ + siders\x20that\x20these\x20peers\x20are\x20down.\n\n\r\n\x05\x04\x1b\x02\ + \x03\x04\x12\x04\xd7\x01\x04\x0c\n\r\n\x05\x04\x1b\x02\x03\x06\x12\x04\ + \xd7\x01\r\x16\n\r\n\x05\x04\x1b\x02\x03\x01\x12\x04\xd7\x01\x17!\n\r\n\ + \x05\x04\x1b\x02\x03\x03\x12\x04\xd7\x01$%\na\n\x04\x04\x1b\x02\x04\x12\ + \x04\xda\x01\x04+\x1aS\x20Pending\x20peers\x20are\x20the\x20peers\x20tha\ + t\x20the\x20leader\x20can't\x20consider\x20as\n\x20working\x20followers.\ + \n\n\r\n\x05\x04\x1b\x02\x04\x04\x12\x04\xda\x01\x04\x0c\n\r\n\x05\x04\ + \x1b\x02\x04\x06\x12\x04\xda\x01\r\x18\n\r\n\x05\x04\x1b\x02\x04\x01\x12\ + \x04\xda\x01\x19&\n\r\n\x05\x04\x1b\x02\x04\x03\x12\x04\xda\x01)*\n6\n\ + \x04\x04\x1b\x02\x05\x12\x04\xdc\x01\x04\x1d\x1a(\x20Bytes\x20read/writt\ + en\x20during\x20this\x20period.\n\n\x0f\n\x05\x04\x1b\x02\x05\x04\x12\ + \x06\xdc\x01\x04\xda\x01+\n\r\n\x05\x04\x1b\x02\x05\x05\x12\x04\xdc\x01\ + \x04\n\n\r\n\x05\x04\x1b\x02\x05\x01\x12\x04\xdc\x01\x0b\x18\n\r\n\x05\ + \x04\x1b\x02\x05\x03\x12\x04\xdc\x01\x1b\x1c\n\x0c\n\x04\x04\x1b\x02\x06\ + \x12\x04\xdd\x01\x04\x1a\n\x0f\n\x05\x04\x1b\x02\x06\x04\x12\x06\xdd\x01\ + \x04\xdc\x01\x1d\n\r\n\x05\x04\x1b\x02\x06\x05\x12\x04\xdd\x01\x04\n\n\r\ + \n\x05\x04\x1b\x02\x06\x01\x12\x04\xdd\x01\x0b\x15\n\r\n\x05\x04\x1b\x02\ + \x06\x03\x12\x04\xdd\x01\x18\x19\n5\n\x04\x04\x1b\x02\x07\x12\x04\xdf\ + \x01\x04\x1c\x1a'\x20Keys\x20read/written\x20during\x20this\x20period.\n\ + \n\x0f\n\x05\x04\x1b\x02\x07\x04\x12\x06\xdf\x01\x04\xdd\x01\x1a\n\r\n\ + \x05\x04\x1b\x02\x07\x05\x12\x04\xdf\x01\x04\n\n\r\n\x05\x04\x1b\x02\x07\ + \x01\x12\x04\xdf\x01\x0b\x17\n\r\n\x05\x04\x1b\x02\x07\x03\x12\x04\xdf\ + \x01\x1a\x1b\n\x0c\n\x04\x04\x1b\x02\x08\x12\x04\xe0\x01\x04\x19\n\x0f\n\ + \x05\x04\x1b\x02\x08\x04\x12\x06\xe0\x01\x04\xdf\x01\x1c\n\r\n\x05\x04\ + \x1b\x02\x08\x05\x12\x04\xe0\x01\x04\n\n\r\n\x05\x04\x1b\x02\x08\x01\x12\ + \x04\xe0\x01\x0b\x14\n\r\n\x05\x04\x1b\x02\x08\x03\x12\x04\xe0\x01\x17\ + \x18\n(\n\x04\x04\x1b\x02\t\x12\x04\xe2\x01\x04!\x1a\x1a\x20Approximate\ + \x20region\x20size.\n\n\x0f\n\x05\x04\x1b\x02\t\x04\x12\x06\xe2\x01\x04\ + \xe0\x01\x19\n\r\n\x05\x04\x1b\x02\t\x05\x12\x04\xe2\x01\x04\n\n\r\n\x05\ + \x04\x1b\x02\t\x01\x12\x04\xe2\x01\x0b\x1b\n\r\n\x05\x04\x1b\x02\t\x03\ + \x12\x04\xe2\x01\x1e\x20\n\xde\x01\n\x02\x05\x01\x12\x06\xe8\x01\0\xeb\ + \x01\x01\x1a\xcf\x01\x20A\x20clone\x20of\x20eraftpb.ConfChangeType,\x20i\ + t\x20exists\x20because\x20proto2\x20enums\x20cannot\x20be\n\x20used\x20d\ + irectly\x20in\x20proto3\x20syntax.\n\x20See\x20more:\x20https://develope\ + rs.google.com/protocol-buffers/docs/proto3#using-proto2-message-types\n\ + \n\x0b\n\x03\x05\x01\x01\x12\x04\xe8\x01\x05\x13\n\x0c\n\x04\x05\x01\x02\ + \0\x12\x04\xe9\x01\x04\x13\n\r\n\x05\x05\x01\x02\0\x01\x12\x04\xe9\x01\ + \x04\x0b\n\r\n\x05\x05\x01\x02\0\x02\x12\x04\xe9\x01\x11\x12\n\x0c\n\x04\ + \x05\x01\x02\x01\x12\x04\xea\x01\x04\x13\n\r\n\x05\x05\x01\x02\x01\x01\ + \x12\x04\xea\x01\x04\x0e\n\r\n\x05\x05\x01\x02\x01\x02\x12\x04\xea\x01\ + \x11\x12\n\x0c\n\x02\x04\x1c\x12\x06\xed\x01\0\xf1\x01\x01\n\x0b\n\x03\ + \x04\x1c\x01\x12\x04\xed\x01\x08\x12\n\x0c\n\x04\x04\x1c\x02\0\x12\x04\ + \xee\x01\x04\x19\n\x0f\n\x05\x04\x1c\x02\0\x04\x12\x06\xee\x01\x04\xed\ + \x01\x14\n\r\n\x05\x04\x1c\x02\0\x06\x12\x04\xee\x01\x04\x0f\n\r\n\x05\ + \x04\x1c\x02\0\x01\x12\x04\xee\x01\x10\x14\n\r\n\x05\x04\x1c\x02\0\x03\ + \x12\x04\xee\x01\x17\x18\nS\n\x04\x04\x1c\x02\x01\x12\x04\xf0\x01\x04#\ + \x1aE\x20FIXME:\x20replace\x20with\x20actual\x20ConfChangeType\x20once\ + \x20eraftpb\x20uses\x20proto3.\n\n\x0f\n\x05\x04\x1c\x02\x01\x04\x12\x06\ + \xf0\x01\x04\xee\x01\x19\n\r\n\x05\x04\x1c\x02\x01\x06\x12\x04\xf0\x01\ + \x04\x12\n\r\n\x05\x04\x1c\x02\x01\x01\x12\x04\xf0\x01\x13\x1e\n\r\n\x05\ + \x04\x1c\x02\x01\x03\x12\x04\xf0\x01!\"\n\x0c\n\x02\x04\x1d\x12\x06\xf3\ + \x01\0\xf5\x01\x01\n\x0b\n\x03\x04\x1d\x01\x12\x04\xf3\x01\x08\x16\n\x0c\ + \n\x04\x04\x1d\x02\0\x12\x04\xf4\x01\x04\x19\n\x0f\n\x05\x04\x1d\x02\0\ + \x04\x12\x06\xf4\x01\x04\xf3\x01\x18\n\r\n\x05\x04\x1d\x02\0\x06\x12\x04\ + \xf4\x01\x04\x0f\n\r\n\x05\x04\x1d\x02\0\x01\x12\x04\xf4\x01\x10\x14\n\r\ + \n\x05\x04\x1d\x02\0\x03\x12\x04\xf4\x01\x17\x18\n\x0c\n\x02\x04\x1e\x12\ + \x06\xf7\x01\0\x90\x02\x01\n\x0b\n\x03\x04\x1e\x01\x12\x04\xf7\x01\x08\ + \x1f\n\x0c\n\x04\x04\x1e\x02\0\x12\x04\xf8\x01\x04\x1e\n\x0f\n\x05\x04\ + \x1e\x02\0\x04\x12\x06\xf8\x01\x04\xf7\x01!\n\r\n\x05\x04\x1e\x02\0\x06\ + \x12\x04\xf8\x01\x04\x12\n\r\n\x05\x04\x1e\x02\0\x01\x12\x04\xf8\x01\x13\ + \x19\n\r\n\x05\x04\x1e\x02\0\x03\x12\x04\xf8\x01\x1c\x1d\n\xcf\x06\n\x04\ + \x04\x1e\x02\x01\x12\x04\x88\x02\x04\x1f\x1a\xc0\x06\x20Notice,\x20Pd\ + \x20only\x20allows\x20handling\x20reported\x20epoch\x20>=\x20current\x20\ + pd's.\n\x20Leader\x20peer\x20reports\x20region\x20status\x20with\x20Regi\ + onHeartbeatRequest\n\x20to\x20pd\x20regularly,\x20pd\x20will\x20determin\ + e\x20whether\x20this\x20region\n\x20should\x20do\x20ChangePeer\x20or\x20\ + not.\n\x20E,g,\x20max\x20peer\x20number\x20is\x203,\x20region\x20A,\x20f\ + irst\x20only\x20peer\x201\x20in\x20A.\n\x201.\x20Pd\x20region\x20state\ + \x20->\x20Peers\x20(1),\x20ConfVer\x20(1).\n\x202.\x20Leader\x20peer\x20\ + 1\x20reports\x20region\x20state\x20to\x20pd,\x20pd\x20finds\x20the\n\x20\ + peer\x20number\x20is\x20<\x203,\x20so\x20first\x20changes\x20its\x20curr\ + ent\x20region\n\x20state\x20->\x20Peers\x20(1,\x202),\x20ConfVer\x20(1),\ + \x20and\x20returns\x20ChangePeer\x20Adding\x202.\n\x203.\x20Leader\x20do\ + es\x20ChangePeer,\x20then\x20reports\x20Peers\x20(1,\x202),\x20ConfVer\ + \x20(2),\n\x20pd\x20updates\x20its\x20state\x20->\x20Peers\x20(1,\x202),\ + \x20ConfVer\x20(2).\n\x204.\x20Leader\x20may\x20report\x20old\x20Peers\ + \x20(1),\x20ConfVer\x20(1)\x20to\x20pd\x20before\x20ConfChange\n\x20fini\ + shed,\x20pd\x20stills\x20responses\x20ChangePeer\x20Adding\x202,\x20of\ + \x20course,\x20we\x20must\n\x20guarantee\x20the\x20second\x20ChangePeer\ + \x20can't\x20be\x20applied\x20in\x20TiKV.\n\n\x0f\n\x05\x04\x1e\x02\x01\ + \x04\x12\x06\x88\x02\x04\xf8\x01\x1e\n\r\n\x05\x04\x1e\x02\x01\x06\x12\ + \x04\x88\x02\x04\x0e\n\r\n\x05\x04\x1e\x02\x01\x01\x12\x04\x88\x02\x0f\ + \x1a\n\r\n\x05\x04\x1e\x02\x01\x03\x12\x04\x88\x02\x1d\x1e\nV\n\x04\x04\ + \x1e\x02\x02\x12\x04\x8a\x02\x04'\x1aH\x20Pd\x20can\x20return\x20transfe\ + r_leader\x20to\x20let\x20TiKV\x20does\x20leader\x20transfer\x20itself.\n\ + \n\x0f\n\x05\x04\x1e\x02\x02\x04\x12\x06\x8a\x02\x04\x88\x02\x1f\n\r\n\ + \x05\x04\x1e\x02\x02\x06\x12\x04\x8a\x02\x04\x12\n\r\n\x05\x04\x1e\x02\ + \x02\x01\x12\x04\x8a\x02\x13\"\n\r\n\x05\x04\x1e\x02\x02\x03\x12\x04\x8a\ + \x02%&\n\x20\n\x04\x04\x1e\x02\x03\x12\x04\x8c\x02\x04\x19\x1a\x12\x20ID\ + \x20of\x20the\x20region\n\n\x0f\n\x05\x04\x1e\x02\x03\x04\x12\x06\x8c\ + \x02\x04\x8a\x02'\n\r\n\x05\x04\x1e\x02\x03\x05\x12\x04\x8c\x02\x04\n\n\ + \r\n\x05\x04\x1e\x02\x03\x01\x12\x04\x8c\x02\x0b\x14\n\r\n\x05\x04\x1e\ + \x02\x03\x03\x12\x04\x8c\x02\x17\x18\n\x0c\n\x04\x04\x1e\x02\x04\x12\x04\ + \x8d\x02\x04(\n\x0f\n\x05\x04\x1e\x02\x04\x04\x12\x06\x8d\x02\x04\x8c\ + \x02\x19\n\r\n\x05\x04\x1e\x02\x04\x06\x12\x04\x8d\x02\x04\x16\n\r\n\x05\ + \x04\x1e\x02\x04\x01\x12\x04\x8d\x02\x17#\n\r\n\x05\x04\x1e\x02\x04\x03\ + \x12\x04\x8d\x02&'\nY\n\x04\x04\x1e\x02\x05\x12\x04\x8f\x02\x04\x20\x1aK\ + \x20Leader\x20of\x20the\x20region\x20at\x20the\x20moment\x20of\x20the\ + \x20corresponding\x20request\x20was\x20made.\n\n\x0f\n\x05\x04\x1e\x02\ + \x05\x04\x12\x06\x8f\x02\x04\x8d\x02(\n\r\n\x05\x04\x1e\x02\x05\x06\x12\ + \x04\x8f\x02\x04\x0f\n\r\n\x05\x04\x1e\x02\x05\x01\x12\x04\x8f\x02\x10\ + \x1b\n\r\n\x05\x04\x1e\x02\x05\x03\x12\x04\x8f\x02\x1e\x1f\n\x0c\n\x02\ + \x04\x1f\x12\x06\x92\x02\0\x96\x02\x01\n\x0b\n\x03\x04\x1f\x01\x12\x04\ + \x92\x02\x08\x17\n\x0c\n\x04\x04\x1f\x02\0\x12\x04\x93\x02\x04\x1d\n\x0f\ + \n\x05\x04\x1f\x02\0\x04\x12\x06\x93\x02\x04\x92\x02\x19\n\r\n\x05\x04\ + \x1f\x02\0\x06\x12\x04\x93\x02\x04\x11\n\r\n\x05\x04\x1f\x02\0\x01\x12\ + \x04\x93\x02\x12\x18\n\r\n\x05\x04\x1f\x02\0\x03\x12\x04\x93\x02\x1b\x1c\ + \n\x0c\n\x04\x04\x1f\x02\x01\x12\x04\x95\x02\x04\x1d\n\x0f\n\x05\x04\x1f\ + \x02\x01\x04\x12\x06\x95\x02\x04\x93\x02\x1d\n\r\n\x05\x04\x1f\x02\x01\ + \x06\x12\x04\x95\x02\x04\x11\n\r\n\x05\x04\x1f\x02\x01\x01\x12\x04\x95\ + \x02\x12\x18\n\r\n\x05\x04\x1f\x02\x01\x03\x12\x04\x95\x02\x1b\x1c\n\x0c\ + \n\x02\x04\x20\x12\x06\x98\x02\0\xa1\x02\x01\n\x0b\n\x03\x04\x20\x01\x12\ + \x04\x98\x02\x08\x18\n\x0c\n\x04\x04\x20\x02\0\x12\x04\x99\x02\x04\x1e\n\ + \x0f\n\x05\x04\x20\x02\0\x04\x12\x06\x99\x02\x04\x98\x02\x1a\n\r\n\x05\ + \x04\x20\x02\0\x06\x12\x04\x99\x02\x04\x12\n\r\n\x05\x04\x20\x02\0\x01\ + \x12\x04\x99\x02\x13\x19\n\r\n\x05\x04\x20\x02\0\x03\x12\x04\x99\x02\x1c\ + \x1d\n\xba\x01\n\x04\x04\x20\x02\x01\x12\x04\x9e\x02\x04\x1d\x1a\xab\x01\ + \x20We\x20split\x20the\x20region\x20into\x20two,\x20first\x20uses\x20the\ + \x20origin\n\x20parent\x20region\x20id,\x20and\x20the\x20second\x20uses\ + \x20the\x20new_region_id.\n\x20We\x20must\x20guarantee\x20that\x20the\ + \x20new_region_id\x20is\x20global\x20unique.\n\n\x0f\n\x05\x04\x20\x02\ + \x01\x04\x12\x06\x9e\x02\x04\x99\x02\x1e\n\r\n\x05\x04\x20\x02\x01\x05\ + \x12\x04\x9e\x02\x04\n\n\r\n\x05\x04\x20\x02\x01\x01\x12\x04\x9e\x02\x0b\ + \x18\n\r\n\x05\x04\x20\x02\x01\x03\x12\x04\x9e\x02\x1b\x1c\n6\n\x04\x04\ + \x20\x02\x02\x12\x04\xa0\x02\x04%\x1a(\x20The\x20peer\x20ids\x20for\x20t\ + he\x20new\x20split\x20region.\n\n\r\n\x05\x04\x20\x02\x02\x04\x12\x04\ + \xa0\x02\x04\x0c\n\r\n\x05\x04\x20\x02\x02\x05\x12\x04\xa0\x02\r\x13\n\r\ + \n\x05\x04\x20\x02\x02\x01\x12\x04\xa0\x02\x14\x20\n\r\n\x05\x04\x20\x02\ + \x02\x03\x12\x04\xa0\x02#$\n\x0c\n\x02\x04!\x12\x06\xa3\x02\0\xa8\x02\ + \x01\n\x0b\n\x03\x04!\x01\x12\x04\xa3\x02\x08\x1a\n\x0c\n\x04\x04!\x02\0\ + \x12\x04\xa4\x02\x04\x1d\n\x0f\n\x05\x04!\x02\0\x04\x12\x06\xa4\x02\x04\ + \xa3\x02\x1c\n\r\n\x05\x04!\x02\0\x06\x12\x04\xa4\x02\x04\x11\n\r\n\x05\ + \x04!\x02\0\x01\x12\x04\xa4\x02\x12\x18\n\r\n\x05\x04!\x02\0\x03\x12\x04\ + \xa4\x02\x1b\x1c\n\x0c\n\x04\x04!\x02\x01\x12\x04\xa6\x02\x04\x1b\n\x0f\ + \n\x05\x04!\x02\x01\x04\x12\x06\xa6\x02\x04\xa4\x02\x1d\n\r\n\x05\x04!\ + \x02\x01\x06\x12\x04\xa6\x02\x04\x11\n\r\n\x05\x04!\x02\x01\x01\x12\x04\ + \xa6\x02\x12\x16\n\r\n\x05\x04!\x02\x01\x03\x12\x04\xa6\x02\x19\x1a\n\ + \x0c\n\x04\x04!\x02\x02\x12\x04\xa7\x02\x04\x1c\n\x0f\n\x05\x04!\x02\x02\ + \x04\x12\x06\xa7\x02\x04\xa6\x02\x1b\n\r\n\x05\x04!\x02\x02\x06\x12\x04\ + \xa7\x02\x04\x11\n\r\n\x05\x04!\x02\x02\x01\x12\x04\xa7\x02\x12\x17\n\r\ + \n\x05\x04!\x02\x02\x03\x12\x04\xa7\x02\x1a\x1b\n\x0c\n\x02\x04\"\x12\ + \x06\xaa\x02\0\xac\x02\x01\n\x0b\n\x03\x04\"\x01\x12\x04\xaa\x02\x08\x1b\ + \n\x0c\n\x04\x04\"\x02\0\x12\x04\xab\x02\x04\x1e\n\x0f\n\x05\x04\"\x02\0\ + \x04\x12\x06\xab\x02\x04\xaa\x02\x1d\n\r\n\x05\x04\"\x02\0\x06\x12\x04\ + \xab\x02\x04\x12\n\r\n\x05\x04\"\x02\0\x01\x12\x04\xab\x02\x13\x19\n\r\n\ + \x05\x04\"\x02\0\x03\x12\x04\xab\x02\x1c\x1d\n\x0c\n\x02\x04#\x12\x06\ + \xae\x02\0\xca\x02\x01\n\x0b\n\x03\x04#\x01\x12\x04\xae\x02\x08\x12\n\ + \x0c\n\x04\x04#\x02\0\x12\x04\xaf\x02\x04\x18\n\x0f\n\x05\x04#\x02\0\x04\ + \x12\x06\xaf\x02\x04\xae\x02\x14\n\r\n\x05\x04#\x02\0\x05\x12\x04\xaf\ + \x02\x04\n\n\r\n\x05\x04#\x02\0\x01\x12\x04\xaf\x02\x0b\x13\n\r\n\x05\ + \x04#\x02\0\x03\x12\x04\xaf\x02\x16\x17\n'\n\x04\x04#\x02\x01\x12\x04\ + \xb1\x02\x04\x18\x1a\x19\x20Capacity\x20for\x20the\x20store.\n\n\x0f\n\ + \x05\x04#\x02\x01\x04\x12\x06\xb1\x02\x04\xaf\x02\x18\n\r\n\x05\x04#\x02\ + \x01\x05\x12\x04\xb1\x02\x04\n\n\r\n\x05\x04#\x02\x01\x01\x12\x04\xb1\ + \x02\x0b\x13\n\r\n\x05\x04#\x02\x01\x03\x12\x04\xb1\x02\x16\x17\n-\n\x04\ + \x04#\x02\x02\x12\x04\xb3\x02\x04\x19\x1a\x1f\x20Available\x20size\x20fo\ + r\x20the\x20store.\n\n\x0f\n\x05\x04#\x02\x02\x04\x12\x06\xb3\x02\x04\ + \xb1\x02\x18\n\r\n\x05\x04#\x02\x02\x05\x12\x04\xb3\x02\x04\n\n\r\n\x05\ + \x04#\x02\x02\x01\x12\x04\xb3\x02\x0b\x14\n\r\n\x05\x04#\x02\x02\x03\x12\ + \x04\xb3\x02\x17\x18\n1\n\x04\x04#\x02\x03\x12\x04\xb5\x02\x04\x1c\x1a#\ + \x20Total\x20region\x20count\x20in\x20this\x20store.\n\n\x0f\n\x05\x04#\ + \x02\x03\x04\x12\x06\xb5\x02\x04\xb3\x02\x19\n\r\n\x05\x04#\x02\x03\x05\ + \x12\x04\xb5\x02\x04\n\n\r\n\x05\x04#\x02\x03\x01\x12\x04\xb5\x02\x0b\ + \x17\n\r\n\x05\x04#\x02\x03\x03\x12\x04\xb5\x02\x1a\x1b\n/\n\x04\x04#\ + \x02\x04\x12\x04\xb7\x02\x04\"\x1a!\x20Current\x20sending\x20snapshot\ + \x20count.\n\n\x0f\n\x05\x04#\x02\x04\x04\x12\x06\xb7\x02\x04\xb5\x02\ + \x1c\n\r\n\x05\x04#\x02\x04\x05\x12\x04\xb7\x02\x04\n\n\r\n\x05\x04#\x02\ + \x04\x01\x12\x04\xb7\x02\x0b\x1d\n\r\n\x05\x04#\x02\x04\x03\x12\x04\xb7\ + \x02\x20!\n1\n\x04\x04#\x02\x05\x12\x04\xb9\x02\x04$\x1a#\x20Current\x20\ + receiving\x20snapshot\x20count.\n\n\x0f\n\x05\x04#\x02\x05\x04\x12\x06\ + \xb9\x02\x04\xb7\x02\"\n\r\n\x05\x04#\x02\x05\x05\x12\x04\xb9\x02\x04\n\ + \n\r\n\x05\x04#\x02\x05\x01\x12\x04\xb9\x02\x0b\x1f\n\r\n\x05\x04#\x02\ + \x05\x03\x12\x04\xb9\x02\"#\nF\n\x04\x04#\x02\x06\x12\x04\xbb\x02\x04\ + \x1a\x1a8\x20When\x20the\x20store\x20is\x20started\x20(unix\x20timestamp\ + \x20in\x20seconds).\n\n\x0f\n\x05\x04#\x02\x06\x04\x12\x06\xbb\x02\x04\ + \xb9\x02$\n\r\n\x05\x04#\x02\x06\x05\x12\x04\xbb\x02\x04\n\n\r\n\x05\x04\ + #\x02\x06\x01\x12\x04\xbb\x02\x0b\x15\n\r\n\x05\x04#\x02\x06\x03\x12\x04\ + \xbb\x02\x18\x19\n5\n\x04\x04#\x02\x07\x12\x04\xbd\x02\x04#\x1a'\x20How\ + \x20many\x20region\x20is\x20applying\x20snapshot.\n\n\x0f\n\x05\x04#\x02\ + \x07\x04\x12\x06\xbd\x02\x04\xbb\x02\x1a\n\r\n\x05\x04#\x02\x07\x05\x12\ + \x04\xbd\x02\x04\n\n\r\n\x05\x04#\x02\x07\x01\x12\x04\xbd\x02\x0b\x1e\n\ + \r\n\x05\x04#\x02\x07\x03\x12\x04\xbd\x02!\"\n$\n\x04\x04#\x02\x08\x12\ + \x04\xbf\x02\x04\x15\x1a\x16\x20If\x20the\x20store\x20is\x20busy\n\n\x0f\ + \n\x05\x04#\x02\x08\x04\x12\x06\xbf\x02\x04\xbd\x02#\n\r\n\x05\x04#\x02\ + \x08\x05\x12\x04\xbf\x02\x04\x08\n\r\n\x05\x04#\x02\x08\x01\x12\x04\xbf\ + \x02\t\x10\n\r\n\x05\x04#\x02\x08\x03\x12\x04\xbf\x02\x13\x14\n)\n\x04\ + \x04#\x02\t\x12\x04\xc1\x02\x04\x1a\x1a\x1b\x20Actually\x20used\x20space\ + \x20by\x20db\n\n\x0f\n\x05\x04#\x02\t\x04\x12\x06\xc1\x02\x04\xbf\x02\ + \x15\n\r\n\x05\x04#\x02\t\x05\x12\x04\xc1\x02\x04\n\n\r\n\x05\x04#\x02\t\ + \x01\x12\x04\xc1\x02\x0b\x14\n\r\n\x05\x04#\x02\t\x03\x12\x04\xc1\x02\ + \x17\x19\n,\n\x04\x04#\x02\n\x12\x04\xc3\x02\x04\x1e\x1a\x1e\x20Bytes\ + \x20written\x20for\x20the\x20store.\n\n\x0f\n\x05\x04#\x02\n\x04\x12\x06\ + \xc3\x02\x04\xc1\x02\x1a\n\r\n\x05\x04#\x02\n\x05\x12\x04\xc3\x02\x04\n\ + \n\r\n\x05\x04#\x02\n\x01\x12\x04\xc3\x02\x0b\x18\n\r\n\x05\x04#\x02\n\ + \x03\x12\x04\xc3\x02\x1b\x1d\n+\n\x04\x04#\x02\x0b\x12\x04\xc5\x02\x04\ + \x1d\x1a\x1d\x20Keys\x20written\x20for\x20the\x20store.\n\n\x0f\n\x05\ + \x04#\x02\x0b\x04\x12\x06\xc5\x02\x04\xc3\x02\x1e\n\r\n\x05\x04#\x02\x0b\ + \x05\x12\x04\xc5\x02\x04\n\n\r\n\x05\x04#\x02\x0b\x01\x12\x04\xc5\x02\ + \x0b\x17\n\r\n\x05\x04#\x02\x0b\x03\x12\x04\xc5\x02\x1a\x1c\n)\n\x04\x04\ + #\x02\x0c\x12\x04\xc7\x02\x04\x1b\x1a\x1b\x20Bytes\x20read\x20for\x20the\ + \x20store.\n\n\x0f\n\x05\x04#\x02\x0c\x04\x12\x06\xc7\x02\x04\xc5\x02\ + \x1d\n\r\n\x05\x04#\x02\x0c\x05\x12\x04\xc7\x02\x04\n\n\r\n\x05\x04#\x02\ + \x0c\x01\x12\x04\xc7\x02\x0b\x15\n\r\n\x05\x04#\x02\x0c\x03\x12\x04\xc7\ + \x02\x18\x1a\n(\n\x04\x04#\x02\r\x12\x04\xc9\x02\x04\x1a\x1a\x1a\x20Keys\ + \x20read\x20for\x20the\x20store.\n\n\x0f\n\x05\x04#\x02\r\x04\x12\x06\ + \xc9\x02\x04\xc7\x02\x1b\n\r\n\x05\x04#\x02\r\x05\x12\x04\xc9\x02\x04\n\ + \n\r\n\x05\x04#\x02\r\x01\x12\x04\xc9\x02\x0b\x14\n\r\n\x05\x04#\x02\r\ + \x03\x12\x04\xc9\x02\x17\x19\n\x0c\n\x02\x04$\x12\x06\xcc\x02\0\xd0\x02\ + \x01\n\x0b\n\x03\x04$\x01\x12\x04\xcc\x02\x08\x1d\n\x0c\n\x04\x04$\x02\0\ + \x12\x04\xcd\x02\x04\x1d\n\x0f\n\x05\x04$\x02\0\x04\x12\x06\xcd\x02\x04\ + \xcc\x02\x1f\n\r\n\x05\x04$\x02\0\x06\x12\x04\xcd\x02\x04\x11\n\r\n\x05\ + \x04$\x02\0\x01\x12\x04\xcd\x02\x12\x18\n\r\n\x05\x04$\x02\0\x03\x12\x04\ + \xcd\x02\x1b\x1c\n\x0c\n\x04\x04$\x02\x01\x12\x04\xcf\x02\x04\x19\n\x0f\ + \n\x05\x04$\x02\x01\x04\x12\x06\xcf\x02\x04\xcd\x02\x1d\n\r\n\x05\x04$\ + \x02\x01\x06\x12\x04\xcf\x02\x04\x0e\n\r\n\x05\x04$\x02\x01\x01\x12\x04\ + \xcf\x02\x0f\x14\n\r\n\x05\x04$\x02\x01\x03\x12\x04\xcf\x02\x17\x18\n\ + \x0c\n\x02\x04%\x12\x06\xd2\x02\0\xd4\x02\x01\n\x0b\n\x03\x04%\x01\x12\ + \x04\xd2\x02\x08\x1e\n\x0c\n\x04\x04%\x02\0\x12\x04\xd3\x02\x04\x1e\n\ + \x0f\n\x05\x04%\x02\0\x04\x12\x06\xd3\x02\x04\xd2\x02\x20\n\r\n\x05\x04%\ + \x02\0\x06\x12\x04\xd3\x02\x04\x12\n\r\n\x05\x04%\x02\0\x01\x12\x04\xd3\ + \x02\x13\x19\n\r\n\x05\x04%\x02\0\x03\x12\x04\xd3\x02\x1c\x1db\x06proto3\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/src/pdpb_grpc.rs b/_vendor/src/github.com/pingcap/kvproto/src/pdpb_grpc.rs new file mode 100644 index 00000000000..2001670586c --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/src/pdpb_grpc.rs @@ -0,0 +1,446 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy)] + +#![cfg_attr(rustfmt, rustfmt_skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] + +const METHOD_PD_GET_MEMBERS: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/pdpb.PD/GetMembers", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_PD_TSO: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Duplex, + name: "/pdpb.PD/Tso", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_PD_BOOTSTRAP: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/pdpb.PD/Bootstrap", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_PD_IS_BOOTSTRAPPED: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/pdpb.PD/IsBootstrapped", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_PD_ALLOC_ID: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/pdpb.PD/AllocID", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_PD_GET_STORE: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/pdpb.PD/GetStore", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_PD_PUT_STORE: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/pdpb.PD/PutStore", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_PD_STORE_HEARTBEAT: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/pdpb.PD/StoreHeartbeat", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_PD_REGION_HEARTBEAT: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Duplex, + name: "/pdpb.PD/RegionHeartbeat", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_PD_GET_REGION: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/pdpb.PD/GetRegion", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_PD_GET_REGION_BY_ID: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/pdpb.PD/GetRegionByID", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_PD_ASK_SPLIT: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/pdpb.PD/AskSplit", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_PD_REPORT_SPLIT: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/pdpb.PD/ReportSplit", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_PD_GET_CLUSTER_CONFIG: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/pdpb.PD/GetClusterConfig", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_PD_PUT_CLUSTER_CONFIG: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/pdpb.PD/PutClusterConfig", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +pub struct PdClient { + client: ::grpcio::Client, +} + +impl PdClient { + pub fn new(channel: ::grpcio::Channel) -> Self { + PdClient { + client: ::grpcio::Client::new(channel), + } + } + + pub fn get_members_opt(&self, req: super::pdpb::GetMembersRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_PD_GET_MEMBERS, req, opt) + } + + pub fn get_members(&self, req: super::pdpb::GetMembersRequest) -> ::grpcio::Result { + self.get_members_opt(req, ::grpcio::CallOption::default()) + } + + pub fn get_members_async_opt(&self, req: super::pdpb::GetMembersRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_PD_GET_MEMBERS, req, opt) + } + + pub fn get_members_async(&self, req: super::pdpb::GetMembersRequest) -> ::grpcio::ClientUnaryReceiver { + self.get_members_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn tso_opt(&self, opt: ::grpcio::CallOption) -> (::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver) { + self.client.duplex_streaming(&METHOD_PD_TSO, opt) + } + + pub fn tso(&self) -> (::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver) { + self.tso_opt(::grpcio::CallOption::default()) + } + + pub fn bootstrap_opt(&self, req: super::pdpb::BootstrapRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_PD_BOOTSTRAP, req, opt) + } + + pub fn bootstrap(&self, req: super::pdpb::BootstrapRequest) -> ::grpcio::Result { + self.bootstrap_opt(req, ::grpcio::CallOption::default()) + } + + pub fn bootstrap_async_opt(&self, req: super::pdpb::BootstrapRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_PD_BOOTSTRAP, req, opt) + } + + pub fn bootstrap_async(&self, req: super::pdpb::BootstrapRequest) -> ::grpcio::ClientUnaryReceiver { + self.bootstrap_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn is_bootstrapped_opt(&self, req: super::pdpb::IsBootstrappedRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_PD_IS_BOOTSTRAPPED, req, opt) + } + + pub fn is_bootstrapped(&self, req: super::pdpb::IsBootstrappedRequest) -> ::grpcio::Result { + self.is_bootstrapped_opt(req, ::grpcio::CallOption::default()) + } + + pub fn is_bootstrapped_async_opt(&self, req: super::pdpb::IsBootstrappedRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_PD_IS_BOOTSTRAPPED, req, opt) + } + + pub fn is_bootstrapped_async(&self, req: super::pdpb::IsBootstrappedRequest) -> ::grpcio::ClientUnaryReceiver { + self.is_bootstrapped_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn alloc_id_opt(&self, req: super::pdpb::AllocIDRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_PD_ALLOC_ID, req, opt) + } + + pub fn alloc_id(&self, req: super::pdpb::AllocIDRequest) -> ::grpcio::Result { + self.alloc_id_opt(req, ::grpcio::CallOption::default()) + } + + pub fn alloc_id_async_opt(&self, req: super::pdpb::AllocIDRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_PD_ALLOC_ID, req, opt) + } + + pub fn alloc_id_async(&self, req: super::pdpb::AllocIDRequest) -> ::grpcio::ClientUnaryReceiver { + self.alloc_id_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn get_store_opt(&self, req: super::pdpb::GetStoreRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_PD_GET_STORE, req, opt) + } + + pub fn get_store(&self, req: super::pdpb::GetStoreRequest) -> ::grpcio::Result { + self.get_store_opt(req, ::grpcio::CallOption::default()) + } + + pub fn get_store_async_opt(&self, req: super::pdpb::GetStoreRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_PD_GET_STORE, req, opt) + } + + pub fn get_store_async(&self, req: super::pdpb::GetStoreRequest) -> ::grpcio::ClientUnaryReceiver { + self.get_store_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn put_store_opt(&self, req: super::pdpb::PutStoreRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_PD_PUT_STORE, req, opt) + } + + pub fn put_store(&self, req: super::pdpb::PutStoreRequest) -> ::grpcio::Result { + self.put_store_opt(req, ::grpcio::CallOption::default()) + } + + pub fn put_store_async_opt(&self, req: super::pdpb::PutStoreRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_PD_PUT_STORE, req, opt) + } + + pub fn put_store_async(&self, req: super::pdpb::PutStoreRequest) -> ::grpcio::ClientUnaryReceiver { + self.put_store_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn store_heartbeat_opt(&self, req: super::pdpb::StoreHeartbeatRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_PD_STORE_HEARTBEAT, req, opt) + } + + pub fn store_heartbeat(&self, req: super::pdpb::StoreHeartbeatRequest) -> ::grpcio::Result { + self.store_heartbeat_opt(req, ::grpcio::CallOption::default()) + } + + pub fn store_heartbeat_async_opt(&self, req: super::pdpb::StoreHeartbeatRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_PD_STORE_HEARTBEAT, req, opt) + } + + pub fn store_heartbeat_async(&self, req: super::pdpb::StoreHeartbeatRequest) -> ::grpcio::ClientUnaryReceiver { + self.store_heartbeat_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn region_heartbeat_opt(&self, opt: ::grpcio::CallOption) -> (::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver) { + self.client.duplex_streaming(&METHOD_PD_REGION_HEARTBEAT, opt) + } + + pub fn region_heartbeat(&self) -> (::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver) { + self.region_heartbeat_opt(::grpcio::CallOption::default()) + } + + pub fn get_region_opt(&self, req: super::pdpb::GetRegionRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_PD_GET_REGION, req, opt) + } + + pub fn get_region(&self, req: super::pdpb::GetRegionRequest) -> ::grpcio::Result { + self.get_region_opt(req, ::grpcio::CallOption::default()) + } + + pub fn get_region_async_opt(&self, req: super::pdpb::GetRegionRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_PD_GET_REGION, req, opt) + } + + pub fn get_region_async(&self, req: super::pdpb::GetRegionRequest) -> ::grpcio::ClientUnaryReceiver { + self.get_region_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn get_region_by_id_opt(&self, req: super::pdpb::GetRegionByIDRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_PD_GET_REGION_BY_ID, req, opt) + } + + pub fn get_region_by_id(&self, req: super::pdpb::GetRegionByIDRequest) -> ::grpcio::Result { + self.get_region_by_id_opt(req, ::grpcio::CallOption::default()) + } + + pub fn get_region_by_id_async_opt(&self, req: super::pdpb::GetRegionByIDRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_PD_GET_REGION_BY_ID, req, opt) + } + + pub fn get_region_by_id_async(&self, req: super::pdpb::GetRegionByIDRequest) -> ::grpcio::ClientUnaryReceiver { + self.get_region_by_id_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn ask_split_opt(&self, req: super::pdpb::AskSplitRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_PD_ASK_SPLIT, req, opt) + } + + pub fn ask_split(&self, req: super::pdpb::AskSplitRequest) -> ::grpcio::Result { + self.ask_split_opt(req, ::grpcio::CallOption::default()) + } + + pub fn ask_split_async_opt(&self, req: super::pdpb::AskSplitRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_PD_ASK_SPLIT, req, opt) + } + + pub fn ask_split_async(&self, req: super::pdpb::AskSplitRequest) -> ::grpcio::ClientUnaryReceiver { + self.ask_split_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn report_split_opt(&self, req: super::pdpb::ReportSplitRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_PD_REPORT_SPLIT, req, opt) + } + + pub fn report_split(&self, req: super::pdpb::ReportSplitRequest) -> ::grpcio::Result { + self.report_split_opt(req, ::grpcio::CallOption::default()) + } + + pub fn report_split_async_opt(&self, req: super::pdpb::ReportSplitRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_PD_REPORT_SPLIT, req, opt) + } + + pub fn report_split_async(&self, req: super::pdpb::ReportSplitRequest) -> ::grpcio::ClientUnaryReceiver { + self.report_split_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn get_cluster_config_opt(&self, req: super::pdpb::GetClusterConfigRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_PD_GET_CLUSTER_CONFIG, req, opt) + } + + pub fn get_cluster_config(&self, req: super::pdpb::GetClusterConfigRequest) -> ::grpcio::Result { + self.get_cluster_config_opt(req, ::grpcio::CallOption::default()) + } + + pub fn get_cluster_config_async_opt(&self, req: super::pdpb::GetClusterConfigRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_PD_GET_CLUSTER_CONFIG, req, opt) + } + + pub fn get_cluster_config_async(&self, req: super::pdpb::GetClusterConfigRequest) -> ::grpcio::ClientUnaryReceiver { + self.get_cluster_config_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn put_cluster_config_opt(&self, req: super::pdpb::PutClusterConfigRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_PD_PUT_CLUSTER_CONFIG, req, opt) + } + + pub fn put_cluster_config(&self, req: super::pdpb::PutClusterConfigRequest) -> ::grpcio::Result { + self.put_cluster_config_opt(req, ::grpcio::CallOption::default()) + } + + pub fn put_cluster_config_async_opt(&self, req: super::pdpb::PutClusterConfigRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_PD_PUT_CLUSTER_CONFIG, req, opt) + } + + pub fn put_cluster_config_async(&self, req: super::pdpb::PutClusterConfigRequest) -> ::grpcio::ClientUnaryReceiver { + self.put_cluster_config_async_opt(req, ::grpcio::CallOption::default()) + } + pub fn spawn(&self, f: F) where F: ::futures::Future + Send + 'static { + self.client.spawn(f) + } +} + +pub trait Pd { + fn get_members(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::GetMembersRequest, sink: ::grpcio::UnarySink); + fn tso(&self, ctx: ::grpcio::RpcContext, stream: ::grpcio::RequestStream, sink: ::grpcio::DuplexSink); + fn bootstrap(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::BootstrapRequest, sink: ::grpcio::UnarySink); + fn is_bootstrapped(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::IsBootstrappedRequest, sink: ::grpcio::UnarySink); + fn alloc_id(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::AllocIDRequest, sink: ::grpcio::UnarySink); + fn get_store(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::GetStoreRequest, sink: ::grpcio::UnarySink); + fn put_store(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::PutStoreRequest, sink: ::grpcio::UnarySink); + fn store_heartbeat(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::StoreHeartbeatRequest, sink: ::grpcio::UnarySink); + fn region_heartbeat(&self, ctx: ::grpcio::RpcContext, stream: ::grpcio::RequestStream, sink: ::grpcio::DuplexSink); + fn get_region(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::GetRegionRequest, sink: ::grpcio::UnarySink); + fn get_region_by_id(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::GetRegionByIDRequest, sink: ::grpcio::UnarySink); + fn ask_split(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::AskSplitRequest, sink: ::grpcio::UnarySink); + fn report_split(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::ReportSplitRequest, sink: ::grpcio::UnarySink); + fn get_cluster_config(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::GetClusterConfigRequest, sink: ::grpcio::UnarySink); + fn put_cluster_config(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::PutClusterConfigRequest, sink: ::grpcio::UnarySink); +} + +pub fn create_pd(s: S) -> ::grpcio::Service { + let mut builder = ::grpcio::ServiceBuilder::new(); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_PD_GET_MEMBERS, move |ctx, req, resp| { + instance.get_members(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_duplex_streaming_handler(&METHOD_PD_TSO, move |ctx, req, resp| { + instance.tso(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_PD_BOOTSTRAP, move |ctx, req, resp| { + instance.bootstrap(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_PD_IS_BOOTSTRAPPED, move |ctx, req, resp| { + instance.is_bootstrapped(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_PD_ALLOC_ID, move |ctx, req, resp| { + instance.alloc_id(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_PD_GET_STORE, move |ctx, req, resp| { + instance.get_store(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_PD_PUT_STORE, move |ctx, req, resp| { + instance.put_store(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_PD_STORE_HEARTBEAT, move |ctx, req, resp| { + instance.store_heartbeat(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_duplex_streaming_handler(&METHOD_PD_REGION_HEARTBEAT, move |ctx, req, resp| { + instance.region_heartbeat(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_PD_GET_REGION, move |ctx, req, resp| { + instance.get_region(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_PD_GET_REGION_BY_ID, move |ctx, req, resp| { + instance.get_region_by_id(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_PD_ASK_SPLIT, move |ctx, req, resp| { + instance.ask_split(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_PD_REPORT_SPLIT, move |ctx, req, resp| { + instance.report_split(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_PD_GET_CLUSTER_CONFIG, move |ctx, req, resp| { + instance.get_cluster_config(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_PD_PUT_CLUSTER_CONFIG, move |ctx, req, resp| { + instance.put_cluster_config(ctx, req, resp) + }); + builder.build() +} diff --git a/_vendor/src/github.com/pingcap/kvproto/src/raft_cmdpb.rs b/_vendor/src/github.com/pingcap/kvproto/src/raft_cmdpb.rs new file mode 100644 index 00000000000..0295ff43b37 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/src/raft_cmdpb.rs @@ -0,0 +1,10096 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy)] + +#![cfg_attr(rustfmt, rustfmt_skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(PartialEq,Clone,Default)] +pub struct GetRequest { + // message fields + cf: ::protobuf::SingularField<::std::string::String>, + key: ::protobuf::SingularField<::std::vec::Vec>, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for GetRequest {} + +impl GetRequest { + pub fn new() -> GetRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static GetRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const GetRequest, + }; + unsafe { + instance.get(GetRequest::new) + } + } + + // optional string cf = 1; + + pub fn clear_cf(&mut self) { + self.cf.clear(); + } + + pub fn has_cf(&self) -> bool { + self.cf.is_some() + } + + // Param is passed by value, moved + pub fn set_cf(&mut self, v: ::std::string::String) { + self.cf = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_cf(&mut self) -> &mut ::std::string::String { + if self.cf.is_none() { + self.cf.set_default(); + } + self.cf.as_mut().unwrap() + } + + // Take field + pub fn take_cf(&mut self) -> ::std::string::String { + self.cf.take().unwrap_or_else(|| ::std::string::String::new()) + } + + pub fn get_cf(&self) -> &str { + match self.cf.as_ref() { + Some(v) => &v, + None => "", + } + } + + fn get_cf_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { + &self.cf + } + + fn mut_cf_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { + &mut self.cf + } + + // optional bytes key = 2; + + pub fn clear_key(&mut self) { + self.key.clear(); + } + + pub fn has_key(&self) -> bool { + self.key.is_some() + } + + // Param is passed by value, moved + pub fn set_key(&mut self, v: ::std::vec::Vec) { + self.key = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { + if self.key.is_none() { + self.key.set_default(); + } + self.key.as_mut().unwrap() + } + + // Take field + pub fn take_key(&mut self) -> ::std::vec::Vec { + self.key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub fn get_key(&self) -> &[u8] { + match self.key.as_ref() { + Some(v) => &v, + None => &[], + } + } + + fn get_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { + &self.key + } + + fn mut_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { + &mut self.key + } +} + +impl ::protobuf::Message for GetRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.cf)?; + }, + 2 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.key)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.cf.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(ref v) = self.key.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.cf.as_ref() { + os.write_string(1, &v)?; + } + if let Some(ref v) = self.key.as_ref() { + os.write_bytes(2, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for GetRequest { + fn new() -> GetRequest { + GetRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "cf", + GetRequest::get_cf_for_reflect, + GetRequest::mut_cf_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "key", + GetRequest::get_key_for_reflect, + GetRequest::mut_key_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "GetRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for GetRequest { + fn clear(&mut self) { + self.clear_cf(); + self.clear_key(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for GetRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct GetResponse { + // message fields + value: ::protobuf::SingularField<::std::vec::Vec>, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for GetResponse {} + +impl GetResponse { + pub fn new() -> GetResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static GetResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const GetResponse, + }; + unsafe { + instance.get(GetResponse::new) + } + } + + // optional bytes value = 1; + + pub fn clear_value(&mut self) { + self.value.clear(); + } + + pub fn has_value(&self) -> bool { + self.value.is_some() + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: ::std::vec::Vec) { + self.value = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { + if self.value.is_none() { + self.value.set_default(); + } + self.value.as_mut().unwrap() + } + + // Take field + pub fn take_value(&mut self) -> ::std::vec::Vec { + self.value.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub fn get_value(&self) -> &[u8] { + match self.value.as_ref() { + Some(v) => &v, + None => &[], + } + } + + fn get_value_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { + &self.value + } + + fn mut_value_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { + &mut self.value + } +} + +impl ::protobuf::Message for GetResponse { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.value)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.value.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.value.as_ref() { + os.write_bytes(1, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for GetResponse { + fn new() -> GetResponse { + GetResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "value", + GetResponse::get_value_for_reflect, + GetResponse::mut_value_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "GetResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for GetResponse { + fn clear(&mut self) { + self.clear_value(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for GetResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GetResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct PutRequest { + // message fields + cf: ::protobuf::SingularField<::std::string::String>, + key: ::protobuf::SingularField<::std::vec::Vec>, + value: ::protobuf::SingularField<::std::vec::Vec>, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for PutRequest {} + +impl PutRequest { + pub fn new() -> PutRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static PutRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const PutRequest, + }; + unsafe { + instance.get(PutRequest::new) + } + } + + // optional string cf = 1; + + pub fn clear_cf(&mut self) { + self.cf.clear(); + } + + pub fn has_cf(&self) -> bool { + self.cf.is_some() + } + + // Param is passed by value, moved + pub fn set_cf(&mut self, v: ::std::string::String) { + self.cf = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_cf(&mut self) -> &mut ::std::string::String { + if self.cf.is_none() { + self.cf.set_default(); + } + self.cf.as_mut().unwrap() + } + + // Take field + pub fn take_cf(&mut self) -> ::std::string::String { + self.cf.take().unwrap_or_else(|| ::std::string::String::new()) + } + + pub fn get_cf(&self) -> &str { + match self.cf.as_ref() { + Some(v) => &v, + None => "", + } + } + + fn get_cf_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { + &self.cf + } + + fn mut_cf_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { + &mut self.cf + } + + // optional bytes key = 2; + + pub fn clear_key(&mut self) { + self.key.clear(); + } + + pub fn has_key(&self) -> bool { + self.key.is_some() + } + + // Param is passed by value, moved + pub fn set_key(&mut self, v: ::std::vec::Vec) { + self.key = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { + if self.key.is_none() { + self.key.set_default(); + } + self.key.as_mut().unwrap() + } + + // Take field + pub fn take_key(&mut self) -> ::std::vec::Vec { + self.key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub fn get_key(&self) -> &[u8] { + match self.key.as_ref() { + Some(v) => &v, + None => &[], + } + } + + fn get_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { + &self.key + } + + fn mut_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { + &mut self.key + } + + // optional bytes value = 3; + + pub fn clear_value(&mut self) { + self.value.clear(); + } + + pub fn has_value(&self) -> bool { + self.value.is_some() + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: ::std::vec::Vec) { + self.value = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { + if self.value.is_none() { + self.value.set_default(); + } + self.value.as_mut().unwrap() + } + + // Take field + pub fn take_value(&mut self) -> ::std::vec::Vec { + self.value.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub fn get_value(&self) -> &[u8] { + match self.value.as_ref() { + Some(v) => &v, + None => &[], + } + } + + fn get_value_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { + &self.value + } + + fn mut_value_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { + &mut self.value + } +} + +impl ::protobuf::Message for PutRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.cf)?; + }, + 2 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.key)?; + }, + 3 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.value)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.cf.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(ref v) = self.key.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(ref v) = self.value.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.cf.as_ref() { + os.write_string(1, &v)?; + } + if let Some(ref v) = self.key.as_ref() { + os.write_bytes(2, &v)?; + } + if let Some(ref v) = self.value.as_ref() { + os.write_bytes(3, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for PutRequest { + fn new() -> PutRequest { + PutRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "cf", + PutRequest::get_cf_for_reflect, + PutRequest::mut_cf_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "key", + PutRequest::get_key_for_reflect, + PutRequest::mut_key_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "value", + PutRequest::get_value_for_reflect, + PutRequest::mut_value_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "PutRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for PutRequest { + fn clear(&mut self) { + self.clear_cf(); + self.clear_key(); + self.clear_value(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for PutRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PutRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct PutResponse { + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for PutResponse {} + +impl PutResponse { + pub fn new() -> PutResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static PutResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const PutResponse, + }; + unsafe { + instance.get(PutResponse::new) + } + } +} + +impl ::protobuf::Message for PutResponse { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for PutResponse { + fn new() -> PutResponse { + PutResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let fields = ::std::vec::Vec::new(); + ::protobuf::reflect::MessageDescriptor::new::( + "PutResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for PutResponse { + fn clear(&mut self) { + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for PutResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PutResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct DeleteRequest { + // message fields + cf: ::protobuf::SingularField<::std::string::String>, + key: ::protobuf::SingularField<::std::vec::Vec>, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for DeleteRequest {} + +impl DeleteRequest { + pub fn new() -> DeleteRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static DeleteRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const DeleteRequest, + }; + unsafe { + instance.get(DeleteRequest::new) + } + } + + // optional string cf = 1; + + pub fn clear_cf(&mut self) { + self.cf.clear(); + } + + pub fn has_cf(&self) -> bool { + self.cf.is_some() + } + + // Param is passed by value, moved + pub fn set_cf(&mut self, v: ::std::string::String) { + self.cf = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_cf(&mut self) -> &mut ::std::string::String { + if self.cf.is_none() { + self.cf.set_default(); + } + self.cf.as_mut().unwrap() + } + + // Take field + pub fn take_cf(&mut self) -> ::std::string::String { + self.cf.take().unwrap_or_else(|| ::std::string::String::new()) + } + + pub fn get_cf(&self) -> &str { + match self.cf.as_ref() { + Some(v) => &v, + None => "", + } + } + + fn get_cf_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { + &self.cf + } + + fn mut_cf_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { + &mut self.cf + } + + // optional bytes key = 2; + + pub fn clear_key(&mut self) { + self.key.clear(); + } + + pub fn has_key(&self) -> bool { + self.key.is_some() + } + + // Param is passed by value, moved + pub fn set_key(&mut self, v: ::std::vec::Vec) { + self.key = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { + if self.key.is_none() { + self.key.set_default(); + } + self.key.as_mut().unwrap() + } + + // Take field + pub fn take_key(&mut self) -> ::std::vec::Vec { + self.key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub fn get_key(&self) -> &[u8] { + match self.key.as_ref() { + Some(v) => &v, + None => &[], + } + } + + fn get_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { + &self.key + } + + fn mut_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { + &mut self.key + } +} + +impl ::protobuf::Message for DeleteRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.cf)?; + }, + 2 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.key)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.cf.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(ref v) = self.key.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.cf.as_ref() { + os.write_string(1, &v)?; + } + if let Some(ref v) = self.key.as_ref() { + os.write_bytes(2, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for DeleteRequest { + fn new() -> DeleteRequest { + DeleteRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "cf", + DeleteRequest::get_cf_for_reflect, + DeleteRequest::mut_cf_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "key", + DeleteRequest::get_key_for_reflect, + DeleteRequest::mut_key_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "DeleteRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for DeleteRequest { + fn clear(&mut self) { + self.clear_cf(); + self.clear_key(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for DeleteRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DeleteRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct DeleteResponse { + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for DeleteResponse {} + +impl DeleteResponse { + pub fn new() -> DeleteResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static DeleteResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const DeleteResponse, + }; + unsafe { + instance.get(DeleteResponse::new) + } + } +} + +impl ::protobuf::Message for DeleteResponse { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for DeleteResponse { + fn new() -> DeleteResponse { + DeleteResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let fields = ::std::vec::Vec::new(); + ::protobuf::reflect::MessageDescriptor::new::( + "DeleteResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for DeleteResponse { + fn clear(&mut self) { + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for DeleteResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DeleteResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct DeleteRangeRequest { + // message fields + cf: ::protobuf::SingularField<::std::string::String>, + start_key: ::protobuf::SingularField<::std::vec::Vec>, + end_key: ::protobuf::SingularField<::std::vec::Vec>, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for DeleteRangeRequest {} + +impl DeleteRangeRequest { + pub fn new() -> DeleteRangeRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static DeleteRangeRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const DeleteRangeRequest, + }; + unsafe { + instance.get(DeleteRangeRequest::new) + } + } + + // optional string cf = 1; + + pub fn clear_cf(&mut self) { + self.cf.clear(); + } + + pub fn has_cf(&self) -> bool { + self.cf.is_some() + } + + // Param is passed by value, moved + pub fn set_cf(&mut self, v: ::std::string::String) { + self.cf = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_cf(&mut self) -> &mut ::std::string::String { + if self.cf.is_none() { + self.cf.set_default(); + } + self.cf.as_mut().unwrap() + } + + // Take field + pub fn take_cf(&mut self) -> ::std::string::String { + self.cf.take().unwrap_or_else(|| ::std::string::String::new()) + } + + pub fn get_cf(&self) -> &str { + match self.cf.as_ref() { + Some(v) => &v, + None => "", + } + } + + fn get_cf_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { + &self.cf + } + + fn mut_cf_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { + &mut self.cf + } + + // optional bytes start_key = 2; + + pub fn clear_start_key(&mut self) { + self.start_key.clear(); + } + + pub fn has_start_key(&self) -> bool { + self.start_key.is_some() + } + + // Param is passed by value, moved + pub fn set_start_key(&mut self, v: ::std::vec::Vec) { + self.start_key = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_start_key(&mut self) -> &mut ::std::vec::Vec { + if self.start_key.is_none() { + self.start_key.set_default(); + } + self.start_key.as_mut().unwrap() + } + + // Take field + pub fn take_start_key(&mut self) -> ::std::vec::Vec { + self.start_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub fn get_start_key(&self) -> &[u8] { + match self.start_key.as_ref() { + Some(v) => &v, + None => &[], + } + } + + fn get_start_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { + &self.start_key + } + + fn mut_start_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { + &mut self.start_key + } + + // optional bytes end_key = 3; + + pub fn clear_end_key(&mut self) { + self.end_key.clear(); + } + + pub fn has_end_key(&self) -> bool { + self.end_key.is_some() + } + + // Param is passed by value, moved + pub fn set_end_key(&mut self, v: ::std::vec::Vec) { + self.end_key = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_end_key(&mut self) -> &mut ::std::vec::Vec { + if self.end_key.is_none() { + self.end_key.set_default(); + } + self.end_key.as_mut().unwrap() + } + + // Take field + pub fn take_end_key(&mut self) -> ::std::vec::Vec { + self.end_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub fn get_end_key(&self) -> &[u8] { + match self.end_key.as_ref() { + Some(v) => &v, + None => &[], + } + } + + fn get_end_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { + &self.end_key + } + + fn mut_end_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { + &mut self.end_key + } +} + +impl ::protobuf::Message for DeleteRangeRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.cf)?; + }, + 2 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.start_key)?; + }, + 3 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.end_key)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.cf.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(ref v) = self.start_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(ref v) = self.end_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.cf.as_ref() { + os.write_string(1, &v)?; + } + if let Some(ref v) = self.start_key.as_ref() { + os.write_bytes(2, &v)?; + } + if let Some(ref v) = self.end_key.as_ref() { + os.write_bytes(3, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for DeleteRangeRequest { + fn new() -> DeleteRangeRequest { + DeleteRangeRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "cf", + DeleteRangeRequest::get_cf_for_reflect, + DeleteRangeRequest::mut_cf_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "start_key", + DeleteRangeRequest::get_start_key_for_reflect, + DeleteRangeRequest::mut_start_key_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "end_key", + DeleteRangeRequest::get_end_key_for_reflect, + DeleteRangeRequest::mut_end_key_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "DeleteRangeRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for DeleteRangeRequest { + fn clear(&mut self) { + self.clear_cf(); + self.clear_start_key(); + self.clear_end_key(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for DeleteRangeRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DeleteRangeRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct DeleteRangeResponse { + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for DeleteRangeResponse {} + +impl DeleteRangeResponse { + pub fn new() -> DeleteRangeResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static DeleteRangeResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const DeleteRangeResponse, + }; + unsafe { + instance.get(DeleteRangeResponse::new) + } + } +} + +impl ::protobuf::Message for DeleteRangeResponse { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for DeleteRangeResponse { + fn new() -> DeleteRangeResponse { + DeleteRangeResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let fields = ::std::vec::Vec::new(); + ::protobuf::reflect::MessageDescriptor::new::( + "DeleteRangeResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for DeleteRangeResponse { + fn clear(&mut self) { + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for DeleteRangeResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DeleteRangeResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct SnapRequest { + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for SnapRequest {} + +impl SnapRequest { + pub fn new() -> SnapRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static SnapRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const SnapRequest, + }; + unsafe { + instance.get(SnapRequest::new) + } + } +} + +impl ::protobuf::Message for SnapRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for SnapRequest { + fn new() -> SnapRequest { + SnapRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let fields = ::std::vec::Vec::new(); + ::protobuf::reflect::MessageDescriptor::new::( + "SnapRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for SnapRequest { + fn clear(&mut self) { + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for SnapRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SnapRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct SnapResponse { + // message fields + region: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for SnapResponse {} + +impl SnapResponse { + pub fn new() -> SnapResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static SnapResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const SnapResponse, + }; + unsafe { + instance.get(SnapResponse::new) + } + } + + // optional .metapb.Region region = 1; + + pub fn clear_region(&mut self) { + self.region.clear(); + } + + pub fn has_region(&self) -> bool { + self.region.is_some() + } + + // Param is passed by value, moved + pub fn set_region(&mut self, v: super::metapb::Region) { + self.region = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region(&mut self) -> &mut super::metapb::Region { + if self.region.is_none() { + self.region.set_default(); + } + self.region.as_mut().unwrap() + } + + // Take field + pub fn take_region(&mut self) -> super::metapb::Region { + self.region.take().unwrap_or_else(|| super::metapb::Region::new()) + } + + pub fn get_region(&self) -> &super::metapb::Region { + self.region.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) + } + + fn get_region_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region + } + + fn mut_region_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region + } +} + +impl ::protobuf::Message for SnapResponse { + fn is_initialized(&self) -> bool { + for v in &self.region { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.region.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.region.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for SnapResponse { + fn new() -> SnapResponse { + SnapResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region", + SnapResponse::get_region_for_reflect, + SnapResponse::mut_region_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "SnapResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for SnapResponse { + fn clear(&mut self) { + self.clear_region(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for SnapResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SnapResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct PrewriteRequest { + // message fields + key: ::protobuf::SingularField<::std::vec::Vec>, + value: ::protobuf::SingularField<::std::vec::Vec>, + lock: ::protobuf::SingularField<::std::vec::Vec>, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for PrewriteRequest {} + +impl PrewriteRequest { + pub fn new() -> PrewriteRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static PrewriteRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const PrewriteRequest, + }; + unsafe { + instance.get(PrewriteRequest::new) + } + } + + // optional bytes key = 1; + + pub fn clear_key(&mut self) { + self.key.clear(); + } + + pub fn has_key(&self) -> bool { + self.key.is_some() + } + + // Param is passed by value, moved + pub fn set_key(&mut self, v: ::std::vec::Vec) { + self.key = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { + if self.key.is_none() { + self.key.set_default(); + } + self.key.as_mut().unwrap() + } + + // Take field + pub fn take_key(&mut self) -> ::std::vec::Vec { + self.key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub fn get_key(&self) -> &[u8] { + match self.key.as_ref() { + Some(v) => &v, + None => &[], + } + } + + fn get_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { + &self.key + } + + fn mut_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { + &mut self.key + } + + // optional bytes value = 2; + + pub fn clear_value(&mut self) { + self.value.clear(); + } + + pub fn has_value(&self) -> bool { + self.value.is_some() + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: ::std::vec::Vec) { + self.value = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { + if self.value.is_none() { + self.value.set_default(); + } + self.value.as_mut().unwrap() + } + + // Take field + pub fn take_value(&mut self) -> ::std::vec::Vec { + self.value.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub fn get_value(&self) -> &[u8] { + match self.value.as_ref() { + Some(v) => &v, + None => &[], + } + } + + fn get_value_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { + &self.value + } + + fn mut_value_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { + &mut self.value + } + + // optional bytes lock = 3; + + pub fn clear_lock(&mut self) { + self.lock.clear(); + } + + pub fn has_lock(&self) -> bool { + self.lock.is_some() + } + + // Param is passed by value, moved + pub fn set_lock(&mut self, v: ::std::vec::Vec) { + self.lock = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_lock(&mut self) -> &mut ::std::vec::Vec { + if self.lock.is_none() { + self.lock.set_default(); + } + self.lock.as_mut().unwrap() + } + + // Take field + pub fn take_lock(&mut self) -> ::std::vec::Vec { + self.lock.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub fn get_lock(&self) -> &[u8] { + match self.lock.as_ref() { + Some(v) => &v, + None => &[], + } + } + + fn get_lock_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { + &self.lock + } + + fn mut_lock_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { + &mut self.lock + } +} + +impl ::protobuf::Message for PrewriteRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.key)?; + }, + 2 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.value)?; + }, + 3 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.lock)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.key.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(ref v) = self.value.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(ref v) = self.lock.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.key.as_ref() { + os.write_bytes(1, &v)?; + } + if let Some(ref v) = self.value.as_ref() { + os.write_bytes(2, &v)?; + } + if let Some(ref v) = self.lock.as_ref() { + os.write_bytes(3, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for PrewriteRequest { + fn new() -> PrewriteRequest { + PrewriteRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "key", + PrewriteRequest::get_key_for_reflect, + PrewriteRequest::mut_key_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "value", + PrewriteRequest::get_value_for_reflect, + PrewriteRequest::mut_value_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "lock", + PrewriteRequest::get_lock_for_reflect, + PrewriteRequest::mut_lock_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "PrewriteRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for PrewriteRequest { + fn clear(&mut self) { + self.clear_key(); + self.clear_value(); + self.clear_lock(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for PrewriteRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PrewriteRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct PrewriteResponse { + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for PrewriteResponse {} + +impl PrewriteResponse { + pub fn new() -> PrewriteResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static PrewriteResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const PrewriteResponse, + }; + unsafe { + instance.get(PrewriteResponse::new) + } + } +} + +impl ::protobuf::Message for PrewriteResponse { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for PrewriteResponse { + fn new() -> PrewriteResponse { + PrewriteResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let fields = ::std::vec::Vec::new(); + ::protobuf::reflect::MessageDescriptor::new::( + "PrewriteResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for PrewriteResponse { + fn clear(&mut self) { + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for PrewriteResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PrewriteResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Request { + // message fields + cmd_type: ::std::option::Option, + get: ::protobuf::SingularPtrField, + put: ::protobuf::SingularPtrField, + delete: ::protobuf::SingularPtrField, + snap: ::protobuf::SingularPtrField, + prewrite: ::protobuf::SingularPtrField, + delete_range: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Request {} + +impl Request { + pub fn new() -> Request { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static Request { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Request, + }; + unsafe { + instance.get(Request::new) + } + } + + // optional .raft_cmdpb.CmdType cmd_type = 1; + + pub fn clear_cmd_type(&mut self) { + self.cmd_type = ::std::option::Option::None; + } + + pub fn has_cmd_type(&self) -> bool { + self.cmd_type.is_some() + } + + // Param is passed by value, moved + pub fn set_cmd_type(&mut self, v: CmdType) { + self.cmd_type = ::std::option::Option::Some(v); + } + + pub fn get_cmd_type(&self) -> CmdType { + self.cmd_type.unwrap_or(CmdType::Invalid) + } + + fn get_cmd_type_for_reflect(&self) -> &::std::option::Option { + &self.cmd_type + } + + fn mut_cmd_type_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.cmd_type + } + + // optional .raft_cmdpb.GetRequest get = 2; + + pub fn clear_get(&mut self) { + self.get.clear(); + } + + pub fn has_get(&self) -> bool { + self.get.is_some() + } + + // Param is passed by value, moved + pub fn set_get(&mut self, v: GetRequest) { + self.get = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_get(&mut self) -> &mut GetRequest { + if self.get.is_none() { + self.get.set_default(); + } + self.get.as_mut().unwrap() + } + + // Take field + pub fn take_get(&mut self) -> GetRequest { + self.get.take().unwrap_or_else(|| GetRequest::new()) + } + + pub fn get_get(&self) -> &GetRequest { + self.get.as_ref().unwrap_or_else(|| GetRequest::default_instance()) + } + + fn get_get_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.get + } + + fn mut_get_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.get + } + + // optional .raft_cmdpb.PutRequest put = 4; + + pub fn clear_put(&mut self) { + self.put.clear(); + } + + pub fn has_put(&self) -> bool { + self.put.is_some() + } + + // Param is passed by value, moved + pub fn set_put(&mut self, v: PutRequest) { + self.put = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_put(&mut self) -> &mut PutRequest { + if self.put.is_none() { + self.put.set_default(); + } + self.put.as_mut().unwrap() + } + + // Take field + pub fn take_put(&mut self) -> PutRequest { + self.put.take().unwrap_or_else(|| PutRequest::new()) + } + + pub fn get_put(&self) -> &PutRequest { + self.put.as_ref().unwrap_or_else(|| PutRequest::default_instance()) + } + + fn get_put_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.put + } + + fn mut_put_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.put + } + + // optional .raft_cmdpb.DeleteRequest delete = 5; + + pub fn clear_delete(&mut self) { + self.delete.clear(); + } + + pub fn has_delete(&self) -> bool { + self.delete.is_some() + } + + // Param is passed by value, moved + pub fn set_delete(&mut self, v: DeleteRequest) { + self.delete = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_delete(&mut self) -> &mut DeleteRequest { + if self.delete.is_none() { + self.delete.set_default(); + } + self.delete.as_mut().unwrap() + } + + // Take field + pub fn take_delete(&mut self) -> DeleteRequest { + self.delete.take().unwrap_or_else(|| DeleteRequest::new()) + } + + pub fn get_delete(&self) -> &DeleteRequest { + self.delete.as_ref().unwrap_or_else(|| DeleteRequest::default_instance()) + } + + fn get_delete_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.delete + } + + fn mut_delete_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.delete + } + + // optional .raft_cmdpb.SnapRequest snap = 6; + + pub fn clear_snap(&mut self) { + self.snap.clear(); + } + + pub fn has_snap(&self) -> bool { + self.snap.is_some() + } + + // Param is passed by value, moved + pub fn set_snap(&mut self, v: SnapRequest) { + self.snap = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_snap(&mut self) -> &mut SnapRequest { + if self.snap.is_none() { + self.snap.set_default(); + } + self.snap.as_mut().unwrap() + } + + // Take field + pub fn take_snap(&mut self) -> SnapRequest { + self.snap.take().unwrap_or_else(|| SnapRequest::new()) + } + + pub fn get_snap(&self) -> &SnapRequest { + self.snap.as_ref().unwrap_or_else(|| SnapRequest::default_instance()) + } + + fn get_snap_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.snap + } + + fn mut_snap_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.snap + } + + // optional .raft_cmdpb.PrewriteRequest prewrite = 7; + + pub fn clear_prewrite(&mut self) { + self.prewrite.clear(); + } + + pub fn has_prewrite(&self) -> bool { + self.prewrite.is_some() + } + + // Param is passed by value, moved + pub fn set_prewrite(&mut self, v: PrewriteRequest) { + self.prewrite = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_prewrite(&mut self) -> &mut PrewriteRequest { + if self.prewrite.is_none() { + self.prewrite.set_default(); + } + self.prewrite.as_mut().unwrap() + } + + // Take field + pub fn take_prewrite(&mut self) -> PrewriteRequest { + self.prewrite.take().unwrap_or_else(|| PrewriteRequest::new()) + } + + pub fn get_prewrite(&self) -> &PrewriteRequest { + self.prewrite.as_ref().unwrap_or_else(|| PrewriteRequest::default_instance()) + } + + fn get_prewrite_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.prewrite + } + + fn mut_prewrite_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.prewrite + } + + // optional .raft_cmdpb.DeleteRangeRequest delete_range = 8; + + pub fn clear_delete_range(&mut self) { + self.delete_range.clear(); + } + + pub fn has_delete_range(&self) -> bool { + self.delete_range.is_some() + } + + // Param is passed by value, moved + pub fn set_delete_range(&mut self, v: DeleteRangeRequest) { + self.delete_range = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_delete_range(&mut self) -> &mut DeleteRangeRequest { + if self.delete_range.is_none() { + self.delete_range.set_default(); + } + self.delete_range.as_mut().unwrap() + } + + // Take field + pub fn take_delete_range(&mut self) -> DeleteRangeRequest { + self.delete_range.take().unwrap_or_else(|| DeleteRangeRequest::new()) + } + + pub fn get_delete_range(&self) -> &DeleteRangeRequest { + self.delete_range.as_ref().unwrap_or_else(|| DeleteRangeRequest::default_instance()) + } + + fn get_delete_range_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.delete_range + } + + fn mut_delete_range_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.delete_range + } +} + +impl ::protobuf::Message for Request { + fn is_initialized(&self) -> bool { + for v in &self.get { + if !v.is_initialized() { + return false; + } + }; + for v in &self.put { + if !v.is_initialized() { + return false; + } + }; + for v in &self.delete { + if !v.is_initialized() { + return false; + } + }; + for v in &self.snap { + if !v.is_initialized() { + return false; + } + }; + for v in &self.prewrite { + if !v.is_initialized() { + return false; + } + }; + for v in &self.delete_range { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_enum()?; + self.cmd_type = ::std::option::Option::Some(tmp); + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.get)?; + }, + 4 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.put)?; + }, + 5 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.delete)?; + }, + 6 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.snap)?; + }, + 7 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.prewrite)?; + }, + 8 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.delete_range)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.cmd_type { + my_size += ::protobuf::rt::enum_size(1, v); + } + if let Some(ref v) = self.get.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.put.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.delete.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.snap.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.prewrite.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.delete_range.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.cmd_type { + os.write_enum(1, v.value())?; + } + if let Some(ref v) = self.get.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.put.as_ref() { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.delete.as_ref() { + os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.snap.as_ref() { + os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.prewrite.as_ref() { + os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.delete_range.as_ref() { + os.write_tag(8, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for Request { + fn new() -> Request { + Request::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "cmd_type", + Request::get_cmd_type_for_reflect, + Request::mut_cmd_type_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "get", + Request::get_get_for_reflect, + Request::mut_get_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "put", + Request::get_put_for_reflect, + Request::mut_put_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "delete", + Request::get_delete_for_reflect, + Request::mut_delete_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "snap", + Request::get_snap_for_reflect, + Request::mut_snap_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "prewrite", + Request::get_prewrite_for_reflect, + Request::mut_prewrite_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "delete_range", + Request::get_delete_range_for_reflect, + Request::mut_delete_range_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Request", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for Request { + fn clear(&mut self) { + self.clear_cmd_type(); + self.clear_get(); + self.clear_put(); + self.clear_delete(); + self.clear_snap(); + self.clear_prewrite(); + self.clear_delete_range(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Request { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Request { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Response { + // message fields + cmd_type: ::std::option::Option, + get: ::protobuf::SingularPtrField, + put: ::protobuf::SingularPtrField, + delete: ::protobuf::SingularPtrField, + snap: ::protobuf::SingularPtrField, + prewrite: ::protobuf::SingularPtrField, + delte_range: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Response {} + +impl Response { + pub fn new() -> Response { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static Response { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Response, + }; + unsafe { + instance.get(Response::new) + } + } + + // optional .raft_cmdpb.CmdType cmd_type = 1; + + pub fn clear_cmd_type(&mut self) { + self.cmd_type = ::std::option::Option::None; + } + + pub fn has_cmd_type(&self) -> bool { + self.cmd_type.is_some() + } + + // Param is passed by value, moved + pub fn set_cmd_type(&mut self, v: CmdType) { + self.cmd_type = ::std::option::Option::Some(v); + } + + pub fn get_cmd_type(&self) -> CmdType { + self.cmd_type.unwrap_or(CmdType::Invalid) + } + + fn get_cmd_type_for_reflect(&self) -> &::std::option::Option { + &self.cmd_type + } + + fn mut_cmd_type_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.cmd_type + } + + // optional .raft_cmdpb.GetResponse get = 2; + + pub fn clear_get(&mut self) { + self.get.clear(); + } + + pub fn has_get(&self) -> bool { + self.get.is_some() + } + + // Param is passed by value, moved + pub fn set_get(&mut self, v: GetResponse) { + self.get = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_get(&mut self) -> &mut GetResponse { + if self.get.is_none() { + self.get.set_default(); + } + self.get.as_mut().unwrap() + } + + // Take field + pub fn take_get(&mut self) -> GetResponse { + self.get.take().unwrap_or_else(|| GetResponse::new()) + } + + pub fn get_get(&self) -> &GetResponse { + self.get.as_ref().unwrap_or_else(|| GetResponse::default_instance()) + } + + fn get_get_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.get + } + + fn mut_get_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.get + } + + // optional .raft_cmdpb.PutResponse put = 4; + + pub fn clear_put(&mut self) { + self.put.clear(); + } + + pub fn has_put(&self) -> bool { + self.put.is_some() + } + + // Param is passed by value, moved + pub fn set_put(&mut self, v: PutResponse) { + self.put = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_put(&mut self) -> &mut PutResponse { + if self.put.is_none() { + self.put.set_default(); + } + self.put.as_mut().unwrap() + } + + // Take field + pub fn take_put(&mut self) -> PutResponse { + self.put.take().unwrap_or_else(|| PutResponse::new()) + } + + pub fn get_put(&self) -> &PutResponse { + self.put.as_ref().unwrap_or_else(|| PutResponse::default_instance()) + } + + fn get_put_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.put + } + + fn mut_put_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.put + } + + // optional .raft_cmdpb.DeleteResponse delete = 5; + + pub fn clear_delete(&mut self) { + self.delete.clear(); + } + + pub fn has_delete(&self) -> bool { + self.delete.is_some() + } + + // Param is passed by value, moved + pub fn set_delete(&mut self, v: DeleteResponse) { + self.delete = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_delete(&mut self) -> &mut DeleteResponse { + if self.delete.is_none() { + self.delete.set_default(); + } + self.delete.as_mut().unwrap() + } + + // Take field + pub fn take_delete(&mut self) -> DeleteResponse { + self.delete.take().unwrap_or_else(|| DeleteResponse::new()) + } + + pub fn get_delete(&self) -> &DeleteResponse { + self.delete.as_ref().unwrap_or_else(|| DeleteResponse::default_instance()) + } + + fn get_delete_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.delete + } + + fn mut_delete_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.delete + } + + // optional .raft_cmdpb.SnapResponse snap = 6; + + pub fn clear_snap(&mut self) { + self.snap.clear(); + } + + pub fn has_snap(&self) -> bool { + self.snap.is_some() + } + + // Param is passed by value, moved + pub fn set_snap(&mut self, v: SnapResponse) { + self.snap = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_snap(&mut self) -> &mut SnapResponse { + if self.snap.is_none() { + self.snap.set_default(); + } + self.snap.as_mut().unwrap() + } + + // Take field + pub fn take_snap(&mut self) -> SnapResponse { + self.snap.take().unwrap_or_else(|| SnapResponse::new()) + } + + pub fn get_snap(&self) -> &SnapResponse { + self.snap.as_ref().unwrap_or_else(|| SnapResponse::default_instance()) + } + + fn get_snap_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.snap + } + + fn mut_snap_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.snap + } + + // optional .raft_cmdpb.PrewriteResponse prewrite = 7; + + pub fn clear_prewrite(&mut self) { + self.prewrite.clear(); + } + + pub fn has_prewrite(&self) -> bool { + self.prewrite.is_some() + } + + // Param is passed by value, moved + pub fn set_prewrite(&mut self, v: PrewriteResponse) { + self.prewrite = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_prewrite(&mut self) -> &mut PrewriteResponse { + if self.prewrite.is_none() { + self.prewrite.set_default(); + } + self.prewrite.as_mut().unwrap() + } + + // Take field + pub fn take_prewrite(&mut self) -> PrewriteResponse { + self.prewrite.take().unwrap_or_else(|| PrewriteResponse::new()) + } + + pub fn get_prewrite(&self) -> &PrewriteResponse { + self.prewrite.as_ref().unwrap_or_else(|| PrewriteResponse::default_instance()) + } + + fn get_prewrite_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.prewrite + } + + fn mut_prewrite_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.prewrite + } + + // optional .raft_cmdpb.DeleteRangeResponse delte_range = 8; + + pub fn clear_delte_range(&mut self) { + self.delte_range.clear(); + } + + pub fn has_delte_range(&self) -> bool { + self.delte_range.is_some() + } + + // Param is passed by value, moved + pub fn set_delte_range(&mut self, v: DeleteRangeResponse) { + self.delte_range = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_delte_range(&mut self) -> &mut DeleteRangeResponse { + if self.delte_range.is_none() { + self.delte_range.set_default(); + } + self.delte_range.as_mut().unwrap() + } + + // Take field + pub fn take_delte_range(&mut self) -> DeleteRangeResponse { + self.delte_range.take().unwrap_or_else(|| DeleteRangeResponse::new()) + } + + pub fn get_delte_range(&self) -> &DeleteRangeResponse { + self.delte_range.as_ref().unwrap_or_else(|| DeleteRangeResponse::default_instance()) + } + + fn get_delte_range_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.delte_range + } + + fn mut_delte_range_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.delte_range + } +} + +impl ::protobuf::Message for Response { + fn is_initialized(&self) -> bool { + for v in &self.get { + if !v.is_initialized() { + return false; + } + }; + for v in &self.put { + if !v.is_initialized() { + return false; + } + }; + for v in &self.delete { + if !v.is_initialized() { + return false; + } + }; + for v in &self.snap { + if !v.is_initialized() { + return false; + } + }; + for v in &self.prewrite { + if !v.is_initialized() { + return false; + } + }; + for v in &self.delte_range { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_enum()?; + self.cmd_type = ::std::option::Option::Some(tmp); + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.get)?; + }, + 4 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.put)?; + }, + 5 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.delete)?; + }, + 6 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.snap)?; + }, + 7 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.prewrite)?; + }, + 8 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.delte_range)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.cmd_type { + my_size += ::protobuf::rt::enum_size(1, v); + } + if let Some(ref v) = self.get.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.put.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.delete.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.snap.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.prewrite.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.delte_range.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.cmd_type { + os.write_enum(1, v.value())?; + } + if let Some(ref v) = self.get.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.put.as_ref() { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.delete.as_ref() { + os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.snap.as_ref() { + os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.prewrite.as_ref() { + os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.delte_range.as_ref() { + os.write_tag(8, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for Response { + fn new() -> Response { + Response::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "cmd_type", + Response::get_cmd_type_for_reflect, + Response::mut_cmd_type_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "get", + Response::get_get_for_reflect, + Response::mut_get_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "put", + Response::get_put_for_reflect, + Response::mut_put_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "delete", + Response::get_delete_for_reflect, + Response::mut_delete_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "snap", + Response::get_snap_for_reflect, + Response::mut_snap_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "prewrite", + Response::get_prewrite_for_reflect, + Response::mut_prewrite_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "delte_range", + Response::get_delte_range_for_reflect, + Response::mut_delte_range_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Response", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for Response { + fn clear(&mut self) { + self.clear_cmd_type(); + self.clear_get(); + self.clear_put(); + self.clear_delete(); + self.clear_snap(); + self.clear_prewrite(); + self.clear_delte_range(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Response { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Response { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ChangePeerRequest { + // message fields + change_type: ::std::option::Option, + peer: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for ChangePeerRequest {} + +impl ChangePeerRequest { + pub fn new() -> ChangePeerRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static ChangePeerRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ChangePeerRequest, + }; + unsafe { + instance.get(ChangePeerRequest::new) + } + } + + // optional .eraftpb.ConfChangeType change_type = 1; + + pub fn clear_change_type(&mut self) { + self.change_type = ::std::option::Option::None; + } + + pub fn has_change_type(&self) -> bool { + self.change_type.is_some() + } + + // Param is passed by value, moved + pub fn set_change_type(&mut self, v: super::eraftpb::ConfChangeType) { + self.change_type = ::std::option::Option::Some(v); + } + + pub fn get_change_type(&self) -> super::eraftpb::ConfChangeType { + self.change_type.unwrap_or(super::eraftpb::ConfChangeType::AddNode) + } + + fn get_change_type_for_reflect(&self) -> &::std::option::Option { + &self.change_type + } + + fn mut_change_type_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.change_type + } + + // optional .metapb.Peer peer = 2; + + pub fn clear_peer(&mut self) { + self.peer.clear(); + } + + pub fn has_peer(&self) -> bool { + self.peer.is_some() + } + + // Param is passed by value, moved + pub fn set_peer(&mut self, v: super::metapb::Peer) { + self.peer = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_peer(&mut self) -> &mut super::metapb::Peer { + if self.peer.is_none() { + self.peer.set_default(); + } + self.peer.as_mut().unwrap() + } + + // Take field + pub fn take_peer(&mut self) -> super::metapb::Peer { + self.peer.take().unwrap_or_else(|| super::metapb::Peer::new()) + } + + pub fn get_peer(&self) -> &super::metapb::Peer { + self.peer.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) + } + + fn get_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.peer + } + + fn mut_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.peer + } +} + +impl ::protobuf::Message for ChangePeerRequest { + fn is_initialized(&self) -> bool { + for v in &self.peer { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_enum()?; + self.change_type = ::std::option::Option::Some(tmp); + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.peer)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.change_type { + my_size += ::protobuf::rt::enum_size(1, v); + } + if let Some(ref v) = self.peer.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.change_type { + os.write_enum(1, v.value())?; + } + if let Some(ref v) = self.peer.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for ChangePeerRequest { + fn new() -> ChangePeerRequest { + ChangePeerRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "change_type", + ChangePeerRequest::get_change_type_for_reflect, + ChangePeerRequest::mut_change_type_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "peer", + ChangePeerRequest::get_peer_for_reflect, + ChangePeerRequest::mut_peer_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ChangePeerRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for ChangePeerRequest { + fn clear(&mut self) { + self.clear_change_type(); + self.clear_peer(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ChangePeerRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ChangePeerRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ChangePeerResponse { + // message fields + region: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for ChangePeerResponse {} + +impl ChangePeerResponse { + pub fn new() -> ChangePeerResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static ChangePeerResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ChangePeerResponse, + }; + unsafe { + instance.get(ChangePeerResponse::new) + } + } + + // optional .metapb.Region region = 1; + + pub fn clear_region(&mut self) { + self.region.clear(); + } + + pub fn has_region(&self) -> bool { + self.region.is_some() + } + + // Param is passed by value, moved + pub fn set_region(&mut self, v: super::metapb::Region) { + self.region = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region(&mut self) -> &mut super::metapb::Region { + if self.region.is_none() { + self.region.set_default(); + } + self.region.as_mut().unwrap() + } + + // Take field + pub fn take_region(&mut self) -> super::metapb::Region { + self.region.take().unwrap_or_else(|| super::metapb::Region::new()) + } + + pub fn get_region(&self) -> &super::metapb::Region { + self.region.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) + } + + fn get_region_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region + } + + fn mut_region_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region + } +} + +impl ::protobuf::Message for ChangePeerResponse { + fn is_initialized(&self) -> bool { + for v in &self.region { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.region.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.region.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for ChangePeerResponse { + fn new() -> ChangePeerResponse { + ChangePeerResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region", + ChangePeerResponse::get_region_for_reflect, + ChangePeerResponse::mut_region_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ChangePeerResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for ChangePeerResponse { + fn clear(&mut self) { + self.clear_region(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ChangePeerResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ChangePeerResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct SplitRequest { + // message fields + split_key: ::protobuf::SingularField<::std::vec::Vec>, + new_region_id: ::std::option::Option, + new_peer_ids: ::std::vec::Vec, + right_derive: ::std::option::Option, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for SplitRequest {} + +impl SplitRequest { + pub fn new() -> SplitRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static SplitRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const SplitRequest, + }; + unsafe { + instance.get(SplitRequest::new) + } + } + + // optional bytes split_key = 1; + + pub fn clear_split_key(&mut self) { + self.split_key.clear(); + } + + pub fn has_split_key(&self) -> bool { + self.split_key.is_some() + } + + // Param is passed by value, moved + pub fn set_split_key(&mut self, v: ::std::vec::Vec) { + self.split_key = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_split_key(&mut self) -> &mut ::std::vec::Vec { + if self.split_key.is_none() { + self.split_key.set_default(); + } + self.split_key.as_mut().unwrap() + } + + // Take field + pub fn take_split_key(&mut self) -> ::std::vec::Vec { + self.split_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub fn get_split_key(&self) -> &[u8] { + match self.split_key.as_ref() { + Some(v) => &v, + None => &[], + } + } + + fn get_split_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { + &self.split_key + } + + fn mut_split_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { + &mut self.split_key + } + + // optional uint64 new_region_id = 2; + + pub fn clear_new_region_id(&mut self) { + self.new_region_id = ::std::option::Option::None; + } + + pub fn has_new_region_id(&self) -> bool { + self.new_region_id.is_some() + } + + // Param is passed by value, moved + pub fn set_new_region_id(&mut self, v: u64) { + self.new_region_id = ::std::option::Option::Some(v); + } + + pub fn get_new_region_id(&self) -> u64 { + self.new_region_id.unwrap_or(0) + } + + fn get_new_region_id_for_reflect(&self) -> &::std::option::Option { + &self.new_region_id + } + + fn mut_new_region_id_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.new_region_id + } + + // repeated uint64 new_peer_ids = 3; + + pub fn clear_new_peer_ids(&mut self) { + self.new_peer_ids.clear(); + } + + // Param is passed by value, moved + pub fn set_new_peer_ids(&mut self, v: ::std::vec::Vec) { + self.new_peer_ids = v; + } + + // Mutable pointer to the field. + pub fn mut_new_peer_ids(&mut self) -> &mut ::std::vec::Vec { + &mut self.new_peer_ids + } + + // Take field + pub fn take_new_peer_ids(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.new_peer_ids, ::std::vec::Vec::new()) + } + + pub fn get_new_peer_ids(&self) -> &[u64] { + &self.new_peer_ids + } + + fn get_new_peer_ids_for_reflect(&self) -> &::std::vec::Vec { + &self.new_peer_ids + } + + fn mut_new_peer_ids_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.new_peer_ids + } + + // optional bool right_derive = 4; + + pub fn clear_right_derive(&mut self) { + self.right_derive = ::std::option::Option::None; + } + + pub fn has_right_derive(&self) -> bool { + self.right_derive.is_some() + } + + // Param is passed by value, moved + pub fn set_right_derive(&mut self, v: bool) { + self.right_derive = ::std::option::Option::Some(v); + } + + pub fn get_right_derive(&self) -> bool { + self.right_derive.unwrap_or(false) + } + + fn get_right_derive_for_reflect(&self) -> &::std::option::Option { + &self.right_derive + } + + fn mut_right_derive_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.right_derive + } +} + +impl ::protobuf::Message for SplitRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.split_key)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.new_region_id = ::std::option::Option::Some(tmp); + }, + 3 => { + ::protobuf::rt::read_repeated_uint64_into(wire_type, is, &mut self.new_peer_ids)?; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.right_derive = ::std::option::Option::Some(tmp); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.split_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.new_region_id { + my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); + } + for value in &self.new_peer_ids { + my_size += ::protobuf::rt::value_size(3, *value, ::protobuf::wire_format::WireTypeVarint); + }; + if let Some(v) = self.right_derive { + my_size += 2; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.split_key.as_ref() { + os.write_bytes(1, &v)?; + } + if let Some(v) = self.new_region_id { + os.write_uint64(2, v)?; + } + for v in &self.new_peer_ids { + os.write_uint64(3, *v)?; + }; + if let Some(v) = self.right_derive { + os.write_bool(4, v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for SplitRequest { + fn new() -> SplitRequest { + SplitRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "split_key", + SplitRequest::get_split_key_for_reflect, + SplitRequest::mut_split_key_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "new_region_id", + SplitRequest::get_new_region_id_for_reflect, + SplitRequest::mut_new_region_id_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "new_peer_ids", + SplitRequest::get_new_peer_ids_for_reflect, + SplitRequest::mut_new_peer_ids_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "right_derive", + SplitRequest::get_right_derive_for_reflect, + SplitRequest::mut_right_derive_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "SplitRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for SplitRequest { + fn clear(&mut self) { + self.clear_split_key(); + self.clear_new_region_id(); + self.clear_new_peer_ids(); + self.clear_right_derive(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for SplitRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SplitRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct SplitResponse { + // message fields + left: ::protobuf::SingularPtrField, + right: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for SplitResponse {} + +impl SplitResponse { + pub fn new() -> SplitResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static SplitResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const SplitResponse, + }; + unsafe { + instance.get(SplitResponse::new) + } + } + + // optional .metapb.Region left = 1; + + pub fn clear_left(&mut self) { + self.left.clear(); + } + + pub fn has_left(&self) -> bool { + self.left.is_some() + } + + // Param is passed by value, moved + pub fn set_left(&mut self, v: super::metapb::Region) { + self.left = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_left(&mut self) -> &mut super::metapb::Region { + if self.left.is_none() { + self.left.set_default(); + } + self.left.as_mut().unwrap() + } + + // Take field + pub fn take_left(&mut self) -> super::metapb::Region { + self.left.take().unwrap_or_else(|| super::metapb::Region::new()) + } + + pub fn get_left(&self) -> &super::metapb::Region { + self.left.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) + } + + fn get_left_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.left + } + + fn mut_left_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.left + } + + // optional .metapb.Region right = 2; + + pub fn clear_right(&mut self) { + self.right.clear(); + } + + pub fn has_right(&self) -> bool { + self.right.is_some() + } + + // Param is passed by value, moved + pub fn set_right(&mut self, v: super::metapb::Region) { + self.right = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_right(&mut self) -> &mut super::metapb::Region { + if self.right.is_none() { + self.right.set_default(); + } + self.right.as_mut().unwrap() + } + + // Take field + pub fn take_right(&mut self) -> super::metapb::Region { + self.right.take().unwrap_or_else(|| super::metapb::Region::new()) + } + + pub fn get_right(&self) -> &super::metapb::Region { + self.right.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) + } + + fn get_right_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.right + } + + fn mut_right_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.right + } +} + +impl ::protobuf::Message for SplitResponse { + fn is_initialized(&self) -> bool { + for v in &self.left { + if !v.is_initialized() { + return false; + } + }; + for v in &self.right { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.left)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.right)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.left.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.right.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.left.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.right.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for SplitResponse { + fn new() -> SplitResponse { + SplitResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "left", + SplitResponse::get_left_for_reflect, + SplitResponse::mut_left_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "right", + SplitResponse::get_right_for_reflect, + SplitResponse::mut_right_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "SplitResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for SplitResponse { + fn clear(&mut self) { + self.clear_left(); + self.clear_right(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for SplitResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SplitResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct CompactLogRequest { + // message fields + compact_index: ::std::option::Option, + compact_term: ::std::option::Option, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for CompactLogRequest {} + +impl CompactLogRequest { + pub fn new() -> CompactLogRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static CompactLogRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const CompactLogRequest, + }; + unsafe { + instance.get(CompactLogRequest::new) + } + } + + // optional uint64 compact_index = 1; + + pub fn clear_compact_index(&mut self) { + self.compact_index = ::std::option::Option::None; + } + + pub fn has_compact_index(&self) -> bool { + self.compact_index.is_some() + } + + // Param is passed by value, moved + pub fn set_compact_index(&mut self, v: u64) { + self.compact_index = ::std::option::Option::Some(v); + } + + pub fn get_compact_index(&self) -> u64 { + self.compact_index.unwrap_or(0) + } + + fn get_compact_index_for_reflect(&self) -> &::std::option::Option { + &self.compact_index + } + + fn mut_compact_index_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.compact_index + } + + // optional uint64 compact_term = 2; + + pub fn clear_compact_term(&mut self) { + self.compact_term = ::std::option::Option::None; + } + + pub fn has_compact_term(&self) -> bool { + self.compact_term.is_some() + } + + // Param is passed by value, moved + pub fn set_compact_term(&mut self, v: u64) { + self.compact_term = ::std::option::Option::Some(v); + } + + pub fn get_compact_term(&self) -> u64 { + self.compact_term.unwrap_or(0) + } + + fn get_compact_term_for_reflect(&self) -> &::std::option::Option { + &self.compact_term + } + + fn mut_compact_term_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.compact_term + } +} + +impl ::protobuf::Message for CompactLogRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.compact_index = ::std::option::Option::Some(tmp); + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.compact_term = ::std::option::Option::Some(tmp); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.compact_index { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.compact_term { + my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.compact_index { + os.write_uint64(1, v)?; + } + if let Some(v) = self.compact_term { + os.write_uint64(2, v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for CompactLogRequest { + fn new() -> CompactLogRequest { + CompactLogRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "compact_index", + CompactLogRequest::get_compact_index_for_reflect, + CompactLogRequest::mut_compact_index_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "compact_term", + CompactLogRequest::get_compact_term_for_reflect, + CompactLogRequest::mut_compact_term_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "CompactLogRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for CompactLogRequest { + fn clear(&mut self) { + self.clear_compact_index(); + self.clear_compact_term(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for CompactLogRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CompactLogRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct CompactLogResponse { + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for CompactLogResponse {} + +impl CompactLogResponse { + pub fn new() -> CompactLogResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static CompactLogResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const CompactLogResponse, + }; + unsafe { + instance.get(CompactLogResponse::new) + } + } +} + +impl ::protobuf::Message for CompactLogResponse { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for CompactLogResponse { + fn new() -> CompactLogResponse { + CompactLogResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let fields = ::std::vec::Vec::new(); + ::protobuf::reflect::MessageDescriptor::new::( + "CompactLogResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for CompactLogResponse { + fn clear(&mut self) { + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for CompactLogResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CompactLogResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct TransferLeaderRequest { + // message fields + peer: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for TransferLeaderRequest {} + +impl TransferLeaderRequest { + pub fn new() -> TransferLeaderRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static TransferLeaderRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const TransferLeaderRequest, + }; + unsafe { + instance.get(TransferLeaderRequest::new) + } + } + + // optional .metapb.Peer peer = 1; + + pub fn clear_peer(&mut self) { + self.peer.clear(); + } + + pub fn has_peer(&self) -> bool { + self.peer.is_some() + } + + // Param is passed by value, moved + pub fn set_peer(&mut self, v: super::metapb::Peer) { + self.peer = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_peer(&mut self) -> &mut super::metapb::Peer { + if self.peer.is_none() { + self.peer.set_default(); + } + self.peer.as_mut().unwrap() + } + + // Take field + pub fn take_peer(&mut self) -> super::metapb::Peer { + self.peer.take().unwrap_or_else(|| super::metapb::Peer::new()) + } + + pub fn get_peer(&self) -> &super::metapb::Peer { + self.peer.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) + } + + fn get_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.peer + } + + fn mut_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.peer + } +} + +impl ::protobuf::Message for TransferLeaderRequest { + fn is_initialized(&self) -> bool { + for v in &self.peer { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.peer)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.peer.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.peer.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for TransferLeaderRequest { + fn new() -> TransferLeaderRequest { + TransferLeaderRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "peer", + TransferLeaderRequest::get_peer_for_reflect, + TransferLeaderRequest::mut_peer_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "TransferLeaderRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for TransferLeaderRequest { + fn clear(&mut self) { + self.clear_peer(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for TransferLeaderRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TransferLeaderRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct TransferLeaderResponse { + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for TransferLeaderResponse {} + +impl TransferLeaderResponse { + pub fn new() -> TransferLeaderResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static TransferLeaderResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const TransferLeaderResponse, + }; + unsafe { + instance.get(TransferLeaderResponse::new) + } + } +} + +impl ::protobuf::Message for TransferLeaderResponse { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for TransferLeaderResponse { + fn new() -> TransferLeaderResponse { + TransferLeaderResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let fields = ::std::vec::Vec::new(); + ::protobuf::reflect::MessageDescriptor::new::( + "TransferLeaderResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for TransferLeaderResponse { + fn clear(&mut self) { + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for TransferLeaderResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TransferLeaderResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct VerifyHashRequest { + // message fields + index: ::std::option::Option, + hash: ::protobuf::SingularField<::std::vec::Vec>, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for VerifyHashRequest {} + +impl VerifyHashRequest { + pub fn new() -> VerifyHashRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static VerifyHashRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const VerifyHashRequest, + }; + unsafe { + instance.get(VerifyHashRequest::new) + } + } + + // optional uint64 index = 1; + + pub fn clear_index(&mut self) { + self.index = ::std::option::Option::None; + } + + pub fn has_index(&self) -> bool { + self.index.is_some() + } + + // Param is passed by value, moved + pub fn set_index(&mut self, v: u64) { + self.index = ::std::option::Option::Some(v); + } + + pub fn get_index(&self) -> u64 { + self.index.unwrap_or(0) + } + + fn get_index_for_reflect(&self) -> &::std::option::Option { + &self.index + } + + fn mut_index_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.index + } + + // optional bytes hash = 2; + + pub fn clear_hash(&mut self) { + self.hash.clear(); + } + + pub fn has_hash(&self) -> bool { + self.hash.is_some() + } + + // Param is passed by value, moved + pub fn set_hash(&mut self, v: ::std::vec::Vec) { + self.hash = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_hash(&mut self) -> &mut ::std::vec::Vec { + if self.hash.is_none() { + self.hash.set_default(); + } + self.hash.as_mut().unwrap() + } + + // Take field + pub fn take_hash(&mut self) -> ::std::vec::Vec { + self.hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub fn get_hash(&self) -> &[u8] { + match self.hash.as_ref() { + Some(v) => &v, + None => &[], + } + } + + fn get_hash_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { + &self.hash + } + + fn mut_hash_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { + &mut self.hash + } +} + +impl ::protobuf::Message for VerifyHashRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.index = ::std::option::Option::Some(tmp); + }, + 2 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.hash)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.index { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.hash.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.index { + os.write_uint64(1, v)?; + } + if let Some(ref v) = self.hash.as_ref() { + os.write_bytes(2, &v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for VerifyHashRequest { + fn new() -> VerifyHashRequest { + VerifyHashRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "index", + VerifyHashRequest::get_index_for_reflect, + VerifyHashRequest::mut_index_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "hash", + VerifyHashRequest::get_hash_for_reflect, + VerifyHashRequest::mut_hash_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "VerifyHashRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for VerifyHashRequest { + fn clear(&mut self) { + self.clear_index(); + self.clear_hash(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for VerifyHashRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for VerifyHashRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct VerifyHashResponse { + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for VerifyHashResponse {} + +impl VerifyHashResponse { + pub fn new() -> VerifyHashResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static VerifyHashResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const VerifyHashResponse, + }; + unsafe { + instance.get(VerifyHashResponse::new) + } + } +} + +impl ::protobuf::Message for VerifyHashResponse { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for VerifyHashResponse { + fn new() -> VerifyHashResponse { + VerifyHashResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let fields = ::std::vec::Vec::new(); + ::protobuf::reflect::MessageDescriptor::new::( + "VerifyHashResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for VerifyHashResponse { + fn clear(&mut self) { + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for VerifyHashResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for VerifyHashResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct AdminRequest { + // message fields + cmd_type: ::std::option::Option, + change_peer: ::protobuf::SingularPtrField, + split: ::protobuf::SingularPtrField, + compact_log: ::protobuf::SingularPtrField, + transfer_leader: ::protobuf::SingularPtrField, + verify_hash: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for AdminRequest {} + +impl AdminRequest { + pub fn new() -> AdminRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static AdminRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const AdminRequest, + }; + unsafe { + instance.get(AdminRequest::new) + } + } + + // optional .raft_cmdpb.AdminCmdType cmd_type = 1; + + pub fn clear_cmd_type(&mut self) { + self.cmd_type = ::std::option::Option::None; + } + + pub fn has_cmd_type(&self) -> bool { + self.cmd_type.is_some() + } + + // Param is passed by value, moved + pub fn set_cmd_type(&mut self, v: AdminCmdType) { + self.cmd_type = ::std::option::Option::Some(v); + } + + pub fn get_cmd_type(&self) -> AdminCmdType { + self.cmd_type.unwrap_or(AdminCmdType::InvalidAdmin) + } + + fn get_cmd_type_for_reflect(&self) -> &::std::option::Option { + &self.cmd_type + } + + fn mut_cmd_type_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.cmd_type + } + + // optional .raft_cmdpb.ChangePeerRequest change_peer = 2; + + pub fn clear_change_peer(&mut self) { + self.change_peer.clear(); + } + + pub fn has_change_peer(&self) -> bool { + self.change_peer.is_some() + } + + // Param is passed by value, moved + pub fn set_change_peer(&mut self, v: ChangePeerRequest) { + self.change_peer = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_change_peer(&mut self) -> &mut ChangePeerRequest { + if self.change_peer.is_none() { + self.change_peer.set_default(); + } + self.change_peer.as_mut().unwrap() + } + + // Take field + pub fn take_change_peer(&mut self) -> ChangePeerRequest { + self.change_peer.take().unwrap_or_else(|| ChangePeerRequest::new()) + } + + pub fn get_change_peer(&self) -> &ChangePeerRequest { + self.change_peer.as_ref().unwrap_or_else(|| ChangePeerRequest::default_instance()) + } + + fn get_change_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.change_peer + } + + fn mut_change_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.change_peer + } + + // optional .raft_cmdpb.SplitRequest split = 3; + + pub fn clear_split(&mut self) { + self.split.clear(); + } + + pub fn has_split(&self) -> bool { + self.split.is_some() + } + + // Param is passed by value, moved + pub fn set_split(&mut self, v: SplitRequest) { + self.split = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_split(&mut self) -> &mut SplitRequest { + if self.split.is_none() { + self.split.set_default(); + } + self.split.as_mut().unwrap() + } + + // Take field + pub fn take_split(&mut self) -> SplitRequest { + self.split.take().unwrap_or_else(|| SplitRequest::new()) + } + + pub fn get_split(&self) -> &SplitRequest { + self.split.as_ref().unwrap_or_else(|| SplitRequest::default_instance()) + } + + fn get_split_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.split + } + + fn mut_split_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.split + } + + // optional .raft_cmdpb.CompactLogRequest compact_log = 4; + + pub fn clear_compact_log(&mut self) { + self.compact_log.clear(); + } + + pub fn has_compact_log(&self) -> bool { + self.compact_log.is_some() + } + + // Param is passed by value, moved + pub fn set_compact_log(&mut self, v: CompactLogRequest) { + self.compact_log = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_compact_log(&mut self) -> &mut CompactLogRequest { + if self.compact_log.is_none() { + self.compact_log.set_default(); + } + self.compact_log.as_mut().unwrap() + } + + // Take field + pub fn take_compact_log(&mut self) -> CompactLogRequest { + self.compact_log.take().unwrap_or_else(|| CompactLogRequest::new()) + } + + pub fn get_compact_log(&self) -> &CompactLogRequest { + self.compact_log.as_ref().unwrap_or_else(|| CompactLogRequest::default_instance()) + } + + fn get_compact_log_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.compact_log + } + + fn mut_compact_log_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.compact_log + } + + // optional .raft_cmdpb.TransferLeaderRequest transfer_leader = 5; + + pub fn clear_transfer_leader(&mut self) { + self.transfer_leader.clear(); + } + + pub fn has_transfer_leader(&self) -> bool { + self.transfer_leader.is_some() + } + + // Param is passed by value, moved + pub fn set_transfer_leader(&mut self, v: TransferLeaderRequest) { + self.transfer_leader = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_transfer_leader(&mut self) -> &mut TransferLeaderRequest { + if self.transfer_leader.is_none() { + self.transfer_leader.set_default(); + } + self.transfer_leader.as_mut().unwrap() + } + + // Take field + pub fn take_transfer_leader(&mut self) -> TransferLeaderRequest { + self.transfer_leader.take().unwrap_or_else(|| TransferLeaderRequest::new()) + } + + pub fn get_transfer_leader(&self) -> &TransferLeaderRequest { + self.transfer_leader.as_ref().unwrap_or_else(|| TransferLeaderRequest::default_instance()) + } + + fn get_transfer_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.transfer_leader + } + + fn mut_transfer_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.transfer_leader + } + + // optional .raft_cmdpb.VerifyHashRequest verify_hash = 6; + + pub fn clear_verify_hash(&mut self) { + self.verify_hash.clear(); + } + + pub fn has_verify_hash(&self) -> bool { + self.verify_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_verify_hash(&mut self, v: VerifyHashRequest) { + self.verify_hash = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_verify_hash(&mut self) -> &mut VerifyHashRequest { + if self.verify_hash.is_none() { + self.verify_hash.set_default(); + } + self.verify_hash.as_mut().unwrap() + } + + // Take field + pub fn take_verify_hash(&mut self) -> VerifyHashRequest { + self.verify_hash.take().unwrap_or_else(|| VerifyHashRequest::new()) + } + + pub fn get_verify_hash(&self) -> &VerifyHashRequest { + self.verify_hash.as_ref().unwrap_or_else(|| VerifyHashRequest::default_instance()) + } + + fn get_verify_hash_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.verify_hash + } + + fn mut_verify_hash_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.verify_hash + } +} + +impl ::protobuf::Message for AdminRequest { + fn is_initialized(&self) -> bool { + for v in &self.change_peer { + if !v.is_initialized() { + return false; + } + }; + for v in &self.split { + if !v.is_initialized() { + return false; + } + }; + for v in &self.compact_log { + if !v.is_initialized() { + return false; + } + }; + for v in &self.transfer_leader { + if !v.is_initialized() { + return false; + } + }; + for v in &self.verify_hash { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_enum()?; + self.cmd_type = ::std::option::Option::Some(tmp); + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.change_peer)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.split)?; + }, + 4 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.compact_log)?; + }, + 5 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.transfer_leader)?; + }, + 6 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.verify_hash)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.cmd_type { + my_size += ::protobuf::rt::enum_size(1, v); + } + if let Some(ref v) = self.change_peer.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.split.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.compact_log.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.transfer_leader.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.verify_hash.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.cmd_type { + os.write_enum(1, v.value())?; + } + if let Some(ref v) = self.change_peer.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.split.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.compact_log.as_ref() { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.transfer_leader.as_ref() { + os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.verify_hash.as_ref() { + os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for AdminRequest { + fn new() -> AdminRequest { + AdminRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "cmd_type", + AdminRequest::get_cmd_type_for_reflect, + AdminRequest::mut_cmd_type_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "change_peer", + AdminRequest::get_change_peer_for_reflect, + AdminRequest::mut_change_peer_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "split", + AdminRequest::get_split_for_reflect, + AdminRequest::mut_split_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "compact_log", + AdminRequest::get_compact_log_for_reflect, + AdminRequest::mut_compact_log_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "transfer_leader", + AdminRequest::get_transfer_leader_for_reflect, + AdminRequest::mut_transfer_leader_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "verify_hash", + AdminRequest::get_verify_hash_for_reflect, + AdminRequest::mut_verify_hash_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "AdminRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for AdminRequest { + fn clear(&mut self) { + self.clear_cmd_type(); + self.clear_change_peer(); + self.clear_split(); + self.clear_compact_log(); + self.clear_transfer_leader(); + self.clear_verify_hash(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for AdminRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for AdminRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct AdminResponse { + // message fields + cmd_type: ::std::option::Option, + change_peer: ::protobuf::SingularPtrField, + split: ::protobuf::SingularPtrField, + compact_log: ::protobuf::SingularPtrField, + transfer_leader: ::protobuf::SingularPtrField, + verify_hash: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for AdminResponse {} + +impl AdminResponse { + pub fn new() -> AdminResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static AdminResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const AdminResponse, + }; + unsafe { + instance.get(AdminResponse::new) + } + } + + // optional .raft_cmdpb.AdminCmdType cmd_type = 1; + + pub fn clear_cmd_type(&mut self) { + self.cmd_type = ::std::option::Option::None; + } + + pub fn has_cmd_type(&self) -> bool { + self.cmd_type.is_some() + } + + // Param is passed by value, moved + pub fn set_cmd_type(&mut self, v: AdminCmdType) { + self.cmd_type = ::std::option::Option::Some(v); + } + + pub fn get_cmd_type(&self) -> AdminCmdType { + self.cmd_type.unwrap_or(AdminCmdType::InvalidAdmin) + } + + fn get_cmd_type_for_reflect(&self) -> &::std::option::Option { + &self.cmd_type + } + + fn mut_cmd_type_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.cmd_type + } + + // optional .raft_cmdpb.ChangePeerResponse change_peer = 2; + + pub fn clear_change_peer(&mut self) { + self.change_peer.clear(); + } + + pub fn has_change_peer(&self) -> bool { + self.change_peer.is_some() + } + + // Param is passed by value, moved + pub fn set_change_peer(&mut self, v: ChangePeerResponse) { + self.change_peer = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_change_peer(&mut self) -> &mut ChangePeerResponse { + if self.change_peer.is_none() { + self.change_peer.set_default(); + } + self.change_peer.as_mut().unwrap() + } + + // Take field + pub fn take_change_peer(&mut self) -> ChangePeerResponse { + self.change_peer.take().unwrap_or_else(|| ChangePeerResponse::new()) + } + + pub fn get_change_peer(&self) -> &ChangePeerResponse { + self.change_peer.as_ref().unwrap_or_else(|| ChangePeerResponse::default_instance()) + } + + fn get_change_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.change_peer + } + + fn mut_change_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.change_peer + } + + // optional .raft_cmdpb.SplitResponse split = 3; + + pub fn clear_split(&mut self) { + self.split.clear(); + } + + pub fn has_split(&self) -> bool { + self.split.is_some() + } + + // Param is passed by value, moved + pub fn set_split(&mut self, v: SplitResponse) { + self.split = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_split(&mut self) -> &mut SplitResponse { + if self.split.is_none() { + self.split.set_default(); + } + self.split.as_mut().unwrap() + } + + // Take field + pub fn take_split(&mut self) -> SplitResponse { + self.split.take().unwrap_or_else(|| SplitResponse::new()) + } + + pub fn get_split(&self) -> &SplitResponse { + self.split.as_ref().unwrap_or_else(|| SplitResponse::default_instance()) + } + + fn get_split_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.split + } + + fn mut_split_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.split + } + + // optional .raft_cmdpb.CompactLogResponse compact_log = 4; + + pub fn clear_compact_log(&mut self) { + self.compact_log.clear(); + } + + pub fn has_compact_log(&self) -> bool { + self.compact_log.is_some() + } + + // Param is passed by value, moved + pub fn set_compact_log(&mut self, v: CompactLogResponse) { + self.compact_log = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_compact_log(&mut self) -> &mut CompactLogResponse { + if self.compact_log.is_none() { + self.compact_log.set_default(); + } + self.compact_log.as_mut().unwrap() + } + + // Take field + pub fn take_compact_log(&mut self) -> CompactLogResponse { + self.compact_log.take().unwrap_or_else(|| CompactLogResponse::new()) + } + + pub fn get_compact_log(&self) -> &CompactLogResponse { + self.compact_log.as_ref().unwrap_or_else(|| CompactLogResponse::default_instance()) + } + + fn get_compact_log_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.compact_log + } + + fn mut_compact_log_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.compact_log + } + + // optional .raft_cmdpb.TransferLeaderResponse transfer_leader = 5; + + pub fn clear_transfer_leader(&mut self) { + self.transfer_leader.clear(); + } + + pub fn has_transfer_leader(&self) -> bool { + self.transfer_leader.is_some() + } + + // Param is passed by value, moved + pub fn set_transfer_leader(&mut self, v: TransferLeaderResponse) { + self.transfer_leader = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_transfer_leader(&mut self) -> &mut TransferLeaderResponse { + if self.transfer_leader.is_none() { + self.transfer_leader.set_default(); + } + self.transfer_leader.as_mut().unwrap() + } + + // Take field + pub fn take_transfer_leader(&mut self) -> TransferLeaderResponse { + self.transfer_leader.take().unwrap_or_else(|| TransferLeaderResponse::new()) + } + + pub fn get_transfer_leader(&self) -> &TransferLeaderResponse { + self.transfer_leader.as_ref().unwrap_or_else(|| TransferLeaderResponse::default_instance()) + } + + fn get_transfer_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.transfer_leader + } + + fn mut_transfer_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.transfer_leader + } + + // optional .raft_cmdpb.VerifyHashResponse verify_hash = 6; + + pub fn clear_verify_hash(&mut self) { + self.verify_hash.clear(); + } + + pub fn has_verify_hash(&self) -> bool { + self.verify_hash.is_some() + } + + // Param is passed by value, moved + pub fn set_verify_hash(&mut self, v: VerifyHashResponse) { + self.verify_hash = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_verify_hash(&mut self) -> &mut VerifyHashResponse { + if self.verify_hash.is_none() { + self.verify_hash.set_default(); + } + self.verify_hash.as_mut().unwrap() + } + + // Take field + pub fn take_verify_hash(&mut self) -> VerifyHashResponse { + self.verify_hash.take().unwrap_or_else(|| VerifyHashResponse::new()) + } + + pub fn get_verify_hash(&self) -> &VerifyHashResponse { + self.verify_hash.as_ref().unwrap_or_else(|| VerifyHashResponse::default_instance()) + } + + fn get_verify_hash_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.verify_hash + } + + fn mut_verify_hash_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.verify_hash + } +} + +impl ::protobuf::Message for AdminResponse { + fn is_initialized(&self) -> bool { + for v in &self.change_peer { + if !v.is_initialized() { + return false; + } + }; + for v in &self.split { + if !v.is_initialized() { + return false; + } + }; + for v in &self.compact_log { + if !v.is_initialized() { + return false; + } + }; + for v in &self.transfer_leader { + if !v.is_initialized() { + return false; + } + }; + for v in &self.verify_hash { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_enum()?; + self.cmd_type = ::std::option::Option::Some(tmp); + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.change_peer)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.split)?; + }, + 4 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.compact_log)?; + }, + 5 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.transfer_leader)?; + }, + 6 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.verify_hash)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.cmd_type { + my_size += ::protobuf::rt::enum_size(1, v); + } + if let Some(ref v) = self.change_peer.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.split.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.compact_log.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.transfer_leader.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.verify_hash.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.cmd_type { + os.write_enum(1, v.value())?; + } + if let Some(ref v) = self.change_peer.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.split.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.compact_log.as_ref() { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.transfer_leader.as_ref() { + os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.verify_hash.as_ref() { + os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for AdminResponse { + fn new() -> AdminResponse { + AdminResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "cmd_type", + AdminResponse::get_cmd_type_for_reflect, + AdminResponse::mut_cmd_type_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "change_peer", + AdminResponse::get_change_peer_for_reflect, + AdminResponse::mut_change_peer_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "split", + AdminResponse::get_split_for_reflect, + AdminResponse::mut_split_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "compact_log", + AdminResponse::get_compact_log_for_reflect, + AdminResponse::mut_compact_log_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "transfer_leader", + AdminResponse::get_transfer_leader_for_reflect, + AdminResponse::mut_transfer_leader_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "verify_hash", + AdminResponse::get_verify_hash_for_reflect, + AdminResponse::mut_verify_hash_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "AdminResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for AdminResponse { + fn clear(&mut self) { + self.clear_cmd_type(); + self.clear_change_peer(); + self.clear_split(); + self.clear_compact_log(); + self.clear_transfer_leader(); + self.clear_verify_hash(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for AdminResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for AdminResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RegionLeaderRequest { + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RegionLeaderRequest {} + +impl RegionLeaderRequest { + pub fn new() -> RegionLeaderRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RegionLeaderRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RegionLeaderRequest, + }; + unsafe { + instance.get(RegionLeaderRequest::new) + } + } +} + +impl ::protobuf::Message for RegionLeaderRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RegionLeaderRequest { + fn new() -> RegionLeaderRequest { + RegionLeaderRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let fields = ::std::vec::Vec::new(); + ::protobuf::reflect::MessageDescriptor::new::( + "RegionLeaderRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RegionLeaderRequest { + fn clear(&mut self) { + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RegionLeaderRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RegionLeaderRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RegionLeaderResponse { + // message fields + leader: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RegionLeaderResponse {} + +impl RegionLeaderResponse { + pub fn new() -> RegionLeaderResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RegionLeaderResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RegionLeaderResponse, + }; + unsafe { + instance.get(RegionLeaderResponse::new) + } + } + + // optional .metapb.Peer leader = 1; + + pub fn clear_leader(&mut self) { + self.leader.clear(); + } + + pub fn has_leader(&self) -> bool { + self.leader.is_some() + } + + // Param is passed by value, moved + pub fn set_leader(&mut self, v: super::metapb::Peer) { + self.leader = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_leader(&mut self) -> &mut super::metapb::Peer { + if self.leader.is_none() { + self.leader.set_default(); + } + self.leader.as_mut().unwrap() + } + + // Take field + pub fn take_leader(&mut self) -> super::metapb::Peer { + self.leader.take().unwrap_or_else(|| super::metapb::Peer::new()) + } + + pub fn get_leader(&self) -> &super::metapb::Peer { + self.leader.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) + } + + fn get_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.leader + } + + fn mut_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.leader + } +} + +impl ::protobuf::Message for RegionLeaderResponse { + fn is_initialized(&self) -> bool { + for v in &self.leader { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.leader)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.leader.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.leader.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RegionLeaderResponse { + fn new() -> RegionLeaderResponse { + RegionLeaderResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "leader", + RegionLeaderResponse::get_leader_for_reflect, + RegionLeaderResponse::mut_leader_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RegionLeaderResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RegionLeaderResponse { + fn clear(&mut self) { + self.clear_leader(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RegionLeaderResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RegionLeaderResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RegionDetailRequest { + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RegionDetailRequest {} + +impl RegionDetailRequest { + pub fn new() -> RegionDetailRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RegionDetailRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RegionDetailRequest, + }; + unsafe { + instance.get(RegionDetailRequest::new) + } + } +} + +impl ::protobuf::Message for RegionDetailRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RegionDetailRequest { + fn new() -> RegionDetailRequest { + RegionDetailRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let fields = ::std::vec::Vec::new(); + ::protobuf::reflect::MessageDescriptor::new::( + "RegionDetailRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RegionDetailRequest { + fn clear(&mut self) { + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RegionDetailRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RegionDetailRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RegionDetailResponse { + // message fields + region: ::protobuf::SingularPtrField, + leader: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RegionDetailResponse {} + +impl RegionDetailResponse { + pub fn new() -> RegionDetailResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RegionDetailResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RegionDetailResponse, + }; + unsafe { + instance.get(RegionDetailResponse::new) + } + } + + // optional .metapb.Region region = 1; + + pub fn clear_region(&mut self) { + self.region.clear(); + } + + pub fn has_region(&self) -> bool { + self.region.is_some() + } + + // Param is passed by value, moved + pub fn set_region(&mut self, v: super::metapb::Region) { + self.region = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region(&mut self) -> &mut super::metapb::Region { + if self.region.is_none() { + self.region.set_default(); + } + self.region.as_mut().unwrap() + } + + // Take field + pub fn take_region(&mut self) -> super::metapb::Region { + self.region.take().unwrap_or_else(|| super::metapb::Region::new()) + } + + pub fn get_region(&self) -> &super::metapb::Region { + self.region.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) + } + + fn get_region_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region + } + + fn mut_region_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region + } + + // optional .metapb.Peer leader = 2; + + pub fn clear_leader(&mut self) { + self.leader.clear(); + } + + pub fn has_leader(&self) -> bool { + self.leader.is_some() + } + + // Param is passed by value, moved + pub fn set_leader(&mut self, v: super::metapb::Peer) { + self.leader = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_leader(&mut self) -> &mut super::metapb::Peer { + if self.leader.is_none() { + self.leader.set_default(); + } + self.leader.as_mut().unwrap() + } + + // Take field + pub fn take_leader(&mut self) -> super::metapb::Peer { + self.leader.take().unwrap_or_else(|| super::metapb::Peer::new()) + } + + pub fn get_leader(&self) -> &super::metapb::Peer { + self.leader.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) + } + + fn get_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.leader + } + + fn mut_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.leader + } +} + +impl ::protobuf::Message for RegionDetailResponse { + fn is_initialized(&self) -> bool { + for v in &self.region { + if !v.is_initialized() { + return false; + } + }; + for v in &self.leader { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.leader)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.region.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.leader.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.region.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.leader.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RegionDetailResponse { + fn new() -> RegionDetailResponse { + RegionDetailResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region", + RegionDetailResponse::get_region_for_reflect, + RegionDetailResponse::mut_region_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "leader", + RegionDetailResponse::get_leader_for_reflect, + RegionDetailResponse::mut_leader_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RegionDetailResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RegionDetailResponse { + fn clear(&mut self) { + self.clear_region(); + self.clear_leader(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RegionDetailResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RegionDetailResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct StatusRequest { + // message fields + cmd_type: ::std::option::Option, + region_leader: ::protobuf::SingularPtrField, + region_detail: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for StatusRequest {} + +impl StatusRequest { + pub fn new() -> StatusRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static StatusRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const StatusRequest, + }; + unsafe { + instance.get(StatusRequest::new) + } + } + + // optional .raft_cmdpb.StatusCmdType cmd_type = 1; + + pub fn clear_cmd_type(&mut self) { + self.cmd_type = ::std::option::Option::None; + } + + pub fn has_cmd_type(&self) -> bool { + self.cmd_type.is_some() + } + + // Param is passed by value, moved + pub fn set_cmd_type(&mut self, v: StatusCmdType) { + self.cmd_type = ::std::option::Option::Some(v); + } + + pub fn get_cmd_type(&self) -> StatusCmdType { + self.cmd_type.unwrap_or(StatusCmdType::InvalidStatus) + } + + fn get_cmd_type_for_reflect(&self) -> &::std::option::Option { + &self.cmd_type + } + + fn mut_cmd_type_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.cmd_type + } + + // optional .raft_cmdpb.RegionLeaderRequest region_leader = 2; + + pub fn clear_region_leader(&mut self) { + self.region_leader.clear(); + } + + pub fn has_region_leader(&self) -> bool { + self.region_leader.is_some() + } + + // Param is passed by value, moved + pub fn set_region_leader(&mut self, v: RegionLeaderRequest) { + self.region_leader = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_leader(&mut self) -> &mut RegionLeaderRequest { + if self.region_leader.is_none() { + self.region_leader.set_default(); + } + self.region_leader.as_mut().unwrap() + } + + // Take field + pub fn take_region_leader(&mut self) -> RegionLeaderRequest { + self.region_leader.take().unwrap_or_else(|| RegionLeaderRequest::new()) + } + + pub fn get_region_leader(&self) -> &RegionLeaderRequest { + self.region_leader.as_ref().unwrap_or_else(|| RegionLeaderRequest::default_instance()) + } + + fn get_region_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_leader + } + + fn mut_region_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_leader + } + + // optional .raft_cmdpb.RegionDetailRequest region_detail = 3; + + pub fn clear_region_detail(&mut self) { + self.region_detail.clear(); + } + + pub fn has_region_detail(&self) -> bool { + self.region_detail.is_some() + } + + // Param is passed by value, moved + pub fn set_region_detail(&mut self, v: RegionDetailRequest) { + self.region_detail = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_detail(&mut self) -> &mut RegionDetailRequest { + if self.region_detail.is_none() { + self.region_detail.set_default(); + } + self.region_detail.as_mut().unwrap() + } + + // Take field + pub fn take_region_detail(&mut self) -> RegionDetailRequest { + self.region_detail.take().unwrap_or_else(|| RegionDetailRequest::new()) + } + + pub fn get_region_detail(&self) -> &RegionDetailRequest { + self.region_detail.as_ref().unwrap_or_else(|| RegionDetailRequest::default_instance()) + } + + fn get_region_detail_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_detail + } + + fn mut_region_detail_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_detail + } +} + +impl ::protobuf::Message for StatusRequest { + fn is_initialized(&self) -> bool { + for v in &self.region_leader { + if !v.is_initialized() { + return false; + } + }; + for v in &self.region_detail { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_enum()?; + self.cmd_type = ::std::option::Option::Some(tmp); + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_leader)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_detail)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.cmd_type { + my_size += ::protobuf::rt::enum_size(1, v); + } + if let Some(ref v) = self.region_leader.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.region_detail.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.cmd_type { + os.write_enum(1, v.value())?; + } + if let Some(ref v) = self.region_leader.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.region_detail.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for StatusRequest { + fn new() -> StatusRequest { + StatusRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "cmd_type", + StatusRequest::get_cmd_type_for_reflect, + StatusRequest::mut_cmd_type_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_leader", + StatusRequest::get_region_leader_for_reflect, + StatusRequest::mut_region_leader_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_detail", + StatusRequest::get_region_detail_for_reflect, + StatusRequest::mut_region_detail_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "StatusRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for StatusRequest { + fn clear(&mut self) { + self.clear_cmd_type(); + self.clear_region_leader(); + self.clear_region_detail(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for StatusRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StatusRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct StatusResponse { + // message fields + cmd_type: ::std::option::Option, + region_leader: ::protobuf::SingularPtrField, + region_detail: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for StatusResponse {} + +impl StatusResponse { + pub fn new() -> StatusResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static StatusResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const StatusResponse, + }; + unsafe { + instance.get(StatusResponse::new) + } + } + + // optional .raft_cmdpb.StatusCmdType cmd_type = 1; + + pub fn clear_cmd_type(&mut self) { + self.cmd_type = ::std::option::Option::None; + } + + pub fn has_cmd_type(&self) -> bool { + self.cmd_type.is_some() + } + + // Param is passed by value, moved + pub fn set_cmd_type(&mut self, v: StatusCmdType) { + self.cmd_type = ::std::option::Option::Some(v); + } + + pub fn get_cmd_type(&self) -> StatusCmdType { + self.cmd_type.unwrap_or(StatusCmdType::InvalidStatus) + } + + fn get_cmd_type_for_reflect(&self) -> &::std::option::Option { + &self.cmd_type + } + + fn mut_cmd_type_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.cmd_type + } + + // optional .raft_cmdpb.RegionLeaderResponse region_leader = 2; + + pub fn clear_region_leader(&mut self) { + self.region_leader.clear(); + } + + pub fn has_region_leader(&self) -> bool { + self.region_leader.is_some() + } + + // Param is passed by value, moved + pub fn set_region_leader(&mut self, v: RegionLeaderResponse) { + self.region_leader = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_leader(&mut self) -> &mut RegionLeaderResponse { + if self.region_leader.is_none() { + self.region_leader.set_default(); + } + self.region_leader.as_mut().unwrap() + } + + // Take field + pub fn take_region_leader(&mut self) -> RegionLeaderResponse { + self.region_leader.take().unwrap_or_else(|| RegionLeaderResponse::new()) + } + + pub fn get_region_leader(&self) -> &RegionLeaderResponse { + self.region_leader.as_ref().unwrap_or_else(|| RegionLeaderResponse::default_instance()) + } + + fn get_region_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_leader + } + + fn mut_region_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_leader + } + + // optional .raft_cmdpb.RegionDetailResponse region_detail = 3; + + pub fn clear_region_detail(&mut self) { + self.region_detail.clear(); + } + + pub fn has_region_detail(&self) -> bool { + self.region_detail.is_some() + } + + // Param is passed by value, moved + pub fn set_region_detail(&mut self, v: RegionDetailResponse) { + self.region_detail = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_detail(&mut self) -> &mut RegionDetailResponse { + if self.region_detail.is_none() { + self.region_detail.set_default(); + } + self.region_detail.as_mut().unwrap() + } + + // Take field + pub fn take_region_detail(&mut self) -> RegionDetailResponse { + self.region_detail.take().unwrap_or_else(|| RegionDetailResponse::new()) + } + + pub fn get_region_detail(&self) -> &RegionDetailResponse { + self.region_detail.as_ref().unwrap_or_else(|| RegionDetailResponse::default_instance()) + } + + fn get_region_detail_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_detail + } + + fn mut_region_detail_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_detail + } +} + +impl ::protobuf::Message for StatusResponse { + fn is_initialized(&self) -> bool { + for v in &self.region_leader { + if !v.is_initialized() { + return false; + } + }; + for v in &self.region_detail { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_enum()?; + self.cmd_type = ::std::option::Option::Some(tmp); + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_leader)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_detail)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.cmd_type { + my_size += ::protobuf::rt::enum_size(1, v); + } + if let Some(ref v) = self.region_leader.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.region_detail.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.cmd_type { + os.write_enum(1, v.value())?; + } + if let Some(ref v) = self.region_leader.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.region_detail.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for StatusResponse { + fn new() -> StatusResponse { + StatusResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "cmd_type", + StatusResponse::get_cmd_type_for_reflect, + StatusResponse::mut_cmd_type_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_leader", + StatusResponse::get_region_leader_for_reflect, + StatusResponse::mut_region_leader_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_detail", + StatusResponse::get_region_detail_for_reflect, + StatusResponse::mut_region_detail_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "StatusResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for StatusResponse { + fn clear(&mut self) { + self.clear_cmd_type(); + self.clear_region_leader(); + self.clear_region_detail(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for StatusResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StatusResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RaftRequestHeader { + // message fields + region_id: ::std::option::Option, + peer: ::protobuf::SingularPtrField, + read_quorum: ::std::option::Option, + uuid: ::protobuf::SingularField<::std::vec::Vec>, + region_epoch: ::protobuf::SingularPtrField, + term: ::std::option::Option, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RaftRequestHeader {} + +impl RaftRequestHeader { + pub fn new() -> RaftRequestHeader { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RaftRequestHeader { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RaftRequestHeader, + }; + unsafe { + instance.get(RaftRequestHeader::new) + } + } + + // optional uint64 region_id = 1; + + pub fn clear_region_id(&mut self) { + self.region_id = ::std::option::Option::None; + } + + pub fn has_region_id(&self) -> bool { + self.region_id.is_some() + } + + // Param is passed by value, moved + pub fn set_region_id(&mut self, v: u64) { + self.region_id = ::std::option::Option::Some(v); + } + + pub fn get_region_id(&self) -> u64 { + self.region_id.unwrap_or(0) + } + + fn get_region_id_for_reflect(&self) -> &::std::option::Option { + &self.region_id + } + + fn mut_region_id_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.region_id + } + + // optional .metapb.Peer peer = 2; + + pub fn clear_peer(&mut self) { + self.peer.clear(); + } + + pub fn has_peer(&self) -> bool { + self.peer.is_some() + } + + // Param is passed by value, moved + pub fn set_peer(&mut self, v: super::metapb::Peer) { + self.peer = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_peer(&mut self) -> &mut super::metapb::Peer { + if self.peer.is_none() { + self.peer.set_default(); + } + self.peer.as_mut().unwrap() + } + + // Take field + pub fn take_peer(&mut self) -> super::metapb::Peer { + self.peer.take().unwrap_or_else(|| super::metapb::Peer::new()) + } + + pub fn get_peer(&self) -> &super::metapb::Peer { + self.peer.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) + } + + fn get_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.peer + } + + fn mut_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.peer + } + + // optional bool read_quorum = 3; + + pub fn clear_read_quorum(&mut self) { + self.read_quorum = ::std::option::Option::None; + } + + pub fn has_read_quorum(&self) -> bool { + self.read_quorum.is_some() + } + + // Param is passed by value, moved + pub fn set_read_quorum(&mut self, v: bool) { + self.read_quorum = ::std::option::Option::Some(v); + } + + pub fn get_read_quorum(&self) -> bool { + self.read_quorum.unwrap_or(false) + } + + fn get_read_quorum_for_reflect(&self) -> &::std::option::Option { + &self.read_quorum + } + + fn mut_read_quorum_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.read_quorum + } + + // optional bytes uuid = 4; + + pub fn clear_uuid(&mut self) { + self.uuid.clear(); + } + + pub fn has_uuid(&self) -> bool { + self.uuid.is_some() + } + + // Param is passed by value, moved + pub fn set_uuid(&mut self, v: ::std::vec::Vec) { + self.uuid = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_uuid(&mut self) -> &mut ::std::vec::Vec { + if self.uuid.is_none() { + self.uuid.set_default(); + } + self.uuid.as_mut().unwrap() + } + + // Take field + pub fn take_uuid(&mut self) -> ::std::vec::Vec { + self.uuid.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub fn get_uuid(&self) -> &[u8] { + match self.uuid.as_ref() { + Some(v) => &v, + None => &[], + } + } + + fn get_uuid_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { + &self.uuid + } + + fn mut_uuid_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { + &mut self.uuid + } + + // optional .metapb.RegionEpoch region_epoch = 5; + + pub fn clear_region_epoch(&mut self) { + self.region_epoch.clear(); + } + + pub fn has_region_epoch(&self) -> bool { + self.region_epoch.is_some() + } + + // Param is passed by value, moved + pub fn set_region_epoch(&mut self, v: super::metapb::RegionEpoch) { + self.region_epoch = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_epoch(&mut self) -> &mut super::metapb::RegionEpoch { + if self.region_epoch.is_none() { + self.region_epoch.set_default(); + } + self.region_epoch.as_mut().unwrap() + } + + // Take field + pub fn take_region_epoch(&mut self) -> super::metapb::RegionEpoch { + self.region_epoch.take().unwrap_or_else(|| super::metapb::RegionEpoch::new()) + } + + pub fn get_region_epoch(&self) -> &super::metapb::RegionEpoch { + self.region_epoch.as_ref().unwrap_or_else(|| super::metapb::RegionEpoch::default_instance()) + } + + fn get_region_epoch_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_epoch + } + + fn mut_region_epoch_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_epoch + } + + // optional uint64 term = 6; + + pub fn clear_term(&mut self) { + self.term = ::std::option::Option::None; + } + + pub fn has_term(&self) -> bool { + self.term.is_some() + } + + // Param is passed by value, moved + pub fn set_term(&mut self, v: u64) { + self.term = ::std::option::Option::Some(v); + } + + pub fn get_term(&self) -> u64 { + self.term.unwrap_or(0) + } + + fn get_term_for_reflect(&self) -> &::std::option::Option { + &self.term + } + + fn mut_term_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.term + } +} + +impl ::protobuf::Message for RaftRequestHeader { + fn is_initialized(&self) -> bool { + for v in &self.peer { + if !v.is_initialized() { + return false; + } + }; + for v in &self.region_epoch { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.region_id = ::std::option::Option::Some(tmp); + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.peer)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.read_quorum = ::std::option::Option::Some(tmp); + }, + 4 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.uuid)?; + }, + 5 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_epoch)?; + }, + 6 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.term = ::std::option::Option::Some(tmp); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(v) = self.region_id { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.peer.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(v) = self.read_quorum { + my_size += 2; + } + if let Some(ref v) = self.uuid.as_ref() { + my_size += ::protobuf::rt::bytes_size(4, &v); + } + if let Some(ref v) = self.region_epoch.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(v) = self.term { + my_size += ::protobuf::rt::value_size(6, v, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(v) = self.region_id { + os.write_uint64(1, v)?; + } + if let Some(ref v) = self.peer.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(v) = self.read_quorum { + os.write_bool(3, v)?; + } + if let Some(ref v) = self.uuid.as_ref() { + os.write_bytes(4, &v)?; + } + if let Some(ref v) = self.region_epoch.as_ref() { + os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(v) = self.term { + os.write_uint64(6, v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RaftRequestHeader { + fn new() -> RaftRequestHeader { + RaftRequestHeader::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "region_id", + RaftRequestHeader::get_region_id_for_reflect, + RaftRequestHeader::mut_region_id_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "peer", + RaftRequestHeader::get_peer_for_reflect, + RaftRequestHeader::mut_peer_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "read_quorum", + RaftRequestHeader::get_read_quorum_for_reflect, + RaftRequestHeader::mut_read_quorum_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "uuid", + RaftRequestHeader::get_uuid_for_reflect, + RaftRequestHeader::mut_uuid_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_epoch", + RaftRequestHeader::get_region_epoch_for_reflect, + RaftRequestHeader::mut_region_epoch_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "term", + RaftRequestHeader::get_term_for_reflect, + RaftRequestHeader::mut_term_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RaftRequestHeader", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RaftRequestHeader { + fn clear(&mut self) { + self.clear_region_id(); + self.clear_peer(); + self.clear_read_quorum(); + self.clear_uuid(); + self.clear_region_epoch(); + self.clear_term(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RaftRequestHeader { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RaftRequestHeader { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RaftResponseHeader { + // message fields + error: ::protobuf::SingularPtrField, + uuid: ::protobuf::SingularField<::std::vec::Vec>, + current_term: ::std::option::Option, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RaftResponseHeader {} + +impl RaftResponseHeader { + pub fn new() -> RaftResponseHeader { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RaftResponseHeader { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RaftResponseHeader, + }; + unsafe { + instance.get(RaftResponseHeader::new) + } + } + + // optional .errorpb.Error error = 1; + + pub fn clear_error(&mut self) { + self.error.clear(); + } + + pub fn has_error(&self) -> bool { + self.error.is_some() + } + + // Param is passed by value, moved + pub fn set_error(&mut self, v: super::errorpb::Error) { + self.error = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_error(&mut self) -> &mut super::errorpb::Error { + if self.error.is_none() { + self.error.set_default(); + } + self.error.as_mut().unwrap() + } + + // Take field + pub fn take_error(&mut self) -> super::errorpb::Error { + self.error.take().unwrap_or_else(|| super::errorpb::Error::new()) + } + + pub fn get_error(&self) -> &super::errorpb::Error { + self.error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) + } + + fn get_error_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.error + } + + fn mut_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.error + } + + // optional bytes uuid = 2; + + pub fn clear_uuid(&mut self) { + self.uuid.clear(); + } + + pub fn has_uuid(&self) -> bool { + self.uuid.is_some() + } + + // Param is passed by value, moved + pub fn set_uuid(&mut self, v: ::std::vec::Vec) { + self.uuid = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_uuid(&mut self) -> &mut ::std::vec::Vec { + if self.uuid.is_none() { + self.uuid.set_default(); + } + self.uuid.as_mut().unwrap() + } + + // Take field + pub fn take_uuid(&mut self) -> ::std::vec::Vec { + self.uuid.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + pub fn get_uuid(&self) -> &[u8] { + match self.uuid.as_ref() { + Some(v) => &v, + None => &[], + } + } + + fn get_uuid_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { + &self.uuid + } + + fn mut_uuid_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { + &mut self.uuid + } + + // optional uint64 current_term = 3; + + pub fn clear_current_term(&mut self) { + self.current_term = ::std::option::Option::None; + } + + pub fn has_current_term(&self) -> bool { + self.current_term.is_some() + } + + // Param is passed by value, moved + pub fn set_current_term(&mut self, v: u64) { + self.current_term = ::std::option::Option::Some(v); + } + + pub fn get_current_term(&self) -> u64 { + self.current_term.unwrap_or(0) + } + + fn get_current_term_for_reflect(&self) -> &::std::option::Option { + &self.current_term + } + + fn mut_current_term_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.current_term + } +} + +impl ::protobuf::Message for RaftResponseHeader { + fn is_initialized(&self) -> bool { + for v in &self.error { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.error)?; + }, + 2 => { + ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.uuid)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.current_term = ::std::option::Option::Some(tmp); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.error.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.uuid.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.current_term { + my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.error.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.uuid.as_ref() { + os.write_bytes(2, &v)?; + } + if let Some(v) = self.current_term { + os.write_uint64(3, v)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RaftResponseHeader { + fn new() -> RaftResponseHeader { + RaftResponseHeader::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "error", + RaftResponseHeader::get_error_for_reflect, + RaftResponseHeader::mut_error_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "uuid", + RaftResponseHeader::get_uuid_for_reflect, + RaftResponseHeader::mut_uuid_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "current_term", + RaftResponseHeader::get_current_term_for_reflect, + RaftResponseHeader::mut_current_term_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RaftResponseHeader", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RaftResponseHeader { + fn clear(&mut self) { + self.clear_error(); + self.clear_uuid(); + self.clear_current_term(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RaftResponseHeader { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RaftResponseHeader { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RaftCmdRequest { + // message fields + header: ::protobuf::SingularPtrField, + requests: ::protobuf::RepeatedField, + admin_request: ::protobuf::SingularPtrField, + status_request: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RaftCmdRequest {} + +impl RaftCmdRequest { + pub fn new() -> RaftCmdRequest { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RaftCmdRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RaftCmdRequest, + }; + unsafe { + instance.get(RaftCmdRequest::new) + } + } + + // optional .raft_cmdpb.RaftRequestHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: RaftRequestHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut RaftRequestHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> RaftRequestHeader { + self.header.take().unwrap_or_else(|| RaftRequestHeader::new()) + } + + pub fn get_header(&self) -> &RaftRequestHeader { + self.header.as_ref().unwrap_or_else(|| RaftRequestHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } + + // repeated .raft_cmdpb.Request requests = 2; + + pub fn clear_requests(&mut self) { + self.requests.clear(); + } + + // Param is passed by value, moved + pub fn set_requests(&mut self, v: ::protobuf::RepeatedField) { + self.requests = v; + } + + // Mutable pointer to the field. + pub fn mut_requests(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.requests + } + + // Take field + pub fn take_requests(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.requests, ::protobuf::RepeatedField::new()) + } + + pub fn get_requests(&self) -> &[Request] { + &self.requests + } + + fn get_requests_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.requests + } + + fn mut_requests_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.requests + } + + // optional .raft_cmdpb.AdminRequest admin_request = 3; + + pub fn clear_admin_request(&mut self) { + self.admin_request.clear(); + } + + pub fn has_admin_request(&self) -> bool { + self.admin_request.is_some() + } + + // Param is passed by value, moved + pub fn set_admin_request(&mut self, v: AdminRequest) { + self.admin_request = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_admin_request(&mut self) -> &mut AdminRequest { + if self.admin_request.is_none() { + self.admin_request.set_default(); + } + self.admin_request.as_mut().unwrap() + } + + // Take field + pub fn take_admin_request(&mut self) -> AdminRequest { + self.admin_request.take().unwrap_or_else(|| AdminRequest::new()) + } + + pub fn get_admin_request(&self) -> &AdminRequest { + self.admin_request.as_ref().unwrap_or_else(|| AdminRequest::default_instance()) + } + + fn get_admin_request_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.admin_request + } + + fn mut_admin_request_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.admin_request + } + + // optional .raft_cmdpb.StatusRequest status_request = 4; + + pub fn clear_status_request(&mut self) { + self.status_request.clear(); + } + + pub fn has_status_request(&self) -> bool { + self.status_request.is_some() + } + + // Param is passed by value, moved + pub fn set_status_request(&mut self, v: StatusRequest) { + self.status_request = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_status_request(&mut self) -> &mut StatusRequest { + if self.status_request.is_none() { + self.status_request.set_default(); + } + self.status_request.as_mut().unwrap() + } + + // Take field + pub fn take_status_request(&mut self) -> StatusRequest { + self.status_request.take().unwrap_or_else(|| StatusRequest::new()) + } + + pub fn get_status_request(&self) -> &StatusRequest { + self.status_request.as_ref().unwrap_or_else(|| StatusRequest::default_instance()) + } + + fn get_status_request_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.status_request + } + + fn mut_status_request_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.status_request + } +} + +impl ::protobuf::Message for RaftCmdRequest { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + for v in &self.requests { + if !v.is_initialized() { + return false; + } + }; + for v in &self.admin_request { + if !v.is_initialized() { + return false; + } + }; + for v in &self.status_request { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + 2 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.requests)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.admin_request)?; + }, + 4 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.status_request)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + for value in &self.requests { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if let Some(ref v) = self.admin_request.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.status_request.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + for v in &self.requests { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if let Some(ref v) = self.admin_request.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.status_request.as_ref() { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RaftCmdRequest { + fn new() -> RaftCmdRequest { + RaftCmdRequest::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + RaftCmdRequest::get_header_for_reflect, + RaftCmdRequest::mut_header_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "requests", + RaftCmdRequest::get_requests_for_reflect, + RaftCmdRequest::mut_requests_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "admin_request", + RaftCmdRequest::get_admin_request_for_reflect, + RaftCmdRequest::mut_admin_request_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "status_request", + RaftCmdRequest::get_status_request_for_reflect, + RaftCmdRequest::mut_status_request_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RaftCmdRequest", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RaftCmdRequest { + fn clear(&mut self) { + self.clear_header(); + self.clear_requests(); + self.clear_admin_request(); + self.clear_status_request(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RaftCmdRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RaftCmdRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RaftCmdResponse { + // message fields + header: ::protobuf::SingularPtrField, + responses: ::protobuf::RepeatedField, + admin_response: ::protobuf::SingularPtrField, + status_response: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RaftCmdResponse {} + +impl RaftCmdResponse { + pub fn new() -> RaftCmdResponse { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RaftCmdResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RaftCmdResponse, + }; + unsafe { + instance.get(RaftCmdResponse::new) + } + } + + // optional .raft_cmdpb.RaftResponseHeader header = 1; + + pub fn clear_header(&mut self) { + self.header.clear(); + } + + pub fn has_header(&self) -> bool { + self.header.is_some() + } + + // Param is passed by value, moved + pub fn set_header(&mut self, v: RaftResponseHeader) { + self.header = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_header(&mut self) -> &mut RaftResponseHeader { + if self.header.is_none() { + self.header.set_default(); + } + self.header.as_mut().unwrap() + } + + // Take field + pub fn take_header(&mut self) -> RaftResponseHeader { + self.header.take().unwrap_or_else(|| RaftResponseHeader::new()) + } + + pub fn get_header(&self) -> &RaftResponseHeader { + self.header.as_ref().unwrap_or_else(|| RaftResponseHeader::default_instance()) + } + + fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.header + } + + fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.header + } + + // repeated .raft_cmdpb.Response responses = 2; + + pub fn clear_responses(&mut self) { + self.responses.clear(); + } + + // Param is passed by value, moved + pub fn set_responses(&mut self, v: ::protobuf::RepeatedField) { + self.responses = v; + } + + // Mutable pointer to the field. + pub fn mut_responses(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.responses + } + + // Take field + pub fn take_responses(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.responses, ::protobuf::RepeatedField::new()) + } + + pub fn get_responses(&self) -> &[Response] { + &self.responses + } + + fn get_responses_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.responses + } + + fn mut_responses_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.responses + } + + // optional .raft_cmdpb.AdminResponse admin_response = 3; + + pub fn clear_admin_response(&mut self) { + self.admin_response.clear(); + } + + pub fn has_admin_response(&self) -> bool { + self.admin_response.is_some() + } + + // Param is passed by value, moved + pub fn set_admin_response(&mut self, v: AdminResponse) { + self.admin_response = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_admin_response(&mut self) -> &mut AdminResponse { + if self.admin_response.is_none() { + self.admin_response.set_default(); + } + self.admin_response.as_mut().unwrap() + } + + // Take field + pub fn take_admin_response(&mut self) -> AdminResponse { + self.admin_response.take().unwrap_or_else(|| AdminResponse::new()) + } + + pub fn get_admin_response(&self) -> &AdminResponse { + self.admin_response.as_ref().unwrap_or_else(|| AdminResponse::default_instance()) + } + + fn get_admin_response_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.admin_response + } + + fn mut_admin_response_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.admin_response + } + + // optional .raft_cmdpb.StatusResponse status_response = 4; + + pub fn clear_status_response(&mut self) { + self.status_response.clear(); + } + + pub fn has_status_response(&self) -> bool { + self.status_response.is_some() + } + + // Param is passed by value, moved + pub fn set_status_response(&mut self, v: StatusResponse) { + self.status_response = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_status_response(&mut self) -> &mut StatusResponse { + if self.status_response.is_none() { + self.status_response.set_default(); + } + self.status_response.as_mut().unwrap() + } + + // Take field + pub fn take_status_response(&mut self) -> StatusResponse { + self.status_response.take().unwrap_or_else(|| StatusResponse::new()) + } + + pub fn get_status_response(&self) -> &StatusResponse { + self.status_response.as_ref().unwrap_or_else(|| StatusResponse::default_instance()) + } + + fn get_status_response_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.status_response + } + + fn mut_status_response_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.status_response + } +} + +impl ::protobuf::Message for RaftCmdResponse { + fn is_initialized(&self) -> bool { + for v in &self.header { + if !v.is_initialized() { + return false; + } + }; + for v in &self.responses { + if !v.is_initialized() { + return false; + } + }; + for v in &self.admin_response { + if !v.is_initialized() { + return false; + } + }; + for v in &self.status_response { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; + }, + 2 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.responses)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.admin_response)?; + }, + 4 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.status_response)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.header.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + for value in &self.responses { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if let Some(ref v) = self.admin_response.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.status_response.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.header.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + for v in &self.responses { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if let Some(ref v) = self.admin_response.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.status_response.as_ref() { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RaftCmdResponse { + fn new() -> RaftCmdResponse { + RaftCmdResponse::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "header", + RaftCmdResponse::get_header_for_reflect, + RaftCmdResponse::mut_header_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "responses", + RaftCmdResponse::get_responses_for_reflect, + RaftCmdResponse::mut_responses_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "admin_response", + RaftCmdResponse::get_admin_response_for_reflect, + RaftCmdResponse::mut_admin_response_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "status_response", + RaftCmdResponse::get_status_response_for_reflect, + RaftCmdResponse::mut_status_response_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RaftCmdResponse", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RaftCmdResponse { + fn clear(&mut self) { + self.clear_header(); + self.clear_responses(); + self.clear_admin_response(); + self.clear_status_response(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RaftCmdResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RaftCmdResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum CmdType { + Invalid = 0, + Get = 1, + Put = 3, + Delete = 4, + Snap = 5, + Prewrite = 6, + DeleteRange = 7, +} + +impl ::protobuf::ProtobufEnum for CmdType { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(CmdType::Invalid), + 1 => ::std::option::Option::Some(CmdType::Get), + 3 => ::std::option::Option::Some(CmdType::Put), + 4 => ::std::option::Option::Some(CmdType::Delete), + 5 => ::std::option::Option::Some(CmdType::Snap), + 6 => ::std::option::Option::Some(CmdType::Prewrite), + 7 => ::std::option::Option::Some(CmdType::DeleteRange), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [CmdType] = &[ + CmdType::Invalid, + CmdType::Get, + CmdType::Put, + CmdType::Delete, + CmdType::Snap, + CmdType::Prewrite, + CmdType::DeleteRange, + ]; + values + } + + fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, + }; + unsafe { + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new("CmdType", file_descriptor_proto()) + }) + } + } +} + +impl ::std::marker::Copy for CmdType { +} + +impl ::protobuf::reflect::ProtobufValue for CmdType { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum AdminCmdType { + InvalidAdmin = 0, + ChangePeer = 1, + Split = 2, + CompactLog = 3, + TransferLeader = 4, + ComputeHash = 5, + VerifyHash = 6, +} + +impl ::protobuf::ProtobufEnum for AdminCmdType { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(AdminCmdType::InvalidAdmin), + 1 => ::std::option::Option::Some(AdminCmdType::ChangePeer), + 2 => ::std::option::Option::Some(AdminCmdType::Split), + 3 => ::std::option::Option::Some(AdminCmdType::CompactLog), + 4 => ::std::option::Option::Some(AdminCmdType::TransferLeader), + 5 => ::std::option::Option::Some(AdminCmdType::ComputeHash), + 6 => ::std::option::Option::Some(AdminCmdType::VerifyHash), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [AdminCmdType] = &[ + AdminCmdType::InvalidAdmin, + AdminCmdType::ChangePeer, + AdminCmdType::Split, + AdminCmdType::CompactLog, + AdminCmdType::TransferLeader, + AdminCmdType::ComputeHash, + AdminCmdType::VerifyHash, + ]; + values + } + + fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, + }; + unsafe { + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new("AdminCmdType", file_descriptor_proto()) + }) + } + } +} + +impl ::std::marker::Copy for AdminCmdType { +} + +impl ::protobuf::reflect::ProtobufValue for AdminCmdType { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum StatusCmdType { + InvalidStatus = 0, + RegionLeader = 1, + RegionDetail = 2, +} + +impl ::protobuf::ProtobufEnum for StatusCmdType { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(StatusCmdType::InvalidStatus), + 1 => ::std::option::Option::Some(StatusCmdType::RegionLeader), + 2 => ::std::option::Option::Some(StatusCmdType::RegionDetail), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [StatusCmdType] = &[ + StatusCmdType::InvalidStatus, + StatusCmdType::RegionLeader, + StatusCmdType::RegionDetail, + ]; + values + } + + fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, + }; + unsafe { + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new("StatusCmdType", file_descriptor_proto()) + }) + } + } +} + +impl ::std::marker::Copy for StatusCmdType { +} + +impl ::protobuf::reflect::ProtobufValue for StatusCmdType { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x10raft_cmdpb.proto\x12\nraft_cmdpb\x1a\x0cmetapb.proto\x1a\rerrorpb.\ + proto\x1a\reraftpb.proto\".\n\nGetRequest\x12\x0e\n\x02cf\x18\x01\x20\ + \x01(\tR\x02cf\x12\x10\n\x03key\x18\x02\x20\x01(\x0cR\x03key\"#\n\x0bGet\ + Response\x12\x14\n\x05value\x18\x01\x20\x01(\x0cR\x05value\"D\n\nPutRequ\ + est\x12\x0e\n\x02cf\x18\x01\x20\x01(\tR\x02cf\x12\x10\n\x03key\x18\x02\ + \x20\x01(\x0cR\x03key\x12\x14\n\x05value\x18\x03\x20\x01(\x0cR\x05value\ + \"\r\n\x0bPutResponse\"1\n\rDeleteRequest\x12\x0e\n\x02cf\x18\x01\x20\ + \x01(\tR\x02cf\x12\x10\n\x03key\x18\x02\x20\x01(\x0cR\x03key\"\x10\n\x0e\ + DeleteResponse\"Z\n\x12DeleteRangeRequest\x12\x0e\n\x02cf\x18\x01\x20\ + \x01(\tR\x02cf\x12\x1b\n\tstart_key\x18\x02\x20\x01(\x0cR\x08startKey\ + \x12\x17\n\x07end_key\x18\x03\x20\x01(\x0cR\x06endKey\"\x15\n\x13DeleteR\ + angeResponse\"\r\n\x0bSnapRequest\"6\n\x0cSnapResponse\x12&\n\x06region\ + \x18\x01\x20\x01(\x0b2\x0e.metapb.RegionR\x06region\"M\n\x0fPrewriteRequ\ + est\x12\x10\n\x03key\x18\x01\x20\x01(\x0cR\x03key\x12\x14\n\x05value\x18\ + \x02\x20\x01(\x0cR\x05value\x12\x12\n\x04lock\x18\x03\x20\x01(\x0cR\x04l\ + ock\"\x12\n\x10PrewriteResponse\"\xe9\x02\n\x07Request\x12.\n\x08cmd_typ\ + e\x18\x01\x20\x01(\x0e2\x13.raft_cmdpb.CmdTypeR\x07cmdType\x12(\n\x03get\ + \x18\x02\x20\x01(\x0b2\x16.raft_cmdpb.GetRequestR\x03get\x12(\n\x03put\ + \x18\x04\x20\x01(\x0b2\x16.raft_cmdpb.PutRequestR\x03put\x121\n\x06delet\ + e\x18\x05\x20\x01(\x0b2\x19.raft_cmdpb.DeleteRequestR\x06delete\x12+\n\ + \x04snap\x18\x06\x20\x01(\x0b2\x17.raft_cmdpb.SnapRequestR\x04snap\x127\ + \n\x08prewrite\x18\x07\x20\x01(\x0b2\x1b.raft_cmdpb.PrewriteRequestR\x08\ + prewrite\x12A\n\x0cdelete_range\x18\x08\x20\x01(\x0b2\x1e.raft_cmdpb.Del\ + eteRangeRequestR\x0bdeleteRange\"\xee\x02\n\x08Response\x12.\n\x08cmd_ty\ + pe\x18\x01\x20\x01(\x0e2\x13.raft_cmdpb.CmdTypeR\x07cmdType\x12)\n\x03ge\ + t\x18\x02\x20\x01(\x0b2\x17.raft_cmdpb.GetResponseR\x03get\x12)\n\x03put\ + \x18\x04\x20\x01(\x0b2\x17.raft_cmdpb.PutResponseR\x03put\x122\n\x06dele\ + te\x18\x05\x20\x01(\x0b2\x1a.raft_cmdpb.DeleteResponseR\x06delete\x12,\n\ + \x04snap\x18\x06\x20\x01(\x0b2\x18.raft_cmdpb.SnapResponseR\x04snap\x128\ + \n\x08prewrite\x18\x07\x20\x01(\x0b2\x1c.raft_cmdpb.PrewriteResponseR\ + \x08prewrite\x12@\n\x0bdelte_range\x18\x08\x20\x01(\x0b2\x1f.raft_cmdpb.\ + DeleteRangeResponseR\ndelteRange\"o\n\x11ChangePeerRequest\x128\n\x0bcha\ + nge_type\x18\x01\x20\x01(\x0e2\x17.eraftpb.ConfChangeTypeR\nchangeType\ + \x12\x20\n\x04peer\x18\x02\x20\x01(\x0b2\x0c.metapb.PeerR\x04peer\"<\n\ + \x12ChangePeerResponse\x12&\n\x06region\x18\x01\x20\x01(\x0b2\x0e.metapb\ + .RegionR\x06region\"\x94\x01\n\x0cSplitRequest\x12\x1b\n\tsplit_key\x18\ + \x01\x20\x01(\x0cR\x08splitKey\x12\"\n\rnew_region_id\x18\x02\x20\x01(\ + \x04R\x0bnewRegionId\x12\x20\n\x0cnew_peer_ids\x18\x03\x20\x03(\x04R\nne\ + wPeerIds\x12!\n\x0cright_derive\x18\x04\x20\x01(\x08R\x0brightDerive\"Y\ + \n\rSplitResponse\x12\"\n\x04left\x18\x01\x20\x01(\x0b2\x0e.metapb.Regio\ + nR\x04left\x12$\n\x05right\x18\x02\x20\x01(\x0b2\x0e.metapb.RegionR\x05r\ + ight\"[\n\x11CompactLogRequest\x12#\n\rcompact_index\x18\x01\x20\x01(\ + \x04R\x0ccompactIndex\x12!\n\x0ccompact_term\x18\x02\x20\x01(\x04R\x0bco\ + mpactTerm\"\x14\n\x12CompactLogResponse\"9\n\x15TransferLeaderRequest\ + \x12\x20\n\x04peer\x18\x01\x20\x01(\x0b2\x0c.metapb.PeerR\x04peer\"\x18\ + \n\x16TransferLeaderResponse\"=\n\x11VerifyHashRequest\x12\x14\n\x05inde\ + x\x18\x01\x20\x01(\x04R\x05index\x12\x12\n\x04hash\x18\x02\x20\x01(\x0cR\ + \x04hash\"\x14\n\x12VerifyHashResponse\"\xff\x02\n\x0cAdminRequest\x123\ + \n\x08cmd_type\x18\x01\x20\x01(\x0e2\x18.raft_cmdpb.AdminCmdTypeR\x07cmd\ + Type\x12>\n\x0bchange_peer\x18\x02\x20\x01(\x0b2\x1d.raft_cmdpb.ChangePe\ + erRequestR\nchangePeer\x12.\n\x05split\x18\x03\x20\x01(\x0b2\x18.raft_cm\ + dpb.SplitRequestR\x05split\x12>\n\x0bcompact_log\x18\x04\x20\x01(\x0b2\ + \x1d.raft_cmdpb.CompactLogRequestR\ncompactLog\x12J\n\x0ftransfer_leader\ + \x18\x05\x20\x01(\x0b2!.raft_cmdpb.TransferLeaderRequestR\x0etransferLea\ + der\x12>\n\x0bverify_hash\x18\x06\x20\x01(\x0b2\x1d.raft_cmdpb.VerifyHas\ + hRequestR\nverifyHash\"\x85\x03\n\rAdminResponse\x123\n\x08cmd_type\x18\ + \x01\x20\x01(\x0e2\x18.raft_cmdpb.AdminCmdTypeR\x07cmdType\x12?\n\x0bcha\ + nge_peer\x18\x02\x20\x01(\x0b2\x1e.raft_cmdpb.ChangePeerResponseR\nchang\ + ePeer\x12/\n\x05split\x18\x03\x20\x01(\x0b2\x19.raft_cmdpb.SplitResponse\ + R\x05split\x12?\n\x0bcompact_log\x18\x04\x20\x01(\x0b2\x1e.raft_cmdpb.Co\ + mpactLogResponseR\ncompactLog\x12K\n\x0ftransfer_leader\x18\x05\x20\x01(\ + \x0b2\".raft_cmdpb.TransferLeaderResponseR\x0etransferLeader\x12?\n\x0bv\ + erify_hash\x18\x06\x20\x01(\x0b2\x1e.raft_cmdpb.VerifyHashResponseR\nver\ + ifyHash\"\x15\n\x13RegionLeaderRequest\"<\n\x14RegionLeaderResponse\x12$\ + \n\x06leader\x18\x01\x20\x01(\x0b2\x0c.metapb.PeerR\x06leader\"\x15\n\ + \x13RegionDetailRequest\"d\n\x14RegionDetailResponse\x12&\n\x06region\ + \x18\x01\x20\x01(\x0b2\x0e.metapb.RegionR\x06region\x12$\n\x06leader\x18\ + \x02\x20\x01(\x0b2\x0c.metapb.PeerR\x06leader\"\xd1\x01\n\rStatusRequest\ + \x124\n\x08cmd_type\x18\x01\x20\x01(\x0e2\x19.raft_cmdpb.StatusCmdTypeR\ + \x07cmdType\x12D\n\rregion_leader\x18\x02\x20\x01(\x0b2\x1f.raft_cmdpb.R\ + egionLeaderRequestR\x0cregionLeader\x12D\n\rregion_detail\x18\x03\x20\ + \x01(\x0b2\x1f.raft_cmdpb.RegionDetailRequestR\x0cregionDetail\"\xd4\x01\ + \n\x0eStatusResponse\x124\n\x08cmd_type\x18\x01\x20\x01(\x0e2\x19.raft_c\ + mdpb.StatusCmdTypeR\x07cmdType\x12E\n\rregion_leader\x18\x02\x20\x01(\ + \x0b2\x20.raft_cmdpb.RegionLeaderResponseR\x0cregionLeader\x12E\n\rregio\ + n_detail\x18\x03\x20\x01(\x0b2\x20.raft_cmdpb.RegionDetailResponseR\x0cr\ + egionDetail\"\xd3\x01\n\x11RaftRequestHeader\x12\x1b\n\tregion_id\x18\ + \x01\x20\x01(\x04R\x08regionId\x12\x20\n\x04peer\x18\x02\x20\x01(\x0b2\ + \x0c.metapb.PeerR\x04peer\x12\x1f\n\x0bread_quorum\x18\x03\x20\x01(\x08R\ + \nreadQuorum\x12\x12\n\x04uuid\x18\x04\x20\x01(\x0cR\x04uuid\x126\n\x0cr\ + egion_epoch\x18\x05\x20\x01(\x0b2\x13.metapb.RegionEpochR\x0bregionEpoch\ + \x12\x12\n\x04term\x18\x06\x20\x01(\x04R\x04term\"q\n\x12RaftResponseHea\ + der\x12$\n\x05error\x18\x01\x20\x01(\x0b2\x0e.errorpb.ErrorR\x05error\ + \x12\x12\n\x04uuid\x18\x02\x20\x01(\x0cR\x04uuid\x12!\n\x0ccurrent_term\ + \x18\x03\x20\x01(\x04R\x0bcurrentTerm\"\xf9\x01\n\x0eRaftCmdRequest\x125\ + \n\x06header\x18\x01\x20\x01(\x0b2\x1d.raft_cmdpb.RaftRequestHeaderR\x06\ + header\x12/\n\x08requests\x18\x02\x20\x03(\x0b2\x13.raft_cmdpb.RequestR\ + \x08requests\x12=\n\radmin_request\x18\x03\x20\x01(\x0b2\x18.raft_cmdpb.\ + AdminRequestR\x0cadminRequest\x12@\n\x0estatus_request\x18\x04\x20\x01(\ + \x0b2\x19.raft_cmdpb.StatusRequestR\rstatusRequest\"\x84\x02\n\x0fRaftCm\ + dResponse\x126\n\x06header\x18\x01\x20\x01(\x0b2\x1e.raft_cmdpb.RaftResp\ + onseHeaderR\x06header\x122\n\tresponses\x18\x02\x20\x03(\x0b2\x14.raft_c\ + mdpb.ResponseR\tresponses\x12@\n\x0eadmin_response\x18\x03\x20\x01(\x0b2\ + \x19.raft_cmdpb.AdminResponseR\radminResponse\x12C\n\x0fstatus_response\ + \x18\x04\x20\x01(\x0b2\x1a.raft_cmdpb.StatusResponseR\x0estatusResponse*\ + ]\n\x07CmdType\x12\x0b\n\x07Invalid\x10\0\x12\x07\n\x03Get\x10\x01\x12\ + \x07\n\x03Put\x10\x03\x12\n\n\x06Delete\x10\x04\x12\x08\n\x04Snap\x10\ + \x05\x12\x0c\n\x08Prewrite\x10\x06\x12\x0f\n\x0bDeleteRange\x10\x07*\x80\ + \x01\n\x0cAdminCmdType\x12\x10\n\x0cInvalidAdmin\x10\0\x12\x0e\n\nChange\ + Peer\x10\x01\x12\t\n\x05Split\x10\x02\x12\x0e\n\nCompactLog\x10\x03\x12\ + \x12\n\x0eTransferLeader\x10\x04\x12\x0f\n\x0bComputeHash\x10\x05\x12\ + \x0e\n\nVerifyHash\x10\x06*F\n\rStatusCmdType\x12\x11\n\rInvalidStatus\ + \x10\0\x12\x10\n\x0cRegionLeader\x10\x01\x12\x10\n\x0cRegionDetail\x10\ + \x02B\x1a\n\x18com.pingcap.tikv.kvprotoJ\xcfE\n\x07\x12\x05\0\0\xff\x01\ + \x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x01\x08\x12\ + \n\t\n\x02\x03\0\x12\x03\x03\x07\x15\n\t\n\x02\x03\x01\x12\x03\x04\x07\ + \x16\n\t\n\x02\x03\x02\x12\x03\x05\x07\x16\n\x08\n\x01\x08\x12\x03\x07\0\ + 1\n\x0b\n\x04\x08\xe7\x07\0\x12\x03\x07\01\n\x0c\n\x05\x08\xe7\x07\0\x02\ + \x12\x03\x07\x07\x13\n\r\n\x06\x08\xe7\x07\0\x02\0\x12\x03\x07\x07\x13\n\ + \x0e\n\x07\x08\xe7\x07\0\x02\0\x01\x12\x03\x07\x07\x13\n\x0c\n\x05\x08\ + \xe7\x07\0\x07\x12\x03\x07\x160\n\n\n\x02\x04\0\x12\x04\t\0\x0c\x01\n\n\ + \n\x03\x04\0\x01\x12\x03\t\x08\x12\n\x0b\n\x04\x04\0\x02\0\x12\x03\n\x04\ + \x1c\n\x0c\n\x05\x04\0\x02\0\x04\x12\x03\n\x04\x0c\n\x0c\n\x05\x04\0\x02\ + \0\x05\x12\x03\n\r\x13\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\n\x14\x16\n\ + \x0c\n\x05\x04\0\x02\0\x03\x12\x03\n\x1a\x1b\n\x0b\n\x04\x04\0\x02\x01\ + \x12\x03\x0b\x04\x1c\n\x0c\n\x05\x04\0\x02\x01\x04\x12\x03\x0b\x04\x0c\n\ + \x0c\n\x05\x04\0\x02\x01\x05\x12\x03\x0b\r\x12\n\x0c\n\x05\x04\0\x02\x01\ + \x01\x12\x03\x0b\x14\x17\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x0b\x1a\ + \x1b\n\n\n\x02\x04\x01\x12\x04\x0e\0\x10\x01\n\n\n\x03\x04\x01\x01\x12\ + \x03\x0e\x08\x13\n\x0b\n\x04\x04\x01\x02\0\x12\x03\x0f\x04\x1d\n\x0c\n\ + \x05\x04\x01\x02\0\x04\x12\x03\x0f\x04\x0c\n\x0c\n\x05\x04\x01\x02\0\x05\ + \x12\x03\x0f\r\x12\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x0f\x13\x18\n\ + \x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x0f\x1b\x1c\n\n\n\x02\x04\x02\x12\ + \x04\x12\0\x16\x01\n\n\n\x03\x04\x02\x01\x12\x03\x12\x08\x12\n\x0b\n\x04\ + \x04\x02\x02\0\x12\x03\x13\x04\x1e\n\x0c\n\x05\x04\x02\x02\0\x04\x12\x03\ + \x13\x04\x0c\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03\x13\r\x13\n\x0c\n\x05\ + \x04\x02\x02\0\x01\x12\x03\x13\x14\x16\n\x0c\n\x05\x04\x02\x02\0\x03\x12\ + \x03\x13\x1c\x1d\n\x0b\n\x04\x04\x02\x02\x01\x12\x03\x14\x04\x1e\n\x0c\n\ + \x05\x04\x02\x02\x01\x04\x12\x03\x14\x04\x0c\n\x0c\n\x05\x04\x02\x02\x01\ + \x05\x12\x03\x14\r\x12\n\x0c\n\x05\x04\x02\x02\x01\x01\x12\x03\x14\x14\ + \x17\n\x0c\n\x05\x04\x02\x02\x01\x03\x12\x03\x14\x1c\x1d\n\x0b\n\x04\x04\ + \x02\x02\x02\x12\x03\x15\x04\x1e\n\x0c\n\x05\x04\x02\x02\x02\x04\x12\x03\ + \x15\x04\x0c\n\x0c\n\x05\x04\x02\x02\x02\x05\x12\x03\x15\r\x12\n\x0c\n\ + \x05\x04\x02\x02\x02\x01\x12\x03\x15\x14\x19\n\x0c\n\x05\x04\x02\x02\x02\ + \x03\x12\x03\x15\x1c\x1d\n\n\n\x02\x04\x03\x12\x04\x18\0\x1a\x01\n\n\n\ + \x03\x04\x03\x01\x12\x03\x18\x08\x13\n\n\n\x02\x04\x04\x12\x04\x1c\0\x1f\ + \x01\n\n\n\x03\x04\x04\x01\x12\x03\x1c\x08\x15\n\x0b\n\x04\x04\x04\x02\0\ + \x12\x03\x1d\x04\x1c\n\x0c\n\x05\x04\x04\x02\0\x04\x12\x03\x1d\x04\x0c\n\ + \x0c\n\x05\x04\x04\x02\0\x05\x12\x03\x1d\r\x13\n\x0c\n\x05\x04\x04\x02\0\ + \x01\x12\x03\x1d\x14\x16\n\x0c\n\x05\x04\x04\x02\0\x03\x12\x03\x1d\x1a\ + \x1b\n\x0b\n\x04\x04\x04\x02\x01\x12\x03\x1e\x04\x1c\n\x0c\n\x05\x04\x04\ + \x02\x01\x04\x12\x03\x1e\x04\x0c\n\x0c\n\x05\x04\x04\x02\x01\x05\x12\x03\ + \x1e\r\x12\n\x0c\n\x05\x04\x04\x02\x01\x01\x12\x03\x1e\x14\x17\n\x0c\n\ + \x05\x04\x04\x02\x01\x03\x12\x03\x1e\x1a\x1b\n\n\n\x02\x04\x05\x12\x04!\ + \0#\x01\n\n\n\x03\x04\x05\x01\x12\x03!\x08\x16\n\n\n\x02\x04\x06\x12\x04\ + %\0)\x01\n\n\n\x03\x04\x06\x01\x12\x03%\x08\x1a\n\x0b\n\x04\x04\x06\x02\ + \0\x12\x03&\x04!\n\x0c\n\x05\x04\x06\x02\0\x04\x12\x03&\x04\x0c\n\x0c\n\ + \x05\x04\x06\x02\0\x05\x12\x03&\r\x13\n\x0c\n\x05\x04\x06\x02\0\x01\x12\ + \x03&\x14\x16\n\x0c\n\x05\x04\x06\x02\0\x03\x12\x03&\x1f\x20\n\x0b\n\x04\ + \x04\x06\x02\x01\x12\x03'\x04!\n\x0c\n\x05\x04\x06\x02\x01\x04\x12\x03'\ + \x04\x0c\n\x0c\n\x05\x04\x06\x02\x01\x05\x12\x03'\r\x12\n\x0c\n\x05\x04\ + \x06\x02\x01\x01\x12\x03'\x13\x1c\n\x0c\n\x05\x04\x06\x02\x01\x03\x12\ + \x03'\x1f\x20\n\x0b\n\x04\x04\x06\x02\x02\x12\x03(\x04!\n\x0c\n\x05\x04\ + \x06\x02\x02\x04\x12\x03(\x04\x0c\n\x0c\n\x05\x04\x06\x02\x02\x05\x12\ + \x03(\r\x12\n\x0c\n\x05\x04\x06\x02\x02\x01\x12\x03(\x13\x1a\n\x0c\n\x05\ + \x04\x06\x02\x02\x03\x12\x03(\x1f\x20\n\n\n\x02\x04\x07\x12\x04+\0-\x01\ + \n\n\n\x03\x04\x07\x01\x12\x03+\x08\x1b\n\n\n\x02\x04\x08\x12\x04/\01\ + \x01\n\n\n\x03\x04\x08\x01\x12\x03/\x08\x13\n\n\n\x02\x04\t\x12\x043\05\ + \x01\n\n\n\x03\x04\t\x01\x12\x033\x08\x14\n\x0b\n\x04\x04\t\x02\0\x12\ + \x034\x04&\n\x0c\n\x05\x04\t\x02\0\x04\x12\x034\x04\x0c\n\x0c\n\x05\x04\ + \t\x02\0\x06\x12\x034\r\x1a\n\x0c\n\x05\x04\t\x02\0\x01\x12\x034\x1b!\n\ + \x0c\n\x05\x04\t\x02\0\x03\x12\x034$%\n\n\n\x02\x04\n\x12\x047\0;\x01\n\ + \n\n\x03\x04\n\x01\x12\x037\x08\x17\n\x0b\n\x04\x04\n\x02\0\x12\x038\x04\ + \x1e\n\x0c\n\x05\x04\n\x02\0\x04\x12\x038\x04\x0c\n\x0c\n\x05\x04\n\x02\ + \0\x05\x12\x038\r\x12\n\x0c\n\x05\x04\n\x02\0\x01\x12\x038\x13\x16\n\x0c\ + \n\x05\x04\n\x02\0\x03\x12\x038\x1c\x1d\n\x0b\n\x04\x04\n\x02\x01\x12\ + \x039\x04\x1e\n\x0c\n\x05\x04\n\x02\x01\x04\x12\x039\x04\x0c\n\x0c\n\x05\ + \x04\n\x02\x01\x05\x12\x039\r\x12\n\x0c\n\x05\x04\n\x02\x01\x01\x12\x039\ + \x13\x18\n\x0c\n\x05\x04\n\x02\x01\x03\x12\x039\x1c\x1d\n\x0b\n\x04\x04\ + \n\x02\x02\x12\x03:\x04\x1e\n\x0c\n\x05\x04\n\x02\x02\x04\x12\x03:\x04\ + \x0c\n\x0c\n\x05\x04\n\x02\x02\x05\x12\x03:\r\x12\n\x0c\n\x05\x04\n\x02\ + \x02\x01\x12\x03:\x13\x17\n\x0c\n\x05\x04\n\x02\x02\x03\x12\x03:\x1c\x1d\ + \n\n\n\x02\x04\x0b\x12\x04=\0?\x01\n\n\n\x03\x04\x0b\x01\x12\x03=\x08\ + \x18\n\n\n\x02\x05\0\x12\x04A\0I\x01\n\n\n\x03\x05\0\x01\x12\x03A\x05\ + \x0c\n\x0b\n\x04\x05\0\x02\0\x12\x03B\x04\x14\n\x0c\n\x05\x05\0\x02\0\ + \x01\x12\x03B\x04\x0b\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03B\x12\x13\n\x0b\ + \n\x04\x05\0\x02\x01\x12\x03C\x04\x14\n\x0c\n\x05\x05\0\x02\x01\x01\x12\ + \x03C\x04\x07\n\x0c\n\x05\x05\0\x02\x01\x02\x12\x03C\x12\x13\n\x0b\n\x04\ + \x05\0\x02\x02\x12\x03D\x04\x14\n\x0c\n\x05\x05\0\x02\x02\x01\x12\x03D\ + \x04\x07\n\x0c\n\x05\x05\0\x02\x02\x02\x12\x03D\x12\x13\n\x0b\n\x04\x05\ + \0\x02\x03\x12\x03E\x04\x14\n\x0c\n\x05\x05\0\x02\x03\x01\x12\x03E\x04\n\ + \n\x0c\n\x05\x05\0\x02\x03\x02\x12\x03E\x12\x13\n\x0b\n\x04\x05\0\x02\ + \x04\x12\x03F\x04\x14\n\x0c\n\x05\x05\0\x02\x04\x01\x12\x03F\x04\x08\n\ + \x0c\n\x05\x05\0\x02\x04\x02\x12\x03F\x12\x13\n\x0b\n\x04\x05\0\x02\x05\ + \x12\x03G\x04\x14\n\x0c\n\x05\x05\0\x02\x05\x01\x12\x03G\x04\x0c\n\x0c\n\ + \x05\x05\0\x02\x05\x02\x12\x03G\x12\x13\n\x0b\n\x04\x05\0\x02\x06\x12\ + \x03H\x04\x14\n\x0c\n\x05\x05\0\x02\x06\x01\x12\x03H\x04\x0f\n\x0c\n\x05\ + \x05\0\x02\x06\x02\x12\x03H\x12\x13\n\n\n\x02\x04\x0c\x12\x04K\0S\x01\n\ + \n\n\x03\x04\x0c\x01\x12\x03K\x08\x0f\n\x0b\n\x04\x04\x0c\x02\0\x12\x03L\ + \x041\n\x0c\n\x05\x04\x0c\x02\0\x04\x12\x03L\x04\x0c\n\x0c\n\x05\x04\x0c\ + \x02\0\x06\x12\x03L\r\x14\n\x0c\n\x05\x04\x0c\x02\0\x01\x12\x03L\x20(\n\ + \x0c\n\x05\x04\x0c\x02\0\x03\x12\x03L/0\n\x0b\n\x04\x04\x0c\x02\x01\x12\ + \x03M\x041\n\x0c\n\x05\x04\x0c\x02\x01\x04\x12\x03M\x04\x0c\n\x0c\n\x05\ + \x04\x0c\x02\x01\x06\x12\x03M\r\x17\n\x0c\n\x05\x04\x0c\x02\x01\x01\x12\ + \x03M\x20#\n\x0c\n\x05\x04\x0c\x02\x01\x03\x12\x03M/0\n\x0b\n\x04\x04\ + \x0c\x02\x02\x12\x03N\x041\n\x0c\n\x05\x04\x0c\x02\x02\x04\x12\x03N\x04\ + \x0c\n\x0c\n\x05\x04\x0c\x02\x02\x06\x12\x03N\r\x17\n\x0c\n\x05\x04\x0c\ + \x02\x02\x01\x12\x03N\x20#\n\x0c\n\x05\x04\x0c\x02\x02\x03\x12\x03N/0\n\ + \x0b\n\x04\x04\x0c\x02\x03\x12\x03O\x041\n\x0c\n\x05\x04\x0c\x02\x03\x04\ + \x12\x03O\x04\x0c\n\x0c\n\x05\x04\x0c\x02\x03\x06\x12\x03O\r\x1a\n\x0c\n\ + \x05\x04\x0c\x02\x03\x01\x12\x03O\x20&\n\x0c\n\x05\x04\x0c\x02\x03\x03\ + \x12\x03O/0\n\x0b\n\x04\x04\x0c\x02\x04\x12\x03P\x041\n\x0c\n\x05\x04\ + \x0c\x02\x04\x04\x12\x03P\x04\x0c\n\x0c\n\x05\x04\x0c\x02\x04\x06\x12\ + \x03P\r\x18\n\x0c\n\x05\x04\x0c\x02\x04\x01\x12\x03P\x20$\n\x0c\n\x05\ + \x04\x0c\x02\x04\x03\x12\x03P/0\n\x0b\n\x04\x04\x0c\x02\x05\x12\x03Q\x04\ + 1\n\x0c\n\x05\x04\x0c\x02\x05\x04\x12\x03Q\x04\x0c\n\x0c\n\x05\x04\x0c\ + \x02\x05\x06\x12\x03Q\r\x1c\n\x0c\n\x05\x04\x0c\x02\x05\x01\x12\x03Q\x20\ + (\n\x0c\n\x05\x04\x0c\x02\x05\x03\x12\x03Q/0\n\x0b\n\x04\x04\x0c\x02\x06\ + \x12\x03R\x041\n\x0c\n\x05\x04\x0c\x02\x06\x04\x12\x03R\x04\x0c\n\x0c\n\ + \x05\x04\x0c\x02\x06\x06\x12\x03R\r\x1f\n\x0c\n\x05\x04\x0c\x02\x06\x01\ + \x12\x03R\x20,\n\x0c\n\x05\x04\x0c\x02\x06\x03\x12\x03R/0\n\n\n\x02\x04\ + \r\x12\x04U\0]\x01\n\n\n\x03\x04\r\x01\x12\x03U\x08\x10\n\x0b\n\x04\x04\ + \r\x02\0\x12\x03V\x041\n\x0c\n\x05\x04\r\x02\0\x04\x12\x03V\x04\x0c\n\ + \x0c\n\x05\x04\r\x02\0\x06\x12\x03V\r\x14\n\x0c\n\x05\x04\r\x02\0\x01\ + \x12\x03V!)\n\x0c\n\x05\x04\r\x02\0\x03\x12\x03V/0\n\x0b\n\x04\x04\r\x02\ + \x01\x12\x03W\x041\n\x0c\n\x05\x04\r\x02\x01\x04\x12\x03W\x04\x0c\n\x0c\ + \n\x05\x04\r\x02\x01\x06\x12\x03W\r\x18\n\x0c\n\x05\x04\r\x02\x01\x01\ + \x12\x03W!$\n\x0c\n\x05\x04\r\x02\x01\x03\x12\x03W/0\n\x0b\n\x04\x04\r\ + \x02\x02\x12\x03X\x041\n\x0c\n\x05\x04\r\x02\x02\x04\x12\x03X\x04\x0c\n\ + \x0c\n\x05\x04\r\x02\x02\x06\x12\x03X\r\x18\n\x0c\n\x05\x04\r\x02\x02\ + \x01\x12\x03X!$\n\x0c\n\x05\x04\r\x02\x02\x03\x12\x03X/0\n\x0b\n\x04\x04\ + \r\x02\x03\x12\x03Y\x041\n\x0c\n\x05\x04\r\x02\x03\x04\x12\x03Y\x04\x0c\ + \n\x0c\n\x05\x04\r\x02\x03\x06\x12\x03Y\r\x1b\n\x0c\n\x05\x04\r\x02\x03\ + \x01\x12\x03Y!'\n\x0c\n\x05\x04\r\x02\x03\x03\x12\x03Y/0\n\x0b\n\x04\x04\ + \r\x02\x04\x12\x03Z\x041\n\x0c\n\x05\x04\r\x02\x04\x04\x12\x03Z\x04\x0c\ + \n\x0c\n\x05\x04\r\x02\x04\x06\x12\x03Z\r\x19\n\x0c\n\x05\x04\r\x02\x04\ + \x01\x12\x03Z!%\n\x0c\n\x05\x04\r\x02\x04\x03\x12\x03Z/0\n\x0b\n\x04\x04\ + \r\x02\x05\x12\x03[\x041\n\x0c\n\x05\x04\r\x02\x05\x04\x12\x03[\x04\x0c\ + \n\x0c\n\x05\x04\r\x02\x05\x06\x12\x03[\r\x1d\n\x0c\n\x05\x04\r\x02\x05\ + \x01\x12\x03[!)\n\x0c\n\x05\x04\r\x02\x05\x03\x12\x03[/0\n\x0b\n\x04\x04\ + \r\x02\x06\x12\x03\\\x041\n\x0c\n\x05\x04\r\x02\x06\x04\x12\x03\\\x04\ + \x0c\n\x0c\n\x05\x04\r\x02\x06\x06\x12\x03\\\r\x20\n\x0c\n\x05\x04\r\x02\ + \x06\x01\x12\x03\\!,\n\x0c\n\x05\x04\r\x02\x06\x03\x12\x03\\/0\n\n\n\x02\ + \x04\x0e\x12\x04_\0c\x01\n\n\n\x03\x04\x0e\x01\x12\x03_\x08\x19\nA\n\x04\ + \x04\x0e\x02\0\x12\x03a\x044\x1a4\x20This\x20can\x20be\x20only\x20called\ + \x20in\x20internal\x20RaftStore\x20now.\n\n\x0c\n\x05\x04\x0e\x02\0\x04\ + \x12\x03a\x04\x0c\n\x0c\n\x05\x04\x0e\x02\0\x06\x12\x03a\r#\n\x0c\n\x05\ + \x04\x0e\x02\0\x01\x12\x03a$/\n\x0c\n\x05\x04\x0e\x02\0\x03\x12\x03a23\n\ + \x0b\n\x04\x04\x0e\x02\x01\x12\x03b\x044\n\x0c\n\x05\x04\x0e\x02\x01\x04\ + \x12\x03b\x04\x0c\n\x0c\n\x05\x04\x0e\x02\x01\x06\x12\x03b\r\x18\n\x0c\n\ + \x05\x04\x0e\x02\x01\x01\x12\x03b\x19\x1d\n\x0c\n\x05\x04\x0e\x02\x01\ + \x03\x12\x03b23\n\n\n\x02\x04\x0f\x12\x04e\0g\x01\n\n\n\x03\x04\x0f\x01\ + \x12\x03e\x08\x1a\n\x0b\n\x04\x04\x0f\x02\0\x12\x03f\x04&\n\x0c\n\x05\ + \x04\x0f\x02\0\x04\x12\x03f\x04\x0c\n\x0c\n\x05\x04\x0f\x02\0\x06\x12\ + \x03f\r\x1a\n\x0c\n\x05\x04\x0f\x02\0\x01\x12\x03f\x1b!\n\x0c\n\x05\x04\ + \x0f\x02\0\x03\x12\x03f$%\n\n\n\x02\x04\x10\x12\x04i\0v\x01\n\n\n\x03\ + \x04\x10\x01\x12\x03i\x08\x14\nv\n\x04\x04\x10\x02\0\x12\x03l\x042\x1ai\ + \x20This\x20can\x20be\x20only\x20called\x20in\x20internal\x20RaftStore\ + \x20now.\n\x20The\x20split_key\x20must\x20be\x20in\x20the\x20been\x20spl\ + itting\x20region.\n\n\x0c\n\x05\x04\x10\x02\0\x04\x12\x03l\x04\x0c\n\x0c\ + \n\x05\x04\x10\x02\0\x05\x12\x03l\r\x12\n\x0c\n\x05\x04\x10\x02\0\x01\ + \x12\x03l\x13\x1c\n\x0c\n\x05\x04\x10\x02\0\x03\x12\x03l01\n\xba\x01\n\ + \x04\x04\x10\x02\x01\x12\x03p\x042\x1a\xac\x01\x20We\x20split\x20the\x20\ + region\x20into\x20two,\x20first\x20uses\x20the\x20origin\x20\n\x20parent\ + \x20region\x20id,\x20and\x20the\x20second\x20uses\x20the\x20new_region_i\ + d.\n\x20We\x20must\x20guarantee\x20that\x20the\x20new_region_id\x20is\ + \x20global\x20unique.\n\n\x0c\n\x05\x04\x10\x02\x01\x04\x12\x03p\x04\x0c\ + \n\x0c\n\x05\x04\x10\x02\x01\x05\x12\x03p\r\x13\n\x0c\n\x05\x04\x10\x02\ + \x01\x01\x12\x03p\x14!\n\x0c\n\x05\x04\x10\x02\x01\x03\x12\x03p01\n5\n\ + \x04\x04\x10\x02\x02\x12\x03r\x042\x1a(\x20The\x20peer\x20ids\x20for\x20\ + the\x20new\x20split\x20region.\n\n\x0c\n\x05\x04\x10\x02\x02\x04\x12\x03\ + r\x04\x0c\n\x0c\n\x05\x04\x10\x02\x02\x05\x12\x03r\r\x13\n\x0c\n\x05\x04\ + \x10\x02\x02\x01\x12\x03r\x14\x20\n\x0c\n\x05\x04\x10\x02\x02\x03\x12\ + \x03r01\nb\n\x04\x04\x10\x02\x03\x12\x03u\x042\x1aU\x20If\x20true,\x20ri\ + ght\x20region\x20derive\x20the\x20origin\x20region_id,\x20\n\x20left\x20\ + region\x20use\x20new_region_id.\n\n\x0c\n\x05\x04\x10\x02\x03\x04\x12\ + \x03u\x04\x0c\n\x0c\n\x05\x04\x10\x02\x03\x05\x12\x03u\r\x11\n\x0c\n\x05\ + \x04\x10\x02\x03\x01\x12\x03u\x12\x1e\n\x0c\n\x05\x04\x10\x02\x03\x03\ + \x12\x03u01\n\n\n\x02\x04\x11\x12\x04x\0{\x01\n\n\n\x03\x04\x11\x01\x12\ + \x03x\x08\x15\n\x0b\n\x04\x04\x11\x02\0\x12\x03y\x04%\n\x0c\n\x05\x04\ + \x11\x02\0\x04\x12\x03y\x04\x0c\n\x0c\n\x05\x04\x11\x02\0\x06\x12\x03y\r\ + \x1a\n\x0c\n\x05\x04\x11\x02\0\x01\x12\x03y\x1b\x1f\n\x0c\n\x05\x04\x11\ + \x02\0\x03\x12\x03y#$\n\x0b\n\x04\x04\x11\x02\x01\x12\x03z\x04%\n\x0c\n\ + \x05\x04\x11\x02\x01\x04\x12\x03z\x04\x0c\n\x0c\n\x05\x04\x11\x02\x01\ + \x06\x12\x03z\r\x1a\n\x0c\n\x05\x04\x11\x02\x01\x01\x12\x03z\x1b\x20\n\ + \x0c\n\x05\x04\x11\x02\x01\x03\x12\x03z#$\n\x0b\n\x02\x04\x12\x12\x05}\0\ + \x80\x01\x01\n\n\n\x03\x04\x12\x01\x12\x03}\x08\x19\n\x0b\n\x04\x04\x12\ + \x02\0\x12\x03~\x04(\n\x0c\n\x05\x04\x12\x02\0\x04\x12\x03~\x04\x0c\n\ + \x0c\n\x05\x04\x12\x02\0\x05\x12\x03~\r\x13\n\x0c\n\x05\x04\x12\x02\0\ + \x01\x12\x03~\x14!\n\x0c\n\x05\x04\x12\x02\0\x03\x12\x03~&'\n\x0b\n\x04\ + \x04\x12\x02\x01\x12\x03\x7f\x04(\n\x0c\n\x05\x04\x12\x02\x01\x04\x12\ + \x03\x7f\x04\x0c\n\x0c\n\x05\x04\x12\x02\x01\x05\x12\x03\x7f\r\x13\n\x0c\ + \n\x05\x04\x12\x02\x01\x01\x12\x03\x7f\x14\x20\n\x0c\n\x05\x04\x12\x02\ + \x01\x03\x12\x03\x7f&'\n\x0c\n\x02\x04\x13\x12\x06\x82\x01\0\x84\x01\x01\ + \n\x0b\n\x03\x04\x13\x01\x12\x04\x82\x01\x08\x1a\n\x0c\n\x02\x04\x14\x12\ + \x06\x86\x01\0\x88\x01\x01\n\x0b\n\x03\x04\x14\x01\x12\x04\x86\x01\x08\ + \x1d\n\x0c\n\x04\x04\x14\x02\0\x12\x04\x87\x01\x04\"\n\r\n\x05\x04\x14\ + \x02\0\x04\x12\x04\x87\x01\x04\x0c\n\r\n\x05\x04\x14\x02\0\x06\x12\x04\ + \x87\x01\r\x18\n\r\n\x05\x04\x14\x02\0\x01\x12\x04\x87\x01\x19\x1d\n\r\n\ + \x05\x04\x14\x02\0\x03\x12\x04\x87\x01\x20!\n\x0c\n\x02\x04\x15\x12\x06\ + \x8a\x01\0\x8b\x01\x01\n\x0b\n\x03\x04\x15\x01\x12\x04\x8a\x01\x08\x1e\n\ + \x0c\n\x02\x04\x16\x12\x06\x8d\x01\0\x90\x01\x01\n\x0b\n\x03\x04\x16\x01\ + \x12\x04\x8d\x01\x08\x19\n\x0c\n\x04\x04\x16\x02\0\x12\x04\x8e\x01\x04\ + \x20\n\r\n\x05\x04\x16\x02\0\x04\x12\x04\x8e\x01\x04\x0c\n\r\n\x05\x04\ + \x16\x02\0\x05\x12\x04\x8e\x01\r\x13\n\r\n\x05\x04\x16\x02\0\x01\x12\x04\ + \x8e\x01\x14\x19\n\r\n\x05\x04\x16\x02\0\x03\x12\x04\x8e\x01\x1e\x1f\n\ + \x0c\n\x04\x04\x16\x02\x01\x12\x04\x8f\x01\x04\x20\n\r\n\x05\x04\x16\x02\ + \x01\x04\x12\x04\x8f\x01\x04\x0c\n\r\n\x05\x04\x16\x02\x01\x05\x12\x04\ + \x8f\x01\r\x12\n\r\n\x05\x04\x16\x02\x01\x01\x12\x04\x8f\x01\x13\x17\n\r\ + \n\x05\x04\x16\x02\x01\x03\x12\x04\x8f\x01\x1e\x1f\n\x0c\n\x02\x04\x17\ + \x12\x06\x92\x01\0\x93\x01\x01\n\x0b\n\x03\x04\x17\x01\x12\x04\x92\x01\ + \x08\x1a\n\x0c\n\x02\x05\x01\x12\x06\x95\x01\0\x9d\x01\x01\n\x0b\n\x03\ + \x05\x01\x01\x12\x04\x95\x01\x05\x11\n\x0c\n\x04\x05\x01\x02\0\x12\x04\ + \x96\x01\x04\x18\n\r\n\x05\x05\x01\x02\0\x01\x12\x04\x96\x01\x04\x10\n\r\ + \n\x05\x05\x01\x02\0\x02\x12\x04\x96\x01\x16\x17\n\x0c\n\x04\x05\x01\x02\ + \x01\x12\x04\x97\x01\x04\x18\n\r\n\x05\x05\x01\x02\x01\x01\x12\x04\x97\ + \x01\x04\x0e\n\r\n\x05\x05\x01\x02\x01\x02\x12\x04\x97\x01\x16\x17\n\x0c\ + \n\x04\x05\x01\x02\x02\x12\x04\x98\x01\x04\x18\n\r\n\x05\x05\x01\x02\x02\ + \x01\x12\x04\x98\x01\x04\t\n\r\n\x05\x05\x01\x02\x02\x02\x12\x04\x98\x01\ + \x16\x17\n\x0c\n\x04\x05\x01\x02\x03\x12\x04\x99\x01\x04\x18\n\r\n\x05\ + \x05\x01\x02\x03\x01\x12\x04\x99\x01\x04\x0e\n\r\n\x05\x05\x01\x02\x03\ + \x02\x12\x04\x99\x01\x16\x17\n\x0c\n\x04\x05\x01\x02\x04\x12\x04\x9a\x01\ + \x04\x18\n\r\n\x05\x05\x01\x02\x04\x01\x12\x04\x9a\x01\x04\x12\n\r\n\x05\ + \x05\x01\x02\x04\x02\x12\x04\x9a\x01\x16\x17\n\x0c\n\x04\x05\x01\x02\x05\ + \x12\x04\x9b\x01\x04\x18\n\r\n\x05\x05\x01\x02\x05\x01\x12\x04\x9b\x01\ + \x04\x0f\n\r\n\x05\x05\x01\x02\x05\x02\x12\x04\x9b\x01\x16\x17\n\x0c\n\ + \x04\x05\x01\x02\x06\x12\x04\x9c\x01\x04\x18\n\r\n\x05\x05\x01\x02\x06\ + \x01\x12\x04\x9c\x01\x04\x0e\n\r\n\x05\x05\x01\x02\x06\x02\x12\x04\x9c\ + \x01\x16\x17\n\x0c\n\x02\x04\x18\x12\x06\x9f\x01\0\xa6\x01\x01\n\x0b\n\ + \x03\x04\x18\x01\x12\x04\x9f\x01\x08\x14\n\x0c\n\x04\x04\x18\x02\0\x12\ + \x04\xa0\x01\x048\n\r\n\x05\x04\x18\x02\0\x04\x12\x04\xa0\x01\x04\x0c\n\ + \r\n\x05\x04\x18\x02\0\x06\x12\x04\xa0\x01\r\x19\n\r\n\x05\x04\x18\x02\0\ + \x01\x12\x04\xa0\x01\x1a\"\n\r\n\x05\x04\x18\x02\0\x03\x12\x04\xa0\x0167\ + \n\x0c\n\x04\x04\x18\x02\x01\x12\x04\xa1\x01\x048\n\r\n\x05\x04\x18\x02\ + \x01\x04\x12\x04\xa1\x01\x04\x0c\n\r\n\x05\x04\x18\x02\x01\x06\x12\x04\ + \xa1\x01\r\x1e\n\r\n\x05\x04\x18\x02\x01\x01\x12\x04\xa1\x01\x1f*\n\r\n\ + \x05\x04\x18\x02\x01\x03\x12\x04\xa1\x0167\n\x0c\n\x04\x04\x18\x02\x02\ + \x12\x04\xa2\x01\x048\n\r\n\x05\x04\x18\x02\x02\x04\x12\x04\xa2\x01\x04\ + \x0c\n\r\n\x05\x04\x18\x02\x02\x06\x12\x04\xa2\x01\r\x19\n\r\n\x05\x04\ + \x18\x02\x02\x01\x12\x04\xa2\x01\x1a\x1f\n\r\n\x05\x04\x18\x02\x02\x03\ + \x12\x04\xa2\x0167\n\x0c\n\x04\x04\x18\x02\x03\x12\x04\xa3\x01\x048\n\r\ + \n\x05\x04\x18\x02\x03\x04\x12\x04\xa3\x01\x04\x0c\n\r\n\x05\x04\x18\x02\ + \x03\x06\x12\x04\xa3\x01\r\x1e\n\r\n\x05\x04\x18\x02\x03\x01\x12\x04\xa3\ + \x01\x1f*\n\r\n\x05\x04\x18\x02\x03\x03\x12\x04\xa3\x0167\n\x0c\n\x04\ + \x04\x18\x02\x04\x12\x04\xa4\x01\x048\n\r\n\x05\x04\x18\x02\x04\x04\x12\ + \x04\xa4\x01\x04\x0c\n\r\n\x05\x04\x18\x02\x04\x06\x12\x04\xa4\x01\r\"\n\ + \r\n\x05\x04\x18\x02\x04\x01\x12\x04\xa4\x01#2\n\r\n\x05\x04\x18\x02\x04\ + \x03\x12\x04\xa4\x0167\n\x0c\n\x04\x04\x18\x02\x05\x12\x04\xa5\x01\x048\ + \n\r\n\x05\x04\x18\x02\x05\x04\x12\x04\xa5\x01\x04\x0c\n\r\n\x05\x04\x18\ + \x02\x05\x06\x12\x04\xa5\x01\r\x1e\n\r\n\x05\x04\x18\x02\x05\x01\x12\x04\ + \xa5\x01\x1f*\n\r\n\x05\x04\x18\x02\x05\x03\x12\x04\xa5\x0167\n\x0c\n\ + \x02\x04\x19\x12\x06\xa8\x01\0\xaf\x01\x01\n\x0b\n\x03\x04\x19\x01\x12\ + \x04\xa8\x01\x08\x15\n\x0c\n\x04\x04\x19\x02\0\x12\x04\xa9\x01\x048\n\r\ + \n\x05\x04\x19\x02\0\x04\x12\x04\xa9\x01\x04\x0c\n\r\n\x05\x04\x19\x02\0\ + \x06\x12\x04\xa9\x01\r\x19\n\r\n\x05\x04\x19\x02\0\x01\x12\x04\xa9\x01\ + \x1a\"\n\r\n\x05\x04\x19\x02\0\x03\x12\x04\xa9\x0167\n\x0c\n\x04\x04\x19\ + \x02\x01\x12\x04\xaa\x01\x048\n\r\n\x05\x04\x19\x02\x01\x04\x12\x04\xaa\ + \x01\x04\x0c\n\r\n\x05\x04\x19\x02\x01\x06\x12\x04\xaa\x01\r\x1f\n\r\n\ + \x05\x04\x19\x02\x01\x01\x12\x04\xaa\x01\x20+\n\r\n\x05\x04\x19\x02\x01\ + \x03\x12\x04\xaa\x0167\n\x0c\n\x04\x04\x19\x02\x02\x12\x04\xab\x01\x048\ + \n\r\n\x05\x04\x19\x02\x02\x04\x12\x04\xab\x01\x04\x0c\n\r\n\x05\x04\x19\ + \x02\x02\x06\x12\x04\xab\x01\r\x1a\n\r\n\x05\x04\x19\x02\x02\x01\x12\x04\ + \xab\x01\x1b\x20\n\r\n\x05\x04\x19\x02\x02\x03\x12\x04\xab\x0167\n\x0c\n\ + \x04\x04\x19\x02\x03\x12\x04\xac\x01\x048\n\r\n\x05\x04\x19\x02\x03\x04\ + \x12\x04\xac\x01\x04\x0c\n\r\n\x05\x04\x19\x02\x03\x06\x12\x04\xac\x01\r\ + \x1f\n\r\n\x05\x04\x19\x02\x03\x01\x12\x04\xac\x01\x20+\n\r\n\x05\x04\ + \x19\x02\x03\x03\x12\x04\xac\x0167\n\x0c\n\x04\x04\x19\x02\x04\x12\x04\ + \xad\x01\x048\n\r\n\x05\x04\x19\x02\x04\x04\x12\x04\xad\x01\x04\x0c\n\r\ + \n\x05\x04\x19\x02\x04\x06\x12\x04\xad\x01\r#\n\r\n\x05\x04\x19\x02\x04\ + \x01\x12\x04\xad\x01$3\n\r\n\x05\x04\x19\x02\x04\x03\x12\x04\xad\x0167\n\ + \x0c\n\x04\x04\x19\x02\x05\x12\x04\xae\x01\x048\n\r\n\x05\x04\x19\x02\ + \x05\x04\x12\x04\xae\x01\x04\x0c\n\r\n\x05\x04\x19\x02\x05\x06\x12\x04\ + \xae\x01\r\x1f\n\r\n\x05\x04\x19\x02\x05\x01\x12\x04\xae\x01\x20+\n\r\n\ + \x05\x04\x19\x02\x05\x03\x12\x04\xae\x0167\n1\n\x02\x04\x1a\x12\x06\xb2\ + \x01\0\xb4\x01\x01\x1a#\x20For\x20get\x20the\x20leader\x20of\x20the\x20r\ + egion.\n\n\x0b\n\x03\x04\x1a\x01\x12\x04\xb2\x01\x08\x1b\n\x0c\n\x02\x04\ + \x1b\x12\x06\xb6\x01\0\xb8\x01\x01\n\x0b\n\x03\x04\x1b\x01\x12\x04\xb6\ + \x01\x08\x1c\n\x0c\n\x04\x04\x1b\x02\0\x12\x04\xb7\x01\x04$\n\r\n\x05\ + \x04\x1b\x02\0\x04\x12\x04\xb7\x01\x04\x0c\n\r\n\x05\x04\x1b\x02\0\x06\ + \x12\x04\xb7\x01\r\x18\n\r\n\x05\x04\x1b\x02\0\x01\x12\x04\xb7\x01\x19\ + \x1f\n\r\n\x05\x04\x1b\x02\0\x03\x12\x04\xb7\x01\"#\n\xe4\x04\n\x02\x04\ + \x1c\x12\x06\xc3\x01\0\xc5\x01\x01\x1a\xd5\x04\x20For\x20getting\x20more\ + \x20information\x20of\x20the\x20region.\n\x20We\x20add\x20some\x20admin\ + \x20operations\x20(ChangePeer,\x20Split...)\x20into\x20the\x20pb\x20job\ + \x20list,\n\x20then\x20pd\x20server\x20will\x20peek\x20the\x20first\x20o\ + ne,\x20handle\x20it\x20and\x20then\x20pop\x20it\x20from\x20the\x20job\ + \x20lib.\x20\n\x20But\x20sometimes,\x20the\x20pd\x20server\x20may\x20cra\ + sh\x20before\x20popping.\x20When\x20another\x20pd\x20server\n\x20starts\ + \x20and\x20finds\x20the\x20job\x20is\x20running\x20but\x20not\x20finishe\ + d,\x20it\x20will\x20first\x20check\x20whether\n\x20the\x20raft\x20server\ + \x20already\x20has\x20handled\x20this\x20job.\n\x20E,g,\x20for\x20Change\ + Peer,\x20if\x20we\x20add\x20Peer10\x20into\x20region1\x20and\x20find\x20\ + region1\x20has\x20already\x20had\n\x20Peer10,\x20we\x20can\x20think\x20t\ + his\x20ChangePeer\x20is\x20finished,\x20and\x20can\x20pop\x20this\x20job\ + \x20from\x20job\x20list\n\x20directly.\n\n\x0b\n\x03\x04\x1c\x01\x12\x04\ + \xc3\x01\x08\x1b\n\x0c\n\x02\x04\x1d\x12\x06\xc7\x01\0\xca\x01\x01\n\x0b\ + \n\x03\x04\x1d\x01\x12\x04\xc7\x01\x08\x1c\n\x0c\n\x04\x04\x1d\x02\0\x12\ + \x04\xc8\x01\x04'\n\r\n\x05\x04\x1d\x02\0\x04\x12\x04\xc8\x01\x04\x0c\n\ + \r\n\x05\x04\x1d\x02\0\x06\x12\x04\xc8\x01\r\x1a\n\r\n\x05\x04\x1d\x02\0\ + \x01\x12\x04\xc8\x01\x1b!\n\r\n\x05\x04\x1d\x02\0\x03\x12\x04\xc8\x01%&\ + \n\x0c\n\x04\x04\x1d\x02\x01\x12\x04\xc9\x01\x04'\n\r\n\x05\x04\x1d\x02\ + \x01\x04\x12\x04\xc9\x01\x04\x0c\n\r\n\x05\x04\x1d\x02\x01\x06\x12\x04\ + \xc9\x01\r\x18\n\r\n\x05\x04\x1d\x02\x01\x01\x12\x04\xc9\x01\x19\x1f\n\r\ + \n\x05\x04\x1d\x02\x01\x03\x12\x04\xc9\x01%&\n\x0c\n\x02\x05\x02\x12\x06\ + \xcd\x01\0\xd1\x01\x01\n\x0b\n\x03\x05\x02\x01\x12\x04\xcd\x01\x05\x12\n\ + \x0c\n\x04\x05\x02\x02\0\x12\x04\xce\x01\x04\x19\n\r\n\x05\x05\x02\x02\0\ + \x01\x12\x04\xce\x01\x04\x11\n\r\n\x05\x05\x02\x02\0\x02\x12\x04\xce\x01\ + \x17\x18\n\x0c\n\x04\x05\x02\x02\x01\x12\x04\xcf\x01\x04\x19\n\r\n\x05\ + \x05\x02\x02\x01\x01\x12\x04\xcf\x01\x04\x10\n\r\n\x05\x05\x02\x02\x01\ + \x02\x12\x04\xcf\x01\x17\x18\n\x0c\n\x04\x05\x02\x02\x02\x12\x04\xd0\x01\ + \x04\x19\n\r\n\x05\x05\x02\x02\x02\x01\x12\x04\xd0\x01\x04\x10\n\r\n\x05\ + \x05\x02\x02\x02\x02\x12\x04\xd0\x01\x17\x18\n\x0c\n\x02\x04\x1e\x12\x06\ + \xd3\x01\0\xd7\x01\x01\n\x0b\n\x03\x04\x1e\x01\x12\x04\xd3\x01\x08\x15\n\ + \x0c\n\x04\x04\x1e\x02\0\x12\x04\xd4\x01\x046\n\r\n\x05\x04\x1e\x02\0\ + \x04\x12\x04\xd4\x01\x04\x0c\n\r\n\x05\x04\x1e\x02\0\x06\x12\x04\xd4\x01\ + \r\x1a\n\r\n\x05\x04\x1e\x02\0\x01\x12\x04\xd4\x01\x1b#\n\r\n\x05\x04\ + \x1e\x02\0\x03\x12\x04\xd4\x0145\n\x0c\n\x04\x04\x1e\x02\x01\x12\x04\xd5\ + \x01\x046\n\r\n\x05\x04\x1e\x02\x01\x04\x12\x04\xd5\x01\x04\x0c\n\r\n\ + \x05\x04\x1e\x02\x01\x06\x12\x04\xd5\x01\r\x20\n\r\n\x05\x04\x1e\x02\x01\ + \x01\x12\x04\xd5\x01!.\n\r\n\x05\x04\x1e\x02\x01\x03\x12\x04\xd5\x0145\n\ + \x0c\n\x04\x04\x1e\x02\x02\x12\x04\xd6\x01\x046\n\r\n\x05\x04\x1e\x02\ + \x02\x04\x12\x04\xd6\x01\x04\x0c\n\r\n\x05\x04\x1e\x02\x02\x06\x12\x04\ + \xd6\x01\r\x20\n\r\n\x05\x04\x1e\x02\x02\x01\x12\x04\xd6\x01!.\n\r\n\x05\ + \x04\x1e\x02\x02\x03\x12\x04\xd6\x0145\n\x0c\n\x02\x04\x1f\x12\x06\xd9\ + \x01\0\xdd\x01\x01\n\x0b\n\x03\x04\x1f\x01\x12\x04\xd9\x01\x08\x16\n\x0c\ + \n\x04\x04\x1f\x02\0\x12\x04\xda\x01\x046\n\r\n\x05\x04\x1f\x02\0\x04\ + \x12\x04\xda\x01\x04\x0c\n\r\n\x05\x04\x1f\x02\0\x06\x12\x04\xda\x01\r\ + \x1a\n\r\n\x05\x04\x1f\x02\0\x01\x12\x04\xda\x01\x1b#\n\r\n\x05\x04\x1f\ + \x02\0\x03\x12\x04\xda\x0145\n\x0c\n\x04\x04\x1f\x02\x01\x12\x04\xdb\x01\ + \x046\n\r\n\x05\x04\x1f\x02\x01\x04\x12\x04\xdb\x01\x04\x0c\n\r\n\x05\ + \x04\x1f\x02\x01\x06\x12\x04\xdb\x01\r!\n\r\n\x05\x04\x1f\x02\x01\x01\ + \x12\x04\xdb\x01\"/\n\r\n\x05\x04\x1f\x02\x01\x03\x12\x04\xdb\x0145\n\ + \x0c\n\x04\x04\x1f\x02\x02\x12\x04\xdc\x01\x046\n\r\n\x05\x04\x1f\x02\ + \x02\x04\x12\x04\xdc\x01\x04\x0c\n\r\n\x05\x04\x1f\x02\x02\x06\x12\x04\ + \xdc\x01\r!\n\r\n\x05\x04\x1f\x02\x02\x01\x12\x04\xdc\x01\"/\n\r\n\x05\ + \x04\x1f\x02\x02\x03\x12\x04\xdc\x0145\n\x0c\n\x02\x04\x20\x12\x06\xdf\ + \x01\0\xe9\x01\x01\n\x0b\n\x03\x04\x20\x01\x12\x04\xdf\x01\x08\x19\n\x0c\ + \n\x04\x04\x20\x02\0\x12\x04\xe0\x01\x044\n\r\n\x05\x04\x20\x02\0\x04\ + \x12\x04\xe0\x01\x04\x0c\n\r\n\x05\x04\x20\x02\0\x05\x12\x04\xe0\x01\r\ + \x13\n\r\n\x05\x04\x20\x02\0\x01\x12\x04\xe0\x01\x14\x1d\n\r\n\x05\x04\ + \x20\x02\0\x03\x12\x04\xe0\x0123\n\x0c\n\x04\x04\x20\x02\x01\x12\x04\xe1\ + \x01\x044\n\r\n\x05\x04\x20\x02\x01\x04\x12\x04\xe1\x01\x04\x0c\n\r\n\ + \x05\x04\x20\x02\x01\x06\x12\x04\xe1\x01\r\x18\n\r\n\x05\x04\x20\x02\x01\ + \x01\x12\x04\xe1\x01\x19\x1d\n\r\n\x05\x04\x20\x02\x01\x03\x12\x04\xe1\ + \x0123\n+\n\x04\x04\x20\x02\x02\x12\x04\xe3\x01\x044\x1a\x1d\x20true\x20\ + for\x20read\x20linearization\n\n\r\n\x05\x04\x20\x02\x02\x04\x12\x04\xe3\ + \x01\x04\x0c\n\r\n\x05\x04\x20\x02\x02\x05\x12\x04\xe3\x01\r\x11\n\r\n\ + \x05\x04\x20\x02\x02\x01\x12\x04\xe3\x01\x12\x1d\n\r\n\x05\x04\x20\x02\ + \x02\x03\x12\x04\xe3\x0123\n3\n\x04\x04\x20\x02\x03\x12\x04\xe5\x01\x044\ + \x1a%\x2016\x20bytes,\x20to\x20distinguish\x20request.\x20\x20\n\n\r\n\ + \x05\x04\x20\x02\x03\x04\x12\x04\xe5\x01\x04\x0c\n\r\n\x05\x04\x20\x02\ + \x03\x05\x12\x04\xe5\x01\r\x12\n\r\n\x05\x04\x20\x02\x03\x01\x12\x04\xe5\ + \x01\x13\x17\n\r\n\x05\x04\x20\x02\x03\x03\x12\x04\xe5\x0123\n\x0c\n\x04\ + \x04\x20\x02\x04\x12\x04\xe7\x01\x044\n\r\n\x05\x04\x20\x02\x04\x04\x12\ + \x04\xe7\x01\x04\x0c\n\r\n\x05\x04\x20\x02\x04\x06\x12\x04\xe7\x01\r\x1f\ + \n\r\n\x05\x04\x20\x02\x04\x01\x12\x04\xe7\x01\x20,\n\r\n\x05\x04\x20\ + \x02\x04\x03\x12\x04\xe7\x0123\n\x0c\n\x04\x04\x20\x02\x05\x12\x04\xe8\ + \x01\x044\n\r\n\x05\x04\x20\x02\x05\x04\x12\x04\xe8\x01\x04\x0c\n\r\n\ + \x05\x04\x20\x02\x05\x05\x12\x04\xe8\x01\r\x13\n\r\n\x05\x04\x20\x02\x05\ + \x01\x12\x04\xe8\x01\x14\x18\n\r\n\x05\x04\x20\x02\x05\x03\x12\x04\xe8\ + \x0123\n\x0c\n\x02\x04!\x12\x06\xeb\x01\0\xef\x01\x01\n\x0b\n\x03\x04!\ + \x01\x12\x04\xeb\x01\x08\x1a\n\x0c\n\x04\x04!\x02\0\x12\x04\xec\x01\x04&\ + \n\r\n\x05\x04!\x02\0\x04\x12\x04\xec\x01\x04\x0c\n\r\n\x05\x04!\x02\0\ + \x06\x12\x04\xec\x01\r\x1a\n\r\n\x05\x04!\x02\0\x01\x12\x04\xec\x01\x1b\ + \x20\n\r\n\x05\x04!\x02\0\x03\x12\x04\xec\x01$%\n\x0c\n\x04\x04!\x02\x01\ + \x12\x04\xed\x01\x04&\n\r\n\x05\x04!\x02\x01\x04\x12\x04\xed\x01\x04\x0c\ + \n\r\n\x05\x04!\x02\x01\x05\x12\x04\xed\x01\r\x12\n\r\n\x05\x04!\x02\x01\ + \x01\x12\x04\xed\x01\x13\x17\n\r\n\x05\x04!\x02\x01\x03\x12\x04\xed\x01$\ + %\n\x0c\n\x04\x04!\x02\x02\x12\x04\xee\x01\x04&\n\r\n\x05\x04!\x02\x02\ + \x04\x12\x04\xee\x01\x04\x0c\n\r\n\x05\x04!\x02\x02\x05\x12\x04\xee\x01\ + \r\x13\n\r\n\x05\x04!\x02\x02\x01\x12\x04\xee\x01\x14\x20\n\r\n\x05\x04!\ + \x02\x02\x03\x12\x04\xee\x01$%\n\x0c\n\x02\x04\"\x12\x06\xf1\x01\0\xf8\ + \x01\x01\n\x0b\n\x03\x04\"\x01\x12\x04\xf1\x01\x08\x16\n\x0c\n\x04\x04\"\ + \x02\0\x12\x04\xf2\x01\x04.\n\r\n\x05\x04\"\x02\0\x04\x12\x04\xf2\x01\ + \x04\x0c\n\r\n\x05\x04\"\x02\0\x06\x12\x04\xf2\x01\r\x1e\n\r\n\x05\x04\"\ + \x02\0\x01\x12\x04\xf2\x01\x1f%\n\r\n\x05\x04\"\x02\0\x03\x12\x04\xf2\ + \x01,-\nZ\n\x04\x04\"\x02\x01\x12\x04\xf5\x01\x04.\x1aL\x20We\x20can't\ + \x20enclose\x20normal\x20requests\x20and\x20administrator\x20request\n\ + \x20at\x20same\x20time.\x20\n\n\r\n\x05\x04\"\x02\x01\x04\x12\x04\xf5\ + \x01\x04\x0c\n\r\n\x05\x04\"\x02\x01\x06\x12\x04\xf5\x01\r\x14\n\r\n\x05\ + \x04\"\x02\x01\x01\x12\x04\xf5\x01\x15\x1d\n\r\n\x05\x04\"\x02\x01\x03\ + \x12\x04\xf5\x01,-\n\x0c\n\x04\x04\"\x02\x02\x12\x04\xf6\x01\x04.\n\r\n\ + \x05\x04\"\x02\x02\x04\x12\x04\xf6\x01\x04\x0c\n\r\n\x05\x04\"\x02\x02\ + \x06\x12\x04\xf6\x01\r\x19\n\r\n\x05\x04\"\x02\x02\x01\x12\x04\xf6\x01\ + \x1a'\n\r\n\x05\x04\"\x02\x02\x03\x12\x04\xf6\x01,-\n\x0c\n\x04\x04\"\ + \x02\x03\x12\x04\xf7\x01\x04.\n\r\n\x05\x04\"\x02\x03\x04\x12\x04\xf7\ + \x01\x04\x0c\n\r\n\x05\x04\"\x02\x03\x06\x12\x04\xf7\x01\r\x1a\n\r\n\x05\ + \x04\"\x02\x03\x01\x12\x04\xf7\x01\x1b)\n\r\n\x05\x04\"\x02\x03\x03\x12\ + \x04\xf7\x01,-\n\x0c\n\x02\x04#\x12\x06\xfa\x01\0\xff\x01\x01\n\x0b\n\ + \x03\x04#\x01\x12\x04\xfa\x01\x08\x17\n\x0c\n\x04\x04#\x02\0\x12\x04\xfb\ + \x01\x040\n\r\n\x05\x04#\x02\0\x04\x12\x04\xfb\x01\x04\x0c\n\r\n\x05\x04\ + #\x02\0\x06\x12\x04\xfb\x01\r\x1f\n\r\n\x05\x04#\x02\0\x01\x12\x04\xfb\ + \x01\x20&\n\r\n\x05\x04#\x02\0\x03\x12\x04\xfb\x01./\n\x0c\n\x04\x04#\ + \x02\x01\x12\x04\xfc\x01\x040\n\r\n\x05\x04#\x02\x01\x04\x12\x04\xfc\x01\ + \x04\x0c\n\r\n\x05\x04#\x02\x01\x06\x12\x04\xfc\x01\r\x15\n\r\n\x05\x04#\ + \x02\x01\x01\x12\x04\xfc\x01\x16\x1f\n\r\n\x05\x04#\x02\x01\x03\x12\x04\ + \xfc\x01./\n\x0c\n\x04\x04#\x02\x02\x12\x04\xfd\x01\x040\n\r\n\x05\x04#\ + \x02\x02\x04\x12\x04\xfd\x01\x04\x0c\n\r\n\x05\x04#\x02\x02\x06\x12\x04\ + \xfd\x01\r\x1a\n\r\n\x05\x04#\x02\x02\x01\x12\x04\xfd\x01\x1b)\n\r\n\x05\ + \x04#\x02\x02\x03\x12\x04\xfd\x01./\n\x0c\n\x04\x04#\x02\x03\x12\x04\xfe\ + \x01\x040\n\r\n\x05\x04#\x02\x03\x04\x12\x04\xfe\x01\x04\x0c\n\r\n\x05\ + \x04#\x02\x03\x06\x12\x04\xfe\x01\r\x1b\n\r\n\x05\x04#\x02\x03\x01\x12\ + \x04\xfe\x01\x1c+\n\r\n\x05\x04#\x02\x03\x03\x12\x04\xfe\x01./\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/src/raft_serverpb.rs b/_vendor/src/github.com/pingcap/kvproto/src/raft_serverpb.rs new file mode 100644 index 00000000000..2d345ccdcb0 --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/src/raft_serverpb.rs @@ -0,0 +1,3400 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy)] + +#![cfg_attr(rustfmt, rustfmt_skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(PartialEq,Clone,Default)] +pub struct RaftMessage { + // message fields + pub region_id: u64, + pub from_peer: ::protobuf::SingularPtrField, + pub to_peer: ::protobuf::SingularPtrField, + pub message: ::protobuf::SingularPtrField, + pub region_epoch: ::protobuf::SingularPtrField, + pub is_tombstone: bool, + pub start_key: ::std::vec::Vec, + pub end_key: ::std::vec::Vec, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RaftMessage {} + +impl RaftMessage { + pub fn new() -> RaftMessage { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RaftMessage { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RaftMessage, + }; + unsafe { + instance.get(RaftMessage::new) + } + } + + // uint64 region_id = 1; + + pub fn clear_region_id(&mut self) { + self.region_id = 0; + } + + // Param is passed by value, moved + pub fn set_region_id(&mut self, v: u64) { + self.region_id = v; + } + + pub fn get_region_id(&self) -> u64 { + self.region_id + } + + fn get_region_id_for_reflect(&self) -> &u64 { + &self.region_id + } + + fn mut_region_id_for_reflect(&mut self) -> &mut u64 { + &mut self.region_id + } + + // .metapb.Peer from_peer = 2; + + pub fn clear_from_peer(&mut self) { + self.from_peer.clear(); + } + + pub fn has_from_peer(&self) -> bool { + self.from_peer.is_some() + } + + // Param is passed by value, moved + pub fn set_from_peer(&mut self, v: super::metapb::Peer) { + self.from_peer = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_from_peer(&mut self) -> &mut super::metapb::Peer { + if self.from_peer.is_none() { + self.from_peer.set_default(); + } + self.from_peer.as_mut().unwrap() + } + + // Take field + pub fn take_from_peer(&mut self) -> super::metapb::Peer { + self.from_peer.take().unwrap_or_else(|| super::metapb::Peer::new()) + } + + pub fn get_from_peer(&self) -> &super::metapb::Peer { + self.from_peer.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) + } + + fn get_from_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.from_peer + } + + fn mut_from_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.from_peer + } + + // .metapb.Peer to_peer = 3; + + pub fn clear_to_peer(&mut self) { + self.to_peer.clear(); + } + + pub fn has_to_peer(&self) -> bool { + self.to_peer.is_some() + } + + // Param is passed by value, moved + pub fn set_to_peer(&mut self, v: super::metapb::Peer) { + self.to_peer = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_to_peer(&mut self) -> &mut super::metapb::Peer { + if self.to_peer.is_none() { + self.to_peer.set_default(); + } + self.to_peer.as_mut().unwrap() + } + + // Take field + pub fn take_to_peer(&mut self) -> super::metapb::Peer { + self.to_peer.take().unwrap_or_else(|| super::metapb::Peer::new()) + } + + pub fn get_to_peer(&self) -> &super::metapb::Peer { + self.to_peer.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) + } + + fn get_to_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.to_peer + } + + fn mut_to_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.to_peer + } + + // .eraftpb.Message message = 4; + + pub fn clear_message(&mut self) { + self.message.clear(); + } + + pub fn has_message(&self) -> bool { + self.message.is_some() + } + + // Param is passed by value, moved + pub fn set_message(&mut self, v: super::eraftpb::Message) { + self.message = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_message(&mut self) -> &mut super::eraftpb::Message { + if self.message.is_none() { + self.message.set_default(); + } + self.message.as_mut().unwrap() + } + + // Take field + pub fn take_message(&mut self) -> super::eraftpb::Message { + self.message.take().unwrap_or_else(|| super::eraftpb::Message::new()) + } + + pub fn get_message(&self) -> &super::eraftpb::Message { + self.message.as_ref().unwrap_or_else(|| super::eraftpb::Message::default_instance()) + } + + fn get_message_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.message + } + + fn mut_message_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.message + } + + // .metapb.RegionEpoch region_epoch = 5; + + pub fn clear_region_epoch(&mut self) { + self.region_epoch.clear(); + } + + pub fn has_region_epoch(&self) -> bool { + self.region_epoch.is_some() + } + + // Param is passed by value, moved + pub fn set_region_epoch(&mut self, v: super::metapb::RegionEpoch) { + self.region_epoch = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region_epoch(&mut self) -> &mut super::metapb::RegionEpoch { + if self.region_epoch.is_none() { + self.region_epoch.set_default(); + } + self.region_epoch.as_mut().unwrap() + } + + // Take field + pub fn take_region_epoch(&mut self) -> super::metapb::RegionEpoch { + self.region_epoch.take().unwrap_or_else(|| super::metapb::RegionEpoch::new()) + } + + pub fn get_region_epoch(&self) -> &super::metapb::RegionEpoch { + self.region_epoch.as_ref().unwrap_or_else(|| super::metapb::RegionEpoch::default_instance()) + } + + fn get_region_epoch_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region_epoch + } + + fn mut_region_epoch_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region_epoch + } + + // bool is_tombstone = 6; + + pub fn clear_is_tombstone(&mut self) { + self.is_tombstone = false; + } + + // Param is passed by value, moved + pub fn set_is_tombstone(&mut self, v: bool) { + self.is_tombstone = v; + } + + pub fn get_is_tombstone(&self) -> bool { + self.is_tombstone + } + + fn get_is_tombstone_for_reflect(&self) -> &bool { + &self.is_tombstone + } + + fn mut_is_tombstone_for_reflect(&mut self) -> &mut bool { + &mut self.is_tombstone + } + + // bytes start_key = 7; + + pub fn clear_start_key(&mut self) { + self.start_key.clear(); + } + + // Param is passed by value, moved + pub fn set_start_key(&mut self, v: ::std::vec::Vec) { + self.start_key = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_start_key(&mut self) -> &mut ::std::vec::Vec { + &mut self.start_key + } + + // Take field + pub fn take_start_key(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.start_key, ::std::vec::Vec::new()) + } + + pub fn get_start_key(&self) -> &[u8] { + &self.start_key + } + + fn get_start_key_for_reflect(&self) -> &::std::vec::Vec { + &self.start_key + } + + fn mut_start_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.start_key + } + + // bytes end_key = 8; + + pub fn clear_end_key(&mut self) { + self.end_key.clear(); + } + + // Param is passed by value, moved + pub fn set_end_key(&mut self, v: ::std::vec::Vec) { + self.end_key = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_end_key(&mut self) -> &mut ::std::vec::Vec { + &mut self.end_key + } + + // Take field + pub fn take_end_key(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.end_key, ::std::vec::Vec::new()) + } + + pub fn get_end_key(&self) -> &[u8] { + &self.end_key + } + + fn get_end_key_for_reflect(&self) -> &::std::vec::Vec { + &self.end_key + } + + fn mut_end_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.end_key + } +} + +impl ::protobuf::Message for RaftMessage { + fn is_initialized(&self) -> bool { + for v in &self.from_peer { + if !v.is_initialized() { + return false; + } + }; + for v in &self.to_peer { + if !v.is_initialized() { + return false; + } + }; + for v in &self.message { + if !v.is_initialized() { + return false; + } + }; + for v in &self.region_epoch { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.region_id = tmp; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.from_peer)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.to_peer)?; + }, + 4 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.message)?; + }, + 5 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_epoch)?; + }, + 6 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.is_tombstone = tmp; + }, + 7 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.start_key)?; + }, + 8 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.end_key)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.region_id != 0 { + my_size += ::protobuf::rt::value_size(1, self.region_id, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.from_peer.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.to_peer.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.message.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.region_epoch.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.is_tombstone != false { + my_size += 2; + } + if !self.start_key.is_empty() { + my_size += ::protobuf::rt::bytes_size(7, &self.start_key); + } + if !self.end_key.is_empty() { + my_size += ::protobuf::rt::bytes_size(8, &self.end_key); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.region_id != 0 { + os.write_uint64(1, self.region_id)?; + } + if let Some(ref v) = self.from_peer.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.to_peer.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.message.as_ref() { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.region_epoch.as_ref() { + os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.is_tombstone != false { + os.write_bool(6, self.is_tombstone)?; + } + if !self.start_key.is_empty() { + os.write_bytes(7, &self.start_key)?; + } + if !self.end_key.is_empty() { + os.write_bytes(8, &self.end_key)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RaftMessage { + fn new() -> RaftMessage { + RaftMessage::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "region_id", + RaftMessage::get_region_id_for_reflect, + RaftMessage::mut_region_id_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "from_peer", + RaftMessage::get_from_peer_for_reflect, + RaftMessage::mut_from_peer_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "to_peer", + RaftMessage::get_to_peer_for_reflect, + RaftMessage::mut_to_peer_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "message", + RaftMessage::get_message_for_reflect, + RaftMessage::mut_message_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region_epoch", + RaftMessage::get_region_epoch_for_reflect, + RaftMessage::mut_region_epoch_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "is_tombstone", + RaftMessage::get_is_tombstone_for_reflect, + RaftMessage::mut_is_tombstone_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "start_key", + RaftMessage::get_start_key_for_reflect, + RaftMessage::mut_start_key_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "end_key", + RaftMessage::get_end_key_for_reflect, + RaftMessage::mut_end_key_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RaftMessage", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RaftMessage { + fn clear(&mut self) { + self.clear_region_id(); + self.clear_from_peer(); + self.clear_to_peer(); + self.clear_message(); + self.clear_region_epoch(); + self.clear_is_tombstone(); + self.clear_start_key(); + self.clear_end_key(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RaftMessage { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RaftMessage { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RaftTruncatedState { + // message fields + pub index: u64, + pub term: u64, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RaftTruncatedState {} + +impl RaftTruncatedState { + pub fn new() -> RaftTruncatedState { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RaftTruncatedState { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RaftTruncatedState, + }; + unsafe { + instance.get(RaftTruncatedState::new) + } + } + + // uint64 index = 1; + + pub fn clear_index(&mut self) { + self.index = 0; + } + + // Param is passed by value, moved + pub fn set_index(&mut self, v: u64) { + self.index = v; + } + + pub fn get_index(&self) -> u64 { + self.index + } + + fn get_index_for_reflect(&self) -> &u64 { + &self.index + } + + fn mut_index_for_reflect(&mut self) -> &mut u64 { + &mut self.index + } + + // uint64 term = 2; + + pub fn clear_term(&mut self) { + self.term = 0; + } + + // Param is passed by value, moved + pub fn set_term(&mut self, v: u64) { + self.term = v; + } + + pub fn get_term(&self) -> u64 { + self.term + } + + fn get_term_for_reflect(&self) -> &u64 { + &self.term + } + + fn mut_term_for_reflect(&mut self) -> &mut u64 { + &mut self.term + } +} + +impl ::protobuf::Message for RaftTruncatedState { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.index = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.term = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.index != 0 { + my_size += ::protobuf::rt::value_size(1, self.index, ::protobuf::wire_format::WireTypeVarint); + } + if self.term != 0 { + my_size += ::protobuf::rt::value_size(2, self.term, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.index != 0 { + os.write_uint64(1, self.index)?; + } + if self.term != 0 { + os.write_uint64(2, self.term)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RaftTruncatedState { + fn new() -> RaftTruncatedState { + RaftTruncatedState::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "index", + RaftTruncatedState::get_index_for_reflect, + RaftTruncatedState::mut_index_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "term", + RaftTruncatedState::get_term_for_reflect, + RaftTruncatedState::mut_term_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RaftTruncatedState", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RaftTruncatedState { + fn clear(&mut self) { + self.clear_index(); + self.clear_term(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RaftTruncatedState { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RaftTruncatedState { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct SnapshotCFFile { + // message fields + pub cf: ::std::string::String, + pub size: u64, + pub checksum: u32, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for SnapshotCFFile {} + +impl SnapshotCFFile { + pub fn new() -> SnapshotCFFile { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static SnapshotCFFile { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const SnapshotCFFile, + }; + unsafe { + instance.get(SnapshotCFFile::new) + } + } + + // string cf = 1; + + pub fn clear_cf(&mut self) { + self.cf.clear(); + } + + // Param is passed by value, moved + pub fn set_cf(&mut self, v: ::std::string::String) { + self.cf = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_cf(&mut self) -> &mut ::std::string::String { + &mut self.cf + } + + // Take field + pub fn take_cf(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.cf, ::std::string::String::new()) + } + + pub fn get_cf(&self) -> &str { + &self.cf + } + + fn get_cf_for_reflect(&self) -> &::std::string::String { + &self.cf + } + + fn mut_cf_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.cf + } + + // uint64 size = 2; + + pub fn clear_size(&mut self) { + self.size = 0; + } + + // Param is passed by value, moved + pub fn set_size(&mut self, v: u64) { + self.size = v; + } + + pub fn get_size(&self) -> u64 { + self.size + } + + fn get_size_for_reflect(&self) -> &u64 { + &self.size + } + + fn mut_size_for_reflect(&mut self) -> &mut u64 { + &mut self.size + } + + // uint32 checksum = 3; + + pub fn clear_checksum(&mut self) { + self.checksum = 0; + } + + // Param is passed by value, moved + pub fn set_checksum(&mut self, v: u32) { + self.checksum = v; + } + + pub fn get_checksum(&self) -> u32 { + self.checksum + } + + fn get_checksum_for_reflect(&self) -> &u32 { + &self.checksum + } + + fn mut_checksum_for_reflect(&mut self) -> &mut u32 { + &mut self.checksum + } +} + +impl ::protobuf::Message for SnapshotCFFile { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.cf)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.size = tmp; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.checksum = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.cf.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.cf); + } + if self.size != 0 { + my_size += ::protobuf::rt::value_size(2, self.size, ::protobuf::wire_format::WireTypeVarint); + } + if self.checksum != 0 { + my_size += ::protobuf::rt::value_size(3, self.checksum, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.cf.is_empty() { + os.write_string(1, &self.cf)?; + } + if self.size != 0 { + os.write_uint64(2, self.size)?; + } + if self.checksum != 0 { + os.write_uint32(3, self.checksum)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for SnapshotCFFile { + fn new() -> SnapshotCFFile { + SnapshotCFFile::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "cf", + SnapshotCFFile::get_cf_for_reflect, + SnapshotCFFile::mut_cf_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "size", + SnapshotCFFile::get_size_for_reflect, + SnapshotCFFile::mut_size_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "checksum", + SnapshotCFFile::get_checksum_for_reflect, + SnapshotCFFile::mut_checksum_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "SnapshotCFFile", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for SnapshotCFFile { + fn clear(&mut self) { + self.clear_cf(); + self.clear_size(); + self.clear_checksum(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for SnapshotCFFile { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SnapshotCFFile { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct SnapshotMeta { + // message fields + pub cf_files: ::protobuf::RepeatedField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for SnapshotMeta {} + +impl SnapshotMeta { + pub fn new() -> SnapshotMeta { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static SnapshotMeta { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const SnapshotMeta, + }; + unsafe { + instance.get(SnapshotMeta::new) + } + } + + // repeated .raft_serverpb.SnapshotCFFile cf_files = 1; + + pub fn clear_cf_files(&mut self) { + self.cf_files.clear(); + } + + // Param is passed by value, moved + pub fn set_cf_files(&mut self, v: ::protobuf::RepeatedField) { + self.cf_files = v; + } + + // Mutable pointer to the field. + pub fn mut_cf_files(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.cf_files + } + + // Take field + pub fn take_cf_files(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.cf_files, ::protobuf::RepeatedField::new()) + } + + pub fn get_cf_files(&self) -> &[SnapshotCFFile] { + &self.cf_files + } + + fn get_cf_files_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.cf_files + } + + fn mut_cf_files_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.cf_files + } +} + +impl ::protobuf::Message for SnapshotMeta { + fn is_initialized(&self) -> bool { + for v in &self.cf_files { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.cf_files)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.cf_files { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + for v in &self.cf_files { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for SnapshotMeta { + fn new() -> SnapshotMeta { + SnapshotMeta::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "cf_files", + SnapshotMeta::get_cf_files_for_reflect, + SnapshotMeta::mut_cf_files_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "SnapshotMeta", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for SnapshotMeta { + fn clear(&mut self) { + self.clear_cf_files(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for SnapshotMeta { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SnapshotMeta { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct SnapshotChunk { + // message fields + pub message: ::protobuf::SingularPtrField, + pub data: ::std::vec::Vec, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for SnapshotChunk {} + +impl SnapshotChunk { + pub fn new() -> SnapshotChunk { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static SnapshotChunk { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const SnapshotChunk, + }; + unsafe { + instance.get(SnapshotChunk::new) + } + } + + // .raft_serverpb.RaftMessage message = 1; + + pub fn clear_message(&mut self) { + self.message.clear(); + } + + pub fn has_message(&self) -> bool { + self.message.is_some() + } + + // Param is passed by value, moved + pub fn set_message(&mut self, v: RaftMessage) { + self.message = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_message(&mut self) -> &mut RaftMessage { + if self.message.is_none() { + self.message.set_default(); + } + self.message.as_mut().unwrap() + } + + // Take field + pub fn take_message(&mut self) -> RaftMessage { + self.message.take().unwrap_or_else(|| RaftMessage::new()) + } + + pub fn get_message(&self) -> &RaftMessage { + self.message.as_ref().unwrap_or_else(|| RaftMessage::default_instance()) + } + + fn get_message_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.message + } + + fn mut_message_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.message + } + + // bytes data = 2; + + pub fn clear_data(&mut self) { + self.data.clear(); + } + + // Param is passed by value, moved + pub fn set_data(&mut self, v: ::std::vec::Vec) { + self.data = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { + &mut self.data + } + + // Take field + pub fn take_data(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.data, ::std::vec::Vec::new()) + } + + pub fn get_data(&self) -> &[u8] { + &self.data + } + + fn get_data_for_reflect(&self) -> &::std::vec::Vec { + &self.data + } + + fn mut_data_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.data + } +} + +impl ::protobuf::Message for SnapshotChunk { + fn is_initialized(&self) -> bool { + for v in &self.message { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.message)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.data)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.message.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.data.is_empty() { + my_size += ::protobuf::rt::bytes_size(2, &self.data); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.message.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.data.is_empty() { + os.write_bytes(2, &self.data)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for SnapshotChunk { + fn new() -> SnapshotChunk { + SnapshotChunk::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "message", + SnapshotChunk::get_message_for_reflect, + SnapshotChunk::mut_message_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "data", + SnapshotChunk::get_data_for_reflect, + SnapshotChunk::mut_data_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "SnapshotChunk", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for SnapshotChunk { + fn clear(&mut self) { + self.clear_message(); + self.clear_data(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for SnapshotChunk { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SnapshotChunk { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Done { + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Done {} + +impl Done { + pub fn new() -> Done { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static Done { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Done, + }; + unsafe { + instance.get(Done::new) + } + } +} + +impl ::protobuf::Message for Done { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for Done { + fn new() -> Done { + Done::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let fields = ::std::vec::Vec::new(); + ::protobuf::reflect::MessageDescriptor::new::( + "Done", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for Done { + fn clear(&mut self) { + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Done { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Done { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct KeyValue { + // message fields + pub key: ::std::vec::Vec, + pub value: ::std::vec::Vec, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for KeyValue {} + +impl KeyValue { + pub fn new() -> KeyValue { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static KeyValue { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const KeyValue, + }; + unsafe { + instance.get(KeyValue::new) + } + } + + // bytes key = 1; + + pub fn clear_key(&mut self) { + self.key.clear(); + } + + // Param is passed by value, moved + pub fn set_key(&mut self, v: ::std::vec::Vec) { + self.key = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { + &mut self.key + } + + // Take field + pub fn take_key(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) + } + + pub fn get_key(&self) -> &[u8] { + &self.key + } + + fn get_key_for_reflect(&self) -> &::std::vec::Vec { + &self.key + } + + fn mut_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.key + } + + // bytes value = 2; + + pub fn clear_value(&mut self) { + self.value.clear(); + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: ::std::vec::Vec) { + self.value = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { + &mut self.value + } + + // Take field + pub fn take_value(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.value, ::std::vec::Vec::new()) + } + + pub fn get_value(&self) -> &[u8] { + &self.value + } + + fn get_value_for_reflect(&self) -> &::std::vec::Vec { + &self.value + } + + fn mut_value_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.value + } +} + +impl ::protobuf::Message for KeyValue { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.value)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.key.is_empty() { + my_size += ::protobuf::rt::bytes_size(1, &self.key); + } + if !self.value.is_empty() { + my_size += ::protobuf::rt::bytes_size(2, &self.value); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.key.is_empty() { + os.write_bytes(1, &self.key)?; + } + if !self.value.is_empty() { + os.write_bytes(2, &self.value)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for KeyValue { + fn new() -> KeyValue { + KeyValue::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "key", + KeyValue::get_key_for_reflect, + KeyValue::mut_key_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "value", + KeyValue::get_value_for_reflect, + KeyValue::mut_value_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "KeyValue", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for KeyValue { + fn clear(&mut self) { + self.clear_key(); + self.clear_value(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for KeyValue { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for KeyValue { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RaftSnapshotData { + // message fields + pub region: ::protobuf::SingularPtrField, + pub file_size: u64, + pub data: ::protobuf::RepeatedField, + pub version: u64, + pub meta: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RaftSnapshotData {} + +impl RaftSnapshotData { + pub fn new() -> RaftSnapshotData { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RaftSnapshotData { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RaftSnapshotData, + }; + unsafe { + instance.get(RaftSnapshotData::new) + } + } + + // .metapb.Region region = 1; + + pub fn clear_region(&mut self) { + self.region.clear(); + } + + pub fn has_region(&self) -> bool { + self.region.is_some() + } + + // Param is passed by value, moved + pub fn set_region(&mut self, v: super::metapb::Region) { + self.region = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region(&mut self) -> &mut super::metapb::Region { + if self.region.is_none() { + self.region.set_default(); + } + self.region.as_mut().unwrap() + } + + // Take field + pub fn take_region(&mut self) -> super::metapb::Region { + self.region.take().unwrap_or_else(|| super::metapb::Region::new()) + } + + pub fn get_region(&self) -> &super::metapb::Region { + self.region.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) + } + + fn get_region_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region + } + + fn mut_region_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region + } + + // uint64 file_size = 2; + + pub fn clear_file_size(&mut self) { + self.file_size = 0; + } + + // Param is passed by value, moved + pub fn set_file_size(&mut self, v: u64) { + self.file_size = v; + } + + pub fn get_file_size(&self) -> u64 { + self.file_size + } + + fn get_file_size_for_reflect(&self) -> &u64 { + &self.file_size + } + + fn mut_file_size_for_reflect(&mut self) -> &mut u64 { + &mut self.file_size + } + + // repeated .raft_serverpb.KeyValue data = 3; + + pub fn clear_data(&mut self) { + self.data.clear(); + } + + // Param is passed by value, moved + pub fn set_data(&mut self, v: ::protobuf::RepeatedField) { + self.data = v; + } + + // Mutable pointer to the field. + pub fn mut_data(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.data + } + + // Take field + pub fn take_data(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.data, ::protobuf::RepeatedField::new()) + } + + pub fn get_data(&self) -> &[KeyValue] { + &self.data + } + + fn get_data_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.data + } + + fn mut_data_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.data + } + + // uint64 version = 4; + + pub fn clear_version(&mut self) { + self.version = 0; + } + + // Param is passed by value, moved + pub fn set_version(&mut self, v: u64) { + self.version = v; + } + + pub fn get_version(&self) -> u64 { + self.version + } + + fn get_version_for_reflect(&self) -> &u64 { + &self.version + } + + fn mut_version_for_reflect(&mut self) -> &mut u64 { + &mut self.version + } + + // .raft_serverpb.SnapshotMeta meta = 5; + + pub fn clear_meta(&mut self) { + self.meta.clear(); + } + + pub fn has_meta(&self) -> bool { + self.meta.is_some() + } + + // Param is passed by value, moved + pub fn set_meta(&mut self, v: SnapshotMeta) { + self.meta = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_meta(&mut self) -> &mut SnapshotMeta { + if self.meta.is_none() { + self.meta.set_default(); + } + self.meta.as_mut().unwrap() + } + + // Take field + pub fn take_meta(&mut self) -> SnapshotMeta { + self.meta.take().unwrap_or_else(|| SnapshotMeta::new()) + } + + pub fn get_meta(&self) -> &SnapshotMeta { + self.meta.as_ref().unwrap_or_else(|| SnapshotMeta::default_instance()) + } + + fn get_meta_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.meta + } + + fn mut_meta_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.meta + } +} + +impl ::protobuf::Message for RaftSnapshotData { + fn is_initialized(&self) -> bool { + for v in &self.region { + if !v.is_initialized() { + return false; + } + }; + for v in &self.data { + if !v.is_initialized() { + return false; + } + }; + for v in &self.meta { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.file_size = tmp; + }, + 3 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.data)?; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.version = tmp; + }, + 5 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.meta)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.region.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.file_size != 0 { + my_size += ::protobuf::rt::value_size(2, self.file_size, ::protobuf::wire_format::WireTypeVarint); + } + for value in &self.data { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if self.version != 0 { + my_size += ::protobuf::rt::value_size(4, self.version, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.meta.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.region.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.file_size != 0 { + os.write_uint64(2, self.file_size)?; + } + for v in &self.data { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if self.version != 0 { + os.write_uint64(4, self.version)?; + } + if let Some(ref v) = self.meta.as_ref() { + os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RaftSnapshotData { + fn new() -> RaftSnapshotData { + RaftSnapshotData::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region", + RaftSnapshotData::get_region_for_reflect, + RaftSnapshotData::mut_region_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "file_size", + RaftSnapshotData::get_file_size_for_reflect, + RaftSnapshotData::mut_file_size_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "data", + RaftSnapshotData::get_data_for_reflect, + RaftSnapshotData::mut_data_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "version", + RaftSnapshotData::get_version_for_reflect, + RaftSnapshotData::mut_version_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "meta", + RaftSnapshotData::get_meta_for_reflect, + RaftSnapshotData::mut_meta_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RaftSnapshotData", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RaftSnapshotData { + fn clear(&mut self) { + self.clear_region(); + self.clear_file_size(); + self.clear_data(); + self.clear_version(); + self.clear_meta(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RaftSnapshotData { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RaftSnapshotData { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct StoreIdent { + // message fields + pub cluster_id: u64, + pub store_id: u64, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for StoreIdent {} + +impl StoreIdent { + pub fn new() -> StoreIdent { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static StoreIdent { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const StoreIdent, + }; + unsafe { + instance.get(StoreIdent::new) + } + } + + // uint64 cluster_id = 1; + + pub fn clear_cluster_id(&mut self) { + self.cluster_id = 0; + } + + // Param is passed by value, moved + pub fn set_cluster_id(&mut self, v: u64) { + self.cluster_id = v; + } + + pub fn get_cluster_id(&self) -> u64 { + self.cluster_id + } + + fn get_cluster_id_for_reflect(&self) -> &u64 { + &self.cluster_id + } + + fn mut_cluster_id_for_reflect(&mut self) -> &mut u64 { + &mut self.cluster_id + } + + // uint64 store_id = 2; + + pub fn clear_store_id(&mut self) { + self.store_id = 0; + } + + // Param is passed by value, moved + pub fn set_store_id(&mut self, v: u64) { + self.store_id = v; + } + + pub fn get_store_id(&self) -> u64 { + self.store_id + } + + fn get_store_id_for_reflect(&self) -> &u64 { + &self.store_id + } + + fn mut_store_id_for_reflect(&mut self) -> &mut u64 { + &mut self.store_id + } +} + +impl ::protobuf::Message for StoreIdent { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.cluster_id = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.store_id = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.cluster_id != 0 { + my_size += ::protobuf::rt::value_size(1, self.cluster_id, ::protobuf::wire_format::WireTypeVarint); + } + if self.store_id != 0 { + my_size += ::protobuf::rt::value_size(2, self.store_id, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.cluster_id != 0 { + os.write_uint64(1, self.cluster_id)?; + } + if self.store_id != 0 { + os.write_uint64(2, self.store_id)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for StoreIdent { + fn new() -> StoreIdent { + StoreIdent::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "cluster_id", + StoreIdent::get_cluster_id_for_reflect, + StoreIdent::mut_cluster_id_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "store_id", + StoreIdent::get_store_id_for_reflect, + StoreIdent::mut_store_id_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "StoreIdent", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for StoreIdent { + fn clear(&mut self) { + self.clear_cluster_id(); + self.clear_store_id(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for StoreIdent { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StoreIdent { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RaftLocalState { + // message fields + pub hard_state: ::protobuf::SingularPtrField, + pub last_index: u64, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RaftLocalState {} + +impl RaftLocalState { + pub fn new() -> RaftLocalState { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RaftLocalState { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RaftLocalState, + }; + unsafe { + instance.get(RaftLocalState::new) + } + } + + // .eraftpb.HardState hard_state = 1; + + pub fn clear_hard_state(&mut self) { + self.hard_state.clear(); + } + + pub fn has_hard_state(&self) -> bool { + self.hard_state.is_some() + } + + // Param is passed by value, moved + pub fn set_hard_state(&mut self, v: super::eraftpb::HardState) { + self.hard_state = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_hard_state(&mut self) -> &mut super::eraftpb::HardState { + if self.hard_state.is_none() { + self.hard_state.set_default(); + } + self.hard_state.as_mut().unwrap() + } + + // Take field + pub fn take_hard_state(&mut self) -> super::eraftpb::HardState { + self.hard_state.take().unwrap_or_else(|| super::eraftpb::HardState::new()) + } + + pub fn get_hard_state(&self) -> &super::eraftpb::HardState { + self.hard_state.as_ref().unwrap_or_else(|| super::eraftpb::HardState::default_instance()) + } + + fn get_hard_state_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.hard_state + } + + fn mut_hard_state_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.hard_state + } + + // uint64 last_index = 2; + + pub fn clear_last_index(&mut self) { + self.last_index = 0; + } + + // Param is passed by value, moved + pub fn set_last_index(&mut self, v: u64) { + self.last_index = v; + } + + pub fn get_last_index(&self) -> u64 { + self.last_index + } + + fn get_last_index_for_reflect(&self) -> &u64 { + &self.last_index + } + + fn mut_last_index_for_reflect(&mut self) -> &mut u64 { + &mut self.last_index + } +} + +impl ::protobuf::Message for RaftLocalState { + fn is_initialized(&self) -> bool { + for v in &self.hard_state { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.hard_state)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.last_index = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.hard_state.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.last_index != 0 { + my_size += ::protobuf::rt::value_size(2, self.last_index, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.hard_state.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.last_index != 0 { + os.write_uint64(2, self.last_index)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RaftLocalState { + fn new() -> RaftLocalState { + RaftLocalState::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "hard_state", + RaftLocalState::get_hard_state_for_reflect, + RaftLocalState::mut_hard_state_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "last_index", + RaftLocalState::get_last_index_for_reflect, + RaftLocalState::mut_last_index_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RaftLocalState", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RaftLocalState { + fn clear(&mut self) { + self.clear_hard_state(); + self.clear_last_index(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RaftLocalState { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RaftLocalState { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RaftApplyState { + // message fields + pub applied_index: u64, + pub truncated_state: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RaftApplyState {} + +impl RaftApplyState { + pub fn new() -> RaftApplyState { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RaftApplyState { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RaftApplyState, + }; + unsafe { + instance.get(RaftApplyState::new) + } + } + + // uint64 applied_index = 1; + + pub fn clear_applied_index(&mut self) { + self.applied_index = 0; + } + + // Param is passed by value, moved + pub fn set_applied_index(&mut self, v: u64) { + self.applied_index = v; + } + + pub fn get_applied_index(&self) -> u64 { + self.applied_index + } + + fn get_applied_index_for_reflect(&self) -> &u64 { + &self.applied_index + } + + fn mut_applied_index_for_reflect(&mut self) -> &mut u64 { + &mut self.applied_index + } + + // .raft_serverpb.RaftTruncatedState truncated_state = 2; + + pub fn clear_truncated_state(&mut self) { + self.truncated_state.clear(); + } + + pub fn has_truncated_state(&self) -> bool { + self.truncated_state.is_some() + } + + // Param is passed by value, moved + pub fn set_truncated_state(&mut self, v: RaftTruncatedState) { + self.truncated_state = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_truncated_state(&mut self) -> &mut RaftTruncatedState { + if self.truncated_state.is_none() { + self.truncated_state.set_default(); + } + self.truncated_state.as_mut().unwrap() + } + + // Take field + pub fn take_truncated_state(&mut self) -> RaftTruncatedState { + self.truncated_state.take().unwrap_or_else(|| RaftTruncatedState::new()) + } + + pub fn get_truncated_state(&self) -> &RaftTruncatedState { + self.truncated_state.as_ref().unwrap_or_else(|| RaftTruncatedState::default_instance()) + } + + fn get_truncated_state_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.truncated_state + } + + fn mut_truncated_state_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.truncated_state + } +} + +impl ::protobuf::Message for RaftApplyState { + fn is_initialized(&self) -> bool { + for v in &self.truncated_state { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.applied_index = tmp; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.truncated_state)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.applied_index != 0 { + my_size += ::protobuf::rt::value_size(1, self.applied_index, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.truncated_state.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.applied_index != 0 { + os.write_uint64(1, self.applied_index)?; + } + if let Some(ref v) = self.truncated_state.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RaftApplyState { + fn new() -> RaftApplyState { + RaftApplyState::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "applied_index", + RaftApplyState::get_applied_index_for_reflect, + RaftApplyState::mut_applied_index_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "truncated_state", + RaftApplyState::get_truncated_state_for_reflect, + RaftApplyState::mut_truncated_state_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RaftApplyState", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RaftApplyState { + fn clear(&mut self) { + self.clear_applied_index(); + self.clear_truncated_state(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RaftApplyState { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RaftApplyState { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RegionLocalState { + // message fields + pub state: PeerState, + pub region: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for RegionLocalState {} + +impl RegionLocalState { + pub fn new() -> RegionLocalState { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static RegionLocalState { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RegionLocalState, + }; + unsafe { + instance.get(RegionLocalState::new) + } + } + + // .raft_serverpb.PeerState state = 1; + + pub fn clear_state(&mut self) { + self.state = PeerState::Normal; + } + + // Param is passed by value, moved + pub fn set_state(&mut self, v: PeerState) { + self.state = v; + } + + pub fn get_state(&self) -> PeerState { + self.state + } + + fn get_state_for_reflect(&self) -> &PeerState { + &self.state + } + + fn mut_state_for_reflect(&mut self) -> &mut PeerState { + &mut self.state + } + + // .metapb.Region region = 2; + + pub fn clear_region(&mut self) { + self.region.clear(); + } + + pub fn has_region(&self) -> bool { + self.region.is_some() + } + + // Param is passed by value, moved + pub fn set_region(&mut self, v: super::metapb::Region) { + self.region = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_region(&mut self) -> &mut super::metapb::Region { + if self.region.is_none() { + self.region.set_default(); + } + self.region.as_mut().unwrap() + } + + // Take field + pub fn take_region(&mut self) -> super::metapb::Region { + self.region.take().unwrap_or_else(|| super::metapb::Region::new()) + } + + pub fn get_region(&self) -> &super::metapb::Region { + self.region.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) + } + + fn get_region_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.region + } + + fn mut_region_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.region + } +} + +impl ::protobuf::Message for RegionLocalState { + fn is_initialized(&self) -> bool { + for v in &self.region { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_enum()?; + self.state = tmp; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.state != PeerState::Normal { + my_size += ::protobuf::rt::enum_size(1, self.state); + } + if let Some(ref v) = self.region.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.state != PeerState::Normal { + os.write_enum(1, self.state.value())?; + } + if let Some(ref v) = self.region.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for RegionLocalState { + fn new() -> RegionLocalState { + RegionLocalState::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "state", + RegionLocalState::get_state_for_reflect, + RegionLocalState::mut_state_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "region", + RegionLocalState::get_region_for_reflect, + RegionLocalState::mut_region_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RegionLocalState", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for RegionLocalState { + fn clear(&mut self) { + self.clear_state(); + self.clear_region(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RegionLocalState { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RegionLocalState { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum PeerState { + Normal = 0, + Applying = 1, + Tombstone = 2, +} + +impl ::protobuf::ProtobufEnum for PeerState { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(PeerState::Normal), + 1 => ::std::option::Option::Some(PeerState::Applying), + 2 => ::std::option::Option::Some(PeerState::Tombstone), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [PeerState] = &[ + PeerState::Normal, + PeerState::Applying, + PeerState::Tombstone, + ]; + values + } + + fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, + }; + unsafe { + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new("PeerState", file_descriptor_proto()) + }) + } + } +} + +impl ::std::marker::Copy for PeerState { +} + +impl ::std::default::Default for PeerState { + fn default() -> Self { + PeerState::Normal + } +} + +impl ::protobuf::reflect::ProtobufValue for PeerState { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x13raft_serverpb.proto\x12\rraft_serverpb\x1a\reraftpb.proto\x1a\x0cm\ + etapb.proto\"\xb9\x02\n\x0bRaftMessage\x12\x1b\n\tregion_id\x18\x01\x20\ + \x01(\x04R\x08regionId\x12)\n\tfrom_peer\x18\x02\x20\x01(\x0b2\x0c.metap\ + b.PeerR\x08fromPeer\x12%\n\x07to_peer\x18\x03\x20\x01(\x0b2\x0c.metapb.P\ + eerR\x06toPeer\x12*\n\x07message\x18\x04\x20\x01(\x0b2\x10.eraftpb.Messa\ + geR\x07message\x126\n\x0cregion_epoch\x18\x05\x20\x01(\x0b2\x13.metapb.R\ + egionEpochR\x0bregionEpoch\x12!\n\x0cis_tombstone\x18\x06\x20\x01(\x08R\ + \x0bisTombstone\x12\x1b\n\tstart_key\x18\x07\x20\x01(\x0cR\x08startKey\ + \x12\x17\n\x07end_key\x18\x08\x20\x01(\x0cR\x06endKey\">\n\x12RaftTrunca\ + tedState\x12\x14\n\x05index\x18\x01\x20\x01(\x04R\x05index\x12\x12\n\x04\ + term\x18\x02\x20\x01(\x04R\x04term\"P\n\x0eSnapshotCFFile\x12\x0e\n\x02c\ + f\x18\x01\x20\x01(\tR\x02cf\x12\x12\n\x04size\x18\x02\x20\x01(\x04R\x04s\ + ize\x12\x1a\n\x08checksum\x18\x03\x20\x01(\rR\x08checksum\"H\n\x0cSnapsh\ + otMeta\x128\n\x08cf_files\x18\x01\x20\x03(\x0b2\x1d.raft_serverpb.Snapsh\ + otCFFileR\x07cfFiles\"Y\n\rSnapshotChunk\x124\n\x07message\x18\x01\x20\ + \x01(\x0b2\x1a.raft_serverpb.RaftMessageR\x07message\x12\x12\n\x04data\ + \x18\x02\x20\x01(\x0cR\x04data\"\x06\n\x04Done\"2\n\x08KeyValue\x12\x10\ + \n\x03key\x18\x01\x20\x01(\x0cR\x03key\x12\x14\n\x05value\x18\x02\x20\ + \x01(\x0cR\x05value\"\xcf\x01\n\x10RaftSnapshotData\x12&\n\x06region\x18\ + \x01\x20\x01(\x0b2\x0e.metapb.RegionR\x06region\x12\x1b\n\tfile_size\x18\ + \x02\x20\x01(\x04R\x08fileSize\x12+\n\x04data\x18\x03\x20\x03(\x0b2\x17.\ + raft_serverpb.KeyValueR\x04data\x12\x18\n\x07version\x18\x04\x20\x01(\ + \x04R\x07version\x12/\n\x04meta\x18\x05\x20\x01(\x0b2\x1b.raft_serverpb.\ + SnapshotMetaR\x04meta\"F\n\nStoreIdent\x12\x1d\n\ncluster_id\x18\x01\x20\ + \x01(\x04R\tclusterId\x12\x19\n\x08store_id\x18\x02\x20\x01(\x04R\x07sto\ + reId\"b\n\x0eRaftLocalState\x121\n\nhard_state\x18\x01\x20\x01(\x0b2\x12\ + .eraftpb.HardStateR\thardState\x12\x1d\n\nlast_index\x18\x02\x20\x01(\ + \x04R\tlastIndex\"\x81\x01\n\x0eRaftApplyState\x12#\n\rapplied_index\x18\ + \x01\x20\x01(\x04R\x0cappliedIndex\x12J\n\x0ftruncated_state\x18\x02\x20\ + \x01(\x0b2!.raft_serverpb.RaftTruncatedStateR\x0etruncatedState\"j\n\x10\ + RegionLocalState\x12.\n\x05state\x18\x01\x20\x01(\x0e2\x18.raft_serverpb\ + .PeerStateR\x05state\x12&\n\x06region\x18\x02\x20\x01(\x0b2\x0e.metapb.R\ + egionR\x06region*4\n\tPeerState\x12\n\n\x06Normal\x10\0\x12\x0c\n\x08App\ + lying\x10\x01\x12\r\n\tTombstone\x10\x02B\x1a\n\x18com.pingcap.tikv.kvpr\ + otoJ\x9f\x16\n\x06\x12\x04\0\0P\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\ + \x08\n\x01\x02\x12\x03\x01\x08\x15\n\t\n\x02\x03\0\x12\x03\x03\x07\x16\n\ + \t\n\x02\x03\x01\x12\x03\x04\x07\x15\n\x08\n\x01\x08\x12\x03\x06\01\n\ + \x0b\n\x04\x08\xe7\x07\0\x12\x03\x06\01\n\x0c\n\x05\x08\xe7\x07\0\x02\ + \x12\x03\x06\x07\x13\n\r\n\x06\x08\xe7\x07\0\x02\0\x12\x03\x06\x07\x13\n\ + \x0e\n\x07\x08\xe7\x07\0\x02\0\x01\x12\x03\x06\x07\x13\n\x0c\n\x05\x08\ + \xe7\x07\0\x07\x12\x03\x06\x160\n\n\n\x02\x04\0\x12\x04\x08\0\x13\x01\n\ + \n\n\x03\x04\0\x01\x12\x03\x08\x08\x13\n\x0b\n\x04\x04\0\x02\0\x12\x03\t\ + \x04\x19\n\r\n\x05\x04\0\x02\0\x04\x12\x04\t\x04\x08\x15\n\x0c\n\x05\x04\ + \0\x02\0\x05\x12\x03\t\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\t\x0b\ + \x14\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\t\x17\x18\n\x0b\n\x04\x04\0\x02\ + \x01\x12\x03\n\x04\x1e\n\r\n\x05\x04\0\x02\x01\x04\x12\x04\n\x04\t\x19\n\ + \x0c\n\x05\x04\0\x02\x01\x06\x12\x03\n\x04\x0f\n\x0c\n\x05\x04\0\x02\x01\ + \x01\x12\x03\n\x10\x19\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\n\x1c\x1d\n\ + \x0b\n\x04\x04\0\x02\x02\x12\x03\x0b\x04\x1c\n\r\n\x05\x04\0\x02\x02\x04\ + \x12\x04\x0b\x04\n\x1e\n\x0c\n\x05\x04\0\x02\x02\x06\x12\x03\x0b\x04\x0f\ + \n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x0b\x10\x17\n\x0c\n\x05\x04\0\x02\ + \x02\x03\x12\x03\x0b\x1a\x1b\n\x0b\n\x04\x04\0\x02\x03\x12\x03\x0c\x04\ + \x20\n\r\n\x05\x04\0\x02\x03\x04\x12\x04\x0c\x04\x0b\x1c\n\x0c\n\x05\x04\ + \0\x02\x03\x06\x12\x03\x0c\x04\x13\n\x0c\n\x05\x04\0\x02\x03\x01\x12\x03\ + \x0c\x14\x1b\n\x0c\n\x05\x04\0\x02\x03\x03\x12\x03\x0c\x1e\x1f\n\x0b\n\ + \x04\x04\0\x02\x04\x12\x03\r\x04(\n\r\n\x05\x04\0\x02\x04\x04\x12\x04\r\ + \x04\x0c\x20\n\x0c\n\x05\x04\0\x02\x04\x06\x12\x03\r\x04\x16\n\x0c\n\x05\ + \x04\0\x02\x04\x01\x12\x03\r\x17#\n\x0c\n\x05\x04\0\x02\x04\x03\x12\x03\ + \r&'\nR\n\x04\x04\0\x02\x05\x12\x03\x0f\x04\x1a\x1aE\x20true\x20means\ + \x20to_peer\x20is\x20a\x20tombstone\x20peer\x20and\x20it\x20should\x20re\ + move\x20itself.\n\n\r\n\x05\x04\0\x02\x05\x04\x12\x04\x0f\x04\r(\n\x0c\n\ + \x05\x04\0\x02\x05\x05\x12\x03\x0f\x04\x08\n\x0c\n\x05\x04\0\x02\x05\x01\ + \x12\x03\x0f\t\x15\n\x0c\n\x05\x04\0\x02\x05\x03\x12\x03\x0f\x18\x19\n5\ + \n\x04\x04\0\x02\x06\x12\x03\x11\x04\x18\x1a(\x20Region\x20key\x20range\ + \x20[start_key,\x20end_key).\n\n\r\n\x05\x04\0\x02\x06\x04\x12\x04\x11\ + \x04\x0f\x1a\n\x0c\n\x05\x04\0\x02\x06\x05\x12\x03\x11\x04\t\n\x0c\n\x05\ + \x04\0\x02\x06\x01\x12\x03\x11\n\x13\n\x0c\n\x05\x04\0\x02\x06\x03\x12\ + \x03\x11\x16\x17\n\x0b\n\x04\x04\0\x02\x07\x12\x03\x12\x04\x16\n\r\n\x05\ + \x04\0\x02\x07\x04\x12\x04\x12\x04\x11\x18\n\x0c\n\x05\x04\0\x02\x07\x05\ + \x12\x03\x12\x04\t\n\x0c\n\x05\x04\0\x02\x07\x01\x12\x03\x12\n\x11\n\x0c\ + \n\x05\x04\0\x02\x07\x03\x12\x03\x12\x14\x15\n\n\n\x02\x04\x01\x12\x04\ + \x15\0\x18\x01\n\n\n\x03\x04\x01\x01\x12\x03\x15\x08\x1a\n\x0b\n\x04\x04\ + \x01\x02\0\x12\x03\x16\x04\x15\n\r\n\x05\x04\x01\x02\0\x04\x12\x04\x16\ + \x04\x15\x1c\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\x16\x04\n\n\x0c\n\x05\ + \x04\x01\x02\0\x01\x12\x03\x16\x0b\x10\n\x0c\n\x05\x04\x01\x02\0\x03\x12\ + \x03\x16\x13\x14\n\x0b\n\x04\x04\x01\x02\x01\x12\x03\x17\x04\x14\n\r\n\ + \x05\x04\x01\x02\x01\x04\x12\x04\x17\x04\x16\x15\n\x0c\n\x05\x04\x01\x02\ + \x01\x05\x12\x03\x17\x04\n\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\x17\ + \x0b\x0f\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\x17\x12\x13\n\n\n\x02\ + \x04\x02\x12\x04\x1a\0\x1e\x01\n\n\n\x03\x04\x02\x01\x12\x03\x1a\x08\x16\ + \n\x0b\n\x04\x04\x02\x02\0\x12\x03\x1b\x04\x12\n\r\n\x05\x04\x02\x02\0\ + \x04\x12\x04\x1b\x04\x1a\x18\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03\x1b\ + \x04\n\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\x1b\x0b\r\n\x0c\n\x05\x04\ + \x02\x02\0\x03\x12\x03\x1b\x10\x11\n\x0b\n\x04\x04\x02\x02\x01\x12\x03\ + \x1c\x04\x14\n\r\n\x05\x04\x02\x02\x01\x04\x12\x04\x1c\x04\x1b\x12\n\x0c\ + \n\x05\x04\x02\x02\x01\x05\x12\x03\x1c\x04\n\n\x0c\n\x05\x04\x02\x02\x01\ + \x01\x12\x03\x1c\x0b\x0f\n\x0c\n\x05\x04\x02\x02\x01\x03\x12\x03\x1c\x12\ + \x13\n\x0b\n\x04\x04\x02\x02\x02\x12\x03\x1d\x04\x18\n\r\n\x05\x04\x02\ + \x02\x02\x04\x12\x04\x1d\x04\x1c\x14\n\x0c\n\x05\x04\x02\x02\x02\x05\x12\ + \x03\x1d\x04\n\n\x0c\n\x05\x04\x02\x02\x02\x01\x12\x03\x1d\x0b\x13\n\x0c\ + \n\x05\x04\x02\x02\x02\x03\x12\x03\x1d\x16\x17\n\n\n\x02\x04\x03\x12\x04\ + \x20\0\"\x01\n\n\n\x03\x04\x03\x01\x12\x03\x20\x08\x14\n\x0b\n\x04\x04\ + \x03\x02\0\x12\x03!\x04)\n\x0c\n\x05\x04\x03\x02\0\x04\x12\x03!\x04\x0c\ + \n\x0c\n\x05\x04\x03\x02\0\x06\x12\x03!\r\x1b\n\x0c\n\x05\x04\x03\x02\0\ + \x01\x12\x03!\x1c$\n\x0c\n\x05\x04\x03\x02\0\x03\x12\x03!'(\n\n\n\x02\ + \x04\x04\x12\x04$\0'\x01\n\n\n\x03\x04\x04\x01\x12\x03$\x08\x15\n\x0b\n\ + \x04\x04\x04\x02\0\x12\x03%\x04\x1c\n\r\n\x05\x04\x04\x02\0\x04\x12\x04%\ + \x04$\x17\n\x0c\n\x05\x04\x04\x02\0\x06\x12\x03%\x04\x0f\n\x0c\n\x05\x04\ + \x04\x02\0\x01\x12\x03%\x10\x17\n\x0c\n\x05\x04\x04\x02\0\x03\x12\x03%\ + \x1a\x1b\n\x0b\n\x04\x04\x04\x02\x01\x12\x03&\x04\x13\n\r\n\x05\x04\x04\ + \x02\x01\x04\x12\x04&\x04%\x1c\n\x0c\n\x05\x04\x04\x02\x01\x05\x12\x03&\ + \x04\t\n\x0c\n\x05\x04\x04\x02\x01\x01\x12\x03&\n\x0e\n\x0c\n\x05\x04\ + \x04\x02\x01\x03\x12\x03&\x11\x12\n\t\n\x02\x04\x05\x12\x03)\0\x0f\n\n\n\ + \x03\x04\x05\x01\x12\x03)\x08\x0c\n\n\n\x02\x04\x06\x12\x04+\0.\x01\n\n\ + \n\x03\x04\x06\x01\x12\x03+\x08\x10\n\x0b\n\x04\x04\x06\x02\0\x12\x03,\ + \x04\x17\n\r\n\x05\x04\x06\x02\0\x04\x12\x04,\x04+\x12\n\x0c\n\x05\x04\ + \x06\x02\0\x05\x12\x03,\x04\t\n\x0c\n\x05\x04\x06\x02\0\x01\x12\x03,\n\r\ + \n\x0c\n\x05\x04\x06\x02\0\x03\x12\x03,\x15\x16\n\x0b\n\x04\x04\x06\x02\ + \x01\x12\x03-\x04\x17\n\r\n\x05\x04\x06\x02\x01\x04\x12\x04-\x04,\x17\n\ + \x0c\n\x05\x04\x06\x02\x01\x05\x12\x03-\x04\t\n\x0c\n\x05\x04\x06\x02\ + \x01\x01\x12\x03-\n\x0f\n\x0c\n\x05\x04\x06\x02\x01\x03\x12\x03-\x15\x16\ + \n\n\n\x02\x04\x07\x12\x040\06\x01\n\n\n\x03\x04\x07\x01\x12\x030\x08\ + \x18\n\x0b\n\x04\x04\x07\x02\0\x12\x031\x04\x1d\n\r\n\x05\x04\x07\x02\0\ + \x04\x12\x041\x040\x1a\n\x0c\n\x05\x04\x07\x02\0\x06\x12\x031\x04\x11\n\ + \x0c\n\x05\x04\x07\x02\0\x01\x12\x031\x12\x18\n\x0c\n\x05\x04\x07\x02\0\ + \x03\x12\x031\x1b\x1c\n\x0b\n\x04\x04\x07\x02\x01\x12\x032\x04\x19\n\r\n\ + \x05\x04\x07\x02\x01\x04\x12\x042\x041\x1d\n\x0c\n\x05\x04\x07\x02\x01\ + \x05\x12\x032\x04\n\n\x0c\n\x05\x04\x07\x02\x01\x01\x12\x032\x0b\x14\n\ + \x0c\n\x05\x04\x07\x02\x01\x03\x12\x032\x17\x18\n\x0b\n\x04\x04\x07\x02\ + \x02\x12\x033\x04\x1f\n\x0c\n\x05\x04\x07\x02\x02\x04\x12\x033\x04\x0c\n\ + \x0c\n\x05\x04\x07\x02\x02\x06\x12\x033\r\x15\n\x0c\n\x05\x04\x07\x02\ + \x02\x01\x12\x033\x16\x1a\n\x0c\n\x05\x04\x07\x02\x02\x03\x12\x033\x1d\ + \x1e\n\x0b\n\x04\x04\x07\x02\x03\x12\x034\x04\x17\n\r\n\x05\x04\x07\x02\ + \x03\x04\x12\x044\x043\x1f\n\x0c\n\x05\x04\x07\x02\x03\x05\x12\x034\x04\ + \n\n\x0c\n\x05\x04\x07\x02\x03\x01\x12\x034\x0b\x12\n\x0c\n\x05\x04\x07\ + \x02\x03\x03\x12\x034\x15\x16\n\x0b\n\x04\x04\x07\x02\x04\x12\x035\x04\ + \x1a\n\r\n\x05\x04\x07\x02\x04\x04\x12\x045\x044\x17\n\x0c\n\x05\x04\x07\ + \x02\x04\x06\x12\x035\x04\x10\n\x0c\n\x05\x04\x07\x02\x04\x01\x12\x035\ + \x11\x15\n\x0c\n\x05\x04\x07\x02\x04\x03\x12\x035\x18\x19\n\n\n\x02\x04\ + \x08\x12\x048\0;\x01\n\n\n\x03\x04\x08\x01\x12\x038\x08\x12\n\x0b\n\x04\ + \x04\x08\x02\0\x12\x039\x04\x1a\n\r\n\x05\x04\x08\x02\0\x04\x12\x049\x04\ + 8\x14\n\x0c\n\x05\x04\x08\x02\0\x05\x12\x039\x04\n\n\x0c\n\x05\x04\x08\ + \x02\0\x01\x12\x039\x0b\x15\n\x0c\n\x05\x04\x08\x02\0\x03\x12\x039\x18\ + \x19\n\x0b\n\x04\x04\x08\x02\x01\x12\x03:\x04\x18\n\r\n\x05\x04\x08\x02\ + \x01\x04\x12\x04:\x049\x1a\n\x0c\n\x05\x04\x08\x02\x01\x05\x12\x03:\x04\ + \n\n\x0c\n\x05\x04\x08\x02\x01\x01\x12\x03:\x0b\x13\n\x0c\n\x05\x04\x08\ + \x02\x01\x03\x12\x03:\x16\x17\n\n\n\x02\x04\t\x12\x04=\0@\x01\n\n\n\x03\ + \x04\t\x01\x12\x03=\x08\x16\n\x0b\n\x04\x04\t\x02\0\x12\x03>\x04%\n\r\n\ + \x05\x04\t\x02\0\x04\x12\x04>\x04=\x18\n\x0c\n\x05\x04\t\x02\0\x06\x12\ + \x03>\x04\x15\n\x0c\n\x05\x04\t\x02\0\x01\x12\x03>\x16\x20\n\x0c\n\x05\ + \x04\t\x02\0\x03\x12\x03>#$\n\x0b\n\x04\x04\t\x02\x01\x12\x03?\x04\x1a\n\ + \r\n\x05\x04\t\x02\x01\x04\x12\x04?\x04>%\n\x0c\n\x05\x04\t\x02\x01\x05\ + \x12\x03?\x04\n\n\x0c\n\x05\x04\t\x02\x01\x01\x12\x03?\x0b\x15\n\x0c\n\ + \x05\x04\t\x02\x01\x03\x12\x03?\x18\x19\n\n\n\x02\x04\n\x12\x04B\0E\x01\ + \n\n\n\x03\x04\n\x01\x12\x03B\x08\x16\n\x0b\n\x04\x04\n\x02\0\x12\x03C\ + \x04\x1d\n\r\n\x05\x04\n\x02\0\x04\x12\x04C\x04B\x18\n\x0c\n\x05\x04\n\ + \x02\0\x05\x12\x03C\x04\n\n\x0c\n\x05\x04\n\x02\0\x01\x12\x03C\x0b\x18\n\ + \x0c\n\x05\x04\n\x02\0\x03\x12\x03C\x1b\x1c\n\x0b\n\x04\x04\n\x02\x01\ + \x12\x03D\x04+\n\r\n\x05\x04\n\x02\x01\x04\x12\x04D\x04C\x1d\n\x0c\n\x05\ + \x04\n\x02\x01\x06\x12\x03D\x04\x16\n\x0c\n\x05\x04\n\x02\x01\x01\x12\ + \x03D\x17&\n\x0c\n\x05\x04\n\x02\x01\x03\x12\x03D)*\n\n\n\x02\x05\0\x12\ + \x04G\0K\x01\n\n\n\x03\x05\0\x01\x12\x03G\x05\x0e\n\x0b\n\x04\x05\0\x02\ + \0\x12\x03H\x04\x0f\n\x0c\n\x05\x05\0\x02\0\x01\x12\x03H\x04\n\n\x0c\n\ + \x05\x05\0\x02\0\x02\x12\x03H\r\x0e\n\x0b\n\x04\x05\0\x02\x01\x12\x03I\ + \x04\x11\n\x0c\n\x05\x05\0\x02\x01\x01\x12\x03I\x04\x0c\n\x0c\n\x05\x05\ + \0\x02\x01\x02\x12\x03I\x0f\x10\n\x0b\n\x04\x05\0\x02\x02\x12\x03J\x04\ + \x12\n\x0c\n\x05\x05\0\x02\x02\x01\x12\x03J\x04\r\n\x0c\n\x05\x05\0\x02\ + \x02\x02\x12\x03J\x10\x11\n\n\n\x02\x04\x0b\x12\x04M\0P\x01\n\n\n\x03\ + \x04\x0b\x01\x12\x03M\x08\x18\n\x0b\n\x04\x04\x0b\x02\0\x12\x03N\x04\x18\ + \n\r\n\x05\x04\x0b\x02\0\x04\x12\x04N\x04M\x1a\n\x0c\n\x05\x04\x0b\x02\0\ + \x06\x12\x03N\x04\r\n\x0c\n\x05\x04\x0b\x02\0\x01\x12\x03N\x0e\x13\n\x0c\ + \n\x05\x04\x0b\x02\0\x03\x12\x03N\x16\x17\n\x0b\n\x04\x04\x0b\x02\x01\ + \x12\x03O\x04\x1d\n\r\n\x05\x04\x0b\x02\x01\x04\x12\x04O\x04N\x18\n\x0c\ + \n\x05\x04\x0b\x02\x01\x06\x12\x03O\x04\x11\n\x0c\n\x05\x04\x0b\x02\x01\ + \x01\x12\x03O\x12\x18\n\x0c\n\x05\x04\x0b\x02\x01\x03\x12\x03O\x1b\x1cb\ + \x06proto3\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/_vendor/src/github.com/pingcap/kvproto/src/tikvpb_grpc.rs b/_vendor/src/github.com/pingcap/kvproto/src/tikvpb_grpc.rs new file mode 100644 index 00000000000..61744d376ba --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/src/tikvpb_grpc.rs @@ -0,0 +1,614 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy)] + +#![cfg_attr(rustfmt, rustfmt_skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] + +const METHOD_TIKV_KV_GET: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/tikvpb.Tikv/KvGet", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TIKV_KV_SCAN: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/tikvpb.Tikv/KvScan", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TIKV_KV_PREWRITE: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/tikvpb.Tikv/KvPrewrite", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TIKV_KV_COMMIT: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/tikvpb.Tikv/KvCommit", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TIKV_KV_IMPORT: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/tikvpb.Tikv/KvImport", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TIKV_KV_CLEANUP: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/tikvpb.Tikv/KvCleanup", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TIKV_KV_BATCH_GET: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/tikvpb.Tikv/KvBatchGet", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TIKV_KV_BATCH_ROLLBACK: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/tikvpb.Tikv/KvBatchRollback", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TIKV_KV_SCAN_LOCK: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/tikvpb.Tikv/KvScanLock", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TIKV_KV_RESOLVE_LOCK: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/tikvpb.Tikv/KvResolveLock", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TIKV_KV_GC: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/tikvpb.Tikv/KvGC", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TIKV_KV_DELETE_RANGE: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/tikvpb.Tikv/KvDeleteRange", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TIKV_RAW_GET: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/tikvpb.Tikv/RawGet", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TIKV_RAW_PUT: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/tikvpb.Tikv/RawPut", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TIKV_RAW_DELETE: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/tikvpb.Tikv/RawDelete", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TIKV_RAW_SCAN: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/tikvpb.Tikv/RawScan", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TIKV_COPROCESSOR: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/tikvpb.Tikv/Coprocessor", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TIKV_RAFT: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::ClientStreaming, + name: "/tikvpb.Tikv/Raft", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TIKV_SNAPSHOT: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::ClientStreaming, + name: "/tikvpb.Tikv/Snapshot", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TIKV_MVCC_GET_BY_KEY: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/tikvpb.Tikv/MvccGetByKey", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TIKV_MVCC_GET_BY_START_TS: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/tikvpb.Tikv/MvccGetByStartTs", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +pub struct TikvClient { + client: ::grpcio::Client, +} + +impl TikvClient { + pub fn new(channel: ::grpcio::Channel) -> Self { + TikvClient { + client: ::grpcio::Client::new(channel), + } + } + + pub fn kv_get_opt(&self, req: super::kvrpcpb::GetRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_TIKV_KV_GET, req, opt) + } + + pub fn kv_get(&self, req: super::kvrpcpb::GetRequest) -> ::grpcio::Result { + self.kv_get_opt(req, ::grpcio::CallOption::default()) + } + + pub fn kv_get_async_opt(&self, req: super::kvrpcpb::GetRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_TIKV_KV_GET, req, opt) + } + + pub fn kv_get_async(&self, req: super::kvrpcpb::GetRequest) -> ::grpcio::ClientUnaryReceiver { + self.kv_get_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn kv_scan_opt(&self, req: super::kvrpcpb::ScanRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_TIKV_KV_SCAN, req, opt) + } + + pub fn kv_scan(&self, req: super::kvrpcpb::ScanRequest) -> ::grpcio::Result { + self.kv_scan_opt(req, ::grpcio::CallOption::default()) + } + + pub fn kv_scan_async_opt(&self, req: super::kvrpcpb::ScanRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_TIKV_KV_SCAN, req, opt) + } + + pub fn kv_scan_async(&self, req: super::kvrpcpb::ScanRequest) -> ::grpcio::ClientUnaryReceiver { + self.kv_scan_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn kv_prewrite_opt(&self, req: super::kvrpcpb::PrewriteRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_TIKV_KV_PREWRITE, req, opt) + } + + pub fn kv_prewrite(&self, req: super::kvrpcpb::PrewriteRequest) -> ::grpcio::Result { + self.kv_prewrite_opt(req, ::grpcio::CallOption::default()) + } + + pub fn kv_prewrite_async_opt(&self, req: super::kvrpcpb::PrewriteRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_TIKV_KV_PREWRITE, req, opt) + } + + pub fn kv_prewrite_async(&self, req: super::kvrpcpb::PrewriteRequest) -> ::grpcio::ClientUnaryReceiver { + self.kv_prewrite_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn kv_commit_opt(&self, req: super::kvrpcpb::CommitRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_TIKV_KV_COMMIT, req, opt) + } + + pub fn kv_commit(&self, req: super::kvrpcpb::CommitRequest) -> ::grpcio::Result { + self.kv_commit_opt(req, ::grpcio::CallOption::default()) + } + + pub fn kv_commit_async_opt(&self, req: super::kvrpcpb::CommitRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_TIKV_KV_COMMIT, req, opt) + } + + pub fn kv_commit_async(&self, req: super::kvrpcpb::CommitRequest) -> ::grpcio::ClientUnaryReceiver { + self.kv_commit_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn kv_import_opt(&self, req: super::kvrpcpb::ImportRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_TIKV_KV_IMPORT, req, opt) + } + + pub fn kv_import(&self, req: super::kvrpcpb::ImportRequest) -> ::grpcio::Result { + self.kv_import_opt(req, ::grpcio::CallOption::default()) + } + + pub fn kv_import_async_opt(&self, req: super::kvrpcpb::ImportRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_TIKV_KV_IMPORT, req, opt) + } + + pub fn kv_import_async(&self, req: super::kvrpcpb::ImportRequest) -> ::grpcio::ClientUnaryReceiver { + self.kv_import_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn kv_cleanup_opt(&self, req: super::kvrpcpb::CleanupRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_TIKV_KV_CLEANUP, req, opt) + } + + pub fn kv_cleanup(&self, req: super::kvrpcpb::CleanupRequest) -> ::grpcio::Result { + self.kv_cleanup_opt(req, ::grpcio::CallOption::default()) + } + + pub fn kv_cleanup_async_opt(&self, req: super::kvrpcpb::CleanupRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_TIKV_KV_CLEANUP, req, opt) + } + + pub fn kv_cleanup_async(&self, req: super::kvrpcpb::CleanupRequest) -> ::grpcio::ClientUnaryReceiver { + self.kv_cleanup_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn kv_batch_get_opt(&self, req: super::kvrpcpb::BatchGetRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_TIKV_KV_BATCH_GET, req, opt) + } + + pub fn kv_batch_get(&self, req: super::kvrpcpb::BatchGetRequest) -> ::grpcio::Result { + self.kv_batch_get_opt(req, ::grpcio::CallOption::default()) + } + + pub fn kv_batch_get_async_opt(&self, req: super::kvrpcpb::BatchGetRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_TIKV_KV_BATCH_GET, req, opt) + } + + pub fn kv_batch_get_async(&self, req: super::kvrpcpb::BatchGetRequest) -> ::grpcio::ClientUnaryReceiver { + self.kv_batch_get_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn kv_batch_rollback_opt(&self, req: super::kvrpcpb::BatchRollbackRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_TIKV_KV_BATCH_ROLLBACK, req, opt) + } + + pub fn kv_batch_rollback(&self, req: super::kvrpcpb::BatchRollbackRequest) -> ::grpcio::Result { + self.kv_batch_rollback_opt(req, ::grpcio::CallOption::default()) + } + + pub fn kv_batch_rollback_async_opt(&self, req: super::kvrpcpb::BatchRollbackRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_TIKV_KV_BATCH_ROLLBACK, req, opt) + } + + pub fn kv_batch_rollback_async(&self, req: super::kvrpcpb::BatchRollbackRequest) -> ::grpcio::ClientUnaryReceiver { + self.kv_batch_rollback_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn kv_scan_lock_opt(&self, req: super::kvrpcpb::ScanLockRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_TIKV_KV_SCAN_LOCK, req, opt) + } + + pub fn kv_scan_lock(&self, req: super::kvrpcpb::ScanLockRequest) -> ::grpcio::Result { + self.kv_scan_lock_opt(req, ::grpcio::CallOption::default()) + } + + pub fn kv_scan_lock_async_opt(&self, req: super::kvrpcpb::ScanLockRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_TIKV_KV_SCAN_LOCK, req, opt) + } + + pub fn kv_scan_lock_async(&self, req: super::kvrpcpb::ScanLockRequest) -> ::grpcio::ClientUnaryReceiver { + self.kv_scan_lock_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn kv_resolve_lock_opt(&self, req: super::kvrpcpb::ResolveLockRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_TIKV_KV_RESOLVE_LOCK, req, opt) + } + + pub fn kv_resolve_lock(&self, req: super::kvrpcpb::ResolveLockRequest) -> ::grpcio::Result { + self.kv_resolve_lock_opt(req, ::grpcio::CallOption::default()) + } + + pub fn kv_resolve_lock_async_opt(&self, req: super::kvrpcpb::ResolveLockRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_TIKV_KV_RESOLVE_LOCK, req, opt) + } + + pub fn kv_resolve_lock_async(&self, req: super::kvrpcpb::ResolveLockRequest) -> ::grpcio::ClientUnaryReceiver { + self.kv_resolve_lock_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn kv_gc_opt(&self, req: super::kvrpcpb::GCRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_TIKV_KV_GC, req, opt) + } + + pub fn kv_gc(&self, req: super::kvrpcpb::GCRequest) -> ::grpcio::Result { + self.kv_gc_opt(req, ::grpcio::CallOption::default()) + } + + pub fn kv_gc_async_opt(&self, req: super::kvrpcpb::GCRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_TIKV_KV_GC, req, opt) + } + + pub fn kv_gc_async(&self, req: super::kvrpcpb::GCRequest) -> ::grpcio::ClientUnaryReceiver { + self.kv_gc_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn kv_delete_range_opt(&self, req: super::kvrpcpb::DeleteRangeRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_TIKV_KV_DELETE_RANGE, req, opt) + } + + pub fn kv_delete_range(&self, req: super::kvrpcpb::DeleteRangeRequest) -> ::grpcio::Result { + self.kv_delete_range_opt(req, ::grpcio::CallOption::default()) + } + + pub fn kv_delete_range_async_opt(&self, req: super::kvrpcpb::DeleteRangeRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_TIKV_KV_DELETE_RANGE, req, opt) + } + + pub fn kv_delete_range_async(&self, req: super::kvrpcpb::DeleteRangeRequest) -> ::grpcio::ClientUnaryReceiver { + self.kv_delete_range_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn raw_get_opt(&self, req: super::kvrpcpb::RawGetRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_TIKV_RAW_GET, req, opt) + } + + pub fn raw_get(&self, req: super::kvrpcpb::RawGetRequest) -> ::grpcio::Result { + self.raw_get_opt(req, ::grpcio::CallOption::default()) + } + + pub fn raw_get_async_opt(&self, req: super::kvrpcpb::RawGetRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_TIKV_RAW_GET, req, opt) + } + + pub fn raw_get_async(&self, req: super::kvrpcpb::RawGetRequest) -> ::grpcio::ClientUnaryReceiver { + self.raw_get_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn raw_put_opt(&self, req: super::kvrpcpb::RawPutRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_TIKV_RAW_PUT, req, opt) + } + + pub fn raw_put(&self, req: super::kvrpcpb::RawPutRequest) -> ::grpcio::Result { + self.raw_put_opt(req, ::grpcio::CallOption::default()) + } + + pub fn raw_put_async_opt(&self, req: super::kvrpcpb::RawPutRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_TIKV_RAW_PUT, req, opt) + } + + pub fn raw_put_async(&self, req: super::kvrpcpb::RawPutRequest) -> ::grpcio::ClientUnaryReceiver { + self.raw_put_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn raw_delete_opt(&self, req: super::kvrpcpb::RawDeleteRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_TIKV_RAW_DELETE, req, opt) + } + + pub fn raw_delete(&self, req: super::kvrpcpb::RawDeleteRequest) -> ::grpcio::Result { + self.raw_delete_opt(req, ::grpcio::CallOption::default()) + } + + pub fn raw_delete_async_opt(&self, req: super::kvrpcpb::RawDeleteRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_TIKV_RAW_DELETE, req, opt) + } + + pub fn raw_delete_async(&self, req: super::kvrpcpb::RawDeleteRequest) -> ::grpcio::ClientUnaryReceiver { + self.raw_delete_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn raw_scan_opt(&self, req: super::kvrpcpb::RawScanRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_TIKV_RAW_SCAN, req, opt) + } + + pub fn raw_scan(&self, req: super::kvrpcpb::RawScanRequest) -> ::grpcio::Result { + self.raw_scan_opt(req, ::grpcio::CallOption::default()) + } + + pub fn raw_scan_async_opt(&self, req: super::kvrpcpb::RawScanRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_TIKV_RAW_SCAN, req, opt) + } + + pub fn raw_scan_async(&self, req: super::kvrpcpb::RawScanRequest) -> ::grpcio::ClientUnaryReceiver { + self.raw_scan_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn coprocessor_opt(&self, req: super::coprocessor::Request, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_TIKV_COPROCESSOR, req, opt) + } + + pub fn coprocessor(&self, req: super::coprocessor::Request) -> ::grpcio::Result { + self.coprocessor_opt(req, ::grpcio::CallOption::default()) + } + + pub fn coprocessor_async_opt(&self, req: super::coprocessor::Request, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_TIKV_COPROCESSOR, req, opt) + } + + pub fn coprocessor_async(&self, req: super::coprocessor::Request) -> ::grpcio::ClientUnaryReceiver { + self.coprocessor_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn raft_opt(&self, opt: ::grpcio::CallOption) -> (::grpcio::ClientCStreamSender, ::grpcio::ClientCStreamReceiver) { + self.client.client_streaming(&METHOD_TIKV_RAFT, opt) + } + + pub fn raft(&self) -> (::grpcio::ClientCStreamSender, ::grpcio::ClientCStreamReceiver) { + self.raft_opt(::grpcio::CallOption::default()) + } + + pub fn snapshot_opt(&self, opt: ::grpcio::CallOption) -> (::grpcio::ClientCStreamSender, ::grpcio::ClientCStreamReceiver) { + self.client.client_streaming(&METHOD_TIKV_SNAPSHOT, opt) + } + + pub fn snapshot(&self) -> (::grpcio::ClientCStreamSender, ::grpcio::ClientCStreamReceiver) { + self.snapshot_opt(::grpcio::CallOption::default()) + } + + pub fn mvcc_get_by_key_opt(&self, req: super::kvrpcpb::MvccGetByKeyRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_TIKV_MVCC_GET_BY_KEY, req, opt) + } + + pub fn mvcc_get_by_key(&self, req: super::kvrpcpb::MvccGetByKeyRequest) -> ::grpcio::Result { + self.mvcc_get_by_key_opt(req, ::grpcio::CallOption::default()) + } + + pub fn mvcc_get_by_key_async_opt(&self, req: super::kvrpcpb::MvccGetByKeyRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_TIKV_MVCC_GET_BY_KEY, req, opt) + } + + pub fn mvcc_get_by_key_async(&self, req: super::kvrpcpb::MvccGetByKeyRequest) -> ::grpcio::ClientUnaryReceiver { + self.mvcc_get_by_key_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn mvcc_get_by_start_ts_opt(&self, req: super::kvrpcpb::MvccGetByStartTsRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_TIKV_MVCC_GET_BY_START_TS, req, opt) + } + + pub fn mvcc_get_by_start_ts(&self, req: super::kvrpcpb::MvccGetByStartTsRequest) -> ::grpcio::Result { + self.mvcc_get_by_start_ts_opt(req, ::grpcio::CallOption::default()) + } + + pub fn mvcc_get_by_start_ts_async_opt(&self, req: super::kvrpcpb::MvccGetByStartTsRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { + self.client.unary_call_async(&METHOD_TIKV_MVCC_GET_BY_START_TS, req, opt) + } + + pub fn mvcc_get_by_start_ts_async(&self, req: super::kvrpcpb::MvccGetByStartTsRequest) -> ::grpcio::ClientUnaryReceiver { + self.mvcc_get_by_start_ts_async_opt(req, ::grpcio::CallOption::default()) + } + pub fn spawn(&self, f: F) where F: ::futures::Future + Send + 'static { + self.client.spawn(f) + } +} + +pub trait Tikv { + fn kv_get(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::GetRequest, sink: ::grpcio::UnarySink); + fn kv_scan(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::ScanRequest, sink: ::grpcio::UnarySink); + fn kv_prewrite(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::PrewriteRequest, sink: ::grpcio::UnarySink); + fn kv_commit(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::CommitRequest, sink: ::grpcio::UnarySink); + fn kv_import(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::ImportRequest, sink: ::grpcio::UnarySink); + fn kv_cleanup(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::CleanupRequest, sink: ::grpcio::UnarySink); + fn kv_batch_get(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::BatchGetRequest, sink: ::grpcio::UnarySink); + fn kv_batch_rollback(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::BatchRollbackRequest, sink: ::grpcio::UnarySink); + fn kv_scan_lock(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::ScanLockRequest, sink: ::grpcio::UnarySink); + fn kv_resolve_lock(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::ResolveLockRequest, sink: ::grpcio::UnarySink); + fn kv_gc(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::GCRequest, sink: ::grpcio::UnarySink); + fn kv_delete_range(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::DeleteRangeRequest, sink: ::grpcio::UnarySink); + fn raw_get(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::RawGetRequest, sink: ::grpcio::UnarySink); + fn raw_put(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::RawPutRequest, sink: ::grpcio::UnarySink); + fn raw_delete(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::RawDeleteRequest, sink: ::grpcio::UnarySink); + fn raw_scan(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::RawScanRequest, sink: ::grpcio::UnarySink); + fn coprocessor(&self, ctx: ::grpcio::RpcContext, req: super::coprocessor::Request, sink: ::grpcio::UnarySink); + fn raft(&self, ctx: ::grpcio::RpcContext, stream: ::grpcio::RequestStream, sink: ::grpcio::ClientStreamingSink); + fn snapshot(&self, ctx: ::grpcio::RpcContext, stream: ::grpcio::RequestStream, sink: ::grpcio::ClientStreamingSink); + fn mvcc_get_by_key(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::MvccGetByKeyRequest, sink: ::grpcio::UnarySink); + fn mvcc_get_by_start_ts(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::MvccGetByStartTsRequest, sink: ::grpcio::UnarySink); +} + +pub fn create_tikv(s: S) -> ::grpcio::Service { + let mut builder = ::grpcio::ServiceBuilder::new(); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_TIKV_KV_GET, move |ctx, req, resp| { + instance.kv_get(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_TIKV_KV_SCAN, move |ctx, req, resp| { + instance.kv_scan(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_TIKV_KV_PREWRITE, move |ctx, req, resp| { + instance.kv_prewrite(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_TIKV_KV_COMMIT, move |ctx, req, resp| { + instance.kv_commit(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_TIKV_KV_IMPORT, move |ctx, req, resp| { + instance.kv_import(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_TIKV_KV_CLEANUP, move |ctx, req, resp| { + instance.kv_cleanup(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_TIKV_KV_BATCH_GET, move |ctx, req, resp| { + instance.kv_batch_get(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_TIKV_KV_BATCH_ROLLBACK, move |ctx, req, resp| { + instance.kv_batch_rollback(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_TIKV_KV_SCAN_LOCK, move |ctx, req, resp| { + instance.kv_scan_lock(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_TIKV_KV_RESOLVE_LOCK, move |ctx, req, resp| { + instance.kv_resolve_lock(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_TIKV_KV_GC, move |ctx, req, resp| { + instance.kv_gc(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_TIKV_KV_DELETE_RANGE, move |ctx, req, resp| { + instance.kv_delete_range(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_TIKV_RAW_GET, move |ctx, req, resp| { + instance.raw_get(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_TIKV_RAW_PUT, move |ctx, req, resp| { + instance.raw_put(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_TIKV_RAW_DELETE, move |ctx, req, resp| { + instance.raw_delete(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_TIKV_RAW_SCAN, move |ctx, req, resp| { + instance.raw_scan(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_TIKV_COPROCESSOR, move |ctx, req, resp| { + instance.coprocessor(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_client_streaming_handler(&METHOD_TIKV_RAFT, move |ctx, req, resp| { + instance.raft(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_client_streaming_handler(&METHOD_TIKV_SNAPSHOT, move |ctx, req, resp| { + instance.snapshot(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_TIKV_MVCC_GET_BY_KEY, move |ctx, req, resp| { + instance.mvcc_get_by_key(ctx, req, resp) + }); + let instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_TIKV_MVCC_GET_BY_START_TS, move |ctx, req, resp| { + instance.mvcc_get_by_start_ts(ctx, req, resp) + }); + builder.build() +} diff --git a/_vendor/src/github.com/pingcap/kvproto/src/util.rs b/_vendor/src/github.com/pingcap/kvproto/src/util.rs new file mode 100644 index 00000000000..b00f57e594c --- /dev/null +++ b/_vendor/src/github.com/pingcap/kvproto/src/util.rs @@ -0,0 +1,20 @@ +use eraftpb; +use pdpb; + +impl From for eraftpb::ConfChangeType { + fn from(ct: pdpb::ConfChangeType) -> Self { + match ct { + pdpb::ConfChangeType::AddNode => eraftpb::ConfChangeType::AddNode, + pdpb::ConfChangeType::RemoveNode => eraftpb::ConfChangeType::RemoveNode, + } + } +} + +impl From for pdpb::ConfChangeType { + fn from(ct: eraftpb::ConfChangeType) -> Self { + match ct { + eraftpb::ConfChangeType::AddNode => pdpb::ConfChangeType::AddNode, + eraftpb::ConfChangeType::RemoveNode => pdpb::ConfChangeType::RemoveNode, + } + } +} diff --git a/glide.lock b/glide.lock index a77abcd683d..26d5ad26add 100644 --- a/glide.lock +++ b/glide.lock @@ -149,7 +149,7 @@ imports: - name: github.com/pingcap/check version: ce8a2f822ab1e245a4eefcef2996531c79c943f1 - name: github.com/pingcap/kvproto - version: ebe86abfa6519ffefdf2946fba762a894fe88256 + version: aa89780c80ffbad78c6aaaf0c53829547cf3a5c2 subpackages: - pkg/coprocessor - pkg/eraftpb diff --git a/glide.yaml b/glide.yaml index dc8899d222d..7db6a69ab49 100644 --- a/glide.yaml +++ b/glide.yaml @@ -118,7 +118,7 @@ import: - package: github.com/pingcap/check version: ce8a2f822ab1e245a4eefcef2996531c79c943f1 - package: github.com/pingcap/kvproto - version: ebe86abfa6519ffefdf2946fba762a894fe88256 + version: aa89780c80ffbad78c6aaaf0c53829547cf3a5c2 subpackages: - pkg/coprocessor - pkg/eraftpb From 2620ea5b553737f9821cbcfbb96b70c8ec26f9fe Mon Sep 17 00:00:00 2001 From: UncP Date: Thu, 17 Aug 2017 14:43:53 +0800 Subject: [PATCH 02/13] update pdpb.pb.go Signed-off-by: UncP --- .../src/github.com/pingcap/kvproto/.gitignore | 12 - .../src/github.com/pingcap/kvproto/Cargo.toml | 12 - .../src/github.com/pingcap/kvproto/Makefile | 39 - .../src/github.com/pingcap/kvproto/README.md | 10 - .../src/github.com/gogo/protobuf/LICENSE | 36 - .../gogo/protobuf/_conformance/conformance.go | 161 - .../conformance_proto/conformance.pb.go | 1890 --- .../conformance_proto/conformance.proto | 285 - .../github.com/gogo/protobuf/codec/codec.go | 91 - .../github.com/gogo/protobuf/gogoproto/doc.go | 168 - .../gogo/protobuf/gogoproto/gogo.pb.go | 749 - .../gogo/protobuf/gogoproto/gogo.proto | 125 - .../gogo/protobuf/gogoproto/helper.go | 345 - .../gogo/protobuf/gogoreplace/main.go | 25 - .../gogo/protobuf/install-protobuf.sh | 29 - .../src/github.com/gogo/protobuf/io/full.go | 102 - .../src/github.com/gogo/protobuf/io/io.go | 70 - .../src/github.com/gogo/protobuf/io/uint32.go | 126 - .../src/github.com/gogo/protobuf/io/varint.go | 134 - .../github.com/gogo/protobuf/jsonpb/jsonpb.go | 959 -- .../gogo/protobuf/plugin/compare/compare.go | 526 - .../protobuf/plugin/compare/comparetest.go | 107 - .../plugin/defaultcheck/defaultcheck.go | 133 - .../plugin/description/description.go | 201 - .../plugin/description/descriptiontest.go | 73 - .../protobuf/plugin/embedcheck/embedcheck.go | 199 - .../plugin/enumstringer/enumstringer.go | 104 - .../gogo/protobuf/plugin/equal/equal.go | 645 - .../gogo/protobuf/plugin/equal/equaltest.go | 96 - .../gogo/protobuf/plugin/face/face.go | 233 - .../gogo/protobuf/plugin/face/facetest.go | 82 - .../gogo/protobuf/plugin/gostring/gostring.go | 368 - .../protobuf/plugin/gostring/gostringtest.go | 90 - .../protobuf/plugin/marshalto/marshalto.go | 1423 -- .../protobuf/plugin/oneofcheck/oneofcheck.go | 93 - .../gogo/protobuf/plugin/populate/populate.go | 796 - .../gogo/protobuf/plugin/size/size.go | 669 - .../gogo/protobuf/plugin/size/sizetest.go | 134 - .../gogo/protobuf/plugin/stringer/stringer.go | 296 - .../protobuf/plugin/stringer/stringertest.go | 83 - .../gogo/protobuf/plugin/testgen/testgen.go | 608 - .../gogo/protobuf/plugin/union/union.go | 209 - .../gogo/protobuf/plugin/union/uniontest.go | 86 - .../protobuf/plugin/unmarshal/unmarshal.go | 1439 -- .../github.com/gogo/protobuf/proto/clone.go | 234 - .../github.com/gogo/protobuf/proto/decode.go | 978 -- .../gogo/protobuf/proto/decode_gogo.go | 172 - .../gogo/protobuf/proto/duration.go | 100 - .../gogo/protobuf/proto/duration_gogo.go | 203 - .../github.com/gogo/protobuf/proto/encode.go | 1362 -- .../gogo/protobuf/proto/encode_gogo.go | 350 - .../github.com/gogo/protobuf/proto/equal.go | 300 - .../gogo/protobuf/proto/extensions.go | 693 - .../gogo/protobuf/proto/extensions_gogo.go | 294 - .../src/github.com/gogo/protobuf/proto/lib.go | 898 -- .../gogo/protobuf/proto/lib_gogo.go | 42 - .../gogo/protobuf/proto/message_set.go | 311 - .../gogo/protobuf/proto/pointer_reflect.go | 484 - .../protobuf/proto/pointer_reflect_gogo.go | 85 - .../gogo/protobuf/proto/pointer_unsafe.go | 270 - .../protobuf/proto/pointer_unsafe_gogo.go | 128 - .../gogo/protobuf/proto/properties.go | 968 -- .../gogo/protobuf/proto/properties_gogo.go | 111 - .../protobuf/proto/proto3_proto/proto3.pb.go | 347 - .../protobuf/proto/proto3_proto/proto3.proto | 87 - .../gogo/protobuf/proto/skip_gogo.go | 119 - .../github.com/gogo/protobuf/proto/text.go | 928 -- .../gogo/protobuf/proto/text_gogo.go | 57 - .../gogo/protobuf/proto/text_parser.go | 1013 -- .../gogo/protobuf/proto/timestamp.go | 113 - .../gogo/protobuf/proto/timestamp_gogo.go | 229 - .../protobuf/google/protobuf/any.proto | 140 - .../google/protobuf/compiler/plugin.proto | 150 - .../protobuf/google/protobuf/descriptor.proto | 813 - .../protobuf/google/protobuf/duration.proto | 98 - .../protobuf/google/protobuf/empty.proto | 53 - .../protobuf/google/protobuf/field_mask.proto | 246 - .../protobuf/google/protobuf/struct.proto | 96 - .../protobuf/google/protobuf/timestamp.proto | 111 - .../protobuf/google/protobuf/wrappers.proto | 119 - .../gogo/protobuf/protoc-gen-combo/combo.go | 200 - .../gogo/protobuf/protoc-gen-gofast/main.go | 48 - .../protoc-gen-gogo/descriptor/descriptor.go | 92 - .../descriptor/descriptor.pb.go | 2088 --- .../descriptor/descriptor_gostring.gen.go | 715 - .../protoc-gen-gogo/descriptor/helper.go | 357 - .../gogo/protobuf/protoc-gen-gogo/doc.go | 51 - .../protoc-gen-gogo/generator/generator.go | 3318 ---- .../protoc-gen-gogo/generator/helper.go | 447 - .../protobuf/protoc-gen-gogo/grpc/grpc.go | 463 - .../gogo/protobuf/protoc-gen-gogo/main.go | 57 - .../protoc-gen-gogo/plugin/plugin.pb.go | 230 - .../gogo/protobuf/protoc-gen-gogofast/main.go | 47 - .../protobuf/protoc-gen-gogofaster/main.go | 50 - .../protobuf/protoc-gen-gogoslick/main.go | 59 - .../protobuf/protoc-gen-gogotypes/main.go | 75 - .../gogo/protobuf/protoc-gen-gostring/main.go | 42 - .../protobuf/protoc-min-version/minversion.go | 65 - .../gogo/protobuf/sortkeys/sortkeys.go | 101 - .../src/github.com/gogo/protobuf/types/any.go | 135 - .../github.com/gogo/protobuf/types/any.pb.go | 687 - .../src/github.com/gogo/protobuf/types/doc.go | 35 - .../gogo/protobuf/types/duration.go | 100 - .../gogo/protobuf/types/duration.pb.go | 515 - .../gogo/protobuf/types/duration_gogo.go | 100 - .../gogo/protobuf/types/empty.pb.go | 478 - .../gogo/protobuf/types/field_mask.pb.go | 759 - .../gogo/protobuf/types/struct.pb.go | 1908 --- .../gogo/protobuf/types/timestamp.go | 123 - .../gogo/protobuf/types/timestamp.pb.go | 527 - .../gogo/protobuf/types/timestamp_gogo.go | 94 - .../gogo/protobuf/types/wrappers.pb.go | 2280 --- .../gogo/protobuf/vanity/command/command.go | 161 - .../github.com/gogo/protobuf/vanity/enum.go | 78 - .../github.com/gogo/protobuf/vanity/field.go | 83 - .../github.com/gogo/protobuf/vanity/file.go | 181 - .../gogo/protobuf/vanity/foreach.go | 125 - .../github.com/gogo/protobuf/vanity/msg.go | 142 - .../gogo/protobuf/vanity/test/doc.go | 1 - .../vanity/test/fast/gogovanity.pb.go | 408 - .../protobuf/vanity/test/fast/proto3.pb.go | 320 - .../protobuf/vanity/test/fast/vanity.pb.go | 375 - .../vanity/test/faster/gogovanity.pb.go | 396 - .../protobuf/vanity/test/faster/proto3.pb.go | 320 - .../protobuf/vanity/test/faster/vanity.pb.go | 354 - .../protobuf/vanity/test/gogovanity.proto | 39 - .../gogo/protobuf/vanity/test/proto3.proto | 35 - .../vanity/test/slick/gogovanity.pb.go | 512 - .../protobuf/vanity/test/slick/proto3.pb.go | 411 - .../protobuf/vanity/test/slick/vanity.pb.go | 449 - .../gogo/protobuf/vanity/test/vanity.proto | 36 - .../gogo/protobuf/version/version.go | 78 - .../src/github.com/golang/protobuf/LICENSE | 31 - .../github.com/golang/protobuf/proto/clone.go | 229 - .../golang/protobuf/proto/decode.go | 970 -- .../golang/protobuf/proto/encode.go | 1362 -- .../github.com/golang/protobuf/proto/equal.go | 300 - .../golang/protobuf/proto/extensions.go | 587 - .../github.com/golang/protobuf/proto/lib.go | 898 -- .../golang/protobuf/proto/message_set.go | 311 - .../golang/protobuf/proto/pointer_reflect.go | 484 - .../golang/protobuf/proto/pointer_unsafe.go | 270 - .../golang/protobuf/proto/properties.go | 872 - .../github.com/golang/protobuf/proto/text.go | 854 - .../golang/protobuf/proto/text_parser.go | 895 -- .../src/github.com/juju/errors/LICENSE | 191 - .../_vendor/src/github.com/juju/errors/doc.go | 81 - .../src/github.com/juju/errors/error.go | 145 - .../src/github.com/juju/errors/errortypes.go | 284 - .../src/github.com/juju/errors/functions.go | 330 - .../src/github.com/juju/errors/path.go | 38 - .../src/github.com/pingcap/tipb/LICENSE | 201 - .../pingcap/tipb/generate-binlog.sh | 13 - .../github.com/pingcap/tipb/generate-go.sh | 10 - .../github.com/pingcap/tipb/generate-rust.sh | 22 - .../pingcap/tipb/sharedbytes/sharedbytes.go | 42 - .../_vendor/src/golang.org/x/net/LICENSE | 27 - .../_vendor/src/golang.org/x/net/PATENTS | 22 - .../src/golang.org/x/net/context/context.go | 447 - .../x/net/http2/client_conn_pool.go | 225 - .../x/net/http2/configure_transport.go | 89 - .../src/golang.org/x/net/http2/errors.go | 122 - .../golang.org/x/net/http2/fixed_buffer.go | 60 - .../src/golang.org/x/net/http2/flow.go | 50 - .../src/golang.org/x/net/http2/frame.go | 1496 -- .../src/golang.org/x/net/http2/go15.go | 11 - .../src/golang.org/x/net/http2/gotrack.go | 170 - .../src/golang.org/x/net/http2/headermap.go | 78 - .../golang.org/x/net/http2/hpack/encode.go | 251 - .../src/golang.org/x/net/http2/hpack/hpack.go | 542 - .../golang.org/x/net/http2/hpack/huffman.go | 190 - .../golang.org/x/net/http2/hpack/tables.go | 352 - .../src/golang.org/x/net/http2/http2.go | 429 - .../src/golang.org/x/net/http2/not_go15.go | 11 - .../src/golang.org/x/net/http2/not_go16.go | 13 - .../src/golang.org/x/net/http2/pipe.go | 147 - .../src/golang.org/x/net/http2/server.go | 2149 --- .../src/golang.org/x/net/http2/transport.go | 1666 -- .../src/golang.org/x/net/http2/write.go | 263 - .../src/golang.org/x/net/http2/writesched.go | 283 - .../x/net/internal/timeseries/timeseries.go | 525 - .../src/golang.org/x/net/trace/events.go | 524 - .../src/golang.org/x/net/trace/histogram.go | 356 - .../src/golang.org/x/net/trace/trace.go | 1059 -- .../_vendor/src/golang.org/x/text/LICENSE | 27 - .../x/text/secure/bidirule/bidirule.go | 342 - .../_vendor/src/golang.org/x/tools/LICENSE | 27 - .../_vendor/src/golang.org/x/tools/PATENTS | 22 - .../golang.org/x/tools/cmd/goimports/doc.go | 45 - .../x/tools/cmd/goimports/goimports.go | 317 - .../x/tools/cmd/goimports/goimports_gc.go | 26 - .../x/tools/cmd/goimports/goimports_not_gc.go | 11 - .../x/tools/go/ast/astutil/enclosing.go | 627 - .../x/tools/go/ast/astutil/imports.go | 449 - .../golang.org/x/tools/go/ast/astutil/util.go | 14 - .../golang.org/x/tools/imports/fastwalk.go | 172 - .../x/tools/imports/fastwalk_dirent_fileno.go | 13 - .../x/tools/imports/fastwalk_dirent_ino.go | 13 - .../x/tools/imports/fastwalk_portable.go | 29 - .../x/tools/imports/fastwalk_unix.go | 122 - .../src/golang.org/x/tools/imports/fix.go | 978 -- .../src/golang.org/x/tools/imports/imports.go | 289 - .../src/golang.org/x/tools/imports/mkindex.go | 173 - .../golang.org/x/tools/imports/mkstdlib.go | 103 - .../golang.org/x/tools/imports/sortimports.go | 212 - .../src/golang.org/x/tools/imports/zstdlib.go | 9289 ----------- .../src/google.golang.org/grpc/LICENSE | 28 - .../src/google.golang.org/grpc/PATENTS | 22 - .../src/google.golang.org/grpc/backoff.go | 80 - .../src/google.golang.org/grpc/balancer.go | 400 - .../src/google.golang.org/grpc/call.go | 289 - .../src/google.golang.org/grpc/clientconn.go | 1006 -- .../src/google.golang.org/grpc/codegen.sh | 17 - .../grpc/codes/code_string.go | 16 - .../src/google.golang.org/grpc/codes/codes.go | 159 - .../src/google.golang.org/grpc/coverage.sh | 48 - .../grpc/credentials/credentials.go | 230 - .../grpc/credentials/credentials_util_go17.go | 75 - .../grpc/credentials/credentials_util_go18.go | 53 - .../credentials/credentials_util_pre_go17.go | 72 - .../_vendor/src/google.golang.org/grpc/doc.go | 6 - .../google.golang.org/grpc/grpclog/logger.go | 93 - .../src/google.golang.org/grpc/interceptor.go | 90 - .../grpc/internal/internal.go | 49 - .../grpc/keepalive/keepalive.go | 52 - .../grpc/metadata/metadata.go | 152 - .../google.golang.org/grpc/naming/naming.go | 74 - .../src/google.golang.org/grpc/peer/peer.go | 65 - .../src/google.golang.org/grpc/rpc_util.go | 532 - .../src/google.golang.org/grpc/server.go | 1085 -- .../google.golang.org/grpc/stats/handlers.go | 76 - .../src/google.golang.org/grpc/stats/stats.go | 223 - .../src/google.golang.org/grpc/stream.go | 626 - .../src/google.golang.org/grpc/tap/tap.go | 54 - .../src/google.golang.org/grpc/trace.go | 119 - .../grpc/transport/control.go | 199 - .../google.golang.org/grpc/transport/go16.go | 46 - .../google.golang.org/grpc/transport/go17.go | 46 - .../grpc/transport/handler_server.go | 397 - .../grpc/transport/http2_client.go | 1230 -- .../grpc/transport/http2_server.go | 847 - .../grpc/transport/http_util.go | 511 - .../grpc/transport/pre_go16.go | 51 - .../grpc/transport/transport.go | 626 - .../src/github.com/pingcap/kvproto/circle.yml | 51 - .../src/github.com/pingcap/kvproto/common.sh | 27 - .../github.com/pingcap/kvproto/generate_go.sh | 68 - .../pingcap/kvproto/generate_rust.sh | 61 - .../src/github.com/pingcap/kvproto/glide.lock | 104 - .../src/github.com/pingcap/kvproto/glide.yaml | 81 - .../kvproto/pkg/coprocessor/coprocessor.pb.go | 960 -- .../pingcap/kvproto/pkg/eraftpb/eraftpb.pb.go | 2219 --- .../pingcap/kvproto/pkg/errorpb/errorpb.pb.go | 2027 --- .../pingcap/kvproto/pkg/kvrpcpb/kvrpcpb.pb.go | 10053 ------------ .../pingcap/kvproto/pkg/metapb/metapb.pb.go | 2 +- .../kvproto/pkg/raft_cmdpb/raft_cmdpb.pb.go | 7803 --------- .../pkg/raft_serverpb/raft_serverpb.pb.go | 2690 ---- .../pingcap/kvproto/pkg/tikvpb/tikvpb.pb.go | 895 -- .../pingcap/kvproto/proto/coprocessor.proto | 32 - .../pingcap/kvproto/proto/eraftpb.proto | 86 - .../pingcap/kvproto/proto/errorpb.proto | 58 - .../pingcap/kvproto/proto/kvrpcpb.proto | 292 - .../pingcap/kvproto/proto/metapb.proto | 59 - .../pingcap/kvproto/proto/pdpb.proto | 341 - .../pingcap/kvproto/proto/raft_cmdpb.proto | 256 - .../pingcap/kvproto/proto/raft_serverpb.proto | 81 - .../pingcap/kvproto/proto/tikvpb.proto | 48 - .../pingcap/kvproto/src/coprocessor.rs | 1045 -- .../github.com/pingcap/kvproto/src/eraftpb.rs | 2797 ---- .../github.com/pingcap/kvproto/src/errorpb.rs | 2469 --- .../github.com/pingcap/kvproto/src/kvrpcpb.rs | 13213 ---------------- .../src/github.com/pingcap/kvproto/src/lib.rs | 15 - .../github.com/pingcap/kvproto/src/metapb.rs | 1923 --- .../github.com/pingcap/kvproto/src/pdpb.rs | 11027 ------------- .../pingcap/kvproto/src/pdpb_grpc.rs | 446 - .../pingcap/kvproto/src/raft_cmdpb.rs | 10096 ------------ .../pingcap/kvproto/src/raft_serverpb.rs | 3400 ---- .../pingcap/kvproto/src/tikvpb_grpc.rs | 614 - .../github.com/pingcap/kvproto/src/util.rs | 20 - 279 files changed, 1 insertion(+), 166892 deletions(-) delete mode 100644 _vendor/src/github.com/pingcap/kvproto/.gitignore delete mode 100644 _vendor/src/github.com/pingcap/kvproto/Cargo.toml delete mode 100644 _vendor/src/github.com/pingcap/kvproto/Makefile delete mode 100644 _vendor/src/github.com/pingcap/kvproto/README.md delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/LICENSE delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance_proto/conformance.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance_proto/conformance.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/codec/codec.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/doc.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/gogo.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/gogo.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/helper.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoreplace/main.go delete mode 100755 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/install-protobuf.sh delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/full.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/io.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/uint32.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/varint.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/jsonpb/jsonpb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/compare/compare.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/compare/comparetest.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/defaultcheck/defaultcheck.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/description/description.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/description/descriptiontest.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/embedcheck/embedcheck.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/enumstringer/enumstringer.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/equal/equal.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/equal/equaltest.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/face/face.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/face/facetest.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/gostring/gostring.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/gostring/gostringtest.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/marshalto/marshalto.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/oneofcheck/oneofcheck.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/populate/populate.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/size/size.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/size/sizetest.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/stringer/stringer.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/stringer/stringertest.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/testgen/testgen.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/union/union.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/union/uniontest.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/unmarshal/unmarshal.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/clone.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/decode.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/decode_gogo.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/duration.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/duration_gogo.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/encode.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/encode_gogo.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/equal.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/extensions.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/extensions_gogo.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/lib.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/lib_gogo.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/message_set.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_reflect.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_unsafe.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/properties.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/properties_gogo.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/proto3_proto/proto3.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/proto3_proto/proto3.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/skip_gogo.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text_gogo.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text_parser.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/timestamp.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/timestamp_gogo.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/any.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/compiler/plugin.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/descriptor.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/duration.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/empty.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/field_mask.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/struct.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/timestamp.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/wrappers.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-combo/combo.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gofast/main.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/helper.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/doc.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/generator/generator.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/generator/helper.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/grpc/grpc.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/main.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/plugin/plugin.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogofast/main.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogofaster/main.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogoslick/main.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogotypes/main.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gostring/main.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-min-version/minversion.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/sortkeys/sortkeys.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/any.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/any.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/doc.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration_gogo.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/empty.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/field_mask.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/struct.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp_gogo.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/wrappers.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/command/command.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/enum.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/field.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/file.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/foreach.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/msg.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/doc.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/gogovanity.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/proto3.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/vanity.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/gogovanity.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/proto3.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/vanity.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/gogovanity.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/proto3.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/gogovanity.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/proto3.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/vanity.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/vanity.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/version/version.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/LICENSE delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/clone.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/decode.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/encode.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/equal.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/extensions.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/lib.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/message_set.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/pointer_reflect.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/pointer_unsafe.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/properties.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/text.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/text_parser.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/LICENSE delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/doc.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/error.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/errortypes.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/functions.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/path.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/LICENSE delete mode 100755 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-binlog.sh delete mode 100755 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-go.sh delete mode 100755 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-rust.sh delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/sharedbytes/sharedbytes.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/LICENSE delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/PATENTS delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/context/context.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/client_conn_pool.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/configure_transport.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/errors.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/fixed_buffer.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/flow.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/frame.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/go15.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/gotrack.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/headermap.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/encode.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/hpack.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/huffman.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/tables.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/http2.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/not_go15.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/not_go16.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/pipe.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/server.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/transport.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/write.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/writesched.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/internal/timeseries/timeseries.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/events.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/histogram.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/trace.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/text/LICENSE delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/text/secure/bidirule/bidirule.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/LICENSE delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/PATENTS delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/cmd/goimports/doc.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/cmd/goimports/goimports.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/cmd/goimports/goimports_gc.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/cmd/goimports/goimports_not_gc.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/enclosing.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/imports.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/util.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_dirent_fileno.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_dirent_ino.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_portable.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_unix.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fix.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/imports.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/mkindex.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/mkstdlib.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/sortimports.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/zstdlib.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/LICENSE delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/PATENTS delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/backoff.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/balancer.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/call.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/clientconn.go delete mode 100755 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codegen.sh delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codes/code_string.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codes/codes.go delete mode 100755 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/coverage.sh delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_go17.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_go18.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_pre_go17.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/doc.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/grpclog/logger.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/interceptor.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/internal/internal.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/keepalive/keepalive.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/metadata/metadata.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/naming/naming.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/peer/peer.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/rpc_util.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/server.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stats/handlers.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stats/stats.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stream.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/tap/tap.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/trace.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/control.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/go16.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/go17.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/handler_server.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http2_client.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http2_server.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http_util.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/pre_go16.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/transport.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/circle.yml delete mode 100755 _vendor/src/github.com/pingcap/kvproto/common.sh delete mode 100755 _vendor/src/github.com/pingcap/kvproto/generate_go.sh delete mode 100755 _vendor/src/github.com/pingcap/kvproto/generate_rust.sh delete mode 100644 _vendor/src/github.com/pingcap/kvproto/glide.lock delete mode 100644 _vendor/src/github.com/pingcap/kvproto/glide.yaml delete mode 100644 _vendor/src/github.com/pingcap/kvproto/pkg/coprocessor/coprocessor.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/pkg/eraftpb/eraftpb.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/pkg/errorpb/errorpb.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/pkg/kvrpcpb/kvrpcpb.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/pkg/raft_cmdpb/raft_cmdpb.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/pkg/raft_serverpb/raft_serverpb.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/pkg/tikvpb/tikvpb.pb.go delete mode 100644 _vendor/src/github.com/pingcap/kvproto/proto/coprocessor.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/proto/eraftpb.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/proto/errorpb.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/proto/kvrpcpb.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/proto/metapb.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/proto/pdpb.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/proto/raft_cmdpb.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/proto/raft_serverpb.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/proto/tikvpb.proto delete mode 100644 _vendor/src/github.com/pingcap/kvproto/src/coprocessor.rs delete mode 100644 _vendor/src/github.com/pingcap/kvproto/src/eraftpb.rs delete mode 100644 _vendor/src/github.com/pingcap/kvproto/src/errorpb.rs delete mode 100644 _vendor/src/github.com/pingcap/kvproto/src/kvrpcpb.rs delete mode 100644 _vendor/src/github.com/pingcap/kvproto/src/lib.rs delete mode 100644 _vendor/src/github.com/pingcap/kvproto/src/metapb.rs delete mode 100644 _vendor/src/github.com/pingcap/kvproto/src/pdpb.rs delete mode 100644 _vendor/src/github.com/pingcap/kvproto/src/pdpb_grpc.rs delete mode 100644 _vendor/src/github.com/pingcap/kvproto/src/raft_cmdpb.rs delete mode 100644 _vendor/src/github.com/pingcap/kvproto/src/raft_serverpb.rs delete mode 100644 _vendor/src/github.com/pingcap/kvproto/src/tikvpb_grpc.rs delete mode 100644 _vendor/src/github.com/pingcap/kvproto/src/util.rs diff --git a/_vendor/src/github.com/pingcap/kvproto/.gitignore b/_vendor/src/github.com/pingcap/kvproto/.gitignore deleted file mode 100644 index f4b3f76f095..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -target -# ignore object files generated by golang compiler -pkg/darwin_amd64/ -pkg/linux_amd64/ -# ignore source files downloaded by `go get` -src/github.com/ -# ignore binary file compiler by `go get` -bin/ -_vendor/bin -_vendor/pkg -Cargo.lock -.vscode diff --git a/_vendor/src/github.com/pingcap/kvproto/Cargo.toml b/_vendor/src/github.com/pingcap/kvproto/Cargo.toml deleted file mode 100644 index f47097be08e..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "kvproto" -version = "0.0.1" -keywords = ["TiKV"] - -[lib] -name = "kvproto" - -[dependencies] -protobuf = "1.*" -futures = "0.1" -grpcio = "0.1" diff --git a/_vendor/src/github.com/pingcap/kvproto/Makefile b/_vendor/src/github.com/pingcap/kvproto/Makefile deleted file mode 100644 index 537507ebe1e..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -### Makefile for kvproto - -CURDIR := $(shell pwd) - -KEEP_FILE := '**/*.proto,**/*.sh' - -export PATH := $(CURDIR)/_vendor/bin:$(PATH) -export GOPATH := $(GOPATH):$(CURDIR)/_vendor - -all: go rust test - -test: - # Build test. - go build ./pkg/... - cargo check - -go: - # Standalone GOPATH - GOPATH=$(CURDIR)/_vendor ./generate_go.sh - -rust: - GOPATH=$(CURDIR)/_vendor ./generate_rust.sh - -update_go_pkg: - which glide >/dev/null || curl https://glide.sh/get | sh - which glide-vc || go get -v -u github.com/sgotti/glide-vc - rm -rf vendor && mv _vendor vendor || true - rm -rf _vendor -ifdef PKG - glide get --strip-vendor --skip-test ${PKG} -else - glide update --strip-vendor --skip-test -endif - @echo "removing test files" - glide vc --only-code --no-tests --use-lock-file --keep $(KEEP_FILE) - mkdir -p _vendor - mv vendor _vendor - -.PHONY: update_go_pkg all diff --git a/_vendor/src/github.com/pingcap/kvproto/README.md b/_vendor/src/github.com/pingcap/kvproto/README.md deleted file mode 100644 index 2e7b0adbb2b..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# kvproto -Protocol buffer files for TiKV - -# Usage - -+ Write your own protocol file in proto folder. -+ Run `make` to generate go and rust code. - We generate all go codes in pkg folder and rust in src folder. -+ Update the dependent projects. - diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/LICENSE b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/LICENSE deleted file mode 100644 index 7be0cc7b62c..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/LICENSE +++ /dev/null @@ -1,36 +0,0 @@ -Protocol Buffers for Go with Gadgets - -Copyright (c) 2013, The GoGo Authors. All rights reserved. -http://github.com/gogo/protobuf - -Go support for Protocol Buffers - Google's data interchange format - -Copyright 2010 The Go Authors. All rights reserved. -https://github.com/golang/protobuf - -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/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance.go deleted file mode 100644 index 45b37881b72..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance.go +++ /dev/null @@ -1,161 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -// conformance implements the conformance test subprocess protocol as -// documented in conformance.proto. -package main - -import ( - "encoding/binary" - "fmt" - "io" - "os" - - pb "github.com/gogo/protobuf/_conformance/conformance_proto" - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" -) - -func main() { - var sizeBuf [4]byte - inbuf := make([]byte, 0, 4096) - outbuf := proto.NewBuffer(nil) - for { - if _, err := io.ReadFull(os.Stdin, sizeBuf[:]); err == io.EOF { - break - } else if err != nil { - fmt.Fprintln(os.Stderr, "go conformance: read request:", err) - os.Exit(1) - } - size := binary.LittleEndian.Uint32(sizeBuf[:]) - if int(size) > cap(inbuf) { - inbuf = make([]byte, size) - } - inbuf = inbuf[:size] - if _, err := io.ReadFull(os.Stdin, inbuf); err != nil { - fmt.Fprintln(os.Stderr, "go conformance: read request:", err) - os.Exit(1) - } - - req := new(pb.ConformanceRequest) - if err := proto.Unmarshal(inbuf, req); err != nil { - fmt.Fprintln(os.Stderr, "go conformance: parse request:", err) - os.Exit(1) - } - res := handle(req) - - if err := outbuf.Marshal(res); err != nil { - fmt.Fprintln(os.Stderr, "go conformance: marshal response:", err) - os.Exit(1) - } - binary.LittleEndian.PutUint32(sizeBuf[:], uint32(len(outbuf.Bytes()))) - if _, err := os.Stdout.Write(sizeBuf[:]); err != nil { - fmt.Fprintln(os.Stderr, "go conformance: write response:", err) - os.Exit(1) - } - if _, err := os.Stdout.Write(outbuf.Bytes()); err != nil { - fmt.Fprintln(os.Stderr, "go conformance: write response:", err) - os.Exit(1) - } - outbuf.Reset() - } -} - -var jsonMarshaler = jsonpb.Marshaler{ - OrigName: true, -} - -func handle(req *pb.ConformanceRequest) *pb.ConformanceResponse { - var err error - var msg pb.TestAllTypes - switch p := req.Payload.(type) { - case *pb.ConformanceRequest_ProtobufPayload: - err = proto.Unmarshal(p.ProtobufPayload, &msg) - case *pb.ConformanceRequest_JsonPayload: - err = jsonpb.UnmarshalString(p.JsonPayload, &msg) - if err != nil && err.Error() == "unmarshaling Any not supported yet" { - return &pb.ConformanceResponse{ - Result: &pb.ConformanceResponse_Skipped{ - Skipped: err.Error(), - }, - } - } - default: - return &pb.ConformanceResponse{ - Result: &pb.ConformanceResponse_RuntimeError{ - RuntimeError: "unknown request payload type", - }, - } - } - if err != nil { - return &pb.ConformanceResponse{ - Result: &pb.ConformanceResponse_ParseError{ - ParseError: err.Error(), - }, - } - } - switch req.RequestedOutputFormat { - case pb.WireFormat_PROTOBUF: - p, err := proto.Marshal(&msg) - if err != nil { - return &pb.ConformanceResponse{ - Result: &pb.ConformanceResponse_SerializeError{ - SerializeError: err.Error(), - }, - } - } - return &pb.ConformanceResponse{ - Result: &pb.ConformanceResponse_ProtobufPayload{ - ProtobufPayload: p, - }, - } - case pb.WireFormat_JSON: - p, err := jsonMarshaler.MarshalToString(&msg) - if err != nil { - return &pb.ConformanceResponse{ - Result: &pb.ConformanceResponse_SerializeError{ - SerializeError: err.Error(), - }, - } - } - return &pb.ConformanceResponse{ - Result: &pb.ConformanceResponse_JsonPayload{ - JsonPayload: p, - }, - } - default: - return &pb.ConformanceResponse{ - Result: &pb.ConformanceResponse_RuntimeError{ - RuntimeError: "unknown output format", - }, - } - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance_proto/conformance.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance_proto/conformance.pb.go deleted file mode 100644 index 9571c9c2093..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance_proto/conformance.pb.go +++ /dev/null @@ -1,1890 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: conformance_proto/conformance.proto -// DO NOT EDIT! - -/* -Package conformance is a generated protocol buffer package. - -It is generated from these files: - conformance_proto/conformance.proto - -It has these top-level messages: - ConformanceRequest - ConformanceResponse - TestAllTypes - ForeignMessage -*/ -package conformance - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import google_protobuf "github.com/gogo/protobuf/types" -import google_protobuf1 "github.com/gogo/protobuf/types" -import google_protobuf2 "github.com/gogo/protobuf/types" -import google_protobuf3 "github.com/gogo/protobuf/types" -import google_protobuf4 "github.com/gogo/protobuf/types" -import google_protobuf5 "github.com/gogo/protobuf/types" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type WireFormat int32 - -const ( - WireFormat_UNSPECIFIED WireFormat = 0 - WireFormat_PROTOBUF WireFormat = 1 - WireFormat_JSON WireFormat = 2 -) - -var WireFormat_name = map[int32]string{ - 0: "UNSPECIFIED", - 1: "PROTOBUF", - 2: "JSON", -} -var WireFormat_value = map[string]int32{ - "UNSPECIFIED": 0, - "PROTOBUF": 1, - "JSON": 2, -} - -func (x WireFormat) String() string { - return proto.EnumName(WireFormat_name, int32(x)) -} -func (WireFormat) EnumDescriptor() ([]byte, []int) { return fileDescriptorConformance, []int{0} } - -type ForeignEnum int32 - -const ( - ForeignEnum_FOREIGN_FOO ForeignEnum = 0 - ForeignEnum_FOREIGN_BAR ForeignEnum = 1 - ForeignEnum_FOREIGN_BAZ ForeignEnum = 2 -) - -var ForeignEnum_name = map[int32]string{ - 0: "FOREIGN_FOO", - 1: "FOREIGN_BAR", - 2: "FOREIGN_BAZ", -} -var ForeignEnum_value = map[string]int32{ - "FOREIGN_FOO": 0, - "FOREIGN_BAR": 1, - "FOREIGN_BAZ": 2, -} - -func (x ForeignEnum) String() string { - return proto.EnumName(ForeignEnum_name, int32(x)) -} -func (ForeignEnum) EnumDescriptor() ([]byte, []int) { return fileDescriptorConformance, []int{1} } - -type TestAllTypes_NestedEnum int32 - -const ( - TestAllTypes_FOO TestAllTypes_NestedEnum = 0 - TestAllTypes_BAR TestAllTypes_NestedEnum = 1 - TestAllTypes_BAZ TestAllTypes_NestedEnum = 2 - TestAllTypes_NEG TestAllTypes_NestedEnum = -1 -) - -var TestAllTypes_NestedEnum_name = map[int32]string{ - 0: "FOO", - 1: "BAR", - 2: "BAZ", - -1: "NEG", -} -var TestAllTypes_NestedEnum_value = map[string]int32{ - "FOO": 0, - "BAR": 1, - "BAZ": 2, - "NEG": -1, -} - -func (x TestAllTypes_NestedEnum) String() string { - return proto.EnumName(TestAllTypes_NestedEnum_name, int32(x)) -} -func (TestAllTypes_NestedEnum) EnumDescriptor() ([]byte, []int) { - return fileDescriptorConformance, []int{2, 0} -} - -// Represents a single test case's input. The testee should: -// -// 1. parse this proto (which should always succeed) -// 2. parse the protobuf or JSON payload in "payload" (which may fail) -// 3. if the parse succeeded, serialize the message in the requested format. -type ConformanceRequest struct { - // The payload (whether protobuf of JSON) is always for a TestAllTypes proto - // (see below). - // - // Types that are valid to be assigned to Payload: - // *ConformanceRequest_ProtobufPayload - // *ConformanceRequest_JsonPayload - Payload isConformanceRequest_Payload `protobuf_oneof:"payload"` - // Which format should the testee serialize its message to? - RequestedOutputFormat WireFormat `protobuf:"varint,3,opt,name=requested_output_format,json=requestedOutputFormat,proto3,enum=conformance.WireFormat" json:"requested_output_format,omitempty"` -} - -func (m *ConformanceRequest) Reset() { *m = ConformanceRequest{} } -func (m *ConformanceRequest) String() string { return proto.CompactTextString(m) } -func (*ConformanceRequest) ProtoMessage() {} -func (*ConformanceRequest) Descriptor() ([]byte, []int) { return fileDescriptorConformance, []int{0} } - -type isConformanceRequest_Payload interface { - isConformanceRequest_Payload() -} - -type ConformanceRequest_ProtobufPayload struct { - ProtobufPayload []byte `protobuf:"bytes,1,opt,name=protobuf_payload,json=protobufPayload,proto3,oneof"` -} -type ConformanceRequest_JsonPayload struct { - JsonPayload string `protobuf:"bytes,2,opt,name=json_payload,json=jsonPayload,proto3,oneof"` -} - -func (*ConformanceRequest_ProtobufPayload) isConformanceRequest_Payload() {} -func (*ConformanceRequest_JsonPayload) isConformanceRequest_Payload() {} - -func (m *ConformanceRequest) GetPayload() isConformanceRequest_Payload { - if m != nil { - return m.Payload - } - return nil -} - -func (m *ConformanceRequest) GetProtobufPayload() []byte { - if x, ok := m.GetPayload().(*ConformanceRequest_ProtobufPayload); ok { - return x.ProtobufPayload - } - return nil -} - -func (m *ConformanceRequest) GetJsonPayload() string { - if x, ok := m.GetPayload().(*ConformanceRequest_JsonPayload); ok { - return x.JsonPayload - } - return "" -} - -func (m *ConformanceRequest) GetRequestedOutputFormat() WireFormat { - if m != nil { - return m.RequestedOutputFormat - } - return WireFormat_UNSPECIFIED -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*ConformanceRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _ConformanceRequest_OneofMarshaler, _ConformanceRequest_OneofUnmarshaler, _ConformanceRequest_OneofSizer, []interface{}{ - (*ConformanceRequest_ProtobufPayload)(nil), - (*ConformanceRequest_JsonPayload)(nil), - } -} - -func _ConformanceRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*ConformanceRequest) - // payload - switch x := m.Payload.(type) { - case *ConformanceRequest_ProtobufPayload: - _ = b.EncodeVarint(1<<3 | proto.WireBytes) - _ = b.EncodeRawBytes(x.ProtobufPayload) - case *ConformanceRequest_JsonPayload: - _ = b.EncodeVarint(2<<3 | proto.WireBytes) - _ = b.EncodeStringBytes(x.JsonPayload) - case nil: - default: - return fmt.Errorf("ConformanceRequest.Payload has unexpected type %T", x) - } - return nil -} - -func _ConformanceRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*ConformanceRequest) - switch tag { - case 1: // payload.protobuf_payload - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeRawBytes(true) - m.Payload = &ConformanceRequest_ProtobufPayload{x} - return true, err - case 2: // payload.json_payload - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Payload = &ConformanceRequest_JsonPayload{x} - return true, err - default: - return false, nil - } -} - -func _ConformanceRequest_OneofSizer(msg proto.Message) (n int) { - m := msg.(*ConformanceRequest) - // payload - switch x := m.Payload.(type) { - case *ConformanceRequest_ProtobufPayload: - n += proto.SizeVarint(1<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.ProtobufPayload))) - n += len(x.ProtobufPayload) - case *ConformanceRequest_JsonPayload: - n += proto.SizeVarint(2<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.JsonPayload))) - n += len(x.JsonPayload) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -// Represents a single test case's output. -type ConformanceResponse struct { - // Types that are valid to be assigned to Result: - // *ConformanceResponse_ParseError - // *ConformanceResponse_SerializeError - // *ConformanceResponse_RuntimeError - // *ConformanceResponse_ProtobufPayload - // *ConformanceResponse_JsonPayload - // *ConformanceResponse_Skipped - Result isConformanceResponse_Result `protobuf_oneof:"result"` -} - -func (m *ConformanceResponse) Reset() { *m = ConformanceResponse{} } -func (m *ConformanceResponse) String() string { return proto.CompactTextString(m) } -func (*ConformanceResponse) ProtoMessage() {} -func (*ConformanceResponse) Descriptor() ([]byte, []int) { return fileDescriptorConformance, []int{1} } - -type isConformanceResponse_Result interface { - isConformanceResponse_Result() -} - -type ConformanceResponse_ParseError struct { - ParseError string `protobuf:"bytes,1,opt,name=parse_error,json=parseError,proto3,oneof"` -} -type ConformanceResponse_SerializeError struct { - SerializeError string `protobuf:"bytes,6,opt,name=serialize_error,json=serializeError,proto3,oneof"` -} -type ConformanceResponse_RuntimeError struct { - RuntimeError string `protobuf:"bytes,2,opt,name=runtime_error,json=runtimeError,proto3,oneof"` -} -type ConformanceResponse_ProtobufPayload struct { - ProtobufPayload []byte `protobuf:"bytes,3,opt,name=protobuf_payload,json=protobufPayload,proto3,oneof"` -} -type ConformanceResponse_JsonPayload struct { - JsonPayload string `protobuf:"bytes,4,opt,name=json_payload,json=jsonPayload,proto3,oneof"` -} -type ConformanceResponse_Skipped struct { - Skipped string `protobuf:"bytes,5,opt,name=skipped,proto3,oneof"` -} - -func (*ConformanceResponse_ParseError) isConformanceResponse_Result() {} -func (*ConformanceResponse_SerializeError) isConformanceResponse_Result() {} -func (*ConformanceResponse_RuntimeError) isConformanceResponse_Result() {} -func (*ConformanceResponse_ProtobufPayload) isConformanceResponse_Result() {} -func (*ConformanceResponse_JsonPayload) isConformanceResponse_Result() {} -func (*ConformanceResponse_Skipped) isConformanceResponse_Result() {} - -func (m *ConformanceResponse) GetResult() isConformanceResponse_Result { - if m != nil { - return m.Result - } - return nil -} - -func (m *ConformanceResponse) GetParseError() string { - if x, ok := m.GetResult().(*ConformanceResponse_ParseError); ok { - return x.ParseError - } - return "" -} - -func (m *ConformanceResponse) GetSerializeError() string { - if x, ok := m.GetResult().(*ConformanceResponse_SerializeError); ok { - return x.SerializeError - } - return "" -} - -func (m *ConformanceResponse) GetRuntimeError() string { - if x, ok := m.GetResult().(*ConformanceResponse_RuntimeError); ok { - return x.RuntimeError - } - return "" -} - -func (m *ConformanceResponse) GetProtobufPayload() []byte { - if x, ok := m.GetResult().(*ConformanceResponse_ProtobufPayload); ok { - return x.ProtobufPayload - } - return nil -} - -func (m *ConformanceResponse) GetJsonPayload() string { - if x, ok := m.GetResult().(*ConformanceResponse_JsonPayload); ok { - return x.JsonPayload - } - return "" -} - -func (m *ConformanceResponse) GetSkipped() string { - if x, ok := m.GetResult().(*ConformanceResponse_Skipped); ok { - return x.Skipped - } - return "" -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*ConformanceResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _ConformanceResponse_OneofMarshaler, _ConformanceResponse_OneofUnmarshaler, _ConformanceResponse_OneofSizer, []interface{}{ - (*ConformanceResponse_ParseError)(nil), - (*ConformanceResponse_SerializeError)(nil), - (*ConformanceResponse_RuntimeError)(nil), - (*ConformanceResponse_ProtobufPayload)(nil), - (*ConformanceResponse_JsonPayload)(nil), - (*ConformanceResponse_Skipped)(nil), - } -} - -func _ConformanceResponse_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*ConformanceResponse) - // result - switch x := m.Result.(type) { - case *ConformanceResponse_ParseError: - _ = b.EncodeVarint(1<<3 | proto.WireBytes) - _ = b.EncodeStringBytes(x.ParseError) - case *ConformanceResponse_SerializeError: - _ = b.EncodeVarint(6<<3 | proto.WireBytes) - _ = b.EncodeStringBytes(x.SerializeError) - case *ConformanceResponse_RuntimeError: - _ = b.EncodeVarint(2<<3 | proto.WireBytes) - _ = b.EncodeStringBytes(x.RuntimeError) - case *ConformanceResponse_ProtobufPayload: - _ = b.EncodeVarint(3<<3 | proto.WireBytes) - _ = b.EncodeRawBytes(x.ProtobufPayload) - case *ConformanceResponse_JsonPayload: - _ = b.EncodeVarint(4<<3 | proto.WireBytes) - _ = b.EncodeStringBytes(x.JsonPayload) - case *ConformanceResponse_Skipped: - _ = b.EncodeVarint(5<<3 | proto.WireBytes) - _ = b.EncodeStringBytes(x.Skipped) - case nil: - default: - return fmt.Errorf("ConformanceResponse.Result has unexpected type %T", x) - } - return nil -} - -func _ConformanceResponse_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*ConformanceResponse) - switch tag { - case 1: // result.parse_error - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Result = &ConformanceResponse_ParseError{x} - return true, err - case 6: // result.serialize_error - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Result = &ConformanceResponse_SerializeError{x} - return true, err - case 2: // result.runtime_error - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Result = &ConformanceResponse_RuntimeError{x} - return true, err - case 3: // result.protobuf_payload - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeRawBytes(true) - m.Result = &ConformanceResponse_ProtobufPayload{x} - return true, err - case 4: // result.json_payload - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Result = &ConformanceResponse_JsonPayload{x} - return true, err - case 5: // result.skipped - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Result = &ConformanceResponse_Skipped{x} - return true, err - default: - return false, nil - } -} - -func _ConformanceResponse_OneofSizer(msg proto.Message) (n int) { - m := msg.(*ConformanceResponse) - // result - switch x := m.Result.(type) { - case *ConformanceResponse_ParseError: - n += proto.SizeVarint(1<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.ParseError))) - n += len(x.ParseError) - case *ConformanceResponse_SerializeError: - n += proto.SizeVarint(6<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.SerializeError))) - n += len(x.SerializeError) - case *ConformanceResponse_RuntimeError: - n += proto.SizeVarint(2<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.RuntimeError))) - n += len(x.RuntimeError) - case *ConformanceResponse_ProtobufPayload: - n += proto.SizeVarint(3<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.ProtobufPayload))) - n += len(x.ProtobufPayload) - case *ConformanceResponse_JsonPayload: - n += proto.SizeVarint(4<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.JsonPayload))) - n += len(x.JsonPayload) - case *ConformanceResponse_Skipped: - n += proto.SizeVarint(5<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.Skipped))) - n += len(x.Skipped) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -// This proto includes every type of field in both singular and repeated -// forms. -type TestAllTypes struct { - // Singular - OptionalInt32 int32 `protobuf:"varint,1,opt,name=optional_int32,json=optionalInt32,proto3" json:"optional_int32,omitempty"` - OptionalInt64 int64 `protobuf:"varint,2,opt,name=optional_int64,json=optionalInt64,proto3" json:"optional_int64,omitempty"` - OptionalUint32 uint32 `protobuf:"varint,3,opt,name=optional_uint32,json=optionalUint32,proto3" json:"optional_uint32,omitempty"` - OptionalUint64 uint64 `protobuf:"varint,4,opt,name=optional_uint64,json=optionalUint64,proto3" json:"optional_uint64,omitempty"` - OptionalSint32 int32 `protobuf:"zigzag32,5,opt,name=optional_sint32,json=optionalSint32,proto3" json:"optional_sint32,omitempty"` - OptionalSint64 int64 `protobuf:"zigzag64,6,opt,name=optional_sint64,json=optionalSint64,proto3" json:"optional_sint64,omitempty"` - OptionalFixed32 uint32 `protobuf:"fixed32,7,opt,name=optional_fixed32,json=optionalFixed32,proto3" json:"optional_fixed32,omitempty"` - OptionalFixed64 uint64 `protobuf:"fixed64,8,opt,name=optional_fixed64,json=optionalFixed64,proto3" json:"optional_fixed64,omitempty"` - OptionalSfixed32 int32 `protobuf:"fixed32,9,opt,name=optional_sfixed32,json=optionalSfixed32,proto3" json:"optional_sfixed32,omitempty"` - OptionalSfixed64 int64 `protobuf:"fixed64,10,opt,name=optional_sfixed64,json=optionalSfixed64,proto3" json:"optional_sfixed64,omitempty"` - OptionalFloat float32 `protobuf:"fixed32,11,opt,name=optional_float,json=optionalFloat,proto3" json:"optional_float,omitempty"` - OptionalDouble float64 `protobuf:"fixed64,12,opt,name=optional_double,json=optionalDouble,proto3" json:"optional_double,omitempty"` - OptionalBool bool `protobuf:"varint,13,opt,name=optional_bool,json=optionalBool,proto3" json:"optional_bool,omitempty"` - OptionalString string `protobuf:"bytes,14,opt,name=optional_string,json=optionalString,proto3" json:"optional_string,omitempty"` - OptionalBytes []byte `protobuf:"bytes,15,opt,name=optional_bytes,json=optionalBytes,proto3" json:"optional_bytes,omitempty"` - OptionalNestedMessage *TestAllTypes_NestedMessage `protobuf:"bytes,18,opt,name=optional_nested_message,json=optionalNestedMessage" json:"optional_nested_message,omitempty"` - OptionalForeignMessage *ForeignMessage `protobuf:"bytes,19,opt,name=optional_foreign_message,json=optionalForeignMessage" json:"optional_foreign_message,omitempty"` - OptionalNestedEnum TestAllTypes_NestedEnum `protobuf:"varint,21,opt,name=optional_nested_enum,json=optionalNestedEnum,proto3,enum=conformance.TestAllTypes_NestedEnum" json:"optional_nested_enum,omitempty"` - OptionalForeignEnum ForeignEnum `protobuf:"varint,22,opt,name=optional_foreign_enum,json=optionalForeignEnum,proto3,enum=conformance.ForeignEnum" json:"optional_foreign_enum,omitempty"` - OptionalStringPiece string `protobuf:"bytes,24,opt,name=optional_string_piece,json=optionalStringPiece,proto3" json:"optional_string_piece,omitempty"` - OptionalCord string `protobuf:"bytes,25,opt,name=optional_cord,json=optionalCord,proto3" json:"optional_cord,omitempty"` - RecursiveMessage *TestAllTypes `protobuf:"bytes,27,opt,name=recursive_message,json=recursiveMessage" json:"recursive_message,omitempty"` - // Repeated - RepeatedInt32 []int32 `protobuf:"varint,31,rep,packed,name=repeated_int32,json=repeatedInt32" json:"repeated_int32,omitempty"` - RepeatedInt64 []int64 `protobuf:"varint,32,rep,packed,name=repeated_int64,json=repeatedInt64" json:"repeated_int64,omitempty"` - RepeatedUint32 []uint32 `protobuf:"varint,33,rep,packed,name=repeated_uint32,json=repeatedUint32" json:"repeated_uint32,omitempty"` - RepeatedUint64 []uint64 `protobuf:"varint,34,rep,packed,name=repeated_uint64,json=repeatedUint64" json:"repeated_uint64,omitempty"` - RepeatedSint32 []int32 `protobuf:"zigzag32,35,rep,packed,name=repeated_sint32,json=repeatedSint32" json:"repeated_sint32,omitempty"` - RepeatedSint64 []int64 `protobuf:"zigzag64,36,rep,packed,name=repeated_sint64,json=repeatedSint64" json:"repeated_sint64,omitempty"` - RepeatedFixed32 []uint32 `protobuf:"fixed32,37,rep,packed,name=repeated_fixed32,json=repeatedFixed32" json:"repeated_fixed32,omitempty"` - RepeatedFixed64 []uint64 `protobuf:"fixed64,38,rep,packed,name=repeated_fixed64,json=repeatedFixed64" json:"repeated_fixed64,omitempty"` - RepeatedSfixed32 []int32 `protobuf:"fixed32,39,rep,packed,name=repeated_sfixed32,json=repeatedSfixed32" json:"repeated_sfixed32,omitempty"` - RepeatedSfixed64 []int64 `protobuf:"fixed64,40,rep,packed,name=repeated_sfixed64,json=repeatedSfixed64" json:"repeated_sfixed64,omitempty"` - RepeatedFloat []float32 `protobuf:"fixed32,41,rep,packed,name=repeated_float,json=repeatedFloat" json:"repeated_float,omitempty"` - RepeatedDouble []float64 `protobuf:"fixed64,42,rep,packed,name=repeated_double,json=repeatedDouble" json:"repeated_double,omitempty"` - RepeatedBool []bool `protobuf:"varint,43,rep,packed,name=repeated_bool,json=repeatedBool" json:"repeated_bool,omitempty"` - RepeatedString []string `protobuf:"bytes,44,rep,name=repeated_string,json=repeatedString" json:"repeated_string,omitempty"` - RepeatedBytes [][]byte `protobuf:"bytes,45,rep,name=repeated_bytes,json=repeatedBytes" json:"repeated_bytes,omitempty"` - RepeatedNestedMessage []*TestAllTypes_NestedMessage `protobuf:"bytes,48,rep,name=repeated_nested_message,json=repeatedNestedMessage" json:"repeated_nested_message,omitempty"` - RepeatedForeignMessage []*ForeignMessage `protobuf:"bytes,49,rep,name=repeated_foreign_message,json=repeatedForeignMessage" json:"repeated_foreign_message,omitempty"` - RepeatedNestedEnum []TestAllTypes_NestedEnum `protobuf:"varint,51,rep,packed,name=repeated_nested_enum,json=repeatedNestedEnum,enum=conformance.TestAllTypes_NestedEnum" json:"repeated_nested_enum,omitempty"` - RepeatedForeignEnum []ForeignEnum `protobuf:"varint,52,rep,packed,name=repeated_foreign_enum,json=repeatedForeignEnum,enum=conformance.ForeignEnum" json:"repeated_foreign_enum,omitempty"` - RepeatedStringPiece []string `protobuf:"bytes,54,rep,name=repeated_string_piece,json=repeatedStringPiece" json:"repeated_string_piece,omitempty"` - RepeatedCord []string `protobuf:"bytes,55,rep,name=repeated_cord,json=repeatedCord" json:"repeated_cord,omitempty"` - // Map - MapInt32Int32 map[int32]int32 `protobuf:"bytes,56,rep,name=map_int32_int32,json=mapInt32Int32" json:"map_int32_int32,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` - MapInt64Int64 map[int64]int64 `protobuf:"bytes,57,rep,name=map_int64_int64,json=mapInt64Int64" json:"map_int64_int64,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` - MapUint32Uint32 map[uint32]uint32 `protobuf:"bytes,58,rep,name=map_uint32_uint32,json=mapUint32Uint32" json:"map_uint32_uint32,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` - MapUint64Uint64 map[uint64]uint64 `protobuf:"bytes,59,rep,name=map_uint64_uint64,json=mapUint64Uint64" json:"map_uint64_uint64,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` - MapSint32Sint32 map[int32]int32 `protobuf:"bytes,60,rep,name=map_sint32_sint32,json=mapSint32Sint32" json:"map_sint32_sint32,omitempty" protobuf_key:"zigzag32,1,opt,name=key,proto3" protobuf_val:"zigzag32,2,opt,name=value,proto3"` - MapSint64Sint64 map[int64]int64 `protobuf:"bytes,61,rep,name=map_sint64_sint64,json=mapSint64Sint64" json:"map_sint64_sint64,omitempty" protobuf_key:"zigzag64,1,opt,name=key,proto3" protobuf_val:"zigzag64,2,opt,name=value,proto3"` - MapFixed32Fixed32 map[uint32]uint32 `protobuf:"bytes,62,rep,name=map_fixed32_fixed32,json=mapFixed32Fixed32" json:"map_fixed32_fixed32,omitempty" protobuf_key:"fixed32,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"` - MapFixed64Fixed64 map[uint64]uint64 `protobuf:"bytes,63,rep,name=map_fixed64_fixed64,json=mapFixed64Fixed64" json:"map_fixed64_fixed64,omitempty" protobuf_key:"fixed64,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"` - MapSfixed32Sfixed32 map[int32]int32 `protobuf:"bytes,64,rep,name=map_sfixed32_sfixed32,json=mapSfixed32Sfixed32" json:"map_sfixed32_sfixed32,omitempty" protobuf_key:"fixed32,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"` - MapSfixed64Sfixed64 map[int64]int64 `protobuf:"bytes,65,rep,name=map_sfixed64_sfixed64,json=mapSfixed64Sfixed64" json:"map_sfixed64_sfixed64,omitempty" protobuf_key:"fixed64,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"` - MapInt32Float map[int32]float32 `protobuf:"bytes,66,rep,name=map_int32_float,json=mapInt32Float" json:"map_int32_float,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"` - MapInt32Double map[int32]float64 `protobuf:"bytes,67,rep,name=map_int32_double,json=mapInt32Double" json:"map_int32_double,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"` - MapBoolBool map[bool]bool `protobuf:"bytes,68,rep,name=map_bool_bool,json=mapBoolBool" json:"map_bool_bool,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` - MapStringString map[string]string `protobuf:"bytes,69,rep,name=map_string_string,json=mapStringString" json:"map_string_string,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - MapStringBytes map[string][]byte `protobuf:"bytes,70,rep,name=map_string_bytes,json=mapStringBytes" json:"map_string_bytes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - MapStringNestedMessage map[string]*TestAllTypes_NestedMessage `protobuf:"bytes,71,rep,name=map_string_nested_message,json=mapStringNestedMessage" json:"map_string_nested_message,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"` - MapStringForeignMessage map[string]*ForeignMessage `protobuf:"bytes,72,rep,name=map_string_foreign_message,json=mapStringForeignMessage" json:"map_string_foreign_message,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"` - MapStringNestedEnum map[string]TestAllTypes_NestedEnum `protobuf:"bytes,73,rep,name=map_string_nested_enum,json=mapStringNestedEnum" json:"map_string_nested_enum,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=conformance.TestAllTypes_NestedEnum"` - MapStringForeignEnum map[string]ForeignEnum `protobuf:"bytes,74,rep,name=map_string_foreign_enum,json=mapStringForeignEnum" json:"map_string_foreign_enum,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=conformance.ForeignEnum"` - // Types that are valid to be assigned to OneofField: - // *TestAllTypes_OneofUint32 - // *TestAllTypes_OneofNestedMessage - // *TestAllTypes_OneofString - // *TestAllTypes_OneofBytes - // *TestAllTypes_OneofBool - // *TestAllTypes_OneofUint64 - // *TestAllTypes_OneofFloat - // *TestAllTypes_OneofDouble - // *TestAllTypes_OneofEnum - OneofField isTestAllTypes_OneofField `protobuf_oneof:"oneof_field"` - // Well-known types - OptionalBoolWrapper *google_protobuf5.BoolValue `protobuf:"bytes,201,opt,name=optional_bool_wrapper,json=optionalBoolWrapper" json:"optional_bool_wrapper,omitempty"` - OptionalInt32Wrapper *google_protobuf5.Int32Value `protobuf:"bytes,202,opt,name=optional_int32_wrapper,json=optionalInt32Wrapper" json:"optional_int32_wrapper,omitempty"` - OptionalInt64Wrapper *google_protobuf5.Int64Value `protobuf:"bytes,203,opt,name=optional_int64_wrapper,json=optionalInt64Wrapper" json:"optional_int64_wrapper,omitempty"` - OptionalUint32Wrapper *google_protobuf5.UInt32Value `protobuf:"bytes,204,opt,name=optional_uint32_wrapper,json=optionalUint32Wrapper" json:"optional_uint32_wrapper,omitempty"` - OptionalUint64Wrapper *google_protobuf5.UInt64Value `protobuf:"bytes,205,opt,name=optional_uint64_wrapper,json=optionalUint64Wrapper" json:"optional_uint64_wrapper,omitempty"` - OptionalFloatWrapper *google_protobuf5.FloatValue `protobuf:"bytes,206,opt,name=optional_float_wrapper,json=optionalFloatWrapper" json:"optional_float_wrapper,omitempty"` - OptionalDoubleWrapper *google_protobuf5.DoubleValue `protobuf:"bytes,207,opt,name=optional_double_wrapper,json=optionalDoubleWrapper" json:"optional_double_wrapper,omitempty"` - OptionalStringWrapper *google_protobuf5.StringValue `protobuf:"bytes,208,opt,name=optional_string_wrapper,json=optionalStringWrapper" json:"optional_string_wrapper,omitempty"` - OptionalBytesWrapper *google_protobuf5.BytesValue `protobuf:"bytes,209,opt,name=optional_bytes_wrapper,json=optionalBytesWrapper" json:"optional_bytes_wrapper,omitempty"` - RepeatedBoolWrapper []*google_protobuf5.BoolValue `protobuf:"bytes,211,rep,name=repeated_bool_wrapper,json=repeatedBoolWrapper" json:"repeated_bool_wrapper,omitempty"` - RepeatedInt32Wrapper []*google_protobuf5.Int32Value `protobuf:"bytes,212,rep,name=repeated_int32_wrapper,json=repeatedInt32Wrapper" json:"repeated_int32_wrapper,omitempty"` - RepeatedInt64Wrapper []*google_protobuf5.Int64Value `protobuf:"bytes,213,rep,name=repeated_int64_wrapper,json=repeatedInt64Wrapper" json:"repeated_int64_wrapper,omitempty"` - RepeatedUint32Wrapper []*google_protobuf5.UInt32Value `protobuf:"bytes,214,rep,name=repeated_uint32_wrapper,json=repeatedUint32Wrapper" json:"repeated_uint32_wrapper,omitempty"` - RepeatedUint64Wrapper []*google_protobuf5.UInt64Value `protobuf:"bytes,215,rep,name=repeated_uint64_wrapper,json=repeatedUint64Wrapper" json:"repeated_uint64_wrapper,omitempty"` - RepeatedFloatWrapper []*google_protobuf5.FloatValue `protobuf:"bytes,216,rep,name=repeated_float_wrapper,json=repeatedFloatWrapper" json:"repeated_float_wrapper,omitempty"` - RepeatedDoubleWrapper []*google_protobuf5.DoubleValue `protobuf:"bytes,217,rep,name=repeated_double_wrapper,json=repeatedDoubleWrapper" json:"repeated_double_wrapper,omitempty"` - RepeatedStringWrapper []*google_protobuf5.StringValue `protobuf:"bytes,218,rep,name=repeated_string_wrapper,json=repeatedStringWrapper" json:"repeated_string_wrapper,omitempty"` - RepeatedBytesWrapper []*google_protobuf5.BytesValue `protobuf:"bytes,219,rep,name=repeated_bytes_wrapper,json=repeatedBytesWrapper" json:"repeated_bytes_wrapper,omitempty"` - OptionalDuration *google_protobuf1.Duration `protobuf:"bytes,301,opt,name=optional_duration,json=optionalDuration" json:"optional_duration,omitempty"` - OptionalTimestamp *google_protobuf4.Timestamp `protobuf:"bytes,302,opt,name=optional_timestamp,json=optionalTimestamp" json:"optional_timestamp,omitempty"` - OptionalFieldMask *google_protobuf2.FieldMask `protobuf:"bytes,303,opt,name=optional_field_mask,json=optionalFieldMask" json:"optional_field_mask,omitempty"` - OptionalStruct *google_protobuf3.Struct `protobuf:"bytes,304,opt,name=optional_struct,json=optionalStruct" json:"optional_struct,omitempty"` - OptionalAny *google_protobuf.Any `protobuf:"bytes,305,opt,name=optional_any,json=optionalAny" json:"optional_any,omitempty"` - OptionalValue *google_protobuf3.Value `protobuf:"bytes,306,opt,name=optional_value,json=optionalValue" json:"optional_value,omitempty"` - RepeatedDuration []*google_protobuf1.Duration `protobuf:"bytes,311,rep,name=repeated_duration,json=repeatedDuration" json:"repeated_duration,omitempty"` - RepeatedTimestamp []*google_protobuf4.Timestamp `protobuf:"bytes,312,rep,name=repeated_timestamp,json=repeatedTimestamp" json:"repeated_timestamp,omitempty"` - RepeatedFieldmask []*google_protobuf2.FieldMask `protobuf:"bytes,313,rep,name=repeated_fieldmask,json=repeatedFieldmask" json:"repeated_fieldmask,omitempty"` - RepeatedStruct []*google_protobuf3.Struct `protobuf:"bytes,324,rep,name=repeated_struct,json=repeatedStruct" json:"repeated_struct,omitempty"` - RepeatedAny []*google_protobuf.Any `protobuf:"bytes,315,rep,name=repeated_any,json=repeatedAny" json:"repeated_any,omitempty"` - RepeatedValue []*google_protobuf3.Value `protobuf:"bytes,316,rep,name=repeated_value,json=repeatedValue" json:"repeated_value,omitempty"` - // Test field-name-to-JSON-name convention. - // (protobuf says names can be any valid C/C++ identifier.) - Fieldname1 int32 `protobuf:"varint,401,opt,name=fieldname1,proto3" json:"fieldname1,omitempty"` - FieldName2 int32 `protobuf:"varint,402,opt,name=field_name2,json=fieldName2,proto3" json:"field_name2,omitempty"` - XFieldName3 int32 `protobuf:"varint,403,opt,name=_field_name3,json=FieldName3,proto3" json:"_field_name3,omitempty"` - Field_Name4_ int32 `protobuf:"varint,404,opt,name=field__name4_,json=fieldName4,proto3" json:"field__name4_,omitempty"` - Field0Name5 int32 `protobuf:"varint,405,opt,name=field0name5,proto3" json:"field0name5,omitempty"` - Field_0Name6 int32 `protobuf:"varint,406,opt,name=field_0_name6,json=field0Name6,proto3" json:"field_0_name6,omitempty"` - FieldName7 int32 `protobuf:"varint,407,opt,name=fieldName7,proto3" json:"fieldName7,omitempty"` - FieldName8 int32 `protobuf:"varint,408,opt,name=FieldName8,proto3" json:"FieldName8,omitempty"` - Field_Name9 int32 `protobuf:"varint,409,opt,name=field_Name9,json=fieldName9,proto3" json:"field_Name9,omitempty"` - Field_Name10 int32 `protobuf:"varint,410,opt,name=Field_Name10,json=FieldName10,proto3" json:"Field_Name10,omitempty"` - FIELD_NAME11 int32 `protobuf:"varint,411,opt,name=FIELD_NAME11,json=FIELDNAME11,proto3" json:"FIELD_NAME11,omitempty"` - FIELDName12 int32 `protobuf:"varint,412,opt,name=FIELD_name12,json=FIELDName12,proto3" json:"FIELD_name12,omitempty"` - XFieldName13 int32 `protobuf:"varint,413,opt,name=__field_name13,json=FieldName13,proto3" json:"__field_name13,omitempty"` - X_FieldName14 int32 `protobuf:"varint,414,opt,name=__Field_name14,json=FieldName14,proto3" json:"__Field_name14,omitempty"` - Field_Name15 int32 `protobuf:"varint,415,opt,name=field__name15,json=fieldName15,proto3" json:"field__name15,omitempty"` - Field__Name16 int32 `protobuf:"varint,416,opt,name=field__Name16,json=fieldName16,proto3" json:"field__Name16,omitempty"` - FieldName17__ int32 `protobuf:"varint,417,opt,name=field_name17__,json=fieldName17,proto3" json:"field_name17__,omitempty"` - FieldName18__ int32 `protobuf:"varint,418,opt,name=Field_name18__,json=FieldName18,proto3" json:"Field_name18__,omitempty"` -} - -func (m *TestAllTypes) Reset() { *m = TestAllTypes{} } -func (m *TestAllTypes) String() string { return proto.CompactTextString(m) } -func (*TestAllTypes) ProtoMessage() {} -func (*TestAllTypes) Descriptor() ([]byte, []int) { return fileDescriptorConformance, []int{2} } - -type isTestAllTypes_OneofField interface { - isTestAllTypes_OneofField() -} - -type TestAllTypes_OneofUint32 struct { - OneofUint32 uint32 `protobuf:"varint,111,opt,name=oneof_uint32,json=oneofUint32,proto3,oneof"` -} -type TestAllTypes_OneofNestedMessage struct { - OneofNestedMessage *TestAllTypes_NestedMessage `protobuf:"bytes,112,opt,name=oneof_nested_message,json=oneofNestedMessage,oneof"` -} -type TestAllTypes_OneofString struct { - OneofString string `protobuf:"bytes,113,opt,name=oneof_string,json=oneofString,proto3,oneof"` -} -type TestAllTypes_OneofBytes struct { - OneofBytes []byte `protobuf:"bytes,114,opt,name=oneof_bytes,json=oneofBytes,proto3,oneof"` -} -type TestAllTypes_OneofBool struct { - OneofBool bool `protobuf:"varint,115,opt,name=oneof_bool,json=oneofBool,proto3,oneof"` -} -type TestAllTypes_OneofUint64 struct { - OneofUint64 uint64 `protobuf:"varint,116,opt,name=oneof_uint64,json=oneofUint64,proto3,oneof"` -} -type TestAllTypes_OneofFloat struct { - OneofFloat float32 `protobuf:"fixed32,117,opt,name=oneof_float,json=oneofFloat,proto3,oneof"` -} -type TestAllTypes_OneofDouble struct { - OneofDouble float64 `protobuf:"fixed64,118,opt,name=oneof_double,json=oneofDouble,proto3,oneof"` -} -type TestAllTypes_OneofEnum struct { - OneofEnum TestAllTypes_NestedEnum `protobuf:"varint,119,opt,name=oneof_enum,json=oneofEnum,proto3,enum=conformance.TestAllTypes_NestedEnum,oneof"` -} - -func (*TestAllTypes_OneofUint32) isTestAllTypes_OneofField() {} -func (*TestAllTypes_OneofNestedMessage) isTestAllTypes_OneofField() {} -func (*TestAllTypes_OneofString) isTestAllTypes_OneofField() {} -func (*TestAllTypes_OneofBytes) isTestAllTypes_OneofField() {} -func (*TestAllTypes_OneofBool) isTestAllTypes_OneofField() {} -func (*TestAllTypes_OneofUint64) isTestAllTypes_OneofField() {} -func (*TestAllTypes_OneofFloat) isTestAllTypes_OneofField() {} -func (*TestAllTypes_OneofDouble) isTestAllTypes_OneofField() {} -func (*TestAllTypes_OneofEnum) isTestAllTypes_OneofField() {} - -func (m *TestAllTypes) GetOneofField() isTestAllTypes_OneofField { - if m != nil { - return m.OneofField - } - return nil -} - -func (m *TestAllTypes) GetOptionalInt32() int32 { - if m != nil { - return m.OptionalInt32 - } - return 0 -} - -func (m *TestAllTypes) GetOptionalInt64() int64 { - if m != nil { - return m.OptionalInt64 - } - return 0 -} - -func (m *TestAllTypes) GetOptionalUint32() uint32 { - if m != nil { - return m.OptionalUint32 - } - return 0 -} - -func (m *TestAllTypes) GetOptionalUint64() uint64 { - if m != nil { - return m.OptionalUint64 - } - return 0 -} - -func (m *TestAllTypes) GetOptionalSint32() int32 { - if m != nil { - return m.OptionalSint32 - } - return 0 -} - -func (m *TestAllTypes) GetOptionalSint64() int64 { - if m != nil { - return m.OptionalSint64 - } - return 0 -} - -func (m *TestAllTypes) GetOptionalFixed32() uint32 { - if m != nil { - return m.OptionalFixed32 - } - return 0 -} - -func (m *TestAllTypes) GetOptionalFixed64() uint64 { - if m != nil { - return m.OptionalFixed64 - } - return 0 -} - -func (m *TestAllTypes) GetOptionalSfixed32() int32 { - if m != nil { - return m.OptionalSfixed32 - } - return 0 -} - -func (m *TestAllTypes) GetOptionalSfixed64() int64 { - if m != nil { - return m.OptionalSfixed64 - } - return 0 -} - -func (m *TestAllTypes) GetOptionalFloat() float32 { - if m != nil { - return m.OptionalFloat - } - return 0 -} - -func (m *TestAllTypes) GetOptionalDouble() float64 { - if m != nil { - return m.OptionalDouble - } - return 0 -} - -func (m *TestAllTypes) GetOptionalBool() bool { - if m != nil { - return m.OptionalBool - } - return false -} - -func (m *TestAllTypes) GetOptionalString() string { - if m != nil { - return m.OptionalString - } - return "" -} - -func (m *TestAllTypes) GetOptionalBytes() []byte { - if m != nil { - return m.OptionalBytes - } - return nil -} - -func (m *TestAllTypes) GetOptionalNestedMessage() *TestAllTypes_NestedMessage { - if m != nil { - return m.OptionalNestedMessage - } - return nil -} - -func (m *TestAllTypes) GetOptionalForeignMessage() *ForeignMessage { - if m != nil { - return m.OptionalForeignMessage - } - return nil -} - -func (m *TestAllTypes) GetOptionalNestedEnum() TestAllTypes_NestedEnum { - if m != nil { - return m.OptionalNestedEnum - } - return TestAllTypes_FOO -} - -func (m *TestAllTypes) GetOptionalForeignEnum() ForeignEnum { - if m != nil { - return m.OptionalForeignEnum - } - return ForeignEnum_FOREIGN_FOO -} - -func (m *TestAllTypes) GetOptionalStringPiece() string { - if m != nil { - return m.OptionalStringPiece - } - return "" -} - -func (m *TestAllTypes) GetOptionalCord() string { - if m != nil { - return m.OptionalCord - } - return "" -} - -func (m *TestAllTypes) GetRecursiveMessage() *TestAllTypes { - if m != nil { - return m.RecursiveMessage - } - return nil -} - -func (m *TestAllTypes) GetRepeatedInt32() []int32 { - if m != nil { - return m.RepeatedInt32 - } - return nil -} - -func (m *TestAllTypes) GetRepeatedInt64() []int64 { - if m != nil { - return m.RepeatedInt64 - } - return nil -} - -func (m *TestAllTypes) GetRepeatedUint32() []uint32 { - if m != nil { - return m.RepeatedUint32 - } - return nil -} - -func (m *TestAllTypes) GetRepeatedUint64() []uint64 { - if m != nil { - return m.RepeatedUint64 - } - return nil -} - -func (m *TestAllTypes) GetRepeatedSint32() []int32 { - if m != nil { - return m.RepeatedSint32 - } - return nil -} - -func (m *TestAllTypes) GetRepeatedSint64() []int64 { - if m != nil { - return m.RepeatedSint64 - } - return nil -} - -func (m *TestAllTypes) GetRepeatedFixed32() []uint32 { - if m != nil { - return m.RepeatedFixed32 - } - return nil -} - -func (m *TestAllTypes) GetRepeatedFixed64() []uint64 { - if m != nil { - return m.RepeatedFixed64 - } - return nil -} - -func (m *TestAllTypes) GetRepeatedSfixed32() []int32 { - if m != nil { - return m.RepeatedSfixed32 - } - return nil -} - -func (m *TestAllTypes) GetRepeatedSfixed64() []int64 { - if m != nil { - return m.RepeatedSfixed64 - } - return nil -} - -func (m *TestAllTypes) GetRepeatedFloat() []float32 { - if m != nil { - return m.RepeatedFloat - } - return nil -} - -func (m *TestAllTypes) GetRepeatedDouble() []float64 { - if m != nil { - return m.RepeatedDouble - } - return nil -} - -func (m *TestAllTypes) GetRepeatedBool() []bool { - if m != nil { - return m.RepeatedBool - } - return nil -} - -func (m *TestAllTypes) GetRepeatedString() []string { - if m != nil { - return m.RepeatedString - } - return nil -} - -func (m *TestAllTypes) GetRepeatedBytes() [][]byte { - if m != nil { - return m.RepeatedBytes - } - return nil -} - -func (m *TestAllTypes) GetRepeatedNestedMessage() []*TestAllTypes_NestedMessage { - if m != nil { - return m.RepeatedNestedMessage - } - return nil -} - -func (m *TestAllTypes) GetRepeatedForeignMessage() []*ForeignMessage { - if m != nil { - return m.RepeatedForeignMessage - } - return nil -} - -func (m *TestAllTypes) GetRepeatedNestedEnum() []TestAllTypes_NestedEnum { - if m != nil { - return m.RepeatedNestedEnum - } - return nil -} - -func (m *TestAllTypes) GetRepeatedForeignEnum() []ForeignEnum { - if m != nil { - return m.RepeatedForeignEnum - } - return nil -} - -func (m *TestAllTypes) GetRepeatedStringPiece() []string { - if m != nil { - return m.RepeatedStringPiece - } - return nil -} - -func (m *TestAllTypes) GetRepeatedCord() []string { - if m != nil { - return m.RepeatedCord - } - return nil -} - -func (m *TestAllTypes) GetMapInt32Int32() map[int32]int32 { - if m != nil { - return m.MapInt32Int32 - } - return nil -} - -func (m *TestAllTypes) GetMapInt64Int64() map[int64]int64 { - if m != nil { - return m.MapInt64Int64 - } - return nil -} - -func (m *TestAllTypes) GetMapUint32Uint32() map[uint32]uint32 { - if m != nil { - return m.MapUint32Uint32 - } - return nil -} - -func (m *TestAllTypes) GetMapUint64Uint64() map[uint64]uint64 { - if m != nil { - return m.MapUint64Uint64 - } - return nil -} - -func (m *TestAllTypes) GetMapSint32Sint32() map[int32]int32 { - if m != nil { - return m.MapSint32Sint32 - } - return nil -} - -func (m *TestAllTypes) GetMapSint64Sint64() map[int64]int64 { - if m != nil { - return m.MapSint64Sint64 - } - return nil -} - -func (m *TestAllTypes) GetMapFixed32Fixed32() map[uint32]uint32 { - if m != nil { - return m.MapFixed32Fixed32 - } - return nil -} - -func (m *TestAllTypes) GetMapFixed64Fixed64() map[uint64]uint64 { - if m != nil { - return m.MapFixed64Fixed64 - } - return nil -} - -func (m *TestAllTypes) GetMapSfixed32Sfixed32() map[int32]int32 { - if m != nil { - return m.MapSfixed32Sfixed32 - } - return nil -} - -func (m *TestAllTypes) GetMapSfixed64Sfixed64() map[int64]int64 { - if m != nil { - return m.MapSfixed64Sfixed64 - } - return nil -} - -func (m *TestAllTypes) GetMapInt32Float() map[int32]float32 { - if m != nil { - return m.MapInt32Float - } - return nil -} - -func (m *TestAllTypes) GetMapInt32Double() map[int32]float64 { - if m != nil { - return m.MapInt32Double - } - return nil -} - -func (m *TestAllTypes) GetMapBoolBool() map[bool]bool { - if m != nil { - return m.MapBoolBool - } - return nil -} - -func (m *TestAllTypes) GetMapStringString() map[string]string { - if m != nil { - return m.MapStringString - } - return nil -} - -func (m *TestAllTypes) GetMapStringBytes() map[string][]byte { - if m != nil { - return m.MapStringBytes - } - return nil -} - -func (m *TestAllTypes) GetMapStringNestedMessage() map[string]*TestAllTypes_NestedMessage { - if m != nil { - return m.MapStringNestedMessage - } - return nil -} - -func (m *TestAllTypes) GetMapStringForeignMessage() map[string]*ForeignMessage { - if m != nil { - return m.MapStringForeignMessage - } - return nil -} - -func (m *TestAllTypes) GetMapStringNestedEnum() map[string]TestAllTypes_NestedEnum { - if m != nil { - return m.MapStringNestedEnum - } - return nil -} - -func (m *TestAllTypes) GetMapStringForeignEnum() map[string]ForeignEnum { - if m != nil { - return m.MapStringForeignEnum - } - return nil -} - -func (m *TestAllTypes) GetOneofUint32() uint32 { - if x, ok := m.GetOneofField().(*TestAllTypes_OneofUint32); ok { - return x.OneofUint32 - } - return 0 -} - -func (m *TestAllTypes) GetOneofNestedMessage() *TestAllTypes_NestedMessage { - if x, ok := m.GetOneofField().(*TestAllTypes_OneofNestedMessage); ok { - return x.OneofNestedMessage - } - return nil -} - -func (m *TestAllTypes) GetOneofString() string { - if x, ok := m.GetOneofField().(*TestAllTypes_OneofString); ok { - return x.OneofString - } - return "" -} - -func (m *TestAllTypes) GetOneofBytes() []byte { - if x, ok := m.GetOneofField().(*TestAllTypes_OneofBytes); ok { - return x.OneofBytes - } - return nil -} - -func (m *TestAllTypes) GetOneofBool() bool { - if x, ok := m.GetOneofField().(*TestAllTypes_OneofBool); ok { - return x.OneofBool - } - return false -} - -func (m *TestAllTypes) GetOneofUint64() uint64 { - if x, ok := m.GetOneofField().(*TestAllTypes_OneofUint64); ok { - return x.OneofUint64 - } - return 0 -} - -func (m *TestAllTypes) GetOneofFloat() float32 { - if x, ok := m.GetOneofField().(*TestAllTypes_OneofFloat); ok { - return x.OneofFloat - } - return 0 -} - -func (m *TestAllTypes) GetOneofDouble() float64 { - if x, ok := m.GetOneofField().(*TestAllTypes_OneofDouble); ok { - return x.OneofDouble - } - return 0 -} - -func (m *TestAllTypes) GetOneofEnum() TestAllTypes_NestedEnum { - if x, ok := m.GetOneofField().(*TestAllTypes_OneofEnum); ok { - return x.OneofEnum - } - return TestAllTypes_FOO -} - -func (m *TestAllTypes) GetOptionalBoolWrapper() *google_protobuf5.BoolValue { - if m != nil { - return m.OptionalBoolWrapper - } - return nil -} - -func (m *TestAllTypes) GetOptionalInt32Wrapper() *google_protobuf5.Int32Value { - if m != nil { - return m.OptionalInt32Wrapper - } - return nil -} - -func (m *TestAllTypes) GetOptionalInt64Wrapper() *google_protobuf5.Int64Value { - if m != nil { - return m.OptionalInt64Wrapper - } - return nil -} - -func (m *TestAllTypes) GetOptionalUint32Wrapper() *google_protobuf5.UInt32Value { - if m != nil { - return m.OptionalUint32Wrapper - } - return nil -} - -func (m *TestAllTypes) GetOptionalUint64Wrapper() *google_protobuf5.UInt64Value { - if m != nil { - return m.OptionalUint64Wrapper - } - return nil -} - -func (m *TestAllTypes) GetOptionalFloatWrapper() *google_protobuf5.FloatValue { - if m != nil { - return m.OptionalFloatWrapper - } - return nil -} - -func (m *TestAllTypes) GetOptionalDoubleWrapper() *google_protobuf5.DoubleValue { - if m != nil { - return m.OptionalDoubleWrapper - } - return nil -} - -func (m *TestAllTypes) GetOptionalStringWrapper() *google_protobuf5.StringValue { - if m != nil { - return m.OptionalStringWrapper - } - return nil -} - -func (m *TestAllTypes) GetOptionalBytesWrapper() *google_protobuf5.BytesValue { - if m != nil { - return m.OptionalBytesWrapper - } - return nil -} - -func (m *TestAllTypes) GetRepeatedBoolWrapper() []*google_protobuf5.BoolValue { - if m != nil { - return m.RepeatedBoolWrapper - } - return nil -} - -func (m *TestAllTypes) GetRepeatedInt32Wrapper() []*google_protobuf5.Int32Value { - if m != nil { - return m.RepeatedInt32Wrapper - } - return nil -} - -func (m *TestAllTypes) GetRepeatedInt64Wrapper() []*google_protobuf5.Int64Value { - if m != nil { - return m.RepeatedInt64Wrapper - } - return nil -} - -func (m *TestAllTypes) GetRepeatedUint32Wrapper() []*google_protobuf5.UInt32Value { - if m != nil { - return m.RepeatedUint32Wrapper - } - return nil -} - -func (m *TestAllTypes) GetRepeatedUint64Wrapper() []*google_protobuf5.UInt64Value { - if m != nil { - return m.RepeatedUint64Wrapper - } - return nil -} - -func (m *TestAllTypes) GetRepeatedFloatWrapper() []*google_protobuf5.FloatValue { - if m != nil { - return m.RepeatedFloatWrapper - } - return nil -} - -func (m *TestAllTypes) GetRepeatedDoubleWrapper() []*google_protobuf5.DoubleValue { - if m != nil { - return m.RepeatedDoubleWrapper - } - return nil -} - -func (m *TestAllTypes) GetRepeatedStringWrapper() []*google_protobuf5.StringValue { - if m != nil { - return m.RepeatedStringWrapper - } - return nil -} - -func (m *TestAllTypes) GetRepeatedBytesWrapper() []*google_protobuf5.BytesValue { - if m != nil { - return m.RepeatedBytesWrapper - } - return nil -} - -func (m *TestAllTypes) GetOptionalDuration() *google_protobuf1.Duration { - if m != nil { - return m.OptionalDuration - } - return nil -} - -func (m *TestAllTypes) GetOptionalTimestamp() *google_protobuf4.Timestamp { - if m != nil { - return m.OptionalTimestamp - } - return nil -} - -func (m *TestAllTypes) GetOptionalFieldMask() *google_protobuf2.FieldMask { - if m != nil { - return m.OptionalFieldMask - } - return nil -} - -func (m *TestAllTypes) GetOptionalStruct() *google_protobuf3.Struct { - if m != nil { - return m.OptionalStruct - } - return nil -} - -func (m *TestAllTypes) GetOptionalAny() *google_protobuf.Any { - if m != nil { - return m.OptionalAny - } - return nil -} - -func (m *TestAllTypes) GetOptionalValue() *google_protobuf3.Value { - if m != nil { - return m.OptionalValue - } - return nil -} - -func (m *TestAllTypes) GetRepeatedDuration() []*google_protobuf1.Duration { - if m != nil { - return m.RepeatedDuration - } - return nil -} - -func (m *TestAllTypes) GetRepeatedTimestamp() []*google_protobuf4.Timestamp { - if m != nil { - return m.RepeatedTimestamp - } - return nil -} - -func (m *TestAllTypes) GetRepeatedFieldmask() []*google_protobuf2.FieldMask { - if m != nil { - return m.RepeatedFieldmask - } - return nil -} - -func (m *TestAllTypes) GetRepeatedStruct() []*google_protobuf3.Struct { - if m != nil { - return m.RepeatedStruct - } - return nil -} - -func (m *TestAllTypes) GetRepeatedAny() []*google_protobuf.Any { - if m != nil { - return m.RepeatedAny - } - return nil -} - -func (m *TestAllTypes) GetRepeatedValue() []*google_protobuf3.Value { - if m != nil { - return m.RepeatedValue - } - return nil -} - -func (m *TestAllTypes) GetFieldname1() int32 { - if m != nil { - return m.Fieldname1 - } - return 0 -} - -func (m *TestAllTypes) GetFieldName2() int32 { - if m != nil { - return m.FieldName2 - } - return 0 -} - -func (m *TestAllTypes) GetXFieldName3() int32 { - if m != nil { - return m.XFieldName3 - } - return 0 -} - -func (m *TestAllTypes) GetField_Name4_() int32 { - if m != nil { - return m.Field_Name4_ - } - return 0 -} - -func (m *TestAllTypes) GetField0Name5() int32 { - if m != nil { - return m.Field0Name5 - } - return 0 -} - -func (m *TestAllTypes) GetField_0Name6() int32 { - if m != nil { - return m.Field_0Name6 - } - return 0 -} - -func (m *TestAllTypes) GetFieldName7() int32 { - if m != nil { - return m.FieldName7 - } - return 0 -} - -func (m *TestAllTypes) GetFieldName8() int32 { - if m != nil { - return m.FieldName8 - } - return 0 -} - -func (m *TestAllTypes) GetField_Name9() int32 { - if m != nil { - return m.Field_Name9 - } - return 0 -} - -func (m *TestAllTypes) GetField_Name10() int32 { - if m != nil { - return m.Field_Name10 - } - return 0 -} - -func (m *TestAllTypes) GetFIELD_NAME11() int32 { - if m != nil { - return m.FIELD_NAME11 - } - return 0 -} - -func (m *TestAllTypes) GetFIELDName12() int32 { - if m != nil { - return m.FIELDName12 - } - return 0 -} - -func (m *TestAllTypes) GetXFieldName13() int32 { - if m != nil { - return m.XFieldName13 - } - return 0 -} - -func (m *TestAllTypes) GetX_FieldName14() int32 { - if m != nil { - return m.X_FieldName14 - } - return 0 -} - -func (m *TestAllTypes) GetField_Name15() int32 { - if m != nil { - return m.Field_Name15 - } - return 0 -} - -func (m *TestAllTypes) GetField__Name16() int32 { - if m != nil { - return m.Field__Name16 - } - return 0 -} - -func (m *TestAllTypes) GetFieldName17__() int32 { - if m != nil { - return m.FieldName17__ - } - return 0 -} - -func (m *TestAllTypes) GetFieldName18__() int32 { - if m != nil { - return m.FieldName18__ - } - return 0 -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*TestAllTypes) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _TestAllTypes_OneofMarshaler, _TestAllTypes_OneofUnmarshaler, _TestAllTypes_OneofSizer, []interface{}{ - (*TestAllTypes_OneofUint32)(nil), - (*TestAllTypes_OneofNestedMessage)(nil), - (*TestAllTypes_OneofString)(nil), - (*TestAllTypes_OneofBytes)(nil), - (*TestAllTypes_OneofBool)(nil), - (*TestAllTypes_OneofUint64)(nil), - (*TestAllTypes_OneofFloat)(nil), - (*TestAllTypes_OneofDouble)(nil), - (*TestAllTypes_OneofEnum)(nil), - } -} - -func _TestAllTypes_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*TestAllTypes) - // oneof_field - switch x := m.OneofField.(type) { - case *TestAllTypes_OneofUint32: - _ = b.EncodeVarint(111<<3 | proto.WireVarint) - _ = b.EncodeVarint(uint64(x.OneofUint32)) - case *TestAllTypes_OneofNestedMessage: - _ = b.EncodeVarint(112<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.OneofNestedMessage); err != nil { - return err - } - case *TestAllTypes_OneofString: - _ = b.EncodeVarint(113<<3 | proto.WireBytes) - _ = b.EncodeStringBytes(x.OneofString) - case *TestAllTypes_OneofBytes: - _ = b.EncodeVarint(114<<3 | proto.WireBytes) - _ = b.EncodeRawBytes(x.OneofBytes) - case *TestAllTypes_OneofBool: - t := uint64(0) - if x.OneofBool { - t = 1 - } - _ = b.EncodeVarint(115<<3 | proto.WireVarint) - _ = b.EncodeVarint(t) - case *TestAllTypes_OneofUint64: - _ = b.EncodeVarint(116<<3 | proto.WireVarint) - _ = b.EncodeVarint(uint64(x.OneofUint64)) - case *TestAllTypes_OneofFloat: - _ = b.EncodeVarint(117<<3 | proto.WireFixed32) - _ = b.EncodeFixed32(uint64(math.Float32bits(x.OneofFloat))) - case *TestAllTypes_OneofDouble: - _ = b.EncodeVarint(118<<3 | proto.WireFixed64) - _ = b.EncodeFixed64(math.Float64bits(x.OneofDouble)) - case *TestAllTypes_OneofEnum: - _ = b.EncodeVarint(119<<3 | proto.WireVarint) - _ = b.EncodeVarint(uint64(x.OneofEnum)) - case nil: - default: - return fmt.Errorf("TestAllTypes.OneofField has unexpected type %T", x) - } - return nil -} - -func _TestAllTypes_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*TestAllTypes) - switch tag { - case 111: // oneof_field.oneof_uint32 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.OneofField = &TestAllTypes_OneofUint32{uint32(x)} - return true, err - case 112: // oneof_field.oneof_nested_message - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(TestAllTypes_NestedMessage) - err := b.DecodeMessage(msg) - m.OneofField = &TestAllTypes_OneofNestedMessage{msg} - return true, err - case 113: // oneof_field.oneof_string - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.OneofField = &TestAllTypes_OneofString{x} - return true, err - case 114: // oneof_field.oneof_bytes - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeRawBytes(true) - m.OneofField = &TestAllTypes_OneofBytes{x} - return true, err - case 115: // oneof_field.oneof_bool - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.OneofField = &TestAllTypes_OneofBool{x != 0} - return true, err - case 116: // oneof_field.oneof_uint64 - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.OneofField = &TestAllTypes_OneofUint64{x} - return true, err - case 117: // oneof_field.oneof_float - if wire != proto.WireFixed32 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed32() - m.OneofField = &TestAllTypes_OneofFloat{math.Float32frombits(uint32(x))} - return true, err - case 118: // oneof_field.oneof_double - if wire != proto.WireFixed64 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed64() - m.OneofField = &TestAllTypes_OneofDouble{math.Float64frombits(x)} - return true, err - case 119: // oneof_field.oneof_enum - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.OneofField = &TestAllTypes_OneofEnum{TestAllTypes_NestedEnum(x)} - return true, err - default: - return false, nil - } -} - -func _TestAllTypes_OneofSizer(msg proto.Message) (n int) { - m := msg.(*TestAllTypes) - // oneof_field - switch x := m.OneofField.(type) { - case *TestAllTypes_OneofUint32: - n += proto.SizeVarint(111<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.OneofUint32)) - case *TestAllTypes_OneofNestedMessage: - s := proto.Size(x.OneofNestedMessage) - n += proto.SizeVarint(112<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case *TestAllTypes_OneofString: - n += proto.SizeVarint(113<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.OneofString))) - n += len(x.OneofString) - case *TestAllTypes_OneofBytes: - n += proto.SizeVarint(114<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.OneofBytes))) - n += len(x.OneofBytes) - case *TestAllTypes_OneofBool: - n += proto.SizeVarint(115<<3 | proto.WireVarint) - n += 1 - case *TestAllTypes_OneofUint64: - n += proto.SizeVarint(116<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.OneofUint64)) - case *TestAllTypes_OneofFloat: - n += proto.SizeVarint(117<<3 | proto.WireFixed32) - n += 4 - case *TestAllTypes_OneofDouble: - n += proto.SizeVarint(118<<3 | proto.WireFixed64) - n += 8 - case *TestAllTypes_OneofEnum: - n += proto.SizeVarint(119<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.OneofEnum)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type TestAllTypes_NestedMessage struct { - A int32 `protobuf:"varint,1,opt,name=a,proto3" json:"a,omitempty"` - Corecursive *TestAllTypes `protobuf:"bytes,2,opt,name=corecursive" json:"corecursive,omitempty"` -} - -func (m *TestAllTypes_NestedMessage) Reset() { *m = TestAllTypes_NestedMessage{} } -func (m *TestAllTypes_NestedMessage) String() string { return proto.CompactTextString(m) } -func (*TestAllTypes_NestedMessage) ProtoMessage() {} -func (*TestAllTypes_NestedMessage) Descriptor() ([]byte, []int) { - return fileDescriptorConformance, []int{2, 0} -} - -func (m *TestAllTypes_NestedMessage) GetA() int32 { - if m != nil { - return m.A - } - return 0 -} - -func (m *TestAllTypes_NestedMessage) GetCorecursive() *TestAllTypes { - if m != nil { - return m.Corecursive - } - return nil -} - -type ForeignMessage struct { - C int32 `protobuf:"varint,1,opt,name=c,proto3" json:"c,omitempty"` -} - -func (m *ForeignMessage) Reset() { *m = ForeignMessage{} } -func (m *ForeignMessage) String() string { return proto.CompactTextString(m) } -func (*ForeignMessage) ProtoMessage() {} -func (*ForeignMessage) Descriptor() ([]byte, []int) { return fileDescriptorConformance, []int{3} } - -func (m *ForeignMessage) GetC() int32 { - if m != nil { - return m.C - } - return 0 -} - -func init() { - proto.RegisterType((*ConformanceRequest)(nil), "conformance.ConformanceRequest") - proto.RegisterType((*ConformanceResponse)(nil), "conformance.ConformanceResponse") - proto.RegisterType((*TestAllTypes)(nil), "conformance.TestAllTypes") - proto.RegisterType((*TestAllTypes_NestedMessage)(nil), "conformance.TestAllTypes.NestedMessage") - proto.RegisterType((*ForeignMessage)(nil), "conformance.ForeignMessage") - proto.RegisterEnum("conformance.WireFormat", WireFormat_name, WireFormat_value) - proto.RegisterEnum("conformance.ForeignEnum", ForeignEnum_name, ForeignEnum_value) - proto.RegisterEnum("conformance.TestAllTypes_NestedEnum", TestAllTypes_NestedEnum_name, TestAllTypes_NestedEnum_value) -} - -func init() { proto.RegisterFile("conformance_proto/conformance.proto", fileDescriptorConformance) } - -var fileDescriptorConformance = []byte{ - // 2737 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x5a, 0xd9, 0x72, 0xdb, 0xc8, - 0xd5, 0x16, 0x08, 0x59, 0x4b, 0x93, 0x92, 0xa8, 0xd6, 0xd6, 0x96, 0x5d, 0x63, 0x58, 0xb2, 0x7f, - 0xd3, 0xf6, 0x8c, 0xac, 0x05, 0x86, 0x65, 0xcf, 0x3f, 0x8e, 0x45, 0x9b, 0xb4, 0xe4, 0x8c, 0x25, - 0x17, 0x64, 0x8d, 0xab, 0x9c, 0x0b, 0x06, 0xa6, 0x20, 0x15, 0xc7, 0x24, 0xc1, 0x01, 0x48, 0x4f, - 0x94, 0xcb, 0xbc, 0x41, 0xf6, 0x7d, 0xbd, 0xcf, 0x7a, 0x93, 0xa4, 0x92, 0xab, 0x54, 0x6e, 0xb2, - 0x27, 0x95, 0x3d, 0x79, 0x85, 0xbc, 0x43, 0x52, 0xbd, 0xa2, 0xbb, 0x01, 0x50, 0xf4, 0x54, 0x0d, - 0x25, 0x1e, 0x7c, 0xfd, 0x9d, 0xd3, 0xe7, 0x1c, 0x7c, 0x2d, 0x1c, 0x18, 0x2c, 0xd7, 0x83, 0xf6, - 0x51, 0x10, 0xb6, 0xbc, 0x76, 0xdd, 0xaf, 0x75, 0xc2, 0xa0, 0x1b, 0xdc, 0x90, 0x2c, 0x2b, 0xc4, - 0x02, 0xf3, 0x92, 0x69, 0xf1, 0xec, 0x71, 0x10, 0x1c, 0x37, 0xfd, 0x1b, 0xe4, 0xd2, 0x8b, 0xde, - 0xd1, 0x0d, 0xaf, 0x7d, 0x42, 0x71, 0x8b, 0x6f, 0xe8, 0x97, 0x0e, 0x7b, 0xa1, 0xd7, 0x6d, 0x04, - 0x6d, 0x76, 0xdd, 0xd2, 0xaf, 0x1f, 0x35, 0xfc, 0xe6, 0x61, 0xad, 0xe5, 0x45, 0x2f, 0x19, 0xe2, - 0xbc, 0x8e, 0x88, 0xba, 0x61, 0xaf, 0xde, 0x65, 0x57, 0x2f, 0xe8, 0x57, 0xbb, 0x8d, 0x96, 0x1f, - 0x75, 0xbd, 0x56, 0x27, 0x2b, 0x80, 0x0f, 0x43, 0xaf, 0xd3, 0xf1, 0xc3, 0x88, 0x5e, 0x5f, 0xfa, - 0x85, 0x01, 0xe0, 0xfd, 0x78, 0x2f, 0xae, 0xff, 0x41, 0xcf, 0x8f, 0xba, 0xf0, 0x3a, 0x28, 0xf2, - 0x15, 0xb5, 0x8e, 0x77, 0xd2, 0x0c, 0xbc, 0x43, 0x64, 0x58, 0x46, 0xa9, 0xb0, 0x3d, 0xe4, 0x4e, - 0xf1, 0x2b, 0x4f, 0xe8, 0x05, 0xb8, 0x0c, 0x0a, 0xef, 0x47, 0x41, 0x5b, 0x00, 0x73, 0x96, 0x51, - 0x1a, 0xdf, 0x1e, 0x72, 0xf3, 0xd8, 0xca, 0x41, 0x7b, 0x60, 0x21, 0xa4, 0xe4, 0xfe, 0x61, 0x2d, - 0xe8, 0x75, 0x3b, 0xbd, 0x6e, 0x8d, 0x78, 0xed, 0x22, 0xd3, 0x32, 0x4a, 0x93, 0xeb, 0x0b, 0x2b, - 0x72, 0x9a, 0x9f, 0x35, 0x42, 0xbf, 0x4a, 0x2e, 0xbb, 0x73, 0x62, 0xdd, 0x1e, 0x59, 0x46, 0xcd, - 0xe5, 0x71, 0x30, 0xca, 0x1c, 0x2e, 0x7d, 0x2a, 0x07, 0x66, 0x94, 0x4d, 0x44, 0x9d, 0xa0, 0x1d, - 0xf9, 0xf0, 0x22, 0xc8, 0x77, 0xbc, 0x30, 0xf2, 0x6b, 0x7e, 0x18, 0x06, 0x21, 0xd9, 0x00, 0x8e, - 0x0b, 0x10, 0x63, 0x05, 0xdb, 0xe0, 0x55, 0x30, 0x15, 0xf9, 0x61, 0xc3, 0x6b, 0x36, 0x3e, 0xc9, - 0x61, 0x23, 0x0c, 0x36, 0x29, 0x2e, 0x50, 0xe8, 0x65, 0x30, 0x11, 0xf6, 0xda, 0x38, 0xc1, 0x0c, - 0xc8, 0xf7, 0x59, 0x60, 0x66, 0x0a, 0x4b, 0x4b, 0x9d, 0x39, 0x68, 0xea, 0x86, 0xd3, 0x52, 0xb7, - 0x08, 0x46, 0xa3, 0x97, 0x8d, 0x4e, 0xc7, 0x3f, 0x44, 0x67, 0xd8, 0x75, 0x6e, 0x28, 0x8f, 0x81, - 0x91, 0xd0, 0x8f, 0x7a, 0xcd, 0xee, 0xd2, 0x7f, 0xaa, 0xa0, 0xf0, 0xd4, 0x8f, 0xba, 0x5b, 0xcd, - 0xe6, 0xd3, 0x93, 0x8e, 0x1f, 0xc1, 0xcb, 0x60, 0x32, 0xe8, 0xe0, 0x5e, 0xf3, 0x9a, 0xb5, 0x46, - 0xbb, 0xbb, 0xb1, 0x4e, 0x12, 0x70, 0xc6, 0x9d, 0xe0, 0xd6, 0x1d, 0x6c, 0xd4, 0x61, 0x8e, 0x4d, - 0xf6, 0x65, 0x2a, 0x30, 0xc7, 0x86, 0x57, 0xc0, 0x94, 0x80, 0xf5, 0x28, 0x1d, 0xde, 0xd5, 0x84, - 0x2b, 0x56, 0x1f, 0x10, 0x6b, 0x02, 0xe8, 0xd8, 0x64, 0x57, 0xc3, 0x2a, 0x50, 0x63, 0x8c, 0x28, - 0x23, 0xde, 0xde, 0x74, 0x0c, 0xdc, 0x4f, 0x32, 0x46, 0x94, 0x11, 0xd7, 0x08, 0xaa, 0x40, 0xc7, - 0x86, 0x57, 0x41, 0x51, 0x00, 0x8f, 0x1a, 0x9f, 0xf0, 0x0f, 0x37, 0xd6, 0xd1, 0xa8, 0x65, 0x94, - 0x46, 0x5d, 0x41, 0x50, 0xa5, 0xe6, 0x24, 0xd4, 0xb1, 0xd1, 0x98, 0x65, 0x94, 0x46, 0x34, 0xa8, - 0x63, 0xc3, 0xeb, 0x60, 0x3a, 0x76, 0xcf, 0x69, 0xc7, 0x2d, 0xa3, 0x34, 0xe5, 0x0a, 0x8e, 0x7d, - 0x66, 0x4f, 0x01, 0x3b, 0x36, 0x02, 0x96, 0x51, 0x2a, 0xea, 0x60, 0xc7, 0x56, 0x52, 0x7f, 0xd4, - 0x0c, 0xbc, 0x2e, 0xca, 0x5b, 0x46, 0x29, 0x17, 0xa7, 0xbe, 0x8a, 0x8d, 0xca, 0xfe, 0x0f, 0x83, - 0xde, 0x8b, 0xa6, 0x8f, 0x0a, 0x96, 0x51, 0x32, 0xe2, 0xfd, 0x3f, 0x20, 0x56, 0xb8, 0x0c, 0xc4, - 0xca, 0xda, 0x8b, 0x20, 0x68, 0xa2, 0x09, 0xcb, 0x28, 0x8d, 0xb9, 0x05, 0x6e, 0x2c, 0x07, 0x41, - 0x53, 0xcd, 0x66, 0x37, 0x6c, 0xb4, 0x8f, 0xd1, 0x24, 0xee, 0x2a, 0x29, 0x9b, 0xc4, 0xaa, 0x44, - 0xf7, 0xe2, 0xa4, 0xeb, 0x47, 0x68, 0x0a, 0xb7, 0x71, 0x1c, 0x5d, 0x19, 0x1b, 0x61, 0x0d, 0x2c, - 0x08, 0x58, 0x9b, 0xde, 0xde, 0x2d, 0x3f, 0x8a, 0xbc, 0x63, 0x1f, 0x41, 0xcb, 0x28, 0xe5, 0xd7, - 0xaf, 0x28, 0x37, 0xb6, 0xdc, 0xa2, 0x2b, 0xbb, 0x04, 0xff, 0x98, 0xc2, 0xdd, 0x39, 0xce, 0xa3, - 0x98, 0xe1, 0x01, 0x40, 0x71, 0x96, 0x82, 0xd0, 0x6f, 0x1c, 0xb7, 0x85, 0x87, 0x19, 0xe2, 0xe1, - 0x9c, 0xe2, 0xa1, 0x4a, 0x31, 0x9c, 0x75, 0x5e, 0x24, 0x53, 0xb1, 0xc3, 0xf7, 0xc0, 0xac, 0x1e, - 0xb7, 0xdf, 0xee, 0xb5, 0xd0, 0x1c, 0x51, 0xa3, 0x4b, 0xa7, 0x05, 0x5d, 0x69, 0xf7, 0x5a, 0x2e, - 0x54, 0x23, 0xc6, 0x36, 0xf8, 0x2e, 0x98, 0x4b, 0x84, 0x4b, 0x88, 0xe7, 0x09, 0x31, 0x4a, 0x8b, - 0x95, 0x90, 0xcd, 0x68, 0x81, 0x12, 0x36, 0x47, 0x62, 0xa3, 0xd5, 0xaa, 0x75, 0x1a, 0x7e, 0xdd, - 0x47, 0x08, 0xd7, 0xac, 0x9c, 0x1b, 0xcb, 0xc5, 0xeb, 0x68, 0xdd, 0x9e, 0xe0, 0xcb, 0xf0, 0x8a, - 0xd4, 0x0a, 0xf5, 0x20, 0x3c, 0x44, 0x67, 0x19, 0xde, 0x88, 0xdb, 0xe1, 0x7e, 0x10, 0x1e, 0xc2, - 0x2a, 0x98, 0x0e, 0xfd, 0x7a, 0x2f, 0x8c, 0x1a, 0xaf, 0x7c, 0x91, 0xd6, 0x73, 0x24, 0xad, 0x67, - 0x33, 0x73, 0xe0, 0x16, 0xc5, 0x1a, 0x9e, 0xce, 0xcb, 0x60, 0x32, 0xf4, 0x3b, 0xbe, 0x87, 0xf3, - 0x48, 0x6f, 0xe6, 0x0b, 0x96, 0x89, 0xd5, 0x86, 0x5b, 0x85, 0xda, 0xc8, 0x30, 0xc7, 0x46, 0x96, - 0x65, 0x62, 0xb5, 0x91, 0x60, 0x54, 0x1b, 0x04, 0x8c, 0xa9, 0xcd, 0x45, 0xcb, 0xc4, 0x6a, 0xc3, - 0xcd, 0xb1, 0xda, 0x28, 0x40, 0xc7, 0x46, 0x4b, 0x96, 0x89, 0xd5, 0x46, 0x06, 0x6a, 0x8c, 0x4c, - 0x6d, 0x96, 0x2d, 0x13, 0xab, 0x0d, 0x37, 0xef, 0x27, 0x19, 0x99, 0xda, 0x5c, 0xb2, 0x4c, 0xac, - 0x36, 0x32, 0x90, 0xaa, 0x8d, 0x00, 0x72, 0x59, 0xb8, 0x6c, 0x99, 0x58, 0x6d, 0xb8, 0x5d, 0x52, - 0x1b, 0x15, 0xea, 0xd8, 0xe8, 0xff, 0x2c, 0x13, 0xab, 0x8d, 0x02, 0xa5, 0x6a, 0x13, 0xbb, 0xe7, - 0xb4, 0x57, 0x2c, 0x13, 0xab, 0x8d, 0x08, 0x40, 0x52, 0x1b, 0x0d, 0xec, 0xd8, 0xa8, 0x64, 0x99, - 0x58, 0x6d, 0x54, 0x30, 0x55, 0x9b, 0x38, 0x08, 0xa2, 0x36, 0x57, 0x2d, 0x13, 0xab, 0x8d, 0x08, - 0x81, 0xab, 0x8d, 0x80, 0x31, 0xb5, 0xb9, 0x66, 0x99, 0x58, 0x6d, 0xb8, 0x39, 0x56, 0x1b, 0x01, - 0x24, 0x6a, 0x73, 0xdd, 0x32, 0xb1, 0xda, 0x70, 0x23, 0x57, 0x9b, 0x38, 0x42, 0xaa, 0x36, 0x6f, - 0x5a, 0x26, 0x56, 0x1b, 0x11, 0x9f, 0x50, 0x9b, 0x98, 0x8d, 0xa8, 0xcd, 0x5b, 0x96, 0x89, 0xd5, - 0x46, 0xd0, 0x71, 0xb5, 0x11, 0x30, 0x4d, 0x6d, 0x56, 0x2d, 0xf3, 0xb5, 0xd4, 0x86, 0xf3, 0x24, - 0xd4, 0x26, 0xce, 0x92, 0xa6, 0x36, 0x6b, 0xc4, 0x43, 0x7f, 0xb5, 0x11, 0xc9, 0x4c, 0xa8, 0x8d, - 0x1e, 0x37, 0x11, 0x85, 0x0d, 0xcb, 0x1c, 0x5c, 0x6d, 0xd4, 0x88, 0xb9, 0xda, 0x24, 0xc2, 0x25, - 0xc4, 0x36, 0x21, 0xee, 0xa3, 0x36, 0x5a, 0xa0, 0x5c, 0x6d, 0xb4, 0x6a, 0x31, 0xb5, 0x71, 0x70, - 0xcd, 0xa8, 0xda, 0xa8, 0x75, 0x13, 0x6a, 0x23, 0xd6, 0x11, 0xb5, 0xb9, 0xc5, 0xf0, 0x46, 0xdc, - 0x0e, 0x44, 0x6d, 0x9e, 0x82, 0xa9, 0x96, 0xd7, 0xa1, 0x02, 0xc1, 0x64, 0x62, 0x93, 0x24, 0xf5, - 0xcd, 0xec, 0x0c, 0x3c, 0xf6, 0x3a, 0x44, 0x3b, 0xc8, 0x47, 0xa5, 0xdd, 0x0d, 0x4f, 0xdc, 0x89, - 0x96, 0x6c, 0x93, 0x58, 0x1d, 0x9b, 0xa9, 0xca, 0xed, 0xc1, 0x58, 0x1d, 0x9b, 0x7c, 0x28, 0xac, - 0xcc, 0x06, 0x9f, 0x83, 0x69, 0xcc, 0x4a, 0xe5, 0x87, 0xab, 0xd0, 0x1d, 0xc2, 0xbb, 0xd2, 0x97, - 0x97, 0x4a, 0x13, 0xfd, 0xa4, 0xcc, 0x38, 0x3c, 0xd9, 0x2a, 0x73, 0x3b, 0x36, 0x17, 0xae, 0xb7, - 0x07, 0xe4, 0x76, 0x6c, 0xfa, 0xa9, 0x72, 0x73, 0x2b, 0xe7, 0xa6, 0x22, 0xc7, 0xb5, 0xee, 0xff, - 0x07, 0xe0, 0xa6, 0x02, 0xb8, 0xaf, 0xc5, 0x2d, 0x5b, 0x65, 0x6e, 0xc7, 0xe6, 0xf2, 0xf8, 0xce, - 0x80, 0xdc, 0x8e, 0xbd, 0xaf, 0xc5, 0x2d, 0x5b, 0xe1, 0xc7, 0xc1, 0x0c, 0xe6, 0x66, 0xda, 0x26, - 0x24, 0xf5, 0x2e, 0x61, 0x5f, 0xed, 0xcb, 0xce, 0x74, 0x96, 0xfd, 0xa0, 0xfc, 0x38, 0x50, 0xd5, - 0xae, 0x78, 0x70, 0x6c, 0xa1, 0xc4, 0x1f, 0x19, 0xd4, 0x83, 0x63, 0xb3, 0x1f, 0x9a, 0x07, 0x61, - 0x87, 0x47, 0x60, 0x8e, 0xe4, 0x87, 0x6f, 0x42, 0x28, 0xf8, 0x3d, 0xe2, 0x63, 0xbd, 0x7f, 0x8e, - 0x18, 0x98, 0xff, 0xa4, 0x5e, 0x70, 0xc8, 0xfa, 0x15, 0xd5, 0x0f, 0xae, 0x04, 0xdf, 0xcb, 0xd6, - 0xc0, 0x7e, 0x1c, 0x9b, 0xff, 0xd4, 0xfd, 0xc4, 0x57, 0xd4, 0xfb, 0x95, 0x1e, 0x1a, 0xe5, 0x41, - 0xef, 0x57, 0x72, 0x9c, 0x68, 0xf7, 0x2b, 0x3d, 0x62, 0x9e, 0x81, 0x62, 0xcc, 0xca, 0xce, 0x98, - 0xfb, 0x84, 0xf6, 0xad, 0xd3, 0x69, 0xe9, 0xe9, 0x43, 0x79, 0x27, 0x5b, 0x8a, 0x11, 0xee, 0x02, - 0xec, 0x89, 0x9c, 0x46, 0xf4, 0x48, 0x7a, 0x40, 0x58, 0xaf, 0xf5, 0x65, 0xc5, 0xe7, 0x14, 0xfe, - 0x9f, 0x52, 0xe6, 0x5b, 0xb1, 0x45, 0xb4, 0x3b, 0x95, 0x42, 0x76, 0x7e, 0x55, 0x06, 0x69, 0x77, - 0x02, 0xa5, 0x9f, 0x52, 0xbb, 0x4b, 0x56, 0x9e, 0x04, 0xc6, 0x4d, 0x8f, 0xbc, 0xea, 0x00, 0x49, - 0xa0, 0xcb, 0xc9, 0x69, 0x18, 0x27, 0x41, 0x32, 0xc2, 0x0e, 0x38, 0x2b, 0x11, 0x6b, 0x87, 0xe4, - 0x43, 0xe2, 0xe1, 0xe6, 0x00, 0x1e, 0x94, 0x63, 0x91, 0x7a, 0x9a, 0x6f, 0xa5, 0x5e, 0x84, 0x11, - 0x58, 0x94, 0x3c, 0xea, 0xa7, 0xe6, 0x36, 0x71, 0xe9, 0x0c, 0xe0, 0x52, 0x3d, 0x33, 0xa9, 0xcf, - 0x85, 0x56, 0xfa, 0x55, 0x78, 0x0c, 0xe6, 0x93, 0xdb, 0x24, 0x47, 0xdf, 0xce, 0x20, 0xf7, 0x80, - 0xb4, 0x0d, 0x7c, 0xf4, 0x49, 0xf7, 0x80, 0x76, 0x05, 0xbe, 0x0f, 0x16, 0x52, 0x76, 0x47, 0x3c, - 0x3d, 0x22, 0x9e, 0x36, 0x06, 0xdf, 0x5a, 0xec, 0x6a, 0xb6, 0x95, 0x72, 0x09, 0x2e, 0x83, 0x42, - 0xd0, 0xf6, 0x83, 0x23, 0x7e, 0xdc, 0x04, 0xf8, 0x11, 0x7b, 0x7b, 0xc8, 0xcd, 0x13, 0x2b, 0x3b, - 0x3c, 0x3e, 0x06, 0x66, 0x29, 0x48, 0xab, 0x6d, 0xe7, 0xb5, 0x1e, 0xb7, 0xb6, 0x87, 0x5c, 0x48, - 0x68, 0xd4, 0x5a, 0x8a, 0x08, 0x58, 0xb7, 0x7f, 0xc0, 0x27, 0x12, 0xc4, 0xca, 0x7a, 0xf7, 0x22, - 0xa0, 0x5f, 0x59, 0xdb, 0x86, 0x6c, 0xbc, 0x01, 0x88, 0x91, 0x76, 0xe1, 0x05, 0x00, 0x18, 0x04, - 0xdf, 0x87, 0x11, 0x7e, 0x10, 0xdd, 0x1e, 0x72, 0xc7, 0x29, 0x02, 0xdf, 0x5b, 0xca, 0x56, 0x1d, - 0x1b, 0x75, 0x2d, 0xa3, 0x34, 0xac, 0x6c, 0xd5, 0xb1, 0x63, 0x47, 0x54, 0x7b, 0x7a, 0xf8, 0xf1, - 0x58, 0x38, 0xa2, 0x62, 0x22, 0x78, 0x98, 0x90, 0xbc, 0xc2, 0x8f, 0xc6, 0x82, 0x87, 0x09, 0x43, - 0x85, 0x47, 0x43, 0xca, 0xf6, 0xe1, 0xe0, 0x8f, 0x78, 0x22, 0x66, 0x52, 0x9e, 0x3d, 0xe9, 0x69, - 0x8c, 0x88, 0x0c, 0x9b, 0xa6, 0xa1, 0x5f, 0x19, 0x24, 0xf7, 0x8b, 0x2b, 0x74, 0xdc, 0xb6, 0xc2, - 0xe7, 0x3c, 0x2b, 0x78, 0xab, 0xef, 0x79, 0xcd, 0x9e, 0x1f, 0x3f, 0xa6, 0x61, 0xd3, 0x33, 0xba, - 0x0e, 0xba, 0x60, 0x5e, 0x9d, 0xd1, 0x08, 0xc6, 0x5f, 0x1b, 0xec, 0xd1, 0x56, 0x67, 0x24, 0x7a, - 0x47, 0x29, 0x67, 0x95, 0x49, 0x4e, 0x06, 0xa7, 0x63, 0x0b, 0xce, 0xdf, 0xf4, 0xe1, 0x74, 0xec, - 0x24, 0xa7, 0x63, 0x73, 0xce, 0x03, 0xe9, 0x21, 0xbf, 0xa7, 0x06, 0xfa, 0x5b, 0x4a, 0x7a, 0x3e, - 0x41, 0x7a, 0x20, 0x45, 0x3a, 0xa7, 0x0e, 0x89, 0xb2, 0x68, 0xa5, 0x58, 0x7f, 0xd7, 0x8f, 0x96, - 0x07, 0x3b, 0xa7, 0x8e, 0x94, 0xd2, 0x32, 0x40, 0x1a, 0x47, 0xb0, 0xfe, 0x3e, 0x2b, 0x03, 0xa4, - 0x97, 0xb4, 0x0c, 0x10, 0x5b, 0x5a, 0xa8, 0xb4, 0xd3, 0x04, 0xe9, 0x1f, 0xb2, 0x42, 0xa5, 0xcd, - 0xa7, 0x85, 0x4a, 0x8d, 0x69, 0xb4, 0x4c, 0x61, 0x38, 0xed, 0x1f, 0xb3, 0x68, 0xe9, 0x4d, 0xa8, - 0xd1, 0x52, 0x63, 0x5a, 0x06, 0xc8, 0x3d, 0x2a, 0x58, 0xff, 0x94, 0x95, 0x01, 0x72, 0xdb, 0x6a, - 0x19, 0x20, 0x36, 0xce, 0xb9, 0x27, 0x3d, 0x1c, 0x28, 0xcd, 0xff, 0x67, 0x83, 0xc8, 0x60, 0xdf, - 0xe6, 0x97, 0x1f, 0x0a, 0xa5, 0x20, 0xd5, 0x91, 0x81, 0x60, 0xfc, 0x8b, 0xc1, 0x9e, 0xb4, 0xfa, - 0x35, 0xbf, 0x32, 0x58, 0xc8, 0xe0, 0x94, 0x1a, 0xea, 0xaf, 0x7d, 0x38, 0x45, 0xf3, 0x2b, 0x53, - 0x08, 0xa9, 0x46, 0xda, 0x30, 0x42, 0x90, 0xfe, 0x8d, 0x92, 0x9e, 0xd2, 0xfc, 0xea, 0xcc, 0x22, - 0x8b, 0x56, 0x8a, 0xf5, 0xef, 0xfd, 0x68, 0x45, 0xf3, 0xab, 0x13, 0x8e, 0xb4, 0x0c, 0xa8, 0xcd, - 0xff, 0x8f, 0xac, 0x0c, 0xc8, 0xcd, 0xaf, 0x0c, 0x03, 0xd2, 0x42, 0xd5, 0x9a, 0xff, 0x9f, 0x59, - 0xa1, 0x2a, 0xcd, 0xaf, 0x8e, 0x0e, 0xd2, 0x68, 0xb5, 0xe6, 0xff, 0x57, 0x16, 0xad, 0xd2, 0xfc, - 0xea, 0xb3, 0x68, 0x5a, 0x06, 0xd4, 0xe6, 0xff, 0x77, 0x56, 0x06, 0xe4, 0xe6, 0x57, 0x06, 0x0e, - 0x9c, 0xf3, 0xa1, 0x34, 0xd7, 0xe5, 0xef, 0x70, 0xd0, 0x77, 0x73, 0x6c, 0x4e, 0x96, 0xd8, 0x3b, - 0x43, 0xc4, 0x33, 0x5f, 0x6e, 0x81, 0x8f, 0x80, 0x18, 0x1a, 0xd6, 0xc4, 0xcb, 0x1a, 0xf4, 0xbd, - 0x5c, 0xc6, 0xf9, 0xf1, 0x94, 0x43, 0x5c, 0xe1, 0x5f, 0x98, 0xe0, 0x47, 0xc1, 0x8c, 0x34, 0xc4, - 0xe6, 0x2f, 0x8e, 0xd0, 0xf7, 0xb3, 0xc8, 0xaa, 0x18, 0xf3, 0xd8, 0x8b, 0x5e, 0xc6, 0x64, 0xc2, - 0x04, 0xb7, 0xd4, 0xb9, 0x70, 0xaf, 0xde, 0x45, 0x3f, 0xa0, 0x44, 0x0b, 0x69, 0x45, 0xe8, 0xd5, - 0xbb, 0xca, 0xc4, 0xb8, 0x57, 0xef, 0xc2, 0x4d, 0x20, 0x66, 0x8b, 0x35, 0xaf, 0x7d, 0x82, 0x7e, - 0x48, 0xd7, 0xcf, 0x26, 0xd6, 0x6f, 0xb5, 0x4f, 0xdc, 0x3c, 0x87, 0x6e, 0xb5, 0x4f, 0xe0, 0x5d, - 0x69, 0xd6, 0xfc, 0x0a, 0x97, 0x01, 0xfd, 0x88, 0xae, 0x9d, 0x4f, 0xac, 0xa5, 0x55, 0x12, 0xd3, - 0x4d, 0xf2, 0x15, 0x97, 0x27, 0x6e, 0x50, 0x5e, 0x9e, 0x1f, 0xe7, 0x48, 0xb5, 0xfb, 0x95, 0x47, - 0xf4, 0xa5, 0x54, 0x1e, 0x41, 0x14, 0x97, 0xe7, 0x27, 0xb9, 0x0c, 0x85, 0x93, 0xca, 0xc3, 0x97, - 0xc5, 0xe5, 0x91, 0xb9, 0x48, 0x79, 0x48, 0x75, 0x7e, 0x9a, 0xc5, 0x25, 0x55, 0x27, 0x1e, 0x0a, - 0xb2, 0x55, 0xb8, 0x3a, 0xf2, 0xad, 0x82, 0xab, 0xf3, 0x4b, 0x4a, 0x94, 0x5d, 0x1d, 0xe9, 0xee, - 0x60, 0xd5, 0x11, 0x14, 0xb8, 0x3a, 0x3f, 0xa3, 0xeb, 0x33, 0xaa, 0xc3, 0xa1, 0xac, 0x3a, 0x62, - 0x25, 0xad, 0xce, 0xcf, 0xe9, 0xda, 0xcc, 0xea, 0x70, 0x38, 0xad, 0xce, 0x05, 0x00, 0xc8, 0xfe, - 0xdb, 0x5e, 0xcb, 0x5f, 0x43, 0x9f, 0x36, 0xc9, 0x6b, 0x28, 0xc9, 0x04, 0x2d, 0x90, 0xa7, 0xfd, - 0x8b, 0xbf, 0xae, 0xa3, 0xcf, 0xc8, 0x88, 0x5d, 0x6c, 0x82, 0x17, 0x41, 0xa1, 0x16, 0x43, 0x36, - 0xd0, 0x67, 0x19, 0xa4, 0xca, 0x21, 0x1b, 0x70, 0x09, 0x4c, 0x50, 0x04, 0x81, 0xd8, 0x35, 0xf4, - 0x39, 0x9d, 0x86, 0xfc, 0x3d, 0x49, 0xbe, 0xad, 0x62, 0xc8, 0x4d, 0xf4, 0x79, 0x8a, 0x90, 0x6d, - 0x70, 0x99, 0xd3, 0xac, 0x12, 0x1e, 0x07, 0x7d, 0x41, 0x01, 0x61, 0x1e, 0x47, 0xec, 0x08, 0x7f, - 0xbb, 0x85, 0xbe, 0xa8, 0x3b, 0xba, 0x85, 0x01, 0x22, 0xb4, 0x4d, 0xf4, 0x25, 0x3d, 0xda, 0xcd, - 0x78, 0xcb, 0xf8, 0xeb, 0x6d, 0xf4, 0x65, 0x9d, 0xe2, 0x36, 0x5c, 0x02, 0x85, 0xaa, 0x40, 0xac, - 0xad, 0xa2, 0xaf, 0xb0, 0x38, 0x04, 0xc9, 0xda, 0x2a, 0xc1, 0xec, 0x54, 0xde, 0x7d, 0x50, 0xdb, - 0xdd, 0x7a, 0x5c, 0x59, 0x5b, 0x43, 0x5f, 0xe5, 0x18, 0x6c, 0xa4, 0xb6, 0x18, 0x43, 0x72, 0xbd, - 0x8e, 0xbe, 0xa6, 0x60, 0x88, 0x0d, 0x5e, 0x02, 0x93, 0x35, 0x29, 0xbf, 0x6b, 0x1b, 0xe8, 0xeb, - 0x09, 0x6f, 0x1b, 0x14, 0x55, 0x8d, 0x51, 0x36, 0xfa, 0x46, 0x02, 0x65, 0xc7, 0x09, 0xa4, 0xa0, - 0x9b, 0xe8, 0x9b, 0x72, 0x02, 0x09, 0x48, 0xca, 0x32, 0xdd, 0x9d, 0x83, 0xbe, 0x95, 0x00, 0x39, - 0xd8, 0x9f, 0x14, 0xd3, 0xad, 0x5a, 0x0d, 0x7d, 0x3b, 0x81, 0xba, 0x85, 0x51, 0x52, 0x4c, 0x9b, - 0xb5, 0x1a, 0xfa, 0x4e, 0x22, 0xaa, 0xcd, 0xc5, 0xe7, 0x60, 0x42, 0x7d, 0xd0, 0x29, 0x00, 0xc3, - 0x63, 0x6f, 0x44, 0x0d, 0x0f, 0xbe, 0x0d, 0xf2, 0xf5, 0x40, 0xbc, 0xd4, 0x40, 0xb9, 0xd3, 0x5e, - 0x80, 0xc8, 0xe8, 0xc5, 0x7b, 0x00, 0x26, 0x87, 0x94, 0xb0, 0x08, 0xcc, 0x97, 0xfe, 0x09, 0x73, - 0x81, 0x7f, 0x85, 0xb3, 0xe0, 0x0c, 0xbd, 0x7d, 0x72, 0xc4, 0x46, 0xbf, 0xdc, 0xc9, 0x6d, 0x1a, - 0x31, 0x83, 0x3c, 0x90, 0x94, 0x19, 0xcc, 0x14, 0x06, 0x53, 0x66, 0x28, 0x83, 0xd9, 0xb4, 0xd1, - 0xa3, 0xcc, 0x31, 0x91, 0xc2, 0x31, 0x91, 0xce, 0xa1, 0x8c, 0x18, 0x65, 0x8e, 0xe1, 0x14, 0x8e, - 0xe1, 0x24, 0x47, 0x62, 0x94, 0x28, 0x73, 0x4c, 0xa7, 0x70, 0x4c, 0xa7, 0x73, 0x28, 0x23, 0x43, - 0x99, 0x03, 0xa6, 0x70, 0x40, 0x99, 0xe3, 0x01, 0x98, 0x4f, 0x1f, 0x0c, 0xca, 0x2c, 0xa3, 0x29, - 0x2c, 0xa3, 0x19, 0x2c, 0xea, 0xf0, 0x4f, 0x66, 0x19, 0x49, 0x61, 0x19, 0x91, 0x59, 0xaa, 0x00, - 0x65, 0x8d, 0xf7, 0x64, 0x9e, 0xa9, 0x14, 0x9e, 0xa9, 0x2c, 0x1e, 0x6d, 0x7c, 0x27, 0xf3, 0x14, - 0x53, 0x78, 0x8a, 0xa9, 0xdd, 0x26, 0x0f, 0xe9, 0x4e, 0xeb, 0xd7, 0x9c, 0xcc, 0xb0, 0x05, 0x66, - 0x52, 0xe6, 0x71, 0xa7, 0x51, 0x18, 0x32, 0xc5, 0x5d, 0x50, 0xd4, 0x87, 0x6f, 0xf2, 0xfa, 0xb1, - 0x94, 0xf5, 0x63, 0x29, 0x4d, 0xa2, 0x0f, 0xda, 0x64, 0x8e, 0xf1, 0x14, 0x8e, 0xf1, 0xe4, 0x36, - 0xf4, 0x89, 0xda, 0x69, 0x14, 0x05, 0x99, 0x22, 0x04, 0xe7, 0xfa, 0x8c, 0xcc, 0x52, 0xa8, 0xde, - 0x91, 0xa9, 0x5e, 0xe3, 0x7d, 0x95, 0xe4, 0xf3, 0x18, 0x9c, 0xef, 0x37, 0x33, 0x4b, 0x71, 0xba, - 0xa6, 0x3a, 0xed, 0xfb, 0x0a, 0x4b, 0x72, 0xd4, 0xa4, 0x0d, 0x97, 0x36, 0x2b, 0x4b, 0x71, 0x72, - 0x47, 0x76, 0x32, 0xe8, 0x4b, 0x2d, 0xc9, 0x9b, 0x07, 0xce, 0x66, 0xce, 0xcb, 0x52, 0xdc, 0xad, - 0xa8, 0xee, 0xb2, 0x5f, 0x75, 0xc5, 0x2e, 0x96, 0x6e, 0x03, 0x20, 0x4d, 0xf6, 0x46, 0x81, 0x59, - 0xdd, 0xdb, 0x2b, 0x0e, 0xe1, 0x5f, 0xca, 0x5b, 0x6e, 0xd1, 0xa0, 0xbf, 0x3c, 0x2f, 0xe6, 0xb0, - 0xbb, 0xdd, 0xca, 0xc3, 0xe2, 0x7f, 0xf9, 0x7f, 0x46, 0x79, 0x42, 0x8c, 0xa2, 0xf0, 0xa9, 0xb2, - 0xf4, 0x06, 0x98, 0xd4, 0x06, 0x92, 0x05, 0x60, 0xd4, 0xf9, 0x81, 0x52, 0xbf, 0x76, 0x13, 0x80, - 0xf8, 0xdf, 0x30, 0xc1, 0x29, 0x90, 0x3f, 0xd8, 0xdd, 0x7f, 0x52, 0xb9, 0xbf, 0x53, 0xdd, 0xa9, - 0x3c, 0x28, 0x0e, 0xc1, 0x02, 0x18, 0x7b, 0xe2, 0xee, 0x3d, 0xdd, 0x2b, 0x1f, 0x54, 0x8b, 0x06, - 0x1c, 0x03, 0xc3, 0x8f, 0xf6, 0xf7, 0x76, 0x8b, 0xb9, 0x6b, 0xf7, 0x40, 0x5e, 0x9e, 0x07, 0x4e, - 0x81, 0x7c, 0x75, 0xcf, 0xad, 0xec, 0x3c, 0xdc, 0xad, 0xd1, 0x48, 0x25, 0x03, 0x8d, 0x58, 0x31, - 0x3c, 0x2f, 0xe6, 0xca, 0x17, 0xc1, 0x85, 0x7a, 0xd0, 0x4a, 0xfc, 0x61, 0x26, 0x25, 0xe7, 0xc5, - 0x08, 0xb1, 0x6e, 0xfc, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x33, 0xc2, 0x0c, 0xb6, 0xeb, 0x26, 0x00, - 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance_proto/conformance.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance_proto/conformance.proto deleted file mode 100644 index 95a8fd135f7..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/_conformance/conformance_proto/conformance.proto +++ /dev/null @@ -1,285 +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. - -syntax = "proto3"; -package conformance; -option java_package = "com.google.protobuf.conformance"; - -import "google/protobuf/any.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; - -// This defines the conformance testing protocol. This protocol exists between -// the conformance test suite itself and the code being tested. For each test, -// the suite will send a ConformanceRequest message and expect a -// ConformanceResponse message. -// -// You can either run the tests in two different ways: -// -// 1. in-process (using the interface in conformance_test.h). -// -// 2. as a sub-process communicating over a pipe. Information about how to -// do this is in conformance_test_runner.cc. -// -// Pros/cons of the two approaches: -// -// - running as a sub-process is much simpler for languages other than C/C++. -// -// - running as a sub-process may be more tricky in unusual environments like -// iOS apps, where fork/stdin/stdout are not available. - -enum WireFormat { - UNSPECIFIED = 0; - PROTOBUF = 1; - JSON = 2; -} - -// Represents a single test case's input. The testee should: -// -// 1. parse this proto (which should always succeed) -// 2. parse the protobuf or JSON payload in "payload" (which may fail) -// 3. if the parse succeeded, serialize the message in the requested format. -message ConformanceRequest { - // The payload (whether protobuf of JSON) is always for a TestAllTypes proto - // (see below). - oneof payload { - bytes protobuf_payload = 1; - string json_payload = 2; - } - - // Which format should the testee serialize its message to? - WireFormat requested_output_format = 3; -} - -// Represents a single test case's output. -message ConformanceResponse { - oneof result { - // This string should be set to indicate parsing failed. The string can - // provide more information about the parse error if it is available. - // - // Setting this string does not necessarily mean the testee failed the - // test. Some of the test cases are intentionally invalid input. - string parse_error = 1; - - // If the input was successfully parsed but errors occurred when - // serializing it to the requested output format, set the error message in - // this field. - string serialize_error = 6; - - // This should be set if some other error occurred. This will always - // indicate that the test failed. The string can provide more information - // about the failure. - string runtime_error = 2; - - // If the input was successfully parsed and the requested output was - // protobuf, serialize it to protobuf and set it in this field. - bytes protobuf_payload = 3; - - // If the input was successfully parsed and the requested output was JSON, - // serialize to JSON and set it in this field. - string json_payload = 4; - - // For when the testee skipped the test, likely because a certain feature - // wasn't supported, like JSON input/output. - string skipped = 5; - } -} - -// This proto includes every type of field in both singular and repeated -// forms. -message TestAllTypes { - message NestedMessage { - int32 a = 1; - TestAllTypes corecursive = 2; - } - - enum NestedEnum { - FOO = 0; - BAR = 1; - BAZ = 2; - NEG = -1; // Intentionally negative. - } - - // Singular - int32 optional_int32 = 1; - int64 optional_int64 = 2; - uint32 optional_uint32 = 3; - uint64 optional_uint64 = 4; - sint32 optional_sint32 = 5; - sint64 optional_sint64 = 6; - fixed32 optional_fixed32 = 7; - fixed64 optional_fixed64 = 8; - sfixed32 optional_sfixed32 = 9; - sfixed64 optional_sfixed64 = 10; - float optional_float = 11; - double optional_double = 12; - bool optional_bool = 13; - string optional_string = 14; - bytes optional_bytes = 15; - - NestedMessage optional_nested_message = 18; - ForeignMessage optional_foreign_message = 19; - - NestedEnum optional_nested_enum = 21; - ForeignEnum optional_foreign_enum = 22; - - string optional_string_piece = 24 [ctype=STRING_PIECE]; - string optional_cord = 25 [ctype=CORD]; - - TestAllTypes recursive_message = 27; - - // Repeated - repeated int32 repeated_int32 = 31; - repeated int64 repeated_int64 = 32; - repeated uint32 repeated_uint32 = 33; - repeated uint64 repeated_uint64 = 34; - repeated sint32 repeated_sint32 = 35; - repeated sint64 repeated_sint64 = 36; - repeated fixed32 repeated_fixed32 = 37; - repeated fixed64 repeated_fixed64 = 38; - repeated sfixed32 repeated_sfixed32 = 39; - repeated sfixed64 repeated_sfixed64 = 40; - repeated float repeated_float = 41; - repeated double repeated_double = 42; - repeated bool repeated_bool = 43; - repeated string repeated_string = 44; - repeated bytes repeated_bytes = 45; - - repeated NestedMessage repeated_nested_message = 48; - repeated ForeignMessage repeated_foreign_message = 49; - - repeated NestedEnum repeated_nested_enum = 51; - repeated ForeignEnum repeated_foreign_enum = 52; - - repeated string repeated_string_piece = 54 [ctype=STRING_PIECE]; - repeated string repeated_cord = 55 [ctype=CORD]; - - // Map - map < int32, int32> map_int32_int32 = 56; - map < int64, int64> map_int64_int64 = 57; - map < uint32, uint32> map_uint32_uint32 = 58; - map < uint64, uint64> map_uint64_uint64 = 59; - map < sint32, sint32> map_sint32_sint32 = 60; - map < sint64, sint64> map_sint64_sint64 = 61; - map < fixed32, fixed32> map_fixed32_fixed32 = 62; - map < fixed64, fixed64> map_fixed64_fixed64 = 63; - map map_sfixed32_sfixed32 = 64; - map map_sfixed64_sfixed64 = 65; - map < int32, float> map_int32_float = 66; - map < int32, double> map_int32_double = 67; - map < bool, bool> map_bool_bool = 68; - map < string, string> map_string_string = 69; - map < string, bytes> map_string_bytes = 70; - map < string, NestedMessage> map_string_nested_message = 71; - map < string, ForeignMessage> map_string_foreign_message = 72; - map < string, NestedEnum> map_string_nested_enum = 73; - map < string, ForeignEnum> map_string_foreign_enum = 74; - - oneof oneof_field { - uint32 oneof_uint32 = 111; - NestedMessage oneof_nested_message = 112; - string oneof_string = 113; - bytes oneof_bytes = 114; - bool oneof_bool = 115; - uint64 oneof_uint64 = 116; - float oneof_float = 117; - double oneof_double = 118; - NestedEnum oneof_enum = 119; - } - - // Well-known types - google.protobuf.BoolValue optional_bool_wrapper = 201; - google.protobuf.Int32Value optional_int32_wrapper = 202; - google.protobuf.Int64Value optional_int64_wrapper = 203; - google.protobuf.UInt32Value optional_uint32_wrapper = 204; - google.protobuf.UInt64Value optional_uint64_wrapper = 205; - google.protobuf.FloatValue optional_float_wrapper = 206; - google.protobuf.DoubleValue optional_double_wrapper = 207; - google.protobuf.StringValue optional_string_wrapper = 208; - google.protobuf.BytesValue optional_bytes_wrapper = 209; - - repeated google.protobuf.BoolValue repeated_bool_wrapper = 211; - repeated google.protobuf.Int32Value repeated_int32_wrapper = 212; - repeated google.protobuf.Int64Value repeated_int64_wrapper = 213; - repeated google.protobuf.UInt32Value repeated_uint32_wrapper = 214; - repeated google.protobuf.UInt64Value repeated_uint64_wrapper = 215; - repeated google.protobuf.FloatValue repeated_float_wrapper = 216; - repeated google.protobuf.DoubleValue repeated_double_wrapper = 217; - repeated google.protobuf.StringValue repeated_string_wrapper = 218; - repeated google.protobuf.BytesValue repeated_bytes_wrapper = 219; - - google.protobuf.Duration optional_duration = 301; - google.protobuf.Timestamp optional_timestamp = 302; - google.protobuf.FieldMask optional_field_mask = 303; - google.protobuf.Struct optional_struct = 304; - google.protobuf.Any optional_any = 305; - google.protobuf.Value optional_value = 306; - - repeated google.protobuf.Duration repeated_duration = 311; - repeated google.protobuf.Timestamp repeated_timestamp = 312; - repeated google.protobuf.FieldMask repeated_fieldmask = 313; - repeated google.protobuf.Struct repeated_struct = 324; - repeated google.protobuf.Any repeated_any = 315; - repeated google.protobuf.Value repeated_value = 316; - - // Test field-name-to-JSON-name convention. - // (protobuf says names can be any valid C/C++ identifier.) - int32 fieldname1 = 401; - int32 field_name2 = 402; - int32 _field_name3 = 403; - int32 field__name4_ = 404; - int32 field0name5 = 405; - int32 field_0_name6 = 406; - int32 fieldName7 = 407; - int32 FieldName8 = 408; - int32 field_Name9 = 409; - int32 Field_Name10 = 410; - int32 FIELD_NAME11 = 411; - int32 FIELD_name12 = 412; - int32 __field_name13 = 413; - int32 __Field_name14 = 414; - int32 field__name15 = 415; - int32 field__Name16 = 416; - int32 field_name17__ = 417; - int32 Field_name18__ = 418; -} - -message ForeignMessage { - int32 c = 1; -} - -enum ForeignEnum { - FOREIGN_FOO = 0; - FOREIGN_BAR = 1; - FOREIGN_BAZ = 2; -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/codec/codec.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/codec/codec.go deleted file mode 100644 index 91d10fe7f30..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/codec/codec.go +++ /dev/null @@ -1,91 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2015, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package codec - -import ( - "github.com/gogo/protobuf/proto" -) - -type Codec interface { - Marshal(v interface{}) ([]byte, error) - Unmarshal(data []byte, v interface{}) error - String() string -} - -type marshaler interface { - MarshalTo(data []byte) (n int, err error) -} - -func getSize(v interface{}) (int, bool) { - if sz, ok := v.(interface { - Size() (n int) - }); ok { - return sz.Size(), true - } else if sz, ok := v.(interface { - ProtoSize() (n int) - }); ok { - return sz.ProtoSize(), true - } else { - return 0, false - } -} - -type codec struct { - buf []byte -} - -func (this *codec) String() string { - return "proto" -} - -func New(size int) Codec { - return &codec{make([]byte, size)} -} - -func (this *codec) Marshal(v interface{}) ([]byte, error) { - if m, ok := v.(marshaler); ok { - n, ok := getSize(v) - if !ok { - return proto.Marshal(v.(proto.Message)) - } - if n > len(this.buf) { - this.buf = make([]byte, n) - } - _, err := m.MarshalTo(this.buf) - if err != nil { - return nil, err - } - return this.buf[:n], nil - } - return proto.Marshal(v.(proto.Message)) -} - -func (this *codec) Unmarshal(data []byte, v interface{}) error { - return proto.Unmarshal(data, v.(proto.Message)) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/doc.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/doc.go deleted file mode 100644 index 5ecfae11351..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/doc.go +++ /dev/null @@ -1,168 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -/* -Package gogoproto provides extensions for protocol buffers to achieve: - - - fast marshalling and unmarshalling. - - peace of mind by optionally generating test and benchmark code. - - more canonical Go structures. - - less typing by optionally generating extra helper code. - - goprotobuf compatibility - -More Canonical Go Structures - -A lot of time working with a goprotobuf struct will lead you to a place where you create another struct that is easier to work with and then have a function to copy the values between the two structs. -You might also find that basic structs that started their life as part of an API need to be sent over the wire. With gob, you could just send it. With goprotobuf, you need to make a parallel struct. -Gogoprotobuf tries to fix these problems with the nullable, embed, customtype and customname field extensions. - - - nullable, if false, a field is generated without a pointer (see warning below). - - embed, if true, the field is generated as an embedded field. - - customtype, It works with the Marshal and Unmarshal methods, to allow you to have your own types in your struct, but marshal to bytes. For example, custom.Uuid or custom.Fixed128 - - customname (beta), Changes the generated fieldname. This is especially useful when generated methods conflict with fieldnames. - - casttype (beta), Changes the generated fieldtype. All generated code assumes that this type is castable to the protocol buffer field type. It does not work for structs or enums. - - castkey (beta), Changes the generated fieldtype for a map key. All generated code assumes that this type is castable to the protocol buffer field type. Only supported on maps. - - castvalue (beta), Changes the generated fieldtype for a map value. All generated code assumes that this type is castable to the protocol buffer field type. Only supported on maps. - -Warning about nullable: According to the Protocol Buffer specification, you should be able to tell whether a field is set or unset. With the option nullable=false this feature is lost, since your non-nullable fields will always be set. It can be seen as a layer on top of Protocol Buffers, where before and after marshalling all non-nullable fields are set and they cannot be unset. - -Let us look at: - - github.com/gogo/protobuf/test/example/example.proto - -for a quicker overview. - -The following message: - - package test; - - import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - - message A { - optional string Description = 1 [(gogoproto.nullable) = false]; - optional int64 Number = 2 [(gogoproto.nullable) = false]; - optional bytes Id = 3 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uuid", (gogoproto.nullable) = false]; - } - -Will generate a go struct which looks a lot like this: - - type A struct { - Description string - Number int64 - Id github_com_gogo_protobuf_test_custom.Uuid - } - -You will see there are no pointers, since all fields are non-nullable. -You will also see a custom type which marshals to a string. -Be warned it is your responsibility to test your custom types thoroughly. -You should think of every possible empty and nil case for your marshaling, unmarshaling and size methods. - -Next we will embed the message A in message B. - - message B { - optional A A = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; - repeated bytes G = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false]; - } - -See below that A is embedded in B. - - type B struct { - A - G []github_com_gogo_protobuf_test_custom.Uint128 - } - -Also see the repeated custom type. - - type Uint128 [2]uint64 - -Next we will create a custom name for one of our fields. - - message C { - optional int64 size = 1 [(gogoproto.customname) = "MySize"]; - } - -See below that the field's name is MySize and not Size. - - type C struct { - MySize *int64 - } - -The is useful when having a protocol buffer message with a field name which conflicts with a generated method. -As an example, having a field name size and using the sizer plugin to generate a Size method will cause a go compiler error. -Using customname you can fix this error without changing the field name. -This is typically useful when working with a protocol buffer that was designed before these methods and/or the go language were avialable. - -Gogoprotobuf also has some more subtle changes, these could be changed back: - - - the generated package name for imports do not have the extra /filename.pb, - but are actually the imports specified in the .proto file. - -Gogoprotobuf also has lost some features which should be brought back with time: - - - Marshalling and unmarshalling with reflect and without the unsafe package, - this requires work in pointer_reflect.go - -Why does nullable break protocol buffer specifications: - -The protocol buffer specification states, somewhere, that you should be able to tell whether a -field is set or unset. With the option nullable=false this feature is lost, -since your non-nullable fields will always be set. It can be seen as a layer on top of -protocol buffers, where before and after marshalling all non-nullable fields are set -and they cannot be unset. - -Goprotobuf Compatibility: - -Gogoprotobuf is compatible with Goprotobuf, because it is compatible with protocol buffers. -Gogoprotobuf generates the same code as goprotobuf if no extensions are used. -The enumprefix, getters and stringer extensions can be used to remove some of the unnecessary code generated by goprotobuf: - - - gogoproto_import, if false, the generated code imports github.com/golang/protobuf/proto instead of github.com/gogo/protobuf/proto. - - goproto_enum_prefix, if false, generates the enum constant names without the messagetype prefix - - goproto_enum_stringer (experimental), if false, the enum is generated without the default string method, this is useful for rather using enum_stringer, or allowing you to write your own string method. - - goproto_getters, if false, the message is generated without get methods, this is useful when you would rather want to use face - - goproto_stringer, if false, the message is generated without the default string method, this is useful for rather using stringer, or allowing you to write your own string method. - - goproto_extensions_map (beta), if false, the extensions field is generated as type []byte instead of type map[int32]proto.Extension - - goproto_unrecognized (beta), if false, XXX_unrecognized field is not generated. This is useful in conjunction with gogoproto.nullable=false, to generate structures completely devoid of pointers and reduce GC pressure at the cost of losing information about unrecognized fields. - -Less Typing and Peace of Mind is explained in their specific plugin folders godoc: - - - github.com/gogo/protobuf/plugin/ - -If you do not use any of these extension the code that is generated -will be the same as if goprotobuf has generated it. - -The most complete way to see examples is to look at - - github.com/gogo/protobuf/test/thetest.proto - -Gogoprototest is a seperate project, -because we want to keep gogoprotobuf independant of goprotobuf, -but we still want to test it thoroughly. - -*/ -package gogoproto diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/gogo.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/gogo.pb.go deleted file mode 100644 index d88ba80131e..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/gogo.pb.go +++ /dev/null @@ -1,749 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: gogo.proto -// DO NOT EDIT! - -/* -Package gogoproto is a generated protocol buffer package. - -It is generated from these files: - gogo.proto - -It has these top-level messages: -*/ -package gogoproto - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import google_protobuf "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -var E_GoprotoEnumPrefix = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.EnumOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 62001, - Name: "gogoproto.goproto_enum_prefix", - Tag: "varint,62001,opt,name=goproto_enum_prefix,json=goprotoEnumPrefix", - Filename: "gogo.proto", -} - -var E_GoprotoEnumStringer = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.EnumOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 62021, - Name: "gogoproto.goproto_enum_stringer", - Tag: "varint,62021,opt,name=goproto_enum_stringer,json=goprotoEnumStringer", - Filename: "gogo.proto", -} - -var E_EnumStringer = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.EnumOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 62022, - Name: "gogoproto.enum_stringer", - Tag: "varint,62022,opt,name=enum_stringer,json=enumStringer", - Filename: "gogo.proto", -} - -var E_EnumCustomname = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.EnumOptions)(nil), - ExtensionType: (*string)(nil), - Field: 62023, - Name: "gogoproto.enum_customname", - Tag: "bytes,62023,opt,name=enum_customname,json=enumCustomname", - Filename: "gogo.proto", -} - -var E_EnumvalueCustomname = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.EnumValueOptions)(nil), - ExtensionType: (*string)(nil), - Field: 66001, - Name: "gogoproto.enumvalue_customname", - Tag: "bytes,66001,opt,name=enumvalue_customname,json=enumvalueCustomname", - Filename: "gogo.proto", -} - -var E_GoprotoGettersAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63001, - Name: "gogoproto.goproto_getters_all", - Tag: "varint,63001,opt,name=goproto_getters_all,json=goprotoGettersAll", - Filename: "gogo.proto", -} - -var E_GoprotoEnumPrefixAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63002, - Name: "gogoproto.goproto_enum_prefix_all", - Tag: "varint,63002,opt,name=goproto_enum_prefix_all,json=goprotoEnumPrefixAll", - Filename: "gogo.proto", -} - -var E_GoprotoStringerAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63003, - Name: "gogoproto.goproto_stringer_all", - Tag: "varint,63003,opt,name=goproto_stringer_all,json=goprotoStringerAll", - Filename: "gogo.proto", -} - -var E_VerboseEqualAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63004, - Name: "gogoproto.verbose_equal_all", - Tag: "varint,63004,opt,name=verbose_equal_all,json=verboseEqualAll", - Filename: "gogo.proto", -} - -var E_FaceAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63005, - Name: "gogoproto.face_all", - Tag: "varint,63005,opt,name=face_all,json=faceAll", - Filename: "gogo.proto", -} - -var E_GostringAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63006, - Name: "gogoproto.gostring_all", - Tag: "varint,63006,opt,name=gostring_all,json=gostringAll", - Filename: "gogo.proto", -} - -var E_PopulateAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63007, - Name: "gogoproto.populate_all", - Tag: "varint,63007,opt,name=populate_all,json=populateAll", - Filename: "gogo.proto", -} - -var E_StringerAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63008, - Name: "gogoproto.stringer_all", - Tag: "varint,63008,opt,name=stringer_all,json=stringerAll", - Filename: "gogo.proto", -} - -var E_OnlyoneAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63009, - Name: "gogoproto.onlyone_all", - Tag: "varint,63009,opt,name=onlyone_all,json=onlyoneAll", - Filename: "gogo.proto", -} - -var E_EqualAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63013, - Name: "gogoproto.equal_all", - Tag: "varint,63013,opt,name=equal_all,json=equalAll", - Filename: "gogo.proto", -} - -var E_DescriptionAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63014, - Name: "gogoproto.description_all", - Tag: "varint,63014,opt,name=description_all,json=descriptionAll", - Filename: "gogo.proto", -} - -var E_TestgenAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63015, - Name: "gogoproto.testgen_all", - Tag: "varint,63015,opt,name=testgen_all,json=testgenAll", - Filename: "gogo.proto", -} - -var E_BenchgenAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63016, - Name: "gogoproto.benchgen_all", - Tag: "varint,63016,opt,name=benchgen_all,json=benchgenAll", - Filename: "gogo.proto", -} - -var E_MarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63017, - Name: "gogoproto.marshaler_all", - Tag: "varint,63017,opt,name=marshaler_all,json=marshalerAll", - Filename: "gogo.proto", -} - -var E_UnmarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63018, - Name: "gogoproto.unmarshaler_all", - Tag: "varint,63018,opt,name=unmarshaler_all,json=unmarshalerAll", - Filename: "gogo.proto", -} - -var E_StableMarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63019, - Name: "gogoproto.stable_marshaler_all", - Tag: "varint,63019,opt,name=stable_marshaler_all,json=stableMarshalerAll", - Filename: "gogo.proto", -} - -var E_SizerAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63020, - Name: "gogoproto.sizer_all", - Tag: "varint,63020,opt,name=sizer_all,json=sizerAll", - Filename: "gogo.proto", -} - -var E_GoprotoEnumStringerAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63021, - Name: "gogoproto.goproto_enum_stringer_all", - Tag: "varint,63021,opt,name=goproto_enum_stringer_all,json=goprotoEnumStringerAll", - Filename: "gogo.proto", -} - -var E_EnumStringerAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63022, - Name: "gogoproto.enum_stringer_all", - Tag: "varint,63022,opt,name=enum_stringer_all,json=enumStringerAll", - Filename: "gogo.proto", -} - -var E_UnsafeMarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63023, - Name: "gogoproto.unsafe_marshaler_all", - Tag: "varint,63023,opt,name=unsafe_marshaler_all,json=unsafeMarshalerAll", - Filename: "gogo.proto", -} - -var E_UnsafeUnmarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63024, - Name: "gogoproto.unsafe_unmarshaler_all", - Tag: "varint,63024,opt,name=unsafe_unmarshaler_all,json=unsafeUnmarshalerAll", - Filename: "gogo.proto", -} - -var E_GoprotoExtensionsMapAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63025, - Name: "gogoproto.goproto_extensions_map_all", - Tag: "varint,63025,opt,name=goproto_extensions_map_all,json=goprotoExtensionsMapAll", - Filename: "gogo.proto", -} - -var E_GoprotoUnrecognizedAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63026, - Name: "gogoproto.goproto_unrecognized_all", - Tag: "varint,63026,opt,name=goproto_unrecognized_all,json=goprotoUnrecognizedAll", - Filename: "gogo.proto", -} - -var E_GogoprotoImport = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63027, - Name: "gogoproto.gogoproto_import", - Tag: "varint,63027,opt,name=gogoproto_import,json=gogoprotoImport", - Filename: "gogo.proto", -} - -var E_ProtosizerAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63028, - Name: "gogoproto.protosizer_all", - Tag: "varint,63028,opt,name=protosizer_all,json=protosizerAll", - Filename: "gogo.proto", -} - -var E_CompareAll = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63029, - Name: "gogoproto.compare_all", - Tag: "varint,63029,opt,name=compare_all,json=compareAll", - Filename: "gogo.proto", -} - -var E_GoprotoGetters = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64001, - Name: "gogoproto.goproto_getters", - Tag: "varint,64001,opt,name=goproto_getters,json=goprotoGetters", - Filename: "gogo.proto", -} - -var E_GoprotoStringer = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64003, - Name: "gogoproto.goproto_stringer", - Tag: "varint,64003,opt,name=goproto_stringer,json=goprotoStringer", - Filename: "gogo.proto", -} - -var E_VerboseEqual = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64004, - Name: "gogoproto.verbose_equal", - Tag: "varint,64004,opt,name=verbose_equal,json=verboseEqual", - Filename: "gogo.proto", -} - -var E_Face = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64005, - Name: "gogoproto.face", - Tag: "varint,64005,opt,name=face", - Filename: "gogo.proto", -} - -var E_Gostring = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64006, - Name: "gogoproto.gostring", - Tag: "varint,64006,opt,name=gostring", - Filename: "gogo.proto", -} - -var E_Populate = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64007, - Name: "gogoproto.populate", - Tag: "varint,64007,opt,name=populate", - Filename: "gogo.proto", -} - -var E_Stringer = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 67008, - Name: "gogoproto.stringer", - Tag: "varint,67008,opt,name=stringer", - Filename: "gogo.proto", -} - -var E_Onlyone = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64009, - Name: "gogoproto.onlyone", - Tag: "varint,64009,opt,name=onlyone", - Filename: "gogo.proto", -} - -var E_Equal = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64013, - Name: "gogoproto.equal", - Tag: "varint,64013,opt,name=equal", - Filename: "gogo.proto", -} - -var E_Description = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64014, - Name: "gogoproto.description", - Tag: "varint,64014,opt,name=description", - Filename: "gogo.proto", -} - -var E_Testgen = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64015, - Name: "gogoproto.testgen", - Tag: "varint,64015,opt,name=testgen", - Filename: "gogo.proto", -} - -var E_Benchgen = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64016, - Name: "gogoproto.benchgen", - Tag: "varint,64016,opt,name=benchgen", - Filename: "gogo.proto", -} - -var E_Marshaler = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64017, - Name: "gogoproto.marshaler", - Tag: "varint,64017,opt,name=marshaler", - Filename: "gogo.proto", -} - -var E_Unmarshaler = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64018, - Name: "gogoproto.unmarshaler", - Tag: "varint,64018,opt,name=unmarshaler", - Filename: "gogo.proto", -} - -var E_StableMarshaler = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64019, - Name: "gogoproto.stable_marshaler", - Tag: "varint,64019,opt,name=stable_marshaler,json=stableMarshaler", - Filename: "gogo.proto", -} - -var E_Sizer = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64020, - Name: "gogoproto.sizer", - Tag: "varint,64020,opt,name=sizer", - Filename: "gogo.proto", -} - -var E_UnsafeMarshaler = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64023, - Name: "gogoproto.unsafe_marshaler", - Tag: "varint,64023,opt,name=unsafe_marshaler,json=unsafeMarshaler", - Filename: "gogo.proto", -} - -var E_UnsafeUnmarshaler = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64024, - Name: "gogoproto.unsafe_unmarshaler", - Tag: "varint,64024,opt,name=unsafe_unmarshaler,json=unsafeUnmarshaler", - Filename: "gogo.proto", -} - -var E_GoprotoExtensionsMap = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64025, - Name: "gogoproto.goproto_extensions_map", - Tag: "varint,64025,opt,name=goproto_extensions_map,json=goprotoExtensionsMap", - Filename: "gogo.proto", -} - -var E_GoprotoUnrecognized = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64026, - Name: "gogoproto.goproto_unrecognized", - Tag: "varint,64026,opt,name=goproto_unrecognized,json=goprotoUnrecognized", - Filename: "gogo.proto", -} - -var E_Protosizer = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64028, - Name: "gogoproto.protosizer", - Tag: "varint,64028,opt,name=protosizer", - Filename: "gogo.proto", -} - -var E_Compare = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64029, - Name: "gogoproto.compare", - Tag: "varint,64029,opt,name=compare", - Filename: "gogo.proto", -} - -var E_Nullable = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65001, - Name: "gogoproto.nullable", - Tag: "varint,65001,opt,name=nullable", - Filename: "gogo.proto", -} - -var E_Embed = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65002, - Name: "gogoproto.embed", - Tag: "varint,65002,opt,name=embed", - Filename: "gogo.proto", -} - -var E_Customtype = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65003, - Name: "gogoproto.customtype", - Tag: "bytes,65003,opt,name=customtype", - Filename: "gogo.proto", -} - -var E_Customname = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65004, - Name: "gogoproto.customname", - Tag: "bytes,65004,opt,name=customname", - Filename: "gogo.proto", -} - -var E_Jsontag = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65005, - Name: "gogoproto.jsontag", - Tag: "bytes,65005,opt,name=jsontag", - Filename: "gogo.proto", -} - -var E_Moretags = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65006, - Name: "gogoproto.moretags", - Tag: "bytes,65006,opt,name=moretags", - Filename: "gogo.proto", -} - -var E_Casttype = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65007, - Name: "gogoproto.casttype", - Tag: "bytes,65007,opt,name=casttype", - Filename: "gogo.proto", -} - -var E_Castkey = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65008, - Name: "gogoproto.castkey", - Tag: "bytes,65008,opt,name=castkey", - Filename: "gogo.proto", -} - -var E_Castvalue = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65009, - Name: "gogoproto.castvalue", - Tag: "bytes,65009,opt,name=castvalue", - Filename: "gogo.proto", -} - -var E_Stdtime = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65010, - Name: "gogoproto.stdtime", - Tag: "varint,65010,opt,name=stdtime", - Filename: "gogo.proto", -} - -var E_Stdduration = &proto.ExtensionDesc{ - ExtendedType: (*google_protobuf.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65011, - Name: "gogoproto.stdduration", - Tag: "varint,65011,opt,name=stdduration", - Filename: "gogo.proto", -} - -func init() { - proto.RegisterExtension(E_GoprotoEnumPrefix) - proto.RegisterExtension(E_GoprotoEnumStringer) - proto.RegisterExtension(E_EnumStringer) - proto.RegisterExtension(E_EnumCustomname) - proto.RegisterExtension(E_EnumvalueCustomname) - proto.RegisterExtension(E_GoprotoGettersAll) - proto.RegisterExtension(E_GoprotoEnumPrefixAll) - proto.RegisterExtension(E_GoprotoStringerAll) - proto.RegisterExtension(E_VerboseEqualAll) - proto.RegisterExtension(E_FaceAll) - proto.RegisterExtension(E_GostringAll) - proto.RegisterExtension(E_PopulateAll) - proto.RegisterExtension(E_StringerAll) - proto.RegisterExtension(E_OnlyoneAll) - proto.RegisterExtension(E_EqualAll) - proto.RegisterExtension(E_DescriptionAll) - proto.RegisterExtension(E_TestgenAll) - proto.RegisterExtension(E_BenchgenAll) - proto.RegisterExtension(E_MarshalerAll) - proto.RegisterExtension(E_UnmarshalerAll) - proto.RegisterExtension(E_StableMarshalerAll) - proto.RegisterExtension(E_SizerAll) - proto.RegisterExtension(E_GoprotoEnumStringerAll) - proto.RegisterExtension(E_EnumStringerAll) - proto.RegisterExtension(E_UnsafeMarshalerAll) - proto.RegisterExtension(E_UnsafeUnmarshalerAll) - proto.RegisterExtension(E_GoprotoExtensionsMapAll) - proto.RegisterExtension(E_GoprotoUnrecognizedAll) - proto.RegisterExtension(E_GogoprotoImport) - proto.RegisterExtension(E_ProtosizerAll) - proto.RegisterExtension(E_CompareAll) - proto.RegisterExtension(E_GoprotoGetters) - proto.RegisterExtension(E_GoprotoStringer) - proto.RegisterExtension(E_VerboseEqual) - proto.RegisterExtension(E_Face) - proto.RegisterExtension(E_Gostring) - proto.RegisterExtension(E_Populate) - proto.RegisterExtension(E_Stringer) - proto.RegisterExtension(E_Onlyone) - proto.RegisterExtension(E_Equal) - proto.RegisterExtension(E_Description) - proto.RegisterExtension(E_Testgen) - proto.RegisterExtension(E_Benchgen) - proto.RegisterExtension(E_Marshaler) - proto.RegisterExtension(E_Unmarshaler) - proto.RegisterExtension(E_StableMarshaler) - proto.RegisterExtension(E_Sizer) - proto.RegisterExtension(E_UnsafeMarshaler) - proto.RegisterExtension(E_UnsafeUnmarshaler) - proto.RegisterExtension(E_GoprotoExtensionsMap) - proto.RegisterExtension(E_GoprotoUnrecognized) - proto.RegisterExtension(E_Protosizer) - proto.RegisterExtension(E_Compare) - proto.RegisterExtension(E_Nullable) - proto.RegisterExtension(E_Embed) - proto.RegisterExtension(E_Customtype) - proto.RegisterExtension(E_Customname) - proto.RegisterExtension(E_Jsontag) - proto.RegisterExtension(E_Moretags) - proto.RegisterExtension(E_Casttype) - proto.RegisterExtension(E_Castkey) - proto.RegisterExtension(E_Castvalue) - proto.RegisterExtension(E_Stdtime) - proto.RegisterExtension(E_Stdduration) -} - -func init() { proto.RegisterFile("gogo.proto", fileDescriptorGogo) } - -var fileDescriptorGogo = []byte{ - // 1129 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x97, 0xc9, 0x6f, 0x1c, 0x45, - 0x14, 0x87, 0x85, 0x70, 0x64, 0xcf, 0xf3, 0x86, 0xc7, 0xc6, 0x84, 0x08, 0x44, 0x72, 0xe3, 0xe4, - 0x9c, 0x22, 0x94, 0xb2, 0x22, 0xcb, 0xb1, 0x9c, 0x51, 0x10, 0x86, 0x91, 0x89, 0x03, 0x88, 0xc3, - 0xa8, 0x67, 0xa6, 0xdc, 0x69, 0xe8, 0xee, 0x6a, 0xba, 0xaa, 0xa3, 0x38, 0x37, 0x14, 0x16, 0x21, - 0xc4, 0x8e, 0x04, 0x09, 0x09, 0xcb, 0x81, 0x7d, 0x0d, 0xcb, 0x9d, 0x0b, 0x70, 0xe6, 0x7f, 0xe0, - 0x02, 0x84, 0xdd, 0x37, 0x5f, 0x50, 0x75, 0xbf, 0xd7, 0x53, 0xdd, 0x1e, 0xa9, 0x6a, 0x6e, 0xe3, - 0x71, 0x7d, 0xdf, 0x54, 0xbf, 0x37, 0xf5, 0x7e, 0x53, 0x00, 0xbe, 0xf0, 0xc5, 0x52, 0x92, 0x0a, - 0x25, 0x9a, 0x0d, 0xfd, 0x3a, 0x7f, 0x79, 0xe8, 0xb0, 0x2f, 0x84, 0x1f, 0xf2, 0xa3, 0xf9, 0x5f, - 0xdd, 0x6c, 0xfb, 0x68, 0x9f, 0xcb, 0x5e, 0x1a, 0x24, 0x4a, 0xa4, 0xc5, 0x62, 0x76, 0x3f, 0xcc, - 0xe3, 0xe2, 0x0e, 0x8f, 0xb3, 0xa8, 0x93, 0xa4, 0x7c, 0x3b, 0xb8, 0xd0, 0xbc, 0x63, 0xa9, 0x20, - 0x97, 0x88, 0x5c, 0x5a, 0x8f, 0xb3, 0xe8, 0x81, 0x44, 0x05, 0x22, 0x96, 0x07, 0xaf, 0xff, 0x72, - 0xf3, 0xe1, 0x9b, 0xee, 0x9e, 0xd8, 0x9c, 0x43, 0x54, 0xff, 0xaf, 0x9d, 0x83, 0x6c, 0x13, 0x6e, - 0xad, 0xf8, 0xa4, 0x4a, 0x83, 0xd8, 0xe7, 0xa9, 0xc5, 0xf8, 0x03, 0x1a, 0xe7, 0x0d, 0xe3, 0x83, - 0x88, 0xb2, 0x35, 0x98, 0x1e, 0xc5, 0xf5, 0x23, 0xba, 0xa6, 0xb8, 0x29, 0x69, 0xc1, 0x6c, 0x2e, - 0xe9, 0x65, 0x52, 0x89, 0x28, 0xf6, 0x22, 0x6e, 0xd1, 0xfc, 0x94, 0x6b, 0x1a, 0x9b, 0x33, 0x1a, - 0x5b, 0x2b, 0x29, 0x76, 0x16, 0x16, 0xf4, 0x3b, 0xe7, 0xbd, 0x30, 0xe3, 0xa6, 0xed, 0xc8, 0x50, - 0xdb, 0x59, 0xbd, 0x8c, 0x94, 0x3f, 0x5f, 0x1a, 0xcb, 0x95, 0xf3, 0xa5, 0xc0, 0xf0, 0x1a, 0x9d, - 0xf0, 0xb9, 0x52, 0x3c, 0x95, 0x1d, 0x2f, 0x0c, 0x87, 0x6c, 0xf2, 0x54, 0x10, 0x96, 0xc6, 0xcb, - 0x37, 0xaa, 0x9d, 0x68, 0x15, 0xe4, 0x6a, 0x18, 0xb2, 0x2d, 0xb8, 0x6d, 0x48, 0x67, 0x1d, 0x9c, - 0x57, 0xd0, 0xb9, 0xb0, 0xaf, 0xbb, 0x5a, 0xdb, 0x06, 0x7a, 0xbf, 0xec, 0x87, 0x83, 0xf3, 0x2d, - 0x74, 0x36, 0x91, 0xa5, 0xb6, 0x68, 0xe3, 0xbd, 0x30, 0x77, 0x9e, 0xa7, 0x5d, 0x21, 0x79, 0x87, - 0x3f, 0x91, 0x79, 0xa1, 0x83, 0xee, 0x2a, 0xea, 0x66, 0x11, 0x5c, 0xd7, 0x9c, 0x76, 0x1d, 0x87, - 0x89, 0x6d, 0xaf, 0xc7, 0x1d, 0x14, 0xd7, 0x50, 0x31, 0xae, 0xd7, 0x6b, 0x74, 0x15, 0xa6, 0x7c, - 0x51, 0x3c, 0x92, 0x03, 0xfe, 0x36, 0xe2, 0x93, 0xc4, 0xa0, 0x22, 0x11, 0x49, 0x16, 0x7a, 0xca, - 0x65, 0x07, 0xef, 0x90, 0x82, 0x18, 0x54, 0x8c, 0x50, 0xd6, 0x77, 0x49, 0x21, 0x8d, 0x7a, 0xae, - 0xc0, 0xa4, 0x88, 0xc3, 0x1d, 0x11, 0xbb, 0x6c, 0xe2, 0x3d, 0x34, 0x00, 0x22, 0x5a, 0xb0, 0x0c, - 0x0d, 0xd7, 0x46, 0xbc, 0x8f, 0xf8, 0x04, 0xa7, 0x0e, 0xb4, 0x60, 0x96, 0x86, 0x4c, 0x20, 0x62, - 0x07, 0xc5, 0x07, 0xa8, 0x98, 0x31, 0x30, 0x7c, 0x0c, 0xc5, 0xa5, 0xf2, 0xb9, 0x8b, 0xe4, 0x43, - 0x7a, 0x0c, 0x44, 0xb0, 0x94, 0x5d, 0x1e, 0xf7, 0xce, 0xb9, 0x19, 0x3e, 0xa2, 0x52, 0x12, 0xa3, - 0x15, 0x6b, 0x30, 0x1d, 0x79, 0xa9, 0x3c, 0xe7, 0x85, 0x4e, 0xed, 0xf8, 0x18, 0x1d, 0x53, 0x25, - 0x84, 0x15, 0xc9, 0xe2, 0x51, 0x34, 0x9f, 0x50, 0x45, 0x0c, 0x0c, 0x8f, 0x9e, 0x54, 0x5e, 0x37, - 0xe4, 0x9d, 0x51, 0x6c, 0x9f, 0xd2, 0xd1, 0x2b, 0xd8, 0x0d, 0xd3, 0xb8, 0x0c, 0x0d, 0x19, 0x5c, - 0x74, 0xd2, 0x7c, 0x46, 0x9d, 0xce, 0x01, 0x0d, 0x3f, 0x02, 0xb7, 0x0f, 0x1d, 0xf5, 0x0e, 0xb2, - 0xcf, 0x51, 0xb6, 0x38, 0x64, 0xdc, 0xe3, 0x48, 0x18, 0x55, 0xf9, 0x05, 0x8d, 0x04, 0x5e, 0x73, - 0xb5, 0x61, 0x21, 0x8b, 0xa5, 0xb7, 0x3d, 0x5a, 0xd5, 0xbe, 0xa4, 0xaa, 0x15, 0x6c, 0xa5, 0x6a, - 0x67, 0x60, 0x11, 0x8d, 0xa3, 0xf5, 0xf5, 0x2b, 0x1a, 0xac, 0x05, 0xbd, 0x55, 0xed, 0xee, 0xa3, - 0x70, 0xa8, 0x2c, 0xe7, 0x05, 0xc5, 0x63, 0xa9, 0x99, 0x4e, 0xe4, 0x25, 0x0e, 0xe6, 0xeb, 0x68, - 0xa6, 0x89, 0xbf, 0x5e, 0x0a, 0x36, 0xbc, 0x44, 0xcb, 0x1f, 0x86, 0x83, 0x24, 0xcf, 0xe2, 0x94, - 0xf7, 0x84, 0x1f, 0x07, 0x17, 0x79, 0xdf, 0x41, 0xfd, 0x75, 0xad, 0x55, 0x5b, 0x06, 0xae, 0xcd, - 0xa7, 0xe1, 0x96, 0xf2, 0xf7, 0x46, 0x27, 0x88, 0x12, 0x91, 0x2a, 0x8b, 0xf1, 0x1b, 0xea, 0x54, - 0xc9, 0x9d, 0xce, 0x31, 0xb6, 0x0e, 0x33, 0xf9, 0x9f, 0xae, 0x5f, 0xc9, 0x6f, 0x51, 0x34, 0x3d, - 0xa0, 0x70, 0x70, 0xf4, 0x44, 0x94, 0x78, 0xa9, 0xcb, 0xfc, 0xfb, 0x8e, 0x06, 0x07, 0x22, 0xc5, - 0xb7, 0x6f, 0xb6, 0x96, 0xc4, 0xcd, 0xbb, 0xf6, 0x49, 0x36, 0xb8, 0x94, 0x9e, 0x5f, 0x7a, 0x9e, - 0xdc, 0xc5, 0x33, 0x5b, 0x0d, 0x62, 0x76, 0x9f, 0x2e, 0x4f, 0x35, 0x2e, 0xed, 0xb2, 0x4b, 0xbb, - 0x65, 0x85, 0x2a, 0x69, 0xc9, 0x4e, 0xc1, 0x74, 0x25, 0x2a, 0xed, 0xaa, 0xa7, 0x50, 0x35, 0x65, - 0x26, 0x25, 0x3b, 0x06, 0x63, 0x3a, 0xf6, 0xec, 0xf8, 0xd3, 0x88, 0xe7, 0xcb, 0xd9, 0x09, 0x98, - 0xa0, 0xb8, 0xb3, 0xa3, 0xcf, 0x20, 0x5a, 0x22, 0x1a, 0xa7, 0xa8, 0xb3, 0xe3, 0xcf, 0x12, 0x4e, - 0x88, 0xc6, 0xdd, 0x4b, 0xf8, 0xfd, 0xf3, 0x63, 0x38, 0xae, 0xa8, 0x76, 0xcb, 0x30, 0x8e, 0x19, - 0x67, 0xa7, 0x9f, 0xc3, 0x0f, 0x27, 0x82, 0xdd, 0x03, 0x07, 0x1c, 0x0b, 0xfe, 0x02, 0xa2, 0xc5, - 0x7a, 0xb6, 0x06, 0x93, 0x46, 0xae, 0xd9, 0xf1, 0x17, 0x11, 0x37, 0x29, 0xbd, 0x75, 0xcc, 0x35, - 0xbb, 0xe0, 0x25, 0xda, 0x3a, 0x12, 0xba, 0x6c, 0x14, 0x69, 0x76, 0xfa, 0x65, 0xaa, 0x3a, 0x21, - 0x6c, 0x05, 0x1a, 0xe5, 0x98, 0xb2, 0xf3, 0xaf, 0x20, 0x3f, 0x60, 0x74, 0x05, 0x8c, 0x31, 0x69, - 0x57, 0xbc, 0x4a, 0x15, 0x30, 0x28, 0x7d, 0x8c, 0xea, 0xd1, 0x67, 0x37, 0xbd, 0x46, 0xc7, 0xa8, - 0x96, 0x7c, 0xba, 0x9b, 0xf9, 0xb4, 0xb0, 0x2b, 0x5e, 0xa7, 0x6e, 0xe6, 0xeb, 0xf5, 0x36, 0xea, - 0x59, 0x62, 0x77, 0xbc, 0x41, 0xdb, 0xa8, 0x45, 0x09, 0x6b, 0x43, 0x73, 0x7f, 0x8e, 0xd8, 0x7d, - 0x6f, 0xa2, 0x6f, 0x6e, 0x5f, 0x8c, 0xb0, 0x87, 0x60, 0x71, 0x78, 0x86, 0xd8, 0xad, 0x97, 0x77, - 0x6b, 0xbf, 0xfa, 0xcd, 0x08, 0x61, 0x67, 0x06, 0xbf, 0xfa, 0xcd, 0xfc, 0xb0, 0x6b, 0xaf, 0xec, - 0x56, 0x2f, 0x76, 0x66, 0x7c, 0xb0, 0x55, 0x80, 0xc1, 0xe8, 0xb6, 0xbb, 0xae, 0xa2, 0xcb, 0x80, - 0xf4, 0xd1, 0xc0, 0xc9, 0x6d, 0xe7, 0xaf, 0xd1, 0xd1, 0x40, 0x82, 0x2d, 0xc3, 0x44, 0x9c, 0x85, - 0xa1, 0xfe, 0x72, 0x34, 0xef, 0x1c, 0x12, 0x13, 0x3c, 0xec, 0x13, 0xfb, 0xeb, 0x1e, 0x1e, 0x0c, - 0x02, 0xd8, 0x31, 0x38, 0xc0, 0xa3, 0x2e, 0xef, 0xdb, 0xc8, 0xdf, 0xf6, 0x68, 0x20, 0xe8, 0xd5, - 0x6c, 0x05, 0xa0, 0xb8, 0x34, 0xaa, 0x9d, 0xc4, 0xfa, 0xa9, 0xbf, 0xef, 0x15, 0x77, 0x50, 0x03, - 0x19, 0x08, 0xf2, 0x5b, 0xa7, 0x45, 0x70, 0xa3, 0x2a, 0xc8, 0x2f, 0x9a, 0xc7, 0x61, 0xfc, 0x31, - 0x29, 0x62, 0xe5, 0xf9, 0x36, 0xfa, 0x0f, 0xa4, 0x69, 0xbd, 0x2e, 0x58, 0x24, 0x52, 0xae, 0x3c, - 0x5f, 0xda, 0xd8, 0x3f, 0x91, 0x2d, 0x01, 0x0d, 0xf7, 0x3c, 0xa9, 0x5c, 0x9e, 0xfb, 0x2f, 0x82, - 0x09, 0xd0, 0x9b, 0xd6, 0xaf, 0x1f, 0xe7, 0x3b, 0x36, 0xf6, 0x6f, 0xda, 0x34, 0xae, 0x67, 0x27, - 0xa0, 0xa1, 0x5f, 0xe6, 0xf7, 0x6d, 0x1b, 0xfc, 0x0f, 0xc2, 0x03, 0x42, 0x7f, 0xb2, 0x54, 0x7d, - 0x15, 0xd8, 0x8b, 0xfd, 0x2f, 0x76, 0x9a, 0xd6, 0xb3, 0x55, 0x98, 0x94, 0xaa, 0xdf, 0xcf, 0x52, - 0x2f, 0x1f, 0xfe, 0x16, 0xfc, 0xbf, 0xbd, 0xf2, 0x32, 0x57, 0x32, 0x27, 0x8f, 0xc0, 0x7c, 0x4f, - 0x44, 0x75, 0xf0, 0x24, 0xb4, 0x44, 0x4b, 0xb4, 0xf3, 0x63, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x3f, 0x9b, 0x2b, 0x54, 0xfc, 0x11, 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/gogo.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/gogo.proto deleted file mode 100644 index 0da211a8e3e..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/gogo.proto +++ /dev/null @@ -1,125 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -syntax = "proto2"; -package gogoproto; - -import "google/protobuf/descriptor.proto"; - -option java_package = "com.google.protobuf"; -option java_outer_classname = "GoGoProtos"; - -extend google.protobuf.EnumOptions { - optional bool goproto_enum_prefix = 62001; - optional bool goproto_enum_stringer = 62021; - optional bool enum_stringer = 62022; - optional string enum_customname = 62023; -} - -extend google.protobuf.EnumValueOptions { - optional string enumvalue_customname = 66001; -} - -extend google.protobuf.FileOptions { - optional bool goproto_getters_all = 63001; - optional bool goproto_enum_prefix_all = 63002; - optional bool goproto_stringer_all = 63003; - optional bool verbose_equal_all = 63004; - optional bool face_all = 63005; - optional bool gostring_all = 63006; - optional bool populate_all = 63007; - optional bool stringer_all = 63008; - optional bool onlyone_all = 63009; - - optional bool equal_all = 63013; - optional bool description_all = 63014; - optional bool testgen_all = 63015; - optional bool benchgen_all = 63016; - optional bool marshaler_all = 63017; - optional bool unmarshaler_all = 63018; - optional bool stable_marshaler_all = 63019; - - optional bool sizer_all = 63020; - - optional bool goproto_enum_stringer_all = 63021; - optional bool enum_stringer_all = 63022; - - optional bool unsafe_marshaler_all = 63023; - optional bool unsafe_unmarshaler_all = 63024; - - optional bool goproto_extensions_map_all = 63025; - optional bool goproto_unrecognized_all = 63026; - optional bool gogoproto_import = 63027; - optional bool protosizer_all = 63028; - optional bool compare_all = 63029; -} - -extend google.protobuf.MessageOptions { - optional bool goproto_getters = 64001; - optional bool goproto_stringer = 64003; - optional bool verbose_equal = 64004; - optional bool face = 64005; - optional bool gostring = 64006; - optional bool populate = 64007; - optional bool stringer = 67008; - optional bool onlyone = 64009; - - optional bool equal = 64013; - optional bool description = 64014; - optional bool testgen = 64015; - optional bool benchgen = 64016; - optional bool marshaler = 64017; - optional bool unmarshaler = 64018; - optional bool stable_marshaler = 64019; - - optional bool sizer = 64020; - - optional bool unsafe_marshaler = 64023; - optional bool unsafe_unmarshaler = 64024; - - optional bool goproto_extensions_map = 64025; - optional bool goproto_unrecognized = 64026; - - optional bool protosizer = 64028; - optional bool compare = 64029; -} - -extend google.protobuf.FieldOptions { - optional bool nullable = 65001; - optional bool embed = 65002; - optional string customtype = 65003; - optional string customname = 65004; - optional string jsontag = 65005; - optional string moretags = 65006; - optional string casttype = 65007; - optional string castkey = 65008; - optional string castvalue = 65009; - - optional bool stdtime = 65010; - optional bool stdduration = 65011; -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/helper.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/helper.go deleted file mode 100644 index bb5fff48b5e..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoproto/helper.go +++ /dev/null @@ -1,345 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package gogoproto - -import google_protobuf "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" -import proto "github.com/gogo/protobuf/proto" - -func IsEmbed(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Embed, false) -} - -func IsNullable(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Nullable, true) -} - -func IsStdTime(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Stdtime, false) -} - -func IsStdDuration(field *google_protobuf.FieldDescriptorProto) bool { - return proto.GetBoolExtension(field.Options, E_Stdduration, false) -} - -func NeedsNilCheck(proto3 bool, field *google_protobuf.FieldDescriptorProto) bool { - nullable := IsNullable(field) - if field.IsMessage() || IsCustomType(field) { - return nullable - } - if proto3 { - return false - } - return nullable || *field.Type == google_protobuf.FieldDescriptorProto_TYPE_BYTES -} - -func IsCustomType(field *google_protobuf.FieldDescriptorProto) bool { - typ := GetCustomType(field) - if len(typ) > 0 { - return true - } - return false -} - -func IsCastType(field *google_protobuf.FieldDescriptorProto) bool { - typ := GetCastType(field) - if len(typ) > 0 { - return true - } - return false -} - -func IsCastKey(field *google_protobuf.FieldDescriptorProto) bool { - typ := GetCastKey(field) - if len(typ) > 0 { - return true - } - return false -} - -func IsCastValue(field *google_protobuf.FieldDescriptorProto) bool { - typ := GetCastValue(field) - if len(typ) > 0 { - return true - } - return false -} - -func GetCustomType(field *google_protobuf.FieldDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Customtype) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetCastType(field *google_protobuf.FieldDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Casttype) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetCastKey(field *google_protobuf.FieldDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Castkey) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetCastValue(field *google_protobuf.FieldDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Castvalue) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func IsCustomName(field *google_protobuf.FieldDescriptorProto) bool { - name := GetCustomName(field) - if len(name) > 0 { - return true - } - return false -} - -func IsEnumCustomName(field *google_protobuf.EnumDescriptorProto) bool { - name := GetEnumCustomName(field) - if len(name) > 0 { - return true - } - return false -} - -func IsEnumValueCustomName(field *google_protobuf.EnumValueDescriptorProto) bool { - name := GetEnumValueCustomName(field) - if len(name) > 0 { - return true - } - return false -} - -func GetCustomName(field *google_protobuf.FieldDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Customname) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetEnumCustomName(field *google_protobuf.EnumDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_EnumCustomname) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetEnumValueCustomName(field *google_protobuf.EnumValueDescriptorProto) string { - if field == nil { - return "" - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_EnumvalueCustomname) - if err == nil && v.(*string) != nil { - return *(v.(*string)) - } - } - return "" -} - -func GetJsonTag(field *google_protobuf.FieldDescriptorProto) *string { - if field == nil { - return nil - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Jsontag) - if err == nil && v.(*string) != nil { - return (v.(*string)) - } - } - return nil -} - -func GetMoreTags(field *google_protobuf.FieldDescriptorProto) *string { - if field == nil { - return nil - } - if field.Options != nil { - v, err := proto.GetExtension(field.Options, E_Moretags) - if err == nil && v.(*string) != nil { - return (v.(*string)) - } - } - return nil -} - -type EnableFunc func(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool - -func EnabledGoEnumPrefix(file *google_protobuf.FileDescriptorProto, enum *google_protobuf.EnumDescriptorProto) bool { - return proto.GetBoolExtension(enum.Options, E_GoprotoEnumPrefix, proto.GetBoolExtension(file.Options, E_GoprotoEnumPrefixAll, true)) -} - -func EnabledGoStringer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_GoprotoStringer, proto.GetBoolExtension(file.Options, E_GoprotoStringerAll, true)) -} - -func HasGoGetters(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_GoprotoGetters, proto.GetBoolExtension(file.Options, E_GoprotoGettersAll, true)) -} - -func IsUnion(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Onlyone, proto.GetBoolExtension(file.Options, E_OnlyoneAll, false)) -} - -func HasGoString(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Gostring, proto.GetBoolExtension(file.Options, E_GostringAll, false)) -} - -func HasEqual(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Equal, proto.GetBoolExtension(file.Options, E_EqualAll, false)) -} - -func HasVerboseEqual(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_VerboseEqual, proto.GetBoolExtension(file.Options, E_VerboseEqualAll, false)) -} - -func IsStringer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Stringer, proto.GetBoolExtension(file.Options, E_StringerAll, false)) -} - -func IsFace(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Face, proto.GetBoolExtension(file.Options, E_FaceAll, false)) -} - -func HasDescription(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Description, proto.GetBoolExtension(file.Options, E_DescriptionAll, false)) -} - -func HasPopulate(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Populate, proto.GetBoolExtension(file.Options, E_PopulateAll, false)) -} - -func HasTestGen(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Testgen, proto.GetBoolExtension(file.Options, E_TestgenAll, false)) -} - -func HasBenchGen(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Benchgen, proto.GetBoolExtension(file.Options, E_BenchgenAll, false)) -} - -func IsMarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Marshaler, proto.GetBoolExtension(file.Options, E_MarshalerAll, false)) -} - -func IsUnmarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Unmarshaler, proto.GetBoolExtension(file.Options, E_UnmarshalerAll, false)) -} - -func IsStableMarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_StableMarshaler, proto.GetBoolExtension(file.Options, E_StableMarshalerAll, false)) -} - -func IsSizer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Sizer, proto.GetBoolExtension(file.Options, E_SizerAll, false)) -} - -func IsProtoSizer(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Protosizer, proto.GetBoolExtension(file.Options, E_ProtosizerAll, false)) -} - -func IsGoEnumStringer(file *google_protobuf.FileDescriptorProto, enum *google_protobuf.EnumDescriptorProto) bool { - return proto.GetBoolExtension(enum.Options, E_GoprotoEnumStringer, proto.GetBoolExtension(file.Options, E_GoprotoEnumStringerAll, true)) -} - -func IsEnumStringer(file *google_protobuf.FileDescriptorProto, enum *google_protobuf.EnumDescriptorProto) bool { - return proto.GetBoolExtension(enum.Options, E_EnumStringer, proto.GetBoolExtension(file.Options, E_EnumStringerAll, false)) -} - -func IsUnsafeMarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_UnsafeMarshaler, proto.GetBoolExtension(file.Options, E_UnsafeMarshalerAll, false)) -} - -func IsUnsafeUnmarshaler(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_UnsafeUnmarshaler, proto.GetBoolExtension(file.Options, E_UnsafeUnmarshalerAll, false)) -} - -func HasExtensionsMap(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_GoprotoExtensionsMap, proto.GetBoolExtension(file.Options, E_GoprotoExtensionsMapAll, true)) -} - -func HasUnrecognized(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - if IsProto3(file) { - return false - } - return proto.GetBoolExtension(message.Options, E_GoprotoUnrecognized, proto.GetBoolExtension(file.Options, E_GoprotoUnrecognizedAll, true)) -} - -func IsProto3(file *google_protobuf.FileDescriptorProto) bool { - return file.GetSyntax() == "proto3" -} - -func ImportsGoGoProto(file *google_protobuf.FileDescriptorProto) bool { - return proto.GetBoolExtension(file.Options, E_GogoprotoImport, true) -} - -func HasCompare(file *google_protobuf.FileDescriptorProto, message *google_protobuf.DescriptorProto) bool { - return proto.GetBoolExtension(message.Options, E_Compare, proto.GetBoolExtension(file.Options, E_CompareAll, false)) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoreplace/main.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoreplace/main.go deleted file mode 100644 index 3eab5651343..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/gogoreplace/main.go +++ /dev/null @@ -1,25 +0,0 @@ -package main - -import ( - "bytes" - "fmt" - "io/ioutil" - "os" -) - -func main() { - args := os.Args - if len(args) != 4 { - fmt.Println("gogoreplace wants three arguments") - fmt.Println(" gogoreplace oldsubstring newsubstring filename") - os.Exit(1) - } - data, err := ioutil.ReadFile(args[3]) - if err != nil { - panic(err) - } - data = bytes.Replace(data, []byte(args[1]), []byte(args[2]), -1) - if err := ioutil.WriteFile(args[3], data, 0666); err != nil { - panic(err) - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/install-protobuf.sh b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/install-protobuf.sh deleted file mode 100755 index 10c9320eaf3..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/install-protobuf.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -die() { - echo "$@" >&2 - exit 1 -} - -case "$PROTOBUF_VERSION" in -2*) - basename=protobuf-$PROTOBUF_VERSION - ;; -3*) - basename=protobuf-cpp-$PROTOBUF_VERSION - ;; -*) - die "unknown protobuf version: $PROTOBUF_VERSION" - ;; -esac - -cd /home/travis - -wget https://github.com/google/protobuf/releases/download/v$PROTOBUF_VERSION/$basename.tar.gz -tar xzf $basename.tar.gz - -cd protobuf-$PROTOBUF_VERSION - -./configure --prefix=/home/travis && make -j2 && make install diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/full.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/full.go deleted file mode 100644 index 550726a32f7..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/full.go +++ /dev/null @@ -1,102 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package io - -import ( - "github.com/gogo/protobuf/proto" - "io" -) - -func NewFullWriter(w io.Writer) WriteCloser { - return &fullWriter{w, nil} -} - -type fullWriter struct { - w io.Writer - buffer []byte -} - -func (this *fullWriter) WriteMsg(msg proto.Message) (err error) { - var data []byte - if m, ok := msg.(marshaler); ok { - n, ok := getSize(m) - if !ok { - data, err = proto.Marshal(msg) - if err != nil { - return err - } - } - if n >= len(this.buffer) { - this.buffer = make([]byte, n) - } - _, err = m.MarshalTo(this.buffer) - if err != nil { - return err - } - data = this.buffer[:n] - } else { - data, err = proto.Marshal(msg) - if err != nil { - return err - } - } - _, err = this.w.Write(data) - return err -} - -func (this *fullWriter) Close() error { - if closer, ok := this.w.(io.Closer); ok { - return closer.Close() - } - return nil -} - -type fullReader struct { - r io.Reader - buf []byte -} - -func NewFullReader(r io.Reader, maxSize int) ReadCloser { - return &fullReader{r, make([]byte, maxSize)} -} - -func (this *fullReader) ReadMsg(msg proto.Message) error { - length, err := this.r.Read(this.buf) - if err != nil { - return err - } - return proto.Unmarshal(this.buf[:length], msg) -} - -func (this *fullReader) Close() error { - if closer, ok := this.r.(io.Closer); ok { - return closer.Close() - } - return nil -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/io.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/io.go deleted file mode 100644 index 6dca519a18f..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/io.go +++ /dev/null @@ -1,70 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package io - -import ( - "github.com/gogo/protobuf/proto" - "io" -) - -type Writer interface { - WriteMsg(proto.Message) error -} - -type WriteCloser interface { - Writer - io.Closer -} - -type Reader interface { - ReadMsg(msg proto.Message) error -} - -type ReadCloser interface { - Reader - io.Closer -} - -type marshaler interface { - MarshalTo(data []byte) (n int, err error) -} - -func getSize(v interface{}) (int, bool) { - if sz, ok := v.(interface { - Size() (n int) - }); ok { - return sz.Size(), true - } else if sz, ok := v.(interface { - ProtoSize() (n int) - }); ok { - return sz.ProtoSize(), true - } else { - return 0, false - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/uint32.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/uint32.go deleted file mode 100644 index c3dad1ae750..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/uint32.go +++ /dev/null @@ -1,126 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package io - -import ( - "encoding/binary" - "github.com/gogo/protobuf/proto" - "io" -) - -func NewUint32DelimitedWriter(w io.Writer, byteOrder binary.ByteOrder) WriteCloser { - return &uint32Writer{w, byteOrder, nil} -} - -func NewSizeUint32DelimitedWriter(w io.Writer, byteOrder binary.ByteOrder, size int) WriteCloser { - return &uint32Writer{w, byteOrder, make([]byte, size)} -} - -type uint32Writer struct { - w io.Writer - byteOrder binary.ByteOrder - buffer []byte -} - -func (this *uint32Writer) WriteMsg(msg proto.Message) (err error) { - var data []byte - if m, ok := msg.(marshaler); ok { - n, ok := getSize(m) - if !ok { - data, err = proto.Marshal(msg) - if err != nil { - return err - } - } - if n >= len(this.buffer) { - this.buffer = make([]byte, n) - } - _, err = m.MarshalTo(this.buffer) - if err != nil { - return err - } - data = this.buffer[:n] - } else { - data, err = proto.Marshal(msg) - if err != nil { - return err - } - } - length := uint32(len(data)) - if err = binary.Write(this.w, this.byteOrder, &length); err != nil { - return err - } - _, err = this.w.Write(data) - return err -} - -func (this *uint32Writer) Close() error { - if closer, ok := this.w.(io.Closer); ok { - return closer.Close() - } - return nil -} - -type uint32Reader struct { - r io.Reader - byteOrder binary.ByteOrder - lenBuf []byte - buf []byte - maxSize int -} - -func NewUint32DelimitedReader(r io.Reader, byteOrder binary.ByteOrder, maxSize int) ReadCloser { - return &uint32Reader{r, byteOrder, make([]byte, 4), nil, maxSize} -} - -func (this *uint32Reader) ReadMsg(msg proto.Message) error { - if _, err := io.ReadFull(this.r, this.lenBuf); err != nil { - return err - } - length32 := this.byteOrder.Uint32(this.lenBuf) - length := int(length32) - if length < 0 || length > this.maxSize { - return io.ErrShortBuffer - } - if length >= len(this.buf) { - this.buf = make([]byte, length) - } - _, err := io.ReadFull(this.r, this.buf[:length]) - if err != nil { - return err - } - return proto.Unmarshal(this.buf[:length], msg) -} - -func (this *uint32Reader) Close() error { - if closer, ok := this.r.(io.Closer); ok { - return closer.Close() - } - return nil -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/varint.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/varint.go deleted file mode 100644 index a72e14a583e..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/io/varint.go +++ /dev/null @@ -1,134 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package io - -import ( - "bufio" - "encoding/binary" - "errors" - "github.com/gogo/protobuf/proto" - "io" -) - -var ( - errSmallBuffer = errors.New("Buffer Too Small") - errLargeValue = errors.New("Value is Larger than 64 bits") -) - -func NewDelimitedWriter(w io.Writer) WriteCloser { - return &varintWriter{w, make([]byte, 10), nil} -} - -type varintWriter struct { - w io.Writer - lenBuf []byte - buffer []byte -} - -func (this *varintWriter) WriteMsg(msg proto.Message) (err error) { - var data []byte - if m, ok := msg.(marshaler); ok { - n, ok := getSize(m) - if !ok { - data, err = proto.Marshal(msg) - if err != nil { - return err - } - } - if n >= len(this.buffer) { - this.buffer = make([]byte, n) - } - _, err = m.MarshalTo(this.buffer) - if err != nil { - return err - } - data = this.buffer[:n] - } else { - data, err = proto.Marshal(msg) - if err != nil { - return err - } - } - length := uint64(len(data)) - n := binary.PutUvarint(this.lenBuf, length) - _, err = this.w.Write(this.lenBuf[:n]) - if err != nil { - return err - } - _, err = this.w.Write(data) - return err -} - -func (this *varintWriter) Close() error { - if closer, ok := this.w.(io.Closer); ok { - return closer.Close() - } - return nil -} - -func NewDelimitedReader(r io.Reader, maxSize int) ReadCloser { - var closer io.Closer - if c, ok := r.(io.Closer); ok { - closer = c - } - return &varintReader{bufio.NewReader(r), nil, maxSize, closer} -} - -type varintReader struct { - r *bufio.Reader - buf []byte - maxSize int - closer io.Closer -} - -func (this *varintReader) ReadMsg(msg proto.Message) error { - length64, err := binary.ReadUvarint(this.r) - if err != nil { - return err - } - length := int(length64) - if length < 0 || length > this.maxSize { - return io.ErrShortBuffer - } - if len(this.buf) < length { - this.buf = make([]byte, length) - } - buf := this.buf[:length] - if _, err := io.ReadFull(this.r, buf); err != nil { - return err - } - return proto.Unmarshal(buf, msg) -} - -func (this *varintReader) Close() error { - if this.closer != nil { - return this.closer.Close() - } - return nil -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/jsonpb/jsonpb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/jsonpb/jsonpb.go deleted file mode 100644 index e621c3d33d6..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/jsonpb/jsonpb.go +++ /dev/null @@ -1,959 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2015 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -/* -Package jsonpb provides marshaling and unmarshaling between protocol buffers and JSON. -It follows the specification at https://developers.google.com/protocol-buffers/docs/proto3#json. - -This package produces a different output than the standard "encoding/json" package, -which does not operate correctly on protocol buffers. -*/ -package jsonpb - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "io" - "reflect" - "sort" - "strconv" - "strings" - "time" - - "github.com/gogo/protobuf/proto" - "github.com/gogo/protobuf/types" -) - -// Marshaler is a configurable object for converting between -// protocol buffer objects and a JSON representation for them. -type Marshaler struct { - // Whether to render enum values as integers, as opposed to string values. - EnumsAsInts bool - - // Whether to render fields with zero values. - EmitDefaults bool - - // A string to indent each level by. The presence of this field will - // also cause a space to appear between the field separator and - // value, and for newlines to be appear between fields and array - // elements. - Indent string - - // Whether to use the original (.proto) name for fields. - OrigName bool -} - -// Marshal marshals a protocol buffer into JSON. -func (m *Marshaler) Marshal(out io.Writer, pb proto.Message) error { - writer := &errWriter{writer: out} - return m.marshalObject(writer, pb, "", "") -} - -// MarshalToString converts a protocol buffer object to JSON string. -func (m *Marshaler) MarshalToString(pb proto.Message) (string, error) { - var buf bytes.Buffer - if err := m.Marshal(&buf, pb); err != nil { - return "", err - } - return buf.String(), nil -} - -type int32Slice []int32 - -// For sorting extensions ids to ensure stable output. -func (s int32Slice) Len() int { return len(s) } -func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] } -func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } - -type isWkt interface { - XXX_WellKnownType() string -} - -// marshalObject writes a struct to the Writer. -func (m *Marshaler) marshalObject(out *errWriter, v proto.Message, indent, typeURL string) error { - s := reflect.ValueOf(v).Elem() - - // Handle well-known types. - if wkt, ok := v.(isWkt); ok { - switch wkt.XXX_WellKnownType() { - case "DoubleValue", "FloatValue", "Int64Value", "UInt64Value", - "Int32Value", "UInt32Value", "BoolValue", "StringValue", "BytesValue": - // "Wrappers use the same representation in JSON - // as the wrapped primitive type, ..." - sprop := proto.GetProperties(s.Type()) - return m.marshalValue(out, sprop.Prop[0], s.Field(0), indent) - case "Any": - // Any is a bit more involved. - return m.marshalAny(out, v, indent) - case "Duration": - // "Generated output always contains 3, 6, or 9 fractional digits, - // depending on required precision." - s, ns := s.Field(0).Int(), s.Field(1).Int() - d := time.Duration(s)*time.Second + time.Duration(ns)*time.Nanosecond - x := fmt.Sprintf("%.9f", d.Seconds()) - x = strings.TrimSuffix(x, "000") - x = strings.TrimSuffix(x, "000") - out.write(`"`) - out.write(x) - out.write(`s"`) - return out.err - case "Struct": - // Let marshalValue handle the `fields` map. - // TODO: pass the correct Properties if needed. - return m.marshalValue(out, &proto.Properties{}, s.Field(0), indent) - case "Timestamp": - // "RFC 3339, where generated output will always be Z-normalized - // and uses 3, 6 or 9 fractional digits." - s, ns := s.Field(0).Int(), s.Field(1).Int() - t := time.Unix(s, ns).UTC() - // time.RFC3339Nano isn't exactly right (we need to get 3/6/9 fractional digits). - x := t.Format("2006-01-02T15:04:05.000000000") - x = strings.TrimSuffix(x, "000") - x = strings.TrimSuffix(x, "000") - out.write(`"`) - out.write(x) - out.write(`Z"`) - return out.err - case "Value": - // Value has a single oneof. - kind := s.Field(0) - if kind.IsNil() { - // "absence of any variant indicates an error" - return errors.New("nil Value") - } - // oneof -> *T -> T -> T.F - x := kind.Elem().Elem().Field(0) - // TODO: pass the correct Properties if needed. - return m.marshalValue(out, &proto.Properties{}, x, indent) - } - } - - out.write("{") - if m.Indent != "" { - out.write("\n") - } - - firstField := true - - if typeURL != "" { - if err := m.marshalTypeURL(out, indent, typeURL); err != nil { - return err - } - firstField = false - } - - for i := 0; i < s.NumField(); i++ { - value := s.Field(i) - valueField := s.Type().Field(i) - if strings.HasPrefix(valueField.Name, "XXX_") { - continue - } - - // IsNil will panic on most value kinds. - switch value.Kind() { - case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: - if value.IsNil() { - continue - } - } - - if !m.EmitDefaults { - switch value.Kind() { - case reflect.Bool: - if !value.Bool() { - continue - } - case reflect.Int32, reflect.Int64: - if value.Int() == 0 { - continue - } - case reflect.Uint32, reflect.Uint64: - if value.Uint() == 0 { - continue - } - case reflect.Float32, reflect.Float64: - if value.Float() == 0 { - continue - } - case reflect.String: - if value.Len() == 0 { - continue - } - } - } - - // Oneof fields need special handling. - if valueField.Tag.Get("protobuf_oneof") != "" { - // value is an interface containing &T{real_value}. - sv := value.Elem().Elem() // interface -> *T -> T - value = sv.Field(0) - valueField = sv.Type().Field(0) - } - prop := jsonProperties(valueField, m.OrigName) - if !firstField { - m.writeSep(out) - } - // If the map value is a cast type, it may not implement proto.Message, therefore - // allow the struct tag to declare the underlying message type. Instead of changing - // the signatures of the child types (and because prop.mvalue is not public), use - // CustomType as a passer. - if value.Kind() == reflect.Map { - if tag := valueField.Tag.Get("protobuf"); tag != "" { - for _, v := range strings.Split(tag, ",") { - if !strings.HasPrefix(v, "castvaluetype=") { - continue - } - v = strings.TrimPrefix(v, "castvaluetype=") - prop.CustomType = v - break - } - } - } - if err := m.marshalField(out, prop, value, indent); err != nil { - return err - } - firstField = false - } - - // Handle proto2 extensions. - if ep, ok := v.(proto.Message); ok { - extensions := proto.RegisteredExtensions(v) - // Sort extensions for stable output. - ids := make([]int32, 0, len(extensions)) - for id, desc := range extensions { - if !proto.HasExtension(ep, desc) { - continue - } - ids = append(ids, id) - } - sort.Sort(int32Slice(ids)) - for _, id := range ids { - desc := extensions[id] - if desc == nil { - // unknown extension - continue - } - ext, extErr := proto.GetExtension(ep, desc) - if extErr != nil { - return extErr - } - value := reflect.ValueOf(ext) - var prop proto.Properties - prop.Parse(desc.Tag) - prop.JSONName = fmt.Sprintf("[%s]", desc.Name) - if !firstField { - m.writeSep(out) - } - if err := m.marshalField(out, &prop, value, indent); err != nil { - return err - } - firstField = false - } - - } - - if m.Indent != "" { - out.write("\n") - out.write(indent) - } - out.write("}") - return out.err -} - -func (m *Marshaler) writeSep(out *errWriter) { - if m.Indent != "" { - out.write(",\n") - } else { - out.write(",") - } -} - -func (m *Marshaler) marshalAny(out *errWriter, any proto.Message, indent string) error { - // "If the Any contains a value that has a special JSON mapping, - // it will be converted as follows: {"@type": xxx, "value": yyy}. - // Otherwise, the value will be converted into a JSON object, - // and the "@type" field will be inserted to indicate the actual data type." - v := reflect.ValueOf(any).Elem() - turl := v.Field(0).String() - val := v.Field(1).Bytes() - - // Only the part of type_url after the last slash is relevant. - mname := turl - if slash := strings.LastIndex(mname, "/"); slash >= 0 { - mname = mname[slash+1:] - } - mt := proto.MessageType(mname) - if mt == nil { - return fmt.Errorf("unknown message type %q", mname) - } - msg := reflect.New(mt.Elem()).Interface().(proto.Message) - if err := proto.Unmarshal(val, msg); err != nil { - return err - } - - if _, ok := msg.(isWkt); ok { - out.write("{") - if m.Indent != "" { - out.write("\n") - } - if err := m.marshalTypeURL(out, indent, turl); err != nil { - return err - } - m.writeSep(out) - if m.Indent != "" { - out.write(indent) - out.write(m.Indent) - out.write(`"value": `) - } else { - out.write(`"value":`) - } - if err := m.marshalObject(out, msg, indent+m.Indent, ""); err != nil { - return err - } - if m.Indent != "" { - out.write("\n") - out.write(indent) - } - out.write("}") - return out.err - } - - return m.marshalObject(out, msg, indent, turl) -} - -func (m *Marshaler) marshalTypeURL(out *errWriter, indent, typeURL string) error { - if m.Indent != "" { - out.write(indent) - out.write(m.Indent) - } - out.write(`"@type":`) - if m.Indent != "" { - out.write(" ") - } - b, err := json.Marshal(typeURL) - if err != nil { - return err - } - out.write(string(b)) - return out.err -} - -// marshalField writes field description and value to the Writer. -func (m *Marshaler) marshalField(out *errWriter, prop *proto.Properties, v reflect.Value, indent string) error { - if m.Indent != "" { - out.write(indent) - out.write(m.Indent) - } - out.write(`"`) - out.write(prop.JSONName) - out.write(`":`) - if m.Indent != "" { - out.write(" ") - } - if err := m.marshalValue(out, prop, v, indent); err != nil { - return err - } - return nil -} - -// marshalValue writes the value to the Writer. -func (m *Marshaler) marshalValue(out *errWriter, prop *proto.Properties, v reflect.Value, indent string) error { - - v = reflect.Indirect(v) - - // Handle repeated elements. - if v.Kind() == reflect.Slice && v.Type().Elem().Kind() != reflect.Uint8 { - out.write("[") - comma := "" - for i := 0; i < v.Len(); i++ { - sliceVal := v.Index(i) - out.write(comma) - if m.Indent != "" { - out.write("\n") - out.write(indent) - out.write(m.Indent) - out.write(m.Indent) - } - if err := m.marshalValue(out, prop, sliceVal, indent+m.Indent); err != nil { - return err - } - comma = "," - } - if m.Indent != "" { - out.write("\n") - out.write(indent) - out.write(m.Indent) - } - out.write("]") - return out.err - } - - // Handle well-known types. - // Most are handled up in marshalObject (because 99% are messages). - if wkt, ok := v.Interface().(isWkt); ok { - switch wkt.XXX_WellKnownType() { - case "NullValue": - out.write("null") - return out.err - } - } - - if t, ok := v.Interface().(time.Time); ok { - ts, err := types.TimestampProto(t) - if err != nil { - return err - } - return m.marshalValue(out, prop, reflect.ValueOf(ts), indent) - } - - if d, ok := v.Interface().(time.Duration); ok { - dur := types.DurationProto(d) - return m.marshalValue(out, prop, reflect.ValueOf(dur), indent) - } - - // Handle enumerations. - if !m.EnumsAsInts && prop.Enum != "" { - // Unknown enum values will are stringified by the proto library as their - // value. Such values should _not_ be quoted or they will be interpreted - // as an enum string instead of their value. - enumStr := v.Interface().(fmt.Stringer).String() - var valStr string - if v.Kind() == reflect.Ptr { - valStr = strconv.Itoa(int(v.Elem().Int())) - } else { - valStr = strconv.Itoa(int(v.Int())) - } - - if m, ok := v.Interface().(interface { - MarshalJSON() ([]byte, error) - }); ok { - data, err := m.MarshalJSON() - if err != nil { - return err - } - enumStr = string(data) - enumStr, err = strconv.Unquote(enumStr) - if err != nil { - return err - } - } - - isKnownEnum := enumStr != valStr - - if isKnownEnum { - out.write(`"`) - } - out.write(enumStr) - if isKnownEnum { - out.write(`"`) - } - return out.err - } - - // Handle nested messages. - if v.Kind() == reflect.Struct { - i := v - if v.CanAddr() { - i = v.Addr() - } else { - i = reflect.New(v.Type()) - i.Elem().Set(v) - } - iface := i.Interface() - if iface == nil { - out.write(`null`) - return out.err - } - pm, ok := iface.(proto.Message) - if !ok { - if prop.CustomType == "" { - return fmt.Errorf("%v does not implement proto.Message", v.Type()) - } - t := proto.MessageType(prop.CustomType) - if t == nil || !i.Type().ConvertibleTo(t) { - return fmt.Errorf("%v declared custom type %s but it is not convertible to %v", v.Type(), prop.CustomType, t) - } - pm = i.Convert(t).Interface().(proto.Message) - } - return m.marshalObject(out, pm, indent+m.Indent, "") - } - - // Handle maps. - // Since Go randomizes map iteration, we sort keys for stable output. - if v.Kind() == reflect.Map { - out.write(`{`) - keys := v.MapKeys() - sort.Sort(mapKeys(keys)) - for i, k := range keys { - if i > 0 { - out.write(`,`) - } - if m.Indent != "" { - out.write("\n") - out.write(indent) - out.write(m.Indent) - out.write(m.Indent) - } - - b, err := json.Marshal(k.Interface()) - if err != nil { - return err - } - s := string(b) - - // If the JSON is not a string value, encode it again to make it one. - if !strings.HasPrefix(s, `"`) { - b, err := json.Marshal(s) - if err != nil { - return err - } - s = string(b) - } - - out.write(s) - out.write(`:`) - if m.Indent != "" { - out.write(` `) - } - - if err := m.marshalValue(out, prop, v.MapIndex(k), indent+m.Indent); err != nil { - return err - } - } - if m.Indent != "" { - out.write("\n") - out.write(indent) - out.write(m.Indent) - } - out.write(`}`) - return out.err - } - - // Default handling defers to the encoding/json library. - b, err := json.Marshal(v.Interface()) - if err != nil { - return err - } - needToQuote := string(b[0]) != `"` && (v.Kind() == reflect.Int64 || v.Kind() == reflect.Uint64) - if needToQuote { - out.write(`"`) - } - out.write(string(b)) - if needToQuote { - out.write(`"`) - } - return out.err -} - -// Unmarshaler is a configurable object for converting from a JSON -// representation to a protocol buffer object. -type Unmarshaler struct { - // Whether to allow messages to contain unknown fields, as opposed to - // failing to unmarshal. - AllowUnknownFields bool -} - -// UnmarshalNext unmarshals the next protocol buffer from a JSON object stream. -// This function is lenient and will decode any options permutations of the -// related Marshaler. -func (u *Unmarshaler) UnmarshalNext(dec *json.Decoder, pb proto.Message) error { - inputValue := json.RawMessage{} - if err := dec.Decode(&inputValue); err != nil { - return err - } - return u.unmarshalValue(reflect.ValueOf(pb).Elem(), inputValue, nil) -} - -// Unmarshal unmarshals a JSON object stream into a protocol -// buffer. This function is lenient and will decode any options -// permutations of the related Marshaler. -func (u *Unmarshaler) Unmarshal(r io.Reader, pb proto.Message) error { - dec := json.NewDecoder(r) - return u.UnmarshalNext(dec, pb) -} - -// UnmarshalNext unmarshals the next protocol buffer from a JSON object stream. -// This function is lenient and will decode any options permutations of the -// related Marshaler. -func UnmarshalNext(dec *json.Decoder, pb proto.Message) error { - return new(Unmarshaler).UnmarshalNext(dec, pb) -} - -// Unmarshal unmarshals a JSON object stream into a protocol -// buffer. This function is lenient and will decode any options -// permutations of the related Marshaler. -func Unmarshal(r io.Reader, pb proto.Message) error { - return new(Unmarshaler).Unmarshal(r, pb) -} - -// UnmarshalString will populate the fields of a protocol buffer based -// on a JSON string. This function is lenient and will decode any options -// permutations of the related Marshaler. -func UnmarshalString(str string, pb proto.Message) error { - return new(Unmarshaler).Unmarshal(strings.NewReader(str), pb) -} - -// unmarshalValue converts/copies a value into the target. -// prop may be nil. -func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMessage, prop *proto.Properties) error { - targetType := target.Type() - - // Allocate memory for pointer fields. - if targetType.Kind() == reflect.Ptr { - target.Set(reflect.New(targetType.Elem())) - return u.unmarshalValue(target.Elem(), inputValue, prop) - } - - // Handle well-known types. - if wkt, ok := target.Addr().Interface().(isWkt); ok { - switch wkt.XXX_WellKnownType() { - case "DoubleValue", "FloatValue", "Int64Value", "UInt64Value", - "Int32Value", "UInt32Value", "BoolValue", "StringValue", "BytesValue": - // "Wrappers use the same representation in JSON - // as the wrapped primitive type, except that null is allowed." - // encoding/json will turn JSON `null` into Go `nil`, - // so we don't have to do any extra work. - return u.unmarshalValue(target.Field(0), inputValue, prop) - case "Any": - return fmt.Errorf("unmarshaling Any not supported yet") - case "Duration": - ivStr := string(inputValue) - if ivStr == "null" { - target.Field(0).SetInt(0) - target.Field(1).SetInt(0) - return nil - } - - unq, err := strconv.Unquote(ivStr) - if err != nil { - return err - } - d, err := time.ParseDuration(unq) - if err != nil { - return fmt.Errorf("bad Duration: %v", err) - } - ns := d.Nanoseconds() - s := ns / 1e9 - ns %= 1e9 - target.Field(0).SetInt(s) - target.Field(1).SetInt(ns) - return nil - case "Timestamp": - ivStr := string(inputValue) - if ivStr == "null" { - target.Field(0).SetInt(0) - target.Field(1).SetInt(0) - return nil - } - - unq, err := strconv.Unquote(ivStr) - if err != nil { - return err - } - t, err := time.Parse(time.RFC3339Nano, unq) - if err != nil { - return fmt.Errorf("bad Timestamp: %v", err) - } - target.Field(0).SetInt(int64(t.Unix())) - target.Field(1).SetInt(int64(t.Nanosecond())) - return nil - } - } - - if t, ok := target.Addr().Interface().(*time.Time); ok { - ts := &types.Timestamp{} - if err := u.unmarshalValue(reflect.ValueOf(ts).Elem(), inputValue, prop); err != nil { - return err - } - tt, err := types.TimestampFromProto(ts) - if err != nil { - return err - } - *t = tt - return nil - } - - if d, ok := target.Addr().Interface().(*time.Duration); ok { - dur := &types.Duration{} - if err := u.unmarshalValue(reflect.ValueOf(dur).Elem(), inputValue, prop); err != nil { - return err - } - dd, err := types.DurationFromProto(dur) - if err != nil { - return err - } - *d = dd - return nil - } - - // Handle enums, which have an underlying type of int32, - // and may appear as strings. - // The case of an enum appearing as a number is handled - // at the bottom of this function. - if inputValue[0] == '"' && prop != nil && prop.Enum != "" { - vmap := proto.EnumValueMap(prop.Enum) - // Don't need to do unquoting; valid enum names - // are from a limited character set. - s := inputValue[1 : len(inputValue)-1] - n, ok := vmap[string(s)] - if !ok { - return fmt.Errorf("unknown value %q for enum %s", s, prop.Enum) - } - if target.Kind() == reflect.Ptr { // proto2 - target.Set(reflect.New(targetType.Elem())) - target = target.Elem() - } - target.SetInt(int64(n)) - return nil - } - - // Handle nested messages. - if targetType.Kind() == reflect.Struct { - var jsonFields map[string]json.RawMessage - if err := json.Unmarshal(inputValue, &jsonFields); err != nil { - return err - } - - consumeField := func(prop *proto.Properties) (json.RawMessage, bool) { - // Be liberal in what names we accept; both orig_name and camelName are okay. - fieldNames := acceptedJSONFieldNames(prop) - - vOrig, okOrig := jsonFields[fieldNames.orig] - vCamel, okCamel := jsonFields[fieldNames.camel] - if !okOrig && !okCamel { - return nil, false - } - // If, for some reason, both are present in the data, favour the camelName. - var raw json.RawMessage - if okOrig { - raw = vOrig - delete(jsonFields, fieldNames.orig) - } - if okCamel { - raw = vCamel - delete(jsonFields, fieldNames.camel) - } - return raw, true - } - - sprops := proto.GetProperties(targetType) - for i := 0; i < target.NumField(); i++ { - ft := target.Type().Field(i) - if strings.HasPrefix(ft.Name, "XXX_") { - continue - } - valueForField, ok := consumeField(sprops.Prop[i]) - if !ok { - continue - } - - if err := u.unmarshalValue(target.Field(i), valueForField, sprops.Prop[i]); err != nil { - return err - } - } - // Check for any oneof fields. - if len(jsonFields) > 0 { - for _, oop := range sprops.OneofTypes { - raw, ok := consumeField(oop.Prop) - if !ok { - continue - } - nv := reflect.New(oop.Type.Elem()) - target.Field(oop.Field).Set(nv) - if err := u.unmarshalValue(nv.Elem().Field(0), raw, oop.Prop); err != nil { - return err - } - } - } - if !u.AllowUnknownFields && len(jsonFields) > 0 { - // Pick any field to be the scapegoat. - var f string - for fname := range jsonFields { - f = fname - break - } - return fmt.Errorf("unknown field %q in %v", f, targetType) - } - return nil - } - - // Handle arrays - if targetType.Kind() == reflect.Slice { - if targetType.Elem().Kind() == reflect.Uint8 { - outRef := reflect.New(targetType) - outVal := outRef.Interface() - //CustomType with underlying type []byte - if _, ok := outVal.(interface { - UnmarshalJSON([]byte) error - }); ok { - if err := json.Unmarshal(inputValue, outVal); err != nil { - return err - } - target.Set(outRef.Elem()) - return nil - } - // Special case for encoded bytes. Pre-go1.5 doesn't support unmarshalling - // strings into aliased []byte types. - // https://github.com/golang/go/commit/4302fd0409da5e4f1d71471a6770dacdc3301197 - // https://github.com/golang/go/commit/c60707b14d6be26bf4213114d13070bff00d0b0a - var out []byte - if err := json.Unmarshal(inputValue, &out); err != nil { - return err - } - target.SetBytes(out) - return nil - } - - var slc []json.RawMessage - if err := json.Unmarshal(inputValue, &slc); err != nil { - return err - } - len := len(slc) - target.Set(reflect.MakeSlice(targetType, len, len)) - for i := 0; i < len; i++ { - if err := u.unmarshalValue(target.Index(i), slc[i], prop); err != nil { - return err - } - } - return nil - } - - // Handle maps (whose keys are always strings) - if targetType.Kind() == reflect.Map { - var mp map[string]json.RawMessage - if err := json.Unmarshal(inputValue, &mp); err != nil { - return err - } - target.Set(reflect.MakeMap(targetType)) - var keyprop, valprop *proto.Properties - if prop != nil { - // These could still be nil if the protobuf metadata is broken somehow. - // TODO: This won't work because the fields are unexported. - // We should probably just reparse them. - //keyprop, valprop = prop.mkeyprop, prop.mvalprop - } - for ks, raw := range mp { - // Unmarshal map key. The core json library already decoded the key into a - // string, so we handle that specially. Other types were quoted post-serialization. - var k reflect.Value - if targetType.Key().Kind() == reflect.String { - k = reflect.ValueOf(ks) - } else { - k = reflect.New(targetType.Key()).Elem() - if err := u.unmarshalValue(k, json.RawMessage(ks), keyprop); err != nil { - return err - } - } - - if !k.Type().AssignableTo(targetType.Key()) { - k = k.Convert(targetType.Key()) - } - - // Unmarshal map value. - v := reflect.New(targetType.Elem()).Elem() - if err := u.unmarshalValue(v, raw, valprop); err != nil { - return err - } - target.SetMapIndex(k, v) - } - return nil - } - - // 64-bit integers can be encoded as strings. In this case we drop - // the quotes and proceed as normal. - isNum := targetType.Kind() == reflect.Int64 || targetType.Kind() == reflect.Uint64 - if isNum && strings.HasPrefix(string(inputValue), `"`) { - inputValue = inputValue[1 : len(inputValue)-1] - } - - // Use the encoding/json for parsing other value types. - return json.Unmarshal(inputValue, target.Addr().Interface()) -} - -// jsonProperties returns parsed proto.Properties for the field and corrects JSONName attribute. -func jsonProperties(f reflect.StructField, origName bool) *proto.Properties { - var prop proto.Properties - prop.Init(f.Type, f.Name, f.Tag.Get("protobuf"), &f) - if origName || prop.JSONName == "" { - prop.JSONName = prop.OrigName - } - return &prop -} - -type fieldNames struct { - orig, camel string -} - -func acceptedJSONFieldNames(prop *proto.Properties) fieldNames { - opts := fieldNames{orig: prop.OrigName, camel: prop.OrigName} - if prop.JSONName != "" { - opts.camel = prop.JSONName - } - return opts -} - -// Writer wrapper inspired by https://blog.golang.org/errors-are-values -type errWriter struct { - writer io.Writer - err error -} - -func (w *errWriter) write(str string) { - if w.err != nil { - return - } - _, w.err = w.writer.Write([]byte(str)) -} - -// Map fields may have key types of non-float scalars, strings and enums. -// The easiest way to sort them in some deterministic order is to use fmt. -// If this turns out to be inefficient we can always consider other options, -// such as doing a Schwartzian transform. -// -// Numeric keys are sorted in numeric order per -// https://developers.google.com/protocol-buffers/docs/proto#maps. -type mapKeys []reflect.Value - -func (s mapKeys) Len() int { return len(s) } -func (s mapKeys) Swap(i, j int) { s[i], s[j] = s[j], s[i] } -func (s mapKeys) Less(i, j int) bool { - if k := s[i].Kind(); k == s[j].Kind() { - switch k { - case reflect.Int32, reflect.Int64: - return s[i].Int() < s[j].Int() - case reflect.Uint32, reflect.Uint64: - return s[i].Uint() < s[j].Uint() - } - } - return fmt.Sprint(s[i].Interface()) < fmt.Sprint(s[j].Interface()) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/compare/compare.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/compare/compare.go deleted file mode 100644 index 75c0399af93..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/compare/compare.go +++ /dev/null @@ -1,526 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package compare - -import ( - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/proto" - descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" - "github.com/gogo/protobuf/vanity" -) - -type plugin struct { - *generator.Generator - generator.PluginImports - fmtPkg generator.Single - bytesPkg generator.Single - sortkeysPkg generator.Single - protoPkg generator.Single -} - -func NewPlugin() *plugin { - return &plugin{} -} - -func (p *plugin) Name() string { - return "compare" -} - -func (p *plugin) Init(g *generator.Generator) { - p.Generator = g -} - -func (p *plugin) Generate(file *generator.FileDescriptor) { - p.PluginImports = generator.NewPluginImports(p.Generator) - p.fmtPkg = p.NewImport("fmt") - p.bytesPkg = p.NewImport("bytes") - p.sortkeysPkg = p.NewImport("github.com/gogo/protobuf/sortkeys") - p.protoPkg = p.NewImport("github.com/gogo/protobuf/proto") - - for _, msg := range file.Messages() { - if msg.DescriptorProto.GetOptions().GetMapEntry() { - continue - } - if gogoproto.HasCompare(file.FileDescriptorProto, msg.DescriptorProto) { - p.generateMessage(file, msg) - } - } -} - -func (p *plugin) generateNullableField(fieldname string) { - p.P(`if this.`, fieldname, ` != nil && that1.`, fieldname, ` != nil {`) - p.In() - p.P(`if *this.`, fieldname, ` != *that1.`, fieldname, `{`) - p.In() - p.P(`if *this.`, fieldname, ` < *that1.`, fieldname, `{`) - p.In() - p.P(`return -1`) - p.Out() - p.P(`}`) - p.P(`return 1`) - p.Out() - p.P(`}`) - p.Out() - p.P(`} else if this.`, fieldname, ` != nil {`) - p.In() - p.P(`return 1`) - p.Out() - p.P(`} else if that1.`, fieldname, ` != nil {`) - p.In() - p.P(`return -1`) - p.Out() - p.P(`}`) -} - -func (p *plugin) generateMsgNullAndTypeCheck(ccTypeName string) { - p.P(`if that == nil {`) - p.In() - p.P(`if this == nil {`) - p.In() - p.P(`return 0`) - p.Out() - p.P(`}`) - p.P(`return 1`) - p.Out() - p.P(`}`) - p.P(``) - p.P(`that1, ok := that.(*`, ccTypeName, `)`) - p.P(`if !ok {`) - p.In() - p.P(`that2, ok := that.(`, ccTypeName, `)`) - p.P(`if ok {`) - p.In() - p.P(`that1 = &that2`) - p.Out() - p.P(`} else {`) - p.In() - p.P(`return 1`) - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - p.P(`if that1 == nil {`) - p.In() - p.P(`if this == nil {`) - p.In() - p.P(`return 0`) - p.Out() - p.P(`}`) - p.P(`return 1`) - p.Out() - p.P(`} else if this == nil {`) - p.In() - p.P(`return -1`) - p.Out() - p.P(`}`) -} - -func (p *plugin) generateField(file *generator.FileDescriptor, message *generator.Descriptor, field *descriptor.FieldDescriptorProto) { - proto3 := gogoproto.IsProto3(file.FileDescriptorProto) - fieldname := p.GetOneOfFieldName(message, field) - repeated := field.IsRepeated() - ctype := gogoproto.IsCustomType(field) - nullable := gogoproto.IsNullable(field) - // oneof := field.OneofIndex != nil - if !repeated { - if ctype { - if nullable { - p.P(`if that1.`, fieldname, ` == nil {`) - p.In() - p.P(`if this.`, fieldname, ` != nil {`) - p.In() - p.P(`return 1`) - p.Out() - p.P(`}`) - p.Out() - p.P(`} else if this.`, fieldname, ` == nil {`) - p.In() - p.P(`return -1`) - p.Out() - p.P(`} else if c := this.`, fieldname, `.Compare(*that1.`, fieldname, `); c != 0 {`) - } else { - p.P(`if c := this.`, fieldname, `.Compare(that1.`, fieldname, `); c != 0 {`) - } - p.In() - p.P(`return c`) - p.Out() - p.P(`}`) - } else { - if field.IsMessage() || p.IsGroup(field) { - if nullable { - p.P(`if c := this.`, fieldname, `.Compare(that1.`, fieldname, `); c != 0 {`) - } else { - p.P(`if c := this.`, fieldname, `.Compare(&that1.`, fieldname, `); c != 0 {`) - } - p.In() - p.P(`return c`) - p.Out() - p.P(`}`) - } else if field.IsBytes() { - p.P(`if c := `, p.bytesPkg.Use(), `.Compare(this.`, fieldname, `, that1.`, fieldname, `); c != 0 {`) - p.In() - p.P(`return c`) - p.Out() - p.P(`}`) - } else if field.IsString() { - if nullable && !proto3 { - p.generateNullableField(fieldname) - } else { - p.P(`if this.`, fieldname, ` != that1.`, fieldname, `{`) - p.In() - p.P(`if this.`, fieldname, ` < that1.`, fieldname, `{`) - p.In() - p.P(`return -1`) - p.Out() - p.P(`}`) - p.P(`return 1`) - p.Out() - p.P(`}`) - } - } else if field.IsBool() { - if nullable && !proto3 { - p.P(`if this.`, fieldname, ` != nil && that1.`, fieldname, ` != nil {`) - p.In() - p.P(`if *this.`, fieldname, ` != *that1.`, fieldname, `{`) - p.In() - p.P(`if !*this.`, fieldname, ` {`) - p.In() - p.P(`return -1`) - p.Out() - p.P(`}`) - p.P(`return 1`) - p.Out() - p.P(`}`) - p.Out() - p.P(`} else if this.`, fieldname, ` != nil {`) - p.In() - p.P(`return 1`) - p.Out() - p.P(`} else if that1.`, fieldname, ` != nil {`) - p.In() - p.P(`return -1`) - p.Out() - p.P(`}`) - } else { - p.P(`if this.`, fieldname, ` != that1.`, fieldname, `{`) - p.In() - p.P(`if !this.`, fieldname, ` {`) - p.In() - p.P(`return -1`) - p.Out() - p.P(`}`) - p.P(`return 1`) - p.Out() - p.P(`}`) - } - } else { - if nullable && !proto3 { - p.generateNullableField(fieldname) - } else { - p.P(`if this.`, fieldname, ` != that1.`, fieldname, `{`) - p.In() - p.P(`if this.`, fieldname, ` < that1.`, fieldname, `{`) - p.In() - p.P(`return -1`) - p.Out() - p.P(`}`) - p.P(`return 1`) - p.Out() - p.P(`}`) - } - } - } - } else { - p.P(`if len(this.`, fieldname, `) != len(that1.`, fieldname, `) {`) - p.In() - p.P(`if len(this.`, fieldname, `) < len(that1.`, fieldname, `) {`) - p.In() - p.P(`return -1`) - p.Out() - p.P(`}`) - p.P(`return 1`) - p.Out() - p.P(`}`) - p.P(`for i := range this.`, fieldname, ` {`) - p.In() - if ctype { - p.P(`if c := this.`, fieldname, `[i].Compare(that1.`, fieldname, `[i]); c != 0 {`) - p.In() - p.P(`return c`) - p.Out() - p.P(`}`) - } else { - if p.IsMap(field) { - m := p.GoMapType(nil, field) - valuegoTyp, _ := p.GoType(nil, m.ValueField) - valuegoAliasTyp, _ := p.GoType(nil, m.ValueAliasField) - nullable, valuegoTyp, valuegoAliasTyp = generator.GoMapValueTypes(field, m.ValueField, valuegoTyp, valuegoAliasTyp) - - mapValue := m.ValueAliasField - if mapValue.IsMessage() || p.IsGroup(mapValue) { - if nullable && valuegoTyp == valuegoAliasTyp { - p.P(`if c := this.`, fieldname, `[i].Compare(that1.`, fieldname, `[i]); c != 0 {`) - } else { - // Compare() has a pointer receiver, but map value is a value type - a := `this.` + fieldname + `[i]` - b := `that1.` + fieldname + `[i]` - if valuegoTyp != valuegoAliasTyp { - // cast back to the type that has the generated methods on it - a = `(` + valuegoTyp + `)(` + a + `)` - b = `(` + valuegoTyp + `)(` + b + `)` - } - p.P(`a := `, a) - p.P(`b := `, b) - if nullable { - p.P(`if c := a.Compare(b); c != 0 {`) - } else { - p.P(`if c := (&a).Compare(&b); c != 0 {`) - } - } - p.In() - p.P(`return c`) - p.Out() - p.P(`}`) - } else if mapValue.IsBytes() { - p.P(`if c := `, p.bytesPkg.Use(), `.Compare(this.`, fieldname, `[i], that1.`, fieldname, `[i]); c != 0 {`) - p.In() - p.P(`return c`) - p.Out() - p.P(`}`) - } else if mapValue.IsString() { - p.P(`if this.`, fieldname, `[i] != that1.`, fieldname, `[i] {`) - p.In() - p.P(`if this.`, fieldname, `[i] < that1.`, fieldname, `[i] {`) - p.In() - p.P(`return -1`) - p.Out() - p.P(`}`) - p.P(`return 1`) - p.Out() - p.P(`}`) - } else { - p.P(`if this.`, fieldname, `[i] != that1.`, fieldname, `[i] {`) - p.In() - p.P(`if this.`, fieldname, `[i] < that1.`, fieldname, `[i] {`) - p.In() - p.P(`return -1`) - p.Out() - p.P(`}`) - p.P(`return 1`) - p.Out() - p.P(`}`) - } - } else if field.IsMessage() || p.IsGroup(field) { - if nullable { - p.P(`if c := this.`, fieldname, `[i].Compare(that1.`, fieldname, `[i]); c != 0 {`) - p.In() - p.P(`return c`) - p.Out() - p.P(`}`) - } else { - p.P(`if c := this.`, fieldname, `[i].Compare(&that1.`, fieldname, `[i]); c != 0 {`) - p.In() - p.P(`return c`) - p.Out() - p.P(`}`) - } - } else if field.IsBytes() { - p.P(`if c := `, p.bytesPkg.Use(), `.Compare(this.`, fieldname, `[i], that1.`, fieldname, `[i]); c != 0 {`) - p.In() - p.P(`return c`) - p.Out() - p.P(`}`) - } else if field.IsString() { - p.P(`if this.`, fieldname, `[i] != that1.`, fieldname, `[i] {`) - p.In() - p.P(`if this.`, fieldname, `[i] < that1.`, fieldname, `[i] {`) - p.In() - p.P(`return -1`) - p.Out() - p.P(`}`) - p.P(`return 1`) - p.Out() - p.P(`}`) - } else if field.IsBool() { - p.P(`if this.`, fieldname, `[i] != that1.`, fieldname, `[i] {`) - p.In() - p.P(`if !this.`, fieldname, `[i] {`) - p.In() - p.P(`return -1`) - p.Out() - p.P(`}`) - p.P(`return 1`) - p.Out() - p.P(`}`) - } else { - p.P(`if this.`, fieldname, `[i] != that1.`, fieldname, `[i] {`) - p.In() - p.P(`if this.`, fieldname, `[i] < that1.`, fieldname, `[i] {`) - p.In() - p.P(`return -1`) - p.Out() - p.P(`}`) - p.P(`return 1`) - p.Out() - p.P(`}`) - } - } - p.Out() - p.P(`}`) - } -} - -func (p *plugin) generateMessage(file *generator.FileDescriptor, message *generator.Descriptor) { - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - p.P(`func (this *`, ccTypeName, `) Compare(that interface{}) int {`) - p.In() - p.generateMsgNullAndTypeCheck(ccTypeName) - oneofs := make(map[string]struct{}) - - for _, field := range message.Field { - oneof := field.OneofIndex != nil - if oneof { - fieldname := p.GetFieldName(message, field) - if _, ok := oneofs[fieldname]; ok { - continue - } else { - oneofs[fieldname] = struct{}{} - } - p.P(`if that1.`, fieldname, ` == nil {`) - p.In() - p.P(`if this.`, fieldname, ` != nil {`) - p.In() - p.P(`return 1`) - p.Out() - p.P(`}`) - p.Out() - p.P(`} else if this.`, fieldname, ` == nil {`) - p.In() - p.P(`return -1`) - p.Out() - p.P(`} else if c := this.`, fieldname, `.Compare(that1.`, fieldname, `); c != 0 {`) - p.In() - p.P(`return c`) - p.Out() - p.P(`}`) - } else { - p.generateField(file, message, field) - } - } - if message.DescriptorProto.HasExtension() { - if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) { - p.P(`thismap := `, p.protoPkg.Use(), `.GetUnsafeExtensionsMap(this)`) - p.P(`thatmap := `, p.protoPkg.Use(), `.GetUnsafeExtensionsMap(that1)`) - p.P(`extkeys := make([]int32, 0, len(thismap)+len(thatmap))`) - p.P(`for k, _ := range thismap {`) - p.In() - p.P(`extkeys = append(extkeys, k)`) - p.Out() - p.P(`}`) - p.P(`for k, _ := range thatmap {`) - p.In() - p.P(`if _, ok := thismap[k]; !ok {`) - p.In() - p.P(`extkeys = append(extkeys, k)`) - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - p.P(p.sortkeysPkg.Use(), `.Int32s(extkeys)`) - p.P(`for _, k := range extkeys {`) - p.In() - p.P(`if v, ok := thismap[k]; ok {`) - p.In() - p.P(`if v2, ok := thatmap[k]; ok {`) - p.In() - p.P(`if c := v.Compare(&v2); c != 0 {`) - p.In() - p.P(`return c`) - p.Out() - p.P(`}`) - p.Out() - p.P(`} else {`) - p.In() - p.P(`return 1`) - p.Out() - p.P(`}`) - p.Out() - p.P(`} else {`) - p.In() - p.P(`return -1`) - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - } else { - fieldname := "XXX_extensions" - p.P(`if c := `, p.bytesPkg.Use(), `.Compare(this.`, fieldname, `, that1.`, fieldname, `); c != 0 {`) - p.In() - p.P(`return c`) - p.Out() - p.P(`}`) - } - } - if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) { - fieldname := "XXX_unrecognized" - p.P(`if c := `, p.bytesPkg.Use(), `.Compare(this.`, fieldname, `, that1.`, fieldname, `); c != 0 {`) - p.In() - p.P(`return c`) - p.Out() - p.P(`}`) - } - p.P(`return 0`) - p.Out() - p.P(`}`) - - //Generate Compare methods for oneof fields - m := proto.Clone(message.DescriptorProto).(*descriptor.DescriptorProto) - for _, field := range m.Field { - oneof := field.OneofIndex != nil - if !oneof { - continue - } - ccTypeName := p.OneOfTypeName(message, field) - p.P(`func (this *`, ccTypeName, `) Compare(that interface{}) int {`) - p.In() - - p.generateMsgNullAndTypeCheck(ccTypeName) - vanity.TurnOffNullableForNativeTypesWithoutDefaultsOnly(field) - p.generateField(file, message, field) - - p.P(`return 0`) - p.Out() - p.P(`}`) - } -} - -func init() { - generator.RegisterPlugin(NewPlugin()) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/compare/comparetest.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/compare/comparetest.go deleted file mode 100644 index 4db0d6acc57..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/compare/comparetest.go +++ /dev/null @@ -1,107 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package compare - -import ( - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/plugin/testgen" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" -) - -type test struct { - *generator.Generator -} - -func NewTest(g *generator.Generator) testgen.TestPlugin { - return &test{g} -} - -func (p *test) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool { - used := false - randPkg := imports.NewImport("math/rand") - timePkg := imports.NewImport("time") - testingPkg := imports.NewImport("testing") - protoPkg := imports.NewImport("github.com/gogo/protobuf/proto") - if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { - protoPkg = imports.NewImport("github.com/golang/protobuf/proto") - } - for _, message := range file.Messages() { - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - if !gogoproto.HasCompare(file.FileDescriptorProto, message.DescriptorProto) { - continue - } - if message.DescriptorProto.GetOptions().GetMapEntry() { - continue - } - - if gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { - used = true - p.P(`func Test`, ccTypeName, `Compare(t *`, testingPkg.Use(), `.T) {`) - p.In() - p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(`, timePkg.Use(), `.Now().UnixNano()))`) - p.P(`p := NewPopulated`, ccTypeName, `(popr, false)`) - p.P(`dAtA, err := `, protoPkg.Use(), `.Marshal(p)`) - p.P(`if err != nil {`) - p.In() - p.P(`panic(err)`) - p.Out() - p.P(`}`) - p.P(`msg := &`, ccTypeName, `{}`) - p.P(`if err := `, protoPkg.Use(), `.Unmarshal(dAtA, msg); err != nil {`) - p.In() - p.P(`panic(err)`) - p.Out() - p.P(`}`) - p.P(`if c := p.Compare(msg); c != 0 {`) - p.In() - p.P(`t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)`) - p.Out() - p.P(`}`) - p.P(`p2 := NewPopulated`, ccTypeName, `(popr, false)`) - p.P(`c := p.Compare(p2)`) - p.P(`c2 := p2.Compare(p)`) - p.P(`if c != (-1 * c2) {`) - p.In() - p.P(`t.Errorf("p.Compare(p2) = %d", c)`) - p.P(`t.Errorf("p2.Compare(p) = %d", c2)`) - p.P(`t.Errorf("p = %#v", p)`) - p.P(`t.Errorf("p2 = %#v", p2)`) - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - } - - } - return used -} - -func init() { - testgen.RegisterTestPlugin(NewTest) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/defaultcheck/defaultcheck.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/defaultcheck/defaultcheck.go deleted file mode 100644 index 486f2877192..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/defaultcheck/defaultcheck.go +++ /dev/null @@ -1,133 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -/* -The defaultcheck plugin is used to check whether nullable is not used incorrectly. -For instance: -An error is caused if a nullable field: - - has a default value, - - is an enum which does not start at zero, - - is used for an extension, - - is used for a native proto3 type, - - is used for a repeated native type. - -An error is also caused if a field with a default value is used in a message: - - which is a face. - - without getters. - -It is enabled by the following extensions: - - - nullable - -For incorrect usage of nullable with tests see: - - github.com/gogo/protobuf/test/nullableconflict - -*/ -package defaultcheck - -import ( - "fmt" - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" - "os" -) - -type plugin struct { - *generator.Generator -} - -func NewPlugin() *plugin { - return &plugin{} -} - -func (p *plugin) Name() string { - return "defaultcheck" -} - -func (p *plugin) Init(g *generator.Generator) { - p.Generator = g -} - -func (p *plugin) Generate(file *generator.FileDescriptor) { - proto3 := gogoproto.IsProto3(file.FileDescriptorProto) - for _, msg := range file.Messages() { - getters := gogoproto.HasGoGetters(file.FileDescriptorProto, msg.DescriptorProto) - face := gogoproto.IsFace(file.FileDescriptorProto, msg.DescriptorProto) - for _, field := range msg.GetField() { - if len(field.GetDefaultValue()) > 0 { - if !getters { - fmt.Fprintf(os.Stderr, "ERROR: field %v.%v cannot have a default value and not have a getter method", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name)) - os.Exit(1) - } - if face { - fmt.Fprintf(os.Stderr, "ERROR: field %v.%v cannot have a default value be in a face", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name)) - os.Exit(1) - } - } - if gogoproto.IsNullable(field) { - continue - } - if len(field.GetDefaultValue()) > 0 { - fmt.Fprintf(os.Stderr, "ERROR: field %v.%v cannot be non-nullable and have a default value", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name)) - os.Exit(1) - } - if !field.IsMessage() && !gogoproto.IsCustomType(field) { - if field.IsRepeated() { - fmt.Fprintf(os.Stderr, "WARNING: field %v.%v is a repeated non-nullable native type, nullable=false has no effect\n", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name)) - } else if proto3 { - fmt.Fprintf(os.Stderr, "ERROR: field %v.%v is a native type and in proto3 syntax with nullable=false there exists conflicting implementations when encoding zero values", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name)) - os.Exit(1) - } - if field.IsBytes() { - fmt.Fprintf(os.Stderr, "WARNING: field %v.%v is a non-nullable bytes type, nullable=false has no effect\n", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name)) - } - } - if !field.IsEnum() { - continue - } - enum := p.ObjectNamed(field.GetTypeName()).(*generator.EnumDescriptor) - if len(enum.Value) == 0 || enum.Value[0].GetNumber() != 0 { - fmt.Fprintf(os.Stderr, "ERROR: field %v.%v cannot be non-nullable and be an enum type %v which does not start with zero", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name), enum.GetName()) - os.Exit(1) - } - } - } - for _, e := range file.GetExtension() { - if !gogoproto.IsNullable(e) { - fmt.Fprintf(os.Stderr, "ERROR: extended field %v cannot be nullable %v", generator.CamelCase(e.GetName()), generator.CamelCase(*e.Name)) - os.Exit(1) - } - } -} - -func (p *plugin) GenerateImports(*generator.FileDescriptor) {} - -func init() { - generator.RegisterPlugin(NewPlugin()) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/description/description.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/description/description.go deleted file mode 100644 index f72efba6128..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/description/description.go +++ /dev/null @@ -1,201 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -/* -The description (experimental) plugin generates a Description method for each message. -The Description method returns a populated google_protobuf.FileDescriptorSet struct. -This contains the description of the files used to generate this message. - -It is enabled by the following extensions: - - - description - - description_all - -The description plugin also generates a test given it is enabled using one of the following extensions: - - - testgen - - testgen_all - -Let us look at: - - github.com/gogo/protobuf/test/example/example.proto - -Btw all the output can be seen at: - - github.com/gogo/protobuf/test/example/* - -The following message: - - message B { - option (gogoproto.description) = true; - optional A A = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; - repeated bytes G = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false]; - } - -given to the description plugin, will generate the following code: - - func (this *B) Description() (desc *google_protobuf.FileDescriptorSet) { - return ExampleDescription() - } - -and the following test code: - - func TestDescription(t *testing9.T) { - ExampleDescription() - } - -The hope is to use this struct in some way instead of reflect. -This package is subject to change, since a use has not been figured out yet. - -*/ -package description - -import ( - "bytes" - "compress/gzip" - "fmt" - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/proto" - descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" -) - -type plugin struct { - *generator.Generator - generator.PluginImports -} - -func NewPlugin() *plugin { - return &plugin{} -} - -func (p *plugin) Name() string { - return "description" -} - -func (p *plugin) Init(g *generator.Generator) { - p.Generator = g -} - -func (p *plugin) Generate(file *generator.FileDescriptor) { - used := false - localName := generator.FileName(file) - - p.PluginImports = generator.NewPluginImports(p.Generator) - descriptorPkg := p.NewImport("github.com/gogo/protobuf/protoc-gen-gogo/descriptor") - protoPkg := p.NewImport("github.com/gogo/protobuf/proto") - gzipPkg := p.NewImport("compress/gzip") - bytesPkg := p.NewImport("bytes") - ioutilPkg := p.NewImport("io/ioutil") - - for _, message := range file.Messages() { - if !gogoproto.HasDescription(file.FileDescriptorProto, message.DescriptorProto) { - continue - } - if message.DescriptorProto.GetOptions().GetMapEntry() { - continue - } - used = true - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - p.P(`func (this *`, ccTypeName, `) Description() (desc *`, descriptorPkg.Use(), `.FileDescriptorSet) {`) - p.In() - p.P(`return `, localName, `Description()`) - p.Out() - p.P(`}`) - } - - if used { - - p.P(`func `, localName, `Description() (desc *`, descriptorPkg.Use(), `.FileDescriptorSet) {`) - p.In() - //Don't generate SourceCodeInfo, since it will create too much code. - - ss := make([]*descriptor.SourceCodeInfo, 0) - for _, f := range p.Generator.AllFiles().GetFile() { - ss = append(ss, f.SourceCodeInfo) - f.SourceCodeInfo = nil - } - b, err := proto.Marshal(p.Generator.AllFiles()) - if err != nil { - panic(err) - } - for i, f := range p.Generator.AllFiles().GetFile() { - f.SourceCodeInfo = ss[i] - } - p.P(`d := &`, descriptorPkg.Use(), `.FileDescriptorSet{}`) - var buf bytes.Buffer - w, _ := gzip.NewWriterLevel(&buf, gzip.BestCompression) - w.Write(b) - w.Close() - b = buf.Bytes() - p.P("var gzipped = []byte{") - p.In() - p.P("// ", len(b), " bytes of a gzipped FileDescriptorSet") - for len(b) > 0 { - n := 16 - if n > len(b) { - n = len(b) - } - - s := "" - for _, c := range b[:n] { - s += fmt.Sprintf("0x%02x,", c) - } - p.P(s) - - b = b[n:] - } - p.Out() - p.P("}") - p.P(`r := `, bytesPkg.Use(), `.NewReader(gzipped)`) - p.P(`gzipr, err := `, gzipPkg.Use(), `.NewReader(r)`) - p.P(`if err != nil {`) - p.In() - p.P(`panic(err)`) - p.Out() - p.P(`}`) - p.P(`ungzipped, err := `, ioutilPkg.Use(), `.ReadAll(gzipr)`) - p.P(`if err != nil {`) - p.In() - p.P(`panic(err)`) - p.Out() - p.P(`}`) - p.P(`if err := `, protoPkg.Use(), `.Unmarshal(ungzipped, d); err != nil {`) - p.In() - p.P(`panic(err)`) - p.Out() - p.P(`}`) - p.P(`return d`) - p.Out() - p.P(`}`) - } -} - -func init() { - generator.RegisterPlugin(NewPlugin()) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/description/descriptiontest.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/description/descriptiontest.go deleted file mode 100644 index babcd311da4..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/description/descriptiontest.go +++ /dev/null @@ -1,73 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package description - -import ( - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/plugin/testgen" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" -) - -type test struct { - *generator.Generator -} - -func NewTest(g *generator.Generator) testgen.TestPlugin { - return &test{g} -} - -func (p *test) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool { - used := false - testingPkg := imports.NewImport("testing") - for _, message := range file.Messages() { - if !gogoproto.HasDescription(file.FileDescriptorProto, message.DescriptorProto) || - !gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { - continue - } - if message.DescriptorProto.GetOptions().GetMapEntry() { - continue - } - used = true - } - - if used { - localName := generator.FileName(file) - p.P(`func Test`, localName, `Description(t *`, testingPkg.Use(), `.T) {`) - p.In() - p.P(localName, `Description()`) - p.Out() - p.P(`}`) - - } - return used -} - -func init() { - testgen.RegisterTestPlugin(NewTest) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/embedcheck/embedcheck.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/embedcheck/embedcheck.go deleted file mode 100644 index 1cb77cacb10..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/embedcheck/embedcheck.go +++ /dev/null @@ -1,199 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -/* -The embedcheck plugin is used to check whether embed is not used incorrectly. -For instance: -An embedded message has a generated string method, but the is a member of a message which does not. -This causes a warning. -An error is caused by a namespace conflict. - -It is enabled by the following extensions: - - - embed - - embed_all - -For incorrect usage of embed with tests see: - - github.com/gogo/protobuf/test/embedconflict - -*/ -package embedcheck - -import ( - "fmt" - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" - "os" -) - -type plugin struct { - *generator.Generator -} - -func NewPlugin() *plugin { - return &plugin{} -} - -func (p *plugin) Name() string { - return "embedcheck" -} - -func (p *plugin) Init(g *generator.Generator) { - p.Generator = g -} - -var overwriters []map[string]gogoproto.EnableFunc = []map[string]gogoproto.EnableFunc{ - { - "stringer": gogoproto.IsStringer, - }, - { - "gostring": gogoproto.HasGoString, - }, - { - "equal": gogoproto.HasEqual, - }, - { - "verboseequal": gogoproto.HasVerboseEqual, - }, - { - "size": gogoproto.IsSizer, - "protosizer": gogoproto.IsProtoSizer, - }, - { - "unmarshaler": gogoproto.IsUnmarshaler, - "unsafe_unmarshaler": gogoproto.IsUnsafeUnmarshaler, - }, - { - "marshaler": gogoproto.IsMarshaler, - "unsafe_marshaler": gogoproto.IsUnsafeMarshaler, - }, -} - -func (p *plugin) Generate(file *generator.FileDescriptor) { - for _, msg := range file.Messages() { - for _, os := range overwriters { - possible := true - for _, overwriter := range os { - if overwriter(file.FileDescriptorProto, msg.DescriptorProto) { - possible = false - } - } - if possible { - p.checkOverwrite(msg, os) - } - } - p.checkNameSpace(msg) - for _, field := range msg.GetField() { - if gogoproto.IsEmbed(field) && gogoproto.IsCustomName(field) { - fmt.Fprintf(os.Stderr, "ERROR: field %v with custom name %v cannot be embedded", *field.Name, gogoproto.GetCustomName(field)) - os.Exit(1) - } - } - p.checkRepeated(msg) - } - for _, e := range file.GetExtension() { - if gogoproto.IsEmbed(e) { - fmt.Fprintf(os.Stderr, "ERROR: extended field %v cannot be embedded", generator.CamelCase(*e.Name)) - os.Exit(1) - } - } -} - -func (p *plugin) checkNameSpace(message *generator.Descriptor) map[string]bool { - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - names := make(map[string]bool) - for _, field := range message.Field { - fieldname := generator.CamelCase(*field.Name) - if field.IsMessage() && gogoproto.IsEmbed(field) { - desc := p.ObjectNamed(field.GetTypeName()) - moreNames := p.checkNameSpace(desc.(*generator.Descriptor)) - for another := range moreNames { - if names[another] { - fmt.Fprintf(os.Stderr, "ERROR: duplicate embedded fieldname %v in type %v\n", fieldname, ccTypeName) - os.Exit(1) - } - names[another] = true - } - } else { - if names[fieldname] { - fmt.Fprintf(os.Stderr, "ERROR: duplicate embedded fieldname %v in type %v\n", fieldname, ccTypeName) - os.Exit(1) - } - names[fieldname] = true - } - } - return names -} - -func (p *plugin) checkOverwrite(message *generator.Descriptor, enablers map[string]gogoproto.EnableFunc) { - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - names := []string{} - for name := range enablers { - names = append(names, name) - } - for _, field := range message.Field { - if field.IsMessage() && gogoproto.IsEmbed(field) { - fieldname := generator.CamelCase(*field.Name) - desc := p.ObjectNamed(field.GetTypeName()) - msg := desc.(*generator.Descriptor) - for errStr, enabled := range enablers { - if enabled(msg.File(), msg.DescriptorProto) { - fmt.Fprintf(os.Stderr, "WARNING: found non-%v %v with embedded %v %v\n", names, ccTypeName, errStr, fieldname) - } - } - p.checkOverwrite(msg, enablers) - } - } -} - -func (p *plugin) checkRepeated(message *generator.Descriptor) { - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - for _, field := range message.Field { - if !gogoproto.IsEmbed(field) { - continue - } - if field.IsBytes() { - fieldname := generator.CamelCase(*field.Name) - fmt.Fprintf(os.Stderr, "ERROR: found embedded bytes field %s in message %s\n", fieldname, ccTypeName) - os.Exit(1) - } - if !field.IsRepeated() { - continue - } - fieldname := generator.CamelCase(*field.Name) - fmt.Fprintf(os.Stderr, "ERROR: found repeated embedded field %s in message %s\n", fieldname, ccTypeName) - os.Exit(1) - } -} - -func (p *plugin) GenerateImports(*generator.FileDescriptor) {} - -func init() { - generator.RegisterPlugin(NewPlugin()) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/enumstringer/enumstringer.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/enumstringer/enumstringer.go deleted file mode 100644 index 04d6e547fc3..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/enumstringer/enumstringer.go +++ /dev/null @@ -1,104 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -/* -The enumstringer (experimental) plugin generates a String method for each enum. - -It is enabled by the following extensions: - - - enum_stringer - - enum_stringer_all - -This package is subject to change. - -*/ -package enumstringer - -import ( - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" -) - -type enumstringer struct { - *generator.Generator - generator.PluginImports - atleastOne bool - localName string -} - -func NewEnumStringer() *enumstringer { - return &enumstringer{} -} - -func (p *enumstringer) Name() string { - return "enumstringer" -} - -func (p *enumstringer) Init(g *generator.Generator) { - p.Generator = g -} - -func (p *enumstringer) Generate(file *generator.FileDescriptor) { - p.PluginImports = generator.NewPluginImports(p.Generator) - p.atleastOne = false - - p.localName = generator.FileName(file) - - strconvPkg := p.NewImport("strconv") - - for _, enum := range file.Enums() { - if !gogoproto.IsEnumStringer(file.FileDescriptorProto, enum.EnumDescriptorProto) { - continue - } - if gogoproto.IsGoEnumStringer(file.FileDescriptorProto, enum.EnumDescriptorProto) { - panic("Go enum stringer conflicts with new enumstringer plugin: please use gogoproto.goproto_enum_stringer or gogoproto.goproto_enum_string_all and set it to false") - } - p.atleastOne = true - ccTypeName := generator.CamelCaseSlice(enum.TypeName()) - p.P("func (x ", ccTypeName, ") String() string {") - p.In() - p.P(`s, ok := `, ccTypeName, `_name[int32(x)]`) - p.P(`if ok {`) - p.In() - p.P(`return s`) - p.Out() - p.P(`}`) - p.P(`return `, strconvPkg.Use(), `.Itoa(int(x))`) - p.Out() - p.P(`}`) - } - - if !p.atleastOne { - return - } - -} - -func init() { - generator.RegisterPlugin(NewEnumStringer()) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/equal/equal.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/equal/equal.go deleted file mode 100644 index 6a422635d40..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/equal/equal.go +++ /dev/null @@ -1,645 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -/* -The equal plugin generates an Equal and a VerboseEqual method for each message. -These equal methods are quite obvious. -The only difference is that VerboseEqual returns a non nil error if it is not equal. -This error contains more detail on exactly which part of the message was not equal to the other message. -The idea is that this is useful for debugging. - -Equal is enabled using the following extensions: - - - equal - - equal_all - -While VerboseEqual is enable dusing the following extensions: - - - verbose_equal - - verbose_equal_all - -The equal plugin also generates a test given it is enabled using one of the following extensions: - - - testgen - - testgen_all - -Let us look at: - - github.com/gogo/protobuf/test/example/example.proto - -Btw all the output can be seen at: - - github.com/gogo/protobuf/test/example/* - -The following message: - - option (gogoproto.equal_all) = true; - option (gogoproto.verbose_equal_all) = true; - - message B { - optional A A = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; - repeated bytes G = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false]; - } - -given to the equal plugin, will generate the following code: - - func (this *B) VerboseEqual(that interface{}) error { - if that == nil { - if this == nil { - return nil - } - return fmt2.Errorf("that == nil && this != nil") - } - - that1, ok := that.(*B) - if !ok { - return fmt2.Errorf("that is not of type *B") - } - if that1 == nil { - if this == nil { - return nil - } - return fmt2.Errorf("that is type *B but is nil && this != nil") - } else if this == nil { - return fmt2.Errorf("that is type *B but is not nil && this == nil") - } - if !this.A.Equal(&that1.A) { - return fmt2.Errorf("A this(%v) Not Equal that(%v)", this.A, that1.A) - } - if len(this.G) != len(that1.G) { - return fmt2.Errorf("G this(%v) Not Equal that(%v)", len(this.G), len(that1.G)) - } - for i := range this.G { - if !this.G[i].Equal(that1.G[i]) { - return fmt2.Errorf("G this[%v](%v) Not Equal that[%v](%v)", i, this.G[i], i, that1.G[i]) - } - } - if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { - return fmt2.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) - } - return nil - } - - func (this *B) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*B) - if !ok { - return false - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if !this.A.Equal(&that1.A) { - return false - } - if len(this.G) != len(that1.G) { - return false - } - for i := range this.G { - if !this.G[i].Equal(that1.G[i]) { - return false - } - } - if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { - return false - } - return true - } - -and the following test code: - - func TestBVerboseEqual(t *testing8.T) { - popr := math_rand8.New(math_rand8.NewSource(time8.Now().UnixNano())) - p := NewPopulatedB(popr, false) - dAtA, err := github_com_gogo_protobuf_proto2.Marshal(p) - if err != nil { - panic(err) - } - msg := &B{} - if err := github_com_gogo_protobuf_proto2.Unmarshal(dAtA, msg); err != nil { - panic(err) - } - if err := p.VerboseEqual(msg); err != nil { - t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) - } - -*/ -package equal - -import ( - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/proto" - descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" - "github.com/gogo/protobuf/vanity" -) - -type plugin struct { - *generator.Generator - generator.PluginImports - fmtPkg generator.Single - bytesPkg generator.Single - protoPkg generator.Single -} - -func NewPlugin() *plugin { - return &plugin{} -} - -func (p *plugin) Name() string { - return "equal" -} - -func (p *plugin) Init(g *generator.Generator) { - p.Generator = g -} - -func (p *plugin) Generate(file *generator.FileDescriptor) { - p.PluginImports = generator.NewPluginImports(p.Generator) - p.fmtPkg = p.NewImport("fmt") - p.bytesPkg = p.NewImport("bytes") - p.protoPkg = p.NewImport("github.com/gogo/protobuf/proto") - - for _, msg := range file.Messages() { - if msg.DescriptorProto.GetOptions().GetMapEntry() { - continue - } - if gogoproto.HasVerboseEqual(file.FileDescriptorProto, msg.DescriptorProto) { - p.generateMessage(file, msg, true) - } - if gogoproto.HasEqual(file.FileDescriptorProto, msg.DescriptorProto) { - p.generateMessage(file, msg, false) - } - } -} - -func (p *plugin) generateNullableField(fieldname string, verbose bool) { - p.P(`if this.`, fieldname, ` != nil && that1.`, fieldname, ` != nil {`) - p.In() - p.P(`if *this.`, fieldname, ` != *that1.`, fieldname, `{`) - p.In() - if verbose { - p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, ` this(%v) Not Equal that(%v)", *this.`, fieldname, `, *that1.`, fieldname, `)`) - } else { - p.P(`return false`) - } - p.Out() - p.P(`}`) - p.Out() - p.P(`} else if this.`, fieldname, ` != nil {`) - p.In() - if verbose { - p.P(`return `, p.fmtPkg.Use(), `.Errorf("this.`, fieldname, ` == nil && that.`, fieldname, ` != nil")`) - } else { - p.P(`return false`) - } - p.Out() - p.P(`} else if that1.`, fieldname, ` != nil {`) -} - -func (p *plugin) generateMsgNullAndTypeCheck(ccTypeName string, verbose bool) { - p.P(`if that == nil {`) - p.In() - p.P(`if this == nil {`) - p.In() - if verbose { - p.P(`return nil`) - } else { - p.P(`return true`) - } - p.Out() - p.P(`}`) - if verbose { - p.P(`return `, p.fmtPkg.Use(), `.Errorf("that == nil && this != nil")`) - } else { - p.P(`return false`) - } - p.Out() - p.P(`}`) - p.P(``) - p.P(`that1, ok := that.(*`, ccTypeName, `)`) - p.P(`if !ok {`) - p.In() - p.P(`that2, ok := that.(`, ccTypeName, `)`) - p.P(`if ok {`) - p.In() - p.P(`that1 = &that2`) - p.Out() - p.P(`} else {`) - p.In() - if verbose { - p.P(`return `, p.fmtPkg.Use(), `.Errorf("that is not of type *`, ccTypeName, `")`) - } else { - p.P(`return false`) - } - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - p.P(`if that1 == nil {`) - p.In() - p.P(`if this == nil {`) - p.In() - if verbose { - p.P(`return nil`) - } else { - p.P(`return true`) - } - p.Out() - p.P(`}`) - if verbose { - p.P(`return `, p.fmtPkg.Use(), `.Errorf("that is type *`, ccTypeName, ` but is nil && this != nil")`) - } else { - p.P(`return false`) - } - p.Out() - p.P(`} else if this == nil {`) - p.In() - if verbose { - p.P(`return `, p.fmtPkg.Use(), `.Errorf("that is type *`, ccTypeName, ` but is not nil && this == nil")`) - } else { - p.P(`return false`) - } - p.Out() - p.P(`}`) -} - -func (p *plugin) generateField(file *generator.FileDescriptor, message *generator.Descriptor, field *descriptor.FieldDescriptorProto, verbose bool) { - proto3 := gogoproto.IsProto3(file.FileDescriptorProto) - fieldname := p.GetOneOfFieldName(message, field) - repeated := field.IsRepeated() - ctype := gogoproto.IsCustomType(field) - nullable := gogoproto.IsNullable(field) - isDuration := gogoproto.IsStdDuration(field) - isTimestamp := gogoproto.IsStdTime(field) - // oneof := field.OneofIndex != nil - if !repeated { - if ctype || isTimestamp { - if nullable { - p.P(`if that1.`, fieldname, ` == nil {`) - p.In() - p.P(`if this.`, fieldname, ` != nil {`) - p.In() - if verbose { - p.P(`return `, p.fmtPkg.Use(), `.Errorf("this.`, fieldname, ` != nil && that1.`, fieldname, ` == nil")`) - } else { - p.P(`return false`) - } - p.Out() - p.P(`}`) - p.Out() - p.P(`} else if !this.`, fieldname, `.Equal(*that1.`, fieldname, `) {`) - } else { - p.P(`if !this.`, fieldname, `.Equal(that1.`, fieldname, `) {`) - } - p.In() - if verbose { - p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, ` this(%v) Not Equal that(%v)", this.`, fieldname, `, that1.`, fieldname, `)`) - } else { - p.P(`return false`) - } - p.Out() - p.P(`}`) - } else if isDuration { - if nullable { - p.generateNullableField(fieldname, verbose) - } else { - p.P(`if this.`, fieldname, ` != that1.`, fieldname, `{`) - } - p.In() - if verbose { - p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, ` this(%v) Not Equal that(%v)", this.`, fieldname, `, that1.`, fieldname, `)`) - } else { - p.P(`return false`) - } - p.Out() - p.P(`}`) - } else { - if field.IsMessage() || p.IsGroup(field) { - if nullable { - p.P(`if !this.`, fieldname, `.Equal(that1.`, fieldname, `) {`) - } else { - p.P(`if !this.`, fieldname, `.Equal(&that1.`, fieldname, `) {`) - } - } else if field.IsBytes() { - p.P(`if !`, p.bytesPkg.Use(), `.Equal(this.`, fieldname, `, that1.`, fieldname, `) {`) - } else if field.IsString() { - if nullable && !proto3 { - p.generateNullableField(fieldname, verbose) - } else { - p.P(`if this.`, fieldname, ` != that1.`, fieldname, `{`) - } - } else { - if nullable && !proto3 { - p.generateNullableField(fieldname, verbose) - } else { - p.P(`if this.`, fieldname, ` != that1.`, fieldname, `{`) - } - } - p.In() - if verbose { - p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, ` this(%v) Not Equal that(%v)", this.`, fieldname, `, that1.`, fieldname, `)`) - } else { - p.P(`return false`) - } - p.Out() - p.P(`}`) - } - } else { - p.P(`if len(this.`, fieldname, `) != len(that1.`, fieldname, `) {`) - p.In() - if verbose { - p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, ` this(%v) Not Equal that(%v)", len(this.`, fieldname, `), len(that1.`, fieldname, `))`) - } else { - p.P(`return false`) - } - p.Out() - p.P(`}`) - p.P(`for i := range this.`, fieldname, ` {`) - p.In() - if ctype && !p.IsMap(field) { - p.P(`if !this.`, fieldname, `[i].Equal(that1.`, fieldname, `[i]) {`) - } else if isTimestamp { - if nullable { - p.P(`if !this.`, fieldname, `[i].Equal(*that1.`, fieldname, `[i]) {`) - } else { - p.P(`if !this.`, fieldname, `[i].Equal(that1.`, fieldname, `[i]) {`) - } - } else if isDuration { - if nullable { - p.P(`if dthis, dthat := this.`, fieldname, `[i], that1.`, fieldname, `[i]; (dthis != nil && dthat != nil && *dthis != *dthat) || (dthis != nil && dthat == nil) || (dthis == nil && dthat != nil) {`) - } else { - p.P(`if this.`, fieldname, `[i] != that1.`, fieldname, `[i] {`) - } - } else { - if p.IsMap(field) { - m := p.GoMapType(nil, field) - valuegoTyp, _ := p.GoType(nil, m.ValueField) - valuegoAliasTyp, _ := p.GoType(nil, m.ValueAliasField) - nullable, valuegoTyp, valuegoAliasTyp = generator.GoMapValueTypes(field, m.ValueField, valuegoTyp, valuegoAliasTyp) - - mapValue := m.ValueAliasField - if mapValue.IsMessage() || p.IsGroup(mapValue) { - if nullable && valuegoTyp == valuegoAliasTyp { - p.P(`if !this.`, fieldname, `[i].Equal(that1.`, fieldname, `[i]) {`) - } else { - // Equal() has a pointer receiver, but map value is a value type - a := `this.` + fieldname + `[i]` - b := `that1.` + fieldname + `[i]` - if valuegoTyp != valuegoAliasTyp { - // cast back to the type that has the generated methods on it - a = `(` + valuegoTyp + `)(` + a + `)` - b = `(` + valuegoTyp + `)(` + b + `)` - } - p.P(`a := `, a) - p.P(`b := `, b) - if nullable { - p.P(`if !a.Equal(b) {`) - } else { - p.P(`if !(&a).Equal(&b) {`) - } - } - } else if mapValue.IsBytes() { - if ctype { - if nullable { - p.P(`if !this.`, fieldname, `[i].Equal(*that1.`, fieldname, `[i]) { //nullable`) - } else { - p.P(`if !this.`, fieldname, `[i].Equal(that1.`, fieldname, `[i]) { //not nullable`) - } - } else { - p.P(`if !`, p.bytesPkg.Use(), `.Equal(this.`, fieldname, `[i], that1.`, fieldname, `[i]) {`) - } - } else if mapValue.IsString() { - p.P(`if this.`, fieldname, `[i] != that1.`, fieldname, `[i] {`) - } else { - p.P(`if this.`, fieldname, `[i] != that1.`, fieldname, `[i] {`) - } - } else if field.IsMessage() || p.IsGroup(field) { - if nullable { - p.P(`if !this.`, fieldname, `[i].Equal(that1.`, fieldname, `[i]) {`) - } else { - p.P(`if !this.`, fieldname, `[i].Equal(&that1.`, fieldname, `[i]) {`) - } - } else if field.IsBytes() { - p.P(`if !`, p.bytesPkg.Use(), `.Equal(this.`, fieldname, `[i], that1.`, fieldname, `[i]) {`) - } else if field.IsString() { - p.P(`if this.`, fieldname, `[i] != that1.`, fieldname, `[i] {`) - } else { - p.P(`if this.`, fieldname, `[i] != that1.`, fieldname, `[i] {`) - } - } - p.In() - if verbose { - p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, ` this[%v](%v) Not Equal that[%v](%v)", i, this.`, fieldname, `[i], i, that1.`, fieldname, `[i])`) - } else { - p.P(`return false`) - } - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - } -} - -func (p *plugin) generateMessage(file *generator.FileDescriptor, message *generator.Descriptor, verbose bool) { - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - if verbose { - p.P(`func (this *`, ccTypeName, `) VerboseEqual(that interface{}) error {`) - } else { - p.P(`func (this *`, ccTypeName, `) Equal(that interface{}) bool {`) - } - p.In() - p.generateMsgNullAndTypeCheck(ccTypeName, verbose) - oneofs := make(map[string]struct{}) - - for _, field := range message.Field { - oneof := field.OneofIndex != nil - if oneof { - fieldname := p.GetFieldName(message, field) - if _, ok := oneofs[fieldname]; ok { - continue - } else { - oneofs[fieldname] = struct{}{} - } - p.P(`if that1.`, fieldname, ` == nil {`) - p.In() - p.P(`if this.`, fieldname, ` != nil {`) - p.In() - if verbose { - p.P(`return `, p.fmtPkg.Use(), `.Errorf("this.`, fieldname, ` != nil && that1.`, fieldname, ` == nil")`) - } else { - p.P(`return false`) - } - p.Out() - p.P(`}`) - p.Out() - p.P(`} else if this.`, fieldname, ` == nil {`) - p.In() - if verbose { - p.P(`return `, p.fmtPkg.Use(), `.Errorf("this.`, fieldname, ` == nil && that1.`, fieldname, ` != nil")`) - } else { - p.P(`return false`) - } - p.Out() - if verbose { - p.P(`} else if err := this.`, fieldname, `.VerboseEqual(that1.`, fieldname, `); err != nil {`) - } else { - p.P(`} else if !this.`, fieldname, `.Equal(that1.`, fieldname, `) {`) - } - p.In() - if verbose { - p.P(`return err`) - } else { - p.P(`return false`) - } - p.Out() - p.P(`}`) - } else { - p.generateField(file, message, field, verbose) - } - } - if message.DescriptorProto.HasExtension() { - if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) { - fieldname := "XXX_InternalExtensions" - p.P(`thismap := `, p.protoPkg.Use(), `.GetUnsafeExtensionsMap(this)`) - p.P(`thatmap := `, p.protoPkg.Use(), `.GetUnsafeExtensionsMap(that1)`) - p.P(`for k, v := range thismap {`) - p.In() - p.P(`if v2, ok := thatmap[k]; ok {`) - p.In() - p.P(`if !v.Equal(&v2) {`) - p.In() - if verbose { - p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, ` this[%v](%v) Not Equal that[%v](%v)", k, thismap[k], k, thatmap[k])`) - } else { - p.P(`return false`) - } - p.Out() - p.P(`}`) - p.Out() - p.P(`} else {`) - p.In() - if verbose { - p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, `[%v] Not In that", k)`) - } else { - p.P(`return false`) - } - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - - p.P(`for k, _ := range thatmap {`) - p.In() - p.P(`if _, ok := thismap[k]; !ok {`) - p.In() - if verbose { - p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, `[%v] Not In this", k)`) - } else { - p.P(`return false`) - } - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - } else { - fieldname := "XXX_extensions" - p.P(`if !`, p.bytesPkg.Use(), `.Equal(this.`, fieldname, `, that1.`, fieldname, `) {`) - p.In() - if verbose { - p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, ` this(%v) Not Equal that(%v)", this.`, fieldname, `, that1.`, fieldname, `)`) - } else { - p.P(`return false`) - } - p.Out() - p.P(`}`) - } - } - if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) { - fieldname := "XXX_unrecognized" - p.P(`if !`, p.bytesPkg.Use(), `.Equal(this.`, fieldname, `, that1.`, fieldname, `) {`) - p.In() - if verbose { - p.P(`return `, p.fmtPkg.Use(), `.Errorf("`, fieldname, ` this(%v) Not Equal that(%v)", this.`, fieldname, `, that1.`, fieldname, `)`) - } else { - p.P(`return false`) - } - p.Out() - p.P(`}`) - } - if verbose { - p.P(`return nil`) - } else { - p.P(`return true`) - } - p.Out() - p.P(`}`) - - //Generate Equal methods for oneof fields - m := proto.Clone(message.DescriptorProto).(*descriptor.DescriptorProto) - for _, field := range m.Field { - oneof := field.OneofIndex != nil - if !oneof { - continue - } - ccTypeName := p.OneOfTypeName(message, field) - if verbose { - p.P(`func (this *`, ccTypeName, `) VerboseEqual(that interface{}) error {`) - } else { - p.P(`func (this *`, ccTypeName, `) Equal(that interface{}) bool {`) - } - p.In() - - p.generateMsgNullAndTypeCheck(ccTypeName, verbose) - vanity.TurnOffNullableForNativeTypesWithoutDefaultsOnly(field) - p.generateField(file, message, field, verbose) - - if verbose { - p.P(`return nil`) - } else { - p.P(`return true`) - } - p.Out() - p.P(`}`) - } -} - -func init() { - generator.RegisterPlugin(NewPlugin()) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/equal/equaltest.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/equal/equaltest.go deleted file mode 100644 index 8a47a0c9be7..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/equal/equaltest.go +++ /dev/null @@ -1,96 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package equal - -import ( - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/plugin/testgen" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" -) - -type test struct { - *generator.Generator -} - -func NewTest(g *generator.Generator) testgen.TestPlugin { - return &test{g} -} - -func (p *test) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool { - used := false - randPkg := imports.NewImport("math/rand") - timePkg := imports.NewImport("time") - testingPkg := imports.NewImport("testing") - protoPkg := imports.NewImport("github.com/gogo/protobuf/proto") - if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { - protoPkg = imports.NewImport("github.com/golang/protobuf/proto") - } - for _, message := range file.Messages() { - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - if !gogoproto.HasVerboseEqual(file.FileDescriptorProto, message.DescriptorProto) { - continue - } - if message.DescriptorProto.GetOptions().GetMapEntry() { - continue - } - - if gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { - used = true - p.P(`func Test`, ccTypeName, `VerboseEqual(t *`, testingPkg.Use(), `.T) {`) - p.In() - p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(`, timePkg.Use(), `.Now().UnixNano()))`) - p.P(`p := NewPopulated`, ccTypeName, `(popr, false)`) - p.P(`dAtA, err := `, protoPkg.Use(), `.Marshal(p)`) - p.P(`if err != nil {`) - p.In() - p.P(`panic(err)`) - p.Out() - p.P(`}`) - p.P(`msg := &`, ccTypeName, `{}`) - p.P(`if err := `, protoPkg.Use(), `.Unmarshal(dAtA, msg); err != nil {`) - p.In() - p.P(`panic(err)`) - p.Out() - p.P(`}`) - p.P(`if err := p.VerboseEqual(msg); err != nil {`) - p.In() - p.P(`t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)`) - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - } - - } - return used -} - -func init() { - testgen.RegisterTestPlugin(NewTest) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/face/face.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/face/face.go deleted file mode 100644 index a0293452652..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/face/face.go +++ /dev/null @@ -1,233 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -/* -The face plugin generates a function will be generated which can convert a structure which satisfies an interface (face) to the specified structure. -This interface contains getters for each of the fields in the struct. -The specified struct is also generated with the getters. -This means that getters should be turned off so as not to conflict with face getters. -This allows it to satisfy its own face. - -It is enabled by the following extensions: - - - face - - face_all - -Turn off getters by using the following extensions: - - - getters - - getters_all - -The face plugin also generates a test given it is enabled using one of the following extensions: - - - testgen - - testgen_all - -Let us look at: - - github.com/gogo/protobuf/test/example/example.proto - -Btw all the output can be seen at: - - github.com/gogo/protobuf/test/example/* - -The following message: - - message A { - option (gogoproto.face) = true; - option (gogoproto.goproto_getters) = false; - optional string Description = 1 [(gogoproto.nullable) = false]; - optional int64 Number = 2 [(gogoproto.nullable) = false]; - optional bytes Id = 3 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uuid", (gogoproto.nullable) = false]; - } - -given to the face plugin, will generate the following code: - - type AFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetDescription() string - GetNumber() int64 - GetId() github_com_gogo_protobuf_test_custom.Uuid - } - - func (this *A) Proto() github_com_gogo_protobuf_proto.Message { - return this - } - - func (this *A) TestProto() github_com_gogo_protobuf_proto.Message { - return NewAFromFace(this) - } - - func (this *A) GetDescription() string { - return this.Description - } - - func (this *A) GetNumber() int64 { - return this.Number - } - - func (this *A) GetId() github_com_gogo_protobuf_test_custom.Uuid { - return this.Id - } - - func NewAFromFace(that AFace) *A { - this := &A{} - this.Description = that.GetDescription() - this.Number = that.GetNumber() - this.Id = that.GetId() - return this - } - -and the following test code: - - func TestAFace(t *testing7.T) { - popr := math_rand7.New(math_rand7.NewSource(time7.Now().UnixNano())) - p := NewPopulatedA(popr, true) - msg := p.TestProto() - if !p.Equal(msg) { - t.Fatalf("%#v !Face Equal %#v", msg, p) - } - } - -The struct A, representing the message, will also be generated just like always. -As you can see A satisfies its own Face, AFace. - -Creating another struct which satisfies AFace is very easy. -Simply create all these methods specified in AFace. -Implementing The Proto method is done with the helper function NewAFromFace: - - func (this *MyStruct) Proto() proto.Message { - return NewAFromFace(this) - } - -just the like TestProto method which is used to test the NewAFromFace function. - -*/ -package face - -import ( - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" -) - -type plugin struct { - *generator.Generator - generator.PluginImports -} - -func NewPlugin() *plugin { - return &plugin{} -} - -func (p *plugin) Name() string { - return "face" -} - -func (p *plugin) Init(g *generator.Generator) { - p.Generator = g -} - -func (p *plugin) Generate(file *generator.FileDescriptor) { - p.PluginImports = generator.NewPluginImports(p.Generator) - protoPkg := p.NewImport("github.com/gogo/protobuf/proto") - if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { - protoPkg = p.NewImport("github.com/golang/protobuf/proto") - } - for _, message := range file.Messages() { - if !gogoproto.IsFace(file.FileDescriptorProto, message.DescriptorProto) { - continue - } - if message.DescriptorProto.GetOptions().GetMapEntry() { - continue - } - if message.DescriptorProto.HasExtension() { - panic("face does not support message with extensions") - } - if gogoproto.HasGoGetters(file.FileDescriptorProto, message.DescriptorProto) { - panic("face requires getters to be disabled please use gogoproto.getters or gogoproto.getters_all and set it to false") - } - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - p.P(`type `, ccTypeName, `Face interface{`) - p.In() - p.P(`Proto() `, protoPkg.Use(), `.Message`) - for _, field := range message.Field { - fieldname := p.GetFieldName(message, field) - goTyp, _ := p.GoType(message, field) - if p.IsMap(field) { - m := p.GoMapType(nil, field) - goTyp = m.GoType - } - p.P(`Get`, fieldname, `() `, goTyp) - } - p.Out() - p.P(`}`) - p.P(``) - p.P(`func (this *`, ccTypeName, `) Proto() `, protoPkg.Use(), `.Message {`) - p.In() - p.P(`return this`) - p.Out() - p.P(`}`) - p.P(``) - p.P(`func (this *`, ccTypeName, `) TestProto() `, protoPkg.Use(), `.Message {`) - p.In() - p.P(`return New`, ccTypeName, `FromFace(this)`) - p.Out() - p.P(`}`) - p.P(``) - for _, field := range message.Field { - fieldname := p.GetFieldName(message, field) - goTyp, _ := p.GoType(message, field) - if p.IsMap(field) { - m := p.GoMapType(nil, field) - goTyp = m.GoType - } - p.P(`func (this *`, ccTypeName, `) Get`, fieldname, `() `, goTyp, `{`) - p.In() - p.P(` return this.`, fieldname) - p.Out() - p.P(`}`) - p.P(``) - } - p.P(``) - p.P(`func New`, ccTypeName, `FromFace(that `, ccTypeName, `Face) *`, ccTypeName, ` {`) - p.In() - p.P(`this := &`, ccTypeName, `{}`) - for _, field := range message.Field { - fieldname := p.GetFieldName(message, field) - p.P(`this.`, fieldname, ` = that.Get`, fieldname, `()`) - } - p.P(`return this`) - p.Out() - p.P(`}`) - p.P(``) - } -} - -func init() { - generator.RegisterPlugin(NewPlugin()) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/face/facetest.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/face/facetest.go deleted file mode 100644 index 467cc0a6640..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/face/facetest.go +++ /dev/null @@ -1,82 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package face - -import ( - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/plugin/testgen" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" -) - -type test struct { - *generator.Generator -} - -func NewTest(g *generator.Generator) testgen.TestPlugin { - return &test{g} -} - -func (p *test) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool { - used := false - randPkg := imports.NewImport("math/rand") - timePkg := imports.NewImport("time") - testingPkg := imports.NewImport("testing") - for _, message := range file.Messages() { - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - if !gogoproto.IsFace(file.FileDescriptorProto, message.DescriptorProto) { - continue - } - if message.DescriptorProto.GetOptions().GetMapEntry() { - continue - } - - if gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { - used = true - - p.P(`func Test`, ccTypeName, `Face(t *`, testingPkg.Use(), `.T) {`) - p.In() - p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(`, timePkg.Use(), `.Now().UnixNano()))`) - p.P(`p := NewPopulated`, ccTypeName, `(popr, true)`) - p.P(`msg := p.TestProto()`) - p.P(`if !p.Equal(msg) {`) - p.In() - p.P(`t.Fatalf("%#v !Face Equal %#v", msg, p)`) - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - } - - } - return used -} - -func init() { - testgen.RegisterTestPlugin(NewTest) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/gostring/gostring.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/gostring/gostring.go deleted file mode 100644 index 789cc5d1d95..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/gostring/gostring.go +++ /dev/null @@ -1,368 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -/* -The gostring plugin generates a GoString method for each message. -The GoString method is called whenever you use a fmt.Printf as such: - - fmt.Printf("%#v", mymessage) - -or whenever you actually call GoString() -The output produced by the GoString method can be copied from the output into code and used to set a variable. -It is totally valid Go Code and is populated exactly as the struct that was printed out. - -It is enabled by the following extensions: - - - gostring - - gostring_all - -The gostring plugin also generates a test given it is enabled using one of the following extensions: - - - testgen - - testgen_all - -Let us look at: - - github.com/gogo/protobuf/test/example/example.proto - -Btw all the output can be seen at: - - github.com/gogo/protobuf/test/example/* - -The following message: - - option (gogoproto.gostring_all) = true; - - message A { - optional string Description = 1 [(gogoproto.nullable) = false]; - optional int64 Number = 2 [(gogoproto.nullable) = false]; - optional bytes Id = 3 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uuid", (gogoproto.nullable) = false]; - } - -given to the gostring plugin, will generate the following code: - - func (this *A) GoString() string { - if this == nil { - return "nil" - } - s := strings1.Join([]string{`&test.A{` + `Description:` + fmt1.Sprintf("%#v", this.Description), `Number:` + fmt1.Sprintf("%#v", this.Number), `Id:` + fmt1.Sprintf("%#v", this.Id), `XXX_unrecognized:` + fmt1.Sprintf("%#v", this.XXX_unrecognized) + `}`}, ", ") - return s - } - -and the following test code: - - func TestAGoString(t *testing6.T) { - popr := math_rand6.New(math_rand6.NewSource(time6.Now().UnixNano())) - p := NewPopulatedA(popr, false) - s1 := p.GoString() - s2 := fmt2.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - panic(err) - } - } - -Typically fmt.Printf("%#v") will stop to print when it reaches a pointer and -not print their values, while the generated GoString method will always print all values, recursively. - -*/ -package gostring - -import ( - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" - "strconv" - "strings" -) - -type gostring struct { - *generator.Generator - generator.PluginImports - atleastOne bool - localName string - overwrite bool -} - -func NewGoString() *gostring { - return &gostring{} -} - -func (p *gostring) Name() string { - return "gostring" -} - -func (p *gostring) Overwrite() { - p.overwrite = true -} - -func (p *gostring) Init(g *generator.Generator) { - p.Generator = g -} - -func (p *gostring) Generate(file *generator.FileDescriptor) { - proto3 := gogoproto.IsProto3(file.FileDescriptorProto) - p.PluginImports = generator.NewPluginImports(p.Generator) - p.atleastOne = false - - p.localName = generator.FileName(file) - - fmtPkg := p.NewImport("fmt") - stringsPkg := p.NewImport("strings") - protoPkg := p.NewImport("github.com/gogo/protobuf/proto") - if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { - protoPkg = p.NewImport("github.com/golang/protobuf/proto") - } - sortPkg := p.NewImport("sort") - strconvPkg := p.NewImport("strconv") - reflectPkg := p.NewImport("reflect") - sortKeysPkg := p.NewImport("github.com/gogo/protobuf/sortkeys") - - for _, message := range file.Messages() { - if !p.overwrite && !gogoproto.HasGoString(file.FileDescriptorProto, message.DescriptorProto) { - continue - } - if message.DescriptorProto.GetOptions().GetMapEntry() { - continue - } - p.atleastOne = true - packageName := file.PackageName() - - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - p.P(`func (this *`, ccTypeName, `) GoString() string {`) - p.In() - p.P(`if this == nil {`) - p.In() - p.P(`return "nil"`) - p.Out() - p.P(`}`) - - p.P(`s := make([]string, 0, `, strconv.Itoa(len(message.Field)+4), `)`) - p.P(`s = append(s, "&`, packageName, ".", ccTypeName, `{")`) - - oneofs := make(map[string]struct{}) - for _, field := range message.Field { - nullable := gogoproto.IsNullable(field) - repeated := field.IsRepeated() - fieldname := p.GetFieldName(message, field) - oneof := field.OneofIndex != nil - if oneof { - if _, ok := oneofs[fieldname]; ok { - continue - } else { - oneofs[fieldname] = struct{}{} - } - p.P(`if this.`, fieldname, ` != nil {`) - p.In() - p.P(`s = append(s, "`, fieldname, `: " + `, fmtPkg.Use(), `.Sprintf("%#v", this.`, fieldname, `) + ",\n")`) - p.Out() - p.P(`}`) - } else if p.IsMap(field) { - m := p.GoMapType(nil, field) - mapgoTyp, keyField, keyAliasField := m.GoType, m.KeyField, m.KeyAliasField - keysName := `keysFor` + fieldname - keygoTyp, _ := p.GoType(nil, keyField) - keygoTyp = strings.Replace(keygoTyp, "*", "", 1) - keygoAliasTyp, _ := p.GoType(nil, keyAliasField) - keygoAliasTyp = strings.Replace(keygoAliasTyp, "*", "", 1) - keyCapTyp := generator.CamelCase(keygoTyp) - p.P(keysName, ` := make([]`, keygoTyp, `, 0, len(this.`, fieldname, `))`) - p.P(`for k, _ := range this.`, fieldname, ` {`) - p.In() - if keygoAliasTyp == keygoTyp { - p.P(keysName, ` = append(`, keysName, `, k)`) - } else { - p.P(keysName, ` = append(`, keysName, `, `, keygoTyp, `(k))`) - } - p.Out() - p.P(`}`) - p.P(sortKeysPkg.Use(), `.`, keyCapTyp, `s(`, keysName, `)`) - mapName := `mapStringFor` + fieldname - p.P(mapName, ` := "`, mapgoTyp, `{"`) - p.P(`for _, k := range `, keysName, ` {`) - p.In() - if keygoAliasTyp == keygoTyp { - p.P(mapName, ` += fmt.Sprintf("%#v: %#v,", k, this.`, fieldname, `[k])`) - } else { - p.P(mapName, ` += fmt.Sprintf("%#v: %#v,", k, this.`, fieldname, `[`, keygoAliasTyp, `(k)])`) - } - p.Out() - p.P(`}`) - p.P(mapName, ` += "}"`) - p.P(`if this.`, fieldname, ` != nil {`) - p.In() - p.P(`s = append(s, "`, fieldname, `: " + `, mapName, `+ ",\n")`) - p.Out() - p.P(`}`) - } else if field.IsMessage() || p.IsGroup(field) { - if nullable || repeated { - p.P(`if this.`, fieldname, ` != nil {`) - p.In() - } - if nullable || repeated { - p.P(`s = append(s, "`, fieldname, `: " + `, fmtPkg.Use(), `.Sprintf("%#v", this.`, fieldname, `) + ",\n")`) - } else { - p.P(`s = append(s, "`, fieldname, `: " + `, stringsPkg.Use(), `.Replace(this.`, fieldname, `.GoString()`, ",`&`,``,1)", ` + ",\n")`) - } - if nullable || repeated { - p.Out() - p.P(`}`) - } - } else { - if !proto3 && (nullable || repeated) { - p.P(`if this.`, fieldname, ` != nil {`) - p.In() - } - if field.IsEnum() { - if nullable && !repeated && !proto3 { - goTyp, _ := p.GoType(message, field) - p.P(`s = append(s, "`, fieldname, `: " + valueToGoString`, p.localName, `(this.`, fieldname, `,"`, packageName, ".", generator.GoTypeToName(goTyp), `"`, `) + ",\n")`) - } else { - p.P(`s = append(s, "`, fieldname, `: " + `, fmtPkg.Use(), `.Sprintf("%#v", this.`, fieldname, `) + ",\n")`) - } - } else { - if nullable && !repeated && !proto3 { - goTyp, _ := p.GoType(message, field) - p.P(`s = append(s, "`, fieldname, `: " + valueToGoString`, p.localName, `(this.`, fieldname, `,"`, generator.GoTypeToName(goTyp), `"`, `) + ",\n")`) - } else { - p.P(`s = append(s, "`, fieldname, `: " + `, fmtPkg.Use(), `.Sprintf("%#v", this.`, fieldname, `) + ",\n")`) - } - } - if !proto3 && (nullable || repeated) { - p.Out() - p.P(`}`) - } - } - } - if message.DescriptorProto.HasExtension() { - if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) { - p.P(`s = append(s, "XXX_InternalExtensions: " + extensionToGoString`, p.localName, `(this) + ",\n")`) - } else { - p.P(`if this.XXX_extensions != nil {`) - p.In() - p.P(`s = append(s, "XXX_extensions: " + `, fmtPkg.Use(), `.Sprintf("%#v", this.XXX_extensions) + ",\n")`) - p.Out() - p.P(`}`) - } - } - if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) { - p.P(`if this.XXX_unrecognized != nil {`) - p.In() - p.P(`s = append(s, "XXX_unrecognized:" + `, fmtPkg.Use(), `.Sprintf("%#v", this.XXX_unrecognized) + ",\n")`) - p.Out() - p.P(`}`) - } - - p.P(`s = append(s, "}")`) - //outStr += strings.Join([]string{" + `}`", `}`, `,", "`, ")"}, "") - p.P(`return `, stringsPkg.Use(), `.Join(s, "")`) - p.Out() - p.P(`}`) - - //Generate GoString methods for oneof fields - for _, field := range message.Field { - oneof := field.OneofIndex != nil - if !oneof { - continue - } - ccTypeName := p.OneOfTypeName(message, field) - p.P(`func (this *`, ccTypeName, `) GoString() string {`) - p.In() - p.P(`if this == nil {`) - p.In() - p.P(`return "nil"`) - p.Out() - p.P(`}`) - outFlds := []string{} - fieldname := p.GetOneOfFieldName(message, field) - if field.IsMessage() || p.IsGroup(field) { - tmp := strings.Join([]string{"`", fieldname, ":` + "}, "") - tmp += strings.Join([]string{fmtPkg.Use(), `.Sprintf("%#v", this.`, fieldname, `)`}, "") - outFlds = append(outFlds, tmp) - } else { - tmp := strings.Join([]string{"`", fieldname, ":` + "}, "") - tmp += strings.Join([]string{fmtPkg.Use(), `.Sprintf("%#v", this.`, fieldname, ")"}, "") - outFlds = append(outFlds, tmp) - } - outStr := strings.Join([]string{"s := ", stringsPkg.Use(), ".Join([]string{`&", packageName, ".", ccTypeName, "{` + \n"}, "") - outStr += strings.Join(outFlds, ",\n") - outStr += strings.Join([]string{" + `}`", `}`, `,", "`, ")"}, "") - p.P(outStr) - p.P(`return s`) - p.Out() - p.P(`}`) - } - } - - if !p.atleastOne { - return - } - - p.P(`func valueToGoString`, p.localName, `(v interface{}, typ string) string {`) - p.In() - p.P(`rv := `, reflectPkg.Use(), `.ValueOf(v)`) - p.P(`if rv.IsNil() {`) - p.In() - p.P(`return "nil"`) - p.Out() - p.P(`}`) - p.P(`pv := `, reflectPkg.Use(), `.Indirect(rv).Interface()`) - p.P(`return `, fmtPkg.Use(), `.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)`) - p.Out() - p.P(`}`) - - p.P(`func extensionToGoString`, p.localName, `(m `, protoPkg.Use(), `.Message) string {`) - p.In() - p.P(`e := `, protoPkg.Use(), `.GetUnsafeExtensionsMap(m)`) - p.P(`if e == nil { return "nil" }`) - p.P(`s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{"`) - p.P(`keys := make([]int, 0, len(e))`) - p.P(`for k := range e {`) - p.In() - p.P(`keys = append(keys, int(k))`) - p.Out() - p.P(`}`) - p.P(sortPkg.Use(), `.Ints(keys)`) - p.P(`ss := []string{}`) - p.P(`for _, k := range keys {`) - p.In() - p.P(`ss = append(ss, `, strconvPkg.Use(), `.Itoa(k) + ": " + e[int32(k)].GoString())`) - p.Out() - p.P(`}`) - p.P(`s+=`, stringsPkg.Use(), `.Join(ss, ",") + "})"`) - p.P(`return s`) - p.Out() - p.P(`}`) - -} - -func init() { - generator.RegisterPlugin(NewGoString()) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/gostring/gostringtest.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/gostring/gostringtest.go deleted file mode 100644 index c7e6c16980e..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/gostring/gostringtest.go +++ /dev/null @@ -1,90 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package gostring - -import ( - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/plugin/testgen" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" -) - -type test struct { - *generator.Generator -} - -func NewTest(g *generator.Generator) testgen.TestPlugin { - return &test{g} -} - -func (p *test) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool { - used := false - randPkg := imports.NewImport("math/rand") - timePkg := imports.NewImport("time") - testingPkg := imports.NewImport("testing") - fmtPkg := imports.NewImport("fmt") - parserPkg := imports.NewImport("go/parser") - for _, message := range file.Messages() { - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - if !gogoproto.HasGoString(file.FileDescriptorProto, message.DescriptorProto) { - continue - } - if message.DescriptorProto.GetOptions().GetMapEntry() { - continue - } - - if gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { - used = true - p.P(`func Test`, ccTypeName, `GoString(t *`, testingPkg.Use(), `.T) {`) - p.In() - p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(`, timePkg.Use(), `.Now().UnixNano()))`) - p.P(`p := NewPopulated`, ccTypeName, `(popr, false)`) - p.P(`s1 := p.GoString()`) - p.P(`s2 := `, fmtPkg.Use(), `.Sprintf("%#v", p)`) - p.P(`if s1 != s2 {`) - p.In() - p.P(`t.Fatalf("GoString want %v got %v", s1, s2)`) - p.Out() - p.P(`}`) - p.P(`_, err := `, parserPkg.Use(), `.ParseExpr(s1)`) - p.P(`if err != nil {`) - p.In() - p.P(`panic(err)`) - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - } - - } - return used -} - -func init() { - testgen.RegisterTestPlugin(NewTest) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/marshalto/marshalto.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/marshalto/marshalto.go deleted file mode 100644 index d8b1af09e45..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/marshalto/marshalto.go +++ /dev/null @@ -1,1423 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -/* -The marshalto plugin generates a Marshal and MarshalTo method for each message. -The `Marshal() ([]byte, error)` method results in the fact that the message -implements the Marshaler interface. -This allows proto.Marshal to be faster by calling the generated Marshal method rather than using reflect to Marshal the struct. - -If is enabled by the following extensions: - - - marshaler - - marshaler_all - -Or the following extensions: - - - unsafe_marshaler - - unsafe_marshaler_all - -That is if you want to use the unsafe package in your generated code. -The speed up using the unsafe package is not very significant. - -The generation of marshalling tests are enabled using one of the following extensions: - - - testgen - - testgen_all - -And benchmarks given it is enabled using one of the following extensions: - - - benchgen - - benchgen_all - -Let us look at: - - github.com/gogo/protobuf/test/example/example.proto - -Btw all the output can be seen at: - - github.com/gogo/protobuf/test/example/* - -The following message: - -option (gogoproto.marshaler_all) = true; - -message B { - option (gogoproto.description) = true; - optional A A = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; - repeated bytes G = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false]; -} - -given to the marshalto plugin, will generate the following code: - - func (m *B) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil - } - - func (m *B) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintExample(dAtA, i, uint64(m.A.Size())) - n2, err := m.A.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 - if len(m.G) > 0 { - for _, msg := range m.G { - dAtA[i] = 0x12 - i++ - i = encodeVarintExample(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil - } - -As shown above Marshal calculates the size of the not yet marshalled message -and allocates the appropriate buffer. -This is followed by calling the MarshalTo method which requires a preallocated buffer. -The MarshalTo method allows a user to rather preallocated a reusable buffer. - -The Size method is generated using the size plugin and the gogoproto.sizer, gogoproto.sizer_all extensions. -The user can also using the generated Size method to check that his reusable buffer is still big enough. - -The generated tests and benchmarks will keep you safe and show that this is really a significant speed improvement. - -An additional message-level option `stable_marshaler` (and the file-level -option `stable_marshaler_all`) exists which causes the generated marshalling -code to behave deterministically. Today, this only changes the serialization of -maps; they are serialized in sort order. -*/ -package marshalto - -import ( - "fmt" - "sort" - "strconv" - "strings" - - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/proto" - descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" - "github.com/gogo/protobuf/vanity" -) - -type NumGen interface { - Next() string - Current() string -} - -type numGen struct { - index int -} - -func NewNumGen() NumGen { - return &numGen{0} -} - -func (this *numGen) Next() string { - this.index++ - return this.Current() -} - -func (this *numGen) Current() string { - return strconv.Itoa(this.index) -} - -type marshalto struct { - *generator.Generator - generator.PluginImports - atleastOne bool - unsafePkg generator.Single - errorsPkg generator.Single - protoPkg generator.Single - sortKeysPkg generator.Single - mathPkg generator.Single - typesPkg generator.Single - localName string - unsafe bool -} - -func NewMarshal() *marshalto { - return &marshalto{} -} - -func NewUnsafeMarshal() *marshalto { - return &marshalto{unsafe: true} -} - -func (p *marshalto) Name() string { - if p.unsafe { - return "unsafemarshaler" - } - return "marshalto" -} - -func (p *marshalto) Init(g *generator.Generator) { - p.Generator = g -} - -func (p *marshalto) callFixed64(varName ...string) { - p.P(`i = encodeFixed64`, p.localName, `(dAtA, i, uint64(`, strings.Join(varName, ""), `))`) -} - -func (p *marshalto) callFixed32(varName ...string) { - p.P(`i = encodeFixed32`, p.localName, `(dAtA, i, uint32(`, strings.Join(varName, ""), `))`) -} - -func (p *marshalto) callVarint(varName ...string) { - p.P(`i = encodeVarint`, p.localName, `(dAtA, i, uint64(`, strings.Join(varName, ""), `))`) -} - -func (p *marshalto) encodeVarint(varName string) { - p.P(`for `, varName, ` >= 1<<7 {`) - p.In() - p.P(`dAtA[i] = uint8(uint64(`, varName, `)&0x7f|0x80)`) - p.P(varName, ` >>= 7`) - p.P(`i++`) - p.Out() - p.P(`}`) - p.P(`dAtA[i] = uint8(`, varName, `)`) - p.P(`i++`) -} - -func (p *marshalto) encodeFixed64(varName string) { - p.P(`dAtA[i] = uint8(`, varName, `)`) - p.P(`i++`) - p.P(`dAtA[i] = uint8(`, varName, ` >> 8)`) - p.P(`i++`) - p.P(`dAtA[i] = uint8(`, varName, ` >> 16)`) - p.P(`i++`) - p.P(`dAtA[i] = uint8(`, varName, ` >> 24)`) - p.P(`i++`) - p.P(`dAtA[i] = uint8(`, varName, ` >> 32)`) - p.P(`i++`) - p.P(`dAtA[i] = uint8(`, varName, ` >> 40)`) - p.P(`i++`) - p.P(`dAtA[i] = uint8(`, varName, ` >> 48)`) - p.P(`i++`) - p.P(`dAtA[i] = uint8(`, varName, ` >> 56)`) - p.P(`i++`) -} - -func (p *marshalto) unsafeFixed64(varName string, someType string) { - p.P(`*(*`, someType, `)(`, p.unsafePkg.Use(), `.Pointer(&dAtA[i])) = `, varName) - p.P(`i+=8`) -} - -func (p *marshalto) encodeFixed32(varName string) { - p.P(`dAtA[i] = uint8(`, varName, `)`) - p.P(`i++`) - p.P(`dAtA[i] = uint8(`, varName, ` >> 8)`) - p.P(`i++`) - p.P(`dAtA[i] = uint8(`, varName, ` >> 16)`) - p.P(`i++`) - p.P(`dAtA[i] = uint8(`, varName, ` >> 24)`) - p.P(`i++`) -} - -func (p *marshalto) unsafeFixed32(varName string, someType string) { - p.P(`*(*`, someType, `)(`, p.unsafePkg.Use(), `.Pointer(&dAtA[i])) = `, varName) - p.P(`i+=4`) -} - -func (p *marshalto) encodeKey(fieldNumber int32, wireType int) { - x := uint32(fieldNumber)<<3 | uint32(wireType) - i := 0 - keybuf := make([]byte, 0) - for i = 0; x > 127; i++ { - keybuf = append(keybuf, 0x80|uint8(x&0x7F)) - x >>= 7 - } - keybuf = append(keybuf, uint8(x)) - for _, b := range keybuf { - p.P(`dAtA[i] = `, fmt.Sprintf("%#v", b)) - p.P(`i++`) - } -} - -func keySize(fieldNumber int32, wireType int) int { - x := uint32(fieldNumber)<<3 | uint32(wireType) - size := 0 - for size = 0; x > 127; size++ { - x >>= 7 - } - size++ - return size -} - -func wireToType(wire string) int { - switch wire { - case "fixed64": - return proto.WireFixed64 - case "fixed32": - return proto.WireFixed32 - case "varint": - return proto.WireVarint - case "bytes": - return proto.WireBytes - case "group": - return proto.WireBytes - case "zigzag32": - return proto.WireVarint - case "zigzag64": - return proto.WireVarint - } - panic("unreachable") -} - -func (p *marshalto) mapField(numGen NumGen, field *descriptor.FieldDescriptorProto, kvField *descriptor.FieldDescriptorProto, varName string, protoSizer bool) { - switch kvField.GetType() { - case descriptor.FieldDescriptorProto_TYPE_DOUBLE: - p.callFixed64(p.mathPkg.Use(), `.Float64bits(float64(`, varName, `))`) - case descriptor.FieldDescriptorProto_TYPE_FLOAT: - p.callFixed32(p.mathPkg.Use(), `.Float32bits(float32(`, varName, `))`) - case descriptor.FieldDescriptorProto_TYPE_INT64, - descriptor.FieldDescriptorProto_TYPE_UINT64, - descriptor.FieldDescriptorProto_TYPE_INT32, - descriptor.FieldDescriptorProto_TYPE_UINT32, - descriptor.FieldDescriptorProto_TYPE_ENUM: - p.callVarint(varName) - case descriptor.FieldDescriptorProto_TYPE_FIXED64, - descriptor.FieldDescriptorProto_TYPE_SFIXED64: - p.callFixed64(varName) - case descriptor.FieldDescriptorProto_TYPE_FIXED32, - descriptor.FieldDescriptorProto_TYPE_SFIXED32: - p.callFixed32(varName) - case descriptor.FieldDescriptorProto_TYPE_BOOL: - p.P(`if `, varName, ` {`) - p.In() - p.P(`dAtA[i] = 1`) - p.Out() - p.P(`} else {`) - p.In() - p.P(`dAtA[i] = 0`) - p.Out() - p.P(`}`) - p.P(`i++`) - case descriptor.FieldDescriptorProto_TYPE_STRING, - descriptor.FieldDescriptorProto_TYPE_BYTES: - if gogoproto.IsCustomType(field) && kvField.IsBytes() { - p.callVarint(varName, `.Size()`) - p.P(`n`, numGen.Next(), `, err := `, varName, `.MarshalTo(dAtA[i:])`) - p.P(`if err != nil {`) - p.In() - p.P(`return 0, err`) - p.Out() - p.P(`}`) - p.P(`i+=n`, numGen.Current()) - } else { - p.callVarint(`len(`, varName, `)`) - p.P(`i+=copy(dAtA[i:], `, varName, `)`) - } - case descriptor.FieldDescriptorProto_TYPE_SINT32: - p.callVarint(`(uint32(`, varName, `) << 1) ^ uint32((`, varName, ` >> 31))`) - case descriptor.FieldDescriptorProto_TYPE_SINT64: - p.callVarint(`(uint64(`, varName, `) << 1) ^ uint64((`, varName, ` >> 63))`) - case descriptor.FieldDescriptorProto_TYPE_MESSAGE: - if gogoproto.IsStdTime(field) { - p.callVarint(p.typesPkg.Use(), `.SizeOfStdTime(*`, varName, `)`) - p.P(`n`, numGen.Next(), `, err := `, p.typesPkg.Use(), `.StdTimeMarshalTo(*`, varName, `, dAtA[i:])`) - } else if gogoproto.IsStdDuration(field) { - p.callVarint(p.typesPkg.Use(), `.SizeOfStdDuration(*`, varName, `)`) - p.P(`n`, numGen.Next(), `, err := `, p.typesPkg.Use(), `.StdDurationMarshalTo(*`, varName, `, dAtA[i:])`) - } else if protoSizer { - p.callVarint(varName, `.ProtoSize()`) - p.P(`n`, numGen.Next(), `, err := `, varName, `.MarshalTo(dAtA[i:])`) - } else { - p.callVarint(varName, `.Size()`) - p.P(`n`, numGen.Next(), `, err := `, varName, `.MarshalTo(dAtA[i:])`) - } - p.P(`if err != nil {`) - p.In() - p.P(`return 0, err`) - p.Out() - p.P(`}`) - p.P(`i+=n`, numGen.Current()) - } -} - -type orderFields []*descriptor.FieldDescriptorProto - -func (this orderFields) Len() int { - return len(this) -} - -func (this orderFields) Less(i, j int) bool { - return this[i].GetNumber() < this[j].GetNumber() -} - -func (this orderFields) Swap(i, j int) { - this[i], this[j] = this[j], this[i] -} - -func (p *marshalto) generateField(proto3 bool, numGen NumGen, file *generator.FileDescriptor, message *generator.Descriptor, field *descriptor.FieldDescriptorProto) { - fieldname := p.GetOneOfFieldName(message, field) - nullable := gogoproto.IsNullable(field) - repeated := field.IsRepeated() - required := field.IsRequired() - - protoSizer := gogoproto.IsProtoSizer(file.FileDescriptorProto, message.DescriptorProto) - doNilCheck := gogoproto.NeedsNilCheck(proto3, field) - if required && nullable { - p.P(`if m.`, fieldname, `== nil {`) - p.In() - if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { - p.P(`return 0, new(`, p.protoPkg.Use(), `.RequiredNotSetError)`) - } else { - p.P(`return 0, `, p.protoPkg.Use(), `.NewRequiredNotSetError("`, field.GetName(), `")`) - } - p.Out() - p.P(`} else {`) - } else if repeated { - p.P(`if len(m.`, fieldname, `) > 0 {`) - p.In() - } else if doNilCheck { - p.P(`if m.`, fieldname, ` != nil {`) - p.In() - } - packed := field.IsPacked() || (proto3 && field.IsRepeated() && generator.IsScalar(field)) - wireType := field.WireType() - fieldNumber := field.GetNumber() - if packed { - wireType = proto.WireBytes - } - switch *field.Type { - case descriptor.FieldDescriptorProto_TYPE_DOUBLE: - if !p.unsafe || gogoproto.IsCastType(field) { - if packed { - p.encodeKey(fieldNumber, wireType) - p.callVarint(`len(m.`, fieldname, `) * 8`) - p.P(`for _, num := range m.`, fieldname, ` {`) - p.In() - p.P(`f`, numGen.Next(), ` := `, p.mathPkg.Use(), `.Float64bits(float64(num))`) - p.encodeFixed64("f" + numGen.Current()) - p.Out() - p.P(`}`) - } else if repeated { - p.P(`for _, num := range m.`, fieldname, ` {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.P(`f`, numGen.Next(), ` := `, p.mathPkg.Use(), `.Float64bits(float64(num))`) - p.encodeFixed64("f" + numGen.Current()) - p.Out() - p.P(`}`) - } else if proto3 { - p.P(`if m.`, fieldname, ` != 0 {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.callFixed64(p.mathPkg.Use(), `.Float64bits(float64(m.`+fieldname, `))`) - p.Out() - p.P(`}`) - } else if !nullable { - p.encodeKey(fieldNumber, wireType) - p.callFixed64(p.mathPkg.Use(), `.Float64bits(float64(m.`+fieldname, `))`) - } else { - p.encodeKey(fieldNumber, wireType) - p.callFixed64(p.mathPkg.Use(), `.Float64bits(float64(*m.`+fieldname, `))`) - } - } else { - if packed { - p.encodeKey(fieldNumber, wireType) - p.callVarint(`len(m.`, fieldname, `) * 8`) - p.P(`for _, num := range m.`, fieldname, ` {`) - p.In() - p.unsafeFixed64("num", "float64") - p.Out() - p.P(`}`) - } else if repeated { - p.P(`for _, num := range m.`, fieldname, ` {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.unsafeFixed64("num", "float64") - p.Out() - p.P(`}`) - } else if proto3 { - p.P(`if m.`, fieldname, ` != 0 {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.unsafeFixed64(`m.`+fieldname, "float64") - p.Out() - p.P(`}`) - } else if !nullable { - p.encodeKey(fieldNumber, wireType) - p.unsafeFixed64(`m.`+fieldname, "float64") - } else { - p.encodeKey(fieldNumber, wireType) - p.unsafeFixed64(`*m.`+fieldname, `float64`) - } - } - case descriptor.FieldDescriptorProto_TYPE_FLOAT: - if !p.unsafe || gogoproto.IsCastType(field) { - if packed { - p.encodeKey(fieldNumber, wireType) - p.callVarint(`len(m.`, fieldname, `) * 4`) - p.P(`for _, num := range m.`, fieldname, ` {`) - p.In() - p.P(`f`, numGen.Next(), ` := `, p.mathPkg.Use(), `.Float32bits(float32(num))`) - p.encodeFixed32("f" + numGen.Current()) - p.Out() - p.P(`}`) - } else if repeated { - p.P(`for _, num := range m.`, fieldname, ` {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.P(`f`, numGen.Next(), ` := `, p.mathPkg.Use(), `.Float32bits(float32(num))`) - p.encodeFixed32("f" + numGen.Current()) - p.Out() - p.P(`}`) - } else if proto3 { - p.P(`if m.`, fieldname, ` != 0 {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.callFixed32(p.mathPkg.Use(), `.Float32bits(float32(m.`+fieldname, `))`) - p.Out() - p.P(`}`) - } else if !nullable { - p.encodeKey(fieldNumber, wireType) - p.callFixed32(p.mathPkg.Use(), `.Float32bits(float32(m.`+fieldname, `))`) - } else { - p.encodeKey(fieldNumber, wireType) - p.callFixed32(p.mathPkg.Use(), `.Float32bits(float32(*m.`+fieldname, `))`) - } - } else { - if packed { - p.encodeKey(fieldNumber, wireType) - p.callVarint(`len(m.`, fieldname, `) * 4`) - p.P(`for _, num := range m.`, fieldname, ` {`) - p.In() - p.unsafeFixed32("num", "float32") - p.Out() - p.P(`}`) - } else if repeated { - p.P(`for _, num := range m.`, fieldname, ` {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.unsafeFixed32("num", "float32") - p.Out() - p.P(`}`) - } else if proto3 { - p.P(`if m.`, fieldname, ` != 0 {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.unsafeFixed32(`m.`+fieldname, `float32`) - p.Out() - p.P(`}`) - } else if !nullable { - p.encodeKey(fieldNumber, wireType) - p.unsafeFixed32(`m.`+fieldname, `float32`) - } else { - p.encodeKey(fieldNumber, wireType) - p.unsafeFixed32(`*m.`+fieldname, "float32") - } - } - case descriptor.FieldDescriptorProto_TYPE_INT64, - descriptor.FieldDescriptorProto_TYPE_UINT64, - descriptor.FieldDescriptorProto_TYPE_INT32, - descriptor.FieldDescriptorProto_TYPE_UINT32, - descriptor.FieldDescriptorProto_TYPE_ENUM: - if packed { - jvar := "j" + numGen.Next() - p.P(`dAtA`, numGen.Next(), ` := make([]byte, len(m.`, fieldname, `)*10)`) - p.P(`var `, jvar, ` int`) - if *field.Type == descriptor.FieldDescriptorProto_TYPE_INT64 || - *field.Type == descriptor.FieldDescriptorProto_TYPE_INT32 { - p.P(`for _, num1 := range m.`, fieldname, ` {`) - p.In() - p.P(`num := uint64(num1)`) - } else { - p.P(`for _, num := range m.`, fieldname, ` {`) - p.In() - } - p.P(`for num >= 1<<7 {`) - p.In() - p.P(`dAtA`, numGen.Current(), `[`, jvar, `] = uint8(uint64(num)&0x7f|0x80)`) - p.P(`num >>= 7`) - p.P(jvar, `++`) - p.Out() - p.P(`}`) - p.P(`dAtA`, numGen.Current(), `[`, jvar, `] = uint8(num)`) - p.P(jvar, `++`) - p.Out() - p.P(`}`) - p.encodeKey(fieldNumber, wireType) - p.callVarint(jvar) - p.P(`i += copy(dAtA[i:], dAtA`, numGen.Current(), `[:`, jvar, `])`) - } else if repeated { - p.P(`for _, num := range m.`, fieldname, ` {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.callVarint("num") - p.Out() - p.P(`}`) - } else if proto3 { - p.P(`if m.`, fieldname, ` != 0 {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.callVarint(`m.`, fieldname) - p.Out() - p.P(`}`) - } else if !nullable { - p.encodeKey(fieldNumber, wireType) - p.callVarint(`m.`, fieldname) - } else { - p.encodeKey(fieldNumber, wireType) - p.callVarint(`*m.`, fieldname) - } - case descriptor.FieldDescriptorProto_TYPE_FIXED64, - descriptor.FieldDescriptorProto_TYPE_SFIXED64: - if !p.unsafe { - if packed { - p.encodeKey(fieldNumber, wireType) - p.callVarint(`len(m.`, fieldname, `) * 8`) - p.P(`for _, num := range m.`, fieldname, ` {`) - p.In() - p.encodeFixed64("num") - p.Out() - p.P(`}`) - } else if repeated { - p.P(`for _, num := range m.`, fieldname, ` {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.encodeFixed64("num") - p.Out() - p.P(`}`) - } else if proto3 { - p.P(`if m.`, fieldname, ` != 0 {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.callFixed64("m." + fieldname) - p.Out() - p.P(`}`) - } else if !nullable { - p.encodeKey(fieldNumber, wireType) - p.callFixed64("m." + fieldname) - } else { - p.encodeKey(fieldNumber, wireType) - p.callFixed64("*m." + fieldname) - } - } else { - typeName := "int64" - if *field.Type == descriptor.FieldDescriptorProto_TYPE_FIXED64 { - typeName = "uint64" - } - if packed { - p.encodeKey(fieldNumber, wireType) - p.callVarint(`len(m.`, fieldname, `) * 8`) - p.P(`for _, num := range m.`, fieldname, ` {`) - p.In() - p.unsafeFixed64("num", typeName) - p.Out() - p.P(`}`) - } else if repeated { - p.P(`for _, num := range m.`, fieldname, ` {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.unsafeFixed64("num", typeName) - p.Out() - p.P(`}`) - } else if proto3 { - p.P(`if m.`, fieldname, ` != 0 {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.unsafeFixed64("m."+fieldname, typeName) - p.Out() - p.P(`}`) - } else if !nullable { - p.encodeKey(fieldNumber, wireType) - p.unsafeFixed64("m."+fieldname, typeName) - } else { - p.encodeKey(fieldNumber, wireType) - p.unsafeFixed64("*m."+fieldname, typeName) - } - } - case descriptor.FieldDescriptorProto_TYPE_FIXED32, - descriptor.FieldDescriptorProto_TYPE_SFIXED32: - if !p.unsafe { - if packed { - p.encodeKey(fieldNumber, wireType) - p.callVarint(`len(m.`, fieldname, `) * 4`) - p.P(`for _, num := range m.`, fieldname, ` {`) - p.In() - p.encodeFixed32("num") - p.Out() - p.P(`}`) - } else if repeated { - p.P(`for _, num := range m.`, fieldname, ` {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.encodeFixed32("num") - p.Out() - p.P(`}`) - } else if proto3 { - p.P(`if m.`, fieldname, ` != 0 {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.callFixed32("m." + fieldname) - p.Out() - p.P(`}`) - } else if !nullable { - p.encodeKey(fieldNumber, wireType) - p.callFixed32("m." + fieldname) - } else { - p.encodeKey(fieldNumber, wireType) - p.callFixed32("*m." + fieldname) - } - } else { - typeName := "int32" - if *field.Type == descriptor.FieldDescriptorProto_TYPE_FIXED32 { - typeName = "uint32" - } - if packed { - p.encodeKey(fieldNumber, wireType) - p.callVarint(`len(m.`, fieldname, `) * 4`) - p.P(`for _, num := range m.`, fieldname, ` {`) - p.In() - p.unsafeFixed32("num", typeName) - p.Out() - p.P(`}`) - } else if repeated { - p.P(`for _, num := range m.`, fieldname, ` {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.unsafeFixed32("num", typeName) - p.Out() - p.P(`}`) - } else if proto3 { - p.P(`if m.`, fieldname, ` != 0 {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.unsafeFixed32("m."+fieldname, typeName) - p.Out() - p.P(`}`) - } else if !nullable { - p.encodeKey(fieldNumber, wireType) - p.unsafeFixed32("m."+fieldname, typeName) - } else { - p.encodeKey(fieldNumber, wireType) - p.unsafeFixed32("*m."+fieldname, typeName) - } - } - case descriptor.FieldDescriptorProto_TYPE_BOOL: - if packed { - p.encodeKey(fieldNumber, wireType) - p.callVarint(`len(m.`, fieldname, `)`) - p.P(`for _, b := range m.`, fieldname, ` {`) - p.In() - p.P(`if b {`) - p.In() - p.P(`dAtA[i] = 1`) - p.Out() - p.P(`} else {`) - p.In() - p.P(`dAtA[i] = 0`) - p.Out() - p.P(`}`) - p.P(`i++`) - p.Out() - p.P(`}`) - } else if repeated { - p.P(`for _, b := range m.`, fieldname, ` {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.P(`if b {`) - p.In() - p.P(`dAtA[i] = 1`) - p.Out() - p.P(`} else {`) - p.In() - p.P(`dAtA[i] = 0`) - p.Out() - p.P(`}`) - p.P(`i++`) - p.Out() - p.P(`}`) - } else if proto3 { - p.P(`if m.`, fieldname, ` {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.P(`if m.`, fieldname, ` {`) - p.In() - p.P(`dAtA[i] = 1`) - p.Out() - p.P(`} else {`) - p.In() - p.P(`dAtA[i] = 0`) - p.Out() - p.P(`}`) - p.P(`i++`) - p.Out() - p.P(`}`) - } else if !nullable { - p.encodeKey(fieldNumber, wireType) - p.P(`if m.`, fieldname, ` {`) - p.In() - p.P(`dAtA[i] = 1`) - p.Out() - p.P(`} else {`) - p.In() - p.P(`dAtA[i] = 0`) - p.Out() - p.P(`}`) - p.P(`i++`) - } else { - p.encodeKey(fieldNumber, wireType) - p.P(`if *m.`, fieldname, ` {`) - p.In() - p.P(`dAtA[i] = 1`) - p.Out() - p.P(`} else {`) - p.In() - p.P(`dAtA[i] = 0`) - p.Out() - p.P(`}`) - p.P(`i++`) - } - case descriptor.FieldDescriptorProto_TYPE_STRING: - if repeated { - p.P(`for _, s := range m.`, fieldname, ` {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.P(`l = len(s)`) - p.encodeVarint("l") - p.P(`i+=copy(dAtA[i:], s)`) - p.Out() - p.P(`}`) - } else if proto3 { - p.P(`if len(m.`, fieldname, `) > 0 {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.callVarint(`len(m.`, fieldname, `)`) - p.P(`i+=copy(dAtA[i:], m.`, fieldname, `)`) - p.Out() - p.P(`}`) - } else if !nullable { - p.encodeKey(fieldNumber, wireType) - p.callVarint(`len(m.`, fieldname, `)`) - p.P(`i+=copy(dAtA[i:], m.`, fieldname, `)`) - } else { - p.encodeKey(fieldNumber, wireType) - p.callVarint(`len(*m.`, fieldname, `)`) - p.P(`i+=copy(dAtA[i:], *m.`, fieldname, `)`) - } - case descriptor.FieldDescriptorProto_TYPE_GROUP: - panic(fmt.Errorf("marshaler does not support group %v", fieldname)) - case descriptor.FieldDescriptorProto_TYPE_MESSAGE: - if p.IsMap(field) { - m := p.GoMapType(nil, field) - keygoTyp, keywire := p.GoType(nil, m.KeyField) - keygoAliasTyp, _ := p.GoType(nil, m.KeyAliasField) - // keys may not be pointers - keygoTyp = strings.Replace(keygoTyp, "*", "", 1) - keygoAliasTyp = strings.Replace(keygoAliasTyp, "*", "", 1) - keyCapTyp := generator.CamelCase(keygoTyp) - valuegoTyp, valuewire := p.GoType(nil, m.ValueField) - valuegoAliasTyp, _ := p.GoType(nil, m.ValueAliasField) - nullable, valuegoTyp, valuegoAliasTyp = generator.GoMapValueTypes(field, m.ValueField, valuegoTyp, valuegoAliasTyp) - keyKeySize := keySize(1, wireToType(keywire)) - valueKeySize := keySize(2, wireToType(valuewire)) - if gogoproto.IsStableMarshaler(file.FileDescriptorProto, message.DescriptorProto) { - keysName := `keysFor` + fieldname - p.P(keysName, ` := make([]`, keygoTyp, `, 0, len(m.`, fieldname, `))`) - p.P(`for k, _ := range m.`, fieldname, ` {`) - p.In() - p.P(keysName, ` = append(`, keysName, `, `, keygoTyp, `(k))`) - p.Out() - p.P(`}`) - p.P(p.sortKeysPkg.Use(), `.`, keyCapTyp, `s(`, keysName, `)`) - p.P(`for _, k := range `, keysName, ` {`) - } else { - p.P(`for k, _ := range m.`, fieldname, ` {`) - } - p.In() - p.encodeKey(fieldNumber, wireType) - sum := []string{strconv.Itoa(keyKeySize)} - switch m.KeyField.GetType() { - case descriptor.FieldDescriptorProto_TYPE_DOUBLE, - descriptor.FieldDescriptorProto_TYPE_FIXED64, - descriptor.FieldDescriptorProto_TYPE_SFIXED64: - sum = append(sum, `8`) - case descriptor.FieldDescriptorProto_TYPE_FLOAT, - descriptor.FieldDescriptorProto_TYPE_FIXED32, - descriptor.FieldDescriptorProto_TYPE_SFIXED32: - sum = append(sum, `4`) - case descriptor.FieldDescriptorProto_TYPE_INT64, - descriptor.FieldDescriptorProto_TYPE_UINT64, - descriptor.FieldDescriptorProto_TYPE_UINT32, - descriptor.FieldDescriptorProto_TYPE_ENUM, - descriptor.FieldDescriptorProto_TYPE_INT32: - sum = append(sum, `sov`+p.localName+`(uint64(k))`) - case descriptor.FieldDescriptorProto_TYPE_BOOL: - sum = append(sum, `1`) - case descriptor.FieldDescriptorProto_TYPE_STRING, - descriptor.FieldDescriptorProto_TYPE_BYTES: - sum = append(sum, `len(k)+sov`+p.localName+`(uint64(len(k)))`) - case descriptor.FieldDescriptorProto_TYPE_SINT32, - descriptor.FieldDescriptorProto_TYPE_SINT64: - sum = append(sum, `soz`+p.localName+`(uint64(k))`) - } - if gogoproto.IsStableMarshaler(file.FileDescriptorProto, message.DescriptorProto) { - p.P(`v := m.`, fieldname, `[`, keygoAliasTyp, `(k)]`) - } else { - p.P(`v := m.`, fieldname, `[k]`) - } - accessor := `v` - switch m.ValueField.GetType() { - case descriptor.FieldDescriptorProto_TYPE_DOUBLE, - descriptor.FieldDescriptorProto_TYPE_FIXED64, - descriptor.FieldDescriptorProto_TYPE_SFIXED64: - sum = append(sum, strconv.Itoa(valueKeySize)) - sum = append(sum, strconv.Itoa(8)) - case descriptor.FieldDescriptorProto_TYPE_FLOAT, - descriptor.FieldDescriptorProto_TYPE_FIXED32, - descriptor.FieldDescriptorProto_TYPE_SFIXED32: - sum = append(sum, strconv.Itoa(valueKeySize)) - sum = append(sum, strconv.Itoa(4)) - case descriptor.FieldDescriptorProto_TYPE_INT64, - descriptor.FieldDescriptorProto_TYPE_UINT64, - descriptor.FieldDescriptorProto_TYPE_UINT32, - descriptor.FieldDescriptorProto_TYPE_ENUM, - descriptor.FieldDescriptorProto_TYPE_INT32: - sum = append(sum, strconv.Itoa(valueKeySize)) - sum = append(sum, `sov`+p.localName+`(uint64(v))`) - case descriptor.FieldDescriptorProto_TYPE_BOOL: - sum = append(sum, strconv.Itoa(valueKeySize)) - sum = append(sum, `1`) - case descriptor.FieldDescriptorProto_TYPE_STRING: - sum = append(sum, strconv.Itoa(valueKeySize)) - sum = append(sum, `len(v)+sov`+p.localName+`(uint64(len(v)))`) - case descriptor.FieldDescriptorProto_TYPE_BYTES: - if gogoproto.IsCustomType(field) { - p.P(`cSize := 0`) - if gogoproto.IsNullable(field) { - p.P(`if `, accessor, ` != nil {`) - p.In() - } - p.P(`cSize = `, accessor, `.Size()`) - p.P(`cSize += `, strconv.Itoa(valueKeySize), ` + sov`+p.localName+`(uint64(cSize))`) - if gogoproto.IsNullable(field) { - p.Out() - p.P(`}`) - } - sum = append(sum, `cSize`) - } else { - p.P(`byteSize := 0`) - if proto3 { - p.P(`if len(v) > 0 {`) - } else { - p.P(`if v != nil {`) - } - p.In() - p.P(`byteSize = `, strconv.Itoa(valueKeySize), ` + len(v)+sov`+p.localName+`(uint64(len(v)))`) - p.Out() - p.P(`}`) - sum = append(sum, `byteSize`) - } - case descriptor.FieldDescriptorProto_TYPE_SINT32, - descriptor.FieldDescriptorProto_TYPE_SINT64: - sum = append(sum, strconv.Itoa(valueKeySize)) - sum = append(sum, `soz`+p.localName+`(uint64(v))`) - case descriptor.FieldDescriptorProto_TYPE_MESSAGE: - if valuegoTyp != valuegoAliasTyp && - !gogoproto.IsStdTime(field) && - !gogoproto.IsStdDuration(field) { - if nullable { - // cast back to the type that has the generated methods on it - accessor = `((` + valuegoTyp + `)(` + accessor + `))` - } else { - accessor = `((*` + valuegoTyp + `)(&` + accessor + `))` - } - } else if !nullable { - accessor = `(&v)` - } - p.P(`msgSize := 0`) - p.P(`if `, accessor, ` != nil {`) - p.In() - if gogoproto.IsStdTime(field) { - p.P(`msgSize = `, p.typesPkg.Use(), `.SizeOfStdTime(*`, accessor, `)`) - } else if gogoproto.IsStdDuration(field) { - p.P(`msgSize = `, p.typesPkg.Use(), `.SizeOfStdDuration(*`, accessor, `)`) - } else if protoSizer { - p.P(`msgSize = `, accessor, `.ProtoSize()`) - } else { - p.P(`msgSize = `, accessor, `.Size()`) - } - p.P(`msgSize += `, strconv.Itoa(valueKeySize), ` + sov`+p.localName+`(uint64(msgSize))`) - p.Out() - p.P(`}`) - sum = append(sum, `msgSize`) - } - p.P(`mapSize := `, strings.Join(sum, " + ")) - p.callVarint("mapSize") - p.encodeKey(1, wireToType(keywire)) - p.mapField(numGen, field, m.KeyField, "k", protoSizer) - nullableMsg := nullable && (m.ValueField.GetType() == descriptor.FieldDescriptorProto_TYPE_MESSAGE || - gogoproto.IsCustomType(field) && m.ValueField.IsBytes()) - plainBytes := m.ValueField.IsBytes() && !gogoproto.IsCustomType(field) - if nullableMsg { - p.P(`if `, accessor, ` != nil { `) - p.In() - } else if plainBytes { - if proto3 { - p.P(`if len(`, accessor, `) > 0 {`) - } else { - p.P(`if `, accessor, ` != nil {`) - } - p.In() - } - p.encodeKey(2, wireToType(valuewire)) - p.mapField(numGen, field, m.ValueField, accessor, protoSizer) - if nullableMsg || plainBytes { - p.Out() - p.P(`}`) - } - p.Out() - p.P(`}`) - } else if repeated { - p.P(`for _, msg := range m.`, fieldname, ` {`) - p.In() - p.encodeKey(fieldNumber, wireType) - varName := "msg" - if gogoproto.IsStdTime(field) { - if gogoproto.IsNullable(field) { - varName = "*" + varName - } - p.callVarint(p.typesPkg.Use(), `.SizeOfStdTime(`, varName, `)`) - p.P(`n, err := `, p.typesPkg.Use(), `.StdTimeMarshalTo(`, varName, `, dAtA[i:])`) - } else if gogoproto.IsStdDuration(field) { - if gogoproto.IsNullable(field) { - varName = "*" + varName - } - p.callVarint(p.typesPkg.Use(), `.SizeOfStdDuration(`, varName, `)`) - p.P(`n, err := `, p.typesPkg.Use(), `.StdDurationMarshalTo(`, varName, `, dAtA[i:])`) - } else if protoSizer { - p.callVarint(varName, ".ProtoSize()") - p.P(`n, err := `, varName, `.MarshalTo(dAtA[i:])`) - } else { - p.callVarint(varName, ".Size()") - p.P(`n, err := `, varName, `.MarshalTo(dAtA[i:])`) - } - p.P(`if err != nil {`) - p.In() - p.P(`return 0, err`) - p.Out() - p.P(`}`) - p.P(`i+=n`) - p.Out() - p.P(`}`) - } else { - p.encodeKey(fieldNumber, wireType) - varName := `m.` + fieldname - if gogoproto.IsStdTime(field) { - if gogoproto.IsNullable(field) { - varName = "*" + varName - } - p.callVarint(p.typesPkg.Use(), `.SizeOfStdTime(`, varName, `)`) - p.P(`n`, numGen.Next(), `, err := `, p.typesPkg.Use(), `.StdTimeMarshalTo(`, varName, `, dAtA[i:])`) - } else if gogoproto.IsStdDuration(field) { - if gogoproto.IsNullable(field) { - varName = "*" + varName - } - p.callVarint(p.typesPkg.Use(), `.SizeOfStdDuration(`, varName, `)`) - p.P(`n`, numGen.Next(), `, err := `, p.typesPkg.Use(), `.StdDurationMarshalTo(`, varName, `, dAtA[i:])`) - } else if protoSizer { - p.callVarint(varName, `.ProtoSize()`) - p.P(`n`, numGen.Next(), `, err := `, varName, `.MarshalTo(dAtA[i:])`) - } else { - p.callVarint(varName, `.Size()`) - p.P(`n`, numGen.Next(), `, err := `, varName, `.MarshalTo(dAtA[i:])`) - } - p.P(`if err != nil {`) - p.In() - p.P(`return 0, err`) - p.Out() - p.P(`}`) - p.P(`i+=n`, numGen.Current()) - } - case descriptor.FieldDescriptorProto_TYPE_BYTES: - if !gogoproto.IsCustomType(field) { - if repeated { - p.P(`for _, b := range m.`, fieldname, ` {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.callVarint("len(b)") - p.P(`i+=copy(dAtA[i:], b)`) - p.Out() - p.P(`}`) - } else if proto3 { - p.P(`if len(m.`, fieldname, `) > 0 {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.callVarint(`len(m.`, fieldname, `)`) - p.P(`i+=copy(dAtA[i:], m.`, fieldname, `)`) - p.Out() - p.P(`}`) - } else { - p.encodeKey(fieldNumber, wireType) - p.callVarint(`len(m.`, fieldname, `)`) - p.P(`i+=copy(dAtA[i:], m.`, fieldname, `)`) - } - } else { - if repeated { - p.P(`for _, msg := range m.`, fieldname, ` {`) - p.In() - p.encodeKey(fieldNumber, wireType) - if protoSizer { - p.callVarint(`msg.ProtoSize()`) - } else { - p.callVarint(`msg.Size()`) - } - p.P(`n, err := msg.MarshalTo(dAtA[i:])`) - p.P(`if err != nil {`) - p.In() - p.P(`return 0, err`) - p.Out() - p.P(`}`) - p.P(`i+=n`) - p.Out() - p.P(`}`) - } else { - p.encodeKey(fieldNumber, wireType) - if protoSizer { - p.callVarint(`m.`, fieldname, `.ProtoSize()`) - } else { - p.callVarint(`m.`, fieldname, `.Size()`) - } - p.P(`n`, numGen.Next(), `, err := m.`, fieldname, `.MarshalTo(dAtA[i:])`) - p.P(`if err != nil {`) - p.In() - p.P(`return 0, err`) - p.Out() - p.P(`}`) - p.P(`i+=n`, numGen.Current()) - } - } - case descriptor.FieldDescriptorProto_TYPE_SINT32: - if packed { - datavar := "dAtA" + numGen.Next() - jvar := "j" + numGen.Next() - p.P(datavar, ` := make([]byte, len(m.`, fieldname, ")*5)") - p.P(`var `, jvar, ` int`) - p.P(`for _, num := range m.`, fieldname, ` {`) - p.In() - xvar := "x" + numGen.Next() - p.P(xvar, ` := (uint32(num) << 1) ^ uint32((num >> 31))`) - p.P(`for `, xvar, ` >= 1<<7 {`) - p.In() - p.P(datavar, `[`, jvar, `] = uint8(uint64(`, xvar, `)&0x7f|0x80)`) - p.P(jvar, `++`) - p.P(xvar, ` >>= 7`) - p.Out() - p.P(`}`) - p.P(datavar, `[`, jvar, `] = uint8(`, xvar, `)`) - p.P(jvar, `++`) - p.Out() - p.P(`}`) - p.encodeKey(fieldNumber, wireType) - p.callVarint(jvar) - p.P(`i+=copy(dAtA[i:], `, datavar, `[:`, jvar, `])`) - } else if repeated { - p.P(`for _, num := range m.`, fieldname, ` {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.P(`x`, numGen.Next(), ` := (uint32(num) << 1) ^ uint32((num >> 31))`) - p.encodeVarint("x" + numGen.Current()) - p.Out() - p.P(`}`) - } else if proto3 { - p.P(`if m.`, fieldname, ` != 0 {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.callVarint(`(uint32(m.`, fieldname, `) << 1) ^ uint32((m.`, fieldname, ` >> 31))`) - p.Out() - p.P(`}`) - } else if !nullable { - p.encodeKey(fieldNumber, wireType) - p.callVarint(`(uint32(m.`, fieldname, `) << 1) ^ uint32((m.`, fieldname, ` >> 31))`) - } else { - p.encodeKey(fieldNumber, wireType) - p.callVarint(`(uint32(*m.`, fieldname, `) << 1) ^ uint32((*m.`, fieldname, ` >> 31))`) - } - case descriptor.FieldDescriptorProto_TYPE_SINT64: - if packed { - jvar := "j" + numGen.Next() - xvar := "x" + numGen.Next() - datavar := "dAtA" + numGen.Next() - p.P(`var `, jvar, ` int`) - p.P(datavar, ` := make([]byte, len(m.`, fieldname, `)*10)`) - p.P(`for _, num := range m.`, fieldname, ` {`) - p.In() - p.P(xvar, ` := (uint64(num) << 1) ^ uint64((num >> 63))`) - p.P(`for `, xvar, ` >= 1<<7 {`) - p.In() - p.P(datavar, `[`, jvar, `] = uint8(uint64(`, xvar, `)&0x7f|0x80)`) - p.P(jvar, `++`) - p.P(xvar, ` >>= 7`) - p.Out() - p.P(`}`) - p.P(datavar, `[`, jvar, `] = uint8(`, xvar, `)`) - p.P(jvar, `++`) - p.Out() - p.P(`}`) - p.encodeKey(fieldNumber, wireType) - p.callVarint(jvar) - p.P(`i+=copy(dAtA[i:], `, datavar, `[:`, jvar, `])`) - } else if repeated { - p.P(`for _, num := range m.`, fieldname, ` {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.P(`x`, numGen.Next(), ` := (uint64(num) << 1) ^ uint64((num >> 63))`) - p.encodeVarint("x" + numGen.Current()) - p.Out() - p.P(`}`) - } else if proto3 { - p.P(`if m.`, fieldname, ` != 0 {`) - p.In() - p.encodeKey(fieldNumber, wireType) - p.callVarint(`(uint64(m.`, fieldname, `) << 1) ^ uint64((m.`, fieldname, ` >> 63))`) - p.Out() - p.P(`}`) - } else if !nullable { - p.encodeKey(fieldNumber, wireType) - p.callVarint(`(uint64(m.`, fieldname, `) << 1) ^ uint64((m.`, fieldname, ` >> 63))`) - } else { - p.encodeKey(fieldNumber, wireType) - p.callVarint(`(uint64(*m.`, fieldname, `) << 1) ^ uint64((*m.`, fieldname, ` >> 63))`) - } - default: - panic("not implemented") - } - if (required && nullable) || repeated || doNilCheck { - p.Out() - p.P(`}`) - } -} - -func (p *marshalto) Generate(file *generator.FileDescriptor) { - numGen := NewNumGen() - p.PluginImports = generator.NewPluginImports(p.Generator) - p.atleastOne = false - p.localName = generator.FileName(file) - - p.mathPkg = p.NewImport("math") - p.sortKeysPkg = p.NewImport("github.com/gogo/protobuf/sortkeys") - p.protoPkg = p.NewImport("github.com/gogo/protobuf/proto") - if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { - p.protoPkg = p.NewImport("github.com/golang/protobuf/proto") - } - p.unsafePkg = p.NewImport("unsafe") - p.errorsPkg = p.NewImport("errors") - p.typesPkg = p.NewImport("github.com/gogo/protobuf/types") - - for _, message := range file.Messages() { - if message.DescriptorProto.GetOptions().GetMapEntry() { - continue - } - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - if p.unsafe { - if !gogoproto.IsUnsafeMarshaler(file.FileDescriptorProto, message.DescriptorProto) { - continue - } - if gogoproto.IsMarshaler(file.FileDescriptorProto, message.DescriptorProto) { - panic(fmt.Sprintf("unsafe_marshaler and marshalto enabled for %v", ccTypeName)) - } - } - if !p.unsafe { - if !gogoproto.IsMarshaler(file.FileDescriptorProto, message.DescriptorProto) { - continue - } - if gogoproto.IsUnsafeMarshaler(file.FileDescriptorProto, message.DescriptorProto) { - panic(fmt.Sprintf("unsafe_marshaler and marshalto enabled for %v", ccTypeName)) - } - } - p.atleastOne = true - - p.P(`func (m *`, ccTypeName, `) Marshal() (dAtA []byte, err error) {`) - p.In() - if gogoproto.IsProtoSizer(file.FileDescriptorProto, message.DescriptorProto) { - p.P(`size := m.ProtoSize()`) - } else { - p.P(`size := m.Size()`) - } - p.P(`dAtA = make([]byte, size)`) - p.P(`n, err := m.MarshalTo(dAtA)`) - p.P(`if err != nil {`) - p.In() - p.P(`return nil, err`) - p.Out() - p.P(`}`) - p.P(`return dAtA[:n], nil`) - p.Out() - p.P(`}`) - p.P(``) - p.P(`func (m *`, ccTypeName, `) MarshalTo(dAtA []byte) (int, error) {`) - p.In() - p.P(`var i int`) - p.P(`_ = i`) - p.P(`var l int`) - p.P(`_ = l`) - fields := orderFields(message.GetField()) - sort.Sort(fields) - oneofs := make(map[string]struct{}) - for _, field := range message.Field { - oneof := field.OneofIndex != nil - if !oneof { - proto3 := gogoproto.IsProto3(file.FileDescriptorProto) - p.generateField(proto3, numGen, file, message, field) - } else { - fieldname := p.GetFieldName(message, field) - if _, ok := oneofs[fieldname]; !ok { - oneofs[fieldname] = struct{}{} - p.P(`if m.`, fieldname, ` != nil {`) - p.In() - p.P(`nn`, numGen.Next(), `, err := m.`, fieldname, `.MarshalTo(dAtA[i:])`) - p.P(`if err != nil {`) - p.In() - p.P(`return 0, err`) - p.Out() - p.P(`}`) - p.P(`i+=nn`, numGen.Current()) - p.Out() - p.P(`}`) - } - } - } - if message.DescriptorProto.HasExtension() { - if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) { - p.P(`n, err := `, p.protoPkg.Use(), `.EncodeInternalExtension(m, dAtA[i:])`) - p.P(`if err != nil {`) - p.In() - p.P(`return 0, err`) - p.Out() - p.P(`}`) - p.P(`i+=n`) - } else { - p.P(`if m.XXX_extensions != nil {`) - p.In() - p.P(`i+=copy(dAtA[i:], m.XXX_extensions)`) - p.Out() - p.P(`}`) - } - } - if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) { - p.P(`if m.XXX_unrecognized != nil {`) - p.In() - p.P(`i+=copy(dAtA[i:], m.XXX_unrecognized)`) - p.Out() - p.P(`}`) - } - - p.P(`return i, nil`) - p.Out() - p.P(`}`) - p.P() - - //Generate MarshalTo methods for oneof fields - m := proto.Clone(message.DescriptorProto).(*descriptor.DescriptorProto) - for _, field := range m.Field { - oneof := field.OneofIndex != nil - if !oneof { - continue - } - ccTypeName := p.OneOfTypeName(message, field) - p.P(`func (m *`, ccTypeName, `) MarshalTo(dAtA []byte) (int, error) {`) - p.In() - p.P(`i := 0`) - vanity.TurnOffNullableForNativeTypesWithoutDefaultsOnly(field) - p.generateField(false, numGen, file, message, field) - p.P(`return i, nil`) - p.Out() - p.P(`}`) - } - } - - if p.atleastOne { - p.P(`func encodeFixed64`, p.localName, `(dAtA []byte, offset int, v uint64) int {`) - p.In() - p.P(`dAtA[offset] = uint8(v)`) - p.P(`dAtA[offset+1] = uint8(v >> 8)`) - p.P(`dAtA[offset+2] = uint8(v >> 16)`) - p.P(`dAtA[offset+3] = uint8(v >> 24)`) - p.P(`dAtA[offset+4] = uint8(v >> 32)`) - p.P(`dAtA[offset+5] = uint8(v >> 40)`) - p.P(`dAtA[offset+6] = uint8(v >> 48)`) - p.P(`dAtA[offset+7] = uint8(v >> 56)`) - p.P(`return offset+8`) - p.Out() - p.P(`}`) - - p.P(`func encodeFixed32`, p.localName, `(dAtA []byte, offset int, v uint32) int {`) - p.In() - p.P(`dAtA[offset] = uint8(v)`) - p.P(`dAtA[offset+1] = uint8(v >> 8)`) - p.P(`dAtA[offset+2] = uint8(v >> 16)`) - p.P(`dAtA[offset+3] = uint8(v >> 24)`) - p.P(`return offset+4`) - p.Out() - p.P(`}`) - - p.P(`func encodeVarint`, p.localName, `(dAtA []byte, offset int, v uint64) int {`) - p.In() - p.P(`for v >= 1<<7 {`) - p.In() - p.P(`dAtA[offset] = uint8(v&0x7f|0x80)`) - p.P(`v >>= 7`) - p.P(`offset++`) - p.Out() - p.P(`}`) - p.P(`dAtA[offset] = uint8(v)`) - p.P(`return offset+1`) - p.Out() - p.P(`}`) - } - -} - -func init() { - generator.RegisterPlugin(NewMarshal()) - generator.RegisterPlugin(NewUnsafeMarshal()) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/oneofcheck/oneofcheck.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/oneofcheck/oneofcheck.go deleted file mode 100644 index 0f822e8a8ac..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/oneofcheck/oneofcheck.go +++ /dev/null @@ -1,93 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -/* -The oneofcheck plugin is used to check whether oneof is not used incorrectly. -For instance: -An error is caused if a oneof field: - - is used in a face - - is an embedded field - -*/ -package oneofcheck - -import ( - "fmt" - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" - "os" -) - -type plugin struct { - *generator.Generator -} - -func NewPlugin() *plugin { - return &plugin{} -} - -func (p *plugin) Name() string { - return "oneofcheck" -} - -func (p *plugin) Init(g *generator.Generator) { - p.Generator = g -} - -func (p *plugin) Generate(file *generator.FileDescriptor) { - for _, msg := range file.Messages() { - face := gogoproto.IsFace(file.FileDescriptorProto, msg.DescriptorProto) - for _, field := range msg.GetField() { - if field.OneofIndex == nil { - continue - } - if face { - fmt.Fprintf(os.Stderr, "ERROR: field %v.%v cannot be in a face and oneof\n", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name)) - os.Exit(1) - } - if gogoproto.IsEmbed(field) { - fmt.Fprintf(os.Stderr, "ERROR: field %v.%v cannot be in an oneof and an embedded field\n", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name)) - os.Exit(1) - } - if !gogoproto.IsNullable(field) { - fmt.Fprintf(os.Stderr, "ERROR: field %v.%v cannot be in an oneof and a non-nullable field\n", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name)) - os.Exit(1) - } - if gogoproto.IsUnion(file.FileDescriptorProto, msg.DescriptorProto) { - fmt.Fprintf(os.Stderr, "ERROR: field %v.%v cannot be in an oneof and in an union (deprecated)\n", generator.CamelCase(*msg.Name), generator.CamelCase(*field.Name)) - os.Exit(1) - } - } - } -} - -func (p *plugin) GenerateImports(*generator.FileDescriptor) {} - -func init() { - generator.RegisterPlugin(NewPlugin()) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/populate/populate.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/populate/populate.go deleted file mode 100644 index e03c3e29e0a..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/populate/populate.go +++ /dev/null @@ -1,796 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -/* -The populate plugin generates a NewPopulated function. -This function returns a newly populated structure. - -It is enabled by the following extensions: - - - populate - - populate_all - -Let us look at: - - github.com/gogo/protobuf/test/example/example.proto - -Btw all the output can be seen at: - - github.com/gogo/protobuf/test/example/* - -The following message: - - option (gogoproto.populate_all) = true; - - message B { - optional A A = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; - repeated bytes G = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false]; - } - -given to the populate plugin, will generate code the following code: - - func NewPopulatedB(r randyExample, easy bool) *B { - this := &B{} - v2 := NewPopulatedA(r, easy) - this.A = *v2 - if r.Intn(10) != 0 { - v3 := r.Intn(10) - this.G = make([]github_com_gogo_protobuf_test_custom.Uint128, v3) - for i := 0; i < v3; i++ { - v4 := github_com_gogo_protobuf_test_custom.NewPopulatedUint128(r) - this.G[i] = *v4 - } - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedExample(r, 3) - } - return this - } - -The idea that is useful for testing. -Most of the other plugins' generated test code uses it. -You will still be able to use the generated test code of other packages -if you turn off the popluate plugin and write your own custom NewPopulated function. - -If the easy flag is not set the XXX_unrecognized and XXX_extensions fields are also populated. -These have caused problems with JSON marshalling and unmarshalling tests. - -*/ -package populate - -import ( - "fmt" - "math" - "strconv" - "strings" - - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/proto" - descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" - "github.com/gogo/protobuf/vanity" -) - -type VarGen interface { - Next() string - Current() string -} - -type varGen struct { - index int64 -} - -func NewVarGen() VarGen { - return &varGen{0} -} - -func (this *varGen) Next() string { - this.index++ - return fmt.Sprintf("v%d", this.index) -} - -func (this *varGen) Current() string { - return fmt.Sprintf("v%d", this.index) -} - -type plugin struct { - *generator.Generator - generator.PluginImports - varGen VarGen - atleastOne bool - localName string - typesPkg generator.Single -} - -func NewPlugin() *plugin { - return &plugin{} -} - -func (p *plugin) Name() string { - return "populate" -} - -func (p *plugin) Init(g *generator.Generator) { - p.Generator = g -} - -func value(typeName string, fieldType descriptor.FieldDescriptorProto_Type) string { - switch fieldType { - case descriptor.FieldDescriptorProto_TYPE_DOUBLE: - return typeName + "(r.Float64())" - case descriptor.FieldDescriptorProto_TYPE_FLOAT: - return typeName + "(r.Float32())" - case descriptor.FieldDescriptorProto_TYPE_INT64, - descriptor.FieldDescriptorProto_TYPE_SFIXED64, - descriptor.FieldDescriptorProto_TYPE_SINT64: - return typeName + "(r.Int63())" - case descriptor.FieldDescriptorProto_TYPE_UINT64, - descriptor.FieldDescriptorProto_TYPE_FIXED64: - return typeName + "(uint64(r.Uint32()))" - case descriptor.FieldDescriptorProto_TYPE_INT32, - descriptor.FieldDescriptorProto_TYPE_SINT32, - descriptor.FieldDescriptorProto_TYPE_SFIXED32, - descriptor.FieldDescriptorProto_TYPE_ENUM: - return typeName + "(r.Int31())" - case descriptor.FieldDescriptorProto_TYPE_UINT32, - descriptor.FieldDescriptorProto_TYPE_FIXED32: - return typeName + "(r.Uint32())" - case descriptor.FieldDescriptorProto_TYPE_BOOL: - return typeName + `(bool(r.Intn(2) == 0))` - case descriptor.FieldDescriptorProto_TYPE_STRING, - descriptor.FieldDescriptorProto_TYPE_GROUP, - descriptor.FieldDescriptorProto_TYPE_MESSAGE, - descriptor.FieldDescriptorProto_TYPE_BYTES: - } - panic(fmt.Errorf("unexpected type %v", typeName)) -} - -func negative(fieldType descriptor.FieldDescriptorProto_Type) bool { - switch fieldType { - case descriptor.FieldDescriptorProto_TYPE_UINT64, - descriptor.FieldDescriptorProto_TYPE_FIXED64, - descriptor.FieldDescriptorProto_TYPE_UINT32, - descriptor.FieldDescriptorProto_TYPE_FIXED32, - descriptor.FieldDescriptorProto_TYPE_BOOL: - return false - } - return true -} - -func (p *plugin) getFuncName(goTypName string) string { - funcName := "NewPopulated" + goTypName - goTypNames := strings.Split(goTypName, ".") - if len(goTypNames) == 2 { - funcName = goTypNames[0] + ".NewPopulated" + goTypNames[1] - } else if len(goTypNames) != 1 { - panic(fmt.Errorf("unreachable: too many dots in %v", goTypName)) - } - switch funcName { - case "time.NewPopulatedTime": - funcName = p.typesPkg.Use() + ".NewPopulatedStdTime" - case "time.NewPopulatedDuration": - p.typesPkg.Use() - funcName = p.typesPkg.Use() + ".NewPopulatedStdDuration" - } - return funcName -} - -func (p *plugin) getFuncCall(goTypName string) string { - funcName := p.getFuncName(goTypName) - funcCall := funcName + "(r, easy)" - return funcCall -} - -func (p *plugin) getCustomFuncCall(goTypName string) string { - funcName := p.getFuncName(goTypName) - funcCall := funcName + "(r)" - return funcCall -} - -func (p *plugin) getEnumVal(field *descriptor.FieldDescriptorProto, goTyp string) string { - enum := p.ObjectNamed(field.GetTypeName()).(*generator.EnumDescriptor) - l := len(enum.Value) - values := make([]string, l) - for i := range enum.Value { - values[i] = strconv.Itoa(int(*enum.Value[i].Number)) - } - arr := "[]int32{" + strings.Join(values, ",") + "}" - val := strings.Join([]string{generator.GoTypeToName(goTyp), `(`, arr, `[r.Intn(`, fmt.Sprintf("%d", l), `)])`}, "") - return val -} - -func (p *plugin) GenerateField(file *generator.FileDescriptor, message *generator.Descriptor, field *descriptor.FieldDescriptorProto) { - proto3 := gogoproto.IsProto3(file.FileDescriptorProto) - goTyp, _ := p.GoType(message, field) - fieldname := p.GetOneOfFieldName(message, field) - goTypName := generator.GoTypeToName(goTyp) - if p.IsMap(field) { - m := p.GoMapType(nil, field) - keygoTyp, _ := p.GoType(nil, m.KeyField) - keygoTyp = strings.Replace(keygoTyp, "*", "", 1) - keygoAliasTyp, _ := p.GoType(nil, m.KeyAliasField) - keygoAliasTyp = strings.Replace(keygoAliasTyp, "*", "", 1) - - valuegoTyp, _ := p.GoType(nil, m.ValueField) - valuegoAliasTyp, _ := p.GoType(nil, m.ValueAliasField) - keytypName := generator.GoTypeToName(keygoTyp) - keygoAliasTyp = generator.GoTypeToName(keygoAliasTyp) - valuetypAliasName := generator.GoTypeToName(valuegoAliasTyp) - - nullable, valuegoTyp, valuegoAliasTyp := generator.GoMapValueTypes(field, m.ValueField, valuegoTyp, valuegoAliasTyp) - - p.P(p.varGen.Next(), ` := r.Intn(10)`) - p.P(`this.`, fieldname, ` = make(`, m.GoType, `)`) - p.P(`for i := 0; i < `, p.varGen.Current(), `; i++ {`) - p.In() - keyval := "" - if m.KeyField.IsString() { - keyval = fmt.Sprintf("randString%v(r)", p.localName) - } else { - keyval = value(keytypName, m.KeyField.GetType()) - } - if keygoAliasTyp != keygoTyp { - keyval = keygoAliasTyp + `(` + keyval + `)` - } - if m.ValueField.IsMessage() || p.IsGroup(field) || - (m.ValueField.IsBytes() && gogoproto.IsCustomType(field)) { - s := `this.` + fieldname + `[` + keyval + `] = ` - if gogoproto.IsStdTime(field) || gogoproto.IsStdDuration(field) { - valuegoTyp = valuegoAliasTyp - } - funcCall := p.getCustomFuncCall(goTypName) - if !gogoproto.IsCustomType(field) { - goTypName = generator.GoTypeToName(valuegoTyp) - funcCall = p.getFuncCall(goTypName) - } - if !nullable { - funcCall = `*` + funcCall - } - if valuegoTyp != valuegoAliasTyp { - funcCall = `(` + valuegoAliasTyp + `)(` + funcCall + `)` - } - s += funcCall - p.P(s) - } else if m.ValueField.IsEnum() { - s := `this.` + fieldname + `[` + keyval + `]` + ` = ` + p.getEnumVal(m.ValueField, valuegoTyp) - p.P(s) - } else if m.ValueField.IsBytes() { - count := p.varGen.Next() - p.P(count, ` := r.Intn(100)`) - p.P(p.varGen.Next(), ` := `, keyval) - p.P(`this.`, fieldname, `[`, p.varGen.Current(), `] = make(`, valuegoTyp, `, `, count, `)`) - p.P(`for i := 0; i < `, count, `; i++ {`) - p.In() - p.P(`this.`, fieldname, `[`, p.varGen.Current(), `][i] = byte(r.Intn(256))`) - p.Out() - p.P(`}`) - } else if m.ValueField.IsString() { - s := `this.` + fieldname + `[` + keyval + `]` + ` = ` + fmt.Sprintf("randString%v(r)", p.localName) - p.P(s) - } else { - p.P(p.varGen.Next(), ` := `, keyval) - p.P(`this.`, fieldname, `[`, p.varGen.Current(), `] = `, value(valuetypAliasName, m.ValueField.GetType())) - if negative(m.ValueField.GetType()) { - p.P(`if r.Intn(2) == 0 {`) - p.In() - p.P(`this.`, fieldname, `[`, p.varGen.Current(), `] *= -1`) - p.Out() - p.P(`}`) - } - } - p.Out() - p.P(`}`) - } else if field.IsMessage() || p.IsGroup(field) { - funcCall := p.getFuncCall(goTypName) - if field.IsRepeated() { - p.P(p.varGen.Next(), ` := r.Intn(5)`) - p.P(`this.`, fieldname, ` = make(`, goTyp, `, `, p.varGen.Current(), `)`) - p.P(`for i := 0; i < `, p.varGen.Current(), `; i++ {`) - p.In() - if gogoproto.IsNullable(field) { - p.P(`this.`, fieldname, `[i] = `, funcCall) - } else { - p.P(p.varGen.Next(), `:= `, funcCall) - p.P(`this.`, fieldname, `[i] = *`, p.varGen.Current()) - } - p.Out() - p.P(`}`) - } else { - if gogoproto.IsNullable(field) { - p.P(`this.`, fieldname, ` = `, funcCall) - } else { - p.P(p.varGen.Next(), `:= `, funcCall) - p.P(`this.`, fieldname, ` = *`, p.varGen.Current()) - } - } - } else { - if field.IsEnum() { - val := p.getEnumVal(field, goTyp) - if field.IsRepeated() { - p.P(p.varGen.Next(), ` := r.Intn(10)`) - p.P(`this.`, fieldname, ` = make(`, goTyp, `, `, p.varGen.Current(), `)`) - p.P(`for i := 0; i < `, p.varGen.Current(), `; i++ {`) - p.In() - p.P(`this.`, fieldname, `[i] = `, val) - p.Out() - p.P(`}`) - } else if !gogoproto.IsNullable(field) || proto3 { - p.P(`this.`, fieldname, ` = `, val) - } else { - p.P(p.varGen.Next(), ` := `, val) - p.P(`this.`, fieldname, ` = &`, p.varGen.Current()) - } - } else if gogoproto.IsCustomType(field) { - funcCall := p.getCustomFuncCall(goTypName) - if field.IsRepeated() { - p.P(p.varGen.Next(), ` := r.Intn(10)`) - p.P(`this.`, fieldname, ` = make(`, goTyp, `, `, p.varGen.Current(), `)`) - p.P(`for i := 0; i < `, p.varGen.Current(), `; i++ {`) - p.In() - p.P(p.varGen.Next(), `:= `, funcCall) - p.P(`this.`, fieldname, `[i] = *`, p.varGen.Current()) - p.Out() - p.P(`}`) - } else if gogoproto.IsNullable(field) { - p.P(`this.`, fieldname, ` = `, funcCall) - } else { - p.P(p.varGen.Next(), `:= `, funcCall) - p.P(`this.`, fieldname, ` = *`, p.varGen.Current()) - } - } else if field.IsBytes() { - if field.IsRepeated() { - p.P(p.varGen.Next(), ` := r.Intn(10)`) - p.P(`this.`, fieldname, ` = make(`, goTyp, `, `, p.varGen.Current(), `)`) - p.P(`for i := 0; i < `, p.varGen.Current(), `; i++ {`) - p.In() - p.P(p.varGen.Next(), ` := r.Intn(100)`) - p.P(`this.`, fieldname, `[i] = make([]byte,`, p.varGen.Current(), `)`) - p.P(`for j := 0; j < `, p.varGen.Current(), `; j++ {`) - p.In() - p.P(`this.`, fieldname, `[i][j] = byte(r.Intn(256))`) - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - } else { - p.P(p.varGen.Next(), ` := r.Intn(100)`) - p.P(`this.`, fieldname, ` = make(`, goTyp, `, `, p.varGen.Current(), `)`) - p.P(`for i := 0; i < `, p.varGen.Current(), `; i++ {`) - p.In() - p.P(`this.`, fieldname, `[i] = byte(r.Intn(256))`) - p.Out() - p.P(`}`) - } - } else if field.IsString() { - typName := generator.GoTypeToName(goTyp) - val := fmt.Sprintf("%s(randString%v(r))", typName, p.localName) - if field.IsRepeated() { - p.P(p.varGen.Next(), ` := r.Intn(10)`) - p.P(`this.`, fieldname, ` = make(`, goTyp, `, `, p.varGen.Current(), `)`) - p.P(`for i := 0; i < `, p.varGen.Current(), `; i++ {`) - p.In() - p.P(`this.`, fieldname, `[i] = `, val) - p.Out() - p.P(`}`) - } else if !gogoproto.IsNullable(field) || proto3 { - p.P(`this.`, fieldname, ` = `, val) - } else { - p.P(p.varGen.Next(), `:= `, val) - p.P(`this.`, fieldname, ` = &`, p.varGen.Current()) - } - } else { - typName := generator.GoTypeToName(goTyp) - if field.IsRepeated() { - p.P(p.varGen.Next(), ` := r.Intn(10)`) - p.P(`this.`, fieldname, ` = make(`, goTyp, `, `, p.varGen.Current(), `)`) - p.P(`for i := 0; i < `, p.varGen.Current(), `; i++ {`) - p.In() - p.P(`this.`, fieldname, `[i] = `, value(typName, field.GetType())) - if negative(field.GetType()) { - p.P(`if r.Intn(2) == 0 {`) - p.In() - p.P(`this.`, fieldname, `[i] *= -1`) - p.Out() - p.P(`}`) - } - p.Out() - p.P(`}`) - } else if !gogoproto.IsNullable(field) || proto3 { - p.P(`this.`, fieldname, ` = `, value(typName, field.GetType())) - if negative(field.GetType()) { - p.P(`if r.Intn(2) == 0 {`) - p.In() - p.P(`this.`, fieldname, ` *= -1`) - p.Out() - p.P(`}`) - } - } else { - p.P(p.varGen.Next(), ` := `, value(typName, field.GetType())) - if negative(field.GetType()) { - p.P(`if r.Intn(2) == 0 {`) - p.In() - p.P(p.varGen.Current(), ` *= -1`) - p.Out() - p.P(`}`) - } - p.P(`this.`, fieldname, ` = &`, p.varGen.Current()) - } - } - } -} - -func (p *plugin) hasLoop(field *descriptor.FieldDescriptorProto, visited []*generator.Descriptor, excludes []*generator.Descriptor) *generator.Descriptor { - if field.IsMessage() || p.IsGroup(field) || p.IsMap(field) { - var fieldMessage *generator.Descriptor - if p.IsMap(field) { - m := p.GoMapType(nil, field) - if !m.ValueField.IsMessage() { - return nil - } - fieldMessage = p.ObjectNamed(m.ValueField.GetTypeName()).(*generator.Descriptor) - } else { - fieldMessage = p.ObjectNamed(field.GetTypeName()).(*generator.Descriptor) - } - fieldTypeName := generator.CamelCaseSlice(fieldMessage.TypeName()) - for _, message := range visited { - messageTypeName := generator.CamelCaseSlice(message.TypeName()) - if fieldTypeName == messageTypeName { - for _, e := range excludes { - if fieldTypeName == generator.CamelCaseSlice(e.TypeName()) { - return nil - } - } - return fieldMessage - } - } - pkg := strings.Split(field.GetTypeName(), ".")[1] - for _, f := range fieldMessage.Field { - if strings.HasPrefix(f.GetTypeName(), "."+pkg+".") { - visited = append(visited, fieldMessage) - loopTo := p.hasLoop(f, visited, excludes) - if loopTo != nil { - return loopTo - } - } - } - } - return nil -} - -func (p *plugin) loops(field *descriptor.FieldDescriptorProto, message *generator.Descriptor) int { - //fmt.Fprintf(os.Stderr, "loops %v %v\n", field.GetTypeName(), generator.CamelCaseSlice(message.TypeName())) - excludes := []*generator.Descriptor{} - loops := 0 - for { - visited := []*generator.Descriptor{} - loopTo := p.hasLoop(field, visited, excludes) - if loopTo == nil { - break - } - //fmt.Fprintf(os.Stderr, "loopTo %v\n", generator.CamelCaseSlice(loopTo.TypeName())) - excludes = append(excludes, loopTo) - loops++ - } - return loops -} - -func (p *plugin) Generate(file *generator.FileDescriptor) { - p.atleastOne = false - p.PluginImports = generator.NewPluginImports(p.Generator) - p.varGen = NewVarGen() - proto3 := gogoproto.IsProto3(file.FileDescriptorProto) - p.typesPkg = p.NewImport("github.com/gogo/protobuf/types") - p.localName = generator.FileName(file) - protoPkg := p.NewImport("github.com/gogo/protobuf/proto") - if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { - protoPkg = p.NewImport("github.com/golang/protobuf/proto") - } - - for _, message := range file.Messages() { - if !gogoproto.HasPopulate(file.FileDescriptorProto, message.DescriptorProto) { - continue - } - if message.DescriptorProto.GetOptions().GetMapEntry() { - continue - } - p.atleastOne = true - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - loopLevels := make([]int, len(message.Field)) - maxLoopLevel := 0 - for i, field := range message.Field { - loopLevels[i] = p.loops(field, message) - if loopLevels[i] > maxLoopLevel { - maxLoopLevel = loopLevels[i] - } - } - ranTotal := 0 - for i := range loopLevels { - ranTotal += int(math.Pow10(maxLoopLevel - loopLevels[i])) - } - p.P(`func NewPopulated`, ccTypeName, `(r randy`, p.localName, `, easy bool) *`, ccTypeName, ` {`) - p.In() - p.P(`this := &`, ccTypeName, `{}`) - if gogoproto.IsUnion(message.File(), message.DescriptorProto) && len(message.Field) > 0 { - p.P(`fieldNum := r.Intn(`, fmt.Sprintf("%d", ranTotal), `)`) - p.P(`switch fieldNum {`) - k := 0 - for i, field := range message.Field { - is := []string{} - ran := int(math.Pow10(maxLoopLevel - loopLevels[i])) - for j := 0; j < ran; j++ { - is = append(is, fmt.Sprintf("%d", j+k)) - } - k += ran - p.P(`case `, strings.Join(is, ","), `:`) - p.In() - p.GenerateField(file, message, field) - p.Out() - } - p.P(`}`) - } else { - var maxFieldNumber int32 - oneofs := make(map[string]struct{}) - for fieldIndex, field := range message.Field { - if field.GetNumber() > maxFieldNumber { - maxFieldNumber = field.GetNumber() - } - oneof := field.OneofIndex != nil - if !oneof { - if field.IsRequired() || (!gogoproto.IsNullable(field) && !field.IsRepeated()) || (proto3 && !field.IsMessage()) { - p.GenerateField(file, message, field) - } else { - if loopLevels[fieldIndex] > 0 { - p.P(`if r.Intn(10) == 0 {`) - } else { - p.P(`if r.Intn(10) != 0 {`) - } - p.In() - p.GenerateField(file, message, field) - p.Out() - p.P(`}`) - } - } else { - fieldname := p.GetFieldName(message, field) - if _, ok := oneofs[fieldname]; ok { - continue - } else { - oneofs[fieldname] = struct{}{} - } - fieldNumbers := []int32{} - for _, f := range message.Field { - fname := p.GetFieldName(message, f) - if fname == fieldname { - fieldNumbers = append(fieldNumbers, f.GetNumber()) - } - } - - p.P(`oneofNumber_`, fieldname, ` := `, fmt.Sprintf("%#v", fieldNumbers), `[r.Intn(`, strconv.Itoa(len(fieldNumbers)), `)]`) - p.P(`switch oneofNumber_`, fieldname, ` {`) - for _, f := range message.Field { - fname := p.GetFieldName(message, f) - if fname != fieldname { - continue - } - p.P(`case `, strconv.Itoa(int(f.GetNumber())), `:`) - p.In() - ccTypeName := p.OneOfTypeName(message, f) - p.P(`this.`, fname, ` = NewPopulated`, ccTypeName, `(r, easy)`) - p.Out() - } - p.P(`}`) - } - } - if message.DescriptorProto.HasExtension() { - p.P(`if !easy && r.Intn(10) != 0 {`) - p.In() - p.P(`l := r.Intn(5)`) - p.P(`for i := 0; i < l; i++ {`) - p.In() - if len(message.DescriptorProto.GetExtensionRange()) > 1 { - p.P(`eIndex := r.Intn(`, strconv.Itoa(len(message.DescriptorProto.GetExtensionRange())), `)`) - p.P(`fieldNumber := 0`) - p.P(`switch eIndex {`) - for i, e := range message.DescriptorProto.GetExtensionRange() { - p.P(`case `, strconv.Itoa(i), `:`) - p.In() - p.P(`fieldNumber = r.Intn(`, strconv.Itoa(int(e.GetEnd()-e.GetStart())), `) + `, strconv.Itoa(int(e.GetStart()))) - p.Out() - if e.GetEnd() > maxFieldNumber { - maxFieldNumber = e.GetEnd() - } - } - p.P(`}`) - } else { - e := message.DescriptorProto.GetExtensionRange()[0] - p.P(`fieldNumber := r.Intn(`, strconv.Itoa(int(e.GetEnd()-e.GetStart())), `) + `, strconv.Itoa(int(e.GetStart()))) - if e.GetEnd() > maxFieldNumber { - maxFieldNumber = e.GetEnd() - } - } - p.P(`wire := r.Intn(4)`) - p.P(`if wire == 3 { wire = 5 }`) - p.P(`dAtA := randField`, p.localName, `(nil, r, fieldNumber, wire)`) - p.P(protoPkg.Use(), `.SetRawExtension(this, int32(fieldNumber), dAtA)`) - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - } - - if maxFieldNumber < (1 << 10) { - p.P(`if !easy && r.Intn(10) != 0 {`) - p.In() - if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) { - p.P(`this.XXX_unrecognized = randUnrecognized`, p.localName, `(r, `, strconv.Itoa(int(maxFieldNumber+1)), `)`) - } - p.Out() - p.P(`}`) - } - } - p.P(`return this`) - p.Out() - p.P(`}`) - p.P(``) - - //Generate NewPopulated functions for oneof fields - m := proto.Clone(message.DescriptorProto).(*descriptor.DescriptorProto) - for _, f := range m.Field { - oneof := f.OneofIndex != nil - if !oneof { - continue - } - ccTypeName := p.OneOfTypeName(message, f) - p.P(`func NewPopulated`, ccTypeName, `(r randy`, p.localName, `, easy bool) *`, ccTypeName, ` {`) - p.In() - p.P(`this := &`, ccTypeName, `{}`) - vanity.TurnOffNullableForNativeTypesWithoutDefaultsOnly(f) - p.GenerateField(file, message, f) - p.P(`return this`) - p.Out() - p.P(`}`) - } - } - - if !p.atleastOne { - return - } - - p.P(`type randy`, p.localName, ` interface {`) - p.In() - p.P(`Float32() float32`) - p.P(`Float64() float64`) - p.P(`Int63() int64`) - p.P(`Int31() int32`) - p.P(`Uint32() uint32`) - p.P(`Intn(n int) int`) - p.Out() - p.P(`}`) - - p.P(`func randUTF8Rune`, p.localName, `(r randy`, p.localName, `) rune {`) - p.In() - p.P(`ru := r.Intn(62)`) - p.P(`if ru < 10 {`) - p.In() - p.P(`return rune(ru+48)`) - p.Out() - p.P(`} else if ru < 36 {`) - p.In() - p.P(`return rune(ru+55)`) - p.Out() - p.P(`}`) - p.P(`return rune(ru+61)`) - p.Out() - p.P(`}`) - - p.P(`func randString`, p.localName, `(r randy`, p.localName, `) string {`) - p.In() - p.P(p.varGen.Next(), ` := r.Intn(100)`) - p.P(`tmps := make([]rune, `, p.varGen.Current(), `)`) - p.P(`for i := 0; i < `, p.varGen.Current(), `; i++ {`) - p.In() - p.P(`tmps[i] = randUTF8Rune`, p.localName, `(r)`) - p.Out() - p.P(`}`) - p.P(`return string(tmps)`) - p.Out() - p.P(`}`) - - p.P(`func randUnrecognized`, p.localName, `(r randy`, p.localName, `, maxFieldNumber int) (dAtA []byte) {`) - p.In() - p.P(`l := r.Intn(5)`) - p.P(`for i := 0; i < l; i++ {`) - p.In() - p.P(`wire := r.Intn(4)`) - p.P(`if wire == 3 { wire = 5 }`) - p.P(`fieldNumber := maxFieldNumber + r.Intn(100)`) - p.P(`dAtA = randField`, p.localName, `(dAtA, r, fieldNumber, wire)`) - p.Out() - p.P(`}`) - p.P(`return dAtA`) - p.Out() - p.P(`}`) - - p.P(`func randField`, p.localName, `(dAtA []byte, r randy`, p.localName, `, fieldNumber int, wire int) []byte {`) - p.In() - p.P(`key := uint32(fieldNumber)<<3 | uint32(wire)`) - p.P(`switch wire {`) - p.P(`case 0:`) - p.In() - p.P(`dAtA = encodeVarintPopulate`, p.localName, `(dAtA, uint64(key))`) - p.P(p.varGen.Next(), ` := r.Int63()`) - p.P(`if r.Intn(2) == 0 {`) - p.In() - p.P(p.varGen.Current(), ` *= -1`) - p.Out() - p.P(`}`) - p.P(`dAtA = encodeVarintPopulate`, p.localName, `(dAtA, uint64(`, p.varGen.Current(), `))`) - p.Out() - p.P(`case 1:`) - p.In() - p.P(`dAtA = encodeVarintPopulate`, p.localName, `(dAtA, uint64(key))`) - p.P(`dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))`) - p.Out() - p.P(`case 2:`) - p.In() - p.P(`dAtA = encodeVarintPopulate`, p.localName, `(dAtA, uint64(key))`) - p.P(`ll := r.Intn(100)`) - p.P(`dAtA = encodeVarintPopulate`, p.localName, `(dAtA, uint64(ll))`) - p.P(`for j := 0; j < ll; j++ {`) - p.In() - p.P(`dAtA = append(dAtA, byte(r.Intn(256)))`) - p.Out() - p.P(`}`) - p.Out() - p.P(`default:`) - p.In() - p.P(`dAtA = encodeVarintPopulate`, p.localName, `(dAtA, uint64(key))`) - p.P(`dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))`) - p.Out() - p.P(`}`) - p.P(`return dAtA`) - p.Out() - p.P(`}`) - - p.P(`func encodeVarintPopulate`, p.localName, `(dAtA []byte, v uint64) []byte {`) - p.In() - p.P(`for v >= 1<<7 {`) - p.In() - p.P(`dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80))`) - p.P(`v >>= 7`) - p.Out() - p.P(`}`) - p.P(`dAtA = append(dAtA, uint8(v))`) - p.P(`return dAtA`) - p.Out() - p.P(`}`) - -} - -func init() { - generator.RegisterPlugin(NewPlugin()) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/size/size.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/size/size.go deleted file mode 100644 index 15ab49ccb87..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/size/size.go +++ /dev/null @@ -1,669 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -/* -The size plugin generates a Size or ProtoSize method for each message. -This is useful with the MarshalTo method generated by the marshalto plugin and the -gogoproto.marshaler and gogoproto.marshaler_all extensions. - -It is enabled by the following extensions: - - - sizer - - sizer_all - - protosizer - - protosizer_all - -The size plugin also generates a test given it is enabled using one of the following extensions: - - - testgen - - testgen_all - -And a benchmark given it is enabled using one of the following extensions: - - - benchgen - - benchgen_all - -Let us look at: - - github.com/gogo/protobuf/test/example/example.proto - -Btw all the output can be seen at: - - github.com/gogo/protobuf/test/example/* - -The following message: - - option (gogoproto.sizer_all) = true; - - message B { - option (gogoproto.description) = true; - optional A A = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; - repeated bytes G = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false]; - } - -given to the size plugin, will generate the following code: - - func (m *B) Size() (n int) { - var l int - _ = l - l = m.A.Size() - n += 1 + l + sovExample(uint64(l)) - if len(m.G) > 0 { - for _, e := range m.G { - l = e.Size() - n += 1 + l + sovExample(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n - } - -and the following test code: - - func TestBSize(t *testing5.T) { - popr := math_rand5.New(math_rand5.NewSource(time5.Now().UnixNano())) - p := NewPopulatedB(popr, true) - dAtA, err := github_com_gogo_protobuf_proto2.Marshal(p) - if err != nil { - panic(err) - } - size := p.Size() - if len(dAtA) != size { - t.Fatalf("size %v != marshalled size %v", size, len(dAtA)) - } - } - - func BenchmarkBSize(b *testing5.B) { - popr := math_rand5.New(math_rand5.NewSource(616)) - total := 0 - pops := make([]*B, 1000) - for i := 0; i < 1000; i++ { - pops[i] = NewPopulatedB(popr, false) - } - b.ResetTimer() - for i := 0; i < b.N; i++ { - total += pops[i%1000].Size() - } - b.SetBytes(int64(total / b.N)) - } - -The sovExample function is a size of varint function for the example.pb.go file. - -*/ -package size - -import ( - "fmt" - "strconv" - "strings" - - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/proto" - descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" - "github.com/gogo/protobuf/vanity" -) - -type size struct { - *generator.Generator - generator.PluginImports - atleastOne bool - localName string - typesPkg generator.Single -} - -func NewSize() *size { - return &size{} -} - -func (p *size) Name() string { - return "size" -} - -func (p *size) Init(g *generator.Generator) { - p.Generator = g -} - -func wireToType(wire string) int { - switch wire { - case "fixed64": - return proto.WireFixed64 - case "fixed32": - return proto.WireFixed32 - case "varint": - return proto.WireVarint - case "bytes": - return proto.WireBytes - case "group": - return proto.WireBytes - case "zigzag32": - return proto.WireVarint - case "zigzag64": - return proto.WireVarint - } - panic("unreachable") -} - -func keySize(fieldNumber int32, wireType int) int { - x := uint32(fieldNumber)<<3 | uint32(wireType) - size := 0 - for size = 0; x > 127; size++ { - x >>= 7 - } - size++ - return size -} - -func (p *size) sizeVarint() { - p.P(` - func sov`, p.localName, `(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n - }`) -} - -func (p *size) sizeZigZag() { - p.P(`func soz`, p.localName, `(x uint64) (n int) { - return sov`, p.localName, `(uint64((x << 1) ^ uint64((int64(x) >> 63)))) - }`) -} - -func (p *size) std(field *descriptor.FieldDescriptorProto, name string) (string, bool) { - if gogoproto.IsStdTime(field) { - if gogoproto.IsNullable(field) { - return p.typesPkg.Use() + `.SizeOfStdTime(*` + name + `)`, true - } else { - return p.typesPkg.Use() + `.SizeOfStdTime(` + name + `)`, true - } - } else if gogoproto.IsStdDuration(field) { - if gogoproto.IsNullable(field) { - return p.typesPkg.Use() + `.SizeOfStdDuration(*` + name + `)`, true - } else { - return p.typesPkg.Use() + `.SizeOfStdDuration(` + name + `)`, true - } - } - return "", false -} - -func (p *size) generateField(proto3 bool, file *generator.FileDescriptor, message *generator.Descriptor, field *descriptor.FieldDescriptorProto, sizeName string) { - fieldname := p.GetOneOfFieldName(message, field) - nullable := gogoproto.IsNullable(field) - repeated := field.IsRepeated() - doNilCheck := gogoproto.NeedsNilCheck(proto3, field) - if repeated { - p.P(`if len(m.`, fieldname, `) > 0 {`) - p.In() - } else if doNilCheck { - p.P(`if m.`, fieldname, ` != nil {`) - p.In() - } - packed := field.IsPacked() || (proto3 && field.IsRepeated() && generator.IsScalar(field)) - _, wire := p.GoType(message, field) - wireType := wireToType(wire) - fieldNumber := field.GetNumber() - if packed { - wireType = proto.WireBytes - } - key := keySize(fieldNumber, wireType) - switch *field.Type { - case descriptor.FieldDescriptorProto_TYPE_DOUBLE, - descriptor.FieldDescriptorProto_TYPE_FIXED64, - descriptor.FieldDescriptorProto_TYPE_SFIXED64: - if packed { - p.P(`n+=`, strconv.Itoa(key), `+sov`, p.localName, `(uint64(len(m.`, fieldname, `)*8))`, `+len(m.`, fieldname, `)*8`) - } else if repeated { - p.P(`n+=`, strconv.Itoa(key+8), `*len(m.`, fieldname, `)`) - } else if proto3 { - p.P(`if m.`, fieldname, ` != 0 {`) - p.In() - p.P(`n+=`, strconv.Itoa(key+8)) - p.Out() - p.P(`}`) - } else if nullable { - p.P(`n+=`, strconv.Itoa(key+8)) - } else { - p.P(`n+=`, strconv.Itoa(key+8)) - } - case descriptor.FieldDescriptorProto_TYPE_FLOAT, - descriptor.FieldDescriptorProto_TYPE_FIXED32, - descriptor.FieldDescriptorProto_TYPE_SFIXED32: - if packed { - p.P(`n+=`, strconv.Itoa(key), `+sov`, p.localName, `(uint64(len(m.`, fieldname, `)*4))`, `+len(m.`, fieldname, `)*4`) - } else if repeated { - p.P(`n+=`, strconv.Itoa(key+4), `*len(m.`, fieldname, `)`) - } else if proto3 { - p.P(`if m.`, fieldname, ` != 0 {`) - p.In() - p.P(`n+=`, strconv.Itoa(key+4)) - p.Out() - p.P(`}`) - } else if nullable { - p.P(`n+=`, strconv.Itoa(key+4)) - } else { - p.P(`n+=`, strconv.Itoa(key+4)) - } - case descriptor.FieldDescriptorProto_TYPE_INT64, - descriptor.FieldDescriptorProto_TYPE_UINT64, - descriptor.FieldDescriptorProto_TYPE_UINT32, - descriptor.FieldDescriptorProto_TYPE_ENUM, - descriptor.FieldDescriptorProto_TYPE_INT32: - if packed { - p.P(`l = 0`) - p.P(`for _, e := range m.`, fieldname, ` {`) - p.In() - p.P(`l+=sov`, p.localName, `(uint64(e))`) - p.Out() - p.P(`}`) - p.P(`n+=`, strconv.Itoa(key), `+sov`, p.localName, `(uint64(l))+l`) - } else if repeated { - p.P(`for _, e := range m.`, fieldname, ` {`) - p.In() - p.P(`n+=`, strconv.Itoa(key), `+sov`, p.localName, `(uint64(e))`) - p.Out() - p.P(`}`) - } else if proto3 { - p.P(`if m.`, fieldname, ` != 0 {`) - p.In() - p.P(`n+=`, strconv.Itoa(key), `+sov`, p.localName, `(uint64(m.`, fieldname, `))`) - p.Out() - p.P(`}`) - } else if nullable { - p.P(`n+=`, strconv.Itoa(key), `+sov`, p.localName, `(uint64(*m.`, fieldname, `))`) - } else { - p.P(`n+=`, strconv.Itoa(key), `+sov`, p.localName, `(uint64(m.`, fieldname, `))`) - } - case descriptor.FieldDescriptorProto_TYPE_BOOL: - if packed { - p.P(`n+=`, strconv.Itoa(key), `+sov`, p.localName, `(uint64(len(m.`, fieldname, `)))`, `+len(m.`, fieldname, `)*1`) - } else if repeated { - p.P(`n+=`, strconv.Itoa(key+1), `*len(m.`, fieldname, `)`) - } else if proto3 { - p.P(`if m.`, fieldname, ` {`) - p.In() - p.P(`n+=`, strconv.Itoa(key+1)) - p.Out() - p.P(`}`) - } else if nullable { - p.P(`n+=`, strconv.Itoa(key+1)) - } else { - p.P(`n+=`, strconv.Itoa(key+1)) - } - case descriptor.FieldDescriptorProto_TYPE_STRING: - if repeated { - p.P(`for _, s := range m.`, fieldname, ` { `) - p.In() - p.P(`l = len(s)`) - p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`) - p.Out() - p.P(`}`) - } else if proto3 { - p.P(`l=len(m.`, fieldname, `)`) - p.P(`if l > 0 {`) - p.In() - p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`) - p.Out() - p.P(`}`) - } else if nullable { - p.P(`l=len(*m.`, fieldname, `)`) - p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`) - } else { - p.P(`l=len(m.`, fieldname, `)`) - p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`) - } - case descriptor.FieldDescriptorProto_TYPE_GROUP: - panic(fmt.Errorf("size does not support group %v", fieldname)) - case descriptor.FieldDescriptorProto_TYPE_MESSAGE: - if p.IsMap(field) { - m := p.GoMapType(nil, field) - _, keywire := p.GoType(nil, m.KeyAliasField) - valuegoTyp, _ := p.GoType(nil, m.ValueField) - valuegoAliasTyp, valuewire := p.GoType(nil, m.ValueAliasField) - _, fieldwire := p.GoType(nil, field) - - nullable, valuegoTyp, valuegoAliasTyp = generator.GoMapValueTypes(field, m.ValueField, valuegoTyp, valuegoAliasTyp) - - fieldKeySize := keySize(field.GetNumber(), wireToType(fieldwire)) - keyKeySize := keySize(1, wireToType(keywire)) - valueKeySize := keySize(2, wireToType(valuewire)) - p.P(`for k, v := range m.`, fieldname, ` { `) - p.In() - p.P(`_ = k`) - p.P(`_ = v`) - sum := []string{strconv.Itoa(keyKeySize)} - switch m.KeyField.GetType() { - case descriptor.FieldDescriptorProto_TYPE_DOUBLE, - descriptor.FieldDescriptorProto_TYPE_FIXED64, - descriptor.FieldDescriptorProto_TYPE_SFIXED64: - sum = append(sum, `8`) - case descriptor.FieldDescriptorProto_TYPE_FLOAT, - descriptor.FieldDescriptorProto_TYPE_FIXED32, - descriptor.FieldDescriptorProto_TYPE_SFIXED32: - sum = append(sum, `4`) - case descriptor.FieldDescriptorProto_TYPE_INT64, - descriptor.FieldDescriptorProto_TYPE_UINT64, - descriptor.FieldDescriptorProto_TYPE_UINT32, - descriptor.FieldDescriptorProto_TYPE_ENUM, - descriptor.FieldDescriptorProto_TYPE_INT32: - sum = append(sum, `sov`+p.localName+`(uint64(k))`) - case descriptor.FieldDescriptorProto_TYPE_BOOL: - sum = append(sum, `1`) - case descriptor.FieldDescriptorProto_TYPE_STRING, - descriptor.FieldDescriptorProto_TYPE_BYTES: - sum = append(sum, `len(k)+sov`+p.localName+`(uint64(len(k)))`) - case descriptor.FieldDescriptorProto_TYPE_SINT32, - descriptor.FieldDescriptorProto_TYPE_SINT64: - sum = append(sum, `soz`+p.localName+`(uint64(k))`) - } - switch m.ValueField.GetType() { - case descriptor.FieldDescriptorProto_TYPE_DOUBLE, - descriptor.FieldDescriptorProto_TYPE_FIXED64, - descriptor.FieldDescriptorProto_TYPE_SFIXED64: - sum = append(sum, strconv.Itoa(valueKeySize)) - sum = append(sum, strconv.Itoa(8)) - case descriptor.FieldDescriptorProto_TYPE_FLOAT, - descriptor.FieldDescriptorProto_TYPE_FIXED32, - descriptor.FieldDescriptorProto_TYPE_SFIXED32: - sum = append(sum, strconv.Itoa(valueKeySize)) - sum = append(sum, strconv.Itoa(4)) - case descriptor.FieldDescriptorProto_TYPE_INT64, - descriptor.FieldDescriptorProto_TYPE_UINT64, - descriptor.FieldDescriptorProto_TYPE_UINT32, - descriptor.FieldDescriptorProto_TYPE_ENUM, - descriptor.FieldDescriptorProto_TYPE_INT32: - sum = append(sum, strconv.Itoa(valueKeySize)) - sum = append(sum, `sov`+p.localName+`(uint64(v))`) - case descriptor.FieldDescriptorProto_TYPE_BOOL: - sum = append(sum, strconv.Itoa(valueKeySize)) - sum = append(sum, `1`) - case descriptor.FieldDescriptorProto_TYPE_STRING: - sum = append(sum, strconv.Itoa(valueKeySize)) - sum = append(sum, `len(v)+sov`+p.localName+`(uint64(len(v)))`) - case descriptor.FieldDescriptorProto_TYPE_BYTES: - if gogoproto.IsCustomType(field) { - p.P(`l = 0`) - if nullable { - p.P(`if v != nil {`) - p.In() - } - p.P(`l = v.`, sizeName, `()`) - p.P(`l += `, strconv.Itoa(valueKeySize), ` + sov`+p.localName+`(uint64(l))`) - if nullable { - p.Out() - p.P(`}`) - } - sum = append(sum, `l`) - } else { - p.P(`l = 0`) - if proto3 { - p.P(`if len(v) > 0 {`) - } else { - p.P(`if v != nil {`) - } - p.In() - p.P(`l = `, strconv.Itoa(valueKeySize), ` + len(v)+sov`+p.localName+`(uint64(len(v)))`) - p.Out() - p.P(`}`) - sum = append(sum, `l`) - } - case descriptor.FieldDescriptorProto_TYPE_SINT32, - descriptor.FieldDescriptorProto_TYPE_SINT64: - sum = append(sum, strconv.Itoa(valueKeySize)) - sum = append(sum, `soz`+p.localName+`(uint64(v))`) - case descriptor.FieldDescriptorProto_TYPE_MESSAGE: - stdSizeCall, stdOk := p.std(field, "v") - if nullable { - p.P(`l = 0`) - p.P(`if v != nil {`) - p.In() - if stdOk { - p.P(`l = `, stdSizeCall) - } else if valuegoTyp != valuegoAliasTyp { - p.P(`l = ((`, valuegoTyp, `)(v)).`, sizeName, `()`) - } else { - p.P(`l = v.`, sizeName, `()`) - } - p.P(`l += `, strconv.Itoa(valueKeySize), ` + sov`+p.localName+`(uint64(l))`) - p.Out() - p.P(`}`) - sum = append(sum, `l`) - } else { - if stdOk { - p.P(`l = `, stdSizeCall) - } else if valuegoTyp != valuegoAliasTyp { - p.P(`l = ((*`, valuegoTyp, `)(&v)).`, sizeName, `()`) - } else { - p.P(`l = v.`, sizeName, `()`) - } - sum = append(sum, strconv.Itoa(valueKeySize)) - sum = append(sum, `l+sov`+p.localName+`(uint64(l))`) - } - } - p.P(`mapEntrySize := `, strings.Join(sum, "+")) - p.P(`n+=mapEntrySize+`, fieldKeySize, `+sov`, p.localName, `(uint64(mapEntrySize))`) - p.Out() - p.P(`}`) - } else if repeated { - p.P(`for _, e := range m.`, fieldname, ` { `) - p.In() - stdSizeCall, stdOk := p.std(field, "e") - if stdOk { - p.P(`l=`, stdSizeCall) - } else { - p.P(`l=e.`, sizeName, `()`) - } - p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`) - p.Out() - p.P(`}`) - } else { - stdSizeCall, stdOk := p.std(field, "m."+fieldname) - if stdOk { - p.P(`l=`, stdSizeCall) - } else { - p.P(`l=m.`, fieldname, `.`, sizeName, `()`) - } - p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`) - } - case descriptor.FieldDescriptorProto_TYPE_BYTES: - if !gogoproto.IsCustomType(field) { - if repeated { - p.P(`for _, b := range m.`, fieldname, ` { `) - p.In() - p.P(`l = len(b)`) - p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`) - p.Out() - p.P(`}`) - } else if proto3 { - p.P(`l=len(m.`, fieldname, `)`) - p.P(`if l > 0 {`) - p.In() - p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`) - p.Out() - p.P(`}`) - } else { - p.P(`l=len(m.`, fieldname, `)`) - p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`) - } - } else { - if repeated { - p.P(`for _, e := range m.`, fieldname, ` { `) - p.In() - p.P(`l=e.`, sizeName, `()`) - p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`) - p.Out() - p.P(`}`) - } else { - p.P(`l=m.`, fieldname, `.`, sizeName, `()`) - p.P(`n+=`, strconv.Itoa(key), `+l+sov`, p.localName, `(uint64(l))`) - } - } - case descriptor.FieldDescriptorProto_TYPE_SINT32, - descriptor.FieldDescriptorProto_TYPE_SINT64: - if packed { - p.P(`l = 0`) - p.P(`for _, e := range m.`, fieldname, ` {`) - p.In() - p.P(`l+=soz`, p.localName, `(uint64(e))`) - p.Out() - p.P(`}`) - p.P(`n+=`, strconv.Itoa(key), `+sov`, p.localName, `(uint64(l))+l`) - } else if repeated { - p.P(`for _, e := range m.`, fieldname, ` {`) - p.In() - p.P(`n+=`, strconv.Itoa(key), `+soz`, p.localName, `(uint64(e))`) - p.Out() - p.P(`}`) - } else if proto3 { - p.P(`if m.`, fieldname, ` != 0 {`) - p.In() - p.P(`n+=`, strconv.Itoa(key), `+soz`, p.localName, `(uint64(m.`, fieldname, `))`) - p.Out() - p.P(`}`) - } else if nullable { - p.P(`n+=`, strconv.Itoa(key), `+soz`, p.localName, `(uint64(*m.`, fieldname, `))`) - } else { - p.P(`n+=`, strconv.Itoa(key), `+soz`, p.localName, `(uint64(m.`, fieldname, `))`) - } - default: - panic("not implemented") - } - if repeated || doNilCheck { - p.Out() - p.P(`}`) - } -} - -func (p *size) Generate(file *generator.FileDescriptor) { - p.PluginImports = generator.NewPluginImports(p.Generator) - p.atleastOne = false - p.localName = generator.FileName(file) - p.typesPkg = p.NewImport("github.com/gogo/protobuf/types") - protoPkg := p.NewImport("github.com/gogo/protobuf/proto") - if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { - protoPkg = p.NewImport("github.com/golang/protobuf/proto") - } - for _, message := range file.Messages() { - sizeName := "" - if gogoproto.IsSizer(file.FileDescriptorProto, message.DescriptorProto) { - sizeName = "Size" - } else if gogoproto.IsProtoSizer(file.FileDescriptorProto, message.DescriptorProto) { - sizeName = "ProtoSize" - } else { - continue - } - if message.DescriptorProto.GetOptions().GetMapEntry() { - continue - } - p.atleastOne = true - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - p.P(`func (m *`, ccTypeName, `) `, sizeName, `() (n int) {`) - p.In() - p.P(`var l int`) - p.P(`_ = l`) - oneofs := make(map[string]struct{}) - for _, field := range message.Field { - oneof := field.OneofIndex != nil - if !oneof { - proto3 := gogoproto.IsProto3(file.FileDescriptorProto) - p.generateField(proto3, file, message, field, sizeName) - } else { - fieldname := p.GetFieldName(message, field) - if _, ok := oneofs[fieldname]; ok { - continue - } else { - oneofs[fieldname] = struct{}{} - } - p.P(`if m.`, fieldname, ` != nil {`) - p.In() - p.P(`n+=m.`, fieldname, `.`, sizeName, `()`) - p.Out() - p.P(`}`) - } - } - if message.DescriptorProto.HasExtension() { - if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) { - p.P(`n += `, protoPkg.Use(), `.SizeOfInternalExtension(m)`) - } else { - p.P(`if m.XXX_extensions != nil {`) - p.In() - p.P(`n+=len(m.XXX_extensions)`) - p.Out() - p.P(`}`) - } - } - if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) { - p.P(`if m.XXX_unrecognized != nil {`) - p.In() - p.P(`n+=len(m.XXX_unrecognized)`) - p.Out() - p.P(`}`) - } - p.P(`return n`) - p.Out() - p.P(`}`) - p.P() - - //Generate Size methods for oneof fields - m := proto.Clone(message.DescriptorProto).(*descriptor.DescriptorProto) - for _, f := range m.Field { - oneof := f.OneofIndex != nil - if !oneof { - continue - } - ccTypeName := p.OneOfTypeName(message, f) - p.P(`func (m *`, ccTypeName, `) `, sizeName, `() (n int) {`) - p.In() - p.P(`var l int`) - p.P(`_ = l`) - vanity.TurnOffNullableForNativeTypesWithoutDefaultsOnly(f) - p.generateField(false, file, message, f, sizeName) - p.P(`return n`) - p.Out() - p.P(`}`) - } - } - - if !p.atleastOne { - return - } - - p.sizeVarint() - p.sizeZigZag() - -} - -func init() { - generator.RegisterPlugin(NewSize()) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/size/sizetest.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/size/sizetest.go deleted file mode 100644 index 1df98730007..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/size/sizetest.go +++ /dev/null @@ -1,134 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package size - -import ( - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/plugin/testgen" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" -) - -type test struct { - *generator.Generator -} - -func NewTest(g *generator.Generator) testgen.TestPlugin { - return &test{g} -} - -func (p *test) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool { - used := false - randPkg := imports.NewImport("math/rand") - timePkg := imports.NewImport("time") - testingPkg := imports.NewImport("testing") - protoPkg := imports.NewImport("github.com/gogo/protobuf/proto") - if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { - protoPkg = imports.NewImport("github.com/golang/protobuf/proto") - } - for _, message := range file.Messages() { - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - sizeName := "" - if gogoproto.IsSizer(file.FileDescriptorProto, message.DescriptorProto) { - sizeName = "Size" - } else if gogoproto.IsProtoSizer(file.FileDescriptorProto, message.DescriptorProto) { - sizeName = "ProtoSize" - } else { - continue - } - if message.DescriptorProto.GetOptions().GetMapEntry() { - continue - } - - if gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { - used = true - p.P(`func Test`, ccTypeName, sizeName, `(t *`, testingPkg.Use(), `.T) {`) - p.In() - p.P(`seed := `, timePkg.Use(), `.Now().UnixNano()`) - p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(seed))`) - p.P(`p := NewPopulated`, ccTypeName, `(popr, true)`) - p.P(`size2 := `, protoPkg.Use(), `.Size(p)`) - p.P(`dAtA, err := `, protoPkg.Use(), `.Marshal(p)`) - p.P(`if err != nil {`) - p.In() - p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`) - p.Out() - p.P(`}`) - p.P(`size := p.`, sizeName, `()`) - p.P(`if len(dAtA) != size {`) - p.In() - p.P(`t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))`) - p.Out() - p.P(`}`) - p.P(`if size2 != size {`) - p.In() - p.P(`t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)`) - p.Out() - p.P(`}`) - p.P(`size3 := `, protoPkg.Use(), `.Size(p)`) - p.P(`if size3 != size {`) - p.In() - p.P(`t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)`) - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - p.P() - } - - if gogoproto.HasBenchGen(file.FileDescriptorProto, message.DescriptorProto) { - used = true - p.P(`func Benchmark`, ccTypeName, sizeName, `(b *`, testingPkg.Use(), `.B) {`) - p.In() - p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(616))`) - p.P(`total := 0`) - p.P(`pops := make([]*`, ccTypeName, `, 1000)`) - p.P(`for i := 0; i < 1000; i++ {`) - p.In() - p.P(`pops[i] = NewPopulated`, ccTypeName, `(popr, false)`) - p.Out() - p.P(`}`) - p.P(`b.ResetTimer()`) - p.P(`for i := 0; i < b.N; i++ {`) - p.In() - p.P(`total += pops[i%1000].`, sizeName, `()`) - p.Out() - p.P(`}`) - p.P(`b.SetBytes(int64(total / b.N))`) - p.Out() - p.P(`}`) - p.P() - } - - } - return used -} - -func init() { - testgen.RegisterTestPlugin(NewTest) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/stringer/stringer.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/stringer/stringer.go deleted file mode 100644 index aa5f022e4e5..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/stringer/stringer.go +++ /dev/null @@ -1,296 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -/* -The stringer plugin generates a String method for each message. - -It is enabled by the following extensions: - - - stringer - - stringer_all - -The stringer plugin also generates a test given it is enabled using one of the following extensions: - - - testgen - - testgen_all - -Let us look at: - - github.com/gogo/protobuf/test/example/example.proto - -Btw all the output can be seen at: - - github.com/gogo/protobuf/test/example/* - -The following message: - - option (gogoproto.goproto_stringer_all) = false; - option (gogoproto.stringer_all) = true; - - message A { - optional string Description = 1 [(gogoproto.nullable) = false]; - optional int64 Number = 2 [(gogoproto.nullable) = false]; - optional bytes Id = 3 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uuid", (gogoproto.nullable) = false]; - } - -given to the stringer stringer, will generate the following code: - - func (this *A) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&A{`, - `Description:` + fmt.Sprintf("%v", this.Description) + `,`, - `Number:` + fmt.Sprintf("%v", this.Number) + `,`, - `Id:` + fmt.Sprintf("%v", this.Id) + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s - } - -and the following test code: - - func TestAStringer(t *testing4.T) { - popr := math_rand4.New(math_rand4.NewSource(time4.Now().UnixNano())) - p := NewPopulatedA(popr, false) - s1 := p.String() - s2 := fmt1.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } - } - -Typically fmt.Printf("%v") will stop to print when it reaches a pointer and -not print their values, while the generated String method will always print all values, recursively. - -*/ -package stringer - -import ( - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" - "strings" -) - -type stringer struct { - *generator.Generator - generator.PluginImports - atleastOne bool - localName string -} - -func NewStringer() *stringer { - return &stringer{} -} - -func (p *stringer) Name() string { - return "stringer" -} - -func (p *stringer) Init(g *generator.Generator) { - p.Generator = g -} - -func (p *stringer) Generate(file *generator.FileDescriptor) { - proto3 := gogoproto.IsProto3(file.FileDescriptorProto) - p.PluginImports = generator.NewPluginImports(p.Generator) - p.atleastOne = false - - p.localName = generator.FileName(file) - - fmtPkg := p.NewImport("fmt") - stringsPkg := p.NewImport("strings") - reflectPkg := p.NewImport("reflect") - sortKeysPkg := p.NewImport("github.com/gogo/protobuf/sortkeys") - protoPkg := p.NewImport("github.com/gogo/protobuf/proto") - for _, message := range file.Messages() { - if !gogoproto.IsStringer(file.FileDescriptorProto, message.DescriptorProto) { - continue - } - if gogoproto.EnabledGoStringer(file.FileDescriptorProto, message.DescriptorProto) { - panic("old string method needs to be disabled, please use gogoproto.goproto_stringer or gogoproto.goproto_stringer_all and set it to false") - } - if message.DescriptorProto.GetOptions().GetMapEntry() { - continue - } - p.atleastOne = true - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - p.P(`func (this *`, ccTypeName, `) String() string {`) - p.In() - p.P(`if this == nil {`) - p.In() - p.P(`return "nil"`) - p.Out() - p.P(`}`) - for _, field := range message.Field { - if !p.IsMap(field) { - continue - } - fieldname := p.GetFieldName(message, field) - - m := p.GoMapType(nil, field) - mapgoTyp, keyField, keyAliasField := m.GoType, m.KeyField, m.KeyAliasField - keysName := `keysFor` + fieldname - keygoTyp, _ := p.GoType(nil, keyField) - keygoTyp = strings.Replace(keygoTyp, "*", "", 1) - keygoAliasTyp, _ := p.GoType(nil, keyAliasField) - keygoAliasTyp = strings.Replace(keygoAliasTyp, "*", "", 1) - keyCapTyp := generator.CamelCase(keygoTyp) - p.P(keysName, ` := make([]`, keygoTyp, `, 0, len(this.`, fieldname, `))`) - p.P(`for k, _ := range this.`, fieldname, ` {`) - p.In() - if keygoAliasTyp == keygoTyp { - p.P(keysName, ` = append(`, keysName, `, k)`) - } else { - p.P(keysName, ` = append(`, keysName, `, `, keygoTyp, `(k))`) - } - p.Out() - p.P(`}`) - p.P(sortKeysPkg.Use(), `.`, keyCapTyp, `s(`, keysName, `)`) - mapName := `mapStringFor` + fieldname - p.P(mapName, ` := "`, mapgoTyp, `{"`) - p.P(`for _, k := range `, keysName, ` {`) - p.In() - if keygoAliasTyp == keygoTyp { - p.P(mapName, ` += fmt.Sprintf("%v: %v,", k, this.`, fieldname, `[k])`) - } else { - p.P(mapName, ` += fmt.Sprintf("%v: %v,", k, this.`, fieldname, `[`, keygoAliasTyp, `(k)])`) - } - p.Out() - p.P(`}`) - p.P(mapName, ` += "}"`) - } - p.P("s := ", stringsPkg.Use(), ".Join([]string{`&", ccTypeName, "{`,") - oneofs := make(map[string]struct{}) - for _, field := range message.Field { - nullable := gogoproto.IsNullable(field) - repeated := field.IsRepeated() - fieldname := p.GetFieldName(message, field) - oneof := field.OneofIndex != nil - if oneof { - if _, ok := oneofs[fieldname]; ok { - continue - } else { - oneofs[fieldname] = struct{}{} - } - p.P("`", fieldname, ":`", ` + `, fmtPkg.Use(), `.Sprintf("%v", this.`, fieldname, ") + `,", "`,") - } else if p.IsMap(field) { - mapName := `mapStringFor` + fieldname - p.P("`", fieldname, ":`", ` + `, mapName, " + `,", "`,") - } else if field.IsMessage() || p.IsGroup(field) { - desc := p.ObjectNamed(field.GetTypeName()) - msgname := p.TypeName(desc) - msgnames := strings.Split(msgname, ".") - typeName := msgnames[len(msgnames)-1] - if nullable { - p.P("`", fieldname, ":`", ` + `, stringsPkg.Use(), `.Replace(`, fmtPkg.Use(), `.Sprintf("%v", this.`, fieldname, `), "`, typeName, `","`, msgname, `"`, ", 1) + `,", "`,") - } else if repeated { - p.P("`", fieldname, ":`", ` + `, stringsPkg.Use(), `.Replace(`, stringsPkg.Use(), `.Replace(`, fmtPkg.Use(), `.Sprintf("%v", this.`, fieldname, `), "`, typeName, `","`, msgname, `"`, ", 1),`&`,``,1) + `,", "`,") - } else { - p.P("`", fieldname, ":`", ` + `, stringsPkg.Use(), `.Replace(`, stringsPkg.Use(), `.Replace(this.`, fieldname, `.String(), "`, typeName, `","`, msgname, `"`, ", 1),`&`,``,1) + `,", "`,") - } - } else { - if nullable && !repeated && !proto3 { - p.P("`", fieldname, ":`", ` + valueToString`, p.localName, `(this.`, fieldname, ") + `,", "`,") - } else { - p.P("`", fieldname, ":`", ` + `, fmtPkg.Use(), `.Sprintf("%v", this.`, fieldname, ") + `,", "`,") - } - } - } - if message.DescriptorProto.HasExtension() { - if gogoproto.HasExtensionsMap(file.FileDescriptorProto, message.DescriptorProto) { - p.P("`XXX_InternalExtensions:` + ", protoPkg.Use(), ".StringFromInternalExtension(this) + `,`,") - } else { - p.P("`XXX_extensions:` + ", protoPkg.Use(), ".StringFromExtensionsBytes(this.XXX_extensions) + `,`,") - } - } - if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) { - p.P("`XXX_unrecognized:` + ", fmtPkg.Use(), `.Sprintf("%v", this.XXX_unrecognized) + `, "`,`,") - } - p.P("`}`,") - p.P(`}`, `,""`, ")") - p.P(`return s`) - p.Out() - p.P(`}`) - - //Generate String methods for oneof fields - for _, field := range message.Field { - oneof := field.OneofIndex != nil - if !oneof { - continue - } - ccTypeName := p.OneOfTypeName(message, field) - p.P(`func (this *`, ccTypeName, `) String() string {`) - p.In() - p.P(`if this == nil {`) - p.In() - p.P(`return "nil"`) - p.Out() - p.P(`}`) - p.P("s := ", stringsPkg.Use(), ".Join([]string{`&", ccTypeName, "{`,") - fieldname := p.GetOneOfFieldName(message, field) - if field.IsMessage() || p.IsGroup(field) { - desc := p.ObjectNamed(field.GetTypeName()) - msgname := p.TypeName(desc) - msgnames := strings.Split(msgname, ".") - typeName := msgnames[len(msgnames)-1] - p.P("`", fieldname, ":`", ` + `, stringsPkg.Use(), `.Replace(`, fmtPkg.Use(), `.Sprintf("%v", this.`, fieldname, `), "`, typeName, `","`, msgname, `"`, ", 1) + `,", "`,") - } else { - p.P("`", fieldname, ":`", ` + `, fmtPkg.Use(), `.Sprintf("%v", this.`, fieldname, ") + `,", "`,") - } - p.P("`}`,") - p.P(`}`, `,""`, ")") - p.P(`return s`) - p.Out() - p.P(`}`) - } - } - - if !p.atleastOne { - return - } - - p.P(`func valueToString`, p.localName, `(v interface{}) string {`) - p.In() - p.P(`rv := `, reflectPkg.Use(), `.ValueOf(v)`) - p.P(`if rv.IsNil() {`) - p.In() - p.P(`return "nil"`) - p.Out() - p.P(`}`) - p.P(`pv := `, reflectPkg.Use(), `.Indirect(rv).Interface()`) - p.P(`return `, fmtPkg.Use(), `.Sprintf("*%v", pv)`) - p.Out() - p.P(`}`) - -} - -func init() { - generator.RegisterPlugin(NewStringer()) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/stringer/stringertest.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/stringer/stringertest.go deleted file mode 100644 index 0912a22df63..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/stringer/stringertest.go +++ /dev/null @@ -1,83 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package stringer - -import ( - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/plugin/testgen" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" -) - -type test struct { - *generator.Generator -} - -func NewTest(g *generator.Generator) testgen.TestPlugin { - return &test{g} -} - -func (p *test) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool { - used := false - randPkg := imports.NewImport("math/rand") - timePkg := imports.NewImport("time") - testingPkg := imports.NewImport("testing") - fmtPkg := imports.NewImport("fmt") - for _, message := range file.Messages() { - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - if !gogoproto.IsStringer(file.FileDescriptorProto, message.DescriptorProto) { - continue - } - if message.DescriptorProto.GetOptions().GetMapEntry() { - continue - } - - if gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { - used = true - p.P(`func Test`, ccTypeName, `Stringer(t *`, testingPkg.Use(), `.T) {`) - p.In() - p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(`, timePkg.Use(), `.Now().UnixNano()))`) - p.P(`p := NewPopulated`, ccTypeName, `(popr, false)`) - p.P(`s1 := p.String()`) - p.P(`s2 := `, fmtPkg.Use(), `.Sprintf("%v", p)`) - p.P(`if s1 != s2 {`) - p.In() - p.P(`t.Fatalf("String want %v got %v", s1, s2)`) - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - } - - } - return used -} - -func init() { - testgen.RegisterTestPlugin(NewTest) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/testgen/testgen.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/testgen/testgen.go deleted file mode 100644 index e0a9287e560..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/testgen/testgen.go +++ /dev/null @@ -1,608 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -/* -The testgen plugin generates Test and Benchmark functions for each message. - -Tests are enabled using the following extensions: - - - testgen - - testgen_all - -Benchmarks are enabled using the following extensions: - - - benchgen - - benchgen_all - -Let us look at: - - github.com/gogo/protobuf/test/example/example.proto - -Btw all the output can be seen at: - - github.com/gogo/protobuf/test/example/* - -The following message: - - option (gogoproto.testgen_all) = true; - option (gogoproto.benchgen_all) = true; - - message A { - optional string Description = 1 [(gogoproto.nullable) = false]; - optional int64 Number = 2 [(gogoproto.nullable) = false]; - optional bytes Id = 3 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uuid", (gogoproto.nullable) = false]; - } - -given to the testgen plugin, will generate the following test code: - - func TestAProto(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedA(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - panic(err) - } - msg := &A{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - panic(err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if err := p.VerboseEqual(msg); err != nil { - t.Fatalf("%#v !VerboseProto %#v, since %v", msg, p, err) - } - if !p.Equal(msg) { - t.Fatalf("%#v !Proto %#v", msg, p) - } - } - - func BenchmarkAProtoMarshal(b *testing.B) { - popr := math_rand.New(math_rand.NewSource(616)) - total := 0 - pops := make([]*A, 10000) - for i := 0; i < 10000; i++ { - pops[i] = NewPopulatedA(popr, false) - } - b.ResetTimer() - for i := 0; i < b.N; i++ { - dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000]) - if err != nil { - panic(err) - } - total += len(dAtA) - } - b.SetBytes(int64(total / b.N)) - } - - func BenchmarkAProtoUnmarshal(b *testing.B) { - popr := math_rand.New(math_rand.NewSource(616)) - total := 0 - datas := make([][]byte, 10000) - for i := 0; i < 10000; i++ { - dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedA(popr, false)) - if err != nil { - panic(err) - } - datas[i] = dAtA - } - msg := &A{} - b.ResetTimer() - for i := 0; i < b.N; i++ { - total += len(datas[i%10000]) - if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil { - panic(err) - } - } - b.SetBytes(int64(total / b.N)) - } - - - func TestAJSON(t *testing1.T) { - popr := math_rand1.New(math_rand1.NewSource(time1.Now().UnixNano())) - p := NewPopulatedA(popr, true) - jsondata, err := encoding_json.Marshal(p) - if err != nil { - panic(err) - } - msg := &A{} - err = encoding_json.Unmarshal(jsondata, msg) - if err != nil { - panic(err) - } - if err := p.VerboseEqual(msg); err != nil { - t.Fatalf("%#v !VerboseProto %#v, since %v", msg, p, err) - } - if !p.Equal(msg) { - t.Fatalf("%#v !Json Equal %#v", msg, p) - } - } - - func TestAProtoText(t *testing2.T) { - popr := math_rand2.New(math_rand2.NewSource(time2.Now().UnixNano())) - p := NewPopulatedA(popr, true) - dAtA := github_com_gogo_protobuf_proto1.MarshalTextString(p) - msg := &A{} - if err := github_com_gogo_protobuf_proto1.UnmarshalText(dAtA, msg); err != nil { - panic(err) - } - if err := p.VerboseEqual(msg); err != nil { - t.Fatalf("%#v !VerboseProto %#v, since %v", msg, p, err) - } - if !p.Equal(msg) { - t.Fatalf("%#v !Proto %#v", msg, p) - } - } - - func TestAProtoCompactText(t *testing2.T) { - popr := math_rand2.New(math_rand2.NewSource(time2.Now().UnixNano())) - p := NewPopulatedA(popr, true) - dAtA := github_com_gogo_protobuf_proto1.CompactTextString(p) - msg := &A{} - if err := github_com_gogo_protobuf_proto1.UnmarshalText(dAtA, msg); err != nil { - panic(err) - } - if err := p.VerboseEqual(msg); err != nil { - t.Fatalf("%#v !VerboseProto %#v, since %v", msg, p, err) - } - if !p.Equal(msg) { - t.Fatalf("%#v !Proto %#v", msg, p) - } - } - -Other registered tests are also generated. -Tests are registered to this test plugin by calling the following function. - - func RegisterTestPlugin(newFunc NewTestPlugin) - -where NewTestPlugin is: - - type NewTestPlugin func(g *generator.Generator) TestPlugin - -and TestPlugin is an interface: - - type TestPlugin interface { - Generate(imports generator.PluginImports, file *generator.FileDescriptor) (used bool) - } - -Plugins that use this interface include: - - - populate - - gostring - - equal - - union - - and more - -Please look at these plugins as examples of how to create your own. -A good idea is to let each plugin generate its own tests. - -*/ -package testgen - -import ( - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" -) - -type TestPlugin interface { - Generate(imports generator.PluginImports, file *generator.FileDescriptor) (used bool) -} - -type NewTestPlugin func(g *generator.Generator) TestPlugin - -var testplugins = make([]NewTestPlugin, 0) - -func RegisterTestPlugin(newFunc NewTestPlugin) { - testplugins = append(testplugins, newFunc) -} - -type plugin struct { - *generator.Generator - generator.PluginImports - tests []TestPlugin -} - -func NewPlugin() *plugin { - return &plugin{} -} - -func (p *plugin) Name() string { - return "testgen" -} - -func (p *plugin) Init(g *generator.Generator) { - p.Generator = g - p.tests = make([]TestPlugin, 0, len(testplugins)) - for i := range testplugins { - p.tests = append(p.tests, testplugins[i](g)) - } -} - -func (p *plugin) Generate(file *generator.FileDescriptor) { - p.PluginImports = generator.NewPluginImports(p.Generator) - atLeastOne := false - for i := range p.tests { - used := p.tests[i].Generate(p.PluginImports, file) - if used { - atLeastOne = true - } - } - if atLeastOne { - p.P(`//These tests are generated by github.com/gogo/protobuf/plugin/testgen`) - } -} - -type testProto struct { - *generator.Generator -} - -func newProto(g *generator.Generator) TestPlugin { - return &testProto{g} -} - -func (p *testProto) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool { - used := false - testingPkg := imports.NewImport("testing") - randPkg := imports.NewImport("math/rand") - timePkg := imports.NewImport("time") - protoPkg := imports.NewImport("github.com/gogo/protobuf/proto") - if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { - protoPkg = imports.NewImport("github.com/golang/protobuf/proto") - } - for _, message := range file.Messages() { - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - if message.DescriptorProto.GetOptions().GetMapEntry() { - continue - } - if gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { - used = true - - p.P(`func Test`, ccTypeName, `Proto(t *`, testingPkg.Use(), `.T) {`) - p.In() - p.P(`seed := `, timePkg.Use(), `.Now().UnixNano()`) - p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(seed))`) - p.P(`p := NewPopulated`, ccTypeName, `(popr, false)`) - p.P(`dAtA, err := `, protoPkg.Use(), `.Marshal(p)`) - p.P(`if err != nil {`) - p.In() - p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`) - p.Out() - p.P(`}`) - p.P(`msg := &`, ccTypeName, `{}`) - p.P(`if err := `, protoPkg.Use(), `.Unmarshal(dAtA, msg); err != nil {`) - p.In() - p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`) - p.Out() - p.P(`}`) - p.P(`littlefuzz := make([]byte, len(dAtA))`) - p.P(`copy(littlefuzz, dAtA)`) - p.P(`for i := range dAtA {`) - p.In() - p.P(`dAtA[i] = byte(popr.Intn(256))`) - p.Out() - p.P(`}`) - if gogoproto.HasVerboseEqual(file.FileDescriptorProto, message.DescriptorProto) { - p.P(`if err := p.VerboseEqual(msg); err != nil {`) - p.In() - p.P(`t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)`) - p.Out() - p.P(`}`) - } - p.P(`if !p.Equal(msg) {`) - p.In() - p.P(`t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)`) - p.Out() - p.P(`}`) - p.P(`if len(littlefuzz) > 0 {`) - p.In() - p.P(`fuzzamount := 100`) - p.P(`for i := 0; i < fuzzamount; i++ {`) - p.In() - p.P(`littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))`) - p.P(`littlefuzz = append(littlefuzz, byte(popr.Intn(256)))`) - p.Out() - p.P(`}`) - p.P(`// shouldn't panic`) - p.P(`_ = `, protoPkg.Use(), `.Unmarshal(littlefuzz, msg)`) - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - p.P() - } - - if gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { - if gogoproto.IsMarshaler(file.FileDescriptorProto, message.DescriptorProto) || gogoproto.IsUnsafeMarshaler(file.FileDescriptorProto, message.DescriptorProto) { - p.P(`func Test`, ccTypeName, `MarshalTo(t *`, testingPkg.Use(), `.T) {`) - p.In() - p.P(`seed := `, timePkg.Use(), `.Now().UnixNano()`) - p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(seed))`) - p.P(`p := NewPopulated`, ccTypeName, `(popr, false)`) - if gogoproto.IsProtoSizer(file.FileDescriptorProto, message.DescriptorProto) { - p.P(`size := p.ProtoSize()`) - } else { - p.P(`size := p.Size()`) - } - p.P(`dAtA := make([]byte, size)`) - p.P(`for i := range dAtA {`) - p.In() - p.P(`dAtA[i] = byte(popr.Intn(256))`) - p.Out() - p.P(`}`) - p.P(`_, err := p.MarshalTo(dAtA)`) - p.P(`if err != nil {`) - p.In() - p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`) - p.Out() - p.P(`}`) - p.P(`msg := &`, ccTypeName, `{}`) - p.P(`if err := `, protoPkg.Use(), `.Unmarshal(dAtA, msg); err != nil {`) - p.In() - p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`) - p.Out() - p.P(`}`) - p.P(`for i := range dAtA {`) - p.In() - p.P(`dAtA[i] = byte(popr.Intn(256))`) - p.Out() - p.P(`}`) - if gogoproto.HasVerboseEqual(file.FileDescriptorProto, message.DescriptorProto) { - p.P(`if err := p.VerboseEqual(msg); err != nil {`) - p.In() - p.P(`t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)`) - p.Out() - p.P(`}`) - } - p.P(`if !p.Equal(msg) {`) - p.In() - p.P(`t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)`) - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - p.P() - } - } - - if gogoproto.HasBenchGen(file.FileDescriptorProto, message.DescriptorProto) { - used = true - p.P(`func Benchmark`, ccTypeName, `ProtoMarshal(b *`, testingPkg.Use(), `.B) {`) - p.In() - p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(616))`) - p.P(`total := 0`) - p.P(`pops := make([]*`, ccTypeName, `, 10000)`) - p.P(`for i := 0; i < 10000; i++ {`) - p.In() - p.P(`pops[i] = NewPopulated`, ccTypeName, `(popr, false)`) - p.Out() - p.P(`}`) - p.P(`b.ResetTimer()`) - p.P(`for i := 0; i < b.N; i++ {`) - p.In() - p.P(`dAtA, err := `, protoPkg.Use(), `.Marshal(pops[i%10000])`) - p.P(`if err != nil {`) - p.In() - p.P(`panic(err)`) - p.Out() - p.P(`}`) - p.P(`total += len(dAtA)`) - p.Out() - p.P(`}`) - p.P(`b.SetBytes(int64(total / b.N))`) - p.Out() - p.P(`}`) - p.P() - - p.P(`func Benchmark`, ccTypeName, `ProtoUnmarshal(b *`, testingPkg.Use(), `.B) {`) - p.In() - p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(616))`) - p.P(`total := 0`) - p.P(`datas := make([][]byte, 10000)`) - p.P(`for i := 0; i < 10000; i++ {`) - p.In() - p.P(`dAtA, err := `, protoPkg.Use(), `.Marshal(NewPopulated`, ccTypeName, `(popr, false))`) - p.P(`if err != nil {`) - p.In() - p.P(`panic(err)`) - p.Out() - p.P(`}`) - p.P(`datas[i] = dAtA`) - p.Out() - p.P(`}`) - p.P(`msg := &`, ccTypeName, `{}`) - p.P(`b.ResetTimer()`) - p.P(`for i := 0; i < b.N; i++ {`) - p.In() - p.P(`total += len(datas[i%10000])`) - p.P(`if err := `, protoPkg.Use(), `.Unmarshal(datas[i%10000], msg); err != nil {`) - p.In() - p.P(`panic(err)`) - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - p.P(`b.SetBytes(int64(total / b.N))`) - p.Out() - p.P(`}`) - p.P() - } - } - return used -} - -type testJson struct { - *generator.Generator -} - -func newJson(g *generator.Generator) TestPlugin { - return &testJson{g} -} - -func (p *testJson) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool { - used := false - testingPkg := imports.NewImport("testing") - randPkg := imports.NewImport("math/rand") - timePkg := imports.NewImport("time") - jsonPkg := imports.NewImport("github.com/gogo/protobuf/jsonpb") - for _, message := range file.Messages() { - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - if message.DescriptorProto.GetOptions().GetMapEntry() { - continue - } - if gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { - used = true - p.P(`func Test`, ccTypeName, `JSON(t *`, testingPkg.Use(), `.T) {`) - p.In() - p.P(`seed := `, timePkg.Use(), `.Now().UnixNano()`) - p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(seed))`) - p.P(`p := NewPopulated`, ccTypeName, `(popr, true)`) - p.P(`marshaler := `, jsonPkg.Use(), `.Marshaler{}`) - p.P(`jsondata, err := marshaler.MarshalToString(p)`) - p.P(`if err != nil {`) - p.In() - p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`) - p.Out() - p.P(`}`) - p.P(`msg := &`, ccTypeName, `{}`) - p.P(`err = `, jsonPkg.Use(), `.UnmarshalString(jsondata, msg)`) - p.P(`if err != nil {`) - p.In() - p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`) - p.Out() - p.P(`}`) - if gogoproto.HasVerboseEqual(file.FileDescriptorProto, message.DescriptorProto) { - p.P(`if err := p.VerboseEqual(msg); err != nil {`) - p.In() - p.P(`t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)`) - p.Out() - p.P(`}`) - } - p.P(`if !p.Equal(msg) {`) - p.In() - p.P(`t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)`) - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - } - } - return used -} - -type testText struct { - *generator.Generator -} - -func newText(g *generator.Generator) TestPlugin { - return &testText{g} -} - -func (p *testText) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool { - used := false - testingPkg := imports.NewImport("testing") - randPkg := imports.NewImport("math/rand") - timePkg := imports.NewImport("time") - protoPkg := imports.NewImport("github.com/gogo/protobuf/proto") - if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { - protoPkg = imports.NewImport("github.com/golang/protobuf/proto") - } - //fmtPkg := imports.NewImport("fmt") - for _, message := range file.Messages() { - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - if message.DescriptorProto.GetOptions().GetMapEntry() { - continue - } - if gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { - used = true - - p.P(`func Test`, ccTypeName, `ProtoText(t *`, testingPkg.Use(), `.T) {`) - p.In() - p.P(`seed := `, timePkg.Use(), `.Now().UnixNano()`) - p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(seed))`) - p.P(`p := NewPopulated`, ccTypeName, `(popr, true)`) - p.P(`dAtA := `, protoPkg.Use(), `.MarshalTextString(p)`) - p.P(`msg := &`, ccTypeName, `{}`) - p.P(`if err := `, protoPkg.Use(), `.UnmarshalText(dAtA, msg); err != nil {`) - p.In() - p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`) - p.Out() - p.P(`}`) - if gogoproto.HasVerboseEqual(file.FileDescriptorProto, message.DescriptorProto) { - p.P(`if err := p.VerboseEqual(msg); err != nil {`) - p.In() - p.P(`t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)`) - p.Out() - p.P(`}`) - } - p.P(`if !p.Equal(msg) {`) - p.In() - p.P(`t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)`) - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - p.P() - - p.P(`func Test`, ccTypeName, `ProtoCompactText(t *`, testingPkg.Use(), `.T) {`) - p.In() - p.P(`seed := `, timePkg.Use(), `.Now().UnixNano()`) - p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(seed))`) - p.P(`p := NewPopulated`, ccTypeName, `(popr, true)`) - p.P(`dAtA := `, protoPkg.Use(), `.CompactTextString(p)`) - p.P(`msg := &`, ccTypeName, `{}`) - p.P(`if err := `, protoPkg.Use(), `.UnmarshalText(dAtA, msg); err != nil {`) - p.In() - p.P(`t.Fatalf("seed = %d, err = %v", seed, err)`) - p.Out() - p.P(`}`) - if gogoproto.HasVerboseEqual(file.FileDescriptorProto, message.DescriptorProto) { - p.P(`if err := p.VerboseEqual(msg); err != nil {`) - p.In() - p.P(`t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)`) - p.Out() - p.P(`}`) - } - p.P(`if !p.Equal(msg) {`) - p.In() - p.P(`t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)`) - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - p.P() - - } - } - return used -} - -func init() { - RegisterTestPlugin(newProto) - RegisterTestPlugin(newJson) - RegisterTestPlugin(newText) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/union/union.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/union/union.go deleted file mode 100644 index 72edb2498cd..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/union/union.go +++ /dev/null @@ -1,209 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -/* -The onlyone plugin generates code for the onlyone extension. -All fields must be nullable and only one of the fields may be set, like a union. -Two methods are generated - - GetValue() interface{} - -and - - SetValue(v interface{}) (set bool) - -These provide easier interaction with a onlyone. - -The onlyone extension is not called union as this causes compile errors in the C++ generated code. -There can only be one ;) - -It is enabled by the following extensions: - - - onlyone - - onlyone_all - -The onlyone plugin also generates a test given it is enabled using one of the following extensions: - - - testgen - - testgen_all - -Lets look at: - - github.com/gogo/protobuf/test/example/example.proto - -Btw all the output can be seen at: - - github.com/gogo/protobuf/test/example/* - -The following message: - - message U { - option (gogoproto.onlyone) = true; - optional A A = 1; - optional B B = 2; - } - -given to the onlyone plugin, will generate code which looks a lot like this: - - func (this *U) GetValue() interface{} { - if this.A != nil { - return this.A - } - if this.B != nil { - return this.B - } - return nil - } - - func (this *U) SetValue(value interface{}) bool { - switch vt := value.(type) { - case *A: - this.A = vt - case *B: - this.B = vt - default: - return false - } - return true - } - -and the following test code: - - func TestUUnion(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedU(popr) - v := p.GetValue() - msg := &U{} - if !msg.SetValue(v) { - t.Fatalf("Union: Could not set Value") - } - if !p.Equal(msg) { - t.Fatalf("%#v !Union Equal %#v", msg, p) - } - } - -*/ -package union - -import ( - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" -) - -type union struct { - *generator.Generator - generator.PluginImports -} - -func NewUnion() *union { - return &union{} -} - -func (p *union) Name() string { - return "union" -} - -func (p *union) Init(g *generator.Generator) { - p.Generator = g -} - -func (p *union) Generate(file *generator.FileDescriptor) { - p.PluginImports = generator.NewPluginImports(p.Generator) - - for _, message := range file.Messages() { - if !gogoproto.IsUnion(file.FileDescriptorProto, message.DescriptorProto) { - continue - } - if message.DescriptorProto.HasExtension() { - panic("onlyone does not currently support extensions") - } - if message.DescriptorProto.GetOptions().GetMapEntry() { - continue - } - - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - p.P(`func (this *`, ccTypeName, `) GetValue() interface{} {`) - p.In() - for _, field := range message.Field { - fieldname := p.GetFieldName(message, field) - if fieldname == "Value" { - panic("cannot have a onlyone message " + ccTypeName + " with a field named Value") - } - p.P(`if this.`, fieldname, ` != nil {`) - p.In() - p.P(`return this.`, fieldname) - p.Out() - p.P(`}`) - } - p.P(`return nil`) - p.Out() - p.P(`}`) - p.P(``) - p.P(`func (this *`, ccTypeName, `) SetValue(value interface{}) bool {`) - p.In() - p.P(`switch vt := value.(type) {`) - p.In() - for _, field := range message.Field { - fieldname := p.GetFieldName(message, field) - goTyp, _ := p.GoType(message, field) - p.P(`case `, goTyp, `:`) - p.In() - p.P(`this.`, fieldname, ` = vt`) - p.Out() - } - p.P(`default:`) - p.In() - for _, field := range message.Field { - fieldname := p.GetFieldName(message, field) - if field.IsMessage() { - goTyp, _ := p.GoType(message, field) - obj := p.ObjectNamed(field.GetTypeName()).(*generator.Descriptor) - - if gogoproto.IsUnion(obj.File(), obj.DescriptorProto) { - p.P(`this.`, fieldname, ` = new(`, generator.GoTypeToName(goTyp), `)`) - p.P(`if set := this.`, fieldname, `.SetValue(value); set {`) - p.In() - p.P(`return true`) - p.Out() - p.P(`}`) - p.P(`this.`, fieldname, ` = nil`) - } - } - } - p.P(`return false`) - p.Out() - p.P(`}`) - p.P(`return true`) - p.Out() - p.P(`}`) - } -} - -func init() { - generator.RegisterPlugin(NewUnion()) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/union/uniontest.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/union/uniontest.go deleted file mode 100644 index 949cf833850..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/union/uniontest.go +++ /dev/null @@ -1,86 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package union - -import ( - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/plugin/testgen" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" -) - -type test struct { - *generator.Generator -} - -func NewTest(g *generator.Generator) testgen.TestPlugin { - return &test{g} -} - -func (p *test) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool { - used := false - randPkg := imports.NewImport("math/rand") - timePkg := imports.NewImport("time") - testingPkg := imports.NewImport("testing") - for _, message := range file.Messages() { - if !gogoproto.IsUnion(file.FileDescriptorProto, message.DescriptorProto) || - !gogoproto.HasTestGen(file.FileDescriptorProto, message.DescriptorProto) { - continue - } - if message.DescriptorProto.GetOptions().GetMapEntry() { - continue - } - used = true - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - - p.P(`func Test`, ccTypeName, `OnlyOne(t *`, testingPkg.Use(), `.T) {`) - p.In() - p.P(`popr := `, randPkg.Use(), `.New(`, randPkg.Use(), `.NewSource(`, timePkg.Use(), `.Now().UnixNano()))`) - p.P(`p := NewPopulated`, ccTypeName, `(popr, true)`) - p.P(`v := p.GetValue()`) - p.P(`msg := &`, ccTypeName, `{}`) - p.P(`if !msg.SetValue(v) {`) - p.In() - p.P(`t.Fatalf("OnlyOne: Could not set Value")`) - p.Out() - p.P(`}`) - p.P(`if !p.Equal(msg) {`) - p.In() - p.P(`t.Fatalf("%#v !OnlyOne Equal %#v", msg, p)`) - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - - } - return used -} - -func init() { - testgen.RegisterTestPlugin(NewTest) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/unmarshal/unmarshal.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/unmarshal/unmarshal.go deleted file mode 100644 index c8a704991b4..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/plugin/unmarshal/unmarshal.go +++ /dev/null @@ -1,1439 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -/* -The unmarshal plugin generates a Unmarshal method for each message. -The `Unmarshal([]byte) error` method results in the fact that the message -implements the Unmarshaler interface. -The allows proto.Unmarshal to be faster by calling the generated Unmarshal method rather than using reflect. - -If is enabled by the following extensions: - - - unmarshaler - - unmarshaler_all - -Or the following extensions: - - - unsafe_unmarshaler - - unsafe_unmarshaler_all - -That is if you want to use the unsafe package in your generated code. -The speed up using the unsafe package is not very significant. - -The generation of unmarshalling tests are enabled using one of the following extensions: - - - testgen - - testgen_all - -And benchmarks given it is enabled using one of the following extensions: - - - benchgen - - benchgen_all - -Let us look at: - - github.com/gogo/protobuf/test/example/example.proto - -Btw all the output can be seen at: - - github.com/gogo/protobuf/test/example/* - -The following message: - - option (gogoproto.unmarshaler_all) = true; - - message B { - option (gogoproto.description) = true; - optional A A = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; - repeated bytes G = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false]; - } - -given to the unmarshal plugin, will generate the following code: - - func (m *B) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - switch fieldNum { - case 1: - if wireType != 2 { - return proto.ErrWrongType - } - var msglen int - for shift := uint(0); ; shift += 7 { - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.A.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return proto.ErrWrongType - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.G = append(m.G, github_com_gogo_protobuf_test_custom.Uint128{}) - if err := m.G[len(m.G)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - var sizeOfWire int - for { - sizeOfWire++ - wire >>= 7 - if wire == 0 { - break - } - } - iNdEx -= sizeOfWire - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - return nil - } - -Remember when using this code to call proto.Unmarshal. -This will call m.Reset and invoke the generated Unmarshal method for you. -If you call m.Unmarshal without m.Reset you could be merging protocol buffers. - -*/ -package unmarshal - -import ( - "fmt" - "strconv" - "strings" - - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/proto" - descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" -) - -type unmarshal struct { - *generator.Generator - unsafe bool - generator.PluginImports - atleastOne bool - ioPkg generator.Single - mathPkg generator.Single - unsafePkg generator.Single - typesPkg generator.Single - localName string -} - -func NewUnmarshal() *unmarshal { - return &unmarshal{} -} - -func NewUnsafeUnmarshal() *unmarshal { - return &unmarshal{unsafe: true} -} - -func (p *unmarshal) Name() string { - if p.unsafe { - return "unsafeunmarshaler" - } - return "unmarshal" -} - -func (p *unmarshal) Init(g *generator.Generator) { - p.Generator = g -} - -func (p *unmarshal) decodeVarint(varName string, typName string) { - p.P(`for shift := uint(0); ; shift += 7 {`) - p.In() - p.P(`if shift >= 64 {`) - p.In() - p.P(`return ErrIntOverflow` + p.localName) - p.Out() - p.P(`}`) - p.P(`if iNdEx >= l {`) - p.In() - p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) - p.Out() - p.P(`}`) - p.P(`b := dAtA[iNdEx]`) - p.P(`iNdEx++`) - p.P(varName, ` |= (`, typName, `(b) & 0x7F) << shift`) - p.P(`if b < 0x80 {`) - p.In() - p.P(`break`) - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) -} - -func (p *unmarshal) decodeFixed32(varName string, typeName string) { - p.P(`if (iNdEx+4) > l {`) - p.In() - p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) - p.Out() - p.P(`}`) - p.P(`iNdEx += 4`) - p.P(varName, ` = `, typeName, `(dAtA[iNdEx-4])`) - p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-3]) << 8`) - p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-2]) << 16`) - p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-1]) << 24`) -} - -func (p *unmarshal) unsafeFixed32(varName string, typeName string) { - p.P(`if iNdEx + 4 > l {`) - p.In() - p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) - p.Out() - p.P(`}`) - p.P(varName, ` = *(*`, typeName, `)(`, p.unsafePkg.Use(), `.Pointer(&dAtA[iNdEx]))`) - p.P(`iNdEx += 4`) -} - -func (p *unmarshal) decodeFixed64(varName string, typeName string) { - p.P(`if (iNdEx+8) > l {`) - p.In() - p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) - p.Out() - p.P(`}`) - p.P(`iNdEx += 8`) - p.P(varName, ` = `, typeName, `(dAtA[iNdEx-8])`) - p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-7]) << 8`) - p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-6]) << 16`) - p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-5]) << 24`) - p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-4]) << 32`) - p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-3]) << 40`) - p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-2]) << 48`) - p.P(varName, ` |= `, typeName, `(dAtA[iNdEx-1]) << 56`) -} - -func (p *unmarshal) unsafeFixed64(varName string, typeName string) { - p.P(`if iNdEx + 8 > l {`) - p.In() - p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) - p.Out() - p.P(`}`) - p.P(varName, ` = *(*`, typeName, `)(`, p.unsafePkg.Use(), `.Pointer(&dAtA[iNdEx]))`) - p.P(`iNdEx += 8`) -} - -func (p *unmarshal) mapField(varName string, customType bool, field *descriptor.FieldDescriptorProto) { - switch field.GetType() { - case descriptor.FieldDescriptorProto_TYPE_DOUBLE: - p.P(`var `, varName, `temp uint64`) - p.decodeFixed64(varName+"temp", "uint64") - p.P(varName, ` := `, p.mathPkg.Use(), `.Float64frombits(`, varName, `temp)`) - case descriptor.FieldDescriptorProto_TYPE_FLOAT: - p.P(`var `, varName, `temp uint32`) - p.decodeFixed32(varName+"temp", "uint32") - p.P(varName, ` := `, p.mathPkg.Use(), `.Float32frombits(`, varName, `temp)`) - case descriptor.FieldDescriptorProto_TYPE_INT64: - p.P(`var `, varName, ` int64`) - p.decodeVarint(varName, "int64") - case descriptor.FieldDescriptorProto_TYPE_UINT64: - p.P(`var `, varName, ` uint64`) - p.decodeVarint(varName, "uint64") - case descriptor.FieldDescriptorProto_TYPE_INT32: - p.P(`var `, varName, ` int32`) - p.decodeVarint(varName, "int32") - case descriptor.FieldDescriptorProto_TYPE_FIXED64: - p.P(`var `, varName, ` uint64`) - p.decodeFixed64(varName, "uint64") - case descriptor.FieldDescriptorProto_TYPE_FIXED32: - p.P(`var `, varName, ` uint32`) - p.decodeFixed32(varName, "uint32") - case descriptor.FieldDescriptorProto_TYPE_BOOL: - p.P(`var `, varName, `temp int`) - p.decodeVarint(varName+"temp", "int") - p.P(varName, ` := bool(`, varName, `temp != 0)`) - case descriptor.FieldDescriptorProto_TYPE_STRING: - p.P(`var stringLen`, varName, ` uint64`) - p.decodeVarint("stringLen"+varName, "uint64") - p.P(`intStringLen`, varName, ` := int(stringLen`, varName, `)`) - p.P(`if intStringLen`, varName, ` < 0 {`) - p.In() - p.P(`return ErrInvalidLength` + p.localName) - p.Out() - p.P(`}`) - p.P(`postStringIndex`, varName, ` := iNdEx + intStringLen`, varName) - p.P(`if postStringIndex`, varName, ` > l {`) - p.In() - p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) - p.Out() - p.P(`}`) - cast, _ := p.GoType(nil, field) - cast = strings.Replace(cast, "*", "", 1) - p.P(varName, ` := `, cast, `(dAtA[iNdEx:postStringIndex`, varName, `])`) - p.P(`iNdEx = postStringIndex`, varName) - case descriptor.FieldDescriptorProto_TYPE_MESSAGE: - p.P(`var mapmsglen int`) - p.decodeVarint("mapmsglen", "int") - p.P(`if mapmsglen < 0 {`) - p.In() - p.P(`return ErrInvalidLength` + p.localName) - p.Out() - p.P(`}`) - p.P(`postmsgIndex := iNdEx + mapmsglen`) - p.P(`if mapmsglen < 0 {`) - p.In() - p.P(`return ErrInvalidLength` + p.localName) - p.Out() - p.P(`}`) - p.P(`if postmsgIndex > l {`) - p.In() - p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) - p.Out() - p.P(`}`) - desc := p.ObjectNamed(field.GetTypeName()) - msgname := p.TypeName(desc) - buf := `dAtA[iNdEx:postmsgIndex]` - if gogoproto.IsStdTime(field) { - p.P(varName, ` := new(time.Time)`) - p.P(`if err := `, p.typesPkg.Use(), `.StdTimeUnmarshal(`, varName, `, `, buf, `); err != nil {`) - } else if gogoproto.IsStdDuration(field) { - p.P(varName, ` := new(time.Duration)`) - p.P(`if err := `, p.typesPkg.Use(), `.StdDurationUnmarshal(`, varName, `, `, buf, `); err != nil {`) - } else { - p.P(varName, ` := &`, msgname, `{}`) - p.P(`if err := `, varName, `.Unmarshal(`, buf, `); err != nil {`) - } - p.In() - p.P(`return err`) - p.Out() - p.P(`}`) - p.P(`iNdEx = postmsgIndex`) - case descriptor.FieldDescriptorProto_TYPE_BYTES: - p.P(`var mapbyteLen uint64`) - p.decodeVarint("mapbyteLen", "uint64") - p.P(`intMapbyteLen := int(mapbyteLen)`) - p.P(`if intMapbyteLen < 0 {`) - p.In() - p.P(`return ErrInvalidLength` + p.localName) - p.Out() - p.P(`}`) - p.P(`postbytesIndex := iNdEx + intMapbyteLen`) - p.P(`if postbytesIndex > l {`) - p.In() - p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) - p.Out() - p.P(`}`) - if customType { - _, ctyp, err := generator.GetCustomType(field) - if err != nil { - panic(err) - } - p.P(`var `, varName, `1 `, ctyp) - p.P(`var `, varName, ` = &`, varName, `1`) - p.P(`if err := `, varName, `.Unmarshal(dAtA[iNdEx:postbytesIndex]); err != nil {`) - p.In() - p.P(`return err`) - p.Out() - p.P(`}`) - } else { - p.P(varName, ` := make([]byte, mapbyteLen)`) - p.P(`copy(`, varName, `, dAtA[iNdEx:postbytesIndex])`) - } - p.P(`iNdEx = postbytesIndex`) - case descriptor.FieldDescriptorProto_TYPE_UINT32: - p.P(`var `, varName, ` uint32`) - p.decodeVarint(varName, "uint32") - case descriptor.FieldDescriptorProto_TYPE_ENUM: - typName := p.TypeName(p.ObjectNamed(field.GetTypeName())) - p.P(`var `, varName, ` `, typName) - p.decodeVarint(varName, typName) - case descriptor.FieldDescriptorProto_TYPE_SFIXED32: - p.P(`var `, varName, ` int32`) - p.decodeFixed32(varName, "int32") - case descriptor.FieldDescriptorProto_TYPE_SFIXED64: - p.P(`var `, varName, ` int64`) - p.decodeFixed64(varName, "int64") - case descriptor.FieldDescriptorProto_TYPE_SINT32: - p.P(`var `, varName, `temp int32`) - p.decodeVarint(varName+"temp", "int32") - p.P(varName, `temp = int32((uint32(`, varName, `temp) >> 1) ^ uint32(((`, varName, `temp&1)<<31)>>31))`) - p.P(varName, ` := int32(`, varName, `temp)`) - case descriptor.FieldDescriptorProto_TYPE_SINT64: - p.P(`var `, varName, `temp uint64`) - p.decodeVarint(varName+"temp", "uint64") - p.P(varName, `temp = (`, varName, `temp >> 1) ^ uint64((int64(`, varName, `temp&1)<<63)>>63)`) - p.P(varName, ` := int64(`, varName, `temp)`) - } -} - -func (p *unmarshal) noStarOrSliceType(msg *generator.Descriptor, field *descriptor.FieldDescriptorProto) string { - typ, _ := p.GoType(msg, field) - if typ[0] == '*' { - return typ[1:] - } - if typ[0] == '[' && typ[1] == ']' { - return typ[2:] - } - return typ -} - -func (p *unmarshal) field(file *generator.FileDescriptor, msg *generator.Descriptor, field *descriptor.FieldDescriptorProto, fieldname string, proto3 bool) { - repeated := field.IsRepeated() - nullable := gogoproto.IsNullable(field) - typ := p.noStarOrSliceType(msg, field) - oneof := field.OneofIndex != nil - switch *field.Type { - case descriptor.FieldDescriptorProto_TYPE_DOUBLE: - if !p.unsafe || gogoproto.IsCastType(field) { - p.P(`var v uint64`) - p.decodeFixed64("v", "uint64") - if oneof { - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{`, typ, "(", p.mathPkg.Use(), `.Float64frombits(v))}`) - } else if repeated { - p.P(`v2 := `, typ, "(", p.mathPkg.Use(), `.Float64frombits(v))`) - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v2)`) - } else if proto3 || !nullable { - p.P(`m.`, fieldname, ` = `, typ, "(", p.mathPkg.Use(), `.Float64frombits(v))`) - } else { - p.P(`v2 := `, typ, "(", p.mathPkg.Use(), `.Float64frombits(v))`) - p.P(`m.`, fieldname, ` = &v2`) - } - } else { - if oneof { - p.P(`var v float64`) - p.unsafeFixed64("v", "float64") - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) - } else if repeated { - p.P(`var v float64`) - p.unsafeFixed64("v", "float64") - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) - } else if proto3 || !nullable { - p.unsafeFixed64(`m.`+fieldname, "float64") - } else { - p.P(`var v float64`) - p.unsafeFixed64("v", "float64") - p.P(`m.`, fieldname, ` = &v`) - } - } - case descriptor.FieldDescriptorProto_TYPE_FLOAT: - if !p.unsafe || gogoproto.IsCastType(field) { - p.P(`var v uint32`) - p.decodeFixed32("v", "uint32") - if oneof { - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{`, typ, "(", p.mathPkg.Use(), `.Float32frombits(v))}`) - } else if repeated { - p.P(`v2 := `, typ, "(", p.mathPkg.Use(), `.Float32frombits(v))`) - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v2)`) - } else if proto3 || !nullable { - p.P(`m.`, fieldname, ` = `, typ, "(", p.mathPkg.Use(), `.Float32frombits(v))`) - } else { - p.P(`v2 := `, typ, "(", p.mathPkg.Use(), `.Float32frombits(v))`) - p.P(`m.`, fieldname, ` = &v2`) - } - } else { - if oneof { - p.P(`var v float32`) - p.unsafeFixed32("v", "float32") - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) - } else if repeated { - p.P(`var v float32`) - p.unsafeFixed32("v", "float32") - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) - } else if proto3 || !nullable { - p.unsafeFixed32("m."+fieldname, "float32") - } else { - p.P(`var v float32`) - p.unsafeFixed32("v", "float32") - p.P(`m.`, fieldname, ` = &v`) - } - } - case descriptor.FieldDescriptorProto_TYPE_INT64: - if oneof { - p.P(`var v `, typ) - p.decodeVarint("v", typ) - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) - } else if repeated { - p.P(`var v `, typ) - p.decodeVarint("v", typ) - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) - } else if proto3 || !nullable { - p.P(`m.`, fieldname, ` = 0`) - p.decodeVarint("m."+fieldname, typ) - } else { - p.P(`var v `, typ) - p.decodeVarint("v", typ) - p.P(`m.`, fieldname, ` = &v`) - } - case descriptor.FieldDescriptorProto_TYPE_UINT64: - if oneof { - p.P(`var v `, typ) - p.decodeVarint("v", typ) - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) - } else if repeated { - p.P(`var v `, typ) - p.decodeVarint("v", typ) - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) - } else if proto3 || !nullable { - p.P(`m.`, fieldname, ` = 0`) - p.decodeVarint("m."+fieldname, typ) - } else { - p.P(`var v `, typ) - p.decodeVarint("v", typ) - p.P(`m.`, fieldname, ` = &v`) - } - case descriptor.FieldDescriptorProto_TYPE_INT32: - if oneof { - p.P(`var v `, typ) - p.decodeVarint("v", typ) - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) - } else if repeated { - p.P(`var v `, typ) - p.decodeVarint("v", typ) - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) - } else if proto3 || !nullable { - p.P(`m.`, fieldname, ` = 0`) - p.decodeVarint("m."+fieldname, typ) - } else { - p.P(`var v `, typ) - p.decodeVarint("v", typ) - p.P(`m.`, fieldname, ` = &v`) - } - case descriptor.FieldDescriptorProto_TYPE_FIXED64: - if !p.unsafe || gogoproto.IsCastType(field) { - if oneof { - p.P(`var v `, typ) - p.decodeFixed64("v", typ) - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) - } else if repeated { - p.P(`var v `, typ) - p.decodeFixed64("v", typ) - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) - } else if proto3 || !nullable { - p.P(`m.`, fieldname, ` = 0`) - p.decodeFixed64("m."+fieldname, typ) - } else { - p.P(`var v `, typ) - p.decodeFixed64("v", typ) - p.P(`m.`, fieldname, ` = &v`) - } - } else { - if oneof { - p.P(`var v uint64`) - p.unsafeFixed64("v", "uint64") - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) - } else if repeated { - p.P(`var v uint64`) - p.unsafeFixed64("v", "uint64") - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) - } else if proto3 || !nullable { - p.unsafeFixed64("m."+fieldname, "uint64") - } else { - p.P(`var v uint64`) - p.unsafeFixed64("v", "uint64") - p.P(`m.`, fieldname, ` = &v`) - } - } - case descriptor.FieldDescriptorProto_TYPE_FIXED32: - if !p.unsafe || gogoproto.IsCastType(field) { - if oneof { - p.P(`var v `, typ) - p.decodeFixed32("v", typ) - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) - } else if repeated { - p.P(`var v `, typ) - p.decodeFixed32("v", typ) - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) - } else if proto3 || !nullable { - p.P(`m.`, fieldname, ` = 0`) - p.decodeFixed32("m."+fieldname, typ) - } else { - p.P(`var v `, typ) - p.decodeFixed32("v", typ) - p.P(`m.`, fieldname, ` = &v`) - } - } else { - if oneof { - p.P(`var v uint32`) - p.unsafeFixed32("v", "uint32") - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) - } else if repeated { - p.P(`var v uint32`) - p.unsafeFixed32("v", "uint32") - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) - } else if proto3 || !nullable { - p.unsafeFixed32("m."+fieldname, "uint32") - } else { - p.P(`var v uint32`) - p.unsafeFixed32("v", "uint32") - p.P(`m.`, fieldname, ` = &v`) - } - } - case descriptor.FieldDescriptorProto_TYPE_BOOL: - p.P(`var v int`) - p.decodeVarint("v", "int") - if oneof { - p.P(`b := `, typ, `(v != 0)`) - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{b}`) - } else if repeated { - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, `, typ, `(v != 0))`) - } else if proto3 || !nullable { - p.P(`m.`, fieldname, ` = `, typ, `(v != 0)`) - } else { - p.P(`b := `, typ, `(v != 0)`) - p.P(`m.`, fieldname, ` = &b`) - } - case descriptor.FieldDescriptorProto_TYPE_STRING: - p.P(`var stringLen uint64`) - p.decodeVarint("stringLen", "uint64") - p.P(`intStringLen := int(stringLen)`) - p.P(`if intStringLen < 0 {`) - p.In() - p.P(`return ErrInvalidLength` + p.localName) - p.Out() - p.P(`}`) - p.P(`postIndex := iNdEx + intStringLen`) - p.P(`if postIndex > l {`) - p.In() - p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) - p.Out() - p.P(`}`) - if oneof { - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{`, typ, `(dAtA[iNdEx:postIndex])}`) - } else if repeated { - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, `, typ, `(dAtA[iNdEx:postIndex]))`) - } else if proto3 || !nullable { - p.P(`m.`, fieldname, ` = `, typ, `(dAtA[iNdEx:postIndex])`) - } else { - p.P(`s := `, typ, `(dAtA[iNdEx:postIndex])`) - p.P(`m.`, fieldname, ` = &s`) - } - p.P(`iNdEx = postIndex`) - case descriptor.FieldDescriptorProto_TYPE_GROUP: - panic(fmt.Errorf("unmarshaler does not support group %v", fieldname)) - case descriptor.FieldDescriptorProto_TYPE_MESSAGE: - desc := p.ObjectNamed(field.GetTypeName()) - msgname := p.TypeName(desc) - p.P(`var msglen int`) - p.decodeVarint("msglen", "int") - p.P(`if msglen < 0 {`) - p.In() - p.P(`return ErrInvalidLength` + p.localName) - p.Out() - p.P(`}`) - p.P(`postIndex := iNdEx + msglen`) - p.P(`if postIndex > l {`) - p.In() - p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) - p.Out() - p.P(`}`) - if oneof { - buf := `dAtA[iNdEx:postIndex]` - if gogoproto.IsStdTime(field) { - if nullable { - p.P(`v := new(time.Time)`) - p.P(`if err := `, p.typesPkg.Use(), `.StdTimeUnmarshal(v, `, buf, `); err != nil {`) - } else { - p.P(`v := time.Time{}`) - p.P(`if err := `, p.typesPkg.Use(), `.StdTimeUnmarshal(&v, `, buf, `); err != nil {`) - } - } else if gogoproto.IsStdDuration(field) { - if nullable { - p.P(`v := new(time.Duration)`) - p.P(`if err := `, p.typesPkg.Use(), `.StdDurationUnmarshal(v, `, buf, `); err != nil {`) - } else { - p.P(`v := time.Duration(0)`) - p.P(`if err := `, p.typesPkg.Use(), `.StdDurationUnmarshal(&v, `, buf, `); err != nil {`) - } - } else { - p.P(`v := &`, msgname, `{}`) - p.P(`if err := v.Unmarshal(`, buf, `); err != nil {`) - } - p.In() - p.P(`return err`) - p.Out() - p.P(`}`) - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) - } else if p.IsMap(field) { - m := p.GoMapType(nil, field) - - keygoTyp, _ := p.GoType(nil, m.KeyField) - keygoAliasTyp, _ := p.GoType(nil, m.KeyAliasField) - // keys may not be pointers - keygoTyp = strings.Replace(keygoTyp, "*", "", 1) - keygoAliasTyp = strings.Replace(keygoAliasTyp, "*", "", 1) - - valuegoTyp, _ := p.GoType(nil, m.ValueField) - valuegoAliasTyp, _ := p.GoType(nil, m.ValueAliasField) - - // if the map type is an alias and key or values are aliases (type Foo map[Bar]Baz), - // we need to explicitly record their use here. - p.RecordTypeUse(m.KeyAliasField.GetTypeName()) - p.RecordTypeUse(m.ValueAliasField.GetTypeName()) - - nullable, valuegoTyp, valuegoAliasTyp = generator.GoMapValueTypes(field, m.ValueField, valuegoTyp, valuegoAliasTyp) - if gogoproto.IsStdTime(field) || gogoproto.IsStdDuration(field) { - valuegoTyp = valuegoAliasTyp - } - - p.P(`var keykey uint64`) - p.decodeVarint("keykey", "uint64") - p.mapField("mapkey", false, m.KeyAliasField) - p.P(`if m.`, fieldname, ` == nil {`) - p.In() - p.P(`m.`, fieldname, ` = make(`, m.GoType, `)`) - p.Out() - p.P(`}`) - s := `m.` + fieldname - if keygoTyp == keygoAliasTyp { - s += `[mapkey]` - } else { - s += `[` + keygoAliasTyp + `(mapkey)]` - } - v := `mapvalue` - if (m.ValueField.IsMessage() || gogoproto.IsCustomType(field)) && !nullable { - v = `*` + v - } - if valuegoTyp != valuegoAliasTyp { - v = `((` + valuegoAliasTyp + `)(` + v + `))` - } - p.P(`if iNdEx < postIndex {`) - p.In() - p.P(`var valuekey uint64`) - p.decodeVarint("valuekey", "uint64") - p.mapField("mapvalue", gogoproto.IsCustomType(field), m.ValueAliasField) - p.P(s, ` = `, v) - p.Out() - p.P(`} else {`) - p.In() - if gogoproto.IsStdTime(field) { - p.P(`var mapvalue = new(time.Time)`) - if nullable { - p.P(s, ` = mapvalue`) - } else { - p.P(s, ` = *mapvalue`) - } - } else if gogoproto.IsStdDuration(field) { - p.P(`var mapvalue = new(time.Duration)`) - if nullable { - p.P(s, ` = mapvalue`) - } else { - p.P(s, ` = *mapvalue`) - } - } else { - p.P(`var mapvalue `, valuegoAliasTyp) - p.P(s, ` = mapvalue`) - } - p.Out() - p.P(`}`) - } else if repeated { - if gogoproto.IsStdTime(field) { - if nullable { - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, new(time.Time))`) - } else { - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, time.Time{})`) - } - } else if gogoproto.IsStdDuration(field) { - if nullable { - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, new(time.Duration))`) - } else { - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, time.Duration(0))`) - } - } else if nullable { - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, &`, msgname, `{})`) - } else { - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, `, msgname, `{})`) - } - varName := `m.` + fieldname + `[len(m.` + fieldname + `)-1]` - buf := `dAtA[iNdEx:postIndex]` - if gogoproto.IsStdTime(field) { - if nullable { - p.P(`if err := `, p.typesPkg.Use(), `.StdTimeUnmarshal(`, varName, `,`, buf, `); err != nil {`) - } else { - p.P(`if err := `, p.typesPkg.Use(), `.StdTimeUnmarshal(&(`, varName, `),`, buf, `); err != nil {`) - } - } else if gogoproto.IsStdDuration(field) { - if nullable { - p.P(`if err := `, p.typesPkg.Use(), `.StdDurationUnmarshal(`, varName, `,`, buf, `); err != nil {`) - } else { - p.P(`if err := `, p.typesPkg.Use(), `.StdDurationUnmarshal(&(`, varName, `),`, buf, `); err != nil {`) - } - } else { - p.P(`if err := `, varName, `.Unmarshal(`, buf, `); err != nil {`) - } - p.In() - p.P(`return err`) - p.Out() - p.P(`}`) - } else if nullable { - p.P(`if m.`, fieldname, ` == nil {`) - p.In() - if gogoproto.IsStdTime(field) { - p.P(`m.`, fieldname, ` = new(time.Time)`) - } else if gogoproto.IsStdDuration(field) { - p.P(`m.`, fieldname, ` = new(time.Duration)`) - } else { - p.P(`m.`, fieldname, ` = &`, msgname, `{}`) - } - p.Out() - p.P(`}`) - if gogoproto.IsStdTime(field) { - p.P(`if err := `, p.typesPkg.Use(), `.StdTimeUnmarshal(m.`, fieldname, `, dAtA[iNdEx:postIndex]); err != nil {`) - } else if gogoproto.IsStdDuration(field) { - p.P(`if err := `, p.typesPkg.Use(), `.StdDurationUnmarshal(m.`, fieldname, `, dAtA[iNdEx:postIndex]); err != nil {`) - } else { - p.P(`if err := m.`, fieldname, `.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {`) - } - p.In() - p.P(`return err`) - p.Out() - p.P(`}`) - } else { - if gogoproto.IsStdTime(field) { - p.P(`if err := `, p.typesPkg.Use(), `.StdTimeUnmarshal(&m.`, fieldname, `, dAtA[iNdEx:postIndex]); err != nil {`) - } else if gogoproto.IsStdDuration(field) { - p.P(`if err := `, p.typesPkg.Use(), `.StdDurationUnmarshal(&m.`, fieldname, `, dAtA[iNdEx:postIndex]); err != nil {`) - } else { - p.P(`if err := m.`, fieldname, `.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {`) - } - p.In() - p.P(`return err`) - p.Out() - p.P(`}`) - } - p.P(`iNdEx = postIndex`) - case descriptor.FieldDescriptorProto_TYPE_BYTES: - p.P(`var byteLen int`) - p.decodeVarint("byteLen", "int") - p.P(`if byteLen < 0 {`) - p.In() - p.P(`return ErrInvalidLength` + p.localName) - p.Out() - p.P(`}`) - p.P(`postIndex := iNdEx + byteLen`) - p.P(`if postIndex > l {`) - p.In() - p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) - p.Out() - p.P(`}`) - if !gogoproto.IsCustomType(field) { - if oneof { - p.P(`v := make([]byte, postIndex-iNdEx)`) - p.P(`copy(v, dAtA[iNdEx:postIndex])`) - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) - } else if repeated { - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, make([]byte, postIndex-iNdEx))`) - p.P(`copy(m.`, fieldname, `[len(m.`, fieldname, `)-1], dAtA[iNdEx:postIndex])`) - } else { - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `[:0] , dAtA[iNdEx:postIndex]...)`) - p.P(`if m.`, fieldname, ` == nil {`) - p.In() - p.P(`m.`, fieldname, ` = []byte{}`) - p.Out() - p.P(`}`) - } - } else { - _, ctyp, err := generator.GetCustomType(field) - if err != nil { - panic(err) - } - if oneof { - p.P(`var vv `, ctyp) - p.P(`v := &vv`) - p.P(`if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {`) - p.In() - p.P(`return err`) - p.Out() - p.P(`}`) - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{*v}`) - } else if repeated { - p.P(`var v `, ctyp) - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) - p.P(`if err := m.`, fieldname, `[len(m.`, fieldname, `)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {`) - p.In() - p.P(`return err`) - p.Out() - p.P(`}`) - } else if nullable { - p.P(`var v `, ctyp) - p.P(`m.`, fieldname, ` = &v`) - p.P(`if err := m.`, fieldname, `.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {`) - p.In() - p.P(`return err`) - p.Out() - p.P(`}`) - } else { - p.P(`if err := m.`, fieldname, `.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {`) - p.In() - p.P(`return err`) - p.Out() - p.P(`}`) - } - } - p.P(`iNdEx = postIndex`) - case descriptor.FieldDescriptorProto_TYPE_UINT32: - if oneof { - p.P(`var v `, typ) - p.decodeVarint("v", typ) - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) - } else if repeated { - p.P(`var v `, typ) - p.decodeVarint("v", typ) - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) - } else if proto3 || !nullable { - p.P(`m.`, fieldname, ` = 0`) - p.decodeVarint("m."+fieldname, typ) - } else { - p.P(`var v `, typ) - p.decodeVarint("v", typ) - p.P(`m.`, fieldname, ` = &v`) - } - case descriptor.FieldDescriptorProto_TYPE_ENUM: - typName := p.TypeName(p.ObjectNamed(field.GetTypeName())) - if oneof { - p.P(`var v `, typName) - p.decodeVarint("v", typName) - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) - } else if repeated { - p.P(`var v `, typName) - p.decodeVarint("v", typName) - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) - } else if proto3 || !nullable { - p.P(`m.`, fieldname, ` = 0`) - p.decodeVarint("m."+fieldname, typName) - } else { - p.P(`var v `, typName) - p.decodeVarint("v", typName) - p.P(`m.`, fieldname, ` = &v`) - } - case descriptor.FieldDescriptorProto_TYPE_SFIXED32: - if !p.unsafe || gogoproto.IsCastType(field) { - if oneof { - p.P(`var v `, typ) - p.decodeFixed32("v", typ) - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) - } else if repeated { - p.P(`var v `, typ) - p.decodeFixed32("v", typ) - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) - } else if proto3 || !nullable { - p.P(`m.`, fieldname, ` = 0`) - p.decodeFixed32("m."+fieldname, typ) - } else { - p.P(`var v `, typ) - p.decodeFixed32("v", typ) - p.P(`m.`, fieldname, ` = &v`) - } - } else { - if oneof { - p.P(`var v int32`) - p.unsafeFixed32("v", "int32") - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) - } else if repeated { - p.P(`var v int32`) - p.unsafeFixed32("v", "int32") - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) - } else if proto3 || !nullable { - p.unsafeFixed32("m."+fieldname, "int32") - } else { - p.P(`var v int32`) - p.unsafeFixed32("v", "int32") - p.P(`m.`, fieldname, ` = &v`) - } - } - case descriptor.FieldDescriptorProto_TYPE_SFIXED64: - if !p.unsafe || gogoproto.IsCastType(field) { - if oneof { - p.P(`var v `, typ) - p.decodeFixed64("v", typ) - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) - } else if repeated { - p.P(`var v `, typ) - p.decodeFixed64("v", typ) - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) - } else if proto3 || !nullable { - p.P(`m.`, fieldname, ` = 0`) - p.decodeFixed64("m."+fieldname, typ) - } else { - p.P(`var v `, typ) - p.decodeFixed64("v", typ) - p.P(`m.`, fieldname, ` = &v`) - } - } else { - if oneof { - p.P(`var v int64`) - p.unsafeFixed64("v", "int64") - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) - } else if repeated { - p.P(`var v int64`) - p.unsafeFixed64("v", "int64") - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) - } else if proto3 || !nullable { - p.unsafeFixed64("m."+fieldname, "int64") - } else { - p.P(`var v int64`) - p.unsafeFixed64("v", "int64") - p.P(`m.`, fieldname, ` = &v`) - } - } - case descriptor.FieldDescriptorProto_TYPE_SINT32: - p.P(`var v `, typ) - p.decodeVarint("v", typ) - p.P(`v = `, typ, `((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31))`) - if oneof { - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{v}`) - } else if repeated { - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, v)`) - } else if proto3 || !nullable { - p.P(`m.`, fieldname, ` = v`) - } else { - p.P(`m.`, fieldname, ` = &v`) - } - case descriptor.FieldDescriptorProto_TYPE_SINT64: - p.P(`var v uint64`) - p.decodeVarint("v", "uint64") - p.P(`v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63)`) - if oneof { - p.P(`m.`, fieldname, ` = &`, p.OneOfTypeName(msg, field), `{`, typ, `(v)}`) - } else if repeated { - p.P(`m.`, fieldname, ` = append(m.`, fieldname, `, `, typ, `(v))`) - } else if proto3 || !nullable { - p.P(`m.`, fieldname, ` = `, typ, `(v)`) - } else { - p.P(`v2 := `, typ, `(v)`) - p.P(`m.`, fieldname, ` = &v2`) - } - default: - panic("not implemented") - } -} - -func (p *unmarshal) Generate(file *generator.FileDescriptor) { - proto3 := gogoproto.IsProto3(file.FileDescriptorProto) - p.PluginImports = generator.NewPluginImports(p.Generator) - p.atleastOne = false - p.localName = generator.FileName(file) - if p.unsafe { - p.localName += "Unsafe" - } - - p.ioPkg = p.NewImport("io") - p.mathPkg = p.NewImport("math") - p.unsafePkg = p.NewImport("unsafe") - p.typesPkg = p.NewImport("github.com/gogo/protobuf/types") - fmtPkg := p.NewImport("fmt") - protoPkg := p.NewImport("github.com/gogo/protobuf/proto") - if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { - protoPkg = p.NewImport("github.com/golang/protobuf/proto") - } - - for _, message := range file.Messages() { - ccTypeName := generator.CamelCaseSlice(message.TypeName()) - if p.unsafe { - if !gogoproto.IsUnsafeUnmarshaler(file.FileDescriptorProto, message.DescriptorProto) { - continue - } - if gogoproto.IsUnmarshaler(file.FileDescriptorProto, message.DescriptorProto) { - panic(fmt.Sprintf("unsafe_unmarshaler and unmarshaler enabled for %v", ccTypeName)) - } - } - if !p.unsafe { - if !gogoproto.IsUnmarshaler(file.FileDescriptorProto, message.DescriptorProto) { - continue - } - if gogoproto.IsUnsafeUnmarshaler(file.FileDescriptorProto, message.DescriptorProto) { - panic(fmt.Sprintf("unsafe_unmarshaler and unmarshaler enabled for %v", ccTypeName)) - } - } - if message.DescriptorProto.GetOptions().GetMapEntry() { - continue - } - p.atleastOne = true - - // build a map required field_id -> bitmask offset - rfMap := make(map[int32]uint) - rfNextId := uint(0) - for _, field := range message.Field { - if field.IsRequired() { - rfMap[field.GetNumber()] = rfNextId - rfNextId++ - } - } - rfCount := len(rfMap) - - p.P(`func (m *`, ccTypeName, `) Unmarshal(dAtA []byte) error {`) - p.In() - if rfCount > 0 { - p.P(`var hasFields [`, strconv.Itoa(1+(rfCount-1)/64), `]uint64`) - } - p.P(`l := len(dAtA)`) - p.P(`iNdEx := 0`) - p.P(`for iNdEx < l {`) - p.In() - p.P(`preIndex := iNdEx`) - p.P(`var wire uint64`) - p.decodeVarint("wire", "uint64") - p.P(`fieldNum := int32(wire >> 3)`) - if len(message.Field) > 0 || !message.IsGroup() { - p.P(`wireType := int(wire & 0x7)`) - } - if !message.IsGroup() { - p.P(`if wireType == `, strconv.Itoa(proto.WireEndGroup), ` {`) - p.In() - p.P(`return `, fmtPkg.Use(), `.Errorf("proto: `+message.GetName()+`: wiretype end group for non-group")`) - p.Out() - p.P(`}`) - } - p.P(`if fieldNum <= 0 {`) - p.In() - p.P(`return `, fmtPkg.Use(), `.Errorf("proto: `+message.GetName()+`: illegal tag %d (wire type %d)", fieldNum, wire)`) - p.Out() - p.P(`}`) - p.P(`switch fieldNum {`) - p.In() - for _, field := range message.Field { - fieldname := p.GetFieldName(message, field) - errFieldname := fieldname - if field.OneofIndex != nil { - errFieldname = p.GetOneOfFieldName(message, field) - } - packed := field.IsPacked() || (proto3 && field.IsRepeated() && generator.IsScalar(field)) - p.P(`case `, strconv.Itoa(int(field.GetNumber())), `:`) - p.In() - wireType := field.WireType() - if packed { - p.P(`if wireType == `, strconv.Itoa(proto.WireBytes), `{`) - p.In() - p.P(`var packedLen int`) - p.decodeVarint("packedLen", "int") - p.P(`if packedLen < 0 {`) - p.In() - p.P(`return ErrInvalidLength` + p.localName) - p.Out() - p.P(`}`) - p.P(`postIndex := iNdEx + packedLen`) - p.P(`if postIndex > l {`) - p.In() - p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) - p.Out() - p.P(`}`) - p.P(`for iNdEx < postIndex {`) - p.In() - p.field(file, message, field, fieldname, false) - p.Out() - p.P(`}`) - p.Out() - p.P(`} else if wireType == `, strconv.Itoa(wireType), `{`) - p.In() - p.field(file, message, field, fieldname, false) - p.Out() - p.P(`} else {`) - p.In() - p.P(`return ` + fmtPkg.Use() + `.Errorf("proto: wrong wireType = %d for field ` + errFieldname + `", wireType)`) - p.Out() - p.P(`}`) - } else { - p.P(`if wireType != `, strconv.Itoa(wireType), `{`) - p.In() - p.P(`return ` + fmtPkg.Use() + `.Errorf("proto: wrong wireType = %d for field ` + errFieldname + `", wireType)`) - p.Out() - p.P(`}`) - p.field(file, message, field, fieldname, proto3) - } - - if field.IsRequired() { - fieldBit, ok := rfMap[field.GetNumber()] - if !ok { - panic("field is required, but no bit registered") - } - p.P(`hasFields[`, strconv.Itoa(int(fieldBit/64)), `] |= uint64(`, fmt.Sprintf("0x%08x", 1<<(fieldBit%64)), `)`) - } - } - p.Out() - p.P(`default:`) - p.In() - if message.DescriptorProto.HasExtension() { - c := []string{} - for _, erange := range message.GetExtensionRange() { - c = append(c, `((fieldNum >= `+strconv.Itoa(int(erange.GetStart()))+") && (fieldNum<"+strconv.Itoa(int(erange.GetEnd()))+`))`) - } - p.P(`if `, strings.Join(c, "||"), `{`) - p.In() - p.P(`var sizeOfWire int`) - p.P(`for {`) - p.In() - p.P(`sizeOfWire++`) - p.P(`wire >>= 7`) - p.P(`if wire == 0 {`) - p.In() - p.P(`break`) - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - p.P(`iNdEx-=sizeOfWire`) - p.P(`skippy, err := skip`, p.localName+`(dAtA[iNdEx:])`) - p.P(`if err != nil {`) - p.In() - p.P(`return err`) - p.Out() - p.P(`}`) - p.P(`if skippy < 0 {`) - p.In() - p.P(`return ErrInvalidLength`, p.localName) - p.Out() - p.P(`}`) - p.P(`if (iNdEx + skippy) > l {`) - p.In() - p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) - p.Out() - p.P(`}`) - p.P(protoPkg.Use(), `.AppendExtension(m, int32(fieldNum), dAtA[iNdEx:iNdEx+skippy])`) - p.P(`iNdEx += skippy`) - p.Out() - p.P(`} else {`) - p.In() - } - p.P(`iNdEx=preIndex`) - p.P(`skippy, err := skip`, p.localName, `(dAtA[iNdEx:])`) - p.P(`if err != nil {`) - p.In() - p.P(`return err`) - p.Out() - p.P(`}`) - p.P(`if skippy < 0 {`) - p.In() - p.P(`return ErrInvalidLength`, p.localName) - p.Out() - p.P(`}`) - p.P(`if (iNdEx + skippy) > l {`) - p.In() - p.P(`return `, p.ioPkg.Use(), `.ErrUnexpectedEOF`) - p.Out() - p.P(`}`) - if gogoproto.HasUnrecognized(file.FileDescriptorProto, message.DescriptorProto) { - p.P(`m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)`) - } - p.P(`iNdEx += skippy`) - p.Out() - if message.DescriptorProto.HasExtension() { - p.Out() - p.P(`}`) - } - p.Out() - p.P(`}`) - p.Out() - p.P(`}`) - - for _, field := range message.Field { - if !field.IsRequired() { - continue - } - - fieldBit, ok := rfMap[field.GetNumber()] - if !ok { - panic("field is required, but no bit registered") - } - - p.P(`if hasFields[`, strconv.Itoa(int(fieldBit/64)), `] & uint64(`, fmt.Sprintf("0x%08x", 1<<(fieldBit%64)), `) == 0 {`) - p.In() - if !gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { - p.P(`return new(`, protoPkg.Use(), `.RequiredNotSetError)`) - } else { - p.P(`return `, protoPkg.Use(), `.NewRequiredNotSetError("`, field.GetName(), `")`) - } - p.Out() - p.P(`}`) - } - p.P() - p.P(`if iNdEx > l {`) - p.In() - p.P(`return ` + p.ioPkg.Use() + `.ErrUnexpectedEOF`) - p.Out() - p.P(`}`) - p.P(`return nil`) - p.Out() - p.P(`}`) - } - if !p.atleastOne { - return - } - - p.P(`func skip` + p.localName + `(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow` + p.localName + ` - } - if iNdEx >= l { - return 0, ` + p.ioPkg.Use() + `.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow` + p.localName + ` - } - if iNdEx >= l { - return 0, ` + p.ioPkg.Use() + `.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow` + p.localName + ` - } - if iNdEx >= l { - return 0, ` + p.ioPkg.Use() + `.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLength` + p.localName + ` - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow` + p.localName + ` - } - if iNdEx >= l { - return 0, ` + p.ioPkg.Use() + `.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skip` + p.localName + `(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, ` + fmtPkg.Use() + `.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") - } - - var ( - ErrInvalidLength` + p.localName + ` = ` + fmtPkg.Use() + `.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflow` + p.localName + ` = ` + fmtPkg.Use() + `.Errorf("proto: integer overflow") - ) - `) -} - -func init() { - generator.RegisterPlugin(NewUnmarshal()) - generator.RegisterPlugin(NewUnsafeUnmarshal()) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/clone.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/clone.go deleted file mode 100644 index 5d4cba4b51c..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/clone.go +++ /dev/null @@ -1,234 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2011 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -// Protocol buffer deep copy and merge. -// TODO: RawMessage. - -package proto - -import ( - "log" - "reflect" - "strings" -) - -// Clone returns a deep copy of a protocol buffer. -func Clone(pb Message) Message { - in := reflect.ValueOf(pb) - if in.IsNil() { - return pb - } - - out := reflect.New(in.Type().Elem()) - // out is empty so a merge is a deep copy. - mergeStruct(out.Elem(), in.Elem()) - return out.Interface().(Message) -} - -// Merge merges src into dst. -// Required and optional fields that are set in src will be set to that value in dst. -// Elements of repeated fields will be appended. -// Merge panics if src and dst are not the same type, or if dst is nil. -func Merge(dst, src Message) { - in := reflect.ValueOf(src) - out := reflect.ValueOf(dst) - if out.IsNil() { - panic("proto: nil destination") - } - if in.Type() != out.Type() { - // Explicit test prior to mergeStruct so that mistyped nils will fail - panic("proto: type mismatch") - } - if in.IsNil() { - // Merging nil into non-nil is a quiet no-op - return - } - mergeStruct(out.Elem(), in.Elem()) -} - -func mergeStruct(out, in reflect.Value) { - sprop := GetProperties(in.Type()) - for i := 0; i < in.NumField(); i++ { - f := in.Type().Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - mergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i]) - } - - if emIn, ok := in.Addr().Interface().(extensionsBytes); ok { - emOut := out.Addr().Interface().(extensionsBytes) - bIn := emIn.GetExtensions() - bOut := emOut.GetExtensions() - *bOut = append(*bOut, *bIn...) - } else if emIn, ok := extendable(in.Addr().Interface()); ok { - emOut, _ := extendable(out.Addr().Interface()) - mIn, muIn := emIn.extensionsRead() - if mIn != nil { - mOut := emOut.extensionsWrite() - muIn.Lock() - mergeExtension(mOut, mIn) - muIn.Unlock() - } - } - - uf := in.FieldByName("XXX_unrecognized") - if !uf.IsValid() { - return - } - uin := uf.Bytes() - if len(uin) > 0 { - out.FieldByName("XXX_unrecognized").SetBytes(append([]byte(nil), uin...)) - } -} - -// mergeAny performs a merge between two values of the same type. -// viaPtr indicates whether the values were indirected through a pointer (implying proto2). -// prop is set if this is a struct field (it may be nil). -func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) { - if in.Type() == protoMessageType { - if !in.IsNil() { - if out.IsNil() { - out.Set(reflect.ValueOf(Clone(in.Interface().(Message)))) - } else { - Merge(out.Interface().(Message), in.Interface().(Message)) - } - } - return - } - switch in.Kind() { - case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, - reflect.String, reflect.Uint32, reflect.Uint64: - if !viaPtr && isProto3Zero(in) { - return - } - out.Set(in) - case reflect.Interface: - // Probably a oneof field; copy non-nil values. - if in.IsNil() { - return - } - // Allocate destination if it is not set, or set to a different type. - // Otherwise we will merge as normal. - if out.IsNil() || out.Elem().Type() != in.Elem().Type() { - out.Set(reflect.New(in.Elem().Elem().Type())) // interface -> *T -> T -> new(T) - } - mergeAny(out.Elem(), in.Elem(), false, nil) - case reflect.Map: - if in.Len() == 0 { - return - } - if out.IsNil() { - out.Set(reflect.MakeMap(in.Type())) - } - // For maps with value types of *T or []byte we need to deep copy each value. - elemKind := in.Type().Elem().Kind() - for _, key := range in.MapKeys() { - var val reflect.Value - switch elemKind { - case reflect.Ptr: - val = reflect.New(in.Type().Elem().Elem()) - mergeAny(val, in.MapIndex(key), false, nil) - case reflect.Slice: - val = in.MapIndex(key) - val = reflect.ValueOf(append([]byte{}, val.Bytes()...)) - default: - val = in.MapIndex(key) - } - out.SetMapIndex(key, val) - } - case reflect.Ptr: - if in.IsNil() { - return - } - if out.IsNil() { - out.Set(reflect.New(in.Elem().Type())) - } - mergeAny(out.Elem(), in.Elem(), true, nil) - case reflect.Slice: - if in.IsNil() { - return - } - if in.Type().Elem().Kind() == reflect.Uint8 { - // []byte is a scalar bytes field, not a repeated field. - - // Edge case: if this is in a proto3 message, a zero length - // bytes field is considered the zero value, and should not - // be merged. - if prop != nil && prop.proto3 && in.Len() == 0 { - return - } - - // Make a deep copy. - // Append to []byte{} instead of []byte(nil) so that we never end up - // with a nil result. - out.SetBytes(append([]byte{}, in.Bytes()...)) - return - } - n := in.Len() - if out.IsNil() { - out.Set(reflect.MakeSlice(in.Type(), 0, n)) - } - switch in.Type().Elem().Kind() { - case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, - reflect.String, reflect.Uint32, reflect.Uint64: - out.Set(reflect.AppendSlice(out, in)) - default: - for i := 0; i < n; i++ { - x := reflect.Indirect(reflect.New(in.Type().Elem())) - mergeAny(x, in.Index(i), false, nil) - out.Set(reflect.Append(out, x)) - } - } - case reflect.Struct: - mergeStruct(out, in) - default: - // unknown type, so not a protocol buffer - log.Printf("proto: don't know how to copy %v", in) - } -} - -func mergeExtension(out, in map[int32]Extension) { - for extNum, eIn := range in { - eOut := Extension{desc: eIn.desc} - if eIn.value != nil { - v := reflect.New(reflect.TypeOf(eIn.value)).Elem() - mergeAny(v, reflect.ValueOf(eIn.value), false, nil) - eOut.value = v.Interface() - } - if eIn.enc != nil { - eOut.enc = make([]byte, len(eIn.enc)) - copy(eOut.enc, eIn.enc) - } - - out[extNum] = eOut - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/decode.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/decode.go deleted file mode 100644 index 737f2731d45..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/decode.go +++ /dev/null @@ -1,978 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -/* - * Routines for decoding protocol buffer data to construct in-memory representations. - */ - -import ( - "errors" - "fmt" - "io" - "os" - "reflect" -) - -// errOverflow is returned when an integer is too large to be represented. -var errOverflow = errors.New("proto: integer overflow") - -// ErrInternalBadWireType is returned by generated code when an incorrect -// wire type is encountered. It does not get returned to user code. -var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof") - -// The fundamental decoders that interpret bytes on the wire. -// Those that take integer types all return uint64 and are -// therefore of type valueDecoder. - -// DecodeVarint reads a varint-encoded integer from the slice. -// It returns the integer and the number of bytes consumed, or -// zero if there is not enough. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -func DecodeVarint(buf []byte) (x uint64, n int) { - for shift := uint(0); shift < 64; shift += 7 { - if n >= len(buf) { - return 0, 0 - } - b := uint64(buf[n]) - n++ - x |= (b & 0x7F) << shift - if (b & 0x80) == 0 { - return x, n - } - } - - // The number is too large to represent in a 64-bit value. - return 0, 0 -} - -func (p *Buffer) decodeVarintSlow() (x uint64, err error) { - i := p.index - l := len(p.buf) - - for shift := uint(0); shift < 64; shift += 7 { - if i >= l { - err = io.ErrUnexpectedEOF - return - } - b := p.buf[i] - i++ - x |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - p.index = i - return - } - } - - // The number is too large to represent in a 64-bit value. - err = errOverflow - return -} - -// DecodeVarint reads a varint-encoded integer from the Buffer. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -func (p *Buffer) DecodeVarint() (x uint64, err error) { - i := p.index - buf := p.buf - - if i >= len(buf) { - return 0, io.ErrUnexpectedEOF - } else if buf[i] < 0x80 { - p.index++ - return uint64(buf[i]), nil - } else if len(buf)-i < 10 { - return p.decodeVarintSlow() - } - - var b uint64 - // we already checked the first byte - x = uint64(buf[i]) - 0x80 - i++ - - b = uint64(buf[i]) - i++ - x += b << 7 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 7 - - b = uint64(buf[i]) - i++ - x += b << 14 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 14 - - b = uint64(buf[i]) - i++ - x += b << 21 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 21 - - b = uint64(buf[i]) - i++ - x += b << 28 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 28 - - b = uint64(buf[i]) - i++ - x += b << 35 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 35 - - b = uint64(buf[i]) - i++ - x += b << 42 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 42 - - b = uint64(buf[i]) - i++ - x += b << 49 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 49 - - b = uint64(buf[i]) - i++ - x += b << 56 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 56 - - b = uint64(buf[i]) - i++ - x += b << 63 - if b&0x80 == 0 { - goto done - } - // x -= 0x80 << 63 // Always zero. - - return 0, errOverflow - -done: - p.index = i - return x, nil -} - -// DecodeFixed64 reads a 64-bit integer from the Buffer. -// This is the format for the -// fixed64, sfixed64, and double protocol buffer types. -func (p *Buffer) DecodeFixed64() (x uint64, err error) { - // x, err already 0 - i := p.index + 8 - if i < 0 || i > len(p.buf) { - err = io.ErrUnexpectedEOF - return - } - p.index = i - - x = uint64(p.buf[i-8]) - x |= uint64(p.buf[i-7]) << 8 - x |= uint64(p.buf[i-6]) << 16 - x |= uint64(p.buf[i-5]) << 24 - x |= uint64(p.buf[i-4]) << 32 - x |= uint64(p.buf[i-3]) << 40 - x |= uint64(p.buf[i-2]) << 48 - x |= uint64(p.buf[i-1]) << 56 - return -} - -// DecodeFixed32 reads a 32-bit integer from the Buffer. -// This is the format for the -// fixed32, sfixed32, and float protocol buffer types. -func (p *Buffer) DecodeFixed32() (x uint64, err error) { - // x, err already 0 - i := p.index + 4 - if i < 0 || i > len(p.buf) { - err = io.ErrUnexpectedEOF - return - } - p.index = i - - x = uint64(p.buf[i-4]) - x |= uint64(p.buf[i-3]) << 8 - x |= uint64(p.buf[i-2]) << 16 - x |= uint64(p.buf[i-1]) << 24 - return -} - -// DecodeZigzag64 reads a zigzag-encoded 64-bit integer -// from the Buffer. -// This is the format used for the sint64 protocol buffer type. -func (p *Buffer) DecodeZigzag64() (x uint64, err error) { - x, err = p.DecodeVarint() - if err != nil { - return - } - x = (x >> 1) ^ uint64((int64(x&1)<<63)>>63) - return -} - -// DecodeZigzag32 reads a zigzag-encoded 32-bit integer -// from the Buffer. -// This is the format used for the sint32 protocol buffer type. -func (p *Buffer) DecodeZigzag32() (x uint64, err error) { - x, err = p.DecodeVarint() - if err != nil { - return - } - x = uint64((uint32(x) >> 1) ^ uint32((int32(x&1)<<31)>>31)) - return -} - -// These are not ValueDecoders: they produce an array of bytes or a string. -// bytes, embedded messages - -// DecodeRawBytes reads a count-delimited byte buffer from the Buffer. -// This is the format used for the bytes protocol buffer -// type and for embedded messages. -func (p *Buffer) DecodeRawBytes(alloc bool) (buf []byte, err error) { - n, err := p.DecodeVarint() - if err != nil { - return nil, err - } - - nb := int(n) - if nb < 0 { - return nil, fmt.Errorf("proto: bad byte length %d", nb) - } - end := p.index + nb - if end < p.index || end > len(p.buf) { - return nil, io.ErrUnexpectedEOF - } - - if !alloc { - // todo: check if can get more uses of alloc=false - buf = p.buf[p.index:end] - p.index += nb - return - } - - buf = make([]byte, nb) - copy(buf, p.buf[p.index:]) - p.index += nb - return -} - -// DecodeStringBytes reads an encoded string from the Buffer. -// This is the format used for the proto2 string type. -func (p *Buffer) DecodeStringBytes() (s string, err error) { - buf, err := p.DecodeRawBytes(false) - if err != nil { - return - } - return string(buf), nil -} - -// Skip the next item in the buffer. Its wire type is decoded and presented as an argument. -// If the protocol buffer has extensions, and the field matches, add it as an extension. -// Otherwise, if the XXX_unrecognized field exists, append the skipped data there. -func (o *Buffer) skipAndSave(t reflect.Type, tag, wire int, base structPointer, unrecField field) error { - oi := o.index - - err := o.skip(t, tag, wire) - if err != nil { - return err - } - - if !unrecField.IsValid() { - return nil - } - - ptr := structPointer_Bytes(base, unrecField) - - // Add the skipped field to struct field - obuf := o.buf - - o.buf = *ptr - o.EncodeVarint(uint64(tag<<3 | wire)) - *ptr = append(o.buf, obuf[oi:o.index]...) - - o.buf = obuf - - return nil -} - -// Skip the next item in the buffer. Its wire type is decoded and presented as an argument. -func (o *Buffer) skip(t reflect.Type, tag, wire int) error { - - var u uint64 - var err error - - switch wire { - case WireVarint: - _, err = o.DecodeVarint() - case WireFixed64: - _, err = o.DecodeFixed64() - case WireBytes: - _, err = o.DecodeRawBytes(false) - case WireFixed32: - _, err = o.DecodeFixed32() - case WireStartGroup: - for { - u, err = o.DecodeVarint() - if err != nil { - break - } - fwire := int(u & 0x7) - if fwire == WireEndGroup { - break - } - ftag := int(u >> 3) - err = o.skip(t, ftag, fwire) - if err != nil { - break - } - } - default: - err = fmt.Errorf("proto: can't skip unknown wire type %d for %s", wire, t) - } - return err -} - -// Unmarshaler is the interface representing objects that can -// unmarshal themselves. The method should reset the receiver before -// decoding starts. The argument points to data that may be -// overwritten, so implementations should not keep references to the -// buffer. -type Unmarshaler interface { - Unmarshal([]byte) error -} - -// Unmarshal parses the protocol buffer representation in buf and places the -// decoded result in pb. If the struct underlying pb does not match -// the data in buf, the results can be unpredictable. -// -// Unmarshal resets pb before starting to unmarshal, so any -// existing data in pb is always removed. Use UnmarshalMerge -// to preserve and append to existing data. -func Unmarshal(buf []byte, pb Message) error { - pb.Reset() - return UnmarshalMerge(buf, pb) -} - -// UnmarshalMerge parses the protocol buffer representation in buf and -// writes the decoded result to pb. If the struct underlying pb does not match -// the data in buf, the results can be unpredictable. -// -// UnmarshalMerge merges into existing data in pb. -// Most code should use Unmarshal instead. -func UnmarshalMerge(buf []byte, pb Message) error { - // If the object can unmarshal itself, let it. - if u, ok := pb.(Unmarshaler); ok { - return u.Unmarshal(buf) - } - return NewBuffer(buf).Unmarshal(pb) -} - -// DecodeMessage reads a count-delimited message from the Buffer. -func (p *Buffer) DecodeMessage(pb Message) error { - enc, err := p.DecodeRawBytes(false) - if err != nil { - return err - } - return NewBuffer(enc).Unmarshal(pb) -} - -// DecodeGroup reads a tag-delimited group from the Buffer. -func (p *Buffer) DecodeGroup(pb Message) error { - typ, base, err := getbase(pb) - if err != nil { - return err - } - return p.unmarshalType(typ.Elem(), GetProperties(typ.Elem()), true, base) -} - -// Unmarshal parses the protocol buffer representation in the -// Buffer and places the decoded result in pb. If the struct -// underlying pb does not match the data in the buffer, the results can be -// unpredictable. -// -// Unlike proto.Unmarshal, this does not reset pb before starting to unmarshal. -func (p *Buffer) Unmarshal(pb Message) error { - // If the object can unmarshal itself, let it. - if u, ok := pb.(Unmarshaler); ok { - err := u.Unmarshal(p.buf[p.index:]) - p.index = len(p.buf) - return err - } - - typ, base, err := getbase(pb) - if err != nil { - return err - } - - err = p.unmarshalType(typ.Elem(), GetProperties(typ.Elem()), false, base) - - if collectStats { - stats.Decode++ - } - - return err -} - -// unmarshalType does the work of unmarshaling a structure. -func (o *Buffer) unmarshalType(st reflect.Type, prop *StructProperties, is_group bool, base structPointer) error { - var state errorState - required, reqFields := prop.reqCount, uint64(0) - - var err error - for err == nil && o.index < len(o.buf) { - oi := o.index - var u uint64 - u, err = o.DecodeVarint() - if err != nil { - break - } - wire := int(u & 0x7) - if wire == WireEndGroup { - if is_group { - if required > 0 { - // Not enough information to determine the exact field. - // (See below.) - return &RequiredNotSetError{"{Unknown}"} - } - return nil // input is satisfied - } - return fmt.Errorf("proto: %s: wiretype end group for non-group", st) - } - tag := int(u >> 3) - if tag <= 0 { - return fmt.Errorf("proto: %s: illegal tag %d (wire type %d)", st, tag, wire) - } - fieldnum, ok := prop.decoderTags.get(tag) - if !ok { - // Maybe it's an extension? - if prop.extendable { - if e, eok := structPointer_Interface(base, st).(extensionsBytes); eok { - if isExtensionField(e, int32(tag)) { - if err = o.skip(st, tag, wire); err == nil { - ext := e.GetExtensions() - *ext = append(*ext, o.buf[oi:o.index]...) - } - continue - } - } else if e, _ := extendable(structPointer_Interface(base, st)); isExtensionField(e, int32(tag)) { - if err = o.skip(st, tag, wire); err == nil { - extmap := e.extensionsWrite() - ext := extmap[int32(tag)] // may be missing - ext.enc = append(ext.enc, o.buf[oi:o.index]...) - extmap[int32(tag)] = ext - } - continue - } - } - // Maybe it's a oneof? - if prop.oneofUnmarshaler != nil { - m := structPointer_Interface(base, st).(Message) - // First return value indicates whether tag is a oneof field. - ok, err = prop.oneofUnmarshaler(m, tag, wire, o) - if err == ErrInternalBadWireType { - // Map the error to something more descriptive. - // Do the formatting here to save generated code space. - err = fmt.Errorf("bad wiretype for oneof field in %T", m) - } - if ok { - continue - } - } - err = o.skipAndSave(st, tag, wire, base, prop.unrecField) - continue - } - p := prop.Prop[fieldnum] - - if p.dec == nil { - fmt.Fprintf(os.Stderr, "proto: no protobuf decoder for %s.%s\n", st, st.Field(fieldnum).Name) - continue - } - dec := p.dec - if wire != WireStartGroup && wire != p.WireType { - if wire == WireBytes && p.packedDec != nil { - // a packable field - dec = p.packedDec - } else { - err = fmt.Errorf("proto: bad wiretype for field %s.%s: got wiretype %d, want %d", st, st.Field(fieldnum).Name, wire, p.WireType) - continue - } - } - decErr := dec(o, p, base) - if decErr != nil && !state.shouldContinue(decErr, p) { - err = decErr - } - if err == nil && p.Required { - // Successfully decoded a required field. - if tag <= 64 { - // use bitmap for fields 1-64 to catch field reuse. - var mask uint64 = 1 << uint64(tag-1) - if reqFields&mask == 0 { - // new required field - reqFields |= mask - required-- - } - } else { - // This is imprecise. It can be fooled by a required field - // with a tag > 64 that is encoded twice; that's very rare. - // A fully correct implementation would require allocating - // a data structure, which we would like to avoid. - required-- - } - } - } - if err == nil { - if is_group { - return io.ErrUnexpectedEOF - } - if state.err != nil { - return state.err - } - if required > 0 { - // Not enough information to determine the exact field. If we use extra - // CPU, we could determine the field only if the missing required field - // has a tag <= 64 and we check reqFields. - return &RequiredNotSetError{"{Unknown}"} - } - } - return err -} - -// Individual type decoders -// For each, -// u is the decoded value, -// v is a pointer to the field (pointer) in the struct - -// Sizes of the pools to allocate inside the Buffer. -// The goal is modest amortization and allocation -// on at least 16-byte boundaries. -const ( - boolPoolSize = 16 - uint32PoolSize = 8 - uint64PoolSize = 4 -) - -// Decode a bool. -func (o *Buffer) dec_bool(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - if len(o.bools) == 0 { - o.bools = make([]bool, boolPoolSize) - } - o.bools[0] = u != 0 - *structPointer_Bool(base, p.field) = &o.bools[0] - o.bools = o.bools[1:] - return nil -} - -func (o *Buffer) dec_proto3_bool(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - *structPointer_BoolVal(base, p.field) = u != 0 - return nil -} - -// Decode an int32. -func (o *Buffer) dec_int32(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - word32_Set(structPointer_Word32(base, p.field), o, uint32(u)) - return nil -} - -func (o *Buffer) dec_proto3_int32(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - word32Val_Set(structPointer_Word32Val(base, p.field), uint32(u)) - return nil -} - -// Decode an int64. -func (o *Buffer) dec_int64(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - word64_Set(structPointer_Word64(base, p.field), o, u) - return nil -} - -func (o *Buffer) dec_proto3_int64(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - word64Val_Set(structPointer_Word64Val(base, p.field), o, u) - return nil -} - -// Decode a string. -func (o *Buffer) dec_string(p *Properties, base structPointer) error { - s, err := o.DecodeStringBytes() - if err != nil { - return err - } - *structPointer_String(base, p.field) = &s - return nil -} - -func (o *Buffer) dec_proto3_string(p *Properties, base structPointer) error { - s, err := o.DecodeStringBytes() - if err != nil { - return err - } - *structPointer_StringVal(base, p.field) = s - return nil -} - -// Decode a slice of bytes ([]byte). -func (o *Buffer) dec_slice_byte(p *Properties, base structPointer) error { - b, err := o.DecodeRawBytes(true) - if err != nil { - return err - } - *structPointer_Bytes(base, p.field) = b - return nil -} - -// Decode a slice of bools ([]bool). -func (o *Buffer) dec_slice_bool(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - v := structPointer_BoolSlice(base, p.field) - *v = append(*v, u != 0) - return nil -} - -// Decode a slice of bools ([]bool) in packed format. -func (o *Buffer) dec_slice_packed_bool(p *Properties, base structPointer) error { - v := structPointer_BoolSlice(base, p.field) - - nn, err := o.DecodeVarint() - if err != nil { - return err - } - nb := int(nn) // number of bytes of encoded bools - fin := o.index + nb - if fin < o.index { - return errOverflow - } - - y := *v - for o.index < fin { - u, err := p.valDec(o) - if err != nil { - return err - } - y = append(y, u != 0) - } - - *v = y - return nil -} - -// Decode a slice of int32s ([]int32). -func (o *Buffer) dec_slice_int32(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - structPointer_Word32Slice(base, p.field).Append(uint32(u)) - return nil -} - -// Decode a slice of int32s ([]int32) in packed format. -func (o *Buffer) dec_slice_packed_int32(p *Properties, base structPointer) error { - v := structPointer_Word32Slice(base, p.field) - - nn, err := o.DecodeVarint() - if err != nil { - return err - } - nb := int(nn) // number of bytes of encoded int32s - - fin := o.index + nb - if fin < o.index { - return errOverflow - } - for o.index < fin { - u, err := p.valDec(o) - if err != nil { - return err - } - v.Append(uint32(u)) - } - return nil -} - -// Decode a slice of int64s ([]int64). -func (o *Buffer) dec_slice_int64(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - - structPointer_Word64Slice(base, p.field).Append(u) - return nil -} - -// Decode a slice of int64s ([]int64) in packed format. -func (o *Buffer) dec_slice_packed_int64(p *Properties, base structPointer) error { - v := structPointer_Word64Slice(base, p.field) - - nn, err := o.DecodeVarint() - if err != nil { - return err - } - nb := int(nn) // number of bytes of encoded int64s - - fin := o.index + nb - if fin < o.index { - return errOverflow - } - for o.index < fin { - u, err := p.valDec(o) - if err != nil { - return err - } - v.Append(u) - } - return nil -} - -// Decode a slice of strings ([]string). -func (o *Buffer) dec_slice_string(p *Properties, base structPointer) error { - s, err := o.DecodeStringBytes() - if err != nil { - return err - } - v := structPointer_StringSlice(base, p.field) - *v = append(*v, s) - return nil -} - -// Decode a slice of slice of bytes ([][]byte). -func (o *Buffer) dec_slice_slice_byte(p *Properties, base structPointer) error { - b, err := o.DecodeRawBytes(true) - if err != nil { - return err - } - v := structPointer_BytesSlice(base, p.field) - *v = append(*v, b) - return nil -} - -// Decode a map field. -func (o *Buffer) dec_new_map(p *Properties, base structPointer) error { - raw, err := o.DecodeRawBytes(false) - if err != nil { - return err - } - oi := o.index // index at the end of this map entry - o.index -= len(raw) // move buffer back to start of map entry - - mptr := structPointer_NewAt(base, p.field, p.mtype) // *map[K]V - if mptr.Elem().IsNil() { - mptr.Elem().Set(reflect.MakeMap(mptr.Type().Elem())) - } - v := mptr.Elem() // map[K]V - - // Prepare addressable doubly-indirect placeholders for the key and value types. - // See enc_new_map for why. - keyptr := reflect.New(reflect.PtrTo(p.mtype.Key())).Elem() // addressable *K - keybase := toStructPointer(keyptr.Addr()) // **K - - var valbase structPointer - var valptr reflect.Value - switch p.mtype.Elem().Kind() { - case reflect.Slice: - // []byte - var dummy []byte - valptr = reflect.ValueOf(&dummy) // *[]byte - valbase = toStructPointer(valptr) // *[]byte - case reflect.Ptr: - // message; valptr is **Msg; need to allocate the intermediate pointer - valptr = reflect.New(reflect.PtrTo(p.mtype.Elem())).Elem() // addressable *V - valptr.Set(reflect.New(valptr.Type().Elem())) - valbase = toStructPointer(valptr) - default: - // everything else - valptr = reflect.New(reflect.PtrTo(p.mtype.Elem())).Elem() // addressable *V - valbase = toStructPointer(valptr.Addr()) // **V - } - - // Decode. - // This parses a restricted wire format, namely the encoding of a message - // with two fields. See enc_new_map for the format. - for o.index < oi { - // tagcode for key and value properties are always a single byte - // because they have tags 1 and 2. - tagcode := o.buf[o.index] - o.index++ - switch tagcode { - case p.mkeyprop.tagcode[0]: - if err := p.mkeyprop.dec(o, p.mkeyprop, keybase); err != nil { - return err - } - case p.mvalprop.tagcode[0]: - if err := p.mvalprop.dec(o, p.mvalprop, valbase); err != nil { - return err - } - default: - // TODO: Should we silently skip this instead? - return fmt.Errorf("proto: bad map data tag %d", raw[0]) - } - } - keyelem, valelem := keyptr.Elem(), valptr.Elem() - if !keyelem.IsValid() { - keyelem = reflect.Zero(p.mtype.Key()) - } - if !valelem.IsValid() { - valelem = reflect.Zero(p.mtype.Elem()) - } - - v.SetMapIndex(keyelem, valelem) - return nil -} - -// Decode a group. -func (o *Buffer) dec_struct_group(p *Properties, base structPointer) error { - bas := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(bas) { - // allocate new nested message - bas = toStructPointer(reflect.New(p.stype)) - structPointer_SetStructPointer(base, p.field, bas) - } - return o.unmarshalType(p.stype, p.sprop, true, bas) -} - -// Decode an embedded message. -func (o *Buffer) dec_struct_message(p *Properties, base structPointer) (err error) { - raw, e := o.DecodeRawBytes(false) - if e != nil { - return e - } - - bas := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(bas) { - // allocate new nested message - bas = toStructPointer(reflect.New(p.stype)) - structPointer_SetStructPointer(base, p.field, bas) - } - - // If the object can unmarshal itself, let it. - if p.isUnmarshaler { - iv := structPointer_Interface(bas, p.stype) - return iv.(Unmarshaler).Unmarshal(raw) - } - - obuf := o.buf - oi := o.index - o.buf = raw - o.index = 0 - - err = o.unmarshalType(p.stype, p.sprop, false, bas) - o.buf = obuf - o.index = oi - - return err -} - -// Decode a slice of embedded messages. -func (o *Buffer) dec_slice_struct_message(p *Properties, base structPointer) error { - return o.dec_slice_struct(p, false, base) -} - -// Decode a slice of embedded groups. -func (o *Buffer) dec_slice_struct_group(p *Properties, base structPointer) error { - return o.dec_slice_struct(p, true, base) -} - -// Decode a slice of structs ([]*struct). -func (o *Buffer) dec_slice_struct(p *Properties, is_group bool, base structPointer) error { - v := reflect.New(p.stype) - bas := toStructPointer(v) - structPointer_StructPointerSlice(base, p.field).Append(bas) - - if is_group { - err := o.unmarshalType(p.stype, p.sprop, is_group, bas) - return err - } - - raw, err := o.DecodeRawBytes(false) - if err != nil { - return err - } - - // If the object can unmarshal itself, let it. - if p.isUnmarshaler { - iv := v.Interface() - return iv.(Unmarshaler).Unmarshal(raw) - } - - obuf := o.buf - oi := o.index - o.buf = raw - o.index = 0 - - err = o.unmarshalType(p.stype, p.sprop, is_group, bas) - - o.buf = obuf - o.index = oi - - return err -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/decode_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/decode_gogo.go deleted file mode 100644 index 6fb74de4cc9..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/decode_gogo.go +++ /dev/null @@ -1,172 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package proto - -import ( - "reflect" -) - -// Decode a reference to a struct pointer. -func (o *Buffer) dec_ref_struct_message(p *Properties, base structPointer) (err error) { - raw, e := o.DecodeRawBytes(false) - if e != nil { - return e - } - - // If the object can unmarshal itself, let it. - if p.isUnmarshaler { - panic("not supported, since this is a pointer receiver") - } - - obuf := o.buf - oi := o.index - o.buf = raw - o.index = 0 - - bas := structPointer_FieldPointer(base, p.field) - - err = o.unmarshalType(p.stype, p.sprop, false, bas) - o.buf = obuf - o.index = oi - - return err -} - -// Decode a slice of references to struct pointers ([]struct). -func (o *Buffer) dec_slice_ref_struct(p *Properties, is_group bool, base structPointer) error { - newBas := appendStructPointer(base, p.field, p.sstype) - - if is_group { - panic("not supported, maybe in future, if requested.") - } - - raw, err := o.DecodeRawBytes(false) - if err != nil { - return err - } - - // If the object can unmarshal itself, let it. - if p.isUnmarshaler { - panic("not supported, since this is not a pointer receiver.") - } - - obuf := o.buf - oi := o.index - o.buf = raw - o.index = 0 - - err = o.unmarshalType(p.stype, p.sprop, is_group, newBas) - - o.buf = obuf - o.index = oi - - return err -} - -// Decode a slice of references to struct pointers. -func (o *Buffer) dec_slice_ref_struct_message(p *Properties, base structPointer) error { - return o.dec_slice_ref_struct(p, false, base) -} - -func setPtrCustomType(base structPointer, f field, v interface{}) { - if v == nil { - return - } - structPointer_SetStructPointer(base, f, toStructPointer(reflect.ValueOf(v))) -} - -func setCustomType(base structPointer, f field, value interface{}) { - if value == nil { - return - } - v := reflect.ValueOf(value).Elem() - t := reflect.TypeOf(value).Elem() - kind := t.Kind() - switch kind { - case reflect.Slice: - slice := reflect.MakeSlice(t, v.Len(), v.Cap()) - reflect.Copy(slice, v) - oldHeader := structPointer_GetSliceHeader(base, f) - oldHeader.Data = slice.Pointer() - oldHeader.Len = v.Len() - oldHeader.Cap = v.Cap() - default: - size := reflect.TypeOf(value).Elem().Size() - structPointer_Copy(toStructPointer(reflect.ValueOf(value)), structPointer_Add(base, f), int(size)) - } -} - -func (o *Buffer) dec_custom_bytes(p *Properties, base structPointer) error { - b, err := o.DecodeRawBytes(true) - if err != nil { - return err - } - i := reflect.New(p.ctype.Elem()).Interface() - custom := (i).(Unmarshaler) - if err := custom.Unmarshal(b); err != nil { - return err - } - setPtrCustomType(base, p.field, custom) - return nil -} - -func (o *Buffer) dec_custom_ref_bytes(p *Properties, base structPointer) error { - b, err := o.DecodeRawBytes(true) - if err != nil { - return err - } - i := reflect.New(p.ctype).Interface() - custom := (i).(Unmarshaler) - if err := custom.Unmarshal(b); err != nil { - return err - } - if custom != nil { - setCustomType(base, p.field, custom) - } - return nil -} - -// Decode a slice of bytes ([]byte) into a slice of custom types. -func (o *Buffer) dec_custom_slice_bytes(p *Properties, base structPointer) error { - b, err := o.DecodeRawBytes(true) - if err != nil { - return err - } - i := reflect.New(p.ctype.Elem()).Interface() - custom := (i).(Unmarshaler) - if err := custom.Unmarshal(b); err != nil { - return err - } - newBas := appendStructPointer(base, p.field, p.ctype) - - var zero field - setCustomType(newBas, zero, custom) - - return nil -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/duration.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/duration.go deleted file mode 100644 index 93464c91cff..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/duration.go +++ /dev/null @@ -1,100 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -// This file implements conversions between google.protobuf.Duration -// and time.Duration. - -import ( - "errors" - "fmt" - "time" -) - -const ( - // Range of a Duration in seconds, as specified in - // google/protobuf/duration.proto. This is about 10,000 years in seconds. - maxSeconds = int64(10000 * 365.25 * 24 * 60 * 60) - minSeconds = -maxSeconds -) - -// validateDuration determines whether the Duration is valid according to the -// definition in google/protobuf/duration.proto. A valid Duration -// may still be too large to fit into a time.Duration (the range of Duration -// is about 10,000 years, and the range of time.Duration is about 290). -func validateDuration(d *duration) error { - if d == nil { - return errors.New("duration: nil Duration") - } - if d.Seconds < minSeconds || d.Seconds > maxSeconds { - return fmt.Errorf("duration: %#v: seconds out of range", d) - } - if d.Nanos <= -1e9 || d.Nanos >= 1e9 { - return fmt.Errorf("duration: %#v: nanos out of range", d) - } - // Seconds and Nanos must have the same sign, unless d.Nanos is zero. - if (d.Seconds < 0 && d.Nanos > 0) || (d.Seconds > 0 && d.Nanos < 0) { - return fmt.Errorf("duration: %#v: seconds and nanos have different signs", d) - } - return nil -} - -// DurationFromProto converts a Duration to a time.Duration. DurationFromProto -// returns an error if the Duration is invalid or is too large to be -// represented in a time.Duration. -func durationFromProto(p *duration) (time.Duration, error) { - if err := validateDuration(p); err != nil { - return 0, err - } - d := time.Duration(p.Seconds) * time.Second - if int64(d/time.Second) != p.Seconds { - return 0, fmt.Errorf("duration: %#v is out of range for time.Duration", p) - } - if p.Nanos != 0 { - d += time.Duration(p.Nanos) - if (d < 0) != (p.Nanos < 0) { - return 0, fmt.Errorf("duration: %#v is out of range for time.Duration", p) - } - } - return d, nil -} - -// DurationProto converts a time.Duration to a Duration. -func durationProto(d time.Duration) *duration { - nanos := d.Nanoseconds() - secs := nanos / 1e9 - nanos -= secs * 1e9 - return &duration{ - Seconds: secs, - Nanos: int32(nanos), - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/duration_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/duration_gogo.go deleted file mode 100644 index 18e2a5f7765..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/duration_gogo.go +++ /dev/null @@ -1,203 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2016, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package proto - -import ( - "reflect" - "time" -) - -var durationType = reflect.TypeOf((*time.Duration)(nil)).Elem() - -type duration struct { - Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` - Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` -} - -func (m *duration) Reset() { *m = duration{} } -func (*duration) ProtoMessage() {} -func (*duration) String() string { return "duration" } - -func init() { - RegisterType((*duration)(nil), "gogo.protobuf.proto.duration") -} - -func (o *Buffer) decDuration() (time.Duration, error) { - b, err := o.DecodeRawBytes(true) - if err != nil { - return 0, err - } - dproto := &duration{} - if err := Unmarshal(b, dproto); err != nil { - return 0, err - } - return durationFromProto(dproto) -} - -func (o *Buffer) dec_duration(p *Properties, base structPointer) error { - d, err := o.decDuration() - if err != nil { - return err - } - word64_Set(structPointer_Word64(base, p.field), o, uint64(d)) - return nil -} - -func (o *Buffer) dec_ref_duration(p *Properties, base structPointer) error { - d, err := o.decDuration() - if err != nil { - return err - } - word64Val_Set(structPointer_Word64Val(base, p.field), o, uint64(d)) - return nil -} - -func (o *Buffer) dec_slice_duration(p *Properties, base structPointer) error { - d, err := o.decDuration() - if err != nil { - return err - } - newBas := appendStructPointer(base, p.field, reflect.SliceOf(reflect.PtrTo(durationType))) - var zero field - setPtrCustomType(newBas, zero, &d) - return nil -} - -func (o *Buffer) dec_slice_ref_duration(p *Properties, base structPointer) error { - d, err := o.decDuration() - if err != nil { - return err - } - structPointer_Word64Slice(base, p.field).Append(uint64(d)) - return nil -} - -func size_duration(p *Properties, base structPointer) (n int) { - structp := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(structp) { - return 0 - } - dur := structPointer_Interface(structp, durationType).(*time.Duration) - d := durationProto(*dur) - size := Size(d) - return size + sizeVarint(uint64(size)) + len(p.tagcode) -} - -func (o *Buffer) enc_duration(p *Properties, base structPointer) error { - structp := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(structp) { - return ErrNil - } - dur := structPointer_Interface(structp, durationType).(*time.Duration) - d := durationProto(*dur) - data, err := Marshal(d) - if err != nil { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - return nil -} - -func size_ref_duration(p *Properties, base structPointer) (n int) { - dur := structPointer_InterfaceAt(base, p.field, durationType).(*time.Duration) - d := durationProto(*dur) - size := Size(d) - return size + sizeVarint(uint64(size)) + len(p.tagcode) -} - -func (o *Buffer) enc_ref_duration(p *Properties, base structPointer) error { - dur := structPointer_InterfaceAt(base, p.field, durationType).(*time.Duration) - d := durationProto(*dur) - data, err := Marshal(d) - if err != nil { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - return nil -} - -func size_slice_duration(p *Properties, base structPointer) (n int) { - pdurs := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(reflect.PtrTo(durationType))).(*[]*time.Duration) - durs := *pdurs - for i := 0; i < len(durs); i++ { - if durs[i] == nil { - return 0 - } - dproto := durationProto(*durs[i]) - size := Size(dproto) - n += len(p.tagcode) + size + sizeVarint(uint64(size)) - } - return n -} - -func (o *Buffer) enc_slice_duration(p *Properties, base structPointer) error { - pdurs := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(reflect.PtrTo(durationType))).(*[]*time.Duration) - durs := *pdurs - for i := 0; i < len(durs); i++ { - if durs[i] == nil { - return errRepeatedHasNil - } - dproto := durationProto(*durs[i]) - data, err := Marshal(dproto) - if err != nil { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - } - return nil -} - -func size_slice_ref_duration(p *Properties, base structPointer) (n int) { - pdurs := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(durationType)).(*[]time.Duration) - durs := *pdurs - for i := 0; i < len(durs); i++ { - dproto := durationProto(durs[i]) - size := Size(dproto) - n += len(p.tagcode) + size + sizeVarint(uint64(size)) - } - return n -} - -func (o *Buffer) enc_slice_ref_duration(p *Properties, base structPointer) error { - pdurs := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(durationType)).(*[]time.Duration) - durs := *pdurs - for i := 0; i < len(durs); i++ { - dproto := durationProto(durs[i]) - data, err := Marshal(dproto) - if err != nil { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - } - return nil -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/encode.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/encode.go deleted file mode 100644 index 2b30f84626a..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/encode.go +++ /dev/null @@ -1,1362 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -/* - * Routines for encoding data into the wire format for protocol buffers. - */ - -import ( - "errors" - "fmt" - "reflect" - "sort" -) - -// RequiredNotSetError is the error returned if Marshal is called with -// a protocol buffer struct whose required fields have not -// all been initialized. It is also the error returned if Unmarshal is -// called with an encoded protocol buffer that does not include all the -// required fields. -// -// When printed, RequiredNotSetError reports the first unset required field in a -// message. If the field cannot be precisely determined, it is reported as -// "{Unknown}". -type RequiredNotSetError struct { - field string -} - -func (e *RequiredNotSetError) Error() string { - return fmt.Sprintf("proto: required field %q not set", e.field) -} - -var ( - // errRepeatedHasNil is the error returned if Marshal is called with - // a struct with a repeated field containing a nil element. - errRepeatedHasNil = errors.New("proto: repeated field has nil element") - - // errOneofHasNil is the error returned if Marshal is called with - // a struct with a oneof field containing a nil element. - errOneofHasNil = errors.New("proto: oneof field has nil value") - - // ErrNil is the error returned if Marshal is called with nil. - ErrNil = errors.New("proto: Marshal called with nil") - - // ErrTooLarge is the error returned if Marshal is called with a - // message that encodes to >2GB. - ErrTooLarge = errors.New("proto: message encodes to over 2 GB") -) - -// The fundamental encoders that put bytes on the wire. -// Those that take integer types all accept uint64 and are -// therefore of type valueEncoder. - -const maxVarintBytes = 10 // maximum length of a varint - -// maxMarshalSize is the largest allowed size of an encoded protobuf, -// since C++ and Java use signed int32s for the size. -const maxMarshalSize = 1<<31 - 1 - -// EncodeVarint returns the varint encoding of x. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -// Not used by the package itself, but helpful to clients -// wishing to use the same encoding. -func EncodeVarint(x uint64) []byte { - var buf [maxVarintBytes]byte - var n int - for n = 0; x > 127; n++ { - buf[n] = 0x80 | uint8(x&0x7F) - x >>= 7 - } - buf[n] = uint8(x) - n++ - return buf[0:n] -} - -// EncodeVarint writes a varint-encoded integer to the Buffer. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -func (p *Buffer) EncodeVarint(x uint64) error { - for x >= 1<<7 { - p.buf = append(p.buf, uint8(x&0x7f|0x80)) - x >>= 7 - } - p.buf = append(p.buf, uint8(x)) - return nil -} - -// SizeVarint returns the varint encoding size of an integer. -func SizeVarint(x uint64) int { - return sizeVarint(x) -} - -func sizeVarint(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} - -// EncodeFixed64 writes a 64-bit integer to the Buffer. -// This is the format for the -// fixed64, sfixed64, and double protocol buffer types. -func (p *Buffer) EncodeFixed64(x uint64) error { - p.buf = append(p.buf, - uint8(x), - uint8(x>>8), - uint8(x>>16), - uint8(x>>24), - uint8(x>>32), - uint8(x>>40), - uint8(x>>48), - uint8(x>>56)) - return nil -} - -func sizeFixed64(x uint64) int { - return 8 -} - -// EncodeFixed32 writes a 32-bit integer to the Buffer. -// This is the format for the -// fixed32, sfixed32, and float protocol buffer types. -func (p *Buffer) EncodeFixed32(x uint64) error { - p.buf = append(p.buf, - uint8(x), - uint8(x>>8), - uint8(x>>16), - uint8(x>>24)) - return nil -} - -func sizeFixed32(x uint64) int { - return 4 -} - -// EncodeZigzag64 writes a zigzag-encoded 64-bit integer -// to the Buffer. -// This is the format used for the sint64 protocol buffer type. -func (p *Buffer) EncodeZigzag64(x uint64) error { - // use signed number to get arithmetic right shift. - return p.EncodeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} - -func sizeZigzag64(x uint64) int { - return sizeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} - -// EncodeZigzag32 writes a zigzag-encoded 32-bit integer -// to the Buffer. -// This is the format used for the sint32 protocol buffer type. -func (p *Buffer) EncodeZigzag32(x uint64) error { - // use signed number to get arithmetic right shift. - return p.EncodeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31)))) -} - -func sizeZigzag32(x uint64) int { - return sizeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31)))) -} - -// EncodeRawBytes writes a count-delimited byte buffer to the Buffer. -// This is the format used for the bytes protocol buffer -// type and for embedded messages. -func (p *Buffer) EncodeRawBytes(b []byte) error { - p.EncodeVarint(uint64(len(b))) - p.buf = append(p.buf, b...) - return nil -} - -func sizeRawBytes(b []byte) int { - return sizeVarint(uint64(len(b))) + - len(b) -} - -// EncodeStringBytes writes an encoded string to the Buffer. -// This is the format used for the proto2 string type. -func (p *Buffer) EncodeStringBytes(s string) error { - p.EncodeVarint(uint64(len(s))) - p.buf = append(p.buf, s...) - return nil -} - -func sizeStringBytes(s string) int { - return sizeVarint(uint64(len(s))) + - len(s) -} - -// Marshaler is the interface representing objects that can marshal themselves. -type Marshaler interface { - Marshal() ([]byte, error) -} - -// Marshal takes the protocol buffer -// and encodes it into the wire format, returning the data. -func Marshal(pb Message) ([]byte, error) { - // Can the object marshal itself? - if m, ok := pb.(Marshaler); ok { - return m.Marshal() - } - p := NewBuffer(nil) - err := p.Marshal(pb) - if p.buf == nil && err == nil { - // Return a non-nil slice on success. - return []byte{}, nil - } - return p.buf, err -} - -// EncodeMessage writes the protocol buffer to the Buffer, -// prefixed by a varint-encoded length. -func (p *Buffer) EncodeMessage(pb Message) error { - t, base, err := getbase(pb) - if structPointer_IsNil(base) { - return ErrNil - } - if err == nil { - var state errorState - err = p.enc_len_struct(GetProperties(t.Elem()), base, &state) - } - return err -} - -// Marshal takes the protocol buffer -// and encodes it into the wire format, writing the result to the -// Buffer. -func (p *Buffer) Marshal(pb Message) error { - // Can the object marshal itself? - if m, ok := pb.(Marshaler); ok { - data, err := m.Marshal() - p.buf = append(p.buf, data...) - return err - } - - t, base, err := getbase(pb) - if structPointer_IsNil(base) { - return ErrNil - } - if err == nil { - err = p.enc_struct(GetProperties(t.Elem()), base) - } - - if collectStats { - (stats).Encode++ // Parens are to work around a goimports bug. - } - - if len(p.buf) > maxMarshalSize { - return ErrTooLarge - } - return err -} - -// Size returns the encoded size of a protocol buffer. -func Size(pb Message) (n int) { - // Can the object marshal itself? If so, Size is slow. - // TODO: add Size to Marshaler, or add a Sizer interface. - if m, ok := pb.(Marshaler); ok { - b, _ := m.Marshal() - return len(b) - } - - t, base, err := getbase(pb) - if structPointer_IsNil(base) { - return 0 - } - if err == nil { - n = size_struct(GetProperties(t.Elem()), base) - } - - if collectStats { - (stats).Size++ // Parens are to work around a goimports bug. - } - - return -} - -// Individual type encoders. - -// Encode a bool. -func (o *Buffer) enc_bool(p *Properties, base structPointer) error { - v := *structPointer_Bool(base, p.field) - if v == nil { - return ErrNil - } - x := 0 - if *v { - x = 1 - } - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func (o *Buffer) enc_proto3_bool(p *Properties, base structPointer) error { - v := *structPointer_BoolVal(base, p.field) - if !v { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, 1) - return nil -} - -func size_bool(p *Properties, base structPointer) int { - v := *structPointer_Bool(base, p.field) - if v == nil { - return 0 - } - return len(p.tagcode) + 1 // each bool takes exactly one byte -} - -func size_proto3_bool(p *Properties, base structPointer) int { - v := *structPointer_BoolVal(base, p.field) - if !v && !p.oneof { - return 0 - } - return len(p.tagcode) + 1 // each bool takes exactly one byte -} - -// Encode an int32. -func (o *Buffer) enc_int32(p *Properties, base structPointer) error { - v := structPointer_Word32(base, p.field) - if word32_IsNil(v) { - return ErrNil - } - x := int32(word32_Get(v)) // permit sign extension to use full 64-bit range - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func (o *Buffer) enc_proto3_int32(p *Properties, base structPointer) error { - v := structPointer_Word32Val(base, p.field) - x := int32(word32Val_Get(v)) // permit sign extension to use full 64-bit range - if x == 0 { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func size_int32(p *Properties, base structPointer) (n int) { - v := structPointer_Word32(base, p.field) - if word32_IsNil(v) { - return 0 - } - x := int32(word32_Get(v)) // permit sign extension to use full 64-bit range - n += len(p.tagcode) - n += p.valSize(uint64(x)) - return -} - -func size_proto3_int32(p *Properties, base structPointer) (n int) { - v := structPointer_Word32Val(base, p.field) - x := int32(word32Val_Get(v)) // permit sign extension to use full 64-bit range - if x == 0 && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += p.valSize(uint64(x)) - return -} - -// Encode a uint32. -// Exactly the same as int32, except for no sign extension. -func (o *Buffer) enc_uint32(p *Properties, base structPointer) error { - v := structPointer_Word32(base, p.field) - if word32_IsNil(v) { - return ErrNil - } - x := word32_Get(v) - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func (o *Buffer) enc_proto3_uint32(p *Properties, base structPointer) error { - v := structPointer_Word32Val(base, p.field) - x := word32Val_Get(v) - if x == 0 { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func size_uint32(p *Properties, base structPointer) (n int) { - v := structPointer_Word32(base, p.field) - if word32_IsNil(v) { - return 0 - } - x := word32_Get(v) - n += len(p.tagcode) - n += p.valSize(uint64(x)) - return -} - -func size_proto3_uint32(p *Properties, base structPointer) (n int) { - v := structPointer_Word32Val(base, p.field) - x := word32Val_Get(v) - if x == 0 && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += p.valSize(uint64(x)) - return -} - -// Encode an int64. -func (o *Buffer) enc_int64(p *Properties, base structPointer) error { - v := structPointer_Word64(base, p.field) - if word64_IsNil(v) { - return ErrNil - } - x := word64_Get(v) - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, x) - return nil -} - -func (o *Buffer) enc_proto3_int64(p *Properties, base structPointer) error { - v := structPointer_Word64Val(base, p.field) - x := word64Val_Get(v) - if x == 0 { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, x) - return nil -} - -func size_int64(p *Properties, base structPointer) (n int) { - v := structPointer_Word64(base, p.field) - if word64_IsNil(v) { - return 0 - } - x := word64_Get(v) - n += len(p.tagcode) - n += p.valSize(x) - return -} - -func size_proto3_int64(p *Properties, base structPointer) (n int) { - v := structPointer_Word64Val(base, p.field) - x := word64Val_Get(v) - if x == 0 && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += p.valSize(x) - return -} - -// Encode a string. -func (o *Buffer) enc_string(p *Properties, base structPointer) error { - v := *structPointer_String(base, p.field) - if v == nil { - return ErrNil - } - x := *v - o.buf = append(o.buf, p.tagcode...) - o.EncodeStringBytes(x) - return nil -} - -func (o *Buffer) enc_proto3_string(p *Properties, base structPointer) error { - v := *structPointer_StringVal(base, p.field) - if v == "" { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeStringBytes(v) - return nil -} - -func size_string(p *Properties, base structPointer) (n int) { - v := *structPointer_String(base, p.field) - if v == nil { - return 0 - } - x := *v - n += len(p.tagcode) - n += sizeStringBytes(x) - return -} - -func size_proto3_string(p *Properties, base structPointer) (n int) { - v := *structPointer_StringVal(base, p.field) - if v == "" && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += sizeStringBytes(v) - return -} - -// All protocol buffer fields are nillable, but be careful. -func isNil(v reflect.Value) bool { - switch v.Kind() { - case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: - return v.IsNil() - } - return false -} - -// Encode a message struct. -func (o *Buffer) enc_struct_message(p *Properties, base structPointer) error { - var state errorState - structp := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(structp) { - return ErrNil - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, err := m.Marshal() - if err != nil && !state.shouldContinue(err, nil) { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - return state.err - } - - o.buf = append(o.buf, p.tagcode...) - return o.enc_len_struct(p.sprop, structp, &state) -} - -func size_struct_message(p *Properties, base structPointer) int { - structp := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(structp) { - return 0 - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, _ := m.Marshal() - n0 := len(p.tagcode) - n1 := sizeRawBytes(data) - return n0 + n1 - } - - n0 := len(p.tagcode) - n1 := size_struct(p.sprop, structp) - n2 := sizeVarint(uint64(n1)) // size of encoded length - return n0 + n1 + n2 -} - -// Encode a group struct. -func (o *Buffer) enc_struct_group(p *Properties, base structPointer) error { - var state errorState - b := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(b) { - return ErrNil - } - - o.EncodeVarint(uint64((p.Tag << 3) | WireStartGroup)) - err := o.enc_struct(p.sprop, b) - if err != nil && !state.shouldContinue(err, nil) { - return err - } - o.EncodeVarint(uint64((p.Tag << 3) | WireEndGroup)) - return state.err -} - -func size_struct_group(p *Properties, base structPointer) (n int) { - b := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(b) { - return 0 - } - - n += sizeVarint(uint64((p.Tag << 3) | WireStartGroup)) - n += size_struct(p.sprop, b) - n += sizeVarint(uint64((p.Tag << 3) | WireEndGroup)) - return -} - -// Encode a slice of bools ([]bool). -func (o *Buffer) enc_slice_bool(p *Properties, base structPointer) error { - s := *structPointer_BoolSlice(base, p.field) - l := len(s) - if l == 0 { - return ErrNil - } - for _, x := range s { - o.buf = append(o.buf, p.tagcode...) - v := uint64(0) - if x { - v = 1 - } - p.valEnc(o, v) - } - return nil -} - -func size_slice_bool(p *Properties, base structPointer) int { - s := *structPointer_BoolSlice(base, p.field) - l := len(s) - if l == 0 { - return 0 - } - return l * (len(p.tagcode) + 1) // each bool takes exactly one byte -} - -// Encode a slice of bools ([]bool) in packed format. -func (o *Buffer) enc_slice_packed_bool(p *Properties, base structPointer) error { - s := *structPointer_BoolSlice(base, p.field) - l := len(s) - if l == 0 { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeVarint(uint64(l)) // each bool takes exactly one byte - for _, x := range s { - v := uint64(0) - if x { - v = 1 - } - p.valEnc(o, v) - } - return nil -} - -func size_slice_packed_bool(p *Properties, base structPointer) (n int) { - s := *structPointer_BoolSlice(base, p.field) - l := len(s) - if l == 0 { - return 0 - } - n += len(p.tagcode) - n += sizeVarint(uint64(l)) - n += l // each bool takes exactly one byte - return -} - -// Encode a slice of bytes ([]byte). -func (o *Buffer) enc_slice_byte(p *Properties, base structPointer) error { - s := *structPointer_Bytes(base, p.field) - if s == nil { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(s) - return nil -} - -func (o *Buffer) enc_proto3_slice_byte(p *Properties, base structPointer) error { - s := *structPointer_Bytes(base, p.field) - if len(s) == 0 { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(s) - return nil -} - -func size_slice_byte(p *Properties, base structPointer) (n int) { - s := *structPointer_Bytes(base, p.field) - if s == nil && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += sizeRawBytes(s) - return -} - -func size_proto3_slice_byte(p *Properties, base structPointer) (n int) { - s := *structPointer_Bytes(base, p.field) - if len(s) == 0 && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += sizeRawBytes(s) - return -} - -// Encode a slice of int32s ([]int32). -func (o *Buffer) enc_slice_int32(p *Properties, base structPointer) error { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - for i := 0; i < l; i++ { - o.buf = append(o.buf, p.tagcode...) - x := int32(s.Index(i)) // permit sign extension to use full 64-bit range - p.valEnc(o, uint64(x)) - } - return nil -} - -func size_slice_int32(p *Properties, base structPointer) (n int) { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - for i := 0; i < l; i++ { - n += len(p.tagcode) - x := int32(s.Index(i)) // permit sign extension to use full 64-bit range - n += p.valSize(uint64(x)) - } - return -} - -// Encode a slice of int32s ([]int32) in packed format. -func (o *Buffer) enc_slice_packed_int32(p *Properties, base structPointer) error { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - // TODO: Reuse a Buffer. - buf := NewBuffer(nil) - for i := 0; i < l; i++ { - x := int32(s.Index(i)) // permit sign extension to use full 64-bit range - p.valEnc(buf, uint64(x)) - } - - o.buf = append(o.buf, p.tagcode...) - o.EncodeVarint(uint64(len(buf.buf))) - o.buf = append(o.buf, buf.buf...) - return nil -} - -func size_slice_packed_int32(p *Properties, base structPointer) (n int) { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - var bufSize int - for i := 0; i < l; i++ { - x := int32(s.Index(i)) // permit sign extension to use full 64-bit range - bufSize += p.valSize(uint64(x)) - } - - n += len(p.tagcode) - n += sizeVarint(uint64(bufSize)) - n += bufSize - return -} - -// Encode a slice of uint32s ([]uint32). -// Exactly the same as int32, except for no sign extension. -func (o *Buffer) enc_slice_uint32(p *Properties, base structPointer) error { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - for i := 0; i < l; i++ { - o.buf = append(o.buf, p.tagcode...) - x := s.Index(i) - p.valEnc(o, uint64(x)) - } - return nil -} - -func size_slice_uint32(p *Properties, base structPointer) (n int) { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - for i := 0; i < l; i++ { - n += len(p.tagcode) - x := s.Index(i) - n += p.valSize(uint64(x)) - } - return -} - -// Encode a slice of uint32s ([]uint32) in packed format. -// Exactly the same as int32, except for no sign extension. -func (o *Buffer) enc_slice_packed_uint32(p *Properties, base structPointer) error { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - // TODO: Reuse a Buffer. - buf := NewBuffer(nil) - for i := 0; i < l; i++ { - p.valEnc(buf, uint64(s.Index(i))) - } - - o.buf = append(o.buf, p.tagcode...) - o.EncodeVarint(uint64(len(buf.buf))) - o.buf = append(o.buf, buf.buf...) - return nil -} - -func size_slice_packed_uint32(p *Properties, base structPointer) (n int) { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - var bufSize int - for i := 0; i < l; i++ { - bufSize += p.valSize(uint64(s.Index(i))) - } - - n += len(p.tagcode) - n += sizeVarint(uint64(bufSize)) - n += bufSize - return -} - -// Encode a slice of int64s ([]int64). -func (o *Buffer) enc_slice_int64(p *Properties, base structPointer) error { - s := structPointer_Word64Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - for i := 0; i < l; i++ { - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, s.Index(i)) - } - return nil -} - -func size_slice_int64(p *Properties, base structPointer) (n int) { - s := structPointer_Word64Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - for i := 0; i < l; i++ { - n += len(p.tagcode) - n += p.valSize(s.Index(i)) - } - return -} - -// Encode a slice of int64s ([]int64) in packed format. -func (o *Buffer) enc_slice_packed_int64(p *Properties, base structPointer) error { - s := structPointer_Word64Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - // TODO: Reuse a Buffer. - buf := NewBuffer(nil) - for i := 0; i < l; i++ { - p.valEnc(buf, s.Index(i)) - } - - o.buf = append(o.buf, p.tagcode...) - o.EncodeVarint(uint64(len(buf.buf))) - o.buf = append(o.buf, buf.buf...) - return nil -} - -func size_slice_packed_int64(p *Properties, base structPointer) (n int) { - s := structPointer_Word64Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - var bufSize int - for i := 0; i < l; i++ { - bufSize += p.valSize(s.Index(i)) - } - - n += len(p.tagcode) - n += sizeVarint(uint64(bufSize)) - n += bufSize - return -} - -// Encode a slice of slice of bytes ([][]byte). -func (o *Buffer) enc_slice_slice_byte(p *Properties, base structPointer) error { - ss := *structPointer_BytesSlice(base, p.field) - l := len(ss) - if l == 0 { - return ErrNil - } - for i := 0; i < l; i++ { - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(ss[i]) - } - return nil -} - -func size_slice_slice_byte(p *Properties, base structPointer) (n int) { - ss := *structPointer_BytesSlice(base, p.field) - l := len(ss) - if l == 0 { - return 0 - } - n += l * len(p.tagcode) - for i := 0; i < l; i++ { - n += sizeRawBytes(ss[i]) - } - return -} - -// Encode a slice of strings ([]string). -func (o *Buffer) enc_slice_string(p *Properties, base structPointer) error { - ss := *structPointer_StringSlice(base, p.field) - l := len(ss) - for i := 0; i < l; i++ { - o.buf = append(o.buf, p.tagcode...) - o.EncodeStringBytes(ss[i]) - } - return nil -} - -func size_slice_string(p *Properties, base structPointer) (n int) { - ss := *structPointer_StringSlice(base, p.field) - l := len(ss) - n += l * len(p.tagcode) - for i := 0; i < l; i++ { - n += sizeStringBytes(ss[i]) - } - return -} - -// Encode a slice of message structs ([]*struct). -func (o *Buffer) enc_slice_struct_message(p *Properties, base structPointer) error { - var state errorState - s := structPointer_StructPointerSlice(base, p.field) - l := s.Len() - - for i := 0; i < l; i++ { - structp := s.Index(i) - if structPointer_IsNil(structp) { - return errRepeatedHasNil - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, err := m.Marshal() - if err != nil && !state.shouldContinue(err, nil) { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - continue - } - - o.buf = append(o.buf, p.tagcode...) - err := o.enc_len_struct(p.sprop, structp, &state) - if err != nil && !state.shouldContinue(err, nil) { - if err == ErrNil { - return errRepeatedHasNil - } - return err - } - } - return state.err -} - -func size_slice_struct_message(p *Properties, base structPointer) (n int) { - s := structPointer_StructPointerSlice(base, p.field) - l := s.Len() - n += l * len(p.tagcode) - for i := 0; i < l; i++ { - structp := s.Index(i) - if structPointer_IsNil(structp) { - return // return the size up to this point - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, _ := m.Marshal() - n += sizeRawBytes(data) - continue - } - - n0 := size_struct(p.sprop, structp) - n1 := sizeVarint(uint64(n0)) // size of encoded length - n += n0 + n1 - } - return -} - -// Encode a slice of group structs ([]*struct). -func (o *Buffer) enc_slice_struct_group(p *Properties, base structPointer) error { - var state errorState - s := structPointer_StructPointerSlice(base, p.field) - l := s.Len() - - for i := 0; i < l; i++ { - b := s.Index(i) - if structPointer_IsNil(b) { - return errRepeatedHasNil - } - - o.EncodeVarint(uint64((p.Tag << 3) | WireStartGroup)) - - err := o.enc_struct(p.sprop, b) - - if err != nil && !state.shouldContinue(err, nil) { - if err == ErrNil { - return errRepeatedHasNil - } - return err - } - - o.EncodeVarint(uint64((p.Tag << 3) | WireEndGroup)) - } - return state.err -} - -func size_slice_struct_group(p *Properties, base structPointer) (n int) { - s := structPointer_StructPointerSlice(base, p.field) - l := s.Len() - - n += l * sizeVarint(uint64((p.Tag<<3)|WireStartGroup)) - n += l * sizeVarint(uint64((p.Tag<<3)|WireEndGroup)) - for i := 0; i < l; i++ { - b := s.Index(i) - if structPointer_IsNil(b) { - return // return size up to this point - } - - n += size_struct(p.sprop, b) - } - return -} - -// Encode an extension map. -func (o *Buffer) enc_map(p *Properties, base structPointer) error { - exts := structPointer_ExtMap(base, p.field) - if err := encodeExtensionsMap(*exts); err != nil { - return err - } - - return o.enc_map_body(*exts) -} - -func (o *Buffer) enc_exts(p *Properties, base structPointer) error { - exts := structPointer_Extensions(base, p.field) - - v, mu := exts.extensionsRead() - if v == nil { - return nil - } - - mu.Lock() - defer mu.Unlock() - if err := encodeExtensionsMap(v); err != nil { - return err - } - - return o.enc_map_body(v) -} - -func (o *Buffer) enc_map_body(v map[int32]Extension) error { - // Fast-path for common cases: zero or one extensions. - if len(v) <= 1 { - for _, e := range v { - o.buf = append(o.buf, e.enc...) - } - return nil - } - - // Sort keys to provide a deterministic encoding. - keys := make([]int, 0, len(v)) - for k := range v { - keys = append(keys, int(k)) - } - sort.Ints(keys) - - for _, k := range keys { - o.buf = append(o.buf, v[int32(k)].enc...) - } - return nil -} - -func size_map(p *Properties, base structPointer) int { - v := structPointer_ExtMap(base, p.field) - return extensionsMapSize(*v) -} - -func size_exts(p *Properties, base structPointer) int { - v := structPointer_Extensions(base, p.field) - return extensionsSize(v) -} - -// Encode a map field. -func (o *Buffer) enc_new_map(p *Properties, base structPointer) error { - var state errorState // XXX: or do we need to plumb this through? - - /* - A map defined as - map map_field = N; - is encoded in the same way as - message MapFieldEntry { - key_type key = 1; - value_type value = 2; - } - repeated MapFieldEntry map_field = N; - */ - - v := structPointer_NewAt(base, p.field, p.mtype).Elem() // map[K]V - if v.Len() == 0 { - return nil - } - - keycopy, valcopy, keybase, valbase := mapEncodeScratch(p.mtype) - - enc := func() error { - if err := p.mkeyprop.enc(o, p.mkeyprop, keybase); err != nil { - return err - } - if err := p.mvalprop.enc(o, p.mvalprop, valbase); err != nil && err != ErrNil { - return err - } - return nil - } - - // Don't sort map keys. It is not required by the spec, and C++ doesn't do it. - for _, key := range v.MapKeys() { - val := v.MapIndex(key) - - keycopy.Set(key) - valcopy.Set(val) - - o.buf = append(o.buf, p.tagcode...) - if err := o.enc_len_thing(enc, &state); err != nil { - return err - } - } - return nil -} - -func size_new_map(p *Properties, base structPointer) int { - v := structPointer_NewAt(base, p.field, p.mtype).Elem() // map[K]V - - keycopy, valcopy, keybase, valbase := mapEncodeScratch(p.mtype) - - n := 0 - for _, key := range v.MapKeys() { - val := v.MapIndex(key) - keycopy.Set(key) - valcopy.Set(val) - - // Tag codes for key and val are the responsibility of the sub-sizer. - keysize := p.mkeyprop.size(p.mkeyprop, keybase) - valsize := p.mvalprop.size(p.mvalprop, valbase) - entry := keysize + valsize - // Add on tag code and length of map entry itself. - n += len(p.tagcode) + sizeVarint(uint64(entry)) + entry - } - return n -} - -// mapEncodeScratch returns a new reflect.Value matching the map's value type, -// and a structPointer suitable for passing to an encoder or sizer. -func mapEncodeScratch(mapType reflect.Type) (keycopy, valcopy reflect.Value, keybase, valbase structPointer) { - // Prepare addressable doubly-indirect placeholders for the key and value types. - // This is needed because the element-type encoders expect **T, but the map iteration produces T. - - keycopy = reflect.New(mapType.Key()).Elem() // addressable K - keyptr := reflect.New(reflect.PtrTo(keycopy.Type())).Elem() // addressable *K - keyptr.Set(keycopy.Addr()) // - keybase = toStructPointer(keyptr.Addr()) // **K - - // Value types are more varied and require special handling. - switch mapType.Elem().Kind() { - case reflect.Slice: - // []byte - var dummy []byte - valcopy = reflect.ValueOf(&dummy).Elem() // addressable []byte - valbase = toStructPointer(valcopy.Addr()) - case reflect.Ptr: - // message; the generated field type is map[K]*Msg (so V is *Msg), - // so we only need one level of indirection. - valcopy = reflect.New(mapType.Elem()).Elem() // addressable V - valbase = toStructPointer(valcopy.Addr()) - default: - // everything else - valcopy = reflect.New(mapType.Elem()).Elem() // addressable V - valptr := reflect.New(reflect.PtrTo(valcopy.Type())).Elem() // addressable *V - valptr.Set(valcopy.Addr()) // - valbase = toStructPointer(valptr.Addr()) // **V - } - return -} - -// Encode a struct. -func (o *Buffer) enc_struct(prop *StructProperties, base structPointer) error { - var state errorState - // Encode fields in tag order so that decoders may use optimizations - // that depend on the ordering. - // https://developers.google.com/protocol-buffers/docs/encoding#order - for _, i := range prop.order { - p := prop.Prop[i] - if p.enc != nil { - err := p.enc(o, p, base) - if err != nil { - if err == ErrNil { - if p.Required && state.err == nil { - state.err = &RequiredNotSetError{p.Name} - } - } else if err == errRepeatedHasNil { - // Give more context to nil values in repeated fields. - return errors.New("repeated field " + p.OrigName + " has nil element") - } else if !state.shouldContinue(err, p) { - return err - } - } - if len(o.buf) > maxMarshalSize { - return ErrTooLarge - } - } - } - - // Do oneof fields. - if prop.oneofMarshaler != nil { - m := structPointer_Interface(base, prop.stype).(Message) - if err := prop.oneofMarshaler(m, o); err == ErrNil { - return errOneofHasNil - } else if err != nil { - return err - } - } - - // Add unrecognized fields at the end. - if prop.unrecField.IsValid() { - v := *structPointer_Bytes(base, prop.unrecField) - if len(o.buf)+len(v) > maxMarshalSize { - return ErrTooLarge - } - if len(v) > 0 { - o.buf = append(o.buf, v...) - } - } - - return state.err -} - -func size_struct(prop *StructProperties, base structPointer) (n int) { - for _, i := range prop.order { - p := prop.Prop[i] - if p.size != nil { - n += p.size(p, base) - } - } - - // Add unrecognized fields at the end. - if prop.unrecField.IsValid() { - v := *structPointer_Bytes(base, prop.unrecField) - n += len(v) - } - - // Factor in any oneof fields. - if prop.oneofSizer != nil { - m := structPointer_Interface(base, prop.stype).(Message) - n += prop.oneofSizer(m) - } - - return -} - -var zeroes [20]byte // longer than any conceivable sizeVarint - -// Encode a struct, preceded by its encoded length (as a varint). -func (o *Buffer) enc_len_struct(prop *StructProperties, base structPointer, state *errorState) error { - return o.enc_len_thing(func() error { return o.enc_struct(prop, base) }, state) -} - -// Encode something, preceded by its encoded length (as a varint). -func (o *Buffer) enc_len_thing(enc func() error, state *errorState) error { - iLen := len(o.buf) - o.buf = append(o.buf, 0, 0, 0, 0) // reserve four bytes for length - iMsg := len(o.buf) - err := enc() - if err != nil && !state.shouldContinue(err, nil) { - return err - } - lMsg := len(o.buf) - iMsg - lLen := sizeVarint(uint64(lMsg)) - switch x := lLen - (iMsg - iLen); { - case x > 0: // actual length is x bytes larger than the space we reserved - // Move msg x bytes right. - o.buf = append(o.buf, zeroes[:x]...) - copy(o.buf[iMsg+x:], o.buf[iMsg:iMsg+lMsg]) - case x < 0: // actual length is x bytes smaller than the space we reserved - // Move msg x bytes left. - copy(o.buf[iMsg+x:], o.buf[iMsg:iMsg+lMsg]) - o.buf = o.buf[:len(o.buf)+x] // x is negative - } - // Encode the length in the reserved space. - o.buf = o.buf[:iLen] - o.EncodeVarint(uint64(lMsg)) - o.buf = o.buf[:len(o.buf)+lMsg] - return state.err -} - -// errorState maintains the first error that occurs and updates that error -// with additional context. -type errorState struct { - err error -} - -// shouldContinue reports whether encoding should continue upon encountering the -// given error. If the error is RequiredNotSetError, shouldContinue returns true -// and, if this is the first appearance of that error, remembers it for future -// reporting. -// -// If prop is not nil, it may update any error with additional context about the -// field with the error. -func (s *errorState) shouldContinue(err error, prop *Properties) bool { - // Ignore unset required fields. - reqNotSet, ok := err.(*RequiredNotSetError) - if !ok { - return false - } - if s.err == nil { - if prop != nil { - err = &RequiredNotSetError{prop.Name + "." + reqNotSet.field} - } - s.err = err - } - return true -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/encode_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/encode_gogo.go deleted file mode 100644 index 32111b7f41d..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/encode_gogo.go +++ /dev/null @@ -1,350 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// http://github.com/golang/protobuf/ -// -// 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. - -package proto - -import ( - "reflect" -) - -func NewRequiredNotSetError(field string) *RequiredNotSetError { - return &RequiredNotSetError{field} -} - -type Sizer interface { - Size() int -} - -func (o *Buffer) enc_ext_slice_byte(p *Properties, base structPointer) error { - s := *structPointer_Bytes(base, p.field) - if s == nil { - return ErrNil - } - o.buf = append(o.buf, s...) - return nil -} - -func size_ext_slice_byte(p *Properties, base structPointer) (n int) { - s := *structPointer_Bytes(base, p.field) - if s == nil { - return 0 - } - n += len(s) - return -} - -// Encode a reference to bool pointer. -func (o *Buffer) enc_ref_bool(p *Properties, base structPointer) error { - v := *structPointer_BoolVal(base, p.field) - x := 0 - if v { - x = 1 - } - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func size_ref_bool(p *Properties, base structPointer) int { - return len(p.tagcode) + 1 // each bool takes exactly one byte -} - -// Encode a reference to int32 pointer. -func (o *Buffer) enc_ref_int32(p *Properties, base structPointer) error { - v := structPointer_Word32Val(base, p.field) - x := int32(word32Val_Get(v)) - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func size_ref_int32(p *Properties, base structPointer) (n int) { - v := structPointer_Word32Val(base, p.field) - x := int32(word32Val_Get(v)) - n += len(p.tagcode) - n += p.valSize(uint64(x)) - return -} - -func (o *Buffer) enc_ref_uint32(p *Properties, base structPointer) error { - v := structPointer_Word32Val(base, p.field) - x := word32Val_Get(v) - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func size_ref_uint32(p *Properties, base structPointer) (n int) { - v := structPointer_Word32Val(base, p.field) - x := word32Val_Get(v) - n += len(p.tagcode) - n += p.valSize(uint64(x)) - return -} - -// Encode a reference to an int64 pointer. -func (o *Buffer) enc_ref_int64(p *Properties, base structPointer) error { - v := structPointer_Word64Val(base, p.field) - x := word64Val_Get(v) - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, x) - return nil -} - -func size_ref_int64(p *Properties, base structPointer) (n int) { - v := structPointer_Word64Val(base, p.field) - x := word64Val_Get(v) - n += len(p.tagcode) - n += p.valSize(x) - return -} - -// Encode a reference to a string pointer. -func (o *Buffer) enc_ref_string(p *Properties, base structPointer) error { - v := *structPointer_StringVal(base, p.field) - o.buf = append(o.buf, p.tagcode...) - o.EncodeStringBytes(v) - return nil -} - -func size_ref_string(p *Properties, base structPointer) (n int) { - v := *structPointer_StringVal(base, p.field) - n += len(p.tagcode) - n += sizeStringBytes(v) - return -} - -// Encode a reference to a message struct. -func (o *Buffer) enc_ref_struct_message(p *Properties, base structPointer) error { - var state errorState - structp := structPointer_GetRefStructPointer(base, p.field) - if structPointer_IsNil(structp) { - return ErrNil - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, err := m.Marshal() - if err != nil && !state.shouldContinue(err, nil) { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - return nil - } - - o.buf = append(o.buf, p.tagcode...) - return o.enc_len_struct(p.sprop, structp, &state) -} - -//TODO this is only copied, please fix this -func size_ref_struct_message(p *Properties, base structPointer) int { - structp := structPointer_GetRefStructPointer(base, p.field) - if structPointer_IsNil(structp) { - return 0 - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, _ := m.Marshal() - n0 := len(p.tagcode) - n1 := sizeRawBytes(data) - return n0 + n1 - } - - n0 := len(p.tagcode) - n1 := size_struct(p.sprop, structp) - n2 := sizeVarint(uint64(n1)) // size of encoded length - return n0 + n1 + n2 -} - -// Encode a slice of references to message struct pointers ([]struct). -func (o *Buffer) enc_slice_ref_struct_message(p *Properties, base structPointer) error { - var state errorState - ss := structPointer_StructRefSlice(base, p.field, p.stype.Size()) - l := ss.Len() - for i := 0; i < l; i++ { - structp := ss.Index(i) - if structPointer_IsNil(structp) { - return errRepeatedHasNil - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, err := m.Marshal() - if err != nil && !state.shouldContinue(err, nil) { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - continue - } - - o.buf = append(o.buf, p.tagcode...) - err := o.enc_len_struct(p.sprop, structp, &state) - if err != nil && !state.shouldContinue(err, nil) { - if err == ErrNil { - return errRepeatedHasNil - } - return err - } - - } - return state.err -} - -//TODO this is only copied, please fix this -func size_slice_ref_struct_message(p *Properties, base structPointer) (n int) { - ss := structPointer_StructRefSlice(base, p.field, p.stype.Size()) - l := ss.Len() - n += l * len(p.tagcode) - for i := 0; i < l; i++ { - structp := ss.Index(i) - if structPointer_IsNil(structp) { - return // return the size up to this point - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, _ := m.Marshal() - n += len(p.tagcode) - n += sizeRawBytes(data) - continue - } - - n0 := size_struct(p.sprop, structp) - n1 := sizeVarint(uint64(n0)) // size of encoded length - n += n0 + n1 - } - return -} - -func (o *Buffer) enc_custom_bytes(p *Properties, base structPointer) error { - i := structPointer_InterfaceRef(base, p.field, p.ctype) - if i == nil { - return ErrNil - } - custom := i.(Marshaler) - data, err := custom.Marshal() - if err != nil { - return err - } - if data == nil { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - return nil -} - -func size_custom_bytes(p *Properties, base structPointer) (n int) { - n += len(p.tagcode) - i := structPointer_InterfaceRef(base, p.field, p.ctype) - if i == nil { - return 0 - } - custom := i.(Marshaler) - data, _ := custom.Marshal() - n += sizeRawBytes(data) - return -} - -func (o *Buffer) enc_custom_ref_bytes(p *Properties, base structPointer) error { - custom := structPointer_InterfaceAt(base, p.field, p.ctype).(Marshaler) - data, err := custom.Marshal() - if err != nil { - return err - } - if data == nil { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - return nil -} - -func size_custom_ref_bytes(p *Properties, base structPointer) (n int) { - n += len(p.tagcode) - i := structPointer_InterfaceAt(base, p.field, p.ctype) - if i == nil { - return 0 - } - custom := i.(Marshaler) - data, _ := custom.Marshal() - n += sizeRawBytes(data) - return -} - -func (o *Buffer) enc_custom_slice_bytes(p *Properties, base structPointer) error { - inter := structPointer_InterfaceRef(base, p.field, p.ctype) - if inter == nil { - return ErrNil - } - slice := reflect.ValueOf(inter) - l := slice.Len() - for i := 0; i < l; i++ { - v := slice.Index(i) - custom := v.Interface().(Marshaler) - data, err := custom.Marshal() - if err != nil { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - } - return nil -} - -func size_custom_slice_bytes(p *Properties, base structPointer) (n int) { - inter := structPointer_InterfaceRef(base, p.field, p.ctype) - if inter == nil { - return 0 - } - slice := reflect.ValueOf(inter) - l := slice.Len() - n += l * len(p.tagcode) - for i := 0; i < l; i++ { - v := slice.Index(i) - custom := v.Interface().(Marshaler) - data, _ := custom.Marshal() - n += sizeRawBytes(data) - } - return -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/equal.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/equal.go deleted file mode 100644 index 2ed1cf59666..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/equal.go +++ /dev/null @@ -1,300 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2011 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -// Protocol buffer comparison. - -package proto - -import ( - "bytes" - "log" - "reflect" - "strings" -) - -/* -Equal returns true iff protocol buffers a and b are equal. -The arguments must both be pointers to protocol buffer structs. - -Equality is defined in this way: - - Two messages are equal iff they are the same type, - corresponding fields are equal, unknown field sets - are equal, and extensions sets are equal. - - Two set scalar fields are equal iff their values are equal. - If the fields are of a floating-point type, remember that - NaN != x for all x, including NaN. If the message is defined - in a proto3 .proto file, fields are not "set"; specifically, - zero length proto3 "bytes" fields are equal (nil == {}). - - Two repeated fields are equal iff their lengths are the same, - and their corresponding elements are equal. Note a "bytes" field, - although represented by []byte, is not a repeated field and the - rule for the scalar fields described above applies. - - Two unset fields are equal. - - Two unknown field sets are equal if their current - encoded state is equal. - - Two extension sets are equal iff they have corresponding - elements that are pairwise equal. - - Two map fields are equal iff their lengths are the same, - and they contain the same set of elements. Zero-length map - fields are equal. - - Every other combination of things are not equal. - -The return value is undefined if a and b are not protocol buffers. -*/ -func Equal(a, b Message) bool { - if a == nil || b == nil { - return a == b - } - v1, v2 := reflect.ValueOf(a), reflect.ValueOf(b) - if v1.Type() != v2.Type() { - return false - } - if v1.Kind() == reflect.Ptr { - if v1.IsNil() { - return v2.IsNil() - } - if v2.IsNil() { - return false - } - v1, v2 = v1.Elem(), v2.Elem() - } - if v1.Kind() != reflect.Struct { - return false - } - return equalStruct(v1, v2) -} - -// v1 and v2 are known to have the same type. -func equalStruct(v1, v2 reflect.Value) bool { - sprop := GetProperties(v1.Type()) - for i := 0; i < v1.NumField(); i++ { - f := v1.Type().Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - f1, f2 := v1.Field(i), v2.Field(i) - if f.Type.Kind() == reflect.Ptr { - if n1, n2 := f1.IsNil(), f2.IsNil(); n1 && n2 { - // both unset - continue - } else if n1 != n2 { - // set/unset mismatch - return false - } - b1, ok := f1.Interface().(raw) - if ok { - b2 := f2.Interface().(raw) - // RawMessage - if !bytes.Equal(b1.Bytes(), b2.Bytes()) { - return false - } - continue - } - f1, f2 = f1.Elem(), f2.Elem() - } - if !equalAny(f1, f2, sprop.Prop[i]) { - return false - } - } - - if em1 := v1.FieldByName("XXX_InternalExtensions"); em1.IsValid() { - em2 := v2.FieldByName("XXX_InternalExtensions") - if !equalExtensions(v1.Type(), em1.Interface().(XXX_InternalExtensions), em2.Interface().(XXX_InternalExtensions)) { - return false - } - } - - if em1 := v1.FieldByName("XXX_extensions"); em1.IsValid() { - em2 := v2.FieldByName("XXX_extensions") - if !equalExtMap(v1.Type(), em1.Interface().(map[int32]Extension), em2.Interface().(map[int32]Extension)) { - return false - } - } - - uf := v1.FieldByName("XXX_unrecognized") - if !uf.IsValid() { - return true - } - - u1 := uf.Bytes() - u2 := v2.FieldByName("XXX_unrecognized").Bytes() - if !bytes.Equal(u1, u2) { - return false - } - - return true -} - -// v1 and v2 are known to have the same type. -// prop may be nil. -func equalAny(v1, v2 reflect.Value, prop *Properties) bool { - if v1.Type() == protoMessageType { - m1, _ := v1.Interface().(Message) - m2, _ := v2.Interface().(Message) - return Equal(m1, m2) - } - switch v1.Kind() { - case reflect.Bool: - return v1.Bool() == v2.Bool() - case reflect.Float32, reflect.Float64: - return v1.Float() == v2.Float() - case reflect.Int32, reflect.Int64: - return v1.Int() == v2.Int() - case reflect.Interface: - // Probably a oneof field; compare the inner values. - n1, n2 := v1.IsNil(), v2.IsNil() - if n1 || n2 { - return n1 == n2 - } - e1, e2 := v1.Elem(), v2.Elem() - if e1.Type() != e2.Type() { - return false - } - return equalAny(e1, e2, nil) - case reflect.Map: - if v1.Len() != v2.Len() { - return false - } - for _, key := range v1.MapKeys() { - val2 := v2.MapIndex(key) - if !val2.IsValid() { - // This key was not found in the second map. - return false - } - if !equalAny(v1.MapIndex(key), val2, nil) { - return false - } - } - return true - case reflect.Ptr: - // Maps may have nil values in them, so check for nil. - if v1.IsNil() && v2.IsNil() { - return true - } - if v1.IsNil() != v2.IsNil() { - return false - } - return equalAny(v1.Elem(), v2.Elem(), prop) - case reflect.Slice: - if v1.Type().Elem().Kind() == reflect.Uint8 { - // short circuit: []byte - - // Edge case: if this is in a proto3 message, a zero length - // bytes field is considered the zero value. - if prop != nil && prop.proto3 && v1.Len() == 0 && v2.Len() == 0 { - return true - } - if v1.IsNil() != v2.IsNil() { - return false - } - return bytes.Equal(v1.Interface().([]byte), v2.Interface().([]byte)) - } - - if v1.Len() != v2.Len() { - return false - } - for i := 0; i < v1.Len(); i++ { - if !equalAny(v1.Index(i), v2.Index(i), prop) { - return false - } - } - return true - case reflect.String: - return v1.Interface().(string) == v2.Interface().(string) - case reflect.Struct: - return equalStruct(v1, v2) - case reflect.Uint32, reflect.Uint64: - return v1.Uint() == v2.Uint() - } - - // unknown type, so not a protocol buffer - log.Printf("proto: don't know how to compare %v", v1) - return false -} - -// base is the struct type that the extensions are based on. -// x1 and x2 are InternalExtensions. -func equalExtensions(base reflect.Type, x1, x2 XXX_InternalExtensions) bool { - em1, _ := x1.extensionsRead() - em2, _ := x2.extensionsRead() - return equalExtMap(base, em1, em2) -} - -func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool { - if len(em1) != len(em2) { - return false - } - - for extNum, e1 := range em1 { - e2, ok := em2[extNum] - if !ok { - return false - } - - m1, m2 := e1.value, e2.value - - if m1 != nil && m2 != nil { - // Both are unencoded. - if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { - return false - } - continue - } - - // At least one is encoded. To do a semantically correct comparison - // we need to unmarshal them first. - var desc *ExtensionDesc - if m := extensionMaps[base]; m != nil { - desc = m[extNum] - } - if desc == nil { - log.Printf("proto: don't know how to compare extension %d of %v", extNum, base) - continue - } - var err error - if m1 == nil { - m1, err = decodeExtension(e1.enc, desc) - } - if m2 == nil && err == nil { - m2, err = decodeExtension(e2.enc, desc) - } - if err != nil { - // The encoded form is invalid. - log.Printf("proto: badly encoded extension %d of %v: %v", extNum, base, err) - return false - } - if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { - return false - } - } - - return true -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/extensions.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/extensions.go deleted file mode 100644 index 0dfcb538e8f..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/extensions.go +++ /dev/null @@ -1,693 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -/* - * Types and routines for supporting protocol buffer extensions. - */ - -import ( - "errors" - "fmt" - "reflect" - "strconv" - "sync" -) - -// ErrMissingExtension is the error returned by GetExtension if the named extension is not in the message. -var ErrMissingExtension = errors.New("proto: missing extension") - -// ExtensionRange represents a range of message extensions for a protocol buffer. -// Used in code generated by the protocol compiler. -type ExtensionRange struct { - Start, End int32 // both inclusive -} - -// extendableProto is an interface implemented by any protocol buffer generated by the current -// proto compiler that may be extended. -type extendableProto interface { - Message - ExtensionRangeArray() []ExtensionRange - extensionsWrite() map[int32]Extension - extensionsRead() (map[int32]Extension, sync.Locker) -} - -// extendableProtoV1 is an interface implemented by a protocol buffer generated by the previous -// version of the proto compiler that may be extended. -type extendableProtoV1 interface { - Message - ExtensionRangeArray() []ExtensionRange - ExtensionMap() map[int32]Extension -} - -type extensionsBytes interface { - Message - ExtensionRangeArray() []ExtensionRange - GetExtensions() *[]byte -} - -// extensionAdapter is a wrapper around extendableProtoV1 that implements extendableProto. -type extensionAdapter struct { - extendableProtoV1 -} - -func (e extensionAdapter) extensionsWrite() map[int32]Extension { - return e.ExtensionMap() -} - -func (e extensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) { - return e.ExtensionMap(), notLocker{} -} - -// notLocker is a sync.Locker whose Lock and Unlock methods are nops. -type notLocker struct{} - -func (n notLocker) Lock() {} -func (n notLocker) Unlock() {} - -// extendable returns the extendableProto interface for the given generated proto message. -// If the proto message has the old extension format, it returns a wrapper that implements -// the extendableProto interface. -func extendable(p interface{}) (extendableProto, bool) { - if ep, ok := p.(extendableProto); ok { - return ep, ok - } - if ep, ok := p.(extendableProtoV1); ok { - return extensionAdapter{ep}, ok - } - return nil, false -} - -// XXX_InternalExtensions is an internal representation of proto extensions. -// -// Each generated message struct type embeds an anonymous XXX_InternalExtensions field, -// thus gaining the unexported 'extensions' method, which can be called only from the proto package. -// -// The methods of XXX_InternalExtensions are not concurrency safe in general, -// but calls to logically read-only methods such as has and get may be executed concurrently. -type XXX_InternalExtensions struct { - // The struct must be indirect so that if a user inadvertently copies a - // generated message and its embedded XXX_InternalExtensions, they - // avoid the mayhem of a copied mutex. - // - // The mutex serializes all logically read-only operations to p.extensionMap. - // It is up to the client to ensure that write operations to p.extensionMap are - // mutually exclusive with other accesses. - p *struct { - mu sync.Mutex - extensionMap map[int32]Extension - } -} - -// extensionsWrite returns the extension map, creating it on first use. -func (e *XXX_InternalExtensions) extensionsWrite() map[int32]Extension { - if e.p == nil { - e.p = new(struct { - mu sync.Mutex - extensionMap map[int32]Extension - }) - e.p.extensionMap = make(map[int32]Extension) - } - return e.p.extensionMap -} - -// extensionsRead returns the extensions map for read-only use. It may be nil. -// The caller must hold the returned mutex's lock when accessing Elements within the map. -func (e *XXX_InternalExtensions) extensionsRead() (map[int32]Extension, sync.Locker) { - if e.p == nil { - return nil, nil - } - return e.p.extensionMap, &e.p.mu -} - -type extensionRange interface { - Message - ExtensionRangeArray() []ExtensionRange -} - -var extendableProtoType = reflect.TypeOf((*extendableProto)(nil)).Elem() -var extendableProtoV1Type = reflect.TypeOf((*extendableProtoV1)(nil)).Elem() -var extendableBytesType = reflect.TypeOf((*extensionsBytes)(nil)).Elem() -var extensionRangeType = reflect.TypeOf((*extensionRange)(nil)).Elem() - -// ExtensionDesc represents an extension specification. -// Used in generated code from the protocol compiler. -type ExtensionDesc struct { - ExtendedType Message // nil pointer to the type that is being extended - ExtensionType interface{} // nil pointer to the extension type - Field int32 // field number - Name string // fully-qualified name of extension, for text formatting - Tag string // protobuf tag style - Filename string // name of the file in which the extension is defined -} - -func (ed *ExtensionDesc) repeated() bool { - t := reflect.TypeOf(ed.ExtensionType) - return t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 -} - -// Extension represents an extension in a message. -type Extension struct { - // When an extension is stored in a message using SetExtension - // only desc and value are set. When the message is marshaled - // enc will be set to the encoded form of the message. - // - // When a message is unmarshaled and contains extensions, each - // extension will have only enc set. When such an extension is - // accessed using GetExtension (or GetExtensions) desc and value - // will be set. - desc *ExtensionDesc - value interface{} - enc []byte -} - -// SetRawExtension is for testing only. -func SetRawExtension(base Message, id int32, b []byte) { - if ebase, ok := base.(extensionsBytes); ok { - clearExtension(base, id) - ext := ebase.GetExtensions() - *ext = append(*ext, b...) - return - } - epb, ok := extendable(base) - if !ok { - return - } - extmap := epb.extensionsWrite() - extmap[id] = Extension{enc: b} -} - -// isExtensionField returns true iff the given field number is in an extension range. -func isExtensionField(pb extensionRange, field int32) bool { - for _, er := range pb.ExtensionRangeArray() { - if er.Start <= field && field <= er.End { - return true - } - } - return false -} - -// checkExtensionTypes checks that the given extension is valid for pb. -func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error { - var pbi interface{} = pb - // Check the extended type. - if ea, ok := pbi.(extensionAdapter); ok { - pbi = ea.extendableProtoV1 - } - if a, b := reflect.TypeOf(pbi), reflect.TypeOf(extension.ExtendedType); a != b { - return errors.New("proto: bad extended type; " + b.String() + " does not extend " + a.String()) - } - // Check the range. - if !isExtensionField(pb, extension.Field) { - return errors.New("proto: bad extension number; not in declared ranges") - } - return nil -} - -// extPropKey is sufficient to uniquely identify an extension. -type extPropKey struct { - base reflect.Type - field int32 -} - -var extProp = struct { - sync.RWMutex - m map[extPropKey]*Properties -}{ - m: make(map[extPropKey]*Properties), -} - -func extensionProperties(ed *ExtensionDesc) *Properties { - key := extPropKey{base: reflect.TypeOf(ed.ExtendedType), field: ed.Field} - - extProp.RLock() - if prop, ok := extProp.m[key]; ok { - extProp.RUnlock() - return prop - } - extProp.RUnlock() - - extProp.Lock() - defer extProp.Unlock() - // Check again. - if prop, ok := extProp.m[key]; ok { - return prop - } - - prop := new(Properties) - prop.Init(reflect.TypeOf(ed.ExtensionType), "unknown_name", ed.Tag, nil) - extProp.m[key] = prop - return prop -} - -// encode encodes any unmarshaled (unencoded) extensions in e. -func encodeExtensions(e *XXX_InternalExtensions) error { - m, mu := e.extensionsRead() - if m == nil { - return nil // fast path - } - mu.Lock() - defer mu.Unlock() - return encodeExtensionsMap(m) -} - -// encode encodes any unmarshaled (unencoded) extensions in e. -func encodeExtensionsMap(m map[int32]Extension) error { - for k, e := range m { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - et := reflect.TypeOf(e.desc.ExtensionType) - props := extensionProperties(e.desc) - - p := NewBuffer(nil) - // If e.value has type T, the encoder expects a *struct{ X T }. - // Pass a *T with a zero field and hope it all works out. - x := reflect.New(et) - x.Elem().Set(reflect.ValueOf(e.value)) - if err := props.enc(p, props, toStructPointer(x)); err != nil { - return err - } - e.enc = p.buf - m[k] = e - } - return nil -} - -func extensionsSize(e *XXX_InternalExtensions) (n int) { - m, mu := e.extensionsRead() - if m == nil { - return 0 - } - mu.Lock() - defer mu.Unlock() - return extensionsMapSize(m) -} - -func extensionsMapSize(m map[int32]Extension) (n int) { - for _, e := range m { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - n += len(e.enc) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - et := reflect.TypeOf(e.desc.ExtensionType) - props := extensionProperties(e.desc) - - // If e.value has type T, the encoder expects a *struct{ X T }. - // Pass a *T with a zero field and hope it all works out. - x := reflect.New(et) - x.Elem().Set(reflect.ValueOf(e.value)) - n += props.size(props, toStructPointer(x)) - } - return -} - -// HasExtension returns whether the given extension is present in pb. -func HasExtension(pb Message, extension *ExtensionDesc) bool { - if epb, doki := pb.(extensionsBytes); doki { - ext := epb.GetExtensions() - buf := *ext - o := 0 - for o < len(buf) { - tag, n := DecodeVarint(buf[o:]) - fieldNum := int32(tag >> 3) - if int32(fieldNum) == extension.Field { - return true - } - wireType := int(tag & 0x7) - o += n - l, err := size(buf[o:], wireType) - if err != nil { - return false - } - o += l - } - return false - } - // TODO: Check types, field numbers, etc.? - epb, ok := extendable(pb) - if !ok { - return false - } - extmap, mu := epb.extensionsRead() - if extmap == nil { - return false - } - mu.Lock() - _, ok = extmap[extension.Field] - mu.Unlock() - return ok -} - -func deleteExtension(pb extensionsBytes, theFieldNum int32, offset int) int { - ext := pb.GetExtensions() - for offset < len(*ext) { - tag, n1 := DecodeVarint((*ext)[offset:]) - fieldNum := int32(tag >> 3) - wireType := int(tag & 0x7) - n2, err := size((*ext)[offset+n1:], wireType) - if err != nil { - panic(err) - } - newOffset := offset + n1 + n2 - if fieldNum == theFieldNum { - *ext = append((*ext)[:offset], (*ext)[newOffset:]...) - return offset - } - offset = newOffset - } - return -1 -} - -// ClearExtension removes the given extension from pb. -func ClearExtension(pb Message, extension *ExtensionDesc) { - clearExtension(pb, extension.Field) -} - -func clearExtension(pb Message, fieldNum int32) { - if epb, doki := pb.(extensionsBytes); doki { - offset := 0 - for offset != -1 { - offset = deleteExtension(epb, fieldNum, offset) - } - return - } - epb, ok := extendable(pb) - if !ok { - return - } - // TODO: Check types, field numbers, etc.? - extmap := epb.extensionsWrite() - delete(extmap, fieldNum) -} - -// GetExtension parses and returns the given extension of pb. -// If the extension is not present and has no default value it returns ErrMissingExtension. -func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { - if epb, doki := pb.(extensionsBytes); doki { - ext := epb.GetExtensions() - o := 0 - for o < len(*ext) { - tag, n := DecodeVarint((*ext)[o:]) - fieldNum := int32(tag >> 3) - wireType := int(tag & 0x7) - l, err := size((*ext)[o+n:], wireType) - if err != nil { - return nil, err - } - if int32(fieldNum) == extension.Field { - v, err := decodeExtension((*ext)[o:o+n+l], extension) - if err != nil { - return nil, err - } - return v, nil - } - o += n + l - } - return defaultExtensionValue(extension) - } - epb, ok := extendable(pb) - if !ok { - return nil, errors.New("proto: not an extendable proto") - } - if err := checkExtensionTypes(epb, extension); err != nil { - return nil, err - } - - emap, mu := epb.extensionsRead() - if emap == nil { - return defaultExtensionValue(extension) - } - mu.Lock() - defer mu.Unlock() - e, ok := emap[extension.Field] - if !ok { - // defaultExtensionValue returns the default value or - // ErrMissingExtension if there is no default. - return defaultExtensionValue(extension) - } - - if e.value != nil { - // Already decoded. Check the descriptor, though. - if e.desc != extension { - // This shouldn't happen. If it does, it means that - // GetExtension was called twice with two different - // descriptors with the same field number. - return nil, errors.New("proto: descriptor conflict") - } - return e.value, nil - } - - v, err := decodeExtension(e.enc, extension) - if err != nil { - return nil, err - } - - // Remember the decoded version and drop the encoded version. - // That way it is safe to mutate what we return. - e.value = v - e.desc = extension - e.enc = nil - emap[extension.Field] = e - return e.value, nil -} - -// defaultExtensionValue returns the default value for extension. -// If no default for an extension is defined ErrMissingExtension is returned. -func defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) { - t := reflect.TypeOf(extension.ExtensionType) - props := extensionProperties(extension) - - sf, _, err := fieldDefault(t, props) - if err != nil { - return nil, err - } - - if sf == nil || sf.value == nil { - // There is no default value. - return nil, ErrMissingExtension - } - - if t.Kind() != reflect.Ptr { - // We do not need to return a Ptr, we can directly return sf.value. - return sf.value, nil - } - - // We need to return an interface{} that is a pointer to sf.value. - value := reflect.New(t).Elem() - value.Set(reflect.New(value.Type().Elem())) - if sf.kind == reflect.Int32 { - // We may have an int32 or an enum, but the underlying data is int32. - // Since we can't set an int32 into a non int32 reflect.value directly - // set it as a int32. - value.Elem().SetInt(int64(sf.value.(int32))) - } else { - value.Elem().Set(reflect.ValueOf(sf.value)) - } - return value.Interface(), nil -} - -// decodeExtension decodes an extension encoded in b. -func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) { - o := NewBuffer(b) - - t := reflect.TypeOf(extension.ExtensionType) - - props := extensionProperties(extension) - - // t is a pointer to a struct, pointer to basic type or a slice. - // Allocate a "field" to store the pointer/slice itself; the - // pointer/slice will be stored here. We pass - // the address of this field to props.dec. - // This passes a zero field and a *t and lets props.dec - // interpret it as a *struct{ x t }. - value := reflect.New(t).Elem() - - for { - // Discard wire type and field number varint. It isn't needed. - if _, err := o.DecodeVarint(); err != nil { - return nil, err - } - - if err := props.dec(o, props, toStructPointer(value.Addr())); err != nil { - return nil, err - } - - if o.index >= len(o.buf) { - break - } - } - return value.Interface(), nil -} - -// GetExtensions returns a slice of the extensions present in pb that are also listed in es. -// The returned slice has the same length as es; missing extensions will appear as nil elements. -func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) { - extensions = make([]interface{}, len(es)) - for i, e := range es { - extensions[i], err = GetExtension(pb, e) - if err == ErrMissingExtension { - err = nil - } - if err != nil { - return - } - } - return -} - -// ExtensionDescs returns a new slice containing pb's extension descriptors, in undefined order. -// For non-registered extensions, ExtensionDescs returns an incomplete descriptor containing -// just the Field field, which defines the extension's field number. -func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) { - epb, ok := extendable(pb) - if !ok { - return nil, fmt.Errorf("proto: %T is not an extendable proto.Message", pb) - } - registeredExtensions := RegisteredExtensions(pb) - - emap, mu := epb.extensionsRead() - if emap == nil { - return nil, nil - } - mu.Lock() - defer mu.Unlock() - extensions := make([]*ExtensionDesc, 0, len(emap)) - for extid, e := range emap { - desc := e.desc - if desc == nil { - desc = registeredExtensions[extid] - if desc == nil { - desc = &ExtensionDesc{Field: extid} - } - } - - extensions = append(extensions, desc) - } - return extensions, nil -} - -// SetExtension sets the specified extension of pb to the specified value. -func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error { - if epb, doki := pb.(extensionsBytes); doki { - ClearExtension(pb, extension) - ext := epb.GetExtensions() - et := reflect.TypeOf(extension.ExtensionType) - props := extensionProperties(extension) - p := NewBuffer(nil) - x := reflect.New(et) - x.Elem().Set(reflect.ValueOf(value)) - if err := props.enc(p, props, toStructPointer(x)); err != nil { - return err - } - *ext = append(*ext, p.buf...) - return nil - } - epb, ok := extendable(pb) - if !ok { - return errors.New("proto: not an extendable proto") - } - if err := checkExtensionTypes(epb, extension); err != nil { - return err - } - typ := reflect.TypeOf(extension.ExtensionType) - if typ != reflect.TypeOf(value) { - return errors.New("proto: bad extension value type") - } - // nil extension values need to be caught early, because the - // encoder can't distinguish an ErrNil due to a nil extension - // from an ErrNil due to a missing field. Extensions are - // always optional, so the encoder would just swallow the error - // and drop all the extensions from the encoded message. - if reflect.ValueOf(value).IsNil() { - return fmt.Errorf("proto: SetExtension called with nil value of type %T", value) - } - - extmap := epb.extensionsWrite() - extmap[extension.Field] = Extension{desc: extension, value: value} - return nil -} - -// ClearAllExtensions clears all extensions from pb. -func ClearAllExtensions(pb Message) { - if epb, doki := pb.(extensionsBytes); doki { - ext := epb.GetExtensions() - *ext = []byte{} - return - } - epb, ok := extendable(pb) - if !ok { - return - } - m := epb.extensionsWrite() - for k := range m { - delete(m, k) - } -} - -// A global registry of extensions. -// The generated code will register the generated descriptors by calling RegisterExtension. - -var extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc) - -// RegisterExtension is called from the generated code. -func RegisterExtension(desc *ExtensionDesc) { - st := reflect.TypeOf(desc.ExtendedType).Elem() - m := extensionMaps[st] - if m == nil { - m = make(map[int32]*ExtensionDesc) - extensionMaps[st] = m - } - if _, ok := m[desc.Field]; ok { - panic("proto: duplicate extension registered: " + st.String() + " " + strconv.Itoa(int(desc.Field))) - } - m[desc.Field] = desc -} - -// RegisteredExtensions returns a map of the registered extensions of a -// protocol buffer struct, indexed by the extension number. -// The argument pb should be a nil pointer to the struct type. -func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc { - return extensionMaps[reflect.TypeOf(pb).Elem()] -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/extensions_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/extensions_gogo.go deleted file mode 100644 index ea6478f009d..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/extensions_gogo.go +++ /dev/null @@ -1,294 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package proto - -import ( - "bytes" - "errors" - "fmt" - "reflect" - "sort" - "strings" - "sync" -) - -func GetBoolExtension(pb Message, extension *ExtensionDesc, ifnotset bool) bool { - if reflect.ValueOf(pb).IsNil() { - return ifnotset - } - value, err := GetExtension(pb, extension) - if err != nil { - return ifnotset - } - if value == nil { - return ifnotset - } - if value.(*bool) == nil { - return ifnotset - } - return *(value.(*bool)) -} - -func (this *Extension) Equal(that *Extension) bool { - return bytes.Equal(this.enc, that.enc) -} - -func (this *Extension) Compare(that *Extension) int { - return bytes.Compare(this.enc, that.enc) -} - -func SizeOfInternalExtension(m extendableProto) (n int) { - return SizeOfExtensionMap(m.extensionsWrite()) -} - -func SizeOfExtensionMap(m map[int32]Extension) (n int) { - return extensionsMapSize(m) -} - -type sortableMapElem struct { - field int32 - ext Extension -} - -func newSortableExtensionsFromMap(m map[int32]Extension) sortableExtensions { - s := make(sortableExtensions, 0, len(m)) - for k, v := range m { - s = append(s, &sortableMapElem{field: k, ext: v}) - } - return s -} - -type sortableExtensions []*sortableMapElem - -func (this sortableExtensions) Len() int { return len(this) } - -func (this sortableExtensions) Swap(i, j int) { this[i], this[j] = this[j], this[i] } - -func (this sortableExtensions) Less(i, j int) bool { return this[i].field < this[j].field } - -func (this sortableExtensions) String() string { - sort.Sort(this) - ss := make([]string, len(this)) - for i := range this { - ss[i] = fmt.Sprintf("%d: %v", this[i].field, this[i].ext) - } - return "map[" + strings.Join(ss, ",") + "]" -} - -func StringFromInternalExtension(m extendableProto) string { - return StringFromExtensionsMap(m.extensionsWrite()) -} - -func StringFromExtensionsMap(m map[int32]Extension) string { - return newSortableExtensionsFromMap(m).String() -} - -func StringFromExtensionsBytes(ext []byte) string { - m, err := BytesToExtensionsMap(ext) - if err != nil { - panic(err) - } - return StringFromExtensionsMap(m) -} - -func EncodeInternalExtension(m extendableProto, data []byte) (n int, err error) { - return EncodeExtensionMap(m.extensionsWrite(), data) -} - -func EncodeExtensionMap(m map[int32]Extension, data []byte) (n int, err error) { - if err := encodeExtensionsMap(m); err != nil { - return 0, err - } - keys := make([]int, 0, len(m)) - for k := range m { - keys = append(keys, int(k)) - } - sort.Ints(keys) - for _, k := range keys { - n += copy(data[n:], m[int32(k)].enc) - } - return n, nil -} - -func GetRawExtension(m map[int32]Extension, id int32) ([]byte, error) { - if m[id].value == nil || m[id].desc == nil { - return m[id].enc, nil - } - if err := encodeExtensionsMap(m); err != nil { - return nil, err - } - return m[id].enc, nil -} - -func size(buf []byte, wire int) (int, error) { - switch wire { - case WireVarint: - _, n := DecodeVarint(buf) - return n, nil - case WireFixed64: - return 8, nil - case WireBytes: - v, n := DecodeVarint(buf) - return int(v) + n, nil - case WireFixed32: - return 4, nil - case WireStartGroup: - offset := 0 - for { - u, n := DecodeVarint(buf[offset:]) - fwire := int(u & 0x7) - offset += n - if fwire == WireEndGroup { - return offset, nil - } - s, err := size(buf[offset:], wire) - if err != nil { - return 0, err - } - offset += s - } - } - return 0, fmt.Errorf("proto: can't get size for unknown wire type %d", wire) -} - -func BytesToExtensionsMap(buf []byte) (map[int32]Extension, error) { - m := make(map[int32]Extension) - i := 0 - for i < len(buf) { - tag, n := DecodeVarint(buf[i:]) - if n <= 0 { - return nil, fmt.Errorf("unable to decode varint") - } - fieldNum := int32(tag >> 3) - wireType := int(tag & 0x7) - l, err := size(buf[i+n:], wireType) - if err != nil { - return nil, err - } - end := i + int(l) + n - m[int32(fieldNum)] = Extension{enc: buf[i:end]} - i = end - } - return m, nil -} - -func NewExtension(e []byte) Extension { - ee := Extension{enc: make([]byte, len(e))} - copy(ee.enc, e) - return ee -} - -func AppendExtension(e Message, tag int32, buf []byte) { - if ee, eok := e.(extensionsBytes); eok { - ext := ee.GetExtensions() - *ext = append(*ext, buf...) - return - } - if ee, eok := e.(extendableProto); eok { - m := ee.extensionsWrite() - ext := m[int32(tag)] // may be missing - ext.enc = append(ext.enc, buf...) - m[int32(tag)] = ext - } -} - -func encodeExtension(e *Extension) error { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - return nil - } - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - et := reflect.TypeOf(e.desc.ExtensionType) - props := extensionProperties(e.desc) - - p := NewBuffer(nil) - // If e.value has type T, the encoder expects a *struct{ X T }. - // Pass a *T with a zero field and hope it all works out. - x := reflect.New(et) - x.Elem().Set(reflect.ValueOf(e.value)) - if err := props.enc(p, props, toStructPointer(x)); err != nil { - return err - } - e.enc = p.buf - return nil -} - -func (this Extension) GoString() string { - if this.enc == nil { - if err := encodeExtension(&this); err != nil { - panic(err) - } - } - return fmt.Sprintf("proto.NewExtension(%#v)", this.enc) -} - -func SetUnsafeExtension(pb Message, fieldNum int32, value interface{}) error { - typ := reflect.TypeOf(pb).Elem() - ext, ok := extensionMaps[typ] - if !ok { - return fmt.Errorf("proto: bad extended type; %s is not extendable", typ.String()) - } - desc, ok := ext[fieldNum] - if !ok { - return errors.New("proto: bad extension number; not in declared ranges") - } - return SetExtension(pb, desc, value) -} - -func GetUnsafeExtension(pb Message, fieldNum int32) (interface{}, error) { - typ := reflect.TypeOf(pb).Elem() - ext, ok := extensionMaps[typ] - if !ok { - return nil, fmt.Errorf("proto: bad extended type; %s is not extendable", typ.String()) - } - desc, ok := ext[fieldNum] - if !ok { - return nil, fmt.Errorf("unregistered field number %d", fieldNum) - } - return GetExtension(pb, desc) -} - -func NewUnsafeXXX_InternalExtensions(m map[int32]Extension) XXX_InternalExtensions { - x := &XXX_InternalExtensions{ - p: new(struct { - mu sync.Mutex - extensionMap map[int32]Extension - }), - } - x.p.extensionMap = m - return *x -} - -func GetUnsafeExtensionsMap(extendable Message) map[int32]Extension { - pb := extendable.(extendableProto) - return pb.extensionsWrite() -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/lib.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/lib.go deleted file mode 100644 index 7580bb45c61..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/lib.go +++ /dev/null @@ -1,898 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -/* -Package proto converts data structures to and from the wire format of -protocol buffers. It works in concert with the Go source code generated -for .proto files by the protocol compiler. - -A summary of the properties of the protocol buffer interface -for a protocol buffer variable v: - - - Names are turned from camel_case to CamelCase for export. - - There are no methods on v to set fields; just treat - them as structure fields. - - There are getters that return a field's value if set, - and return the field's default value if unset. - The getters work even if the receiver is a nil message. - - The zero value for a struct is its correct initialization state. - All desired fields must be set before marshaling. - - A Reset() method will restore a protobuf struct to its zero state. - - Non-repeated fields are pointers to the values; nil means unset. - That is, optional or required field int32 f becomes F *int32. - - Repeated fields are slices. - - Helper functions are available to aid the setting of fields. - msg.Foo = proto.String("hello") // set field - - Constants are defined to hold the default values of all fields that - have them. They have the form Default_StructName_FieldName. - Because the getter methods handle defaulted values, - direct use of these constants should be rare. - - Enums are given type names and maps from names to values. - Enum values are prefixed by the enclosing message's name, or by the - enum's type name if it is a top-level enum. Enum types have a String - method, and a Enum method to assist in message construction. - - Nested messages, groups and enums have type names prefixed with the name of - the surrounding message type. - - Extensions are given descriptor names that start with E_, - followed by an underscore-delimited list of the nested messages - that contain it (if any) followed by the CamelCased name of the - extension field itself. HasExtension, ClearExtension, GetExtension - and SetExtension are functions for manipulating extensions. - - Oneof field sets are given a single field in their message, - with distinguished wrapper types for each possible field value. - - Marshal and Unmarshal are functions to encode and decode the wire format. - -When the .proto file specifies `syntax="proto3"`, there are some differences: - - - Non-repeated fields of non-message type are values instead of pointers. - - Getters are only generated for message and oneof fields. - - Enum types do not get an Enum method. - -The simplest way to describe this is to see an example. -Given file test.proto, containing - - package example; - - enum FOO { X = 17; } - - message Test { - required string label = 1; - optional int32 type = 2 [default=77]; - repeated int64 reps = 3; - optional group OptionalGroup = 4 { - required string RequiredField = 5; - } - oneof union { - int32 number = 6; - string name = 7; - } - } - -The resulting file, test.pb.go, is: - - package example - - import proto "github.com/gogo/protobuf/proto" - import math "math" - - type FOO int32 - const ( - FOO_X FOO = 17 - ) - var FOO_name = map[int32]string{ - 17: "X", - } - var FOO_value = map[string]int32{ - "X": 17, - } - - func (x FOO) Enum() *FOO { - p := new(FOO) - *p = x - return p - } - func (x FOO) String() string { - return proto.EnumName(FOO_name, int32(x)) - } - func (x *FOO) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FOO_value, data) - if err != nil { - return err - } - *x = FOO(value) - return nil - } - - type Test struct { - Label *string `protobuf:"bytes,1,req,name=label" json:"label,omitempty"` - Type *int32 `protobuf:"varint,2,opt,name=type,def=77" json:"type,omitempty"` - Reps []int64 `protobuf:"varint,3,rep,name=reps" json:"reps,omitempty"` - Optionalgroup *Test_OptionalGroup `protobuf:"group,4,opt,name=OptionalGroup" json:"optionalgroup,omitempty"` - // Types that are valid to be assigned to Union: - // *Test_Number - // *Test_Name - Union isTest_Union `protobuf_oneof:"union"` - XXX_unrecognized []byte `json:"-"` - } - func (m *Test) Reset() { *m = Test{} } - func (m *Test) String() string { return proto.CompactTextString(m) } - func (*Test) ProtoMessage() {} - - type isTest_Union interface { - isTest_Union() - } - - type Test_Number struct { - Number int32 `protobuf:"varint,6,opt,name=number"` - } - type Test_Name struct { - Name string `protobuf:"bytes,7,opt,name=name"` - } - - func (*Test_Number) isTest_Union() {} - func (*Test_Name) isTest_Union() {} - - func (m *Test) GetUnion() isTest_Union { - if m != nil { - return m.Union - } - return nil - } - const Default_Test_Type int32 = 77 - - func (m *Test) GetLabel() string { - if m != nil && m.Label != nil { - return *m.Label - } - return "" - } - - func (m *Test) GetType() int32 { - if m != nil && m.Type != nil { - return *m.Type - } - return Default_Test_Type - } - - func (m *Test) GetOptionalgroup() *Test_OptionalGroup { - if m != nil { - return m.Optionalgroup - } - return nil - } - - type Test_OptionalGroup struct { - RequiredField *string `protobuf:"bytes,5,req" json:"RequiredField,omitempty"` - } - func (m *Test_OptionalGroup) Reset() { *m = Test_OptionalGroup{} } - func (m *Test_OptionalGroup) String() string { return proto.CompactTextString(m) } - - func (m *Test_OptionalGroup) GetRequiredField() string { - if m != nil && m.RequiredField != nil { - return *m.RequiredField - } - return "" - } - - func (m *Test) GetNumber() int32 { - if x, ok := m.GetUnion().(*Test_Number); ok { - return x.Number - } - return 0 - } - - func (m *Test) GetName() string { - if x, ok := m.GetUnion().(*Test_Name); ok { - return x.Name - } - return "" - } - - func init() { - proto.RegisterEnum("example.FOO", FOO_name, FOO_value) - } - -To create and play with a Test object: - - package main - - import ( - "log" - - "github.com/gogo/protobuf/proto" - pb "./example.pb" - ) - - func main() { - test := &pb.Test{ - Label: proto.String("hello"), - Type: proto.Int32(17), - Reps: []int64{1, 2, 3}, - Optionalgroup: &pb.Test_OptionalGroup{ - RequiredField: proto.String("good bye"), - }, - Union: &pb.Test_Name{"fred"}, - } - data, err := proto.Marshal(test) - if err != nil { - log.Fatal("marshaling error: ", err) - } - newTest := &pb.Test{} - err = proto.Unmarshal(data, newTest) - if err != nil { - log.Fatal("unmarshaling error: ", err) - } - // Now test and newTest contain the same data. - if test.GetLabel() != newTest.GetLabel() { - log.Fatalf("data mismatch %q != %q", test.GetLabel(), newTest.GetLabel()) - } - // Use a type switch to determine which oneof was set. - switch u := test.Union.(type) { - case *pb.Test_Number: // u.Number contains the number. - case *pb.Test_Name: // u.Name contains the string. - } - // etc. - } -*/ -package proto - -import ( - "encoding/json" - "fmt" - "log" - "reflect" - "sort" - "strconv" - "sync" -) - -// Message is implemented by generated protocol buffer messages. -type Message interface { - Reset() - String() string - ProtoMessage() -} - -// Stats records allocation details about the protocol buffer encoders -// and decoders. Useful for tuning the library itself. -type Stats struct { - Emalloc uint64 // mallocs in encode - Dmalloc uint64 // mallocs in decode - Encode uint64 // number of encodes - Decode uint64 // number of decodes - Chit uint64 // number of cache hits - Cmiss uint64 // number of cache misses - Size uint64 // number of sizes -} - -// Set to true to enable stats collection. -const collectStats = false - -var stats Stats - -// GetStats returns a copy of the global Stats structure. -func GetStats() Stats { return stats } - -// A Buffer is a buffer manager for marshaling and unmarshaling -// protocol buffers. It may be reused between invocations to -// reduce memory usage. It is not necessary to use a Buffer; -// the global functions Marshal and Unmarshal create a -// temporary Buffer and are fine for most applications. -type Buffer struct { - buf []byte // encode/decode byte stream - index int // read point - - // pools of basic types to amortize allocation. - bools []bool - uint32s []uint32 - uint64s []uint64 - - // extra pools, only used with pointer_reflect.go - int32s []int32 - int64s []int64 - float32s []float32 - float64s []float64 -} - -// NewBuffer allocates a new Buffer and initializes its internal data to -// the contents of the argument slice. -func NewBuffer(e []byte) *Buffer { - return &Buffer{buf: e} -} - -// Reset resets the Buffer, ready for marshaling a new protocol buffer. -func (p *Buffer) Reset() { - p.buf = p.buf[0:0] // for reading/writing - p.index = 0 // for reading -} - -// SetBuf replaces the internal buffer with the slice, -// ready for unmarshaling the contents of the slice. -func (p *Buffer) SetBuf(s []byte) { - p.buf = s - p.index = 0 -} - -// Bytes returns the contents of the Buffer. -func (p *Buffer) Bytes() []byte { return p.buf } - -/* - * Helper routines for simplifying the creation of optional fields of basic type. - */ - -// Bool is a helper routine that allocates a new bool value -// to store v and returns a pointer to it. -func Bool(v bool) *bool { - return &v -} - -// Int32 is a helper routine that allocates a new int32 value -// to store v and returns a pointer to it. -func Int32(v int32) *int32 { - return &v -} - -// Int is a helper routine that allocates a new int32 value -// to store v and returns a pointer to it, but unlike Int32 -// its argument value is an int. -func Int(v int) *int32 { - p := new(int32) - *p = int32(v) - return p -} - -// Int64 is a helper routine that allocates a new int64 value -// to store v and returns a pointer to it. -func Int64(v int64) *int64 { - return &v -} - -// Float32 is a helper routine that allocates a new float32 value -// to store v and returns a pointer to it. -func Float32(v float32) *float32 { - return &v -} - -// Float64 is a helper routine that allocates a new float64 value -// to store v and returns a pointer to it. -func Float64(v float64) *float64 { - return &v -} - -// Uint32 is a helper routine that allocates a new uint32 value -// to store v and returns a pointer to it. -func Uint32(v uint32) *uint32 { - return &v -} - -// Uint64 is a helper routine that allocates a new uint64 value -// to store v and returns a pointer to it. -func Uint64(v uint64) *uint64 { - return &v -} - -// String is a helper routine that allocates a new string value -// to store v and returns a pointer to it. -func String(v string) *string { - return &v -} - -// EnumName is a helper function to simplify printing protocol buffer enums -// by name. Given an enum map and a value, it returns a useful string. -func EnumName(m map[int32]string, v int32) string { - s, ok := m[v] - if ok { - return s - } - return strconv.Itoa(int(v)) -} - -// UnmarshalJSONEnum is a helper function to simplify recovering enum int values -// from their JSON-encoded representation. Given a map from the enum's symbolic -// names to its int values, and a byte buffer containing the JSON-encoded -// value, it returns an int32 that can be cast to the enum type by the caller. -// -// The function can deal with both JSON representations, numeric and symbolic. -func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) { - if data[0] == '"' { - // New style: enums are strings. - var repr string - if err := json.Unmarshal(data, &repr); err != nil { - return -1, err - } - val, ok := m[repr] - if !ok { - return 0, fmt.Errorf("unrecognized enum %s value %q", enumName, repr) - } - return val, nil - } - // Old style: enums are ints. - var val int32 - if err := json.Unmarshal(data, &val); err != nil { - return 0, fmt.Errorf("cannot unmarshal %#q into enum %s", data, enumName) - } - return val, nil -} - -// DebugPrint dumps the encoded data in b in a debugging format with a header -// including the string s. Used in testing but made available for general debugging. -func (p *Buffer) DebugPrint(s string, b []byte) { - var u uint64 - - obuf := p.buf - sindex := p.index - p.buf = b - p.index = 0 - depth := 0 - - fmt.Printf("\n--- %s ---\n", s) - -out: - for { - for i := 0; i < depth; i++ { - fmt.Print(" ") - } - - index := p.index - if index == len(p.buf) { - break - } - - op, err := p.DecodeVarint() - if err != nil { - fmt.Printf("%3d: fetching op err %v\n", index, err) - break out - } - tag := op >> 3 - wire := op & 7 - - switch wire { - default: - fmt.Printf("%3d: t=%3d unknown wire=%d\n", - index, tag, wire) - break out - - case WireBytes: - var r []byte - - r, err = p.DecodeRawBytes(false) - if err != nil { - break out - } - fmt.Printf("%3d: t=%3d bytes [%d]", index, tag, len(r)) - if len(r) <= 6 { - for i := 0; i < len(r); i++ { - fmt.Printf(" %.2x", r[i]) - } - } else { - for i := 0; i < 3; i++ { - fmt.Printf(" %.2x", r[i]) - } - fmt.Printf(" ..") - for i := len(r) - 3; i < len(r); i++ { - fmt.Printf(" %.2x", r[i]) - } - } - fmt.Printf("\n") - - case WireFixed32: - u, err = p.DecodeFixed32() - if err != nil { - fmt.Printf("%3d: t=%3d fix32 err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d fix32 %d\n", index, tag, u) - - case WireFixed64: - u, err = p.DecodeFixed64() - if err != nil { - fmt.Printf("%3d: t=%3d fix64 err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d fix64 %d\n", index, tag, u) - - case WireVarint: - u, err = p.DecodeVarint() - if err != nil { - fmt.Printf("%3d: t=%3d varint err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d varint %d\n", index, tag, u) - - case WireStartGroup: - fmt.Printf("%3d: t=%3d start\n", index, tag) - depth++ - - case WireEndGroup: - depth-- - fmt.Printf("%3d: t=%3d end\n", index, tag) - } - } - - if depth != 0 { - fmt.Printf("%3d: start-end not balanced %d\n", p.index, depth) - } - fmt.Printf("\n") - - p.buf = obuf - p.index = sindex -} - -// SetDefaults sets unset protocol buffer fields to their default values. -// It only modifies fields that are both unset and have defined defaults. -// It recursively sets default values in any non-nil sub-messages. -func SetDefaults(pb Message) { - setDefaults(reflect.ValueOf(pb), true, false) -} - -// v is a pointer to a struct. -func setDefaults(v reflect.Value, recur, zeros bool) { - v = v.Elem() - - defaultMu.RLock() - dm, ok := defaults[v.Type()] - defaultMu.RUnlock() - if !ok { - dm = buildDefaultMessage(v.Type()) - defaultMu.Lock() - defaults[v.Type()] = dm - defaultMu.Unlock() - } - - for _, sf := range dm.scalars { - f := v.Field(sf.index) - if !f.IsNil() { - // field already set - continue - } - dv := sf.value - if dv == nil && !zeros { - // no explicit default, and don't want to set zeros - continue - } - fptr := f.Addr().Interface() // **T - // TODO: Consider batching the allocations we do here. - switch sf.kind { - case reflect.Bool: - b := new(bool) - if dv != nil { - *b = dv.(bool) - } - *(fptr.(**bool)) = b - case reflect.Float32: - f := new(float32) - if dv != nil { - *f = dv.(float32) - } - *(fptr.(**float32)) = f - case reflect.Float64: - f := new(float64) - if dv != nil { - *f = dv.(float64) - } - *(fptr.(**float64)) = f - case reflect.Int32: - // might be an enum - if ft := f.Type(); ft != int32PtrType { - // enum - f.Set(reflect.New(ft.Elem())) - if dv != nil { - f.Elem().SetInt(int64(dv.(int32))) - } - } else { - // int32 field - i := new(int32) - if dv != nil { - *i = dv.(int32) - } - *(fptr.(**int32)) = i - } - case reflect.Int64: - i := new(int64) - if dv != nil { - *i = dv.(int64) - } - *(fptr.(**int64)) = i - case reflect.String: - s := new(string) - if dv != nil { - *s = dv.(string) - } - *(fptr.(**string)) = s - case reflect.Uint8: - // exceptional case: []byte - var b []byte - if dv != nil { - db := dv.([]byte) - b = make([]byte, len(db)) - copy(b, db) - } else { - b = []byte{} - } - *(fptr.(*[]byte)) = b - case reflect.Uint32: - u := new(uint32) - if dv != nil { - *u = dv.(uint32) - } - *(fptr.(**uint32)) = u - case reflect.Uint64: - u := new(uint64) - if dv != nil { - *u = dv.(uint64) - } - *(fptr.(**uint64)) = u - default: - log.Printf("proto: can't set default for field %v (sf.kind=%v)", f, sf.kind) - } - } - - for _, ni := range dm.nested { - f := v.Field(ni) - // f is *T or []*T or map[T]*T - switch f.Kind() { - case reflect.Ptr: - if f.IsNil() { - continue - } - setDefaults(f, recur, zeros) - - case reflect.Slice: - for i := 0; i < f.Len(); i++ { - e := f.Index(i) - if e.IsNil() { - continue - } - setDefaults(e, recur, zeros) - } - - case reflect.Map: - for _, k := range f.MapKeys() { - e := f.MapIndex(k) - if e.IsNil() { - continue - } - setDefaults(e, recur, zeros) - } - } - } -} - -var ( - // defaults maps a protocol buffer struct type to a slice of the fields, - // with its scalar fields set to their proto-declared non-zero default values. - defaultMu sync.RWMutex - defaults = make(map[reflect.Type]defaultMessage) - - int32PtrType = reflect.TypeOf((*int32)(nil)) -) - -// defaultMessage represents information about the default values of a message. -type defaultMessage struct { - scalars []scalarField - nested []int // struct field index of nested messages -} - -type scalarField struct { - index int // struct field index - kind reflect.Kind // element type (the T in *T or []T) - value interface{} // the proto-declared default value, or nil -} - -// t is a struct type. -func buildDefaultMessage(t reflect.Type) (dm defaultMessage) { - sprop := GetProperties(t) - for _, prop := range sprop.Prop { - fi, ok := sprop.decoderTags.get(prop.Tag) - if !ok { - // XXX_unrecognized - continue - } - ft := t.Field(fi).Type - - sf, nested, err := fieldDefault(ft, prop) - switch { - case err != nil: - log.Print(err) - case nested: - dm.nested = append(dm.nested, fi) - case sf != nil: - sf.index = fi - dm.scalars = append(dm.scalars, *sf) - } - } - - return dm -} - -// fieldDefault returns the scalarField for field type ft. -// sf will be nil if the field can not have a default. -// nestedMessage will be true if this is a nested message. -// Note that sf.index is not set on return. -func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMessage bool, err error) { - var canHaveDefault bool - switch ft.Kind() { - case reflect.Ptr: - if ft.Elem().Kind() == reflect.Struct { - nestedMessage = true - } else { - canHaveDefault = true // proto2 scalar field - } - - case reflect.Slice: - switch ft.Elem().Kind() { - case reflect.Ptr: - nestedMessage = true // repeated message - case reflect.Uint8: - canHaveDefault = true // bytes field - } - - case reflect.Map: - if ft.Elem().Kind() == reflect.Ptr { - nestedMessage = true // map with message values - } - } - - if !canHaveDefault { - if nestedMessage { - return nil, true, nil - } - return nil, false, nil - } - - // We now know that ft is a pointer or slice. - sf = &scalarField{kind: ft.Elem().Kind()} - - // scalar fields without defaults - if !prop.HasDefault { - return sf, false, nil - } - - // a scalar field: either *T or []byte - switch ft.Elem().Kind() { - case reflect.Bool: - x, err := strconv.ParseBool(prop.Default) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default bool %q: %v", prop.Default, err) - } - sf.value = x - case reflect.Float32: - x, err := strconv.ParseFloat(prop.Default, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default float32 %q: %v", prop.Default, err) - } - sf.value = float32(x) - case reflect.Float64: - x, err := strconv.ParseFloat(prop.Default, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default float64 %q: %v", prop.Default, err) - } - sf.value = x - case reflect.Int32: - x, err := strconv.ParseInt(prop.Default, 10, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default int32 %q: %v", prop.Default, err) - } - sf.value = int32(x) - case reflect.Int64: - x, err := strconv.ParseInt(prop.Default, 10, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default int64 %q: %v", prop.Default, err) - } - sf.value = x - case reflect.String: - sf.value = prop.Default - case reflect.Uint8: - // []byte (not *uint8) - sf.value = []byte(prop.Default) - case reflect.Uint32: - x, err := strconv.ParseUint(prop.Default, 10, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default uint32 %q: %v", prop.Default, err) - } - sf.value = uint32(x) - case reflect.Uint64: - x, err := strconv.ParseUint(prop.Default, 10, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default uint64 %q: %v", prop.Default, err) - } - sf.value = x - default: - return nil, false, fmt.Errorf("proto: unhandled def kind %v", ft.Elem().Kind()) - } - - return sf, false, nil -} - -// Map fields may have key types of non-float scalars, strings and enums. -// The easiest way to sort them in some deterministic order is to use fmt. -// If this turns out to be inefficient we can always consider other options, -// such as doing a Schwartzian transform. - -func mapKeys(vs []reflect.Value) sort.Interface { - s := mapKeySorter{ - vs: vs, - // default Less function: textual comparison - less: func(a, b reflect.Value) bool { - return fmt.Sprint(a.Interface()) < fmt.Sprint(b.Interface()) - }, - } - - // Type specialization per https://developers.google.com/protocol-buffers/docs/proto#maps; - // numeric keys are sorted numerically. - if len(vs) == 0 { - return s - } - switch vs[0].Kind() { - case reflect.Int32, reflect.Int64: - s.less = func(a, b reflect.Value) bool { return a.Int() < b.Int() } - case reflect.Uint32, reflect.Uint64: - s.less = func(a, b reflect.Value) bool { return a.Uint() < b.Uint() } - } - - return s -} - -type mapKeySorter struct { - vs []reflect.Value - less func(a, b reflect.Value) bool -} - -func (s mapKeySorter) Len() int { return len(s.vs) } -func (s mapKeySorter) Swap(i, j int) { s.vs[i], s.vs[j] = s.vs[j], s.vs[i] } -func (s mapKeySorter) Less(i, j int) bool { - return s.less(s.vs[i], s.vs[j]) -} - -// isProto3Zero reports whether v is a zero proto3 value. -func isProto3Zero(v reflect.Value) bool { - switch v.Kind() { - case reflect.Bool: - return !v.Bool() - case reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint32, reflect.Uint64: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.String: - return v.String() == "" - } - return false -} - -// ProtoPackageIsVersion2 is referenced from generated protocol buffer files -// to assert that that code is compatible with this version of the proto package. -const GoGoProtoPackageIsVersion2 = true - -// ProtoPackageIsVersion1 is referenced from generated protocol buffer files -// to assert that that code is compatible with this version of the proto package. -const GoGoProtoPackageIsVersion1 = true diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/lib_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/lib_gogo.go deleted file mode 100644 index 4b4f7c909e6..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/lib_gogo.go +++ /dev/null @@ -1,42 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package proto - -import ( - "encoding/json" - "strconv" -) - -func MarshalJSONEnum(m map[int32]string, value int32) ([]byte, error) { - s, ok := m[value] - if !ok { - s = strconv.Itoa(int(value)) - } - return json.Marshal(s) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/message_set.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/message_set.go deleted file mode 100644 index fd982decd66..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/message_set.go +++ /dev/null @@ -1,311 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -/* - * Support for message sets. - */ - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "reflect" - "sort" -) - -// errNoMessageTypeID occurs when a protocol buffer does not have a message type ID. -// A message type ID is required for storing a protocol buffer in a message set. -var errNoMessageTypeID = errors.New("proto does not have a message type ID") - -// The first two types (_MessageSet_Item and messageSet) -// model what the protocol compiler produces for the following protocol message: -// message MessageSet { -// repeated group Item = 1 { -// required int32 type_id = 2; -// required string message = 3; -// }; -// } -// That is the MessageSet wire format. We can't use a proto to generate these -// because that would introduce a circular dependency between it and this package. - -type _MessageSet_Item struct { - TypeId *int32 `protobuf:"varint,2,req,name=type_id"` - Message []byte `protobuf:"bytes,3,req,name=message"` -} - -type messageSet struct { - Item []*_MessageSet_Item `protobuf:"group,1,rep"` - XXX_unrecognized []byte - // TODO: caching? -} - -// Make sure messageSet is a Message. -var _ Message = (*messageSet)(nil) - -// messageTypeIder is an interface satisfied by a protocol buffer type -// that may be stored in a MessageSet. -type messageTypeIder interface { - MessageTypeId() int32 -} - -func (ms *messageSet) find(pb Message) *_MessageSet_Item { - mti, ok := pb.(messageTypeIder) - if !ok { - return nil - } - id := mti.MessageTypeId() - for _, item := range ms.Item { - if *item.TypeId == id { - return item - } - } - return nil -} - -func (ms *messageSet) Has(pb Message) bool { - if ms.find(pb) != nil { - return true - } - return false -} - -func (ms *messageSet) Unmarshal(pb Message) error { - if item := ms.find(pb); item != nil { - return Unmarshal(item.Message, pb) - } - if _, ok := pb.(messageTypeIder); !ok { - return errNoMessageTypeID - } - return nil // TODO: return error instead? -} - -func (ms *messageSet) Marshal(pb Message) error { - msg, err := Marshal(pb) - if err != nil { - return err - } - if item := ms.find(pb); item != nil { - // reuse existing item - item.Message = msg - return nil - } - - mti, ok := pb.(messageTypeIder) - if !ok { - return errNoMessageTypeID - } - - mtid := mti.MessageTypeId() - ms.Item = append(ms.Item, &_MessageSet_Item{ - TypeId: &mtid, - Message: msg, - }) - return nil -} - -func (ms *messageSet) Reset() { *ms = messageSet{} } -func (ms *messageSet) String() string { return CompactTextString(ms) } -func (*messageSet) ProtoMessage() {} - -// Support for the message_set_wire_format message option. - -func skipVarint(buf []byte) []byte { - i := 0 - for ; buf[i]&0x80 != 0; i++ { - } - return buf[i+1:] -} - -// MarshalMessageSet encodes the extension map represented by m in the message set wire format. -// It is called by generated Marshal methods on protocol buffer messages with the message_set_wire_format option. -func MarshalMessageSet(exts interface{}) ([]byte, error) { - var m map[int32]Extension - switch exts := exts.(type) { - case *XXX_InternalExtensions: - if err := encodeExtensions(exts); err != nil { - return nil, err - } - m, _ = exts.extensionsRead() - case map[int32]Extension: - if err := encodeExtensionsMap(exts); err != nil { - return nil, err - } - m = exts - default: - return nil, errors.New("proto: not an extension map") - } - - // Sort extension IDs to provide a deterministic encoding. - // See also enc_map in encode.go. - ids := make([]int, 0, len(m)) - for id := range m { - ids = append(ids, int(id)) - } - sort.Ints(ids) - - ms := &messageSet{Item: make([]*_MessageSet_Item, 0, len(m))} - for _, id := range ids { - e := m[int32(id)] - // Remove the wire type and field number varint, as well as the length varint. - msg := skipVarint(skipVarint(e.enc)) - - ms.Item = append(ms.Item, &_MessageSet_Item{ - TypeId: Int32(int32(id)), - Message: msg, - }) - } - return Marshal(ms) -} - -// UnmarshalMessageSet decodes the extension map encoded in buf in the message set wire format. -// It is called by generated Unmarshal methods on protocol buffer messages with the message_set_wire_format option. -func UnmarshalMessageSet(buf []byte, exts interface{}) error { - var m map[int32]Extension - switch exts := exts.(type) { - case *XXX_InternalExtensions: - m = exts.extensionsWrite() - case map[int32]Extension: - m = exts - default: - return errors.New("proto: not an extension map") - } - - ms := new(messageSet) - if err := Unmarshal(buf, ms); err != nil { - return err - } - for _, item := range ms.Item { - id := *item.TypeId - msg := item.Message - - // Restore wire type and field number varint, plus length varint. - // Be careful to preserve duplicate items. - b := EncodeVarint(uint64(id)<<3 | WireBytes) - if ext, ok := m[id]; ok { - // Existing data; rip off the tag and length varint - // so we join the new data correctly. - // We can assume that ext.enc is set because we are unmarshaling. - o := ext.enc[len(b):] // skip wire type and field number - _, n := DecodeVarint(o) // calculate length of length varint - o = o[n:] // skip length varint - msg = append(o, msg...) // join old data and new data - } - b = append(b, EncodeVarint(uint64(len(msg)))...) - b = append(b, msg...) - - m[id] = Extension{enc: b} - } - return nil -} - -// MarshalMessageSetJSON encodes the extension map represented by m in JSON format. -// It is called by generated MarshalJSON methods on protocol buffer messages with the message_set_wire_format option. -func MarshalMessageSetJSON(exts interface{}) ([]byte, error) { - var m map[int32]Extension - switch exts := exts.(type) { - case *XXX_InternalExtensions: - m, _ = exts.extensionsRead() - case map[int32]Extension: - m = exts - default: - return nil, errors.New("proto: not an extension map") - } - var b bytes.Buffer - b.WriteByte('{') - - // Process the map in key order for deterministic output. - ids := make([]int32, 0, len(m)) - for id := range m { - ids = append(ids, id) - } - sort.Sort(int32Slice(ids)) // int32Slice defined in text.go - - for i, id := range ids { - ext := m[id] - if i > 0 { - b.WriteByte(',') - } - - msd, ok := messageSetMap[id] - if !ok { - // Unknown type; we can't render it, so skip it. - continue - } - fmt.Fprintf(&b, `"[%s]":`, msd.name) - - x := ext.value - if x == nil { - x = reflect.New(msd.t.Elem()).Interface() - if err := Unmarshal(ext.enc, x.(Message)); err != nil { - return nil, err - } - } - d, err := json.Marshal(x) - if err != nil { - return nil, err - } - b.Write(d) - } - b.WriteByte('}') - return b.Bytes(), nil -} - -// UnmarshalMessageSetJSON decodes the extension map encoded in buf in JSON format. -// It is called by generated UnmarshalJSON methods on protocol buffer messages with the message_set_wire_format option. -func UnmarshalMessageSetJSON(buf []byte, exts interface{}) error { - // Common-case fast path. - if len(buf) == 0 || bytes.Equal(buf, []byte("{}")) { - return nil - } - - // This is fairly tricky, and it's not clear that it is needed. - return errors.New("TODO: UnmarshalMessageSetJSON not yet implemented") -} - -// A global registry of types that can be used in a MessageSet. - -var messageSetMap = make(map[int32]messageSetDesc) - -type messageSetDesc struct { - t reflect.Type // pointer to struct - name string -} - -// RegisterMessageSetType is called from the generated code. -func RegisterMessageSetType(m Message, fieldNum int32, name string) { - messageSetMap[fieldNum] = messageSetDesc{ - t: reflect.TypeOf(m), - name: name, - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_reflect.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_reflect.go deleted file mode 100644 index fb512e2e16d..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_reflect.go +++ /dev/null @@ -1,484 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2012 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -// +build appengine js - -// This file contains an implementation of proto field accesses using package reflect. -// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can -// be used on App Engine. - -package proto - -import ( - "math" - "reflect" -) - -// A structPointer is a pointer to a struct. -type structPointer struct { - v reflect.Value -} - -// toStructPointer returns a structPointer equivalent to the given reflect value. -// The reflect value must itself be a pointer to a struct. -func toStructPointer(v reflect.Value) structPointer { - return structPointer{v} -} - -// IsNil reports whether p is nil. -func structPointer_IsNil(p structPointer) bool { - return p.v.IsNil() -} - -// Interface returns the struct pointer as an interface value. -func structPointer_Interface(p structPointer, _ reflect.Type) interface{} { - return p.v.Interface() -} - -// A field identifies a field in a struct, accessible from a structPointer. -// In this implementation, a field is identified by the sequence of field indices -// passed to reflect's FieldByIndex. -type field []int - -// toField returns a field equivalent to the given reflect field. -func toField(f *reflect.StructField) field { - return f.Index -} - -// invalidField is an invalid field identifier. -var invalidField = field(nil) - -// IsValid reports whether the field identifier is valid. -func (f field) IsValid() bool { return f != nil } - -// field returns the given field in the struct as a reflect value. -func structPointer_field(p structPointer, f field) reflect.Value { - // Special case: an extension map entry with a value of type T - // passes a *T to the struct-handling code with a zero field, - // expecting that it will be treated as equivalent to *struct{ X T }, - // which has the same memory layout. We have to handle that case - // specially, because reflect will panic if we call FieldByIndex on a - // non-struct. - if f == nil { - return p.v.Elem() - } - - return p.v.Elem().FieldByIndex(f) -} - -// ifield returns the given field in the struct as an interface value. -func structPointer_ifield(p structPointer, f field) interface{} { - return structPointer_field(p, f).Addr().Interface() -} - -// Bytes returns the address of a []byte field in the struct. -func structPointer_Bytes(p structPointer, f field) *[]byte { - return structPointer_ifield(p, f).(*[]byte) -} - -// BytesSlice returns the address of a [][]byte field in the struct. -func structPointer_BytesSlice(p structPointer, f field) *[][]byte { - return structPointer_ifield(p, f).(*[][]byte) -} - -// Bool returns the address of a *bool field in the struct. -func structPointer_Bool(p structPointer, f field) **bool { - return structPointer_ifield(p, f).(**bool) -} - -// BoolVal returns the address of a bool field in the struct. -func structPointer_BoolVal(p structPointer, f field) *bool { - return structPointer_ifield(p, f).(*bool) -} - -// BoolSlice returns the address of a []bool field in the struct. -func structPointer_BoolSlice(p structPointer, f field) *[]bool { - return structPointer_ifield(p, f).(*[]bool) -} - -// String returns the address of a *string field in the struct. -func structPointer_String(p structPointer, f field) **string { - return structPointer_ifield(p, f).(**string) -} - -// StringVal returns the address of a string field in the struct. -func structPointer_StringVal(p structPointer, f field) *string { - return structPointer_ifield(p, f).(*string) -} - -// StringSlice returns the address of a []string field in the struct. -func structPointer_StringSlice(p structPointer, f field) *[]string { - return structPointer_ifield(p, f).(*[]string) -} - -// Extensions returns the address of an extension map field in the struct. -func structPointer_Extensions(p structPointer, f field) *XXX_InternalExtensions { - return structPointer_ifield(p, f).(*XXX_InternalExtensions) -} - -// ExtMap returns the address of an extension map field in the struct. -func structPointer_ExtMap(p structPointer, f field) *map[int32]Extension { - return structPointer_ifield(p, f).(*map[int32]Extension) -} - -// NewAt returns the reflect.Value for a pointer to a field in the struct. -func structPointer_NewAt(p structPointer, f field, typ reflect.Type) reflect.Value { - return structPointer_field(p, f).Addr() -} - -// SetStructPointer writes a *struct field in the struct. -func structPointer_SetStructPointer(p structPointer, f field, q structPointer) { - structPointer_field(p, f).Set(q.v) -} - -// GetStructPointer reads a *struct field in the struct. -func structPointer_GetStructPointer(p structPointer, f field) structPointer { - return structPointer{structPointer_field(p, f)} -} - -// StructPointerSlice the address of a []*struct field in the struct. -func structPointer_StructPointerSlice(p structPointer, f field) structPointerSlice { - return structPointerSlice{structPointer_field(p, f)} -} - -// A structPointerSlice represents the address of a slice of pointers to structs -// (themselves messages or groups). That is, v.Type() is *[]*struct{...}. -type structPointerSlice struct { - v reflect.Value -} - -func (p structPointerSlice) Len() int { return p.v.Len() } -func (p structPointerSlice) Index(i int) structPointer { return structPointer{p.v.Index(i)} } -func (p structPointerSlice) Append(q structPointer) { - p.v.Set(reflect.Append(p.v, q.v)) -} - -var ( - int32Type = reflect.TypeOf(int32(0)) - uint32Type = reflect.TypeOf(uint32(0)) - float32Type = reflect.TypeOf(float32(0)) - int64Type = reflect.TypeOf(int64(0)) - uint64Type = reflect.TypeOf(uint64(0)) - float64Type = reflect.TypeOf(float64(0)) -) - -// A word32 represents a field of type *int32, *uint32, *float32, or *enum. -// That is, v.Type() is *int32, *uint32, *float32, or *enum and v is assignable. -type word32 struct { - v reflect.Value -} - -// IsNil reports whether p is nil. -func word32_IsNil(p word32) bool { - return p.v.IsNil() -} - -// Set sets p to point at a newly allocated word with bits set to x. -func word32_Set(p word32, o *Buffer, x uint32) { - t := p.v.Type().Elem() - switch t { - case int32Type: - if len(o.int32s) == 0 { - o.int32s = make([]int32, uint32PoolSize) - } - o.int32s[0] = int32(x) - p.v.Set(reflect.ValueOf(&o.int32s[0])) - o.int32s = o.int32s[1:] - return - case uint32Type: - if len(o.uint32s) == 0 { - o.uint32s = make([]uint32, uint32PoolSize) - } - o.uint32s[0] = x - p.v.Set(reflect.ValueOf(&o.uint32s[0])) - o.uint32s = o.uint32s[1:] - return - case float32Type: - if len(o.float32s) == 0 { - o.float32s = make([]float32, uint32PoolSize) - } - o.float32s[0] = math.Float32frombits(x) - p.v.Set(reflect.ValueOf(&o.float32s[0])) - o.float32s = o.float32s[1:] - return - } - - // must be enum - p.v.Set(reflect.New(t)) - p.v.Elem().SetInt(int64(int32(x))) -} - -// Get gets the bits pointed at by p, as a uint32. -func word32_Get(p word32) uint32 { - elem := p.v.Elem() - switch elem.Kind() { - case reflect.Int32: - return uint32(elem.Int()) - case reflect.Uint32: - return uint32(elem.Uint()) - case reflect.Float32: - return math.Float32bits(float32(elem.Float())) - } - panic("unreachable") -} - -// Word32 returns a reference to a *int32, *uint32, *float32, or *enum field in the struct. -func structPointer_Word32(p structPointer, f field) word32 { - return word32{structPointer_field(p, f)} -} - -// A word32Val represents a field of type int32, uint32, float32, or enum. -// That is, v.Type() is int32, uint32, float32, or enum and v is assignable. -type word32Val struct { - v reflect.Value -} - -// Set sets *p to x. -func word32Val_Set(p word32Val, x uint32) { - switch p.v.Type() { - case int32Type: - p.v.SetInt(int64(x)) - return - case uint32Type: - p.v.SetUint(uint64(x)) - return - case float32Type: - p.v.SetFloat(float64(math.Float32frombits(x))) - return - } - - // must be enum - p.v.SetInt(int64(int32(x))) -} - -// Get gets the bits pointed at by p, as a uint32. -func word32Val_Get(p word32Val) uint32 { - elem := p.v - switch elem.Kind() { - case reflect.Int32: - return uint32(elem.Int()) - case reflect.Uint32: - return uint32(elem.Uint()) - case reflect.Float32: - return math.Float32bits(float32(elem.Float())) - } - panic("unreachable") -} - -// Word32Val returns a reference to a int32, uint32, float32, or enum field in the struct. -func structPointer_Word32Val(p structPointer, f field) word32Val { - return word32Val{structPointer_field(p, f)} -} - -// A word32Slice is a slice of 32-bit values. -// That is, v.Type() is []int32, []uint32, []float32, or []enum. -type word32Slice struct { - v reflect.Value -} - -func (p word32Slice) Append(x uint32) { - n, m := p.v.Len(), p.v.Cap() - if n < m { - p.v.SetLen(n + 1) - } else { - t := p.v.Type().Elem() - p.v.Set(reflect.Append(p.v, reflect.Zero(t))) - } - elem := p.v.Index(n) - switch elem.Kind() { - case reflect.Int32: - elem.SetInt(int64(int32(x))) - case reflect.Uint32: - elem.SetUint(uint64(x)) - case reflect.Float32: - elem.SetFloat(float64(math.Float32frombits(x))) - } -} - -func (p word32Slice) Len() int { - return p.v.Len() -} - -func (p word32Slice) Index(i int) uint32 { - elem := p.v.Index(i) - switch elem.Kind() { - case reflect.Int32: - return uint32(elem.Int()) - case reflect.Uint32: - return uint32(elem.Uint()) - case reflect.Float32: - return math.Float32bits(float32(elem.Float())) - } - panic("unreachable") -} - -// Word32Slice returns a reference to a []int32, []uint32, []float32, or []enum field in the struct. -func structPointer_Word32Slice(p structPointer, f field) word32Slice { - return word32Slice{structPointer_field(p, f)} -} - -// word64 is like word32 but for 64-bit values. -type word64 struct { - v reflect.Value -} - -func word64_Set(p word64, o *Buffer, x uint64) { - t := p.v.Type().Elem() - switch t { - case int64Type: - if len(o.int64s) == 0 { - o.int64s = make([]int64, uint64PoolSize) - } - o.int64s[0] = int64(x) - p.v.Set(reflect.ValueOf(&o.int64s[0])) - o.int64s = o.int64s[1:] - return - case uint64Type: - if len(o.uint64s) == 0 { - o.uint64s = make([]uint64, uint64PoolSize) - } - o.uint64s[0] = x - p.v.Set(reflect.ValueOf(&o.uint64s[0])) - o.uint64s = o.uint64s[1:] - return - case float64Type: - if len(o.float64s) == 0 { - o.float64s = make([]float64, uint64PoolSize) - } - o.float64s[0] = math.Float64frombits(x) - p.v.Set(reflect.ValueOf(&o.float64s[0])) - o.float64s = o.float64s[1:] - return - } - panic("unreachable") -} - -func word64_IsNil(p word64) bool { - return p.v.IsNil() -} - -func word64_Get(p word64) uint64 { - elem := p.v.Elem() - switch elem.Kind() { - case reflect.Int64: - return uint64(elem.Int()) - case reflect.Uint64: - return elem.Uint() - case reflect.Float64: - return math.Float64bits(elem.Float()) - } - panic("unreachable") -} - -func structPointer_Word64(p structPointer, f field) word64 { - return word64{structPointer_field(p, f)} -} - -// word64Val is like word32Val but for 64-bit values. -type word64Val struct { - v reflect.Value -} - -func word64Val_Set(p word64Val, o *Buffer, x uint64) { - switch p.v.Type() { - case int64Type: - p.v.SetInt(int64(x)) - return - case uint64Type: - p.v.SetUint(x) - return - case float64Type: - p.v.SetFloat(math.Float64frombits(x)) - return - } - panic("unreachable") -} - -func word64Val_Get(p word64Val) uint64 { - elem := p.v - switch elem.Kind() { - case reflect.Int64: - return uint64(elem.Int()) - case reflect.Uint64: - return elem.Uint() - case reflect.Float64: - return math.Float64bits(elem.Float()) - } - panic("unreachable") -} - -func structPointer_Word64Val(p structPointer, f field) word64Val { - return word64Val{structPointer_field(p, f)} -} - -type word64Slice struct { - v reflect.Value -} - -func (p word64Slice) Append(x uint64) { - n, m := p.v.Len(), p.v.Cap() - if n < m { - p.v.SetLen(n + 1) - } else { - t := p.v.Type().Elem() - p.v.Set(reflect.Append(p.v, reflect.Zero(t))) - } - elem := p.v.Index(n) - switch elem.Kind() { - case reflect.Int64: - elem.SetInt(int64(int64(x))) - case reflect.Uint64: - elem.SetUint(uint64(x)) - case reflect.Float64: - elem.SetFloat(float64(math.Float64frombits(x))) - } -} - -func (p word64Slice) Len() int { - return p.v.Len() -} - -func (p word64Slice) Index(i int) uint64 { - elem := p.v.Index(i) - switch elem.Kind() { - case reflect.Int64: - return uint64(elem.Int()) - case reflect.Uint64: - return uint64(elem.Uint()) - case reflect.Float64: - return math.Float64bits(float64(elem.Float())) - } - panic("unreachable") -} - -func structPointer_Word64Slice(p structPointer, f field) word64Slice { - return word64Slice{structPointer_field(p, f)} -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go deleted file mode 100644 index 1763a5f227a..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go +++ /dev/null @@ -1,85 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2016, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -// +build appengine js - -package proto - -import ( - "reflect" -) - -func structPointer_FieldPointer(p structPointer, f field) structPointer { - panic("not implemented") -} - -func appendStructPointer(base structPointer, f field, typ reflect.Type) structPointer { - panic("not implemented") -} - -func structPointer_InterfaceAt(p structPointer, f field, t reflect.Type) interface{} { - panic("not implemented") -} - -func structPointer_InterfaceRef(p structPointer, f field, t reflect.Type) interface{} { - panic("not implemented") -} - -func structPointer_GetRefStructPointer(p structPointer, f field) structPointer { - panic("not implemented") -} - -func structPointer_Add(p structPointer, size field) structPointer { - panic("not implemented") -} - -func structPointer_Len(p structPointer, f field) int { - panic("not implemented") -} - -func structPointer_GetSliceHeader(p structPointer, f field) *reflect.SliceHeader { - panic("not implemented") -} - -func structPointer_Copy(oldptr structPointer, newptr structPointer, size int) { - panic("not implemented") -} - -func structPointer_StructRefSlice(p structPointer, f field, size uintptr) *structRefSlice { - panic("not implemented") -} - -type structRefSlice struct{} - -func (v *structRefSlice) Len() int { - panic("not implemented") -} - -func (v *structRefSlice) Index(i int) structPointer { - panic("not implemented") -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_unsafe.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_unsafe.go deleted file mode 100644 index 6b5567d47cd..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_unsafe.go +++ /dev/null @@ -1,270 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2012 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -// +build !appengine,!js - -// This file contains the implementation of the proto field accesses using package unsafe. - -package proto - -import ( - "reflect" - "unsafe" -) - -// NOTE: These type_Foo functions would more idiomatically be methods, -// but Go does not allow methods on pointer types, and we must preserve -// some pointer type for the garbage collector. We use these -// funcs with clunky names as our poor approximation to methods. -// -// An alternative would be -// type structPointer struct { p unsafe.Pointer } -// but that does not registerize as well. - -// A structPointer is a pointer to a struct. -type structPointer unsafe.Pointer - -// toStructPointer returns a structPointer equivalent to the given reflect value. -func toStructPointer(v reflect.Value) structPointer { - return structPointer(unsafe.Pointer(v.Pointer())) -} - -// IsNil reports whether p is nil. -func structPointer_IsNil(p structPointer) bool { - return p == nil -} - -// Interface returns the struct pointer, assumed to have element type t, -// as an interface value. -func structPointer_Interface(p structPointer, t reflect.Type) interface{} { - return reflect.NewAt(t, unsafe.Pointer(p)).Interface() -} - -// A field identifies a field in a struct, accessible from a structPointer. -// In this implementation, a field is identified by its byte offset from the start of the struct. -type field uintptr - -// toField returns a field equivalent to the given reflect field. -func toField(f *reflect.StructField) field { - return field(f.Offset) -} - -// invalidField is an invalid field identifier. -const invalidField = ^field(0) - -// IsValid reports whether the field identifier is valid. -func (f field) IsValid() bool { - return f != ^field(0) -} - -// Bytes returns the address of a []byte field in the struct. -func structPointer_Bytes(p structPointer, f field) *[]byte { - return (*[]byte)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// BytesSlice returns the address of a [][]byte field in the struct. -func structPointer_BytesSlice(p structPointer, f field) *[][]byte { - return (*[][]byte)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// Bool returns the address of a *bool field in the struct. -func structPointer_Bool(p structPointer, f field) **bool { - return (**bool)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// BoolVal returns the address of a bool field in the struct. -func structPointer_BoolVal(p structPointer, f field) *bool { - return (*bool)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// BoolSlice returns the address of a []bool field in the struct. -func structPointer_BoolSlice(p structPointer, f field) *[]bool { - return (*[]bool)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// String returns the address of a *string field in the struct. -func structPointer_String(p structPointer, f field) **string { - return (**string)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// StringVal returns the address of a string field in the struct. -func structPointer_StringVal(p structPointer, f field) *string { - return (*string)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// StringSlice returns the address of a []string field in the struct. -func structPointer_StringSlice(p structPointer, f field) *[]string { - return (*[]string)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// ExtMap returns the address of an extension map field in the struct. -func structPointer_Extensions(p structPointer, f field) *XXX_InternalExtensions { - return (*XXX_InternalExtensions)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -func structPointer_ExtMap(p structPointer, f field) *map[int32]Extension { - return (*map[int32]Extension)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// NewAt returns the reflect.Value for a pointer to a field in the struct. -func structPointer_NewAt(p structPointer, f field, typ reflect.Type) reflect.Value { - return reflect.NewAt(typ, unsafe.Pointer(uintptr(p)+uintptr(f))) -} - -// SetStructPointer writes a *struct field in the struct. -func structPointer_SetStructPointer(p structPointer, f field, q structPointer) { - *(*structPointer)(unsafe.Pointer(uintptr(p) + uintptr(f))) = q -} - -// GetStructPointer reads a *struct field in the struct. -func structPointer_GetStructPointer(p structPointer, f field) structPointer { - return *(*structPointer)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// StructPointerSlice the address of a []*struct field in the struct. -func structPointer_StructPointerSlice(p structPointer, f field) *structPointerSlice { - return (*structPointerSlice)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// A structPointerSlice represents a slice of pointers to structs (themselves submessages or groups). -type structPointerSlice []structPointer - -func (v *structPointerSlice) Len() int { return len(*v) } -func (v *structPointerSlice) Index(i int) structPointer { return (*v)[i] } -func (v *structPointerSlice) Append(p structPointer) { *v = append(*v, p) } - -// A word32 is the address of a "pointer to 32-bit value" field. -type word32 **uint32 - -// IsNil reports whether *v is nil. -func word32_IsNil(p word32) bool { - return *p == nil -} - -// Set sets *v to point at a newly allocated word set to x. -func word32_Set(p word32, o *Buffer, x uint32) { - if len(o.uint32s) == 0 { - o.uint32s = make([]uint32, uint32PoolSize) - } - o.uint32s[0] = x - *p = &o.uint32s[0] - o.uint32s = o.uint32s[1:] -} - -// Get gets the value pointed at by *v. -func word32_Get(p word32) uint32 { - return **p -} - -// Word32 returns the address of a *int32, *uint32, *float32, or *enum field in the struct. -func structPointer_Word32(p structPointer, f field) word32 { - return word32((**uint32)(unsafe.Pointer(uintptr(p) + uintptr(f)))) -} - -// A word32Val is the address of a 32-bit value field. -type word32Val *uint32 - -// Set sets *p to x. -func word32Val_Set(p word32Val, x uint32) { - *p = x -} - -// Get gets the value pointed at by p. -func word32Val_Get(p word32Val) uint32 { - return *p -} - -// Word32Val returns the address of a *int32, *uint32, *float32, or *enum field in the struct. -func structPointer_Word32Val(p structPointer, f field) word32Val { - return word32Val((*uint32)(unsafe.Pointer(uintptr(p) + uintptr(f)))) -} - -// A word32Slice is a slice of 32-bit values. -type word32Slice []uint32 - -func (v *word32Slice) Append(x uint32) { *v = append(*v, x) } -func (v *word32Slice) Len() int { return len(*v) } -func (v *word32Slice) Index(i int) uint32 { return (*v)[i] } - -// Word32Slice returns the address of a []int32, []uint32, []float32, or []enum field in the struct. -func structPointer_Word32Slice(p structPointer, f field) *word32Slice { - return (*word32Slice)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// word64 is like word32 but for 64-bit values. -type word64 **uint64 - -func word64_Set(p word64, o *Buffer, x uint64) { - if len(o.uint64s) == 0 { - o.uint64s = make([]uint64, uint64PoolSize) - } - o.uint64s[0] = x - *p = &o.uint64s[0] - o.uint64s = o.uint64s[1:] -} - -func word64_IsNil(p word64) bool { - return *p == nil -} - -func word64_Get(p word64) uint64 { - return **p -} - -func structPointer_Word64(p structPointer, f field) word64 { - return word64((**uint64)(unsafe.Pointer(uintptr(p) + uintptr(f)))) -} - -// word64Val is like word32Val but for 64-bit values. -type word64Val *uint64 - -func word64Val_Set(p word64Val, o *Buffer, x uint64) { - *p = x -} - -func word64Val_Get(p word64Val) uint64 { - return *p -} - -func structPointer_Word64Val(p structPointer, f field) word64Val { - return word64Val((*uint64)(unsafe.Pointer(uintptr(p) + uintptr(f)))) -} - -// word64Slice is like word32Slice but for 64-bit values. -type word64Slice []uint64 - -func (v *word64Slice) Append(x uint64) { *v = append(*v, x) } -func (v *word64Slice) Len() int { return len(*v) } -func (v *word64Slice) Index(i int) uint64 { return (*v)[i] } - -func structPointer_Word64Slice(p structPointer, f field) *word64Slice { - return (*word64Slice)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go deleted file mode 100644 index f156a29f0e8..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go +++ /dev/null @@ -1,128 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -// +build !appengine,!js - -// This file contains the implementation of the proto field accesses using package unsafe. - -package proto - -import ( - "reflect" - "unsafe" -) - -func structPointer_InterfaceAt(p structPointer, f field, t reflect.Type) interface{} { - point := unsafe.Pointer(uintptr(p) + uintptr(f)) - r := reflect.NewAt(t, point) - return r.Interface() -} - -func structPointer_InterfaceRef(p structPointer, f field, t reflect.Type) interface{} { - point := unsafe.Pointer(uintptr(p) + uintptr(f)) - r := reflect.NewAt(t, point) - if r.Elem().IsNil() { - return nil - } - return r.Elem().Interface() -} - -func copyUintPtr(oldptr, newptr uintptr, size int) { - oldbytes := make([]byte, 0) - oldslice := (*reflect.SliceHeader)(unsafe.Pointer(&oldbytes)) - oldslice.Data = oldptr - oldslice.Len = size - oldslice.Cap = size - newbytes := make([]byte, 0) - newslice := (*reflect.SliceHeader)(unsafe.Pointer(&newbytes)) - newslice.Data = newptr - newslice.Len = size - newslice.Cap = size - copy(newbytes, oldbytes) -} - -func structPointer_Copy(oldptr structPointer, newptr structPointer, size int) { - copyUintPtr(uintptr(oldptr), uintptr(newptr), size) -} - -func appendStructPointer(base structPointer, f field, typ reflect.Type) structPointer { - size := typ.Elem().Size() - - oldHeader := structPointer_GetSliceHeader(base, f) - oldSlice := reflect.NewAt(typ, unsafe.Pointer(oldHeader)).Elem() - newLen := oldHeader.Len + 1 - newSlice := reflect.MakeSlice(typ, newLen, newLen) - reflect.Copy(newSlice, oldSlice) - bas := toStructPointer(newSlice) - oldHeader.Data = uintptr(bas) - oldHeader.Len = newLen - oldHeader.Cap = newLen - - return structPointer(unsafe.Pointer(uintptr(unsafe.Pointer(bas)) + uintptr(uintptr(newLen-1)*size))) -} - -func structPointer_FieldPointer(p structPointer, f field) structPointer { - return structPointer(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -func structPointer_GetRefStructPointer(p structPointer, f field) structPointer { - return structPointer((*structPointer)(unsafe.Pointer(uintptr(p) + uintptr(f)))) -} - -func structPointer_GetSliceHeader(p structPointer, f field) *reflect.SliceHeader { - return (*reflect.SliceHeader)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -func structPointer_Add(p structPointer, size field) structPointer { - return structPointer(unsafe.Pointer(uintptr(p) + uintptr(size))) -} - -func structPointer_Len(p structPointer, f field) int { - return len(*(*[]interface{})(unsafe.Pointer(structPointer_GetRefStructPointer(p, f)))) -} - -func structPointer_StructRefSlice(p structPointer, f field, size uintptr) *structRefSlice { - return &structRefSlice{p: p, f: f, size: size} -} - -// A structRefSlice represents a slice of structs (themselves submessages or groups). -type structRefSlice struct { - p structPointer - f field - size uintptr -} - -func (v *structRefSlice) Len() int { - return structPointer_Len(v.p, v.f) -} - -func (v *structRefSlice) Index(i int) structPointer { - ss := structPointer_GetStructPointer(v.p, v.f) - ss1 := structPointer_GetRefStructPointer(ss, 0) - return structPointer_Add(ss1, field(uintptr(i)*v.size)) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/properties.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/properties.go deleted file mode 100644 index 44b332052ef..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/properties.go +++ /dev/null @@ -1,968 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -/* - * Routines for encoding data into the wire format for protocol buffers. - */ - -import ( - "fmt" - "log" - "os" - "reflect" - "sort" - "strconv" - "strings" - "sync" -) - -const debug bool = false - -// Constants that identify the encoding of a value on the wire. -const ( - WireVarint = 0 - WireFixed64 = 1 - WireBytes = 2 - WireStartGroup = 3 - WireEndGroup = 4 - WireFixed32 = 5 -) - -const startSize = 10 // initial slice/string sizes - -// Encoders are defined in encode.go -// An encoder outputs the full representation of a field, including its -// tag and encoder type. -type encoder func(p *Buffer, prop *Properties, base structPointer) error - -// A valueEncoder encodes a single integer in a particular encoding. -type valueEncoder func(o *Buffer, x uint64) error - -// Sizers are defined in encode.go -// A sizer returns the encoded size of a field, including its tag and encoder -// type. -type sizer func(prop *Properties, base structPointer) int - -// A valueSizer returns the encoded size of a single integer in a particular -// encoding. -type valueSizer func(x uint64) int - -// Decoders are defined in decode.go -// A decoder creates a value from its wire representation. -// Unrecognized subelements are saved in unrec. -type decoder func(p *Buffer, prop *Properties, base structPointer) error - -// A valueDecoder decodes a single integer in a particular encoding. -type valueDecoder func(o *Buffer) (x uint64, err error) - -// A oneofMarshaler does the marshaling for all oneof fields in a message. -type oneofMarshaler func(Message, *Buffer) error - -// A oneofUnmarshaler does the unmarshaling for a oneof field in a message. -type oneofUnmarshaler func(Message, int, int, *Buffer) (bool, error) - -// A oneofSizer does the sizing for all oneof fields in a message. -type oneofSizer func(Message) int - -// tagMap is an optimization over map[int]int for typical protocol buffer -// use-cases. Encoded protocol buffers are often in tag order with small tag -// numbers. -type tagMap struct { - fastTags []int - slowTags map[int]int -} - -// tagMapFastLimit is the upper bound on the tag number that will be stored in -// the tagMap slice rather than its map. -const tagMapFastLimit = 1024 - -func (p *tagMap) get(t int) (int, bool) { - if t > 0 && t < tagMapFastLimit { - if t >= len(p.fastTags) { - return 0, false - } - fi := p.fastTags[t] - return fi, fi >= 0 - } - fi, ok := p.slowTags[t] - return fi, ok -} - -func (p *tagMap) put(t int, fi int) { - if t > 0 && t < tagMapFastLimit { - for len(p.fastTags) < t+1 { - p.fastTags = append(p.fastTags, -1) - } - p.fastTags[t] = fi - return - } - if p.slowTags == nil { - p.slowTags = make(map[int]int) - } - p.slowTags[t] = fi -} - -// StructProperties represents properties for all the fields of a struct. -// decoderTags and decoderOrigNames should only be used by the decoder. -type StructProperties struct { - Prop []*Properties // properties for each field - reqCount int // required count - decoderTags tagMap // map from proto tag to struct field number - decoderOrigNames map[string]int // map from original name to struct field number - order []int // list of struct field numbers in tag order - unrecField field // field id of the XXX_unrecognized []byte field - extendable bool // is this an extendable proto - - oneofMarshaler oneofMarshaler - oneofUnmarshaler oneofUnmarshaler - oneofSizer oneofSizer - stype reflect.Type - - // OneofTypes contains information about the oneof fields in this message. - // It is keyed by the original name of a field. - OneofTypes map[string]*OneofProperties -} - -// OneofProperties represents information about a specific field in a oneof. -type OneofProperties struct { - Type reflect.Type // pointer to generated struct type for this oneof field - Field int // struct field number of the containing oneof in the message - Prop *Properties -} - -// Implement the sorting interface so we can sort the fields in tag order, as recommended by the spec. -// See encode.go, (*Buffer).enc_struct. - -func (sp *StructProperties) Len() int { return len(sp.order) } -func (sp *StructProperties) Less(i, j int) bool { - return sp.Prop[sp.order[i]].Tag < sp.Prop[sp.order[j]].Tag -} -func (sp *StructProperties) Swap(i, j int) { sp.order[i], sp.order[j] = sp.order[j], sp.order[i] } - -// Properties represents the protocol-specific behavior of a single struct field. -type Properties struct { - Name string // name of the field, for error messages - OrigName string // original name before protocol compiler (always set) - JSONName string // name to use for JSON; determined by protoc - Wire string - WireType int - Tag int - Required bool - Optional bool - Repeated bool - Packed bool // relevant for repeated primitives only - Enum string // set for enum types only - proto3 bool // whether this is known to be a proto3 field; set for []byte only - oneof bool // whether this is a oneof field - - Default string // default value - HasDefault bool // whether an explicit default was provided - CustomType string - StdTime bool - StdDuration bool - - enc encoder - valEnc valueEncoder // set for bool and numeric types only - field field - tagcode []byte // encoding of EncodeVarint((Tag<<3)|WireType) - tagbuf [8]byte - stype reflect.Type // set for struct types only - sstype reflect.Type // set for slices of structs types only - ctype reflect.Type // set for custom types only - sprop *StructProperties // set for struct types only - isMarshaler bool - isUnmarshaler bool - - mtype reflect.Type // set for map types only - mkeyprop *Properties // set for map types only - mvalprop *Properties // set for map types only - - size sizer - valSize valueSizer // set for bool and numeric types only - - dec decoder - valDec valueDecoder // set for bool and numeric types only - - // If this is a packable field, this will be the decoder for the packed version of the field. - packedDec decoder -} - -// String formats the properties in the protobuf struct field tag style. -func (p *Properties) String() string { - s := p.Wire - s = "," - s += strconv.Itoa(p.Tag) - if p.Required { - s += ",req" - } - if p.Optional { - s += ",opt" - } - if p.Repeated { - s += ",rep" - } - if p.Packed { - s += ",packed" - } - s += ",name=" + p.OrigName - if p.JSONName != p.OrigName { - s += ",json=" + p.JSONName - } - if p.proto3 { - s += ",proto3" - } - if p.oneof { - s += ",oneof" - } - if len(p.Enum) > 0 { - s += ",enum=" + p.Enum - } - if p.HasDefault { - s += ",def=" + p.Default - } - return s -} - -// Parse populates p by parsing a string in the protobuf struct field tag style. -func (p *Properties) Parse(s string) { - // "bytes,49,opt,name=foo,def=hello!" - fields := strings.Split(s, ",") // breaks def=, but handled below. - if len(fields) < 2 { - fmt.Fprintf(os.Stderr, "proto: tag has too few fields: %q\n", s) - return - } - - p.Wire = fields[0] - switch p.Wire { - case "varint": - p.WireType = WireVarint - p.valEnc = (*Buffer).EncodeVarint - p.valDec = (*Buffer).DecodeVarint - p.valSize = sizeVarint - case "fixed32": - p.WireType = WireFixed32 - p.valEnc = (*Buffer).EncodeFixed32 - p.valDec = (*Buffer).DecodeFixed32 - p.valSize = sizeFixed32 - case "fixed64": - p.WireType = WireFixed64 - p.valEnc = (*Buffer).EncodeFixed64 - p.valDec = (*Buffer).DecodeFixed64 - p.valSize = sizeFixed64 - case "zigzag32": - p.WireType = WireVarint - p.valEnc = (*Buffer).EncodeZigzag32 - p.valDec = (*Buffer).DecodeZigzag32 - p.valSize = sizeZigzag32 - case "zigzag64": - p.WireType = WireVarint - p.valEnc = (*Buffer).EncodeZigzag64 - p.valDec = (*Buffer).DecodeZigzag64 - p.valSize = sizeZigzag64 - case "bytes", "group": - p.WireType = WireBytes - // no numeric converter for non-numeric types - default: - fmt.Fprintf(os.Stderr, "proto: tag has unknown wire type: %q\n", s) - return - } - - var err error - p.Tag, err = strconv.Atoi(fields[1]) - if err != nil { - return - } - - for i := 2; i < len(fields); i++ { - f := fields[i] - switch { - case f == "req": - p.Required = true - case f == "opt": - p.Optional = true - case f == "rep": - p.Repeated = true - case f == "packed": - p.Packed = true - case strings.HasPrefix(f, "name="): - p.OrigName = f[5:] - case strings.HasPrefix(f, "json="): - p.JSONName = f[5:] - case strings.HasPrefix(f, "enum="): - p.Enum = f[5:] - case f == "proto3": - p.proto3 = true - case f == "oneof": - p.oneof = true - case strings.HasPrefix(f, "def="): - p.HasDefault = true - p.Default = f[4:] // rest of string - if i+1 < len(fields) { - // Commas aren't escaped, and def is always last. - p.Default += "," + strings.Join(fields[i+1:], ",") - break - } - case strings.HasPrefix(f, "embedded="): - p.OrigName = strings.Split(f, "=")[1] - case strings.HasPrefix(f, "customtype="): - p.CustomType = strings.Split(f, "=")[1] - case f == "stdtime": - p.StdTime = true - case f == "stdduration": - p.StdDuration = true - } - } -} - -func logNoSliceEnc(t1, t2 reflect.Type) { - fmt.Fprintf(os.Stderr, "proto: no slice oenc for %T = []%T\n", t1, t2) -} - -var protoMessageType = reflect.TypeOf((*Message)(nil)).Elem() - -// Initialize the fields for encoding and decoding. -func (p *Properties) setEncAndDec(typ reflect.Type, f *reflect.StructField, lockGetProp bool) { - p.enc = nil - p.dec = nil - p.size = nil - isMap := typ.Kind() == reflect.Map - if len(p.CustomType) > 0 && !isMap { - p.setCustomEncAndDec(typ) - p.setTag(lockGetProp) - return - } - if p.StdTime && !isMap { - p.setTimeEncAndDec(typ) - p.setTag(lockGetProp) - return - } - if p.StdDuration && !isMap { - p.setDurationEncAndDec(typ) - p.setTag(lockGetProp) - return - } - switch t1 := typ; t1.Kind() { - default: - fmt.Fprintf(os.Stderr, "proto: no coders for %v\n", t1) - - // proto3 scalar types - - case reflect.Bool: - if p.proto3 { - p.enc = (*Buffer).enc_proto3_bool - p.dec = (*Buffer).dec_proto3_bool - p.size = size_proto3_bool - } else { - p.enc = (*Buffer).enc_ref_bool - p.dec = (*Buffer).dec_proto3_bool - p.size = size_ref_bool - } - case reflect.Int32: - if p.proto3 { - p.enc = (*Buffer).enc_proto3_int32 - p.dec = (*Buffer).dec_proto3_int32 - p.size = size_proto3_int32 - } else { - p.enc = (*Buffer).enc_ref_int32 - p.dec = (*Buffer).dec_proto3_int32 - p.size = size_ref_int32 - } - case reflect.Uint32: - if p.proto3 { - p.enc = (*Buffer).enc_proto3_uint32 - p.dec = (*Buffer).dec_proto3_int32 // can reuse - p.size = size_proto3_uint32 - } else { - p.enc = (*Buffer).enc_ref_uint32 - p.dec = (*Buffer).dec_proto3_int32 // can reuse - p.size = size_ref_uint32 - } - case reflect.Int64, reflect.Uint64: - if p.proto3 { - p.enc = (*Buffer).enc_proto3_int64 - p.dec = (*Buffer).dec_proto3_int64 - p.size = size_proto3_int64 - } else { - p.enc = (*Buffer).enc_ref_int64 - p.dec = (*Buffer).dec_proto3_int64 - p.size = size_ref_int64 - } - case reflect.Float32: - if p.proto3 { - p.enc = (*Buffer).enc_proto3_uint32 // can just treat them as bits - p.dec = (*Buffer).dec_proto3_int32 - p.size = size_proto3_uint32 - } else { - p.enc = (*Buffer).enc_ref_uint32 // can just treat them as bits - p.dec = (*Buffer).dec_proto3_int32 - p.size = size_ref_uint32 - } - case reflect.Float64: - if p.proto3 { - p.enc = (*Buffer).enc_proto3_int64 // can just treat them as bits - p.dec = (*Buffer).dec_proto3_int64 - p.size = size_proto3_int64 - } else { - p.enc = (*Buffer).enc_ref_int64 // can just treat them as bits - p.dec = (*Buffer).dec_proto3_int64 - p.size = size_ref_int64 - } - case reflect.String: - if p.proto3 { - p.enc = (*Buffer).enc_proto3_string - p.dec = (*Buffer).dec_proto3_string - p.size = size_proto3_string - } else { - p.enc = (*Buffer).enc_ref_string - p.dec = (*Buffer).dec_proto3_string - p.size = size_ref_string - } - case reflect.Struct: - p.stype = typ - p.isMarshaler = isMarshaler(typ) - p.isUnmarshaler = isUnmarshaler(typ) - if p.Wire == "bytes" { - p.enc = (*Buffer).enc_ref_struct_message - p.dec = (*Buffer).dec_ref_struct_message - p.size = size_ref_struct_message - } else { - fmt.Fprintf(os.Stderr, "proto: no coders for struct %T\n", typ) - } - - case reflect.Ptr: - switch t2 := t1.Elem(); t2.Kind() { - default: - fmt.Fprintf(os.Stderr, "proto: no encoder function for %v -> %v\n", t1, t2) - break - case reflect.Bool: - p.enc = (*Buffer).enc_bool - p.dec = (*Buffer).dec_bool - p.size = size_bool - case reflect.Int32: - p.enc = (*Buffer).enc_int32 - p.dec = (*Buffer).dec_int32 - p.size = size_int32 - case reflect.Uint32: - p.enc = (*Buffer).enc_uint32 - p.dec = (*Buffer).dec_int32 // can reuse - p.size = size_uint32 - case reflect.Int64, reflect.Uint64: - p.enc = (*Buffer).enc_int64 - p.dec = (*Buffer).dec_int64 - p.size = size_int64 - case reflect.Float32: - p.enc = (*Buffer).enc_uint32 // can just treat them as bits - p.dec = (*Buffer).dec_int32 - p.size = size_uint32 - case reflect.Float64: - p.enc = (*Buffer).enc_int64 // can just treat them as bits - p.dec = (*Buffer).dec_int64 - p.size = size_int64 - case reflect.String: - p.enc = (*Buffer).enc_string - p.dec = (*Buffer).dec_string - p.size = size_string - case reflect.Struct: - p.stype = t1.Elem() - p.isMarshaler = isMarshaler(t1) - p.isUnmarshaler = isUnmarshaler(t1) - if p.Wire == "bytes" { - p.enc = (*Buffer).enc_struct_message - p.dec = (*Buffer).dec_struct_message - p.size = size_struct_message - } else { - p.enc = (*Buffer).enc_struct_group - p.dec = (*Buffer).dec_struct_group - p.size = size_struct_group - } - } - - case reflect.Slice: - switch t2 := t1.Elem(); t2.Kind() { - default: - logNoSliceEnc(t1, t2) - break - case reflect.Bool: - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_bool - p.size = size_slice_packed_bool - } else { - p.enc = (*Buffer).enc_slice_bool - p.size = size_slice_bool - } - p.dec = (*Buffer).dec_slice_bool - p.packedDec = (*Buffer).dec_slice_packed_bool - case reflect.Int32: - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_int32 - p.size = size_slice_packed_int32 - } else { - p.enc = (*Buffer).enc_slice_int32 - p.size = size_slice_int32 - } - p.dec = (*Buffer).dec_slice_int32 - p.packedDec = (*Buffer).dec_slice_packed_int32 - case reflect.Uint32: - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_uint32 - p.size = size_slice_packed_uint32 - } else { - p.enc = (*Buffer).enc_slice_uint32 - p.size = size_slice_uint32 - } - p.dec = (*Buffer).dec_slice_int32 - p.packedDec = (*Buffer).dec_slice_packed_int32 - case reflect.Int64, reflect.Uint64: - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_int64 - p.size = size_slice_packed_int64 - } else { - p.enc = (*Buffer).enc_slice_int64 - p.size = size_slice_int64 - } - p.dec = (*Buffer).dec_slice_int64 - p.packedDec = (*Buffer).dec_slice_packed_int64 - case reflect.Uint8: - p.dec = (*Buffer).dec_slice_byte - if p.proto3 { - p.enc = (*Buffer).enc_proto3_slice_byte - p.size = size_proto3_slice_byte - } else { - p.enc = (*Buffer).enc_slice_byte - p.size = size_slice_byte - } - case reflect.Float32, reflect.Float64: - switch t2.Bits() { - case 32: - // can just treat them as bits - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_uint32 - p.size = size_slice_packed_uint32 - } else { - p.enc = (*Buffer).enc_slice_uint32 - p.size = size_slice_uint32 - } - p.dec = (*Buffer).dec_slice_int32 - p.packedDec = (*Buffer).dec_slice_packed_int32 - case 64: - // can just treat them as bits - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_int64 - p.size = size_slice_packed_int64 - } else { - p.enc = (*Buffer).enc_slice_int64 - p.size = size_slice_int64 - } - p.dec = (*Buffer).dec_slice_int64 - p.packedDec = (*Buffer).dec_slice_packed_int64 - default: - logNoSliceEnc(t1, t2) - break - } - case reflect.String: - p.enc = (*Buffer).enc_slice_string - p.dec = (*Buffer).dec_slice_string - p.size = size_slice_string - case reflect.Ptr: - switch t3 := t2.Elem(); t3.Kind() { - default: - fmt.Fprintf(os.Stderr, "proto: no ptr oenc for %T -> %T -> %T\n", t1, t2, t3) - break - case reflect.Struct: - p.stype = t2.Elem() - p.isMarshaler = isMarshaler(t2) - p.isUnmarshaler = isUnmarshaler(t2) - if p.Wire == "bytes" { - p.enc = (*Buffer).enc_slice_struct_message - p.dec = (*Buffer).dec_slice_struct_message - p.size = size_slice_struct_message - } else { - p.enc = (*Buffer).enc_slice_struct_group - p.dec = (*Buffer).dec_slice_struct_group - p.size = size_slice_struct_group - } - } - case reflect.Slice: - switch t2.Elem().Kind() { - default: - fmt.Fprintf(os.Stderr, "proto: no slice elem oenc for %T -> %T -> %T\n", t1, t2, t2.Elem()) - break - case reflect.Uint8: - p.enc = (*Buffer).enc_slice_slice_byte - p.dec = (*Buffer).dec_slice_slice_byte - p.size = size_slice_slice_byte - } - case reflect.Struct: - p.setSliceOfNonPointerStructs(t1) - } - - case reflect.Map: - p.enc = (*Buffer).enc_new_map - p.dec = (*Buffer).dec_new_map - p.size = size_new_map - - p.mtype = t1 - p.mkeyprop = &Properties{} - p.mkeyprop.init(reflect.PtrTo(p.mtype.Key()), "Key", f.Tag.Get("protobuf_key"), nil, lockGetProp) - p.mvalprop = &Properties{} - vtype := p.mtype.Elem() - if vtype.Kind() != reflect.Ptr && vtype.Kind() != reflect.Slice { - // The value type is not a message (*T) or bytes ([]byte), - // so we need encoders for the pointer to this type. - vtype = reflect.PtrTo(vtype) - } - - p.mvalprop.CustomType = p.CustomType - p.mvalprop.StdDuration = p.StdDuration - p.mvalprop.StdTime = p.StdTime - p.mvalprop.init(vtype, "Value", f.Tag.Get("protobuf_val"), nil, lockGetProp) - } - p.setTag(lockGetProp) -} - -func (p *Properties) setTag(lockGetProp bool) { - // precalculate tag code - wire := p.WireType - if p.Packed { - wire = WireBytes - } - x := uint32(p.Tag)<<3 | uint32(wire) - i := 0 - for i = 0; x > 127; i++ { - p.tagbuf[i] = 0x80 | uint8(x&0x7F) - x >>= 7 - } - p.tagbuf[i] = uint8(x) - p.tagcode = p.tagbuf[0 : i+1] - - if p.stype != nil { - if lockGetProp { - p.sprop = GetProperties(p.stype) - } else { - p.sprop = getPropertiesLocked(p.stype) - } - } -} - -var ( - marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem() - unmarshalerType = reflect.TypeOf((*Unmarshaler)(nil)).Elem() -) - -// isMarshaler reports whether type t implements Marshaler. -func isMarshaler(t reflect.Type) bool { - return t.Implements(marshalerType) -} - -// isUnmarshaler reports whether type t implements Unmarshaler. -func isUnmarshaler(t reflect.Type) bool { - return t.Implements(unmarshalerType) -} - -// Init populates the properties from a protocol buffer struct tag. -func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) { - p.init(typ, name, tag, f, true) -} - -func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructField, lockGetProp bool) { - // "bytes,49,opt,def=hello!" - p.Name = name - p.OrigName = name - if f != nil { - p.field = toField(f) - } - if tag == "" { - return - } - p.Parse(tag) - p.setEncAndDec(typ, f, lockGetProp) -} - -var ( - propertiesMu sync.RWMutex - propertiesMap = make(map[reflect.Type]*StructProperties) -) - -// GetProperties returns the list of properties for the type represented by t. -// t must represent a generated struct type of a protocol message. -func GetProperties(t reflect.Type) *StructProperties { - if t.Kind() != reflect.Struct { - panic("proto: type must have kind struct") - } - - // Most calls to GetProperties in a long-running program will be - // retrieving details for types we have seen before. - propertiesMu.RLock() - sprop, ok := propertiesMap[t] - propertiesMu.RUnlock() - if ok { - if collectStats { - stats.Chit++ - } - return sprop - } - - propertiesMu.Lock() - sprop = getPropertiesLocked(t) - propertiesMu.Unlock() - return sprop -} - -// getPropertiesLocked requires that propertiesMu is held. -func getPropertiesLocked(t reflect.Type) *StructProperties { - if prop, ok := propertiesMap[t]; ok { - if collectStats { - stats.Chit++ - } - return prop - } - if collectStats { - stats.Cmiss++ - } - - prop := new(StructProperties) - // in case of recursive protos, fill this in now. - propertiesMap[t] = prop - - // build properties - prop.extendable = reflect.PtrTo(t).Implements(extendableProtoType) || - reflect.PtrTo(t).Implements(extendableProtoV1Type) || - reflect.PtrTo(t).Implements(extendableBytesType) - prop.unrecField = invalidField - prop.Prop = make([]*Properties, t.NumField()) - prop.order = make([]int, t.NumField()) - - isOneofMessage := false - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - p := new(Properties) - name := f.Name - p.init(f.Type, name, f.Tag.Get("protobuf"), &f, false) - - if f.Name == "XXX_InternalExtensions" { // special case - p.enc = (*Buffer).enc_exts - p.dec = nil // not needed - p.size = size_exts - } else if f.Name == "XXX_extensions" { // special case - if len(f.Tag.Get("protobuf")) > 0 { - p.enc = (*Buffer).enc_ext_slice_byte - p.dec = nil // not needed - p.size = size_ext_slice_byte - } else { - p.enc = (*Buffer).enc_map - p.dec = nil // not needed - p.size = size_map - } - } else if f.Name == "XXX_unrecognized" { // special case - prop.unrecField = toField(&f) - } - oneof := f.Tag.Get("protobuf_oneof") // special case - if oneof != "" { - isOneofMessage = true - // Oneof fields don't use the traditional protobuf tag. - p.OrigName = oneof - } - prop.Prop[i] = p - prop.order[i] = i - if debug { - print(i, " ", f.Name, " ", t.String(), " ") - if p.Tag > 0 { - print(p.String()) - } - print("\n") - } - if p.enc == nil && !strings.HasPrefix(f.Name, "XXX_") && oneof == "" { - fmt.Fprintln(os.Stderr, "proto: no encoder for", f.Name, f.Type.String(), "[GetProperties]") - } - } - - // Re-order prop.order. - sort.Sort(prop) - - type oneofMessage interface { - XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) - } - if om, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); isOneofMessage && ok { - var oots []interface{} - prop.oneofMarshaler, prop.oneofUnmarshaler, prop.oneofSizer, oots = om.XXX_OneofFuncs() - prop.stype = t - - // Interpret oneof metadata. - prop.OneofTypes = make(map[string]*OneofProperties) - for _, oot := range oots { - oop := &OneofProperties{ - Type: reflect.ValueOf(oot).Type(), // *T - Prop: new(Properties), - } - sft := oop.Type.Elem().Field(0) - oop.Prop.Name = sft.Name - oop.Prop.Parse(sft.Tag.Get("protobuf")) - // There will be exactly one interface field that - // this new value is assignable to. - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - if f.Type.Kind() != reflect.Interface { - continue - } - if !oop.Type.AssignableTo(f.Type) { - continue - } - oop.Field = i - break - } - prop.OneofTypes[oop.Prop.OrigName] = oop - } - } - - // build required counts - // build tags - reqCount := 0 - prop.decoderOrigNames = make(map[string]int) - for i, p := range prop.Prop { - if strings.HasPrefix(p.Name, "XXX_") { - // Internal fields should not appear in tags/origNames maps. - // They are handled specially when encoding and decoding. - continue - } - if p.Required { - reqCount++ - } - prop.decoderTags.put(p.Tag, i) - prop.decoderOrigNames[p.OrigName] = i - } - prop.reqCount = reqCount - - return prop -} - -// Return the Properties object for the x[0]'th field of the structure. -func propByIndex(t reflect.Type, x []int) *Properties { - if len(x) != 1 { - fmt.Fprintf(os.Stderr, "proto: field index dimension %d (not 1) for type %s\n", len(x), t) - return nil - } - prop := GetProperties(t) - return prop.Prop[x[0]] -} - -// Get the address and type of a pointer to a struct from an interface. -func getbase(pb Message) (t reflect.Type, b structPointer, err error) { - if pb == nil { - err = ErrNil - return - } - // get the reflect type of the pointer to the struct. - t = reflect.TypeOf(pb) - // get the address of the struct. - value := reflect.ValueOf(pb) - b = toStructPointer(value) - return -} - -// A global registry of enum types. -// The generated code will register the generated maps by calling RegisterEnum. - -var enumValueMaps = make(map[string]map[string]int32) -var enumStringMaps = make(map[string]map[int32]string) - -// RegisterEnum is called from the generated code to install the enum descriptor -// maps into the global table to aid parsing text format protocol buffers. -func RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) { - if _, ok := enumValueMaps[typeName]; ok { - panic("proto: duplicate enum registered: " + typeName) - } - enumValueMaps[typeName] = valueMap - if _, ok := enumStringMaps[typeName]; ok { - panic("proto: duplicate enum registered: " + typeName) - } - enumStringMaps[typeName] = unusedNameMap -} - -// EnumValueMap returns the mapping from names to integers of the -// enum type enumType, or a nil if not found. -func EnumValueMap(enumType string) map[string]int32 { - return enumValueMaps[enumType] -} - -// A registry of all linked message types. -// The string is a fully-qualified proto name ("pkg.Message"). -var ( - protoTypes = make(map[string]reflect.Type) - revProtoTypes = make(map[reflect.Type]string) -) - -// RegisterType is called from generated code and maps from the fully qualified -// proto name to the type (pointer to struct) of the protocol buffer. -func RegisterType(x Message, name string) { - if _, ok := protoTypes[name]; ok { - // TODO: Some day, make this a panic. - log.Printf("proto: duplicate proto type registered: %s", name) - return - } - t := reflect.TypeOf(x) - protoTypes[name] = t - revProtoTypes[t] = name -} - -// MessageName returns the fully-qualified proto name for the given message type. -func MessageName(x Message) string { - type xname interface { - XXX_MessageName() string - } - if m, ok := x.(xname); ok { - return m.XXX_MessageName() - } - return revProtoTypes[reflect.TypeOf(x)] -} - -// MessageType returns the message type (pointer to struct) for a named message. -func MessageType(name string) reflect.Type { return protoTypes[name] } - -// A registry of all linked proto files. -var ( - protoFiles = make(map[string][]byte) // file name => fileDescriptor -) - -// RegisterFile is called from generated code and maps from the -// full file name of a .proto file to its compressed FileDescriptorProto. -func RegisterFile(filename string, fileDescriptor []byte) { - protoFiles[filename] = fileDescriptor -} - -// FileDescriptor returns the compressed FileDescriptorProto for a .proto file. -func FileDescriptor(filename string) []byte { return protoFiles[filename] } diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/properties_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/properties_gogo.go deleted file mode 100644 index b6b7176c565..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/properties_gogo.go +++ /dev/null @@ -1,111 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package proto - -import ( - "fmt" - "os" - "reflect" -) - -func (p *Properties) setCustomEncAndDec(typ reflect.Type) { - p.ctype = typ - if p.Repeated { - p.enc = (*Buffer).enc_custom_slice_bytes - p.dec = (*Buffer).dec_custom_slice_bytes - p.size = size_custom_slice_bytes - } else if typ.Kind() == reflect.Ptr { - p.enc = (*Buffer).enc_custom_bytes - p.dec = (*Buffer).dec_custom_bytes - p.size = size_custom_bytes - } else { - p.enc = (*Buffer).enc_custom_ref_bytes - p.dec = (*Buffer).dec_custom_ref_bytes - p.size = size_custom_ref_bytes - } -} - -func (p *Properties) setDurationEncAndDec(typ reflect.Type) { - if p.Repeated { - if typ.Elem().Kind() == reflect.Ptr { - p.enc = (*Buffer).enc_slice_duration - p.dec = (*Buffer).dec_slice_duration - p.size = size_slice_duration - } else { - p.enc = (*Buffer).enc_slice_ref_duration - p.dec = (*Buffer).dec_slice_ref_duration - p.size = size_slice_ref_duration - } - } else if typ.Kind() == reflect.Ptr { - p.enc = (*Buffer).enc_duration - p.dec = (*Buffer).dec_duration - p.size = size_duration - } else { - p.enc = (*Buffer).enc_ref_duration - p.dec = (*Buffer).dec_ref_duration - p.size = size_ref_duration - } -} - -func (p *Properties) setTimeEncAndDec(typ reflect.Type) { - if p.Repeated { - if typ.Elem().Kind() == reflect.Ptr { - p.enc = (*Buffer).enc_slice_time - p.dec = (*Buffer).dec_slice_time - p.size = size_slice_time - } else { - p.enc = (*Buffer).enc_slice_ref_time - p.dec = (*Buffer).dec_slice_ref_time - p.size = size_slice_ref_time - } - } else if typ.Kind() == reflect.Ptr { - p.enc = (*Buffer).enc_time - p.dec = (*Buffer).dec_time - p.size = size_time - } else { - p.enc = (*Buffer).enc_ref_time - p.dec = (*Buffer).dec_ref_time - p.size = size_ref_time - } - -} - -func (p *Properties) setSliceOfNonPointerStructs(typ reflect.Type) { - t2 := typ.Elem() - p.sstype = typ - p.stype = t2 - p.isMarshaler = isMarshaler(t2) - p.isUnmarshaler = isUnmarshaler(t2) - p.enc = (*Buffer).enc_slice_ref_struct_message - p.dec = (*Buffer).dec_slice_ref_struct_message - p.size = size_slice_ref_struct_message - if p.Wire != "bytes" { - fmt.Fprintf(os.Stderr, "proto: no ptr oenc for %T -> %T \n", typ, t2) - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/proto3_proto/proto3.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/proto3_proto/proto3.pb.go deleted file mode 100644 index c3e7b6b76ac..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/proto3_proto/proto3.pb.go +++ /dev/null @@ -1,347 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: proto3_proto/proto3.proto -// DO NOT EDIT! - -/* -Package proto3_proto is a generated protocol buffer package. - -It is generated from these files: - proto3_proto/proto3.proto - -It has these top-level messages: - Message - Nested - MessageWithMap - IntMap - IntMaps -*/ -package proto3_proto - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import google_protobuf "github.com/gogo/protobuf/types" -import testdata "github.com/gogo/protobuf/proto/testdata" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type Message_Humour int32 - -const ( - Message_UNKNOWN Message_Humour = 0 - Message_PUNS Message_Humour = 1 - Message_SLAPSTICK Message_Humour = 2 - Message_BILL_BAILEY Message_Humour = 3 -) - -var Message_Humour_name = map[int32]string{ - 0: "UNKNOWN", - 1: "PUNS", - 2: "SLAPSTICK", - 3: "BILL_BAILEY", -} -var Message_Humour_value = map[string]int32{ - "UNKNOWN": 0, - "PUNS": 1, - "SLAPSTICK": 2, - "BILL_BAILEY": 3, -} - -func (x Message_Humour) String() string { - return proto.EnumName(Message_Humour_name, int32(x)) -} -func (Message_Humour) EnumDescriptor() ([]byte, []int) { return fileDescriptorProto3, []int{0, 0} } - -type Message struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Hilarity Message_Humour `protobuf:"varint,2,opt,name=hilarity,proto3,enum=proto3_proto.Message_Humour" json:"hilarity,omitempty"` - HeightInCm uint32 `protobuf:"varint,3,opt,name=height_in_cm,json=heightInCm,proto3" json:"height_in_cm,omitempty"` - Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` - ResultCount int64 `protobuf:"varint,7,opt,name=result_count,json=resultCount,proto3" json:"result_count,omitempty"` - TrueScotsman bool `protobuf:"varint,8,opt,name=true_scotsman,json=trueScotsman,proto3" json:"true_scotsman,omitempty"` - Score float32 `protobuf:"fixed32,9,opt,name=score,proto3" json:"score,omitempty"` - Key []uint64 `protobuf:"varint,5,rep,packed,name=key" json:"key,omitempty"` - ShortKey []int32 `protobuf:"varint,19,rep,packed,name=short_key,json=shortKey" json:"short_key,omitempty"` - Nested *Nested `protobuf:"bytes,6,opt,name=nested" json:"nested,omitempty"` - RFunny []Message_Humour `protobuf:"varint,16,rep,packed,name=r_funny,json=rFunny,enum=proto3_proto.Message_Humour" json:"r_funny,omitempty"` - Terrain map[string]*Nested `protobuf:"bytes,10,rep,name=terrain" json:"terrain,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"` - Proto2Field *testdata.SubDefaults `protobuf:"bytes,11,opt,name=proto2_field,json=proto2Field" json:"proto2_field,omitempty"` - Proto2Value map[string]*testdata.SubDefaults `protobuf:"bytes,13,rep,name=proto2_value,json=proto2Value" json:"proto2_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"` - Anything *google_protobuf.Any `protobuf:"bytes,14,opt,name=anything" json:"anything,omitempty"` - ManyThings []*google_protobuf.Any `protobuf:"bytes,15,rep,name=many_things,json=manyThings" json:"many_things,omitempty"` - Submessage *Message `protobuf:"bytes,17,opt,name=submessage" json:"submessage,omitempty"` - Children []*Message `protobuf:"bytes,18,rep,name=children" json:"children,omitempty"` -} - -func (m *Message) Reset() { *m = Message{} } -func (m *Message) String() string { return proto.CompactTextString(m) } -func (*Message) ProtoMessage() {} -func (*Message) Descriptor() ([]byte, []int) { return fileDescriptorProto3, []int{0} } - -func (m *Message) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *Message) GetHilarity() Message_Humour { - if m != nil { - return m.Hilarity - } - return Message_UNKNOWN -} - -func (m *Message) GetHeightInCm() uint32 { - if m != nil { - return m.HeightInCm - } - return 0 -} - -func (m *Message) GetData() []byte { - if m != nil { - return m.Data - } - return nil -} - -func (m *Message) GetResultCount() int64 { - if m != nil { - return m.ResultCount - } - return 0 -} - -func (m *Message) GetTrueScotsman() bool { - if m != nil { - return m.TrueScotsman - } - return false -} - -func (m *Message) GetScore() float32 { - if m != nil { - return m.Score - } - return 0 -} - -func (m *Message) GetKey() []uint64 { - if m != nil { - return m.Key - } - return nil -} - -func (m *Message) GetShortKey() []int32 { - if m != nil { - return m.ShortKey - } - return nil -} - -func (m *Message) GetNested() *Nested { - if m != nil { - return m.Nested - } - return nil -} - -func (m *Message) GetRFunny() []Message_Humour { - if m != nil { - return m.RFunny - } - return nil -} - -func (m *Message) GetTerrain() map[string]*Nested { - if m != nil { - return m.Terrain - } - return nil -} - -func (m *Message) GetProto2Field() *testdata.SubDefaults { - if m != nil { - return m.Proto2Field - } - return nil -} - -func (m *Message) GetProto2Value() map[string]*testdata.SubDefaults { - if m != nil { - return m.Proto2Value - } - return nil -} - -func (m *Message) GetAnything() *google_protobuf.Any { - if m != nil { - return m.Anything - } - return nil -} - -func (m *Message) GetManyThings() []*google_protobuf.Any { - if m != nil { - return m.ManyThings - } - return nil -} - -func (m *Message) GetSubmessage() *Message { - if m != nil { - return m.Submessage - } - return nil -} - -func (m *Message) GetChildren() []*Message { - if m != nil { - return m.Children - } - return nil -} - -type Nested struct { - Bunny string `protobuf:"bytes,1,opt,name=bunny,proto3" json:"bunny,omitempty"` - Cute bool `protobuf:"varint,2,opt,name=cute,proto3" json:"cute,omitempty"` -} - -func (m *Nested) Reset() { *m = Nested{} } -func (m *Nested) String() string { return proto.CompactTextString(m) } -func (*Nested) ProtoMessage() {} -func (*Nested) Descriptor() ([]byte, []int) { return fileDescriptorProto3, []int{1} } - -func (m *Nested) GetBunny() string { - if m != nil { - return m.Bunny - } - return "" -} - -func (m *Nested) GetCute() bool { - if m != nil { - return m.Cute - } - return false -} - -type MessageWithMap struct { - ByteMapping map[bool][]byte `protobuf:"bytes,1,rep,name=byte_mapping,json=byteMapping" json:"byte_mapping,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (m *MessageWithMap) Reset() { *m = MessageWithMap{} } -func (m *MessageWithMap) String() string { return proto.CompactTextString(m) } -func (*MessageWithMap) ProtoMessage() {} -func (*MessageWithMap) Descriptor() ([]byte, []int) { return fileDescriptorProto3, []int{2} } - -func (m *MessageWithMap) GetByteMapping() map[bool][]byte { - if m != nil { - return m.ByteMapping - } - return nil -} - -type IntMap struct { - Rtt map[int32]int32 `protobuf:"bytes,1,rep,name=rtt" json:"rtt,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` -} - -func (m *IntMap) Reset() { *m = IntMap{} } -func (m *IntMap) String() string { return proto.CompactTextString(m) } -func (*IntMap) ProtoMessage() {} -func (*IntMap) Descriptor() ([]byte, []int) { return fileDescriptorProto3, []int{3} } - -func (m *IntMap) GetRtt() map[int32]int32 { - if m != nil { - return m.Rtt - } - return nil -} - -type IntMaps struct { - Maps []*IntMap `protobuf:"bytes,1,rep,name=maps" json:"maps,omitempty"` -} - -func (m *IntMaps) Reset() { *m = IntMaps{} } -func (m *IntMaps) String() string { return proto.CompactTextString(m) } -func (*IntMaps) ProtoMessage() {} -func (*IntMaps) Descriptor() ([]byte, []int) { return fileDescriptorProto3, []int{4} } - -func (m *IntMaps) GetMaps() []*IntMap { - if m != nil { - return m.Maps - } - return nil -} - -func init() { - proto.RegisterType((*Message)(nil), "proto3_proto.Message") - proto.RegisterType((*Nested)(nil), "proto3_proto.Nested") - proto.RegisterType((*MessageWithMap)(nil), "proto3_proto.MessageWithMap") - proto.RegisterType((*IntMap)(nil), "proto3_proto.IntMap") - proto.RegisterType((*IntMaps)(nil), "proto3_proto.IntMaps") - proto.RegisterEnum("proto3_proto.Message_Humour", Message_Humour_name, Message_Humour_value) -} - -func init() { proto.RegisterFile("proto3_proto/proto3.proto", fileDescriptorProto3) } - -var fileDescriptorProto3 = []byte{ - // 733 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0x53, 0x6d, 0x6f, 0xf3, 0x34, - 0x14, 0x25, 0x4d, 0x5f, 0xd2, 0x9b, 0x74, 0x0b, 0x5e, 0x91, 0xbc, 0x02, 0x52, 0x28, 0x12, 0x8a, - 0x78, 0x49, 0xa1, 0xd3, 0xd0, 0x84, 0x10, 0x68, 0x1b, 0x9b, 0xa8, 0xd6, 0x95, 0xca, 0xdd, 0x98, - 0xf8, 0x14, 0xa5, 0xad, 0xdb, 0x46, 0x34, 0x4e, 0x49, 0x1c, 0xa4, 0xfc, 0x1d, 0xfe, 0x28, 0x8f, - 0x6c, 0xa7, 0x5d, 0x36, 0x65, 0xcf, 0xf3, 0x29, 0xf6, 0xf1, 0xb9, 0xf7, 0x9c, 0x1c, 0x5f, 0xc3, - 0xe9, 0x2e, 0x89, 0x79, 0x7c, 0xe6, 0xcb, 0xcf, 0x40, 0x6d, 0x3c, 0xf9, 0x41, 0x56, 0xf9, 0xa8, - 0x77, 0xba, 0x8e, 0xe3, 0xf5, 0x96, 0x2a, 0xca, 0x3c, 0x5b, 0x0d, 0x02, 0x96, 0x2b, 0x62, 0xef, - 0x84, 0xd3, 0x94, 0x2f, 0x03, 0x1e, 0x0c, 0xc4, 0x42, 0x81, 0xfd, 0xff, 0x5b, 0xd0, 0xba, 0xa7, - 0x69, 0x1a, 0xac, 0x29, 0x42, 0x50, 0x67, 0x41, 0x44, 0xb1, 0xe6, 0x68, 0x6e, 0x9b, 0xc8, 0x35, - 0xba, 0x00, 0x63, 0x13, 0x6e, 0x83, 0x24, 0xe4, 0x39, 0xae, 0x39, 0x9a, 0x7b, 0x34, 0xfc, 0xcc, - 0x2b, 0x0b, 0x7a, 0x45, 0xb1, 0xf7, 0x7b, 0x16, 0xc5, 0x59, 0x42, 0x0e, 0x6c, 0xe4, 0x80, 0xb5, - 0xa1, 0xe1, 0x7a, 0xc3, 0xfd, 0x90, 0xf9, 0x8b, 0x08, 0xeb, 0x8e, 0xe6, 0x76, 0x08, 0x28, 0x6c, - 0xc4, 0xae, 0x23, 0xa1, 0x27, 0xec, 0xe0, 0xba, 0xa3, 0xb9, 0x16, 0x91, 0x6b, 0xf4, 0x05, 0x58, - 0x09, 0x4d, 0xb3, 0x2d, 0xf7, 0x17, 0x71, 0xc6, 0x38, 0x6e, 0x39, 0x9a, 0xab, 0x13, 0x53, 0x61, - 0xd7, 0x02, 0x42, 0x5f, 0x42, 0x87, 0x27, 0x19, 0xf5, 0xd3, 0x45, 0xcc, 0xd3, 0x28, 0x60, 0xd8, - 0x70, 0x34, 0xd7, 0x20, 0x96, 0x00, 0x67, 0x05, 0x86, 0xba, 0xd0, 0x48, 0x17, 0x71, 0x42, 0x71, - 0xdb, 0xd1, 0xdc, 0x1a, 0x51, 0x1b, 0x64, 0x83, 0xfe, 0x37, 0xcd, 0x71, 0xc3, 0xd1, 0xdd, 0x3a, - 0x11, 0x4b, 0xf4, 0x29, 0xb4, 0xd3, 0x4d, 0x9c, 0x70, 0x5f, 0xe0, 0x27, 0x8e, 0xee, 0x36, 0x88, - 0x21, 0x81, 0x3b, 0x9a, 0xa3, 0x6f, 0xa1, 0xc9, 0x68, 0xca, 0xe9, 0x12, 0x37, 0x1d, 0xcd, 0x35, - 0x87, 0xdd, 0x97, 0xbf, 0x3e, 0x91, 0x67, 0xa4, 0xe0, 0xa0, 0x73, 0x68, 0x25, 0xfe, 0x2a, 0x63, - 0x2c, 0xc7, 0xb6, 0xa3, 0x7f, 0x30, 0xa9, 0x66, 0x72, 0x2b, 0xb8, 0xe8, 0x67, 0x68, 0x71, 0x9a, - 0x24, 0x41, 0xc8, 0x30, 0x38, 0xba, 0x6b, 0x0e, 0xfb, 0xd5, 0x65, 0x0f, 0x8a, 0x74, 0xc3, 0x78, - 0x92, 0x93, 0x7d, 0x09, 0xba, 0x00, 0x75, 0xff, 0x43, 0x7f, 0x15, 0xd2, 0xed, 0x12, 0x9b, 0xd2, - 0xe8, 0x27, 0xde, 0xfe, 0xae, 0xbd, 0x59, 0x36, 0xff, 0x8d, 0xae, 0x82, 0x6c, 0xcb, 0x53, 0x62, - 0x2a, 0xea, 0xad, 0x60, 0xa2, 0xd1, 0xa1, 0xf2, 0xdf, 0x60, 0x9b, 0x51, 0xdc, 0x91, 0xe2, 0x5f, - 0x55, 0x8b, 0x4f, 0x25, 0xf3, 0x4f, 0x41, 0x54, 0x06, 0x8a, 0x56, 0x12, 0x41, 0xdf, 0x83, 0x11, - 0xb0, 0x9c, 0x6f, 0x42, 0xb6, 0xc6, 0x47, 0x45, 0x52, 0x6a, 0x0e, 0xbd, 0xfd, 0x1c, 0x7a, 0x97, - 0x2c, 0x27, 0x07, 0x16, 0x3a, 0x07, 0x33, 0x0a, 0x58, 0xee, 0xcb, 0x5d, 0x8a, 0x8f, 0xa5, 0x76, - 0x75, 0x11, 0x08, 0xe2, 0x83, 0xe4, 0xa1, 0x73, 0x80, 0x34, 0x9b, 0x47, 0xca, 0x14, 0xfe, 0xb8, - 0xf8, 0xd7, 0x2a, 0xc7, 0xa4, 0x44, 0x44, 0x3f, 0x80, 0xb1, 0xd8, 0x84, 0xdb, 0x65, 0x42, 0x19, - 0x46, 0x52, 0xea, 0x8d, 0xa2, 0x03, 0xad, 0x37, 0x05, 0xab, 0x1c, 0xf8, 0x7e, 0x72, 0xd4, 0xd3, - 0x90, 0x93, 0xf3, 0x35, 0x34, 0x54, 0x70, 0xb5, 0xf7, 0xcc, 0x86, 0xa2, 0xfc, 0x54, 0xbb, 0xd0, - 0x7a, 0x8f, 0x60, 0xbf, 0x4e, 0xb1, 0xa2, 0xeb, 0x37, 0x2f, 0xbb, 0xbe, 0x71, 0x91, 0xcf, 0x6d, - 0xfb, 0xbf, 0x42, 0x53, 0x0d, 0x14, 0x32, 0xa1, 0xf5, 0x38, 0xb9, 0x9b, 0xfc, 0xf1, 0x34, 0xb1, - 0x3f, 0x42, 0x06, 0xd4, 0xa7, 0x8f, 0x93, 0x99, 0xad, 0xa1, 0x0e, 0xb4, 0x67, 0xe3, 0xcb, 0xe9, - 0xec, 0x61, 0x74, 0x7d, 0x67, 0xd7, 0xd0, 0x31, 0x98, 0x57, 0xa3, 0xf1, 0xd8, 0xbf, 0xba, 0x1c, - 0x8d, 0x6f, 0xfe, 0xb2, 0xf5, 0xfe, 0x10, 0x9a, 0xca, 0xac, 0x78, 0x33, 0x73, 0x39, 0xbe, 0xca, - 0x8f, 0xda, 0x88, 0x57, 0xba, 0xc8, 0xb8, 0x32, 0x64, 0x10, 0xb9, 0xee, 0xff, 0xa7, 0xc1, 0x51, - 0x91, 0xd9, 0x53, 0xc8, 0x37, 0xf7, 0xc1, 0x0e, 0x4d, 0xc1, 0x9a, 0xe7, 0x9c, 0xfa, 0x51, 0xb0, - 0xdb, 0x89, 0x39, 0xd0, 0x64, 0xce, 0xdf, 0x55, 0xe6, 0x5c, 0xd4, 0x78, 0x57, 0x39, 0xa7, 0xf7, - 0x8a, 0x5f, 0x4c, 0xd5, 0xfc, 0x19, 0xe9, 0xfd, 0x02, 0xf6, 0x6b, 0x42, 0x39, 0x30, 0x43, 0x05, - 0xd6, 0x2d, 0x07, 0x66, 0x95, 0x93, 0xf9, 0x07, 0x9a, 0x23, 0xc6, 0x85, 0xb7, 0x01, 0xe8, 0x09, - 0xe7, 0x85, 0xa5, 0xcf, 0x5f, 0x5a, 0x52, 0x14, 0x8f, 0x70, 0xae, 0x2c, 0x08, 0x66, 0xef, 0x47, - 0x30, 0xf6, 0x40, 0x59, 0xb2, 0x51, 0x21, 0xd9, 0x28, 0x4b, 0x9e, 0x41, 0x4b, 0xf5, 0x4b, 0x91, - 0x0b, 0xf5, 0x28, 0xd8, 0xa5, 0x85, 0x68, 0xb7, 0x4a, 0x94, 0x48, 0xc6, 0xbc, 0xa9, 0x8e, 0xde, - 0x05, 0x00, 0x00, 0xff, 0xff, 0x75, 0x38, 0xad, 0x84, 0xe4, 0x05, 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/proto3_proto/proto3.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/proto3_proto/proto3.proto deleted file mode 100644 index 85a36818fc7..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/proto3_proto/proto3.proto +++ /dev/null @@ -1,87 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2014 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -syntax = "proto3"; - -import "google/protobuf/any.proto"; -import "testdata/test.proto"; - -package proto3_proto; - -message Message { - enum Humour { - UNKNOWN = 0; - PUNS = 1; - SLAPSTICK = 2; - BILL_BAILEY = 3; - } - - string name = 1; - Humour hilarity = 2; - uint32 height_in_cm = 3; - bytes data = 4; - int64 result_count = 7; - bool true_scotsman = 8; - float score = 9; - - repeated uint64 key = 5; - repeated int32 short_key = 19; - Nested nested = 6; - repeated Humour r_funny = 16; - - map terrain = 10; - testdata.SubDefaults proto2_field = 11; - map proto2_value = 13; - - google.protobuf.Any anything = 14; - repeated google.protobuf.Any many_things = 15; - - Message submessage = 17; - repeated Message children = 18; -} - -message Nested { - string bunny = 1; - bool cute = 2; -} - -message MessageWithMap { - map byte_mapping = 1; -} - - -message IntMap { - map rtt = 1; -} - -message IntMaps { - repeated IntMap maps = 1; -} \ No newline at end of file diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/skip_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/skip_gogo.go deleted file mode 100644 index 5a5fd93f7c1..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/skip_gogo.go +++ /dev/null @@ -1,119 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package proto - -import ( - "fmt" - "io" -) - -func Skip(data []byte) (n int, err error) { - l := len(data) - index := 0 - for index < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if index >= l { - return 0, io.ErrUnexpectedEOF - } - b := data[index] - index++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for { - if index >= l { - return 0, io.ErrUnexpectedEOF - } - index++ - if data[index-1] < 0x80 { - break - } - } - return index, nil - case 1: - index += 8 - return index, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if index >= l { - return 0, io.ErrUnexpectedEOF - } - b := data[index] - index++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - index += length - return index, nil - case 3: - for { - var innerWire uint64 - var start int = index - for shift := uint(0); ; shift += 7 { - if index >= l { - return 0, io.ErrUnexpectedEOF - } - b := data[index] - index++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := Skip(data[start:]) - if err != nil { - return 0, err - } - index = start + next - } - return index, nil - case 4: - return index, nil - case 5: - index += 4 - return index, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text.go deleted file mode 100644 index d63732fcbda..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text.go +++ /dev/null @@ -1,928 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -// Functions for writing the text protocol buffer format. - -import ( - "bufio" - "bytes" - "encoding" - "errors" - "fmt" - "io" - "log" - "math" - "reflect" - "sort" - "strings" - "sync" - "time" -) - -var ( - newline = []byte("\n") - spaces = []byte(" ") - gtNewline = []byte(">\n") - endBraceNewline = []byte("}\n") - backslashN = []byte{'\\', 'n'} - backslashR = []byte{'\\', 'r'} - backslashT = []byte{'\\', 't'} - backslashDQ = []byte{'\\', '"'} - backslashBS = []byte{'\\', '\\'} - posInf = []byte("inf") - negInf = []byte("-inf") - nan = []byte("nan") -) - -type writer interface { - io.Writer - WriteByte(byte) error -} - -// textWriter is an io.Writer that tracks its indentation level. -type textWriter struct { - ind int - complete bool // if the current position is a complete line - compact bool // whether to write out as a one-liner - w writer -} - -func (w *textWriter) WriteString(s string) (n int, err error) { - if !strings.Contains(s, "\n") { - if !w.compact && w.complete { - w.writeIndent() - } - w.complete = false - return io.WriteString(w.w, s) - } - // WriteString is typically called without newlines, so this - // codepath and its copy are rare. We copy to avoid - // duplicating all of Write's logic here. - return w.Write([]byte(s)) -} - -func (w *textWriter) Write(p []byte) (n int, err error) { - newlines := bytes.Count(p, newline) - if newlines == 0 { - if !w.compact && w.complete { - w.writeIndent() - } - n, err = w.w.Write(p) - w.complete = false - return n, err - } - - frags := bytes.SplitN(p, newline, newlines+1) - if w.compact { - for i, frag := range frags { - if i > 0 { - if err := w.w.WriteByte(' '); err != nil { - return n, err - } - n++ - } - nn, err := w.w.Write(frag) - n += nn - if err != nil { - return n, err - } - } - return n, nil - } - - for i, frag := range frags { - if w.complete { - w.writeIndent() - } - nn, err := w.w.Write(frag) - n += nn - if err != nil { - return n, err - } - if i+1 < len(frags) { - if err := w.w.WriteByte('\n'); err != nil { - return n, err - } - n++ - } - } - w.complete = len(frags[len(frags)-1]) == 0 - return n, nil -} - -func (w *textWriter) WriteByte(c byte) error { - if w.compact && c == '\n' { - c = ' ' - } - if !w.compact && w.complete { - w.writeIndent() - } - err := w.w.WriteByte(c) - w.complete = c == '\n' - return err -} - -func (w *textWriter) indent() { w.ind++ } - -func (w *textWriter) unindent() { - if w.ind == 0 { - log.Print("proto: textWriter unindented too far") - return - } - w.ind-- -} - -func writeName(w *textWriter, props *Properties) error { - if _, err := w.WriteString(props.OrigName); err != nil { - return err - } - if props.Wire != "group" { - return w.WriteByte(':') - } - return nil -} - -// raw is the interface satisfied by RawMessage. -type raw interface { - Bytes() []byte -} - -func requiresQuotes(u string) bool { - // When type URL contains any characters except [0-9A-Za-z./\-]*, it must be quoted. - for _, ch := range u { - switch { - case ch == '.' || ch == '/' || ch == '_': - continue - case '0' <= ch && ch <= '9': - continue - case 'A' <= ch && ch <= 'Z': - continue - case 'a' <= ch && ch <= 'z': - continue - default: - return true - } - } - return false -} - -// isAny reports whether sv is a google.protobuf.Any message -func isAny(sv reflect.Value) bool { - type wkt interface { - XXX_WellKnownType() string - } - t, ok := sv.Addr().Interface().(wkt) - return ok && t.XXX_WellKnownType() == "Any" -} - -// writeProto3Any writes an expanded google.protobuf.Any message. -// -// It returns (false, nil) if sv value can't be unmarshaled (e.g. because -// required messages are not linked in). -// -// It returns (true, error) when sv was written in expanded format or an error -// was encountered. -func (tm *TextMarshaler) writeProto3Any(w *textWriter, sv reflect.Value) (bool, error) { - turl := sv.FieldByName("TypeUrl") - val := sv.FieldByName("Value") - if !turl.IsValid() || !val.IsValid() { - return true, errors.New("proto: invalid google.protobuf.Any message") - } - - b, ok := val.Interface().([]byte) - if !ok { - return true, errors.New("proto: invalid google.protobuf.Any message") - } - - parts := strings.Split(turl.String(), "/") - mt := MessageType(parts[len(parts)-1]) - if mt == nil { - return false, nil - } - m := reflect.New(mt.Elem()) - if err := Unmarshal(b, m.Interface().(Message)); err != nil { - return false, nil - } - w.Write([]byte("[")) - u := turl.String() - if requiresQuotes(u) { - writeString(w, u) - } else { - w.Write([]byte(u)) - } - if w.compact { - w.Write([]byte("]:<")) - } else { - w.Write([]byte("]: <\n")) - w.ind++ - } - if err := tm.writeStruct(w, m.Elem()); err != nil { - return true, err - } - if w.compact { - w.Write([]byte("> ")) - } else { - w.ind-- - w.Write([]byte(">\n")) - } - return true, nil -} - -func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { - if tm.ExpandAny && isAny(sv) { - if canExpand, err := tm.writeProto3Any(w, sv); canExpand { - return err - } - } - st := sv.Type() - sprops := GetProperties(st) - for i := 0; i < sv.NumField(); i++ { - fv := sv.Field(i) - props := sprops.Prop[i] - name := st.Field(i).Name - - if strings.HasPrefix(name, "XXX_") { - // There are two XXX_ fields: - // XXX_unrecognized []byte - // XXX_extensions map[int32]proto.Extension - // The first is handled here; - // the second is handled at the bottom of this function. - if name == "XXX_unrecognized" && !fv.IsNil() { - if err := writeUnknownStruct(w, fv.Interface().([]byte)); err != nil { - return err - } - } - continue - } - if fv.Kind() == reflect.Ptr && fv.IsNil() { - // Field not filled in. This could be an optional field or - // a required field that wasn't filled in. Either way, there - // isn't anything we can show for it. - continue - } - if fv.Kind() == reflect.Slice && fv.IsNil() { - // Repeated field that is empty, or a bytes field that is unused. - continue - } - - if props.Repeated && fv.Kind() == reflect.Slice { - // Repeated field. - for j := 0; j < fv.Len(); j++ { - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - v := fv.Index(j) - if v.Kind() == reflect.Ptr && v.IsNil() { - // A nil message in a repeated field is not valid, - // but we can handle that more gracefully than panicking. - if _, err := w.Write([]byte("\n")); err != nil { - return err - } - continue - } - if len(props.Enum) > 0 { - if err := tm.writeEnum(w, v, props); err != nil { - return err - } - } else if err := tm.writeAny(w, v, props); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - continue - } - if fv.Kind() == reflect.Map { - // Map fields are rendered as a repeated struct with key/value fields. - keys := fv.MapKeys() - sort.Sort(mapKeys(keys)) - for _, key := range keys { - val := fv.MapIndex(key) - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - // open struct - if err := w.WriteByte('<'); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte('\n'); err != nil { - return err - } - } - w.indent() - // key - if _, err := w.WriteString("key:"); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, key, props.mkeyprop); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - // nil values aren't legal, but we can avoid panicking because of them. - if val.Kind() != reflect.Ptr || !val.IsNil() { - // value - if _, err := w.WriteString("value:"); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, val, props.mvalprop); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - // close struct - w.unindent() - if err := w.WriteByte('>'); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - continue - } - if props.proto3 && fv.Kind() == reflect.Slice && fv.Len() == 0 { - // empty bytes field - continue - } - if props.proto3 && fv.Kind() != reflect.Ptr && fv.Kind() != reflect.Slice { - // proto3 non-repeated scalar field; skip if zero value - if isProto3Zero(fv) { - continue - } - } - - if fv.Kind() == reflect.Interface { - // Check if it is a oneof. - if st.Field(i).Tag.Get("protobuf_oneof") != "" { - // fv is nil, or holds a pointer to generated struct. - // That generated struct has exactly one field, - // which has a protobuf struct tag. - if fv.IsNil() { - continue - } - inner := fv.Elem().Elem() // interface -> *T -> T - tag := inner.Type().Field(0).Tag.Get("protobuf") - props = new(Properties) // Overwrite the outer props var, but not its pointee. - props.Parse(tag) - // Write the value in the oneof, not the oneof itself. - fv = inner.Field(0) - - // Special case to cope with malformed messages gracefully: - // If the value in the oneof is a nil pointer, don't panic - // in writeAny. - if fv.Kind() == reflect.Ptr && fv.IsNil() { - // Use errors.New so writeAny won't render quotes. - msg := errors.New("/* nil */") - fv = reflect.ValueOf(&msg).Elem() - } - } - } - - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if b, ok := fv.Interface().(raw); ok { - if err := writeRaw(w, b.Bytes()); err != nil { - return err - } - continue - } - - if len(props.Enum) > 0 { - if err := tm.writeEnum(w, fv, props); err != nil { - return err - } - } else if err := tm.writeAny(w, fv, props); err != nil { - return err - } - - if err := w.WriteByte('\n'); err != nil { - return err - } - } - - // Extensions (the XXX_extensions field). - pv := sv - if pv.CanAddr() { - pv = sv.Addr() - } else { - pv = reflect.New(sv.Type()) - pv.Elem().Set(sv) - } - if pv.Type().Implements(extensionRangeType) { - if err := tm.writeExtensions(w, pv); err != nil { - return err - } - } - - return nil -} - -// writeRaw writes an uninterpreted raw message. -func writeRaw(w *textWriter, b []byte) error { - if err := w.WriteByte('<'); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte('\n'); err != nil { - return err - } - } - w.indent() - if err := writeUnknownStruct(w, b); err != nil { - return err - } - w.unindent() - if err := w.WriteByte('>'); err != nil { - return err - } - return nil -} - -// writeAny writes an arbitrary field. -func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error { - v = reflect.Indirect(v) - - if props != nil { - if len(props.CustomType) > 0 { - custom, ok := v.Interface().(Marshaler) - if ok { - data, err := custom.Marshal() - if err != nil { - return err - } - if err := writeString(w, string(data)); err != nil { - return err - } - return nil - } - } else if props.StdTime { - t, ok := v.Interface().(time.Time) - if !ok { - return fmt.Errorf("stdtime is not time.Time, but %T", v.Interface()) - } - tproto, err := timestampProto(t) - if err != nil { - return err - } - props.StdTime = false - err = tm.writeAny(w, reflect.ValueOf(tproto), props) - props.StdTime = true - return err - } else if props.StdDuration { - d, ok := v.Interface().(time.Duration) - if !ok { - return fmt.Errorf("stdtime is not time.Duration, but %T", v.Interface()) - } - dproto := durationProto(d) - props.StdDuration = false - err := tm.writeAny(w, reflect.ValueOf(dproto), props) - props.StdDuration = true - return err - } - } - - // Floats have special cases. - if v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 { - x := v.Float() - var b []byte - switch { - case math.IsInf(x, 1): - b = posInf - case math.IsInf(x, -1): - b = negInf - case math.IsNaN(x): - b = nan - } - if b != nil { - _, err := w.Write(b) - return err - } - // Other values are handled below. - } - - // We don't attempt to serialise every possible value type; only those - // that can occur in protocol buffers. - switch v.Kind() { - case reflect.Slice: - // Should only be a []byte; repeated fields are handled in writeStruct. - if err := writeString(w, string(v.Bytes())); err != nil { - return err - } - case reflect.String: - if err := writeString(w, v.String()); err != nil { - return err - } - case reflect.Struct: - // Required/optional group/message. - var bra, ket byte = '<', '>' - if props != nil && props.Wire == "group" { - bra, ket = '{', '}' - } - if err := w.WriteByte(bra); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte('\n'); err != nil { - return err - } - } - w.indent() - if etm, ok := v.Interface().(encoding.TextMarshaler); ok { - text, err := etm.MarshalText() - if err != nil { - return err - } - if _, err = w.Write(text); err != nil { - return err - } - } else if err := tm.writeStruct(w, v); err != nil { - return err - } - w.unindent() - if err := w.WriteByte(ket); err != nil { - return err - } - default: - _, err := fmt.Fprint(w, v.Interface()) - return err - } - return nil -} - -// equivalent to C's isprint. -func isprint(c byte) bool { - return c >= 0x20 && c < 0x7f -} - -// writeString writes a string in the protocol buffer text format. -// It is similar to strconv.Quote except we don't use Go escape sequences, -// we treat the string as a byte sequence, and we use octal escapes. -// These differences are to maintain interoperability with the other -// languages' implementations of the text format. -func writeString(w *textWriter, s string) error { - // use WriteByte here to get any needed indent - if err := w.WriteByte('"'); err != nil { - return err - } - // Loop over the bytes, not the runes. - for i := 0; i < len(s); i++ { - var err error - // Divergence from C++: we don't escape apostrophes. - // There's no need to escape them, and the C++ parser - // copes with a naked apostrophe. - switch c := s[i]; c { - case '\n': - _, err = w.w.Write(backslashN) - case '\r': - _, err = w.w.Write(backslashR) - case '\t': - _, err = w.w.Write(backslashT) - case '"': - _, err = w.w.Write(backslashDQ) - case '\\': - _, err = w.w.Write(backslashBS) - default: - if isprint(c) { - err = w.w.WriteByte(c) - } else { - _, err = fmt.Fprintf(w.w, "\\%03o", c) - } - } - if err != nil { - return err - } - } - return w.WriteByte('"') -} - -func writeUnknownStruct(w *textWriter, data []byte) (err error) { - if !w.compact { - if _, err := fmt.Fprintf(w, "/* %d unknown bytes */\n", len(data)); err != nil { - return err - } - } - b := NewBuffer(data) - for b.index < len(b.buf) { - x, err := b.DecodeVarint() - if err != nil { - _, ferr := fmt.Fprintf(w, "/* %v */\n", err) - return ferr - } - wire, tag := x&7, x>>3 - if wire == WireEndGroup { - w.unindent() - if _, werr := w.Write(endBraceNewline); werr != nil { - return werr - } - continue - } - if _, ferr := fmt.Fprint(w, tag); ferr != nil { - return ferr - } - if wire != WireStartGroup { - if err = w.WriteByte(':'); err != nil { - return err - } - } - if !w.compact || wire == WireStartGroup { - if err = w.WriteByte(' '); err != nil { - return err - } - } - switch wire { - case WireBytes: - buf, e := b.DecodeRawBytes(false) - if e == nil { - _, err = fmt.Fprintf(w, "%q", buf) - } else { - _, err = fmt.Fprintf(w, "/* %v */", e) - } - case WireFixed32: - x, err = b.DecodeFixed32() - err = writeUnknownInt(w, x, err) - case WireFixed64: - x, err = b.DecodeFixed64() - err = writeUnknownInt(w, x, err) - case WireStartGroup: - err = w.WriteByte('{') - w.indent() - case WireVarint: - x, err = b.DecodeVarint() - err = writeUnknownInt(w, x, err) - default: - _, err = fmt.Fprintf(w, "/* unknown wire type %d */", wire) - } - if err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - return nil -} - -func writeUnknownInt(w *textWriter, x uint64, err error) error { - if err == nil { - _, err = fmt.Fprint(w, x) - } else { - _, err = fmt.Fprintf(w, "/* %v */", err) - } - return err -} - -type int32Slice []int32 - -func (s int32Slice) Len() int { return len(s) } -func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] } -func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } - -// writeExtensions writes all the extensions in pv. -// pv is assumed to be a pointer to a protocol message struct that is extendable. -func (tm *TextMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error { - emap := extensionMaps[pv.Type().Elem()] - e := pv.Interface().(Message) - - var m map[int32]Extension - var mu sync.Locker - if em, ok := e.(extensionsBytes); ok { - eb := em.GetExtensions() - var err error - m, err = BytesToExtensionsMap(*eb) - if err != nil { - return err - } - mu = notLocker{} - } else if _, ok := e.(extendableProto); ok { - ep, _ := extendable(e) - m, mu = ep.extensionsRead() - if m == nil { - return nil - } - } - - // Order the extensions by ID. - // This isn't strictly necessary, but it will give us - // canonical output, which will also make testing easier. - - mu.Lock() - ids := make([]int32, 0, len(m)) - for id := range m { - ids = append(ids, id) - } - sort.Sort(int32Slice(ids)) - mu.Unlock() - - for _, extNum := range ids { - ext := m[extNum] - var desc *ExtensionDesc - if emap != nil { - desc = emap[extNum] - } - if desc == nil { - // Unknown extension. - if err := writeUnknownStruct(w, ext.enc); err != nil { - return err - } - continue - } - - pb, err := GetExtension(e, desc) - if err != nil { - return fmt.Errorf("failed getting extension: %v", err) - } - - // Repeated extensions will appear as a slice. - if !desc.repeated() { - if err := tm.writeExtension(w, desc.Name, pb); err != nil { - return err - } - } else { - v := reflect.ValueOf(pb) - for i := 0; i < v.Len(); i++ { - if err := tm.writeExtension(w, desc.Name, v.Index(i).Interface()); err != nil { - return err - } - } - } - } - return nil -} - -func (tm *TextMarshaler) writeExtension(w *textWriter, name string, pb interface{}) error { - if _, err := fmt.Fprintf(w, "[%s]:", name); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, reflect.ValueOf(pb), nil); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - return nil -} - -func (w *textWriter) writeIndent() { - if !w.complete { - return - } - remain := w.ind * 2 - for remain > 0 { - n := remain - if n > len(spaces) { - n = len(spaces) - } - w.w.Write(spaces[:n]) - remain -= n - } - w.complete = false -} - -// TextMarshaler is a configurable text format marshaler. -type TextMarshaler struct { - Compact bool // use compact text format (one line). - ExpandAny bool // expand google.protobuf.Any messages of known types -} - -// Marshal writes a given protocol buffer in text format. -// The only errors returned are from w. -func (tm *TextMarshaler) Marshal(w io.Writer, pb Message) error { - val := reflect.ValueOf(pb) - if pb == nil || val.IsNil() { - w.Write([]byte("")) - return nil - } - var bw *bufio.Writer - ww, ok := w.(writer) - if !ok { - bw = bufio.NewWriter(w) - ww = bw - } - aw := &textWriter{ - w: ww, - complete: true, - compact: tm.Compact, - } - - if etm, ok := pb.(encoding.TextMarshaler); ok { - text, err := etm.MarshalText() - if err != nil { - return err - } - if _, err = aw.Write(text); err != nil { - return err - } - if bw != nil { - return bw.Flush() - } - return nil - } - // Dereference the received pointer so we don't have outer < and >. - v := reflect.Indirect(val) - if err := tm.writeStruct(aw, v); err != nil { - return err - } - if bw != nil { - return bw.Flush() - } - return nil -} - -// Text is the same as Marshal, but returns the string directly. -func (tm *TextMarshaler) Text(pb Message) string { - var buf bytes.Buffer - tm.Marshal(&buf, pb) - return buf.String() -} - -var ( - defaultTextMarshaler = TextMarshaler{} - compactTextMarshaler = TextMarshaler{Compact: true} -) - -// TODO: consider removing some of the Marshal functions below. - -// MarshalText writes a given protocol buffer in text format. -// The only errors returned are from w. -func MarshalText(w io.Writer, pb Message) error { return defaultTextMarshaler.Marshal(w, pb) } - -// MarshalTextString is the same as MarshalText, but returns the string directly. -func MarshalTextString(pb Message) string { return defaultTextMarshaler.Text(pb) } - -// CompactText writes a given protocol buffer in compact text format (one line). -func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Marshal(w, pb) } - -// CompactTextString is the same as CompactText, but returns the string directly. -func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) } diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text_gogo.go deleted file mode 100644 index 1d6c6aa0e41..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text_gogo.go +++ /dev/null @@ -1,57 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package proto - -import ( - "fmt" - "reflect" -) - -func (tm *TextMarshaler) writeEnum(w *textWriter, v reflect.Value, props *Properties) error { - m, ok := enumStringMaps[props.Enum] - if !ok { - if err := tm.writeAny(w, v, props); err != nil { - return err - } - } - key := int32(0) - if v.Kind() == reflect.Ptr { - key = int32(v.Elem().Int()) - } else { - key = int32(v.Int()) - } - s, ok := m[key] - if !ok { - if err := tm.writeAny(w, v, props); err != nil { - return err - } - } - _, err := fmt.Fprint(w, s) - return err -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text_parser.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text_parser.go deleted file mode 100644 index 9db12e96018..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/text_parser.go +++ /dev/null @@ -1,1013 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -// Functions for parsing the Text protocol buffer format. -// TODO: message sets. - -import ( - "encoding" - "errors" - "fmt" - "reflect" - "strconv" - "strings" - "time" - "unicode/utf8" -) - -// Error string emitted when deserializing Any and fields are already set -const anyRepeatedlyUnpacked = "Any message unpacked multiple times, or %q already set" - -type ParseError struct { - Message string - Line int // 1-based line number - Offset int // 0-based byte offset from start of input -} - -func (p *ParseError) Error() string { - if p.Line == 1 { - // show offset only for first line - return fmt.Sprintf("line 1.%d: %v", p.Offset, p.Message) - } - return fmt.Sprintf("line %d: %v", p.Line, p.Message) -} - -type token struct { - value string - err *ParseError - line int // line number - offset int // byte number from start of input, not start of line - unquoted string // the unquoted version of value, if it was a quoted string -} - -func (t *token) String() string { - if t.err == nil { - return fmt.Sprintf("%q (line=%d, offset=%d)", t.value, t.line, t.offset) - } - return fmt.Sprintf("parse error: %v", t.err) -} - -type textParser struct { - s string // remaining input - done bool // whether the parsing is finished (success or error) - backed bool // whether back() was called - offset, line int - cur token -} - -func newTextParser(s string) *textParser { - p := new(textParser) - p.s = s - p.line = 1 - p.cur.line = 1 - return p -} - -func (p *textParser) errorf(format string, a ...interface{}) *ParseError { - pe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset} - p.cur.err = pe - p.done = true - return pe -} - -// Numbers and identifiers are matched by [-+._A-Za-z0-9] -func isIdentOrNumberChar(c byte) bool { - switch { - case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z': - return true - case '0' <= c && c <= '9': - return true - } - switch c { - case '-', '+', '.', '_': - return true - } - return false -} - -func isWhitespace(c byte) bool { - switch c { - case ' ', '\t', '\n', '\r': - return true - } - return false -} - -func isQuote(c byte) bool { - switch c { - case '"', '\'': - return true - } - return false -} - -func (p *textParser) skipWhitespace() { - i := 0 - for i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') { - if p.s[i] == '#' { - // comment; skip to end of line or input - for i < len(p.s) && p.s[i] != '\n' { - i++ - } - if i == len(p.s) { - break - } - } - if p.s[i] == '\n' { - p.line++ - } - i++ - } - p.offset += i - p.s = p.s[i:len(p.s)] - if len(p.s) == 0 { - p.done = true - } -} - -func (p *textParser) advance() { - // Skip whitespace - p.skipWhitespace() - if p.done { - return - } - - // Start of non-whitespace - p.cur.err = nil - p.cur.offset, p.cur.line = p.offset, p.line - p.cur.unquoted = "" - switch p.s[0] { - case '<', '>', '{', '}', ':', '[', ']', ';', ',', '/': - // Single symbol - p.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)] - case '"', '\'': - // Quoted string - i := 1 - for i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\n' { - if p.s[i] == '\\' && i+1 < len(p.s) { - // skip escaped char - i++ - } - i++ - } - if i >= len(p.s) || p.s[i] != p.s[0] { - p.errorf("unmatched quote") - return - } - unq, err := unquoteC(p.s[1:i], rune(p.s[0])) - if err != nil { - p.errorf("invalid quoted string %s: %v", p.s[0:i+1], err) - return - } - p.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)] - p.cur.unquoted = unq - default: - i := 0 - for i < len(p.s) && isIdentOrNumberChar(p.s[i]) { - i++ - } - if i == 0 { - p.errorf("unexpected byte %#x", p.s[0]) - return - } - p.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)] - } - p.offset += len(p.cur.value) -} - -var ( - errBadUTF8 = errors.New("proto: bad UTF-8") - errBadHex = errors.New("proto: bad hexadecimal") -) - -func unquoteC(s string, quote rune) (string, error) { - // This is based on C++'s tokenizer.cc. - // Despite its name, this is *not* parsing C syntax. - // For instance, "\0" is an invalid quoted string. - - // Avoid allocation in trivial cases. - simple := true - for _, r := range s { - if r == '\\' || r == quote { - simple = false - break - } - } - if simple { - return s, nil - } - - buf := make([]byte, 0, 3*len(s)/2) - for len(s) > 0 { - r, n := utf8.DecodeRuneInString(s) - if r == utf8.RuneError && n == 1 { - return "", errBadUTF8 - } - s = s[n:] - if r != '\\' { - if r < utf8.RuneSelf { - buf = append(buf, byte(r)) - } else { - buf = append(buf, string(r)...) - } - continue - } - - ch, tail, err := unescape(s) - if err != nil { - return "", err - } - buf = append(buf, ch...) - s = tail - } - return string(buf), nil -} - -func unescape(s string) (ch string, tail string, err error) { - r, n := utf8.DecodeRuneInString(s) - if r == utf8.RuneError && n == 1 { - return "", "", errBadUTF8 - } - s = s[n:] - switch r { - case 'a': - return "\a", s, nil - case 'b': - return "\b", s, nil - case 'f': - return "\f", s, nil - case 'n': - return "\n", s, nil - case 'r': - return "\r", s, nil - case 't': - return "\t", s, nil - case 'v': - return "\v", s, nil - case '?': - return "?", s, nil // trigraph workaround - case '\'', '"', '\\': - return string(r), s, nil - case '0', '1', '2', '3', '4', '5', '6', '7', 'x', 'X': - if len(s) < 2 { - return "", "", fmt.Errorf(`\%c requires 2 following digits`, r) - } - base := 8 - ss := s[:2] - s = s[2:] - if r == 'x' || r == 'X' { - base = 16 - } else { - ss = string(r) + ss - } - i, err := strconv.ParseUint(ss, base, 8) - if err != nil { - return "", "", err - } - return string([]byte{byte(i)}), s, nil - case 'u', 'U': - n := 4 - if r == 'U' { - n = 8 - } - if len(s) < n { - return "", "", fmt.Errorf(`\%c requires %d digits`, r, n) - } - - bs := make([]byte, n/2) - for i := 0; i < n; i += 2 { - a, ok1 := unhex(s[i]) - b, ok2 := unhex(s[i+1]) - if !ok1 || !ok2 { - return "", "", errBadHex - } - bs[i/2] = a<<4 | b - } - s = s[n:] - return string(bs), s, nil - } - return "", "", fmt.Errorf(`unknown escape \%c`, r) -} - -// Adapted from src/pkg/strconv/quote.go. -func unhex(b byte) (v byte, ok bool) { - switch { - case '0' <= b && b <= '9': - return b - '0', true - case 'a' <= b && b <= 'f': - return b - 'a' + 10, true - case 'A' <= b && b <= 'F': - return b - 'A' + 10, true - } - return 0, false -} - -// Back off the parser by one token. Can only be done between calls to next(). -// It makes the next advance() a no-op. -func (p *textParser) back() { p.backed = true } - -// Advances the parser and returns the new current token. -func (p *textParser) next() *token { - if p.backed || p.done { - p.backed = false - return &p.cur - } - p.advance() - if p.done { - p.cur.value = "" - } else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) { - // Look for multiple quoted strings separated by whitespace, - // and concatenate them. - cat := p.cur - for { - p.skipWhitespace() - if p.done || !isQuote(p.s[0]) { - break - } - p.advance() - if p.cur.err != nil { - return &p.cur - } - cat.value += " " + p.cur.value - cat.unquoted += p.cur.unquoted - } - p.done = false // parser may have seen EOF, but we want to return cat - p.cur = cat - } - return &p.cur -} - -func (p *textParser) consumeToken(s string) error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != s { - p.back() - return p.errorf("expected %q, found %q", s, tok.value) - } - return nil -} - -// Return a RequiredNotSetError indicating which required field was not set. -func (p *textParser) missingRequiredFieldError(sv reflect.Value) *RequiredNotSetError { - st := sv.Type() - sprops := GetProperties(st) - for i := 0; i < st.NumField(); i++ { - if !isNil(sv.Field(i)) { - continue - } - - props := sprops.Prop[i] - if props.Required { - return &RequiredNotSetError{fmt.Sprintf("%v.%v", st, props.OrigName)} - } - } - return &RequiredNotSetError{fmt.Sprintf("%v.", st)} // should not happen -} - -// Returns the index in the struct for the named field, as well as the parsed tag properties. -func structFieldByName(sprops *StructProperties, name string) (int, *Properties, bool) { - i, ok := sprops.decoderOrigNames[name] - if ok { - return i, sprops.Prop[i], true - } - return -1, nil, false -} - -// Consume a ':' from the input stream (if the next token is a colon), -// returning an error if a colon is needed but not present. -func (p *textParser) checkForColon(props *Properties, typ reflect.Type) *ParseError { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != ":" { - // Colon is optional when the field is a group or message. - needColon := true - switch props.Wire { - case "group": - needColon = false - case "bytes": - // A "bytes" field is either a message, a string, or a repeated field; - // those three become *T, *string and []T respectively, so we can check for - // this field being a pointer to a non-string. - if typ.Kind() == reflect.Ptr { - // *T or *string - if typ.Elem().Kind() == reflect.String { - break - } - } else if typ.Kind() == reflect.Slice { - // []T or []*T - if typ.Elem().Kind() != reflect.Ptr { - break - } - } else if typ.Kind() == reflect.String { - // The proto3 exception is for a string field, - // which requires a colon. - break - } - needColon = false - } - if needColon { - return p.errorf("expected ':', found %q", tok.value) - } - p.back() - } - return nil -} - -func (p *textParser) readStruct(sv reflect.Value, terminator string) error { - st := sv.Type() - sprops := GetProperties(st) - reqCount := sprops.reqCount - var reqFieldErr error - fieldSet := make(map[string]bool) - // A struct is a sequence of "name: value", terminated by one of - // '>' or '}', or the end of the input. A name may also be - // "[extension]" or "[type/url]". - // - // The whole struct can also be an expanded Any message, like: - // [type/url] < ... struct contents ... > - for { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == terminator { - break - } - if tok.value == "[" { - // Looks like an extension or an Any. - // - // TODO: Check whether we need to handle - // namespace rooted names (e.g. ".something.Foo"). - extName, err := p.consumeExtName() - if err != nil { - return err - } - - if s := strings.LastIndex(extName, "/"); s >= 0 { - // If it contains a slash, it's an Any type URL. - messageName := extName[s+1:] - mt := MessageType(messageName) - if mt == nil { - return p.errorf("unrecognized message %q in google.protobuf.Any", messageName) - } - tok = p.next() - if tok.err != nil { - return tok.err - } - // consume an optional colon - if tok.value == ":" { - tok = p.next() - if tok.err != nil { - return tok.err - } - } - var terminator string - switch tok.value { - case "<": - terminator = ">" - case "{": - terminator = "}" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - v := reflect.New(mt.Elem()) - if pe := p.readStruct(v.Elem(), terminator); pe != nil { - return pe - } - b, err := Marshal(v.Interface().(Message)) - if err != nil { - return p.errorf("failed to marshal message of type %q: %v", messageName, err) - } - if fieldSet["type_url"] { - return p.errorf(anyRepeatedlyUnpacked, "type_url") - } - if fieldSet["value"] { - return p.errorf(anyRepeatedlyUnpacked, "value") - } - sv.FieldByName("TypeUrl").SetString(extName) - sv.FieldByName("Value").SetBytes(b) - fieldSet["type_url"] = true - fieldSet["value"] = true - continue - } - - var desc *ExtensionDesc - // This could be faster, but it's functional. - // TODO: Do something smarter than a linear scan. - for _, d := range RegisteredExtensions(reflect.New(st).Interface().(Message)) { - if d.Name == extName { - desc = d - break - } - } - if desc == nil { - return p.errorf("unrecognized extension %q", extName) - } - - props := &Properties{} - props.Parse(desc.Tag) - - typ := reflect.TypeOf(desc.ExtensionType) - if err := p.checkForColon(props, typ); err != nil { - return err - } - - rep := desc.repeated() - - // Read the extension structure, and set it in - // the value we're constructing. - var ext reflect.Value - if !rep { - ext = reflect.New(typ).Elem() - } else { - ext = reflect.New(typ.Elem()).Elem() - } - if err := p.readAny(ext, props); err != nil { - if _, ok := err.(*RequiredNotSetError); !ok { - return err - } - reqFieldErr = err - } - ep := sv.Addr().Interface().(Message) - if !rep { - SetExtension(ep, desc, ext.Interface()) - } else { - old, err := GetExtension(ep, desc) - var sl reflect.Value - if err == nil { - sl = reflect.ValueOf(old) // existing slice - } else { - sl = reflect.MakeSlice(typ, 0, 1) - } - sl = reflect.Append(sl, ext) - SetExtension(ep, desc, sl.Interface()) - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - continue - } - - // This is a normal, non-extension field. - name := tok.value - var dst reflect.Value - fi, props, ok := structFieldByName(sprops, name) - if ok { - dst = sv.Field(fi) - } else if oop, ok := sprops.OneofTypes[name]; ok { - // It is a oneof. - props = oop.Prop - nv := reflect.New(oop.Type.Elem()) - dst = nv.Elem().Field(0) - field := sv.Field(oop.Field) - if !field.IsNil() { - return p.errorf("field '%s' would overwrite already parsed oneof '%s'", name, sv.Type().Field(oop.Field).Name) - } - field.Set(nv) - } - if !dst.IsValid() { - return p.errorf("unknown field name %q in %v", name, st) - } - - if dst.Kind() == reflect.Map { - // Consume any colon. - if err := p.checkForColon(props, dst.Type()); err != nil { - return err - } - - // Construct the map if it doesn't already exist. - if dst.IsNil() { - dst.Set(reflect.MakeMap(dst.Type())) - } - key := reflect.New(dst.Type().Key()).Elem() - val := reflect.New(dst.Type().Elem()).Elem() - - // The map entry should be this sequence of tokens: - // < key : KEY value : VALUE > - // However, implementations may omit key or value, and technically - // we should support them in any order. See b/28924776 for a time - // this went wrong. - - tok := p.next() - var terminator string - switch tok.value { - case "<": - terminator = ">" - case "{": - terminator = "}" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - for { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == terminator { - break - } - switch tok.value { - case "key": - if err := p.consumeToken(":"); err != nil { - return err - } - if err := p.readAny(key, props.mkeyprop); err != nil { - return err - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - case "value": - if err := p.checkForColon(props.mvalprop, dst.Type().Elem()); err != nil { - return err - } - if err := p.readAny(val, props.mvalprop); err != nil { - return err - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - default: - p.back() - return p.errorf(`expected "key", "value", or %q, found %q`, terminator, tok.value) - } - } - - dst.SetMapIndex(key, val) - continue - } - - // Check that it's not already set if it's not a repeated field. - if !props.Repeated && fieldSet[name] { - return p.errorf("non-repeated field %q was repeated", name) - } - - if err := p.checkForColon(props, dst.Type()); err != nil { - return err - } - - // Parse into the field. - fieldSet[name] = true - if err := p.readAny(dst, props); err != nil { - if _, ok := err.(*RequiredNotSetError); !ok { - return err - } - reqFieldErr = err - } - if props.Required { - reqCount-- - } - - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - - } - - if reqCount > 0 { - return p.missingRequiredFieldError(sv) - } - return reqFieldErr -} - -// consumeExtName consumes extension name or expanded Any type URL and the -// following ']'. It returns the name or URL consumed. -func (p *textParser) consumeExtName() (string, error) { - tok := p.next() - if tok.err != nil { - return "", tok.err - } - - // If extension name or type url is quoted, it's a single token. - if len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] { - name, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0])) - if err != nil { - return "", err - } - return name, p.consumeToken("]") - } - - // Consume everything up to "]" - var parts []string - for tok.value != "]" { - parts = append(parts, tok.value) - tok = p.next() - if tok.err != nil { - return "", p.errorf("unrecognized type_url or extension name: %s", tok.err) - } - } - return strings.Join(parts, ""), nil -} - -// consumeOptionalSeparator consumes an optional semicolon or comma. -// It is used in readStruct to provide backward compatibility. -func (p *textParser) consumeOptionalSeparator() error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != ";" && tok.value != "," { - p.back() - } - return nil -} - -func (p *textParser) readAny(v reflect.Value, props *Properties) error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == "" { - return p.errorf("unexpected EOF") - } - if len(props.CustomType) > 0 { - if props.Repeated { - t := reflect.TypeOf(v.Interface()) - if t.Kind() == reflect.Slice { - tc := reflect.TypeOf(new(Marshaler)) - ok := t.Elem().Implements(tc.Elem()) - if ok { - fv := v - flen := fv.Len() - if flen == fv.Cap() { - nav := reflect.MakeSlice(v.Type(), flen, 2*flen+1) - reflect.Copy(nav, fv) - fv.Set(nav) - } - fv.SetLen(flen + 1) - - // Read one. - p.back() - return p.readAny(fv.Index(flen), props) - } - } - } - if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { - custom := reflect.New(props.ctype.Elem()).Interface().(Unmarshaler) - err := custom.Unmarshal([]byte(tok.unquoted)) - if err != nil { - return p.errorf("%v %v: %v", err, v.Type(), tok.value) - } - v.Set(reflect.ValueOf(custom)) - } else { - custom := reflect.New(reflect.TypeOf(v.Interface())).Interface().(Unmarshaler) - err := custom.Unmarshal([]byte(tok.unquoted)) - if err != nil { - return p.errorf("%v %v: %v", err, v.Type(), tok.value) - } - v.Set(reflect.Indirect(reflect.ValueOf(custom))) - } - return nil - } - if props.StdTime { - fv := v - p.back() - props.StdTime = false - tproto := ×tamp{} - err := p.readAny(reflect.ValueOf(tproto).Elem(), props) - props.StdTime = true - if err != nil { - return err - } - tim, err := timestampFromProto(tproto) - if err != nil { - return err - } - if props.Repeated { - t := reflect.TypeOf(v.Interface()) - if t.Kind() == reflect.Slice { - if t.Elem().Kind() == reflect.Ptr { - ts := fv.Interface().([]*time.Time) - ts = append(ts, &tim) - fv.Set(reflect.ValueOf(ts)) - return nil - } else { - ts := fv.Interface().([]time.Time) - ts = append(ts, tim) - fv.Set(reflect.ValueOf(ts)) - return nil - } - } - } - if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { - v.Set(reflect.ValueOf(&tim)) - } else { - v.Set(reflect.Indirect(reflect.ValueOf(&tim))) - } - return nil - } - if props.StdDuration { - fv := v - p.back() - props.StdDuration = false - dproto := &duration{} - err := p.readAny(reflect.ValueOf(dproto).Elem(), props) - props.StdDuration = true - if err != nil { - return err - } - dur, err := durationFromProto(dproto) - if err != nil { - return err - } - if props.Repeated { - t := reflect.TypeOf(v.Interface()) - if t.Kind() == reflect.Slice { - if t.Elem().Kind() == reflect.Ptr { - ds := fv.Interface().([]*time.Duration) - ds = append(ds, &dur) - fv.Set(reflect.ValueOf(ds)) - return nil - } else { - ds := fv.Interface().([]time.Duration) - ds = append(ds, dur) - fv.Set(reflect.ValueOf(ds)) - return nil - } - } - } - if reflect.TypeOf(v.Interface()).Kind() == reflect.Ptr { - v.Set(reflect.ValueOf(&dur)) - } else { - v.Set(reflect.Indirect(reflect.ValueOf(&dur))) - } - return nil - } - switch fv := v; fv.Kind() { - case reflect.Slice: - at := v.Type() - if at.Elem().Kind() == reflect.Uint8 { - // Special case for []byte - if tok.value[0] != '"' && tok.value[0] != '\'' { - // Deliberately written out here, as the error after - // this switch statement would write "invalid []byte: ...", - // which is not as user-friendly. - return p.errorf("invalid string: %v", tok.value) - } - bytes := []byte(tok.unquoted) - fv.Set(reflect.ValueOf(bytes)) - return nil - } - // Repeated field. - if tok.value == "[" { - // Repeated field with list notation, like [1,2,3]. - for { - fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) - err := p.readAny(fv.Index(fv.Len()-1), props) - if err != nil { - return err - } - ntok := p.next() - if ntok.err != nil { - return ntok.err - } - if ntok.value == "]" { - break - } - if ntok.value != "," { - return p.errorf("Expected ']' or ',' found %q", ntok.value) - } - } - return nil - } - // One value of the repeated field. - p.back() - fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) - return p.readAny(fv.Index(fv.Len()-1), props) - case reflect.Bool: - // true/1/t/True or false/f/0/False. - switch tok.value { - case "true", "1", "t", "True": - fv.SetBool(true) - return nil - case "false", "0", "f", "False": - fv.SetBool(false) - return nil - } - case reflect.Float32, reflect.Float64: - v := tok.value - // Ignore 'f' for compatibility with output generated by C++, but don't - // remove 'f' when the value is "-inf" or "inf". - if strings.HasSuffix(v, "f") && tok.value != "-inf" && tok.value != "inf" { - v = v[:len(v)-1] - } - if f, err := strconv.ParseFloat(v, fv.Type().Bits()); err == nil { - fv.SetFloat(f) - return nil - } - case reflect.Int32: - if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil { - fv.SetInt(x) - return nil - } - - if len(props.Enum) == 0 { - break - } - m, ok := enumValueMaps[props.Enum] - if !ok { - break - } - x, ok := m[tok.value] - if !ok { - break - } - fv.SetInt(int64(x)) - return nil - case reflect.Int64: - if x, err := strconv.ParseInt(tok.value, 0, 64); err == nil { - fv.SetInt(x) - return nil - } - - case reflect.Ptr: - // A basic field (indirected through pointer), or a repeated message/group - p.back() - fv.Set(reflect.New(fv.Type().Elem())) - return p.readAny(fv.Elem(), props) - case reflect.String: - if tok.value[0] == '"' || tok.value[0] == '\'' { - fv.SetString(tok.unquoted) - return nil - } - case reflect.Struct: - var terminator string - switch tok.value { - case "{": - terminator = "}" - case "<": - terminator = ">" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - // TODO: Handle nested messages which implement encoding.TextUnmarshaler. - return p.readStruct(fv, terminator) - case reflect.Uint32: - if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { - fv.SetUint(uint64(x)) - return nil - } - case reflect.Uint64: - if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil { - fv.SetUint(x) - return nil - } - } - return p.errorf("invalid %v: %v", v.Type(), tok.value) -} - -// UnmarshalText reads a protocol buffer in Text format. UnmarshalText resets pb -// before starting to unmarshal, so any existing data in pb is always removed. -// If a required field is not set and no other error occurs, -// UnmarshalText returns *RequiredNotSetError. -func UnmarshalText(s string, pb Message) error { - if um, ok := pb.(encoding.TextUnmarshaler); ok { - err := um.UnmarshalText([]byte(s)) - return err - } - pb.Reset() - v := reflect.ValueOf(pb) - if pe := newTextParser(s).readStruct(v.Elem(), ""); pe != nil { - return pe - } - return nil -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/timestamp.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/timestamp.go deleted file mode 100644 index 9324f6542bc..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/timestamp.go +++ /dev/null @@ -1,113 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -// This file implements operations on google.protobuf.Timestamp. - -import ( - "errors" - "fmt" - "time" -) - -const ( - // Seconds field of the earliest valid Timestamp. - // This is time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). - minValidSeconds = -62135596800 - // Seconds field just after the latest valid Timestamp. - // This is time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). - maxValidSeconds = 253402300800 -) - -// validateTimestamp determines whether a Timestamp is valid. -// A valid timestamp represents a time in the range -// [0001-01-01, 10000-01-01) and has a Nanos field -// in the range [0, 1e9). -// -// If the Timestamp is valid, validateTimestamp returns nil. -// Otherwise, it returns an error that describes -// the problem. -// -// Every valid Timestamp can be represented by a time.Time, but the converse is not true. -func validateTimestamp(ts *timestamp) error { - if ts == nil { - return errors.New("timestamp: nil Timestamp") - } - if ts.Seconds < minValidSeconds { - return fmt.Errorf("timestamp: %#v before 0001-01-01", ts) - } - if ts.Seconds >= maxValidSeconds { - return fmt.Errorf("timestamp: %#v after 10000-01-01", ts) - } - if ts.Nanos < 0 || ts.Nanos >= 1e9 { - return fmt.Errorf("timestamp: %#v: nanos not in range [0, 1e9)", ts) - } - return nil -} - -// TimestampFromProto converts a google.protobuf.Timestamp proto to a time.Time. -// It returns an error if the argument is invalid. -// -// Unlike most Go functions, if Timestamp returns an error, the first return value -// is not the zero time.Time. Instead, it is the value obtained from the -// time.Unix function when passed the contents of the Timestamp, in the UTC -// locale. This may or may not be a meaningful time; many invalid Timestamps -// do map to valid time.Times. -// -// A nil Timestamp returns an error. The first return value in that case is -// undefined. -func timestampFromProto(ts *timestamp) (time.Time, error) { - // Don't return the zero value on error, because corresponds to a valid - // timestamp. Instead return whatever time.Unix gives us. - var t time.Time - if ts == nil { - t = time.Unix(0, 0).UTC() // treat nil like the empty Timestamp - } else { - t = time.Unix(ts.Seconds, int64(ts.Nanos)).UTC() - } - return t, validateTimestamp(ts) -} - -// TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. -// It returns an error if the resulting Timestamp is invalid. -func timestampProto(t time.Time) (*timestamp, error) { - seconds := t.Unix() - nanos := int32(t.Sub(time.Unix(seconds, 0))) - ts := ×tamp{ - Seconds: seconds, - Nanos: nanos, - } - if err := validateTimestamp(ts); err != nil { - return nil, err - } - return ts, nil -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/timestamp_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/timestamp_gogo.go deleted file mode 100644 index d4276474360..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/proto/timestamp_gogo.go +++ /dev/null @@ -1,229 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2016, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package proto - -import ( - "reflect" - "time" -) - -var timeType = reflect.TypeOf((*time.Time)(nil)).Elem() - -type timestamp struct { - Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` - Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` -} - -func (m *timestamp) Reset() { *m = timestamp{} } -func (*timestamp) ProtoMessage() {} -func (*timestamp) String() string { return "timestamp" } - -func init() { - RegisterType((*timestamp)(nil), "gogo.protobuf.proto.timestamp") -} - -func (o *Buffer) decTimestamp() (time.Time, error) { - b, err := o.DecodeRawBytes(true) - if err != nil { - return time.Time{}, err - } - tproto := ×tamp{} - if err := Unmarshal(b, tproto); err != nil { - return time.Time{}, err - } - return timestampFromProto(tproto) -} - -func (o *Buffer) dec_time(p *Properties, base structPointer) error { - t, err := o.decTimestamp() - if err != nil { - return err - } - setPtrCustomType(base, p.field, &t) - return nil -} - -func (o *Buffer) dec_ref_time(p *Properties, base structPointer) error { - t, err := o.decTimestamp() - if err != nil { - return err - } - setCustomType(base, p.field, &t) - return nil -} - -func (o *Buffer) dec_slice_time(p *Properties, base structPointer) error { - t, err := o.decTimestamp() - if err != nil { - return err - } - newBas := appendStructPointer(base, p.field, reflect.SliceOf(reflect.PtrTo(timeType))) - var zero field - setPtrCustomType(newBas, zero, &t) - return nil -} - -func (o *Buffer) dec_slice_ref_time(p *Properties, base structPointer) error { - t, err := o.decTimestamp() - if err != nil { - return err - } - newBas := appendStructPointer(base, p.field, reflect.SliceOf(timeType)) - var zero field - setCustomType(newBas, zero, &t) - return nil -} - -func size_time(p *Properties, base structPointer) (n int) { - structp := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(structp) { - return 0 - } - tim := structPointer_Interface(structp, timeType).(*time.Time) - t, err := timestampProto(*tim) - if err != nil { - return 0 - } - size := Size(t) - return size + sizeVarint(uint64(size)) + len(p.tagcode) -} - -func (o *Buffer) enc_time(p *Properties, base structPointer) error { - structp := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(structp) { - return ErrNil - } - tim := structPointer_Interface(structp, timeType).(*time.Time) - t, err := timestampProto(*tim) - if err != nil { - return err - } - data, err := Marshal(t) - if err != nil { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - return nil -} - -func size_ref_time(p *Properties, base structPointer) (n int) { - tim := structPointer_InterfaceAt(base, p.field, timeType).(*time.Time) - t, err := timestampProto(*tim) - if err != nil { - return 0 - } - size := Size(t) - return size + sizeVarint(uint64(size)) + len(p.tagcode) -} - -func (o *Buffer) enc_ref_time(p *Properties, base structPointer) error { - tim := structPointer_InterfaceAt(base, p.field, timeType).(*time.Time) - t, err := timestampProto(*tim) - if err != nil { - return err - } - data, err := Marshal(t) - if err != nil { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - return nil -} - -func size_slice_time(p *Properties, base structPointer) (n int) { - ptims := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(reflect.PtrTo(timeType))).(*[]*time.Time) - tims := *ptims - for i := 0; i < len(tims); i++ { - if tims[i] == nil { - return 0 - } - tproto, err := timestampProto(*tims[i]) - if err != nil { - return 0 - } - size := Size(tproto) - n += len(p.tagcode) + size + sizeVarint(uint64(size)) - } - return n -} - -func (o *Buffer) enc_slice_time(p *Properties, base structPointer) error { - ptims := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(reflect.PtrTo(timeType))).(*[]*time.Time) - tims := *ptims - for i := 0; i < len(tims); i++ { - if tims[i] == nil { - return errRepeatedHasNil - } - tproto, err := timestampProto(*tims[i]) - if err != nil { - return err - } - data, err := Marshal(tproto) - if err != nil { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - } - return nil -} - -func size_slice_ref_time(p *Properties, base structPointer) (n int) { - ptims := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(timeType)).(*[]time.Time) - tims := *ptims - for i := 0; i < len(tims); i++ { - tproto, err := timestampProto(tims[i]) - if err != nil { - return 0 - } - size := Size(tproto) - n += len(p.tagcode) + size + sizeVarint(uint64(size)) - } - return n -} - -func (o *Buffer) enc_slice_ref_time(p *Properties, base structPointer) error { - ptims := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(timeType)).(*[]time.Time) - tims := *ptims - for i := 0; i < len(tims); i++ { - tproto, err := timestampProto(tims[i]) - if err != nil { - return err - } - data, err := Marshal(tproto) - if err != nil { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - } - return nil -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/any.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/any.proto deleted file mode 100644 index 8152a34e484..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/any.proto +++ /dev/null @@ -1,140 +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. - -syntax = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option go_package = "types"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "AnyProto"; -option java_multiple_files = true; -option java_generate_equals_and_hash = true; -option objc_class_prefix = "GPB"; - -// `Any` contains an arbitrary serialized protocol buffer message along with a -// URL that describes the type of the serialized message. -// -// Protobuf library provides support to pack/unpack Any values in the form -// of utility functions or additional generated methods of the Any type. -// -// Example 1: Pack and unpack a message in C++. -// -// Foo foo = ...; -// Any any; -// any.PackFrom(foo); -// ... -// if (any.UnpackTo(&foo)) { -// ... -// } -// -// Example 2: Pack and unpack a message in Java. -// -// Foo foo = ...; -// Any any = Any.pack(foo); -// ... -// if (any.is(Foo.class)) { -// foo = any.unpack(Foo.class); -// } -// -// Example 3: Pack and unpack a message in Python. -// -// foo = Foo(...) -// any = Any() -// any.Pack(foo) -// ... -// if any.Is(Foo.DESCRIPTOR): -// any.Unpack(foo) -// ... -// -// The pack methods provided by protobuf library will by default use -// 'type.googleapis.com/full.type.name' as the type URL and the unpack -// methods only use the fully qualified type name after the last '/' -// in the type URL, for example "foo.bar.com/x/y.z" will yield type -// name "y.z". -// -// -// JSON -// ==== -// The JSON representation of an `Any` value uses the regular -// representation of the deserialized, embedded message, with an -// additional field `@type` which contains the type URL. Example: -// -// package google.profile; -// message Person { -// string first_name = 1; -// string last_name = 2; -// } -// -// { -// "@type": "type.googleapis.com/google.profile.Person", -// "firstName": , -// "lastName": -// } -// -// If the embedded message type is well-known and has a custom JSON -// representation, that representation will be embedded adding a field -// `value` which holds the custom JSON in addition to the `@type` -// field. Example (for message [google.protobuf.Duration][]): -// -// { -// "@type": "type.googleapis.com/google.protobuf.Duration", -// "value": "1.212s" -// } -// -message Any { - // A URL/resource name whose content describes the type of the - // serialized protocol buffer message. - // - // For URLs which use the scheme `http`, `https`, or no scheme, the - // following restrictions and interpretations apply: - // - // * If no scheme is provided, `https` is assumed. - // * The last segment of the URL's path must represent the fully - // qualified name of the type (as in `path/google.protobuf.Duration`). - // The name should be in a canonical form (e.g., leading "." is - // not accepted). - // * An HTTP GET on the URL must yield a [google.protobuf.Type][] - // value in binary format, or produce an error. - // * Applications are allowed to cache lookup results based on the - // URL, or have them precompiled into a binary to avoid any - // lookup. Therefore, binary compatibility needs to be preserved - // on changes to types. (Use versioned type names to manage - // breaking changes.) - // - // Schemes other than `http`, `https` (or the empty scheme) might be - // used with implementation specific semantics. - // - string type_url = 1; - - // Must be a valid serialized protocol buffer of the above specified type. - bytes value = 2; -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/compiler/plugin.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/compiler/plugin.proto deleted file mode 100644 index acaee1f4945..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/compiler/plugin.proto +++ /dev/null @@ -1,150 +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. - -// Author: kenton@google.com (Kenton Varda) -// -// WARNING: The plugin interface is currently EXPERIMENTAL and is subject to -// change. -// -// protoc (aka the Protocol Compiler) can be extended via plugins. A plugin is -// just a program that reads a CodeGeneratorRequest from stdin and writes a -// CodeGeneratorResponse to stdout. -// -// Plugins written using C++ can use google/protobuf/compiler/plugin.h instead -// of dealing with the raw protocol defined here. -// -// A plugin executable needs only to be placed somewhere in the path. The -// plugin should be named "protoc-gen-$NAME", and will then be used when the -// flag "--${NAME}_out" is passed to protoc. - -syntax = "proto2"; -package google.protobuf.compiler; -option java_package = "com.google.protobuf.compiler"; -option java_outer_classname = "PluginProtos"; - -option go_package = "plugin_go"; - -import "google/protobuf/descriptor.proto"; - -// An encoded CodeGeneratorRequest is written to the plugin's stdin. -message CodeGeneratorRequest { - // The .proto files that were explicitly listed on the command-line. The - // code generator should generate code only for these files. Each file's - // descriptor will be included in proto_file, below. - repeated string file_to_generate = 1; - - // The generator parameter passed on the command-line. - optional string parameter = 2; - - // FileDescriptorProtos for all files in files_to_generate and everything - // they import. The files will appear in topological order, so each file - // appears before any file that imports it. - // - // protoc guarantees that all proto_files will be written after - // the fields above, even though this is not technically guaranteed by the - // protobuf wire format. This theoretically could allow a plugin to stream - // in the FileDescriptorProtos and handle them one by one rather than read - // the entire set into memory at once. However, as of this writing, this - // is not similarly optimized on protoc's end -- it will store all fields in - // memory at once before sending them to the plugin. - repeated FileDescriptorProto proto_file = 15; -} - -// The plugin writes an encoded CodeGeneratorResponse to stdout. -message CodeGeneratorResponse { - // Error message. If non-empty, code generation failed. The plugin process - // should exit with status code zero even if it reports an error in this way. - // - // This should be used to indicate errors in .proto files which prevent the - // code generator from generating correct code. Errors which indicate a - // problem in protoc itself -- such as the input CodeGeneratorRequest being - // unparseable -- should be reported by writing a message to stderr and - // exiting with a non-zero status code. - optional string error = 1; - - // Represents a single generated file. - message File { - // The file name, relative to the output directory. The name must not - // contain "." or ".." components and must be relative, not be absolute (so, - // the file cannot lie outside the output directory). "/" must be used as - // the path separator, not "\". - // - // If the name is omitted, the content will be appended to the previous - // file. This allows the generator to break large files into small chunks, - // and allows the generated text to be streamed back to protoc so that large - // files need not reside completely in memory at one time. Note that as of - // this writing protoc does not optimize for this -- it will read the entire - // CodeGeneratorResponse before writing files to disk. - optional string name = 1; - - // If non-empty, indicates that the named file should already exist, and the - // content here is to be inserted into that file at a defined insertion - // point. This feature allows a code generator to extend the output - // produced by another code generator. The original generator may provide - // insertion points by placing special annotations in the file that look - // like: - // @@protoc_insertion_point(NAME) - // The annotation can have arbitrary text before and after it on the line, - // which allows it to be placed in a comment. NAME should be replaced with - // an identifier naming the point -- this is what other generators will use - // as the insertion_point. Code inserted at this point will be placed - // immediately above the line containing the insertion point (thus multiple - // insertions to the same point will come out in the order they were added). - // The double-@ is intended to make it unlikely that the generated code - // could contain things that look like insertion points by accident. - // - // For example, the C++ code generator places the following line in the - // .pb.h files that it generates: - // // @@protoc_insertion_point(namespace_scope) - // This line appears within the scope of the file's package namespace, but - // outside of any particular class. Another plugin can then specify the - // insertion_point "namespace_scope" to generate additional classes or - // other declarations that should be placed in this scope. - // - // Note that if the line containing the insertion point begins with - // whitespace, the same whitespace will be added to every line of the - // inserted text. This is useful for languages like Python, where - // indentation matters. In these languages, the insertion point comment - // should be indented the same amount as any inserted code will need to be - // in order to work correctly in that context. - // - // The code generator that generates the initial file and the one which - // inserts into it must both run as part of a single invocation of protoc. - // Code generators are executed in the order in which they appear on the - // command line. - // - // If |insertion_point| is present, |name| must also be present. - optional string insertion_point = 2; - - // The file contents. - optional string content = 15; - } - repeated File file = 15; -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/descriptor.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/descriptor.proto deleted file mode 100644 index 9aefdef2fab..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/descriptor.proto +++ /dev/null @@ -1,813 +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. - -// Author: kenton@google.com (Kenton Varda) -// Based on original Protocol Buffers design by -// Sanjay Ghemawat, Jeff Dean, and others. -// -// The messages in this file describe the definitions found in .proto files. -// A valid .proto file can be translated directly to a FileDescriptorProto -// without any other information (e.g. without reading its imports). - - -syntax = "proto2"; - -package google.protobuf; -option go_package = "descriptor"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "DescriptorProtos"; -option csharp_namespace = "Google.Protobuf.Reflection"; -option objc_class_prefix = "GPB"; -option java_generate_equals_and_hash = true; - -// descriptor.proto must be optimized for speed because reflection-based -// algorithms don't work during bootstrapping. -option optimize_for = SPEED; - -// The protocol compiler can output a FileDescriptorSet containing the .proto -// files it parses. -message FileDescriptorSet { - repeated FileDescriptorProto file = 1; -} - -// Describes a complete .proto file. -message FileDescriptorProto { - optional string name = 1; // file name, relative to root of source tree - optional string package = 2; // e.g. "foo", "foo.bar", etc. - - // Names of files imported by this file. - repeated string dependency = 3; - // Indexes of the public imported files in the dependency list above. - repeated int32 public_dependency = 10; - // Indexes of the weak imported files in the dependency list. - // For Google-internal migration only. Do not use. - repeated int32 weak_dependency = 11; - - // All top-level definitions in this file. - repeated DescriptorProto message_type = 4; - repeated EnumDescriptorProto enum_type = 5; - repeated ServiceDescriptorProto service = 6; - repeated FieldDescriptorProto extension = 7; - - optional FileOptions options = 8; - - // This field contains optional information about the original source code. - // You may safely remove this entire field without harming runtime - // functionality of the descriptors -- the information is needed only by - // development tools. - optional SourceCodeInfo source_code_info = 9; - - // The syntax of the proto file. - // The supported values are "proto2" and "proto3". - optional string syntax = 12; -} - -// Describes a message type. -message DescriptorProto { - optional string name = 1; - - repeated FieldDescriptorProto field = 2; - repeated FieldDescriptorProto extension = 6; - - repeated DescriptorProto nested_type = 3; - repeated EnumDescriptorProto enum_type = 4; - - message ExtensionRange { - optional int32 start = 1; - optional int32 end = 2; - } - repeated ExtensionRange extension_range = 5; - - repeated OneofDescriptorProto oneof_decl = 8; - - optional MessageOptions options = 7; - - // Range of reserved tag numbers. Reserved tag numbers may not be used by - // fields or extension ranges in the same message. Reserved ranges may - // not overlap. - message ReservedRange { - optional int32 start = 1; // Inclusive. - optional int32 end = 2; // Exclusive. - } - repeated ReservedRange reserved_range = 9; - // Reserved field names, which may not be used by fields in the same message. - // A given name may only be reserved once. - repeated string reserved_name = 10; -} - -// Describes a field within a message. -message FieldDescriptorProto { - enum Type { - // 0 is reserved for errors. - // Order is weird for historical reasons. - TYPE_DOUBLE = 1; - TYPE_FLOAT = 2; - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if - // negative values are likely. - TYPE_INT64 = 3; - TYPE_UINT64 = 4; - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if - // negative values are likely. - TYPE_INT32 = 5; - TYPE_FIXED64 = 6; - TYPE_FIXED32 = 7; - TYPE_BOOL = 8; - TYPE_STRING = 9; - TYPE_GROUP = 10; // Tag-delimited aggregate. - TYPE_MESSAGE = 11; // Length-delimited aggregate. - - // New in version 2. - TYPE_BYTES = 12; - TYPE_UINT32 = 13; - TYPE_ENUM = 14; - TYPE_SFIXED32 = 15; - TYPE_SFIXED64 = 16; - TYPE_SINT32 = 17; // Uses ZigZag encoding. - TYPE_SINT64 = 18; // Uses ZigZag encoding. - }; - - enum Label { - // 0 is reserved for errors - LABEL_OPTIONAL = 1; - LABEL_REQUIRED = 2; - LABEL_REPEATED = 3; - // TODO(sanjay): Should we add LABEL_MAP? - }; - - optional string name = 1; - optional int32 number = 3; - optional Label label = 4; - - // If type_name is set, this need not be set. If both this and type_name - // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. - optional Type type = 5; - - // For message and enum types, this is the name of the type. If the name - // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping - // rules are used to find the type (i.e. first the nested types within this - // message are searched, then within the parent, on up to the root - // namespace). - optional string type_name = 6; - - // For extensions, this is the name of the type being extended. It is - // resolved in the same manner as type_name. - optional string extendee = 2; - - // For numeric types, contains the original text representation of the value. - // For booleans, "true" or "false". - // For strings, contains the default text contents (not escaped in any way). - // For bytes, contains the C escaped value. All bytes >= 128 are escaped. - // TODO(kenton): Base-64 encode? - optional string default_value = 7; - - // If set, gives the index of a oneof in the containing type's oneof_decl - // list. This field is a member of that oneof. - optional int32 oneof_index = 9; - - // JSON name of this field. The value is set by protocol compiler. If the - // user has set a "json_name" option on this field, that option's value - // will be used. Otherwise, it's deduced from the field's name by converting - // it to camelCase. - optional string json_name = 10; - - optional FieldOptions options = 8; -} - -// Describes a oneof. -message OneofDescriptorProto { - optional string name = 1; - optional OneofOptions options = 2; -} - -// Describes an enum type. -message EnumDescriptorProto { - optional string name = 1; - - repeated EnumValueDescriptorProto value = 2; - - optional EnumOptions options = 3; -} - -// Describes a value within an enum. -message EnumValueDescriptorProto { - optional string name = 1; - optional int32 number = 2; - - optional EnumValueOptions options = 3; -} - -// Describes a service. -message ServiceDescriptorProto { - optional string name = 1; - repeated MethodDescriptorProto method = 2; - - optional ServiceOptions options = 3; -} - -// Describes a method of a service. -message MethodDescriptorProto { - optional string name = 1; - - // Input and output type names. These are resolved in the same way as - // FieldDescriptorProto.type_name, but must refer to a message type. - optional string input_type = 2; - optional string output_type = 3; - - optional MethodOptions options = 4; - - // Identifies if client streams multiple client messages - optional bool client_streaming = 5 [default=false]; - // Identifies if server streams multiple server messages - optional bool server_streaming = 6 [default=false]; -} - - -// =================================================================== -// Options - -// Each of the definitions above may have "options" attached. These are -// just annotations which may cause code to be generated slightly differently -// or may contain hints for code that manipulates protocol messages. -// -// Clients may define custom options as extensions of the *Options messages. -// These extensions may not yet be known at parsing time, so the parser cannot -// store the values in them. Instead it stores them in a field in the *Options -// message called uninterpreted_option. This field must have the same name -// across all *Options messages. We then use this field to populate the -// extensions when we build a descriptor, at which point all protos have been -// parsed and so all extensions are known. -// -// Extension numbers for custom options may be chosen as follows: -// * For options which will only be used within a single application or -// organization, or for experimental options, use field numbers 50000 -// through 99999. It is up to you to ensure that you do not use the -// same number for multiple options. -// * For options which will be published and used publicly by multiple -// independent entities, e-mail protobuf-global-extension-registry@google.com -// to reserve extension numbers. Simply provide your project name (e.g. -// Objective-C plugin) and your project website (if available) -- there's no -// need to explain how you intend to use them. Usually you only need one -// extension number. You can declare multiple options with only one extension -// number by putting them in a sub-message. See the Custom Options section of -// the docs for examples: -// https://developers.google.com/protocol-buffers/docs/proto#options -// If this turns out to be popular, a web service will be set up -// to automatically assign option numbers. - - -message FileOptions { - - // Sets the Java package where classes generated from this .proto will be - // placed. By default, the proto package is used, but this is often - // inappropriate because proto packages do not normally start with backwards - // domain names. - optional string java_package = 1; - - - // If set, all the classes from the .proto file are wrapped in a single - // outer class with the given name. This applies to both Proto1 - // (equivalent to the old "--one_java_file" option) and Proto2 (where - // a .proto always translates to a single class, but you may want to - // explicitly choose the class name). - optional string java_outer_classname = 8; - - // If set true, then the Java code generator will generate a separate .java - // file for each top-level message, enum, and service defined in the .proto - // file. Thus, these types will *not* be nested inside the outer class - // named by java_outer_classname. However, the outer class will still be - // generated to contain the file's getDescriptor() method as well as any - // top-level extensions defined in the file. - optional bool java_multiple_files = 10 [default=false]; - - // If set true, then the Java code generator will generate equals() and - // hashCode() methods for all messages defined in the .proto file. - // This increases generated code size, potentially substantially for large - // protos, which may harm a memory-constrained application. - // - In the full runtime this is a speed optimization, as the - // AbstractMessage base class includes reflection-based implementations of - // these methods. - // - In the lite runtime, setting this option changes the semantics of - // equals() and hashCode() to more closely match those of the full runtime; - // the generated methods compute their results based on field values rather - // than object identity. (Implementations should not assume that hashcodes - // will be consistent across runtimes or versions of the protocol compiler.) - optional bool java_generate_equals_and_hash = 20 [default=false]; - - // If set true, then the Java2 code generator will generate code that - // throws an exception whenever an attempt is made to assign a non-UTF-8 - // byte sequence to a string field. - // Message reflection will do the same. - // However, an extension field still accepts non-UTF-8 byte sequences. - // This option has no effect on when used with the lite runtime. - optional bool java_string_check_utf8 = 27 [default=false]; - - - // Generated classes can be optimized for speed or code size. - enum OptimizeMode { - SPEED = 1; // Generate complete code for parsing, serialization, - // etc. - CODE_SIZE = 2; // Use ReflectionOps to implement these methods. - LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. - } - optional OptimizeMode optimize_for = 9 [default=SPEED]; - - // Sets the Go package where structs generated from this .proto will be - // placed. If omitted, the Go package will be derived from the following: - // - The basename of the package import path, if provided. - // - Otherwise, the package statement in the .proto file, if present. - // - Otherwise, the basename of the .proto file, without extension. - optional string go_package = 11; - - - - // Should generic services be generated in each language? "Generic" services - // are not specific to any particular RPC system. They are generated by the - // main code generators in each language (without additional plugins). - // Generic services were the only kind of service generation supported by - // early versions of google.protobuf. - // - // Generic services are now considered deprecated in favor of using plugins - // that generate code specific to your particular RPC system. Therefore, - // these default to false. Old code which depends on generic services should - // explicitly set them to true. - optional bool cc_generic_services = 16 [default=false]; - optional bool java_generic_services = 17 [default=false]; - optional bool py_generic_services = 18 [default=false]; - - // Is this file deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for everything in the file, or it will be completely ignored; in the very - // least, this is a formalization for deprecating files. - optional bool deprecated = 23 [default=false]; - - // Enables the use of arenas for the proto messages in this file. This applies - // only to generated classes for C++. - optional bool cc_enable_arenas = 31 [default=false]; - - - // Sets the objective c class prefix which is prepended to all objective c - // generated classes from this .proto. There is no default. - optional string objc_class_prefix = 36; - - // Namespace for generated classes; defaults to the package. - optional string csharp_namespace = 37; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; - - //reserved 38; -} - -message MessageOptions { - // Set true to use the old proto1 MessageSet wire format for extensions. - // This is provided for backwards-compatibility with the MessageSet wire - // format. You should not use this for any other reason: It's less - // efficient, has fewer features, and is more complicated. - // - // The message must be defined exactly as follows: - // message Foo { - // option message_set_wire_format = true; - // extensions 4 to max; - // } - // Note that the message cannot have any defined fields; MessageSets only - // have extensions. - // - // All extensions of your type must be singular messages; e.g. they cannot - // be int32s, enums, or repeated messages. - // - // Because this is an option, the above two restrictions are not enforced by - // the protocol compiler. - optional bool message_set_wire_format = 1 [default=false]; - - // Disables the generation of the standard "descriptor()" accessor, which can - // conflict with a field of the same name. This is meant to make migration - // from proto1 easier; new code should avoid fields named "descriptor". - optional bool no_standard_descriptor_accessor = 2 [default=false]; - - // Is this message deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the message, or it will be completely ignored; in the very least, - // this is a formalization for deprecating messages. - optional bool deprecated = 3 [default=false]; - - // Whether the message is an automatically generated map entry type for the - // maps field. - // - // For maps fields: - // map map_field = 1; - // The parsed descriptor looks like: - // message MapFieldEntry { - // option map_entry = true; - // optional KeyType key = 1; - // optional ValueType value = 2; - // } - // repeated MapFieldEntry map_field = 1; - // - // Implementations may choose not to generate the map_entry=true message, but - // use a native map in the target language to hold the keys and values. - // The reflection APIs in such implementions still need to work as - // if the field is a repeated message field. - // - // NOTE: Do not set the option in .proto files. Always use the maps syntax - // instead. The option should only be implicitly set by the proto compiler - // parser. - optional bool map_entry = 7; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message FieldOptions { - // The ctype option instructs the C++ code generator to use a different - // representation of the field than it normally would. See the specific - // options below. This option is not yet implemented in the open source - // release -- sorry, we'll try to include it in a future version! - optional CType ctype = 1 [default = STRING]; - enum CType { - // Default mode. - STRING = 0; - - CORD = 1; - - STRING_PIECE = 2; - } - // The packed option can be enabled for repeated primitive fields to enable - // a more efficient representation on the wire. Rather than repeatedly - // writing the tag and type for each element, the entire array is encoded as - // a single length-delimited blob. In proto3, only explicit setting it to - // false will avoid using packed encoding. - optional bool packed = 2; - - - // The jstype option determines the JavaScript type used for values of the - // field. The option is permitted only for 64 bit integral and fixed types - // (int64, uint64, sint64, fixed64, sfixed64). By default these types are - // represented as JavaScript strings. This avoids loss of precision that can - // happen when a large value is converted to a floating point JavaScript - // numbers. Specifying JS_NUMBER for the jstype causes the generated - // JavaScript code to use the JavaScript "number" type instead of strings. - // This option is an enum to permit additional types to be added, - // e.g. goog.math.Integer. - optional JSType jstype = 6 [default = JS_NORMAL]; - enum JSType { - // Use the default type. - JS_NORMAL = 0; - - // Use JavaScript strings. - JS_STRING = 1; - - // Use JavaScript numbers. - JS_NUMBER = 2; - } - - // Should this field be parsed lazily? Lazy applies only to message-type - // fields. It means that when the outer message is initially parsed, the - // inner message's contents will not be parsed but instead stored in encoded - // form. The inner message will actually be parsed when it is first accessed. - // - // This is only a hint. Implementations are free to choose whether to use - // eager or lazy parsing regardless of the value of this option. However, - // setting this option true suggests that the protocol author believes that - // using lazy parsing on this field is worth the additional bookkeeping - // overhead typically needed to implement it. - // - // This option does not affect the public interface of any generated code; - // all method signatures remain the same. Furthermore, thread-safety of the - // interface is not affected by this option; const methods remain safe to - // call from multiple threads concurrently, while non-const methods continue - // to require exclusive access. - // - // - // Note that implementations may choose not to check required fields within - // a lazy sub-message. That is, calling IsInitialized() on the outher message - // may return true even if the inner message has missing required fields. - // This is necessary because otherwise the inner message would have to be - // parsed in order to perform the check, defeating the purpose of lazy - // parsing. An implementation which chooses not to check required fields - // must be consistent about it. That is, for any particular sub-message, the - // implementation must either *always* check its required fields, or *never* - // check its required fields, regardless of whether or not the message has - // been parsed. - optional bool lazy = 5 [default=false]; - - // Is this field deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for accessors, or it will be completely ignored; in the very least, this - // is a formalization for deprecating fields. - optional bool deprecated = 3 [default=false]; - - // For Google-internal migration only. Do not use. - optional bool weak = 10 [default=false]; - - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message OneofOptions { - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message EnumOptions { - - // Set this option to true to allow mapping different tag names to the same - // value. - optional bool allow_alias = 2; - - // Is this enum deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the enum, or it will be completely ignored; in the very least, this - // is a formalization for deprecating enums. - optional bool deprecated = 3 [default=false]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message EnumValueOptions { - // Is this enum value deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the enum value, or it will be completely ignored; in the very least, - // this is a formalization for deprecating enum values. - optional bool deprecated = 1 [default=false]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message ServiceOptions { - - // Note: Field numbers 1 through 32 are reserved for Google's internal RPC - // framework. We apologize for hoarding these numbers to ourselves, but - // we were already using them long before we decided to release Protocol - // Buffers. - - // Is this service deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the service, or it will be completely ignored; in the very least, - // this is a formalization for deprecating services. - optional bool deprecated = 33 [default=false]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message MethodOptions { - - // Note: Field numbers 1 through 32 are reserved for Google's internal RPC - // framework. We apologize for hoarding these numbers to ourselves, but - // we were already using them long before we decided to release Protocol - // Buffers. - - // Is this method deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the method, or it will be completely ignored; in the very least, - // this is a formalization for deprecating methods. - optional bool deprecated = 33 [default=false]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - - -// A message representing a option the parser does not recognize. This only -// appears in options protos created by the compiler::Parser class. -// DescriptorPool resolves these when building Descriptor objects. Therefore, -// options protos in descriptor objects (e.g. returned by Descriptor::options(), -// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions -// in them. -message UninterpretedOption { - // The name of the uninterpreted option. Each string represents a segment in - // a dot-separated name. is_extension is true iff a segment represents an - // extension (denoted with parentheses in options specs in .proto files). - // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents - // "foo.(bar.baz).qux". - message NamePart { - required string name_part = 1; - required bool is_extension = 2; - } - repeated NamePart name = 2; - - // The value of the uninterpreted option, in whatever type the tokenizer - // identified it as during parsing. Exactly one of these should be set. - optional string identifier_value = 3; - optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; -} - -// =================================================================== -// Optional source code info - -// Encapsulates information about the original source file from which a -// FileDescriptorProto was generated. -message SourceCodeInfo { - // A Location identifies a piece of source code in a .proto file which - // corresponds to a particular definition. This information is intended - // to be useful to IDEs, code indexers, documentation generators, and similar - // tools. - // - // For example, say we have a file like: - // message Foo { - // optional string foo = 1; - // } - // Let's look at just the field definition: - // optional string foo = 1; - // ^ ^^ ^^ ^ ^^^ - // a bc de f ghi - // We have the following locations: - // span path represents - // [a,i) [ 4, 0, 2, 0 ] The whole field definition. - // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). - // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). - // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). - // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). - // - // Notes: - // - A location may refer to a repeated field itself (i.e. not to any - // particular index within it). This is used whenever a set of elements are - // logically enclosed in a single code segment. For example, an entire - // extend block (possibly containing multiple extension definitions) will - // have an outer location whose path refers to the "extensions" repeated - // field without an index. - // - Multiple locations may have the same path. This happens when a single - // logical declaration is spread out across multiple places. The most - // obvious example is the "extend" block again -- there may be multiple - // extend blocks in the same scope, each of which will have the same path. - // - A location's span is not always a subset of its parent's span. For - // example, the "extendee" of an extension declaration appears at the - // beginning of the "extend" block and is shared by all extensions within - // the block. - // - Just because a location's span is a subset of some other location's span - // does not mean that it is a descendent. For example, a "group" defines - // both a type and a field in a single declaration. Thus, the locations - // corresponding to the type and field and their components will overlap. - // - Code which tries to interpret locations should probably be designed to - // ignore those that it doesn't understand, as more types of locations could - // be recorded in the future. - repeated Location location = 1; - message Location { - // Identifies which part of the FileDescriptorProto was defined at this - // location. - // - // Each element is a field number or an index. They form a path from - // the root FileDescriptorProto to the place where the definition. For - // example, this path: - // [ 4, 3, 2, 7, 1 ] - // refers to: - // file.message_type(3) // 4, 3 - // .field(7) // 2, 7 - // .name() // 1 - // This is because FileDescriptorProto.message_type has field number 4: - // repeated DescriptorProto message_type = 4; - // and DescriptorProto.field has field number 2: - // repeated FieldDescriptorProto field = 2; - // and FieldDescriptorProto.name has field number 1: - // optional string name = 1; - // - // Thus, the above path gives the location of a field name. If we removed - // the last element: - // [ 4, 3, 2, 7 ] - // this path refers to the whole field declaration (from the beginning - // of the label to the terminating semicolon). - repeated int32 path = 1 [packed=true]; - - // Always has exactly three or four elements: start line, start column, - // end line (optional, otherwise assumed same as start line), end column. - // These are packed into a single field for efficiency. Note that line - // and column numbers are zero-based -- typically you will want to add - // 1 to each before displaying to a user. - repeated int32 span = 2 [packed=true]; - - // If this SourceCodeInfo represents a complete declaration, these are any - // comments appearing before and after the declaration which appear to be - // attached to the declaration. - // - // A series of line comments appearing on consecutive lines, with no other - // tokens appearing on those lines, will be treated as a single comment. - // - // leading_detached_comments will keep paragraphs of comments that appear - // before (but not connected to) the current element. Each paragraph, - // separated by empty lines, will be one comment element in the repeated - // field. - // - // Only the comment content is provided; comment markers (e.g. //) are - // stripped out. For block comments, leading whitespace and an asterisk - // will be stripped from the beginning of each line other than the first. - // Newlines are included in the output. - // - // Examples: - // - // optional int32 foo = 1; // Comment attached to foo. - // // Comment attached to bar. - // optional int32 bar = 2; - // - // optional string baz = 3; - // // Comment attached to baz. - // // Another line attached to baz. - // - // // Comment attached to qux. - // // - // // Another line attached to qux. - // optional double qux = 4; - // - // // Detached comment for corge. This is not leading or trailing comments - // // to qux or corge because there are blank lines separating it from - // // both. - // - // // Detached comment for corge paragraph 2. - // - // optional string corge = 5; - // /* Block comment attached - // * to corge. Leading asterisks - // * will be removed. */ - // /* Block comment attached to - // * grault. */ - // optional int32 grault = 6; - // - // // ignored detached comments. - optional string leading_comments = 3; - optional string trailing_comments = 4; - repeated string leading_detached_comments = 6; - } -} - -// Describes the relationship between generated code and its original source -// file. A GeneratedCodeInfo message is associated with only one generated -// source file, but may contain references to different source .proto files. -message GeneratedCodeInfo { - // An Annotation connects some span of text in generated code to an element - // of its generating .proto file. - repeated Annotation annotation = 1; - message Annotation { - // Identifies the element in the original source .proto file. This field - // is formatted the same as SourceCodeInfo.Location.path. - repeated int32 path = 1 [packed=true]; - - // Identifies the filesystem path to the original source .proto. - optional string source_file = 2; - - // Identifies the starting offset in bytes in the generated code - // that relates to the identified object. - optional int32 begin = 3; - - // Identifies the ending offset in bytes in the generated code that - // relates to the identified offset. The end offset should be one past - // the last relevant byte (so the length of the text = end - begin). - optional int32 end = 4; - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/duration.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/duration.proto deleted file mode 100644 index c4359dbd200..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/duration.proto +++ /dev/null @@ -1,98 +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. - -syntax = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option go_package = "types"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "DurationProto"; -option java_multiple_files = true; -option java_generate_equals_and_hash = true; -option objc_class_prefix = "GPB"; - -// A Duration represents a signed, fixed-length span of time represented -// as a count of seconds and fractions of seconds at nanosecond -// resolution. It is independent of any calendar and concepts like "day" -// or "month". It is related to Timestamp in that the difference between -// two Timestamp values is a Duration and it can be added or subtracted -// from a Timestamp. Range is approximately +-10,000 years. -// -// Example 1: Compute Duration from two Timestamps in pseudo code. -// -// Timestamp start = ...; -// Timestamp end = ...; -// Duration duration = ...; -// -// duration.seconds = end.seconds - start.seconds; -// duration.nanos = end.nanos - start.nanos; -// -// if (duration.seconds < 0 && duration.nanos > 0) { -// duration.seconds += 1; -// duration.nanos -= 1000000000; -// } else if (durations.seconds > 0 && duration.nanos < 0) { -// duration.seconds -= 1; -// duration.nanos += 1000000000; -// } -// -// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. -// -// Timestamp start = ...; -// Duration duration = ...; -// Timestamp end = ...; -// -// end.seconds = start.seconds + duration.seconds; -// end.nanos = start.nanos + duration.nanos; -// -// if (end.nanos < 0) { -// end.seconds -= 1; -// end.nanos += 1000000000; -// } else if (end.nanos >= 1000000000) { -// end.seconds += 1; -// end.nanos -= 1000000000; -// } -// -// -message Duration { - - // Signed seconds of the span of time. Must be from -315,576,000,000 - // to +315,576,000,000 inclusive. - int64 seconds = 1; - - // Signed fractions of a second at nanosecond resolution of the span - // of time. Durations less than one second are represented with a 0 - // `seconds` field and a positive or negative `nanos` field. For durations - // of one second or more, a non-zero value for the `nanos` field must be - // of the same sign as the `seconds` field. Must be from -999,999,999 - // to +999,999,999 inclusive. - int32 nanos = 2; -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/empty.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/empty.proto deleted file mode 100644 index 61a574b6a42..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/empty.proto +++ /dev/null @@ -1,53 +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. - -syntax = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option go_package = "types"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "EmptyProto"; -option java_multiple_files = true; -option java_generate_equals_and_hash = true; -option objc_class_prefix = "GPB"; -option cc_enable_arenas = true; - -// A generic empty message that you can re-use to avoid defining duplicated -// empty messages in your APIs. A typical example is to use it as the request -// or the response type of an API method. For instance: -// -// service Foo { -// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -// } -// -// The JSON representation for `Empty` is empty JSON object `{}`. -message Empty {} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/field_mask.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/field_mask.proto deleted file mode 100644 index fd252889aae..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/field_mask.proto +++ /dev/null @@ -1,246 +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. - -syntax = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option go_package = "types"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "FieldMaskProto"; -option java_multiple_files = true; -option objc_class_prefix = "GPB"; -option java_generate_equals_and_hash = true; - -// `FieldMask` represents a set of symbolic field paths, for example: -// -// paths: "f.a" -// paths: "f.b.d" -// -// Here `f` represents a field in some root message, `a` and `b` -// fields in the message found in `f`, and `d` a field found in the -// message in `f.b`. -// -// Field masks are used to specify a subset of fields that should be -// returned by a get operation or modified by an update operation. -// Field masks also have a custom JSON encoding (see below). -// -// # Field Masks in Projections -// -// When used in the context of a projection, a response message or -// sub-message is filtered by the API to only contain those fields as -// specified in the mask. For example, if the mask in the previous -// example is applied to a response message as follows: -// -// f { -// a : 22 -// b { -// d : 1 -// x : 2 -// } -// y : 13 -// } -// z: 8 -// -// The result will not contain specific values for fields x,y and z -// (their value will be set to the default, and omitted in proto text -// output): -// -// -// f { -// a : 22 -// b { -// d : 1 -// } -// } -// -// A repeated field is not allowed except at the last position of a -// field mask. -// -// If a FieldMask object is not present in a get operation, the -// operation applies to all fields (as if a FieldMask of all fields -// had been specified). -// -// Note that a field mask does not necessarily apply to the -// top-level response message. In case of a REST get operation, the -// field mask applies directly to the response, but in case of a REST -// list operation, the mask instead applies to each individual message -// in the returned resource list. In case of a REST custom method, -// other definitions may be used. Where the mask applies will be -// clearly documented together with its declaration in the API. In -// any case, the effect on the returned resource/resources is required -// behavior for APIs. -// -// # Field Masks in Update Operations -// -// A field mask in update operations specifies which fields of the -// targeted resource are going to be updated. The API is required -// to only change the values of the fields as specified in the mask -// and leave the others untouched. If a resource is passed in to -// describe the updated values, the API ignores the values of all -// fields not covered by the mask. -// -// If a repeated field is specified for an update operation, the existing -// repeated values in the target resource will be overwritten by the new values. -// Note that a repeated field is only allowed in the last position of a field -// mask. -// -// If a sub-message is specified in the last position of the field mask for an -// update operation, then the existing sub-message in the target resource is -// overwritten. Given the target message: -// -// f { -// b { -// d : 1 -// x : 2 -// } -// c : 1 -// } -// -// And an update message: -// -// f { -// b { -// d : 10 -// } -// } -// -// then if the field mask is: -// -// paths: "f.b" -// -// then the result will be: -// -// f { -// b { -// d : 10 -// } -// c : 1 -// } -// -// However, if the update mask was: -// -// paths: "f.b.d" -// -// then the result would be: -// -// f { -// b { -// d : 10 -// x : 2 -// } -// c : 1 -// } -// -// In order to reset a field's value to the default, the field must -// be in the mask and set to the default value in the provided resource. -// Hence, in order to reset all fields of a resource, provide a default -// instance of the resource and set all fields in the mask, or do -// not provide a mask as described below. -// -// If a field mask is not present on update, the operation applies to -// all fields (as if a field mask of all fields has been specified). -// Note that in the presence of schema evolution, this may mean that -// fields the client does not know and has therefore not filled into -// the request will be reset to their default. If this is unwanted -// behavior, a specific service may require a client to always specify -// a field mask, producing an error if not. -// -// As with get operations, the location of the resource which -// describes the updated values in the request message depends on the -// operation kind. In any case, the effect of the field mask is -// required to be honored by the API. -// -// ## Considerations for HTTP REST -// -// The HTTP kind of an update operation which uses a field mask must -// be set to PATCH instead of PUT in order to satisfy HTTP semantics -// (PUT must only be used for full updates). -// -// # JSON Encoding of Field Masks -// -// In JSON, a field mask is encoded as a single string where paths are -// separated by a comma. Fields name in each path are converted -// to/from lower-camel naming conventions. -// -// As an example, consider the following message declarations: -// -// message Profile { -// User user = 1; -// Photo photo = 2; -// } -// message User { -// string display_name = 1; -// string address = 2; -// } -// -// In proto a field mask for `Profile` may look as such: -// -// mask { -// paths: "user.display_name" -// paths: "photo" -// } -// -// In JSON, the same mask is represented as below: -// -// { -// mask: "user.displayName,photo" -// } -// -// # Field Masks and Oneof Fields -// -// Field masks treat fields in oneofs just as regular fields. Consider the -// following message: -// -// message SampleMessage { -// oneof test_oneof { -// string name = 4; -// SubMessage sub_message = 9; -// } -// } -// -// The field mask can be: -// -// mask { -// paths: "name" -// } -// -// Or: -// -// mask { -// paths: "sub_message" -// } -// -// Note that oneof type names ("test_oneof" in this case) cannot be used in -// paths. -message FieldMask { - // The set of field mask paths. - repeated string paths = 1; -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/struct.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/struct.proto deleted file mode 100644 index 27fdb9188e0..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/struct.proto +++ /dev/null @@ -1,96 +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. - -syntax = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option go_package = "types"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "StructProto"; -option java_multiple_files = true; -option java_generate_equals_and_hash = true; -option objc_class_prefix = "GPB"; - - -// `Struct` represents a structured data value, consisting of fields -// which map to dynamically typed values. In some languages, `Struct` -// might be supported by a native representation. For example, in -// scripting languages like JS a struct is represented as an -// object. The details of that representation are described together -// with the proto support for the language. -// -// The JSON representation for `Struct` is JSON object. -message Struct { - // Unordered map of dynamically typed values. - map fields = 1; -} - -// `Value` represents a dynamically typed value which can be either -// null, a number, a string, a boolean, a recursive struct value, or a -// list of values. A producer of value is expected to set one of that -// variants, absence of any variant indicates an error. -// -// The JSON representation for `Value` is JSON value. -message Value { - // The kind of value. - oneof kind { - // Represents a null value. - NullValue null_value = 1; - // Represents a double value. - double number_value = 2; - // Represents a string value. - string string_value = 3; - // Represents a boolean value. - bool bool_value = 4; - // Represents a structured value. - Struct struct_value = 5; - // Represents a repeated `Value`. - ListValue list_value = 6; - } -} - -// `NullValue` is a singleton enumeration to represent the null value for the -// `Value` type union. -// -// The JSON representation for `NullValue` is JSON `null`. -enum NullValue { - // Null value. - NULL_VALUE = 0; -} - -// `ListValue` is a wrapper around a repeated field of values. -// -// The JSON representation for `ListValue` is JSON array. -message ListValue { - // Repeated field of dynamically typed values. - repeated Value values = 1; -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/timestamp.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/timestamp.proto deleted file mode 100644 index c85024a4278..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/timestamp.proto +++ /dev/null @@ -1,111 +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. - -syntax = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option cc_enable_arenas = true; -option go_package = "types"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "TimestampProto"; -option java_multiple_files = true; -option java_generate_equals_and_hash = true; -option objc_class_prefix = "GPB"; - -// A Timestamp represents a point in time independent of any time zone -// or calendar, represented as seconds and fractions of seconds at -// nanosecond resolution in UTC Epoch time. It is encoded using the -// Proleptic Gregorian Calendar which extends the Gregorian calendar -// backwards to year one. It is encoded assuming all minutes are 60 -// seconds long, i.e. leap seconds are "smeared" so that no leap second -// table is needed for interpretation. 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 date strings. -// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). -// -// 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 current time in Python. -// -// now = time.time() -// seconds = int(now) -// nanos = int((now - seconds) * 10**9) -// timestamp = Timestamp(seconds=seconds, nanos=nanos) -// -// -message Timestamp { - - // Represents seconds of UTC time since Unix epoch - // 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to - // 9999-12-31T23:59:59Z inclusive. - int64 seconds = 1; - - // 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. - int32 nanos = 2; -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/wrappers.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/wrappers.proto deleted file mode 100644 index f685dc082a9..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protobuf/google/protobuf/wrappers.proto +++ /dev/null @@ -1,119 +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. - -// Wrappers for primitive (non-message) types. These types are useful -// for embedding primitives in the `google.protobuf.Any` type and for places -// where we need to distinguish between the absence of a primitive -// typed field and its default value. - -syntax = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option cc_enable_arenas = true; -option go_package = "types"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "WrappersProto"; -option java_multiple_files = true; -option java_generate_equals_and_hash = true; -option objc_class_prefix = "GPB"; - -// Wrapper message for `double`. -// -// The JSON representation for `DoubleValue` is JSON number. -message DoubleValue { - // The double value. - double value = 1; -} - -// Wrapper message for `float`. -// -// The JSON representation for `FloatValue` is JSON number. -message FloatValue { - // The float value. - float value = 1; -} - -// Wrapper message for `int64`. -// -// The JSON representation for `Int64Value` is JSON string. -message Int64Value { - // The int64 value. - int64 value = 1; -} - -// Wrapper message for `uint64`. -// -// The JSON representation for `UInt64Value` is JSON string. -message UInt64Value { - // The uint64 value. - uint64 value = 1; -} - -// Wrapper message for `int32`. -// -// The JSON representation for `Int32Value` is JSON number. -message Int32Value { - // The int32 value. - int32 value = 1; -} - -// Wrapper message for `uint32`. -// -// The JSON representation for `UInt32Value` is JSON number. -message UInt32Value { - // The uint32 value. - uint32 value = 1; -} - -// Wrapper message for `bool`. -// -// The JSON representation for `BoolValue` is JSON `true` and `false`. -message BoolValue { - // The bool value. - bool value = 1; -} - -// Wrapper message for `string`. -// -// The JSON representation for `StringValue` is JSON string. -message StringValue { - // The string value. - string value = 1; -} - -// Wrapper message for `bytes`. -// -// The JSON representation for `BytesValue` is JSON string. -message BytesValue { - // The bytes value. - bytes value = 1; -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-combo/combo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-combo/combo.go deleted file mode 100644 index eebcc1cf4b7..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-combo/combo.go +++ /dev/null @@ -1,200 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package main - -import ( - "bufio" - "bytes" - "flag" - "fmt" - "io/ioutil" - "os" - "os/exec" - "path/filepath" - "strings" - - "github.com/gogo/protobuf/version" -) - -type MixMatch struct { - Old []string - Filename string - Args []string -} - -func (this MixMatch) Gen(folder string, news []string) { - if err := os.MkdirAll(folder, 0777); err != nil { - panic(err) - } - data, err := ioutil.ReadFile(this.Filename) - if err != nil { - panic(err) - } - content := string(data) - for i, old := range this.Old { - if !strings.Contains(content, old) { - panic(fmt.Errorf("could not find string {%s} to replace with {%s}", old, news[i])) - } - content = strings.Replace(content, old, news[i], 1) - if strings.Contains(content, old) && old != news[i] { - panic(fmt.Errorf("found another string {%s} after it was replaced with {%s}", old, news[i])) - } - } - if err = ioutil.WriteFile(filepath.Join(folder, this.Filename), []byte(content), 0666); err != nil { - panic(err) - } - args := append(this.Args, filepath.Join(folder, this.Filename)) - var regenerate = exec.Command("protoc", args...) - out, err := regenerate.CombinedOutput() - - failed := false - scanner := bufio.NewScanner(bytes.NewReader(out)) - for scanner.Scan() { - text := scanner.Text() - fmt.Println("protoc-gen-combo: ", text) - if !strings.Contains(text, "WARNING") { - failed = true - } - } - - if err != nil { - fmt.Print("protoc-gen-combo: error: ", err) - failed = true - } - - if failed { - os.Exit(1) - } -} - -func filter(ss []string, flag string) ([]string, string) { - s := make([]string, 0, len(ss)) - var v string - for i := range ss { - if strings.Contains(ss[i], flag) { - vs := strings.Split(ss[i], "=") - v = vs[1] - continue - } - s = append(s, ss[i]) - } - return s, v -} - -func filterArgs(ss []string) ([]string, []string) { - var args []string - var flags []string - for i := range ss { - if strings.Contains(ss[i], "=") { - flags = append(flags, ss[i]) - continue - } - args = append(args, ss[i]) - } - return flags, args -} - -func main() { - flag.String("version", "2.3.0", "minimum protoc version") - flag.Bool("default", true, "generate the case where everything is false") - flags, args := filterArgs(os.Args[1:]) - var min string - flags, min = filter(flags, "-version") - if len(min) == 0 { - min = "2.3.1" - } - if !version.AtLeast(min) { - fmt.Printf("protoc version not high enough to parse this proto file\n") - return - } - if len(args) != 1 { - fmt.Printf("protoc-gen-combo expects a filename\n") - os.Exit(1) - } - filename := args[0] - var def string - flags, def = filter(flags, "-default") - if _, err := exec.LookPath("protoc"); err != nil { - panic("cannot find protoc in PATH") - } - m := MixMatch{ - Old: []string{ - "option (gogoproto.unmarshaler_all) = false;", - "option (gogoproto.marshaler_all) = false;", - "option (gogoproto.unsafe_unmarshaler_all) = false;", - "option (gogoproto.unsafe_marshaler_all) = false;", - }, - Filename: filename, - Args: flags, - } - if def != "false" { - m.Gen("./combos/neither/", []string{ - "option (gogoproto.unmarshaler_all) = false;", - "option (gogoproto.marshaler_all) = false;", - "option (gogoproto.unsafe_unmarshaler_all) = false;", - "option (gogoproto.unsafe_marshaler_all) = false;", - }) - } - m.Gen("./combos/marshaler/", []string{ - "option (gogoproto.unmarshaler_all) = false;", - "option (gogoproto.marshaler_all) = true;", - "option (gogoproto.unsafe_unmarshaler_all) = false;", - "option (gogoproto.unsafe_marshaler_all) = false;", - }) - m.Gen("./combos/unmarshaler/", []string{ - "option (gogoproto.unmarshaler_all) = true;", - "option (gogoproto.marshaler_all) = false;", - "option (gogoproto.unsafe_unmarshaler_all) = false;", - "option (gogoproto.unsafe_marshaler_all) = false;", - }) - m.Gen("./combos/both/", []string{ - "option (gogoproto.unmarshaler_all) = true;", - "option (gogoproto.marshaler_all) = true;", - "option (gogoproto.unsafe_unmarshaler_all) = false;", - "option (gogoproto.unsafe_marshaler_all) = false;", - }) - m.Gen("./combos/unsafemarshaler/", []string{ - "option (gogoproto.unmarshaler_all) = false;", - "option (gogoproto.marshaler_all) = false;", - "option (gogoproto.unsafe_unmarshaler_all) = false;", - "option (gogoproto.unsafe_marshaler_all) = true;", - }) - m.Gen("./combos/unsafeunmarshaler/", []string{ - "option (gogoproto.unmarshaler_all) = false;", - "option (gogoproto.marshaler_all) = false;", - "option (gogoproto.unsafe_unmarshaler_all) = true;", - "option (gogoproto.unsafe_marshaler_all) = false;", - }) - m.Gen("./combos/unsafeboth/", []string{ - "option (gogoproto.unmarshaler_all) = false;", - "option (gogoproto.marshaler_all) = false;", - "option (gogoproto.unsafe_unmarshaler_all) = true;", - "option (gogoproto.unsafe_marshaler_all) = true;", - }) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gofast/main.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gofast/main.go deleted file mode 100644 index 3562a81ecf4..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gofast/main.go +++ /dev/null @@ -1,48 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2015, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package main - -import ( - "github.com/gogo/protobuf/vanity" - "github.com/gogo/protobuf/vanity/command" -) - -func main() { - req := command.Read() - files := req.GetProtoFile() - - vanity.ForEachFile(files, vanity.TurnOffGogoImport) - - vanity.ForEachFile(files, vanity.TurnOnMarshalerAll) - vanity.ForEachFile(files, vanity.TurnOnSizerAll) - vanity.ForEachFile(files, vanity.TurnOnUnmarshalerAll) - - resp := command.Generate(req) - command.Write(resp) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.go deleted file mode 100644 index e808a3fd0f6..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.go +++ /dev/null @@ -1,92 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -// Package descriptor provides functions for obtaining protocol buffer -// descriptors for generated Go types. -// -// These functions cannot go in package proto because they depend on the -// generated protobuf descriptor messages, which themselves depend on proto. -package descriptor - -import ( - "bytes" - "compress/gzip" - "fmt" - "io/ioutil" - - "github.com/gogo/protobuf/proto" -) - -// extractFile extracts a FileDescriptorProto from a gzip'd buffer. -func extractFile(gz []byte) (*FileDescriptorProto, error) { - r, err := gzip.NewReader(bytes.NewReader(gz)) - if err != nil { - return nil, fmt.Errorf("failed to open gzip reader: %v", err) - } - defer r.Close() - - b, err := ioutil.ReadAll(r) - if err != nil { - return nil, fmt.Errorf("failed to uncompress descriptor: %v", err) - } - - fd := new(FileDescriptorProto) - if err := proto.Unmarshal(b, fd); err != nil { - return nil, fmt.Errorf("malformed FileDescriptorProto: %v", err) - } - - return fd, nil -} - -// Message is a proto.Message with a method to return its descriptor. -// -// Message types generated by the protocol compiler always satisfy -// the Message interface. -type Message interface { - proto.Message - Descriptor() ([]byte, []int) -} - -// ForMessage returns a FileDescriptorProto and a DescriptorProto from within it -// describing the given message. -func ForMessage(msg Message) (fd *FileDescriptorProto, md *DescriptorProto) { - gz, path := msg.Descriptor() - fd, err := extractFile(gz) - if err != nil { - panic(fmt.Sprintf("invalid FileDescriptorProto for %T: %v", msg, err)) - } - - md = fd.MessageType[path[0]] - for _, i := range path[1:] { - md = md.NestedType[i] - } - return fd, md -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go deleted file mode 100644 index 6c4d80f5fdc..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor.pb.go +++ /dev/null @@ -1,2088 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: descriptor.proto -// DO NOT EDIT! - -/* -Package descriptor is a generated protocol buffer package. - -It is generated from these files: - descriptor.proto - -It has these top-level messages: - FileDescriptorSet - FileDescriptorProto - DescriptorProto - FieldDescriptorProto - OneofDescriptorProto - EnumDescriptorProto - EnumValueDescriptorProto - ServiceDescriptorProto - MethodDescriptorProto - FileOptions - MessageOptions - FieldOptions - OneofOptions - EnumOptions - EnumValueOptions - ServiceOptions - MethodOptions - UninterpretedOption - SourceCodeInfo - GeneratedCodeInfo -*/ -package descriptor - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type FieldDescriptorProto_Type int32 - -const ( - // 0 is reserved for errors. - // Order is weird for historical reasons. - FieldDescriptorProto_TYPE_DOUBLE FieldDescriptorProto_Type = 1 - FieldDescriptorProto_TYPE_FLOAT FieldDescriptorProto_Type = 2 - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if - // negative values are likely. - FieldDescriptorProto_TYPE_INT64 FieldDescriptorProto_Type = 3 - FieldDescriptorProto_TYPE_UINT64 FieldDescriptorProto_Type = 4 - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if - // negative values are likely. - FieldDescriptorProto_TYPE_INT32 FieldDescriptorProto_Type = 5 - FieldDescriptorProto_TYPE_FIXED64 FieldDescriptorProto_Type = 6 - FieldDescriptorProto_TYPE_FIXED32 FieldDescriptorProto_Type = 7 - FieldDescriptorProto_TYPE_BOOL FieldDescriptorProto_Type = 8 - FieldDescriptorProto_TYPE_STRING FieldDescriptorProto_Type = 9 - FieldDescriptorProto_TYPE_GROUP FieldDescriptorProto_Type = 10 - FieldDescriptorProto_TYPE_MESSAGE FieldDescriptorProto_Type = 11 - // New in version 2. - FieldDescriptorProto_TYPE_BYTES FieldDescriptorProto_Type = 12 - FieldDescriptorProto_TYPE_UINT32 FieldDescriptorProto_Type = 13 - FieldDescriptorProto_TYPE_ENUM FieldDescriptorProto_Type = 14 - FieldDescriptorProto_TYPE_SFIXED32 FieldDescriptorProto_Type = 15 - FieldDescriptorProto_TYPE_SFIXED64 FieldDescriptorProto_Type = 16 - FieldDescriptorProto_TYPE_SINT32 FieldDescriptorProto_Type = 17 - FieldDescriptorProto_TYPE_SINT64 FieldDescriptorProto_Type = 18 -) - -var FieldDescriptorProto_Type_name = map[int32]string{ - 1: "TYPE_DOUBLE", - 2: "TYPE_FLOAT", - 3: "TYPE_INT64", - 4: "TYPE_UINT64", - 5: "TYPE_INT32", - 6: "TYPE_FIXED64", - 7: "TYPE_FIXED32", - 8: "TYPE_BOOL", - 9: "TYPE_STRING", - 10: "TYPE_GROUP", - 11: "TYPE_MESSAGE", - 12: "TYPE_BYTES", - 13: "TYPE_UINT32", - 14: "TYPE_ENUM", - 15: "TYPE_SFIXED32", - 16: "TYPE_SFIXED64", - 17: "TYPE_SINT32", - 18: "TYPE_SINT64", -} -var FieldDescriptorProto_Type_value = map[string]int32{ - "TYPE_DOUBLE": 1, - "TYPE_FLOAT": 2, - "TYPE_INT64": 3, - "TYPE_UINT64": 4, - "TYPE_INT32": 5, - "TYPE_FIXED64": 6, - "TYPE_FIXED32": 7, - "TYPE_BOOL": 8, - "TYPE_STRING": 9, - "TYPE_GROUP": 10, - "TYPE_MESSAGE": 11, - "TYPE_BYTES": 12, - "TYPE_UINT32": 13, - "TYPE_ENUM": 14, - "TYPE_SFIXED32": 15, - "TYPE_SFIXED64": 16, - "TYPE_SINT32": 17, - "TYPE_SINT64": 18, -} - -func (x FieldDescriptorProto_Type) Enum() *FieldDescriptorProto_Type { - p := new(FieldDescriptorProto_Type) - *p = x - return p -} -func (x FieldDescriptorProto_Type) String() string { - return proto.EnumName(FieldDescriptorProto_Type_name, int32(x)) -} -func (x *FieldDescriptorProto_Type) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FieldDescriptorProto_Type_value, data, "FieldDescriptorProto_Type") - if err != nil { - return err - } - *x = FieldDescriptorProto_Type(value) - return nil -} -func (FieldDescriptorProto_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptorDescriptor, []int{3, 0} -} - -type FieldDescriptorProto_Label int32 - -const ( - // 0 is reserved for errors - FieldDescriptorProto_LABEL_OPTIONAL FieldDescriptorProto_Label = 1 - FieldDescriptorProto_LABEL_REQUIRED FieldDescriptorProto_Label = 2 - FieldDescriptorProto_LABEL_REPEATED FieldDescriptorProto_Label = 3 -) - -var FieldDescriptorProto_Label_name = map[int32]string{ - 1: "LABEL_OPTIONAL", - 2: "LABEL_REQUIRED", - 3: "LABEL_REPEATED", -} -var FieldDescriptorProto_Label_value = map[string]int32{ - "LABEL_OPTIONAL": 1, - "LABEL_REQUIRED": 2, - "LABEL_REPEATED": 3, -} - -func (x FieldDescriptorProto_Label) Enum() *FieldDescriptorProto_Label { - p := new(FieldDescriptorProto_Label) - *p = x - return p -} -func (x FieldDescriptorProto_Label) String() string { - return proto.EnumName(FieldDescriptorProto_Label_name, int32(x)) -} -func (x *FieldDescriptorProto_Label) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FieldDescriptorProto_Label_value, data, "FieldDescriptorProto_Label") - if err != nil { - return err - } - *x = FieldDescriptorProto_Label(value) - return nil -} -func (FieldDescriptorProto_Label) EnumDescriptor() ([]byte, []int) { - return fileDescriptorDescriptor, []int{3, 1} -} - -// Generated classes can be optimized for speed or code size. -type FileOptions_OptimizeMode int32 - -const ( - FileOptions_SPEED FileOptions_OptimizeMode = 1 - // etc. - FileOptions_CODE_SIZE FileOptions_OptimizeMode = 2 - FileOptions_LITE_RUNTIME FileOptions_OptimizeMode = 3 -) - -var FileOptions_OptimizeMode_name = map[int32]string{ - 1: "SPEED", - 2: "CODE_SIZE", - 3: "LITE_RUNTIME", -} -var FileOptions_OptimizeMode_value = map[string]int32{ - "SPEED": 1, - "CODE_SIZE": 2, - "LITE_RUNTIME": 3, -} - -func (x FileOptions_OptimizeMode) Enum() *FileOptions_OptimizeMode { - p := new(FileOptions_OptimizeMode) - *p = x - return p -} -func (x FileOptions_OptimizeMode) String() string { - return proto.EnumName(FileOptions_OptimizeMode_name, int32(x)) -} -func (x *FileOptions_OptimizeMode) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FileOptions_OptimizeMode_value, data, "FileOptions_OptimizeMode") - if err != nil { - return err - } - *x = FileOptions_OptimizeMode(value) - return nil -} -func (FileOptions_OptimizeMode) EnumDescriptor() ([]byte, []int) { - return fileDescriptorDescriptor, []int{9, 0} -} - -type FieldOptions_CType int32 - -const ( - // Default mode. - FieldOptions_STRING FieldOptions_CType = 0 - FieldOptions_CORD FieldOptions_CType = 1 - FieldOptions_STRING_PIECE FieldOptions_CType = 2 -) - -var FieldOptions_CType_name = map[int32]string{ - 0: "STRING", - 1: "CORD", - 2: "STRING_PIECE", -} -var FieldOptions_CType_value = map[string]int32{ - "STRING": 0, - "CORD": 1, - "STRING_PIECE": 2, -} - -func (x FieldOptions_CType) Enum() *FieldOptions_CType { - p := new(FieldOptions_CType) - *p = x - return p -} -func (x FieldOptions_CType) String() string { - return proto.EnumName(FieldOptions_CType_name, int32(x)) -} -func (x *FieldOptions_CType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FieldOptions_CType_value, data, "FieldOptions_CType") - if err != nil { - return err - } - *x = FieldOptions_CType(value) - return nil -} -func (FieldOptions_CType) EnumDescriptor() ([]byte, []int) { - return fileDescriptorDescriptor, []int{11, 0} -} - -type FieldOptions_JSType int32 - -const ( - // Use the default type. - FieldOptions_JS_NORMAL FieldOptions_JSType = 0 - // Use JavaScript strings. - FieldOptions_JS_STRING FieldOptions_JSType = 1 - // Use JavaScript numbers. - FieldOptions_JS_NUMBER FieldOptions_JSType = 2 -) - -var FieldOptions_JSType_name = map[int32]string{ - 0: "JS_NORMAL", - 1: "JS_STRING", - 2: "JS_NUMBER", -} -var FieldOptions_JSType_value = map[string]int32{ - "JS_NORMAL": 0, - "JS_STRING": 1, - "JS_NUMBER": 2, -} - -func (x FieldOptions_JSType) Enum() *FieldOptions_JSType { - p := new(FieldOptions_JSType) - *p = x - return p -} -func (x FieldOptions_JSType) String() string { - return proto.EnumName(FieldOptions_JSType_name, int32(x)) -} -func (x *FieldOptions_JSType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FieldOptions_JSType_value, data, "FieldOptions_JSType") - if err != nil { - return err - } - *x = FieldOptions_JSType(value) - return nil -} -func (FieldOptions_JSType) EnumDescriptor() ([]byte, []int) { - return fileDescriptorDescriptor, []int{11, 1} -} - -// The protocol compiler can output a FileDescriptorSet containing the .proto -// files it parses. -type FileDescriptorSet struct { - File []*FileDescriptorProto `protobuf:"bytes,1,rep,name=file" json:"file,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *FileDescriptorSet) Reset() { *m = FileDescriptorSet{} } -func (m *FileDescriptorSet) String() string { return proto.CompactTextString(m) } -func (*FileDescriptorSet) ProtoMessage() {} -func (*FileDescriptorSet) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{0} } - -func (m *FileDescriptorSet) GetFile() []*FileDescriptorProto { - if m != nil { - return m.File - } - return nil -} - -// Describes a complete .proto file. -type FileDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Package *string `protobuf:"bytes,2,opt,name=package" json:"package,omitempty"` - // Names of files imported by this file. - Dependency []string `protobuf:"bytes,3,rep,name=dependency" json:"dependency,omitempty"` - // Indexes of the public imported files in the dependency list above. - PublicDependency []int32 `protobuf:"varint,10,rep,name=public_dependency,json=publicDependency" json:"public_dependency,omitempty"` - // Indexes of the weak imported files in the dependency list. - // For Google-internal migration only. Do not use. - WeakDependency []int32 `protobuf:"varint,11,rep,name=weak_dependency,json=weakDependency" json:"weak_dependency,omitempty"` - // All top-level definitions in this file. - MessageType []*DescriptorProto `protobuf:"bytes,4,rep,name=message_type,json=messageType" json:"message_type,omitempty"` - EnumType []*EnumDescriptorProto `protobuf:"bytes,5,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` - Service []*ServiceDescriptorProto `protobuf:"bytes,6,rep,name=service" json:"service,omitempty"` - Extension []*FieldDescriptorProto `protobuf:"bytes,7,rep,name=extension" json:"extension,omitempty"` - Options *FileOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` - // This field contains optional information about the original source code. - // You may safely remove this entire field without harming runtime - // functionality of the descriptors -- the information is needed only by - // development tools. - SourceCodeInfo *SourceCodeInfo `protobuf:"bytes,9,opt,name=source_code_info,json=sourceCodeInfo" json:"source_code_info,omitempty"` - // The syntax of the proto file. - // The supported values are "proto2" and "proto3". - Syntax *string `protobuf:"bytes,12,opt,name=syntax" json:"syntax,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *FileDescriptorProto) Reset() { *m = FileDescriptorProto{} } -func (m *FileDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*FileDescriptorProto) ProtoMessage() {} -func (*FileDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{1} } - -func (m *FileDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *FileDescriptorProto) GetPackage() string { - if m != nil && m.Package != nil { - return *m.Package - } - return "" -} - -func (m *FileDescriptorProto) GetDependency() []string { - if m != nil { - return m.Dependency - } - return nil -} - -func (m *FileDescriptorProto) GetPublicDependency() []int32 { - if m != nil { - return m.PublicDependency - } - return nil -} - -func (m *FileDescriptorProto) GetWeakDependency() []int32 { - if m != nil { - return m.WeakDependency - } - return nil -} - -func (m *FileDescriptorProto) GetMessageType() []*DescriptorProto { - if m != nil { - return m.MessageType - } - return nil -} - -func (m *FileDescriptorProto) GetEnumType() []*EnumDescriptorProto { - if m != nil { - return m.EnumType - } - return nil -} - -func (m *FileDescriptorProto) GetService() []*ServiceDescriptorProto { - if m != nil { - return m.Service - } - return nil -} - -func (m *FileDescriptorProto) GetExtension() []*FieldDescriptorProto { - if m != nil { - return m.Extension - } - return nil -} - -func (m *FileDescriptorProto) GetOptions() *FileOptions { - if m != nil { - return m.Options - } - return nil -} - -func (m *FileDescriptorProto) GetSourceCodeInfo() *SourceCodeInfo { - if m != nil { - return m.SourceCodeInfo - } - return nil -} - -func (m *FileDescriptorProto) GetSyntax() string { - if m != nil && m.Syntax != nil { - return *m.Syntax - } - return "" -} - -// Describes a message type. -type DescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Field []*FieldDescriptorProto `protobuf:"bytes,2,rep,name=field" json:"field,omitempty"` - Extension []*FieldDescriptorProto `protobuf:"bytes,6,rep,name=extension" json:"extension,omitempty"` - NestedType []*DescriptorProto `protobuf:"bytes,3,rep,name=nested_type,json=nestedType" json:"nested_type,omitempty"` - EnumType []*EnumDescriptorProto `protobuf:"bytes,4,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` - ExtensionRange []*DescriptorProto_ExtensionRange `protobuf:"bytes,5,rep,name=extension_range,json=extensionRange" json:"extension_range,omitempty"` - OneofDecl []*OneofDescriptorProto `protobuf:"bytes,8,rep,name=oneof_decl,json=oneofDecl" json:"oneof_decl,omitempty"` - Options *MessageOptions `protobuf:"bytes,7,opt,name=options" json:"options,omitempty"` - ReservedRange []*DescriptorProto_ReservedRange `protobuf:"bytes,9,rep,name=reserved_range,json=reservedRange" json:"reserved_range,omitempty"` - // Reserved field names, which may not be used by fields in the same message. - // A given name may only be reserved once. - ReservedName []string `protobuf:"bytes,10,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *DescriptorProto) Reset() { *m = DescriptorProto{} } -func (m *DescriptorProto) String() string { return proto.CompactTextString(m) } -func (*DescriptorProto) ProtoMessage() {} -func (*DescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{2} } - -func (m *DescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *DescriptorProto) GetField() []*FieldDescriptorProto { - if m != nil { - return m.Field - } - return nil -} - -func (m *DescriptorProto) GetExtension() []*FieldDescriptorProto { - if m != nil { - return m.Extension - } - return nil -} - -func (m *DescriptorProto) GetNestedType() []*DescriptorProto { - if m != nil { - return m.NestedType - } - return nil -} - -func (m *DescriptorProto) GetEnumType() []*EnumDescriptorProto { - if m != nil { - return m.EnumType - } - return nil -} - -func (m *DescriptorProto) GetExtensionRange() []*DescriptorProto_ExtensionRange { - if m != nil { - return m.ExtensionRange - } - return nil -} - -func (m *DescriptorProto) GetOneofDecl() []*OneofDescriptorProto { - if m != nil { - return m.OneofDecl - } - return nil -} - -func (m *DescriptorProto) GetOptions() *MessageOptions { - if m != nil { - return m.Options - } - return nil -} - -func (m *DescriptorProto) GetReservedRange() []*DescriptorProto_ReservedRange { - if m != nil { - return m.ReservedRange - } - return nil -} - -func (m *DescriptorProto) GetReservedName() []string { - if m != nil { - return m.ReservedName - } - return nil -} - -type DescriptorProto_ExtensionRange struct { - Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` - End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *DescriptorProto_ExtensionRange) Reset() { *m = DescriptorProto_ExtensionRange{} } -func (m *DescriptorProto_ExtensionRange) String() string { return proto.CompactTextString(m) } -func (*DescriptorProto_ExtensionRange) ProtoMessage() {} -func (*DescriptorProto_ExtensionRange) Descriptor() ([]byte, []int) { - return fileDescriptorDescriptor, []int{2, 0} -} - -func (m *DescriptorProto_ExtensionRange) GetStart() int32 { - if m != nil && m.Start != nil { - return *m.Start - } - return 0 -} - -func (m *DescriptorProto_ExtensionRange) GetEnd() int32 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} - -// Range of reserved tag numbers. Reserved tag numbers may not be used by -// fields or extension ranges in the same message. Reserved ranges may -// not overlap. -type DescriptorProto_ReservedRange struct { - Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` - End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *DescriptorProto_ReservedRange) Reset() { *m = DescriptorProto_ReservedRange{} } -func (m *DescriptorProto_ReservedRange) String() string { return proto.CompactTextString(m) } -func (*DescriptorProto_ReservedRange) ProtoMessage() {} -func (*DescriptorProto_ReservedRange) Descriptor() ([]byte, []int) { - return fileDescriptorDescriptor, []int{2, 1} -} - -func (m *DescriptorProto_ReservedRange) GetStart() int32 { - if m != nil && m.Start != nil { - return *m.Start - } - return 0 -} - -func (m *DescriptorProto_ReservedRange) GetEnd() int32 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} - -// Describes a field within a message. -type FieldDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Number *int32 `protobuf:"varint,3,opt,name=number" json:"number,omitempty"` - Label *FieldDescriptorProto_Label `protobuf:"varint,4,opt,name=label,enum=google.protobuf.FieldDescriptorProto_Label" json:"label,omitempty"` - // If type_name is set, this need not be set. If both this and type_name - // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. - Type *FieldDescriptorProto_Type `protobuf:"varint,5,opt,name=type,enum=google.protobuf.FieldDescriptorProto_Type" json:"type,omitempty"` - // For message and enum types, this is the name of the type. If the name - // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping - // rules are used to find the type (i.e. first the nested types within this - // message are searched, then within the parent, on up to the root - // namespace). - TypeName *string `protobuf:"bytes,6,opt,name=type_name,json=typeName" json:"type_name,omitempty"` - // For extensions, this is the name of the type being extended. It is - // resolved in the same manner as type_name. - Extendee *string `protobuf:"bytes,2,opt,name=extendee" json:"extendee,omitempty"` - // For numeric types, contains the original text representation of the value. - // For booleans, "true" or "false". - // For strings, contains the default text contents (not escaped in any way). - // For bytes, contains the C escaped value. All bytes >= 128 are escaped. - // TODO(kenton): Base-64 encode? - DefaultValue *string `protobuf:"bytes,7,opt,name=default_value,json=defaultValue" json:"default_value,omitempty"` - // If set, gives the index of a oneof in the containing type's oneof_decl - // list. This field is a member of that oneof. - OneofIndex *int32 `protobuf:"varint,9,opt,name=oneof_index,json=oneofIndex" json:"oneof_index,omitempty"` - // JSON name of this field. The value is set by protocol compiler. If the - // user has set a "json_name" option on this field, that option's value - // will be used. Otherwise, it's deduced from the field's name by converting - // it to camelCase. - JsonName *string `protobuf:"bytes,10,opt,name=json_name,json=jsonName" json:"json_name,omitempty"` - Options *FieldOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *FieldDescriptorProto) Reset() { *m = FieldDescriptorProto{} } -func (m *FieldDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*FieldDescriptorProto) ProtoMessage() {} -func (*FieldDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{3} } - -func (m *FieldDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *FieldDescriptorProto) GetNumber() int32 { - if m != nil && m.Number != nil { - return *m.Number - } - return 0 -} - -func (m *FieldDescriptorProto) GetLabel() FieldDescriptorProto_Label { - if m != nil && m.Label != nil { - return *m.Label - } - return FieldDescriptorProto_LABEL_OPTIONAL -} - -func (m *FieldDescriptorProto) GetType() FieldDescriptorProto_Type { - if m != nil && m.Type != nil { - return *m.Type - } - return FieldDescriptorProto_TYPE_DOUBLE -} - -func (m *FieldDescriptorProto) GetTypeName() string { - if m != nil && m.TypeName != nil { - return *m.TypeName - } - return "" -} - -func (m *FieldDescriptorProto) GetExtendee() string { - if m != nil && m.Extendee != nil { - return *m.Extendee - } - return "" -} - -func (m *FieldDescriptorProto) GetDefaultValue() string { - if m != nil && m.DefaultValue != nil { - return *m.DefaultValue - } - return "" -} - -func (m *FieldDescriptorProto) GetOneofIndex() int32 { - if m != nil && m.OneofIndex != nil { - return *m.OneofIndex - } - return 0 -} - -func (m *FieldDescriptorProto) GetJsonName() string { - if m != nil && m.JsonName != nil { - return *m.JsonName - } - return "" -} - -func (m *FieldDescriptorProto) GetOptions() *FieldOptions { - if m != nil { - return m.Options - } - return nil -} - -// Describes a oneof. -type OneofDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Options *OneofOptions `protobuf:"bytes,2,opt,name=options" json:"options,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *OneofDescriptorProto) Reset() { *m = OneofDescriptorProto{} } -func (m *OneofDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*OneofDescriptorProto) ProtoMessage() {} -func (*OneofDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{4} } - -func (m *OneofDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *OneofDescriptorProto) GetOptions() *OneofOptions { - if m != nil { - return m.Options - } - return nil -} - -// Describes an enum type. -type EnumDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Value []*EnumValueDescriptorProto `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"` - Options *EnumOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *EnumDescriptorProto) Reset() { *m = EnumDescriptorProto{} } -func (m *EnumDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*EnumDescriptorProto) ProtoMessage() {} -func (*EnumDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{5} } - -func (m *EnumDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *EnumDescriptorProto) GetValue() []*EnumValueDescriptorProto { - if m != nil { - return m.Value - } - return nil -} - -func (m *EnumDescriptorProto) GetOptions() *EnumOptions { - if m != nil { - return m.Options - } - return nil -} - -// Describes a value within an enum. -type EnumValueDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Number *int32 `protobuf:"varint,2,opt,name=number" json:"number,omitempty"` - Options *EnumValueOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *EnumValueDescriptorProto) Reset() { *m = EnumValueDescriptorProto{} } -func (m *EnumValueDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*EnumValueDescriptorProto) ProtoMessage() {} -func (*EnumValueDescriptorProto) Descriptor() ([]byte, []int) { - return fileDescriptorDescriptor, []int{6} -} - -func (m *EnumValueDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *EnumValueDescriptorProto) GetNumber() int32 { - if m != nil && m.Number != nil { - return *m.Number - } - return 0 -} - -func (m *EnumValueDescriptorProto) GetOptions() *EnumValueOptions { - if m != nil { - return m.Options - } - return nil -} - -// Describes a service. -type ServiceDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Method []*MethodDescriptorProto `protobuf:"bytes,2,rep,name=method" json:"method,omitempty"` - Options *ServiceOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *ServiceDescriptorProto) Reset() { *m = ServiceDescriptorProto{} } -func (m *ServiceDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*ServiceDescriptorProto) ProtoMessage() {} -func (*ServiceDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{7} } - -func (m *ServiceDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *ServiceDescriptorProto) GetMethod() []*MethodDescriptorProto { - if m != nil { - return m.Method - } - return nil -} - -func (m *ServiceDescriptorProto) GetOptions() *ServiceOptions { - if m != nil { - return m.Options - } - return nil -} - -// Describes a method of a service. -type MethodDescriptorProto struct { - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - // Input and output type names. These are resolved in the same way as - // FieldDescriptorProto.type_name, but must refer to a message type. - InputType *string `protobuf:"bytes,2,opt,name=input_type,json=inputType" json:"input_type,omitempty"` - OutputType *string `protobuf:"bytes,3,opt,name=output_type,json=outputType" json:"output_type,omitempty"` - Options *MethodOptions `protobuf:"bytes,4,opt,name=options" json:"options,omitempty"` - // Identifies if client streams multiple client messages - ClientStreaming *bool `protobuf:"varint,5,opt,name=client_streaming,json=clientStreaming,def=0" json:"client_streaming,omitempty"` - // Identifies if server streams multiple server messages - ServerStreaming *bool `protobuf:"varint,6,opt,name=server_streaming,json=serverStreaming,def=0" json:"server_streaming,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *MethodDescriptorProto) Reset() { *m = MethodDescriptorProto{} } -func (m *MethodDescriptorProto) String() string { return proto.CompactTextString(m) } -func (*MethodDescriptorProto) ProtoMessage() {} -func (*MethodDescriptorProto) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{8} } - -const Default_MethodDescriptorProto_ClientStreaming bool = false -const Default_MethodDescriptorProto_ServerStreaming bool = false - -func (m *MethodDescriptorProto) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *MethodDescriptorProto) GetInputType() string { - if m != nil && m.InputType != nil { - return *m.InputType - } - return "" -} - -func (m *MethodDescriptorProto) GetOutputType() string { - if m != nil && m.OutputType != nil { - return *m.OutputType - } - return "" -} - -func (m *MethodDescriptorProto) GetOptions() *MethodOptions { - if m != nil { - return m.Options - } - return nil -} - -func (m *MethodDescriptorProto) GetClientStreaming() bool { - if m != nil && m.ClientStreaming != nil { - return *m.ClientStreaming - } - return Default_MethodDescriptorProto_ClientStreaming -} - -func (m *MethodDescriptorProto) GetServerStreaming() bool { - if m != nil && m.ServerStreaming != nil { - return *m.ServerStreaming - } - return Default_MethodDescriptorProto_ServerStreaming -} - -type FileOptions struct { - // Sets the Java package where classes generated from this .proto will be - // placed. By default, the proto package is used, but this is often - // inappropriate because proto packages do not normally start with backwards - // domain names. - JavaPackage *string `protobuf:"bytes,1,opt,name=java_package,json=javaPackage" json:"java_package,omitempty"` - // If set, all the classes from the .proto file are wrapped in a single - // outer class with the given name. This applies to both Proto1 - // (equivalent to the old "--one_java_file" option) and Proto2 (where - // a .proto always translates to a single class, but you may want to - // explicitly choose the class name). - JavaOuterClassname *string `protobuf:"bytes,8,opt,name=java_outer_classname,json=javaOuterClassname" json:"java_outer_classname,omitempty"` - // If set true, then the Java code generator will generate a separate .java - // file for each top-level message, enum, and service defined in the .proto - // file. Thus, these types will *not* be nested inside the outer class - // named by java_outer_classname. However, the outer class will still be - // generated to contain the file's getDescriptor() method as well as any - // top-level extensions defined in the file. - JavaMultipleFiles *bool `protobuf:"varint,10,opt,name=java_multiple_files,json=javaMultipleFiles,def=0" json:"java_multiple_files,omitempty"` - // If set true, then the Java code generator will generate equals() and - // hashCode() methods for all messages defined in the .proto file. - // This increases generated code size, potentially substantially for large - // protos, which may harm a memory-constrained application. - // - In the full runtime this is a speed optimization, as the - // AbstractMessage base class includes reflection-based implementations of - // these methods. - // - In the lite runtime, setting this option changes the semantics of - // equals() and hashCode() to more closely match those of the full runtime; - // the generated methods compute their results based on field values rather - // than object identity. (Implementations should not assume that hashcodes - // will be consistent across runtimes or versions of the protocol compiler.) - JavaGenerateEqualsAndHash *bool `protobuf:"varint,20,opt,name=java_generate_equals_and_hash,json=javaGenerateEqualsAndHash,def=0" json:"java_generate_equals_and_hash,omitempty"` - // If set true, then the Java2 code generator will generate code that - // throws an exception whenever an attempt is made to assign a non-UTF-8 - // byte sequence to a string field. - // Message reflection will do the same. - // However, an extension field still accepts non-UTF-8 byte sequences. - // This option has no effect on when used with the lite runtime. - JavaStringCheckUtf8 *bool `protobuf:"varint,27,opt,name=java_string_check_utf8,json=javaStringCheckUtf8,def=0" json:"java_string_check_utf8,omitempty"` - OptimizeFor *FileOptions_OptimizeMode `protobuf:"varint,9,opt,name=optimize_for,json=optimizeFor,enum=google.protobuf.FileOptions_OptimizeMode,def=1" json:"optimize_for,omitempty"` - // Sets the Go package where structs generated from this .proto will be - // placed. If omitted, the Go package will be derived from the following: - // - The basename of the package import path, if provided. - // - Otherwise, the package statement in the .proto file, if present. - // - Otherwise, the basename of the .proto file, without extension. - GoPackage *string `protobuf:"bytes,11,opt,name=go_package,json=goPackage" json:"go_package,omitempty"` - // Should generic services be generated in each language? "Generic" services - // are not specific to any particular RPC system. They are generated by the - // main code generators in each language (without additional plugins). - // Generic services were the only kind of service generation supported by - // early versions of google.protobuf. - // - // Generic services are now considered deprecated in favor of using plugins - // that generate code specific to your particular RPC system. Therefore, - // these default to false. Old code which depends on generic services should - // explicitly set them to true. - CcGenericServices *bool `protobuf:"varint,16,opt,name=cc_generic_services,json=ccGenericServices,def=0" json:"cc_generic_services,omitempty"` - JavaGenericServices *bool `protobuf:"varint,17,opt,name=java_generic_services,json=javaGenericServices,def=0" json:"java_generic_services,omitempty"` - PyGenericServices *bool `protobuf:"varint,18,opt,name=py_generic_services,json=pyGenericServices,def=0" json:"py_generic_services,omitempty"` - // Is this file deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for everything in the file, or it will be completely ignored; in the very - // least, this is a formalization for deprecating files. - Deprecated *bool `protobuf:"varint,23,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // Enables the use of arenas for the proto messages in this file. This applies - // only to generated classes for C++. - CcEnableArenas *bool `protobuf:"varint,31,opt,name=cc_enable_arenas,json=ccEnableArenas,def=0" json:"cc_enable_arenas,omitempty"` - // Sets the objective c class prefix which is prepended to all objective c - // generated classes from this .proto. There is no default. - ObjcClassPrefix *string `protobuf:"bytes,36,opt,name=objc_class_prefix,json=objcClassPrefix" json:"objc_class_prefix,omitempty"` - // Namespace for generated classes; defaults to the package. - CsharpNamespace *string `protobuf:"bytes,37,opt,name=csharp_namespace,json=csharpNamespace" json:"csharp_namespace,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *FileOptions) Reset() { *m = FileOptions{} } -func (m *FileOptions) String() string { return proto.CompactTextString(m) } -func (*FileOptions) ProtoMessage() {} -func (*FileOptions) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{9} } - -var extRange_FileOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*FileOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_FileOptions -} - -const Default_FileOptions_JavaMultipleFiles bool = false -const Default_FileOptions_JavaGenerateEqualsAndHash bool = false -const Default_FileOptions_JavaStringCheckUtf8 bool = false -const Default_FileOptions_OptimizeFor FileOptions_OptimizeMode = FileOptions_SPEED -const Default_FileOptions_CcGenericServices bool = false -const Default_FileOptions_JavaGenericServices bool = false -const Default_FileOptions_PyGenericServices bool = false -const Default_FileOptions_Deprecated bool = false -const Default_FileOptions_CcEnableArenas bool = false - -func (m *FileOptions) GetJavaPackage() string { - if m != nil && m.JavaPackage != nil { - return *m.JavaPackage - } - return "" -} - -func (m *FileOptions) GetJavaOuterClassname() string { - if m != nil && m.JavaOuterClassname != nil { - return *m.JavaOuterClassname - } - return "" -} - -func (m *FileOptions) GetJavaMultipleFiles() bool { - if m != nil && m.JavaMultipleFiles != nil { - return *m.JavaMultipleFiles - } - return Default_FileOptions_JavaMultipleFiles -} - -func (m *FileOptions) GetJavaGenerateEqualsAndHash() bool { - if m != nil && m.JavaGenerateEqualsAndHash != nil { - return *m.JavaGenerateEqualsAndHash - } - return Default_FileOptions_JavaGenerateEqualsAndHash -} - -func (m *FileOptions) GetJavaStringCheckUtf8() bool { - if m != nil && m.JavaStringCheckUtf8 != nil { - return *m.JavaStringCheckUtf8 - } - return Default_FileOptions_JavaStringCheckUtf8 -} - -func (m *FileOptions) GetOptimizeFor() FileOptions_OptimizeMode { - if m != nil && m.OptimizeFor != nil { - return *m.OptimizeFor - } - return Default_FileOptions_OptimizeFor -} - -func (m *FileOptions) GetGoPackage() string { - if m != nil && m.GoPackage != nil { - return *m.GoPackage - } - return "" -} - -func (m *FileOptions) GetCcGenericServices() bool { - if m != nil && m.CcGenericServices != nil { - return *m.CcGenericServices - } - return Default_FileOptions_CcGenericServices -} - -func (m *FileOptions) GetJavaGenericServices() bool { - if m != nil && m.JavaGenericServices != nil { - return *m.JavaGenericServices - } - return Default_FileOptions_JavaGenericServices -} - -func (m *FileOptions) GetPyGenericServices() bool { - if m != nil && m.PyGenericServices != nil { - return *m.PyGenericServices - } - return Default_FileOptions_PyGenericServices -} - -func (m *FileOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_FileOptions_Deprecated -} - -func (m *FileOptions) GetCcEnableArenas() bool { - if m != nil && m.CcEnableArenas != nil { - return *m.CcEnableArenas - } - return Default_FileOptions_CcEnableArenas -} - -func (m *FileOptions) GetObjcClassPrefix() string { - if m != nil && m.ObjcClassPrefix != nil { - return *m.ObjcClassPrefix - } - return "" -} - -func (m *FileOptions) GetCsharpNamespace() string { - if m != nil && m.CsharpNamespace != nil { - return *m.CsharpNamespace - } - return "" -} - -func (m *FileOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type MessageOptions struct { - // Set true to use the old proto1 MessageSet wire format for extensions. - // This is provided for backwards-compatibility with the MessageSet wire - // format. You should not use this for any other reason: It's less - // efficient, has fewer features, and is more complicated. - // - // The message must be defined exactly as follows: - // message Foo { - // option message_set_wire_format = true; - // extensions 4 to max; - // } - // Note that the message cannot have any defined fields; MessageSets only - // have extensions. - // - // All extensions of your type must be singular messages; e.g. they cannot - // be int32s, enums, or repeated messages. - // - // Because this is an option, the above two restrictions are not enforced by - // the protocol compiler. - MessageSetWireFormat *bool `protobuf:"varint,1,opt,name=message_set_wire_format,json=messageSetWireFormat,def=0" json:"message_set_wire_format,omitempty"` - // Disables the generation of the standard "descriptor()" accessor, which can - // conflict with a field of the same name. This is meant to make migration - // from proto1 easier; new code should avoid fields named "descriptor". - NoStandardDescriptorAccessor *bool `protobuf:"varint,2,opt,name=no_standard_descriptor_accessor,json=noStandardDescriptorAccessor,def=0" json:"no_standard_descriptor_accessor,omitempty"` - // Is this message deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the message, or it will be completely ignored; in the very least, - // this is a formalization for deprecating messages. - Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // Whether the message is an automatically generated map entry type for the - // maps field. - // - // For maps fields: - // map map_field = 1; - // The parsed descriptor looks like: - // message MapFieldEntry { - // option map_entry = true; - // optional KeyType key = 1; - // optional ValueType value = 2; - // } - // repeated MapFieldEntry map_field = 1; - // - // Implementations may choose not to generate the map_entry=true message, but - // use a native map in the target language to hold the keys and values. - // The reflection APIs in such implementions still need to work as - // if the field is a repeated message field. - // - // NOTE: Do not set the option in .proto files. Always use the maps syntax - // instead. The option should only be implicitly set by the proto compiler - // parser. - MapEntry *bool `protobuf:"varint,7,opt,name=map_entry,json=mapEntry" json:"map_entry,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *MessageOptions) Reset() { *m = MessageOptions{} } -func (m *MessageOptions) String() string { return proto.CompactTextString(m) } -func (*MessageOptions) ProtoMessage() {} -func (*MessageOptions) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{10} } - -var extRange_MessageOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*MessageOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_MessageOptions -} - -const Default_MessageOptions_MessageSetWireFormat bool = false -const Default_MessageOptions_NoStandardDescriptorAccessor bool = false -const Default_MessageOptions_Deprecated bool = false - -func (m *MessageOptions) GetMessageSetWireFormat() bool { - if m != nil && m.MessageSetWireFormat != nil { - return *m.MessageSetWireFormat - } - return Default_MessageOptions_MessageSetWireFormat -} - -func (m *MessageOptions) GetNoStandardDescriptorAccessor() bool { - if m != nil && m.NoStandardDescriptorAccessor != nil { - return *m.NoStandardDescriptorAccessor - } - return Default_MessageOptions_NoStandardDescriptorAccessor -} - -func (m *MessageOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_MessageOptions_Deprecated -} - -func (m *MessageOptions) GetMapEntry() bool { - if m != nil && m.MapEntry != nil { - return *m.MapEntry - } - return false -} - -func (m *MessageOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type FieldOptions struct { - // The ctype option instructs the C++ code generator to use a different - // representation of the field than it normally would. See the specific - // options below. This option is not yet implemented in the open source - // release -- sorry, we'll try to include it in a future version! - Ctype *FieldOptions_CType `protobuf:"varint,1,opt,name=ctype,enum=google.protobuf.FieldOptions_CType,def=0" json:"ctype,omitempty"` - // The packed option can be enabled for repeated primitive fields to enable - // a more efficient representation on the wire. Rather than repeatedly - // writing the tag and type for each element, the entire array is encoded as - // a single length-delimited blob. In proto3, only explicit setting it to - // false will avoid using packed encoding. - Packed *bool `protobuf:"varint,2,opt,name=packed" json:"packed,omitempty"` - // The jstype option determines the JavaScript type used for values of the - // field. The option is permitted only for 64 bit integral and fixed types - // (int64, uint64, sint64, fixed64, sfixed64). By default these types are - // represented as JavaScript strings. This avoids loss of precision that can - // happen when a large value is converted to a floating point JavaScript - // numbers. Specifying JS_NUMBER for the jstype causes the generated - // JavaScript code to use the JavaScript "number" type instead of strings. - // This option is an enum to permit additional types to be added, - // e.g. goog.math.Integer. - Jstype *FieldOptions_JSType `protobuf:"varint,6,opt,name=jstype,enum=google.protobuf.FieldOptions_JSType,def=0" json:"jstype,omitempty"` - // Should this field be parsed lazily? Lazy applies only to message-type - // fields. It means that when the outer message is initially parsed, the - // inner message's contents will not be parsed but instead stored in encoded - // form. The inner message will actually be parsed when it is first accessed. - // - // This is only a hint. Implementations are free to choose whether to use - // eager or lazy parsing regardless of the value of this option. However, - // setting this option true suggests that the protocol author believes that - // using lazy parsing on this field is worth the additional bookkeeping - // overhead typically needed to implement it. - // - // This option does not affect the public interface of any generated code; - // all method signatures remain the same. Furthermore, thread-safety of the - // interface is not affected by this option; const methods remain safe to - // call from multiple threads concurrently, while non-const methods continue - // to require exclusive access. - // - // - // Note that implementations may choose not to check required fields within - // a lazy sub-message. That is, calling IsInitialized() on the outher message - // may return true even if the inner message has missing required fields. - // This is necessary because otherwise the inner message would have to be - // parsed in order to perform the check, defeating the purpose of lazy - // parsing. An implementation which chooses not to check required fields - // must be consistent about it. That is, for any particular sub-message, the - // implementation must either *always* check its required fields, or *never* - // check its required fields, regardless of whether or not the message has - // been parsed. - Lazy *bool `protobuf:"varint,5,opt,name=lazy,def=0" json:"lazy,omitempty"` - // Is this field deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for accessors, or it will be completely ignored; in the very least, this - // is a formalization for deprecating fields. - Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // For Google-internal migration only. Do not use. - Weak *bool `protobuf:"varint,10,opt,name=weak,def=0" json:"weak,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *FieldOptions) Reset() { *m = FieldOptions{} } -func (m *FieldOptions) String() string { return proto.CompactTextString(m) } -func (*FieldOptions) ProtoMessage() {} -func (*FieldOptions) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{11} } - -var extRange_FieldOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*FieldOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_FieldOptions -} - -const Default_FieldOptions_Ctype FieldOptions_CType = FieldOptions_STRING -const Default_FieldOptions_Jstype FieldOptions_JSType = FieldOptions_JS_NORMAL -const Default_FieldOptions_Lazy bool = false -const Default_FieldOptions_Deprecated bool = false -const Default_FieldOptions_Weak bool = false - -func (m *FieldOptions) GetCtype() FieldOptions_CType { - if m != nil && m.Ctype != nil { - return *m.Ctype - } - return Default_FieldOptions_Ctype -} - -func (m *FieldOptions) GetPacked() bool { - if m != nil && m.Packed != nil { - return *m.Packed - } - return false -} - -func (m *FieldOptions) GetJstype() FieldOptions_JSType { - if m != nil && m.Jstype != nil { - return *m.Jstype - } - return Default_FieldOptions_Jstype -} - -func (m *FieldOptions) GetLazy() bool { - if m != nil && m.Lazy != nil { - return *m.Lazy - } - return Default_FieldOptions_Lazy -} - -func (m *FieldOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_FieldOptions_Deprecated -} - -func (m *FieldOptions) GetWeak() bool { - if m != nil && m.Weak != nil { - return *m.Weak - } - return Default_FieldOptions_Weak -} - -func (m *FieldOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type OneofOptions struct { - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *OneofOptions) Reset() { *m = OneofOptions{} } -func (m *OneofOptions) String() string { return proto.CompactTextString(m) } -func (*OneofOptions) ProtoMessage() {} -func (*OneofOptions) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{12} } - -var extRange_OneofOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*OneofOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_OneofOptions -} - -func (m *OneofOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type EnumOptions struct { - // Set this option to true to allow mapping different tag names to the same - // value. - AllowAlias *bool `protobuf:"varint,2,opt,name=allow_alias,json=allowAlias" json:"allow_alias,omitempty"` - // Is this enum deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the enum, or it will be completely ignored; in the very least, this - // is a formalization for deprecating enums. - Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *EnumOptions) Reset() { *m = EnumOptions{} } -func (m *EnumOptions) String() string { return proto.CompactTextString(m) } -func (*EnumOptions) ProtoMessage() {} -func (*EnumOptions) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{13} } - -var extRange_EnumOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*EnumOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_EnumOptions -} - -const Default_EnumOptions_Deprecated bool = false - -func (m *EnumOptions) GetAllowAlias() bool { - if m != nil && m.AllowAlias != nil { - return *m.AllowAlias - } - return false -} - -func (m *EnumOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_EnumOptions_Deprecated -} - -func (m *EnumOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type EnumValueOptions struct { - // Is this enum value deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the enum value, or it will be completely ignored; in the very least, - // this is a formalization for deprecating enum values. - Deprecated *bool `protobuf:"varint,1,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *EnumValueOptions) Reset() { *m = EnumValueOptions{} } -func (m *EnumValueOptions) String() string { return proto.CompactTextString(m) } -func (*EnumValueOptions) ProtoMessage() {} -func (*EnumValueOptions) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{14} } - -var extRange_EnumValueOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*EnumValueOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_EnumValueOptions -} - -const Default_EnumValueOptions_Deprecated bool = false - -func (m *EnumValueOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_EnumValueOptions_Deprecated -} - -func (m *EnumValueOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type ServiceOptions struct { - // Is this service deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the service, or it will be completely ignored; in the very least, - // this is a formalization for deprecating services. - Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *ServiceOptions) Reset() { *m = ServiceOptions{} } -func (m *ServiceOptions) String() string { return proto.CompactTextString(m) } -func (*ServiceOptions) ProtoMessage() {} -func (*ServiceOptions) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{15} } - -var extRange_ServiceOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*ServiceOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_ServiceOptions -} - -const Default_ServiceOptions_Deprecated bool = false - -func (m *ServiceOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_ServiceOptions_Deprecated -} - -func (m *ServiceOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -type MethodOptions struct { - // Is this method deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the method, or it will be completely ignored; in the very least, - // this is a formalization for deprecating methods. - Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` - // The parser stores options it doesn't recognize here. See above. - UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *MethodOptions) Reset() { *m = MethodOptions{} } -func (m *MethodOptions) String() string { return proto.CompactTextString(m) } -func (*MethodOptions) ProtoMessage() {} -func (*MethodOptions) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{16} } - -var extRange_MethodOptions = []proto.ExtensionRange{ - {Start: 1000, End: 536870911}, -} - -func (*MethodOptions) ExtensionRangeArray() []proto.ExtensionRange { - return extRange_MethodOptions -} - -const Default_MethodOptions_Deprecated bool = false - -func (m *MethodOptions) GetDeprecated() bool { - if m != nil && m.Deprecated != nil { - return *m.Deprecated - } - return Default_MethodOptions_Deprecated -} - -func (m *MethodOptions) GetUninterpretedOption() []*UninterpretedOption { - if m != nil { - return m.UninterpretedOption - } - return nil -} - -// A message representing a option the parser does not recognize. This only -// appears in options protos created by the compiler::Parser class. -// DescriptorPool resolves these when building Descriptor objects. Therefore, -// options protos in descriptor objects (e.g. returned by Descriptor::options(), -// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions -// in them. -type UninterpretedOption struct { - Name []*UninterpretedOption_NamePart `protobuf:"bytes,2,rep,name=name" json:"name,omitempty"` - // The value of the uninterpreted option, in whatever type the tokenizer - // identified it as during parsing. Exactly one of these should be set. - IdentifierValue *string `protobuf:"bytes,3,opt,name=identifier_value,json=identifierValue" json:"identifier_value,omitempty"` - PositiveIntValue *uint64 `protobuf:"varint,4,opt,name=positive_int_value,json=positiveIntValue" json:"positive_int_value,omitempty"` - NegativeIntValue *int64 `protobuf:"varint,5,opt,name=negative_int_value,json=negativeIntValue" json:"negative_int_value,omitempty"` - DoubleValue *float64 `protobuf:"fixed64,6,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` - StringValue []byte `protobuf:"bytes,7,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` - AggregateValue *string `protobuf:"bytes,8,opt,name=aggregate_value,json=aggregateValue" json:"aggregate_value,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *UninterpretedOption) Reset() { *m = UninterpretedOption{} } -func (m *UninterpretedOption) String() string { return proto.CompactTextString(m) } -func (*UninterpretedOption) ProtoMessage() {} -func (*UninterpretedOption) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{17} } - -func (m *UninterpretedOption) GetName() []*UninterpretedOption_NamePart { - if m != nil { - return m.Name - } - return nil -} - -func (m *UninterpretedOption) GetIdentifierValue() string { - if m != nil && m.IdentifierValue != nil { - return *m.IdentifierValue - } - return "" -} - -func (m *UninterpretedOption) GetPositiveIntValue() uint64 { - if m != nil && m.PositiveIntValue != nil { - return *m.PositiveIntValue - } - return 0 -} - -func (m *UninterpretedOption) GetNegativeIntValue() int64 { - if m != nil && m.NegativeIntValue != nil { - return *m.NegativeIntValue - } - return 0 -} - -func (m *UninterpretedOption) GetDoubleValue() float64 { - if m != nil && m.DoubleValue != nil { - return *m.DoubleValue - } - return 0 -} - -func (m *UninterpretedOption) GetStringValue() []byte { - if m != nil { - return m.StringValue - } - return nil -} - -func (m *UninterpretedOption) GetAggregateValue() string { - if m != nil && m.AggregateValue != nil { - return *m.AggregateValue - } - return "" -} - -// The name of the uninterpreted option. Each string represents a segment in -// a dot-separated name. is_extension is true iff a segment represents an -// extension (denoted with parentheses in options specs in .proto files). -// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents -// "foo.(bar.baz).qux". -type UninterpretedOption_NamePart struct { - NamePart *string `protobuf:"bytes,1,req,name=name_part,json=namePart" json:"name_part,omitempty"` - IsExtension *bool `protobuf:"varint,2,req,name=is_extension,json=isExtension" json:"is_extension,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *UninterpretedOption_NamePart) Reset() { *m = UninterpretedOption_NamePart{} } -func (m *UninterpretedOption_NamePart) String() string { return proto.CompactTextString(m) } -func (*UninterpretedOption_NamePart) ProtoMessage() {} -func (*UninterpretedOption_NamePart) Descriptor() ([]byte, []int) { - return fileDescriptorDescriptor, []int{17, 0} -} - -func (m *UninterpretedOption_NamePart) GetNamePart() string { - if m != nil && m.NamePart != nil { - return *m.NamePart - } - return "" -} - -func (m *UninterpretedOption_NamePart) GetIsExtension() bool { - if m != nil && m.IsExtension != nil { - return *m.IsExtension - } - return false -} - -// Encapsulates information about the original source file from which a -// FileDescriptorProto was generated. -type SourceCodeInfo struct { - // A Location identifies a piece of source code in a .proto file which - // corresponds to a particular definition. This information is intended - // to be useful to IDEs, code indexers, documentation generators, and similar - // tools. - // - // For example, say we have a file like: - // message Foo { - // optional string foo = 1; - // } - // Let's look at just the field definition: - // optional string foo = 1; - // ^ ^^ ^^ ^ ^^^ - // a bc de f ghi - // We have the following locations: - // span path represents - // [a,i) [ 4, 0, 2, 0 ] The whole field definition. - // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). - // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). - // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). - // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). - // - // Notes: - // - A location may refer to a repeated field itself (i.e. not to any - // particular index within it). This is used whenever a set of elements are - // logically enclosed in a single code segment. For example, an entire - // extend block (possibly containing multiple extension definitions) will - // have an outer location whose path refers to the "extensions" repeated - // field without an index. - // - Multiple locations may have the same path. This happens when a single - // logical declaration is spread out across multiple places. The most - // obvious example is the "extend" block again -- there may be multiple - // extend blocks in the same scope, each of which will have the same path. - // - A location's span is not always a subset of its parent's span. For - // example, the "extendee" of an extension declaration appears at the - // beginning of the "extend" block and is shared by all extensions within - // the block. - // - Just because a location's span is a subset of some other location's span - // does not mean that it is a descendent. For example, a "group" defines - // both a type and a field in a single declaration. Thus, the locations - // corresponding to the type and field and their components will overlap. - // - Code which tries to interpret locations should probably be designed to - // ignore those that it doesn't understand, as more types of locations could - // be recorded in the future. - Location []*SourceCodeInfo_Location `protobuf:"bytes,1,rep,name=location" json:"location,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *SourceCodeInfo) Reset() { *m = SourceCodeInfo{} } -func (m *SourceCodeInfo) String() string { return proto.CompactTextString(m) } -func (*SourceCodeInfo) ProtoMessage() {} -func (*SourceCodeInfo) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{18} } - -func (m *SourceCodeInfo) GetLocation() []*SourceCodeInfo_Location { - if m != nil { - return m.Location - } - return nil -} - -type SourceCodeInfo_Location struct { - // Identifies which part of the FileDescriptorProto was defined at this - // location. - // - // Each element is a field number or an index. They form a path from - // the root FileDescriptorProto to the place where the definition. For - // example, this path: - // [ 4, 3, 2, 7, 1 ] - // refers to: - // file.message_type(3) // 4, 3 - // .field(7) // 2, 7 - // .name() // 1 - // This is because FileDescriptorProto.message_type has field number 4: - // repeated DescriptorProto message_type = 4; - // and DescriptorProto.field has field number 2: - // repeated FieldDescriptorProto field = 2; - // and FieldDescriptorProto.name has field number 1: - // optional string name = 1; - // - // Thus, the above path gives the location of a field name. If we removed - // the last element: - // [ 4, 3, 2, 7 ] - // this path refers to the whole field declaration (from the beginning - // of the label to the terminating semicolon). - Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` - // Always has exactly three or four elements: start line, start column, - // end line (optional, otherwise assumed same as start line), end column. - // These are packed into a single field for efficiency. Note that line - // and column numbers are zero-based -- typically you will want to add - // 1 to each before displaying to a user. - Span []int32 `protobuf:"varint,2,rep,packed,name=span" json:"span,omitempty"` - // If this SourceCodeInfo represents a complete declaration, these are any - // comments appearing before and after the declaration which appear to be - // attached to the declaration. - // - // A series of line comments appearing on consecutive lines, with no other - // tokens appearing on those lines, will be treated as a single comment. - // - // leading_detached_comments will keep paragraphs of comments that appear - // before (but not connected to) the current element. Each paragraph, - // separated by empty lines, will be one comment element in the repeated - // field. - // - // Only the comment content is provided; comment markers (e.g. //) are - // stripped out. For block comments, leading whitespace and an asterisk - // will be stripped from the beginning of each line other than the first. - // Newlines are included in the output. - // - // Examples: - // - // optional int32 foo = 1; // Comment attached to foo. - // // Comment attached to bar. - // optional int32 bar = 2; - // - // optional string baz = 3; - // // Comment attached to baz. - // // Another line attached to baz. - // - // // Comment attached to qux. - // // - // // Another line attached to qux. - // optional double qux = 4; - // - // // Detached comment for corge. This is not leading or trailing comments - // // to qux or corge because there are blank lines separating it from - // // both. - // - // // Detached comment for corge paragraph 2. - // - // optional string corge = 5; - // /* Block comment attached - // * to corge. Leading asterisks - // * will be removed. */ - // /* Block comment attached to - // * grault. */ - // optional int32 grault = 6; - // - // // ignored detached comments. - LeadingComments *string `protobuf:"bytes,3,opt,name=leading_comments,json=leadingComments" json:"leading_comments,omitempty"` - TrailingComments *string `protobuf:"bytes,4,opt,name=trailing_comments,json=trailingComments" json:"trailing_comments,omitempty"` - LeadingDetachedComments []string `protobuf:"bytes,6,rep,name=leading_detached_comments,json=leadingDetachedComments" json:"leading_detached_comments,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *SourceCodeInfo_Location) Reset() { *m = SourceCodeInfo_Location{} } -func (m *SourceCodeInfo_Location) String() string { return proto.CompactTextString(m) } -func (*SourceCodeInfo_Location) ProtoMessage() {} -func (*SourceCodeInfo_Location) Descriptor() ([]byte, []int) { - return fileDescriptorDescriptor, []int{18, 0} -} - -func (m *SourceCodeInfo_Location) GetPath() []int32 { - if m != nil { - return m.Path - } - return nil -} - -func (m *SourceCodeInfo_Location) GetSpan() []int32 { - if m != nil { - return m.Span - } - return nil -} - -func (m *SourceCodeInfo_Location) GetLeadingComments() string { - if m != nil && m.LeadingComments != nil { - return *m.LeadingComments - } - return "" -} - -func (m *SourceCodeInfo_Location) GetTrailingComments() string { - if m != nil && m.TrailingComments != nil { - return *m.TrailingComments - } - return "" -} - -func (m *SourceCodeInfo_Location) GetLeadingDetachedComments() []string { - if m != nil { - return m.LeadingDetachedComments - } - return nil -} - -// Describes the relationship between generated code and its original source -// file. A GeneratedCodeInfo message is associated with only one generated -// source file, but may contain references to different source .proto files. -type GeneratedCodeInfo struct { - // An Annotation connects some span of text in generated code to an element - // of its generating .proto file. - Annotation []*GeneratedCodeInfo_Annotation `protobuf:"bytes,1,rep,name=annotation" json:"annotation,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GeneratedCodeInfo) Reset() { *m = GeneratedCodeInfo{} } -func (m *GeneratedCodeInfo) String() string { return proto.CompactTextString(m) } -func (*GeneratedCodeInfo) ProtoMessage() {} -func (*GeneratedCodeInfo) Descriptor() ([]byte, []int) { return fileDescriptorDescriptor, []int{19} } - -func (m *GeneratedCodeInfo) GetAnnotation() []*GeneratedCodeInfo_Annotation { - if m != nil { - return m.Annotation - } - return nil -} - -type GeneratedCodeInfo_Annotation struct { - // Identifies the element in the original source .proto file. This field - // is formatted the same as SourceCodeInfo.Location.path. - Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` - // Identifies the filesystem path to the original source .proto. - SourceFile *string `protobuf:"bytes,2,opt,name=source_file,json=sourceFile" json:"source_file,omitempty"` - // Identifies the starting offset in bytes in the generated code - // that relates to the identified object. - Begin *int32 `protobuf:"varint,3,opt,name=begin" json:"begin,omitempty"` - // Identifies the ending offset in bytes in the generated code that - // relates to the identified offset. The end offset should be one past - // the last relevant byte (so the length of the text = end - begin). - End *int32 `protobuf:"varint,4,opt,name=end" json:"end,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GeneratedCodeInfo_Annotation) Reset() { *m = GeneratedCodeInfo_Annotation{} } -func (m *GeneratedCodeInfo_Annotation) String() string { return proto.CompactTextString(m) } -func (*GeneratedCodeInfo_Annotation) ProtoMessage() {} -func (*GeneratedCodeInfo_Annotation) Descriptor() ([]byte, []int) { - return fileDescriptorDescriptor, []int{19, 0} -} - -func (m *GeneratedCodeInfo_Annotation) GetPath() []int32 { - if m != nil { - return m.Path - } - return nil -} - -func (m *GeneratedCodeInfo_Annotation) GetSourceFile() string { - if m != nil && m.SourceFile != nil { - return *m.SourceFile - } - return "" -} - -func (m *GeneratedCodeInfo_Annotation) GetBegin() int32 { - if m != nil && m.Begin != nil { - return *m.Begin - } - return 0 -} - -func (m *GeneratedCodeInfo_Annotation) GetEnd() int32 { - if m != nil && m.End != nil { - return *m.End - } - return 0 -} - -func init() { - proto.RegisterType((*FileDescriptorSet)(nil), "google.protobuf.FileDescriptorSet") - proto.RegisterType((*FileDescriptorProto)(nil), "google.protobuf.FileDescriptorProto") - proto.RegisterType((*DescriptorProto)(nil), "google.protobuf.DescriptorProto") - proto.RegisterType((*DescriptorProto_ExtensionRange)(nil), "google.protobuf.DescriptorProto.ExtensionRange") - proto.RegisterType((*DescriptorProto_ReservedRange)(nil), "google.protobuf.DescriptorProto.ReservedRange") - proto.RegisterType((*FieldDescriptorProto)(nil), "google.protobuf.FieldDescriptorProto") - proto.RegisterType((*OneofDescriptorProto)(nil), "google.protobuf.OneofDescriptorProto") - proto.RegisterType((*EnumDescriptorProto)(nil), "google.protobuf.EnumDescriptorProto") - proto.RegisterType((*EnumValueDescriptorProto)(nil), "google.protobuf.EnumValueDescriptorProto") - proto.RegisterType((*ServiceDescriptorProto)(nil), "google.protobuf.ServiceDescriptorProto") - proto.RegisterType((*MethodDescriptorProto)(nil), "google.protobuf.MethodDescriptorProto") - proto.RegisterType((*FileOptions)(nil), "google.protobuf.FileOptions") - proto.RegisterType((*MessageOptions)(nil), "google.protobuf.MessageOptions") - proto.RegisterType((*FieldOptions)(nil), "google.protobuf.FieldOptions") - proto.RegisterType((*OneofOptions)(nil), "google.protobuf.OneofOptions") - proto.RegisterType((*EnumOptions)(nil), "google.protobuf.EnumOptions") - proto.RegisterType((*EnumValueOptions)(nil), "google.protobuf.EnumValueOptions") - proto.RegisterType((*ServiceOptions)(nil), "google.protobuf.ServiceOptions") - proto.RegisterType((*MethodOptions)(nil), "google.protobuf.MethodOptions") - proto.RegisterType((*UninterpretedOption)(nil), "google.protobuf.UninterpretedOption") - proto.RegisterType((*UninterpretedOption_NamePart)(nil), "google.protobuf.UninterpretedOption.NamePart") - proto.RegisterType((*SourceCodeInfo)(nil), "google.protobuf.SourceCodeInfo") - proto.RegisterType((*SourceCodeInfo_Location)(nil), "google.protobuf.SourceCodeInfo.Location") - proto.RegisterType((*GeneratedCodeInfo)(nil), "google.protobuf.GeneratedCodeInfo") - proto.RegisterType((*GeneratedCodeInfo_Annotation)(nil), "google.protobuf.GeneratedCodeInfo.Annotation") - proto.RegisterEnum("google.protobuf.FieldDescriptorProto_Type", FieldDescriptorProto_Type_name, FieldDescriptorProto_Type_value) - proto.RegisterEnum("google.protobuf.FieldDescriptorProto_Label", FieldDescriptorProto_Label_name, FieldDescriptorProto_Label_value) - proto.RegisterEnum("google.protobuf.FileOptions_OptimizeMode", FileOptions_OptimizeMode_name, FileOptions_OptimizeMode_value) - proto.RegisterEnum("google.protobuf.FieldOptions_CType", FieldOptions_CType_name, FieldOptions_CType_value) - proto.RegisterEnum("google.protobuf.FieldOptions_JSType", FieldOptions_JSType_name, FieldOptions_JSType_value) -} - -func init() { proto.RegisterFile("descriptor.proto", fileDescriptorDescriptor) } - -var fileDescriptorDescriptor = []byte{ - // 2273 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xcc, 0x59, 0xcd, 0x6f, 0xdb, 0xc8, - 0x15, 0x5f, 0xea, 0xcb, 0xd2, 0x93, 0x2c, 0x8f, 0xc7, 0xde, 0x84, 0x71, 0x36, 0x1b, 0x47, 0x9b, - 0x34, 0x4e, 0xd2, 0x3a, 0x0b, 0xe7, 0x63, 0xb3, 0xde, 0x62, 0x0b, 0x59, 0x62, 0xbc, 0x0a, 0x64, - 0x4b, 0xa5, 0xec, 0x36, 0xbb, 0x3d, 0x10, 0x63, 0x72, 0x24, 0x33, 0xa1, 0x86, 0x2c, 0x49, 0x25, - 0xf1, 0x9e, 0x02, 0xf4, 0x54, 0xf4, 0x1f, 0x28, 0xda, 0xa2, 0x28, 0xf6, 0xb2, 0x40, 0xff, 0x80, - 0x1e, 0x7a, 0xef, 0xb5, 0x40, 0xef, 0x3d, 0x16, 0x68, 0xff, 0x83, 0x5e, 0x8b, 0x99, 0x21, 0x29, - 0xea, 0x6b, 0xe3, 0x2e, 0xb0, 0x1f, 0x27, 0x6b, 0x7e, 0xef, 0xf7, 0x1e, 0xdf, 0xbc, 0x79, 0x7c, - 0xef, 0x71, 0x0c, 0xc8, 0xa2, 0x81, 0xe9, 0xdb, 0x5e, 0xe8, 0xfa, 0xdb, 0x9e, 0xef, 0x86, 0x2e, - 0x5e, 0x19, 0xb8, 0xee, 0xc0, 0xa1, 0x72, 0x75, 0x32, 0xea, 0xd7, 0x0e, 0x60, 0xf5, 0xb1, 0xed, - 0xd0, 0x66, 0x42, 0xec, 0xd1, 0x10, 0x3f, 0x82, 0x5c, 0xdf, 0x76, 0xa8, 0xaa, 0x6c, 0x66, 0xb7, - 0xca, 0x3b, 0xd7, 0xb7, 0xa7, 0x94, 0xb6, 0x27, 0x35, 0xba, 0x1c, 0xd6, 0x85, 0x46, 0xed, 0x5f, - 0x39, 0x58, 0x9b, 0x23, 0xc5, 0x18, 0x72, 0x8c, 0x0c, 0xb9, 0x45, 0x65, 0xab, 0xa4, 0x8b, 0xdf, - 0x58, 0x85, 0x25, 0x8f, 0x98, 0xcf, 0xc9, 0x80, 0xaa, 0x19, 0x01, 0xc7, 0x4b, 0xfc, 0x2e, 0x80, - 0x45, 0x3d, 0xca, 0x2c, 0xca, 0xcc, 0x33, 0x35, 0xbb, 0x99, 0xdd, 0x2a, 0xe9, 0x29, 0x04, 0xdf, - 0x81, 0x55, 0x6f, 0x74, 0xe2, 0xd8, 0xa6, 0x91, 0xa2, 0xc1, 0x66, 0x76, 0x2b, 0xaf, 0x23, 0x29, - 0x68, 0x8e, 0xc9, 0x37, 0x61, 0xe5, 0x25, 0x25, 0xcf, 0xd3, 0xd4, 0xb2, 0xa0, 0x56, 0x39, 0x9c, - 0x22, 0x36, 0xa0, 0x32, 0xa4, 0x41, 0x40, 0x06, 0xd4, 0x08, 0xcf, 0x3c, 0xaa, 0xe6, 0xc4, 0xee, - 0x37, 0x67, 0x76, 0x3f, 0xbd, 0xf3, 0x72, 0xa4, 0x75, 0x74, 0xe6, 0x51, 0x5c, 0x87, 0x12, 0x65, - 0xa3, 0xa1, 0xb4, 0x90, 0x5f, 0x10, 0x3f, 0x8d, 0x8d, 0x86, 0xd3, 0x56, 0x8a, 0x5c, 0x2d, 0x32, - 0xb1, 0x14, 0x50, 0xff, 0x85, 0x6d, 0x52, 0xb5, 0x20, 0x0c, 0xdc, 0x9c, 0x31, 0xd0, 0x93, 0xf2, - 0x69, 0x1b, 0xb1, 0x1e, 0x6e, 0x40, 0x89, 0xbe, 0x0a, 0x29, 0x0b, 0x6c, 0x97, 0xa9, 0x4b, 0xc2, - 0xc8, 0x8d, 0x39, 0xa7, 0x48, 0x1d, 0x6b, 0xda, 0xc4, 0x58, 0x0f, 0x3f, 0x84, 0x25, 0xd7, 0x0b, - 0x6d, 0x97, 0x05, 0x6a, 0x71, 0x53, 0xd9, 0x2a, 0xef, 0xbc, 0x33, 0x37, 0x11, 0x3a, 0x92, 0xa3, - 0xc7, 0x64, 0xdc, 0x02, 0x14, 0xb8, 0x23, 0xdf, 0xa4, 0x86, 0xe9, 0x5a, 0xd4, 0xb0, 0x59, 0xdf, - 0x55, 0x4b, 0xc2, 0xc0, 0xd5, 0xd9, 0x8d, 0x08, 0x62, 0xc3, 0xb5, 0x68, 0x8b, 0xf5, 0x5d, 0xbd, - 0x1a, 0x4c, 0xac, 0xf1, 0x05, 0x28, 0x04, 0x67, 0x2c, 0x24, 0xaf, 0xd4, 0x8a, 0xc8, 0x90, 0x68, - 0x55, 0xfb, 0x6f, 0x1e, 0x56, 0xce, 0x93, 0x62, 0x1f, 0x41, 0xbe, 0xcf, 0x77, 0xa9, 0x66, 0xfe, - 0x9f, 0x18, 0x48, 0x9d, 0xc9, 0x20, 0x16, 0xbe, 0x66, 0x10, 0xeb, 0x50, 0x66, 0x34, 0x08, 0xa9, - 0x25, 0x33, 0x22, 0x7b, 0xce, 0x9c, 0x02, 0xa9, 0x34, 0x9b, 0x52, 0xb9, 0xaf, 0x95, 0x52, 0x4f, - 0x61, 0x25, 0x71, 0xc9, 0xf0, 0x09, 0x1b, 0xc4, 0xb9, 0x79, 0xf7, 0x4d, 0x9e, 0x6c, 0x6b, 0xb1, - 0x9e, 0xce, 0xd5, 0xf4, 0x2a, 0x9d, 0x58, 0xe3, 0x26, 0x80, 0xcb, 0xa8, 0xdb, 0x37, 0x2c, 0x6a, - 0x3a, 0x6a, 0x71, 0x41, 0x94, 0x3a, 0x9c, 0x32, 0x13, 0x25, 0x57, 0xa2, 0xa6, 0x83, 0x3f, 0x1c, - 0xa7, 0xda, 0xd2, 0x82, 0x4c, 0x39, 0x90, 0x2f, 0xd9, 0x4c, 0xb6, 0x1d, 0x43, 0xd5, 0xa7, 0x3c, - 0xef, 0xa9, 0x15, 0xed, 0xac, 0x24, 0x9c, 0xd8, 0x7e, 0xe3, 0xce, 0xf4, 0x48, 0x4d, 0x6e, 0x6c, - 0xd9, 0x4f, 0x2f, 0xf1, 0x7b, 0x90, 0x00, 0x86, 0x48, 0x2b, 0x10, 0x55, 0xa8, 0x12, 0x83, 0x87, - 0x64, 0x48, 0x37, 0x1e, 0x41, 0x75, 0x32, 0x3c, 0x78, 0x1d, 0xf2, 0x41, 0x48, 0xfc, 0x50, 0x64, - 0x61, 0x5e, 0x97, 0x0b, 0x8c, 0x20, 0x4b, 0x99, 0x25, 0xaa, 0x5c, 0x5e, 0xe7, 0x3f, 0x37, 0x3e, - 0x80, 0xe5, 0x89, 0xc7, 0x9f, 0x57, 0xb1, 0xf6, 0xdb, 0x02, 0xac, 0xcf, 0xcb, 0xb9, 0xb9, 0xe9, - 0x7f, 0x01, 0x0a, 0x6c, 0x34, 0x3c, 0xa1, 0xbe, 0x9a, 0x15, 0x16, 0xa2, 0x15, 0xae, 0x43, 0xde, - 0x21, 0x27, 0xd4, 0x51, 0x73, 0x9b, 0xca, 0x56, 0x75, 0xe7, 0xce, 0xb9, 0xb2, 0x7a, 0xbb, 0xcd, - 0x55, 0x74, 0xa9, 0x89, 0x3f, 0x86, 0x5c, 0x54, 0xe2, 0xb8, 0x85, 0xdb, 0xe7, 0xb3, 0xc0, 0x73, - 0x51, 0x17, 0x7a, 0xf8, 0x32, 0x94, 0xf8, 0x5f, 0x19, 0xdb, 0x82, 0xf0, 0xb9, 0xc8, 0x01, 0x1e, - 0x57, 0xbc, 0x01, 0x45, 0x91, 0x66, 0x16, 0x8d, 0x5b, 0x43, 0xb2, 0xe6, 0x07, 0x63, 0xd1, 0x3e, - 0x19, 0x39, 0xa1, 0xf1, 0x82, 0x38, 0x23, 0x2a, 0x12, 0xa6, 0xa4, 0x57, 0x22, 0xf0, 0x67, 0x1c, - 0xc3, 0x57, 0xa1, 0x2c, 0xb3, 0xd2, 0x66, 0x16, 0x7d, 0x25, 0xaa, 0x4f, 0x5e, 0x97, 0x89, 0xda, - 0xe2, 0x08, 0x7f, 0xfc, 0xb3, 0xc0, 0x65, 0xf1, 0xd1, 0x8a, 0x47, 0x70, 0x40, 0x3c, 0xfe, 0x83, - 0xe9, 0xc2, 0x77, 0x65, 0xfe, 0xf6, 0xa6, 0x73, 0xb1, 0xf6, 0x97, 0x0c, 0xe4, 0xc4, 0xfb, 0xb6, - 0x02, 0xe5, 0xa3, 0x4f, 0xbb, 0x9a, 0xd1, 0xec, 0x1c, 0xef, 0xb5, 0x35, 0xa4, 0xe0, 0x2a, 0x80, - 0x00, 0x1e, 0xb7, 0x3b, 0xf5, 0x23, 0x94, 0x49, 0xd6, 0xad, 0xc3, 0xa3, 0x87, 0xf7, 0x51, 0x36, - 0x51, 0x38, 0x96, 0x40, 0x2e, 0x4d, 0xb8, 0xb7, 0x83, 0xf2, 0x18, 0x41, 0x45, 0x1a, 0x68, 0x3d, - 0xd5, 0x9a, 0x0f, 0xef, 0xa3, 0xc2, 0x24, 0x72, 0x6f, 0x07, 0x2d, 0xe1, 0x65, 0x28, 0x09, 0x64, - 0xaf, 0xd3, 0x69, 0xa3, 0x62, 0x62, 0xb3, 0x77, 0xa4, 0xb7, 0x0e, 0xf7, 0x51, 0x29, 0xb1, 0xb9, - 0xaf, 0x77, 0x8e, 0xbb, 0x08, 0x12, 0x0b, 0x07, 0x5a, 0xaf, 0x57, 0xdf, 0xd7, 0x50, 0x39, 0x61, - 0xec, 0x7d, 0x7a, 0xa4, 0xf5, 0x50, 0x65, 0xc2, 0xad, 0x7b, 0x3b, 0x68, 0x39, 0x79, 0x84, 0x76, - 0x78, 0x7c, 0x80, 0xaa, 0x78, 0x15, 0x96, 0xe5, 0x23, 0x62, 0x27, 0x56, 0xa6, 0xa0, 0x87, 0xf7, - 0x11, 0x1a, 0x3b, 0x22, 0xad, 0xac, 0x4e, 0x00, 0x0f, 0xef, 0x23, 0x5c, 0x6b, 0x40, 0x5e, 0x64, - 0x17, 0xc6, 0x50, 0x6d, 0xd7, 0xf7, 0xb4, 0xb6, 0xd1, 0xe9, 0x1e, 0xb5, 0x3a, 0x87, 0xf5, 0x36, - 0x52, 0xc6, 0x98, 0xae, 0xfd, 0xf4, 0xb8, 0xa5, 0x6b, 0x4d, 0x94, 0x49, 0x63, 0x5d, 0xad, 0x7e, - 0xa4, 0x35, 0x51, 0xb6, 0x66, 0xc2, 0xfa, 0xbc, 0x3a, 0x33, 0xf7, 0xcd, 0x48, 0x1d, 0x71, 0x66, - 0xc1, 0x11, 0x0b, 0x5b, 0x33, 0x47, 0xfc, 0x85, 0x02, 0x6b, 0x73, 0x6a, 0xed, 0xdc, 0x87, 0xfc, - 0x04, 0xf2, 0x32, 0x45, 0x65, 0xf7, 0xb9, 0x35, 0xb7, 0x68, 0x8b, 0x84, 0x9d, 0xe9, 0x40, 0x42, - 0x2f, 0xdd, 0x81, 0xb3, 0x0b, 0x3a, 0x30, 0x37, 0x31, 0xe3, 0xe4, 0xaf, 0x14, 0x50, 0x17, 0xd9, - 0x7e, 0x43, 0xa1, 0xc8, 0x4c, 0x14, 0x8a, 0x8f, 0xa6, 0x1d, 0xb8, 0xb6, 0x78, 0x0f, 0x33, 0x5e, - 0x7c, 0xa9, 0xc0, 0x85, 0xf9, 0x83, 0xca, 0x5c, 0x1f, 0x3e, 0x86, 0xc2, 0x90, 0x86, 0xa7, 0x6e, - 0xdc, 0xac, 0x7f, 0x30, 0xa7, 0x05, 0x70, 0xf1, 0x74, 0xac, 0x22, 0xad, 0x74, 0x0f, 0xc9, 0x2e, - 0x9a, 0x36, 0xa4, 0x37, 0x33, 0x9e, 0xfe, 0x3a, 0x03, 0x6f, 0xcf, 0x35, 0x3e, 0xd7, 0xd1, 0x2b, - 0x00, 0x36, 0xf3, 0x46, 0xa1, 0x6c, 0xc8, 0xb2, 0x3e, 0x95, 0x04, 0x22, 0xde, 0x7d, 0x5e, 0x7b, - 0x46, 0x61, 0x22, 0xcf, 0x0a, 0x39, 0x48, 0x48, 0x10, 0x1e, 0x8d, 0x1d, 0xcd, 0x09, 0x47, 0xdf, - 0x5d, 0xb0, 0xd3, 0x99, 0x5e, 0xf7, 0x3e, 0x20, 0xd3, 0xb1, 0x29, 0x0b, 0x8d, 0x20, 0xf4, 0x29, - 0x19, 0xda, 0x6c, 0x20, 0x0a, 0x70, 0x71, 0x37, 0xdf, 0x27, 0x4e, 0x40, 0xf5, 0x15, 0x29, 0xee, - 0xc5, 0x52, 0xae, 0x21, 0xba, 0x8c, 0x9f, 0xd2, 0x28, 0x4c, 0x68, 0x48, 0x71, 0xa2, 0x51, 0xfb, - 0xcd, 0x12, 0x94, 0x53, 0x63, 0x1d, 0xbe, 0x06, 0x95, 0x67, 0xe4, 0x05, 0x31, 0xe2, 0x51, 0x5d, - 0x46, 0xa2, 0xcc, 0xb1, 0x6e, 0x34, 0xae, 0xbf, 0x0f, 0xeb, 0x82, 0xe2, 0x8e, 0x42, 0xea, 0x1b, - 0xa6, 0x43, 0x82, 0x40, 0x04, 0xad, 0x28, 0xa8, 0x98, 0xcb, 0x3a, 0x5c, 0xd4, 0x88, 0x25, 0xf8, - 0x01, 0xac, 0x09, 0x8d, 0xe1, 0xc8, 0x09, 0x6d, 0xcf, 0xa1, 0x06, 0xff, 0x78, 0x08, 0x44, 0x21, - 0x4e, 0x3c, 0x5b, 0xe5, 0x8c, 0x83, 0x88, 0xc0, 0x3d, 0x0a, 0xf0, 0x3e, 0x5c, 0x11, 0x6a, 0x03, - 0xca, 0xa8, 0x4f, 0x42, 0x6a, 0xd0, 0x5f, 0x8e, 0x88, 0x13, 0x18, 0x84, 0x59, 0xc6, 0x29, 0x09, - 0x4e, 0xd5, 0xf5, 0xb4, 0x81, 0x4b, 0x9c, 0xbb, 0x1f, 0x51, 0x35, 0xc1, 0xac, 0x33, 0xeb, 0x13, - 0x12, 0x9c, 0xe2, 0x5d, 0xb8, 0x20, 0x0c, 0x05, 0xa1, 0x6f, 0xb3, 0x81, 0x61, 0x9e, 0x52, 0xf3, - 0xb9, 0x31, 0x0a, 0xfb, 0x8f, 0xd4, 0xcb, 0x69, 0x0b, 0xc2, 0xc9, 0x9e, 0xe0, 0x34, 0x38, 0xe5, - 0x38, 0xec, 0x3f, 0xc2, 0x3d, 0xa8, 0xf0, 0xf3, 0x18, 0xda, 0x9f, 0x53, 0xa3, 0xef, 0xfa, 0xa2, - 0xb9, 0x54, 0xe7, 0xbc, 0xdc, 0xa9, 0x20, 0x6e, 0x77, 0x22, 0x85, 0x03, 0xd7, 0xa2, 0xbb, 0xf9, - 0x5e, 0x57, 0xd3, 0x9a, 0x7a, 0x39, 0xb6, 0xf2, 0xd8, 0xf5, 0x79, 0x4e, 0x0d, 0xdc, 0x24, 0xc6, - 0x65, 0x99, 0x53, 0x03, 0x37, 0x8e, 0xf0, 0x03, 0x58, 0x33, 0x4d, 0xb9, 0x6d, 0xdb, 0x34, 0xa2, - 0x29, 0x3f, 0x50, 0xd1, 0x44, 0xbc, 0x4c, 0x73, 0x5f, 0x12, 0xa2, 0x34, 0x0f, 0xf0, 0x87, 0xf0, - 0xf6, 0x38, 0x5e, 0x69, 0xc5, 0xd5, 0x99, 0x5d, 0x4e, 0xab, 0x3e, 0x80, 0x35, 0xef, 0x6c, 0x56, - 0x11, 0x4f, 0x3c, 0xd1, 0x3b, 0x9b, 0x56, 0xbb, 0x21, 0xbe, 0xdc, 0x7c, 0x6a, 0x92, 0x90, 0x5a, - 0xea, 0xc5, 0x34, 0x3b, 0x25, 0xc0, 0x77, 0x01, 0x99, 0xa6, 0x41, 0x19, 0x39, 0x71, 0xa8, 0x41, - 0x7c, 0xca, 0x48, 0xa0, 0x5e, 0x4d, 0x93, 0xab, 0xa6, 0xa9, 0x09, 0x69, 0x5d, 0x08, 0xf1, 0x6d, - 0x58, 0x75, 0x4f, 0x9e, 0x99, 0x32, 0xb9, 0x0c, 0xcf, 0xa7, 0x7d, 0xfb, 0x95, 0x7a, 0x5d, 0x84, - 0x69, 0x85, 0x0b, 0x44, 0x6a, 0x75, 0x05, 0x8c, 0x6f, 0x01, 0x32, 0x83, 0x53, 0xe2, 0x7b, 0xa2, - 0xbb, 0x07, 0x1e, 0x31, 0xa9, 0x7a, 0x43, 0x52, 0x25, 0x7e, 0x18, 0xc3, 0xf8, 0x29, 0xac, 0x8f, - 0x98, 0xcd, 0x42, 0xea, 0x7b, 0x3e, 0xe5, 0x43, 0xba, 0x7c, 0xd3, 0xd4, 0x7f, 0x2f, 0x2d, 0x18, - 0xb3, 0x8f, 0xd3, 0x6c, 0x79, 0xba, 0xfa, 0xda, 0x68, 0x16, 0xac, 0xed, 0x42, 0x25, 0x7d, 0xe8, - 0xb8, 0x04, 0xf2, 0xd8, 0x91, 0xc2, 0x7b, 0x68, 0xa3, 0xd3, 0xe4, 0xdd, 0xef, 0x33, 0x0d, 0x65, - 0x78, 0x17, 0x6e, 0xb7, 0x8e, 0x34, 0x43, 0x3f, 0x3e, 0x3c, 0x6a, 0x1d, 0x68, 0x28, 0x7b, 0xbb, - 0x54, 0xfc, 0xcf, 0x12, 0x7a, 0xfd, 0xfa, 0xf5, 0xeb, 0x4c, 0xed, 0x6f, 0x19, 0xa8, 0x4e, 0x4e, - 0xbe, 0xf8, 0xc7, 0x70, 0x31, 0xfe, 0x4c, 0x0d, 0x68, 0x68, 0xbc, 0xb4, 0x7d, 0x91, 0x87, 0x43, - 0x22, 0x67, 0xc7, 0x24, 0x84, 0xeb, 0x11, 0xab, 0x47, 0xc3, 0x9f, 0xdb, 0x3e, 0xcf, 0xb2, 0x21, - 0x09, 0x71, 0x1b, 0xae, 0x32, 0xd7, 0x08, 0x42, 0xc2, 0x2c, 0xe2, 0x5b, 0xc6, 0xf8, 0x82, 0xc0, - 0x20, 0xa6, 0x49, 0x83, 0xc0, 0x95, 0x2d, 0x20, 0xb1, 0xf2, 0x0e, 0x73, 0x7b, 0x11, 0x79, 0x5c, - 0x1b, 0xeb, 0x11, 0x75, 0xea, 0xb8, 0xb3, 0x8b, 0x8e, 0xfb, 0x32, 0x94, 0x86, 0xc4, 0x33, 0x28, - 0x0b, 0xfd, 0x33, 0x31, 0xaf, 0x15, 0xf5, 0xe2, 0x90, 0x78, 0x1a, 0x5f, 0x7f, 0x73, 0x67, 0x90, - 0x8e, 0xe3, 0x3f, 0xb3, 0x50, 0x49, 0xcf, 0x6c, 0x7c, 0x04, 0x36, 0x45, 0x7d, 0x56, 0xc4, 0xeb, - 0xfb, 0xde, 0x57, 0x4e, 0x78, 0xdb, 0x0d, 0x5e, 0xb8, 0x77, 0x0b, 0x72, 0x92, 0xd2, 0xa5, 0x26, - 0x6f, 0x9a, 0xfc, 0x85, 0xa5, 0x72, 0x3e, 0x2f, 0xea, 0xd1, 0x0a, 0xef, 0x43, 0xe1, 0x59, 0x20, - 0x6c, 0x17, 0x84, 0xed, 0xeb, 0x5f, 0x6d, 0xfb, 0x49, 0x4f, 0x18, 0x2f, 0x3d, 0xe9, 0x19, 0x87, - 0x1d, 0xfd, 0xa0, 0xde, 0xd6, 0x23, 0x75, 0x7c, 0x09, 0x72, 0x0e, 0xf9, 0xfc, 0x6c, 0xb2, 0xc4, - 0x0b, 0xe8, 0xbc, 0x81, 0xbf, 0x04, 0xb9, 0x97, 0x94, 0x3c, 0x9f, 0x2c, 0xac, 0x02, 0xfa, 0x06, - 0x53, 0xff, 0x2e, 0xe4, 0x45, 0xbc, 0x30, 0x40, 0x14, 0x31, 0xf4, 0x16, 0x2e, 0x42, 0xae, 0xd1, - 0xd1, 0x79, 0xfa, 0x23, 0xa8, 0x48, 0xd4, 0xe8, 0xb6, 0xb4, 0x86, 0x86, 0x32, 0xb5, 0x07, 0x50, - 0x90, 0x41, 0xe0, 0xaf, 0x46, 0x12, 0x06, 0xf4, 0x56, 0xb4, 0x8c, 0x6c, 0x28, 0xb1, 0xf4, 0xf8, - 0x60, 0x4f, 0xd3, 0x51, 0x26, 0x7d, 0xbc, 0x01, 0x54, 0xd2, 0xe3, 0xda, 0xb7, 0x93, 0x53, 0x7f, - 0x55, 0xa0, 0x9c, 0x1a, 0xbf, 0x78, 0xe3, 0x27, 0x8e, 0xe3, 0xbe, 0x34, 0x88, 0x63, 0x93, 0x20, - 0x4a, 0x0a, 0x10, 0x50, 0x9d, 0x23, 0xe7, 0x3d, 0xb4, 0x6f, 0xc5, 0xf9, 0x3f, 0x2a, 0x80, 0xa6, - 0x47, 0xb7, 0x29, 0x07, 0x95, 0xef, 0xd4, 0xc1, 0x3f, 0x28, 0x50, 0x9d, 0x9c, 0xd7, 0xa6, 0xdc, - 0xbb, 0xf6, 0x9d, 0xba, 0xf7, 0x7b, 0x05, 0x96, 0x27, 0xa6, 0xb4, 0xef, 0x95, 0x77, 0xbf, 0xcb, - 0xc2, 0xda, 0x1c, 0x3d, 0x5c, 0x8f, 0xc6, 0x59, 0x39, 0x61, 0xff, 0xe8, 0x3c, 0xcf, 0xda, 0xe6, - 0xdd, 0xb2, 0x4b, 0xfc, 0x30, 0x9a, 0x7e, 0x6f, 0x01, 0xb2, 0x2d, 0xca, 0x42, 0xbb, 0x6f, 0x53, - 0x3f, 0xfa, 0x04, 0x97, 0x33, 0xee, 0xca, 0x18, 0x97, 0x5f, 0xe1, 0x3f, 0x04, 0xec, 0xb9, 0x81, - 0x1d, 0xda, 0x2f, 0xa8, 0x61, 0xb3, 0xf8, 0x7b, 0x9d, 0xcf, 0xbc, 0x39, 0x1d, 0xc5, 0x92, 0x16, - 0x0b, 0x13, 0x36, 0xa3, 0x03, 0x32, 0xc5, 0xe6, 0xb5, 0x2f, 0xab, 0xa3, 0x58, 0x92, 0xb0, 0xaf, - 0x41, 0xc5, 0x72, 0x47, 0x7c, 0x7c, 0x90, 0x3c, 0x5e, 0x6a, 0x15, 0xbd, 0x2c, 0xb1, 0x84, 0x12, - 0xcd, 0x77, 0xe3, 0x8b, 0x82, 0x8a, 0x5e, 0x96, 0x98, 0xa4, 0xdc, 0x84, 0x15, 0x32, 0x18, 0xf8, - 0xdc, 0x78, 0x6c, 0x48, 0x0e, 0xad, 0xd5, 0x04, 0x16, 0xc4, 0x8d, 0x27, 0x50, 0x8c, 0xe3, 0xc0, - 0xbb, 0x19, 0x8f, 0x84, 0xe1, 0xc9, 0xeb, 0x9a, 0xcc, 0x56, 0x49, 0x2f, 0xb2, 0x58, 0x78, 0x0d, - 0x2a, 0x76, 0x60, 0x8c, 0xef, 0x0d, 0x33, 0x9b, 0x99, 0xad, 0xa2, 0x5e, 0xb6, 0x83, 0xe4, 0xa2, - 0xa8, 0xf6, 0x65, 0x06, 0xaa, 0x93, 0xf7, 0x9e, 0xb8, 0x09, 0x45, 0xc7, 0x35, 0x89, 0x48, 0x04, - 0x79, 0xe9, 0xbe, 0xf5, 0x86, 0xab, 0xd2, 0xed, 0x76, 0xc4, 0xd7, 0x13, 0xcd, 0x8d, 0xbf, 0x2b, - 0x50, 0x8c, 0x61, 0x7c, 0x01, 0x72, 0x1e, 0x09, 0x4f, 0x85, 0xb9, 0xfc, 0x5e, 0x06, 0x29, 0xba, - 0x58, 0x73, 0x3c, 0xf0, 0x08, 0x13, 0x29, 0x10, 0xe1, 0x7c, 0xcd, 0xcf, 0xd5, 0xa1, 0xc4, 0x12, - 0xe3, 0xb0, 0x3b, 0x1c, 0x52, 0x16, 0x06, 0xf1, 0xb9, 0x46, 0x78, 0x23, 0x82, 0xf1, 0x1d, 0x58, - 0x0d, 0x7d, 0x62, 0x3b, 0x13, 0xdc, 0x9c, 0xe0, 0xa2, 0x58, 0x90, 0x90, 0x77, 0xe1, 0x52, 0x6c, - 0xd7, 0xa2, 0x21, 0x31, 0x4f, 0xa9, 0x35, 0x56, 0x2a, 0x88, 0x4b, 0xb5, 0x8b, 0x11, 0xa1, 0x19, - 0xc9, 0x63, 0xdd, 0xda, 0x3f, 0x14, 0x58, 0x8d, 0x07, 0x78, 0x2b, 0x09, 0xd6, 0x01, 0x00, 0x61, - 0xcc, 0x0d, 0xd3, 0xe1, 0x9a, 0x4d, 0xe5, 0x19, 0xbd, 0xed, 0x7a, 0xa2, 0xa4, 0xa7, 0x0c, 0x6c, - 0x0c, 0x01, 0xc6, 0x92, 0x85, 0x61, 0xbb, 0x0a, 0xe5, 0xe8, 0x52, 0x5b, 0xfc, 0x67, 0x44, 0x7e, - 0xf5, 0x81, 0x84, 0xf8, 0xa4, 0x8f, 0xd7, 0x21, 0x7f, 0x42, 0x07, 0x36, 0x8b, 0xae, 0xda, 0xe4, - 0x22, 0xbe, 0xc0, 0xcb, 0x25, 0x17, 0x78, 0x7b, 0xbf, 0x80, 0x35, 0xd3, 0x1d, 0x4e, 0xbb, 0xbb, - 0x87, 0xa6, 0xbe, 0x3c, 0x83, 0x4f, 0x94, 0xcf, 0x60, 0x3c, 0x9d, 0xfd, 0x49, 0x51, 0xbe, 0xc8, - 0x64, 0xf7, 0xbb, 0x7b, 0x7f, 0xce, 0x6c, 0xec, 0x4b, 0xd5, 0x6e, 0xbc, 0x53, 0x9d, 0xf6, 0x1d, - 0x6a, 0x72, 0xef, 0xff, 0x17, 0x00, 0x00, 0xff, 0xff, 0xd0, 0xf2, 0xf3, 0xa9, 0xf1, 0x19, 0x00, - 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go deleted file mode 100644 index 785d6f9fe88..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/descriptor_gostring.gen.go +++ /dev/null @@ -1,715 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: descriptor.proto -// DO NOT EDIT! - -/* -Package descriptor is a generated protocol buffer package. - -It is generated from these files: - descriptor.proto - -It has these top-level messages: - FileDescriptorSet - FileDescriptorProto - DescriptorProto - FieldDescriptorProto - OneofDescriptorProto - EnumDescriptorProto - EnumValueDescriptorProto - ServiceDescriptorProto - MethodDescriptorProto - FileOptions - MessageOptions - FieldOptions - OneofOptions - EnumOptions - EnumValueOptions - ServiceOptions - MethodOptions - UninterpretedOption - SourceCodeInfo - GeneratedCodeInfo -*/ -package descriptor - -import fmt "fmt" -import strings "strings" -import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" -import sort "sort" -import strconv "strconv" -import reflect "reflect" -import proto "github.com/gogo/protobuf/proto" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -func (this *FileDescriptorSet) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&descriptor.FileDescriptorSet{") - if this.File != nil { - s = append(s, "File: "+fmt.Sprintf("%#v", this.File)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *FileDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 16) - s = append(s, "&descriptor.FileDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Package != nil { - s = append(s, "Package: "+valueToGoStringDescriptor(this.Package, "string")+",\n") - } - if this.Dependency != nil { - s = append(s, "Dependency: "+fmt.Sprintf("%#v", this.Dependency)+",\n") - } - if this.PublicDependency != nil { - s = append(s, "PublicDependency: "+fmt.Sprintf("%#v", this.PublicDependency)+",\n") - } - if this.WeakDependency != nil { - s = append(s, "WeakDependency: "+fmt.Sprintf("%#v", this.WeakDependency)+",\n") - } - if this.MessageType != nil { - s = append(s, "MessageType: "+fmt.Sprintf("%#v", this.MessageType)+",\n") - } - if this.EnumType != nil { - s = append(s, "EnumType: "+fmt.Sprintf("%#v", this.EnumType)+",\n") - } - if this.Service != nil { - s = append(s, "Service: "+fmt.Sprintf("%#v", this.Service)+",\n") - } - if this.Extension != nil { - s = append(s, "Extension: "+fmt.Sprintf("%#v", this.Extension)+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.SourceCodeInfo != nil { - s = append(s, "SourceCodeInfo: "+fmt.Sprintf("%#v", this.SourceCodeInfo)+",\n") - } - if this.Syntax != nil { - s = append(s, "Syntax: "+valueToGoStringDescriptor(this.Syntax, "string")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *DescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 14) - s = append(s, "&descriptor.DescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Field != nil { - s = append(s, "Field: "+fmt.Sprintf("%#v", this.Field)+",\n") - } - if this.Extension != nil { - s = append(s, "Extension: "+fmt.Sprintf("%#v", this.Extension)+",\n") - } - if this.NestedType != nil { - s = append(s, "NestedType: "+fmt.Sprintf("%#v", this.NestedType)+",\n") - } - if this.EnumType != nil { - s = append(s, "EnumType: "+fmt.Sprintf("%#v", this.EnumType)+",\n") - } - if this.ExtensionRange != nil { - s = append(s, "ExtensionRange: "+fmt.Sprintf("%#v", this.ExtensionRange)+",\n") - } - if this.OneofDecl != nil { - s = append(s, "OneofDecl: "+fmt.Sprintf("%#v", this.OneofDecl)+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.ReservedRange != nil { - s = append(s, "ReservedRange: "+fmt.Sprintf("%#v", this.ReservedRange)+",\n") - } - if this.ReservedName != nil { - s = append(s, "ReservedName: "+fmt.Sprintf("%#v", this.ReservedName)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *DescriptorProto_ExtensionRange) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.DescriptorProto_ExtensionRange{") - if this.Start != nil { - s = append(s, "Start: "+valueToGoStringDescriptor(this.Start, "int32")+",\n") - } - if this.End != nil { - s = append(s, "End: "+valueToGoStringDescriptor(this.End, "int32")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *DescriptorProto_ReservedRange) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.DescriptorProto_ReservedRange{") - if this.Start != nil { - s = append(s, "Start: "+valueToGoStringDescriptor(this.Start, "int32")+",\n") - } - if this.End != nil { - s = append(s, "End: "+valueToGoStringDescriptor(this.End, "int32")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *FieldDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 14) - s = append(s, "&descriptor.FieldDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Number != nil { - s = append(s, "Number: "+valueToGoStringDescriptor(this.Number, "int32")+",\n") - } - if this.Label != nil { - s = append(s, "Label: "+valueToGoStringDescriptor(this.Label, "descriptor.FieldDescriptorProto_Label")+",\n") - } - if this.Type != nil { - s = append(s, "Type: "+valueToGoStringDescriptor(this.Type, "descriptor.FieldDescriptorProto_Type")+",\n") - } - if this.TypeName != nil { - s = append(s, "TypeName: "+valueToGoStringDescriptor(this.TypeName, "string")+",\n") - } - if this.Extendee != nil { - s = append(s, "Extendee: "+valueToGoStringDescriptor(this.Extendee, "string")+",\n") - } - if this.DefaultValue != nil { - s = append(s, "DefaultValue: "+valueToGoStringDescriptor(this.DefaultValue, "string")+",\n") - } - if this.OneofIndex != nil { - s = append(s, "OneofIndex: "+valueToGoStringDescriptor(this.OneofIndex, "int32")+",\n") - } - if this.JsonName != nil { - s = append(s, "JsonName: "+valueToGoStringDescriptor(this.JsonName, "string")+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *OneofDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.OneofDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *EnumDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&descriptor.EnumDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Value != nil { - s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *EnumValueDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&descriptor.EnumValueDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Number != nil { - s = append(s, "Number: "+valueToGoStringDescriptor(this.Number, "int32")+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *ServiceDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&descriptor.ServiceDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.Method != nil { - s = append(s, "Method: "+fmt.Sprintf("%#v", this.Method)+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *MethodDescriptorProto) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 10) - s = append(s, "&descriptor.MethodDescriptorProto{") - if this.Name != nil { - s = append(s, "Name: "+valueToGoStringDescriptor(this.Name, "string")+",\n") - } - if this.InputType != nil { - s = append(s, "InputType: "+valueToGoStringDescriptor(this.InputType, "string")+",\n") - } - if this.OutputType != nil { - s = append(s, "OutputType: "+valueToGoStringDescriptor(this.OutputType, "string")+",\n") - } - if this.Options != nil { - s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") - } - if this.ClientStreaming != nil { - s = append(s, "ClientStreaming: "+valueToGoStringDescriptor(this.ClientStreaming, "bool")+",\n") - } - if this.ServerStreaming != nil { - s = append(s, "ServerStreaming: "+valueToGoStringDescriptor(this.ServerStreaming, "bool")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *FileOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 19) - s = append(s, "&descriptor.FileOptions{") - if this.JavaPackage != nil { - s = append(s, "JavaPackage: "+valueToGoStringDescriptor(this.JavaPackage, "string")+",\n") - } - if this.JavaOuterClassname != nil { - s = append(s, "JavaOuterClassname: "+valueToGoStringDescriptor(this.JavaOuterClassname, "string")+",\n") - } - if this.JavaMultipleFiles != nil { - s = append(s, "JavaMultipleFiles: "+valueToGoStringDescriptor(this.JavaMultipleFiles, "bool")+",\n") - } - if this.JavaGenerateEqualsAndHash != nil { - s = append(s, "JavaGenerateEqualsAndHash: "+valueToGoStringDescriptor(this.JavaGenerateEqualsAndHash, "bool")+",\n") - } - if this.JavaStringCheckUtf8 != nil { - s = append(s, "JavaStringCheckUtf8: "+valueToGoStringDescriptor(this.JavaStringCheckUtf8, "bool")+",\n") - } - if this.OptimizeFor != nil { - s = append(s, "OptimizeFor: "+valueToGoStringDescriptor(this.OptimizeFor, "descriptor.FileOptions_OptimizeMode")+",\n") - } - if this.GoPackage != nil { - s = append(s, "GoPackage: "+valueToGoStringDescriptor(this.GoPackage, "string")+",\n") - } - if this.CcGenericServices != nil { - s = append(s, "CcGenericServices: "+valueToGoStringDescriptor(this.CcGenericServices, "bool")+",\n") - } - if this.JavaGenericServices != nil { - s = append(s, "JavaGenericServices: "+valueToGoStringDescriptor(this.JavaGenericServices, "bool")+",\n") - } - if this.PyGenericServices != nil { - s = append(s, "PyGenericServices: "+valueToGoStringDescriptor(this.PyGenericServices, "bool")+",\n") - } - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.CcEnableArenas != nil { - s = append(s, "CcEnableArenas: "+valueToGoStringDescriptor(this.CcEnableArenas, "bool")+",\n") - } - if this.ObjcClassPrefix != nil { - s = append(s, "ObjcClassPrefix: "+valueToGoStringDescriptor(this.ObjcClassPrefix, "string")+",\n") - } - if this.CsharpNamespace != nil { - s = append(s, "CsharpNamespace: "+valueToGoStringDescriptor(this.CsharpNamespace, "string")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *MessageOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 9) - s = append(s, "&descriptor.MessageOptions{") - if this.MessageSetWireFormat != nil { - s = append(s, "MessageSetWireFormat: "+valueToGoStringDescriptor(this.MessageSetWireFormat, "bool")+",\n") - } - if this.NoStandardDescriptorAccessor != nil { - s = append(s, "NoStandardDescriptorAccessor: "+valueToGoStringDescriptor(this.NoStandardDescriptorAccessor, "bool")+",\n") - } - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.MapEntry != nil { - s = append(s, "MapEntry: "+valueToGoStringDescriptor(this.MapEntry, "bool")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *FieldOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 11) - s = append(s, "&descriptor.FieldOptions{") - if this.Ctype != nil { - s = append(s, "Ctype: "+valueToGoStringDescriptor(this.Ctype, "descriptor.FieldOptions_CType")+",\n") - } - if this.Packed != nil { - s = append(s, "Packed: "+valueToGoStringDescriptor(this.Packed, "bool")+",\n") - } - if this.Jstype != nil { - s = append(s, "Jstype: "+valueToGoStringDescriptor(this.Jstype, "descriptor.FieldOptions_JSType")+",\n") - } - if this.Lazy != nil { - s = append(s, "Lazy: "+valueToGoStringDescriptor(this.Lazy, "bool")+",\n") - } - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.Weak != nil { - s = append(s, "Weak: "+valueToGoStringDescriptor(this.Weak, "bool")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *OneofOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&descriptor.OneofOptions{") - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *EnumOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&descriptor.EnumOptions{") - if this.AllowAlias != nil { - s = append(s, "AllowAlias: "+valueToGoStringDescriptor(this.AllowAlias, "bool")+",\n") - } - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *EnumValueOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.EnumValueOptions{") - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *ServiceOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.ServiceOptions{") - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *MethodOptions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.MethodOptions{") - if this.Deprecated != nil { - s = append(s, "Deprecated: "+valueToGoStringDescriptor(this.Deprecated, "bool")+",\n") - } - if this.UninterpretedOption != nil { - s = append(s, "UninterpretedOption: "+fmt.Sprintf("%#v", this.UninterpretedOption)+",\n") - } - s = append(s, "XXX_InternalExtensions: "+extensionToGoStringDescriptor(this)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *UninterpretedOption) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 11) - s = append(s, "&descriptor.UninterpretedOption{") - if this.Name != nil { - s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") - } - if this.IdentifierValue != nil { - s = append(s, "IdentifierValue: "+valueToGoStringDescriptor(this.IdentifierValue, "string")+",\n") - } - if this.PositiveIntValue != nil { - s = append(s, "PositiveIntValue: "+valueToGoStringDescriptor(this.PositiveIntValue, "uint64")+",\n") - } - if this.NegativeIntValue != nil { - s = append(s, "NegativeIntValue: "+valueToGoStringDescriptor(this.NegativeIntValue, "int64")+",\n") - } - if this.DoubleValue != nil { - s = append(s, "DoubleValue: "+valueToGoStringDescriptor(this.DoubleValue, "float64")+",\n") - } - if this.StringValue != nil { - s = append(s, "StringValue: "+valueToGoStringDescriptor(this.StringValue, "byte")+",\n") - } - if this.AggregateValue != nil { - s = append(s, "AggregateValue: "+valueToGoStringDescriptor(this.AggregateValue, "string")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *UninterpretedOption_NamePart) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&descriptor.UninterpretedOption_NamePart{") - if this.NamePart != nil { - s = append(s, "NamePart: "+valueToGoStringDescriptor(this.NamePart, "string")+",\n") - } - if this.IsExtension != nil { - s = append(s, "IsExtension: "+valueToGoStringDescriptor(this.IsExtension, "bool")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *SourceCodeInfo) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&descriptor.SourceCodeInfo{") - if this.Location != nil { - s = append(s, "Location: "+fmt.Sprintf("%#v", this.Location)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *SourceCodeInfo_Location) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 9) - s = append(s, "&descriptor.SourceCodeInfo_Location{") - if this.Path != nil { - s = append(s, "Path: "+fmt.Sprintf("%#v", this.Path)+",\n") - } - if this.Span != nil { - s = append(s, "Span: "+fmt.Sprintf("%#v", this.Span)+",\n") - } - if this.LeadingComments != nil { - s = append(s, "LeadingComments: "+valueToGoStringDescriptor(this.LeadingComments, "string")+",\n") - } - if this.TrailingComments != nil { - s = append(s, "TrailingComments: "+valueToGoStringDescriptor(this.TrailingComments, "string")+",\n") - } - if this.LeadingDetachedComments != nil { - s = append(s, "LeadingDetachedComments: "+fmt.Sprintf("%#v", this.LeadingDetachedComments)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *GeneratedCodeInfo) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&descriptor.GeneratedCodeInfo{") - if this.Annotation != nil { - s = append(s, "Annotation: "+fmt.Sprintf("%#v", this.Annotation)+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *GeneratedCodeInfo_Annotation) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 8) - s = append(s, "&descriptor.GeneratedCodeInfo_Annotation{") - if this.Path != nil { - s = append(s, "Path: "+fmt.Sprintf("%#v", this.Path)+",\n") - } - if this.SourceFile != nil { - s = append(s, "SourceFile: "+valueToGoStringDescriptor(this.SourceFile, "string")+",\n") - } - if this.Begin != nil { - s = append(s, "Begin: "+valueToGoStringDescriptor(this.Begin, "int32")+",\n") - } - if this.End != nil { - s = append(s, "End: "+valueToGoStringDescriptor(this.End, "int32")+",\n") - } - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringDescriptor(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func extensionToGoStringDescriptor(m github_com_gogo_protobuf_proto.Message) string { - e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) - if e == nil { - return "nil" - } - s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" - keys := make([]int, 0, len(e)) - for k := range e { - keys = append(keys, int(k)) - } - sort.Ints(keys) - ss := []string{} - for _, k := range keys { - ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) - } - s += strings.Join(ss, ",") + "})" - return s -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/helper.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/helper.go deleted file mode 100644 index 861f4d028d8..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/helper.go +++ /dev/null @@ -1,357 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package descriptor - -import ( - "strings" -) - -func (msg *DescriptorProto) GetMapFields() (*FieldDescriptorProto, *FieldDescriptorProto) { - if !msg.GetOptions().GetMapEntry() { - return nil, nil - } - return msg.GetField()[0], msg.GetField()[1] -} - -func dotToUnderscore(r rune) rune { - if r == '.' { - return '_' - } - return r -} - -func (field *FieldDescriptorProto) WireType() (wire int) { - switch *field.Type { - case FieldDescriptorProto_TYPE_DOUBLE: - return 1 - case FieldDescriptorProto_TYPE_FLOAT: - return 5 - case FieldDescriptorProto_TYPE_INT64: - return 0 - case FieldDescriptorProto_TYPE_UINT64: - return 0 - case FieldDescriptorProto_TYPE_INT32: - return 0 - case FieldDescriptorProto_TYPE_UINT32: - return 0 - case FieldDescriptorProto_TYPE_FIXED64: - return 1 - case FieldDescriptorProto_TYPE_FIXED32: - return 5 - case FieldDescriptorProto_TYPE_BOOL: - return 0 - case FieldDescriptorProto_TYPE_STRING: - return 2 - case FieldDescriptorProto_TYPE_GROUP: - return 2 - case FieldDescriptorProto_TYPE_MESSAGE: - return 2 - case FieldDescriptorProto_TYPE_BYTES: - return 2 - case FieldDescriptorProto_TYPE_ENUM: - return 0 - case FieldDescriptorProto_TYPE_SFIXED32: - return 5 - case FieldDescriptorProto_TYPE_SFIXED64: - return 1 - case FieldDescriptorProto_TYPE_SINT32: - return 0 - case FieldDescriptorProto_TYPE_SINT64: - return 0 - } - panic("unreachable") -} - -func (field *FieldDescriptorProto) GetKeyUint64() (x uint64) { - packed := field.IsPacked() - wireType := field.WireType() - fieldNumber := field.GetNumber() - if packed { - wireType = 2 - } - x = uint64(uint32(fieldNumber)<<3 | uint32(wireType)) - return x -} - -func (field *FieldDescriptorProto) GetKey() []byte { - x := field.GetKeyUint64() - i := 0 - keybuf := make([]byte, 0) - for i = 0; x > 127; i++ { - keybuf = append(keybuf, 0x80|uint8(x&0x7F)) - x >>= 7 - } - keybuf = append(keybuf, uint8(x)) - return keybuf -} - -func (desc *FileDescriptorSet) GetField(packageName, messageName, fieldName string) *FieldDescriptorProto { - msg := desc.GetMessage(packageName, messageName) - if msg == nil { - return nil - } - for _, field := range msg.GetField() { - if field.GetName() == fieldName { - return field - } - } - return nil -} - -func (file *FileDescriptorProto) GetMessage(typeName string) *DescriptorProto { - for _, msg := range file.GetMessageType() { - if msg.GetName() == typeName { - return msg - } - nes := file.GetNestedMessage(msg, strings.TrimPrefix(typeName, msg.GetName()+".")) - if nes != nil { - return nes - } - } - return nil -} - -func (file *FileDescriptorProto) GetNestedMessage(msg *DescriptorProto, typeName string) *DescriptorProto { - for _, nes := range msg.GetNestedType() { - if nes.GetName() == typeName { - return nes - } - res := file.GetNestedMessage(nes, strings.TrimPrefix(typeName, nes.GetName()+".")) - if res != nil { - return res - } - } - return nil -} - -func (desc *FileDescriptorSet) GetMessage(packageName string, typeName string) *DescriptorProto { - for _, file := range desc.GetFile() { - if strings.Map(dotToUnderscore, file.GetPackage()) != strings.Map(dotToUnderscore, packageName) { - continue - } - for _, msg := range file.GetMessageType() { - if msg.GetName() == typeName { - return msg - } - } - for _, msg := range file.GetMessageType() { - for _, nes := range msg.GetNestedType() { - if nes.GetName() == typeName { - return nes - } - if msg.GetName()+"."+nes.GetName() == typeName { - return nes - } - } - } - } - return nil -} - -func (desc *FileDescriptorSet) IsProto3(packageName string, typeName string) bool { - for _, file := range desc.GetFile() { - if strings.Map(dotToUnderscore, file.GetPackage()) != strings.Map(dotToUnderscore, packageName) { - continue - } - for _, msg := range file.GetMessageType() { - if msg.GetName() == typeName { - return file.GetSyntax() == "proto3" - } - } - for _, msg := range file.GetMessageType() { - for _, nes := range msg.GetNestedType() { - if nes.GetName() == typeName { - return file.GetSyntax() == "proto3" - } - if msg.GetName()+"."+nes.GetName() == typeName { - return file.GetSyntax() == "proto3" - } - } - } - } - return false -} - -func (msg *DescriptorProto) IsExtendable() bool { - return len(msg.GetExtensionRange()) > 0 -} - -func (desc *FileDescriptorSet) FindExtension(packageName string, typeName string, fieldName string) (extPackageName string, field *FieldDescriptorProto) { - parent := desc.GetMessage(packageName, typeName) - if parent == nil { - return "", nil - } - if !parent.IsExtendable() { - return "", nil - } - extendee := "." + packageName + "." + typeName - for _, file := range desc.GetFile() { - for _, ext := range file.GetExtension() { - if strings.Map(dotToUnderscore, file.GetPackage()) == strings.Map(dotToUnderscore, packageName) { - if !(ext.GetExtendee() == typeName || ext.GetExtendee() == extendee) { - continue - } - } else { - if ext.GetExtendee() != extendee { - continue - } - } - if ext.GetName() == fieldName { - return file.GetPackage(), ext - } - } - } - return "", nil -} - -func (desc *FileDescriptorSet) FindExtensionByFieldNumber(packageName string, typeName string, fieldNum int32) (extPackageName string, field *FieldDescriptorProto) { - parent := desc.GetMessage(packageName, typeName) - if parent == nil { - return "", nil - } - if !parent.IsExtendable() { - return "", nil - } - extendee := "." + packageName + "." + typeName - for _, file := range desc.GetFile() { - for _, ext := range file.GetExtension() { - if strings.Map(dotToUnderscore, file.GetPackage()) == strings.Map(dotToUnderscore, packageName) { - if !(ext.GetExtendee() == typeName || ext.GetExtendee() == extendee) { - continue - } - } else { - if ext.GetExtendee() != extendee { - continue - } - } - if ext.GetNumber() == fieldNum { - return file.GetPackage(), ext - } - } - } - return "", nil -} - -func (desc *FileDescriptorSet) FindMessage(packageName string, typeName string, fieldName string) (msgPackageName string, msgName string) { - parent := desc.GetMessage(packageName, typeName) - if parent == nil { - return "", "" - } - field := parent.GetFieldDescriptor(fieldName) - if field == nil { - var extPackageName string - extPackageName, field = desc.FindExtension(packageName, typeName, fieldName) - if field == nil { - return "", "" - } - packageName = extPackageName - } - typeNames := strings.Split(field.GetTypeName(), ".") - if len(typeNames) == 1 { - msg := desc.GetMessage(packageName, typeName) - if msg == nil { - return "", "" - } - return packageName, msg.GetName() - } - if len(typeNames) > 2 { - for i := 1; i < len(typeNames)-1; i++ { - packageName = strings.Join(typeNames[1:len(typeNames)-i], ".") - typeName = strings.Join(typeNames[len(typeNames)-i:], ".") - msg := desc.GetMessage(packageName, typeName) - if msg != nil { - typeNames := strings.Split(msg.GetName(), ".") - if len(typeNames) == 1 { - return packageName, msg.GetName() - } - return strings.Join(typeNames[1:len(typeNames)-1], "."), typeNames[len(typeNames)-1] - } - } - } - return "", "" -} - -func (msg *DescriptorProto) GetFieldDescriptor(fieldName string) *FieldDescriptorProto { - for _, field := range msg.GetField() { - if field.GetName() == fieldName { - return field - } - } - return nil -} - -func (desc *FileDescriptorSet) GetEnum(packageName string, typeName string) *EnumDescriptorProto { - for _, file := range desc.GetFile() { - if strings.Map(dotToUnderscore, file.GetPackage()) != strings.Map(dotToUnderscore, packageName) { - continue - } - for _, enum := range file.GetEnumType() { - if enum.GetName() == typeName { - return enum - } - } - } - return nil -} - -func (f *FieldDescriptorProto) IsEnum() bool { - return *f.Type == FieldDescriptorProto_TYPE_ENUM -} - -func (f *FieldDescriptorProto) IsMessage() bool { - return *f.Type == FieldDescriptorProto_TYPE_MESSAGE -} - -func (f *FieldDescriptorProto) IsBytes() bool { - return *f.Type == FieldDescriptorProto_TYPE_BYTES -} - -func (f *FieldDescriptorProto) IsRepeated() bool { - return f.Label != nil && *f.Label == FieldDescriptorProto_LABEL_REPEATED -} - -func (f *FieldDescriptorProto) IsString() bool { - return *f.Type == FieldDescriptorProto_TYPE_STRING -} - -func (f *FieldDescriptorProto) IsBool() bool { - return *f.Type == FieldDescriptorProto_TYPE_BOOL -} - -func (f *FieldDescriptorProto) IsRequired() bool { - return f.Label != nil && *f.Label == FieldDescriptorProto_LABEL_REQUIRED -} - -func (f *FieldDescriptorProto) IsPacked() bool { - return f.Options != nil && f.GetOptions().GetPacked() -} - -func (m *DescriptorProto) HasExtension() bool { - return len(m.ExtensionRange) > 0 -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/doc.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/doc.go deleted file mode 100644 index 15c7cf43c28..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/doc.go +++ /dev/null @@ -1,51 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -/* - A plugin for the Google protocol buffer compiler to generate Go code. - Run it by building this program and putting it in your path with the name - protoc-gen-gogo - That word 'gogo' at the end becomes part of the option string set for the - protocol compiler, so once the protocol compiler (protoc) is installed - you can run - protoc --gogo_out=output_directory input_directory/file.proto - to generate Go bindings for the protocol defined by file.proto. - With that input, the output will be written to - output_directory/go_package/file.pb.go - - The generated code is documented in the package comment for - the library. - - See the README and documentation for protocol buffers to learn more: - https://developers.google.com/protocol-buffers/ - -*/ -package documentation diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/generator/generator.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/generator/generator.go deleted file mode 100644 index 566454bdc20..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/generator/generator.go +++ /dev/null @@ -1,3318 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -/* - The code generator for the plugin for the Google protocol buffer compiler. - It generates Go code from the protocol buffer description files read by the - main routine. -*/ -package generator - -import ( - "bufio" - "bytes" - "compress/gzip" - "fmt" - "go/parser" - "go/printer" - "go/token" - "log" - "os" - "path" - "sort" - "strconv" - "strings" - "unicode" - "unicode/utf8" - - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/proto" - descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - plugin "github.com/gogo/protobuf/protoc-gen-gogo/plugin" -) - -// generatedCodeVersion indicates a version of the generated code. -// It is incremented whenever an incompatibility between the generated code and -// proto package is introduced; the generated code references -// a constant, proto.ProtoPackageIsVersionN (where N is generatedCodeVersion). -const generatedCodeVersion = 2 - -// A Plugin provides functionality to add to the output during Go code generation, -// such as to produce RPC stubs. -type Plugin interface { - // Name identifies the plugin. - Name() string - // Init is called once after data structures are built but before - // code generation begins. - Init(g *Generator) - // Generate produces the code generated by the plugin for this file, - // except for the imports, by calling the generator's methods P, In, and Out. - Generate(file *FileDescriptor) - // GenerateImports produces the import declarations for this file. - // It is called after Generate. - GenerateImports(file *FileDescriptor) -} - -type pluginSlice []Plugin - -func (ps pluginSlice) Len() int { - return len(ps) -} - -func (ps pluginSlice) Less(i, j int) bool { - return ps[i].Name() < ps[j].Name() -} - -func (ps pluginSlice) Swap(i, j int) { - ps[i], ps[j] = ps[j], ps[i] -} - -var plugins pluginSlice - -// RegisterPlugin installs a (second-order) plugin to be run when the Go output is generated. -// It is typically called during initialization. -func RegisterPlugin(p Plugin) { - plugins = append(plugins, p) -} - -// Each type we import as a protocol buffer (other than FileDescriptorProto) needs -// a pointer to the FileDescriptorProto that represents it. These types achieve that -// wrapping by placing each Proto inside a struct with the pointer to its File. The -// structs have the same names as their contents, with "Proto" removed. -// FileDescriptor is used to store the things that it points to. - -// The file and package name method are common to messages and enums. -type common struct { - file *descriptor.FileDescriptorProto // File this object comes from. -} - -// PackageName is name in the package clause in the generated file. -func (c *common) PackageName() string { return uniquePackageOf(c.file) } - -func (c *common) File() *descriptor.FileDescriptorProto { return c.file } - -func fileIsProto3(file *descriptor.FileDescriptorProto) bool { - return file.GetSyntax() == "proto3" -} - -func (c *common) proto3() bool { return fileIsProto3(c.file) } - -// Descriptor represents a protocol buffer message. -type Descriptor struct { - common - *descriptor.DescriptorProto - parent *Descriptor // The containing message, if any. - nested []*Descriptor // Inner messages, if any. - enums []*EnumDescriptor // Inner enums, if any. - ext []*ExtensionDescriptor // Extensions, if any. - typename []string // Cached typename vector. - index int // The index into the container, whether the file or another message. - path string // The SourceCodeInfo path as comma-separated integers. - group bool -} - -// TypeName returns the elements of the dotted type name. -// The package name is not part of this name. -func (d *Descriptor) TypeName() []string { - if d.typename != nil { - return d.typename - } - n := 0 - for parent := d; parent != nil; parent = parent.parent { - n++ - } - s := make([]string, n, n) - for parent := d; parent != nil; parent = parent.parent { - n-- - s[n] = parent.GetName() - } - d.typename = s - return s -} - -func (d *Descriptor) allowOneof() bool { - return true -} - -// EnumDescriptor describes an enum. If it's at top level, its parent will be nil. -// Otherwise it will be the descriptor of the message in which it is defined. -type EnumDescriptor struct { - common - *descriptor.EnumDescriptorProto - parent *Descriptor // The containing message, if any. - typename []string // Cached typename vector. - index int // The index into the container, whether the file or a message. - path string // The SourceCodeInfo path as comma-separated integers. -} - -// TypeName returns the elements of the dotted type name. -// The package name is not part of this name. -func (e *EnumDescriptor) TypeName() (s []string) { - if e.typename != nil { - return e.typename - } - name := e.GetName() - if e.parent == nil { - s = make([]string, 1) - } else { - pname := e.parent.TypeName() - s = make([]string, len(pname)+1) - copy(s, pname) - } - s[len(s)-1] = name - e.typename = s - return s -} - -// alias provides the TypeName corrected for the application of any naming -// extensions on the enum type. It should be used for generating references to -// the Go types and for calculating prefixes. -func (e *EnumDescriptor) alias() (s []string) { - s = e.TypeName() - if gogoproto.IsEnumCustomName(e.EnumDescriptorProto) { - s[len(s)-1] = gogoproto.GetEnumCustomName(e.EnumDescriptorProto) - } - - return -} - -// Everything but the last element of the full type name, CamelCased. -// The values of type Foo.Bar are call Foo_value1... not Foo_Bar_value1... . -func (e *EnumDescriptor) prefix() string { - typeName := e.alias() - if e.parent == nil { - // If the enum is not part of a message, the prefix is just the type name. - return CamelCase(typeName[len(typeName)-1]) + "_" - } - return CamelCaseSlice(typeName[0:len(typeName)-1]) + "_" -} - -// The integer value of the named constant in this enumerated type. -func (e *EnumDescriptor) integerValueAsString(name string) string { - for _, c := range e.Value { - if c.GetName() == name { - return fmt.Sprint(c.GetNumber()) - } - } - log.Fatal("cannot find value for enum constant") - return "" -} - -// ExtensionDescriptor describes an extension. If it's at top level, its parent will be nil. -// Otherwise it will be the descriptor of the message in which it is defined. -type ExtensionDescriptor struct { - common - *descriptor.FieldDescriptorProto - parent *Descriptor // The containing message, if any. -} - -// TypeName returns the elements of the dotted type name. -// The package name is not part of this name. -func (e *ExtensionDescriptor) TypeName() (s []string) { - name := e.GetName() - if e.parent == nil { - // top-level extension - s = make([]string, 1) - } else { - pname := e.parent.TypeName() - s = make([]string, len(pname)+1) - copy(s, pname) - } - s[len(s)-1] = name - return s -} - -// DescName returns the variable name used for the generated descriptor. -func (e *ExtensionDescriptor) DescName() string { - // The full type name. - typeName := e.TypeName() - // Each scope of the extension is individually CamelCased, and all are joined with "_" with an "E_" prefix. - for i, s := range typeName { - typeName[i] = CamelCase(s) - } - return "E_" + strings.Join(typeName, "_") -} - -// ImportedDescriptor describes a type that has been publicly imported from another file. -type ImportedDescriptor struct { - common - o Object -} - -func (id *ImportedDescriptor) TypeName() []string { return id.o.TypeName() } - -// FileDescriptor describes an protocol buffer descriptor file (.proto). -// It includes slices of all the messages and enums defined within it. -// Those slices are constructed by WrapTypes. -type FileDescriptor struct { - *descriptor.FileDescriptorProto - desc []*Descriptor // All the messages defined in this file. - enum []*EnumDescriptor // All the enums defined in this file. - ext []*ExtensionDescriptor // All the top-level extensions defined in this file. - imp []*ImportedDescriptor // All types defined in files publicly imported by this file. - - // Comments, stored as a map of path (comma-separated integers) to the comment. - comments map[string]*descriptor.SourceCodeInfo_Location - - // The full list of symbols that are exported, - // as a map from the exported object to its symbols. - // This is used for supporting public imports. - exported map[Object][]symbol - - index int // The index of this file in the list of files to generate code for - - proto3 bool // whether to generate proto3 code for this file -} - -// PackageName is the package name we'll use in the generated code to refer to this file. -func (d *FileDescriptor) PackageName() string { return uniquePackageOf(d.FileDescriptorProto) } - -// VarName is the variable name we'll use in the generated code to refer -// to the compressed bytes of this descriptor. It is not exported, so -// it is only valid inside the generated package. -func (d *FileDescriptor) VarName() string { return fmt.Sprintf("fileDescriptor%v", FileName(d)) } - -// goPackageOption interprets the file's go_package option. -// If there is no go_package, it returns ("", "", false). -// If there's a simple name, it returns ("", pkg, true). -// If the option implies an import path, it returns (impPath, pkg, true). -func (d *FileDescriptor) goPackageOption() (impPath, pkg string, ok bool) { - pkg = d.GetOptions().GetGoPackage() - if pkg == "" { - return - } - ok = true - // The presence of a slash implies there's an import path. - slash := strings.LastIndex(pkg, "/") - if slash < 0 { - return - } - impPath, pkg = pkg, pkg[slash+1:] - // A semicolon-delimited suffix overrides the package name. - sc := strings.IndexByte(impPath, ';') - if sc < 0 { - return - } - impPath, pkg = impPath[:sc], impPath[sc+1:] - return -} - -// goPackageName returns the Go package name to use in the -// generated Go file. The result explicit reports whether the name -// came from an option go_package statement. If explicit is false, -// the name was derived from the protocol buffer's package statement -// or the input file name. -func (d *FileDescriptor) goPackageName() (name string, explicit bool) { - // Does the file have a "go_package" option? - if _, pkg, ok := d.goPackageOption(); ok { - return pkg, true - } - - // Does the file have a package clause? - if pkg := d.GetPackage(); pkg != "" { - return pkg, false - } - // Use the file base name. - return baseName(d.GetName()), false -} - -// goFileName returns the output name for the generated Go file. -func (d *FileDescriptor) goFileName() string { - name := *d.Name - if ext := path.Ext(name); ext == ".proto" || ext == ".protodevel" { - name = name[:len(name)-len(ext)] - } - name += ".pb.go" - - // Does the file have a "go_package" option? - // If it does, it may override the filename. - if impPath, _, ok := d.goPackageOption(); ok && impPath != "" { - // Replace the existing dirname with the declared import path. - _, name = path.Split(name) - name = path.Join(impPath, name) - return name - } - - return name -} - -func (d *FileDescriptor) addExport(obj Object, sym symbol) { - d.exported[obj] = append(d.exported[obj], sym) -} - -// symbol is an interface representing an exported Go symbol. -type symbol interface { - // GenerateAlias should generate an appropriate alias - // for the symbol from the named package. - GenerateAlias(g *Generator, pkg string) -} - -type messageSymbol struct { - sym string - hasExtensions, isMessageSet bool - hasOneof bool - getters []getterSymbol -} - -type getterSymbol struct { - name string - typ string - typeName string // canonical name in proto world; empty for proto.Message and similar - genType bool // whether typ contains a generated type (message/group/enum) -} - -func (ms *messageSymbol) GenerateAlias(g *Generator, pkg string) { - remoteSym := pkg + "." + ms.sym - - g.P("type ", ms.sym, " ", remoteSym) - g.P("func (m *", ms.sym, ") Reset() { (*", remoteSym, ")(m).Reset() }") - g.P("func (m *", ms.sym, ") String() string { return (*", remoteSym, ")(m).String() }") - g.P("func (*", ms.sym, ") ProtoMessage() {}") - if ms.hasExtensions { - g.P("func (*", ms.sym, ") ExtensionRangeArray() []", g.Pkg["proto"], ".ExtensionRange ", - "{ return (*", remoteSym, ")(nil).ExtensionRangeArray() }") - if ms.isMessageSet { - g.P("func (m *", ms.sym, ") Marshal() ([]byte, error) ", - "{ return (*", remoteSym, ")(m).Marshal() }") - g.P("func (m *", ms.sym, ") Unmarshal(buf []byte) error ", - "{ return (*", remoteSym, ")(m).Unmarshal(buf) }") - } - } - if ms.hasOneof { - // Oneofs and public imports do not mix well. - // We can make them work okay for the binary format, - // but they're going to break weirdly for text/JSON. - enc := "_" + ms.sym + "_OneofMarshaler" - dec := "_" + ms.sym + "_OneofUnmarshaler" - size := "_" + ms.sym + "_OneofSizer" - encSig := "(msg " + g.Pkg["proto"] + ".Message, b *" + g.Pkg["proto"] + ".Buffer) error" - decSig := "(msg " + g.Pkg["proto"] + ".Message, tag, wire int, b *" + g.Pkg["proto"] + ".Buffer) (bool, error)" - sizeSig := "(msg " + g.Pkg["proto"] + ".Message) int" - g.P("func (m *", ms.sym, ") XXX_OneofFuncs() (func", encSig, ", func", decSig, ", func", sizeSig, ", []interface{}) {") - g.P("return ", enc, ", ", dec, ", ", size, ", nil") - g.P("}") - - g.P("func ", enc, encSig, " {") - g.P("m := msg.(*", ms.sym, ")") - g.P("m0 := (*", remoteSym, ")(m)") - g.P("enc, _, _, _ := m0.XXX_OneofFuncs()") - g.P("return enc(m0, b)") - g.P("}") - - g.P("func ", dec, decSig, " {") - g.P("m := msg.(*", ms.sym, ")") - g.P("m0 := (*", remoteSym, ")(m)") - g.P("_, dec, _, _ := m0.XXX_OneofFuncs()") - g.P("return dec(m0, tag, wire, b)") - g.P("}") - - g.P("func ", size, sizeSig, " {") - g.P("m := msg.(*", ms.sym, ")") - g.P("m0 := (*", remoteSym, ")(m)") - g.P("_, _, size, _ := m0.XXX_OneofFuncs()") - g.P("return size(m0)") - g.P("}") - } - for _, get := range ms.getters { - - if get.typeName != "" { - g.RecordTypeUse(get.typeName) - } - typ := get.typ - val := "(*" + remoteSym + ")(m)." + get.name + "()" - if get.genType { - // typ will be "*pkg.T" (message/group) or "pkg.T" (enum) - // or "map[t]*pkg.T" (map to message/enum). - // The first two of those might have a "[]" prefix if it is repeated. - // Drop any package qualifier since we have hoisted the type into this package. - rep := strings.HasPrefix(typ, "[]") - if rep { - typ = typ[2:] - } - isMap := strings.HasPrefix(typ, "map[") - star := typ[0] == '*' - if !isMap { // map types handled lower down - typ = typ[strings.Index(typ, ".")+1:] - } - if star { - typ = "*" + typ - } - if rep { - // Go does not permit conversion between slice types where both - // element types are named. That means we need to generate a bit - // of code in this situation. - // typ is the element type. - // val is the expression to get the slice from the imported type. - - ctyp := typ // conversion type expression; "Foo" or "(*Foo)" - if star { - ctyp = "(" + typ + ")" - } - - g.P("func (m *", ms.sym, ") ", get.name, "() []", typ, " {") - g.In() - g.P("o := ", val) - g.P("if o == nil {") - g.In() - g.P("return nil") - g.Out() - g.P("}") - g.P("s := make([]", typ, ", len(o))") - g.P("for i, x := range o {") - g.In() - g.P("s[i] = ", ctyp, "(x)") - g.Out() - g.P("}") - g.P("return s") - g.Out() - g.P("}") - continue - } - if isMap { - // Split map[keyTyp]valTyp. - bra, ket := strings.Index(typ, "["), strings.Index(typ, "]") - keyTyp, valTyp := typ[bra+1:ket], typ[ket+1:] - // Drop any package qualifier. - // Only the value type may be foreign. - star := valTyp[0] == '*' - valTyp = valTyp[strings.Index(valTyp, ".")+1:] - if star { - valTyp = "*" + valTyp - } - - maptyp := "map[" + keyTyp + "]" + valTyp - g.P("func (m *", ms.sym, ") ", get.name, "() ", typ, " {") - g.P("o := ", val) - g.P("if o == nil { return nil }") - g.P("s := make(", maptyp, ", len(o))") - g.P("for k, v := range o {") - g.P("s[k] = (", valTyp, ")(v)") - g.P("}") - g.P("return s") - g.P("}") - continue - } - // Convert imported type into the forwarding type. - val = "(" + typ + ")(" + val + ")" - } - - g.P("func (m *", ms.sym, ") ", get.name, "() ", typ, " { return ", val, " }") - } - -} - -type enumSymbol struct { - name string - proto3 bool // Whether this came from a proto3 file. -} - -func (es enumSymbol) GenerateAlias(g *Generator, pkg string) { - s := es.name - g.P("type ", s, " ", pkg, ".", s) - g.P("var ", s, "_name = ", pkg, ".", s, "_name") - g.P("var ", s, "_value = ", pkg, ".", s, "_value") - g.P("func (x ", s, ") String() string { return (", pkg, ".", s, ")(x).String() }") - if !es.proto3 { - g.P("func (x ", s, ") Enum() *", s, "{ return (*", s, ")((", pkg, ".", s, ")(x).Enum()) }") - g.P("func (x *", s, ") UnmarshalJSON(data []byte) error { return (*", pkg, ".", s, ")(x).UnmarshalJSON(data) }") - } -} - -type constOrVarSymbol struct { - sym string - typ string // either "const" or "var" - cast string // if non-empty, a type cast is required (used for enums) -} - -func (cs constOrVarSymbol) GenerateAlias(g *Generator, pkg string) { - v := pkg + "." + cs.sym - if cs.cast != "" { - v = cs.cast + "(" + v + ")" - } - g.P(cs.typ, " ", cs.sym, " = ", v) -} - -// Object is an interface abstracting the abilities shared by enums, messages, extensions and imported objects. -type Object interface { - PackageName() string // The name we use in our output (a_b_c), possibly renamed for uniqueness. - TypeName() []string - File() *descriptor.FileDescriptorProto -} - -// Each package name we generate must be unique. The package we're generating -// gets its own name but every other package must have a unique name that does -// not conflict in the code we generate. These names are chosen globally (although -// they don't have to be, it simplifies things to do them globally). -func uniquePackageOf(fd *descriptor.FileDescriptorProto) string { - s, ok := uniquePackageName[fd] - if !ok { - log.Fatal("internal error: no package name defined for " + fd.GetName()) - } - return s -} - -// Generator is the type whose methods generate the output, stored in the associated response structure. -type Generator struct { - *bytes.Buffer - - Request *plugin.CodeGeneratorRequest // The input. - Response *plugin.CodeGeneratorResponse // The output. - - Param map[string]string // Command-line parameters. - PackageImportPath string // Go import path of the package we're generating code for - ImportPrefix string // String to prefix to imported package file names. - ImportMap map[string]string // Mapping from .proto file name to import path - - Pkg map[string]string // The names under which we import support packages - - packageName string // What we're calling ourselves. - allFiles []*FileDescriptor // All files in the tree - allFilesByName map[string]*FileDescriptor // All files by filename. - genFiles []*FileDescriptor // Those files we will generate output for. - file *FileDescriptor // The file we are compiling now. - usedPackages map[string]bool // Names of packages used in current file. - typeNameToObject map[string]Object // Key is a fully-qualified name in input syntax. - init []string // Lines to emit in the init function. - indent string - writeOutput bool - - customImports []string - writtenImports map[string]bool // For de-duplicating written imports -} - -// New creates a new generator and allocates the request and response protobufs. -func New() *Generator { - g := new(Generator) - g.Buffer = new(bytes.Buffer) - g.Request = new(plugin.CodeGeneratorRequest) - g.Response = new(plugin.CodeGeneratorResponse) - g.writtenImports = make(map[string]bool) - uniquePackageName = make(map[*descriptor.FileDescriptorProto]string) - pkgNamesInUse = make(map[string][]*FileDescriptor) - return g -} - -// Error reports a problem, including an error, and exits the program. -func (g *Generator) Error(err error, msgs ...string) { - s := strings.Join(msgs, " ") + ":" + err.Error() - log.Print("protoc-gen-gogo: error:", s) - os.Exit(1) -} - -// Fail reports a problem and exits the program. -func (g *Generator) Fail(msgs ...string) { - s := strings.Join(msgs, " ") - log.Print("protoc-gen-gogo: error:", s) - os.Exit(1) -} - -// CommandLineParameters breaks the comma-separated list of key=value pairs -// in the parameter (a member of the request protobuf) into a key/value map. -// It then sets file name mappings defined by those entries. -func (g *Generator) CommandLineParameters(parameter string) { - g.Param = make(map[string]string) - for _, p := range strings.Split(parameter, ",") { - if i := strings.Index(p, "="); i < 0 { - g.Param[p] = "" - } else { - g.Param[p[0:i]] = p[i+1:] - } - } - - g.ImportMap = make(map[string]string) - pluginList := "none" // Default list of plugin names to enable (empty means all). - for k, v := range g.Param { - switch k { - case "import_prefix": - g.ImportPrefix = v - case "import_path": - g.PackageImportPath = v - case "plugins": - pluginList = v - default: - if len(k) > 0 && k[0] == 'M' { - g.ImportMap[k[1:]] = v - } - } - } - if pluginList == "" { - return - } - if pluginList == "none" { - pluginList = "" - } - gogoPluginNames := []string{"unmarshal", "unsafeunmarshaler", "union", "stringer", "size", "protosizer", "populate", "marshalto", "unsafemarshaler", "gostring", "face", "equal", "enumstringer", "embedcheck", "description", "defaultcheck", "oneofcheck", "compare"} - pluginList = strings.Join(append(gogoPluginNames, pluginList), "+") - if pluginList != "" { - // Amend the set of plugins. - enabled := make(map[string]bool) - for _, name := range strings.Split(pluginList, "+") { - enabled[name] = true - } - var nplugins pluginSlice - for _, p := range plugins { - if enabled[p.Name()] { - nplugins = append(nplugins, p) - } - } - sort.Sort(nplugins) - plugins = nplugins - } -} - -// DefaultPackageName returns the package name printed for the object. -// If its file is in a different package, it returns the package name we're using for this file, plus ".". -// Otherwise it returns the empty string. -func (g *Generator) DefaultPackageName(obj Object) string { - pkg := obj.PackageName() - if pkg == g.packageName { - return "" - } - return pkg + "." -} - -// For each input file, the unique package name to use, underscored. -var uniquePackageName = make(map[*descriptor.FileDescriptorProto]string) - -// Package names already registered. Key is the name from the .proto file; -// value is the name that appears in the generated code. -var pkgNamesInUse = make(map[string][]*FileDescriptor) - -// Create and remember a guaranteed unique package name for this file descriptor. -// Pkg is the candidate name. If f is nil, it's a builtin package like "proto" and -// has no file descriptor. -func RegisterUniquePackageName(pkg string, f *FileDescriptor) string { - // Convert dots to underscores before finding a unique alias. - pkg = strings.Map(badToUnderscore, pkg) - - var i = -1 - var ptr *FileDescriptor = nil - for i, ptr = range pkgNamesInUse[pkg] { - if ptr == f { - if i == 0 { - return pkg - } - return pkg + strconv.Itoa(i) - } - } - - pkgNamesInUse[pkg] = append(pkgNamesInUse[pkg], f) - i += 1 - - if i > 0 { - pkg = pkg + strconv.Itoa(i) - } - - if f != nil { - uniquePackageName[f.FileDescriptorProto] = pkg - } - return pkg -} - -var isGoKeyword = map[string]bool{ - "break": true, - "case": true, - "chan": true, - "const": true, - "continue": true, - "default": true, - "else": true, - "defer": true, - "fallthrough": true, - "for": true, - "func": true, - "go": true, - "goto": true, - "if": true, - "import": true, - "interface": true, - "map": true, - "package": true, - "range": true, - "return": true, - "select": true, - "struct": true, - "switch": true, - "type": true, - "var": true, -} - -// defaultGoPackage returns the package name to use, -// derived from the import path of the package we're building code for. -func (g *Generator) defaultGoPackage() string { - p := g.PackageImportPath - if i := strings.LastIndex(p, "/"); i >= 0 { - p = p[i+1:] - } - if p == "" { - return "" - } - - p = strings.Map(badToUnderscore, p) - // Identifier must not be keyword: insert _. - if isGoKeyword[p] { - p = "_" + p - } - // Identifier must not begin with digit: insert _. - if r, _ := utf8.DecodeRuneInString(p); unicode.IsDigit(r) { - p = "_" + p - } - return p -} - -// SetPackageNames sets the package name for this run. -// The package name must agree across all files being generated. -// It also defines unique package names for all imported files. -func (g *Generator) SetPackageNames() { - // Register the name for this package. It will be the first name - // registered so is guaranteed to be unmodified. - pkg, explicit := g.genFiles[0].goPackageName() - - // Check all files for an explicit go_package option. - for _, f := range g.genFiles { - thisPkg, thisExplicit := f.goPackageName() - if thisExplicit { - if !explicit { - // Let this file's go_package option serve for all input files. - pkg, explicit = thisPkg, true - } else if thisPkg != pkg { - g.Fail("inconsistent package names:", thisPkg, pkg) - } - } - } - - // If we don't have an explicit go_package option but we have an - // import path, use that. - if !explicit { - p := g.defaultGoPackage() - if p != "" { - pkg, explicit = p, true - } - } - - // If there was no go_package and no import path to use, - // double-check that all the inputs have the same implicit - // Go package name. - if !explicit { - for _, f := range g.genFiles { - thisPkg, _ := f.goPackageName() - if thisPkg != pkg { - g.Fail("inconsistent package names:", thisPkg, pkg) - } - } - } - - g.packageName = RegisterUniquePackageName(pkg, g.genFiles[0]) - - // Register the support package names. They might collide with the - // name of a package we import. - g.Pkg = map[string]string{ - "fmt": RegisterUniquePackageName("fmt", nil), - "math": RegisterUniquePackageName("math", nil), - "proto": RegisterUniquePackageName("proto", nil), - } - -AllFiles: - for _, f := range g.allFiles { - for _, genf := range g.genFiles { - if f == genf { - // In this package already. - uniquePackageName[f.FileDescriptorProto] = g.packageName - continue AllFiles - } - } - // The file is a dependency, so we want to ignore its go_package option - // because that is only relevant for its specific generated output. - pkg := f.GetPackage() - if pkg == "" { - pkg = baseName(*f.Name) - } - RegisterUniquePackageName(pkg, f) - } -} - -// WrapTypes walks the incoming data, wrapping DescriptorProtos, EnumDescriptorProtos -// and FileDescriptorProtos into file-referenced objects within the Generator. -// It also creates the list of files to generate and so should be called before GenerateAllFiles. -func (g *Generator) WrapTypes() { - g.allFiles = make([]*FileDescriptor, 0, len(g.Request.ProtoFile)) - g.allFilesByName = make(map[string]*FileDescriptor, len(g.allFiles)) - for _, f := range g.Request.ProtoFile { - // We must wrap the descriptors before we wrap the enums - descs := wrapDescriptors(f) - g.buildNestedDescriptors(descs) - enums := wrapEnumDescriptors(f, descs) - g.buildNestedEnums(descs, enums) - exts := wrapExtensions(f) - fd := &FileDescriptor{ - FileDescriptorProto: f, - desc: descs, - enum: enums, - ext: exts, - exported: make(map[Object][]symbol), - proto3: fileIsProto3(f), - } - extractComments(fd) - g.allFiles = append(g.allFiles, fd) - g.allFilesByName[f.GetName()] = fd - } - for _, fd := range g.allFiles { - fd.imp = wrapImported(fd.FileDescriptorProto, g) - } - - g.genFiles = make([]*FileDescriptor, 0, len(g.Request.FileToGenerate)) - for _, fileName := range g.Request.FileToGenerate { - fd := g.allFilesByName[fileName] - if fd == nil { - g.Fail("could not find file named", fileName) - } - fd.index = len(g.genFiles) - g.genFiles = append(g.genFiles, fd) - } -} - -// Scan the descriptors in this file. For each one, build the slice of nested descriptors -func (g *Generator) buildNestedDescriptors(descs []*Descriptor) { - for _, desc := range descs { - if len(desc.NestedType) != 0 { - for _, nest := range descs { - if nest.parent == desc { - desc.nested = append(desc.nested, nest) - } - } - if len(desc.nested) != len(desc.NestedType) { - g.Fail("internal error: nesting failure for", desc.GetName()) - } - } - } -} - -func (g *Generator) buildNestedEnums(descs []*Descriptor, enums []*EnumDescriptor) { - for _, desc := range descs { - if len(desc.EnumType) != 0 { - for _, enum := range enums { - if enum.parent == desc { - desc.enums = append(desc.enums, enum) - } - } - if len(desc.enums) != len(desc.EnumType) { - g.Fail("internal error: enum nesting failure for", desc.GetName()) - } - } - } -} - -// Construct the Descriptor -func newDescriptor(desc *descriptor.DescriptorProto, parent *Descriptor, file *descriptor.FileDescriptorProto, index int) *Descriptor { - d := &Descriptor{ - common: common{file}, - DescriptorProto: desc, - parent: parent, - index: index, - } - if parent == nil { - d.path = fmt.Sprintf("%d,%d", messagePath, index) - } else { - d.path = fmt.Sprintf("%s,%d,%d", parent.path, messageMessagePath, index) - } - - // The only way to distinguish a group from a message is whether - // the containing message has a TYPE_GROUP field that matches. - if parent != nil { - parts := d.TypeName() - if file.Package != nil { - parts = append([]string{*file.Package}, parts...) - } - exp := "." + strings.Join(parts, ".") - for _, field := range parent.Field { - if field.GetType() == descriptor.FieldDescriptorProto_TYPE_GROUP && field.GetTypeName() == exp { - d.group = true - break - } - } - } - - for _, field := range desc.Extension { - d.ext = append(d.ext, &ExtensionDescriptor{common{file}, field, d}) - } - - return d -} - -// Return a slice of all the Descriptors defined within this file -func wrapDescriptors(file *descriptor.FileDescriptorProto) []*Descriptor { - sl := make([]*Descriptor, 0, len(file.MessageType)+10) - for i, desc := range file.MessageType { - sl = wrapThisDescriptor(sl, desc, nil, file, i) - } - return sl -} - -// Wrap this Descriptor, recursively -func wrapThisDescriptor(sl []*Descriptor, desc *descriptor.DescriptorProto, parent *Descriptor, file *descriptor.FileDescriptorProto, index int) []*Descriptor { - sl = append(sl, newDescriptor(desc, parent, file, index)) - me := sl[len(sl)-1] - for i, nested := range desc.NestedType { - sl = wrapThisDescriptor(sl, nested, me, file, i) - } - return sl -} - -// Construct the EnumDescriptor -func newEnumDescriptor(desc *descriptor.EnumDescriptorProto, parent *Descriptor, file *descriptor.FileDescriptorProto, index int) *EnumDescriptor { - ed := &EnumDescriptor{ - common: common{file}, - EnumDescriptorProto: desc, - parent: parent, - index: index, - } - if parent == nil { - ed.path = fmt.Sprintf("%d,%d", enumPath, index) - } else { - ed.path = fmt.Sprintf("%s,%d,%d", parent.path, messageEnumPath, index) - } - return ed -} - -// Return a slice of all the EnumDescriptors defined within this file -func wrapEnumDescriptors(file *descriptor.FileDescriptorProto, descs []*Descriptor) []*EnumDescriptor { - sl := make([]*EnumDescriptor, 0, len(file.EnumType)+10) - // Top-level enums. - for i, enum := range file.EnumType { - sl = append(sl, newEnumDescriptor(enum, nil, file, i)) - } - // Enums within messages. Enums within embedded messages appear in the outer-most message. - for _, nested := range descs { - for i, enum := range nested.EnumType { - sl = append(sl, newEnumDescriptor(enum, nested, file, i)) - } - } - return sl -} - -// Return a slice of all the top-level ExtensionDescriptors defined within this file. -func wrapExtensions(file *descriptor.FileDescriptorProto) []*ExtensionDescriptor { - var sl []*ExtensionDescriptor - for _, field := range file.Extension { - sl = append(sl, &ExtensionDescriptor{common{file}, field, nil}) - } - return sl -} - -// Return a slice of all the types that are publicly imported into this file. -func wrapImported(file *descriptor.FileDescriptorProto, g *Generator) (sl []*ImportedDescriptor) { - for _, index := range file.PublicDependency { - df := g.fileByName(file.Dependency[index]) - for _, d := range df.desc { - if d.GetOptions().GetMapEntry() { - continue - } - sl = append(sl, &ImportedDescriptor{common{file}, d}) - } - for _, e := range df.enum { - sl = append(sl, &ImportedDescriptor{common{file}, e}) - } - for _, ext := range df.ext { - sl = append(sl, &ImportedDescriptor{common{file}, ext}) - } - } - return -} - -func extractComments(file *FileDescriptor) { - file.comments = make(map[string]*descriptor.SourceCodeInfo_Location) - for _, loc := range file.GetSourceCodeInfo().GetLocation() { - if loc.LeadingComments == nil { - continue - } - var p []string - for _, n := range loc.Path { - p = append(p, strconv.Itoa(int(n))) - } - file.comments[strings.Join(p, ",")] = loc - } -} - -// BuildTypeNameMap builds the map from fully qualified type names to objects. -// The key names for the map come from the input data, which puts a period at the beginning. -// It should be called after SetPackageNames and before GenerateAllFiles. -func (g *Generator) BuildTypeNameMap() { - g.typeNameToObject = make(map[string]Object) - for _, f := range g.allFiles { - // The names in this loop are defined by the proto world, not us, so the - // package name may be empty. If so, the dotted package name of X will - // be ".X"; otherwise it will be ".pkg.X". - dottedPkg := "." + f.GetPackage() - if dottedPkg != "." { - dottedPkg += "." - } - for _, enum := range f.enum { - name := dottedPkg + dottedSlice(enum.TypeName()) - g.typeNameToObject[name] = enum - } - for _, desc := range f.desc { - name := dottedPkg + dottedSlice(desc.TypeName()) - g.typeNameToObject[name] = desc - } - } -} - -// ObjectNamed, given a fully-qualified input type name as it appears in the input data, -// returns the descriptor for the message or enum with that name. -func (g *Generator) ObjectNamed(typeName string) Object { - o, ok := g.typeNameToObject[typeName] - if !ok { - g.Fail("can't find object with type", typeName) - } - - // If the file of this object isn't a direct dependency of the current file, - // or in the current file, then this object has been publicly imported into - // a dependency of the current file. - // We should return the ImportedDescriptor object for it instead. - direct := *o.File().Name == *g.file.Name - if !direct { - for _, dep := range g.file.Dependency { - if *g.fileByName(dep).Name == *o.File().Name { - direct = true - break - } - } - } - if !direct { - found := false - Loop: - for _, dep := range g.file.Dependency { - df := g.fileByName(*g.fileByName(dep).Name) - for _, td := range df.imp { - if td.o == o { - // Found it! - o = td - found = true - break Loop - } - } - } - if !found { - log.Printf("protoc-gen-gogo: WARNING: failed finding publicly imported dependency for %v, used in %v", typeName, *g.file.Name) - } - } - - return o -} - -// P prints the arguments to the generated output. It handles strings and int32s, plus -// handling indirections because they may be *string, etc. -func (g *Generator) P(str ...interface{}) { - if !g.writeOutput { - return - } - g.WriteString(g.indent) - for _, v := range str { - switch s := v.(type) { - case string: - g.WriteString(s) - case *string: - g.WriteString(*s) - case bool: - fmt.Fprintf(g, "%t", s) - case *bool: - fmt.Fprintf(g, "%t", *s) - case int: - fmt.Fprintf(g, "%d", s) - case *int32: - fmt.Fprintf(g, "%d", *s) - case *int64: - fmt.Fprintf(g, "%d", *s) - case float64: - fmt.Fprintf(g, "%g", s) - case *float64: - fmt.Fprintf(g, "%g", *s) - default: - g.Fail(fmt.Sprintf("unknown type in printer: %T", v)) - } - } - g.WriteByte('\n') -} - -// addInitf stores the given statement to be printed inside the file's init function. -// The statement is given as a format specifier and arguments. -func (g *Generator) addInitf(stmt string, a ...interface{}) { - g.init = append(g.init, fmt.Sprintf(stmt, a...)) -} - -func (g *Generator) PrintImport(alias, pkg string) { - statement := "import " + alias + " " + strconv.Quote(pkg) - if g.writtenImports[statement] { - return - } - g.P(statement) - g.writtenImports[statement] = true -} - -// In Indents the output one tab stop. -func (g *Generator) In() { g.indent += "\t" } - -// Out unindents the output one tab stop. -func (g *Generator) Out() { - if len(g.indent) > 0 { - g.indent = g.indent[1:] - } -} - -// GenerateAllFiles generates the output for all the files we're outputting. -func (g *Generator) GenerateAllFiles() { - // Initialize the plugins - for _, p := range plugins { - p.Init(g) - } - // Generate the output. The generator runs for every file, even the files - // that we don't generate output for, so that we can collate the full list - // of exported symbols to support public imports. - genFileMap := make(map[*FileDescriptor]bool, len(g.genFiles)) - for _, file := range g.genFiles { - genFileMap[file] = true - } - for _, file := range g.allFiles { - g.Reset() - g.writeOutput = genFileMap[file] - g.generate(file) - if !g.writeOutput { - continue - } - g.Response.File = append(g.Response.File, &plugin.CodeGeneratorResponse_File{ - Name: proto.String(file.goFileName()), - Content: proto.String(g.String()), - }) - } -} - -// Run all the plugins associated with the file. -func (g *Generator) runPlugins(file *FileDescriptor) { - for _, p := range plugins { - p.Generate(file) - } -} - -// FileOf return the FileDescriptor for this FileDescriptorProto. -func (g *Generator) FileOf(fd *descriptor.FileDescriptorProto) *FileDescriptor { - for _, file := range g.allFiles { - if file.FileDescriptorProto == fd { - return file - } - } - g.Fail("could not find file in table:", fd.GetName()) - return nil -} - -// Fill the response protocol buffer with the generated output for all the files we're -// supposed to generate. -func (g *Generator) generate(file *FileDescriptor) { - g.customImports = make([]string, 0) - g.file = g.FileOf(file.FileDescriptorProto) - g.usedPackages = make(map[string]bool) - - if g.file.index == 0 { - // For one file in the package, assert version compatibility. - g.P("// This is a compile-time assertion to ensure that this generated file") - g.P("// is compatible with the proto package it is being compiled against.") - g.P("// A compilation error at this line likely means your copy of the") - g.P("// proto package needs to be updated.") - if gogoproto.ImportsGoGoProto(file.FileDescriptorProto) { - g.P("const _ = ", g.Pkg["proto"], ".GoGoProtoPackageIsVersion", generatedCodeVersion, " // please upgrade the proto package") - } else { - g.P("const _ = ", g.Pkg["proto"], ".ProtoPackageIsVersion", generatedCodeVersion, " // please upgrade the proto package") - } - g.P() - } - // Reset on each file - g.writtenImports = make(map[string]bool) - for _, td := range g.file.imp { - g.generateImported(td) - } - for _, enum := range g.file.enum { - g.generateEnum(enum) - } - for _, desc := range g.file.desc { - // Don't generate virtual messages for maps. - if desc.GetOptions().GetMapEntry() { - continue - } - g.generateMessage(desc) - } - for _, ext := range g.file.ext { - g.generateExtension(ext) - } - g.generateInitFunction() - - // Run the plugins before the imports so we know which imports are necessary. - g.runPlugins(file) - - g.generateFileDescriptor(file) - - // Generate header and imports last, though they appear first in the output. - rem := g.Buffer - g.Buffer = new(bytes.Buffer) - g.generateHeader() - g.generateImports() - if !g.writeOutput { - return - } - g.Write(rem.Bytes()) - - // Reformat generated code. - fset := token.NewFileSet() - raw := g.Bytes() - ast, err := parser.ParseFile(fset, "", g, parser.ParseComments) - if err != nil { - // Print out the bad code with line numbers. - // This should never happen in practice, but it can while changing generated code, - // so consider this a debugging aid. - var src bytes.Buffer - s := bufio.NewScanner(bytes.NewReader(raw)) - for line := 1; s.Scan(); line++ { - fmt.Fprintf(&src, "%5d\t%s\n", line, s.Bytes()) - } - if serr := s.Err(); serr != nil { - g.Fail("bad Go source code was generated:", err.Error(), "\n"+string(raw)) - } else { - g.Fail("bad Go source code was generated:", err.Error(), "\n"+src.String()) - } - } - g.Reset() - err = (&printer.Config{Mode: printer.TabIndent | printer.UseSpaces, Tabwidth: 8}).Fprint(g, fset, ast) - if err != nil { - g.Fail("generated Go source code could not be reformatted:", err.Error()) - } -} - -// Generate the header, including package definition -func (g *Generator) generateHeader() { - g.P("// Code generated by protoc-gen-gogo.") - g.P("// source: ", *g.file.Name) - g.P("// DO NOT EDIT!") - g.P() - - name := g.file.PackageName() - - if g.file.index == 0 { - // Generate package docs for the first file in the package. - g.P("/*") - g.P("Package ", name, " is a generated protocol buffer package.") - g.P() - if loc, ok := g.file.comments[strconv.Itoa(packagePath)]; ok { - // not using g.PrintComments because this is a /* */ comment block. - text := strings.TrimSuffix(loc.GetLeadingComments(), "\n") - for _, line := range strings.Split(text, "\n") { - line = strings.TrimPrefix(line, " ") - // ensure we don't escape from the block comment - line = strings.Replace(line, "*/", "* /", -1) - g.P(line) - } - g.P() - } - var topMsgs []string - g.P("It is generated from these files:") - for _, f := range g.genFiles { - g.P("\t", f.Name) - for _, msg := range f.desc { - if msg.parent != nil { - continue - } - topMsgs = append(topMsgs, CamelCaseSlice(msg.TypeName())) - } - } - g.P() - g.P("It has these top-level messages:") - for _, msg := range topMsgs { - g.P("\t", msg) - } - g.P("*/") - } - - g.P("package ", name) - g.P() -} - -// PrintComments prints any comments from the source .proto file. -// The path is a comma-separated list of integers. -// It returns an indication of whether any comments were printed. -// See descriptor.proto for its format. -func (g *Generator) PrintComments(path string) bool { - if !g.writeOutput { - return false - } - if loc, ok := g.file.comments[path]; ok { - text := strings.TrimSuffix(loc.GetLeadingComments(), "\n") - for _, line := range strings.Split(text, "\n") { - g.P("// ", strings.TrimPrefix(line, " ")) - } - return true - } - return false -} - -// Comments returns any comments from the source .proto file and empty string if comments not found. -// The path is a comma-separated list of intergers. -// See descriptor.proto for its format. -func (g *Generator) Comments(path string) string { - loc, ok := g.file.comments[path] - if !ok { - return "" - } - text := strings.TrimSuffix(loc.GetLeadingComments(), "\n") - return text -} - -func (g *Generator) fileByName(filename string) *FileDescriptor { - return g.allFilesByName[filename] -} - -// weak returns whether the ith import of the current file is a weak import. -func (g *Generator) weak(i int32) bool { - for _, j := range g.file.WeakDependency { - if j == i { - return true - } - } - return false -} - -// Generate the imports -func (g *Generator) generateImports() { - // We almost always need a proto import. Rather than computing when we - // do, which is tricky when there's a plugin, just import it and - // reference it later. The same argument applies to the fmt and math packages. - if gogoproto.ImportsGoGoProto(g.file.FileDescriptorProto) { - g.PrintImport(g.Pkg["proto"], g.ImportPrefix+"github.com/gogo/protobuf/proto") - } else { - g.PrintImport(g.Pkg["proto"], g.ImportPrefix+"github.com/golang/protobuf/proto") - } - g.PrintImport(g.Pkg["fmt"], "fmt") - g.PrintImport(g.Pkg["math"], "math") - - for i, s := range g.file.Dependency { - fd := g.fileByName(s) - // Do not import our own package. - if fd.PackageName() == g.packageName { - continue - } - filename := fd.goFileName() - // By default, import path is the dirname of the Go filename. - importPath := path.Dir(filename) - if substitution, ok := g.ImportMap[s]; ok { - importPath = substitution - } - importPath = g.ImportPrefix + importPath - // Skip weak imports. - if g.weak(int32(i)) { - g.P("// skipping weak import ", fd.PackageName(), " ", strconv.Quote(importPath)) - continue - } - // We need to import all the dependencies, even if we don't reference them, - // because other code and tools depend on having the full transitive closure - // of protocol buffer types in the binary. - if _, ok := g.usedPackages[fd.PackageName()]; ok { - g.PrintImport(fd.PackageName(), importPath) - } else { - g.P("import _ ", strconv.Quote(importPath)) - } - } - g.P() - for _, s := range g.customImports { - s1 := strings.Map(badToUnderscore, s) - g.PrintImport(s1, s) - } - g.P() - // TODO: may need to worry about uniqueness across plugins - for _, p := range plugins { - p.GenerateImports(g.file) - g.P() - } - g.P("// Reference imports to suppress errors if they are not otherwise used.") - g.P("var _ = ", g.Pkg["proto"], ".Marshal") - g.P("var _ = ", g.Pkg["fmt"], ".Errorf") - g.P("var _ = ", g.Pkg["math"], ".Inf") - g.P() -} - -func (g *Generator) generateImported(id *ImportedDescriptor) { - // Don't generate public import symbols for files that we are generating - // code for, since those symbols will already be in this package. - // We can't simply avoid creating the ImportedDescriptor objects, - // because g.genFiles isn't populated at that stage. - tn := id.TypeName() - sn := tn[len(tn)-1] - df := g.FileOf(id.o.File()) - filename := *df.Name - for _, fd := range g.genFiles { - if *fd.Name == filename { - g.P("// Ignoring public import of ", sn, " from ", filename) - g.P() - return - } - } - g.P("// ", sn, " from public import ", filename) - g.usedPackages[df.PackageName()] = true - - for _, sym := range df.exported[id.o] { - sym.GenerateAlias(g, df.PackageName()) - } - - g.P() -} - -// Generate the enum definitions for this EnumDescriptor. -func (g *Generator) generateEnum(enum *EnumDescriptor) { - // The full type name - typeName := enum.alias() - // The full type name, CamelCased. - ccTypeName := CamelCaseSlice(typeName) - ccPrefix := enum.prefix() - - g.PrintComments(enum.path) - if !gogoproto.EnabledGoEnumPrefix(enum.file, enum.EnumDescriptorProto) { - ccPrefix = "" - } - g.P("type ", ccTypeName, " int32") - g.file.addExport(enum, enumSymbol{ccTypeName, enum.proto3()}) - g.P("const (") - g.In() - for i, e := range enum.Value { - g.PrintComments(fmt.Sprintf("%s,%d,%d", enum.path, enumValuePath, i)) - name := *e.Name - if gogoproto.IsEnumValueCustomName(e) { - name = gogoproto.GetEnumValueCustomName(e) - } - name = ccPrefix + name - - g.P(name, " ", ccTypeName, " = ", e.Number) - g.file.addExport(enum, constOrVarSymbol{name, "const", ccTypeName}) - } - g.Out() - g.P(")") - g.P("var ", ccTypeName, "_name = map[int32]string{") - g.In() - generated := make(map[int32]bool) // avoid duplicate values - for _, e := range enum.Value { - duplicate := "" - if _, present := generated[*e.Number]; present { - duplicate = "// Duplicate value: " - } - g.P(duplicate, e.Number, ": ", strconv.Quote(*e.Name), ",") - generated[*e.Number] = true - } - g.Out() - g.P("}") - g.P("var ", ccTypeName, "_value = map[string]int32{") - g.In() - for _, e := range enum.Value { - g.P(strconv.Quote(*e.Name), ": ", e.Number, ",") - } - g.Out() - g.P("}") - - if !enum.proto3() { - g.P("func (x ", ccTypeName, ") Enum() *", ccTypeName, " {") - g.In() - g.P("p := new(", ccTypeName, ")") - g.P("*p = x") - g.P("return p") - g.Out() - g.P("}") - } - - if gogoproto.IsGoEnumStringer(g.file.FileDescriptorProto, enum.EnumDescriptorProto) { - g.P("func (x ", ccTypeName, ") String() string {") - g.In() - g.P("return ", g.Pkg["proto"], ".EnumName(", ccTypeName, "_name, int32(x))") - g.Out() - g.P("}") - } - - if !enum.proto3() && !gogoproto.IsGoEnumStringer(g.file.FileDescriptorProto, enum.EnumDescriptorProto) { - g.P("func (x ", ccTypeName, ") MarshalJSON() ([]byte, error) {") - g.In() - g.P("return ", g.Pkg["proto"], ".MarshalJSONEnum(", ccTypeName, "_name, int32(x))") - g.Out() - g.P("}") - } - if !enum.proto3() { - g.P("func (x *", ccTypeName, ") UnmarshalJSON(data []byte) error {") - g.In() - g.P("value, err := ", g.Pkg["proto"], ".UnmarshalJSONEnum(", ccTypeName, `_value, data, "`, ccTypeName, `")`) - g.P("if err != nil {") - g.In() - g.P("return err") - g.Out() - g.P("}") - g.P("*x = ", ccTypeName, "(value)") - g.P("return nil") - g.Out() - g.P("}") - } - - var indexes []string - for m := enum.parent; m != nil; m = m.parent { - // XXX: skip groups? - indexes = append([]string{strconv.Itoa(m.index)}, indexes...) - } - indexes = append(indexes, strconv.Itoa(enum.index)) - g.P("func (", ccTypeName, ") EnumDescriptor() ([]byte, []int) { return ", g.file.VarName(), ", []int{", strings.Join(indexes, ", "), "} }") - if enum.file.GetPackage() == "google.protobuf" && enum.GetName() == "NullValue" { - g.P("func (", ccTypeName, `) XXX_WellKnownType() string { return "`, enum.GetName(), `" }`) - } - g.P() -} - -// The tag is a string like "varint,2,opt,name=fieldname,def=7" that -// identifies details of the field for the protocol buffer marshaling and unmarshaling -// code. The fields are: -// wire encoding -// protocol tag number -// opt,req,rep for optional, required, or repeated -// packed whether the encoding is "packed" (optional; repeated primitives only) -// name= the original declared name -// enum= the name of the enum type if it is an enum-typed field. -// proto3 if this field is in a proto3 message -// def= string representation of the default value, if any. -// The default value must be in a representation that can be used at run-time -// to generate the default value. Thus bools become 0 and 1, for instance. -func (g *Generator) goTag(message *Descriptor, field *descriptor.FieldDescriptorProto, wiretype string) string { - optrepreq := "" - switch { - case isOptional(field): - optrepreq = "opt" - case isRequired(field): - optrepreq = "req" - case isRepeated(field): - optrepreq = "rep" - } - var defaultValue string - if dv := field.DefaultValue; dv != nil { // set means an explicit default - defaultValue = *dv - // Some types need tweaking. - switch *field.Type { - case descriptor.FieldDescriptorProto_TYPE_BOOL: - if defaultValue == "true" { - defaultValue = "1" - } else { - defaultValue = "0" - } - case descriptor.FieldDescriptorProto_TYPE_STRING, - descriptor.FieldDescriptorProto_TYPE_BYTES: - // Nothing to do. Quoting is done for the whole tag. - case descriptor.FieldDescriptorProto_TYPE_ENUM: - // For enums we need to provide the integer constant. - obj := g.ObjectNamed(field.GetTypeName()) - if id, ok := obj.(*ImportedDescriptor); ok { - // It is an enum that was publicly imported. - // We need the underlying type. - obj = id.o - } - enum, ok := obj.(*EnumDescriptor) - if !ok { - log.Printf("obj is a %T", obj) - if id, ok := obj.(*ImportedDescriptor); ok { - log.Printf("id.o is a %T", id.o) - } - g.Fail("unknown enum type", CamelCaseSlice(obj.TypeName())) - } - defaultValue = enum.integerValueAsString(defaultValue) - } - defaultValue = ",def=" + defaultValue - } - enum := "" - if *field.Type == descriptor.FieldDescriptorProto_TYPE_ENUM { - // We avoid using obj.PackageName(), because we want to use the - // original (proto-world) package name. - obj := g.ObjectNamed(field.GetTypeName()) - if id, ok := obj.(*ImportedDescriptor); ok { - obj = id.o - } - enum = ",enum=" - if pkg := obj.File().GetPackage(); pkg != "" { - enum += pkg + "." - } - enum += CamelCaseSlice(obj.TypeName()) - } - packed := "" - if (field.Options != nil && field.Options.GetPacked()) || - // Per https://developers.google.com/protocol-buffers/docs/proto3#simple: - // "In proto3, repeated fields of scalar numeric types use packed encoding by default." - (message.proto3() && (field.Options == nil || field.Options.Packed == nil) && - isRepeated(field) && IsScalar(field)) { - packed = ",packed" - } - fieldName := field.GetName() - name := fieldName - if *field.Type == descriptor.FieldDescriptorProto_TYPE_GROUP { - // We must use the type name for groups instead of - // the field name to preserve capitalization. - // type_name in FieldDescriptorProto is fully-qualified, - // but we only want the local part. - name = *field.TypeName - if i := strings.LastIndex(name, "."); i >= 0 { - name = name[i+1:] - } - } - if json := field.GetJsonName(); json != "" && json != name { - // TODO: escaping might be needed, in which case - // perhaps this should be in its own "json" tag. - name += ",json=" + json - } - name = ",name=" + name - - embed := "" - if gogoproto.IsEmbed(field) { - embed = ",embedded=" + fieldName - } - - ctype := "" - if gogoproto.IsCustomType(field) { - ctype = ",customtype=" + gogoproto.GetCustomType(field) - } - - casttype := "" - if gogoproto.IsCastType(field) { - casttype = ",casttype=" + gogoproto.GetCastType(field) - } - - castkey := "" - if gogoproto.IsCastKey(field) { - castkey = ",castkey=" + gogoproto.GetCastKey(field) - } - - castvalue := "" - if gogoproto.IsCastValue(field) { - castvalue = ",castvalue=" + gogoproto.GetCastValue(field) - // record the original message type for jsonpb reconstruction - desc := g.ObjectNamed(field.GetTypeName()) - if d, ok := desc.(*Descriptor); ok && d.GetOptions().GetMapEntry() { - valueField := d.Field[1] - if valueField.IsMessage() { - castvalue += ",castvaluetype=" + strings.TrimPrefix(valueField.GetTypeName(), ".") - } - } - } - - if message.proto3() { - // We only need the extra tag for []byte fields; - // no need to add noise for the others. - if *field.Type != descriptor.FieldDescriptorProto_TYPE_MESSAGE && - *field.Type != descriptor.FieldDescriptorProto_TYPE_GROUP && - !field.IsRepeated() { - name += ",proto3" - } - } - oneof := "" - if field.OneofIndex != nil { - oneof = ",oneof" - } - stdtime := "" - if gogoproto.IsStdTime(field) { - stdtime = ",stdtime" - } - stdduration := "" - if gogoproto.IsStdDuration(field) { - stdduration = ",stdduration" - } - return strconv.Quote(fmt.Sprintf("%s,%d,%s%s%s%s%s%s%s%s%s%s%s%s%s", - wiretype, - field.GetNumber(), - optrepreq, - packed, - name, - enum, - oneof, - defaultValue, - embed, - ctype, - casttype, - castkey, - castvalue, - stdtime, - stdduration)) -} - -func needsStar(field *descriptor.FieldDescriptorProto, proto3 bool, allowOneOf bool) bool { - if isRepeated(field) && - (*field.Type != descriptor.FieldDescriptorProto_TYPE_MESSAGE) && - (*field.Type != descriptor.FieldDescriptorProto_TYPE_GROUP) { - return false - } - if *field.Type == descriptor.FieldDescriptorProto_TYPE_BYTES && !gogoproto.IsCustomType(field) { - return false - } - if !gogoproto.IsNullable(field) { - return false - } - if field.OneofIndex != nil && allowOneOf && - (*field.Type != descriptor.FieldDescriptorProto_TYPE_MESSAGE) && - (*field.Type != descriptor.FieldDescriptorProto_TYPE_GROUP) { - return false - } - if proto3 && - (*field.Type != descriptor.FieldDescriptorProto_TYPE_MESSAGE) && - (*field.Type != descriptor.FieldDescriptorProto_TYPE_GROUP) && - !gogoproto.IsCustomType(field) { - return false - } - return true -} - -// TypeName is the printed name appropriate for an item. If the object is in the current file, -// TypeName drops the package name and underscores the rest. -// Otherwise the object is from another package; and the result is the underscored -// package name followed by the item name. -// The result always has an initial capital. -func (g *Generator) TypeName(obj Object) string { - return g.DefaultPackageName(obj) + CamelCaseSlice(obj.TypeName()) -} - -// TypeNameWithPackage is like TypeName, but always includes the package -// name even if the object is in our own package. -func (g *Generator) TypeNameWithPackage(obj Object) string { - return obj.PackageName() + CamelCaseSlice(obj.TypeName()) -} - -// GoType returns a string representing the type name, and the wire type -func (g *Generator) GoType(message *Descriptor, field *descriptor.FieldDescriptorProto) (typ string, wire string) { - // TODO: Options. - switch *field.Type { - case descriptor.FieldDescriptorProto_TYPE_DOUBLE: - typ, wire = "float64", "fixed64" - case descriptor.FieldDescriptorProto_TYPE_FLOAT: - typ, wire = "float32", "fixed32" - case descriptor.FieldDescriptorProto_TYPE_INT64: - typ, wire = "int64", "varint" - case descriptor.FieldDescriptorProto_TYPE_UINT64: - typ, wire = "uint64", "varint" - case descriptor.FieldDescriptorProto_TYPE_INT32: - typ, wire = "int32", "varint" - case descriptor.FieldDescriptorProto_TYPE_UINT32: - typ, wire = "uint32", "varint" - case descriptor.FieldDescriptorProto_TYPE_FIXED64: - typ, wire = "uint64", "fixed64" - case descriptor.FieldDescriptorProto_TYPE_FIXED32: - typ, wire = "uint32", "fixed32" - case descriptor.FieldDescriptorProto_TYPE_BOOL: - typ, wire = "bool", "varint" - case descriptor.FieldDescriptorProto_TYPE_STRING: - typ, wire = "string", "bytes" - case descriptor.FieldDescriptorProto_TYPE_GROUP: - desc := g.ObjectNamed(field.GetTypeName()) - typ, wire = g.TypeName(desc), "group" - case descriptor.FieldDescriptorProto_TYPE_MESSAGE: - desc := g.ObjectNamed(field.GetTypeName()) - typ, wire = g.TypeName(desc), "bytes" - case descriptor.FieldDescriptorProto_TYPE_BYTES: - typ, wire = "[]byte", "bytes" - case descriptor.FieldDescriptorProto_TYPE_ENUM: - desc := g.ObjectNamed(field.GetTypeName()) - typ, wire = g.TypeName(desc), "varint" - case descriptor.FieldDescriptorProto_TYPE_SFIXED32: - typ, wire = "int32", "fixed32" - case descriptor.FieldDescriptorProto_TYPE_SFIXED64: - typ, wire = "int64", "fixed64" - case descriptor.FieldDescriptorProto_TYPE_SINT32: - typ, wire = "int32", "zigzag32" - case descriptor.FieldDescriptorProto_TYPE_SINT64: - typ, wire = "int64", "zigzag64" - default: - g.Fail("unknown type for", field.GetName()) - } - switch { - case gogoproto.IsCustomType(field) && gogoproto.IsCastType(field): - g.Fail(field.GetName() + " cannot be custom type and cast type") - case gogoproto.IsCustomType(field): - var packageName string - var err error - packageName, typ, err = getCustomType(field) - if err != nil { - g.Fail(err.Error()) - } - if len(packageName) > 0 { - g.customImports = append(g.customImports, packageName) - } - case gogoproto.IsCastType(field): - var packageName string - var err error - packageName, typ, err = getCastType(field) - if err != nil { - g.Fail(err.Error()) - } - if len(packageName) > 0 { - g.customImports = append(g.customImports, packageName) - } - case gogoproto.IsStdTime(field): - g.customImports = append(g.customImports, "time") - typ = "time.Time" - case gogoproto.IsStdDuration(field): - g.customImports = append(g.customImports, "time") - typ = "time.Duration" - } - if needsStar(field, g.file.proto3 && field.Extendee == nil, message != nil && message.allowOneof()) { - typ = "*" + typ - } - if isRepeated(field) { - typ = "[]" + typ - } - return -} - -// GoMapDescriptor is a full description of the map output struct. -type GoMapDescriptor struct { - GoType string - - KeyField *descriptor.FieldDescriptorProto - KeyAliasField *descriptor.FieldDescriptorProto - KeyTag string - - ValueField *descriptor.FieldDescriptorProto - ValueAliasField *descriptor.FieldDescriptorProto - ValueTag string -} - -func (g *Generator) GoMapType(d *Descriptor, field *descriptor.FieldDescriptorProto) *GoMapDescriptor { - if d == nil { - byName := g.ObjectNamed(field.GetTypeName()) - desc, ok := byName.(*Descriptor) - if byName == nil || !ok || !desc.GetOptions().GetMapEntry() { - g.Fail(fmt.Sprintf("field %s is not a map", field.GetTypeName())) - return nil - } - d = desc - } - - m := &GoMapDescriptor{ - KeyField: d.Field[0], - ValueField: d.Field[1], - } - - // Figure out the Go types and tags for the key and value types. - m.KeyAliasField, m.ValueAliasField = g.GetMapKeyField(field, m.KeyField), g.GetMapValueField(field, m.ValueField) - keyType, keyWire := g.GoType(d, m.KeyAliasField) - valType, valWire := g.GoType(d, m.ValueAliasField) - - m.KeyTag, m.ValueTag = g.goTag(d, m.KeyField, keyWire), g.goTag(d, m.ValueField, valWire) - - if gogoproto.IsCastType(field) { - var packageName string - var err error - packageName, typ, err := getCastType(field) - if err != nil { - g.Fail(err.Error()) - } - if len(packageName) > 0 { - g.customImports = append(g.customImports, packageName) - } - m.GoType = typ - return m - } - - // We don't use stars, except for message-typed values. - // Message and enum types are the only two possibly foreign types used in maps, - // so record their use. They are not permitted as map keys. - keyType = strings.TrimPrefix(keyType, "*") - switch *m.ValueAliasField.Type { - case descriptor.FieldDescriptorProto_TYPE_ENUM: - valType = strings.TrimPrefix(valType, "*") - g.RecordTypeUse(m.ValueAliasField.GetTypeName()) - case descriptor.FieldDescriptorProto_TYPE_MESSAGE: - if !gogoproto.IsNullable(m.ValueAliasField) { - valType = strings.TrimPrefix(valType, "*") - } - if !gogoproto.IsStdTime(field) && !gogoproto.IsStdDuration(field) { - g.RecordTypeUse(m.ValueAliasField.GetTypeName()) - } - default: - if gogoproto.IsCustomType(m.ValueAliasField) { - if !gogoproto.IsNullable(m.ValueAliasField) { - valType = strings.TrimPrefix(valType, "*") - } - g.RecordTypeUse(m.ValueAliasField.GetTypeName()) - } else { - valType = strings.TrimPrefix(valType, "*") - } - } - - m.GoType = fmt.Sprintf("map[%s]%s", keyType, valType) - return m -} - -func (g *Generator) RecordTypeUse(t string) { - if obj, ok := g.typeNameToObject[t]; ok { - // Call ObjectNamed to get the true object to record the use. - obj = g.ObjectNamed(t) - g.usedPackages[obj.PackageName()] = true - } -} - -// Method names that may be generated. Fields with these names get an -// underscore appended. Any change to this set is a potential incompatible -// API change because it changes generated field names. -var methodNames = [...]string{ - "Reset", - "String", - "ProtoMessage", - "Marshal", - "Unmarshal", - "ExtensionRangeArray", - "ExtensionMap", - "Descriptor", - "MarshalTo", - "Equal", - "VerboseEqual", - "GoString", - "ProtoSize", -} - -// Names of messages in the `google.protobuf` package for which -// we will generate XXX_WellKnownType methods. -var wellKnownTypes = map[string]bool{ - "Any": true, - "Duration": true, - "Empty": true, - "Struct": true, - "Timestamp": true, - - "Value": true, - "ListValue": true, - "DoubleValue": true, - "FloatValue": true, - "Int64Value": true, - "UInt64Value": true, - "Int32Value": true, - "UInt32Value": true, - "BoolValue": true, - "StringValue": true, - "BytesValue": true, -} - -// Generate the type and default constant definitions for this Descriptor. -func (g *Generator) generateMessage(message *Descriptor) { - // The full type name - typeName := message.TypeName() - // The full type name, CamelCased. - ccTypeName := CamelCaseSlice(typeName) - - usedNames := make(map[string]bool) - for _, n := range methodNames { - usedNames[n] = true - } - if !gogoproto.IsProtoSizer(message.file, message.DescriptorProto) { - usedNames["Size"] = true - } - fieldNames := make(map[*descriptor.FieldDescriptorProto]string) - fieldGetterNames := make(map[*descriptor.FieldDescriptorProto]string) - fieldTypes := make(map[*descriptor.FieldDescriptorProto]string) - mapFieldTypes := make(map[*descriptor.FieldDescriptorProto]string) - - oneofFieldName := make(map[int32]string) // indexed by oneof_index field of FieldDescriptorProto - oneofDisc := make(map[int32]string) // name of discriminator method - oneofTypeName := make(map[*descriptor.FieldDescriptorProto]string) // without star - oneofInsertPoints := make(map[int32]int) // oneof_index => offset of g.Buffer - - g.PrintComments(message.path) - g.P("type ", ccTypeName, " struct {") - g.In() - - // allocNames finds a conflict-free variation of the given strings, - // consistently mutating their suffixes. - // It returns the same number of strings. - allocNames := func(ns ...string) []string { - Loop: - for { - for _, n := range ns { - if usedNames[n] { - for i := range ns { - ns[i] += "_" - } - continue Loop - } - } - for _, n := range ns { - usedNames[n] = true - } - return ns - } - } - - for i, field := range message.Field { - // Allocate the getter and the field at the same time so name - // collisions create field/method consistent names. - // TODO: This allocation occurs based on the order of the fields - // in the proto file, meaning that a change in the field - // ordering can change generated Method/Field names. - base := CamelCase(*field.Name) - if gogoproto.IsCustomName(field) { - base = gogoproto.GetCustomName(field) - } - ns := allocNames(base, "Get"+base) - fieldName, fieldGetterName := ns[0], ns[1] - typename, wiretype := g.GoType(message, field) - jsonName := *field.Name - jsonTag := jsonName + ",omitempty" - repeatedNativeType := (!field.IsMessage() && !gogoproto.IsCustomType(field) && field.IsRepeated()) - if !gogoproto.IsNullable(field) && !repeatedNativeType { - jsonTag = jsonName - } - gogoJsonTag := gogoproto.GetJsonTag(field) - if gogoJsonTag != nil { - jsonTag = *gogoJsonTag - } - gogoMoreTags := gogoproto.GetMoreTags(field) - moreTags := "" - if gogoMoreTags != nil { - moreTags = " " + *gogoMoreTags - } - tag := fmt.Sprintf("protobuf:%s json:%q%s", g.goTag(message, field, wiretype), jsonTag, moreTags) - fieldNames[field] = fieldName - fieldGetterNames[field] = fieldGetterName - if *field.Type == descriptor.FieldDescriptorProto_TYPE_MESSAGE && gogoproto.IsEmbed(field) { - fieldName = "" - } - - oneof := field.OneofIndex != nil && message.allowOneof() - if oneof && oneofFieldName[*field.OneofIndex] == "" { - odp := message.OneofDecl[int(*field.OneofIndex)] - fname := allocNames(CamelCase(odp.GetName()))[0] - - // This is the first field of a oneof we haven't seen before. - // Generate the union field. - com := g.PrintComments(fmt.Sprintf("%s,%d,%d", message.path, messageOneofPath, *field.OneofIndex)) - if com { - g.P("//") - } - g.P("// Types that are valid to be assigned to ", fname, ":") - // Generate the rest of this comment later, - // when we've computed any disambiguation. - oneofInsertPoints[*field.OneofIndex] = g.Buffer.Len() - - dname := "is" + ccTypeName + "_" + fname - oneofFieldName[*field.OneofIndex] = fname - oneofDisc[*field.OneofIndex] = dname - otag := `protobuf_oneof:"` + odp.GetName() + `"` - g.P(fname, " ", dname, " `", otag, "`") - } - - if *field.Type == descriptor.FieldDescriptorProto_TYPE_MESSAGE { - desc := g.ObjectNamed(field.GetTypeName()) - if d, ok := desc.(*Descriptor); ok && d.GetOptions().GetMapEntry() { - m := g.GoMapType(d, field) - typename = m.GoType - mapFieldTypes[field] = typename // record for the getter generation - - tag += fmt.Sprintf(" protobuf_key:%s protobuf_val:%s", m.KeyTag, m.ValueTag) - } - } - - fieldTypes[field] = typename - - if oneof { - tname := ccTypeName + "_" + fieldName - // It is possible for this to collide with a message or enum - // nested in this message. Check for collisions. - for { - ok := true - for _, desc := range message.nested { - if CamelCaseSlice(desc.TypeName()) == tname { - ok = false - break - } - } - for _, enum := range message.enums { - if CamelCaseSlice(enum.TypeName()) == tname { - ok = false - break - } - } - if !ok { - tname += "_" - continue - } - break - } - - oneofTypeName[field] = tname - continue - } - - g.PrintComments(fmt.Sprintf("%s,%d,%d", message.path, messageFieldPath, i)) - g.P(fieldName, "\t", typename, "\t`", tag, "`") - if !gogoproto.IsStdTime(field) && !gogoproto.IsStdDuration(field) { - g.RecordTypeUse(field.GetTypeName()) - } - } - if len(message.ExtensionRange) > 0 { - if gogoproto.HasExtensionsMap(g.file.FileDescriptorProto, message.DescriptorProto) { - g.P(g.Pkg["proto"], ".XXX_InternalExtensions `json:\"-\"`") - } else { - g.P("XXX_extensions\t\t[]byte `protobuf:\"bytes,0,opt\" json:\"-\"`") - } - } - if gogoproto.HasUnrecognized(g.file.FileDescriptorProto, message.DescriptorProto) && !message.proto3() { - g.P("XXX_unrecognized\t[]byte `json:\"-\"`") - } - g.Out() - g.P("}") - - // Update g.Buffer to list valid oneof types. - // We do this down here, after we've disambiguated the oneof type names. - // We go in reverse order of insertion point to avoid invalidating offsets. - for oi := int32(len(message.OneofDecl)); oi >= 0; oi-- { - ip := oneofInsertPoints[oi] - all := g.Buffer.Bytes() - rem := all[ip:] - g.Buffer = bytes.NewBuffer(all[:ip:ip]) // set cap so we don't scribble on rem - for _, field := range message.Field { - if field.OneofIndex == nil || *field.OneofIndex != oi { - continue - } - g.P("//\t*", oneofTypeName[field]) - } - g.Buffer.Write(rem) - } - - // Reset, String and ProtoMessage methods. - g.P("func (m *", ccTypeName, ") Reset() { *m = ", ccTypeName, "{} }") - if gogoproto.EnabledGoStringer(g.file.FileDescriptorProto, message.DescriptorProto) { - g.P("func (m *", ccTypeName, ") String() string { return ", g.Pkg["proto"], ".CompactTextString(m) }") - } - g.P("func (*", ccTypeName, ") ProtoMessage() {}") - var indexes []string - for m := message; m != nil; m = m.parent { - indexes = append([]string{strconv.Itoa(m.index)}, indexes...) - } - g.P("func (*", ccTypeName, ") Descriptor() ([]byte, []int) { return ", g.file.VarName(), ", []int{", strings.Join(indexes, ", "), "} }") - // TODO: Revisit the decision to use a XXX_WellKnownType method - // if we change proto.MessageName to work with multiple equivalents. - if message.file.GetPackage() == "google.protobuf" && wellKnownTypes[message.GetName()] { - g.P("func (*", ccTypeName, `) XXX_WellKnownType() string { return "`, message.GetName(), `" }`) - } - // Extension support methods - var hasExtensions, isMessageSet bool - if len(message.ExtensionRange) > 0 { - hasExtensions = true - // message_set_wire_format only makes sense when extensions are defined. - if opts := message.Options; opts != nil && opts.GetMessageSetWireFormat() { - isMessageSet = true - g.P() - g.P("func (m *", ccTypeName, ") Marshal() ([]byte, error) {") - g.In() - g.P("return ", g.Pkg["proto"], ".MarshalMessageSet(&m.XXX_InternalExtensions)") - g.Out() - g.P("}") - g.P("func (m *", ccTypeName, ") Unmarshal(buf []byte) error {") - g.In() - g.P("return ", g.Pkg["proto"], ".UnmarshalMessageSet(buf, &m.XXX_InternalExtensions)") - g.Out() - g.P("}") - g.P("func (m *", ccTypeName, ") MarshalJSON() ([]byte, error) {") - g.In() - g.P("return ", g.Pkg["proto"], ".MarshalMessageSetJSON(&m.XXX_InternalExtensions)") - g.Out() - g.P("}") - g.P("func (m *", ccTypeName, ") UnmarshalJSON(buf []byte) error {") - g.In() - g.P("return ", g.Pkg["proto"], ".UnmarshalMessageSetJSON(buf, &m.XXX_InternalExtensions)") - g.Out() - g.P("}") - g.P("// ensure ", ccTypeName, " satisfies proto.Marshaler and proto.Unmarshaler") - g.P("var _ ", g.Pkg["proto"], ".Marshaler = (*", ccTypeName, ")(nil)") - g.P("var _ ", g.Pkg["proto"], ".Unmarshaler = (*", ccTypeName, ")(nil)") - } - - g.P() - g.P("var extRange_", ccTypeName, " = []", g.Pkg["proto"], ".ExtensionRange{") - g.In() - for _, r := range message.ExtensionRange { - end := fmt.Sprint(*r.End - 1) // make range inclusive on both ends - g.P("{Start: ", r.Start, ", End: ", end, "},") - } - g.Out() - g.P("}") - g.P("func (*", ccTypeName, ") ExtensionRangeArray() []", g.Pkg["proto"], ".ExtensionRange {") - g.In() - g.P("return extRange_", ccTypeName) - g.Out() - g.P("}") - if !gogoproto.HasExtensionsMap(g.file.FileDescriptorProto, message.DescriptorProto) { - g.P("func (m *", ccTypeName, ") GetExtensions() *[]byte {") - g.In() - g.P("if m.XXX_extensions == nil {") - g.In() - g.P("m.XXX_extensions = make([]byte, 0)") - g.Out() - g.P("}") - g.P("return &m.XXX_extensions") - g.Out() - g.P("}") - } - } - - // Default constants - defNames := make(map[*descriptor.FieldDescriptorProto]string) - for _, field := range message.Field { - def := field.GetDefaultValue() - if def == "" { - continue - } - if !gogoproto.IsNullable(field) { - g.Fail("illegal default value: ", field.GetName(), " in ", message.GetName(), " is not nullable and is thus not allowed to have a default value") - } - fieldname := "Default_" + ccTypeName + "_" + CamelCase(*field.Name) - defNames[field] = fieldname - typename, _ := g.GoType(message, field) - if typename[0] == '*' { - typename = typename[1:] - } - kind := "const " - switch { - case typename == "bool": - case typename == "string": - def = strconv.Quote(def) - case typename == "[]byte": - def = "[]byte(" + strconv.Quote(def) + ")" - kind = "var " - case def == "inf", def == "-inf", def == "nan": - // These names are known to, and defined by, the protocol language. - switch def { - case "inf": - def = "math.Inf(1)" - case "-inf": - def = "math.Inf(-1)" - case "nan": - def = "math.NaN()" - } - if *field.Type == descriptor.FieldDescriptorProto_TYPE_FLOAT { - def = "float32(" + def + ")" - } - kind = "var " - case *field.Type == descriptor.FieldDescriptorProto_TYPE_ENUM: - // Must be an enum. Need to construct the prefixed name. - obj := g.ObjectNamed(field.GetTypeName()) - var enum *EnumDescriptor - if id, ok := obj.(*ImportedDescriptor); ok { - // The enum type has been publicly imported. - enum, _ = id.o.(*EnumDescriptor) - } else { - enum, _ = obj.(*EnumDescriptor) - } - if enum == nil { - log.Printf("don't know how to generate constant for %s", fieldname) - continue - } - - // hunt down the actual enum corresponding to the default - var enumValue *descriptor.EnumValueDescriptorProto - for _, ev := range enum.Value { - if def == ev.GetName() { - enumValue = ev - } - } - - if enumValue != nil { - if gogoproto.IsEnumValueCustomName(enumValue) { - def = gogoproto.GetEnumValueCustomName(enumValue) - } - } else { - g.Fail(fmt.Sprintf("could not resolve default enum value for %v.%v", - g.DefaultPackageName(obj), def)) - - } - - if gogoproto.EnabledGoEnumPrefix(enum.file, enum.EnumDescriptorProto) { - def = g.DefaultPackageName(obj) + enum.prefix() + def - } else { - def = g.DefaultPackageName(obj) + def - } - } - g.P(kind, fieldname, " ", typename, " = ", def) - g.file.addExport(message, constOrVarSymbol{fieldname, kind, ""}) - } - g.P() - - // Oneof per-field types, discriminants and getters. - if message.allowOneof() { - // Generate unexported named types for the discriminant interfaces. - // We shouldn't have to do this, but there was (~19 Aug 2015) a compiler/linker bug - // that was triggered by using anonymous interfaces here. - // TODO: Revisit this and consider reverting back to anonymous interfaces. - for oi := range message.OneofDecl { - dname := oneofDisc[int32(oi)] - g.P("type ", dname, " interface {") - g.In() - g.P(dname, "()") - if gogoproto.HasEqual(g.file.FileDescriptorProto, message.DescriptorProto) { - g.P(`Equal(interface{}) bool`) - } - if gogoproto.HasVerboseEqual(g.file.FileDescriptorProto, message.DescriptorProto) { - g.P(`VerboseEqual(interface{}) error`) - } - if gogoproto.IsMarshaler(g.file.FileDescriptorProto, message.DescriptorProto) || - gogoproto.IsUnsafeMarshaler(g.file.FileDescriptorProto, message.DescriptorProto) { - g.P(`MarshalTo([]byte) (int, error)`) - } - if gogoproto.IsSizer(g.file.FileDescriptorProto, message.DescriptorProto) { - g.P(`Size() int`) - } - if gogoproto.IsProtoSizer(g.file.FileDescriptorProto, message.DescriptorProto) { - g.P(`ProtoSize() int`) - } - g.Out() - g.P("}") - } - g.P() - for _, field := range message.Field { - if field.OneofIndex == nil { - continue - } - _, wiretype := g.GoType(message, field) - tag := "protobuf:" + g.goTag(message, field, wiretype) - g.P("type ", oneofTypeName[field], " struct{ ", fieldNames[field], " ", fieldTypes[field], " `", tag, "` }") - if !gogoproto.IsStdTime(field) && !gogoproto.IsStdDuration(field) { - g.RecordTypeUse(field.GetTypeName()) - } - } - g.P() - for _, field := range message.Field { - if field.OneofIndex == nil { - continue - } - g.P("func (*", oneofTypeName[field], ") ", oneofDisc[*field.OneofIndex], "() {}") - } - g.P() - for oi := range message.OneofDecl { - fname := oneofFieldName[int32(oi)] - g.P("func (m *", ccTypeName, ") Get", fname, "() ", oneofDisc[int32(oi)], " {") - g.P("if m != nil { return m.", fname, " }") - g.P("return nil") - g.P("}") - } - g.P() - } - - // Field getters - var getters []getterSymbol - for _, field := range message.Field { - oneof := field.OneofIndex != nil && message.allowOneof() - if !oneof && !gogoproto.HasGoGetters(g.file.FileDescriptorProto, message.DescriptorProto) { - continue - } - if gogoproto.IsEmbed(field) || gogoproto.IsCustomType(field) { - continue - } - fname := fieldNames[field] - typename, _ := g.GoType(message, field) - if t, ok := mapFieldTypes[field]; ok { - typename = t - } - mname := fieldGetterNames[field] - star := "" - if (*field.Type != descriptor.FieldDescriptorProto_TYPE_MESSAGE) && - (*field.Type != descriptor.FieldDescriptorProto_TYPE_GROUP) && - needsStar(field, g.file.proto3, message != nil && message.allowOneof()) && typename[0] == '*' { - typename = typename[1:] - star = "*" - } - - // Only export getter symbols for basic types, - // and for messages and enums in the same package. - // Groups are not exported. - // Foreign types can't be hoisted through a public import because - // the importer may not already be importing the defining .proto. - // As an example, imagine we have an import tree like this: - // A.proto -> B.proto -> C.proto - // If A publicly imports B, we need to generate the getters from B in A's output, - // but if one such getter returns something from C then we cannot do that - // because A is not importing C already. - var getter, genType bool - switch *field.Type { - case descriptor.FieldDescriptorProto_TYPE_GROUP: - getter = false - case descriptor.FieldDescriptorProto_TYPE_MESSAGE, descriptor.FieldDescriptorProto_TYPE_ENUM: - // Only export getter if its return type is in this package. - getter = g.ObjectNamed(field.GetTypeName()).PackageName() == message.PackageName() - genType = true - default: - getter = true - } - if getter { - getters = append(getters, getterSymbol{ - name: mname, - typ: typename, - typeName: field.GetTypeName(), - genType: genType, - }) - } - - g.P("func (m *", ccTypeName, ") "+mname+"() "+typename+" {") - g.In() - def, hasDef := defNames[field] - typeDefaultIsNil := false // whether this field type's default value is a literal nil unless specified - switch *field.Type { - case descriptor.FieldDescriptorProto_TYPE_BYTES: - typeDefaultIsNil = !hasDef - case descriptor.FieldDescriptorProto_TYPE_GROUP, descriptor.FieldDescriptorProto_TYPE_MESSAGE: - typeDefaultIsNil = gogoproto.IsNullable(field) - } - if isRepeated(field) { - typeDefaultIsNil = true - } - if typeDefaultIsNil && !oneof { - // A bytes field with no explicit default needs less generated code, - // as does a message or group field, or a repeated field. - g.P("if m != nil {") - g.In() - g.P("return m." + fname) - g.Out() - g.P("}") - g.P("return nil") - g.Out() - g.P("}") - g.P() - continue - } - if !gogoproto.IsNullable(field) { - g.P("if m != nil {") - g.In() - g.P("return m." + fname) - g.Out() - g.P("}") - } else if !oneof { - if message.proto3() { - g.P("if m != nil {") - } else { - g.P("if m != nil && m." + fname + " != nil {") - } - g.In() - g.P("return " + star + "m." + fname) - g.Out() - g.P("}") - } else { - uname := oneofFieldName[*field.OneofIndex] - tname := oneofTypeName[field] - g.P("if x, ok := m.Get", uname, "().(*", tname, "); ok {") - g.P("return x.", fname) - g.P("}") - } - if hasDef { - if *field.Type != descriptor.FieldDescriptorProto_TYPE_BYTES { - g.P("return " + def) - } else { - // The default is a []byte var. - // Make a copy when returning it to be safe. - g.P("return append([]byte(nil), ", def, "...)") - } - } else { - switch *field.Type { - case descriptor.FieldDescriptorProto_TYPE_GROUP, - descriptor.FieldDescriptorProto_TYPE_MESSAGE: - if field.OneofIndex != nil { - g.P(`return nil`) - } else { - goTyp, _ := g.GoType(message, field) - goTypName := GoTypeToName(goTyp) - if !gogoproto.IsNullable(field) && gogoproto.IsStdDuration(field) { - g.P("return 0") - } else { - g.P("return ", goTypName, "{}") - } - } - case descriptor.FieldDescriptorProto_TYPE_BOOL: - g.P("return false") - case descriptor.FieldDescriptorProto_TYPE_STRING: - g.P(`return ""`) - case descriptor.FieldDescriptorProto_TYPE_BYTES: - // This is only possible for oneof fields. - g.P("return nil") - case descriptor.FieldDescriptorProto_TYPE_ENUM: - // The default default for an enum is the first value in the enum, - // not zero. - obj := g.ObjectNamed(field.GetTypeName()) - var enum *EnumDescriptor - if id, ok := obj.(*ImportedDescriptor); ok { - // The enum type has been publicly imported. - enum, _ = id.o.(*EnumDescriptor) - } else { - enum, _ = obj.(*EnumDescriptor) - } - if enum == nil { - log.Printf("don't know how to generate getter for %s", field.GetName()) - continue - } - if len(enum.Value) == 0 { - g.P("return 0 // empty enum") - } else { - first := enum.Value[0].GetName() - if gogoproto.IsEnumValueCustomName(enum.Value[0]) { - first = gogoproto.GetEnumValueCustomName(enum.Value[0]) - } - - if gogoproto.EnabledGoEnumPrefix(enum.file, enum.EnumDescriptorProto) { - g.P("return ", g.DefaultPackageName(obj)+enum.prefix()+first) - } else { - g.P("return ", g.DefaultPackageName(obj)+first) - } - } - default: - g.P("return 0") - } - } - g.Out() - g.P("}") - g.P() - } - - if !message.group { - ms := &messageSymbol{ - sym: ccTypeName, - hasExtensions: hasExtensions, - isMessageSet: isMessageSet, - hasOneof: len(message.OneofDecl) > 0, - getters: getters, - } - g.file.addExport(message, ms) - } - - // Oneof functions - if len(message.OneofDecl) > 0 && message.allowOneof() { - fieldWire := make(map[*descriptor.FieldDescriptorProto]string) - - // method - enc := "_" + ccTypeName + "_OneofMarshaler" - dec := "_" + ccTypeName + "_OneofUnmarshaler" - size := "_" + ccTypeName + "_OneofSizer" - encSig := "(msg " + g.Pkg["proto"] + ".Message, b *" + g.Pkg["proto"] + ".Buffer) error" - decSig := "(msg " + g.Pkg["proto"] + ".Message, tag, wire int, b *" + g.Pkg["proto"] + ".Buffer) (bool, error)" - sizeSig := "(msg " + g.Pkg["proto"] + ".Message) (n int)" - - g.P("// XXX_OneofFuncs is for the internal use of the proto package.") - g.P("func (*", ccTypeName, ") XXX_OneofFuncs() (func", encSig, ", func", decSig, ", func", sizeSig, ", []interface{}) {") - g.P("return ", enc, ", ", dec, ", ", size, ", []interface{}{") - for _, field := range message.Field { - if field.OneofIndex == nil { - continue - } - g.P("(*", oneofTypeName[field], ")(nil),") - } - g.P("}") - g.P("}") - g.P() - - // marshaler - g.P("func ", enc, encSig, " {") - g.P("m := msg.(*", ccTypeName, ")") - for oi, odp := range message.OneofDecl { - g.P("// ", odp.GetName()) - fname := oneofFieldName[int32(oi)] - g.P("switch x := m.", fname, ".(type) {") - for _, field := range message.Field { - if field.OneofIndex == nil || int(*field.OneofIndex) != oi { - continue - } - g.P("case *", oneofTypeName[field], ":") - var wire, pre, post string - val := "x." + fieldNames[field] // overridden for TYPE_BOOL - canFail := false // only TYPE_MESSAGE and TYPE_GROUP can fail - switch *field.Type { - case descriptor.FieldDescriptorProto_TYPE_DOUBLE: - wire = "WireFixed64" - pre = "b.EncodeFixed64(" + g.Pkg["math"] + ".Float64bits(" - post = "))" - case descriptor.FieldDescriptorProto_TYPE_FLOAT: - wire = "WireFixed32" - pre = "b.EncodeFixed32(uint64(" + g.Pkg["math"] + ".Float32bits(" - post = ")))" - case descriptor.FieldDescriptorProto_TYPE_INT64, - descriptor.FieldDescriptorProto_TYPE_UINT64: - wire = "WireVarint" - pre, post = "b.EncodeVarint(uint64(", "))" - case descriptor.FieldDescriptorProto_TYPE_INT32, - descriptor.FieldDescriptorProto_TYPE_UINT32, - descriptor.FieldDescriptorProto_TYPE_ENUM: - wire = "WireVarint" - pre, post = "b.EncodeVarint(uint64(", "))" - case descriptor.FieldDescriptorProto_TYPE_FIXED64, - descriptor.FieldDescriptorProto_TYPE_SFIXED64: - wire = "WireFixed64" - pre, post = "b.EncodeFixed64(uint64(", "))" - case descriptor.FieldDescriptorProto_TYPE_FIXED32, - descriptor.FieldDescriptorProto_TYPE_SFIXED32: - wire = "WireFixed32" - pre, post = "b.EncodeFixed32(uint64(", "))" - case descriptor.FieldDescriptorProto_TYPE_BOOL: - // bool needs special handling. - g.P("t := uint64(0)") - g.P("if ", val, " { t = 1 }") - val = "t" - wire = "WireVarint" - pre, post = "b.EncodeVarint(", ")" - case descriptor.FieldDescriptorProto_TYPE_STRING: - wire = "WireBytes" - pre, post = "b.EncodeStringBytes(", ")" - case descriptor.FieldDescriptorProto_TYPE_GROUP: - wire = "WireStartGroup" - pre, post = "b.Marshal(", ")" - canFail = true - case descriptor.FieldDescriptorProto_TYPE_MESSAGE: - wire = "WireBytes" - pre, post = "b.EncodeMessage(", ")" - canFail = true - case descriptor.FieldDescriptorProto_TYPE_BYTES: - wire = "WireBytes" - pre, post = "b.EncodeRawBytes(", ")" - case descriptor.FieldDescriptorProto_TYPE_SINT32: - wire = "WireVarint" - pre, post = "b.EncodeZigzag32(uint64(", "))" - case descriptor.FieldDescriptorProto_TYPE_SINT64: - wire = "WireVarint" - pre, post = "b.EncodeZigzag64(uint64(", "))" - default: - g.Fail("unhandled oneof field type ", field.Type.String()) - } - fieldWire[field] = wire - g.P("_ = b.EncodeVarint(", field.Number, "<<3|", g.Pkg["proto"], ".", wire, ")") - if *field.Type == descriptor.FieldDescriptorProto_TYPE_BYTES && gogoproto.IsCustomType(field) { - g.P(`dAtA, err := `, val, `.Marshal()`) - g.P(`if err != nil {`) - g.In() - g.P(`return err`) - g.Out() - g.P(`}`) - val = "dAtA" - } else if gogoproto.IsStdTime(field) { - pkg := g.useTypes() - if gogoproto.IsNullable(field) { - g.P(`dAtA, err := `, pkg, `.StdTimeMarshal(*`, val, `)`) - } else { - g.P(`dAtA, err := `, pkg, `.StdTimeMarshal(`, val, `)`) - } - g.P(`if err != nil {`) - g.In() - g.P(`return err`) - g.Out() - g.P(`}`) - val = "dAtA" - pre, post = "b.EncodeRawBytes(", ")" - } else if gogoproto.IsStdDuration(field) { - pkg := g.useTypes() - if gogoproto.IsNullable(field) { - g.P(`dAtA, err := `, pkg, `.StdDurationMarshal(*`, val, `)`) - } else { - g.P(`dAtA, err := `, pkg, `.StdDurationMarshal(`, val, `)`) - } - g.P(`if err != nil {`) - g.In() - g.P(`return err`) - g.Out() - g.P(`}`) - val = "dAtA" - pre, post = "b.EncodeRawBytes(", ")" - } - if !canFail { - g.P("_ = ", pre, val, post) - } else { - g.P("if err := ", pre, val, post, "; err != nil {") - g.In() - g.P("return err") - g.Out() - g.P("}") - } - if *field.Type == descriptor.FieldDescriptorProto_TYPE_GROUP { - g.P("_ = b.EncodeVarint(", field.Number, "<<3|", g.Pkg["proto"], ".WireEndGroup)") - } - } - g.P("case nil:") - g.P("default: return ", g.Pkg["fmt"], `.Errorf("`, ccTypeName, ".", fname, ` has unexpected type %T", x)`) - g.P("}") - } - g.P("return nil") - g.P("}") - g.P() - - // unmarshaler - g.P("func ", dec, decSig, " {") - g.P("m := msg.(*", ccTypeName, ")") - g.P("switch tag {") - for _, field := range message.Field { - if field.OneofIndex == nil { - continue - } - odp := message.OneofDecl[int(*field.OneofIndex)] - g.P("case ", field.Number, ": // ", odp.GetName(), ".", *field.Name) - g.P("if wire != ", g.Pkg["proto"], ".", fieldWire[field], " {") - g.P("return true, ", g.Pkg["proto"], ".ErrInternalBadWireType") - g.P("}") - lhs := "x, err" // overridden for TYPE_MESSAGE and TYPE_GROUP - var dec, cast, cast2 string - switch *field.Type { - case descriptor.FieldDescriptorProto_TYPE_DOUBLE: - dec, cast = "b.DecodeFixed64()", g.Pkg["math"]+".Float64frombits" - case descriptor.FieldDescriptorProto_TYPE_FLOAT: - dec, cast, cast2 = "b.DecodeFixed32()", "uint32", g.Pkg["math"]+".Float32frombits" - case descriptor.FieldDescriptorProto_TYPE_INT64: - dec, cast = "b.DecodeVarint()", "int64" - case descriptor.FieldDescriptorProto_TYPE_UINT64: - dec = "b.DecodeVarint()" - case descriptor.FieldDescriptorProto_TYPE_INT32: - dec, cast = "b.DecodeVarint()", "int32" - case descriptor.FieldDescriptorProto_TYPE_FIXED64: - dec = "b.DecodeFixed64()" - case descriptor.FieldDescriptorProto_TYPE_FIXED32: - dec, cast = "b.DecodeFixed32()", "uint32" - case descriptor.FieldDescriptorProto_TYPE_BOOL: - dec = "b.DecodeVarint()" - // handled specially below - case descriptor.FieldDescriptorProto_TYPE_STRING: - dec = "b.DecodeStringBytes()" - case descriptor.FieldDescriptorProto_TYPE_GROUP: - g.P("msg := new(", fieldTypes[field][1:], ")") // drop star - lhs = "err" - dec = "b.DecodeGroup(msg)" - // handled specially below - case descriptor.FieldDescriptorProto_TYPE_MESSAGE: - if gogoproto.IsStdTime(field) || gogoproto.IsStdDuration(field) { - dec = "b.DecodeRawBytes(true)" - } else { - g.P("msg := new(", fieldTypes[field][1:], ")") // drop star - lhs = "err" - dec = "b.DecodeMessage(msg)" - } - // handled specially below - case descriptor.FieldDescriptorProto_TYPE_BYTES: - dec = "b.DecodeRawBytes(true)" - case descriptor.FieldDescriptorProto_TYPE_UINT32: - dec, cast = "b.DecodeVarint()", "uint32" - case descriptor.FieldDescriptorProto_TYPE_ENUM: - dec, cast = "b.DecodeVarint()", fieldTypes[field] - case descriptor.FieldDescriptorProto_TYPE_SFIXED32: - dec, cast = "b.DecodeFixed32()", "int32" - case descriptor.FieldDescriptorProto_TYPE_SFIXED64: - dec, cast = "b.DecodeFixed64()", "int64" - case descriptor.FieldDescriptorProto_TYPE_SINT32: - dec, cast = "b.DecodeZigzag32()", "int32" - case descriptor.FieldDescriptorProto_TYPE_SINT64: - dec, cast = "b.DecodeZigzag64()", "int64" - default: - g.Fail("unhandled oneof field type ", field.Type.String()) - } - g.P(lhs, " := ", dec) - val := "x" - if *field.Type == descriptor.FieldDescriptorProto_TYPE_BYTES && gogoproto.IsCustomType(field) { - g.P(`if err != nil {`) - g.In() - g.P(`return true, err`) - g.Out() - g.P(`}`) - _, ctyp, err := GetCustomType(field) - if err != nil { - panic(err) - } - g.P(`var cc `, ctyp) - g.P(`c := &cc`) - g.P(`err = c.Unmarshal(`, val, `)`) - val = "*c" - } else if gogoproto.IsStdTime(field) { - pkg := g.useTypes() - g.P(`if err != nil {`) - g.In() - g.P(`return true, err`) - g.Out() - g.P(`}`) - g.P(`c := new(time.Time)`) - g.P(`if err2 := `, pkg, `.StdTimeUnmarshal(c, `, val, `); err2 != nil {`) - g.In() - g.P(`return true, err`) - g.Out() - g.P(`}`) - val = "c" - } else if gogoproto.IsStdDuration(field) { - pkg := g.useTypes() - g.P(`if err != nil {`) - g.In() - g.P(`return true, err`) - g.Out() - g.P(`}`) - g.P(`c := new(time.Duration)`) - g.P(`if err2 := `, pkg, `.StdDurationUnmarshal(c, `, val, `); err2 != nil {`) - g.In() - g.P(`return true, err`) - g.Out() - g.P(`}`) - val = "c" - } - if cast != "" { - val = cast + "(" + val + ")" - } - if cast2 != "" { - val = cast2 + "(" + val + ")" - } - switch *field.Type { - case descriptor.FieldDescriptorProto_TYPE_BOOL: - val += " != 0" - case descriptor.FieldDescriptorProto_TYPE_GROUP, - descriptor.FieldDescriptorProto_TYPE_MESSAGE: - if !gogoproto.IsStdTime(field) && !gogoproto.IsStdDuration(field) { - val = "msg" - } - } - if gogoproto.IsCastType(field) { - _, typ, err := getCastType(field) - if err != nil { - g.Fail(err.Error()) - } - val = typ + "(" + val + ")" - } - g.P("m.", oneofFieldName[*field.OneofIndex], " = &", oneofTypeName[field], "{", val, "}") - g.P("return true, err") - } - g.P("default: return false, nil") - g.P("}") - g.P("}") - g.P() - - // sizer - g.P("func ", size, sizeSig, " {") - g.P("m := msg.(*", ccTypeName, ")") - for oi, odp := range message.OneofDecl { - g.P("// ", odp.GetName()) - fname := oneofFieldName[int32(oi)] - g.P("switch x := m.", fname, ".(type) {") - for _, field := range message.Field { - if field.OneofIndex == nil || int(*field.OneofIndex) != oi { - continue - } - g.P("case *", oneofTypeName[field], ":") - val := "x." + fieldNames[field] - var wire, varint, fixed string - switch *field.Type { - case descriptor.FieldDescriptorProto_TYPE_DOUBLE: - wire = "WireFixed64" - fixed = "8" - case descriptor.FieldDescriptorProto_TYPE_FLOAT: - wire = "WireFixed32" - fixed = "4" - case descriptor.FieldDescriptorProto_TYPE_INT64, - descriptor.FieldDescriptorProto_TYPE_UINT64, - descriptor.FieldDescriptorProto_TYPE_INT32, - descriptor.FieldDescriptorProto_TYPE_UINT32, - descriptor.FieldDescriptorProto_TYPE_ENUM: - wire = "WireVarint" - varint = val - case descriptor.FieldDescriptorProto_TYPE_FIXED64, - descriptor.FieldDescriptorProto_TYPE_SFIXED64: - wire = "WireFixed64" - fixed = "8" - case descriptor.FieldDescriptorProto_TYPE_FIXED32, - descriptor.FieldDescriptorProto_TYPE_SFIXED32: - wire = "WireFixed32" - fixed = "4" - case descriptor.FieldDescriptorProto_TYPE_BOOL: - wire = "WireVarint" - fixed = "1" - case descriptor.FieldDescriptorProto_TYPE_STRING: - wire = "WireBytes" - fixed = "len(" + val + ")" - varint = fixed - case descriptor.FieldDescriptorProto_TYPE_GROUP: - wire = "WireStartGroup" - fixed = g.Pkg["proto"] + ".Size(" + val + ")" - case descriptor.FieldDescriptorProto_TYPE_MESSAGE: - wire = "WireBytes" - if gogoproto.IsStdTime(field) { - if gogoproto.IsNullable(field) { - val = "*" + val - } - pkg := g.useTypes() - g.P("s := ", pkg, ".SizeOfStdTime(", val, ")") - } else if gogoproto.IsStdDuration(field) { - if gogoproto.IsNullable(field) { - val = "*" + val - } - pkg := g.useTypes() - g.P("s := ", pkg, ".SizeOfStdDuration(", val, ")") - } else { - g.P("s := ", g.Pkg["proto"], ".Size(", val, ")") - } - fixed = "s" - varint = fixed - case descriptor.FieldDescriptorProto_TYPE_BYTES: - wire = "WireBytes" - if gogoproto.IsCustomType(field) { - fixed = val + ".Size()" - } else { - fixed = "len(" + val + ")" - } - varint = fixed - case descriptor.FieldDescriptorProto_TYPE_SINT32: - wire = "WireVarint" - varint = "(uint32(" + val + ") << 1) ^ uint32((int32(" + val + ") >> 31))" - case descriptor.FieldDescriptorProto_TYPE_SINT64: - wire = "WireVarint" - varint = "uint64(" + val + " << 1) ^ uint64((int64(" + val + ") >> 63))" - default: - g.Fail("unhandled oneof field type ", field.Type.String()) - } - g.P("n += ", g.Pkg["proto"], ".SizeVarint(", field.Number, "<<3|", g.Pkg["proto"], ".", wire, ")") - if varint != "" { - g.P("n += ", g.Pkg["proto"], ".SizeVarint(uint64(", varint, "))") - } - if fixed != "" { - g.P("n += ", fixed) - } - if *field.Type == descriptor.FieldDescriptorProto_TYPE_GROUP { - g.P("n += ", g.Pkg["proto"], ".SizeVarint(", field.Number, "<<3|", g.Pkg["proto"], ".WireEndGroup)") - } - } - g.P("case nil:") - g.P("default:") - g.P("panic(", g.Pkg["fmt"], ".Sprintf(\"proto: unexpected type %T in oneof\", x))") - g.P("}") - } - g.P("return n") - g.P("}") - g.P() - } - - for _, ext := range message.ext { - g.generateExtension(ext) - } - - fullName := strings.Join(message.TypeName(), ".") - if g.file.Package != nil { - fullName = *g.file.Package + "." + fullName - } - - g.addInitf("%s.RegisterType((*%s)(nil), %q)", g.Pkg["proto"], ccTypeName, fullName) -} - -func (g *Generator) generateExtension(ext *ExtensionDescriptor) { - ccTypeName := ext.DescName() - - extObj := g.ObjectNamed(*ext.Extendee) - var extDesc *Descriptor - if id, ok := extObj.(*ImportedDescriptor); ok { - // This is extending a publicly imported message. - // We need the underlying type for goTag. - extDesc = id.o.(*Descriptor) - } else { - extDesc = extObj.(*Descriptor) - } - extendedType := "*" + g.TypeName(extObj) // always use the original - field := ext.FieldDescriptorProto - fieldType, wireType := g.GoType(ext.parent, field) - tag := g.goTag(extDesc, field, wireType) - g.RecordTypeUse(*ext.Extendee) - if n := ext.FieldDescriptorProto.TypeName; n != nil { - // foreign extension type - g.RecordTypeUse(*n) - } - - typeName := ext.TypeName() - - // Special case for proto2 message sets: If this extension is extending - // proto2_bridge.MessageSet, and its final name component is "message_set_extension", - // then drop that last component. - mset := false - if extendedType == "*proto2_bridge.MessageSet" && typeName[len(typeName)-1] == "message_set_extension" { - typeName = typeName[:len(typeName)-1] - mset = true - } - - // For text formatting, the package must be exactly what the .proto file declares, - // ignoring overrides such as the go_package option, and with no dot/underscore mapping. - extName := strings.Join(typeName, ".") - if g.file.Package != nil { - extName = *g.file.Package + "." + extName - } - - g.P("var ", ccTypeName, " = &", g.Pkg["proto"], ".ExtensionDesc{") - g.In() - g.P("ExtendedType: (", extendedType, ")(nil),") - g.P("ExtensionType: (", fieldType, ")(nil),") - g.P("Field: ", field.Number, ",") - g.P(`Name: "`, extName, `",`) - g.P("Tag: ", tag, ",") - g.P(`Filename: "`, g.file.GetName(), `",`) - - g.Out() - g.P("}") - g.P() - - if mset { - // Generate a bit more code to register with message_set.go. - g.addInitf("%s.RegisterMessageSetType((%s)(nil), %d, %q)", g.Pkg["proto"], fieldType, *field.Number, extName) - } - - g.file.addExport(ext, constOrVarSymbol{ccTypeName, "var", ""}) -} - -func (g *Generator) generateInitFunction() { - for _, enum := range g.file.enum { - g.generateEnumRegistration(enum) - } - for _, d := range g.file.desc { - for _, ext := range d.ext { - g.generateExtensionRegistration(ext) - } - } - for _, ext := range g.file.ext { - g.generateExtensionRegistration(ext) - } - if len(g.init) == 0 { - return - } - g.P("func init() {") - g.In() - for _, l := range g.init { - g.P(l) - } - g.Out() - g.P("}") - g.init = nil -} - -func (g *Generator) generateFileDescriptor(file *FileDescriptor) { - // Make a copy and trim source_code_info data. - // TODO: Trim this more when we know exactly what we need. - pb := proto.Clone(file.FileDescriptorProto).(*descriptor.FileDescriptorProto) - pb.SourceCodeInfo = nil - - b, err := proto.Marshal(pb) - if err != nil { - g.Fail(err.Error()) - } - - var buf bytes.Buffer - w, _ := gzip.NewWriterLevel(&buf, gzip.BestCompression) - w.Write(b) - w.Close() - b = buf.Bytes() - - v := file.VarName() - g.P() - g.P("func init() { ", g.Pkg["proto"], ".RegisterFile(", strconv.Quote(*file.Name), ", ", v, ") }") - g.P("var ", v, " = []byte{") - g.In() - g.P("// ", len(b), " bytes of a gzipped FileDescriptorProto") - for len(b) > 0 { - n := 16 - if n > len(b) { - n = len(b) - } - - s := "" - for _, c := range b[:n] { - s += fmt.Sprintf("0x%02x,", c) - } - g.P(s) - - b = b[n:] - } - g.Out() - g.P("}") -} - -func (g *Generator) generateEnumRegistration(enum *EnumDescriptor) { - // // We always print the full (proto-world) package name here. - pkg := enum.File().GetPackage() - if pkg != "" { - pkg += "." - } - // The full type name - typeName := enum.TypeName() - // The full type name, CamelCased. - ccTypeName := CamelCaseSlice(typeName) - g.addInitf("%s.RegisterEnum(%q, %[3]s_name, %[3]s_value)", g.Pkg["proto"], pkg+ccTypeName, ccTypeName) -} - -func (g *Generator) generateExtensionRegistration(ext *ExtensionDescriptor) { - g.addInitf("%s.RegisterExtension(%s)", g.Pkg["proto"], ext.DescName()) -} - -// And now lots of helper functions. - -// Is c an ASCII lower-case letter? -func isASCIILower(c byte) bool { - return 'a' <= c && c <= 'z' -} - -// Is c an ASCII digit? -func isASCIIDigit(c byte) bool { - return '0' <= c && c <= '9' -} - -// CamelCase returns the CamelCased name. -// If there is an interior underscore followed by a lower case letter, -// drop the underscore and convert the letter to upper case. -// There is a remote possibility of this rewrite causing a name collision, -// but it's so remote we're prepared to pretend it's nonexistent - since the -// C++ generator lowercases names, it's extremely unlikely to have two fields -// with different capitalizations. -// In short, _my_field_name_2 becomes XMyFieldName_2. -func CamelCase(s string) string { - if s == "" { - return "" - } - t := make([]byte, 0, 32) - i := 0 - if s[0] == '_' { - // Need a capital letter; drop the '_'. - t = append(t, 'X') - i++ - } - // 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. - for ; i < len(s); i++ { - c := s[i] - if c == '_' && i+1 < len(s) && isASCIILower(s[i+1]) { - continue // Skip the underscore in s. - } - if isASCIIDigit(c) { - t = append(t, c) - continue - } - // 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 ^= ' ' // Make it a capital letter. - } - t = append(t, c) // Guaranteed not lower case. - // Accept lower case sequence that follows. - for i+1 < len(s) && isASCIILower(s[i+1]) { - i++ - t = append(t, s[i]) - } - } - return string(t) -} - -// CamelCaseSlice is like CamelCase, but the argument is a slice of strings to -// be joined with "_". -func CamelCaseSlice(elem []string) string { return CamelCase(strings.Join(elem, "_")) } - -// dottedSlice turns a sliced name into a dotted name. -func dottedSlice(elem []string) string { return strings.Join(elem, ".") } - -// Is this field optional? -func isOptional(field *descriptor.FieldDescriptorProto) bool { - return field.Label != nil && *field.Label == descriptor.FieldDescriptorProto_LABEL_OPTIONAL -} - -// Is this field required? -func isRequired(field *descriptor.FieldDescriptorProto) bool { - return field.Label != nil && *field.Label == descriptor.FieldDescriptorProto_LABEL_REQUIRED -} - -// Is this field repeated? -func isRepeated(field *descriptor.FieldDescriptorProto) bool { - return field.Label != nil && *field.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED -} - -// Is this field a scalar numeric type? -func IsScalar(field *descriptor.FieldDescriptorProto) bool { - if field.Type == nil { - return false - } - switch *field.Type { - case descriptor.FieldDescriptorProto_TYPE_DOUBLE, - descriptor.FieldDescriptorProto_TYPE_FLOAT, - descriptor.FieldDescriptorProto_TYPE_INT64, - descriptor.FieldDescriptorProto_TYPE_UINT64, - descriptor.FieldDescriptorProto_TYPE_INT32, - descriptor.FieldDescriptorProto_TYPE_FIXED64, - descriptor.FieldDescriptorProto_TYPE_FIXED32, - descriptor.FieldDescriptorProto_TYPE_BOOL, - descriptor.FieldDescriptorProto_TYPE_UINT32, - descriptor.FieldDescriptorProto_TYPE_ENUM, - descriptor.FieldDescriptorProto_TYPE_SFIXED32, - descriptor.FieldDescriptorProto_TYPE_SFIXED64, - descriptor.FieldDescriptorProto_TYPE_SINT32, - descriptor.FieldDescriptorProto_TYPE_SINT64: - return true - default: - return false - } -} - -// badToUnderscore is the mapping function used to generate Go names from package names, -// which can be dotted in the input .proto file. It replaces non-identifier characters such as -// dot or dash with underscore. -func badToUnderscore(r rune) rune { - if unicode.IsLetter(r) || unicode.IsDigit(r) || r == '_' { - return r - } - return '_' -} - -// baseName returns the last path element of the name, with the last dotted suffix removed. -func baseName(name string) string { - // First, find the last element - if i := strings.LastIndex(name, "/"); i >= 0 { - name = name[i+1:] - } - // Now drop the suffix - if i := strings.LastIndex(name, "."); i >= 0 { - name = name[0:i] - } - return name -} - -// The SourceCodeInfo message describes the location of elements of a parsed -// .proto file by way of a "path", which is a sequence of integers that -// describe the route from a FileDescriptorProto to the relevant submessage. -// The path alternates between a field number of a repeated field, and an index -// into that repeated field. The constants below define the field numbers that -// are used. -// -// See descriptor.proto for more information about this. -const ( - // tag numbers in FileDescriptorProto - packagePath = 2 // package - messagePath = 4 // message_type - enumPath = 5 // enum_type - // tag numbers in DescriptorProto - messageFieldPath = 2 // field - messageMessagePath = 3 // nested_type - messageEnumPath = 4 // enum_type - messageOneofPath = 8 // oneof_decl - // tag numbers in EnumDescriptorProto - enumValuePath = 2 // value -) diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/generator/helper.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/generator/helper.go deleted file mode 100644 index d7a406e7ccd..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/generator/helper.go +++ /dev/null @@ -1,447 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package generator - -import ( - "bytes" - "go/parser" - "go/printer" - "go/token" - "path" - "strings" - - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/proto" - descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - plugin "github.com/gogo/protobuf/protoc-gen-gogo/plugin" -) - -func (d *FileDescriptor) Messages() []*Descriptor { - return d.desc -} - -func (d *FileDescriptor) Enums() []*EnumDescriptor { - return d.enum -} - -func (d *Descriptor) IsGroup() bool { - return d.group -} - -func (g *Generator) IsGroup(field *descriptor.FieldDescriptorProto) bool { - if d, ok := g.typeNameToObject[field.GetTypeName()].(*Descriptor); ok { - return d.IsGroup() - } - return false -} - -func (g *Generator) TypeNameByObject(typeName string) Object { - o, ok := g.typeNameToObject[typeName] - if !ok { - g.Fail("can't find object with type", typeName) - } - return o -} - -func (g *Generator) OneOfTypeName(message *Descriptor, field *descriptor.FieldDescriptorProto) string { - typeName := message.TypeName() - ccTypeName := CamelCaseSlice(typeName) - fieldName := g.GetOneOfFieldName(message, field) - tname := ccTypeName + "_" + fieldName - // It is possible for this to collide with a message or enum - // nested in this message. Check for collisions. - ok := true - for _, desc := range message.nested { - if strings.Join(desc.TypeName(), "_") == tname { - ok = false - break - } - } - for _, enum := range message.enums { - if strings.Join(enum.TypeName(), "_") == tname { - ok = false - break - } - } - if !ok { - tname += "_" - } - return tname -} - -type PluginImports interface { - NewImport(pkg string) Single - GenerateImports(file *FileDescriptor) -} - -type pluginImports struct { - generator *Generator - singles []Single -} - -func NewPluginImports(generator *Generator) *pluginImports { - return &pluginImports{generator, make([]Single, 0)} -} - -func (this *pluginImports) NewImport(pkg string) Single { - imp := newImportedPackage(this.generator.ImportPrefix, pkg) - this.singles = append(this.singles, imp) - return imp -} - -func (this *pluginImports) GenerateImports(file *FileDescriptor) { - for _, s := range this.singles { - if s.IsUsed() { - this.generator.PrintImport(s.Name(), s.Location()) - } - } -} - -type Single interface { - Use() string - IsUsed() bool - Name() string - Location() string -} - -type importedPackage struct { - used bool - pkg string - name string - importPrefix string -} - -func newImportedPackage(importPrefix, pkg string) *importedPackage { - return &importedPackage{ - pkg: pkg, - importPrefix: importPrefix, - } -} - -func (this *importedPackage) Use() string { - if !this.used { - this.name = RegisterUniquePackageName(this.pkg, nil) - this.used = true - } - return this.name -} - -func (this *importedPackage) IsUsed() bool { - return this.used -} - -func (this *importedPackage) Name() string { - return this.name -} - -func (this *importedPackage) Location() string { - return this.importPrefix + this.pkg -} - -func (g *Generator) GetFieldName(message *Descriptor, field *descriptor.FieldDescriptorProto) string { - goTyp, _ := g.GoType(message, field) - fieldname := CamelCase(*field.Name) - if gogoproto.IsCustomName(field) { - fieldname = gogoproto.GetCustomName(field) - } - if gogoproto.IsEmbed(field) { - fieldname = EmbedFieldName(goTyp) - } - if field.OneofIndex != nil { - fieldname = message.OneofDecl[int(*field.OneofIndex)].GetName() - fieldname = CamelCase(fieldname) - } - for _, f := range methodNames { - if f == fieldname { - return fieldname + "_" - } - } - if !gogoproto.IsProtoSizer(message.file, message.DescriptorProto) { - if fieldname == "Size" { - return fieldname + "_" - } - } - return fieldname -} - -func (g *Generator) GetOneOfFieldName(message *Descriptor, field *descriptor.FieldDescriptorProto) string { - goTyp, _ := g.GoType(message, field) - fieldname := CamelCase(*field.Name) - if gogoproto.IsCustomName(field) { - fieldname = gogoproto.GetCustomName(field) - } - if gogoproto.IsEmbed(field) { - fieldname = EmbedFieldName(goTyp) - } - for _, f := range methodNames { - if f == fieldname { - return fieldname + "_" - } - } - if !gogoproto.IsProtoSizer(message.file, message.DescriptorProto) { - if fieldname == "Size" { - return fieldname + "_" - } - } - return fieldname -} - -func (g *Generator) IsMap(field *descriptor.FieldDescriptorProto) bool { - if !field.IsMessage() { - return false - } - byName := g.ObjectNamed(field.GetTypeName()) - desc, ok := byName.(*Descriptor) - if byName == nil || !ok || !desc.GetOptions().GetMapEntry() { - return false - } - return true -} - -func (g *Generator) GetMapKeyField(field, keyField *descriptor.FieldDescriptorProto) *descriptor.FieldDescriptorProto { - if !gogoproto.IsCastKey(field) { - return keyField - } - keyField = proto.Clone(keyField).(*descriptor.FieldDescriptorProto) - if keyField.Options == nil { - keyField.Options = &descriptor.FieldOptions{} - } - keyType := gogoproto.GetCastKey(field) - if err := proto.SetExtension(keyField.Options, gogoproto.E_Casttype, &keyType); err != nil { - g.Fail(err.Error()) - } - return keyField -} - -func (g *Generator) GetMapValueField(field, valField *descriptor.FieldDescriptorProto) *descriptor.FieldDescriptorProto { - if gogoproto.IsCustomType(field) && gogoproto.IsCastValue(field) { - g.Fail("cannot have a customtype and casttype: ", field.String()) - } - valField = proto.Clone(valField).(*descriptor.FieldDescriptorProto) - if valField.Options == nil { - valField.Options = &descriptor.FieldOptions{} - } - - stdtime := gogoproto.IsStdTime(field) - if stdtime { - if err := proto.SetExtension(valField.Options, gogoproto.E_Stdtime, &stdtime); err != nil { - g.Fail(err.Error()) - } - } - - stddur := gogoproto.IsStdDuration(field) - if stddur { - if err := proto.SetExtension(valField.Options, gogoproto.E_Stdduration, &stddur); err != nil { - g.Fail(err.Error()) - } - } - - if valType := gogoproto.GetCastValue(field); len(valType) > 0 { - if err := proto.SetExtension(valField.Options, gogoproto.E_Casttype, &valType); err != nil { - g.Fail(err.Error()) - } - } - if valType := gogoproto.GetCustomType(field); len(valType) > 0 { - if err := proto.SetExtension(valField.Options, gogoproto.E_Customtype, &valType); err != nil { - g.Fail(err.Error()) - } - } - - nullable := gogoproto.IsNullable(field) - if err := proto.SetExtension(valField.Options, gogoproto.E_Nullable, &nullable); err != nil { - g.Fail(err.Error()) - } - return valField -} - -// GoMapValueTypes returns the map value Go type and the alias map value Go type (for casting), taking into -// account whether the map is nullable or the value is a message. -func GoMapValueTypes(mapField, valueField *descriptor.FieldDescriptorProto, goValueType, goValueAliasType string) (nullable bool, outGoType string, outGoAliasType string) { - nullable = gogoproto.IsNullable(mapField) && (valueField.IsMessage() || gogoproto.IsCustomType(mapField)) - if nullable { - // ensure the non-aliased Go value type is a pointer for consistency - if strings.HasPrefix(goValueType, "*") { - outGoType = goValueType - } else { - outGoType = "*" + goValueType - } - outGoAliasType = goValueAliasType - } else { - outGoType = strings.Replace(goValueType, "*", "", 1) - outGoAliasType = strings.Replace(goValueAliasType, "*", "", 1) - } - return -} - -func GoTypeToName(goTyp string) string { - return strings.Replace(strings.Replace(goTyp, "*", "", -1), "[]", "", -1) -} - -func EmbedFieldName(goTyp string) string { - goTyp = GoTypeToName(goTyp) - goTyps := strings.Split(goTyp, ".") - if len(goTyps) == 1 { - return goTyp - } - if len(goTyps) == 2 { - return goTyps[1] - } - panic("unreachable") -} - -func (g *Generator) GeneratePlugin(p Plugin) { - plugins = []Plugin{p} - p.Init(g) - // Generate the output. The generator runs for every file, even the files - // that we don't generate output for, so that we can collate the full list - // of exported symbols to support public imports. - genFileMap := make(map[*FileDescriptor]bool, len(g.genFiles)) - for _, file := range g.genFiles { - genFileMap[file] = true - } - for _, file := range g.allFiles { - g.Reset() - g.writeOutput = genFileMap[file] - g.generatePlugin(file, p) - if !g.writeOutput { - continue - } - g.Response.File = append(g.Response.File, &plugin.CodeGeneratorResponse_File{ - Name: proto.String(file.goFileName()), - Content: proto.String(g.String()), - }) - } -} - -func (g *Generator) SetFile(file *descriptor.FileDescriptorProto) { - g.file = g.FileOf(file) -} - -func (g *Generator) generatePlugin(file *FileDescriptor, p Plugin) { - g.writtenImports = make(map[string]bool) - g.file = g.FileOf(file.FileDescriptorProto) - g.usedPackages = make(map[string]bool) - - // Run the plugins before the imports so we know which imports are necessary. - p.Generate(file) - - // Generate header and imports last, though they appear first in the output. - rem := g.Buffer - g.Buffer = new(bytes.Buffer) - g.generateHeader() - p.GenerateImports(g.file) - g.generateImports() - if !g.writeOutput { - return - } - g.Write(rem.Bytes()) - - // Reformat generated code. - contents := string(g.Buffer.Bytes()) - fset := token.NewFileSet() - ast, err := parser.ParseFile(fset, "", g, parser.ParseComments) - if err != nil { - g.Fail("bad Go source code was generated:", contents, err.Error()) - return - } - g.Reset() - err = (&printer.Config{Mode: printer.TabIndent | printer.UseSpaces, Tabwidth: 8}).Fprint(g, fset, ast) - if err != nil { - g.Fail("generated Go source code could not be reformatted:", err.Error()) - } -} - -func GetCustomType(field *descriptor.FieldDescriptorProto) (packageName string, typ string, err error) { - return getCustomType(field) -} - -func getCustomType(field *descriptor.FieldDescriptorProto) (packageName string, typ string, err error) { - if field.Options != nil { - var v interface{} - v, err = proto.GetExtension(field.Options, gogoproto.E_Customtype) - if err == nil && v.(*string) != nil { - ctype := *(v.(*string)) - packageName, typ = splitCPackageType(ctype) - return packageName, typ, nil - } - } - return "", "", err -} - -func splitCPackageType(ctype string) (packageName string, typ string) { - ss := strings.Split(ctype, ".") - if len(ss) == 1 { - return "", ctype - } - packageName = strings.Join(ss[0:len(ss)-1], ".") - typeName := ss[len(ss)-1] - importStr := strings.Map(badToUnderscore, packageName) - typ = importStr + "." + typeName - return packageName, typ -} - -func getCastType(field *descriptor.FieldDescriptorProto) (packageName string, typ string, err error) { - if field.Options != nil { - var v interface{} - v, err = proto.GetExtension(field.Options, gogoproto.E_Casttype) - if err == nil && v.(*string) != nil { - ctype := *(v.(*string)) - packageName, typ = splitCPackageType(ctype) - return packageName, typ, nil - } - } - return "", "", err -} - -func FileName(file *FileDescriptor) string { - fname := path.Base(file.FileDescriptorProto.GetName()) - fname = strings.Replace(fname, ".proto", "", -1) - fname = strings.Replace(fname, "-", "_", -1) - fname = strings.Replace(fname, ".", "_", -1) - return CamelCase(fname) -} - -func (g *Generator) AllFiles() *descriptor.FileDescriptorSet { - set := &descriptor.FileDescriptorSet{} - set.File = make([]*descriptor.FileDescriptorProto, len(g.allFiles)) - for i := range g.allFiles { - set.File[i] = g.allFiles[i].FileDescriptorProto - } - return set -} - -func (d *Descriptor) Path() string { - return d.path -} - -func (g *Generator) useTypes() string { - pkg := strings.Map(badToUnderscore, "github.com/gogo/protobuf/types") - g.customImports = append(g.customImports, "github.com/gogo/protobuf/types") - return pkg -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/grpc/grpc.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/grpc/grpc.go deleted file mode 100644 index 359001b4709..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/grpc/grpc.go +++ /dev/null @@ -1,463 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2015 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -// Package grpc outputs gRPC service descriptions in Go code. -// It runs as a plugin for the Go protocol buffer compiler plugin. -// It is linked in to protoc-gen-go. -package grpc - -import ( - "fmt" - "path" - "strconv" - "strings" - - pb "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" -) - -// generatedCodeVersion indicates a version of the generated code. -// It is incremented whenever an incompatibility between the generated code and -// the grpc package is introduced; the generated code references -// a constant, grpc.SupportPackageIsVersionN (where N is generatedCodeVersion). -const generatedCodeVersion = 4 - -// Paths for packages used by code generated in this file, -// relative to the import_prefix of the generator.Generator. -const ( - contextPkgPath = "golang.org/x/net/context" - grpcPkgPath = "google.golang.org/grpc" -) - -func init() { - generator.RegisterPlugin(new(grpc)) -} - -// grpc is an implementation of the Go protocol buffer compiler's -// plugin architecture. It generates bindings for gRPC support. -type grpc struct { - gen *generator.Generator -} - -// Name returns the name of this plugin, "grpc". -func (g *grpc) Name() string { - return "grpc" -} - -// The names for packages imported in the generated code. -// They may vary from the final path component of the import path -// if the name is used by other packages. -var ( - contextPkg string - grpcPkg string -) - -// Init initializes the plugin. -func (g *grpc) Init(gen *generator.Generator) { - g.gen = gen - contextPkg = generator.RegisterUniquePackageName("context", nil) - grpcPkg = generator.RegisterUniquePackageName("grpc", nil) -} - -// Given a type name defined in a .proto, return its object. -// Also record that we're using it, to guarantee the associated import. -func (g *grpc) objectNamed(name string) generator.Object { - g.gen.RecordTypeUse(name) - return g.gen.ObjectNamed(name) -} - -// Given a type name defined in a .proto, return its name as we will print it. -func (g *grpc) typeName(str string) string { - return g.gen.TypeName(g.objectNamed(str)) -} - -// P forwards to g.gen.P. -func (g *grpc) P(args ...interface{}) { g.gen.P(args...) } - -// Generate generates code for the services in the given file. -func (g *grpc) Generate(file *generator.FileDescriptor) { - if len(file.FileDescriptorProto.Service) == 0 { - return - } - - g.P("// Reference imports to suppress errors if they are not otherwise used.") - g.P("var _ ", contextPkg, ".Context") - g.P("var _ ", grpcPkg, ".ClientConn") - g.P() - - // Assert version compatibility. - g.P("// This is a compile-time assertion to ensure that this generated file") - g.P("// is compatible with the grpc package it is being compiled against.") - g.P("const _ = ", grpcPkg, ".SupportPackageIsVersion", generatedCodeVersion) - g.P() - - for i, service := range file.FileDescriptorProto.Service { - g.generateService(file, service, i) - } -} - -// GenerateImports generates the import declaration for this file. -func (g *grpc) GenerateImports(file *generator.FileDescriptor) { - if len(file.FileDescriptorProto.Service) == 0 { - return - } - g.P("import (") - g.P(contextPkg, " ", strconv.Quote(path.Join(g.gen.ImportPrefix, contextPkgPath))) - g.P(grpcPkg, " ", strconv.Quote(path.Join(g.gen.ImportPrefix, grpcPkgPath))) - g.P(")") - g.P() -} - -// reservedClientName records whether a client name is reserved on the client side. -var reservedClientName = map[string]bool{ -// TODO: do we need any in gRPC? -} - -func unexport(s string) string { return strings.ToLower(s[:1]) + s[1:] } - -// generateService generates all the code for the named service. -func (g *grpc) generateService(file *generator.FileDescriptor, service *pb.ServiceDescriptorProto, index int) { - path := fmt.Sprintf("6,%d", index) // 6 means service. - - origServName := service.GetName() - fullServName := origServName - if pkg := file.GetPackage(); pkg != "" { - fullServName = pkg + "." + fullServName - } - servName := generator.CamelCase(origServName) - - g.P() - g.P("// Client API for ", servName, " service") - g.P() - - // Client interface. - g.P("type ", servName, "Client interface {") - for i, method := range service.Method { - g.gen.PrintComments(fmt.Sprintf("%s,2,%d", path, i)) // 2 means method in a service. - g.P(g.generateClientSignature(servName, method)) - } - g.P("}") - g.P() - - // Client structure. - g.P("type ", unexport(servName), "Client struct {") - g.P("cc *", grpcPkg, ".ClientConn") - g.P("}") - g.P() - - // NewClient factory. - g.P("func New", servName, "Client (cc *", grpcPkg, ".ClientConn) ", servName, "Client {") - g.P("return &", unexport(servName), "Client{cc}") - g.P("}") - g.P() - - var methodIndex, streamIndex int - serviceDescVar := "_" + servName + "_serviceDesc" - // Client method implementations. - for _, method := range service.Method { - var descExpr string - if !method.GetServerStreaming() && !method.GetClientStreaming() { - // Unary RPC method - descExpr = fmt.Sprintf("&%s.Methods[%d]", serviceDescVar, methodIndex) - methodIndex++ - } else { - // Streaming RPC method - descExpr = fmt.Sprintf("&%s.Streams[%d]", serviceDescVar, streamIndex) - streamIndex++ - } - g.generateClientMethod(servName, fullServName, serviceDescVar, method, descExpr) - } - - g.P("// Server API for ", servName, " service") - g.P() - - // Server interface. - serverType := servName + "Server" - g.P("type ", serverType, " interface {") - for i, method := range service.Method { - g.gen.PrintComments(fmt.Sprintf("%s,2,%d", path, i)) // 2 means method in a service. - g.P(g.generateServerSignature(servName, method)) - } - g.P("}") - g.P() - - // Server registration. - g.P("func Register", servName, "Server(s *", grpcPkg, ".Server, srv ", serverType, ") {") - g.P("s.RegisterService(&", serviceDescVar, `, srv)`) - g.P("}") - g.P() - - // Server handler implementations. - var handlerNames []string - for _, method := range service.Method { - hname := g.generateServerMethod(servName, fullServName, method) - handlerNames = append(handlerNames, hname) - } - - // Service descriptor. - g.P("var ", serviceDescVar, " = ", grpcPkg, ".ServiceDesc {") - g.P("ServiceName: ", strconv.Quote(fullServName), ",") - g.P("HandlerType: (*", serverType, ")(nil),") - g.P("Methods: []", grpcPkg, ".MethodDesc{") - for i, method := range service.Method { - if method.GetServerStreaming() || method.GetClientStreaming() { - continue - } - g.P("{") - g.P("MethodName: ", strconv.Quote(method.GetName()), ",") - g.P("Handler: ", handlerNames[i], ",") - g.P("},") - } - g.P("},") - g.P("Streams: []", grpcPkg, ".StreamDesc{") - for i, method := range service.Method { - if !method.GetServerStreaming() && !method.GetClientStreaming() { - continue - } - g.P("{") - g.P("StreamName: ", strconv.Quote(method.GetName()), ",") - g.P("Handler: ", handlerNames[i], ",") - if method.GetServerStreaming() { - g.P("ServerStreams: true,") - } - if method.GetClientStreaming() { - g.P("ClientStreams: true,") - } - g.P("},") - } - g.P("},") - g.P("Metadata: \"", file.GetName(), "\",") - g.P("}") - g.P() -} - -// generateClientSignature returns the client-side signature for a method. -func (g *grpc) generateClientSignature(servName string, method *pb.MethodDescriptorProto) string { - origMethName := method.GetName() - methName := generator.CamelCase(origMethName) - if reservedClientName[methName] { - methName += "_" - } - reqArg := ", in *" + g.typeName(method.GetInputType()) - if method.GetClientStreaming() { - reqArg = "" - } - respName := "*" + g.typeName(method.GetOutputType()) - if method.GetServerStreaming() || method.GetClientStreaming() { - respName = servName + "_" + generator.CamelCase(origMethName) + "Client" - } - return fmt.Sprintf("%s(ctx %s.Context%s, opts ...%s.CallOption) (%s, error)", methName, contextPkg, reqArg, grpcPkg, respName) -} - -func (g *grpc) generateClientMethod(servName, fullServName, serviceDescVar string, method *pb.MethodDescriptorProto, descExpr string) { - sname := fmt.Sprintf("/%s/%s", fullServName, method.GetName()) - methName := generator.CamelCase(method.GetName()) - inType := g.typeName(method.GetInputType()) - outType := g.typeName(method.GetOutputType()) - - g.P("func (c *", unexport(servName), "Client) ", g.generateClientSignature(servName, method), "{") - if !method.GetServerStreaming() && !method.GetClientStreaming() { - g.P("out := new(", outType, ")") - // TODO: Pass descExpr to Invoke. - g.P("err := ", grpcPkg, `.Invoke(ctx, "`, sname, `", in, out, c.cc, opts...)`) - g.P("if err != nil { return nil, err }") - g.P("return out, nil") - g.P("}") - g.P() - return - } - streamType := unexport(servName) + methName + "Client" - g.P("stream, err := ", grpcPkg, ".NewClientStream(ctx, ", descExpr, `, c.cc, "`, sname, `", opts...)`) - g.P("if err != nil { return nil, err }") - g.P("x := &", streamType, "{stream}") - if !method.GetClientStreaming() { - g.P("if err := x.ClientStream.SendMsg(in); err != nil { return nil, err }") - g.P("if err := x.ClientStream.CloseSend(); err != nil { return nil, err }") - } - g.P("return x, nil") - g.P("}") - g.P() - - genSend := method.GetClientStreaming() - genRecv := method.GetServerStreaming() - genCloseAndRecv := !method.GetServerStreaming() - - // Stream auxiliary types and methods. - g.P("type ", servName, "_", methName, "Client interface {") - if genSend { - g.P("Send(*", inType, ") error") - } - if genRecv { - g.P("Recv() (*", outType, ", error)") - } - if genCloseAndRecv { - g.P("CloseAndRecv() (*", outType, ", error)") - } - g.P(grpcPkg, ".ClientStream") - g.P("}") - g.P() - - g.P("type ", streamType, " struct {") - g.P(grpcPkg, ".ClientStream") - g.P("}") - g.P() - - if genSend { - g.P("func (x *", streamType, ") Send(m *", inType, ") error {") - g.P("return x.ClientStream.SendMsg(m)") - g.P("}") - g.P() - } - if genRecv { - g.P("func (x *", streamType, ") Recv() (*", outType, ", error) {") - g.P("m := new(", outType, ")") - g.P("if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err }") - g.P("return m, nil") - g.P("}") - g.P() - } - if genCloseAndRecv { - g.P("func (x *", streamType, ") CloseAndRecv() (*", outType, ", error) {") - g.P("if err := x.ClientStream.CloseSend(); err != nil { return nil, err }") - g.P("m := new(", outType, ")") - g.P("if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err }") - g.P("return m, nil") - g.P("}") - g.P() - } -} - -// generateServerSignature returns the server-side signature for a method. -func (g *grpc) generateServerSignature(servName string, method *pb.MethodDescriptorProto) string { - origMethName := method.GetName() - methName := generator.CamelCase(origMethName) - if reservedClientName[methName] { - methName += "_" - } - - var reqArgs []string - ret := "error" - if !method.GetServerStreaming() && !method.GetClientStreaming() { - reqArgs = append(reqArgs, contextPkg+".Context") - ret = "(*" + g.typeName(method.GetOutputType()) + ", error)" - } - if !method.GetClientStreaming() { - reqArgs = append(reqArgs, "*"+g.typeName(method.GetInputType())) - } - if method.GetServerStreaming() || method.GetClientStreaming() { - reqArgs = append(reqArgs, servName+"_"+generator.CamelCase(origMethName)+"Server") - } - - return methName + "(" + strings.Join(reqArgs, ", ") + ") " + ret -} - -func (g *grpc) generateServerMethod(servName, fullServName string, method *pb.MethodDescriptorProto) string { - methName := generator.CamelCase(method.GetName()) - hname := fmt.Sprintf("_%s_%s_Handler", servName, methName) - inType := g.typeName(method.GetInputType()) - outType := g.typeName(method.GetOutputType()) - - if !method.GetServerStreaming() && !method.GetClientStreaming() { - g.P("func ", hname, "(srv interface{}, ctx ", contextPkg, ".Context, dec func(interface{}) error, interceptor ", grpcPkg, ".UnaryServerInterceptor) (interface{}, error) {") - g.P("in := new(", inType, ")") - g.P("if err := dec(in); err != nil { return nil, err }") - g.P("if interceptor == nil { return srv.(", servName, "Server).", methName, "(ctx, in) }") - g.P("info := &", grpcPkg, ".UnaryServerInfo{") - g.P("Server: srv,") - g.P("FullMethod: ", strconv.Quote(fmt.Sprintf("/%s/%s", fullServName, methName)), ",") - g.P("}") - g.P("handler := func(ctx ", contextPkg, ".Context, req interface{}) (interface{}, error) {") - g.P("return srv.(", servName, "Server).", methName, "(ctx, req.(*", inType, "))") - g.P("}") - g.P("return interceptor(ctx, in, info, handler)") - g.P("}") - g.P() - return hname - } - streamType := unexport(servName) + methName + "Server" - g.P("func ", hname, "(srv interface{}, stream ", grpcPkg, ".ServerStream) error {") - if !method.GetClientStreaming() { - g.P("m := new(", inType, ")") - g.P("if err := stream.RecvMsg(m); err != nil { return err }") - g.P("return srv.(", servName, "Server).", methName, "(m, &", streamType, "{stream})") - } else { - g.P("return srv.(", servName, "Server).", methName, "(&", streamType, "{stream})") - } - g.P("}") - g.P() - - genSend := method.GetServerStreaming() - genSendAndClose := !method.GetServerStreaming() - genRecv := method.GetClientStreaming() - - // Stream auxiliary types and methods. - g.P("type ", servName, "_", methName, "Server interface {") - if genSend { - g.P("Send(*", outType, ") error") - } - if genSendAndClose { - g.P("SendAndClose(*", outType, ") error") - } - if genRecv { - g.P("Recv() (*", inType, ", error)") - } - g.P(grpcPkg, ".ServerStream") - g.P("}") - g.P() - - g.P("type ", streamType, " struct {") - g.P(grpcPkg, ".ServerStream") - g.P("}") - g.P() - - if genSend { - g.P("func (x *", streamType, ") Send(m *", outType, ") error {") - g.P("return x.ServerStream.SendMsg(m)") - g.P("}") - g.P() - } - if genSendAndClose { - g.P("func (x *", streamType, ") SendAndClose(m *", outType, ") error {") - g.P("return x.ServerStream.SendMsg(m)") - g.P("}") - g.P() - } - if genRecv { - g.P("func (x *", streamType, ") Recv() (*", inType, ", error) {") - g.P("m := new(", inType, ")") - g.P("if err := x.ServerStream.RecvMsg(m); err != nil { return nil, err }") - g.P("return m, nil") - g.P("}") - g.P() - } - - return hname -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/main.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/main.go deleted file mode 100644 index dd8e795030c..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/main.go +++ /dev/null @@ -1,57 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -// protoc-gen-go is a plugin for the Google protocol buffer compiler to generate -// Go code. Run it by building this program and putting it in your path with -// the name -// protoc-gen-gogo -// That word 'gogo' at the end becomes part of the option string set for the -// protocol compiler, so once the protocol compiler (protoc) is installed -// you can run -// protoc --gogo_out=output_directory input_directory/file.proto -// to generate Go bindings for the protocol defined by file.proto. -// With that input, the output will be written to -// output_directory/file.pb.go -// -// The generated code is documented in the package comment for -// the library. -// -// See the README and documentation for protocol buffers to learn more: -// https://developers.google.com/protocol-buffers/ -package main - -import ( - "github.com/gogo/protobuf/vanity/command" -) - -func main() { - command.Write(command.Generate(command.Read())) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/plugin/plugin.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/plugin/plugin.pb.go deleted file mode 100644 index 6c5973e9281..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogo/plugin/plugin.pb.go +++ /dev/null @@ -1,230 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: plugin.proto -// DO NOT EDIT! - -/* -Package plugin_go is a generated protocol buffer package. - -It is generated from these files: - plugin.proto - -It has these top-level messages: - CodeGeneratorRequest - CodeGeneratorResponse -*/ -package plugin_go - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import google_protobuf "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -// An encoded CodeGeneratorRequest is written to the plugin's stdin. -type CodeGeneratorRequest struct { - // The .proto files that were explicitly listed on the command-line. The - // code generator should generate code only for these files. Each file's - // descriptor will be included in proto_file, below. - FileToGenerate []string `protobuf:"bytes,1,rep,name=file_to_generate,json=fileToGenerate" json:"file_to_generate,omitempty"` - // The generator parameter passed on the command-line. - Parameter *string `protobuf:"bytes,2,opt,name=parameter" json:"parameter,omitempty"` - // FileDescriptorProtos for all files in files_to_generate and everything - // they import. The files will appear in topological order, so each file - // appears before any file that imports it. - // - // protoc guarantees that all proto_files will be written after - // the fields above, even though this is not technically guaranteed by the - // protobuf wire format. This theoretically could allow a plugin to stream - // in the FileDescriptorProtos and handle them one by one rather than read - // the entire set into memory at once. However, as of this writing, this - // is not similarly optimized on protoc's end -- it will store all fields in - // memory at once before sending them to the plugin. - ProtoFile []*google_protobuf.FileDescriptorProto `protobuf:"bytes,15,rep,name=proto_file,json=protoFile" json:"proto_file,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *CodeGeneratorRequest) Reset() { *m = CodeGeneratorRequest{} } -func (m *CodeGeneratorRequest) String() string { return proto.CompactTextString(m) } -func (*CodeGeneratorRequest) ProtoMessage() {} -func (*CodeGeneratorRequest) Descriptor() ([]byte, []int) { return fileDescriptorPlugin, []int{0} } - -func (m *CodeGeneratorRequest) GetFileToGenerate() []string { - if m != nil { - return m.FileToGenerate - } - return nil -} - -func (m *CodeGeneratorRequest) GetParameter() string { - if m != nil && m.Parameter != nil { - return *m.Parameter - } - return "" -} - -func (m *CodeGeneratorRequest) GetProtoFile() []*google_protobuf.FileDescriptorProto { - if m != nil { - return m.ProtoFile - } - return nil -} - -// The plugin writes an encoded CodeGeneratorResponse to stdout. -type CodeGeneratorResponse struct { - // Error message. If non-empty, code generation failed. The plugin process - // should exit with status code zero even if it reports an error in this way. - // - // This should be used to indicate errors in .proto files which prevent the - // code generator from generating correct code. Errors which indicate a - // problem in protoc itself -- such as the input CodeGeneratorRequest being - // unparseable -- should be reported by writing a message to stderr and - // exiting with a non-zero status code. - Error *string `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"` - File []*CodeGeneratorResponse_File `protobuf:"bytes,15,rep,name=file" json:"file,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *CodeGeneratorResponse) Reset() { *m = CodeGeneratorResponse{} } -func (m *CodeGeneratorResponse) String() string { return proto.CompactTextString(m) } -func (*CodeGeneratorResponse) ProtoMessage() {} -func (*CodeGeneratorResponse) Descriptor() ([]byte, []int) { return fileDescriptorPlugin, []int{1} } - -func (m *CodeGeneratorResponse) GetError() string { - if m != nil && m.Error != nil { - return *m.Error - } - return "" -} - -func (m *CodeGeneratorResponse) GetFile() []*CodeGeneratorResponse_File { - if m != nil { - return m.File - } - return nil -} - -// Represents a single generated file. -type CodeGeneratorResponse_File struct { - // The file name, relative to the output directory. The name must not - // contain "." or ".." components and must be relative, not be absolute (so, - // the file cannot lie outside the output directory). "/" must be used as - // the path separator, not "\". - // - // If the name is omitted, the content will be appended to the previous - // file. This allows the generator to break large files into small chunks, - // and allows the generated text to be streamed back to protoc so that large - // files need not reside completely in memory at one time. Note that as of - // this writing protoc does not optimize for this -- it will read the entire - // CodeGeneratorResponse before writing files to disk. - Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - // If non-empty, indicates that the named file should already exist, and the - // content here is to be inserted into that file at a defined insertion - // point. This feature allows a code generator to extend the output - // produced by another code generator. The original generator may provide - // insertion points by placing special annotations in the file that look - // like: - // @@protoc_insertion_point(NAME) - // The annotation can have arbitrary text before and after it on the line, - // which allows it to be placed in a comment. NAME should be replaced with - // an identifier naming the point -- this is what other generators will use - // as the insertion_point. Code inserted at this point will be placed - // immediately above the line containing the insertion point (thus multiple - // insertions to the same point will come out in the order they were added). - // The double-@ is intended to make it unlikely that the generated code - // could contain things that look like insertion points by accident. - // - // For example, the C++ code generator places the following line in the - // .pb.h files that it generates: - // // @@protoc_insertion_point(namespace_scope) - // This line appears within the scope of the file's package namespace, but - // outside of any particular class. Another plugin can then specify the - // insertion_point "namespace_scope" to generate additional classes or - // other declarations that should be placed in this scope. - // - // Note that if the line containing the insertion point begins with - // whitespace, the same whitespace will be added to every line of the - // inserted text. This is useful for languages like Python, where - // indentation matters. In these languages, the insertion point comment - // should be indented the same amount as any inserted code will need to be - // in order to work correctly in that context. - // - // The code generator that generates the initial file and the one which - // inserts into it must both run as part of a single invocation of protoc. - // Code generators are executed in the order in which they appear on the - // command line. - // - // If |insertion_point| is present, |name| must also be present. - InsertionPoint *string `protobuf:"bytes,2,opt,name=insertion_point,json=insertionPoint" json:"insertion_point,omitempty"` - // The file contents. - Content *string `protobuf:"bytes,15,opt,name=content" json:"content,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *CodeGeneratorResponse_File) Reset() { *m = CodeGeneratorResponse_File{} } -func (m *CodeGeneratorResponse_File) String() string { return proto.CompactTextString(m) } -func (*CodeGeneratorResponse_File) ProtoMessage() {} -func (*CodeGeneratorResponse_File) Descriptor() ([]byte, []int) { - return fileDescriptorPlugin, []int{1, 0} -} - -func (m *CodeGeneratorResponse_File) GetName() string { - if m != nil && m.Name != nil { - return *m.Name - } - return "" -} - -func (m *CodeGeneratorResponse_File) GetInsertionPoint() string { - if m != nil && m.InsertionPoint != nil { - return *m.InsertionPoint - } - return "" -} - -func (m *CodeGeneratorResponse_File) GetContent() string { - if m != nil && m.Content != nil { - return *m.Content - } - return "" -} - -func init() { - proto.RegisterType((*CodeGeneratorRequest)(nil), "google.protobuf.compiler.CodeGeneratorRequest") - proto.RegisterType((*CodeGeneratorResponse)(nil), "google.protobuf.compiler.CodeGeneratorResponse") - proto.RegisterType((*CodeGeneratorResponse_File)(nil), "google.protobuf.compiler.CodeGeneratorResponse.File") -} - -func init() { proto.RegisterFile("plugin.proto", fileDescriptorPlugin) } - -var fileDescriptorPlugin = []byte{ - // 304 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x51, 0xc1, 0x4a, 0xc3, 0x40, - 0x10, 0x25, 0xb6, 0x22, 0x19, 0x4b, 0x2b, 0x4b, 0x85, 0xa5, 0xf4, 0x10, 0x8a, 0x60, 0x4e, 0x29, - 0x88, 0xe0, 0xbd, 0x15, 0xf5, 0x58, 0x82, 0x27, 0x41, 0x42, 0x4c, 0xa7, 0x61, 0x21, 0xd9, 0x59, - 0x27, 0xdb, 0x2f, 0xf2, 0x9f, 0xfc, 0x1e, 0xd9, 0xdd, 0xb6, 0x4a, 0xb1, 0xb7, 0x7d, 0xef, 0xcd, - 0xcc, 0x7b, 0x3b, 0x03, 0x03, 0xd3, 0x6c, 0x6b, 0xa5, 0x33, 0xc3, 0x64, 0x49, 0xc8, 0x9a, 0xa8, - 0x6e, 0x30, 0xa0, 0x8f, 0xed, 0x26, 0xab, 0xa8, 0x35, 0xaa, 0x41, 0x9e, 0x24, 0x41, 0x99, 0xef, - 0x95, 0xf9, 0x1a, 0xbb, 0x8a, 0x95, 0xb1, 0xc4, 0xa1, 0x7a, 0xf6, 0x15, 0xc1, 0x78, 0x49, 0x6b, - 0x7c, 0x46, 0x8d, 0x5c, 0x5a, 0xe2, 0x1c, 0x3f, 0xb7, 0xd8, 0x59, 0x91, 0xc2, 0xd5, 0x46, 0x35, - 0x58, 0x58, 0x2a, 0xea, 0xa0, 0xa1, 0x8c, 0x92, 0x5e, 0x1a, 0xe7, 0x43, 0xc7, 0xbf, 0xd2, 0xae, - 0x03, 0xc5, 0x14, 0x62, 0x53, 0x72, 0xd9, 0xa2, 0x45, 0x96, 0x67, 0x49, 0x94, 0xc6, 0xf9, 0x2f, - 0x21, 0x96, 0x00, 0xde, 0xa9, 0x70, 0x5d, 0x72, 0x94, 0xf4, 0xd2, 0xcb, 0xbb, 0x9b, 0xec, 0x38, - 0xf1, 0x93, 0x6a, 0xf0, 0xf1, 0x90, 0x6d, 0xe5, 0xe8, 0x3c, 0xf6, 0xaa, 0x53, 0x66, 0xdf, 0x11, - 0x5c, 0x1f, 0xa5, 0xec, 0x0c, 0xe9, 0x0e, 0xc5, 0x18, 0xce, 0x91, 0x99, 0x58, 0x46, 0xde, 0x38, - 0x00, 0xf1, 0x02, 0xfd, 0x3f, 0x76, 0xf7, 0xd9, 0xa9, 0x05, 0x65, 0xff, 0x0e, 0xf5, 0x69, 0x72, - 0x3f, 0x61, 0xf2, 0x0e, 0x7d, 0x87, 0x84, 0x80, 0xbe, 0x2e, 0x5b, 0xdc, 0xd9, 0xf8, 0xb7, 0xb8, - 0x85, 0x91, 0xd2, 0x1d, 0xb2, 0x55, 0xa4, 0x0b, 0x43, 0x4a, 0xdb, 0xdd, 0xf7, 0x87, 0x07, 0x7a, - 0xe5, 0x58, 0x21, 0xe1, 0xa2, 0x22, 0x6d, 0x51, 0x5b, 0x39, 0xf2, 0x05, 0x7b, 0xb8, 0x78, 0x80, - 0x69, 0x45, 0xed, 0xc9, 0x7c, 0x8b, 0xc1, 0xca, 0x1f, 0xda, 0x2f, 0xa4, 0x7b, 0x8b, 0xc3, 0xd9, - 0x8b, 0x9a, 0x7e, 0x02, 0x00, 0x00, 0xff, 0xff, 0x70, 0xa2, 0xbd, 0x30, 0x02, 0x02, 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogofast/main.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogofast/main.go deleted file mode 100644 index 96c18d9fc70..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogofast/main.go +++ /dev/null @@ -1,47 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2015, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package main - -import ( - "github.com/gogo/protobuf/vanity" - "github.com/gogo/protobuf/vanity/command" -) - -func main() { - req := command.Read() - files := req.GetProtoFile() - files = vanity.FilterFiles(files, vanity.NotGoogleProtobufDescriptorProto) - - vanity.ForEachFile(files, vanity.TurnOnMarshalerAll) - vanity.ForEachFile(files, vanity.TurnOnSizerAll) - vanity.ForEachFile(files, vanity.TurnOnUnmarshalerAll) - - resp := command.Generate(req) - command.Write(resp) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogofaster/main.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogofaster/main.go deleted file mode 100644 index ba3e7e155fb..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogofaster/main.go +++ /dev/null @@ -1,50 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2015, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package main - -import ( - "github.com/gogo/protobuf/vanity" - "github.com/gogo/protobuf/vanity/command" -) - -func main() { - req := command.Read() - files := req.GetProtoFile() - files = vanity.FilterFiles(files, vanity.NotGoogleProtobufDescriptorProto) - - vanity.ForEachFile(files, vanity.TurnOnMarshalerAll) - vanity.ForEachFile(files, vanity.TurnOnSizerAll) - vanity.ForEachFile(files, vanity.TurnOnUnmarshalerAll) - - vanity.ForEachFieldInFilesExcludingExtensions(vanity.OnlyProto2(files), vanity.TurnOffNullableForNativeTypesWithoutDefaultsOnly) - vanity.ForEachFile(files, vanity.TurnOffGoUnrecognizedAll) - - resp := command.Generate(req) - command.Write(resp) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogoslick/main.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogoslick/main.go deleted file mode 100644 index 235bd64af75..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogoslick/main.go +++ /dev/null @@ -1,59 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2015, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package main - -import ( - "github.com/gogo/protobuf/vanity" - "github.com/gogo/protobuf/vanity/command" -) - -func main() { - req := command.Read() - files := req.GetProtoFile() - files = vanity.FilterFiles(files, vanity.NotGoogleProtobufDescriptorProto) - - vanity.ForEachFile(files, vanity.TurnOnMarshalerAll) - vanity.ForEachFile(files, vanity.TurnOnSizerAll) - vanity.ForEachFile(files, vanity.TurnOnUnmarshalerAll) - - vanity.ForEachFieldInFilesExcludingExtensions(vanity.OnlyProto2(files), vanity.TurnOffNullableForNativeTypesWithoutDefaultsOnly) - vanity.ForEachFile(files, vanity.TurnOffGoUnrecognizedAll) - - vanity.ForEachFile(files, vanity.TurnOffGoEnumPrefixAll) - vanity.ForEachFile(files, vanity.TurnOffGoEnumStringerAll) - vanity.ForEachFile(files, vanity.TurnOnEnumStringerAll) - - vanity.ForEachFile(files, vanity.TurnOnEqualAll) - vanity.ForEachFile(files, vanity.TurnOnGoStringAll) - vanity.ForEachFile(files, vanity.TurnOffGoStringerAll) - vanity.ForEachFile(files, vanity.TurnOnStringerAll) - - resp := command.Generate(req) - command.Write(resp) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogotypes/main.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogotypes/main.go deleted file mode 100644 index d227a264f2a..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gogotypes/main.go +++ /dev/null @@ -1,75 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2015, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package main - -import ( - "strings" - - "github.com/gogo/protobuf/vanity" - "github.com/gogo/protobuf/vanity/command" -) - -func main() { - req := command.Read() - files := req.GetProtoFile() - files = vanity.FilterFiles(files, vanity.NotGoogleProtobufDescriptorProto) - - vanity.ForEachFile(files, vanity.TurnOnMarshalerAll) - vanity.ForEachFile(files, vanity.TurnOnSizerAll) - vanity.ForEachFile(files, vanity.TurnOnUnmarshalerAll) - - vanity.ForEachFile(files, vanity.TurnOffGoEnumPrefixAll) - vanity.ForEachFile(files, vanity.TurnOffGoEnumStringerAll) - vanity.ForEachFile(files, vanity.TurnOnEnumStringerAll) - - vanity.ForEachFile(files, vanity.TurnOnEqualAll) - vanity.ForEachFile(files, vanity.TurnOnGoStringAll) - vanity.ForEachFile(files, vanity.TurnOffGoStringerAll) - - for _, file := range files { - if strings.HasSuffix(file.GetName(), "struct.proto") { - // TODO struct can also get a compare method when - // https://github.com/gogo/protobuf/issues/221 is fixed - continue - } - vanity.TurnOnCompareAll(file) - } - - for _, file := range files { - if strings.HasSuffix(file.GetName(), "timestamp.proto") || - strings.HasSuffix(file.GetName(), "duration.proto") { - continue - } - vanity.TurnOnStringerAll(file) - vanity.TurnOnPopulateAll(file) - } - - resp := command.Generate(req) - command.Write(resp) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gostring/main.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gostring/main.go deleted file mode 100644 index 9c7dd6b85e1..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-gen-gostring/main.go +++ /dev/null @@ -1,42 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2016, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package main - -import ( - "github.com/gogo/protobuf/plugin/gostring" - "github.com/gogo/protobuf/vanity/command" -) - -func main() { - req := command.Read() - p := gostring.NewGoString() - p.Overwrite() - resp := command.GeneratePlugin(req, p, "_gostring.gen.go") - command.Write(resp) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-min-version/minversion.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-min-version/minversion.go deleted file mode 100644 index b8434d50401..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/protoc-min-version/minversion.go +++ /dev/null @@ -1,65 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package main - -import ( - "fmt" - "github.com/gogo/protobuf/version" - "os" - "os/exec" - "strings" -) - -func filter(ss []string, flag string) ([]string, string) { - s := make([]string, 0, len(ss)) - var v string - for i := range ss { - if strings.Contains(ss[i], flag) { - vs := strings.Split(ss[i], "=") - v = vs[1] - continue - } - s = append(s, ss[i]) - } - return s, v -} - -func main() { - args, min := filter(os.Args[1:], "-version") - if !version.AtLeast(min) { - fmt.Printf("protoc version not high enough to parse this proto file\n") - return - } - gen := exec.Command("protoc", args...) - out, err := gen.CombinedOutput() - if err != nil { - fmt.Printf("%s\n", string(out)) - panic(err) - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/sortkeys/sortkeys.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/sortkeys/sortkeys.go deleted file mode 100644 index ceadde6a5e1..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/sortkeys/sortkeys.go +++ /dev/null @@ -1,101 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package sortkeys - -import ( - "sort" -) - -func Strings(l []string) { - sort.Strings(l) -} - -func Float64s(l []float64) { - sort.Float64s(l) -} - -func Float32s(l []float32) { - sort.Sort(Float32Slice(l)) -} - -func Int64s(l []int64) { - sort.Sort(Int64Slice(l)) -} - -func Int32s(l []int32) { - sort.Sort(Int32Slice(l)) -} - -func Uint64s(l []uint64) { - sort.Sort(Uint64Slice(l)) -} - -func Uint32s(l []uint32) { - sort.Sort(Uint32Slice(l)) -} - -func Bools(l []bool) { - sort.Sort(BoolSlice(l)) -} - -type BoolSlice []bool - -func (p BoolSlice) Len() int { return len(p) } -func (p BoolSlice) Less(i, j int) bool { return p[j] } -func (p BoolSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } - -type Int64Slice []int64 - -func (p Int64Slice) Len() int { return len(p) } -func (p Int64Slice) Less(i, j int) bool { return p[i] < p[j] } -func (p Int64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } - -type Int32Slice []int32 - -func (p Int32Slice) Len() int { return len(p) } -func (p Int32Slice) Less(i, j int) bool { return p[i] < p[j] } -func (p Int32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } - -type Uint64Slice []uint64 - -func (p Uint64Slice) Len() int { return len(p) } -func (p Uint64Slice) Less(i, j int) bool { return p[i] < p[j] } -func (p Uint64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } - -type Uint32Slice []uint32 - -func (p Uint32Slice) Len() int { return len(p) } -func (p Uint32Slice) Less(i, j int) bool { return p[i] < p[j] } -func (p Uint32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } - -type Float32Slice []float32 - -func (p Float32Slice) Len() int { return len(p) } -func (p Float32Slice) Less(i, j int) bool { return p[i] < p[j] } -func (p Float32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/any.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/any.go deleted file mode 100644 index c10caf40557..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/any.go +++ /dev/null @@ -1,135 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package types - -// This file implements functions to marshal proto.Message to/from -// google.protobuf.Any message. - -import ( - "fmt" - "reflect" - "strings" - - "github.com/gogo/protobuf/proto" -) - -const googleApis = "type.googleapis.com/" - -// AnyMessageName returns the name of the message contained in a google.protobuf.Any message. -// -// Note that regular type assertions should be done using the Is -// function. AnyMessageName is provided for less common use cases like filtering a -// sequence of Any messages based on a set of allowed message type names. -func AnyMessageName(any *Any) (string, error) { - slash := strings.LastIndex(any.TypeUrl, "/") - if slash < 0 { - return "", fmt.Errorf("message type url %q is invalid", any.TypeUrl) - } - return any.TypeUrl[slash+1:], nil -} - -// MarshalAny takes the protocol buffer and encodes it into google.protobuf.Any. -func MarshalAny(pb proto.Message) (*Any, error) { - value, err := proto.Marshal(pb) - if err != nil { - return nil, err - } - return &Any{TypeUrl: googleApis + proto.MessageName(pb), Value: value}, nil -} - -// DynamicAny is a value that can be passed to UnmarshalAny to automatically -// allocate a proto.Message for the type specified in a google.protobuf.Any -// message. The allocated message is stored in the embedded proto.Message. -// -// Example: -// -// var x ptypes.DynamicAny -// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... } -// fmt.Printf("unmarshaled message: %v", x.Message) -type DynamicAny struct { - proto.Message -} - -// Empty returns a new proto.Message of the type specified in a -// google.protobuf.Any message. It returns an error if corresponding message -// type isn't linked in. -func EmptyAny(any *Any) (proto.Message, error) { - aname, err := AnyMessageName(any) - if err != nil { - return nil, err - } - - t := proto.MessageType(aname) - if t == nil { - return nil, fmt.Errorf("any: message type %q isn't linked in", aname) - } - return reflect.New(t.Elem()).Interface().(proto.Message), nil -} - -// UnmarshalAny parses the protocol buffer representation in a google.protobuf.Any -// message and places the decoded result in pb. It returns an error if type of -// contents of Any message does not match type of pb message. -// -// pb can be a proto.Message, or a *DynamicAny. -func UnmarshalAny(any *Any, pb proto.Message) error { - if d, ok := pb.(*DynamicAny); ok { - if d.Message == nil { - var err error - d.Message, err = EmptyAny(any) - if err != nil { - return err - } - } - return UnmarshalAny(any, d.Message) - } - - aname, err := AnyMessageName(any) - if err != nil { - return err - } - - mname := proto.MessageName(pb) - if aname != mname { - return fmt.Errorf("mismatched message type: got %q want %q", aname, mname) - } - return proto.Unmarshal(any.Value, pb) -} - -// Is returns true if any value contains a given message type. -func Is(any *Any, pb proto.Message) bool { - aname, err := AnyMessageName(any) - if err != nil { - return false - } - - return aname == proto.MessageName(pb) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/any.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/any.pb.go deleted file mode 100644 index ebd976e3d0d..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/any.pb.go +++ /dev/null @@ -1,687 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: any.proto -// DO NOT EDIT! - -/* - Package types is a generated protocol buffer package. - - It is generated from these files: - any.proto - - It has these top-level messages: - Any -*/ -package types - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" - -import bytes "bytes" - -import strings "strings" -import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" -import sort "sort" -import strconv "strconv" -import reflect "reflect" - -import io "io" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -// `Any` contains an arbitrary serialized protocol buffer message along with a -// URL that describes the type of the serialized message. -// -// Protobuf library provides support to pack/unpack Any values in the form -// of utility functions or additional generated methods of the Any type. -// -// Example 1: Pack and unpack a message in C++. -// -// Foo foo = ...; -// Any any; -// any.PackFrom(foo); -// ... -// if (any.UnpackTo(&foo)) { -// ... -// } -// -// Example 2: Pack and unpack a message in Java. -// -// Foo foo = ...; -// Any any = Any.pack(foo); -// ... -// if (any.is(Foo.class)) { -// foo = any.unpack(Foo.class); -// } -// -// Example 3: Pack and unpack a message in Python. -// -// foo = Foo(...) -// any = Any() -// any.Pack(foo) -// ... -// if any.Is(Foo.DESCRIPTOR): -// any.Unpack(foo) -// ... -// -// The pack methods provided by protobuf library will by default use -// 'type.googleapis.com/full.type.name' as the type URL and the unpack -// methods only use the fully qualified type name after the last '/' -// in the type URL, for example "foo.bar.com/x/y.z" will yield type -// name "y.z". -// -// -// JSON -// ==== -// The JSON representation of an `Any` value uses the regular -// representation of the deserialized, embedded message, with an -// additional field `@type` which contains the type URL. Example: -// -// package google.profile; -// message Person { -// string first_name = 1; -// string last_name = 2; -// } -// -// { -// "@type": "type.googleapis.com/google.profile.Person", -// "firstName": , -// "lastName": -// } -// -// If the embedded message type is well-known and has a custom JSON -// representation, that representation will be embedded adding a field -// `value` which holds the custom JSON in addition to the `@type` -// field. Example (for message [google.protobuf.Duration][]): -// -// { -// "@type": "type.googleapis.com/google.protobuf.Duration", -// "value": "1.212s" -// } -// -type Any struct { - // A URL/resource name whose content describes the type of the - // serialized protocol buffer message. - // - // For URLs which use the scheme `http`, `https`, or no scheme, the - // following restrictions and interpretations apply: - // - // * If no scheme is provided, `https` is assumed. - // * The last segment of the URL's path must represent the fully - // qualified name of the type (as in `path/google.protobuf.Duration`). - // The name should be in a canonical form (e.g., leading "." is - // not accepted). - // * An HTTP GET on the URL must yield a [google.protobuf.Type][] - // value in binary format, or produce an error. - // * Applications are allowed to cache lookup results based on the - // URL, or have them precompiled into a binary to avoid any - // lookup. Therefore, binary compatibility needs to be preserved - // on changes to types. (Use versioned type names to manage - // breaking changes.) - // - // Schemes other than `http`, `https` (or the empty scheme) might be - // used with implementation specific semantics. - // - TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` - // Must be a valid serialized protocol buffer of the above specified type. - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *Any) Reset() { *m = Any{} } -func (*Any) ProtoMessage() {} -func (*Any) Descriptor() ([]byte, []int) { return fileDescriptorAny, []int{0} } -func (*Any) XXX_WellKnownType() string { return "Any" } - -func (m *Any) GetTypeUrl() string { - if m != nil { - return m.TypeUrl - } - return "" -} - -func (m *Any) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -func init() { - proto.RegisterType((*Any)(nil), "google.protobuf.Any") -} -func (this *Any) Compare(that interface{}) int { - if that == nil { - if this == nil { - return 0 - } - return 1 - } - - that1, ok := that.(*Any) - if !ok { - that2, ok := that.(Any) - if ok { - that1 = &that2 - } else { - return 1 - } - } - if that1 == nil { - if this == nil { - return 0 - } - return 1 - } else if this == nil { - return -1 - } - if this.TypeUrl != that1.TypeUrl { - if this.TypeUrl < that1.TypeUrl { - return -1 - } - return 1 - } - if c := bytes.Compare(this.Value, that1.Value); c != 0 { - return c - } - return 0 -} -func (this *Any) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*Any) - if !ok { - that2, ok := that.(Any) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if this.TypeUrl != that1.TypeUrl { - return false - } - if !bytes.Equal(this.Value, that1.Value) { - return false - } - return true -} -func (this *Any) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&types.Any{") - s = append(s, "TypeUrl: "+fmt.Sprintf("%#v", this.TypeUrl)+",\n") - s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringAny(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func extensionToGoStringAny(m github_com_gogo_protobuf_proto.Message) string { - e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) - if e == nil { - return "nil" - } - s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" - keys := make([]int, 0, len(e)) - for k := range e { - keys = append(keys, int(k)) - } - sort.Ints(keys) - ss := []string{} - for _, k := range keys { - ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) - } - s += strings.Join(ss, ",") + "})" - return s -} -func (m *Any) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Any) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.TypeUrl) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintAny(dAtA, i, uint64(len(m.TypeUrl))) - i += copy(dAtA[i:], m.TypeUrl) - } - if len(m.Value) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintAny(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) - } - return i, nil -} - -func encodeFixed64Any(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Any(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintAny(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func NewPopulatedAny(r randyAny, easy bool) *Any { - this := &Any{} - this.TypeUrl = string(randStringAny(r)) - v1 := r.Intn(100) - this.Value = make([]byte, v1) - for i := 0; i < v1; i++ { - this.Value[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -type randyAny interface { - Float32() float32 - Float64() float64 - Int63() int64 - Int31() int32 - Uint32() uint32 - Intn(n int) int -} - -func randUTF8RuneAny(r randyAny) rune { - ru := r.Intn(62) - if ru < 10 { - return rune(ru + 48) - } else if ru < 36 { - return rune(ru + 55) - } - return rune(ru + 61) -} -func randStringAny(r randyAny) string { - v2 := r.Intn(100) - tmps := make([]rune, v2) - for i := 0; i < v2; i++ { - tmps[i] = randUTF8RuneAny(r) - } - return string(tmps) -} -func randUnrecognizedAny(r randyAny, maxFieldNumber int) (dAtA []byte) { - l := r.Intn(5) - for i := 0; i < l; i++ { - wire := r.Intn(4) - if wire == 3 { - wire = 5 - } - fieldNumber := maxFieldNumber + r.Intn(100) - dAtA = randFieldAny(dAtA, r, fieldNumber, wire) - } - return dAtA -} -func randFieldAny(dAtA []byte, r randyAny, fieldNumber int, wire int) []byte { - key := uint32(fieldNumber)<<3 | uint32(wire) - switch wire { - case 0: - dAtA = encodeVarintPopulateAny(dAtA, uint64(key)) - v3 := r.Int63() - if r.Intn(2) == 0 { - v3 *= -1 - } - dAtA = encodeVarintPopulateAny(dAtA, uint64(v3)) - case 1: - dAtA = encodeVarintPopulateAny(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - case 2: - dAtA = encodeVarintPopulateAny(dAtA, uint64(key)) - ll := r.Intn(100) - dAtA = encodeVarintPopulateAny(dAtA, uint64(ll)) - for j := 0; j < ll; j++ { - dAtA = append(dAtA, byte(r.Intn(256))) - } - default: - dAtA = encodeVarintPopulateAny(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - } - return dAtA -} -func encodeVarintPopulateAny(dAtA []byte, v uint64) []byte { - for v >= 1<<7 { - dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) - v >>= 7 - } - dAtA = append(dAtA, uint8(v)) - return dAtA -} -func (m *Any) Size() (n int) { - var l int - _ = l - l = len(m.TypeUrl) - if l > 0 { - n += 1 + l + sovAny(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovAny(uint64(l)) - } - return n -} - -func sovAny(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozAny(x uint64) (n int) { - return sovAny(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *Any) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Any{`, - `TypeUrl:` + fmt.Sprintf("%v", this.TypeUrl) + `,`, - `Value:` + fmt.Sprintf("%v", this.Value) + `,`, - `}`, - }, "") - return s -} -func valueToStringAny(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *Any) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAny - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Any: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Any: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TypeUrl", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAny - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthAny - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TypeUrl = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAny - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAny - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAny(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthAny - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipAny(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAny - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAny - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAny - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthAny - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAny - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipAny(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthAny = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowAny = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("any.proto", fileDescriptorAny) } - -var fileDescriptorAny = []byte{ - // 208 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x4c, 0xcc, 0xab, 0xd4, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x4f, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0x85, 0xf0, 0x92, - 0x4a, 0xd3, 0x94, 0xcc, 0xb8, 0x98, 0x1d, 0xf3, 0x2a, 0x85, 0x24, 0xb9, 0x38, 0x4a, 0x2a, 0x0b, - 0x52, 0xe3, 0x4b, 0x8b, 0x72, 0x24, 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0xd8, 0x41, 0xfc, 0xd0, - 0xa2, 0x1c, 0x21, 0x11, 0x2e, 0xd6, 0xb2, 0xc4, 0x9c, 0xd2, 0x54, 0x09, 0x26, 0x05, 0x46, 0x0d, - 0x9e, 0x20, 0x08, 0xc7, 0xa9, 0x89, 0xf1, 0xc2, 0x43, 0x39, 0x86, 0x1b, 0x0f, 0xe5, 0x18, 0x3e, - 0x3c, 0x94, 0x63, 0xfc, 0xf1, 0x50, 0x8e, 0xb1, 0xe1, 0x91, 0x1c, 0xe3, 0x8a, 0x47, 0x72, 0x8c, - 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8b, 0x47, 0x72, - 0x0c, 0x1f, 0x40, 0xe2, 0x8f, 0xe5, 0x18, 0xb9, 0x84, 0x93, 0xf3, 0x73, 0xf5, 0xd0, 0xec, 0x77, - 0xe2, 0x70, 0xcc, 0xab, 0x0c, 0x00, 0x71, 0x02, 0x18, 0xa3, 0x58, 0x41, 0x56, 0x16, 0x2f, 0x60, - 0x64, 0x5c, 0xc4, 0xc4, 0xec, 0x1e, 0xe0, 0xb4, 0x8a, 0x49, 0xce, 0x1d, 0xa2, 0x3a, 0x00, 0xaa, - 0x5a, 0x2f, 0x3c, 0x35, 0x27, 0xc7, 0x3b, 0x2f, 0xbf, 0x3c, 0x2f, 0x04, 0xa4, 0x32, 0x89, 0x0d, - 0x6c, 0x8c, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x63, 0x5d, 0x2d, 0x27, 0xe1, 0x00, 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/doc.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/doc.go deleted file mode 100644 index ff2810af1ee..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/doc.go +++ /dev/null @@ -1,35 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -/* -Package types contains code for interacting with well-known types. -*/ -package types diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration.go deleted file mode 100644 index 475d61f1db2..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration.go +++ /dev/null @@ -1,100 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package types - -// This file implements conversions between google.protobuf.Duration -// and time.Duration. - -import ( - "errors" - "fmt" - "time" -) - -const ( - // Range of a Duration in seconds, as specified in - // google/protobuf/duration.proto. This is about 10,000 years in seconds. - maxSeconds = int64(10000 * 365.25 * 24 * 60 * 60) - minSeconds = -maxSeconds -) - -// validateDuration determines whether the Duration is valid according to the -// definition in google/protobuf/duration.proto. A valid Duration -// may still be too large to fit into a time.Duration (the range of Duration -// is about 10,000 years, and the range of time.Duration is about 290). -func validateDuration(d *Duration) error { - if d == nil { - return errors.New("duration: nil Duration") - } - if d.Seconds < minSeconds || d.Seconds > maxSeconds { - return fmt.Errorf("duration: %#v: seconds out of range", d) - } - if d.Nanos <= -1e9 || d.Nanos >= 1e9 { - return fmt.Errorf("duration: %#v: nanos out of range", d) - } - // Seconds and Nanos must have the same sign, unless d.Nanos is zero. - if (d.Seconds < 0 && d.Nanos > 0) || (d.Seconds > 0 && d.Nanos < 0) { - return fmt.Errorf("duration: %#v: seconds and nanos have different signs", d) - } - return nil -} - -// DurationFromProto converts a Duration to a time.Duration. DurationFromProto -// returns an error if the Duration is invalid or is too large to be -// represented in a time.Duration. -func DurationFromProto(p *Duration) (time.Duration, error) { - if err := validateDuration(p); err != nil { - return 0, err - } - d := time.Duration(p.Seconds) * time.Second - if int64(d/time.Second) != p.Seconds { - return 0, fmt.Errorf("duration: %#v is out of range for time.Duration", p) - } - if p.Nanos != 0 { - d += time.Duration(p.Nanos) - if (d < 0) != (p.Nanos < 0) { - return 0, fmt.Errorf("duration: %#v is out of range for time.Duration", p) - } - } - return d, nil -} - -// DurationProto converts a time.Duration to a Duration. -func DurationProto(d time.Duration) *Duration { - nanos := d.Nanoseconds() - secs := nanos / 1e9 - nanos -= secs * 1e9 - return &Duration{ - Seconds: secs, - Nanos: int32(nanos), - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration.pb.go deleted file mode 100644 index dcaaa644285..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration.pb.go +++ /dev/null @@ -1,515 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: duration.proto -// DO NOT EDIT! - -/* - Package types is a generated protocol buffer package. - - It is generated from these files: - duration.proto - - It has these top-level messages: - Duration -*/ -package types - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" - -import strings "strings" -import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" -import sort "sort" -import strconv "strconv" -import reflect "reflect" - -import io "io" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -// A Duration represents a signed, fixed-length span of time represented -// as a count of seconds and fractions of seconds at nanosecond -// resolution. It is independent of any calendar and concepts like "day" -// or "month". It is related to Timestamp in that the difference between -// two Timestamp values is a Duration and it can be added or subtracted -// from a Timestamp. Range is approximately +-10,000 years. -// -// Example 1: Compute Duration from two Timestamps in pseudo code. -// -// Timestamp start = ...; -// Timestamp end = ...; -// Duration duration = ...; -// -// duration.seconds = end.seconds - start.seconds; -// duration.nanos = end.nanos - start.nanos; -// -// if (duration.seconds < 0 && duration.nanos > 0) { -// duration.seconds += 1; -// duration.nanos -= 1000000000; -// } else if (durations.seconds > 0 && duration.nanos < 0) { -// duration.seconds -= 1; -// duration.nanos += 1000000000; -// } -// -// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. -// -// Timestamp start = ...; -// Duration duration = ...; -// Timestamp end = ...; -// -// end.seconds = start.seconds + duration.seconds; -// end.nanos = start.nanos + duration.nanos; -// -// if (end.nanos < 0) { -// end.seconds -= 1; -// end.nanos += 1000000000; -// } else if (end.nanos >= 1000000000) { -// end.seconds += 1; -// end.nanos -= 1000000000; -// } -// -// -type Duration struct { - // Signed seconds of the span of time. Must be from -315,576,000,000 - // to +315,576,000,000 inclusive. - Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` - // Signed fractions of a second at nanosecond resolution of the span - // of time. Durations less than one second are represented with a 0 - // `seconds` field and a positive or negative `nanos` field. For durations - // of one second or more, a non-zero value for the `nanos` field must be - // of the same sign as the `seconds` field. Must be from -999,999,999 - // to +999,999,999 inclusive. - Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` -} - -func (m *Duration) Reset() { *m = Duration{} } -func (*Duration) ProtoMessage() {} -func (*Duration) Descriptor() ([]byte, []int) { return fileDescriptorDuration, []int{0} } -func (*Duration) XXX_WellKnownType() string { return "Duration" } - -func (m *Duration) GetSeconds() int64 { - if m != nil { - return m.Seconds - } - return 0 -} - -func (m *Duration) GetNanos() int32 { - if m != nil { - return m.Nanos - } - return 0 -} - -func init() { - proto.RegisterType((*Duration)(nil), "google.protobuf.Duration") -} -func (this *Duration) Compare(that interface{}) int { - if that == nil { - if this == nil { - return 0 - } - return 1 - } - - that1, ok := that.(*Duration) - if !ok { - that2, ok := that.(Duration) - if ok { - that1 = &that2 - } else { - return 1 - } - } - if that1 == nil { - if this == nil { - return 0 - } - return 1 - } else if this == nil { - return -1 - } - if this.Seconds != that1.Seconds { - if this.Seconds < that1.Seconds { - return -1 - } - return 1 - } - if this.Nanos != that1.Nanos { - if this.Nanos < that1.Nanos { - return -1 - } - return 1 - } - return 0 -} -func (this *Duration) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*Duration) - if !ok { - that2, ok := that.(Duration) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if this.Seconds != that1.Seconds { - return false - } - if this.Nanos != that1.Nanos { - return false - } - return true -} -func (this *Duration) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&types.Duration{") - s = append(s, "Seconds: "+fmt.Sprintf("%#v", this.Seconds)+",\n") - s = append(s, "Nanos: "+fmt.Sprintf("%#v", this.Nanos)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringDuration(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func extensionToGoStringDuration(m github_com_gogo_protobuf_proto.Message) string { - e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) - if e == nil { - return "nil" - } - s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" - keys := make([]int, 0, len(e)) - for k := range e { - keys = append(keys, int(k)) - } - sort.Ints(keys) - ss := []string{} - for _, k := range keys { - ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) - } - s += strings.Join(ss, ",") + "})" - return s -} -func (m *Duration) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Duration) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Seconds != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintDuration(dAtA, i, uint64(m.Seconds)) - } - if m.Nanos != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintDuration(dAtA, i, uint64(m.Nanos)) - } - return i, nil -} - -func encodeFixed64Duration(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Duration(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintDuration(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *Duration) Size() (n int) { - var l int - _ = l - if m.Seconds != 0 { - n += 1 + sovDuration(uint64(m.Seconds)) - } - if m.Nanos != 0 { - n += 1 + sovDuration(uint64(m.Nanos)) - } - return n -} - -func sovDuration(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozDuration(x uint64) (n int) { - return sovDuration(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Duration) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDuration - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Duration: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Duration: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Seconds", wireType) - } - m.Seconds = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDuration - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Seconds |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Nanos", wireType) - } - m.Nanos = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDuration - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Nanos |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipDuration(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthDuration - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipDuration(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowDuration - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowDuration - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowDuration - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthDuration - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowDuration - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipDuration(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthDuration = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowDuration = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("duration.proto", fileDescriptorDuration) } - -var fileDescriptorDuration = []byte{ - // 203 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x4b, 0x29, 0x2d, 0x4a, - 0x2c, 0xc9, 0xcc, 0xcf, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x4f, 0xcf, 0xcf, 0x4f, - 0xcf, 0x49, 0x85, 0xf0, 0x92, 0x4a, 0xd3, 0x94, 0xac, 0xb8, 0x38, 0x5c, 0xa0, 0x4a, 0x84, 0x24, - 0xb8, 0xd8, 0x8b, 0x53, 0x93, 0xf3, 0xf3, 0x52, 0x8a, 0x25, 0x18, 0x15, 0x18, 0x35, 0x98, 0x83, - 0x60, 0x5c, 0x21, 0x11, 0x2e, 0xd6, 0xbc, 0xc4, 0xbc, 0xfc, 0x62, 0x09, 0x26, 0x05, 0x46, 0x0d, - 0xd6, 0x20, 0x08, 0xc7, 0xa9, 0xfe, 0xc2, 0x43, 0x39, 0x86, 0x1b, 0x0f, 0xe5, 0x18, 0x3e, 0x3c, - 0x94, 0x63, 0x5c, 0xf1, 0x48, 0x8e, 0xf1, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, - 0x3c, 0x92, 0x63, 0x7c, 0xf1, 0x48, 0x8e, 0xe1, 0xc3, 0x23, 0x39, 0xc6, 0x15, 0x8f, 0xe5, 0x18, - 0xb9, 0x84, 0x93, 0xf3, 0x73, 0xf5, 0xd0, 0xac, 0x76, 0xe2, 0x85, 0x59, 0x1c, 0x00, 0x12, 0x09, - 0x60, 0x8c, 0x62, 0x2d, 0xa9, 0x2c, 0x48, 0x2d, 0x5e, 0xc0, 0xc8, 0xb8, 0x88, 0x89, 0xd9, 0x3d, - 0xc0, 0x69, 0x15, 0x93, 0x9c, 0x3b, 0x44, 0x4b, 0x00, 0x54, 0x8b, 0x5e, 0x78, 0x6a, 0x4e, 0x8e, - 0x77, 0x5e, 0x7e, 0x79, 0x5e, 0x08, 0x48, 0x65, 0x12, 0x1b, 0xd8, 0x2c, 0x63, 0x40, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xba, 0xfb, 0x15, 0xc9, 0xe6, 0x00, 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration_gogo.go deleted file mode 100644 index 90e7670e21d..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/duration_gogo.go +++ /dev/null @@ -1,100 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2016, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package types - -import ( - "fmt" - "time" -) - -func NewPopulatedDuration(r interface { - Int63() int64 -}, easy bool) *Duration { - this := &Duration{} - maxSecs := time.Hour.Nanoseconds() / 1e9 - max := 2 * maxSecs - s := int64(r.Int63()) % max - s -= maxSecs - neg := int64(1) - if s < 0 { - neg = -1 - } - this.Seconds = s - this.Nanos = int32(neg * (r.Int63() % 1e9)) - return this -} - -func (d *Duration) String() string { - td, err := DurationFromProto(d) - if err != nil { - return fmt.Sprintf("(%v)", err) - } - return td.String() -} - -func NewPopulatedStdDuration(r interface { - Int63() int64 -}, easy bool) *time.Duration { - dur := NewPopulatedDuration(r, easy) - d, err := DurationFromProto(dur) - if err != nil { - return nil - } - return &d -} - -func SizeOfStdDuration(d time.Duration) int { - dur := DurationProto(d) - return dur.Size() -} - -func StdDurationMarshal(d time.Duration) ([]byte, error) { - size := SizeOfStdDuration(d) - buf := make([]byte, size) - _, err := StdDurationMarshalTo(d, buf) - return buf, err -} - -func StdDurationMarshalTo(d time.Duration, data []byte) (int, error) { - dur := DurationProto(d) - return dur.MarshalTo(data) -} - -func StdDurationUnmarshal(d *time.Duration, data []byte) error { - dur := &Duration{} - if err := dur.Unmarshal(data); err != nil { - return err - } - dd, err := DurationFromProto(dur) - if err != nil { - return err - } - *d = dd - return nil -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/empty.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/empty.pb.go deleted file mode 100644 index c94f81f7ce6..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/empty.pb.go +++ /dev/null @@ -1,478 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: empty.proto -// DO NOT EDIT! - -/* -Package types is a generated protocol buffer package. - -It is generated from these files: - empty.proto - -It has these top-level messages: - Empty -*/ -package types - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" - -import strings "strings" -import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" -import sort "sort" -import strconv "strconv" -import reflect "reflect" - -import io "io" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -// A generic empty message that you can re-use to avoid defining duplicated -// empty messages in your APIs. A typical example is to use it as the request -// or the response type of an API method. For instance: -// -// service Foo { -// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -// } -// -// The JSON representation for `Empty` is empty JSON object `{}`. -type Empty struct { -} - -func (m *Empty) Reset() { *m = Empty{} } -func (*Empty) ProtoMessage() {} -func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptorEmpty, []int{0} } -func (*Empty) XXX_WellKnownType() string { return "Empty" } - -func init() { - proto.RegisterType((*Empty)(nil), "google.protobuf.Empty") -} -func (this *Empty) Compare(that interface{}) int { - if that == nil { - if this == nil { - return 0 - } - return 1 - } - - that1, ok := that.(*Empty) - if !ok { - that2, ok := that.(Empty) - if ok { - that1 = &that2 - } else { - return 1 - } - } - if that1 == nil { - if this == nil { - return 0 - } - return 1 - } else if this == nil { - return -1 - } - return 0 -} -func (this *Empty) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*Empty) - if !ok { - that2, ok := that.(Empty) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - return true -} -func (this *Empty) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 4) - s = append(s, "&types.Empty{") - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringEmpty(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func extensionToGoStringEmpty(m github_com_gogo_protobuf_proto.Message) string { - e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) - if e == nil { - return "nil" - } - s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" - keys := make([]int, 0, len(e)) - for k := range e { - keys = append(keys, int(k)) - } - sort.Ints(keys) - ss := []string{} - for _, k := range keys { - ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) - } - s += strings.Join(ss, ",") + "})" - return s -} -func (m *Empty) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Empty) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - return i, nil -} - -func encodeFixed64Empty(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Empty(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintEmpty(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func NewPopulatedEmpty(r randyEmpty, easy bool) *Empty { - this := &Empty{} - if !easy && r.Intn(10) != 0 { - } - return this -} - -type randyEmpty interface { - Float32() float32 - Float64() float64 - Int63() int64 - Int31() int32 - Uint32() uint32 - Intn(n int) int -} - -func randUTF8RuneEmpty(r randyEmpty) rune { - ru := r.Intn(62) - if ru < 10 { - return rune(ru + 48) - } else if ru < 36 { - return rune(ru + 55) - } - return rune(ru + 61) -} -func randStringEmpty(r randyEmpty) string { - v1 := r.Intn(100) - tmps := make([]rune, v1) - for i := 0; i < v1; i++ { - tmps[i] = randUTF8RuneEmpty(r) - } - return string(tmps) -} -func randUnrecognizedEmpty(r randyEmpty, maxFieldNumber int) (dAtA []byte) { - l := r.Intn(5) - for i := 0; i < l; i++ { - wire := r.Intn(4) - if wire == 3 { - wire = 5 - } - fieldNumber := maxFieldNumber + r.Intn(100) - dAtA = randFieldEmpty(dAtA, r, fieldNumber, wire) - } - return dAtA -} -func randFieldEmpty(dAtA []byte, r randyEmpty, fieldNumber int, wire int) []byte { - key := uint32(fieldNumber)<<3 | uint32(wire) - switch wire { - case 0: - dAtA = encodeVarintPopulateEmpty(dAtA, uint64(key)) - v2 := r.Int63() - if r.Intn(2) == 0 { - v2 *= -1 - } - dAtA = encodeVarintPopulateEmpty(dAtA, uint64(v2)) - case 1: - dAtA = encodeVarintPopulateEmpty(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - case 2: - dAtA = encodeVarintPopulateEmpty(dAtA, uint64(key)) - ll := r.Intn(100) - dAtA = encodeVarintPopulateEmpty(dAtA, uint64(ll)) - for j := 0; j < ll; j++ { - dAtA = append(dAtA, byte(r.Intn(256))) - } - default: - dAtA = encodeVarintPopulateEmpty(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - } - return dAtA -} -func encodeVarintPopulateEmpty(dAtA []byte, v uint64) []byte { - for v >= 1<<7 { - dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) - v >>= 7 - } - dAtA = append(dAtA, uint8(v)) - return dAtA -} -func (m *Empty) Size() (n int) { - var l int - _ = l - return n -} - -func sovEmpty(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozEmpty(x uint64) (n int) { - return sovEmpty(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *Empty) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Empty{`, - `}`, - }, "") - return s -} -func valueToStringEmpty(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *Empty) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEmpty - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Empty: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Empty: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipEmpty(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthEmpty - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipEmpty(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEmpty - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEmpty - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEmpty - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthEmpty - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEmpty - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipEmpty(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthEmpty = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowEmpty = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("empty.proto", fileDescriptorEmpty) } - -var fileDescriptorEmpty = []byte{ - // 172 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x4e, 0xcd, 0x2d, 0x28, - 0xa9, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x4f, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0x85, - 0xf0, 0x92, 0x4a, 0xd3, 0x94, 0xd8, 0xb9, 0x58, 0x5d, 0x41, 0xf2, 0x4e, 0xed, 0x8c, 0x17, 0x1e, - 0xca, 0x31, 0xdc, 0x78, 0x28, 0xc7, 0xf0, 0xe1, 0xa1, 0x1c, 0xe3, 0x8f, 0x87, 0x72, 0x8c, 0x0d, - 0x8f, 0xe4, 0x18, 0x57, 0x3c, 0x92, 0x63, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, - 0x07, 0x8f, 0xe4, 0x18, 0x5f, 0x3c, 0x92, 0x63, 0xf8, 0x00, 0x12, 0x7f, 0x2c, 0xc7, 0xc8, 0x25, - 0x9c, 0x9c, 0x9f, 0xab, 0x87, 0x66, 0xa0, 0x13, 0x17, 0xd8, 0xb8, 0x00, 0x10, 0x37, 0x80, 0x31, - 0x8a, 0xb5, 0xa4, 0xb2, 0x20, 0xb5, 0x78, 0x01, 0x23, 0xe3, 0x0f, 0x46, 0xc6, 0x45, 0x4c, 0xcc, - 0xee, 0x01, 0x4e, 0xab, 0x98, 0xe4, 0xdc, 0x21, 0x5a, 0x02, 0xa0, 0x5a, 0xf4, 0xc2, 0x53, 0x73, - 0x72, 0xbc, 0xf3, 0xf2, 0xcb, 0xf3, 0x42, 0x40, 0x8a, 0x93, 0xd8, 0xc0, 0x66, 0x19, 0x03, 0x02, - 0x00, 0x00, 0xff, 0xff, 0x97, 0x6c, 0x95, 0xdd, 0xb9, 0x00, 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/field_mask.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/field_mask.pb.go deleted file mode 100644 index d5f19e3aa80..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/field_mask.pb.go +++ /dev/null @@ -1,759 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: field_mask.proto -// DO NOT EDIT! - -/* -Package types is a generated protocol buffer package. - -It is generated from these files: - field_mask.proto - -It has these top-level messages: - FieldMask -*/ -package types - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" - -import strings "strings" -import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" -import sort "sort" -import strconv "strconv" -import reflect "reflect" - -import io "io" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -// `FieldMask` represents a set of symbolic field paths, for example: -// -// paths: "f.a" -// paths: "f.b.d" -// -// Here `f` represents a field in some root message, `a` and `b` -// fields in the message found in `f`, and `d` a field found in the -// message in `f.b`. -// -// Field masks are used to specify a subset of fields that should be -// returned by a get operation or modified by an update operation. -// Field masks also have a custom JSON encoding (see below). -// -// # Field Masks in Projections -// -// When used in the context of a projection, a response message or -// sub-message is filtered by the API to only contain those fields as -// specified in the mask. For example, if the mask in the previous -// example is applied to a response message as follows: -// -// f { -// a : 22 -// b { -// d : 1 -// x : 2 -// } -// y : 13 -// } -// z: 8 -// -// The result will not contain specific values for fields x,y and z -// (their value will be set to the default, and omitted in proto text -// output): -// -// -// f { -// a : 22 -// b { -// d : 1 -// } -// } -// -// A repeated field is not allowed except at the last position of a -// field mask. -// -// If a FieldMask object is not present in a get operation, the -// operation applies to all fields (as if a FieldMask of all fields -// had been specified). -// -// Note that a field mask does not necessarily apply to the -// top-level response message. In case of a REST get operation, the -// field mask applies directly to the response, but in case of a REST -// list operation, the mask instead applies to each individual message -// in the returned resource list. In case of a REST custom method, -// other definitions may be used. Where the mask applies will be -// clearly documented together with its declaration in the API. In -// any case, the effect on the returned resource/resources is required -// behavior for APIs. -// -// # Field Masks in Update Operations -// -// A field mask in update operations specifies which fields of the -// targeted resource are going to be updated. The API is required -// to only change the values of the fields as specified in the mask -// and leave the others untouched. If a resource is passed in to -// describe the updated values, the API ignores the values of all -// fields not covered by the mask. -// -// If a repeated field is specified for an update operation, the existing -// repeated values in the target resource will be overwritten by the new values. -// Note that a repeated field is only allowed in the last position of a field -// mask. -// -// If a sub-message is specified in the last position of the field mask for an -// update operation, then the existing sub-message in the target resource is -// overwritten. Given the target message: -// -// f { -// b { -// d : 1 -// x : 2 -// } -// c : 1 -// } -// -// And an update message: -// -// f { -// b { -// d : 10 -// } -// } -// -// then if the field mask is: -// -// paths: "f.b" -// -// then the result will be: -// -// f { -// b { -// d : 10 -// } -// c : 1 -// } -// -// However, if the update mask was: -// -// paths: "f.b.d" -// -// then the result would be: -// -// f { -// b { -// d : 10 -// x : 2 -// } -// c : 1 -// } -// -// In order to reset a field's value to the default, the field must -// be in the mask and set to the default value in the provided resource. -// Hence, in order to reset all fields of a resource, provide a default -// instance of the resource and set all fields in the mask, or do -// not provide a mask as described below. -// -// If a field mask is not present on update, the operation applies to -// all fields (as if a field mask of all fields has been specified). -// Note that in the presence of schema evolution, this may mean that -// fields the client does not know and has therefore not filled into -// the request will be reset to their default. If this is unwanted -// behavior, a specific service may require a client to always specify -// a field mask, producing an error if not. -// -// As with get operations, the location of the resource which -// describes the updated values in the request message depends on the -// operation kind. In any case, the effect of the field mask is -// required to be honored by the API. -// -// ## Considerations for HTTP REST -// -// The HTTP kind of an update operation which uses a field mask must -// be set to PATCH instead of PUT in order to satisfy HTTP semantics -// (PUT must only be used for full updates). -// -// # JSON Encoding of Field Masks -// -// In JSON, a field mask is encoded as a single string where paths are -// separated by a comma. Fields name in each path are converted -// to/from lower-camel naming conventions. -// -// As an example, consider the following message declarations: -// -// message Profile { -// User user = 1; -// Photo photo = 2; -// } -// message User { -// string display_name = 1; -// string address = 2; -// } -// -// In proto a field mask for `Profile` may look as such: -// -// mask { -// paths: "user.display_name" -// paths: "photo" -// } -// -// In JSON, the same mask is represented as below: -// -// { -// mask: "user.displayName,photo" -// } -// -// # Field Masks and Oneof Fields -// -// Field masks treat fields in oneofs just as regular fields. Consider the -// following message: -// -// message SampleMessage { -// oneof test_oneof { -// string name = 4; -// SubMessage sub_message = 9; -// } -// } -// -// The field mask can be: -// -// mask { -// paths: "name" -// } -// -// Or: -// -// mask { -// paths: "sub_message" -// } -// -// Note that oneof type names ("test_oneof" in this case) cannot be used in -// paths. -type FieldMask struct { - // The set of field mask paths. - Paths []string `protobuf:"bytes,1,rep,name=paths" json:"paths,omitempty"` -} - -func (m *FieldMask) Reset() { *m = FieldMask{} } -func (*FieldMask) ProtoMessage() {} -func (*FieldMask) Descriptor() ([]byte, []int) { return fileDescriptorFieldMask, []int{0} } - -func (m *FieldMask) GetPaths() []string { - if m != nil { - return m.Paths - } - return nil -} - -func init() { - proto.RegisterType((*FieldMask)(nil), "google.protobuf.FieldMask") -} -func (this *FieldMask) Compare(that interface{}) int { - if that == nil { - if this == nil { - return 0 - } - return 1 - } - - that1, ok := that.(*FieldMask) - if !ok { - that2, ok := that.(FieldMask) - if ok { - that1 = &that2 - } else { - return 1 - } - } - if that1 == nil { - if this == nil { - return 0 - } - return 1 - } else if this == nil { - return -1 - } - if len(this.Paths) != len(that1.Paths) { - if len(this.Paths) < len(that1.Paths) { - return -1 - } - return 1 - } - for i := range this.Paths { - if this.Paths[i] != that1.Paths[i] { - if this.Paths[i] < that1.Paths[i] { - return -1 - } - return 1 - } - } - return 0 -} -func (this *FieldMask) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*FieldMask) - if !ok { - that2, ok := that.(FieldMask) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if len(this.Paths) != len(that1.Paths) { - return false - } - for i := range this.Paths { - if this.Paths[i] != that1.Paths[i] { - return false - } - } - return true -} -func (this *FieldMask) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&types.FieldMask{") - s = append(s, "Paths: "+fmt.Sprintf("%#v", this.Paths)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringFieldMask(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func extensionToGoStringFieldMask(m github_com_gogo_protobuf_proto.Message) string { - e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) - if e == nil { - return "nil" - } - s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" - keys := make([]int, 0, len(e)) - for k := range e { - keys = append(keys, int(k)) - } - sort.Ints(keys) - ss := []string{} - for _, k := range keys { - ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) - } - s += strings.Join(ss, ",") + "})" - return s -} -func (m *FieldMask) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *FieldMask) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Paths) > 0 { - for _, s := range m.Paths { - dAtA[i] = 0xa - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) - } - } - return i, nil -} - -func encodeFixed64FieldMask(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32FieldMask(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintFieldMask(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func NewPopulatedFieldMask(r randyFieldMask, easy bool) *FieldMask { - this := &FieldMask{} - v1 := r.Intn(10) - this.Paths = make([]string, v1) - for i := 0; i < v1; i++ { - this.Paths[i] = string(randStringFieldMask(r)) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -type randyFieldMask interface { - Float32() float32 - Float64() float64 - Int63() int64 - Int31() int32 - Uint32() uint32 - Intn(n int) int -} - -func randUTF8RuneFieldMask(r randyFieldMask) rune { - ru := r.Intn(62) - if ru < 10 { - return rune(ru + 48) - } else if ru < 36 { - return rune(ru + 55) - } - return rune(ru + 61) -} -func randStringFieldMask(r randyFieldMask) string { - v2 := r.Intn(100) - tmps := make([]rune, v2) - for i := 0; i < v2; i++ { - tmps[i] = randUTF8RuneFieldMask(r) - } - return string(tmps) -} -func randUnrecognizedFieldMask(r randyFieldMask, maxFieldNumber int) (dAtA []byte) { - l := r.Intn(5) - for i := 0; i < l; i++ { - wire := r.Intn(4) - if wire == 3 { - wire = 5 - } - fieldNumber := maxFieldNumber + r.Intn(100) - dAtA = randFieldFieldMask(dAtA, r, fieldNumber, wire) - } - return dAtA -} -func randFieldFieldMask(dAtA []byte, r randyFieldMask, fieldNumber int, wire int) []byte { - key := uint32(fieldNumber)<<3 | uint32(wire) - switch wire { - case 0: - dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(key)) - v3 := r.Int63() - if r.Intn(2) == 0 { - v3 *= -1 - } - dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(v3)) - case 1: - dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - case 2: - dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(key)) - ll := r.Intn(100) - dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(ll)) - for j := 0; j < ll; j++ { - dAtA = append(dAtA, byte(r.Intn(256))) - } - default: - dAtA = encodeVarintPopulateFieldMask(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - } - return dAtA -} -func encodeVarintPopulateFieldMask(dAtA []byte, v uint64) []byte { - for v >= 1<<7 { - dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) - v >>= 7 - } - dAtA = append(dAtA, uint8(v)) - return dAtA -} -func (m *FieldMask) Size() (n int) { - var l int - _ = l - if len(m.Paths) > 0 { - for _, s := range m.Paths { - l = len(s) - n += 1 + l + sovFieldMask(uint64(l)) - } - } - return n -} - -func sovFieldMask(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozFieldMask(x uint64) (n int) { - return sovFieldMask(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *FieldMask) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&FieldMask{`, - `Paths:` + fmt.Sprintf("%v", this.Paths) + `,`, - `}`, - }, "") - return s -} -func valueToStringFieldMask(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *FieldMask) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFieldMask - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FieldMask: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FieldMask: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Paths", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowFieldMask - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthFieldMask - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Paths = append(m.Paths, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipFieldMask(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthFieldMask - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipFieldMask(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowFieldMask - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowFieldMask - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowFieldMask - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthFieldMask - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowFieldMask - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipFieldMask(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthFieldMask = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowFieldMask = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("field_mask.proto", fileDescriptorFieldMask) } - -var fileDescriptorFieldMask = []byte{ - // 196 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x12, 0x48, 0xcb, 0x4c, 0xcd, - 0x49, 0x89, 0xcf, 0x4d, 0x2c, 0xce, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x4f, 0xcf, - 0xcf, 0x4f, 0xcf, 0x49, 0x85, 0xf0, 0x92, 0x4a, 0xd3, 0x94, 0x14, 0xb9, 0x38, 0xdd, 0x40, 0x8a, - 0x7c, 0x13, 0x8b, 0xb3, 0x85, 0x44, 0xb8, 0x58, 0x0b, 0x12, 0x4b, 0x32, 0x8a, 0x25, 0x18, 0x15, - 0x98, 0x35, 0x38, 0x83, 0x20, 0x1c, 0xa7, 0x0e, 0xc6, 0x0b, 0x0f, 0xe5, 0x18, 0x6e, 0x3c, 0x94, - 0x63, 0xf8, 0xf0, 0x50, 0x8e, 0xf1, 0xc7, 0x43, 0x39, 0xc6, 0x86, 0x47, 0x72, 0x8c, 0x2b, 0x1e, - 0xc9, 0x31, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x2f, - 0x1e, 0xc9, 0x31, 0x7c, 0x00, 0x89, 0x3f, 0x96, 0x63, 0xe4, 0x12, 0x4e, 0xce, 0xcf, 0xd5, 0x43, - 0xb3, 0xca, 0x89, 0x0f, 0x6e, 0x51, 0x00, 0x48, 0x28, 0x80, 0x31, 0x8a, 0xb5, 0xa4, 0xb2, 0x20, - 0xb5, 0x78, 0x01, 0x23, 0xe3, 0x22, 0x26, 0x66, 0xf7, 0x00, 0xa7, 0x55, 0x4c, 0x72, 0xee, 0x10, - 0x3d, 0x01, 0x50, 0x3d, 0x7a, 0xe1, 0xa9, 0x39, 0x39, 0xde, 0x79, 0xf9, 0xe5, 0x79, 0x21, 0x20, - 0x95, 0x49, 0x6c, 0x60, 0xc3, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xea, 0xb1, 0x3a, 0xd5, - 0xd9, 0x00, 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/struct.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/struct.pb.go deleted file mode 100644 index 61acd4a6494..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/struct.pb.go +++ /dev/null @@ -1,1908 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: struct.proto -// DO NOT EDIT! - -/* - Package types is a generated protocol buffer package. - - It is generated from these files: - struct.proto - - It has these top-level messages: - Struct - Value - ListValue -*/ -package types - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" - -import strconv "strconv" - -import strings "strings" -import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" -import sort "sort" -import reflect "reflect" -import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" - -import io "io" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -// `NullValue` is a singleton enumeration to represent the null value for the -// `Value` type union. -// -// The JSON representation for `NullValue` is JSON `null`. -type NullValue int32 - -const ( - // Null value. - NULL_VALUE NullValue = 0 -) - -var NullValue_name = map[int32]string{ - 0: "NULL_VALUE", -} -var NullValue_value = map[string]int32{ - "NULL_VALUE": 0, -} - -func (NullValue) EnumDescriptor() ([]byte, []int) { return fileDescriptorStruct, []int{0} } -func (NullValue) XXX_WellKnownType() string { return "NullValue" } - -// `Struct` represents a structured data value, consisting of fields -// which map to dynamically typed values. In some languages, `Struct` -// might be supported by a native representation. For example, in -// scripting languages like JS a struct is represented as an -// object. The details of that representation are described together -// with the proto support for the language. -// -// The JSON representation for `Struct` is JSON object. -type Struct struct { - // Unordered map of dynamically typed values. - Fields map[string]*Value `protobuf:"bytes,1,rep,name=fields" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"` -} - -func (m *Struct) Reset() { *m = Struct{} } -func (*Struct) ProtoMessage() {} -func (*Struct) Descriptor() ([]byte, []int) { return fileDescriptorStruct, []int{0} } -func (*Struct) XXX_WellKnownType() string { return "Struct" } - -func (m *Struct) GetFields() map[string]*Value { - if m != nil { - return m.Fields - } - return nil -} - -// `Value` represents a dynamically typed value which can be either -// null, a number, a string, a boolean, a recursive struct value, or a -// list of values. A producer of value is expected to set one of that -// variants, absence of any variant indicates an error. -// -// The JSON representation for `Value` is JSON value. -type Value struct { - // The kind of value. - // - // Types that are valid to be assigned to Kind: - // *Value_NullValue - // *Value_NumberValue - // *Value_StringValue - // *Value_BoolValue - // *Value_StructValue - // *Value_ListValue - Kind isValue_Kind `protobuf_oneof:"kind"` -} - -func (m *Value) Reset() { *m = Value{} } -func (*Value) ProtoMessage() {} -func (*Value) Descriptor() ([]byte, []int) { return fileDescriptorStruct, []int{1} } -func (*Value) XXX_WellKnownType() string { return "Value" } - -type isValue_Kind interface { - isValue_Kind() - Equal(interface{}) bool - MarshalTo([]byte) (int, error) - Size() int -} - -type Value_NullValue struct { - NullValue NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,proto3,enum=google.protobuf.NullValue,oneof"` -} -type Value_NumberValue struct { - NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,proto3,oneof"` -} -type Value_StringValue struct { - StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"` -} -type Value_BoolValue struct { - BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"` -} -type Value_StructValue struct { - StructValue *Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,oneof"` -} -type Value_ListValue struct { - ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,oneof"` -} - -func (*Value_NullValue) isValue_Kind() {} -func (*Value_NumberValue) isValue_Kind() {} -func (*Value_StringValue) isValue_Kind() {} -func (*Value_BoolValue) isValue_Kind() {} -func (*Value_StructValue) isValue_Kind() {} -func (*Value_ListValue) isValue_Kind() {} - -func (m *Value) GetKind() isValue_Kind { - if m != nil { - return m.Kind - } - return nil -} - -func (m *Value) GetNullValue() NullValue { - if x, ok := m.GetKind().(*Value_NullValue); ok { - return x.NullValue - } - return NULL_VALUE -} - -func (m *Value) GetNumberValue() float64 { - if x, ok := m.GetKind().(*Value_NumberValue); ok { - return x.NumberValue - } - return 0 -} - -func (m *Value) GetStringValue() string { - if x, ok := m.GetKind().(*Value_StringValue); ok { - return x.StringValue - } - return "" -} - -func (m *Value) GetBoolValue() bool { - if x, ok := m.GetKind().(*Value_BoolValue); ok { - return x.BoolValue - } - return false -} - -func (m *Value) GetStructValue() *Struct { - if x, ok := m.GetKind().(*Value_StructValue); ok { - return x.StructValue - } - return nil -} - -func (m *Value) GetListValue() *ListValue { - if x, ok := m.GetKind().(*Value_ListValue); ok { - return x.ListValue - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Value) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Value_OneofMarshaler, _Value_OneofUnmarshaler, _Value_OneofSizer, []interface{}{ - (*Value_NullValue)(nil), - (*Value_NumberValue)(nil), - (*Value_StringValue)(nil), - (*Value_BoolValue)(nil), - (*Value_StructValue)(nil), - (*Value_ListValue)(nil), - } -} - -func _Value_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Value) - // kind - switch x := m.Kind.(type) { - case *Value_NullValue: - _ = b.EncodeVarint(1<<3 | proto.WireVarint) - _ = b.EncodeVarint(uint64(x.NullValue)) - case *Value_NumberValue: - _ = b.EncodeVarint(2<<3 | proto.WireFixed64) - _ = b.EncodeFixed64(math.Float64bits(x.NumberValue)) - case *Value_StringValue: - _ = b.EncodeVarint(3<<3 | proto.WireBytes) - _ = b.EncodeStringBytes(x.StringValue) - case *Value_BoolValue: - t := uint64(0) - if x.BoolValue { - t = 1 - } - _ = b.EncodeVarint(4<<3 | proto.WireVarint) - _ = b.EncodeVarint(t) - case *Value_StructValue: - _ = b.EncodeVarint(5<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.StructValue); err != nil { - return err - } - case *Value_ListValue: - _ = b.EncodeVarint(6<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ListValue); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("Value.Kind has unexpected type %T", x) - } - return nil -} - -func _Value_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Value) - switch tag { - case 1: // kind.null_value - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Kind = &Value_NullValue{NullValue(x)} - return true, err - case 2: // kind.number_value - if wire != proto.WireFixed64 { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeFixed64() - m.Kind = &Value_NumberValue{math.Float64frombits(x)} - return true, err - case 3: // kind.string_value - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Kind = &Value_StringValue{x} - return true, err - case 4: // kind.bool_value - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Kind = &Value_BoolValue{x != 0} - return true, err - case 5: // kind.struct_value - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Struct) - err := b.DecodeMessage(msg) - m.Kind = &Value_StructValue{msg} - return true, err - case 6: // kind.list_value - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ListValue) - err := b.DecodeMessage(msg) - m.Kind = &Value_ListValue{msg} - return true, err - default: - return false, nil - } -} - -func _Value_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Value) - // kind - switch x := m.Kind.(type) { - case *Value_NullValue: - n += proto.SizeVarint(1<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.NullValue)) - case *Value_NumberValue: - n += proto.SizeVarint(2<<3 | proto.WireFixed64) - n += 8 - case *Value_StringValue: - n += proto.SizeVarint(3<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.StringValue))) - n += len(x.StringValue) - case *Value_BoolValue: - n += proto.SizeVarint(4<<3 | proto.WireVarint) - n += 1 - case *Value_StructValue: - s := proto.Size(x.StructValue) - n += proto.SizeVarint(5<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case *Value_ListValue: - s := proto.Size(x.ListValue) - n += proto.SizeVarint(6<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -// `ListValue` is a wrapper around a repeated field of values. -// -// The JSON representation for `ListValue` is JSON array. -type ListValue struct { - // Repeated field of dynamically typed values. - Values []*Value `protobuf:"bytes,1,rep,name=values" json:"values,omitempty"` -} - -func (m *ListValue) Reset() { *m = ListValue{} } -func (*ListValue) ProtoMessage() {} -func (*ListValue) Descriptor() ([]byte, []int) { return fileDescriptorStruct, []int{2} } -func (*ListValue) XXX_WellKnownType() string { return "ListValue" } - -func (m *ListValue) GetValues() []*Value { - if m != nil { - return m.Values - } - return nil -} - -func init() { - proto.RegisterType((*Struct)(nil), "google.protobuf.Struct") - proto.RegisterType((*Value)(nil), "google.protobuf.Value") - proto.RegisterType((*ListValue)(nil), "google.protobuf.ListValue") - proto.RegisterEnum("google.protobuf.NullValue", NullValue_name, NullValue_value) -} -func (x NullValue) String() string { - s, ok := NullValue_name[int32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} -func (this *Struct) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*Struct) - if !ok { - that2, ok := that.(Struct) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if len(this.Fields) != len(that1.Fields) { - return false - } - for i := range this.Fields { - if !this.Fields[i].Equal(that1.Fields[i]) { - return false - } - } - return true -} -func (this *Value) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*Value) - if !ok { - that2, ok := that.(Value) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if that1.Kind == nil { - if this.Kind != nil { - return false - } - } else if this.Kind == nil { - return false - } else if !this.Kind.Equal(that1.Kind) { - return false - } - return true -} -func (this *Value_NullValue) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*Value_NullValue) - if !ok { - that2, ok := that.(Value_NullValue) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if this.NullValue != that1.NullValue { - return false - } - return true -} -func (this *Value_NumberValue) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*Value_NumberValue) - if !ok { - that2, ok := that.(Value_NumberValue) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if this.NumberValue != that1.NumberValue { - return false - } - return true -} -func (this *Value_StringValue) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*Value_StringValue) - if !ok { - that2, ok := that.(Value_StringValue) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if this.StringValue != that1.StringValue { - return false - } - return true -} -func (this *Value_BoolValue) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*Value_BoolValue) - if !ok { - that2, ok := that.(Value_BoolValue) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if this.BoolValue != that1.BoolValue { - return false - } - return true -} -func (this *Value_StructValue) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*Value_StructValue) - if !ok { - that2, ok := that.(Value_StructValue) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if !this.StructValue.Equal(that1.StructValue) { - return false - } - return true -} -func (this *Value_ListValue) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*Value_ListValue) - if !ok { - that2, ok := that.(Value_ListValue) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if !this.ListValue.Equal(that1.ListValue) { - return false - } - return true -} -func (this *ListValue) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*ListValue) - if !ok { - that2, ok := that.(ListValue) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if len(this.Values) != len(that1.Values) { - return false - } - for i := range this.Values { - if !this.Values[i].Equal(that1.Values[i]) { - return false - } - } - return true -} -func (this *Struct) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&types.Struct{") - keysForFields := make([]string, 0, len(this.Fields)) - for k := range this.Fields { - keysForFields = append(keysForFields, k) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForFields) - mapStringForFields := "map[string]*Value{" - for _, k := range keysForFields { - mapStringForFields += fmt.Sprintf("%#v: %#v,", k, this.Fields[k]) - } - mapStringForFields += "}" - if this.Fields != nil { - s = append(s, "Fields: "+mapStringForFields+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *Value) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 10) - s = append(s, "&types.Value{") - if this.Kind != nil { - s = append(s, "Kind: "+fmt.Sprintf("%#v", this.Kind)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *Value_NullValue) GoString() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&types.Value_NullValue{` + - `NullValue:` + fmt.Sprintf("%#v", this.NullValue) + `}`}, ", ") - return s -} -func (this *Value_NumberValue) GoString() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&types.Value_NumberValue{` + - `NumberValue:` + fmt.Sprintf("%#v", this.NumberValue) + `}`}, ", ") - return s -} -func (this *Value_StringValue) GoString() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&types.Value_StringValue{` + - `StringValue:` + fmt.Sprintf("%#v", this.StringValue) + `}`}, ", ") - return s -} -func (this *Value_BoolValue) GoString() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&types.Value_BoolValue{` + - `BoolValue:` + fmt.Sprintf("%#v", this.BoolValue) + `}`}, ", ") - return s -} -func (this *Value_StructValue) GoString() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&types.Value_StructValue{` + - `StructValue:` + fmt.Sprintf("%#v", this.StructValue) + `}`}, ", ") - return s -} -func (this *Value_ListValue) GoString() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&types.Value_ListValue{` + - `ListValue:` + fmt.Sprintf("%#v", this.ListValue) + `}`}, ", ") - return s -} -func (this *ListValue) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&types.ListValue{") - if this.Values != nil { - s = append(s, "Values: "+fmt.Sprintf("%#v", this.Values)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringStruct(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func extensionToGoStringStruct(m github_com_gogo_protobuf_proto.Message) string { - e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) - if e == nil { - return "nil" - } - s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" - keys := make([]int, 0, len(e)) - for k := range e { - keys = append(keys, int(k)) - } - sort.Ints(keys) - ss := []string{} - for _, k := range keys { - ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) - } - s += strings.Join(ss, ",") + "})" - return s -} -func (m *Struct) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Struct) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Fields) > 0 { - for k := range m.Fields { - dAtA[i] = 0xa - i++ - v := m.Fields[k] - msgSize := 0 - if v != nil { - msgSize = v.Size() - msgSize += 1 + sovStruct(uint64(msgSize)) - } - mapSize := 1 + len(k) + sovStruct(uint64(len(k))) + msgSize - i = encodeVarintStruct(dAtA, i, uint64(mapSize)) - dAtA[i] = 0xa - i++ - i = encodeVarintStruct(dAtA, i, uint64(len(k))) - i += copy(dAtA[i:], k) - if v != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintStruct(dAtA, i, uint64(v.Size())) - n1, err := v.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } - } - } - return i, nil -} - -func (m *Value) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Value) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Kind != nil { - nn2, err := m.Kind.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn2 - } - return i, nil -} - -func (m *Value_NullValue) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x8 - i++ - i = encodeVarintStruct(dAtA, i, uint64(m.NullValue)) - return i, nil -} -func (m *Value_NumberValue) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x11 - i++ - i = encodeFixed64Struct(dAtA, i, uint64(math.Float64bits(float64(m.NumberValue)))) - return i, nil -} -func (m *Value_StringValue) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x1a - i++ - i = encodeVarintStruct(dAtA, i, uint64(len(m.StringValue))) - i += copy(dAtA[i:], m.StringValue) - return i, nil -} -func (m *Value_BoolValue) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x20 - i++ - if m.BoolValue { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - return i, nil -} -func (m *Value_StructValue) MarshalTo(dAtA []byte) (int, error) { - i := 0 - if m.StructValue != nil { - dAtA[i] = 0x2a - i++ - i = encodeVarintStruct(dAtA, i, uint64(m.StructValue.Size())) - n3, err := m.StructValue.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n3 - } - return i, nil -} -func (m *Value_ListValue) MarshalTo(dAtA []byte) (int, error) { - i := 0 - if m.ListValue != nil { - dAtA[i] = 0x32 - i++ - i = encodeVarintStruct(dAtA, i, uint64(m.ListValue.Size())) - n4, err := m.ListValue.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n4 - } - return i, nil -} -func (m *ListValue) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ListValue) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Values) > 0 { - for _, msg := range m.Values { - dAtA[i] = 0xa - i++ - i = encodeVarintStruct(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - return i, nil -} - -func encodeFixed64Struct(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Struct(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintStruct(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func NewPopulatedStruct(r randyStruct, easy bool) *Struct { - this := &Struct{} - if r.Intn(10) == 0 { - v1 := r.Intn(10) - this.Fields = make(map[string]*Value) - for i := 0; i < v1; i++ { - this.Fields[randStringStruct(r)] = NewPopulatedValue(r, easy) - } - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedValue(r randyStruct, easy bool) *Value { - this := &Value{} - oneofNumber_Kind := []int32{1, 2, 3, 4, 5, 6}[r.Intn(6)] - switch oneofNumber_Kind { - case 1: - this.Kind = NewPopulatedValue_NullValue(r, easy) - case 2: - this.Kind = NewPopulatedValue_NumberValue(r, easy) - case 3: - this.Kind = NewPopulatedValue_StringValue(r, easy) - case 4: - this.Kind = NewPopulatedValue_BoolValue(r, easy) - case 5: - this.Kind = NewPopulatedValue_StructValue(r, easy) - case 6: - this.Kind = NewPopulatedValue_ListValue(r, easy) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedValue_NullValue(r randyStruct, easy bool) *Value_NullValue { - this := &Value_NullValue{} - this.NullValue = NullValue([]int32{0}[r.Intn(1)]) - return this -} -func NewPopulatedValue_NumberValue(r randyStruct, easy bool) *Value_NumberValue { - this := &Value_NumberValue{} - this.NumberValue = float64(r.Float64()) - if r.Intn(2) == 0 { - this.NumberValue *= -1 - } - return this -} -func NewPopulatedValue_StringValue(r randyStruct, easy bool) *Value_StringValue { - this := &Value_StringValue{} - this.StringValue = string(randStringStruct(r)) - return this -} -func NewPopulatedValue_BoolValue(r randyStruct, easy bool) *Value_BoolValue { - this := &Value_BoolValue{} - this.BoolValue = bool(bool(r.Intn(2) == 0)) - return this -} -func NewPopulatedValue_StructValue(r randyStruct, easy bool) *Value_StructValue { - this := &Value_StructValue{} - this.StructValue = NewPopulatedStruct(r, easy) - return this -} -func NewPopulatedValue_ListValue(r randyStruct, easy bool) *Value_ListValue { - this := &Value_ListValue{} - this.ListValue = NewPopulatedListValue(r, easy) - return this -} -func NewPopulatedListValue(r randyStruct, easy bool) *ListValue { - this := &ListValue{} - if r.Intn(10) == 0 { - v2 := r.Intn(5) - this.Values = make([]*Value, v2) - for i := 0; i < v2; i++ { - this.Values[i] = NewPopulatedValue(r, easy) - } - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -type randyStruct interface { - Float32() float32 - Float64() float64 - Int63() int64 - Int31() int32 - Uint32() uint32 - Intn(n int) int -} - -func randUTF8RuneStruct(r randyStruct) rune { - ru := r.Intn(62) - if ru < 10 { - return rune(ru + 48) - } else if ru < 36 { - return rune(ru + 55) - } - return rune(ru + 61) -} -func randStringStruct(r randyStruct) string { - v3 := r.Intn(100) - tmps := make([]rune, v3) - for i := 0; i < v3; i++ { - tmps[i] = randUTF8RuneStruct(r) - } - return string(tmps) -} -func randUnrecognizedStruct(r randyStruct, maxFieldNumber int) (dAtA []byte) { - l := r.Intn(5) - for i := 0; i < l; i++ { - wire := r.Intn(4) - if wire == 3 { - wire = 5 - } - fieldNumber := maxFieldNumber + r.Intn(100) - dAtA = randFieldStruct(dAtA, r, fieldNumber, wire) - } - return dAtA -} -func randFieldStruct(dAtA []byte, r randyStruct, fieldNumber int, wire int) []byte { - key := uint32(fieldNumber)<<3 | uint32(wire) - switch wire { - case 0: - dAtA = encodeVarintPopulateStruct(dAtA, uint64(key)) - v4 := r.Int63() - if r.Intn(2) == 0 { - v4 *= -1 - } - dAtA = encodeVarintPopulateStruct(dAtA, uint64(v4)) - case 1: - dAtA = encodeVarintPopulateStruct(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - case 2: - dAtA = encodeVarintPopulateStruct(dAtA, uint64(key)) - ll := r.Intn(100) - dAtA = encodeVarintPopulateStruct(dAtA, uint64(ll)) - for j := 0; j < ll; j++ { - dAtA = append(dAtA, byte(r.Intn(256))) - } - default: - dAtA = encodeVarintPopulateStruct(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - } - return dAtA -} -func encodeVarintPopulateStruct(dAtA []byte, v uint64) []byte { - for v >= 1<<7 { - dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) - v >>= 7 - } - dAtA = append(dAtA, uint8(v)) - return dAtA -} -func (m *Struct) Size() (n int) { - var l int - _ = l - if len(m.Fields) > 0 { - for k, v := range m.Fields { - _ = k - _ = v - l = 0 - if v != nil { - l = v.Size() - l += 1 + sovStruct(uint64(l)) - } - mapEntrySize := 1 + len(k) + sovStruct(uint64(len(k))) + l - n += mapEntrySize + 1 + sovStruct(uint64(mapEntrySize)) - } - } - return n -} - -func (m *Value) Size() (n int) { - var l int - _ = l - if m.Kind != nil { - n += m.Kind.Size() - } - return n -} - -func (m *Value_NullValue) Size() (n int) { - var l int - _ = l - n += 1 + sovStruct(uint64(m.NullValue)) - return n -} -func (m *Value_NumberValue) Size() (n int) { - var l int - _ = l - n += 9 - return n -} -func (m *Value_StringValue) Size() (n int) { - var l int - _ = l - l = len(m.StringValue) - n += 1 + l + sovStruct(uint64(l)) - return n -} -func (m *Value_BoolValue) Size() (n int) { - var l int - _ = l - n += 2 - return n -} -func (m *Value_StructValue) Size() (n int) { - var l int - _ = l - if m.StructValue != nil { - l = m.StructValue.Size() - n += 1 + l + sovStruct(uint64(l)) - } - return n -} -func (m *Value_ListValue) Size() (n int) { - var l int - _ = l - if m.ListValue != nil { - l = m.ListValue.Size() - n += 1 + l + sovStruct(uint64(l)) - } - return n -} -func (m *ListValue) Size() (n int) { - var l int - _ = l - if len(m.Values) > 0 { - for _, e := range m.Values { - l = e.Size() - n += 1 + l + sovStruct(uint64(l)) - } - } - return n -} - -func sovStruct(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozStruct(x uint64) (n int) { - return sovStruct(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *Struct) String() string { - if this == nil { - return "nil" - } - keysForFields := make([]string, 0, len(this.Fields)) - for k := range this.Fields { - keysForFields = append(keysForFields, k) - } - github_com_gogo_protobuf_sortkeys.Strings(keysForFields) - mapStringForFields := "map[string]*Value{" - for _, k := range keysForFields { - mapStringForFields += fmt.Sprintf("%v: %v,", k, this.Fields[k]) - } - mapStringForFields += "}" - s := strings.Join([]string{`&Struct{`, - `Fields:` + mapStringForFields + `,`, - `}`, - }, "") - return s -} -func (this *Value) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Value{`, - `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, - `}`, - }, "") - return s -} -func (this *Value_NullValue) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Value_NullValue{`, - `NullValue:` + fmt.Sprintf("%v", this.NullValue) + `,`, - `}`, - }, "") - return s -} -func (this *Value_NumberValue) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Value_NumberValue{`, - `NumberValue:` + fmt.Sprintf("%v", this.NumberValue) + `,`, - `}`, - }, "") - return s -} -func (this *Value_StringValue) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Value_StringValue{`, - `StringValue:` + fmt.Sprintf("%v", this.StringValue) + `,`, - `}`, - }, "") - return s -} -func (this *Value_BoolValue) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Value_BoolValue{`, - `BoolValue:` + fmt.Sprintf("%v", this.BoolValue) + `,`, - `}`, - }, "") - return s -} -func (this *Value_StructValue) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Value_StructValue{`, - `StructValue:` + strings.Replace(fmt.Sprintf("%v", this.StructValue), "Struct", "Struct", 1) + `,`, - `}`, - }, "") - return s -} -func (this *Value_ListValue) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Value_ListValue{`, - `ListValue:` + strings.Replace(fmt.Sprintf("%v", this.ListValue), "ListValue", "ListValue", 1) + `,`, - `}`, - }, "") - return s -} -func (this *ListValue) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ListValue{`, - `Values:` + strings.Replace(fmt.Sprintf("%v", this.Values), "Value", "Value", 1) + `,`, - `}`, - }, "") - return s -} -func valueToStringStruct(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *Struct) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStruct - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Struct: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Struct: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Fields", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStruct - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStruct - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - var keykey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStruct - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - keykey |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStruct - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthStruct - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey := string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - if m.Fields == nil { - m.Fields = make(map[string]*Value) - } - if iNdEx < postIndex { - var valuekey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStruct - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - valuekey |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - var mapmsglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStruct - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapmsglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return ErrInvalidLengthStruct - } - postmsgIndex := iNdEx + mapmsglen - if mapmsglen < 0 { - return ErrInvalidLengthStruct - } - if postmsgIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue := &Value{} - if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - iNdEx = postmsgIndex - m.Fields[mapkey] = mapvalue - } else { - var mapvalue *Value - m.Fields[mapkey] = mapvalue - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStruct(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStruct - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Value) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStruct - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Value: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Value: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NullValue", wireType) - } - var v NullValue - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStruct - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (NullValue(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Kind = &Value_NullValue{v} - case 2: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field NumberValue", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - iNdEx += 8 - v = uint64(dAtA[iNdEx-8]) - v |= uint64(dAtA[iNdEx-7]) << 8 - v |= uint64(dAtA[iNdEx-6]) << 16 - v |= uint64(dAtA[iNdEx-5]) << 24 - v |= uint64(dAtA[iNdEx-4]) << 32 - v |= uint64(dAtA[iNdEx-3]) << 40 - v |= uint64(dAtA[iNdEx-2]) << 48 - v |= uint64(dAtA[iNdEx-1]) << 56 - m.Kind = &Value_NumberValue{float64(math.Float64frombits(v))} - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StringValue", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStruct - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthStruct - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Kind = &Value_StringValue{string(dAtA[iNdEx:postIndex])} - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BoolValue", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStruct - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.Kind = &Value_BoolValue{b} - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StructValue", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStruct - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStruct - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &Struct{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Kind = &Value_StructValue{v} - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListValue", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStruct - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStruct - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &ListValue{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Kind = &Value_ListValue{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStruct(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStruct - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ListValue) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStruct - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ListValue: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ListValue: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStruct - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStruct - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Values = append(m.Values, &Value{}) - if err := m.Values[len(m.Values)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStruct(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStruct - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipStruct(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowStruct - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowStruct - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowStruct - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthStruct - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowStruct - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipStruct(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthStruct = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowStruct = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("struct.proto", fileDescriptorStruct) } - -var fileDescriptorStruct = []byte{ - // 432 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x91, 0xc1, 0x6b, 0xd4, 0x40, - 0x14, 0xc6, 0xf3, 0xb2, 0xdd, 0xe0, 0xbe, 0x94, 0x5a, 0x46, 0xd0, 0xa5, 0xc2, 0xb8, 0x6c, 0x2f, - 0x41, 0x24, 0x87, 0xf5, 0x22, 0xae, 0x17, 0x03, 0xb5, 0x05, 0x43, 0x89, 0xd1, 0x56, 0xf0, 0xb2, - 0x98, 0x6d, 0xba, 0x84, 0x4e, 0x67, 0x4a, 0x32, 0x51, 0xf6, 0xa6, 0xff, 0x85, 0x47, 0xf1, 0x24, - 0x1e, 0xfd, 0x2b, 0x3c, 0xf6, 0xe8, 0xd1, 0xe4, 0xe4, 0xb1, 0x47, 0x8f, 0x32, 0x33, 0x49, 0x94, - 0x2e, 0x7b, 0xcb, 0xfb, 0xf2, 0x7b, 0xdf, 0x7b, 0xdf, 0x1b, 0xdc, 0x2c, 0x64, 0x5e, 0xce, 0xa5, - 0x7f, 0x91, 0x0b, 0x29, 0xc8, 0xcd, 0x85, 0x10, 0x0b, 0x96, 0x9a, 0x2a, 0x29, 0x4f, 0xc7, 0x9f, - 0x00, 0x9d, 0x97, 0x9a, 0x20, 0x53, 0x74, 0x4e, 0xb3, 0x94, 0x9d, 0x14, 0x43, 0x18, 0xf5, 0x3c, - 0x77, 0xb2, 0xeb, 0x5f, 0x83, 0x7d, 0x03, 0xfa, 0xcf, 0x34, 0xb5, 0xc7, 0x65, 0xbe, 0x8c, 0x9b, - 0x96, 0x9d, 0x17, 0xe8, 0xfe, 0x27, 0x93, 0x6d, 0xec, 0x9d, 0xa5, 0xcb, 0x21, 0x8c, 0xc0, 0x1b, - 0xc4, 0xea, 0x93, 0x3c, 0xc0, 0xfe, 0xbb, 0xb7, 0xac, 0x4c, 0x87, 0xf6, 0x08, 0x3c, 0x77, 0x72, - 0x7b, 0xc5, 0xfc, 0x58, 0xfd, 0x8d, 0x0d, 0xf4, 0xd8, 0x7e, 0x04, 0xe3, 0xef, 0x36, 0xf6, 0xb5, - 0x48, 0xa6, 0x88, 0xbc, 0x64, 0x6c, 0x66, 0x0c, 0x94, 0xe9, 0xd6, 0x64, 0x67, 0xc5, 0xe0, 0xb0, - 0x64, 0x4c, 0xf3, 0x07, 0x56, 0x3c, 0xe0, 0x6d, 0x41, 0x76, 0x71, 0x93, 0x97, 0xe7, 0x49, 0x9a, - 0xcf, 0xfe, 0xcd, 0x87, 0x03, 0x2b, 0x76, 0x8d, 0xda, 0x41, 0x85, 0xcc, 0x33, 0xbe, 0x68, 0xa0, - 0x9e, 0x5a, 0x5c, 0x41, 0x46, 0x35, 0xd0, 0x3d, 0xc4, 0x44, 0x88, 0x76, 0x8d, 0x8d, 0x11, 0x78, - 0x37, 0xd4, 0x28, 0xa5, 0x19, 0xe0, 0x49, 0x7b, 0xed, 0x06, 0xe9, 0xeb, 0xa8, 0x77, 0xd6, 0xdc, - 0xb1, 0xb1, 0x2f, 0xe7, 0xb2, 0x4b, 0xc9, 0xb2, 0xa2, 0xed, 0x75, 0x74, 0xef, 0x6a, 0xca, 0x30, - 0x2b, 0x64, 0x97, 0x92, 0xb5, 0x45, 0xe0, 0xe0, 0xc6, 0x59, 0xc6, 0x4f, 0xc6, 0x53, 0x1c, 0x74, - 0x04, 0xf1, 0xd1, 0xd1, 0x66, 0xed, 0x8b, 0xae, 0x3b, 0x7a, 0x43, 0xdd, 0xbf, 0x8b, 0x83, 0xee, - 0x88, 0x64, 0x0b, 0xf1, 0xf0, 0x28, 0x0c, 0x67, 0xc7, 0x4f, 0xc3, 0xa3, 0xbd, 0x6d, 0x2b, 0xf8, - 0x08, 0x97, 0x15, 0xb5, 0x7e, 0x56, 0xd4, 0xba, 0xaa, 0x28, 0xfc, 0xa9, 0x28, 0x7c, 0xa8, 0x29, - 0x7c, 0xad, 0x29, 0xfc, 0xa8, 0x29, 0x5c, 0xd6, 0x14, 0x7e, 0xd5, 0x14, 0x7e, 0xd7, 0xd4, 0xba, - 0xaa, 0x29, 0xe0, 0xad, 0xb9, 0x38, 0xbf, 0x3e, 0x2e, 0x70, 0x4d, 0xf2, 0x48, 0xd5, 0x11, 0xbc, - 0xe9, 0xcb, 0xe5, 0x45, 0x5a, 0x7c, 0x06, 0xf8, 0x62, 0xf7, 0xf6, 0xa3, 0xe0, 0x9b, 0x4d, 0xf7, - 0x4d, 0x43, 0xd4, 0xee, 0xf7, 0x3a, 0x65, 0xec, 0x39, 0x17, 0xef, 0xf9, 0x2b, 0x45, 0x26, 0x8e, - 0x76, 0x7a, 0xf8, 0x37, 0x00, 0x00, 0xff, 0xff, 0x52, 0x64, 0x2c, 0x57, 0xd5, 0x02, 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp.go deleted file mode 100644 index 521b62d925e..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp.go +++ /dev/null @@ -1,123 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package types - -// This file implements operations on google.protobuf.Timestamp. - -import ( - "errors" - "fmt" - "time" -) - -const ( - // Seconds field of the earliest valid Timestamp. - // This is time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). - minValidSeconds = -62135596800 - // Seconds field just after the latest valid Timestamp. - // This is time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). - maxValidSeconds = 253402300800 -) - -// validateTimestamp determines whether a Timestamp is valid. -// A valid timestamp represents a time in the range -// [0001-01-01, 10000-01-01) and has a Nanos field -// in the range [0, 1e9). -// -// If the Timestamp is valid, validateTimestamp returns nil. -// Otherwise, it returns an error that describes -// the problem. -// -// Every valid Timestamp can be represented by a time.Time, but the converse is not true. -func validateTimestamp(ts *Timestamp) error { - if ts == nil { - return errors.New("timestamp: nil Timestamp") - } - if ts.Seconds < minValidSeconds { - return fmt.Errorf("timestamp: %#v before 0001-01-01", ts) - } - if ts.Seconds >= maxValidSeconds { - return fmt.Errorf("timestamp: %#v after 10000-01-01", ts) - } - if ts.Nanos < 0 || ts.Nanos >= 1e9 { - return fmt.Errorf("timestamp: %#v: nanos not in range [0, 1e9)", ts) - } - return nil -} - -// TimestampFromProto converts a google.protobuf.Timestamp proto to a time.Time. -// It returns an error if the argument is invalid. -// -// Unlike most Go functions, if Timestamp returns an error, the first return value -// is not the zero time.Time. Instead, it is the value obtained from the -// time.Unix function when passed the contents of the Timestamp, in the UTC -// locale. This may or may not be a meaningful time; many invalid Timestamps -// do map to valid time.Times. -// -// A nil Timestamp returns an error. The first return value in that case is -// undefined. -func TimestampFromProto(ts *Timestamp) (time.Time, error) { - // Don't return the zero value on error, because corresponds to a valid - // timestamp. Instead return whatever time.Unix gives us. - var t time.Time - if ts == nil { - t = time.Unix(0, 0).UTC() // treat nil like the empty Timestamp - } else { - t = time.Unix(ts.Seconds, int64(ts.Nanos)).UTC() - } - return t, validateTimestamp(ts) -} - -// TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. -// It returns an error if the resulting Timestamp is invalid. -func TimestampProto(t time.Time) (*Timestamp, error) { - seconds := t.Unix() - nanos := int32(t.Sub(time.Unix(seconds, 0))) - ts := &Timestamp{ - Seconds: seconds, - Nanos: nanos, - } - if err := validateTimestamp(ts); err != nil { - return nil, err - } - return ts, nil -} - -// TimestampString returns the RFC 3339 string for valid Timestamps. For invalid -// Timestamps, it returns an error message in parentheses. -func TimestampString(ts *Timestamp) string { - t, err := TimestampFromProto(ts) - if err != nil { - return fmt.Sprintf("(%v)", err) - } - return t.Format(time.RFC3339Nano) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp.pb.go deleted file mode 100644 index 4b0c34f2c47..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp.pb.go +++ /dev/null @@ -1,527 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: timestamp.proto -// DO NOT EDIT! - -/* - Package types is a generated protocol buffer package. - - It is generated from these files: - timestamp.proto - - It has these top-level messages: - Timestamp -*/ -package types - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" - -import strings "strings" -import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" -import sort "sort" -import strconv "strconv" -import reflect "reflect" - -import io "io" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -// A Timestamp represents a point in time independent of any time zone -// or calendar, represented as seconds and fractions of seconds at -// nanosecond resolution in UTC Epoch time. It is encoded using the -// Proleptic Gregorian Calendar which extends the Gregorian calendar -// backwards to year one. It is encoded assuming all minutes are 60 -// seconds long, i.e. leap seconds are "smeared" so that no leap second -// table is needed for interpretation. 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 date strings. -// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). -// -// 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 current time in Python. -// -// now = time.time() -// seconds = int(now) -// nanos = int((now - seconds) * 10**9) -// timestamp = Timestamp(seconds=seconds, nanos=nanos) -// -// -type Timestamp struct { - // Represents seconds of UTC time since Unix epoch - // 1970-01-01T00:00:00Z. Must be from 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"` -} - -func (m *Timestamp) Reset() { *m = Timestamp{} } -func (*Timestamp) ProtoMessage() {} -func (*Timestamp) Descriptor() ([]byte, []int) { return fileDescriptorTimestamp, []int{0} } -func (*Timestamp) XXX_WellKnownType() string { return "Timestamp" } - -func (m *Timestamp) GetSeconds() int64 { - if m != nil { - return m.Seconds - } - return 0 -} - -func (m *Timestamp) GetNanos() int32 { - if m != nil { - return m.Nanos - } - return 0 -} - -func init() { - proto.RegisterType((*Timestamp)(nil), "google.protobuf.Timestamp") -} -func (this *Timestamp) Compare(that interface{}) int { - if that == nil { - if this == nil { - return 0 - } - return 1 - } - - that1, ok := that.(*Timestamp) - if !ok { - that2, ok := that.(Timestamp) - if ok { - that1 = &that2 - } else { - return 1 - } - } - if that1 == nil { - if this == nil { - return 0 - } - return 1 - } else if this == nil { - return -1 - } - if this.Seconds != that1.Seconds { - if this.Seconds < that1.Seconds { - return -1 - } - return 1 - } - if this.Nanos != that1.Nanos { - if this.Nanos < that1.Nanos { - return -1 - } - return 1 - } - return 0 -} -func (this *Timestamp) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*Timestamp) - if !ok { - that2, ok := that.(Timestamp) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if this.Seconds != that1.Seconds { - return false - } - if this.Nanos != that1.Nanos { - return false - } - return true -} -func (this *Timestamp) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&types.Timestamp{") - s = append(s, "Seconds: "+fmt.Sprintf("%#v", this.Seconds)+",\n") - s = append(s, "Nanos: "+fmt.Sprintf("%#v", this.Nanos)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringTimestamp(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func extensionToGoStringTimestamp(m github_com_gogo_protobuf_proto.Message) string { - e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) - if e == nil { - return "nil" - } - s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" - keys := make([]int, 0, len(e)) - for k := range e { - keys = append(keys, int(k)) - } - sort.Ints(keys) - ss := []string{} - for _, k := range keys { - ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) - } - s += strings.Join(ss, ",") + "})" - return s -} -func (m *Timestamp) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Timestamp) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Seconds != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTimestamp(dAtA, i, uint64(m.Seconds)) - } - if m.Nanos != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintTimestamp(dAtA, i, uint64(m.Nanos)) - } - return i, nil -} - -func encodeFixed64Timestamp(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Timestamp(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintTimestamp(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *Timestamp) Size() (n int) { - var l int - _ = l - if m.Seconds != 0 { - n += 1 + sovTimestamp(uint64(m.Seconds)) - } - if m.Nanos != 0 { - n += 1 + sovTimestamp(uint64(m.Nanos)) - } - return n -} - -func sovTimestamp(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozTimestamp(x uint64) (n int) { - return sovTimestamp(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Timestamp) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTimestamp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Timestamp: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Timestamp: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Seconds", wireType) - } - m.Seconds = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTimestamp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Seconds |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Nanos", wireType) - } - m.Nanos = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTimestamp - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Nanos |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTimestamp(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTimestamp - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTimestamp(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTimestamp - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTimestamp - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTimestamp - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthTimestamp - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTimestamp - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipTimestamp(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthTimestamp = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTimestamp = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("timestamp.proto", fileDescriptorTimestamp) } - -var fileDescriptorTimestamp = []byte{ - // 208 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x2f, 0xc9, 0xcc, 0x4d, - 0x2d, 0x2e, 0x49, 0xcc, 0x2d, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x4f, 0xcf, 0xcf, - 0x4f, 0xcf, 0x49, 0x85, 0xf0, 0x92, 0x4a, 0xd3, 0x94, 0xac, 0xb9, 0x38, 0x43, 0x60, 0x6a, 0x84, - 0x24, 0xb8, 0xd8, 0x8b, 0x53, 0x93, 0xf3, 0xf3, 0x52, 0x8a, 0x25, 0x18, 0x15, 0x18, 0x35, 0x98, - 0x83, 0x60, 0x5c, 0x21, 0x11, 0x2e, 0xd6, 0xbc, 0xc4, 0xbc, 0xfc, 0x62, 0x09, 0x26, 0x05, 0x46, - 0x0d, 0xd6, 0x20, 0x08, 0xc7, 0xa9, 0x99, 0xf1, 0xc2, 0x43, 0x39, 0x86, 0x1b, 0x0f, 0xe5, 0x18, - 0x3e, 0x3c, 0x94, 0x63, 0x5c, 0xf1, 0x48, 0x8e, 0xf1, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, - 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x7c, 0xf1, 0x48, 0x8e, 0xe1, 0xc3, 0x23, 0x39, 0xc6, 0x15, 0x8f, - 0xe5, 0x18, 0xb9, 0x84, 0x93, 0xf3, 0x73, 0xf5, 0xd0, 0x2c, 0x77, 0xe2, 0x83, 0x5b, 0x1d, 0x00, - 0x12, 0x0a, 0x60, 0x8c, 0x62, 0x2d, 0xa9, 0x2c, 0x48, 0x2d, 0x5e, 0xc0, 0xc8, 0xf8, 0x83, 0x91, - 0x71, 0x11, 0x13, 0xb3, 0x7b, 0x80, 0xd3, 0x2a, 0x26, 0x39, 0x77, 0x88, 0xb6, 0x00, 0xa8, 0x36, - 0xbd, 0xf0, 0xd4, 0x9c, 0x1c, 0xef, 0xbc, 0xfc, 0xf2, 0xbc, 0x10, 0x90, 0xe2, 0x24, 0x36, 0xb0, - 0x79, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7c, 0x4d, 0xbd, 0x9c, 0xed, 0x00, 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp_gogo.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp_gogo.go deleted file mode 100644 index e03fa131583..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/timestamp_gogo.go +++ /dev/null @@ -1,94 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2016, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package types - -import ( - "time" -) - -func NewPopulatedTimestamp(r interface { - Int63() int64 -}, easy bool) *Timestamp { - this := &Timestamp{} - ns := int64(r.Int63()) - this.Seconds = ns / 1e9 - this.Nanos = int32(ns % 1e9) - return this -} - -func (ts *Timestamp) String() string { - return TimestampString(ts) -} - -func NewPopulatedStdTime(r interface { - Int63() int64 -}, easy bool) *time.Time { - timestamp := NewPopulatedTimestamp(r, easy) - t, err := TimestampFromProto(timestamp) - if err != nil { - return nil - } - return &t -} - -func SizeOfStdTime(t time.Time) int { - ts, err := TimestampProto(t) - if err != nil { - return 0 - } - return ts.Size() -} - -func StdTimeMarshal(t time.Time) ([]byte, error) { - size := SizeOfStdTime(t) - buf := make([]byte, size) - _, err := StdTimeMarshalTo(t, buf) - return buf, err -} - -func StdTimeMarshalTo(t time.Time, data []byte) (int, error) { - ts, err := TimestampProto(t) - if err != nil { - return 0, err - } - return ts.MarshalTo(data) -} - -func StdTimeUnmarshal(t *time.Time, data []byte) error { - ts := &Timestamp{} - if err := ts.Unmarshal(data); err != nil { - return err - } - tt, err := TimestampFromProto(ts) - if err != nil { - return err - } - *t = tt - return nil -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/wrappers.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/wrappers.pb.go deleted file mode 100644 index bcd011dc0ca..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/types/wrappers.pb.go +++ /dev/null @@ -1,2280 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: wrappers.proto -// DO NOT EDIT! - -/* -Package types is a generated protocol buffer package. - -It is generated from these files: - wrappers.proto - -It has these top-level messages: - DoubleValue - FloatValue - Int64Value - UInt64Value - Int32Value - UInt32Value - BoolValue - StringValue - BytesValue -*/ -package types - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" - -import bytes "bytes" - -import strings "strings" -import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" -import sort "sort" -import strconv "strconv" -import reflect "reflect" - -import io "io" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -// Wrapper message for `double`. -// -// The JSON representation for `DoubleValue` is JSON number. -type DoubleValue struct { - // The double value. - Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *DoubleValue) Reset() { *m = DoubleValue{} } -func (*DoubleValue) ProtoMessage() {} -func (*DoubleValue) Descriptor() ([]byte, []int) { return fileDescriptorWrappers, []int{0} } -func (*DoubleValue) XXX_WellKnownType() string { return "DoubleValue" } - -func (m *DoubleValue) GetValue() float64 { - if m != nil { - return m.Value - } - return 0 -} - -// Wrapper message for `float`. -// -// The JSON representation for `FloatValue` is JSON number. -type FloatValue struct { - // The float value. - Value float32 `protobuf:"fixed32,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *FloatValue) Reset() { *m = FloatValue{} } -func (*FloatValue) ProtoMessage() {} -func (*FloatValue) Descriptor() ([]byte, []int) { return fileDescriptorWrappers, []int{1} } -func (*FloatValue) XXX_WellKnownType() string { return "FloatValue" } - -func (m *FloatValue) GetValue() float32 { - if m != nil { - return m.Value - } - return 0 -} - -// Wrapper message for `int64`. -// -// The JSON representation for `Int64Value` is JSON string. -type Int64Value struct { - // The int64 value. - Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *Int64Value) Reset() { *m = Int64Value{} } -func (*Int64Value) ProtoMessage() {} -func (*Int64Value) Descriptor() ([]byte, []int) { return fileDescriptorWrappers, []int{2} } -func (*Int64Value) XXX_WellKnownType() string { return "Int64Value" } - -func (m *Int64Value) GetValue() int64 { - if m != nil { - return m.Value - } - return 0 -} - -// Wrapper message for `uint64`. -// -// The JSON representation for `UInt64Value` is JSON string. -type UInt64Value struct { - // The uint64 value. - Value uint64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *UInt64Value) Reset() { *m = UInt64Value{} } -func (*UInt64Value) ProtoMessage() {} -func (*UInt64Value) Descriptor() ([]byte, []int) { return fileDescriptorWrappers, []int{3} } -func (*UInt64Value) XXX_WellKnownType() string { return "UInt64Value" } - -func (m *UInt64Value) GetValue() uint64 { - if m != nil { - return m.Value - } - return 0 -} - -// Wrapper message for `int32`. -// -// The JSON representation for `Int32Value` is JSON number. -type Int32Value struct { - // The int32 value. - Value int32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *Int32Value) Reset() { *m = Int32Value{} } -func (*Int32Value) ProtoMessage() {} -func (*Int32Value) Descriptor() ([]byte, []int) { return fileDescriptorWrappers, []int{4} } -func (*Int32Value) XXX_WellKnownType() string { return "Int32Value" } - -func (m *Int32Value) GetValue() int32 { - if m != nil { - return m.Value - } - return 0 -} - -// Wrapper message for `uint32`. -// -// The JSON representation for `UInt32Value` is JSON number. -type UInt32Value struct { - // The uint32 value. - Value uint32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *UInt32Value) Reset() { *m = UInt32Value{} } -func (*UInt32Value) ProtoMessage() {} -func (*UInt32Value) Descriptor() ([]byte, []int) { return fileDescriptorWrappers, []int{5} } -func (*UInt32Value) XXX_WellKnownType() string { return "UInt32Value" } - -func (m *UInt32Value) GetValue() uint32 { - if m != nil { - return m.Value - } - return 0 -} - -// Wrapper message for `bool`. -// -// The JSON representation for `BoolValue` is JSON `true` and `false`. -type BoolValue struct { - // The bool value. - Value bool `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *BoolValue) Reset() { *m = BoolValue{} } -func (*BoolValue) ProtoMessage() {} -func (*BoolValue) Descriptor() ([]byte, []int) { return fileDescriptorWrappers, []int{6} } -func (*BoolValue) XXX_WellKnownType() string { return "BoolValue" } - -func (m *BoolValue) GetValue() bool { - if m != nil { - return m.Value - } - return false -} - -// Wrapper message for `string`. -// -// The JSON representation for `StringValue` is JSON string. -type StringValue struct { - // The string value. - Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *StringValue) Reset() { *m = StringValue{} } -func (*StringValue) ProtoMessage() {} -func (*StringValue) Descriptor() ([]byte, []int) { return fileDescriptorWrappers, []int{7} } -func (*StringValue) XXX_WellKnownType() string { return "StringValue" } - -func (m *StringValue) GetValue() string { - if m != nil { - return m.Value - } - return "" -} - -// Wrapper message for `bytes`. -// -// The JSON representation for `BytesValue` is JSON string. -type BytesValue struct { - // The bytes value. - Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *BytesValue) Reset() { *m = BytesValue{} } -func (*BytesValue) ProtoMessage() {} -func (*BytesValue) Descriptor() ([]byte, []int) { return fileDescriptorWrappers, []int{8} } -func (*BytesValue) XXX_WellKnownType() string { return "BytesValue" } - -func (m *BytesValue) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -func init() { - proto.RegisterType((*DoubleValue)(nil), "google.protobuf.DoubleValue") - proto.RegisterType((*FloatValue)(nil), "google.protobuf.FloatValue") - proto.RegisterType((*Int64Value)(nil), "google.protobuf.Int64Value") - proto.RegisterType((*UInt64Value)(nil), "google.protobuf.UInt64Value") - proto.RegisterType((*Int32Value)(nil), "google.protobuf.Int32Value") - proto.RegisterType((*UInt32Value)(nil), "google.protobuf.UInt32Value") - proto.RegisterType((*BoolValue)(nil), "google.protobuf.BoolValue") - proto.RegisterType((*StringValue)(nil), "google.protobuf.StringValue") - proto.RegisterType((*BytesValue)(nil), "google.protobuf.BytesValue") -} -func (this *DoubleValue) Compare(that interface{}) int { - if that == nil { - if this == nil { - return 0 - } - return 1 - } - - that1, ok := that.(*DoubleValue) - if !ok { - that2, ok := that.(DoubleValue) - if ok { - that1 = &that2 - } else { - return 1 - } - } - if that1 == nil { - if this == nil { - return 0 - } - return 1 - } else if this == nil { - return -1 - } - if this.Value != that1.Value { - if this.Value < that1.Value { - return -1 - } - return 1 - } - return 0 -} -func (this *FloatValue) Compare(that interface{}) int { - if that == nil { - if this == nil { - return 0 - } - return 1 - } - - that1, ok := that.(*FloatValue) - if !ok { - that2, ok := that.(FloatValue) - if ok { - that1 = &that2 - } else { - return 1 - } - } - if that1 == nil { - if this == nil { - return 0 - } - return 1 - } else if this == nil { - return -1 - } - if this.Value != that1.Value { - if this.Value < that1.Value { - return -1 - } - return 1 - } - return 0 -} -func (this *Int64Value) Compare(that interface{}) int { - if that == nil { - if this == nil { - return 0 - } - return 1 - } - - that1, ok := that.(*Int64Value) - if !ok { - that2, ok := that.(Int64Value) - if ok { - that1 = &that2 - } else { - return 1 - } - } - if that1 == nil { - if this == nil { - return 0 - } - return 1 - } else if this == nil { - return -1 - } - if this.Value != that1.Value { - if this.Value < that1.Value { - return -1 - } - return 1 - } - return 0 -} -func (this *UInt64Value) Compare(that interface{}) int { - if that == nil { - if this == nil { - return 0 - } - return 1 - } - - that1, ok := that.(*UInt64Value) - if !ok { - that2, ok := that.(UInt64Value) - if ok { - that1 = &that2 - } else { - return 1 - } - } - if that1 == nil { - if this == nil { - return 0 - } - return 1 - } else if this == nil { - return -1 - } - if this.Value != that1.Value { - if this.Value < that1.Value { - return -1 - } - return 1 - } - return 0 -} -func (this *Int32Value) Compare(that interface{}) int { - if that == nil { - if this == nil { - return 0 - } - return 1 - } - - that1, ok := that.(*Int32Value) - if !ok { - that2, ok := that.(Int32Value) - if ok { - that1 = &that2 - } else { - return 1 - } - } - if that1 == nil { - if this == nil { - return 0 - } - return 1 - } else if this == nil { - return -1 - } - if this.Value != that1.Value { - if this.Value < that1.Value { - return -1 - } - return 1 - } - return 0 -} -func (this *UInt32Value) Compare(that interface{}) int { - if that == nil { - if this == nil { - return 0 - } - return 1 - } - - that1, ok := that.(*UInt32Value) - if !ok { - that2, ok := that.(UInt32Value) - if ok { - that1 = &that2 - } else { - return 1 - } - } - if that1 == nil { - if this == nil { - return 0 - } - return 1 - } else if this == nil { - return -1 - } - if this.Value != that1.Value { - if this.Value < that1.Value { - return -1 - } - return 1 - } - return 0 -} -func (this *BoolValue) Compare(that interface{}) int { - if that == nil { - if this == nil { - return 0 - } - return 1 - } - - that1, ok := that.(*BoolValue) - if !ok { - that2, ok := that.(BoolValue) - if ok { - that1 = &that2 - } else { - return 1 - } - } - if that1 == nil { - if this == nil { - return 0 - } - return 1 - } else if this == nil { - return -1 - } - if this.Value != that1.Value { - if !this.Value { - return -1 - } - return 1 - } - return 0 -} -func (this *StringValue) Compare(that interface{}) int { - if that == nil { - if this == nil { - return 0 - } - return 1 - } - - that1, ok := that.(*StringValue) - if !ok { - that2, ok := that.(StringValue) - if ok { - that1 = &that2 - } else { - return 1 - } - } - if that1 == nil { - if this == nil { - return 0 - } - return 1 - } else if this == nil { - return -1 - } - if this.Value != that1.Value { - if this.Value < that1.Value { - return -1 - } - return 1 - } - return 0 -} -func (this *BytesValue) Compare(that interface{}) int { - if that == nil { - if this == nil { - return 0 - } - return 1 - } - - that1, ok := that.(*BytesValue) - if !ok { - that2, ok := that.(BytesValue) - if ok { - that1 = &that2 - } else { - return 1 - } - } - if that1 == nil { - if this == nil { - return 0 - } - return 1 - } else if this == nil { - return -1 - } - if c := bytes.Compare(this.Value, that1.Value); c != 0 { - return c - } - return 0 -} -func (this *DoubleValue) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*DoubleValue) - if !ok { - that2, ok := that.(DoubleValue) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if this.Value != that1.Value { - return false - } - return true -} -func (this *FloatValue) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*FloatValue) - if !ok { - that2, ok := that.(FloatValue) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if this.Value != that1.Value { - return false - } - return true -} -func (this *Int64Value) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*Int64Value) - if !ok { - that2, ok := that.(Int64Value) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if this.Value != that1.Value { - return false - } - return true -} -func (this *UInt64Value) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*UInt64Value) - if !ok { - that2, ok := that.(UInt64Value) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if this.Value != that1.Value { - return false - } - return true -} -func (this *Int32Value) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*Int32Value) - if !ok { - that2, ok := that.(Int32Value) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if this.Value != that1.Value { - return false - } - return true -} -func (this *UInt32Value) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*UInt32Value) - if !ok { - that2, ok := that.(UInt32Value) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if this.Value != that1.Value { - return false - } - return true -} -func (this *BoolValue) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*BoolValue) - if !ok { - that2, ok := that.(BoolValue) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if this.Value != that1.Value { - return false - } - return true -} -func (this *StringValue) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*StringValue) - if !ok { - that2, ok := that.(StringValue) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if this.Value != that1.Value { - return false - } - return true -} -func (this *BytesValue) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*BytesValue) - if !ok { - that2, ok := that.(BytesValue) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if !bytes.Equal(this.Value, that1.Value) { - return false - } - return true -} -func (this *DoubleValue) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&types.DoubleValue{") - s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *FloatValue) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&types.FloatValue{") - s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *Int64Value) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&types.Int64Value{") - s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *UInt64Value) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&types.UInt64Value{") - s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *Int32Value) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&types.Int32Value{") - s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *UInt32Value) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&types.UInt32Value{") - s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *BoolValue) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&types.BoolValue{") - s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *StringValue) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&types.StringValue{") - s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *BytesValue) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&types.BytesValue{") - s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringWrappers(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func extensionToGoStringWrappers(m github_com_gogo_protobuf_proto.Message) string { - e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) - if e == nil { - return "nil" - } - s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" - keys := make([]int, 0, len(e)) - for k := range e { - keys = append(keys, int(k)) - } - sort.Ints(keys) - ss := []string{} - for _, k := range keys { - ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) - } - s += strings.Join(ss, ",") + "})" - return s -} -func (m *DoubleValue) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DoubleValue) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Value != 0 { - dAtA[i] = 0x9 - i++ - i = encodeFixed64Wrappers(dAtA, i, uint64(math.Float64bits(float64(m.Value)))) - } - return i, nil -} - -func (m *FloatValue) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *FloatValue) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Value != 0 { - dAtA[i] = 0xd - i++ - i = encodeFixed32Wrappers(dAtA, i, uint32(math.Float32bits(float32(m.Value)))) - } - return i, nil -} - -func (m *Int64Value) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Int64Value) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Value != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintWrappers(dAtA, i, uint64(m.Value)) - } - return i, nil -} - -func (m *UInt64Value) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *UInt64Value) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Value != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintWrappers(dAtA, i, uint64(m.Value)) - } - return i, nil -} - -func (m *Int32Value) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Int32Value) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Value != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintWrappers(dAtA, i, uint64(m.Value)) - } - return i, nil -} - -func (m *UInt32Value) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *UInt32Value) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Value != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintWrappers(dAtA, i, uint64(m.Value)) - } - return i, nil -} - -func (m *BoolValue) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BoolValue) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Value { - dAtA[i] = 0x8 - i++ - if m.Value { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - } - return i, nil -} - -func (m *StringValue) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StringValue) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Value) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintWrappers(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) - } - return i, nil -} - -func (m *BytesValue) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BytesValue) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Value) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintWrappers(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) - } - return i, nil -} - -func encodeFixed64Wrappers(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Wrappers(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintWrappers(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func NewPopulatedDoubleValue(r randyWrappers, easy bool) *DoubleValue { - this := &DoubleValue{} - this.Value = float64(r.Float64()) - if r.Intn(2) == 0 { - this.Value *= -1 - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedFloatValue(r randyWrappers, easy bool) *FloatValue { - this := &FloatValue{} - this.Value = float32(r.Float32()) - if r.Intn(2) == 0 { - this.Value *= -1 - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedInt64Value(r randyWrappers, easy bool) *Int64Value { - this := &Int64Value{} - this.Value = int64(r.Int63()) - if r.Intn(2) == 0 { - this.Value *= -1 - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedUInt64Value(r randyWrappers, easy bool) *UInt64Value { - this := &UInt64Value{} - this.Value = uint64(uint64(r.Uint32())) - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedInt32Value(r randyWrappers, easy bool) *Int32Value { - this := &Int32Value{} - this.Value = int32(r.Int31()) - if r.Intn(2) == 0 { - this.Value *= -1 - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedUInt32Value(r randyWrappers, easy bool) *UInt32Value { - this := &UInt32Value{} - this.Value = uint32(r.Uint32()) - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedBoolValue(r randyWrappers, easy bool) *BoolValue { - this := &BoolValue{} - this.Value = bool(bool(r.Intn(2) == 0)) - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedStringValue(r randyWrappers, easy bool) *StringValue { - this := &StringValue{} - this.Value = string(randStringWrappers(r)) - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedBytesValue(r randyWrappers, easy bool) *BytesValue { - this := &BytesValue{} - v1 := r.Intn(100) - this.Value = make([]byte, v1) - for i := 0; i < v1; i++ { - this.Value[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -type randyWrappers interface { - Float32() float32 - Float64() float64 - Int63() int64 - Int31() int32 - Uint32() uint32 - Intn(n int) int -} - -func randUTF8RuneWrappers(r randyWrappers) rune { - ru := r.Intn(62) - if ru < 10 { - return rune(ru + 48) - } else if ru < 36 { - return rune(ru + 55) - } - return rune(ru + 61) -} -func randStringWrappers(r randyWrappers) string { - v2 := r.Intn(100) - tmps := make([]rune, v2) - for i := 0; i < v2; i++ { - tmps[i] = randUTF8RuneWrappers(r) - } - return string(tmps) -} -func randUnrecognizedWrappers(r randyWrappers, maxFieldNumber int) (dAtA []byte) { - l := r.Intn(5) - for i := 0; i < l; i++ { - wire := r.Intn(4) - if wire == 3 { - wire = 5 - } - fieldNumber := maxFieldNumber + r.Intn(100) - dAtA = randFieldWrappers(dAtA, r, fieldNumber, wire) - } - return dAtA -} -func randFieldWrappers(dAtA []byte, r randyWrappers, fieldNumber int, wire int) []byte { - key := uint32(fieldNumber)<<3 | uint32(wire) - switch wire { - case 0: - dAtA = encodeVarintPopulateWrappers(dAtA, uint64(key)) - v3 := r.Int63() - if r.Intn(2) == 0 { - v3 *= -1 - } - dAtA = encodeVarintPopulateWrappers(dAtA, uint64(v3)) - case 1: - dAtA = encodeVarintPopulateWrappers(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - case 2: - dAtA = encodeVarintPopulateWrappers(dAtA, uint64(key)) - ll := r.Intn(100) - dAtA = encodeVarintPopulateWrappers(dAtA, uint64(ll)) - for j := 0; j < ll; j++ { - dAtA = append(dAtA, byte(r.Intn(256))) - } - default: - dAtA = encodeVarintPopulateWrappers(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - } - return dAtA -} -func encodeVarintPopulateWrappers(dAtA []byte, v uint64) []byte { - for v >= 1<<7 { - dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) - v >>= 7 - } - dAtA = append(dAtA, uint8(v)) - return dAtA -} -func (m *DoubleValue) Size() (n int) { - var l int - _ = l - if m.Value != 0 { - n += 9 - } - return n -} - -func (m *FloatValue) Size() (n int) { - var l int - _ = l - if m.Value != 0 { - n += 5 - } - return n -} - -func (m *Int64Value) Size() (n int) { - var l int - _ = l - if m.Value != 0 { - n += 1 + sovWrappers(uint64(m.Value)) - } - return n -} - -func (m *UInt64Value) Size() (n int) { - var l int - _ = l - if m.Value != 0 { - n += 1 + sovWrappers(uint64(m.Value)) - } - return n -} - -func (m *Int32Value) Size() (n int) { - var l int - _ = l - if m.Value != 0 { - n += 1 + sovWrappers(uint64(m.Value)) - } - return n -} - -func (m *UInt32Value) Size() (n int) { - var l int - _ = l - if m.Value != 0 { - n += 1 + sovWrappers(uint64(m.Value)) - } - return n -} - -func (m *BoolValue) Size() (n int) { - var l int - _ = l - if m.Value { - n += 2 - } - return n -} - -func (m *StringValue) Size() (n int) { - var l int - _ = l - l = len(m.Value) - if l > 0 { - n += 1 + l + sovWrappers(uint64(l)) - } - return n -} - -func (m *BytesValue) Size() (n int) { - var l int - _ = l - l = len(m.Value) - if l > 0 { - n += 1 + l + sovWrappers(uint64(l)) - } - return n -} - -func sovWrappers(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozWrappers(x uint64) (n int) { - return sovWrappers(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *DoubleValue) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&DoubleValue{`, - `Value:` + fmt.Sprintf("%v", this.Value) + `,`, - `}`, - }, "") - return s -} -func (this *FloatValue) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&FloatValue{`, - `Value:` + fmt.Sprintf("%v", this.Value) + `,`, - `}`, - }, "") - return s -} -func (this *Int64Value) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Int64Value{`, - `Value:` + fmt.Sprintf("%v", this.Value) + `,`, - `}`, - }, "") - return s -} -func (this *UInt64Value) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&UInt64Value{`, - `Value:` + fmt.Sprintf("%v", this.Value) + `,`, - `}`, - }, "") - return s -} -func (this *Int32Value) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Int32Value{`, - `Value:` + fmt.Sprintf("%v", this.Value) + `,`, - `}`, - }, "") - return s -} -func (this *UInt32Value) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&UInt32Value{`, - `Value:` + fmt.Sprintf("%v", this.Value) + `,`, - `}`, - }, "") - return s -} -func (this *BoolValue) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&BoolValue{`, - `Value:` + fmt.Sprintf("%v", this.Value) + `,`, - `}`, - }, "") - return s -} -func (this *StringValue) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&StringValue{`, - `Value:` + fmt.Sprintf("%v", this.Value) + `,`, - `}`, - }, "") - return s -} -func (this *BytesValue) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&BytesValue{`, - `Value:` + fmt.Sprintf("%v", this.Value) + `,`, - `}`, - }, "") - return s -} -func valueToStringWrappers(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *DoubleValue) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWrappers - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DoubleValue: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DoubleValue: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - iNdEx += 8 - v = uint64(dAtA[iNdEx-8]) - v |= uint64(dAtA[iNdEx-7]) << 8 - v |= uint64(dAtA[iNdEx-6]) << 16 - v |= uint64(dAtA[iNdEx-5]) << 24 - v |= uint64(dAtA[iNdEx-4]) << 32 - v |= uint64(dAtA[iNdEx-3]) << 40 - v |= uint64(dAtA[iNdEx-2]) << 48 - v |= uint64(dAtA[iNdEx-1]) << 56 - m.Value = float64(math.Float64frombits(v)) - default: - iNdEx = preIndex - skippy, err := skipWrappers(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthWrappers - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *FloatValue) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWrappers - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FloatValue: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FloatValue: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 5 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var v uint32 - if (iNdEx + 4) > l { - return io.ErrUnexpectedEOF - } - iNdEx += 4 - v = uint32(dAtA[iNdEx-4]) - v |= uint32(dAtA[iNdEx-3]) << 8 - v |= uint32(dAtA[iNdEx-2]) << 16 - v |= uint32(dAtA[iNdEx-1]) << 24 - m.Value = float32(math.Float32frombits(v)) - default: - iNdEx = preIndex - skippy, err := skipWrappers(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthWrappers - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Int64Value) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWrappers - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Int64Value: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Int64Value: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - m.Value = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWrappers - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Value |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipWrappers(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthWrappers - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *UInt64Value) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWrappers - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: UInt64Value: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UInt64Value: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - m.Value = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWrappers - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Value |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipWrappers(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthWrappers - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Int32Value) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWrappers - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Int32Value: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Int32Value: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - m.Value = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWrappers - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Value |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipWrappers(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthWrappers - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *UInt32Value) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWrappers - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: UInt32Value: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UInt32Value: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - m.Value = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWrappers - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Value |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipWrappers(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthWrappers - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BoolValue) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWrappers - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BoolValue: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BoolValue: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWrappers - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Value = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipWrappers(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthWrappers - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *StringValue) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWrappers - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StringValue: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StringValue: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWrappers - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthWrappers - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWrappers(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthWrappers - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BytesValue) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWrappers - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BytesValue: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BytesValue: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowWrappers - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthWrappers - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipWrappers(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthWrappers - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipWrappers(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowWrappers - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowWrappers - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowWrappers - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthWrappers - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowWrappers - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipWrappers(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthWrappers = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowWrappers = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("wrappers.proto", fileDescriptorWrappers) } - -var fileDescriptorWrappers = []byte{ - // 281 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x2b, 0x2f, 0x4a, 0x2c, - 0x28, 0x48, 0x2d, 0x2a, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x4f, 0xcf, 0xcf, 0x4f, - 0xcf, 0x49, 0x85, 0xf0, 0x92, 0x4a, 0xd3, 0x94, 0x94, 0xb9, 0xb8, 0x5d, 0xf2, 0x4b, 0x93, 0x72, - 0x52, 0xc3, 0x12, 0x73, 0x4a, 0x53, 0x85, 0x44, 0xb8, 0x58, 0xcb, 0x40, 0x0c, 0x09, 0x46, 0x05, - 0x46, 0x0d, 0xc6, 0x20, 0x08, 0x47, 0x49, 0x89, 0x8b, 0xcb, 0x2d, 0x27, 0x3f, 0xb1, 0x04, 0x8b, - 0x1a, 0x26, 0x24, 0x35, 0x9e, 0x79, 0x25, 0x66, 0x26, 0x58, 0xd4, 0x30, 0xc3, 0xd4, 0x28, 0x73, - 0x71, 0x87, 0xe2, 0x52, 0xc4, 0x82, 0x6a, 0x90, 0xb1, 0x11, 0x16, 0x35, 0xac, 0x68, 0x06, 0x61, - 0x55, 0xc4, 0x0b, 0x53, 0xa4, 0xc8, 0xc5, 0xe9, 0x94, 0x9f, 0x9f, 0x83, 0x45, 0x09, 0x07, 0x92, - 0x39, 0xc1, 0x25, 0x45, 0x99, 0x79, 0xe9, 0x58, 0x14, 0x71, 0x22, 0x39, 0xc8, 0xa9, 0xb2, 0x24, - 0xb5, 0x18, 0x8b, 0x1a, 0x1e, 0xa8, 0x1a, 0xa7, 0x2e, 0xc6, 0x0b, 0x0f, 0xe5, 0x18, 0x6e, 0x3c, - 0x94, 0x63, 0xf8, 0xf0, 0x50, 0x8e, 0xf1, 0xc7, 0x43, 0x39, 0xc6, 0x86, 0x47, 0x72, 0x8c, 0x2b, - 0x1e, 0xc9, 0x31, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, - 0x2f, 0x1e, 0xc9, 0x31, 0x7c, 0x00, 0x89, 0x3f, 0x96, 0x63, 0xe4, 0x12, 0x4e, 0xce, 0xcf, 0xd5, - 0x43, 0x8b, 0x0e, 0x27, 0xde, 0x70, 0x68, 0x7c, 0x05, 0x80, 0x44, 0x02, 0x18, 0xa3, 0x58, 0x4b, - 0x2a, 0x0b, 0x52, 0x8b, 0x17, 0x30, 0x32, 0xfe, 0x60, 0x64, 0x5c, 0xc4, 0xc4, 0xec, 0x1e, 0xe0, - 0xb4, 0x8a, 0x49, 0xce, 0x1d, 0xa2, 0x2b, 0x00, 0xaa, 0x4b, 0x2f, 0x3c, 0x35, 0x27, 0xc7, 0x3b, - 0x2f, 0xbf, 0x3c, 0x2f, 0x04, 0xa4, 0x38, 0x89, 0x0d, 0x6c, 0x9c, 0x31, 0x20, 0x00, 0x00, 0xff, - 0xff, 0xac, 0x8b, 0x9f, 0x55, 0xfd, 0x01, 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/command/command.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/command/command.go deleted file mode 100644 index eeca42ba0d0..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/command/command.go +++ /dev/null @@ -1,161 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2015, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package command - -import ( - "fmt" - "go/format" - "io/ioutil" - "os" - "strings" - - _ "github.com/gogo/protobuf/plugin/compare" - _ "github.com/gogo/protobuf/plugin/defaultcheck" - _ "github.com/gogo/protobuf/plugin/description" - _ "github.com/gogo/protobuf/plugin/embedcheck" - _ "github.com/gogo/protobuf/plugin/enumstringer" - _ "github.com/gogo/protobuf/plugin/equal" - _ "github.com/gogo/protobuf/plugin/face" - _ "github.com/gogo/protobuf/plugin/gostring" - _ "github.com/gogo/protobuf/plugin/marshalto" - _ "github.com/gogo/protobuf/plugin/oneofcheck" - _ "github.com/gogo/protobuf/plugin/populate" - _ "github.com/gogo/protobuf/plugin/size" - _ "github.com/gogo/protobuf/plugin/stringer" - "github.com/gogo/protobuf/plugin/testgen" - _ "github.com/gogo/protobuf/plugin/union" - _ "github.com/gogo/protobuf/plugin/unmarshal" - "github.com/gogo/protobuf/proto" - "github.com/gogo/protobuf/protoc-gen-gogo/generator" - _ "github.com/gogo/protobuf/protoc-gen-gogo/grpc" - plugin "github.com/gogo/protobuf/protoc-gen-gogo/plugin" -) - -func Read() *plugin.CodeGeneratorRequest { - g := generator.New() - data, err := ioutil.ReadAll(os.Stdin) - if err != nil { - g.Error(err, "reading input") - } - - if err := proto.Unmarshal(data, g.Request); err != nil { - g.Error(err, "parsing input proto") - } - - if len(g.Request.FileToGenerate) == 0 { - g.Fail("no files to generate") - } - return g.Request -} - -// filenameSuffix replaces the .pb.go at the end of each filename. -func GeneratePlugin(req *plugin.CodeGeneratorRequest, p generator.Plugin, filenameSuffix string) *plugin.CodeGeneratorResponse { - g := generator.New() - g.Request = req - if len(g.Request.FileToGenerate) == 0 { - g.Fail("no files to generate") - } - - g.CommandLineParameters(g.Request.GetParameter()) - - g.WrapTypes() - g.SetPackageNames() - g.BuildTypeNameMap() - g.GeneratePlugin(p) - - for i := 0; i < len(g.Response.File); i++ { - g.Response.File[i].Name = proto.String( - strings.Replace(*g.Response.File[i].Name, ".pb.go", filenameSuffix, -1), - ) - } - if err := goformat(g.Response); err != nil { - g.Error(err) - } - return g.Response -} - -func goformat(resp *plugin.CodeGeneratorResponse) error { - for i := 0; i < len(resp.File); i++ { - formatted, err := format.Source([]byte(resp.File[i].GetContent())) - if err != nil { - return fmt.Errorf("go format error: %v", err) - } - fmts := string(formatted) - resp.File[i].Content = &fmts - } - return nil -} - -func Generate(req *plugin.CodeGeneratorRequest) *plugin.CodeGeneratorResponse { - // Begin by allocating a generator. The request and response structures are stored there - // so we can do error handling easily - the response structure contains the field to - // report failure. - g := generator.New() - g.Request = req - - g.CommandLineParameters(g.Request.GetParameter()) - - // Create a wrapped version of the Descriptors and EnumDescriptors that - // point to the file that defines them. - g.WrapTypes() - - g.SetPackageNames() - g.BuildTypeNameMap() - - g.GenerateAllFiles() - - if err := goformat(g.Response); err != nil { - g.Error(err) - } - - testReq := proto.Clone(req).(*plugin.CodeGeneratorRequest) - - testResp := GeneratePlugin(testReq, testgen.NewPlugin(), "pb_test.go") - - for i := 0; i < len(testResp.File); i++ { - if strings.Contains(*testResp.File[i].Content, `//These tests are generated by github.com/gogo/protobuf/plugin/testgen`) { - g.Response.File = append(g.Response.File, testResp.File[i]) - } - } - - return g.Response -} - -func Write(resp *plugin.CodeGeneratorResponse) { - g := generator.New() - // Send back the results. - data, err := proto.Marshal(resp) - if err != nil { - g.Error(err, "failed to marshal output proto") - } - _, err = os.Stdout.Write(data) - if err != nil { - g.Error(err, "failed to write output proto") - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/enum.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/enum.go deleted file mode 100644 index 466d07b54eb..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/enum.go +++ /dev/null @@ -1,78 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2015, The GoGo Authors. rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package vanity - -import ( - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/proto" - descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" -) - -func EnumHasBoolExtension(enum *descriptor.EnumDescriptorProto, extension *proto.ExtensionDesc) bool { - if enum.Options == nil { - return false - } - value, err := proto.GetExtension(enum.Options, extension) - if err != nil { - return false - } - if value == nil { - return false - } - if value.(*bool) == nil { - return false - } - return true -} - -func SetBoolEnumOption(extension *proto.ExtensionDesc, value bool) func(enum *descriptor.EnumDescriptorProto) { - return func(enum *descriptor.EnumDescriptorProto) { - if EnumHasBoolExtension(enum, extension) { - return - } - if enum.Options == nil { - enum.Options = &descriptor.EnumOptions{} - } - if err := proto.SetExtension(enum.Options, extension, &value); err != nil { - panic(err) - } - } -} - -func TurnOffGoEnumPrefix(enum *descriptor.EnumDescriptorProto) { - SetBoolEnumOption(gogoproto.E_GoprotoEnumPrefix, false)(enum) -} - -func TurnOffGoEnumStringer(enum *descriptor.EnumDescriptorProto) { - SetBoolEnumOption(gogoproto.E_GoprotoEnumStringer, false)(enum) -} - -func TurnOnEnumStringer(enum *descriptor.EnumDescriptorProto) { - SetBoolEnumOption(gogoproto.E_EnumStringer, true)(enum) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/field.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/field.go deleted file mode 100644 index 9c5e2263c10..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/field.go +++ /dev/null @@ -1,83 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2015, The GoGo Authors. rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package vanity - -import ( - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/proto" - descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" -) - -func FieldHasBoolExtension(field *descriptor.FieldDescriptorProto, extension *proto.ExtensionDesc) bool { - if field.Options == nil { - return false - } - value, err := proto.GetExtension(field.Options, extension) - if err != nil { - return false - } - if value == nil { - return false - } - if value.(*bool) == nil { - return false - } - return true -} - -func SetBoolFieldOption(extension *proto.ExtensionDesc, value bool) func(field *descriptor.FieldDescriptorProto) { - return func(field *descriptor.FieldDescriptorProto) { - if FieldHasBoolExtension(field, extension) { - return - } - if field.Options == nil { - field.Options = &descriptor.FieldOptions{} - } - if err := proto.SetExtension(field.Options, extension, &value); err != nil { - panic(err) - } - } -} - -func TurnOffNullable(field *descriptor.FieldDescriptorProto) { - if field.IsRepeated() && !field.IsMessage() { - return - } - SetBoolFieldOption(gogoproto.E_Nullable, false)(field) -} - -func TurnOffNullableForNativeTypesWithoutDefaultsOnly(field *descriptor.FieldDescriptorProto) { - if field.IsRepeated() || field.IsMessage() { - return - } - if field.DefaultValue != nil { - return - } - SetBoolFieldOption(gogoproto.E_Nullable, false)(field) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/file.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/file.go deleted file mode 100644 index e7b56de1f7a..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/file.go +++ /dev/null @@ -1,181 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2015, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package vanity - -import ( - "path/filepath" - - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/proto" - descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" -) - -func NotGoogleProtobufDescriptorProto(file *descriptor.FileDescriptorProto) bool { - // can not just check if file.GetName() == "google/protobuf/descriptor.proto" because we do not want to assume compile path - _, fileName := filepath.Split(file.GetName()) - return !(file.GetPackage() == "google.protobuf" && fileName == "descriptor.proto") -} - -func FilterFiles(files []*descriptor.FileDescriptorProto, f func(file *descriptor.FileDescriptorProto) bool) []*descriptor.FileDescriptorProto { - filtered := make([]*descriptor.FileDescriptorProto, 0, len(files)) - for i := range files { - if !f(files[i]) { - continue - } - filtered = append(filtered, files[i]) - } - return filtered -} - -func FileHasBoolExtension(file *descriptor.FileDescriptorProto, extension *proto.ExtensionDesc) bool { - if file.Options == nil { - return false - } - value, err := proto.GetExtension(file.Options, extension) - if err != nil { - return false - } - if value == nil { - return false - } - if value.(*bool) == nil { - return false - } - return true -} - -func SetBoolFileOption(extension *proto.ExtensionDesc, value bool) func(file *descriptor.FileDescriptorProto) { - return func(file *descriptor.FileDescriptorProto) { - if FileHasBoolExtension(file, extension) { - return - } - if file.Options == nil { - file.Options = &descriptor.FileOptions{} - } - if err := proto.SetExtension(file.Options, extension, &value); err != nil { - panic(err) - } - } -} - -func TurnOffGoGettersAll(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_GoprotoGettersAll, false)(file) -} - -func TurnOffGoEnumPrefixAll(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_GoprotoEnumPrefixAll, false)(file) -} - -func TurnOffGoStringerAll(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_GoprotoStringerAll, false)(file) -} - -func TurnOnVerboseEqualAll(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_VerboseEqualAll, true)(file) -} - -func TurnOnFaceAll(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_FaceAll, true)(file) -} - -func TurnOnGoStringAll(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_GostringAll, true)(file) -} - -func TurnOnPopulateAll(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_PopulateAll, true)(file) -} - -func TurnOnStringerAll(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_StringerAll, true)(file) -} - -func TurnOnEqualAll(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_EqualAll, true)(file) -} - -func TurnOnDescriptionAll(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_DescriptionAll, true)(file) -} - -func TurnOnTestGenAll(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_TestgenAll, true)(file) -} - -func TurnOnBenchGenAll(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_BenchgenAll, true)(file) -} - -func TurnOnMarshalerAll(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_MarshalerAll, true)(file) -} - -func TurnOnUnmarshalerAll(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_UnmarshalerAll, true)(file) -} - -func TurnOnStable_MarshalerAll(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_StableMarshalerAll, true)(file) -} - -func TurnOnSizerAll(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_SizerAll, true)(file) -} - -func TurnOffGoEnumStringerAll(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_GoprotoEnumStringerAll, false)(file) -} - -func TurnOnEnumStringerAll(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_EnumStringerAll, true)(file) -} - -func TurnOnUnsafeUnmarshalerAll(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_UnsafeUnmarshalerAll, true)(file) -} - -func TurnOnUnsafeMarshalerAll(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_UnsafeMarshalerAll, true)(file) -} - -func TurnOffGoExtensionsMapAll(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_GoprotoExtensionsMapAll, false)(file) -} - -func TurnOffGoUnrecognizedAll(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_GoprotoUnrecognizedAll, false)(file) -} - -func TurnOffGogoImport(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_GogoprotoImport, false)(file) -} - -func TurnOnCompareAll(file *descriptor.FileDescriptorProto) { - SetBoolFileOption(gogoproto.E_CompareAll, true)(file) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/foreach.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/foreach.go deleted file mode 100644 index 888b6d04d59..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/foreach.go +++ /dev/null @@ -1,125 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2015, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package vanity - -import descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - -func ForEachFile(files []*descriptor.FileDescriptorProto, f func(file *descriptor.FileDescriptorProto)) { - for _, file := range files { - f(file) - } -} - -func OnlyProto2(files []*descriptor.FileDescriptorProto) []*descriptor.FileDescriptorProto { - outs := make([]*descriptor.FileDescriptorProto, 0, len(files)) - for i, file := range files { - if file.GetSyntax() == "proto3" { - continue - } - outs = append(outs, files[i]) - } - return outs -} - -func OnlyProto3(files []*descriptor.FileDescriptorProto) []*descriptor.FileDescriptorProto { - outs := make([]*descriptor.FileDescriptorProto, 0, len(files)) - for i, file := range files { - if file.GetSyntax() != "proto3" { - continue - } - outs = append(outs, files[i]) - } - return outs -} - -func ForEachMessageInFiles(files []*descriptor.FileDescriptorProto, f func(msg *descriptor.DescriptorProto)) { - for _, file := range files { - ForEachMessage(file.MessageType, f) - } -} - -func ForEachMessage(msgs []*descriptor.DescriptorProto, f func(msg *descriptor.DescriptorProto)) { - for _, msg := range msgs { - f(msg) - ForEachMessage(msg.NestedType, f) - } -} - -func ForEachFieldInFilesExcludingExtensions(files []*descriptor.FileDescriptorProto, f func(field *descriptor.FieldDescriptorProto)) { - for _, file := range files { - ForEachFieldExcludingExtensions(file.MessageType, f) - } -} - -func ForEachFieldInFiles(files []*descriptor.FileDescriptorProto, f func(field *descriptor.FieldDescriptorProto)) { - for _, file := range files { - for _, ext := range file.Extension { - f(ext) - } - ForEachField(file.MessageType, f) - } -} - -func ForEachFieldExcludingExtensions(msgs []*descriptor.DescriptorProto, f func(field *descriptor.FieldDescriptorProto)) { - for _, msg := range msgs { - for _, field := range msg.Field { - f(field) - } - ForEachField(msg.NestedType, f) - } -} - -func ForEachField(msgs []*descriptor.DescriptorProto, f func(field *descriptor.FieldDescriptorProto)) { - for _, msg := range msgs { - for _, field := range msg.Field { - f(field) - } - for _, ext := range msg.Extension { - f(ext) - } - ForEachField(msg.NestedType, f) - } -} - -func ForEachEnumInFiles(files []*descriptor.FileDescriptorProto, f func(enum *descriptor.EnumDescriptorProto)) { - for _, file := range files { - for _, enum := range file.EnumType { - f(enum) - } - } -} - -func ForEachEnum(msgs []*descriptor.DescriptorProto, f func(field *descriptor.EnumDescriptorProto)) { - for _, msg := range msgs { - for _, field := range msg.EnumType { - f(field) - } - ForEachEnum(msg.NestedType, f) - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/msg.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/msg.go deleted file mode 100644 index 7ff2b9879e5..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/msg.go +++ /dev/null @@ -1,142 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2015, The GoGo Authors. rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package vanity - -import ( - "github.com/gogo/protobuf/gogoproto" - "github.com/gogo/protobuf/proto" - descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" -) - -func MessageHasBoolExtension(msg *descriptor.DescriptorProto, extension *proto.ExtensionDesc) bool { - if msg.Options == nil { - return false - } - value, err := proto.GetExtension(msg.Options, extension) - if err != nil { - return false - } - if value == nil { - return false - } - if value.(*bool) == nil { - return false - } - return true -} - -func SetBoolMessageOption(extension *proto.ExtensionDesc, value bool) func(msg *descriptor.DescriptorProto) { - return func(msg *descriptor.DescriptorProto) { - if MessageHasBoolExtension(msg, extension) { - return - } - if msg.Options == nil { - msg.Options = &descriptor.MessageOptions{} - } - if err := proto.SetExtension(msg.Options, extension, &value); err != nil { - panic(err) - } - } -} - -func TurnOffGoGetters(msg *descriptor.DescriptorProto) { - SetBoolMessageOption(gogoproto.E_GoprotoGetters, false)(msg) -} - -func TurnOffGoStringer(msg *descriptor.DescriptorProto) { - SetBoolMessageOption(gogoproto.E_GoprotoStringer, false)(msg) -} - -func TurnOnVerboseEqual(msg *descriptor.DescriptorProto) { - SetBoolMessageOption(gogoproto.E_VerboseEqual, true)(msg) -} - -func TurnOnFace(msg *descriptor.DescriptorProto) { - SetBoolMessageOption(gogoproto.E_Face, true)(msg) -} - -func TurnOnGoString(msg *descriptor.DescriptorProto) { - SetBoolMessageOption(gogoproto.E_Face, true)(msg) -} - -func TurnOnPopulate(msg *descriptor.DescriptorProto) { - SetBoolMessageOption(gogoproto.E_Populate, true)(msg) -} - -func TurnOnStringer(msg *descriptor.DescriptorProto) { - SetBoolMessageOption(gogoproto.E_Stringer, true)(msg) -} - -func TurnOnEqual(msg *descriptor.DescriptorProto) { - SetBoolMessageOption(gogoproto.E_Equal, true)(msg) -} - -func TurnOnDescription(msg *descriptor.DescriptorProto) { - SetBoolMessageOption(gogoproto.E_Description, true)(msg) -} - -func TurnOnTestGen(msg *descriptor.DescriptorProto) { - SetBoolMessageOption(gogoproto.E_Testgen, true)(msg) -} - -func TurnOnBenchGen(msg *descriptor.DescriptorProto) { - SetBoolMessageOption(gogoproto.E_Benchgen, true)(msg) -} - -func TurnOnMarshaler(msg *descriptor.DescriptorProto) { - SetBoolMessageOption(gogoproto.E_Marshaler, true)(msg) -} - -func TurnOnUnmarshaler(msg *descriptor.DescriptorProto) { - SetBoolMessageOption(gogoproto.E_Unmarshaler, true)(msg) -} - -func TurnOnSizer(msg *descriptor.DescriptorProto) { - SetBoolMessageOption(gogoproto.E_Sizer, true)(msg) -} - -func TurnOnUnsafeUnmarshaler(msg *descriptor.DescriptorProto) { - SetBoolMessageOption(gogoproto.E_UnsafeUnmarshaler, true)(msg) -} - -func TurnOnUnsafeMarshaler(msg *descriptor.DescriptorProto) { - SetBoolMessageOption(gogoproto.E_UnsafeMarshaler, true)(msg) -} - -func TurnOffGoExtensionsMap(msg *descriptor.DescriptorProto) { - SetBoolMessageOption(gogoproto.E_GoprotoExtensionsMap, false)(msg) -} - -func TurnOffGoUnrecognized(msg *descriptor.DescriptorProto) { - SetBoolMessageOption(gogoproto.E_GoprotoUnrecognized, false)(msg) -} - -func TurnOnCompare(msg *descriptor.DescriptorProto) { - SetBoolMessageOption(gogoproto.E_Compare, true)(msg) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/doc.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/doc.go deleted file mode 100644 index 56e54040790..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/doc.go +++ /dev/null @@ -1 +0,0 @@ -package test diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/gogovanity.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/gogovanity.pb.go deleted file mode 100644 index df03703780c..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/gogovanity.pb.go +++ /dev/null @@ -1,408 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: gogovanity.proto -// DO NOT EDIT! - -/* - Package vanity is a generated protocol buffer package. - - It is generated from these files: - gogovanity.proto - - It has these top-level messages: - B -*/ -package vanity - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" - -import io "io" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type B struct { - String_ *string `protobuf:"bytes,1,opt,name=String" json:"String,omitempty"` - Int64 *int64 `protobuf:"varint,2,opt,name=Int64" json:"Int64,omitempty"` - Int32 *int32 `protobuf:"varint,3,opt,name=Int32,def=1234" json:"Int32,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *B) Reset() { *m = B{} } -func (m *B) String() string { return proto.CompactTextString(m) } -func (*B) ProtoMessage() {} -func (*B) Descriptor() ([]byte, []int) { return fileDescriptorGogovanity, []int{0} } - -const Default_B_Int32 int32 = 1234 - -func (m *B) GetString_() string { - if m != nil && m.String_ != nil { - return *m.String_ - } - return "" -} - -func (m *B) GetInt64() int64 { - if m != nil && m.Int64 != nil { - return *m.Int64 - } - return 0 -} - -func (m *B) GetInt32() int32 { - if m != nil && m.Int32 != nil { - return *m.Int32 - } - return Default_B_Int32 -} - -func init() { - proto.RegisterType((*B)(nil), "vanity.B") -} -func (m *B) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *B) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.String_ != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintGogovanity(dAtA, i, uint64(len(*m.String_))) - i += copy(dAtA[i:], *m.String_) - } - if m.Int64 != nil { - dAtA[i] = 0x10 - i++ - i = encodeVarintGogovanity(dAtA, i, uint64(*m.Int64)) - } - if m.Int32 != nil { - dAtA[i] = 0x18 - i++ - i = encodeVarintGogovanity(dAtA, i, uint64(*m.Int32)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func encodeFixed64Gogovanity(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Gogovanity(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintGogovanity(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *B) Size() (n int) { - var l int - _ = l - if m.String_ != nil { - l = len(*m.String_) - n += 1 + l + sovGogovanity(uint64(l)) - } - if m.Int64 != nil { - n += 1 + sovGogovanity(uint64(*m.Int64)) - } - if m.Int32 != nil { - n += 1 + sovGogovanity(uint64(*m.Int32)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovGogovanity(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozGogovanity(x uint64) (n int) { - return sovGogovanity(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *B) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGogovanity - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: B: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: B: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field String_", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGogovanity - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGogovanity - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.String_ = &s - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Int64", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGogovanity - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Int64 = &v - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Int32", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGogovanity - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Int32 = &v - default: - iNdEx = preIndex - skippy, err := skipGogovanity(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthGogovanity - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGogovanity(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGogovanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGogovanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGogovanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthGogovanity - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGogovanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipGogovanity(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthGogovanity = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGogovanity = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("gogovanity.proto", fileDescriptorGogovanity) } - -var fileDescriptorGogovanity = []byte{ - // 157 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x12, 0x48, 0xcf, 0x4f, 0xcf, - 0x2f, 0x4b, 0xcc, 0xcb, 0x2c, 0xa9, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0, - 0xa4, 0x74, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x41, 0x8a, 0xf4, - 0xc1, 0xd2, 0x49, 0xa5, 0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0xb4, 0x29, 0x05, 0x73, 0x31, - 0x3a, 0x09, 0xc9, 0x70, 0xb1, 0x05, 0x97, 0x14, 0x65, 0xe6, 0xa5, 0x4b, 0x30, 0x2a, 0x30, 0x6a, - 0x70, 0x3a, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x18, 0x04, 0x15, 0x13, 0x12, 0xe1, 0x62, 0xf5, 0xcc, - 0x2b, 0x31, 0x33, 0x91, 0x60, 0x52, 0x60, 0xd4, 0x60, 0x0e, 0x82, 0x70, 0x84, 0xa4, 0xc0, 0xa2, - 0xc6, 0x46, 0x12, 0xcc, 0x0a, 0x8c, 0x1a, 0xac, 0x56, 0x2c, 0x86, 0x46, 0xc6, 0x26, 0x41, 0x10, - 0x21, 0x27, 0x9e, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x11, - 0x10, 0x00, 0x00, 0xff, 0xff, 0x35, 0x73, 0x31, 0x4a, 0xac, 0x00, 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/proto3.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/proto3.pb.go deleted file mode 100644 index ffa3c4256c9..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/proto3.pb.go +++ /dev/null @@ -1,320 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: proto3.proto -// DO NOT EDIT! - -/* -Package vanity is a generated protocol buffer package. - -It is generated from these files: - proto3.proto - -It has these top-level messages: - Aproto3 -*/ -package vanity - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" - -import io "io" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type Aproto3 struct { - B string `protobuf:"bytes,1,opt,name=B,proto3" json:"B,omitempty"` -} - -func (m *Aproto3) Reset() { *m = Aproto3{} } -func (m *Aproto3) String() string { return proto.CompactTextString(m) } -func (*Aproto3) ProtoMessage() {} -func (*Aproto3) Descriptor() ([]byte, []int) { return fileDescriptorProto3, []int{0} } - -func (m *Aproto3) GetB() string { - if m != nil { - return m.B - } - return "" -} - -func init() { - proto.RegisterType((*Aproto3)(nil), "vanity.Aproto3") -} -func (m *Aproto3) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Aproto3) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.B) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintProto3(dAtA, i, uint64(len(m.B))) - i += copy(dAtA[i:], m.B) - } - return i, nil -} - -func encodeFixed64Proto3(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Proto3(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintProto3(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *Aproto3) Size() (n int) { - var l int - _ = l - l = len(m.B) - if l > 0 { - n += 1 + l + sovProto3(uint64(l)) - } - return n -} - -func sovProto3(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozProto3(x uint64) (n int) { - return sovProto3(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Aproto3) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProto3 - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Aproto3: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Aproto3: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field B", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProto3 - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProto3 - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.B = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProto3(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthProto3 - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipProto3(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProto3 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProto3 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProto3 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthProto3 - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProto3 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipProto3(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthProto3 = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowProto3 = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("proto3.proto", fileDescriptorProto3) } - -var fileDescriptorProto3 = []byte{ - // 82 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x28, 0xca, 0x2f, - 0xc9, 0x37, 0xd6, 0x03, 0x53, 0x42, 0x6c, 0x65, 0x89, 0x79, 0x99, 0x25, 0x95, 0x4a, 0xe2, 0x5c, - 0xec, 0x8e, 0x10, 0x09, 0x21, 0x1e, 0x2e, 0x46, 0x27, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, - 0x46, 0x27, 0x27, 0x9e, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, - 0x31, 0x89, 0x0d, 0xa2, 0x06, 0x10, 0x00, 0x00, 0xff, 0xff, 0x97, 0x18, 0x92, 0x84, 0x45, 0x00, - 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/vanity.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/vanity.pb.go deleted file mode 100644 index e0091465f29..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/fast/vanity.pb.go +++ /dev/null @@ -1,375 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: vanity.proto -// DO NOT EDIT! - -/* - Package vanity is a generated protocol buffer package. - - It is generated from these files: - vanity.proto - - It has these top-level messages: - A -*/ -package vanity - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" - -import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" - -import io "io" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type A struct { - Strings *string `protobuf:"bytes,1,opt,name=Strings" json:"Strings,omitempty"` - Int *int64 `protobuf:"varint,2,req,name=Int" json:"Int,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *A) Reset() { *m = A{} } -func (m *A) String() string { return proto.CompactTextString(m) } -func (*A) ProtoMessage() {} -func (*A) Descriptor() ([]byte, []int) { return fileDescriptorVanity, []int{0} } - -func (m *A) GetStrings() string { - if m != nil && m.Strings != nil { - return *m.Strings - } - return "" -} - -func (m *A) GetInt() int64 { - if m != nil && m.Int != nil { - return *m.Int - } - return 0 -} - -func init() { - proto.RegisterType((*A)(nil), "vanity.A") -} -func (m *A) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *A) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Strings != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintVanity(dAtA, i, uint64(len(*m.Strings))) - i += copy(dAtA[i:], *m.Strings) - } - if m.Int == nil { - return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("Int") - } else { - dAtA[i] = 0x10 - i++ - i = encodeVarintVanity(dAtA, i, uint64(*m.Int)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func encodeFixed64Vanity(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Vanity(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintVanity(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *A) Size() (n int) { - var l int - _ = l - if m.Strings != nil { - l = len(*m.Strings) - n += 1 + l + sovVanity(uint64(l)) - } - if m.Int != nil { - n += 1 + sovVanity(uint64(*m.Int)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovVanity(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozVanity(x uint64) (n int) { - return sovVanity(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *A) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVanity - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: A: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: A: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Strings", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVanity - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthVanity - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Strings = &s - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Int", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVanity - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Int = &v - hasFields[0] |= uint64(0x00000001) - default: - iNdEx = preIndex - skippy, err := skipVanity(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthVanity - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Int") - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipVanity(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthVanity - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipVanity(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthVanity = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowVanity = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("vanity.proto", fileDescriptorVanity) } - -var fileDescriptorVanity = []byte{ - // 97 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x4b, 0xcc, 0xcb, - 0x2c, 0xa9, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0, 0x94, 0xf4, 0xb9, 0x18, - 0x1d, 0x85, 0x24, 0xb8, 0xd8, 0x83, 0x4b, 0x8a, 0x32, 0xf3, 0xd2, 0x8b, 0x25, 0x18, 0x15, 0x18, - 0x35, 0x38, 0x83, 0x60, 0x5c, 0x21, 0x01, 0x2e, 0x66, 0xcf, 0xbc, 0x12, 0x09, 0x26, 0x05, 0x26, - 0x0d, 0xe6, 0x20, 0x10, 0xd3, 0x89, 0xe7, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, - 0x3c, 0x92, 0x63, 0x04, 0x04, 0x00, 0x00, 0xff, 0xff, 0x2f, 0x7a, 0xd7, 0x63, 0x55, 0x00, 0x00, - 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/gogovanity.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/gogovanity.pb.go deleted file mode 100644 index 28aa729e326..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/gogovanity.pb.go +++ /dev/null @@ -1,396 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: gogovanity.proto -// DO NOT EDIT! - -/* - Package vanity is a generated protocol buffer package. - - It is generated from these files: - gogovanity.proto - - It has these top-level messages: - B -*/ -package vanity - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" - -import io "io" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type B struct { - String_ *string `protobuf:"bytes,1,opt,name=String" json:"String,omitempty"` - Int64 int64 `protobuf:"varint,2,opt,name=Int64" json:"Int64"` - Int32 *int32 `protobuf:"varint,3,opt,name=Int32,def=1234" json:"Int32,omitempty"` -} - -func (m *B) Reset() { *m = B{} } -func (m *B) String() string { return proto.CompactTextString(m) } -func (*B) ProtoMessage() {} -func (*B) Descriptor() ([]byte, []int) { return fileDescriptorGogovanity, []int{0} } - -const Default_B_Int32 int32 = 1234 - -func (m *B) GetString_() string { - if m != nil && m.String_ != nil { - return *m.String_ - } - return "" -} - -func (m *B) GetInt64() int64 { - if m != nil { - return m.Int64 - } - return 0 -} - -func (m *B) GetInt32() int32 { - if m != nil && m.Int32 != nil { - return *m.Int32 - } - return Default_B_Int32 -} - -func init() { - proto.RegisterType((*B)(nil), "vanity.B") -} -func (m *B) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *B) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.String_ != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintGogovanity(dAtA, i, uint64(len(*m.String_))) - i += copy(dAtA[i:], *m.String_) - } - dAtA[i] = 0x10 - i++ - i = encodeVarintGogovanity(dAtA, i, uint64(m.Int64)) - if m.Int32 != nil { - dAtA[i] = 0x18 - i++ - i = encodeVarintGogovanity(dAtA, i, uint64(*m.Int32)) - } - return i, nil -} - -func encodeFixed64Gogovanity(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Gogovanity(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintGogovanity(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *B) Size() (n int) { - var l int - _ = l - if m.String_ != nil { - l = len(*m.String_) - n += 1 + l + sovGogovanity(uint64(l)) - } - n += 1 + sovGogovanity(uint64(m.Int64)) - if m.Int32 != nil { - n += 1 + sovGogovanity(uint64(*m.Int32)) - } - return n -} - -func sovGogovanity(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozGogovanity(x uint64) (n int) { - return sovGogovanity(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *B) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGogovanity - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: B: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: B: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field String_", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGogovanity - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGogovanity - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.String_ = &s - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Int64", wireType) - } - m.Int64 = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGogovanity - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Int64 |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Int32", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGogovanity - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Int32 = &v - default: - iNdEx = preIndex - skippy, err := skipGogovanity(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthGogovanity - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGogovanity(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGogovanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGogovanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGogovanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthGogovanity - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGogovanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipGogovanity(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthGogovanity = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGogovanity = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("gogovanity.proto", fileDescriptorGogovanity) } - -var fileDescriptorGogovanity = []byte{ - // 163 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x12, 0x48, 0xcf, 0x4f, 0xcf, - 0x2f, 0x4b, 0xcc, 0xcb, 0x2c, 0xa9, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0, - 0xa4, 0x74, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x41, 0x8a, 0xf4, - 0xc1, 0xd2, 0x49, 0xa5, 0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0xb4, 0x29, 0x45, 0x72, 0x31, - 0x3a, 0x09, 0xc9, 0x70, 0xb1, 0x05, 0x97, 0x14, 0x65, 0xe6, 0xa5, 0x4b, 0x30, 0x2a, 0x30, 0x6a, - 0x70, 0x3a, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x18, 0x04, 0x15, 0x13, 0x92, 0xe2, 0x62, 0xf5, 0xcc, - 0x2b, 0x31, 0x33, 0x91, 0x60, 0x52, 0x60, 0xd4, 0x60, 0x06, 0x4b, 0x32, 0x04, 0x41, 0x84, 0xa0, - 0x72, 0xc6, 0x46, 0x12, 0xcc, 0x0a, 0x8c, 0x1a, 0xac, 0x56, 0x2c, 0x86, 0x46, 0xc6, 0x26, 0x41, - 0x10, 0x21, 0x27, 0x81, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, - 0x71, 0xc2, 0x63, 0x39, 0x06, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfc, 0xde, 0x29, 0x72, 0xb6, - 0x00, 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/proto3.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/proto3.pb.go deleted file mode 100644 index 66eaa8729c6..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/proto3.pb.go +++ /dev/null @@ -1,320 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: proto3.proto -// DO NOT EDIT! - -/* -Package vanity is a generated protocol buffer package. - -It is generated from these files: - proto3.proto - -It has these top-level messages: - Aproto3 -*/ -package vanity - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" - -import io "io" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type Aproto3 struct { - B string `protobuf:"bytes,1,opt,name=B,proto3" json:"B,omitempty"` -} - -func (m *Aproto3) Reset() { *m = Aproto3{} } -func (m *Aproto3) String() string { return proto.CompactTextString(m) } -func (*Aproto3) ProtoMessage() {} -func (*Aproto3) Descriptor() ([]byte, []int) { return fileDescriptorProto3, []int{0} } - -func (m *Aproto3) GetB() string { - if m != nil { - return m.B - } - return "" -} - -func init() { - proto.RegisterType((*Aproto3)(nil), "vanity.Aproto3") -} -func (m *Aproto3) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Aproto3) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.B) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintProto3(dAtA, i, uint64(len(m.B))) - i += copy(dAtA[i:], m.B) - } - return i, nil -} - -func encodeFixed64Proto3(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Proto3(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintProto3(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *Aproto3) Size() (n int) { - var l int - _ = l - l = len(m.B) - if l > 0 { - n += 1 + l + sovProto3(uint64(l)) - } - return n -} - -func sovProto3(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozProto3(x uint64) (n int) { - return sovProto3(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Aproto3) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProto3 - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Aproto3: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Aproto3: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field B", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProto3 - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProto3 - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.B = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProto3(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthProto3 - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipProto3(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProto3 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProto3 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProto3 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthProto3 - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProto3 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipProto3(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthProto3 = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowProto3 = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("proto3.proto", fileDescriptorProto3) } - -var fileDescriptorProto3 = []byte{ - // 87 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x28, 0xca, 0x2f, - 0xc9, 0x37, 0xd6, 0x03, 0x53, 0x42, 0x6c, 0x65, 0x89, 0x79, 0x99, 0x25, 0x95, 0x4a, 0xe2, 0x5c, - 0xec, 0x8e, 0x10, 0x09, 0x21, 0x1e, 0x2e, 0x46, 0x27, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, - 0x46, 0x27, 0x27, 0x81, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, - 0x71, 0xc2, 0x63, 0x39, 0x86, 0x24, 0x36, 0x88, 0x3a, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x77, - 0x21, 0xa3, 0xc0, 0x49, 0x00, 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/vanity.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/vanity.pb.go deleted file mode 100644 index ecba7f08dfc..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/faster/vanity.pb.go +++ /dev/null @@ -1,354 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: vanity.proto -// DO NOT EDIT! - -/* - Package vanity is a generated protocol buffer package. - - It is generated from these files: - vanity.proto - - It has these top-level messages: - A -*/ -package vanity - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" - -import io "io" -import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type A struct { - Strings string `protobuf:"bytes,1,opt,name=Strings" json:"Strings"` - Int int64 `protobuf:"varint,2,req,name=Int" json:"Int"` -} - -func (m *A) Reset() { *m = A{} } -func (m *A) String() string { return proto.CompactTextString(m) } -func (*A) ProtoMessage() {} -func (*A) Descriptor() ([]byte, []int) { return fileDescriptorVanity, []int{0} } - -func (m *A) GetStrings() string { - if m != nil { - return m.Strings - } - return "" -} - -func (m *A) GetInt() int64 { - if m != nil { - return m.Int - } - return 0 -} - -func init() { - proto.RegisterType((*A)(nil), "vanity.A") -} -func (m *A) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *A) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintVanity(dAtA, i, uint64(len(m.Strings))) - i += copy(dAtA[i:], m.Strings) - dAtA[i] = 0x10 - i++ - i = encodeVarintVanity(dAtA, i, uint64(m.Int)) - return i, nil -} - -func encodeFixed64Vanity(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Vanity(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintVanity(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *A) Size() (n int) { - var l int - _ = l - l = len(m.Strings) - n += 1 + l + sovVanity(uint64(l)) - n += 1 + sovVanity(uint64(m.Int)) - return n -} - -func sovVanity(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozVanity(x uint64) (n int) { - return sovVanity(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *A) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVanity - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: A: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: A: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Strings", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVanity - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthVanity - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Strings = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Int", wireType) - } - m.Int = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVanity - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Int |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - hasFields[0] |= uint64(0x00000001) - default: - iNdEx = preIndex - skippy, err := skipVanity(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthVanity - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Int") - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipVanity(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthVanity - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipVanity(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthVanity = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowVanity = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("vanity.proto", fileDescriptorVanity) } - -var fileDescriptorVanity = []byte{ - // 109 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x4b, 0xcc, 0xcb, - 0x2c, 0xa9, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0, 0x94, 0xac, 0xb9, 0x18, - 0x1d, 0x85, 0xe4, 0xb8, 0xd8, 0x83, 0x4b, 0x8a, 0x32, 0xf3, 0xd2, 0x8b, 0x25, 0x18, 0x15, 0x18, - 0x35, 0x38, 0x9d, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, 0x82, 0x09, 0x0a, 0x89, 0x71, 0x31, 0x7b, - 0xe6, 0x95, 0x48, 0x30, 0x29, 0x30, 0x69, 0x30, 0x43, 0xe5, 0x40, 0x02, 0x4e, 0x02, 0x27, 0x1e, - 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x80, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x56, 0x0d, 0x52, 0xbb, 0x65, 0x00, 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/gogovanity.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/gogovanity.proto deleted file mode 100644 index b0f9279a170..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/gogovanity.proto +++ /dev/null @@ -1,39 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2015, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -syntax = "proto2"; - -package vanity; - -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -message B { - optional string String = 1 [(gogoproto.nullable) = true]; - optional int64 Int64 = 2; - optional int32 Int32 = 3 [default = 1234]; -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/proto3.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/proto3.proto deleted file mode 100644 index aa2f4ac516e..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/proto3.proto +++ /dev/null @@ -1,35 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2015, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -syntax = "proto3"; - -package vanity; - -message Aproto3 { - string B = 1; -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/gogovanity.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/gogovanity.pb.go deleted file mode 100644 index 28dbceb19ed..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/gogovanity.pb.go +++ /dev/null @@ -1,512 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: gogovanity.proto -// DO NOT EDIT! - -/* - Package vanity is a generated protocol buffer package. - - It is generated from these files: - gogovanity.proto - - It has these top-level messages: - B -*/ -package vanity - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" - -import strings "strings" -import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" -import sort "sort" -import strconv "strconv" -import reflect "reflect" - -import io "io" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type B struct { - String_ *string `protobuf:"bytes,1,opt,name=String" json:"String,omitempty"` - Int64 int64 `protobuf:"varint,2,opt,name=Int64" json:"Int64"` - Int32 *int32 `protobuf:"varint,3,opt,name=Int32,def=1234" json:"Int32,omitempty"` -} - -func (m *B) Reset() { *m = B{} } -func (*B) ProtoMessage() {} -func (*B) Descriptor() ([]byte, []int) { return fileDescriptorGogovanity, []int{0} } - -const Default_B_Int32 int32 = 1234 - -func (m *B) GetString_() string { - if m != nil && m.String_ != nil { - return *m.String_ - } - return "" -} - -func (m *B) GetInt64() int64 { - if m != nil { - return m.Int64 - } - return 0 -} - -func (m *B) GetInt32() int32 { - if m != nil && m.Int32 != nil { - return *m.Int32 - } - return Default_B_Int32 -} - -func init() { - proto.RegisterType((*B)(nil), "vanity.B") -} -func (this *B) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*B) - if !ok { - that2, ok := that.(B) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if this.String_ != nil && that1.String_ != nil { - if *this.String_ != *that1.String_ { - return false - } - } else if this.String_ != nil { - return false - } else if that1.String_ != nil { - return false - } - if this.Int64 != that1.Int64 { - return false - } - if this.Int32 != nil && that1.Int32 != nil { - if *this.Int32 != *that1.Int32 { - return false - } - } else if this.Int32 != nil { - return false - } else if that1.Int32 != nil { - return false - } - return true -} -func (this *B) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&vanity.B{") - if this.String_ != nil { - s = append(s, "String_: "+valueToGoStringGogovanity(this.String_, "string")+",\n") - } - s = append(s, "Int64: "+fmt.Sprintf("%#v", this.Int64)+",\n") - if this.Int32 != nil { - s = append(s, "Int32: "+valueToGoStringGogovanity(this.Int32, "int32")+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringGogovanity(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func extensionToGoStringGogovanity(m github_com_gogo_protobuf_proto.Message) string { - e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) - if e == nil { - return "nil" - } - s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" - keys := make([]int, 0, len(e)) - for k := range e { - keys = append(keys, int(k)) - } - sort.Ints(keys) - ss := []string{} - for _, k := range keys { - ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) - } - s += strings.Join(ss, ",") + "})" - return s -} -func (m *B) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *B) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.String_ != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintGogovanity(dAtA, i, uint64(len(*m.String_))) - i += copy(dAtA[i:], *m.String_) - } - dAtA[i] = 0x10 - i++ - i = encodeVarintGogovanity(dAtA, i, uint64(m.Int64)) - if m.Int32 != nil { - dAtA[i] = 0x18 - i++ - i = encodeVarintGogovanity(dAtA, i, uint64(*m.Int32)) - } - return i, nil -} - -func encodeFixed64Gogovanity(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Gogovanity(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintGogovanity(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *B) Size() (n int) { - var l int - _ = l - if m.String_ != nil { - l = len(*m.String_) - n += 1 + l + sovGogovanity(uint64(l)) - } - n += 1 + sovGogovanity(uint64(m.Int64)) - if m.Int32 != nil { - n += 1 + sovGogovanity(uint64(*m.Int32)) - } - return n -} - -func sovGogovanity(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozGogovanity(x uint64) (n int) { - return sovGogovanity(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *B) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&B{`, - `String_:` + valueToStringGogovanity(this.String_) + `,`, - `Int64:` + fmt.Sprintf("%v", this.Int64) + `,`, - `Int32:` + valueToStringGogovanity(this.Int32) + `,`, - `}`, - }, "") - return s -} -func valueToStringGogovanity(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *B) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGogovanity - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: B: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: B: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field String_", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGogovanity - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGogovanity - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.String_ = &s - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Int64", wireType) - } - m.Int64 = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGogovanity - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Int64 |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Int32", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGogovanity - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Int32 = &v - default: - iNdEx = preIndex - skippy, err := skipGogovanity(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthGogovanity - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGogovanity(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGogovanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGogovanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGogovanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthGogovanity - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGogovanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipGogovanity(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthGogovanity = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGogovanity = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("gogovanity.proto", fileDescriptorGogovanity) } - -var fileDescriptorGogovanity = []byte{ - // 192 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x12, 0x48, 0xcf, 0x4f, 0xcf, - 0x2f, 0x4b, 0xcc, 0xcb, 0x2c, 0xa9, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0, - 0xa4, 0x74, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x41, 0x8a, 0xf4, - 0xc1, 0xd2, 0x49, 0xa5, 0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0xb4, 0x29, 0x45, 0x72, 0x31, - 0x3a, 0x09, 0xc9, 0x70, 0xb1, 0x05, 0x97, 0x14, 0x65, 0xe6, 0xa5, 0x4b, 0x30, 0x2a, 0x30, 0x6a, - 0x70, 0x3a, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x18, 0x04, 0x15, 0x13, 0x92, 0xe2, 0x62, 0xf5, 0xcc, - 0x2b, 0x31, 0x33, 0x91, 0x60, 0x52, 0x60, 0xd4, 0x60, 0x06, 0x4b, 0x32, 0x04, 0x41, 0x84, 0xa0, - 0x72, 0xc6, 0x46, 0x12, 0xcc, 0x0a, 0x8c, 0x1a, 0xac, 0x56, 0x2c, 0x86, 0x46, 0xc6, 0x26, 0x41, - 0x10, 0x21, 0x27, 0x9d, 0x0b, 0x0f, 0xe5, 0x18, 0x6e, 0x3c, 0x94, 0x63, 0xf8, 0xf0, 0x50, 0x8e, - 0xb1, 0xe1, 0x91, 0x1c, 0xe3, 0x8a, 0x47, 0x72, 0x8c, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, - 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8b, 0x47, 0x72, 0x0c, 0x1f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, - 0x2c, 0xc7, 0x00, 0x08, 0x00, 0x00, 0xff, 0xff, 0x0a, 0x7e, 0xee, 0xf2, 0xd2, 0x00, 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/proto3.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/proto3.pb.go deleted file mode 100644 index 5ce2132bcd7..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/proto3.pb.go +++ /dev/null @@ -1,411 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: proto3.proto -// DO NOT EDIT! - -/* -Package vanity is a generated protocol buffer package. - -It is generated from these files: - proto3.proto - -It has these top-level messages: - Aproto3 -*/ -package vanity - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" - -import strings "strings" -import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" -import sort "sort" -import strconv "strconv" -import reflect "reflect" - -import io "io" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type Aproto3 struct { - B string `protobuf:"bytes,1,opt,name=B,proto3" json:"B,omitempty"` -} - -func (m *Aproto3) Reset() { *m = Aproto3{} } -func (*Aproto3) ProtoMessage() {} -func (*Aproto3) Descriptor() ([]byte, []int) { return fileDescriptorProto3, []int{0} } - -func (m *Aproto3) GetB() string { - if m != nil { - return m.B - } - return "" -} - -func init() { - proto.RegisterType((*Aproto3)(nil), "vanity.Aproto3") -} -func (this *Aproto3) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*Aproto3) - if !ok { - that2, ok := that.(Aproto3) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if this.B != that1.B { - return false - } - return true -} -func (this *Aproto3) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&vanity.Aproto3{") - s = append(s, "B: "+fmt.Sprintf("%#v", this.B)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringProto3(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func extensionToGoStringProto3(m github_com_gogo_protobuf_proto.Message) string { - e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) - if e == nil { - return "nil" - } - s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" - keys := make([]int, 0, len(e)) - for k := range e { - keys = append(keys, int(k)) - } - sort.Ints(keys) - ss := []string{} - for _, k := range keys { - ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) - } - s += strings.Join(ss, ",") + "})" - return s -} -func (m *Aproto3) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Aproto3) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.B) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintProto3(dAtA, i, uint64(len(m.B))) - i += copy(dAtA[i:], m.B) - } - return i, nil -} - -func encodeFixed64Proto3(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Proto3(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintProto3(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *Aproto3) Size() (n int) { - var l int - _ = l - l = len(m.B) - if l > 0 { - n += 1 + l + sovProto3(uint64(l)) - } - return n -} - -func sovProto3(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozProto3(x uint64) (n int) { - return sovProto3(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *Aproto3) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Aproto3{`, - `B:` + fmt.Sprintf("%v", this.B) + `,`, - `}`, - }, "") - return s -} -func valueToStringProto3(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *Aproto3) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProto3 - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Aproto3: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Aproto3: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field B", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProto3 - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProto3 - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.B = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProto3(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthProto3 - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipProto3(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProto3 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProto3 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProto3 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthProto3 - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProto3 - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipProto3(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthProto3 = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowProto3 = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("proto3.proto", fileDescriptorProto3) } - -var fileDescriptorProto3 = []byte{ - // 116 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x28, 0xca, 0x2f, - 0xc9, 0x37, 0xd6, 0x03, 0x53, 0x42, 0x6c, 0x65, 0x89, 0x79, 0x99, 0x25, 0x95, 0x4a, 0xe2, 0x5c, - 0xec, 0x8e, 0x10, 0x09, 0x21, 0x1e, 0x2e, 0x46, 0x27, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, - 0x46, 0x27, 0x27, 0x9d, 0x0b, 0x0f, 0xe5, 0x18, 0x6e, 0x3c, 0x94, 0x63, 0xf8, 0xf0, 0x50, 0x8e, - 0xb1, 0xe1, 0x91, 0x1c, 0xe3, 0x8a, 0x47, 0x72, 0x8c, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, - 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8b, 0x47, 0x72, 0x0c, 0x1f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, - 0x2c, 0xc7, 0x90, 0xc4, 0x06, 0x31, 0x03, 0x10, 0x00, 0x00, 0xff, 0xff, 0xb1, 0xa0, 0x15, 0x6b, - 0x65, 0x00, 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/vanity.pb.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/vanity.pb.go deleted file mode 100644 index e7f5599d46b..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/slick/vanity.pb.go +++ /dev/null @@ -1,449 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: vanity.proto -// DO NOT EDIT! - -/* - Package vanity is a generated protocol buffer package. - - It is generated from these files: - vanity.proto - - It has these top-level messages: - A -*/ -package vanity - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" - -import strings "strings" -import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" -import sort "sort" -import strconv "strconv" -import reflect "reflect" - -import io "io" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type A struct { - Strings string `protobuf:"bytes,1,opt,name=Strings" json:"Strings"` - Int int64 `protobuf:"varint,2,req,name=Int" json:"Int"` -} - -func (m *A) Reset() { *m = A{} } -func (*A) ProtoMessage() {} -func (*A) Descriptor() ([]byte, []int) { return fileDescriptorVanity, []int{0} } - -func (m *A) GetStrings() string { - if m != nil { - return m.Strings - } - return "" -} - -func (m *A) GetInt() int64 { - if m != nil { - return m.Int - } - return 0 -} - -func init() { - proto.RegisterType((*A)(nil), "vanity.A") -} -func (this *A) Equal(that interface{}) bool { - if that == nil { - if this == nil { - return true - } - return false - } - - that1, ok := that.(*A) - if !ok { - that2, ok := that.(A) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - if this == nil { - return true - } - return false - } else if this == nil { - return false - } - if this.Strings != that1.Strings { - return false - } - if this.Int != that1.Int { - return false - } - return true -} -func (this *A) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&vanity.A{") - s = append(s, "Strings: "+fmt.Sprintf("%#v", this.Strings)+",\n") - s = append(s, "Int: "+fmt.Sprintf("%#v", this.Int)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringVanity(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func extensionToGoStringVanity(m github_com_gogo_protobuf_proto.Message) string { - e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m) - if e == nil { - return "nil" - } - s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{" - keys := make([]int, 0, len(e)) - for k := range e { - keys = append(keys, int(k)) - } - sort.Ints(keys) - ss := []string{} - for _, k := range keys { - ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString()) - } - s += strings.Join(ss, ",") + "})" - return s -} -func (m *A) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *A) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintVanity(dAtA, i, uint64(len(m.Strings))) - i += copy(dAtA[i:], m.Strings) - dAtA[i] = 0x10 - i++ - i = encodeVarintVanity(dAtA, i, uint64(m.Int)) - return i, nil -} - -func encodeFixed64Vanity(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Vanity(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintVanity(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *A) Size() (n int) { - var l int - _ = l - l = len(m.Strings) - n += 1 + l + sovVanity(uint64(l)) - n += 1 + sovVanity(uint64(m.Int)) - return n -} - -func sovVanity(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozVanity(x uint64) (n int) { - return sovVanity(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *A) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&A{`, - `Strings:` + fmt.Sprintf("%v", this.Strings) + `,`, - `Int:` + fmt.Sprintf("%v", this.Int) + `,`, - `}`, - }, "") - return s -} -func valueToStringVanity(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *A) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVanity - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: A: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: A: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Strings", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVanity - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthVanity - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Strings = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Int", wireType) - } - m.Int = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowVanity - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Int |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - hasFields[0] |= uint64(0x00000001) - default: - iNdEx = preIndex - skippy, err := skipVanity(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthVanity - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Int") - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipVanity(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthVanity - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowVanity - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipVanity(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthVanity = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowVanity = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("vanity.proto", fileDescriptorVanity) } - -var fileDescriptorVanity = []byte{ - // 138 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x4b, 0xcc, 0xcb, - 0x2c, 0xa9, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0xf0, 0x94, 0xac, 0xb9, 0x18, - 0x1d, 0x85, 0xe4, 0xb8, 0xd8, 0x83, 0x4b, 0x8a, 0x32, 0xf3, 0xd2, 0x8b, 0x25, 0x18, 0x15, 0x18, - 0x35, 0x38, 0x9d, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, 0x82, 0x09, 0x0a, 0x89, 0x71, 0x31, 0x7b, - 0xe6, 0x95, 0x48, 0x30, 0x29, 0x30, 0x69, 0x30, 0x43, 0xe5, 0x40, 0x02, 0x4e, 0x3a, 0x17, 0x1e, - 0xca, 0x31, 0xdc, 0x78, 0x28, 0xc7, 0xf0, 0xe1, 0xa1, 0x1c, 0x63, 0xc3, 0x23, 0x39, 0xc6, 0x15, - 0x8f, 0xe4, 0x18, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, - 0x17, 0x8f, 0xe4, 0x18, 0x3e, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0x01, 0x10, 0x00, 0x00, - 0xff, 0xff, 0x4d, 0xd9, 0xba, 0x18, 0x81, 0x00, 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/vanity.proto b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/vanity.proto deleted file mode 100644 index c21750bc09f..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/vanity/test/vanity.proto +++ /dev/null @@ -1,36 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2015, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -syntax = "proto2"; - -package vanity; - -message A { - optional string Strings = 1; - required int64 Int = 2; -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/version/version.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/version/version.go deleted file mode 100644 index 461e9903228..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/gogo/protobuf/version/version.go +++ /dev/null @@ -1,78 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// 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. -// -// 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. - -package version - -import ( - "fmt" - "os/exec" - "strconv" - "strings" -) - -func Get() string { - versionBytes, _ := exec.Command("protoc", "--version").CombinedOutput() - version := strings.TrimSpace(string(versionBytes)) - versions := strings.Split(version, " ") - if len(versions) != 2 { - panic("version string returned from protoc is seperated with a space: " + version) - } - return versions[1] -} - -func parseVersion(version string) (int, error) { - versions := strings.Split(version, ".") - if len(versions) != 3 { - return 0, fmt.Errorf("version does not have 3 numbers seperated by dots: %s", version) - } - n := 0 - for _, v := range versions { - i, err := strconv.Atoi(v) - if err != nil { - return 0, err - } - n = n*10 + i - } - return n, nil -} - -func less(this, that string) bool { - thisNum, err := parseVersion(this) - if err != nil { - panic(err) - } - thatNum, err := parseVersion(that) - if err != nil { - panic(err) - } - return thisNum <= thatNum -} - -func AtLeast(v string) bool { - return less(v, Get()) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/LICENSE b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/LICENSE deleted file mode 100644 index 1b1b1921efa..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/LICENSE +++ /dev/null @@ -1,31 +0,0 @@ -Go support for Protocol Buffers - Google's data interchange format - -Copyright 2010 The Go Authors. All rights reserved. -https://github.com/golang/protobuf - -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/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/clone.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/clone.go deleted file mode 100644 index e392575b353..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/clone.go +++ /dev/null @@ -1,229 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2011 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -// Protocol buffer deep copy and merge. -// TODO: RawMessage. - -package proto - -import ( - "log" - "reflect" - "strings" -) - -// Clone returns a deep copy of a protocol buffer. -func Clone(pb Message) Message { - in := reflect.ValueOf(pb) - if in.IsNil() { - return pb - } - - out := reflect.New(in.Type().Elem()) - // out is empty so a merge is a deep copy. - mergeStruct(out.Elem(), in.Elem()) - return out.Interface().(Message) -} - -// Merge merges src into dst. -// Required and optional fields that are set in src will be set to that value in dst. -// Elements of repeated fields will be appended. -// Merge panics if src and dst are not the same type, or if dst is nil. -func Merge(dst, src Message) { - in := reflect.ValueOf(src) - out := reflect.ValueOf(dst) - if out.IsNil() { - panic("proto: nil destination") - } - if in.Type() != out.Type() { - // Explicit test prior to mergeStruct so that mistyped nils will fail - panic("proto: type mismatch") - } - if in.IsNil() { - // Merging nil into non-nil is a quiet no-op - return - } - mergeStruct(out.Elem(), in.Elem()) -} - -func mergeStruct(out, in reflect.Value) { - sprop := GetProperties(in.Type()) - for i := 0; i < in.NumField(); i++ { - f := in.Type().Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - mergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i]) - } - - if emIn, ok := extendable(in.Addr().Interface()); ok { - emOut, _ := extendable(out.Addr().Interface()) - mIn, muIn := emIn.extensionsRead() - if mIn != nil { - mOut := emOut.extensionsWrite() - muIn.Lock() - mergeExtension(mOut, mIn) - muIn.Unlock() - } - } - - uf := in.FieldByName("XXX_unrecognized") - if !uf.IsValid() { - return - } - uin := uf.Bytes() - if len(uin) > 0 { - out.FieldByName("XXX_unrecognized").SetBytes(append([]byte(nil), uin...)) - } -} - -// mergeAny performs a merge between two values of the same type. -// viaPtr indicates whether the values were indirected through a pointer (implying proto2). -// prop is set if this is a struct field (it may be nil). -func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) { - if in.Type() == protoMessageType { - if !in.IsNil() { - if out.IsNil() { - out.Set(reflect.ValueOf(Clone(in.Interface().(Message)))) - } else { - Merge(out.Interface().(Message), in.Interface().(Message)) - } - } - return - } - switch in.Kind() { - case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, - reflect.String, reflect.Uint32, reflect.Uint64: - if !viaPtr && isProto3Zero(in) { - return - } - out.Set(in) - case reflect.Interface: - // Probably a oneof field; copy non-nil values. - if in.IsNil() { - return - } - // Allocate destination if it is not set, or set to a different type. - // Otherwise we will merge as normal. - if out.IsNil() || out.Elem().Type() != in.Elem().Type() { - out.Set(reflect.New(in.Elem().Elem().Type())) // interface -> *T -> T -> new(T) - } - mergeAny(out.Elem(), in.Elem(), false, nil) - case reflect.Map: - if in.Len() == 0 { - return - } - if out.IsNil() { - out.Set(reflect.MakeMap(in.Type())) - } - // For maps with value types of *T or []byte we need to deep copy each value. - elemKind := in.Type().Elem().Kind() - for _, key := range in.MapKeys() { - var val reflect.Value - switch elemKind { - case reflect.Ptr: - val = reflect.New(in.Type().Elem().Elem()) - mergeAny(val, in.MapIndex(key), false, nil) - case reflect.Slice: - val = in.MapIndex(key) - val = reflect.ValueOf(append([]byte{}, val.Bytes()...)) - default: - val = in.MapIndex(key) - } - out.SetMapIndex(key, val) - } - case reflect.Ptr: - if in.IsNil() { - return - } - if out.IsNil() { - out.Set(reflect.New(in.Elem().Type())) - } - mergeAny(out.Elem(), in.Elem(), true, nil) - case reflect.Slice: - if in.IsNil() { - return - } - if in.Type().Elem().Kind() == reflect.Uint8 { - // []byte is a scalar bytes field, not a repeated field. - - // Edge case: if this is in a proto3 message, a zero length - // bytes field is considered the zero value, and should not - // be merged. - if prop != nil && prop.proto3 && in.Len() == 0 { - return - } - - // Make a deep copy. - // Append to []byte{} instead of []byte(nil) so that we never end up - // with a nil result. - out.SetBytes(append([]byte{}, in.Bytes()...)) - return - } - n := in.Len() - if out.IsNil() { - out.Set(reflect.MakeSlice(in.Type(), 0, n)) - } - switch in.Type().Elem().Kind() { - case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, - reflect.String, reflect.Uint32, reflect.Uint64: - out.Set(reflect.AppendSlice(out, in)) - default: - for i := 0; i < n; i++ { - x := reflect.Indirect(reflect.New(in.Type().Elem())) - mergeAny(x, in.Index(i), false, nil) - out.Set(reflect.Append(out, x)) - } - } - case reflect.Struct: - mergeStruct(out, in) - default: - // unknown type, so not a protocol buffer - log.Printf("proto: don't know how to copy %v", in) - } -} - -func mergeExtension(out, in map[int32]Extension) { - for extNum, eIn := range in { - eOut := Extension{desc: eIn.desc} - if eIn.value != nil { - v := reflect.New(reflect.TypeOf(eIn.value)).Elem() - mergeAny(v, reflect.ValueOf(eIn.value), false, nil) - eOut.value = v.Interface() - } - if eIn.enc != nil { - eOut.enc = make([]byte, len(eIn.enc)) - copy(eOut.enc, eIn.enc) - } - - out[extNum] = eOut - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/decode.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/decode.go deleted file mode 100644 index aa207298f99..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/decode.go +++ /dev/null @@ -1,970 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -/* - * Routines for decoding protocol buffer data to construct in-memory representations. - */ - -import ( - "errors" - "fmt" - "io" - "os" - "reflect" -) - -// errOverflow is returned when an integer is too large to be represented. -var errOverflow = errors.New("proto: integer overflow") - -// ErrInternalBadWireType is returned by generated code when an incorrect -// wire type is encountered. It does not get returned to user code. -var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof") - -// The fundamental decoders that interpret bytes on the wire. -// Those that take integer types all return uint64 and are -// therefore of type valueDecoder. - -// DecodeVarint reads a varint-encoded integer from the slice. -// It returns the integer and the number of bytes consumed, or -// zero if there is not enough. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -func DecodeVarint(buf []byte) (x uint64, n int) { - for shift := uint(0); shift < 64; shift += 7 { - if n >= len(buf) { - return 0, 0 - } - b := uint64(buf[n]) - n++ - x |= (b & 0x7F) << shift - if (b & 0x80) == 0 { - return x, n - } - } - - // The number is too large to represent in a 64-bit value. - return 0, 0 -} - -func (p *Buffer) decodeVarintSlow() (x uint64, err error) { - i := p.index - l := len(p.buf) - - for shift := uint(0); shift < 64; shift += 7 { - if i >= l { - err = io.ErrUnexpectedEOF - return - } - b := p.buf[i] - i++ - x |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - p.index = i - return - } - } - - // The number is too large to represent in a 64-bit value. - err = errOverflow - return -} - -// DecodeVarint reads a varint-encoded integer from the Buffer. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -func (p *Buffer) DecodeVarint() (x uint64, err error) { - i := p.index - buf := p.buf - - if i >= len(buf) { - return 0, io.ErrUnexpectedEOF - } else if buf[i] < 0x80 { - p.index++ - return uint64(buf[i]), nil - } else if len(buf)-i < 10 { - return p.decodeVarintSlow() - } - - var b uint64 - // we already checked the first byte - x = uint64(buf[i]) - 0x80 - i++ - - b = uint64(buf[i]) - i++ - x += b << 7 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 7 - - b = uint64(buf[i]) - i++ - x += b << 14 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 14 - - b = uint64(buf[i]) - i++ - x += b << 21 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 21 - - b = uint64(buf[i]) - i++ - x += b << 28 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 28 - - b = uint64(buf[i]) - i++ - x += b << 35 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 35 - - b = uint64(buf[i]) - i++ - x += b << 42 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 42 - - b = uint64(buf[i]) - i++ - x += b << 49 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 49 - - b = uint64(buf[i]) - i++ - x += b << 56 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 56 - - b = uint64(buf[i]) - i++ - x += b << 63 - if b&0x80 == 0 { - goto done - } - // x -= 0x80 << 63 // Always zero. - - return 0, errOverflow - -done: - p.index = i - return x, nil -} - -// DecodeFixed64 reads a 64-bit integer from the Buffer. -// This is the format for the -// fixed64, sfixed64, and double protocol buffer types. -func (p *Buffer) DecodeFixed64() (x uint64, err error) { - // x, err already 0 - i := p.index + 8 - if i < 0 || i > len(p.buf) { - err = io.ErrUnexpectedEOF - return - } - p.index = i - - x = uint64(p.buf[i-8]) - x |= uint64(p.buf[i-7]) << 8 - x |= uint64(p.buf[i-6]) << 16 - x |= uint64(p.buf[i-5]) << 24 - x |= uint64(p.buf[i-4]) << 32 - x |= uint64(p.buf[i-3]) << 40 - x |= uint64(p.buf[i-2]) << 48 - x |= uint64(p.buf[i-1]) << 56 - return -} - -// DecodeFixed32 reads a 32-bit integer from the Buffer. -// This is the format for the -// fixed32, sfixed32, and float protocol buffer types. -func (p *Buffer) DecodeFixed32() (x uint64, err error) { - // x, err already 0 - i := p.index + 4 - if i < 0 || i > len(p.buf) { - err = io.ErrUnexpectedEOF - return - } - p.index = i - - x = uint64(p.buf[i-4]) - x |= uint64(p.buf[i-3]) << 8 - x |= uint64(p.buf[i-2]) << 16 - x |= uint64(p.buf[i-1]) << 24 - return -} - -// DecodeZigzag64 reads a zigzag-encoded 64-bit integer -// from the Buffer. -// This is the format used for the sint64 protocol buffer type. -func (p *Buffer) DecodeZigzag64() (x uint64, err error) { - x, err = p.DecodeVarint() - if err != nil { - return - } - x = (x >> 1) ^ uint64((int64(x&1)<<63)>>63) - return -} - -// DecodeZigzag32 reads a zigzag-encoded 32-bit integer -// from the Buffer. -// This is the format used for the sint32 protocol buffer type. -func (p *Buffer) DecodeZigzag32() (x uint64, err error) { - x, err = p.DecodeVarint() - if err != nil { - return - } - x = uint64((uint32(x) >> 1) ^ uint32((int32(x&1)<<31)>>31)) - return -} - -// These are not ValueDecoders: they produce an array of bytes or a string. -// bytes, embedded messages - -// DecodeRawBytes reads a count-delimited byte buffer from the Buffer. -// This is the format used for the bytes protocol buffer -// type and for embedded messages. -func (p *Buffer) DecodeRawBytes(alloc bool) (buf []byte, err error) { - n, err := p.DecodeVarint() - if err != nil { - return nil, err - } - - nb := int(n) - if nb < 0 { - return nil, fmt.Errorf("proto: bad byte length %d", nb) - } - end := p.index + nb - if end < p.index || end > len(p.buf) { - return nil, io.ErrUnexpectedEOF - } - - if !alloc { - // todo: check if can get more uses of alloc=false - buf = p.buf[p.index:end] - p.index += nb - return - } - - buf = make([]byte, nb) - copy(buf, p.buf[p.index:]) - p.index += nb - return -} - -// DecodeStringBytes reads an encoded string from the Buffer. -// This is the format used for the proto2 string type. -func (p *Buffer) DecodeStringBytes() (s string, err error) { - buf, err := p.DecodeRawBytes(false) - if err != nil { - return - } - return string(buf), nil -} - -// Skip the next item in the buffer. Its wire type is decoded and presented as an argument. -// If the protocol buffer has extensions, and the field matches, add it as an extension. -// Otherwise, if the XXX_unrecognized field exists, append the skipped data there. -func (o *Buffer) skipAndSave(t reflect.Type, tag, wire int, base structPointer, unrecField field) error { - oi := o.index - - err := o.skip(t, tag, wire) - if err != nil { - return err - } - - if !unrecField.IsValid() { - return nil - } - - ptr := structPointer_Bytes(base, unrecField) - - // Add the skipped field to struct field - obuf := o.buf - - o.buf = *ptr - o.EncodeVarint(uint64(tag<<3 | wire)) - *ptr = append(o.buf, obuf[oi:o.index]...) - - o.buf = obuf - - return nil -} - -// Skip the next item in the buffer. Its wire type is decoded and presented as an argument. -func (o *Buffer) skip(t reflect.Type, tag, wire int) error { - - var u uint64 - var err error - - switch wire { - case WireVarint: - _, err = o.DecodeVarint() - case WireFixed64: - _, err = o.DecodeFixed64() - case WireBytes: - _, err = o.DecodeRawBytes(false) - case WireFixed32: - _, err = o.DecodeFixed32() - case WireStartGroup: - for { - u, err = o.DecodeVarint() - if err != nil { - break - } - fwire := int(u & 0x7) - if fwire == WireEndGroup { - break - } - ftag := int(u >> 3) - err = o.skip(t, ftag, fwire) - if err != nil { - break - } - } - default: - err = fmt.Errorf("proto: can't skip unknown wire type %d for %s", wire, t) - } - return err -} - -// Unmarshaler is the interface representing objects that can -// unmarshal themselves. The method should reset the receiver before -// decoding starts. The argument points to data that may be -// overwritten, so implementations should not keep references to the -// buffer. -type Unmarshaler interface { - Unmarshal([]byte) error -} - -// Unmarshal parses the protocol buffer representation in buf and places the -// decoded result in pb. If the struct underlying pb does not match -// the data in buf, the results can be unpredictable. -// -// Unmarshal resets pb before starting to unmarshal, so any -// existing data in pb is always removed. Use UnmarshalMerge -// to preserve and append to existing data. -func Unmarshal(buf []byte, pb Message) error { - pb.Reset() - return UnmarshalMerge(buf, pb) -} - -// UnmarshalMerge parses the protocol buffer representation in buf and -// writes the decoded result to pb. If the struct underlying pb does not match -// the data in buf, the results can be unpredictable. -// -// UnmarshalMerge merges into existing data in pb. -// Most code should use Unmarshal instead. -func UnmarshalMerge(buf []byte, pb Message) error { - // If the object can unmarshal itself, let it. - if u, ok := pb.(Unmarshaler); ok { - return u.Unmarshal(buf) - } - return NewBuffer(buf).Unmarshal(pb) -} - -// DecodeMessage reads a count-delimited message from the Buffer. -func (p *Buffer) DecodeMessage(pb Message) error { - enc, err := p.DecodeRawBytes(false) - if err != nil { - return err - } - return NewBuffer(enc).Unmarshal(pb) -} - -// DecodeGroup reads a tag-delimited group from the Buffer. -func (p *Buffer) DecodeGroup(pb Message) error { - typ, base, err := getbase(pb) - if err != nil { - return err - } - return p.unmarshalType(typ.Elem(), GetProperties(typ.Elem()), true, base) -} - -// Unmarshal parses the protocol buffer representation in the -// Buffer and places the decoded result in pb. If the struct -// underlying pb does not match the data in the buffer, the results can be -// unpredictable. -// -// Unlike proto.Unmarshal, this does not reset pb before starting to unmarshal. -func (p *Buffer) Unmarshal(pb Message) error { - // If the object can unmarshal itself, let it. - if u, ok := pb.(Unmarshaler); ok { - err := u.Unmarshal(p.buf[p.index:]) - p.index = len(p.buf) - return err - } - - typ, base, err := getbase(pb) - if err != nil { - return err - } - - err = p.unmarshalType(typ.Elem(), GetProperties(typ.Elem()), false, base) - - if collectStats { - stats.Decode++ - } - - return err -} - -// unmarshalType does the work of unmarshaling a structure. -func (o *Buffer) unmarshalType(st reflect.Type, prop *StructProperties, is_group bool, base structPointer) error { - var state errorState - required, reqFields := prop.reqCount, uint64(0) - - var err error - for err == nil && o.index < len(o.buf) { - oi := o.index - var u uint64 - u, err = o.DecodeVarint() - if err != nil { - break - } - wire := int(u & 0x7) - if wire == WireEndGroup { - if is_group { - if required > 0 { - // Not enough information to determine the exact field. - // (See below.) - return &RequiredNotSetError{"{Unknown}"} - } - return nil // input is satisfied - } - return fmt.Errorf("proto: %s: wiretype end group for non-group", st) - } - tag := int(u >> 3) - if tag <= 0 { - return fmt.Errorf("proto: %s: illegal tag %d (wire type %d)", st, tag, wire) - } - fieldnum, ok := prop.decoderTags.get(tag) - if !ok { - // Maybe it's an extension? - if prop.extendable { - if e, _ := extendable(structPointer_Interface(base, st)); isExtensionField(e, int32(tag)) { - if err = o.skip(st, tag, wire); err == nil { - extmap := e.extensionsWrite() - ext := extmap[int32(tag)] // may be missing - ext.enc = append(ext.enc, o.buf[oi:o.index]...) - extmap[int32(tag)] = ext - } - continue - } - } - // Maybe it's a oneof? - if prop.oneofUnmarshaler != nil { - m := structPointer_Interface(base, st).(Message) - // First return value indicates whether tag is a oneof field. - ok, err = prop.oneofUnmarshaler(m, tag, wire, o) - if err == ErrInternalBadWireType { - // Map the error to something more descriptive. - // Do the formatting here to save generated code space. - err = fmt.Errorf("bad wiretype for oneof field in %T", m) - } - if ok { - continue - } - } - err = o.skipAndSave(st, tag, wire, base, prop.unrecField) - continue - } - p := prop.Prop[fieldnum] - - if p.dec == nil { - fmt.Fprintf(os.Stderr, "proto: no protobuf decoder for %s.%s\n", st, st.Field(fieldnum).Name) - continue - } - dec := p.dec - if wire != WireStartGroup && wire != p.WireType { - if wire == WireBytes && p.packedDec != nil { - // a packable field - dec = p.packedDec - } else { - err = fmt.Errorf("proto: bad wiretype for field %s.%s: got wiretype %d, want %d", st, st.Field(fieldnum).Name, wire, p.WireType) - continue - } - } - decErr := dec(o, p, base) - if decErr != nil && !state.shouldContinue(decErr, p) { - err = decErr - } - if err == nil && p.Required { - // Successfully decoded a required field. - if tag <= 64 { - // use bitmap for fields 1-64 to catch field reuse. - var mask uint64 = 1 << uint64(tag-1) - if reqFields&mask == 0 { - // new required field - reqFields |= mask - required-- - } - } else { - // This is imprecise. It can be fooled by a required field - // with a tag > 64 that is encoded twice; that's very rare. - // A fully correct implementation would require allocating - // a data structure, which we would like to avoid. - required-- - } - } - } - if err == nil { - if is_group { - return io.ErrUnexpectedEOF - } - if state.err != nil { - return state.err - } - if required > 0 { - // Not enough information to determine the exact field. If we use extra - // CPU, we could determine the field only if the missing required field - // has a tag <= 64 and we check reqFields. - return &RequiredNotSetError{"{Unknown}"} - } - } - return err -} - -// Individual type decoders -// For each, -// u is the decoded value, -// v is a pointer to the field (pointer) in the struct - -// Sizes of the pools to allocate inside the Buffer. -// The goal is modest amortization and allocation -// on at least 16-byte boundaries. -const ( - boolPoolSize = 16 - uint32PoolSize = 8 - uint64PoolSize = 4 -) - -// Decode a bool. -func (o *Buffer) dec_bool(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - if len(o.bools) == 0 { - o.bools = make([]bool, boolPoolSize) - } - o.bools[0] = u != 0 - *structPointer_Bool(base, p.field) = &o.bools[0] - o.bools = o.bools[1:] - return nil -} - -func (o *Buffer) dec_proto3_bool(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - *structPointer_BoolVal(base, p.field) = u != 0 - return nil -} - -// Decode an int32. -func (o *Buffer) dec_int32(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - word32_Set(structPointer_Word32(base, p.field), o, uint32(u)) - return nil -} - -func (o *Buffer) dec_proto3_int32(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - word32Val_Set(structPointer_Word32Val(base, p.field), uint32(u)) - return nil -} - -// Decode an int64. -func (o *Buffer) dec_int64(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - word64_Set(structPointer_Word64(base, p.field), o, u) - return nil -} - -func (o *Buffer) dec_proto3_int64(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - word64Val_Set(structPointer_Word64Val(base, p.field), o, u) - return nil -} - -// Decode a string. -func (o *Buffer) dec_string(p *Properties, base structPointer) error { - s, err := o.DecodeStringBytes() - if err != nil { - return err - } - *structPointer_String(base, p.field) = &s - return nil -} - -func (o *Buffer) dec_proto3_string(p *Properties, base structPointer) error { - s, err := o.DecodeStringBytes() - if err != nil { - return err - } - *structPointer_StringVal(base, p.field) = s - return nil -} - -// Decode a slice of bytes ([]byte). -func (o *Buffer) dec_slice_byte(p *Properties, base structPointer) error { - b, err := o.DecodeRawBytes(true) - if err != nil { - return err - } - *structPointer_Bytes(base, p.field) = b - return nil -} - -// Decode a slice of bools ([]bool). -func (o *Buffer) dec_slice_bool(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - v := structPointer_BoolSlice(base, p.field) - *v = append(*v, u != 0) - return nil -} - -// Decode a slice of bools ([]bool) in packed format. -func (o *Buffer) dec_slice_packed_bool(p *Properties, base structPointer) error { - v := structPointer_BoolSlice(base, p.field) - - nn, err := o.DecodeVarint() - if err != nil { - return err - } - nb := int(nn) // number of bytes of encoded bools - fin := o.index + nb - if fin < o.index { - return errOverflow - } - - y := *v - for o.index < fin { - u, err := p.valDec(o) - if err != nil { - return err - } - y = append(y, u != 0) - } - - *v = y - return nil -} - -// Decode a slice of int32s ([]int32). -func (o *Buffer) dec_slice_int32(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - structPointer_Word32Slice(base, p.field).Append(uint32(u)) - return nil -} - -// Decode a slice of int32s ([]int32) in packed format. -func (o *Buffer) dec_slice_packed_int32(p *Properties, base structPointer) error { - v := structPointer_Word32Slice(base, p.field) - - nn, err := o.DecodeVarint() - if err != nil { - return err - } - nb := int(nn) // number of bytes of encoded int32s - - fin := o.index + nb - if fin < o.index { - return errOverflow - } - for o.index < fin { - u, err := p.valDec(o) - if err != nil { - return err - } - v.Append(uint32(u)) - } - return nil -} - -// Decode a slice of int64s ([]int64). -func (o *Buffer) dec_slice_int64(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - - structPointer_Word64Slice(base, p.field).Append(u) - return nil -} - -// Decode a slice of int64s ([]int64) in packed format. -func (o *Buffer) dec_slice_packed_int64(p *Properties, base structPointer) error { - v := structPointer_Word64Slice(base, p.field) - - nn, err := o.DecodeVarint() - if err != nil { - return err - } - nb := int(nn) // number of bytes of encoded int64s - - fin := o.index + nb - if fin < o.index { - return errOverflow - } - for o.index < fin { - u, err := p.valDec(o) - if err != nil { - return err - } - v.Append(u) - } - return nil -} - -// Decode a slice of strings ([]string). -func (o *Buffer) dec_slice_string(p *Properties, base structPointer) error { - s, err := o.DecodeStringBytes() - if err != nil { - return err - } - v := structPointer_StringSlice(base, p.field) - *v = append(*v, s) - return nil -} - -// Decode a slice of slice of bytes ([][]byte). -func (o *Buffer) dec_slice_slice_byte(p *Properties, base structPointer) error { - b, err := o.DecodeRawBytes(true) - if err != nil { - return err - } - v := structPointer_BytesSlice(base, p.field) - *v = append(*v, b) - return nil -} - -// Decode a map field. -func (o *Buffer) dec_new_map(p *Properties, base structPointer) error { - raw, err := o.DecodeRawBytes(false) - if err != nil { - return err - } - oi := o.index // index at the end of this map entry - o.index -= len(raw) // move buffer back to start of map entry - - mptr := structPointer_NewAt(base, p.field, p.mtype) // *map[K]V - if mptr.Elem().IsNil() { - mptr.Elem().Set(reflect.MakeMap(mptr.Type().Elem())) - } - v := mptr.Elem() // map[K]V - - // Prepare addressable doubly-indirect placeholders for the key and value types. - // See enc_new_map for why. - keyptr := reflect.New(reflect.PtrTo(p.mtype.Key())).Elem() // addressable *K - keybase := toStructPointer(keyptr.Addr()) // **K - - var valbase structPointer - var valptr reflect.Value - switch p.mtype.Elem().Kind() { - case reflect.Slice: - // []byte - var dummy []byte - valptr = reflect.ValueOf(&dummy) // *[]byte - valbase = toStructPointer(valptr) // *[]byte - case reflect.Ptr: - // message; valptr is **Msg; need to allocate the intermediate pointer - valptr = reflect.New(reflect.PtrTo(p.mtype.Elem())).Elem() // addressable *V - valptr.Set(reflect.New(valptr.Type().Elem())) - valbase = toStructPointer(valptr) - default: - // everything else - valptr = reflect.New(reflect.PtrTo(p.mtype.Elem())).Elem() // addressable *V - valbase = toStructPointer(valptr.Addr()) // **V - } - - // Decode. - // This parses a restricted wire format, namely the encoding of a message - // with two fields. See enc_new_map for the format. - for o.index < oi { - // tagcode for key and value properties are always a single byte - // because they have tags 1 and 2. - tagcode := o.buf[o.index] - o.index++ - switch tagcode { - case p.mkeyprop.tagcode[0]: - if err := p.mkeyprop.dec(o, p.mkeyprop, keybase); err != nil { - return err - } - case p.mvalprop.tagcode[0]: - if err := p.mvalprop.dec(o, p.mvalprop, valbase); err != nil { - return err - } - default: - // TODO: Should we silently skip this instead? - return fmt.Errorf("proto: bad map data tag %d", raw[0]) - } - } - keyelem, valelem := keyptr.Elem(), valptr.Elem() - if !keyelem.IsValid() { - keyelem = reflect.Zero(p.mtype.Key()) - } - if !valelem.IsValid() { - valelem = reflect.Zero(p.mtype.Elem()) - } - - v.SetMapIndex(keyelem, valelem) - return nil -} - -// Decode a group. -func (o *Buffer) dec_struct_group(p *Properties, base structPointer) error { - bas := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(bas) { - // allocate new nested message - bas = toStructPointer(reflect.New(p.stype)) - structPointer_SetStructPointer(base, p.field, bas) - } - return o.unmarshalType(p.stype, p.sprop, true, bas) -} - -// Decode an embedded message. -func (o *Buffer) dec_struct_message(p *Properties, base structPointer) (err error) { - raw, e := o.DecodeRawBytes(false) - if e != nil { - return e - } - - bas := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(bas) { - // allocate new nested message - bas = toStructPointer(reflect.New(p.stype)) - structPointer_SetStructPointer(base, p.field, bas) - } - - // If the object can unmarshal itself, let it. - if p.isUnmarshaler { - iv := structPointer_Interface(bas, p.stype) - return iv.(Unmarshaler).Unmarshal(raw) - } - - obuf := o.buf - oi := o.index - o.buf = raw - o.index = 0 - - err = o.unmarshalType(p.stype, p.sprop, false, bas) - o.buf = obuf - o.index = oi - - return err -} - -// Decode a slice of embedded messages. -func (o *Buffer) dec_slice_struct_message(p *Properties, base structPointer) error { - return o.dec_slice_struct(p, false, base) -} - -// Decode a slice of embedded groups. -func (o *Buffer) dec_slice_struct_group(p *Properties, base structPointer) error { - return o.dec_slice_struct(p, true, base) -} - -// Decode a slice of structs ([]*struct). -func (o *Buffer) dec_slice_struct(p *Properties, is_group bool, base structPointer) error { - v := reflect.New(p.stype) - bas := toStructPointer(v) - structPointer_StructPointerSlice(base, p.field).Append(bas) - - if is_group { - err := o.unmarshalType(p.stype, p.sprop, is_group, bas) - return err - } - - raw, err := o.DecodeRawBytes(false) - if err != nil { - return err - } - - // If the object can unmarshal itself, let it. - if p.isUnmarshaler { - iv := v.Interface() - return iv.(Unmarshaler).Unmarshal(raw) - } - - obuf := o.buf - oi := o.index - o.buf = raw - o.index = 0 - - err = o.unmarshalType(p.stype, p.sprop, is_group, bas) - - o.buf = obuf - o.index = oi - - return err -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/encode.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/encode.go deleted file mode 100644 index 2b30f84626a..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/encode.go +++ /dev/null @@ -1,1362 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -/* - * Routines for encoding data into the wire format for protocol buffers. - */ - -import ( - "errors" - "fmt" - "reflect" - "sort" -) - -// RequiredNotSetError is the error returned if Marshal is called with -// a protocol buffer struct whose required fields have not -// all been initialized. It is also the error returned if Unmarshal is -// called with an encoded protocol buffer that does not include all the -// required fields. -// -// When printed, RequiredNotSetError reports the first unset required field in a -// message. If the field cannot be precisely determined, it is reported as -// "{Unknown}". -type RequiredNotSetError struct { - field string -} - -func (e *RequiredNotSetError) Error() string { - return fmt.Sprintf("proto: required field %q not set", e.field) -} - -var ( - // errRepeatedHasNil is the error returned if Marshal is called with - // a struct with a repeated field containing a nil element. - errRepeatedHasNil = errors.New("proto: repeated field has nil element") - - // errOneofHasNil is the error returned if Marshal is called with - // a struct with a oneof field containing a nil element. - errOneofHasNil = errors.New("proto: oneof field has nil value") - - // ErrNil is the error returned if Marshal is called with nil. - ErrNil = errors.New("proto: Marshal called with nil") - - // ErrTooLarge is the error returned if Marshal is called with a - // message that encodes to >2GB. - ErrTooLarge = errors.New("proto: message encodes to over 2 GB") -) - -// The fundamental encoders that put bytes on the wire. -// Those that take integer types all accept uint64 and are -// therefore of type valueEncoder. - -const maxVarintBytes = 10 // maximum length of a varint - -// maxMarshalSize is the largest allowed size of an encoded protobuf, -// since C++ and Java use signed int32s for the size. -const maxMarshalSize = 1<<31 - 1 - -// EncodeVarint returns the varint encoding of x. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -// Not used by the package itself, but helpful to clients -// wishing to use the same encoding. -func EncodeVarint(x uint64) []byte { - var buf [maxVarintBytes]byte - var n int - for n = 0; x > 127; n++ { - buf[n] = 0x80 | uint8(x&0x7F) - x >>= 7 - } - buf[n] = uint8(x) - n++ - return buf[0:n] -} - -// EncodeVarint writes a varint-encoded integer to the Buffer. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -func (p *Buffer) EncodeVarint(x uint64) error { - for x >= 1<<7 { - p.buf = append(p.buf, uint8(x&0x7f|0x80)) - x >>= 7 - } - p.buf = append(p.buf, uint8(x)) - return nil -} - -// SizeVarint returns the varint encoding size of an integer. -func SizeVarint(x uint64) int { - return sizeVarint(x) -} - -func sizeVarint(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} - -// EncodeFixed64 writes a 64-bit integer to the Buffer. -// This is the format for the -// fixed64, sfixed64, and double protocol buffer types. -func (p *Buffer) EncodeFixed64(x uint64) error { - p.buf = append(p.buf, - uint8(x), - uint8(x>>8), - uint8(x>>16), - uint8(x>>24), - uint8(x>>32), - uint8(x>>40), - uint8(x>>48), - uint8(x>>56)) - return nil -} - -func sizeFixed64(x uint64) int { - return 8 -} - -// EncodeFixed32 writes a 32-bit integer to the Buffer. -// This is the format for the -// fixed32, sfixed32, and float protocol buffer types. -func (p *Buffer) EncodeFixed32(x uint64) error { - p.buf = append(p.buf, - uint8(x), - uint8(x>>8), - uint8(x>>16), - uint8(x>>24)) - return nil -} - -func sizeFixed32(x uint64) int { - return 4 -} - -// EncodeZigzag64 writes a zigzag-encoded 64-bit integer -// to the Buffer. -// This is the format used for the sint64 protocol buffer type. -func (p *Buffer) EncodeZigzag64(x uint64) error { - // use signed number to get arithmetic right shift. - return p.EncodeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} - -func sizeZigzag64(x uint64) int { - return sizeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} - -// EncodeZigzag32 writes a zigzag-encoded 32-bit integer -// to the Buffer. -// This is the format used for the sint32 protocol buffer type. -func (p *Buffer) EncodeZigzag32(x uint64) error { - // use signed number to get arithmetic right shift. - return p.EncodeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31)))) -} - -func sizeZigzag32(x uint64) int { - return sizeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31)))) -} - -// EncodeRawBytes writes a count-delimited byte buffer to the Buffer. -// This is the format used for the bytes protocol buffer -// type and for embedded messages. -func (p *Buffer) EncodeRawBytes(b []byte) error { - p.EncodeVarint(uint64(len(b))) - p.buf = append(p.buf, b...) - return nil -} - -func sizeRawBytes(b []byte) int { - return sizeVarint(uint64(len(b))) + - len(b) -} - -// EncodeStringBytes writes an encoded string to the Buffer. -// This is the format used for the proto2 string type. -func (p *Buffer) EncodeStringBytes(s string) error { - p.EncodeVarint(uint64(len(s))) - p.buf = append(p.buf, s...) - return nil -} - -func sizeStringBytes(s string) int { - return sizeVarint(uint64(len(s))) + - len(s) -} - -// Marshaler is the interface representing objects that can marshal themselves. -type Marshaler interface { - Marshal() ([]byte, error) -} - -// Marshal takes the protocol buffer -// and encodes it into the wire format, returning the data. -func Marshal(pb Message) ([]byte, error) { - // Can the object marshal itself? - if m, ok := pb.(Marshaler); ok { - return m.Marshal() - } - p := NewBuffer(nil) - err := p.Marshal(pb) - if p.buf == nil && err == nil { - // Return a non-nil slice on success. - return []byte{}, nil - } - return p.buf, err -} - -// EncodeMessage writes the protocol buffer to the Buffer, -// prefixed by a varint-encoded length. -func (p *Buffer) EncodeMessage(pb Message) error { - t, base, err := getbase(pb) - if structPointer_IsNil(base) { - return ErrNil - } - if err == nil { - var state errorState - err = p.enc_len_struct(GetProperties(t.Elem()), base, &state) - } - return err -} - -// Marshal takes the protocol buffer -// and encodes it into the wire format, writing the result to the -// Buffer. -func (p *Buffer) Marshal(pb Message) error { - // Can the object marshal itself? - if m, ok := pb.(Marshaler); ok { - data, err := m.Marshal() - p.buf = append(p.buf, data...) - return err - } - - t, base, err := getbase(pb) - if structPointer_IsNil(base) { - return ErrNil - } - if err == nil { - err = p.enc_struct(GetProperties(t.Elem()), base) - } - - if collectStats { - (stats).Encode++ // Parens are to work around a goimports bug. - } - - if len(p.buf) > maxMarshalSize { - return ErrTooLarge - } - return err -} - -// Size returns the encoded size of a protocol buffer. -func Size(pb Message) (n int) { - // Can the object marshal itself? If so, Size is slow. - // TODO: add Size to Marshaler, or add a Sizer interface. - if m, ok := pb.(Marshaler); ok { - b, _ := m.Marshal() - return len(b) - } - - t, base, err := getbase(pb) - if structPointer_IsNil(base) { - return 0 - } - if err == nil { - n = size_struct(GetProperties(t.Elem()), base) - } - - if collectStats { - (stats).Size++ // Parens are to work around a goimports bug. - } - - return -} - -// Individual type encoders. - -// Encode a bool. -func (o *Buffer) enc_bool(p *Properties, base structPointer) error { - v := *structPointer_Bool(base, p.field) - if v == nil { - return ErrNil - } - x := 0 - if *v { - x = 1 - } - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func (o *Buffer) enc_proto3_bool(p *Properties, base structPointer) error { - v := *structPointer_BoolVal(base, p.field) - if !v { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, 1) - return nil -} - -func size_bool(p *Properties, base structPointer) int { - v := *structPointer_Bool(base, p.field) - if v == nil { - return 0 - } - return len(p.tagcode) + 1 // each bool takes exactly one byte -} - -func size_proto3_bool(p *Properties, base structPointer) int { - v := *structPointer_BoolVal(base, p.field) - if !v && !p.oneof { - return 0 - } - return len(p.tagcode) + 1 // each bool takes exactly one byte -} - -// Encode an int32. -func (o *Buffer) enc_int32(p *Properties, base structPointer) error { - v := structPointer_Word32(base, p.field) - if word32_IsNil(v) { - return ErrNil - } - x := int32(word32_Get(v)) // permit sign extension to use full 64-bit range - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func (o *Buffer) enc_proto3_int32(p *Properties, base structPointer) error { - v := structPointer_Word32Val(base, p.field) - x := int32(word32Val_Get(v)) // permit sign extension to use full 64-bit range - if x == 0 { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func size_int32(p *Properties, base structPointer) (n int) { - v := structPointer_Word32(base, p.field) - if word32_IsNil(v) { - return 0 - } - x := int32(word32_Get(v)) // permit sign extension to use full 64-bit range - n += len(p.tagcode) - n += p.valSize(uint64(x)) - return -} - -func size_proto3_int32(p *Properties, base structPointer) (n int) { - v := structPointer_Word32Val(base, p.field) - x := int32(word32Val_Get(v)) // permit sign extension to use full 64-bit range - if x == 0 && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += p.valSize(uint64(x)) - return -} - -// Encode a uint32. -// Exactly the same as int32, except for no sign extension. -func (o *Buffer) enc_uint32(p *Properties, base structPointer) error { - v := structPointer_Word32(base, p.field) - if word32_IsNil(v) { - return ErrNil - } - x := word32_Get(v) - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func (o *Buffer) enc_proto3_uint32(p *Properties, base structPointer) error { - v := structPointer_Word32Val(base, p.field) - x := word32Val_Get(v) - if x == 0 { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func size_uint32(p *Properties, base structPointer) (n int) { - v := structPointer_Word32(base, p.field) - if word32_IsNil(v) { - return 0 - } - x := word32_Get(v) - n += len(p.tagcode) - n += p.valSize(uint64(x)) - return -} - -func size_proto3_uint32(p *Properties, base structPointer) (n int) { - v := structPointer_Word32Val(base, p.field) - x := word32Val_Get(v) - if x == 0 && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += p.valSize(uint64(x)) - return -} - -// Encode an int64. -func (o *Buffer) enc_int64(p *Properties, base structPointer) error { - v := structPointer_Word64(base, p.field) - if word64_IsNil(v) { - return ErrNil - } - x := word64_Get(v) - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, x) - return nil -} - -func (o *Buffer) enc_proto3_int64(p *Properties, base structPointer) error { - v := structPointer_Word64Val(base, p.field) - x := word64Val_Get(v) - if x == 0 { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, x) - return nil -} - -func size_int64(p *Properties, base structPointer) (n int) { - v := structPointer_Word64(base, p.field) - if word64_IsNil(v) { - return 0 - } - x := word64_Get(v) - n += len(p.tagcode) - n += p.valSize(x) - return -} - -func size_proto3_int64(p *Properties, base structPointer) (n int) { - v := structPointer_Word64Val(base, p.field) - x := word64Val_Get(v) - if x == 0 && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += p.valSize(x) - return -} - -// Encode a string. -func (o *Buffer) enc_string(p *Properties, base structPointer) error { - v := *structPointer_String(base, p.field) - if v == nil { - return ErrNil - } - x := *v - o.buf = append(o.buf, p.tagcode...) - o.EncodeStringBytes(x) - return nil -} - -func (o *Buffer) enc_proto3_string(p *Properties, base structPointer) error { - v := *structPointer_StringVal(base, p.field) - if v == "" { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeStringBytes(v) - return nil -} - -func size_string(p *Properties, base structPointer) (n int) { - v := *structPointer_String(base, p.field) - if v == nil { - return 0 - } - x := *v - n += len(p.tagcode) - n += sizeStringBytes(x) - return -} - -func size_proto3_string(p *Properties, base structPointer) (n int) { - v := *structPointer_StringVal(base, p.field) - if v == "" && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += sizeStringBytes(v) - return -} - -// All protocol buffer fields are nillable, but be careful. -func isNil(v reflect.Value) bool { - switch v.Kind() { - case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: - return v.IsNil() - } - return false -} - -// Encode a message struct. -func (o *Buffer) enc_struct_message(p *Properties, base structPointer) error { - var state errorState - structp := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(structp) { - return ErrNil - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, err := m.Marshal() - if err != nil && !state.shouldContinue(err, nil) { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - return state.err - } - - o.buf = append(o.buf, p.tagcode...) - return o.enc_len_struct(p.sprop, structp, &state) -} - -func size_struct_message(p *Properties, base structPointer) int { - structp := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(structp) { - return 0 - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, _ := m.Marshal() - n0 := len(p.tagcode) - n1 := sizeRawBytes(data) - return n0 + n1 - } - - n0 := len(p.tagcode) - n1 := size_struct(p.sprop, structp) - n2 := sizeVarint(uint64(n1)) // size of encoded length - return n0 + n1 + n2 -} - -// Encode a group struct. -func (o *Buffer) enc_struct_group(p *Properties, base structPointer) error { - var state errorState - b := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(b) { - return ErrNil - } - - o.EncodeVarint(uint64((p.Tag << 3) | WireStartGroup)) - err := o.enc_struct(p.sprop, b) - if err != nil && !state.shouldContinue(err, nil) { - return err - } - o.EncodeVarint(uint64((p.Tag << 3) | WireEndGroup)) - return state.err -} - -func size_struct_group(p *Properties, base structPointer) (n int) { - b := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(b) { - return 0 - } - - n += sizeVarint(uint64((p.Tag << 3) | WireStartGroup)) - n += size_struct(p.sprop, b) - n += sizeVarint(uint64((p.Tag << 3) | WireEndGroup)) - return -} - -// Encode a slice of bools ([]bool). -func (o *Buffer) enc_slice_bool(p *Properties, base structPointer) error { - s := *structPointer_BoolSlice(base, p.field) - l := len(s) - if l == 0 { - return ErrNil - } - for _, x := range s { - o.buf = append(o.buf, p.tagcode...) - v := uint64(0) - if x { - v = 1 - } - p.valEnc(o, v) - } - return nil -} - -func size_slice_bool(p *Properties, base structPointer) int { - s := *structPointer_BoolSlice(base, p.field) - l := len(s) - if l == 0 { - return 0 - } - return l * (len(p.tagcode) + 1) // each bool takes exactly one byte -} - -// Encode a slice of bools ([]bool) in packed format. -func (o *Buffer) enc_slice_packed_bool(p *Properties, base structPointer) error { - s := *structPointer_BoolSlice(base, p.field) - l := len(s) - if l == 0 { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeVarint(uint64(l)) // each bool takes exactly one byte - for _, x := range s { - v := uint64(0) - if x { - v = 1 - } - p.valEnc(o, v) - } - return nil -} - -func size_slice_packed_bool(p *Properties, base structPointer) (n int) { - s := *structPointer_BoolSlice(base, p.field) - l := len(s) - if l == 0 { - return 0 - } - n += len(p.tagcode) - n += sizeVarint(uint64(l)) - n += l // each bool takes exactly one byte - return -} - -// Encode a slice of bytes ([]byte). -func (o *Buffer) enc_slice_byte(p *Properties, base structPointer) error { - s := *structPointer_Bytes(base, p.field) - if s == nil { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(s) - return nil -} - -func (o *Buffer) enc_proto3_slice_byte(p *Properties, base structPointer) error { - s := *structPointer_Bytes(base, p.field) - if len(s) == 0 { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(s) - return nil -} - -func size_slice_byte(p *Properties, base structPointer) (n int) { - s := *structPointer_Bytes(base, p.field) - if s == nil && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += sizeRawBytes(s) - return -} - -func size_proto3_slice_byte(p *Properties, base structPointer) (n int) { - s := *structPointer_Bytes(base, p.field) - if len(s) == 0 && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += sizeRawBytes(s) - return -} - -// Encode a slice of int32s ([]int32). -func (o *Buffer) enc_slice_int32(p *Properties, base structPointer) error { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - for i := 0; i < l; i++ { - o.buf = append(o.buf, p.tagcode...) - x := int32(s.Index(i)) // permit sign extension to use full 64-bit range - p.valEnc(o, uint64(x)) - } - return nil -} - -func size_slice_int32(p *Properties, base structPointer) (n int) { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - for i := 0; i < l; i++ { - n += len(p.tagcode) - x := int32(s.Index(i)) // permit sign extension to use full 64-bit range - n += p.valSize(uint64(x)) - } - return -} - -// Encode a slice of int32s ([]int32) in packed format. -func (o *Buffer) enc_slice_packed_int32(p *Properties, base structPointer) error { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - // TODO: Reuse a Buffer. - buf := NewBuffer(nil) - for i := 0; i < l; i++ { - x := int32(s.Index(i)) // permit sign extension to use full 64-bit range - p.valEnc(buf, uint64(x)) - } - - o.buf = append(o.buf, p.tagcode...) - o.EncodeVarint(uint64(len(buf.buf))) - o.buf = append(o.buf, buf.buf...) - return nil -} - -func size_slice_packed_int32(p *Properties, base structPointer) (n int) { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - var bufSize int - for i := 0; i < l; i++ { - x := int32(s.Index(i)) // permit sign extension to use full 64-bit range - bufSize += p.valSize(uint64(x)) - } - - n += len(p.tagcode) - n += sizeVarint(uint64(bufSize)) - n += bufSize - return -} - -// Encode a slice of uint32s ([]uint32). -// Exactly the same as int32, except for no sign extension. -func (o *Buffer) enc_slice_uint32(p *Properties, base structPointer) error { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - for i := 0; i < l; i++ { - o.buf = append(o.buf, p.tagcode...) - x := s.Index(i) - p.valEnc(o, uint64(x)) - } - return nil -} - -func size_slice_uint32(p *Properties, base structPointer) (n int) { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - for i := 0; i < l; i++ { - n += len(p.tagcode) - x := s.Index(i) - n += p.valSize(uint64(x)) - } - return -} - -// Encode a slice of uint32s ([]uint32) in packed format. -// Exactly the same as int32, except for no sign extension. -func (o *Buffer) enc_slice_packed_uint32(p *Properties, base structPointer) error { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - // TODO: Reuse a Buffer. - buf := NewBuffer(nil) - for i := 0; i < l; i++ { - p.valEnc(buf, uint64(s.Index(i))) - } - - o.buf = append(o.buf, p.tagcode...) - o.EncodeVarint(uint64(len(buf.buf))) - o.buf = append(o.buf, buf.buf...) - return nil -} - -func size_slice_packed_uint32(p *Properties, base structPointer) (n int) { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - var bufSize int - for i := 0; i < l; i++ { - bufSize += p.valSize(uint64(s.Index(i))) - } - - n += len(p.tagcode) - n += sizeVarint(uint64(bufSize)) - n += bufSize - return -} - -// Encode a slice of int64s ([]int64). -func (o *Buffer) enc_slice_int64(p *Properties, base structPointer) error { - s := structPointer_Word64Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - for i := 0; i < l; i++ { - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, s.Index(i)) - } - return nil -} - -func size_slice_int64(p *Properties, base structPointer) (n int) { - s := structPointer_Word64Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - for i := 0; i < l; i++ { - n += len(p.tagcode) - n += p.valSize(s.Index(i)) - } - return -} - -// Encode a slice of int64s ([]int64) in packed format. -func (o *Buffer) enc_slice_packed_int64(p *Properties, base structPointer) error { - s := structPointer_Word64Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - // TODO: Reuse a Buffer. - buf := NewBuffer(nil) - for i := 0; i < l; i++ { - p.valEnc(buf, s.Index(i)) - } - - o.buf = append(o.buf, p.tagcode...) - o.EncodeVarint(uint64(len(buf.buf))) - o.buf = append(o.buf, buf.buf...) - return nil -} - -func size_slice_packed_int64(p *Properties, base structPointer) (n int) { - s := structPointer_Word64Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - var bufSize int - for i := 0; i < l; i++ { - bufSize += p.valSize(s.Index(i)) - } - - n += len(p.tagcode) - n += sizeVarint(uint64(bufSize)) - n += bufSize - return -} - -// Encode a slice of slice of bytes ([][]byte). -func (o *Buffer) enc_slice_slice_byte(p *Properties, base structPointer) error { - ss := *structPointer_BytesSlice(base, p.field) - l := len(ss) - if l == 0 { - return ErrNil - } - for i := 0; i < l; i++ { - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(ss[i]) - } - return nil -} - -func size_slice_slice_byte(p *Properties, base structPointer) (n int) { - ss := *structPointer_BytesSlice(base, p.field) - l := len(ss) - if l == 0 { - return 0 - } - n += l * len(p.tagcode) - for i := 0; i < l; i++ { - n += sizeRawBytes(ss[i]) - } - return -} - -// Encode a slice of strings ([]string). -func (o *Buffer) enc_slice_string(p *Properties, base structPointer) error { - ss := *structPointer_StringSlice(base, p.field) - l := len(ss) - for i := 0; i < l; i++ { - o.buf = append(o.buf, p.tagcode...) - o.EncodeStringBytes(ss[i]) - } - return nil -} - -func size_slice_string(p *Properties, base structPointer) (n int) { - ss := *structPointer_StringSlice(base, p.field) - l := len(ss) - n += l * len(p.tagcode) - for i := 0; i < l; i++ { - n += sizeStringBytes(ss[i]) - } - return -} - -// Encode a slice of message structs ([]*struct). -func (o *Buffer) enc_slice_struct_message(p *Properties, base structPointer) error { - var state errorState - s := structPointer_StructPointerSlice(base, p.field) - l := s.Len() - - for i := 0; i < l; i++ { - structp := s.Index(i) - if structPointer_IsNil(structp) { - return errRepeatedHasNil - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, err := m.Marshal() - if err != nil && !state.shouldContinue(err, nil) { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - continue - } - - o.buf = append(o.buf, p.tagcode...) - err := o.enc_len_struct(p.sprop, structp, &state) - if err != nil && !state.shouldContinue(err, nil) { - if err == ErrNil { - return errRepeatedHasNil - } - return err - } - } - return state.err -} - -func size_slice_struct_message(p *Properties, base structPointer) (n int) { - s := structPointer_StructPointerSlice(base, p.field) - l := s.Len() - n += l * len(p.tagcode) - for i := 0; i < l; i++ { - structp := s.Index(i) - if structPointer_IsNil(structp) { - return // return the size up to this point - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, _ := m.Marshal() - n += sizeRawBytes(data) - continue - } - - n0 := size_struct(p.sprop, structp) - n1 := sizeVarint(uint64(n0)) // size of encoded length - n += n0 + n1 - } - return -} - -// Encode a slice of group structs ([]*struct). -func (o *Buffer) enc_slice_struct_group(p *Properties, base structPointer) error { - var state errorState - s := structPointer_StructPointerSlice(base, p.field) - l := s.Len() - - for i := 0; i < l; i++ { - b := s.Index(i) - if structPointer_IsNil(b) { - return errRepeatedHasNil - } - - o.EncodeVarint(uint64((p.Tag << 3) | WireStartGroup)) - - err := o.enc_struct(p.sprop, b) - - if err != nil && !state.shouldContinue(err, nil) { - if err == ErrNil { - return errRepeatedHasNil - } - return err - } - - o.EncodeVarint(uint64((p.Tag << 3) | WireEndGroup)) - } - return state.err -} - -func size_slice_struct_group(p *Properties, base structPointer) (n int) { - s := structPointer_StructPointerSlice(base, p.field) - l := s.Len() - - n += l * sizeVarint(uint64((p.Tag<<3)|WireStartGroup)) - n += l * sizeVarint(uint64((p.Tag<<3)|WireEndGroup)) - for i := 0; i < l; i++ { - b := s.Index(i) - if structPointer_IsNil(b) { - return // return size up to this point - } - - n += size_struct(p.sprop, b) - } - return -} - -// Encode an extension map. -func (o *Buffer) enc_map(p *Properties, base structPointer) error { - exts := structPointer_ExtMap(base, p.field) - if err := encodeExtensionsMap(*exts); err != nil { - return err - } - - return o.enc_map_body(*exts) -} - -func (o *Buffer) enc_exts(p *Properties, base structPointer) error { - exts := structPointer_Extensions(base, p.field) - - v, mu := exts.extensionsRead() - if v == nil { - return nil - } - - mu.Lock() - defer mu.Unlock() - if err := encodeExtensionsMap(v); err != nil { - return err - } - - return o.enc_map_body(v) -} - -func (o *Buffer) enc_map_body(v map[int32]Extension) error { - // Fast-path for common cases: zero or one extensions. - if len(v) <= 1 { - for _, e := range v { - o.buf = append(o.buf, e.enc...) - } - return nil - } - - // Sort keys to provide a deterministic encoding. - keys := make([]int, 0, len(v)) - for k := range v { - keys = append(keys, int(k)) - } - sort.Ints(keys) - - for _, k := range keys { - o.buf = append(o.buf, v[int32(k)].enc...) - } - return nil -} - -func size_map(p *Properties, base structPointer) int { - v := structPointer_ExtMap(base, p.field) - return extensionsMapSize(*v) -} - -func size_exts(p *Properties, base structPointer) int { - v := structPointer_Extensions(base, p.field) - return extensionsSize(v) -} - -// Encode a map field. -func (o *Buffer) enc_new_map(p *Properties, base structPointer) error { - var state errorState // XXX: or do we need to plumb this through? - - /* - A map defined as - map map_field = N; - is encoded in the same way as - message MapFieldEntry { - key_type key = 1; - value_type value = 2; - } - repeated MapFieldEntry map_field = N; - */ - - v := structPointer_NewAt(base, p.field, p.mtype).Elem() // map[K]V - if v.Len() == 0 { - return nil - } - - keycopy, valcopy, keybase, valbase := mapEncodeScratch(p.mtype) - - enc := func() error { - if err := p.mkeyprop.enc(o, p.mkeyprop, keybase); err != nil { - return err - } - if err := p.mvalprop.enc(o, p.mvalprop, valbase); err != nil && err != ErrNil { - return err - } - return nil - } - - // Don't sort map keys. It is not required by the spec, and C++ doesn't do it. - for _, key := range v.MapKeys() { - val := v.MapIndex(key) - - keycopy.Set(key) - valcopy.Set(val) - - o.buf = append(o.buf, p.tagcode...) - if err := o.enc_len_thing(enc, &state); err != nil { - return err - } - } - return nil -} - -func size_new_map(p *Properties, base structPointer) int { - v := structPointer_NewAt(base, p.field, p.mtype).Elem() // map[K]V - - keycopy, valcopy, keybase, valbase := mapEncodeScratch(p.mtype) - - n := 0 - for _, key := range v.MapKeys() { - val := v.MapIndex(key) - keycopy.Set(key) - valcopy.Set(val) - - // Tag codes for key and val are the responsibility of the sub-sizer. - keysize := p.mkeyprop.size(p.mkeyprop, keybase) - valsize := p.mvalprop.size(p.mvalprop, valbase) - entry := keysize + valsize - // Add on tag code and length of map entry itself. - n += len(p.tagcode) + sizeVarint(uint64(entry)) + entry - } - return n -} - -// mapEncodeScratch returns a new reflect.Value matching the map's value type, -// and a structPointer suitable for passing to an encoder or sizer. -func mapEncodeScratch(mapType reflect.Type) (keycopy, valcopy reflect.Value, keybase, valbase structPointer) { - // Prepare addressable doubly-indirect placeholders for the key and value types. - // This is needed because the element-type encoders expect **T, but the map iteration produces T. - - keycopy = reflect.New(mapType.Key()).Elem() // addressable K - keyptr := reflect.New(reflect.PtrTo(keycopy.Type())).Elem() // addressable *K - keyptr.Set(keycopy.Addr()) // - keybase = toStructPointer(keyptr.Addr()) // **K - - // Value types are more varied and require special handling. - switch mapType.Elem().Kind() { - case reflect.Slice: - // []byte - var dummy []byte - valcopy = reflect.ValueOf(&dummy).Elem() // addressable []byte - valbase = toStructPointer(valcopy.Addr()) - case reflect.Ptr: - // message; the generated field type is map[K]*Msg (so V is *Msg), - // so we only need one level of indirection. - valcopy = reflect.New(mapType.Elem()).Elem() // addressable V - valbase = toStructPointer(valcopy.Addr()) - default: - // everything else - valcopy = reflect.New(mapType.Elem()).Elem() // addressable V - valptr := reflect.New(reflect.PtrTo(valcopy.Type())).Elem() // addressable *V - valptr.Set(valcopy.Addr()) // - valbase = toStructPointer(valptr.Addr()) // **V - } - return -} - -// Encode a struct. -func (o *Buffer) enc_struct(prop *StructProperties, base structPointer) error { - var state errorState - // Encode fields in tag order so that decoders may use optimizations - // that depend on the ordering. - // https://developers.google.com/protocol-buffers/docs/encoding#order - for _, i := range prop.order { - p := prop.Prop[i] - if p.enc != nil { - err := p.enc(o, p, base) - if err != nil { - if err == ErrNil { - if p.Required && state.err == nil { - state.err = &RequiredNotSetError{p.Name} - } - } else if err == errRepeatedHasNil { - // Give more context to nil values in repeated fields. - return errors.New("repeated field " + p.OrigName + " has nil element") - } else if !state.shouldContinue(err, p) { - return err - } - } - if len(o.buf) > maxMarshalSize { - return ErrTooLarge - } - } - } - - // Do oneof fields. - if prop.oneofMarshaler != nil { - m := structPointer_Interface(base, prop.stype).(Message) - if err := prop.oneofMarshaler(m, o); err == ErrNil { - return errOneofHasNil - } else if err != nil { - return err - } - } - - // Add unrecognized fields at the end. - if prop.unrecField.IsValid() { - v := *structPointer_Bytes(base, prop.unrecField) - if len(o.buf)+len(v) > maxMarshalSize { - return ErrTooLarge - } - if len(v) > 0 { - o.buf = append(o.buf, v...) - } - } - - return state.err -} - -func size_struct(prop *StructProperties, base structPointer) (n int) { - for _, i := range prop.order { - p := prop.Prop[i] - if p.size != nil { - n += p.size(p, base) - } - } - - // Add unrecognized fields at the end. - if prop.unrecField.IsValid() { - v := *structPointer_Bytes(base, prop.unrecField) - n += len(v) - } - - // Factor in any oneof fields. - if prop.oneofSizer != nil { - m := structPointer_Interface(base, prop.stype).(Message) - n += prop.oneofSizer(m) - } - - return -} - -var zeroes [20]byte // longer than any conceivable sizeVarint - -// Encode a struct, preceded by its encoded length (as a varint). -func (o *Buffer) enc_len_struct(prop *StructProperties, base structPointer, state *errorState) error { - return o.enc_len_thing(func() error { return o.enc_struct(prop, base) }, state) -} - -// Encode something, preceded by its encoded length (as a varint). -func (o *Buffer) enc_len_thing(enc func() error, state *errorState) error { - iLen := len(o.buf) - o.buf = append(o.buf, 0, 0, 0, 0) // reserve four bytes for length - iMsg := len(o.buf) - err := enc() - if err != nil && !state.shouldContinue(err, nil) { - return err - } - lMsg := len(o.buf) - iMsg - lLen := sizeVarint(uint64(lMsg)) - switch x := lLen - (iMsg - iLen); { - case x > 0: // actual length is x bytes larger than the space we reserved - // Move msg x bytes right. - o.buf = append(o.buf, zeroes[:x]...) - copy(o.buf[iMsg+x:], o.buf[iMsg:iMsg+lMsg]) - case x < 0: // actual length is x bytes smaller than the space we reserved - // Move msg x bytes left. - copy(o.buf[iMsg+x:], o.buf[iMsg:iMsg+lMsg]) - o.buf = o.buf[:len(o.buf)+x] // x is negative - } - // Encode the length in the reserved space. - o.buf = o.buf[:iLen] - o.EncodeVarint(uint64(lMsg)) - o.buf = o.buf[:len(o.buf)+lMsg] - return state.err -} - -// errorState maintains the first error that occurs and updates that error -// with additional context. -type errorState struct { - err error -} - -// shouldContinue reports whether encoding should continue upon encountering the -// given error. If the error is RequiredNotSetError, shouldContinue returns true -// and, if this is the first appearance of that error, remembers it for future -// reporting. -// -// If prop is not nil, it may update any error with additional context about the -// field with the error. -func (s *errorState) shouldContinue(err error, prop *Properties) bool { - // Ignore unset required fields. - reqNotSet, ok := err.(*RequiredNotSetError) - if !ok { - return false - } - if s.err == nil { - if prop != nil { - err = &RequiredNotSetError{prop.Name + "." + reqNotSet.field} - } - s.err = err - } - return true -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/equal.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/equal.go deleted file mode 100644 index 2ed1cf59666..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/equal.go +++ /dev/null @@ -1,300 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2011 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -// Protocol buffer comparison. - -package proto - -import ( - "bytes" - "log" - "reflect" - "strings" -) - -/* -Equal returns true iff protocol buffers a and b are equal. -The arguments must both be pointers to protocol buffer structs. - -Equality is defined in this way: - - Two messages are equal iff they are the same type, - corresponding fields are equal, unknown field sets - are equal, and extensions sets are equal. - - Two set scalar fields are equal iff their values are equal. - If the fields are of a floating-point type, remember that - NaN != x for all x, including NaN. If the message is defined - in a proto3 .proto file, fields are not "set"; specifically, - zero length proto3 "bytes" fields are equal (nil == {}). - - Two repeated fields are equal iff their lengths are the same, - and their corresponding elements are equal. Note a "bytes" field, - although represented by []byte, is not a repeated field and the - rule for the scalar fields described above applies. - - Two unset fields are equal. - - Two unknown field sets are equal if their current - encoded state is equal. - - Two extension sets are equal iff they have corresponding - elements that are pairwise equal. - - Two map fields are equal iff their lengths are the same, - and they contain the same set of elements. Zero-length map - fields are equal. - - Every other combination of things are not equal. - -The return value is undefined if a and b are not protocol buffers. -*/ -func Equal(a, b Message) bool { - if a == nil || b == nil { - return a == b - } - v1, v2 := reflect.ValueOf(a), reflect.ValueOf(b) - if v1.Type() != v2.Type() { - return false - } - if v1.Kind() == reflect.Ptr { - if v1.IsNil() { - return v2.IsNil() - } - if v2.IsNil() { - return false - } - v1, v2 = v1.Elem(), v2.Elem() - } - if v1.Kind() != reflect.Struct { - return false - } - return equalStruct(v1, v2) -} - -// v1 and v2 are known to have the same type. -func equalStruct(v1, v2 reflect.Value) bool { - sprop := GetProperties(v1.Type()) - for i := 0; i < v1.NumField(); i++ { - f := v1.Type().Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - f1, f2 := v1.Field(i), v2.Field(i) - if f.Type.Kind() == reflect.Ptr { - if n1, n2 := f1.IsNil(), f2.IsNil(); n1 && n2 { - // both unset - continue - } else if n1 != n2 { - // set/unset mismatch - return false - } - b1, ok := f1.Interface().(raw) - if ok { - b2 := f2.Interface().(raw) - // RawMessage - if !bytes.Equal(b1.Bytes(), b2.Bytes()) { - return false - } - continue - } - f1, f2 = f1.Elem(), f2.Elem() - } - if !equalAny(f1, f2, sprop.Prop[i]) { - return false - } - } - - if em1 := v1.FieldByName("XXX_InternalExtensions"); em1.IsValid() { - em2 := v2.FieldByName("XXX_InternalExtensions") - if !equalExtensions(v1.Type(), em1.Interface().(XXX_InternalExtensions), em2.Interface().(XXX_InternalExtensions)) { - return false - } - } - - if em1 := v1.FieldByName("XXX_extensions"); em1.IsValid() { - em2 := v2.FieldByName("XXX_extensions") - if !equalExtMap(v1.Type(), em1.Interface().(map[int32]Extension), em2.Interface().(map[int32]Extension)) { - return false - } - } - - uf := v1.FieldByName("XXX_unrecognized") - if !uf.IsValid() { - return true - } - - u1 := uf.Bytes() - u2 := v2.FieldByName("XXX_unrecognized").Bytes() - if !bytes.Equal(u1, u2) { - return false - } - - return true -} - -// v1 and v2 are known to have the same type. -// prop may be nil. -func equalAny(v1, v2 reflect.Value, prop *Properties) bool { - if v1.Type() == protoMessageType { - m1, _ := v1.Interface().(Message) - m2, _ := v2.Interface().(Message) - return Equal(m1, m2) - } - switch v1.Kind() { - case reflect.Bool: - return v1.Bool() == v2.Bool() - case reflect.Float32, reflect.Float64: - return v1.Float() == v2.Float() - case reflect.Int32, reflect.Int64: - return v1.Int() == v2.Int() - case reflect.Interface: - // Probably a oneof field; compare the inner values. - n1, n2 := v1.IsNil(), v2.IsNil() - if n1 || n2 { - return n1 == n2 - } - e1, e2 := v1.Elem(), v2.Elem() - if e1.Type() != e2.Type() { - return false - } - return equalAny(e1, e2, nil) - case reflect.Map: - if v1.Len() != v2.Len() { - return false - } - for _, key := range v1.MapKeys() { - val2 := v2.MapIndex(key) - if !val2.IsValid() { - // This key was not found in the second map. - return false - } - if !equalAny(v1.MapIndex(key), val2, nil) { - return false - } - } - return true - case reflect.Ptr: - // Maps may have nil values in them, so check for nil. - if v1.IsNil() && v2.IsNil() { - return true - } - if v1.IsNil() != v2.IsNil() { - return false - } - return equalAny(v1.Elem(), v2.Elem(), prop) - case reflect.Slice: - if v1.Type().Elem().Kind() == reflect.Uint8 { - // short circuit: []byte - - // Edge case: if this is in a proto3 message, a zero length - // bytes field is considered the zero value. - if prop != nil && prop.proto3 && v1.Len() == 0 && v2.Len() == 0 { - return true - } - if v1.IsNil() != v2.IsNil() { - return false - } - return bytes.Equal(v1.Interface().([]byte), v2.Interface().([]byte)) - } - - if v1.Len() != v2.Len() { - return false - } - for i := 0; i < v1.Len(); i++ { - if !equalAny(v1.Index(i), v2.Index(i), prop) { - return false - } - } - return true - case reflect.String: - return v1.Interface().(string) == v2.Interface().(string) - case reflect.Struct: - return equalStruct(v1, v2) - case reflect.Uint32, reflect.Uint64: - return v1.Uint() == v2.Uint() - } - - // unknown type, so not a protocol buffer - log.Printf("proto: don't know how to compare %v", v1) - return false -} - -// base is the struct type that the extensions are based on. -// x1 and x2 are InternalExtensions. -func equalExtensions(base reflect.Type, x1, x2 XXX_InternalExtensions) bool { - em1, _ := x1.extensionsRead() - em2, _ := x2.extensionsRead() - return equalExtMap(base, em1, em2) -} - -func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool { - if len(em1) != len(em2) { - return false - } - - for extNum, e1 := range em1 { - e2, ok := em2[extNum] - if !ok { - return false - } - - m1, m2 := e1.value, e2.value - - if m1 != nil && m2 != nil { - // Both are unencoded. - if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { - return false - } - continue - } - - // At least one is encoded. To do a semantically correct comparison - // we need to unmarshal them first. - var desc *ExtensionDesc - if m := extensionMaps[base]; m != nil { - desc = m[extNum] - } - if desc == nil { - log.Printf("proto: don't know how to compare extension %d of %v", extNum, base) - continue - } - var err error - if m1 == nil { - m1, err = decodeExtension(e1.enc, desc) - } - if m2 == nil && err == nil { - m2, err = decodeExtension(e2.enc, desc) - } - if err != nil { - // The encoded form is invalid. - log.Printf("proto: badly encoded extension %d of %v: %v", extNum, base, err) - return false - } - if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { - return false - } - } - - return true -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/extensions.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/extensions.go deleted file mode 100644 index eaad2183126..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/extensions.go +++ /dev/null @@ -1,587 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -/* - * Types and routines for supporting protocol buffer extensions. - */ - -import ( - "errors" - "fmt" - "reflect" - "strconv" - "sync" -) - -// ErrMissingExtension is the error returned by GetExtension if the named extension is not in the message. -var ErrMissingExtension = errors.New("proto: missing extension") - -// ExtensionRange represents a range of message extensions for a protocol buffer. -// Used in code generated by the protocol compiler. -type ExtensionRange struct { - Start, End int32 // both inclusive -} - -// extendableProto is an interface implemented by any protocol buffer generated by the current -// proto compiler that may be extended. -type extendableProto interface { - Message - ExtensionRangeArray() []ExtensionRange - extensionsWrite() map[int32]Extension - extensionsRead() (map[int32]Extension, sync.Locker) -} - -// extendableProtoV1 is an interface implemented by a protocol buffer generated by the previous -// version of the proto compiler that may be extended. -type extendableProtoV1 interface { - Message - ExtensionRangeArray() []ExtensionRange - ExtensionMap() map[int32]Extension -} - -// extensionAdapter is a wrapper around extendableProtoV1 that implements extendableProto. -type extensionAdapter struct { - extendableProtoV1 -} - -func (e extensionAdapter) extensionsWrite() map[int32]Extension { - return e.ExtensionMap() -} - -func (e extensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) { - return e.ExtensionMap(), notLocker{} -} - -// notLocker is a sync.Locker whose Lock and Unlock methods are nops. -type notLocker struct{} - -func (n notLocker) Lock() {} -func (n notLocker) Unlock() {} - -// extendable returns the extendableProto interface for the given generated proto message. -// If the proto message has the old extension format, it returns a wrapper that implements -// the extendableProto interface. -func extendable(p interface{}) (extendableProto, bool) { - if ep, ok := p.(extendableProto); ok { - return ep, ok - } - if ep, ok := p.(extendableProtoV1); ok { - return extensionAdapter{ep}, ok - } - return nil, false -} - -// XXX_InternalExtensions is an internal representation of proto extensions. -// -// Each generated message struct type embeds an anonymous XXX_InternalExtensions field, -// thus gaining the unexported 'extensions' method, which can be called only from the proto package. -// -// The methods of XXX_InternalExtensions are not concurrency safe in general, -// but calls to logically read-only methods such as has and get may be executed concurrently. -type XXX_InternalExtensions struct { - // The struct must be indirect so that if a user inadvertently copies a - // generated message and its embedded XXX_InternalExtensions, they - // avoid the mayhem of a copied mutex. - // - // The mutex serializes all logically read-only operations to p.extensionMap. - // It is up to the client to ensure that write operations to p.extensionMap are - // mutually exclusive with other accesses. - p *struct { - mu sync.Mutex - extensionMap map[int32]Extension - } -} - -// extensionsWrite returns the extension map, creating it on first use. -func (e *XXX_InternalExtensions) extensionsWrite() map[int32]Extension { - if e.p == nil { - e.p = new(struct { - mu sync.Mutex - extensionMap map[int32]Extension - }) - e.p.extensionMap = make(map[int32]Extension) - } - return e.p.extensionMap -} - -// extensionsRead returns the extensions map for read-only use. It may be nil. -// The caller must hold the returned mutex's lock when accessing Elements within the map. -func (e *XXX_InternalExtensions) extensionsRead() (map[int32]Extension, sync.Locker) { - if e.p == nil { - return nil, nil - } - return e.p.extensionMap, &e.p.mu -} - -var extendableProtoType = reflect.TypeOf((*extendableProto)(nil)).Elem() -var extendableProtoV1Type = reflect.TypeOf((*extendableProtoV1)(nil)).Elem() - -// ExtensionDesc represents an extension specification. -// Used in generated code from the protocol compiler. -type ExtensionDesc struct { - ExtendedType Message // nil pointer to the type that is being extended - ExtensionType interface{} // nil pointer to the extension type - Field int32 // field number - Name string // fully-qualified name of extension, for text formatting - Tag string // protobuf tag style - Filename string // name of the file in which the extension is defined -} - -func (ed *ExtensionDesc) repeated() bool { - t := reflect.TypeOf(ed.ExtensionType) - return t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 -} - -// Extension represents an extension in a message. -type Extension struct { - // When an extension is stored in a message using SetExtension - // only desc and value are set. When the message is marshaled - // enc will be set to the encoded form of the message. - // - // When a message is unmarshaled and contains extensions, each - // extension will have only enc set. When such an extension is - // accessed using GetExtension (or GetExtensions) desc and value - // will be set. - desc *ExtensionDesc - value interface{} - enc []byte -} - -// SetRawExtension is for testing only. -func SetRawExtension(base Message, id int32, b []byte) { - epb, ok := extendable(base) - if !ok { - return - } - extmap := epb.extensionsWrite() - extmap[id] = Extension{enc: b} -} - -// isExtensionField returns true iff the given field number is in an extension range. -func isExtensionField(pb extendableProto, field int32) bool { - for _, er := range pb.ExtensionRangeArray() { - if er.Start <= field && field <= er.End { - return true - } - } - return false -} - -// checkExtensionTypes checks that the given extension is valid for pb. -func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error { - var pbi interface{} = pb - // Check the extended type. - if ea, ok := pbi.(extensionAdapter); ok { - pbi = ea.extendableProtoV1 - } - if a, b := reflect.TypeOf(pbi), reflect.TypeOf(extension.ExtendedType); a != b { - return errors.New("proto: bad extended type; " + b.String() + " does not extend " + a.String()) - } - // Check the range. - if !isExtensionField(pb, extension.Field) { - return errors.New("proto: bad extension number; not in declared ranges") - } - return nil -} - -// extPropKey is sufficient to uniquely identify an extension. -type extPropKey struct { - base reflect.Type - field int32 -} - -var extProp = struct { - sync.RWMutex - m map[extPropKey]*Properties -}{ - m: make(map[extPropKey]*Properties), -} - -func extensionProperties(ed *ExtensionDesc) *Properties { - key := extPropKey{base: reflect.TypeOf(ed.ExtendedType), field: ed.Field} - - extProp.RLock() - if prop, ok := extProp.m[key]; ok { - extProp.RUnlock() - return prop - } - extProp.RUnlock() - - extProp.Lock() - defer extProp.Unlock() - // Check again. - if prop, ok := extProp.m[key]; ok { - return prop - } - - prop := new(Properties) - prop.Init(reflect.TypeOf(ed.ExtensionType), "unknown_name", ed.Tag, nil) - extProp.m[key] = prop - return prop -} - -// encode encodes any unmarshaled (unencoded) extensions in e. -func encodeExtensions(e *XXX_InternalExtensions) error { - m, mu := e.extensionsRead() - if m == nil { - return nil // fast path - } - mu.Lock() - defer mu.Unlock() - return encodeExtensionsMap(m) -} - -// encode encodes any unmarshaled (unencoded) extensions in e. -func encodeExtensionsMap(m map[int32]Extension) error { - for k, e := range m { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - et := reflect.TypeOf(e.desc.ExtensionType) - props := extensionProperties(e.desc) - - p := NewBuffer(nil) - // If e.value has type T, the encoder expects a *struct{ X T }. - // Pass a *T with a zero field and hope it all works out. - x := reflect.New(et) - x.Elem().Set(reflect.ValueOf(e.value)) - if err := props.enc(p, props, toStructPointer(x)); err != nil { - return err - } - e.enc = p.buf - m[k] = e - } - return nil -} - -func extensionsSize(e *XXX_InternalExtensions) (n int) { - m, mu := e.extensionsRead() - if m == nil { - return 0 - } - mu.Lock() - defer mu.Unlock() - return extensionsMapSize(m) -} - -func extensionsMapSize(m map[int32]Extension) (n int) { - for _, e := range m { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - n += len(e.enc) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - et := reflect.TypeOf(e.desc.ExtensionType) - props := extensionProperties(e.desc) - - // If e.value has type T, the encoder expects a *struct{ X T }. - // Pass a *T with a zero field and hope it all works out. - x := reflect.New(et) - x.Elem().Set(reflect.ValueOf(e.value)) - n += props.size(props, toStructPointer(x)) - } - return -} - -// HasExtension returns whether the given extension is present in pb. -func HasExtension(pb Message, extension *ExtensionDesc) bool { - // TODO: Check types, field numbers, etc.? - epb, ok := extendable(pb) - if !ok { - return false - } - extmap, mu := epb.extensionsRead() - if extmap == nil { - return false - } - mu.Lock() - _, ok = extmap[extension.Field] - mu.Unlock() - return ok -} - -// ClearExtension removes the given extension from pb. -func ClearExtension(pb Message, extension *ExtensionDesc) { - epb, ok := extendable(pb) - if !ok { - return - } - // TODO: Check types, field numbers, etc.? - extmap := epb.extensionsWrite() - delete(extmap, extension.Field) -} - -// GetExtension parses and returns the given extension of pb. -// If the extension is not present and has no default value it returns ErrMissingExtension. -func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { - epb, ok := extendable(pb) - if !ok { - return nil, errors.New("proto: not an extendable proto") - } - - if err := checkExtensionTypes(epb, extension); err != nil { - return nil, err - } - - emap, mu := epb.extensionsRead() - if emap == nil { - return defaultExtensionValue(extension) - } - mu.Lock() - defer mu.Unlock() - e, ok := emap[extension.Field] - if !ok { - // defaultExtensionValue returns the default value or - // ErrMissingExtension if there is no default. - return defaultExtensionValue(extension) - } - - if e.value != nil { - // Already decoded. Check the descriptor, though. - if e.desc != extension { - // This shouldn't happen. If it does, it means that - // GetExtension was called twice with two different - // descriptors with the same field number. - return nil, errors.New("proto: descriptor conflict") - } - return e.value, nil - } - - v, err := decodeExtension(e.enc, extension) - if err != nil { - return nil, err - } - - // Remember the decoded version and drop the encoded version. - // That way it is safe to mutate what we return. - e.value = v - e.desc = extension - e.enc = nil - emap[extension.Field] = e - return e.value, nil -} - -// defaultExtensionValue returns the default value for extension. -// If no default for an extension is defined ErrMissingExtension is returned. -func defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) { - t := reflect.TypeOf(extension.ExtensionType) - props := extensionProperties(extension) - - sf, _, err := fieldDefault(t, props) - if err != nil { - return nil, err - } - - if sf == nil || sf.value == nil { - // There is no default value. - return nil, ErrMissingExtension - } - - if t.Kind() != reflect.Ptr { - // We do not need to return a Ptr, we can directly return sf.value. - return sf.value, nil - } - - // We need to return an interface{} that is a pointer to sf.value. - value := reflect.New(t).Elem() - value.Set(reflect.New(value.Type().Elem())) - if sf.kind == reflect.Int32 { - // We may have an int32 or an enum, but the underlying data is int32. - // Since we can't set an int32 into a non int32 reflect.value directly - // set it as a int32. - value.Elem().SetInt(int64(sf.value.(int32))) - } else { - value.Elem().Set(reflect.ValueOf(sf.value)) - } - return value.Interface(), nil -} - -// decodeExtension decodes an extension encoded in b. -func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) { - o := NewBuffer(b) - - t := reflect.TypeOf(extension.ExtensionType) - - props := extensionProperties(extension) - - // t is a pointer to a struct, pointer to basic type or a slice. - // Allocate a "field" to store the pointer/slice itself; the - // pointer/slice will be stored here. We pass - // the address of this field to props.dec. - // This passes a zero field and a *t and lets props.dec - // interpret it as a *struct{ x t }. - value := reflect.New(t).Elem() - - for { - // Discard wire type and field number varint. It isn't needed. - if _, err := o.DecodeVarint(); err != nil { - return nil, err - } - - if err := props.dec(o, props, toStructPointer(value.Addr())); err != nil { - return nil, err - } - - if o.index >= len(o.buf) { - break - } - } - return value.Interface(), nil -} - -// GetExtensions returns a slice of the extensions present in pb that are also listed in es. -// The returned slice has the same length as es; missing extensions will appear as nil elements. -func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) { - epb, ok := extendable(pb) - if !ok { - return nil, errors.New("proto: not an extendable proto") - } - extensions = make([]interface{}, len(es)) - for i, e := range es { - extensions[i], err = GetExtension(epb, e) - if err == ErrMissingExtension { - err = nil - } - if err != nil { - return - } - } - return -} - -// ExtensionDescs returns a new slice containing pb's extension descriptors, in undefined order. -// For non-registered extensions, ExtensionDescs returns an incomplete descriptor containing -// just the Field field, which defines the extension's field number. -func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) { - epb, ok := extendable(pb) - if !ok { - return nil, fmt.Errorf("proto: %T is not an extendable proto.Message", pb) - } - registeredExtensions := RegisteredExtensions(pb) - - emap, mu := epb.extensionsRead() - if emap == nil { - return nil, nil - } - mu.Lock() - defer mu.Unlock() - extensions := make([]*ExtensionDesc, 0, len(emap)) - for extid, e := range emap { - desc := e.desc - if desc == nil { - desc = registeredExtensions[extid] - if desc == nil { - desc = &ExtensionDesc{Field: extid} - } - } - - extensions = append(extensions, desc) - } - return extensions, nil -} - -// SetExtension sets the specified extension of pb to the specified value. -func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error { - epb, ok := extendable(pb) - if !ok { - return errors.New("proto: not an extendable proto") - } - if err := checkExtensionTypes(epb, extension); err != nil { - return err - } - typ := reflect.TypeOf(extension.ExtensionType) - if typ != reflect.TypeOf(value) { - return errors.New("proto: bad extension value type") - } - // nil extension values need to be caught early, because the - // encoder can't distinguish an ErrNil due to a nil extension - // from an ErrNil due to a missing field. Extensions are - // always optional, so the encoder would just swallow the error - // and drop all the extensions from the encoded message. - if reflect.ValueOf(value).IsNil() { - return fmt.Errorf("proto: SetExtension called with nil value of type %T", value) - } - - extmap := epb.extensionsWrite() - extmap[extension.Field] = Extension{desc: extension, value: value} - return nil -} - -// ClearAllExtensions clears all extensions from pb. -func ClearAllExtensions(pb Message) { - epb, ok := extendable(pb) - if !ok { - return - } - m := epb.extensionsWrite() - for k := range m { - delete(m, k) - } -} - -// A global registry of extensions. -// The generated code will register the generated descriptors by calling RegisterExtension. - -var extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc) - -// RegisterExtension is called from the generated code. -func RegisterExtension(desc *ExtensionDesc) { - st := reflect.TypeOf(desc.ExtendedType).Elem() - m := extensionMaps[st] - if m == nil { - m = make(map[int32]*ExtensionDesc) - extensionMaps[st] = m - } - if _, ok := m[desc.Field]; ok { - panic("proto: duplicate extension registered: " + st.String() + " " + strconv.Itoa(int(desc.Field))) - } - m[desc.Field] = desc -} - -// RegisteredExtensions returns a map of the registered extensions of a -// protocol buffer struct, indexed by the extension number. -// The argument pb should be a nil pointer to the struct type. -func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc { - return extensionMaps[reflect.TypeOf(pb).Elem()] -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/lib.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/lib.go deleted file mode 100644 index ac4ddbc0759..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/lib.go +++ /dev/null @@ -1,898 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -/* -Package proto converts data structures to and from the wire format of -protocol buffers. It works in concert with the Go source code generated -for .proto files by the protocol compiler. - -A summary of the properties of the protocol buffer interface -for a protocol buffer variable v: - - - Names are turned from camel_case to CamelCase for export. - - There are no methods on v to set fields; just treat - them as structure fields. - - There are getters that return a field's value if set, - and return the field's default value if unset. - The getters work even if the receiver is a nil message. - - The zero value for a struct is its correct initialization state. - All desired fields must be set before marshaling. - - A Reset() method will restore a protobuf struct to its zero state. - - Non-repeated fields are pointers to the values; nil means unset. - That is, optional or required field int32 f becomes F *int32. - - Repeated fields are slices. - - Helper functions are available to aid the setting of fields. - msg.Foo = proto.String("hello") // set field - - Constants are defined to hold the default values of all fields that - have them. They have the form Default_StructName_FieldName. - Because the getter methods handle defaulted values, - direct use of these constants should be rare. - - Enums are given type names and maps from names to values. - Enum values are prefixed by the enclosing message's name, or by the - enum's type name if it is a top-level enum. Enum types have a String - method, and a Enum method to assist in message construction. - - Nested messages, groups and enums have type names prefixed with the name of - the surrounding message type. - - Extensions are given descriptor names that start with E_, - followed by an underscore-delimited list of the nested messages - that contain it (if any) followed by the CamelCased name of the - extension field itself. HasExtension, ClearExtension, GetExtension - and SetExtension are functions for manipulating extensions. - - Oneof field sets are given a single field in their message, - with distinguished wrapper types for each possible field value. - - Marshal and Unmarshal are functions to encode and decode the wire format. - -When the .proto file specifies `syntax="proto3"`, there are some differences: - - - Non-repeated fields of non-message type are values instead of pointers. - - Getters are only generated for message and oneof fields. - - Enum types do not get an Enum method. - -The simplest way to describe this is to see an example. -Given file test.proto, containing - - package example; - - enum FOO { X = 17; } - - message Test { - required string label = 1; - optional int32 type = 2 [default=77]; - repeated int64 reps = 3; - optional group OptionalGroup = 4 { - required string RequiredField = 5; - } - oneof union { - int32 number = 6; - string name = 7; - } - } - -The resulting file, test.pb.go, is: - - package example - - import proto "github.com/golang/protobuf/proto" - import math "math" - - type FOO int32 - const ( - FOO_X FOO = 17 - ) - var FOO_name = map[int32]string{ - 17: "X", - } - var FOO_value = map[string]int32{ - "X": 17, - } - - func (x FOO) Enum() *FOO { - p := new(FOO) - *p = x - return p - } - func (x FOO) String() string { - return proto.EnumName(FOO_name, int32(x)) - } - func (x *FOO) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FOO_value, data) - if err != nil { - return err - } - *x = FOO(value) - return nil - } - - type Test struct { - Label *string `protobuf:"bytes,1,req,name=label" json:"label,omitempty"` - Type *int32 `protobuf:"varint,2,opt,name=type,def=77" json:"type,omitempty"` - Reps []int64 `protobuf:"varint,3,rep,name=reps" json:"reps,omitempty"` - Optionalgroup *Test_OptionalGroup `protobuf:"group,4,opt,name=OptionalGroup" json:"optionalgroup,omitempty"` - // Types that are valid to be assigned to Union: - // *Test_Number - // *Test_Name - Union isTest_Union `protobuf_oneof:"union"` - XXX_unrecognized []byte `json:"-"` - } - func (m *Test) Reset() { *m = Test{} } - func (m *Test) String() string { return proto.CompactTextString(m) } - func (*Test) ProtoMessage() {} - - type isTest_Union interface { - isTest_Union() - } - - type Test_Number struct { - Number int32 `protobuf:"varint,6,opt,name=number"` - } - type Test_Name struct { - Name string `protobuf:"bytes,7,opt,name=name"` - } - - func (*Test_Number) isTest_Union() {} - func (*Test_Name) isTest_Union() {} - - func (m *Test) GetUnion() isTest_Union { - if m != nil { - return m.Union - } - return nil - } - const Default_Test_Type int32 = 77 - - func (m *Test) GetLabel() string { - if m != nil && m.Label != nil { - return *m.Label - } - return "" - } - - func (m *Test) GetType() int32 { - if m != nil && m.Type != nil { - return *m.Type - } - return Default_Test_Type - } - - func (m *Test) GetOptionalgroup() *Test_OptionalGroup { - if m != nil { - return m.Optionalgroup - } - return nil - } - - type Test_OptionalGroup struct { - RequiredField *string `protobuf:"bytes,5,req" json:"RequiredField,omitempty"` - } - func (m *Test_OptionalGroup) Reset() { *m = Test_OptionalGroup{} } - func (m *Test_OptionalGroup) String() string { return proto.CompactTextString(m) } - - func (m *Test_OptionalGroup) GetRequiredField() string { - if m != nil && m.RequiredField != nil { - return *m.RequiredField - } - return "" - } - - func (m *Test) GetNumber() int32 { - if x, ok := m.GetUnion().(*Test_Number); ok { - return x.Number - } - return 0 - } - - func (m *Test) GetName() string { - if x, ok := m.GetUnion().(*Test_Name); ok { - return x.Name - } - return "" - } - - func init() { - proto.RegisterEnum("example.FOO", FOO_name, FOO_value) - } - -To create and play with a Test object: - - package main - - import ( - "log" - - "github.com/golang/protobuf/proto" - pb "./example.pb" - ) - - func main() { - test := &pb.Test{ - Label: proto.String("hello"), - Type: proto.Int32(17), - Reps: []int64{1, 2, 3}, - Optionalgroup: &pb.Test_OptionalGroup{ - RequiredField: proto.String("good bye"), - }, - Union: &pb.Test_Name{"fred"}, - } - data, err := proto.Marshal(test) - if err != nil { - log.Fatal("marshaling error: ", err) - } - newTest := &pb.Test{} - err = proto.Unmarshal(data, newTest) - if err != nil { - log.Fatal("unmarshaling error: ", err) - } - // Now test and newTest contain the same data. - if test.GetLabel() != newTest.GetLabel() { - log.Fatalf("data mismatch %q != %q", test.GetLabel(), newTest.GetLabel()) - } - // Use a type switch to determine which oneof was set. - switch u := test.Union.(type) { - case *pb.Test_Number: // u.Number contains the number. - case *pb.Test_Name: // u.Name contains the string. - } - // etc. - } -*/ -package proto - -import ( - "encoding/json" - "fmt" - "log" - "reflect" - "sort" - "strconv" - "sync" -) - -// Message is implemented by generated protocol buffer messages. -type Message interface { - Reset() - String() string - ProtoMessage() -} - -// Stats records allocation details about the protocol buffer encoders -// and decoders. Useful for tuning the library itself. -type Stats struct { - Emalloc uint64 // mallocs in encode - Dmalloc uint64 // mallocs in decode - Encode uint64 // number of encodes - Decode uint64 // number of decodes - Chit uint64 // number of cache hits - Cmiss uint64 // number of cache misses - Size uint64 // number of sizes -} - -// Set to true to enable stats collection. -const collectStats = false - -var stats Stats - -// GetStats returns a copy of the global Stats structure. -func GetStats() Stats { return stats } - -// A Buffer is a buffer manager for marshaling and unmarshaling -// protocol buffers. It may be reused between invocations to -// reduce memory usage. It is not necessary to use a Buffer; -// the global functions Marshal and Unmarshal create a -// temporary Buffer and are fine for most applications. -type Buffer struct { - buf []byte // encode/decode byte stream - index int // read point - - // pools of basic types to amortize allocation. - bools []bool - uint32s []uint32 - uint64s []uint64 - - // extra pools, only used with pointer_reflect.go - int32s []int32 - int64s []int64 - float32s []float32 - float64s []float64 -} - -// NewBuffer allocates a new Buffer and initializes its internal data to -// the contents of the argument slice. -func NewBuffer(e []byte) *Buffer { - return &Buffer{buf: e} -} - -// Reset resets the Buffer, ready for marshaling a new protocol buffer. -func (p *Buffer) Reset() { - p.buf = p.buf[0:0] // for reading/writing - p.index = 0 // for reading -} - -// SetBuf replaces the internal buffer with the slice, -// ready for unmarshaling the contents of the slice. -func (p *Buffer) SetBuf(s []byte) { - p.buf = s - p.index = 0 -} - -// Bytes returns the contents of the Buffer. -func (p *Buffer) Bytes() []byte { return p.buf } - -/* - * Helper routines for simplifying the creation of optional fields of basic type. - */ - -// Bool is a helper routine that allocates a new bool value -// to store v and returns a pointer to it. -func Bool(v bool) *bool { - return &v -} - -// Int32 is a helper routine that allocates a new int32 value -// to store v and returns a pointer to it. -func Int32(v int32) *int32 { - return &v -} - -// Int is a helper routine that allocates a new int32 value -// to store v and returns a pointer to it, but unlike Int32 -// its argument value is an int. -func Int(v int) *int32 { - p := new(int32) - *p = int32(v) - return p -} - -// Int64 is a helper routine that allocates a new int64 value -// to store v and returns a pointer to it. -func Int64(v int64) *int64 { - return &v -} - -// Float32 is a helper routine that allocates a new float32 value -// to store v and returns a pointer to it. -func Float32(v float32) *float32 { - return &v -} - -// Float64 is a helper routine that allocates a new float64 value -// to store v and returns a pointer to it. -func Float64(v float64) *float64 { - return &v -} - -// Uint32 is a helper routine that allocates a new uint32 value -// to store v and returns a pointer to it. -func Uint32(v uint32) *uint32 { - return &v -} - -// Uint64 is a helper routine that allocates a new uint64 value -// to store v and returns a pointer to it. -func Uint64(v uint64) *uint64 { - return &v -} - -// String is a helper routine that allocates a new string value -// to store v and returns a pointer to it. -func String(v string) *string { - return &v -} - -// EnumName is a helper function to simplify printing protocol buffer enums -// by name. Given an enum map and a value, it returns a useful string. -func EnumName(m map[int32]string, v int32) string { - s, ok := m[v] - if ok { - return s - } - return strconv.Itoa(int(v)) -} - -// UnmarshalJSONEnum is a helper function to simplify recovering enum int values -// from their JSON-encoded representation. Given a map from the enum's symbolic -// names to its int values, and a byte buffer containing the JSON-encoded -// value, it returns an int32 that can be cast to the enum type by the caller. -// -// The function can deal with both JSON representations, numeric and symbolic. -func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) { - if data[0] == '"' { - // New style: enums are strings. - var repr string - if err := json.Unmarshal(data, &repr); err != nil { - return -1, err - } - val, ok := m[repr] - if !ok { - return 0, fmt.Errorf("unrecognized enum %s value %q", enumName, repr) - } - return val, nil - } - // Old style: enums are ints. - var val int32 - if err := json.Unmarshal(data, &val); err != nil { - return 0, fmt.Errorf("cannot unmarshal %#q into enum %s", data, enumName) - } - return val, nil -} - -// DebugPrint dumps the encoded data in b in a debugging format with a header -// including the string s. Used in testing but made available for general debugging. -func (p *Buffer) DebugPrint(s string, b []byte) { - var u uint64 - - obuf := p.buf - index := p.index - p.buf = b - p.index = 0 - depth := 0 - - fmt.Printf("\n--- %s ---\n", s) - -out: - for { - for i := 0; i < depth; i++ { - fmt.Print(" ") - } - - index := p.index - if index == len(p.buf) { - break - } - - op, err := p.DecodeVarint() - if err != nil { - fmt.Printf("%3d: fetching op err %v\n", index, err) - break out - } - tag := op >> 3 - wire := op & 7 - - switch wire { - default: - fmt.Printf("%3d: t=%3d unknown wire=%d\n", - index, tag, wire) - break out - - case WireBytes: - var r []byte - - r, err = p.DecodeRawBytes(false) - if err != nil { - break out - } - fmt.Printf("%3d: t=%3d bytes [%d]", index, tag, len(r)) - if len(r) <= 6 { - for i := 0; i < len(r); i++ { - fmt.Printf(" %.2x", r[i]) - } - } else { - for i := 0; i < 3; i++ { - fmt.Printf(" %.2x", r[i]) - } - fmt.Printf(" ..") - for i := len(r) - 3; i < len(r); i++ { - fmt.Printf(" %.2x", r[i]) - } - } - fmt.Printf("\n") - - case WireFixed32: - u, err = p.DecodeFixed32() - if err != nil { - fmt.Printf("%3d: t=%3d fix32 err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d fix32 %d\n", index, tag, u) - - case WireFixed64: - u, err = p.DecodeFixed64() - if err != nil { - fmt.Printf("%3d: t=%3d fix64 err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d fix64 %d\n", index, tag, u) - - case WireVarint: - u, err = p.DecodeVarint() - if err != nil { - fmt.Printf("%3d: t=%3d varint err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d varint %d\n", index, tag, u) - - case WireStartGroup: - fmt.Printf("%3d: t=%3d start\n", index, tag) - depth++ - - case WireEndGroup: - depth-- - fmt.Printf("%3d: t=%3d end\n", index, tag) - } - } - - if depth != 0 { - fmt.Printf("%3d: start-end not balanced %d\n", p.index, depth) - } - fmt.Printf("\n") - - p.buf = obuf - p.index = index -} - -// SetDefaults sets unset protocol buffer fields to their default values. -// It only modifies fields that are both unset and have defined defaults. -// It recursively sets default values in any non-nil sub-messages. -func SetDefaults(pb Message) { - setDefaults(reflect.ValueOf(pb), true, false) -} - -// v is a pointer to a struct. -func setDefaults(v reflect.Value, recur, zeros bool) { - v = v.Elem() - - defaultMu.RLock() - dm, ok := defaults[v.Type()] - defaultMu.RUnlock() - if !ok { - dm = buildDefaultMessage(v.Type()) - defaultMu.Lock() - defaults[v.Type()] = dm - defaultMu.Unlock() - } - - for _, sf := range dm.scalars { - f := v.Field(sf.index) - if !f.IsNil() { - // field already set - continue - } - dv := sf.value - if dv == nil && !zeros { - // no explicit default, and don't want to set zeros - continue - } - fptr := f.Addr().Interface() // **T - // TODO: Consider batching the allocations we do here. - switch sf.kind { - case reflect.Bool: - b := new(bool) - if dv != nil { - *b = dv.(bool) - } - *(fptr.(**bool)) = b - case reflect.Float32: - f := new(float32) - if dv != nil { - *f = dv.(float32) - } - *(fptr.(**float32)) = f - case reflect.Float64: - f := new(float64) - if dv != nil { - *f = dv.(float64) - } - *(fptr.(**float64)) = f - case reflect.Int32: - // might be an enum - if ft := f.Type(); ft != int32PtrType { - // enum - f.Set(reflect.New(ft.Elem())) - if dv != nil { - f.Elem().SetInt(int64(dv.(int32))) - } - } else { - // int32 field - i := new(int32) - if dv != nil { - *i = dv.(int32) - } - *(fptr.(**int32)) = i - } - case reflect.Int64: - i := new(int64) - if dv != nil { - *i = dv.(int64) - } - *(fptr.(**int64)) = i - case reflect.String: - s := new(string) - if dv != nil { - *s = dv.(string) - } - *(fptr.(**string)) = s - case reflect.Uint8: - // exceptional case: []byte - var b []byte - if dv != nil { - db := dv.([]byte) - b = make([]byte, len(db)) - copy(b, db) - } else { - b = []byte{} - } - *(fptr.(*[]byte)) = b - case reflect.Uint32: - u := new(uint32) - if dv != nil { - *u = dv.(uint32) - } - *(fptr.(**uint32)) = u - case reflect.Uint64: - u := new(uint64) - if dv != nil { - *u = dv.(uint64) - } - *(fptr.(**uint64)) = u - default: - log.Printf("proto: can't set default for field %v (sf.kind=%v)", f, sf.kind) - } - } - - for _, ni := range dm.nested { - f := v.Field(ni) - // f is *T or []*T or map[T]*T - switch f.Kind() { - case reflect.Ptr: - if f.IsNil() { - continue - } - setDefaults(f, recur, zeros) - - case reflect.Slice: - for i := 0; i < f.Len(); i++ { - e := f.Index(i) - if e.IsNil() { - continue - } - setDefaults(e, recur, zeros) - } - - case reflect.Map: - for _, k := range f.MapKeys() { - e := f.MapIndex(k) - if e.IsNil() { - continue - } - setDefaults(e, recur, zeros) - } - } - } -} - -var ( - // defaults maps a protocol buffer struct type to a slice of the fields, - // with its scalar fields set to their proto-declared non-zero default values. - defaultMu sync.RWMutex - defaults = make(map[reflect.Type]defaultMessage) - - int32PtrType = reflect.TypeOf((*int32)(nil)) -) - -// defaultMessage represents information about the default values of a message. -type defaultMessage struct { - scalars []scalarField - nested []int // struct field index of nested messages -} - -type scalarField struct { - index int // struct field index - kind reflect.Kind // element type (the T in *T or []T) - value interface{} // the proto-declared default value, or nil -} - -// t is a struct type. -func buildDefaultMessage(t reflect.Type) (dm defaultMessage) { - sprop := GetProperties(t) - for _, prop := range sprop.Prop { - fi, ok := sprop.decoderTags.get(prop.Tag) - if !ok { - // XXX_unrecognized - continue - } - ft := t.Field(fi).Type - - sf, nested, err := fieldDefault(ft, prop) - switch { - case err != nil: - log.Print(err) - case nested: - dm.nested = append(dm.nested, fi) - case sf != nil: - sf.index = fi - dm.scalars = append(dm.scalars, *sf) - } - } - - return dm -} - -// fieldDefault returns the scalarField for field type ft. -// sf will be nil if the field can not have a default. -// nestedMessage will be true if this is a nested message. -// Note that sf.index is not set on return. -func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMessage bool, err error) { - var canHaveDefault bool - switch ft.Kind() { - case reflect.Ptr: - if ft.Elem().Kind() == reflect.Struct { - nestedMessage = true - } else { - canHaveDefault = true // proto2 scalar field - } - - case reflect.Slice: - switch ft.Elem().Kind() { - case reflect.Ptr: - nestedMessage = true // repeated message - case reflect.Uint8: - canHaveDefault = true // bytes field - } - - case reflect.Map: - if ft.Elem().Kind() == reflect.Ptr { - nestedMessage = true // map with message values - } - } - - if !canHaveDefault { - if nestedMessage { - return nil, true, nil - } - return nil, false, nil - } - - // We now know that ft is a pointer or slice. - sf = &scalarField{kind: ft.Elem().Kind()} - - // scalar fields without defaults - if !prop.HasDefault { - return sf, false, nil - } - - // a scalar field: either *T or []byte - switch ft.Elem().Kind() { - case reflect.Bool: - x, err := strconv.ParseBool(prop.Default) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default bool %q: %v", prop.Default, err) - } - sf.value = x - case reflect.Float32: - x, err := strconv.ParseFloat(prop.Default, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default float32 %q: %v", prop.Default, err) - } - sf.value = float32(x) - case reflect.Float64: - x, err := strconv.ParseFloat(prop.Default, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default float64 %q: %v", prop.Default, err) - } - sf.value = x - case reflect.Int32: - x, err := strconv.ParseInt(prop.Default, 10, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default int32 %q: %v", prop.Default, err) - } - sf.value = int32(x) - case reflect.Int64: - x, err := strconv.ParseInt(prop.Default, 10, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default int64 %q: %v", prop.Default, err) - } - sf.value = x - case reflect.String: - sf.value = prop.Default - case reflect.Uint8: - // []byte (not *uint8) - sf.value = []byte(prop.Default) - case reflect.Uint32: - x, err := strconv.ParseUint(prop.Default, 10, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default uint32 %q: %v", prop.Default, err) - } - sf.value = uint32(x) - case reflect.Uint64: - x, err := strconv.ParseUint(prop.Default, 10, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default uint64 %q: %v", prop.Default, err) - } - sf.value = x - default: - return nil, false, fmt.Errorf("proto: unhandled def kind %v", ft.Elem().Kind()) - } - - return sf, false, nil -} - -// Map fields may have key types of non-float scalars, strings and enums. -// The easiest way to sort them in some deterministic order is to use fmt. -// If this turns out to be inefficient we can always consider other options, -// such as doing a Schwartzian transform. - -func mapKeys(vs []reflect.Value) sort.Interface { - s := mapKeySorter{ - vs: vs, - // default Less function: textual comparison - less: func(a, b reflect.Value) bool { - return fmt.Sprint(a.Interface()) < fmt.Sprint(b.Interface()) - }, - } - - // Type specialization per https://developers.google.com/protocol-buffers/docs/proto#maps; - // numeric keys are sorted numerically. - if len(vs) == 0 { - return s - } - switch vs[0].Kind() { - case reflect.Int32, reflect.Int64: - s.less = func(a, b reflect.Value) bool { return a.Int() < b.Int() } - case reflect.Uint32, reflect.Uint64: - s.less = func(a, b reflect.Value) bool { return a.Uint() < b.Uint() } - } - - return s -} - -type mapKeySorter struct { - vs []reflect.Value - less func(a, b reflect.Value) bool -} - -func (s mapKeySorter) Len() int { return len(s.vs) } -func (s mapKeySorter) Swap(i, j int) { s.vs[i], s.vs[j] = s.vs[j], s.vs[i] } -func (s mapKeySorter) Less(i, j int) bool { - return s.less(s.vs[i], s.vs[j]) -} - -// isProto3Zero reports whether v is a zero proto3 value. -func isProto3Zero(v reflect.Value) bool { - switch v.Kind() { - case reflect.Bool: - return !v.Bool() - case reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint32, reflect.Uint64: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.String: - return v.String() == "" - } - return false -} - -// ProtoPackageIsVersion2 is referenced from generated protocol buffer files -// to assert that that code is compatible with this version of the proto package. -const ProtoPackageIsVersion2 = true - -// ProtoPackageIsVersion1 is referenced from generated protocol buffer files -// to assert that that code is compatible with this version of the proto package. -const ProtoPackageIsVersion1 = true diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/message_set.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/message_set.go deleted file mode 100644 index fd982decd66..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/message_set.go +++ /dev/null @@ -1,311 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -/* - * Support for message sets. - */ - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "reflect" - "sort" -) - -// errNoMessageTypeID occurs when a protocol buffer does not have a message type ID. -// A message type ID is required for storing a protocol buffer in a message set. -var errNoMessageTypeID = errors.New("proto does not have a message type ID") - -// The first two types (_MessageSet_Item and messageSet) -// model what the protocol compiler produces for the following protocol message: -// message MessageSet { -// repeated group Item = 1 { -// required int32 type_id = 2; -// required string message = 3; -// }; -// } -// That is the MessageSet wire format. We can't use a proto to generate these -// because that would introduce a circular dependency between it and this package. - -type _MessageSet_Item struct { - TypeId *int32 `protobuf:"varint,2,req,name=type_id"` - Message []byte `protobuf:"bytes,3,req,name=message"` -} - -type messageSet struct { - Item []*_MessageSet_Item `protobuf:"group,1,rep"` - XXX_unrecognized []byte - // TODO: caching? -} - -// Make sure messageSet is a Message. -var _ Message = (*messageSet)(nil) - -// messageTypeIder is an interface satisfied by a protocol buffer type -// that may be stored in a MessageSet. -type messageTypeIder interface { - MessageTypeId() int32 -} - -func (ms *messageSet) find(pb Message) *_MessageSet_Item { - mti, ok := pb.(messageTypeIder) - if !ok { - return nil - } - id := mti.MessageTypeId() - for _, item := range ms.Item { - if *item.TypeId == id { - return item - } - } - return nil -} - -func (ms *messageSet) Has(pb Message) bool { - if ms.find(pb) != nil { - return true - } - return false -} - -func (ms *messageSet) Unmarshal(pb Message) error { - if item := ms.find(pb); item != nil { - return Unmarshal(item.Message, pb) - } - if _, ok := pb.(messageTypeIder); !ok { - return errNoMessageTypeID - } - return nil // TODO: return error instead? -} - -func (ms *messageSet) Marshal(pb Message) error { - msg, err := Marshal(pb) - if err != nil { - return err - } - if item := ms.find(pb); item != nil { - // reuse existing item - item.Message = msg - return nil - } - - mti, ok := pb.(messageTypeIder) - if !ok { - return errNoMessageTypeID - } - - mtid := mti.MessageTypeId() - ms.Item = append(ms.Item, &_MessageSet_Item{ - TypeId: &mtid, - Message: msg, - }) - return nil -} - -func (ms *messageSet) Reset() { *ms = messageSet{} } -func (ms *messageSet) String() string { return CompactTextString(ms) } -func (*messageSet) ProtoMessage() {} - -// Support for the message_set_wire_format message option. - -func skipVarint(buf []byte) []byte { - i := 0 - for ; buf[i]&0x80 != 0; i++ { - } - return buf[i+1:] -} - -// MarshalMessageSet encodes the extension map represented by m in the message set wire format. -// It is called by generated Marshal methods on protocol buffer messages with the message_set_wire_format option. -func MarshalMessageSet(exts interface{}) ([]byte, error) { - var m map[int32]Extension - switch exts := exts.(type) { - case *XXX_InternalExtensions: - if err := encodeExtensions(exts); err != nil { - return nil, err - } - m, _ = exts.extensionsRead() - case map[int32]Extension: - if err := encodeExtensionsMap(exts); err != nil { - return nil, err - } - m = exts - default: - return nil, errors.New("proto: not an extension map") - } - - // Sort extension IDs to provide a deterministic encoding. - // See also enc_map in encode.go. - ids := make([]int, 0, len(m)) - for id := range m { - ids = append(ids, int(id)) - } - sort.Ints(ids) - - ms := &messageSet{Item: make([]*_MessageSet_Item, 0, len(m))} - for _, id := range ids { - e := m[int32(id)] - // Remove the wire type and field number varint, as well as the length varint. - msg := skipVarint(skipVarint(e.enc)) - - ms.Item = append(ms.Item, &_MessageSet_Item{ - TypeId: Int32(int32(id)), - Message: msg, - }) - } - return Marshal(ms) -} - -// UnmarshalMessageSet decodes the extension map encoded in buf in the message set wire format. -// It is called by generated Unmarshal methods on protocol buffer messages with the message_set_wire_format option. -func UnmarshalMessageSet(buf []byte, exts interface{}) error { - var m map[int32]Extension - switch exts := exts.(type) { - case *XXX_InternalExtensions: - m = exts.extensionsWrite() - case map[int32]Extension: - m = exts - default: - return errors.New("proto: not an extension map") - } - - ms := new(messageSet) - if err := Unmarshal(buf, ms); err != nil { - return err - } - for _, item := range ms.Item { - id := *item.TypeId - msg := item.Message - - // Restore wire type and field number varint, plus length varint. - // Be careful to preserve duplicate items. - b := EncodeVarint(uint64(id)<<3 | WireBytes) - if ext, ok := m[id]; ok { - // Existing data; rip off the tag and length varint - // so we join the new data correctly. - // We can assume that ext.enc is set because we are unmarshaling. - o := ext.enc[len(b):] // skip wire type and field number - _, n := DecodeVarint(o) // calculate length of length varint - o = o[n:] // skip length varint - msg = append(o, msg...) // join old data and new data - } - b = append(b, EncodeVarint(uint64(len(msg)))...) - b = append(b, msg...) - - m[id] = Extension{enc: b} - } - return nil -} - -// MarshalMessageSetJSON encodes the extension map represented by m in JSON format. -// It is called by generated MarshalJSON methods on protocol buffer messages with the message_set_wire_format option. -func MarshalMessageSetJSON(exts interface{}) ([]byte, error) { - var m map[int32]Extension - switch exts := exts.(type) { - case *XXX_InternalExtensions: - m, _ = exts.extensionsRead() - case map[int32]Extension: - m = exts - default: - return nil, errors.New("proto: not an extension map") - } - var b bytes.Buffer - b.WriteByte('{') - - // Process the map in key order for deterministic output. - ids := make([]int32, 0, len(m)) - for id := range m { - ids = append(ids, id) - } - sort.Sort(int32Slice(ids)) // int32Slice defined in text.go - - for i, id := range ids { - ext := m[id] - if i > 0 { - b.WriteByte(',') - } - - msd, ok := messageSetMap[id] - if !ok { - // Unknown type; we can't render it, so skip it. - continue - } - fmt.Fprintf(&b, `"[%s]":`, msd.name) - - x := ext.value - if x == nil { - x = reflect.New(msd.t.Elem()).Interface() - if err := Unmarshal(ext.enc, x.(Message)); err != nil { - return nil, err - } - } - d, err := json.Marshal(x) - if err != nil { - return nil, err - } - b.Write(d) - } - b.WriteByte('}') - return b.Bytes(), nil -} - -// UnmarshalMessageSetJSON decodes the extension map encoded in buf in JSON format. -// It is called by generated UnmarshalJSON methods on protocol buffer messages with the message_set_wire_format option. -func UnmarshalMessageSetJSON(buf []byte, exts interface{}) error { - // Common-case fast path. - if len(buf) == 0 || bytes.Equal(buf, []byte("{}")) { - return nil - } - - // This is fairly tricky, and it's not clear that it is needed. - return errors.New("TODO: UnmarshalMessageSetJSON not yet implemented") -} - -// A global registry of types that can be used in a MessageSet. - -var messageSetMap = make(map[int32]messageSetDesc) - -type messageSetDesc struct { - t reflect.Type // pointer to struct - name string -} - -// RegisterMessageSetType is called from the generated code. -func RegisterMessageSetType(m Message, fieldNum int32, name string) { - messageSetMap[fieldNum] = messageSetDesc{ - t: reflect.TypeOf(m), - name: name, - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/pointer_reflect.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/pointer_reflect.go deleted file mode 100644 index fb512e2e16d..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/pointer_reflect.go +++ /dev/null @@ -1,484 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2012 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -// +build appengine js - -// This file contains an implementation of proto field accesses using package reflect. -// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can -// be used on App Engine. - -package proto - -import ( - "math" - "reflect" -) - -// A structPointer is a pointer to a struct. -type structPointer struct { - v reflect.Value -} - -// toStructPointer returns a structPointer equivalent to the given reflect value. -// The reflect value must itself be a pointer to a struct. -func toStructPointer(v reflect.Value) structPointer { - return structPointer{v} -} - -// IsNil reports whether p is nil. -func structPointer_IsNil(p structPointer) bool { - return p.v.IsNil() -} - -// Interface returns the struct pointer as an interface value. -func structPointer_Interface(p structPointer, _ reflect.Type) interface{} { - return p.v.Interface() -} - -// A field identifies a field in a struct, accessible from a structPointer. -// In this implementation, a field is identified by the sequence of field indices -// passed to reflect's FieldByIndex. -type field []int - -// toField returns a field equivalent to the given reflect field. -func toField(f *reflect.StructField) field { - return f.Index -} - -// invalidField is an invalid field identifier. -var invalidField = field(nil) - -// IsValid reports whether the field identifier is valid. -func (f field) IsValid() bool { return f != nil } - -// field returns the given field in the struct as a reflect value. -func structPointer_field(p structPointer, f field) reflect.Value { - // Special case: an extension map entry with a value of type T - // passes a *T to the struct-handling code with a zero field, - // expecting that it will be treated as equivalent to *struct{ X T }, - // which has the same memory layout. We have to handle that case - // specially, because reflect will panic if we call FieldByIndex on a - // non-struct. - if f == nil { - return p.v.Elem() - } - - return p.v.Elem().FieldByIndex(f) -} - -// ifield returns the given field in the struct as an interface value. -func structPointer_ifield(p structPointer, f field) interface{} { - return structPointer_field(p, f).Addr().Interface() -} - -// Bytes returns the address of a []byte field in the struct. -func structPointer_Bytes(p structPointer, f field) *[]byte { - return structPointer_ifield(p, f).(*[]byte) -} - -// BytesSlice returns the address of a [][]byte field in the struct. -func structPointer_BytesSlice(p structPointer, f field) *[][]byte { - return structPointer_ifield(p, f).(*[][]byte) -} - -// Bool returns the address of a *bool field in the struct. -func structPointer_Bool(p structPointer, f field) **bool { - return structPointer_ifield(p, f).(**bool) -} - -// BoolVal returns the address of a bool field in the struct. -func structPointer_BoolVal(p structPointer, f field) *bool { - return structPointer_ifield(p, f).(*bool) -} - -// BoolSlice returns the address of a []bool field in the struct. -func structPointer_BoolSlice(p structPointer, f field) *[]bool { - return structPointer_ifield(p, f).(*[]bool) -} - -// String returns the address of a *string field in the struct. -func structPointer_String(p structPointer, f field) **string { - return structPointer_ifield(p, f).(**string) -} - -// StringVal returns the address of a string field in the struct. -func structPointer_StringVal(p structPointer, f field) *string { - return structPointer_ifield(p, f).(*string) -} - -// StringSlice returns the address of a []string field in the struct. -func structPointer_StringSlice(p structPointer, f field) *[]string { - return structPointer_ifield(p, f).(*[]string) -} - -// Extensions returns the address of an extension map field in the struct. -func structPointer_Extensions(p structPointer, f field) *XXX_InternalExtensions { - return structPointer_ifield(p, f).(*XXX_InternalExtensions) -} - -// ExtMap returns the address of an extension map field in the struct. -func structPointer_ExtMap(p structPointer, f field) *map[int32]Extension { - return structPointer_ifield(p, f).(*map[int32]Extension) -} - -// NewAt returns the reflect.Value for a pointer to a field in the struct. -func structPointer_NewAt(p structPointer, f field, typ reflect.Type) reflect.Value { - return structPointer_field(p, f).Addr() -} - -// SetStructPointer writes a *struct field in the struct. -func structPointer_SetStructPointer(p structPointer, f field, q structPointer) { - structPointer_field(p, f).Set(q.v) -} - -// GetStructPointer reads a *struct field in the struct. -func structPointer_GetStructPointer(p structPointer, f field) structPointer { - return structPointer{structPointer_field(p, f)} -} - -// StructPointerSlice the address of a []*struct field in the struct. -func structPointer_StructPointerSlice(p structPointer, f field) structPointerSlice { - return structPointerSlice{structPointer_field(p, f)} -} - -// A structPointerSlice represents the address of a slice of pointers to structs -// (themselves messages or groups). That is, v.Type() is *[]*struct{...}. -type structPointerSlice struct { - v reflect.Value -} - -func (p structPointerSlice) Len() int { return p.v.Len() } -func (p structPointerSlice) Index(i int) structPointer { return structPointer{p.v.Index(i)} } -func (p structPointerSlice) Append(q structPointer) { - p.v.Set(reflect.Append(p.v, q.v)) -} - -var ( - int32Type = reflect.TypeOf(int32(0)) - uint32Type = reflect.TypeOf(uint32(0)) - float32Type = reflect.TypeOf(float32(0)) - int64Type = reflect.TypeOf(int64(0)) - uint64Type = reflect.TypeOf(uint64(0)) - float64Type = reflect.TypeOf(float64(0)) -) - -// A word32 represents a field of type *int32, *uint32, *float32, or *enum. -// That is, v.Type() is *int32, *uint32, *float32, or *enum and v is assignable. -type word32 struct { - v reflect.Value -} - -// IsNil reports whether p is nil. -func word32_IsNil(p word32) bool { - return p.v.IsNil() -} - -// Set sets p to point at a newly allocated word with bits set to x. -func word32_Set(p word32, o *Buffer, x uint32) { - t := p.v.Type().Elem() - switch t { - case int32Type: - if len(o.int32s) == 0 { - o.int32s = make([]int32, uint32PoolSize) - } - o.int32s[0] = int32(x) - p.v.Set(reflect.ValueOf(&o.int32s[0])) - o.int32s = o.int32s[1:] - return - case uint32Type: - if len(o.uint32s) == 0 { - o.uint32s = make([]uint32, uint32PoolSize) - } - o.uint32s[0] = x - p.v.Set(reflect.ValueOf(&o.uint32s[0])) - o.uint32s = o.uint32s[1:] - return - case float32Type: - if len(o.float32s) == 0 { - o.float32s = make([]float32, uint32PoolSize) - } - o.float32s[0] = math.Float32frombits(x) - p.v.Set(reflect.ValueOf(&o.float32s[0])) - o.float32s = o.float32s[1:] - return - } - - // must be enum - p.v.Set(reflect.New(t)) - p.v.Elem().SetInt(int64(int32(x))) -} - -// Get gets the bits pointed at by p, as a uint32. -func word32_Get(p word32) uint32 { - elem := p.v.Elem() - switch elem.Kind() { - case reflect.Int32: - return uint32(elem.Int()) - case reflect.Uint32: - return uint32(elem.Uint()) - case reflect.Float32: - return math.Float32bits(float32(elem.Float())) - } - panic("unreachable") -} - -// Word32 returns a reference to a *int32, *uint32, *float32, or *enum field in the struct. -func structPointer_Word32(p structPointer, f field) word32 { - return word32{structPointer_field(p, f)} -} - -// A word32Val represents a field of type int32, uint32, float32, or enum. -// That is, v.Type() is int32, uint32, float32, or enum and v is assignable. -type word32Val struct { - v reflect.Value -} - -// Set sets *p to x. -func word32Val_Set(p word32Val, x uint32) { - switch p.v.Type() { - case int32Type: - p.v.SetInt(int64(x)) - return - case uint32Type: - p.v.SetUint(uint64(x)) - return - case float32Type: - p.v.SetFloat(float64(math.Float32frombits(x))) - return - } - - // must be enum - p.v.SetInt(int64(int32(x))) -} - -// Get gets the bits pointed at by p, as a uint32. -func word32Val_Get(p word32Val) uint32 { - elem := p.v - switch elem.Kind() { - case reflect.Int32: - return uint32(elem.Int()) - case reflect.Uint32: - return uint32(elem.Uint()) - case reflect.Float32: - return math.Float32bits(float32(elem.Float())) - } - panic("unreachable") -} - -// Word32Val returns a reference to a int32, uint32, float32, or enum field in the struct. -func structPointer_Word32Val(p structPointer, f field) word32Val { - return word32Val{structPointer_field(p, f)} -} - -// A word32Slice is a slice of 32-bit values. -// That is, v.Type() is []int32, []uint32, []float32, or []enum. -type word32Slice struct { - v reflect.Value -} - -func (p word32Slice) Append(x uint32) { - n, m := p.v.Len(), p.v.Cap() - if n < m { - p.v.SetLen(n + 1) - } else { - t := p.v.Type().Elem() - p.v.Set(reflect.Append(p.v, reflect.Zero(t))) - } - elem := p.v.Index(n) - switch elem.Kind() { - case reflect.Int32: - elem.SetInt(int64(int32(x))) - case reflect.Uint32: - elem.SetUint(uint64(x)) - case reflect.Float32: - elem.SetFloat(float64(math.Float32frombits(x))) - } -} - -func (p word32Slice) Len() int { - return p.v.Len() -} - -func (p word32Slice) Index(i int) uint32 { - elem := p.v.Index(i) - switch elem.Kind() { - case reflect.Int32: - return uint32(elem.Int()) - case reflect.Uint32: - return uint32(elem.Uint()) - case reflect.Float32: - return math.Float32bits(float32(elem.Float())) - } - panic("unreachable") -} - -// Word32Slice returns a reference to a []int32, []uint32, []float32, or []enum field in the struct. -func structPointer_Word32Slice(p structPointer, f field) word32Slice { - return word32Slice{structPointer_field(p, f)} -} - -// word64 is like word32 but for 64-bit values. -type word64 struct { - v reflect.Value -} - -func word64_Set(p word64, o *Buffer, x uint64) { - t := p.v.Type().Elem() - switch t { - case int64Type: - if len(o.int64s) == 0 { - o.int64s = make([]int64, uint64PoolSize) - } - o.int64s[0] = int64(x) - p.v.Set(reflect.ValueOf(&o.int64s[0])) - o.int64s = o.int64s[1:] - return - case uint64Type: - if len(o.uint64s) == 0 { - o.uint64s = make([]uint64, uint64PoolSize) - } - o.uint64s[0] = x - p.v.Set(reflect.ValueOf(&o.uint64s[0])) - o.uint64s = o.uint64s[1:] - return - case float64Type: - if len(o.float64s) == 0 { - o.float64s = make([]float64, uint64PoolSize) - } - o.float64s[0] = math.Float64frombits(x) - p.v.Set(reflect.ValueOf(&o.float64s[0])) - o.float64s = o.float64s[1:] - return - } - panic("unreachable") -} - -func word64_IsNil(p word64) bool { - return p.v.IsNil() -} - -func word64_Get(p word64) uint64 { - elem := p.v.Elem() - switch elem.Kind() { - case reflect.Int64: - return uint64(elem.Int()) - case reflect.Uint64: - return elem.Uint() - case reflect.Float64: - return math.Float64bits(elem.Float()) - } - panic("unreachable") -} - -func structPointer_Word64(p structPointer, f field) word64 { - return word64{structPointer_field(p, f)} -} - -// word64Val is like word32Val but for 64-bit values. -type word64Val struct { - v reflect.Value -} - -func word64Val_Set(p word64Val, o *Buffer, x uint64) { - switch p.v.Type() { - case int64Type: - p.v.SetInt(int64(x)) - return - case uint64Type: - p.v.SetUint(x) - return - case float64Type: - p.v.SetFloat(math.Float64frombits(x)) - return - } - panic("unreachable") -} - -func word64Val_Get(p word64Val) uint64 { - elem := p.v - switch elem.Kind() { - case reflect.Int64: - return uint64(elem.Int()) - case reflect.Uint64: - return elem.Uint() - case reflect.Float64: - return math.Float64bits(elem.Float()) - } - panic("unreachable") -} - -func structPointer_Word64Val(p structPointer, f field) word64Val { - return word64Val{structPointer_field(p, f)} -} - -type word64Slice struct { - v reflect.Value -} - -func (p word64Slice) Append(x uint64) { - n, m := p.v.Len(), p.v.Cap() - if n < m { - p.v.SetLen(n + 1) - } else { - t := p.v.Type().Elem() - p.v.Set(reflect.Append(p.v, reflect.Zero(t))) - } - elem := p.v.Index(n) - switch elem.Kind() { - case reflect.Int64: - elem.SetInt(int64(int64(x))) - case reflect.Uint64: - elem.SetUint(uint64(x)) - case reflect.Float64: - elem.SetFloat(float64(math.Float64frombits(x))) - } -} - -func (p word64Slice) Len() int { - return p.v.Len() -} - -func (p word64Slice) Index(i int) uint64 { - elem := p.v.Index(i) - switch elem.Kind() { - case reflect.Int64: - return uint64(elem.Int()) - case reflect.Uint64: - return uint64(elem.Uint()) - case reflect.Float64: - return math.Float64bits(float64(elem.Float())) - } - panic("unreachable") -} - -func structPointer_Word64Slice(p structPointer, f field) word64Slice { - return word64Slice{structPointer_field(p, f)} -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/pointer_unsafe.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/pointer_unsafe.go deleted file mode 100644 index 6b5567d47cd..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/pointer_unsafe.go +++ /dev/null @@ -1,270 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2012 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -// +build !appengine,!js - -// This file contains the implementation of the proto field accesses using package unsafe. - -package proto - -import ( - "reflect" - "unsafe" -) - -// NOTE: These type_Foo functions would more idiomatically be methods, -// but Go does not allow methods on pointer types, and we must preserve -// some pointer type for the garbage collector. We use these -// funcs with clunky names as our poor approximation to methods. -// -// An alternative would be -// type structPointer struct { p unsafe.Pointer } -// but that does not registerize as well. - -// A structPointer is a pointer to a struct. -type structPointer unsafe.Pointer - -// toStructPointer returns a structPointer equivalent to the given reflect value. -func toStructPointer(v reflect.Value) structPointer { - return structPointer(unsafe.Pointer(v.Pointer())) -} - -// IsNil reports whether p is nil. -func structPointer_IsNil(p structPointer) bool { - return p == nil -} - -// Interface returns the struct pointer, assumed to have element type t, -// as an interface value. -func structPointer_Interface(p structPointer, t reflect.Type) interface{} { - return reflect.NewAt(t, unsafe.Pointer(p)).Interface() -} - -// A field identifies a field in a struct, accessible from a structPointer. -// In this implementation, a field is identified by its byte offset from the start of the struct. -type field uintptr - -// toField returns a field equivalent to the given reflect field. -func toField(f *reflect.StructField) field { - return field(f.Offset) -} - -// invalidField is an invalid field identifier. -const invalidField = ^field(0) - -// IsValid reports whether the field identifier is valid. -func (f field) IsValid() bool { - return f != ^field(0) -} - -// Bytes returns the address of a []byte field in the struct. -func structPointer_Bytes(p structPointer, f field) *[]byte { - return (*[]byte)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// BytesSlice returns the address of a [][]byte field in the struct. -func structPointer_BytesSlice(p structPointer, f field) *[][]byte { - return (*[][]byte)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// Bool returns the address of a *bool field in the struct. -func structPointer_Bool(p structPointer, f field) **bool { - return (**bool)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// BoolVal returns the address of a bool field in the struct. -func structPointer_BoolVal(p structPointer, f field) *bool { - return (*bool)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// BoolSlice returns the address of a []bool field in the struct. -func structPointer_BoolSlice(p structPointer, f field) *[]bool { - return (*[]bool)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// String returns the address of a *string field in the struct. -func structPointer_String(p structPointer, f field) **string { - return (**string)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// StringVal returns the address of a string field in the struct. -func structPointer_StringVal(p structPointer, f field) *string { - return (*string)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// StringSlice returns the address of a []string field in the struct. -func structPointer_StringSlice(p structPointer, f field) *[]string { - return (*[]string)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// ExtMap returns the address of an extension map field in the struct. -func structPointer_Extensions(p structPointer, f field) *XXX_InternalExtensions { - return (*XXX_InternalExtensions)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -func structPointer_ExtMap(p structPointer, f field) *map[int32]Extension { - return (*map[int32]Extension)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// NewAt returns the reflect.Value for a pointer to a field in the struct. -func structPointer_NewAt(p structPointer, f field, typ reflect.Type) reflect.Value { - return reflect.NewAt(typ, unsafe.Pointer(uintptr(p)+uintptr(f))) -} - -// SetStructPointer writes a *struct field in the struct. -func structPointer_SetStructPointer(p structPointer, f field, q structPointer) { - *(*structPointer)(unsafe.Pointer(uintptr(p) + uintptr(f))) = q -} - -// GetStructPointer reads a *struct field in the struct. -func structPointer_GetStructPointer(p structPointer, f field) structPointer { - return *(*structPointer)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// StructPointerSlice the address of a []*struct field in the struct. -func structPointer_StructPointerSlice(p structPointer, f field) *structPointerSlice { - return (*structPointerSlice)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// A structPointerSlice represents a slice of pointers to structs (themselves submessages or groups). -type structPointerSlice []structPointer - -func (v *structPointerSlice) Len() int { return len(*v) } -func (v *structPointerSlice) Index(i int) structPointer { return (*v)[i] } -func (v *structPointerSlice) Append(p structPointer) { *v = append(*v, p) } - -// A word32 is the address of a "pointer to 32-bit value" field. -type word32 **uint32 - -// IsNil reports whether *v is nil. -func word32_IsNil(p word32) bool { - return *p == nil -} - -// Set sets *v to point at a newly allocated word set to x. -func word32_Set(p word32, o *Buffer, x uint32) { - if len(o.uint32s) == 0 { - o.uint32s = make([]uint32, uint32PoolSize) - } - o.uint32s[0] = x - *p = &o.uint32s[0] - o.uint32s = o.uint32s[1:] -} - -// Get gets the value pointed at by *v. -func word32_Get(p word32) uint32 { - return **p -} - -// Word32 returns the address of a *int32, *uint32, *float32, or *enum field in the struct. -func structPointer_Word32(p structPointer, f field) word32 { - return word32((**uint32)(unsafe.Pointer(uintptr(p) + uintptr(f)))) -} - -// A word32Val is the address of a 32-bit value field. -type word32Val *uint32 - -// Set sets *p to x. -func word32Val_Set(p word32Val, x uint32) { - *p = x -} - -// Get gets the value pointed at by p. -func word32Val_Get(p word32Val) uint32 { - return *p -} - -// Word32Val returns the address of a *int32, *uint32, *float32, or *enum field in the struct. -func structPointer_Word32Val(p structPointer, f field) word32Val { - return word32Val((*uint32)(unsafe.Pointer(uintptr(p) + uintptr(f)))) -} - -// A word32Slice is a slice of 32-bit values. -type word32Slice []uint32 - -func (v *word32Slice) Append(x uint32) { *v = append(*v, x) } -func (v *word32Slice) Len() int { return len(*v) } -func (v *word32Slice) Index(i int) uint32 { return (*v)[i] } - -// Word32Slice returns the address of a []int32, []uint32, []float32, or []enum field in the struct. -func structPointer_Word32Slice(p structPointer, f field) *word32Slice { - return (*word32Slice)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -// word64 is like word32 but for 64-bit values. -type word64 **uint64 - -func word64_Set(p word64, o *Buffer, x uint64) { - if len(o.uint64s) == 0 { - o.uint64s = make([]uint64, uint64PoolSize) - } - o.uint64s[0] = x - *p = &o.uint64s[0] - o.uint64s = o.uint64s[1:] -} - -func word64_IsNil(p word64) bool { - return *p == nil -} - -func word64_Get(p word64) uint64 { - return **p -} - -func structPointer_Word64(p structPointer, f field) word64 { - return word64((**uint64)(unsafe.Pointer(uintptr(p) + uintptr(f)))) -} - -// word64Val is like word32Val but for 64-bit values. -type word64Val *uint64 - -func word64Val_Set(p word64Val, o *Buffer, x uint64) { - *p = x -} - -func word64Val_Get(p word64Val) uint64 { - return *p -} - -func structPointer_Word64Val(p structPointer, f field) word64Val { - return word64Val((*uint64)(unsafe.Pointer(uintptr(p) + uintptr(f)))) -} - -// word64Slice is like word32Slice but for 64-bit values. -type word64Slice []uint64 - -func (v *word64Slice) Append(x uint64) { *v = append(*v, x) } -func (v *word64Slice) Len() int { return len(*v) } -func (v *word64Slice) Index(i int) uint64 { return (*v)[i] } - -func structPointer_Word64Slice(p structPointer, f field) *word64Slice { - return (*word64Slice)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/properties.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/properties.go deleted file mode 100644 index ec2289c0058..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/properties.go +++ /dev/null @@ -1,872 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -/* - * Routines for encoding data into the wire format for protocol buffers. - */ - -import ( - "fmt" - "log" - "os" - "reflect" - "sort" - "strconv" - "strings" - "sync" -) - -const debug bool = false - -// Constants that identify the encoding of a value on the wire. -const ( - WireVarint = 0 - WireFixed64 = 1 - WireBytes = 2 - WireStartGroup = 3 - WireEndGroup = 4 - WireFixed32 = 5 -) - -const startSize = 10 // initial slice/string sizes - -// Encoders are defined in encode.go -// An encoder outputs the full representation of a field, including its -// tag and encoder type. -type encoder func(p *Buffer, prop *Properties, base structPointer) error - -// A valueEncoder encodes a single integer in a particular encoding. -type valueEncoder func(o *Buffer, x uint64) error - -// Sizers are defined in encode.go -// A sizer returns the encoded size of a field, including its tag and encoder -// type. -type sizer func(prop *Properties, base structPointer) int - -// A valueSizer returns the encoded size of a single integer in a particular -// encoding. -type valueSizer func(x uint64) int - -// Decoders are defined in decode.go -// A decoder creates a value from its wire representation. -// Unrecognized subelements are saved in unrec. -type decoder func(p *Buffer, prop *Properties, base structPointer) error - -// A valueDecoder decodes a single integer in a particular encoding. -type valueDecoder func(o *Buffer) (x uint64, err error) - -// A oneofMarshaler does the marshaling for all oneof fields in a message. -type oneofMarshaler func(Message, *Buffer) error - -// A oneofUnmarshaler does the unmarshaling for a oneof field in a message. -type oneofUnmarshaler func(Message, int, int, *Buffer) (bool, error) - -// A oneofSizer does the sizing for all oneof fields in a message. -type oneofSizer func(Message) int - -// tagMap is an optimization over map[int]int for typical protocol buffer -// use-cases. Encoded protocol buffers are often in tag order with small tag -// numbers. -type tagMap struct { - fastTags []int - slowTags map[int]int -} - -// tagMapFastLimit is the upper bound on the tag number that will be stored in -// the tagMap slice rather than its map. -const tagMapFastLimit = 1024 - -func (p *tagMap) get(t int) (int, bool) { - if t > 0 && t < tagMapFastLimit { - if t >= len(p.fastTags) { - return 0, false - } - fi := p.fastTags[t] - return fi, fi >= 0 - } - fi, ok := p.slowTags[t] - return fi, ok -} - -func (p *tagMap) put(t int, fi int) { - if t > 0 && t < tagMapFastLimit { - for len(p.fastTags) < t+1 { - p.fastTags = append(p.fastTags, -1) - } - p.fastTags[t] = fi - return - } - if p.slowTags == nil { - p.slowTags = make(map[int]int) - } - p.slowTags[t] = fi -} - -// StructProperties represents properties for all the fields of a struct. -// decoderTags and decoderOrigNames should only be used by the decoder. -type StructProperties struct { - Prop []*Properties // properties for each field - reqCount int // required count - decoderTags tagMap // map from proto tag to struct field number - decoderOrigNames map[string]int // map from original name to struct field number - order []int // list of struct field numbers in tag order - unrecField field // field id of the XXX_unrecognized []byte field - extendable bool // is this an extendable proto - - oneofMarshaler oneofMarshaler - oneofUnmarshaler oneofUnmarshaler - oneofSizer oneofSizer - stype reflect.Type - - // OneofTypes contains information about the oneof fields in this message. - // It is keyed by the original name of a field. - OneofTypes map[string]*OneofProperties -} - -// OneofProperties represents information about a specific field in a oneof. -type OneofProperties struct { - Type reflect.Type // pointer to generated struct type for this oneof field - Field int // struct field number of the containing oneof in the message - Prop *Properties -} - -// Implement the sorting interface so we can sort the fields in tag order, as recommended by the spec. -// See encode.go, (*Buffer).enc_struct. - -func (sp *StructProperties) Len() int { return len(sp.order) } -func (sp *StructProperties) Less(i, j int) bool { - return sp.Prop[sp.order[i]].Tag < sp.Prop[sp.order[j]].Tag -} -func (sp *StructProperties) Swap(i, j int) { sp.order[i], sp.order[j] = sp.order[j], sp.order[i] } - -// Properties represents the protocol-specific behavior of a single struct field. -type Properties struct { - Name string // name of the field, for error messages - OrigName string // original name before protocol compiler (always set) - JSONName string // name to use for JSON; determined by protoc - Wire string - WireType int - Tag int - Required bool - Optional bool - Repeated bool - Packed bool // relevant for repeated primitives only - Enum string // set for enum types only - proto3 bool // whether this is known to be a proto3 field; set for []byte only - oneof bool // whether this is a oneof field - - Default string // default value - HasDefault bool // whether an explicit default was provided - def_uint64 uint64 - - enc encoder - valEnc valueEncoder // set for bool and numeric types only - field field - tagcode []byte // encoding of EncodeVarint((Tag<<3)|WireType) - tagbuf [8]byte - stype reflect.Type // set for struct types only - sprop *StructProperties // set for struct types only - isMarshaler bool - isUnmarshaler bool - - mtype reflect.Type // set for map types only - mkeyprop *Properties // set for map types only - mvalprop *Properties // set for map types only - - size sizer - valSize valueSizer // set for bool and numeric types only - - dec decoder - valDec valueDecoder // set for bool and numeric types only - - // If this is a packable field, this will be the decoder for the packed version of the field. - packedDec decoder -} - -// String formats the properties in the protobuf struct field tag style. -func (p *Properties) String() string { - s := p.Wire - s = "," - s += strconv.Itoa(p.Tag) - if p.Required { - s += ",req" - } - if p.Optional { - s += ",opt" - } - if p.Repeated { - s += ",rep" - } - if p.Packed { - s += ",packed" - } - s += ",name=" + p.OrigName - if p.JSONName != p.OrigName { - s += ",json=" + p.JSONName - } - if p.proto3 { - s += ",proto3" - } - if p.oneof { - s += ",oneof" - } - if len(p.Enum) > 0 { - s += ",enum=" + p.Enum - } - if p.HasDefault { - s += ",def=" + p.Default - } - return s -} - -// Parse populates p by parsing a string in the protobuf struct field tag style. -func (p *Properties) Parse(s string) { - // "bytes,49,opt,name=foo,def=hello!" - fields := strings.Split(s, ",") // breaks def=, but handled below. - if len(fields) < 2 { - fmt.Fprintf(os.Stderr, "proto: tag has too few fields: %q\n", s) - return - } - - p.Wire = fields[0] - switch p.Wire { - case "varint": - p.WireType = WireVarint - p.valEnc = (*Buffer).EncodeVarint - p.valDec = (*Buffer).DecodeVarint - p.valSize = sizeVarint - case "fixed32": - p.WireType = WireFixed32 - p.valEnc = (*Buffer).EncodeFixed32 - p.valDec = (*Buffer).DecodeFixed32 - p.valSize = sizeFixed32 - case "fixed64": - p.WireType = WireFixed64 - p.valEnc = (*Buffer).EncodeFixed64 - p.valDec = (*Buffer).DecodeFixed64 - p.valSize = sizeFixed64 - case "zigzag32": - p.WireType = WireVarint - p.valEnc = (*Buffer).EncodeZigzag32 - p.valDec = (*Buffer).DecodeZigzag32 - p.valSize = sizeZigzag32 - case "zigzag64": - p.WireType = WireVarint - p.valEnc = (*Buffer).EncodeZigzag64 - p.valDec = (*Buffer).DecodeZigzag64 - p.valSize = sizeZigzag64 - case "bytes", "group": - p.WireType = WireBytes - // no numeric converter for non-numeric types - default: - fmt.Fprintf(os.Stderr, "proto: tag has unknown wire type: %q\n", s) - return - } - - var err error - p.Tag, err = strconv.Atoi(fields[1]) - if err != nil { - return - } - - for i := 2; i < len(fields); i++ { - f := fields[i] - switch { - case f == "req": - p.Required = true - case f == "opt": - p.Optional = true - case f == "rep": - p.Repeated = true - case f == "packed": - p.Packed = true - case strings.HasPrefix(f, "name="): - p.OrigName = f[5:] - case strings.HasPrefix(f, "json="): - p.JSONName = f[5:] - case strings.HasPrefix(f, "enum="): - p.Enum = f[5:] - case f == "proto3": - p.proto3 = true - case f == "oneof": - p.oneof = true - case strings.HasPrefix(f, "def="): - p.HasDefault = true - p.Default = f[4:] // rest of string - if i+1 < len(fields) { - // Commas aren't escaped, and def is always last. - p.Default += "," + strings.Join(fields[i+1:], ",") - break - } - } - } -} - -func logNoSliceEnc(t1, t2 reflect.Type) { - fmt.Fprintf(os.Stderr, "proto: no slice oenc for %T = []%T\n", t1, t2) -} - -var protoMessageType = reflect.TypeOf((*Message)(nil)).Elem() - -// Initialize the fields for encoding and decoding. -func (p *Properties) setEncAndDec(typ reflect.Type, f *reflect.StructField, lockGetProp bool) { - p.enc = nil - p.dec = nil - p.size = nil - - switch t1 := typ; t1.Kind() { - default: - fmt.Fprintf(os.Stderr, "proto: no coders for %v\n", t1) - - // proto3 scalar types - - case reflect.Bool: - p.enc = (*Buffer).enc_proto3_bool - p.dec = (*Buffer).dec_proto3_bool - p.size = size_proto3_bool - case reflect.Int32: - p.enc = (*Buffer).enc_proto3_int32 - p.dec = (*Buffer).dec_proto3_int32 - p.size = size_proto3_int32 - case reflect.Uint32: - p.enc = (*Buffer).enc_proto3_uint32 - p.dec = (*Buffer).dec_proto3_int32 // can reuse - p.size = size_proto3_uint32 - case reflect.Int64, reflect.Uint64: - p.enc = (*Buffer).enc_proto3_int64 - p.dec = (*Buffer).dec_proto3_int64 - p.size = size_proto3_int64 - case reflect.Float32: - p.enc = (*Buffer).enc_proto3_uint32 // can just treat them as bits - p.dec = (*Buffer).dec_proto3_int32 - p.size = size_proto3_uint32 - case reflect.Float64: - p.enc = (*Buffer).enc_proto3_int64 // can just treat them as bits - p.dec = (*Buffer).dec_proto3_int64 - p.size = size_proto3_int64 - case reflect.String: - p.enc = (*Buffer).enc_proto3_string - p.dec = (*Buffer).dec_proto3_string - p.size = size_proto3_string - - case reflect.Ptr: - switch t2 := t1.Elem(); t2.Kind() { - default: - fmt.Fprintf(os.Stderr, "proto: no encoder function for %v -> %v\n", t1, t2) - break - case reflect.Bool: - p.enc = (*Buffer).enc_bool - p.dec = (*Buffer).dec_bool - p.size = size_bool - case reflect.Int32: - p.enc = (*Buffer).enc_int32 - p.dec = (*Buffer).dec_int32 - p.size = size_int32 - case reflect.Uint32: - p.enc = (*Buffer).enc_uint32 - p.dec = (*Buffer).dec_int32 // can reuse - p.size = size_uint32 - case reflect.Int64, reflect.Uint64: - p.enc = (*Buffer).enc_int64 - p.dec = (*Buffer).dec_int64 - p.size = size_int64 - case reflect.Float32: - p.enc = (*Buffer).enc_uint32 // can just treat them as bits - p.dec = (*Buffer).dec_int32 - p.size = size_uint32 - case reflect.Float64: - p.enc = (*Buffer).enc_int64 // can just treat them as bits - p.dec = (*Buffer).dec_int64 - p.size = size_int64 - case reflect.String: - p.enc = (*Buffer).enc_string - p.dec = (*Buffer).dec_string - p.size = size_string - case reflect.Struct: - p.stype = t1.Elem() - p.isMarshaler = isMarshaler(t1) - p.isUnmarshaler = isUnmarshaler(t1) - if p.Wire == "bytes" { - p.enc = (*Buffer).enc_struct_message - p.dec = (*Buffer).dec_struct_message - p.size = size_struct_message - } else { - p.enc = (*Buffer).enc_struct_group - p.dec = (*Buffer).dec_struct_group - p.size = size_struct_group - } - } - - case reflect.Slice: - switch t2 := t1.Elem(); t2.Kind() { - default: - logNoSliceEnc(t1, t2) - break - case reflect.Bool: - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_bool - p.size = size_slice_packed_bool - } else { - p.enc = (*Buffer).enc_slice_bool - p.size = size_slice_bool - } - p.dec = (*Buffer).dec_slice_bool - p.packedDec = (*Buffer).dec_slice_packed_bool - case reflect.Int32: - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_int32 - p.size = size_slice_packed_int32 - } else { - p.enc = (*Buffer).enc_slice_int32 - p.size = size_slice_int32 - } - p.dec = (*Buffer).dec_slice_int32 - p.packedDec = (*Buffer).dec_slice_packed_int32 - case reflect.Uint32: - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_uint32 - p.size = size_slice_packed_uint32 - } else { - p.enc = (*Buffer).enc_slice_uint32 - p.size = size_slice_uint32 - } - p.dec = (*Buffer).dec_slice_int32 - p.packedDec = (*Buffer).dec_slice_packed_int32 - case reflect.Int64, reflect.Uint64: - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_int64 - p.size = size_slice_packed_int64 - } else { - p.enc = (*Buffer).enc_slice_int64 - p.size = size_slice_int64 - } - p.dec = (*Buffer).dec_slice_int64 - p.packedDec = (*Buffer).dec_slice_packed_int64 - case reflect.Uint8: - p.dec = (*Buffer).dec_slice_byte - if p.proto3 { - p.enc = (*Buffer).enc_proto3_slice_byte - p.size = size_proto3_slice_byte - } else { - p.enc = (*Buffer).enc_slice_byte - p.size = size_slice_byte - } - case reflect.Float32, reflect.Float64: - switch t2.Bits() { - case 32: - // can just treat them as bits - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_uint32 - p.size = size_slice_packed_uint32 - } else { - p.enc = (*Buffer).enc_slice_uint32 - p.size = size_slice_uint32 - } - p.dec = (*Buffer).dec_slice_int32 - p.packedDec = (*Buffer).dec_slice_packed_int32 - case 64: - // can just treat them as bits - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_int64 - p.size = size_slice_packed_int64 - } else { - p.enc = (*Buffer).enc_slice_int64 - p.size = size_slice_int64 - } - p.dec = (*Buffer).dec_slice_int64 - p.packedDec = (*Buffer).dec_slice_packed_int64 - default: - logNoSliceEnc(t1, t2) - break - } - case reflect.String: - p.enc = (*Buffer).enc_slice_string - p.dec = (*Buffer).dec_slice_string - p.size = size_slice_string - case reflect.Ptr: - switch t3 := t2.Elem(); t3.Kind() { - default: - fmt.Fprintf(os.Stderr, "proto: no ptr oenc for %T -> %T -> %T\n", t1, t2, t3) - break - case reflect.Struct: - p.stype = t2.Elem() - p.isMarshaler = isMarshaler(t2) - p.isUnmarshaler = isUnmarshaler(t2) - if p.Wire == "bytes" { - p.enc = (*Buffer).enc_slice_struct_message - p.dec = (*Buffer).dec_slice_struct_message - p.size = size_slice_struct_message - } else { - p.enc = (*Buffer).enc_slice_struct_group - p.dec = (*Buffer).dec_slice_struct_group - p.size = size_slice_struct_group - } - } - case reflect.Slice: - switch t2.Elem().Kind() { - default: - fmt.Fprintf(os.Stderr, "proto: no slice elem oenc for %T -> %T -> %T\n", t1, t2, t2.Elem()) - break - case reflect.Uint8: - p.enc = (*Buffer).enc_slice_slice_byte - p.dec = (*Buffer).dec_slice_slice_byte - p.size = size_slice_slice_byte - } - } - - case reflect.Map: - p.enc = (*Buffer).enc_new_map - p.dec = (*Buffer).dec_new_map - p.size = size_new_map - - p.mtype = t1 - p.mkeyprop = &Properties{} - p.mkeyprop.init(reflect.PtrTo(p.mtype.Key()), "Key", f.Tag.Get("protobuf_key"), nil, lockGetProp) - p.mvalprop = &Properties{} - vtype := p.mtype.Elem() - if vtype.Kind() != reflect.Ptr && vtype.Kind() != reflect.Slice { - // The value type is not a message (*T) or bytes ([]byte), - // so we need encoders for the pointer to this type. - vtype = reflect.PtrTo(vtype) - } - p.mvalprop.init(vtype, "Value", f.Tag.Get("protobuf_val"), nil, lockGetProp) - } - - // precalculate tag code - wire := p.WireType - if p.Packed { - wire = WireBytes - } - x := uint32(p.Tag)<<3 | uint32(wire) - i := 0 - for i = 0; x > 127; i++ { - p.tagbuf[i] = 0x80 | uint8(x&0x7F) - x >>= 7 - } - p.tagbuf[i] = uint8(x) - p.tagcode = p.tagbuf[0 : i+1] - - if p.stype != nil { - if lockGetProp { - p.sprop = GetProperties(p.stype) - } else { - p.sprop = getPropertiesLocked(p.stype) - } - } -} - -var ( - marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem() - unmarshalerType = reflect.TypeOf((*Unmarshaler)(nil)).Elem() -) - -// isMarshaler reports whether type t implements Marshaler. -func isMarshaler(t reflect.Type) bool { - // We're checking for (likely) pointer-receiver methods - // so if t is not a pointer, something is very wrong. - // The calls above only invoke isMarshaler on pointer types. - if t.Kind() != reflect.Ptr { - panic("proto: misuse of isMarshaler") - } - return t.Implements(marshalerType) -} - -// isUnmarshaler reports whether type t implements Unmarshaler. -func isUnmarshaler(t reflect.Type) bool { - // We're checking for (likely) pointer-receiver methods - // so if t is not a pointer, something is very wrong. - // The calls above only invoke isUnmarshaler on pointer types. - if t.Kind() != reflect.Ptr { - panic("proto: misuse of isUnmarshaler") - } - return t.Implements(unmarshalerType) -} - -// Init populates the properties from a protocol buffer struct tag. -func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) { - p.init(typ, name, tag, f, true) -} - -func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructField, lockGetProp bool) { - // "bytes,49,opt,def=hello!" - p.Name = name - p.OrigName = name - if f != nil { - p.field = toField(f) - } - if tag == "" { - return - } - p.Parse(tag) - p.setEncAndDec(typ, f, lockGetProp) -} - -var ( - propertiesMu sync.RWMutex - propertiesMap = make(map[reflect.Type]*StructProperties) -) - -// GetProperties returns the list of properties for the type represented by t. -// t must represent a generated struct type of a protocol message. -func GetProperties(t reflect.Type) *StructProperties { - if t.Kind() != reflect.Struct { - panic("proto: type must have kind struct") - } - - // Most calls to GetProperties in a long-running program will be - // retrieving details for types we have seen before. - propertiesMu.RLock() - sprop, ok := propertiesMap[t] - propertiesMu.RUnlock() - if ok { - if collectStats { - stats.Chit++ - } - return sprop - } - - propertiesMu.Lock() - sprop = getPropertiesLocked(t) - propertiesMu.Unlock() - return sprop -} - -// getPropertiesLocked requires that propertiesMu is held. -func getPropertiesLocked(t reflect.Type) *StructProperties { - if prop, ok := propertiesMap[t]; ok { - if collectStats { - stats.Chit++ - } - return prop - } - if collectStats { - stats.Cmiss++ - } - - prop := new(StructProperties) - // in case of recursive protos, fill this in now. - propertiesMap[t] = prop - - // build properties - prop.extendable = reflect.PtrTo(t).Implements(extendableProtoType) || - reflect.PtrTo(t).Implements(extendableProtoV1Type) - prop.unrecField = invalidField - prop.Prop = make([]*Properties, t.NumField()) - prop.order = make([]int, t.NumField()) - - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - p := new(Properties) - name := f.Name - p.init(f.Type, name, f.Tag.Get("protobuf"), &f, false) - - if f.Name == "XXX_InternalExtensions" { // special case - p.enc = (*Buffer).enc_exts - p.dec = nil // not needed - p.size = size_exts - } else if f.Name == "XXX_extensions" { // special case - p.enc = (*Buffer).enc_map - p.dec = nil // not needed - p.size = size_map - } else if f.Name == "XXX_unrecognized" { // special case - prop.unrecField = toField(&f) - } - oneof := f.Tag.Get("protobuf_oneof") // special case - if oneof != "" { - // Oneof fields don't use the traditional protobuf tag. - p.OrigName = oneof - } - prop.Prop[i] = p - prop.order[i] = i - if debug { - print(i, " ", f.Name, " ", t.String(), " ") - if p.Tag > 0 { - print(p.String()) - } - print("\n") - } - if p.enc == nil && !strings.HasPrefix(f.Name, "XXX_") && oneof == "" { - fmt.Fprintln(os.Stderr, "proto: no encoder for", f.Name, f.Type.String(), "[GetProperties]") - } - } - - // Re-order prop.order. - sort.Sort(prop) - - type oneofMessage interface { - XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) - } - if om, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); ok { - var oots []interface{} - prop.oneofMarshaler, prop.oneofUnmarshaler, prop.oneofSizer, oots = om.XXX_OneofFuncs() - prop.stype = t - - // Interpret oneof metadata. - prop.OneofTypes = make(map[string]*OneofProperties) - for _, oot := range oots { - oop := &OneofProperties{ - Type: reflect.ValueOf(oot).Type(), // *T - Prop: new(Properties), - } - sft := oop.Type.Elem().Field(0) - oop.Prop.Name = sft.Name - oop.Prop.Parse(sft.Tag.Get("protobuf")) - // There will be exactly one interface field that - // this new value is assignable to. - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - if f.Type.Kind() != reflect.Interface { - continue - } - if !oop.Type.AssignableTo(f.Type) { - continue - } - oop.Field = i - break - } - prop.OneofTypes[oop.Prop.OrigName] = oop - } - } - - // build required counts - // build tags - reqCount := 0 - prop.decoderOrigNames = make(map[string]int) - for i, p := range prop.Prop { - if strings.HasPrefix(p.Name, "XXX_") { - // Internal fields should not appear in tags/origNames maps. - // They are handled specially when encoding and decoding. - continue - } - if p.Required { - reqCount++ - } - prop.decoderTags.put(p.Tag, i) - prop.decoderOrigNames[p.OrigName] = i - } - prop.reqCount = reqCount - - return prop -} - -// Return the Properties object for the x[0]'th field of the structure. -func propByIndex(t reflect.Type, x []int) *Properties { - if len(x) != 1 { - fmt.Fprintf(os.Stderr, "proto: field index dimension %d (not 1) for type %s\n", len(x), t) - return nil - } - prop := GetProperties(t) - return prop.Prop[x[0]] -} - -// Get the address and type of a pointer to a struct from an interface. -func getbase(pb Message) (t reflect.Type, b structPointer, err error) { - if pb == nil { - err = ErrNil - return - } - // get the reflect type of the pointer to the struct. - t = reflect.TypeOf(pb) - // get the address of the struct. - value := reflect.ValueOf(pb) - b = toStructPointer(value) - return -} - -// A global registry of enum types. -// The generated code will register the generated maps by calling RegisterEnum. - -var enumValueMaps = make(map[string]map[string]int32) - -// RegisterEnum is called from the generated code to install the enum descriptor -// maps into the global table to aid parsing text format protocol buffers. -func RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) { - if _, ok := enumValueMaps[typeName]; ok { - panic("proto: duplicate enum registered: " + typeName) - } - enumValueMaps[typeName] = valueMap -} - -// EnumValueMap returns the mapping from names to integers of the -// enum type enumType, or a nil if not found. -func EnumValueMap(enumType string) map[string]int32 { - return enumValueMaps[enumType] -} - -// A registry of all linked message types. -// The string is a fully-qualified proto name ("pkg.Message"). -var ( - protoTypes = make(map[string]reflect.Type) - revProtoTypes = make(map[reflect.Type]string) -) - -// RegisterType is called from generated code and maps from the fully qualified -// proto name to the type (pointer to struct) of the protocol buffer. -func RegisterType(x Message, name string) { - if _, ok := protoTypes[name]; ok { - // TODO: Some day, make this a panic. - log.Printf("proto: duplicate proto type registered: %s", name) - return - } - t := reflect.TypeOf(x) - protoTypes[name] = t - revProtoTypes[t] = name -} - -// MessageName returns the fully-qualified proto name for the given message type. -func MessageName(x Message) string { - type xname interface { - XXX_MessageName() string - } - if m, ok := x.(xname); ok { - return m.XXX_MessageName() - } - return revProtoTypes[reflect.TypeOf(x)] -} - -// MessageType returns the message type (pointer to struct) for a named message. -func MessageType(name string) reflect.Type { return protoTypes[name] } - -// A registry of all linked proto files. -var ( - protoFiles = make(map[string][]byte) // file name => fileDescriptor -) - -// RegisterFile is called from generated code and maps from the -// full file name of a .proto file to its compressed FileDescriptorProto. -func RegisterFile(filename string, fileDescriptor []byte) { - protoFiles[filename] = fileDescriptor -} - -// FileDescriptor returns the compressed FileDescriptorProto for a .proto file. -func FileDescriptor(filename string) []byte { return protoFiles[filename] } diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/text.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/text.go deleted file mode 100644 index 965876bf033..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/text.go +++ /dev/null @@ -1,854 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -// Functions for writing the text protocol buffer format. - -import ( - "bufio" - "bytes" - "encoding" - "errors" - "fmt" - "io" - "log" - "math" - "reflect" - "sort" - "strings" -) - -var ( - newline = []byte("\n") - spaces = []byte(" ") - gtNewline = []byte(">\n") - endBraceNewline = []byte("}\n") - backslashN = []byte{'\\', 'n'} - backslashR = []byte{'\\', 'r'} - backslashT = []byte{'\\', 't'} - backslashDQ = []byte{'\\', '"'} - backslashBS = []byte{'\\', '\\'} - posInf = []byte("inf") - negInf = []byte("-inf") - nan = []byte("nan") -) - -type writer interface { - io.Writer - WriteByte(byte) error -} - -// textWriter is an io.Writer that tracks its indentation level. -type textWriter struct { - ind int - complete bool // if the current position is a complete line - compact bool // whether to write out as a one-liner - w writer -} - -func (w *textWriter) WriteString(s string) (n int, err error) { - if !strings.Contains(s, "\n") { - if !w.compact && w.complete { - w.writeIndent() - } - w.complete = false - return io.WriteString(w.w, s) - } - // WriteString is typically called without newlines, so this - // codepath and its copy are rare. We copy to avoid - // duplicating all of Write's logic here. - return w.Write([]byte(s)) -} - -func (w *textWriter) Write(p []byte) (n int, err error) { - newlines := bytes.Count(p, newline) - if newlines == 0 { - if !w.compact && w.complete { - w.writeIndent() - } - n, err = w.w.Write(p) - w.complete = false - return n, err - } - - frags := bytes.SplitN(p, newline, newlines+1) - if w.compact { - for i, frag := range frags { - if i > 0 { - if err := w.w.WriteByte(' '); err != nil { - return n, err - } - n++ - } - nn, err := w.w.Write(frag) - n += nn - if err != nil { - return n, err - } - } - return n, nil - } - - for i, frag := range frags { - if w.complete { - w.writeIndent() - } - nn, err := w.w.Write(frag) - n += nn - if err != nil { - return n, err - } - if i+1 < len(frags) { - if err := w.w.WriteByte('\n'); err != nil { - return n, err - } - n++ - } - } - w.complete = len(frags[len(frags)-1]) == 0 - return n, nil -} - -func (w *textWriter) WriteByte(c byte) error { - if w.compact && c == '\n' { - c = ' ' - } - if !w.compact && w.complete { - w.writeIndent() - } - err := w.w.WriteByte(c) - w.complete = c == '\n' - return err -} - -func (w *textWriter) indent() { w.ind++ } - -func (w *textWriter) unindent() { - if w.ind == 0 { - log.Print("proto: textWriter unindented too far") - return - } - w.ind-- -} - -func writeName(w *textWriter, props *Properties) error { - if _, err := w.WriteString(props.OrigName); err != nil { - return err - } - if props.Wire != "group" { - return w.WriteByte(':') - } - return nil -} - -// raw is the interface satisfied by RawMessage. -type raw interface { - Bytes() []byte -} - -func requiresQuotes(u string) bool { - // When type URL contains any characters except [0-9A-Za-z./\-]*, it must be quoted. - for _, ch := range u { - switch { - case ch == '.' || ch == '/' || ch == '_': - continue - case '0' <= ch && ch <= '9': - continue - case 'A' <= ch && ch <= 'Z': - continue - case 'a' <= ch && ch <= 'z': - continue - default: - return true - } - } - return false -} - -// isAny reports whether sv is a google.protobuf.Any message -func isAny(sv reflect.Value) bool { - type wkt interface { - XXX_WellKnownType() string - } - t, ok := sv.Addr().Interface().(wkt) - return ok && t.XXX_WellKnownType() == "Any" -} - -// writeProto3Any writes an expanded google.protobuf.Any message. -// -// It returns (false, nil) if sv value can't be unmarshaled (e.g. because -// required messages are not linked in). -// -// It returns (true, error) when sv was written in expanded format or an error -// was encountered. -func (tm *TextMarshaler) writeProto3Any(w *textWriter, sv reflect.Value) (bool, error) { - turl := sv.FieldByName("TypeUrl") - val := sv.FieldByName("Value") - if !turl.IsValid() || !val.IsValid() { - return true, errors.New("proto: invalid google.protobuf.Any message") - } - - b, ok := val.Interface().([]byte) - if !ok { - return true, errors.New("proto: invalid google.protobuf.Any message") - } - - parts := strings.Split(turl.String(), "/") - mt := MessageType(parts[len(parts)-1]) - if mt == nil { - return false, nil - } - m := reflect.New(mt.Elem()) - if err := Unmarshal(b, m.Interface().(Message)); err != nil { - return false, nil - } - w.Write([]byte("[")) - u := turl.String() - if requiresQuotes(u) { - writeString(w, u) - } else { - w.Write([]byte(u)) - } - if w.compact { - w.Write([]byte("]:<")) - } else { - w.Write([]byte("]: <\n")) - w.ind++ - } - if err := tm.writeStruct(w, m.Elem()); err != nil { - return true, err - } - if w.compact { - w.Write([]byte("> ")) - } else { - w.ind-- - w.Write([]byte(">\n")) - } - return true, nil -} - -func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { - if tm.ExpandAny && isAny(sv) { - if canExpand, err := tm.writeProto3Any(w, sv); canExpand { - return err - } - } - st := sv.Type() - sprops := GetProperties(st) - for i := 0; i < sv.NumField(); i++ { - fv := sv.Field(i) - props := sprops.Prop[i] - name := st.Field(i).Name - - if strings.HasPrefix(name, "XXX_") { - // There are two XXX_ fields: - // XXX_unrecognized []byte - // XXX_extensions map[int32]proto.Extension - // The first is handled here; - // the second is handled at the bottom of this function. - if name == "XXX_unrecognized" && !fv.IsNil() { - if err := writeUnknownStruct(w, fv.Interface().([]byte)); err != nil { - return err - } - } - continue - } - if fv.Kind() == reflect.Ptr && fv.IsNil() { - // Field not filled in. This could be an optional field or - // a required field that wasn't filled in. Either way, there - // isn't anything we can show for it. - continue - } - if fv.Kind() == reflect.Slice && fv.IsNil() { - // Repeated field that is empty, or a bytes field that is unused. - continue - } - - if props.Repeated && fv.Kind() == reflect.Slice { - // Repeated field. - for j := 0; j < fv.Len(); j++ { - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - v := fv.Index(j) - if v.Kind() == reflect.Ptr && v.IsNil() { - // A nil message in a repeated field is not valid, - // but we can handle that more gracefully than panicking. - if _, err := w.Write([]byte("\n")); err != nil { - return err - } - continue - } - if err := tm.writeAny(w, v, props); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - continue - } - if fv.Kind() == reflect.Map { - // Map fields are rendered as a repeated struct with key/value fields. - keys := fv.MapKeys() - sort.Sort(mapKeys(keys)) - for _, key := range keys { - val := fv.MapIndex(key) - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - // open struct - if err := w.WriteByte('<'); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte('\n'); err != nil { - return err - } - } - w.indent() - // key - if _, err := w.WriteString("key:"); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, key, props.mkeyprop); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - // nil values aren't legal, but we can avoid panicking because of them. - if val.Kind() != reflect.Ptr || !val.IsNil() { - // value - if _, err := w.WriteString("value:"); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, val, props.mvalprop); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - // close struct - w.unindent() - if err := w.WriteByte('>'); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - continue - } - if props.proto3 && fv.Kind() == reflect.Slice && fv.Len() == 0 { - // empty bytes field - continue - } - if fv.Kind() != reflect.Ptr && fv.Kind() != reflect.Slice { - // proto3 non-repeated scalar field; skip if zero value - if isProto3Zero(fv) { - continue - } - } - - if fv.Kind() == reflect.Interface { - // Check if it is a oneof. - if st.Field(i).Tag.Get("protobuf_oneof") != "" { - // fv is nil, or holds a pointer to generated struct. - // That generated struct has exactly one field, - // which has a protobuf struct tag. - if fv.IsNil() { - continue - } - inner := fv.Elem().Elem() // interface -> *T -> T - tag := inner.Type().Field(0).Tag.Get("protobuf") - props = new(Properties) // Overwrite the outer props var, but not its pointee. - props.Parse(tag) - // Write the value in the oneof, not the oneof itself. - fv = inner.Field(0) - - // Special case to cope with malformed messages gracefully: - // If the value in the oneof is a nil pointer, don't panic - // in writeAny. - if fv.Kind() == reflect.Ptr && fv.IsNil() { - // Use errors.New so writeAny won't render quotes. - msg := errors.New("/* nil */") - fv = reflect.ValueOf(&msg).Elem() - } - } - } - - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if b, ok := fv.Interface().(raw); ok { - if err := writeRaw(w, b.Bytes()); err != nil { - return err - } - continue - } - - // Enums have a String method, so writeAny will work fine. - if err := tm.writeAny(w, fv, props); err != nil { - return err - } - - if err := w.WriteByte('\n'); err != nil { - return err - } - } - - // Extensions (the XXX_extensions field). - pv := sv.Addr() - if _, ok := extendable(pv.Interface()); ok { - if err := tm.writeExtensions(w, pv); err != nil { - return err - } - } - - return nil -} - -// writeRaw writes an uninterpreted raw message. -func writeRaw(w *textWriter, b []byte) error { - if err := w.WriteByte('<'); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte('\n'); err != nil { - return err - } - } - w.indent() - if err := writeUnknownStruct(w, b); err != nil { - return err - } - w.unindent() - if err := w.WriteByte('>'); err != nil { - return err - } - return nil -} - -// writeAny writes an arbitrary field. -func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error { - v = reflect.Indirect(v) - - // Floats have special cases. - if v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 { - x := v.Float() - var b []byte - switch { - case math.IsInf(x, 1): - b = posInf - case math.IsInf(x, -1): - b = negInf - case math.IsNaN(x): - b = nan - } - if b != nil { - _, err := w.Write(b) - return err - } - // Other values are handled below. - } - - // We don't attempt to serialise every possible value type; only those - // that can occur in protocol buffers. - switch v.Kind() { - case reflect.Slice: - // Should only be a []byte; repeated fields are handled in writeStruct. - if err := writeString(w, string(v.Bytes())); err != nil { - return err - } - case reflect.String: - if err := writeString(w, v.String()); err != nil { - return err - } - case reflect.Struct: - // Required/optional group/message. - var bra, ket byte = '<', '>' - if props != nil && props.Wire == "group" { - bra, ket = '{', '}' - } - if err := w.WriteByte(bra); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte('\n'); err != nil { - return err - } - } - w.indent() - if etm, ok := v.Interface().(encoding.TextMarshaler); ok { - text, err := etm.MarshalText() - if err != nil { - return err - } - if _, err = w.Write(text); err != nil { - return err - } - } else if err := tm.writeStruct(w, v); err != nil { - return err - } - w.unindent() - if err := w.WriteByte(ket); err != nil { - return err - } - default: - _, err := fmt.Fprint(w, v.Interface()) - return err - } - return nil -} - -// equivalent to C's isprint. -func isprint(c byte) bool { - return c >= 0x20 && c < 0x7f -} - -// writeString writes a string in the protocol buffer text format. -// It is similar to strconv.Quote except we don't use Go escape sequences, -// we treat the string as a byte sequence, and we use octal escapes. -// These differences are to maintain interoperability with the other -// languages' implementations of the text format. -func writeString(w *textWriter, s string) error { - // use WriteByte here to get any needed indent - if err := w.WriteByte('"'); err != nil { - return err - } - // Loop over the bytes, not the runes. - for i := 0; i < len(s); i++ { - var err error - // Divergence from C++: we don't escape apostrophes. - // There's no need to escape them, and the C++ parser - // copes with a naked apostrophe. - switch c := s[i]; c { - case '\n': - _, err = w.w.Write(backslashN) - case '\r': - _, err = w.w.Write(backslashR) - case '\t': - _, err = w.w.Write(backslashT) - case '"': - _, err = w.w.Write(backslashDQ) - case '\\': - _, err = w.w.Write(backslashBS) - default: - if isprint(c) { - err = w.w.WriteByte(c) - } else { - _, err = fmt.Fprintf(w.w, "\\%03o", c) - } - } - if err != nil { - return err - } - } - return w.WriteByte('"') -} - -func writeUnknownStruct(w *textWriter, data []byte) (err error) { - if !w.compact { - if _, err := fmt.Fprintf(w, "/* %d unknown bytes */\n", len(data)); err != nil { - return err - } - } - b := NewBuffer(data) - for b.index < len(b.buf) { - x, err := b.DecodeVarint() - if err != nil { - _, err := fmt.Fprintf(w, "/* %v */\n", err) - return err - } - wire, tag := x&7, x>>3 - if wire == WireEndGroup { - w.unindent() - if _, err := w.Write(endBraceNewline); err != nil { - return err - } - continue - } - if _, err := fmt.Fprint(w, tag); err != nil { - return err - } - if wire != WireStartGroup { - if err := w.WriteByte(':'); err != nil { - return err - } - } - if !w.compact || wire == WireStartGroup { - if err := w.WriteByte(' '); err != nil { - return err - } - } - switch wire { - case WireBytes: - buf, e := b.DecodeRawBytes(false) - if e == nil { - _, err = fmt.Fprintf(w, "%q", buf) - } else { - _, err = fmt.Fprintf(w, "/* %v */", e) - } - case WireFixed32: - x, err = b.DecodeFixed32() - err = writeUnknownInt(w, x, err) - case WireFixed64: - x, err = b.DecodeFixed64() - err = writeUnknownInt(w, x, err) - case WireStartGroup: - err = w.WriteByte('{') - w.indent() - case WireVarint: - x, err = b.DecodeVarint() - err = writeUnknownInt(w, x, err) - default: - _, err = fmt.Fprintf(w, "/* unknown wire type %d */", wire) - } - if err != nil { - return err - } - if err = w.WriteByte('\n'); err != nil { - return err - } - } - return nil -} - -func writeUnknownInt(w *textWriter, x uint64, err error) error { - if err == nil { - _, err = fmt.Fprint(w, x) - } else { - _, err = fmt.Fprintf(w, "/* %v */", err) - } - return err -} - -type int32Slice []int32 - -func (s int32Slice) Len() int { return len(s) } -func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] } -func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } - -// writeExtensions writes all the extensions in pv. -// pv is assumed to be a pointer to a protocol message struct that is extendable. -func (tm *TextMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error { - emap := extensionMaps[pv.Type().Elem()] - ep, _ := extendable(pv.Interface()) - - // Order the extensions by ID. - // This isn't strictly necessary, but it will give us - // canonical output, which will also make testing easier. - m, mu := ep.extensionsRead() - if m == nil { - return nil - } - mu.Lock() - ids := make([]int32, 0, len(m)) - for id := range m { - ids = append(ids, id) - } - sort.Sort(int32Slice(ids)) - mu.Unlock() - - for _, extNum := range ids { - ext := m[extNum] - var desc *ExtensionDesc - if emap != nil { - desc = emap[extNum] - } - if desc == nil { - // Unknown extension. - if err := writeUnknownStruct(w, ext.enc); err != nil { - return err - } - continue - } - - pb, err := GetExtension(ep, desc) - if err != nil { - return fmt.Errorf("failed getting extension: %v", err) - } - - // Repeated extensions will appear as a slice. - if !desc.repeated() { - if err := tm.writeExtension(w, desc.Name, pb); err != nil { - return err - } - } else { - v := reflect.ValueOf(pb) - for i := 0; i < v.Len(); i++ { - if err := tm.writeExtension(w, desc.Name, v.Index(i).Interface()); err != nil { - return err - } - } - } - } - return nil -} - -func (tm *TextMarshaler) writeExtension(w *textWriter, name string, pb interface{}) error { - if _, err := fmt.Fprintf(w, "[%s]:", name); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, reflect.ValueOf(pb), nil); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - return nil -} - -func (w *textWriter) writeIndent() { - if !w.complete { - return - } - remain := w.ind * 2 - for remain > 0 { - n := remain - if n > len(spaces) { - n = len(spaces) - } - w.w.Write(spaces[:n]) - remain -= n - } - w.complete = false -} - -// TextMarshaler is a configurable text format marshaler. -type TextMarshaler struct { - Compact bool // use compact text format (one line). - ExpandAny bool // expand google.protobuf.Any messages of known types -} - -// Marshal writes a given protocol buffer in text format. -// The only errors returned are from w. -func (tm *TextMarshaler) Marshal(w io.Writer, pb Message) error { - val := reflect.ValueOf(pb) - if pb == nil || val.IsNil() { - w.Write([]byte("")) - return nil - } - var bw *bufio.Writer - ww, ok := w.(writer) - if !ok { - bw = bufio.NewWriter(w) - ww = bw - } - aw := &textWriter{ - w: ww, - complete: true, - compact: tm.Compact, - } - - if etm, ok := pb.(encoding.TextMarshaler); ok { - text, err := etm.MarshalText() - if err != nil { - return err - } - if _, err = aw.Write(text); err != nil { - return err - } - if bw != nil { - return bw.Flush() - } - return nil - } - // Dereference the received pointer so we don't have outer < and >. - v := reflect.Indirect(val) - if err := tm.writeStruct(aw, v); err != nil { - return err - } - if bw != nil { - return bw.Flush() - } - return nil -} - -// Text is the same as Marshal, but returns the string directly. -func (tm *TextMarshaler) Text(pb Message) string { - var buf bytes.Buffer - tm.Marshal(&buf, pb) - return buf.String() -} - -var ( - defaultTextMarshaler = TextMarshaler{} - compactTextMarshaler = TextMarshaler{Compact: true} -) - -// TODO: consider removing some of the Marshal functions below. - -// MarshalText writes a given protocol buffer in text format. -// The only errors returned are from w. -func MarshalText(w io.Writer, pb Message) error { return defaultTextMarshaler.Marshal(w, pb) } - -// MarshalTextString is the same as MarshalText, but returns the string directly. -func MarshalTextString(pb Message) string { return defaultTextMarshaler.Text(pb) } - -// CompactText writes a given protocol buffer in compact text format (one line). -func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Marshal(w, pb) } - -// CompactTextString is the same as CompactText, but returns the string directly. -func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) } diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/text_parser.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/text_parser.go deleted file mode 100644 index 61f83c1e10f..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/golang/protobuf/proto/text_parser.go +++ /dev/null @@ -1,895 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// 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. - -package proto - -// Functions for parsing the Text protocol buffer format. -// TODO: message sets. - -import ( - "encoding" - "errors" - "fmt" - "reflect" - "strconv" - "strings" - "unicode/utf8" -) - -// Error string emitted when deserializing Any and fields are already set -const anyRepeatedlyUnpacked = "Any message unpacked multiple times, or %q already set" - -type ParseError struct { - Message string - Line int // 1-based line number - Offset int // 0-based byte offset from start of input -} - -func (p *ParseError) Error() string { - if p.Line == 1 { - // show offset only for first line - return fmt.Sprintf("line 1.%d: %v", p.Offset, p.Message) - } - return fmt.Sprintf("line %d: %v", p.Line, p.Message) -} - -type token struct { - value string - err *ParseError - line int // line number - offset int // byte number from start of input, not start of line - unquoted string // the unquoted version of value, if it was a quoted string -} - -func (t *token) String() string { - if t.err == nil { - return fmt.Sprintf("%q (line=%d, offset=%d)", t.value, t.line, t.offset) - } - return fmt.Sprintf("parse error: %v", t.err) -} - -type textParser struct { - s string // remaining input - done bool // whether the parsing is finished (success or error) - backed bool // whether back() was called - offset, line int - cur token -} - -func newTextParser(s string) *textParser { - p := new(textParser) - p.s = s - p.line = 1 - p.cur.line = 1 - return p -} - -func (p *textParser) errorf(format string, a ...interface{}) *ParseError { - pe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset} - p.cur.err = pe - p.done = true - return pe -} - -// Numbers and identifiers are matched by [-+._A-Za-z0-9] -func isIdentOrNumberChar(c byte) bool { - switch { - case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z': - return true - case '0' <= c && c <= '9': - return true - } - switch c { - case '-', '+', '.', '_': - return true - } - return false -} - -func isWhitespace(c byte) bool { - switch c { - case ' ', '\t', '\n', '\r': - return true - } - return false -} - -func isQuote(c byte) bool { - switch c { - case '"', '\'': - return true - } - return false -} - -func (p *textParser) skipWhitespace() { - i := 0 - for i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') { - if p.s[i] == '#' { - // comment; skip to end of line or input - for i < len(p.s) && p.s[i] != '\n' { - i++ - } - if i == len(p.s) { - break - } - } - if p.s[i] == '\n' { - p.line++ - } - i++ - } - p.offset += i - p.s = p.s[i:len(p.s)] - if len(p.s) == 0 { - p.done = true - } -} - -func (p *textParser) advance() { - // Skip whitespace - p.skipWhitespace() - if p.done { - return - } - - // Start of non-whitespace - p.cur.err = nil - p.cur.offset, p.cur.line = p.offset, p.line - p.cur.unquoted = "" - switch p.s[0] { - case '<', '>', '{', '}', ':', '[', ']', ';', ',', '/': - // Single symbol - p.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)] - case '"', '\'': - // Quoted string - i := 1 - for i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\n' { - if p.s[i] == '\\' && i+1 < len(p.s) { - // skip escaped char - i++ - } - i++ - } - if i >= len(p.s) || p.s[i] != p.s[0] { - p.errorf("unmatched quote") - return - } - unq, err := unquoteC(p.s[1:i], rune(p.s[0])) - if err != nil { - p.errorf("invalid quoted string %s: %v", p.s[0:i+1], err) - return - } - p.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)] - p.cur.unquoted = unq - default: - i := 0 - for i < len(p.s) && isIdentOrNumberChar(p.s[i]) { - i++ - } - if i == 0 { - p.errorf("unexpected byte %#x", p.s[0]) - return - } - p.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)] - } - p.offset += len(p.cur.value) -} - -var ( - errBadUTF8 = errors.New("proto: bad UTF-8") - errBadHex = errors.New("proto: bad hexadecimal") -) - -func unquoteC(s string, quote rune) (string, error) { - // This is based on C++'s tokenizer.cc. - // Despite its name, this is *not* parsing C syntax. - // For instance, "\0" is an invalid quoted string. - - // Avoid allocation in trivial cases. - simple := true - for _, r := range s { - if r == '\\' || r == quote { - simple = false - break - } - } - if simple { - return s, nil - } - - buf := make([]byte, 0, 3*len(s)/2) - for len(s) > 0 { - r, n := utf8.DecodeRuneInString(s) - if r == utf8.RuneError && n == 1 { - return "", errBadUTF8 - } - s = s[n:] - if r != '\\' { - if r < utf8.RuneSelf { - buf = append(buf, byte(r)) - } else { - buf = append(buf, string(r)...) - } - continue - } - - ch, tail, err := unescape(s) - if err != nil { - return "", err - } - buf = append(buf, ch...) - s = tail - } - return string(buf), nil -} - -func unescape(s string) (ch string, tail string, err error) { - r, n := utf8.DecodeRuneInString(s) - if r == utf8.RuneError && n == 1 { - return "", "", errBadUTF8 - } - s = s[n:] - switch r { - case 'a': - return "\a", s, nil - case 'b': - return "\b", s, nil - case 'f': - return "\f", s, nil - case 'n': - return "\n", s, nil - case 'r': - return "\r", s, nil - case 't': - return "\t", s, nil - case 'v': - return "\v", s, nil - case '?': - return "?", s, nil // trigraph workaround - case '\'', '"', '\\': - return string(r), s, nil - case '0', '1', '2', '3', '4', '5', '6', '7', 'x', 'X': - if len(s) < 2 { - return "", "", fmt.Errorf(`\%c requires 2 following digits`, r) - } - base := 8 - ss := s[:2] - s = s[2:] - if r == 'x' || r == 'X' { - base = 16 - } else { - ss = string(r) + ss - } - i, err := strconv.ParseUint(ss, base, 8) - if err != nil { - return "", "", err - } - return string([]byte{byte(i)}), s, nil - case 'u', 'U': - n := 4 - if r == 'U' { - n = 8 - } - if len(s) < n { - return "", "", fmt.Errorf(`\%c requires %d digits`, r, n) - } - - bs := make([]byte, n/2) - for i := 0; i < n; i += 2 { - a, ok1 := unhex(s[i]) - b, ok2 := unhex(s[i+1]) - if !ok1 || !ok2 { - return "", "", errBadHex - } - bs[i/2] = a<<4 | b - } - s = s[n:] - return string(bs), s, nil - } - return "", "", fmt.Errorf(`unknown escape \%c`, r) -} - -// Adapted from src/pkg/strconv/quote.go. -func unhex(b byte) (v byte, ok bool) { - switch { - case '0' <= b && b <= '9': - return b - '0', true - case 'a' <= b && b <= 'f': - return b - 'a' + 10, true - case 'A' <= b && b <= 'F': - return b - 'A' + 10, true - } - return 0, false -} - -// Back off the parser by one token. Can only be done between calls to next(). -// It makes the next advance() a no-op. -func (p *textParser) back() { p.backed = true } - -// Advances the parser and returns the new current token. -func (p *textParser) next() *token { - if p.backed || p.done { - p.backed = false - return &p.cur - } - p.advance() - if p.done { - p.cur.value = "" - } else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) { - // Look for multiple quoted strings separated by whitespace, - // and concatenate them. - cat := p.cur - for { - p.skipWhitespace() - if p.done || !isQuote(p.s[0]) { - break - } - p.advance() - if p.cur.err != nil { - return &p.cur - } - cat.value += " " + p.cur.value - cat.unquoted += p.cur.unquoted - } - p.done = false // parser may have seen EOF, but we want to return cat - p.cur = cat - } - return &p.cur -} - -func (p *textParser) consumeToken(s string) error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != s { - p.back() - return p.errorf("expected %q, found %q", s, tok.value) - } - return nil -} - -// Return a RequiredNotSetError indicating which required field was not set. -func (p *textParser) missingRequiredFieldError(sv reflect.Value) *RequiredNotSetError { - st := sv.Type() - sprops := GetProperties(st) - for i := 0; i < st.NumField(); i++ { - if !isNil(sv.Field(i)) { - continue - } - - props := sprops.Prop[i] - if props.Required { - return &RequiredNotSetError{fmt.Sprintf("%v.%v", st, props.OrigName)} - } - } - return &RequiredNotSetError{fmt.Sprintf("%v.", st)} // should not happen -} - -// Returns the index in the struct for the named field, as well as the parsed tag properties. -func structFieldByName(sprops *StructProperties, name string) (int, *Properties, bool) { - i, ok := sprops.decoderOrigNames[name] - if ok { - return i, sprops.Prop[i], true - } - return -1, nil, false -} - -// Consume a ':' from the input stream (if the next token is a colon), -// returning an error if a colon is needed but not present. -func (p *textParser) checkForColon(props *Properties, typ reflect.Type) *ParseError { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != ":" { - // Colon is optional when the field is a group or message. - needColon := true - switch props.Wire { - case "group": - needColon = false - case "bytes": - // A "bytes" field is either a message, a string, or a repeated field; - // those three become *T, *string and []T respectively, so we can check for - // this field being a pointer to a non-string. - if typ.Kind() == reflect.Ptr { - // *T or *string - if typ.Elem().Kind() == reflect.String { - break - } - } else if typ.Kind() == reflect.Slice { - // []T or []*T - if typ.Elem().Kind() != reflect.Ptr { - break - } - } else if typ.Kind() == reflect.String { - // The proto3 exception is for a string field, - // which requires a colon. - break - } - needColon = false - } - if needColon { - return p.errorf("expected ':', found %q", tok.value) - } - p.back() - } - return nil -} - -func (p *textParser) readStruct(sv reflect.Value, terminator string) error { - st := sv.Type() - sprops := GetProperties(st) - reqCount := sprops.reqCount - var reqFieldErr error - fieldSet := make(map[string]bool) - // A struct is a sequence of "name: value", terminated by one of - // '>' or '}', or the end of the input. A name may also be - // "[extension]" or "[type/url]". - // - // The whole struct can also be an expanded Any message, like: - // [type/url] < ... struct contents ... > - for { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == terminator { - break - } - if tok.value == "[" { - // Looks like an extension or an Any. - // - // TODO: Check whether we need to handle - // namespace rooted names (e.g. ".something.Foo"). - extName, err := p.consumeExtName() - if err != nil { - return err - } - - if s := strings.LastIndex(extName, "/"); s >= 0 { - // If it contains a slash, it's an Any type URL. - messageName := extName[s+1:] - mt := MessageType(messageName) - if mt == nil { - return p.errorf("unrecognized message %q in google.protobuf.Any", messageName) - } - tok = p.next() - if tok.err != nil { - return tok.err - } - // consume an optional colon - if tok.value == ":" { - tok = p.next() - if tok.err != nil { - return tok.err - } - } - var terminator string - switch tok.value { - case "<": - terminator = ">" - case "{": - terminator = "}" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - v := reflect.New(mt.Elem()) - if pe := p.readStruct(v.Elem(), terminator); pe != nil { - return pe - } - b, err := Marshal(v.Interface().(Message)) - if err != nil { - return p.errorf("failed to marshal message of type %q: %v", messageName, err) - } - if fieldSet["type_url"] { - return p.errorf(anyRepeatedlyUnpacked, "type_url") - } - if fieldSet["value"] { - return p.errorf(anyRepeatedlyUnpacked, "value") - } - sv.FieldByName("TypeUrl").SetString(extName) - sv.FieldByName("Value").SetBytes(b) - fieldSet["type_url"] = true - fieldSet["value"] = true - continue - } - - var desc *ExtensionDesc - // This could be faster, but it's functional. - // TODO: Do something smarter than a linear scan. - for _, d := range RegisteredExtensions(reflect.New(st).Interface().(Message)) { - if d.Name == extName { - desc = d - break - } - } - if desc == nil { - return p.errorf("unrecognized extension %q", extName) - } - - props := &Properties{} - props.Parse(desc.Tag) - - typ := reflect.TypeOf(desc.ExtensionType) - if err := p.checkForColon(props, typ); err != nil { - return err - } - - rep := desc.repeated() - - // Read the extension structure, and set it in - // the value we're constructing. - var ext reflect.Value - if !rep { - ext = reflect.New(typ).Elem() - } else { - ext = reflect.New(typ.Elem()).Elem() - } - if err := p.readAny(ext, props); err != nil { - if _, ok := err.(*RequiredNotSetError); !ok { - return err - } - reqFieldErr = err - } - ep := sv.Addr().Interface().(Message) - if !rep { - SetExtension(ep, desc, ext.Interface()) - } else { - old, err := GetExtension(ep, desc) - var sl reflect.Value - if err == nil { - sl = reflect.ValueOf(old) // existing slice - } else { - sl = reflect.MakeSlice(typ, 0, 1) - } - sl = reflect.Append(sl, ext) - SetExtension(ep, desc, sl.Interface()) - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - continue - } - - // This is a normal, non-extension field. - name := tok.value - var dst reflect.Value - fi, props, ok := structFieldByName(sprops, name) - if ok { - dst = sv.Field(fi) - } else if oop, ok := sprops.OneofTypes[name]; ok { - // It is a oneof. - props = oop.Prop - nv := reflect.New(oop.Type.Elem()) - dst = nv.Elem().Field(0) - field := sv.Field(oop.Field) - if !field.IsNil() { - return p.errorf("field '%s' would overwrite already parsed oneof '%s'", name, sv.Type().Field(oop.Field).Name) - } - field.Set(nv) - } - if !dst.IsValid() { - return p.errorf("unknown field name %q in %v", name, st) - } - - if dst.Kind() == reflect.Map { - // Consume any colon. - if err := p.checkForColon(props, dst.Type()); err != nil { - return err - } - - // Construct the map if it doesn't already exist. - if dst.IsNil() { - dst.Set(reflect.MakeMap(dst.Type())) - } - key := reflect.New(dst.Type().Key()).Elem() - val := reflect.New(dst.Type().Elem()).Elem() - - // The map entry should be this sequence of tokens: - // < key : KEY value : VALUE > - // However, implementations may omit key or value, and technically - // we should support them in any order. See b/28924776 for a time - // this went wrong. - - tok := p.next() - var terminator string - switch tok.value { - case "<": - terminator = ">" - case "{": - terminator = "}" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - for { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == terminator { - break - } - switch tok.value { - case "key": - if err := p.consumeToken(":"); err != nil { - return err - } - if err := p.readAny(key, props.mkeyprop); err != nil { - return err - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - case "value": - if err := p.checkForColon(props.mvalprop, dst.Type().Elem()); err != nil { - return err - } - if err := p.readAny(val, props.mvalprop); err != nil { - return err - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - default: - p.back() - return p.errorf(`expected "key", "value", or %q, found %q`, terminator, tok.value) - } - } - - dst.SetMapIndex(key, val) - continue - } - - // Check that it's not already set if it's not a repeated field. - if !props.Repeated && fieldSet[name] { - return p.errorf("non-repeated field %q was repeated", name) - } - - if err := p.checkForColon(props, dst.Type()); err != nil { - return err - } - - // Parse into the field. - fieldSet[name] = true - if err := p.readAny(dst, props); err != nil { - if _, ok := err.(*RequiredNotSetError); !ok { - return err - } - reqFieldErr = err - } - if props.Required { - reqCount-- - } - - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - - } - - if reqCount > 0 { - return p.missingRequiredFieldError(sv) - } - return reqFieldErr -} - -// consumeExtName consumes extension name or expanded Any type URL and the -// following ']'. It returns the name or URL consumed. -func (p *textParser) consumeExtName() (string, error) { - tok := p.next() - if tok.err != nil { - return "", tok.err - } - - // If extension name or type url is quoted, it's a single token. - if len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] { - name, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0])) - if err != nil { - return "", err - } - return name, p.consumeToken("]") - } - - // Consume everything up to "]" - var parts []string - for tok.value != "]" { - parts = append(parts, tok.value) - tok = p.next() - if tok.err != nil { - return "", p.errorf("unrecognized type_url or extension name: %s", tok.err) - } - } - return strings.Join(parts, ""), nil -} - -// consumeOptionalSeparator consumes an optional semicolon or comma. -// It is used in readStruct to provide backward compatibility. -func (p *textParser) consumeOptionalSeparator() error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != ";" && tok.value != "," { - p.back() - } - return nil -} - -func (p *textParser) readAny(v reflect.Value, props *Properties) error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == "" { - return p.errorf("unexpected EOF") - } - - switch fv := v; fv.Kind() { - case reflect.Slice: - at := v.Type() - if at.Elem().Kind() == reflect.Uint8 { - // Special case for []byte - if tok.value[0] != '"' && tok.value[0] != '\'' { - // Deliberately written out here, as the error after - // this switch statement would write "invalid []byte: ...", - // which is not as user-friendly. - return p.errorf("invalid string: %v", tok.value) - } - bytes := []byte(tok.unquoted) - fv.Set(reflect.ValueOf(bytes)) - return nil - } - // Repeated field. - if tok.value == "[" { - // Repeated field with list notation, like [1,2,3]. - for { - fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) - err := p.readAny(fv.Index(fv.Len()-1), props) - if err != nil { - return err - } - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == "]" { - break - } - if tok.value != "," { - return p.errorf("Expected ']' or ',' found %q", tok.value) - } - } - return nil - } - // One value of the repeated field. - p.back() - fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) - return p.readAny(fv.Index(fv.Len()-1), props) - case reflect.Bool: - // true/1/t/True or false/f/0/False. - switch tok.value { - case "true", "1", "t", "True": - fv.SetBool(true) - return nil - case "false", "0", "f", "False": - fv.SetBool(false) - return nil - } - case reflect.Float32, reflect.Float64: - v := tok.value - // Ignore 'f' for compatibility with output generated by C++, but don't - // remove 'f' when the value is "-inf" or "inf". - if strings.HasSuffix(v, "f") && tok.value != "-inf" && tok.value != "inf" { - v = v[:len(v)-1] - } - if f, err := strconv.ParseFloat(v, fv.Type().Bits()); err == nil { - fv.SetFloat(f) - return nil - } - case reflect.Int32: - if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil { - fv.SetInt(x) - return nil - } - - if len(props.Enum) == 0 { - break - } - m, ok := enumValueMaps[props.Enum] - if !ok { - break - } - x, ok := m[tok.value] - if !ok { - break - } - fv.SetInt(int64(x)) - return nil - case reflect.Int64: - if x, err := strconv.ParseInt(tok.value, 0, 64); err == nil { - fv.SetInt(x) - return nil - } - - case reflect.Ptr: - // A basic field (indirected through pointer), or a repeated message/group - p.back() - fv.Set(reflect.New(fv.Type().Elem())) - return p.readAny(fv.Elem(), props) - case reflect.String: - if tok.value[0] == '"' || tok.value[0] == '\'' { - fv.SetString(tok.unquoted) - return nil - } - case reflect.Struct: - var terminator string - switch tok.value { - case "{": - terminator = "}" - case "<": - terminator = ">" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - // TODO: Handle nested messages which implement encoding.TextUnmarshaler. - return p.readStruct(fv, terminator) - case reflect.Uint32: - if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { - fv.SetUint(uint64(x)) - return nil - } - case reflect.Uint64: - if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil { - fv.SetUint(x) - return nil - } - } - return p.errorf("invalid %v: %v", v.Type(), tok.value) -} - -// UnmarshalText reads a protocol buffer in Text format. UnmarshalText resets pb -// before starting to unmarshal, so any existing data in pb is always removed. -// If a required field is not set and no other error occurs, -// UnmarshalText returns *RequiredNotSetError. -func UnmarshalText(s string, pb Message) error { - if um, ok := pb.(encoding.TextUnmarshaler); ok { - err := um.UnmarshalText([]byte(s)) - return err - } - pb.Reset() - v := reflect.ValueOf(pb) - if pe := newTextParser(s).readStruct(v.Elem(), ""); pe != nil { - return pe - } - return nil -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/LICENSE b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/LICENSE deleted file mode 100644 index ade9307b390..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ -All files in this repository are licensed as follows. If you contribute -to this repository, it is assumed that you license your contribution -under the same license unless you state otherwise. - -All files Copyright (C) 2015 Canonical Ltd. unless otherwise specified in the file. - -This software is licensed under the LGPLv3, included below. - -As a special exception to the GNU Lesser General Public License version 3 -("LGPL3"), the copyright holders of this Library give you permission to -convey to a third party a Combined Work that links statically or dynamically -to this Library without providing any Minimal Corresponding Source or -Minimal Application Code as set out in 4d or providing the installation -information set out in section 4e, provided that you comply with the other -provisions of LGPL3 and provided that you meet, for the Application the -terms and conditions of the license(s) which apply to the Application. - -Except as stated in this special exception, the provisions of LGPL3 will -continue to comply in full to this Library. If you modify this Library, you -may apply this exception to your version of this Library, but you are not -obliged to do so. If you do not wish to do so, delete this exception -statement from your version. This exception does not (and cannot) modify any -license terms which apply to the Application, with which you must still -comply. - - - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/doc.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/doc.go deleted file mode 100644 index 35b119aa345..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/doc.go +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2013, 2014 Canonical Ltd. -// Licensed under the LGPLv3, see LICENCE file for details. - -/* -[godoc-link-here] - -The juju/errors provides an easy way to annotate errors without losing the -orginal error context. - -The exported `New` and `Errorf` functions are designed to replace the -`errors.New` and `fmt.Errorf` functions respectively. The same underlying -error is there, but the package also records the location at which the error -was created. - -A primary use case for this library is to add extra context any time an -error is returned from a function. - - if err := SomeFunc(); err != nil { - return err - } - -This instead becomes: - - if err := SomeFunc(); err != nil { - return errors.Trace(err) - } - -which just records the file and line number of the Trace call, or - - if err := SomeFunc(); err != nil { - return errors.Annotate(err, "more context") - } - -which also adds an annotation to the error. - -When you want to check to see if an error is of a particular type, a helper -function is normally exported by the package that returned the error, like the -`os` package does. The underlying cause of the error is available using the -`Cause` function. - - os.IsNotExist(errors.Cause(err)) - -The result of the `Error()` call on an annotated error is the annotations joined -with colons, then the result of the `Error()` method for the underlying error -that was the cause. - - err := errors.Errorf("original") - err = errors.Annotatef(err, "context") - err = errors.Annotatef(err, "more context") - err.Error() -> "more context: context: original" - -Obviously recording the file, line and functions is not very useful if you -cannot get them back out again. - - errors.ErrorStack(err) - -will return something like: - - first error - github.com/juju/errors/annotation_test.go:193: - github.com/juju/errors/annotation_test.go:194: annotation - github.com/juju/errors/annotation_test.go:195: - github.com/juju/errors/annotation_test.go:196: more context - github.com/juju/errors/annotation_test.go:197: - -The first error was generated by an external system, so there was no location -associated. The second, fourth, and last lines were generated with Trace calls, -and the other two through Annotate. - -Sometimes when responding to an error you want to return a more specific error -for the situation. - - if err := FindField(field); err != nil { - return errors.Wrap(err, errors.NotFoundf(field)) - } - -This returns an error where the complete error stack is still available, and -`errors.Cause()` will return the `NotFound` error. - -*/ -package errors diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/error.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/error.go deleted file mode 100644 index 8c51c45b39e..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/error.go +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2014 Canonical Ltd. -// Licensed under the LGPLv3, see LICENCE file for details. - -package errors - -import ( - "fmt" - "reflect" - "runtime" -) - -// Err holds a description of an error along with information about -// where the error was created. -// -// It may be embedded in custom error types to add extra information that -// this errors package can understand. -type Err struct { - // message holds an annotation of the error. - message string - - // cause holds the cause of the error as returned - // by the Cause method. - cause error - - // previous holds the previous error in the error stack, if any. - previous error - - // file and line hold the source code location where the error was - // created. - file string - line int -} - -// NewErr is used to return an Err for the purpose of embedding in other -// structures. The location is not specified, and needs to be set with a call -// to SetLocation. -// -// For example: -// type FooError struct { -// errors.Err -// code int -// } -// -// func NewFooError(code int) error { -// err := &FooError{errors.NewErr("foo"), code} -// err.SetLocation(1) -// return err -// } -func NewErr(format string, args ...interface{}) Err { - return Err{ - message: fmt.Sprintf(format, args...), - } -} - -// NewErrWithCause is used to return an Err with case by other error for the purpose of embedding in other -// structures. The location is not specified, and needs to be set with a call -// to SetLocation. -// -// For example: -// type FooError struct { -// errors.Err -// code int -// } -// -// func (e *FooError) Annotate(format string, args ...interface{}) error { -// err := &FooError{errors.NewErrWithCause(e.Err, format, args...), e.code} -// err.SetLocation(1) -// return err -// }) -func NewErrWithCause(other error, format string, args ...interface{}) Err { - return Err{ - message: fmt.Sprintf(format, args...), - cause: Cause(other), - previous: other, - } -} - -// Location is the file and line of where the error was most recently -// created or annotated. -func (e *Err) Location() (filename string, line int) { - return e.file, e.line -} - -// Underlying returns the previous error in the error stack, if any. A client -// should not ever really call this method. It is used to build the error -// stack and should not be introspected by client calls. Or more -// specifically, clients should not depend on anything but the `Cause` of an -// error. -func (e *Err) Underlying() error { - return e.previous -} - -// The Cause of an error is the most recent error in the error stack that -// meets one of these criteria: the original error that was raised; the new -// error that was passed into the Wrap function; the most recently masked -// error; or nil if the error itself is considered the Cause. Normally this -// method is not invoked directly, but instead through the Cause stand alone -// function. -func (e *Err) Cause() error { - return e.cause -} - -// Message returns the message stored with the most recent location. This is -// the empty string if the most recent call was Trace, or the message stored -// with Annotate or Mask. -func (e *Err) Message() string { - return e.message -} - -// Error implements error.Error. -func (e *Err) Error() string { - // We want to walk up the stack of errors showing the annotations - // as long as the cause is the same. - err := e.previous - if !sameError(Cause(err), e.cause) && e.cause != nil { - err = e.cause - } - switch { - case err == nil: - return e.message - case e.message == "": - return err.Error() - } - return fmt.Sprintf("%s: %v", e.message, err) -} - -// SetLocation records the source location of the error at callDepth stack -// frames above the call. -func (e *Err) SetLocation(callDepth int) { - _, file, line, _ := runtime.Caller(callDepth + 1) - e.file = trimGoPath(file) - e.line = line -} - -// StackTrace returns one string for each location recorded in the stack of -// errors. The first value is the originating error, with a line for each -// other annotation or tracing of the error. -func (e *Err) StackTrace() []string { - return errorStack(e) -} - -// Ideally we'd have a way to check identity, but deep equals will do. -func sameError(e1, e2 error) bool { - return reflect.DeepEqual(e1, e2) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/errortypes.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/errortypes.go deleted file mode 100644 index 10b3b19c22a..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/errortypes.go +++ /dev/null @@ -1,284 +0,0 @@ -// Copyright 2014 Canonical Ltd. -// Licensed under the LGPLv3, see LICENCE file for details. - -package errors - -import ( - "fmt" -) - -// wrap is a helper to construct an *wrapper. -func wrap(err error, format, suffix string, args ...interface{}) Err { - newErr := Err{ - message: fmt.Sprintf(format+suffix, args...), - previous: err, - } - newErr.SetLocation(2) - return newErr -} - -// notFound represents an error when something has not been found. -type notFound struct { - Err -} - -// NotFoundf returns an error which satisfies IsNotFound(). -func NotFoundf(format string, args ...interface{}) error { - return ¬Found{wrap(nil, format, " not found", args...)} -} - -// NewNotFound returns an error which wraps err that satisfies -// IsNotFound(). -func NewNotFound(err error, msg string) error { - return ¬Found{wrap(err, msg, "")} -} - -// IsNotFound reports whether err was created with NotFoundf() or -// NewNotFound(). -func IsNotFound(err error) bool { - err = Cause(err) - _, ok := err.(*notFound) - return ok -} - -// userNotFound represents an error when an inexistent user is looked up. -type userNotFound struct { - Err -} - -// UserNotFoundf returns an error which satisfies IsUserNotFound(). -func UserNotFoundf(format string, args ...interface{}) error { - return &userNotFound{wrap(nil, format, " user not found", args...)} -} - -// NewUserNotFound returns an error which wraps err and satisfies -// IsUserNotFound(). -func NewUserNotFound(err error, msg string) error { - return &userNotFound{wrap(err, msg, "")} -} - -// IsUserNotFound reports whether err was created with UserNotFoundf() or -// NewUserNotFound(). -func IsUserNotFound(err error) bool { - err = Cause(err) - _, ok := err.(*userNotFound) - return ok -} - -// unauthorized represents an error when an operation is unauthorized. -type unauthorized struct { - Err -} - -// Unauthorizedf returns an error which satisfies IsUnauthorized(). -func Unauthorizedf(format string, args ...interface{}) error { - return &unauthorized{wrap(nil, format, "", args...)} -} - -// NewUnauthorized returns an error which wraps err and satisfies -// IsUnauthorized(). -func NewUnauthorized(err error, msg string) error { - return &unauthorized{wrap(err, msg, "")} -} - -// IsUnauthorized reports whether err was created with Unauthorizedf() or -// NewUnauthorized(). -func IsUnauthorized(err error) bool { - err = Cause(err) - _, ok := err.(*unauthorized) - return ok -} - -// notImplemented represents an error when something is not -// implemented. -type notImplemented struct { - Err -} - -// NotImplementedf returns an error which satisfies IsNotImplemented(). -func NotImplementedf(format string, args ...interface{}) error { - return ¬Implemented{wrap(nil, format, " not implemented", args...)} -} - -// NewNotImplemented returns an error which wraps err and satisfies -// IsNotImplemented(). -func NewNotImplemented(err error, msg string) error { - return ¬Implemented{wrap(err, msg, "")} -} - -// IsNotImplemented reports whether err was created with -// NotImplementedf() or NewNotImplemented(). -func IsNotImplemented(err error) bool { - err = Cause(err) - _, ok := err.(*notImplemented) - return ok -} - -// alreadyExists represents and error when something already exists. -type alreadyExists struct { - Err -} - -// AlreadyExistsf returns an error which satisfies IsAlreadyExists(). -func AlreadyExistsf(format string, args ...interface{}) error { - return &alreadyExists{wrap(nil, format, " already exists", args...)} -} - -// NewAlreadyExists returns an error which wraps err and satisfies -// IsAlreadyExists(). -func NewAlreadyExists(err error, msg string) error { - return &alreadyExists{wrap(err, msg, "")} -} - -// IsAlreadyExists reports whether the error was created with -// AlreadyExistsf() or NewAlreadyExists(). -func IsAlreadyExists(err error) bool { - err = Cause(err) - _, ok := err.(*alreadyExists) - return ok -} - -// notSupported represents an error when something is not supported. -type notSupported struct { - Err -} - -// NotSupportedf returns an error which satisfies IsNotSupported(). -func NotSupportedf(format string, args ...interface{}) error { - return ¬Supported{wrap(nil, format, " not supported", args...)} -} - -// NewNotSupported returns an error which wraps err and satisfies -// IsNotSupported(). -func NewNotSupported(err error, msg string) error { - return ¬Supported{wrap(err, msg, "")} -} - -// IsNotSupported reports whether the error was created with -// NotSupportedf() or NewNotSupported(). -func IsNotSupported(err error) bool { - err = Cause(err) - _, ok := err.(*notSupported) - return ok -} - -// notValid represents an error when something is not valid. -type notValid struct { - Err -} - -// NotValidf returns an error which satisfies IsNotValid(). -func NotValidf(format string, args ...interface{}) error { - return ¬Valid{wrap(nil, format, " not valid", args...)} -} - -// NewNotValid returns an error which wraps err and satisfies IsNotValid(). -func NewNotValid(err error, msg string) error { - return ¬Valid{wrap(err, msg, "")} -} - -// IsNotValid reports whether the error was created with NotValidf() or -// NewNotValid(). -func IsNotValid(err error) bool { - err = Cause(err) - _, ok := err.(*notValid) - return ok -} - -// notProvisioned represents an error when something is not yet provisioned. -type notProvisioned struct { - Err -} - -// NotProvisionedf returns an error which satisfies IsNotProvisioned(). -func NotProvisionedf(format string, args ...interface{}) error { - return ¬Provisioned{wrap(nil, format, " not provisioned", args...)} -} - -// NewNotProvisioned returns an error which wraps err that satisfies -// IsNotProvisioned(). -func NewNotProvisioned(err error, msg string) error { - return ¬Provisioned{wrap(err, msg, "")} -} - -// IsNotProvisioned reports whether err was created with NotProvisionedf() or -// NewNotProvisioned(). -func IsNotProvisioned(err error) bool { - err = Cause(err) - _, ok := err.(*notProvisioned) - return ok -} - -// notAssigned represents an error when something is not yet assigned to -// something else. -type notAssigned struct { - Err -} - -// NotAssignedf returns an error which satisfies IsNotAssigned(). -func NotAssignedf(format string, args ...interface{}) error { - return ¬Assigned{wrap(nil, format, " not assigned", args...)} -} - -// NewNotAssigned returns an error which wraps err that satisfies -// IsNotAssigned(). -func NewNotAssigned(err error, msg string) error { - return ¬Assigned{wrap(err, msg, "")} -} - -// IsNotAssigned reports whether err was created with NotAssignedf() or -// NewNotAssigned(). -func IsNotAssigned(err error) bool { - err = Cause(err) - _, ok := err.(*notAssigned) - return ok -} - -// badRequest represents an error when a request has bad parameters. -type badRequest struct { - Err -} - -// BadRequestf returns an error which satisfies IsBadRequest(). -func BadRequestf(format string, args ...interface{}) error { - return &badRequest{wrap(nil, format, "", args...)} -} - -// NewBadRequest returns an error which wraps err that satisfies -// IsBadRequest(). -func NewBadRequest(err error, msg string) error { - return &badRequest{wrap(err, msg, "")} -} - -// IsBadRequest reports whether err was created with BadRequestf() or -// NewBadRequest(). -func IsBadRequest(err error) bool { - err = Cause(err) - _, ok := err.(*badRequest) - return ok -} - -// methodNotAllowed represents an error when an HTTP request -// is made with an inappropriate method. -type methodNotAllowed struct { - Err -} - -// MethodNotAllowedf returns an error which satisfies IsMethodNotAllowed(). -func MethodNotAllowedf(format string, args ...interface{}) error { - return &methodNotAllowed{wrap(nil, format, "", args...)} -} - -// NewMethodNotAllowed returns an error which wraps err that satisfies -// IsMethodNotAllowed(). -func NewMethodNotAllowed(err error, msg string) error { - return &methodNotAllowed{wrap(err, msg, "")} -} - -// IsMethodNotAllowed reports whether err was created with MethodNotAllowedf() or -// NewMethodNotAllowed(). -func IsMethodNotAllowed(err error) bool { - err = Cause(err) - _, ok := err.(*methodNotAllowed) - return ok -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/functions.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/functions.go deleted file mode 100644 index 994208d8d77..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/functions.go +++ /dev/null @@ -1,330 +0,0 @@ -// Copyright 2014 Canonical Ltd. -// Licensed under the LGPLv3, see LICENCE file for details. - -package errors - -import ( - "fmt" - "strings" -) - -// New is a drop in replacement for the standard libary errors module that records -// the location that the error is created. -// -// For example: -// return errors.New("validation failed") -// -func New(message string) error { - err := &Err{message: message} - err.SetLocation(1) - return err -} - -// Errorf creates a new annotated error and records the location that the -// error is created. This should be a drop in replacement for fmt.Errorf. -// -// For example: -// return errors.Errorf("validation failed: %s", message) -// -func Errorf(format string, args ...interface{}) error { - err := &Err{message: fmt.Sprintf(format, args...)} - err.SetLocation(1) - return err -} - -// Trace adds the location of the Trace call to the stack. The Cause of the -// resulting error is the same as the error parameter. If the other error is -// nil, the result will be nil. -// -// For example: -// if err := SomeFunc(); err != nil { -// return errors.Trace(err) -// } -// -func Trace(other error) error { - if other == nil { - return nil - } - err := &Err{previous: other, cause: Cause(other)} - err.SetLocation(1) - return err -} - -// Annotate is used to add extra context to an existing error. The location of -// the Annotate call is recorded with the annotations. The file, line and -// function are also recorded. -// -// For example: -// if err := SomeFunc(); err != nil { -// return errors.Annotate(err, "failed to frombulate") -// } -// -func Annotate(other error, message string) error { - if other == nil { - return nil - } - err := &Err{ - previous: other, - cause: Cause(other), - message: message, - } - err.SetLocation(1) - return err -} - -// Annotatef is used to add extra context to an existing error. The location of -// the Annotate call is recorded with the annotations. The file, line and -// function are also recorded. -// -// For example: -// if err := SomeFunc(); err != nil { -// return errors.Annotatef(err, "failed to frombulate the %s", arg) -// } -// -func Annotatef(other error, format string, args ...interface{}) error { - if other == nil { - return nil - } - err := &Err{ - previous: other, - cause: Cause(other), - message: fmt.Sprintf(format, args...), - } - err.SetLocation(1) - return err -} - -// DeferredAnnotatef annotates the given error (when it is not nil) with the given -// format string and arguments (like fmt.Sprintf). If *err is nil, DeferredAnnotatef -// does nothing. This method is used in a defer statement in order to annotate any -// resulting error with the same message. -// -// For example: -// -// defer DeferredAnnotatef(&err, "failed to frombulate the %s", arg) -// -func DeferredAnnotatef(err *error, format string, args ...interface{}) { - if *err == nil { - return - } - newErr := &Err{ - message: fmt.Sprintf(format, args...), - cause: Cause(*err), - previous: *err, - } - newErr.SetLocation(1) - *err = newErr -} - -// Wrap changes the Cause of the error. The location of the Wrap call is also -// stored in the error stack. -// -// For example: -// if err := SomeFunc(); err != nil { -// newErr := &packageError{"more context", private_value} -// return errors.Wrap(err, newErr) -// } -// -func Wrap(other, newDescriptive error) error { - err := &Err{ - previous: other, - cause: newDescriptive, - } - err.SetLocation(1) - return err -} - -// Wrapf changes the Cause of the error, and adds an annotation. The location -// of the Wrap call is also stored in the error stack. -// -// For example: -// if err := SomeFunc(); err != nil { -// return errors.Wrapf(err, simpleErrorType, "invalid value %q", value) -// } -// -func Wrapf(other, newDescriptive error, format string, args ...interface{}) error { - err := &Err{ - message: fmt.Sprintf(format, args...), - previous: other, - cause: newDescriptive, - } - err.SetLocation(1) - return err -} - -// Mask masks the given error with the given format string and arguments (like -// fmt.Sprintf), returning a new error that maintains the error stack, but -// hides the underlying error type. The error string still contains the full -// annotations. If you want to hide the annotations, call Wrap. -func Maskf(other error, format string, args ...interface{}) error { - if other == nil { - return nil - } - err := &Err{ - message: fmt.Sprintf(format, args...), - previous: other, - } - err.SetLocation(1) - return err -} - -// Mask hides the underlying error type, and records the location of the masking. -func Mask(other error) error { - if other == nil { - return nil - } - err := &Err{ - previous: other, - } - err.SetLocation(1) - return err -} - -// Cause returns the cause of the given error. This will be either the -// original error, or the result of a Wrap or Mask call. -// -// Cause is the usual way to diagnose errors that may have been wrapped by -// the other errors functions. -func Cause(err error) error { - var diag error - if err, ok := err.(causer); ok { - diag = err.Cause() - } - if diag != nil { - return diag - } - return err -} - -type causer interface { - Cause() error -} - -type wrapper interface { - // Message returns the top level error message, - // not including the message from the Previous - // error. - Message() string - - // Underlying returns the Previous error, or nil - // if there is none. - Underlying() error -} - -type locationer interface { - Location() (string, int) -} - -var ( - _ wrapper = (*Err)(nil) - _ locationer = (*Err)(nil) - _ causer = (*Err)(nil) -) - -// Details returns information about the stack of errors wrapped by err, in -// the format: -// -// [{filename:99: error one} {otherfile:55: cause of error one}] -// -// This is a terse alternative to ErrorStack as it returns a single line. -func Details(err error) string { - if err == nil { - return "[]" - } - var s []byte - s = append(s, '[') - for { - s = append(s, '{') - if err, ok := err.(locationer); ok { - file, line := err.Location() - if file != "" { - s = append(s, fmt.Sprintf("%s:%d", file, line)...) - s = append(s, ": "...) - } - } - if cerr, ok := err.(wrapper); ok { - s = append(s, cerr.Message()...) - err = cerr.Underlying() - } else { - s = append(s, err.Error()...) - err = nil - } - s = append(s, '}') - if err == nil { - break - } - s = append(s, ' ') - } - s = append(s, ']') - return string(s) -} - -// ErrorStack returns a string representation of the annotated error. If the -// error passed as the parameter is not an annotated error, the result is -// simply the result of the Error() method on that error. -// -// If the error is an annotated error, a multi-line string is returned where -// each line represents one entry in the annotation stack. The full filename -// from the call stack is used in the output. -// -// first error -// github.com/juju/errors/annotation_test.go:193: -// github.com/juju/errors/annotation_test.go:194: annotation -// github.com/juju/errors/annotation_test.go:195: -// github.com/juju/errors/annotation_test.go:196: more context -// github.com/juju/errors/annotation_test.go:197: -func ErrorStack(err error) string { - return strings.Join(errorStack(err), "\n") -} - -func errorStack(err error) []string { - if err == nil { - return nil - } - - // We want the first error first - var lines []string - for { - var buff []byte - if err, ok := err.(locationer); ok { - file, line := err.Location() - // Strip off the leading GOPATH/src path elements. - file = trimGoPath(file) - if file != "" { - buff = append(buff, fmt.Sprintf("%s:%d", file, line)...) - buff = append(buff, ": "...) - } - } - if cerr, ok := err.(wrapper); ok { - message := cerr.Message() - buff = append(buff, message...) - // If there is a cause for this error, and it is different to the cause - // of the underlying error, then output the error string in the stack trace. - var cause error - if err1, ok := err.(causer); ok { - cause = err1.Cause() - } - err = cerr.Underlying() - if cause != nil && !sameError(Cause(err), cause) { - if message != "" { - buff = append(buff, ": "...) - } - buff = append(buff, cause.Error()...) - } - } else { - buff = append(buff, err.Error()...) - err = nil - } - lines = append(lines, string(buff)) - if err == nil { - break - } - } - // reverse the lines to get the original error, which was at the end of - // the list, back to the start. - var result []string - for i := len(lines); i > 0; i-- { - result = append(result, lines[i-1]) - } - return result -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/path.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/path.go deleted file mode 100644 index a7b726ab094..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/juju/errors/path.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2013, 2014 Canonical Ltd. -// Licensed under the LGPLv3, see LICENCE file for details. - -package errors - -import ( - "runtime" - "strings" -) - -// prefixSize is used internally to trim the user specific path from the -// front of the returned filenames from the runtime call stack. -var prefixSize int - -// goPath is the deduced path based on the location of this file as compiled. -var goPath string - -func init() { - _, file, _, ok := runtime.Caller(0) - if file == "?" { - return - } - if ok { - // We know that the end of the file should be: - // github.com/juju/errors/path.go - size := len(file) - suffix := len("github.com/juju/errors/path.go") - goPath = file[:size-suffix] - prefixSize = len(goPath) - } -} - -func trimGoPath(filename string) string { - if strings.HasPrefix(filename, goPath) { - return filename[prefixSize:] - } - return filename -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/LICENSE b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/LICENSE deleted file mode 100644 index 8dada3edaf5..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/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/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-binlog.sh b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-binlog.sh deleted file mode 100755 index 71fbf4c85a0..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-binlog.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -cd proto/binlog - -echo "generate binlog code..." -GOGO_ROOT=${GOPATH}/src/github.com/gogo/protobuf -protoc -I.:${GOGO_ROOT}:${GOGO_ROOT}/protobuf --gofast_out=../../go-binlog binlog.proto -protoc -I.:${GOGO_ROOT}:${GOGO_ROOT}/protobuf --gofast_out=plugins=grpc:../../go-binlog pump.proto -protoc -I.:${GOGO_ROOT}:${GOGO_ROOT}/protobuf --gofast_out=plugins=grpc:../../go-binlog cistern.proto -cd ../../go-binlog -sed -i.bak -E 's/import _ \"gogoproto\"//g' *.pb.go -sed -i.bak -E 's/import fmt \"fmt\"//g' *.pb.go -rm -f *.bak -goimports -w *.pb.go diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-go.sh b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-go.sh deleted file mode 100755 index ef91f60abb1..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-go.sh +++ /dev/null @@ -1,10 +0,0 @@ -cd proto - -echo "generate go code..." -GOGO_ROOT=${GOPATH}/src/github.com/gogo/protobuf -protoc -I.:${GOGO_ROOT}:${GOGO_ROOT}/protobuf --gofast_out=../go-tipb *.proto -cd ../go-tipb -sed -i.bak -E 's/import _ \"gogoproto\"//g' *.pb.go -sed -i.bak -E 's/import fmt \"fmt\"//g' *.pb.go -rm -f *.bak -goimports -w *.pb.go diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-rust.sh b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-rust.sh deleted file mode 100755 index 605bd98d370..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/generate-rust.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -cd proto - -echo "generate rust code..." -ret=0 -GOGO_ROOT=${GOPATH}/src/github.com/gogo/protobuf -protoc -I.:${GOGO_ROOT}:${GOGO_ROOT}/protobuf --rust_out ../src *.proto || ret=$? - - -echo "extern crate protobuf;" > ../src/lib.rs -for file in `ls *.proto` - do - base_name=$(basename $file ".proto") - echo "#[cfg_attr(rustfmt, rustfmt_skip)]" >> ../src/lib.rs - echo "pub mod $base_name;" >> ../src/lib.rs -done -if [[ $ret -ne 0 ]]; then - exit $ret -fi -cd .. -cargo build diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/sharedbytes/sharedbytes.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/sharedbytes/sharedbytes.go deleted file mode 100644 index 4dd461e0c41..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/github.com/pingcap/tipb/sharedbytes/sharedbytes.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2017 PingCAP, Inc. -// -// 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, -// See the License for the specific language governing permissions and -// limitations under the License. - -package sharedbytes - -// SharedBytes is a custom type for protobuf, it does not -// allocates memory in Unmarshal. -type SharedBytes []byte - -// Marshal implements custom type for gogo/protobuf. -func (sb SharedBytes) Marshal() ([]byte, error) { - data := make([]byte, len(sb)) - copy(data, sb) - return data, nil -} - -// MarshalTo implements custom type for gogo/protobuf. -func (sb SharedBytes) MarshalTo(data []byte) (n int, err error) { - n = copy(data, sb) - return -} - -// Unmarshal implements custom type for gogo/protobuf. -func (sb *SharedBytes) Unmarshal(data []byte) error { - *sb = data - return nil -} - -// Size implements custom type for gogo/protobuf. -func (sb SharedBytes) Size() int { - return len(sb) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/LICENSE b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/LICENSE deleted file mode 100644 index 6a66aea5eaf..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 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/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/PATENTS b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/PATENTS deleted file mode 100644 index 733099041f8..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/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/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/context/context.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/context/context.go deleted file mode 100644 index 77b64d0c679..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/context/context.go +++ /dev/null @@ -1,447 +0,0 @@ -// Copyright 2014 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 context defines the Context type, which carries deadlines, -// cancelation signals, and other request-scoped values across API boundaries -// and between processes. -// -// Incoming requests to a server should create a Context, and outgoing calls to -// servers should accept a Context. The chain of function calls between must -// propagate the Context, optionally replacing it with a modified copy created -// using WithDeadline, WithTimeout, WithCancel, or WithValue. -// -// Programs that use Contexts should follow these rules to keep interfaces -// consistent across packages and enable static analysis tools to check context -// propagation: -// -// Do not store Contexts inside a struct type; instead, pass a Context -// explicitly to each function that needs it. The Context should be the first -// parameter, typically named ctx: -// -// func DoSomething(ctx context.Context, arg Arg) error { -// // ... use ctx ... -// } -// -// Do not pass a nil Context, even if a function permits it. Pass context.TODO -// if you are unsure about which Context to use. -// -// Use context Values only for request-scoped data that transits processes and -// APIs, not for passing optional parameters to functions. -// -// The same Context may be passed to functions running in different goroutines; -// Contexts are safe for simultaneous use by multiple goroutines. -// -// See http://blog.golang.org/context for example code for a server that uses -// Contexts. -package context // import "golang.org/x/net/context" - -import ( - "errors" - "fmt" - "sync" - "time" -) - -// A Context carries a deadline, a cancelation signal, and other values across -// API boundaries. -// -// Context's methods may be called by multiple goroutines simultaneously. -type Context interface { - // Deadline returns the time when work done on behalf of this context - // should be canceled. Deadline returns ok==false when no deadline is - // set. Successive calls to Deadline return the same results. - Deadline() (deadline time.Time, ok bool) - - // Done returns a channel that's closed when work done on behalf of this - // context should be canceled. Done may return nil if this context can - // never be canceled. Successive calls to Done return the same value. - // - // WithCancel arranges for Done to be closed when cancel is called; - // WithDeadline arranges for Done to be closed when the deadline - // expires; WithTimeout arranges for Done to be closed when the timeout - // elapses. - // - // Done is provided for use in select statements: - // - // // Stream generates values with DoSomething and sends them to out - // // until DoSomething returns an error or ctx.Done is closed. - // func Stream(ctx context.Context, out <-chan Value) error { - // for { - // v, err := DoSomething(ctx) - // if err != nil { - // return err - // } - // select { - // case <-ctx.Done(): - // return ctx.Err() - // case out <- v: - // } - // } - // } - // - // See http://blog.golang.org/pipelines for more examples of how to use - // a Done channel for cancelation. - Done() <-chan struct{} - - // Err returns a non-nil error value after Done is closed. Err returns - // Canceled if the context was canceled or DeadlineExceeded if the - // context's deadline passed. No other values for Err are defined. - // After Done is closed, successive calls to Err return the same value. - Err() error - - // Value returns the value associated with this context for key, or nil - // if no value is associated with key. Successive calls to Value with - // the same key returns the same result. - // - // Use context values only for request-scoped data that transits - // processes and API boundaries, not for passing optional parameters to - // functions. - // - // A key identifies a specific value in a Context. Functions that wish - // to store values in Context typically allocate a key in a global - // variable then use that key as the argument to context.WithValue and - // Context.Value. A key can be any type that supports equality; - // packages should define keys as an unexported type to avoid - // collisions. - // - // Packages that define a Context key should provide type-safe accessors - // for the values stores using that key: - // - // // Package user defines a User type that's stored in Contexts. - // package user - // - // import "golang.org/x/net/context" - // - // // User is the type of value stored in the Contexts. - // type User struct {...} - // - // // key is an unexported type for keys defined in this package. - // // This prevents collisions with keys defined in other packages. - // type key int - // - // // userKey is the key for user.User values in Contexts. It is - // // unexported; clients use user.NewContext and user.FromContext - // // instead of using this key directly. - // var userKey key = 0 - // - // // NewContext returns a new Context that carries value u. - // func NewContext(ctx context.Context, u *User) context.Context { - // return context.WithValue(ctx, userKey, u) - // } - // - // // FromContext returns the User value stored in ctx, if any. - // func FromContext(ctx context.Context) (*User, bool) { - // u, ok := ctx.Value(userKey).(*User) - // return u, ok - // } - Value(key interface{}) interface{} -} - -// Canceled is the error returned by Context.Err when the context is canceled. -var Canceled = errors.New("context canceled") - -// DeadlineExceeded is the error returned by Context.Err when the context's -// deadline passes. -var DeadlineExceeded = errors.New("context deadline exceeded") - -// An emptyCtx is never canceled, has no values, and has no deadline. It is not -// struct{}, since vars of this type must have distinct addresses. -type emptyCtx int - -func (*emptyCtx) Deadline() (deadline time.Time, ok bool) { - return -} - -func (*emptyCtx) Done() <-chan struct{} { - return nil -} - -func (*emptyCtx) Err() error { - return nil -} - -func (*emptyCtx) Value(key interface{}) interface{} { - return nil -} - -func (e *emptyCtx) String() string { - switch e { - case background: - return "context.Background" - case todo: - return "context.TODO" - } - return "unknown empty Context" -} - -var ( - background = new(emptyCtx) - todo = new(emptyCtx) -) - -// Background returns a non-nil, empty Context. It is never canceled, has no -// values, and has no deadline. It is typically used by the main function, -// initialization, and tests, and as the top-level Context for incoming -// requests. -func Background() Context { - return background -} - -// TODO returns a non-nil, empty Context. Code should use context.TODO when -// it's unclear which Context to use or it is not yet available (because the -// surrounding function has not yet been extended to accept a Context -// parameter). TODO is recognized by static analysis tools that determine -// whether Contexts are propagated correctly in a program. -func TODO() Context { - return todo -} - -// A CancelFunc tells an operation to abandon its work. -// A CancelFunc does not wait for the work to stop. -// After the first call, subsequent calls to a CancelFunc do nothing. -type CancelFunc func() - -// WithCancel returns a copy of parent with a new Done channel. The returned -// context's Done channel is closed when the returned cancel function is called -// or when the parent context's Done channel is closed, whichever happens first. -// -// Canceling this context releases resources associated with it, so code should -// call cancel as soon as the operations running in this Context complete. -func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { - c := newCancelCtx(parent) - propagateCancel(parent, &c) - return &c, func() { c.cancel(true, Canceled) } -} - -// newCancelCtx returns an initialized cancelCtx. -func newCancelCtx(parent Context) cancelCtx { - return cancelCtx{ - Context: parent, - done: make(chan struct{}), - } -} - -// propagateCancel arranges for child to be canceled when parent is. -func propagateCancel(parent Context, child canceler) { - if parent.Done() == nil { - return // parent is never canceled - } - if p, ok := parentCancelCtx(parent); ok { - p.mu.Lock() - if p.err != nil { - // parent has already been canceled - child.cancel(false, p.err) - } else { - if p.children == nil { - p.children = make(map[canceler]bool) - } - p.children[child] = true - } - p.mu.Unlock() - } else { - go func() { - select { - case <-parent.Done(): - child.cancel(false, parent.Err()) - case <-child.Done(): - } - }() - } -} - -// parentCancelCtx follows a chain of parent references until it finds a -// *cancelCtx. This function understands how each of the concrete types in this -// package represents its parent. -func parentCancelCtx(parent Context) (*cancelCtx, bool) { - for { - switch c := parent.(type) { - case *cancelCtx: - return c, true - case *timerCtx: - return &c.cancelCtx, true - case *valueCtx: - parent = c.Context - default: - return nil, false - } - } -} - -// removeChild removes a context from its parent. -func removeChild(parent Context, child canceler) { - p, ok := parentCancelCtx(parent) - if !ok { - return - } - p.mu.Lock() - if p.children != nil { - delete(p.children, child) - } - p.mu.Unlock() -} - -// A canceler is a context type that can be canceled directly. The -// implementations are *cancelCtx and *timerCtx. -type canceler interface { - cancel(removeFromParent bool, err error) - Done() <-chan struct{} -} - -// A cancelCtx can be canceled. When canceled, it also cancels any children -// that implement canceler. -type cancelCtx struct { - Context - - done chan struct{} // closed by the first cancel call. - - mu sync.Mutex - children map[canceler]bool // set to nil by the first cancel call - err error // set to non-nil by the first cancel call -} - -func (c *cancelCtx) Done() <-chan struct{} { - return c.done -} - -func (c *cancelCtx) Err() error { - c.mu.Lock() - defer c.mu.Unlock() - return c.err -} - -func (c *cancelCtx) String() string { - return fmt.Sprintf("%v.WithCancel", c.Context) -} - -// cancel closes c.done, cancels each of c's children, and, if -// removeFromParent is true, removes c from its parent's children. -func (c *cancelCtx) cancel(removeFromParent bool, err error) { - if err == nil { - panic("context: internal error: missing cancel error") - } - c.mu.Lock() - if c.err != nil { - c.mu.Unlock() - return // already canceled - } - c.err = err - close(c.done) - for child := range c.children { - // NOTE: acquiring the child's lock while holding parent's lock. - child.cancel(false, err) - } - c.children = nil - c.mu.Unlock() - - if removeFromParent { - removeChild(c.Context, c) - } -} - -// WithDeadline returns a copy of the parent context with the deadline adjusted -// to be no later than d. If the parent's deadline is already earlier than d, -// WithDeadline(parent, d) is semantically equivalent to parent. The returned -// context's Done channel is closed when the deadline expires, when the returned -// cancel function is called, or when the parent context's Done channel is -// closed, whichever happens first. -// -// Canceling this context releases resources associated with it, so code should -// call cancel as soon as the operations running in this Context complete. -func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) { - if cur, ok := parent.Deadline(); ok && cur.Before(deadline) { - // The current deadline is already sooner than the new one. - return WithCancel(parent) - } - c := &timerCtx{ - cancelCtx: newCancelCtx(parent), - deadline: deadline, - } - propagateCancel(parent, c) - d := deadline.Sub(time.Now()) - if d <= 0 { - c.cancel(true, DeadlineExceeded) // deadline has already passed - return c, func() { c.cancel(true, Canceled) } - } - c.mu.Lock() - defer c.mu.Unlock() - if c.err == nil { - c.timer = time.AfterFunc(d, func() { - c.cancel(true, DeadlineExceeded) - }) - } - return c, func() { c.cancel(true, Canceled) } -} - -// A timerCtx carries a timer and a deadline. It embeds a cancelCtx to -// implement Done and Err. It implements cancel by stopping its timer then -// delegating to cancelCtx.cancel. -type timerCtx struct { - cancelCtx - timer *time.Timer // Under cancelCtx.mu. - - deadline time.Time -} - -func (c *timerCtx) Deadline() (deadline time.Time, ok bool) { - return c.deadline, true -} - -func (c *timerCtx) String() string { - return fmt.Sprintf("%v.WithDeadline(%s [%s])", c.cancelCtx.Context, c.deadline, c.deadline.Sub(time.Now())) -} - -func (c *timerCtx) cancel(removeFromParent bool, err error) { - c.cancelCtx.cancel(false, err) - if removeFromParent { - // Remove this timerCtx from its parent cancelCtx's children. - removeChild(c.cancelCtx.Context, c) - } - c.mu.Lock() - if c.timer != nil { - c.timer.Stop() - c.timer = nil - } - c.mu.Unlock() -} - -// WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)). -// -// Canceling this context releases resources associated with it, so code should -// call cancel as soon as the operations running in this Context complete: -// -// func slowOperationWithTimeout(ctx context.Context) (Result, error) { -// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond) -// defer cancel() // releases resources if slowOperation completes before timeout elapses -// return slowOperation(ctx) -// } -func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) { - return WithDeadline(parent, time.Now().Add(timeout)) -} - -// WithValue returns a copy of parent in which the value associated with key is -// val. -// -// Use context Values only for request-scoped data that transits processes and -// APIs, not for passing optional parameters to functions. -func WithValue(parent Context, key interface{}, val interface{}) Context { - return &valueCtx{parent, key, val} -} - -// A valueCtx carries a key-value pair. It implements Value for that key and -// delegates all other calls to the embedded Context. -type valueCtx struct { - Context - key, val interface{} -} - -func (c *valueCtx) String() string { - return fmt.Sprintf("%v.WithValue(%#v, %#v)", c.Context, c.key, c.val) -} - -func (c *valueCtx) Value(key interface{}) interface{} { - if c.key == key { - return c.val - } - return c.Context.Value(key) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/client_conn_pool.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/client_conn_pool.go deleted file mode 100644 index 772ea5e9244..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/client_conn_pool.go +++ /dev/null @@ -1,225 +0,0 @@ -// Copyright 2015 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. - -// Transport code's client connection pooling. - -package http2 - -import ( - "crypto/tls" - "net/http" - "sync" -) - -// ClientConnPool manages a pool of HTTP/2 client connections. -type ClientConnPool interface { - GetClientConn(req *http.Request, addr string) (*ClientConn, error) - MarkDead(*ClientConn) -} - -// TODO: use singleflight for dialing and addConnCalls? -type clientConnPool struct { - t *Transport - - mu sync.Mutex // TODO: maybe switch to RWMutex - // TODO: add support for sharing conns based on cert names - // (e.g. share conn for googleapis.com and appspot.com) - conns map[string][]*ClientConn // key is host:port - dialing map[string]*dialCall // currently in-flight dials - keys map[*ClientConn][]string - addConnCalls map[string]*addConnCall // in-flight addConnIfNeede calls -} - -func (p *clientConnPool) GetClientConn(req *http.Request, addr string) (*ClientConn, error) { - return p.getClientConn(req, addr, dialOnMiss) -} - -const ( - dialOnMiss = true - noDialOnMiss = false -) - -func (p *clientConnPool) getClientConn(_ *http.Request, addr string, dialOnMiss bool) (*ClientConn, error) { - p.mu.Lock() - for _, cc := range p.conns[addr] { - if cc.CanTakeNewRequest() { - p.mu.Unlock() - return cc, nil - } - } - if !dialOnMiss { - p.mu.Unlock() - return nil, ErrNoCachedConn - } - call := p.getStartDialLocked(addr) - p.mu.Unlock() - <-call.done - return call.res, call.err -} - -// dialCall is an in-flight Transport dial call to a host. -type dialCall struct { - p *clientConnPool - done chan struct{} // closed when done - res *ClientConn // valid after done is closed - err error // valid after done is closed -} - -// requires p.mu is held. -func (p *clientConnPool) getStartDialLocked(addr string) *dialCall { - if call, ok := p.dialing[addr]; ok { - // A dial is already in-flight. Don't start another. - return call - } - call := &dialCall{p: p, done: make(chan struct{})} - if p.dialing == nil { - p.dialing = make(map[string]*dialCall) - } - p.dialing[addr] = call - go call.dial(addr) - return call -} - -// run in its own goroutine. -func (c *dialCall) dial(addr string) { - c.res, c.err = c.p.t.dialClientConn(addr) - close(c.done) - - c.p.mu.Lock() - delete(c.p.dialing, addr) - if c.err == nil { - c.p.addConnLocked(addr, c.res) - } - c.p.mu.Unlock() -} - -// addConnIfNeeded makes a NewClientConn out of c if a connection for key doesn't -// already exist. It coalesces concurrent calls with the same key. -// This is used by the http1 Transport code when it creates a new connection. Because -// the http1 Transport doesn't de-dup TCP dials to outbound hosts (because it doesn't know -// the protocol), it can get into a situation where it has multiple TLS connections. -// This code decides which ones live or die. -// The return value used is whether c was used. -// c is never closed. -func (p *clientConnPool) addConnIfNeeded(key string, t *Transport, c *tls.Conn) (used bool, err error) { - p.mu.Lock() - for _, cc := range p.conns[key] { - if cc.CanTakeNewRequest() { - p.mu.Unlock() - return false, nil - } - } - call, dup := p.addConnCalls[key] - if !dup { - if p.addConnCalls == nil { - p.addConnCalls = make(map[string]*addConnCall) - } - call = &addConnCall{ - p: p, - done: make(chan struct{}), - } - p.addConnCalls[key] = call - go call.run(t, key, c) - } - p.mu.Unlock() - - <-call.done - if call.err != nil { - return false, call.err - } - return !dup, nil -} - -type addConnCall struct { - p *clientConnPool - done chan struct{} // closed when done - err error -} - -func (c *addConnCall) run(t *Transport, key string, tc *tls.Conn) { - cc, err := t.NewClientConn(tc) - - p := c.p - p.mu.Lock() - if err != nil { - c.err = err - } else { - p.addConnLocked(key, cc) - } - delete(p.addConnCalls, key) - p.mu.Unlock() - close(c.done) -} - -func (p *clientConnPool) addConn(key string, cc *ClientConn) { - p.mu.Lock() - p.addConnLocked(key, cc) - p.mu.Unlock() -} - -// p.mu must be held -func (p *clientConnPool) addConnLocked(key string, cc *ClientConn) { - for _, v := range p.conns[key] { - if v == cc { - return - } - } - if p.conns == nil { - p.conns = make(map[string][]*ClientConn) - } - if p.keys == nil { - p.keys = make(map[*ClientConn][]string) - } - p.conns[key] = append(p.conns[key], cc) - p.keys[cc] = append(p.keys[cc], key) -} - -func (p *clientConnPool) MarkDead(cc *ClientConn) { - p.mu.Lock() - defer p.mu.Unlock() - for _, key := range p.keys[cc] { - vv, ok := p.conns[key] - if !ok { - continue - } - newList := filterOutClientConn(vv, cc) - if len(newList) > 0 { - p.conns[key] = newList - } else { - delete(p.conns, key) - } - } - delete(p.keys, cc) -} - -func (p *clientConnPool) closeIdleConnections() { - p.mu.Lock() - defer p.mu.Unlock() - // TODO: don't close a cc if it was just added to the pool - // milliseconds ago and has never been used. There's currently - // a small race window with the HTTP/1 Transport's integration - // where it can add an idle conn just before using it, and - // somebody else can concurrently call CloseIdleConns and - // break some caller's RoundTrip. - for _, vv := range p.conns { - for _, cc := range vv { - cc.closeIfIdle() - } - } -} - -func filterOutClientConn(in []*ClientConn, exclude *ClientConn) []*ClientConn { - out := in[:0] - for _, v := range in { - if v != exclude { - out = append(out, v) - } - } - // If we filtered it out, zero out the last item to prevent - // the GC from seeing it. - if len(in) != len(out) { - in[len(in)-1] = nil - } - return out -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/configure_transport.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/configure_transport.go deleted file mode 100644 index daa17f5d43b..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/configure_transport.go +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2015 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. - -// +build go1.6 - -package http2 - -import ( - "crypto/tls" - "fmt" - "net/http" -) - -func configureTransport(t1 *http.Transport) (*Transport, error) { - connPool := new(clientConnPool) - t2 := &Transport{ - ConnPool: noDialClientConnPool{connPool}, - t1: t1, - } - connPool.t = t2 - if err := registerHTTPSProtocol(t1, noDialH2RoundTripper{t2}); err != nil { - return nil, err - } - if t1.TLSClientConfig == nil { - t1.TLSClientConfig = new(tls.Config) - } - if !strSliceContains(t1.TLSClientConfig.NextProtos, "h2") { - t1.TLSClientConfig.NextProtos = append([]string{"h2"}, t1.TLSClientConfig.NextProtos...) - } - if !strSliceContains(t1.TLSClientConfig.NextProtos, "http/1.1") { - t1.TLSClientConfig.NextProtos = append(t1.TLSClientConfig.NextProtos, "http/1.1") - } - upgradeFn := func(authority string, c *tls.Conn) http.RoundTripper { - addr := authorityAddr(authority) - if used, err := connPool.addConnIfNeeded(addr, t2, c); err != nil { - go c.Close() - return erringRoundTripper{err} - } else if !used { - // Turns out we don't need this c. - // For example, two goroutines made requests to the same host - // at the same time, both kicking off TCP dials. (since protocol - // was unknown) - go c.Close() - } - return t2 - } - if m := t1.TLSNextProto; len(m) == 0 { - t1.TLSNextProto = map[string]func(string, *tls.Conn) http.RoundTripper{ - "h2": upgradeFn, - } - } else { - m["h2"] = upgradeFn - } - return t2, nil -} - -// registerHTTPSProtocol calls Transport.RegisterProtocol but -// convering panics into errors. -func registerHTTPSProtocol(t *http.Transport, rt http.RoundTripper) (err error) { - defer func() { - if e := recover(); e != nil { - err = fmt.Errorf("%v", e) - } - }() - t.RegisterProtocol("https", rt) - return nil -} - -// noDialClientConnPool is an implementation of http2.ClientConnPool -// which never dials. We let the HTTP/1.1 client dial and use its TLS -// connection instead. -type noDialClientConnPool struct{ *clientConnPool } - -func (p noDialClientConnPool) GetClientConn(req *http.Request, addr string) (*ClientConn, error) { - return p.getClientConn(req, addr, noDialOnMiss) -} - -// noDialH2RoundTripper is a RoundTripper which only tries to complete the request -// if there's already has a cached connection to the host. -type noDialH2RoundTripper struct{ t *Transport } - -func (rt noDialH2RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { - res, err := rt.t.RoundTrip(req) - if err == ErrNoCachedConn { - return nil, http.ErrSkipAltProtocol - } - return res, err -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/errors.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/errors.go deleted file mode 100644 index 71a4e290568..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/errors.go +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright 2014 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 http2 - -import ( - "errors" - "fmt" -) - -// An ErrCode is an unsigned 32-bit error code as defined in the HTTP/2 spec. -type ErrCode uint32 - -const ( - ErrCodeNo ErrCode = 0x0 - ErrCodeProtocol ErrCode = 0x1 - ErrCodeInternal ErrCode = 0x2 - ErrCodeFlowControl ErrCode = 0x3 - ErrCodeSettingsTimeout ErrCode = 0x4 - ErrCodeStreamClosed ErrCode = 0x5 - ErrCodeFrameSize ErrCode = 0x6 - ErrCodeRefusedStream ErrCode = 0x7 - ErrCodeCancel ErrCode = 0x8 - ErrCodeCompression ErrCode = 0x9 - ErrCodeConnect ErrCode = 0xa - ErrCodeEnhanceYourCalm ErrCode = 0xb - ErrCodeInadequateSecurity ErrCode = 0xc - ErrCodeHTTP11Required ErrCode = 0xd -) - -var errCodeName = map[ErrCode]string{ - ErrCodeNo: "NO_ERROR", - ErrCodeProtocol: "PROTOCOL_ERROR", - ErrCodeInternal: "INTERNAL_ERROR", - ErrCodeFlowControl: "FLOW_CONTROL_ERROR", - ErrCodeSettingsTimeout: "SETTINGS_TIMEOUT", - ErrCodeStreamClosed: "STREAM_CLOSED", - ErrCodeFrameSize: "FRAME_SIZE_ERROR", - ErrCodeRefusedStream: "REFUSED_STREAM", - ErrCodeCancel: "CANCEL", - ErrCodeCompression: "COMPRESSION_ERROR", - ErrCodeConnect: "CONNECT_ERROR", - ErrCodeEnhanceYourCalm: "ENHANCE_YOUR_CALM", - ErrCodeInadequateSecurity: "INADEQUATE_SECURITY", - ErrCodeHTTP11Required: "HTTP_1_1_REQUIRED", -} - -func (e ErrCode) String() string { - if s, ok := errCodeName[e]; ok { - return s - } - return fmt.Sprintf("unknown error code 0x%x", uint32(e)) -} - -// ConnectionError is an error that results in the termination of the -// entire connection. -type ConnectionError ErrCode - -func (e ConnectionError) Error() string { return fmt.Sprintf("connection error: %s", ErrCode(e)) } - -// StreamError is an error that only affects one stream within an -// HTTP/2 connection. -type StreamError struct { - StreamID uint32 - Code ErrCode -} - -func (e StreamError) Error() string { - return fmt.Sprintf("stream error: stream ID %d; %v", e.StreamID, e.Code) -} - -// 6.9.1 The Flow Control Window -// "If a sender receives a WINDOW_UPDATE that causes a flow control -// window to exceed this maximum it MUST terminate either the stream -// or the connection, as appropriate. For streams, [...]; for the -// connection, a GOAWAY frame with a FLOW_CONTROL_ERROR code." -type goAwayFlowError struct{} - -func (goAwayFlowError) Error() string { return "connection exceeded flow control window size" } - -// connErrorReason wraps a ConnectionError with an informative error about why it occurs. - -// Errors of this type are only returned by the frame parser functions -// and converted into ConnectionError(ErrCodeProtocol). -type connError struct { - Code ErrCode - Reason string -} - -func (e connError) Error() string { - return fmt.Sprintf("http2: connection error: %v: %v", e.Code, e.Reason) -} - -type pseudoHeaderError string - -func (e pseudoHeaderError) Error() string { - return fmt.Sprintf("invalid pseudo-header %q", string(e)) -} - -type duplicatePseudoHeaderError string - -func (e duplicatePseudoHeaderError) Error() string { - return fmt.Sprintf("duplicate pseudo-header %q", string(e)) -} - -type headerFieldNameError string - -func (e headerFieldNameError) Error() string { - return fmt.Sprintf("invalid header field name %q", string(e)) -} - -type headerFieldValueError string - -func (e headerFieldValueError) Error() string { - return fmt.Sprintf("invalid header field value %q", string(e)) -} - -var ( - errMixPseudoHeaderTypes = errors.New("mix of request and response pseudo headers") - errPseudoAfterRegular = errors.New("pseudo header field after regular") -) diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/fixed_buffer.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/fixed_buffer.go deleted file mode 100644 index 47da0f0bf71..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/fixed_buffer.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2014 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 http2 - -import ( - "errors" -) - -// fixedBuffer is an io.ReadWriter backed by a fixed size buffer. -// It never allocates, but moves old data as new data is written. -type fixedBuffer struct { - buf []byte - r, w int -} - -var ( - errReadEmpty = errors.New("read from empty fixedBuffer") - errWriteFull = errors.New("write on full fixedBuffer") -) - -// Read copies bytes from the buffer into p. -// It is an error to read when no data is available. -func (b *fixedBuffer) Read(p []byte) (n int, err error) { - if b.r == b.w { - return 0, errReadEmpty - } - n = copy(p, b.buf[b.r:b.w]) - b.r += n - if b.r == b.w { - b.r = 0 - b.w = 0 - } - return n, nil -} - -// Len returns the number of bytes of the unread portion of the buffer. -func (b *fixedBuffer) Len() int { - return b.w - b.r -} - -// Write copies bytes from p into the buffer. -// It is an error to write more data than the buffer can hold. -func (b *fixedBuffer) Write(p []byte) (n int, err error) { - // Slide existing data to beginning. - if b.r > 0 && len(p) > len(b.buf)-b.w { - copy(b.buf, b.buf[b.r:b.w]) - b.w -= b.r - b.r = 0 - } - - // Write new data. - n = copy(b.buf[b.w:], p) - b.w += n - if n < len(p) { - err = errWriteFull - } - return n, err -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/flow.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/flow.go deleted file mode 100644 index 957de25420d..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/flow.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2014 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. - -// Flow control - -package http2 - -// flow is the flow control window's size. -type flow struct { - // n is the number of DATA bytes we're allowed to send. - // A flow is kept both on a conn and a per-stream. - n int32 - - // conn points to the shared connection-level flow that is - // shared by all streams on that conn. It is nil for the flow - // that's on the conn directly. - conn *flow -} - -func (f *flow) setConnFlow(cf *flow) { f.conn = cf } - -func (f *flow) available() int32 { - n := f.n - if f.conn != nil && f.conn.n < n { - n = f.conn.n - } - return n -} - -func (f *flow) take(n int32) { - if n > f.available() { - panic("internal error: took too much") - } - f.n -= n - if f.conn != nil { - f.conn.n -= n - } -} - -// add adds n bytes (positive or negative) to the flow control window. -// It returns false if the sum would exceed 2^31-1. -func (f *flow) add(n int32) bool { - remain := (1<<31 - 1) - f.n - if n > remain { - return false - } - f.n += n - return true -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/frame.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/frame.go deleted file mode 100644 index 6943f93380c..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/frame.go +++ /dev/null @@ -1,1496 +0,0 @@ -// Copyright 2014 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 http2 - -import ( - "bytes" - "encoding/binary" - "errors" - "fmt" - "io" - "log" - "strings" - "sync" - - "golang.org/x/net/http2/hpack" -) - -const frameHeaderLen = 9 - -var padZeros = make([]byte, 255) // zeros for padding - -// A FrameType is a registered frame type as defined in -// http://http2.github.io/http2-spec/#rfc.section.11.2 -type FrameType uint8 - -const ( - FrameData FrameType = 0x0 - FrameHeaders FrameType = 0x1 - FramePriority FrameType = 0x2 - FrameRSTStream FrameType = 0x3 - FrameSettings FrameType = 0x4 - FramePushPromise FrameType = 0x5 - FramePing FrameType = 0x6 - FrameGoAway FrameType = 0x7 - FrameWindowUpdate FrameType = 0x8 - FrameContinuation FrameType = 0x9 -) - -var frameName = map[FrameType]string{ - FrameData: "DATA", - FrameHeaders: "HEADERS", - FramePriority: "PRIORITY", - FrameRSTStream: "RST_STREAM", - FrameSettings: "SETTINGS", - FramePushPromise: "PUSH_PROMISE", - FramePing: "PING", - FrameGoAway: "GOAWAY", - FrameWindowUpdate: "WINDOW_UPDATE", - FrameContinuation: "CONTINUATION", -} - -func (t FrameType) String() string { - if s, ok := frameName[t]; ok { - return s - } - return fmt.Sprintf("UNKNOWN_FRAME_TYPE_%d", uint8(t)) -} - -// Flags is a bitmask of HTTP/2 flags. -// The meaning of flags varies depending on the frame type. -type Flags uint8 - -// Has reports whether f contains all (0 or more) flags in v. -func (f Flags) Has(v Flags) bool { - return (f & v) == v -} - -// Frame-specific FrameHeader flag bits. -const ( - // Data Frame - FlagDataEndStream Flags = 0x1 - FlagDataPadded Flags = 0x8 - - // Headers Frame - FlagHeadersEndStream Flags = 0x1 - FlagHeadersEndHeaders Flags = 0x4 - FlagHeadersPadded Flags = 0x8 - FlagHeadersPriority Flags = 0x20 - - // Settings Frame - FlagSettingsAck Flags = 0x1 - - // Ping Frame - FlagPingAck Flags = 0x1 - - // Continuation Frame - FlagContinuationEndHeaders Flags = 0x4 - - FlagPushPromiseEndHeaders Flags = 0x4 - FlagPushPromisePadded Flags = 0x8 -) - -var flagName = map[FrameType]map[Flags]string{ - FrameData: { - FlagDataEndStream: "END_STREAM", - FlagDataPadded: "PADDED", - }, - FrameHeaders: { - FlagHeadersEndStream: "END_STREAM", - FlagHeadersEndHeaders: "END_HEADERS", - FlagHeadersPadded: "PADDED", - FlagHeadersPriority: "PRIORITY", - }, - FrameSettings: { - FlagSettingsAck: "ACK", - }, - FramePing: { - FlagPingAck: "ACK", - }, - FrameContinuation: { - FlagContinuationEndHeaders: "END_HEADERS", - }, - FramePushPromise: { - FlagPushPromiseEndHeaders: "END_HEADERS", - FlagPushPromisePadded: "PADDED", - }, -} - -// a frameParser parses a frame given its FrameHeader and payload -// bytes. The length of payload will always equal fh.Length (which -// might be 0). -type frameParser func(fh FrameHeader, payload []byte) (Frame, error) - -var frameParsers = map[FrameType]frameParser{ - FrameData: parseDataFrame, - FrameHeaders: parseHeadersFrame, - FramePriority: parsePriorityFrame, - FrameRSTStream: parseRSTStreamFrame, - FrameSettings: parseSettingsFrame, - FramePushPromise: parsePushPromise, - FramePing: parsePingFrame, - FrameGoAway: parseGoAwayFrame, - FrameWindowUpdate: parseWindowUpdateFrame, - FrameContinuation: parseContinuationFrame, -} - -func typeFrameParser(t FrameType) frameParser { - if f := frameParsers[t]; f != nil { - return f - } - return parseUnknownFrame -} - -// A FrameHeader is the 9 byte header of all HTTP/2 frames. -// -// See http://http2.github.io/http2-spec/#FrameHeader -type FrameHeader struct { - valid bool // caller can access []byte fields in the Frame - - // Type is the 1 byte frame type. There are ten standard frame - // types, but extension frame types may be written by WriteRawFrame - // and will be returned by ReadFrame (as UnknownFrame). - Type FrameType - - // Flags are the 1 byte of 8 potential bit flags per frame. - // They are specific to the frame type. - Flags Flags - - // Length is the length of the frame, not including the 9 byte header. - // The maximum size is one byte less than 16MB (uint24), but only - // frames up to 16KB are allowed without peer agreement. - Length uint32 - - // StreamID is which stream this frame is for. Certain frames - // are not stream-specific, in which case this field is 0. - StreamID uint32 -} - -// Header returns h. It exists so FrameHeaders can be embedded in other -// specific frame types and implement the Frame interface. -func (h FrameHeader) Header() FrameHeader { return h } - -func (h FrameHeader) String() string { - var buf bytes.Buffer - buf.WriteString("[FrameHeader ") - h.writeDebug(&buf) - buf.WriteByte(']') - return buf.String() -} - -func (h FrameHeader) writeDebug(buf *bytes.Buffer) { - buf.WriteString(h.Type.String()) - if h.Flags != 0 { - buf.WriteString(" flags=") - set := 0 - for i := uint8(0); i < 8; i++ { - if h.Flags&(1< 1 { - buf.WriteByte('|') - } - name := flagName[h.Type][Flags(1<>24), - byte(streamID>>16), - byte(streamID>>8), - byte(streamID)) -} - -func (f *Framer) endWrite() error { - // Now that we know the final size, fill in the FrameHeader in - // the space previously reserved for it. Abuse append. - length := len(f.wbuf) - frameHeaderLen - if length >= (1 << 24) { - return ErrFrameTooLarge - } - _ = append(f.wbuf[:0], - byte(length>>16), - byte(length>>8), - byte(length)) - if logFrameWrites { - f.logWrite() - } - - n, err := f.w.Write(f.wbuf) - if err == nil && n != len(f.wbuf) { - err = io.ErrShortWrite - } - return err -} - -func (f *Framer) logWrite() { - if f.debugFramer == nil { - f.debugFramerBuf = new(bytes.Buffer) - f.debugFramer = NewFramer(nil, f.debugFramerBuf) - f.debugFramer.logReads = false // we log it ourselves, saying "wrote" below - // Let us read anything, even if we accidentally wrote it - // in the wrong order: - f.debugFramer.AllowIllegalReads = true - } - f.debugFramerBuf.Write(f.wbuf) - fr, err := f.debugFramer.ReadFrame() - if err != nil { - log.Printf("http2: Framer %p: failed to decode just-written frame", f) - return - } - log.Printf("http2: Framer %p: wrote %v", f, summarizeFrame(fr)) -} - -func (f *Framer) writeByte(v byte) { f.wbuf = append(f.wbuf, v) } -func (f *Framer) writeBytes(v []byte) { f.wbuf = append(f.wbuf, v...) } -func (f *Framer) writeUint16(v uint16) { f.wbuf = append(f.wbuf, byte(v>>8), byte(v)) } -func (f *Framer) writeUint32(v uint32) { - f.wbuf = append(f.wbuf, byte(v>>24), byte(v>>16), byte(v>>8), byte(v)) -} - -const ( - minMaxFrameSize = 1 << 14 - maxFrameSize = 1<<24 - 1 -) - -// NewFramer returns a Framer that writes frames to w and reads them from r. -func NewFramer(w io.Writer, r io.Reader) *Framer { - fr := &Framer{ - w: w, - r: r, - logReads: logFrameReads, - } - fr.getReadBuf = func(size uint32) []byte { - if cap(fr.readBuf) >= int(size) { - return fr.readBuf[:size] - } - fr.readBuf = make([]byte, size) - return fr.readBuf - } - fr.SetMaxReadFrameSize(maxFrameSize) - return fr -} - -// SetMaxReadFrameSize sets the maximum size of a frame -// that will be read by a subsequent call to ReadFrame. -// It is the caller's responsibility to advertise this -// limit with a SETTINGS frame. -func (fr *Framer) SetMaxReadFrameSize(v uint32) { - if v > maxFrameSize { - v = maxFrameSize - } - fr.maxReadSize = v -} - -// ErrorDetail returns a more detailed error of the last error -// returned by Framer.ReadFrame. For instance, if ReadFrame -// returns a StreamError with code PROTOCOL_ERROR, ErrorDetail -// will say exactly what was invalid. ErrorDetail is not guaranteed -// to return a non-nil value and like the rest of the http2 package, -// its return value is not protected by an API compatibility promise. -// ErrorDetail is reset after the next call to ReadFrame. -func (fr *Framer) ErrorDetail() error { - return fr.errDetail -} - -// ErrFrameTooLarge is returned from Framer.ReadFrame when the peer -// sends a frame that is larger than declared with SetMaxReadFrameSize. -var ErrFrameTooLarge = errors.New("http2: frame too large") - -// terminalReadFrameError reports whether err is an unrecoverable -// error from ReadFrame and no other frames should be read. -func terminalReadFrameError(err error) bool { - if _, ok := err.(StreamError); ok { - return false - } - return err != nil -} - -// ReadFrame reads a single frame. The returned Frame is only valid -// until the next call to ReadFrame. -// -// If the frame is larger than previously set with SetMaxReadFrameSize, the -// returned error is ErrFrameTooLarge. Other errors may be of type -// ConnectionError, StreamError, or anything else from from the underlying -// reader. -func (fr *Framer) ReadFrame() (Frame, error) { - fr.errDetail = nil - if fr.lastFrame != nil { - fr.lastFrame.invalidate() - } - fh, err := readFrameHeader(fr.headerBuf[:], fr.r) - if err != nil { - return nil, err - } - if fh.Length > fr.maxReadSize { - return nil, ErrFrameTooLarge - } - payload := fr.getReadBuf(fh.Length) - if _, err := io.ReadFull(fr.r, payload); err != nil { - return nil, err - } - f, err := typeFrameParser(fh.Type)(fh, payload) - if err != nil { - if ce, ok := err.(connError); ok { - return nil, fr.connError(ce.Code, ce.Reason) - } - return nil, err - } - if err := fr.checkFrameOrder(f); err != nil { - return nil, err - } - if fr.logReads { - log.Printf("http2: Framer %p: read %v", fr, summarizeFrame(f)) - } - if fh.Type == FrameHeaders && fr.ReadMetaHeaders != nil { - return fr.readMetaFrame(f.(*HeadersFrame)) - } - return f, nil -} - -// connError returns ConnectionError(code) but first -// stashes away a public reason to the caller can optionally relay it -// to the peer before hanging up on them. This might help others debug -// their implementations. -func (fr *Framer) connError(code ErrCode, reason string) error { - fr.errDetail = errors.New(reason) - return ConnectionError(code) -} - -// checkFrameOrder reports an error if f is an invalid frame to return -// next from ReadFrame. Mostly it checks whether HEADERS and -// CONTINUATION frames are contiguous. -func (fr *Framer) checkFrameOrder(f Frame) error { - last := fr.lastFrame - fr.lastFrame = f - if fr.AllowIllegalReads { - return nil - } - - fh := f.Header() - if fr.lastHeaderStream != 0 { - if fh.Type != FrameContinuation { - return fr.connError(ErrCodeProtocol, - fmt.Sprintf("got %s for stream %d; expected CONTINUATION following %s for stream %d", - fh.Type, fh.StreamID, - last.Header().Type, fr.lastHeaderStream)) - } - if fh.StreamID != fr.lastHeaderStream { - return fr.connError(ErrCodeProtocol, - fmt.Sprintf("got CONTINUATION for stream %d; expected stream %d", - fh.StreamID, fr.lastHeaderStream)) - } - } else if fh.Type == FrameContinuation { - return fr.connError(ErrCodeProtocol, fmt.Sprintf("unexpected CONTINUATION for stream %d", fh.StreamID)) - } - - switch fh.Type { - case FrameHeaders, FrameContinuation: - if fh.Flags.Has(FlagHeadersEndHeaders) { - fr.lastHeaderStream = 0 - } else { - fr.lastHeaderStream = fh.StreamID - } - } - - return nil -} - -// A DataFrame conveys arbitrary, variable-length sequences of octets -// associated with a stream. -// See http://http2.github.io/http2-spec/#rfc.section.6.1 -type DataFrame struct { - FrameHeader - data []byte -} - -func (f *DataFrame) StreamEnded() bool { - return f.FrameHeader.Flags.Has(FlagDataEndStream) -} - -// Data returns the frame's data octets, not including any padding -// size byte or padding suffix bytes. -// The caller must not retain the returned memory past the next -// call to ReadFrame. -func (f *DataFrame) Data() []byte { - f.checkValid() - return f.data -} - -func parseDataFrame(fh FrameHeader, payload []byte) (Frame, error) { - if fh.StreamID == 0 { - // DATA frames MUST be associated with a stream. If a - // DATA frame is received whose stream identifier - // field is 0x0, the recipient MUST respond with a - // connection error (Section 5.4.1) of type - // PROTOCOL_ERROR. - return nil, connError{ErrCodeProtocol, "DATA frame with stream ID 0"} - } - f := &DataFrame{ - FrameHeader: fh, - } - var padSize byte - if fh.Flags.Has(FlagDataPadded) { - var err error - payload, padSize, err = readByte(payload) - if err != nil { - return nil, err - } - } - if int(padSize) > len(payload) { - // If the length of the padding is greater than the - // length of the frame payload, the recipient MUST - // treat this as a connection error. - // Filed: https://github.com/http2/http2-spec/issues/610 - return nil, connError{ErrCodeProtocol, "pad size larger than data payload"} - } - f.data = payload[:len(payload)-int(padSize)] - return f, nil -} - -var errStreamID = errors.New("invalid streamid") - -func validStreamID(streamID uint32) bool { - return streamID != 0 && streamID&(1<<31) == 0 -} - -// WriteData writes a DATA frame. -// -// It will perform exactly one Write to the underlying Writer. -// It is the caller's responsibility to not call other Write methods concurrently. -func (f *Framer) WriteData(streamID uint32, endStream bool, data []byte) error { - // TODO: ignoring padding for now. will add when somebody cares. - if !validStreamID(streamID) && !f.AllowIllegalWrites { - return errStreamID - } - var flags Flags - if endStream { - flags |= FlagDataEndStream - } - f.startWrite(FrameData, flags, streamID) - f.wbuf = append(f.wbuf, data...) - return f.endWrite() -} - -// A SettingsFrame conveys configuration parameters that affect how -// endpoints communicate, such as preferences and constraints on peer -// behavior. -// -// See http://http2.github.io/http2-spec/#SETTINGS -type SettingsFrame struct { - FrameHeader - p []byte -} - -func parseSettingsFrame(fh FrameHeader, p []byte) (Frame, error) { - if fh.Flags.Has(FlagSettingsAck) && fh.Length > 0 { - // When this (ACK 0x1) bit is set, the payload of the - // SETTINGS frame MUST be empty. Receipt of a - // SETTINGS frame with the ACK flag set and a length - // field value other than 0 MUST be treated as a - // connection error (Section 5.4.1) of type - // FRAME_SIZE_ERROR. - return nil, ConnectionError(ErrCodeFrameSize) - } - if fh.StreamID != 0 { - // SETTINGS frames always apply to a connection, - // never a single stream. The stream identifier for a - // SETTINGS frame MUST be zero (0x0). If an endpoint - // receives a SETTINGS frame whose stream identifier - // field is anything other than 0x0, the endpoint MUST - // respond with a connection error (Section 5.4.1) of - // type PROTOCOL_ERROR. - return nil, ConnectionError(ErrCodeProtocol) - } - if len(p)%6 != 0 { - // Expecting even number of 6 byte settings. - return nil, ConnectionError(ErrCodeFrameSize) - } - f := &SettingsFrame{FrameHeader: fh, p: p} - if v, ok := f.Value(SettingInitialWindowSize); ok && v > (1<<31)-1 { - // Values above the maximum flow control window size of 2^31 - 1 MUST - // be treated as a connection error (Section 5.4.1) of type - // FLOW_CONTROL_ERROR. - return nil, ConnectionError(ErrCodeFlowControl) - } - return f, nil -} - -func (f *SettingsFrame) IsAck() bool { - return f.FrameHeader.Flags.Has(FlagSettingsAck) -} - -func (f *SettingsFrame) Value(s SettingID) (v uint32, ok bool) { - f.checkValid() - buf := f.p - for len(buf) > 0 { - settingID := SettingID(binary.BigEndian.Uint16(buf[:2])) - if settingID == s { - return binary.BigEndian.Uint32(buf[2:6]), true - } - buf = buf[6:] - } - return 0, false -} - -// ForeachSetting runs fn for each setting. -// It stops and returns the first error. -func (f *SettingsFrame) ForeachSetting(fn func(Setting) error) error { - f.checkValid() - buf := f.p - for len(buf) > 0 { - if err := fn(Setting{ - SettingID(binary.BigEndian.Uint16(buf[:2])), - binary.BigEndian.Uint32(buf[2:6]), - }); err != nil { - return err - } - buf = buf[6:] - } - return nil -} - -// WriteSettings writes a SETTINGS frame with zero or more settings -// specified and the ACK bit not set. -// -// It will perform exactly one Write to the underlying Writer. -// It is the caller's responsibility to not call other Write methods concurrently. -func (f *Framer) WriteSettings(settings ...Setting) error { - f.startWrite(FrameSettings, 0, 0) - for _, s := range settings { - f.writeUint16(uint16(s.ID)) - f.writeUint32(s.Val) - } - return f.endWrite() -} - -// WriteSettings writes an empty SETTINGS frame with the ACK bit set. -// -// It will perform exactly one Write to the underlying Writer. -// It is the caller's responsibility to not call other Write methods concurrently. -func (f *Framer) WriteSettingsAck() error { - f.startWrite(FrameSettings, FlagSettingsAck, 0) - return f.endWrite() -} - -// A PingFrame is a mechanism for measuring a minimal round trip time -// from the sender, as well as determining whether an idle connection -// is still functional. -// See http://http2.github.io/http2-spec/#rfc.section.6.7 -type PingFrame struct { - FrameHeader - Data [8]byte -} - -func (f *PingFrame) IsAck() bool { return f.Flags.Has(FlagPingAck) } - -func parsePingFrame(fh FrameHeader, payload []byte) (Frame, error) { - if len(payload) != 8 { - return nil, ConnectionError(ErrCodeFrameSize) - } - if fh.StreamID != 0 { - return nil, ConnectionError(ErrCodeProtocol) - } - f := &PingFrame{FrameHeader: fh} - copy(f.Data[:], payload) - return f, nil -} - -func (f *Framer) WritePing(ack bool, data [8]byte) error { - var flags Flags - if ack { - flags = FlagPingAck - } - f.startWrite(FramePing, flags, 0) - f.writeBytes(data[:]) - return f.endWrite() -} - -// A GoAwayFrame informs the remote peer to stop creating streams on this connection. -// See http://http2.github.io/http2-spec/#rfc.section.6.8 -type GoAwayFrame struct { - FrameHeader - LastStreamID uint32 - ErrCode ErrCode - debugData []byte -} - -// DebugData returns any debug data in the GOAWAY frame. Its contents -// are not defined. -// The caller must not retain the returned memory past the next -// call to ReadFrame. -func (f *GoAwayFrame) DebugData() []byte { - f.checkValid() - return f.debugData -} - -func parseGoAwayFrame(fh FrameHeader, p []byte) (Frame, error) { - if fh.StreamID != 0 { - return nil, ConnectionError(ErrCodeProtocol) - } - if len(p) < 8 { - return nil, ConnectionError(ErrCodeFrameSize) - } - return &GoAwayFrame{ - FrameHeader: fh, - LastStreamID: binary.BigEndian.Uint32(p[:4]) & (1<<31 - 1), - ErrCode: ErrCode(binary.BigEndian.Uint32(p[4:8])), - debugData: p[8:], - }, nil -} - -func (f *Framer) WriteGoAway(maxStreamID uint32, code ErrCode, debugData []byte) error { - f.startWrite(FrameGoAway, 0, 0) - f.writeUint32(maxStreamID & (1<<31 - 1)) - f.writeUint32(uint32(code)) - f.writeBytes(debugData) - return f.endWrite() -} - -// An UnknownFrame is the frame type returned when the frame type is unknown -// or no specific frame type parser exists. -type UnknownFrame struct { - FrameHeader - p []byte -} - -// Payload returns the frame's payload (after the header). It is not -// valid to call this method after a subsequent call to -// Framer.ReadFrame, nor is it valid to retain the returned slice. -// The memory is owned by the Framer and is invalidated when the next -// frame is read. -func (f *UnknownFrame) Payload() []byte { - f.checkValid() - return f.p -} - -func parseUnknownFrame(fh FrameHeader, p []byte) (Frame, error) { - return &UnknownFrame{fh, p}, nil -} - -// A WindowUpdateFrame is used to implement flow control. -// See http://http2.github.io/http2-spec/#rfc.section.6.9 -type WindowUpdateFrame struct { - FrameHeader - Increment uint32 // never read with high bit set -} - -func parseWindowUpdateFrame(fh FrameHeader, p []byte) (Frame, error) { - if len(p) != 4 { - return nil, ConnectionError(ErrCodeFrameSize) - } - inc := binary.BigEndian.Uint32(p[:4]) & 0x7fffffff // mask off high reserved bit - if inc == 0 { - // A receiver MUST treat the receipt of a - // WINDOW_UPDATE frame with an flow control window - // increment of 0 as a stream error (Section 5.4.2) of - // type PROTOCOL_ERROR; errors on the connection flow - // control window MUST be treated as a connection - // error (Section 5.4.1). - if fh.StreamID == 0 { - return nil, ConnectionError(ErrCodeProtocol) - } - return nil, StreamError{fh.StreamID, ErrCodeProtocol} - } - return &WindowUpdateFrame{ - FrameHeader: fh, - Increment: inc, - }, nil -} - -// WriteWindowUpdate writes a WINDOW_UPDATE frame. -// The increment value must be between 1 and 2,147,483,647, inclusive. -// If the Stream ID is zero, the window update applies to the -// connection as a whole. -func (f *Framer) WriteWindowUpdate(streamID, incr uint32) error { - // "The legal range for the increment to the flow control window is 1 to 2^31-1 (2,147,483,647) octets." - if (incr < 1 || incr > 2147483647) && !f.AllowIllegalWrites { - return errors.New("illegal window increment value") - } - f.startWrite(FrameWindowUpdate, 0, streamID) - f.writeUint32(incr) - return f.endWrite() -} - -// A HeadersFrame is used to open a stream and additionally carries a -// header block fragment. -type HeadersFrame struct { - FrameHeader - - // Priority is set if FlagHeadersPriority is set in the FrameHeader. - Priority PriorityParam - - headerFragBuf []byte // not owned -} - -func (f *HeadersFrame) HeaderBlockFragment() []byte { - f.checkValid() - return f.headerFragBuf -} - -func (f *HeadersFrame) HeadersEnded() bool { - return f.FrameHeader.Flags.Has(FlagHeadersEndHeaders) -} - -func (f *HeadersFrame) StreamEnded() bool { - return f.FrameHeader.Flags.Has(FlagHeadersEndStream) -} - -func (f *HeadersFrame) HasPriority() bool { - return f.FrameHeader.Flags.Has(FlagHeadersPriority) -} - -func parseHeadersFrame(fh FrameHeader, p []byte) (_ Frame, err error) { - hf := &HeadersFrame{ - FrameHeader: fh, - } - if fh.StreamID == 0 { - // HEADERS frames MUST be associated with a stream. If a HEADERS frame - // is received whose stream identifier field is 0x0, the recipient MUST - // respond with a connection error (Section 5.4.1) of type - // PROTOCOL_ERROR. - return nil, connError{ErrCodeProtocol, "HEADERS frame with stream ID 0"} - } - var padLength uint8 - if fh.Flags.Has(FlagHeadersPadded) { - if p, padLength, err = readByte(p); err != nil { - return - } - } - if fh.Flags.Has(FlagHeadersPriority) { - var v uint32 - p, v, err = readUint32(p) - if err != nil { - return nil, err - } - hf.Priority.StreamDep = v & 0x7fffffff - hf.Priority.Exclusive = (v != hf.Priority.StreamDep) // high bit was set - p, hf.Priority.Weight, err = readByte(p) - if err != nil { - return nil, err - } - } - if len(p)-int(padLength) <= 0 { - return nil, StreamError{fh.StreamID, ErrCodeProtocol} - } - hf.headerFragBuf = p[:len(p)-int(padLength)] - return hf, nil -} - -// HeadersFrameParam are the parameters for writing a HEADERS frame. -type HeadersFrameParam struct { - // StreamID is the required Stream ID to initiate. - StreamID uint32 - // BlockFragment is part (or all) of a Header Block. - BlockFragment []byte - - // EndStream indicates that the header block is the last that - // the endpoint will send for the identified stream. Setting - // this flag causes the stream to enter one of "half closed" - // states. - EndStream bool - - // EndHeaders indicates that this frame contains an entire - // header block and is not followed by any - // CONTINUATION frames. - EndHeaders bool - - // PadLength is the optional number of bytes of zeros to add - // to this frame. - PadLength uint8 - - // Priority, if non-zero, includes stream priority information - // in the HEADER frame. - Priority PriorityParam -} - -// WriteHeaders writes a single HEADERS frame. -// -// This is a low-level header writing method. Encoding headers and -// splitting them into any necessary CONTINUATION frames is handled -// elsewhere. -// -// It will perform exactly one Write to the underlying Writer. -// It is the caller's responsibility to not call other Write methods concurrently. -func (f *Framer) WriteHeaders(p HeadersFrameParam) error { - if !validStreamID(p.StreamID) && !f.AllowIllegalWrites { - return errStreamID - } - var flags Flags - if p.PadLength != 0 { - flags |= FlagHeadersPadded - } - if p.EndStream { - flags |= FlagHeadersEndStream - } - if p.EndHeaders { - flags |= FlagHeadersEndHeaders - } - if !p.Priority.IsZero() { - flags |= FlagHeadersPriority - } - f.startWrite(FrameHeaders, flags, p.StreamID) - if p.PadLength != 0 { - f.writeByte(p.PadLength) - } - if !p.Priority.IsZero() { - v := p.Priority.StreamDep - if !validStreamID(v) && !f.AllowIllegalWrites { - return errors.New("invalid dependent stream id") - } - if p.Priority.Exclusive { - v |= 1 << 31 - } - f.writeUint32(v) - f.writeByte(p.Priority.Weight) - } - f.wbuf = append(f.wbuf, p.BlockFragment...) - f.wbuf = append(f.wbuf, padZeros[:p.PadLength]...) - return f.endWrite() -} - -// A PriorityFrame specifies the sender-advised priority of a stream. -// See http://http2.github.io/http2-spec/#rfc.section.6.3 -type PriorityFrame struct { - FrameHeader - PriorityParam -} - -// PriorityParam are the stream prioritzation parameters. -type PriorityParam struct { - // StreamDep is a 31-bit stream identifier for the - // stream that this stream depends on. Zero means no - // dependency. - StreamDep uint32 - - // Exclusive is whether the dependency is exclusive. - Exclusive bool - - // Weight is the stream's zero-indexed weight. It should be - // set together with StreamDep, or neither should be set. Per - // the spec, "Add one to the value to obtain a weight between - // 1 and 256." - Weight uint8 -} - -func (p PriorityParam) IsZero() bool { - return p == PriorityParam{} -} - -func parsePriorityFrame(fh FrameHeader, payload []byte) (Frame, error) { - if fh.StreamID == 0 { - return nil, connError{ErrCodeProtocol, "PRIORITY frame with stream ID 0"} - } - if len(payload) != 5 { - return nil, connError{ErrCodeFrameSize, fmt.Sprintf("PRIORITY frame payload size was %d; want 5", len(payload))} - } - v := binary.BigEndian.Uint32(payload[:4]) - streamID := v & 0x7fffffff // mask off high bit - return &PriorityFrame{ - FrameHeader: fh, - PriorityParam: PriorityParam{ - Weight: payload[4], - StreamDep: streamID, - Exclusive: streamID != v, // was high bit set? - }, - }, nil -} - -// WritePriority writes a PRIORITY frame. -// -// It will perform exactly one Write to the underlying Writer. -// It is the caller's responsibility to not call other Write methods concurrently. -func (f *Framer) WritePriority(streamID uint32, p PriorityParam) error { - if !validStreamID(streamID) && !f.AllowIllegalWrites { - return errStreamID - } - f.startWrite(FramePriority, 0, streamID) - v := p.StreamDep - if p.Exclusive { - v |= 1 << 31 - } - f.writeUint32(v) - f.writeByte(p.Weight) - return f.endWrite() -} - -// A RSTStreamFrame allows for abnormal termination of a stream. -// See http://http2.github.io/http2-spec/#rfc.section.6.4 -type RSTStreamFrame struct { - FrameHeader - ErrCode ErrCode -} - -func parseRSTStreamFrame(fh FrameHeader, p []byte) (Frame, error) { - if len(p) != 4 { - return nil, ConnectionError(ErrCodeFrameSize) - } - if fh.StreamID == 0 { - return nil, ConnectionError(ErrCodeProtocol) - } - return &RSTStreamFrame{fh, ErrCode(binary.BigEndian.Uint32(p[:4]))}, nil -} - -// WriteRSTStream writes a RST_STREAM frame. -// -// It will perform exactly one Write to the underlying Writer. -// It is the caller's responsibility to not call other Write methods concurrently. -func (f *Framer) WriteRSTStream(streamID uint32, code ErrCode) error { - if !validStreamID(streamID) && !f.AllowIllegalWrites { - return errStreamID - } - f.startWrite(FrameRSTStream, 0, streamID) - f.writeUint32(uint32(code)) - return f.endWrite() -} - -// A ContinuationFrame is used to continue a sequence of header block fragments. -// See http://http2.github.io/http2-spec/#rfc.section.6.10 -type ContinuationFrame struct { - FrameHeader - headerFragBuf []byte -} - -func parseContinuationFrame(fh FrameHeader, p []byte) (Frame, error) { - if fh.StreamID == 0 { - return nil, connError{ErrCodeProtocol, "CONTINUATION frame with stream ID 0"} - } - return &ContinuationFrame{fh, p}, nil -} - -func (f *ContinuationFrame) HeaderBlockFragment() []byte { - f.checkValid() - return f.headerFragBuf -} - -func (f *ContinuationFrame) HeadersEnded() bool { - return f.FrameHeader.Flags.Has(FlagContinuationEndHeaders) -} - -// WriteContinuation writes a CONTINUATION frame. -// -// It will perform exactly one Write to the underlying Writer. -// It is the caller's responsibility to not call other Write methods concurrently. -func (f *Framer) WriteContinuation(streamID uint32, endHeaders bool, headerBlockFragment []byte) error { - if !validStreamID(streamID) && !f.AllowIllegalWrites { - return errStreamID - } - var flags Flags - if endHeaders { - flags |= FlagContinuationEndHeaders - } - f.startWrite(FrameContinuation, flags, streamID) - f.wbuf = append(f.wbuf, headerBlockFragment...) - return f.endWrite() -} - -// A PushPromiseFrame is used to initiate a server stream. -// See http://http2.github.io/http2-spec/#rfc.section.6.6 -type PushPromiseFrame struct { - FrameHeader - PromiseID uint32 - headerFragBuf []byte // not owned -} - -func (f *PushPromiseFrame) HeaderBlockFragment() []byte { - f.checkValid() - return f.headerFragBuf -} - -func (f *PushPromiseFrame) HeadersEnded() bool { - return f.FrameHeader.Flags.Has(FlagPushPromiseEndHeaders) -} - -func parsePushPromise(fh FrameHeader, p []byte) (_ Frame, err error) { - pp := &PushPromiseFrame{ - FrameHeader: fh, - } - if pp.StreamID == 0 { - // PUSH_PROMISE frames MUST be associated with an existing, - // peer-initiated stream. The stream identifier of a - // PUSH_PROMISE frame indicates the stream it is associated - // with. If the stream identifier field specifies the value - // 0x0, a recipient MUST respond with a connection error - // (Section 5.4.1) of type PROTOCOL_ERROR. - return nil, ConnectionError(ErrCodeProtocol) - } - // The PUSH_PROMISE frame includes optional padding. - // Padding fields and flags are identical to those defined for DATA frames - var padLength uint8 - if fh.Flags.Has(FlagPushPromisePadded) { - if p, padLength, err = readByte(p); err != nil { - return - } - } - - p, pp.PromiseID, err = readUint32(p) - if err != nil { - return - } - pp.PromiseID = pp.PromiseID & (1<<31 - 1) - - if int(padLength) > len(p) { - // like the DATA frame, error out if padding is longer than the body. - return nil, ConnectionError(ErrCodeProtocol) - } - pp.headerFragBuf = p[:len(p)-int(padLength)] - return pp, nil -} - -// PushPromiseParam are the parameters for writing a PUSH_PROMISE frame. -type PushPromiseParam struct { - // StreamID is the required Stream ID to initiate. - StreamID uint32 - - // PromiseID is the required Stream ID which this - // Push Promises - PromiseID uint32 - - // BlockFragment is part (or all) of a Header Block. - BlockFragment []byte - - // EndHeaders indicates that this frame contains an entire - // header block and is not followed by any - // CONTINUATION frames. - EndHeaders bool - - // PadLength is the optional number of bytes of zeros to add - // to this frame. - PadLength uint8 -} - -// WritePushPromise writes a single PushPromise Frame. -// -// As with Header Frames, This is the low level call for writing -// individual frames. Continuation frames are handled elsewhere. -// -// It will perform exactly one Write to the underlying Writer. -// It is the caller's responsibility to not call other Write methods concurrently. -func (f *Framer) WritePushPromise(p PushPromiseParam) error { - if !validStreamID(p.StreamID) && !f.AllowIllegalWrites { - return errStreamID - } - var flags Flags - if p.PadLength != 0 { - flags |= FlagPushPromisePadded - } - if p.EndHeaders { - flags |= FlagPushPromiseEndHeaders - } - f.startWrite(FramePushPromise, flags, p.StreamID) - if p.PadLength != 0 { - f.writeByte(p.PadLength) - } - if !validStreamID(p.PromiseID) && !f.AllowIllegalWrites { - return errStreamID - } - f.writeUint32(p.PromiseID) - f.wbuf = append(f.wbuf, p.BlockFragment...) - f.wbuf = append(f.wbuf, padZeros[:p.PadLength]...) - return f.endWrite() -} - -// WriteRawFrame writes a raw frame. This can be used to write -// extension frames unknown to this package. -func (f *Framer) WriteRawFrame(t FrameType, flags Flags, streamID uint32, payload []byte) error { - f.startWrite(t, flags, streamID) - f.writeBytes(payload) - return f.endWrite() -} - -func readByte(p []byte) (remain []byte, b byte, err error) { - if len(p) == 0 { - return nil, 0, io.ErrUnexpectedEOF - } - return p[1:], p[0], nil -} - -func readUint32(p []byte) (remain []byte, v uint32, err error) { - if len(p) < 4 { - return nil, 0, io.ErrUnexpectedEOF - } - return p[4:], binary.BigEndian.Uint32(p[:4]), nil -} - -type streamEnder interface { - StreamEnded() bool -} - -type headersEnder interface { - HeadersEnded() bool -} - -type headersOrContinuation interface { - headersEnder - HeaderBlockFragment() []byte -} - -// A MetaHeadersFrame is the representation of one HEADERS frame and -// zero or more contiguous CONTINUATION frames and the decoding of -// their HPACK-encoded contents. -// -// This type of frame does not appear on the wire and is only returned -// by the Framer when Framer.ReadMetaHeaders is set. -type MetaHeadersFrame struct { - *HeadersFrame - - // Fields are the fields contained in the HEADERS and - // CONTINUATION frames. The underlying slice is owned by the - // Framer and must not be retained after the next call to - // ReadFrame. - // - // Fields are guaranteed to be in the correct http2 order and - // not have unknown pseudo header fields or invalid header - // field names or values. Required pseudo header fields may be - // missing, however. Use the MetaHeadersFrame.Pseudo accessor - // method access pseudo headers. - Fields []hpack.HeaderField - - // Truncated is whether the max header list size limit was hit - // and Fields is incomplete. The hpack decoder state is still - // valid, however. - Truncated bool -} - -// PseudoValue returns the given pseudo header field's value. -// The provided pseudo field should not contain the leading colon. -func (mh *MetaHeadersFrame) PseudoValue(pseudo string) string { - for _, hf := range mh.Fields { - if !hf.IsPseudo() { - return "" - } - if hf.Name[1:] == pseudo { - return hf.Value - } - } - return "" -} - -// RegularFields returns the regular (non-pseudo) header fields of mh. -// The caller does not own the returned slice. -func (mh *MetaHeadersFrame) RegularFields() []hpack.HeaderField { - for i, hf := range mh.Fields { - if !hf.IsPseudo() { - return mh.Fields[i:] - } - } - return nil -} - -// PseudoFields returns the pseudo header fields of mh. -// The caller does not own the returned slice. -func (mh *MetaHeadersFrame) PseudoFields() []hpack.HeaderField { - for i, hf := range mh.Fields { - if !hf.IsPseudo() { - return mh.Fields[:i] - } - } - return mh.Fields -} - -func (mh *MetaHeadersFrame) checkPseudos() error { - var isRequest, isResponse bool - pf := mh.PseudoFields() - for i, hf := range pf { - switch hf.Name { - case ":method", ":path", ":scheme", ":authority": - isRequest = true - case ":status": - isResponse = true - default: - return pseudoHeaderError(hf.Name) - } - // Check for duplicates. - // This would be a bad algorithm, but N is 4. - // And this doesn't allocate. - for _, hf2 := range pf[:i] { - if hf.Name == hf2.Name { - return duplicatePseudoHeaderError(hf.Name) - } - } - } - if isRequest && isResponse { - return errMixPseudoHeaderTypes - } - return nil -} - -func (fr *Framer) maxHeaderStringLen() int { - v := fr.maxHeaderListSize() - if uint32(int(v)) == v { - return int(v) - } - // They had a crazy big number for MaxHeaderBytes anyway, - // so give them unlimited header lengths: - return 0 -} - -// readMetaFrame returns 0 or more CONTINUATION frames from fr and -// merge them into into the provided hf and returns a MetaHeadersFrame -// with the decoded hpack values. -func (fr *Framer) readMetaFrame(hf *HeadersFrame) (*MetaHeadersFrame, error) { - if fr.AllowIllegalReads { - return nil, errors.New("illegal use of AllowIllegalReads with ReadMetaHeaders") - } - mh := &MetaHeadersFrame{ - HeadersFrame: hf, - } - var remainSize = fr.maxHeaderListSize() - var sawRegular bool - - var invalid error // pseudo header field errors - hdec := fr.ReadMetaHeaders - hdec.SetEmitEnabled(true) - hdec.SetMaxStringLength(fr.maxHeaderStringLen()) - hdec.SetEmitFunc(func(hf hpack.HeaderField) { - if !validHeaderFieldValue(hf.Value) { - invalid = headerFieldValueError(hf.Value) - } - isPseudo := strings.HasPrefix(hf.Name, ":") - if isPseudo { - if sawRegular { - invalid = errPseudoAfterRegular - } - } else { - sawRegular = true - if !validHeaderFieldName(hf.Name) { - invalid = headerFieldNameError(hf.Name) - } - } - - if invalid != nil { - hdec.SetEmitEnabled(false) - return - } - - size := hf.Size() - if size > remainSize { - hdec.SetEmitEnabled(false) - mh.Truncated = true - return - } - remainSize -= size - - mh.Fields = append(mh.Fields, hf) - }) - // Lose reference to MetaHeadersFrame: - defer hdec.SetEmitFunc(func(hf hpack.HeaderField) {}) - - var hc headersOrContinuation = hf - for { - frag := hc.HeaderBlockFragment() - if _, err := hdec.Write(frag); err != nil { - return nil, ConnectionError(ErrCodeCompression) - } - - if hc.HeadersEnded() { - break - } - if f, err := fr.ReadFrame(); err != nil { - return nil, err - } else { - hc = f.(*ContinuationFrame) // guaranteed by checkFrameOrder - } - } - - mh.HeadersFrame.headerFragBuf = nil - mh.HeadersFrame.invalidate() - - if err := hdec.Close(); err != nil { - return nil, ConnectionError(ErrCodeCompression) - } - if invalid != nil { - fr.errDetail = invalid - return nil, StreamError{mh.StreamID, ErrCodeProtocol} - } - if err := mh.checkPseudos(); err != nil { - fr.errDetail = err - return nil, StreamError{mh.StreamID, ErrCodeProtocol} - } - return mh, nil -} - -func summarizeFrame(f Frame) string { - var buf bytes.Buffer - f.Header().writeDebug(&buf) - switch f := f.(type) { - case *SettingsFrame: - n := 0 - f.ForeachSetting(func(s Setting) error { - n++ - if n == 1 { - buf.WriteString(", settings:") - } - fmt.Fprintf(&buf, " %v=%v,", s.ID, s.Val) - return nil - }) - if n > 0 { - buf.Truncate(buf.Len() - 1) // remove trailing comma - } - case *DataFrame: - data := f.Data() - const max = 256 - if len(data) > max { - data = data[:max] - } - fmt.Fprintf(&buf, " data=%q", data) - if len(f.Data()) > max { - fmt.Fprintf(&buf, " (%d bytes omitted)", len(f.Data())-max) - } - case *WindowUpdateFrame: - if f.StreamID == 0 { - buf.WriteString(" (conn)") - } - fmt.Fprintf(&buf, " incr=%v", f.Increment) - case *PingFrame: - fmt.Fprintf(&buf, " ping=%q", f.Data[:]) - case *GoAwayFrame: - fmt.Fprintf(&buf, " LastStreamID=%v ErrCode=%v Debug=%q", - f.LastStreamID, f.ErrCode, f.debugData) - case *RSTStreamFrame: - fmt.Fprintf(&buf, " ErrCode=%v", f.ErrCode) - } - return buf.String() -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/go15.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/go15.go deleted file mode 100644 index f0a56241415..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/go15.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2015 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. - -// +build go1.5 - -package http2 - -import "net/http" - -func requestCancel(req *http.Request) <-chan struct{} { return req.Cancel } diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/gotrack.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/gotrack.go deleted file mode 100644 index 9933c9f8c74..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/gotrack.go +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright 2014 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. - -// Defensive debug-only utility to track that functions run on the -// goroutine that they're supposed to. - -package http2 - -import ( - "bytes" - "errors" - "fmt" - "os" - "runtime" - "strconv" - "sync" -) - -var DebugGoroutines = os.Getenv("DEBUG_HTTP2_GOROUTINES") == "1" - -type goroutineLock uint64 - -func newGoroutineLock() goroutineLock { - if !DebugGoroutines { - return 0 - } - return goroutineLock(curGoroutineID()) -} - -func (g goroutineLock) check() { - if !DebugGoroutines { - return - } - if curGoroutineID() != uint64(g) { - panic("running on the wrong goroutine") - } -} - -func (g goroutineLock) checkNotOn() { - if !DebugGoroutines { - return - } - if curGoroutineID() == uint64(g) { - panic("running on the wrong goroutine") - } -} - -var goroutineSpace = []byte("goroutine ") - -func curGoroutineID() uint64 { - bp := littleBuf.Get().(*[]byte) - defer littleBuf.Put(bp) - b := *bp - b = b[:runtime.Stack(b, false)] - // Parse the 4707 out of "goroutine 4707 [" - b = bytes.TrimPrefix(b, goroutineSpace) - i := bytes.IndexByte(b, ' ') - if i < 0 { - panic(fmt.Sprintf("No space found in %q", b)) - } - b = b[:i] - n, err := parseUintBytes(b, 10, 64) - if err != nil { - panic(fmt.Sprintf("Failed to parse goroutine ID out of %q: %v", b, err)) - } - return n -} - -var littleBuf = sync.Pool{ - New: func() interface{} { - buf := make([]byte, 64) - return &buf - }, -} - -// parseUintBytes is like strconv.ParseUint, but using a []byte. -func parseUintBytes(s []byte, base int, bitSize int) (n uint64, err error) { - var cutoff, maxVal uint64 - - if bitSize == 0 { - bitSize = int(strconv.IntSize) - } - - s0 := s - switch { - case len(s) < 1: - err = strconv.ErrSyntax - goto Error - - case 2 <= base && base <= 36: - // valid base; nothing to do - - case base == 0: - // Look for octal, hex prefix. - switch { - case s[0] == '0' && len(s) > 1 && (s[1] == 'x' || s[1] == 'X'): - base = 16 - s = s[2:] - if len(s) < 1 { - err = strconv.ErrSyntax - goto Error - } - case s[0] == '0': - base = 8 - default: - base = 10 - } - - default: - err = errors.New("invalid base " + strconv.Itoa(base)) - goto Error - } - - n = 0 - cutoff = cutoff64(base) - maxVal = 1<= base { - n = 0 - err = strconv.ErrSyntax - goto Error - } - - if n >= cutoff { - // n*base overflows - n = 1<<64 - 1 - err = strconv.ErrRange - goto Error - } - n *= uint64(base) - - n1 := n + uint64(v) - if n1 < n || n1 > maxVal { - // n+v overflows - n = 1<<64 - 1 - err = strconv.ErrRange - goto Error - } - n = n1 - } - - return n, nil - -Error: - return n, &strconv.NumError{Func: "ParseUint", Num: string(s0), Err: err} -} - -// Return the first number n such that n*base >= 1<<64. -func cutoff64(base int) uint64 { - if base < 2 { - return 0 - } - return (1<<64-1)/uint64(base) + 1 -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/headermap.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/headermap.go deleted file mode 100644 index c2805f6ac4d..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/headermap.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2014 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 http2 - -import ( - "net/http" - "strings" -) - -var ( - commonLowerHeader = map[string]string{} // Go-Canonical-Case -> lower-case - commonCanonHeader = map[string]string{} // lower-case -> Go-Canonical-Case -) - -func init() { - for _, v := range []string{ - "accept", - "accept-charset", - "accept-encoding", - "accept-language", - "accept-ranges", - "age", - "access-control-allow-origin", - "allow", - "authorization", - "cache-control", - "content-disposition", - "content-encoding", - "content-language", - "content-length", - "content-location", - "content-range", - "content-type", - "cookie", - "date", - "etag", - "expect", - "expires", - "from", - "host", - "if-match", - "if-modified-since", - "if-none-match", - "if-unmodified-since", - "last-modified", - "link", - "location", - "max-forwards", - "proxy-authenticate", - "proxy-authorization", - "range", - "referer", - "refresh", - "retry-after", - "server", - "set-cookie", - "strict-transport-security", - "trailer", - "transfer-encoding", - "user-agent", - "vary", - "via", - "www-authenticate", - } { - chk := http.CanonicalHeaderKey(v) - commonLowerHeader[chk] = v - commonCanonHeader[v] = chk - } -} - -func lowerHeader(v string) string { - if s, ok := commonLowerHeader[v]; ok { - return s - } - return strings.ToLower(v) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/encode.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/encode.go deleted file mode 100644 index f9bb0339848..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/encode.go +++ /dev/null @@ -1,251 +0,0 @@ -// Copyright 2014 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 hpack - -import ( - "io" -) - -const ( - uint32Max = ^uint32(0) - initialHeaderTableSize = 4096 -) - -type Encoder struct { - dynTab dynamicTable - // minSize is the minimum table size set by - // SetMaxDynamicTableSize after the previous Header Table Size - // Update. - minSize uint32 - // maxSizeLimit is the maximum table size this encoder - // supports. This will protect the encoder from too large - // size. - maxSizeLimit uint32 - // tableSizeUpdate indicates whether "Header Table Size - // Update" is required. - tableSizeUpdate bool - w io.Writer - buf []byte -} - -// NewEncoder returns a new Encoder which performs HPACK encoding. An -// encoded data is written to w. -func NewEncoder(w io.Writer) *Encoder { - e := &Encoder{ - minSize: uint32Max, - maxSizeLimit: initialHeaderTableSize, - tableSizeUpdate: false, - w: w, - } - e.dynTab.setMaxSize(initialHeaderTableSize) - return e -} - -// WriteField encodes f into a single Write to e's underlying Writer. -// This function may also produce bytes for "Header Table Size Update" -// if necessary. If produced, it is done before encoding f. -func (e *Encoder) WriteField(f HeaderField) error { - e.buf = e.buf[:0] - - if e.tableSizeUpdate { - e.tableSizeUpdate = false - if e.minSize < e.dynTab.maxSize { - e.buf = appendTableSize(e.buf, e.minSize) - } - e.minSize = uint32Max - e.buf = appendTableSize(e.buf, e.dynTab.maxSize) - } - - idx, nameValueMatch := e.searchTable(f) - if nameValueMatch { - e.buf = appendIndexed(e.buf, idx) - } else { - indexing := e.shouldIndex(f) - if indexing { - e.dynTab.add(f) - } - - if idx == 0 { - e.buf = appendNewName(e.buf, f, indexing) - } else { - e.buf = appendIndexedName(e.buf, f, idx, indexing) - } - } - n, err := e.w.Write(e.buf) - if err == nil && n != len(e.buf) { - err = io.ErrShortWrite - } - return err -} - -// searchTable searches f in both stable and dynamic header tables. -// The static header table is searched first. Only when there is no -// exact match for both name and value, the dynamic header table is -// then searched. If there is no match, i is 0. If both name and value -// match, i is the matched index and nameValueMatch becomes true. If -// only name matches, i points to that index and nameValueMatch -// becomes false. -func (e *Encoder) searchTable(f HeaderField) (i uint64, nameValueMatch bool) { - for idx, hf := range staticTable { - if !constantTimeStringCompare(hf.Name, f.Name) { - continue - } - if i == 0 { - i = uint64(idx + 1) - } - if f.Sensitive { - continue - } - if !constantTimeStringCompare(hf.Value, f.Value) { - continue - } - i = uint64(idx + 1) - nameValueMatch = true - return - } - - j, nameValueMatch := e.dynTab.search(f) - if nameValueMatch || (i == 0 && j != 0) { - i = j + uint64(len(staticTable)) - } - return -} - -// SetMaxDynamicTableSize changes the dynamic header table size to v. -// The actual size is bounded by the value passed to -// SetMaxDynamicTableSizeLimit. -func (e *Encoder) SetMaxDynamicTableSize(v uint32) { - if v > e.maxSizeLimit { - v = e.maxSizeLimit - } - if v < e.minSize { - e.minSize = v - } - e.tableSizeUpdate = true - e.dynTab.setMaxSize(v) -} - -// SetMaxDynamicTableSizeLimit changes the maximum value that can be -// specified in SetMaxDynamicTableSize to v. By default, it is set to -// 4096, which is the same size of the default dynamic header table -// size described in HPACK specification. If the current maximum -// dynamic header table size is strictly greater than v, "Header Table -// Size Update" will be done in the next WriteField call and the -// maximum dynamic header table size is truncated to v. -func (e *Encoder) SetMaxDynamicTableSizeLimit(v uint32) { - e.maxSizeLimit = v - if e.dynTab.maxSize > v { - e.tableSizeUpdate = true - e.dynTab.setMaxSize(v) - } -} - -// shouldIndex reports whether f should be indexed. -func (e *Encoder) shouldIndex(f HeaderField) bool { - return !f.Sensitive && f.Size() <= e.dynTab.maxSize -} - -// appendIndexed appends index i, as encoded in "Indexed Header Field" -// representation, to dst and returns the extended buffer. -func appendIndexed(dst []byte, i uint64) []byte { - first := len(dst) - dst = appendVarInt(dst, 7, i) - dst[first] |= 0x80 - return dst -} - -// appendNewName appends f, as encoded in one of "Literal Header field -// - New Name" representation variants, to dst and returns the -// extended buffer. -// -// If f.Sensitive is true, "Never Indexed" representation is used. If -// f.Sensitive is false and indexing is true, "Inremental Indexing" -// representation is used. -func appendNewName(dst []byte, f HeaderField, indexing bool) []byte { - dst = append(dst, encodeTypeByte(indexing, f.Sensitive)) - dst = appendHpackString(dst, f.Name) - return appendHpackString(dst, f.Value) -} - -// appendIndexedName appends f and index i referring indexed name -// entry, as encoded in one of "Literal Header field - Indexed Name" -// representation variants, to dst and returns the extended buffer. -// -// If f.Sensitive is true, "Never Indexed" representation is used. If -// f.Sensitive is false and indexing is true, "Incremental Indexing" -// representation is used. -func appendIndexedName(dst []byte, f HeaderField, i uint64, indexing bool) []byte { - first := len(dst) - var n byte - if indexing { - n = 6 - } else { - n = 4 - } - dst = appendVarInt(dst, n, i) - dst[first] |= encodeTypeByte(indexing, f.Sensitive) - return appendHpackString(dst, f.Value) -} - -// appendTableSize appends v, as encoded in "Header Table Size Update" -// representation, to dst and returns the extended buffer. -func appendTableSize(dst []byte, v uint32) []byte { - first := len(dst) - dst = appendVarInt(dst, 5, uint64(v)) - dst[first] |= 0x20 - return dst -} - -// appendVarInt appends i, as encoded in variable integer form using n -// bit prefix, to dst and returns the extended buffer. -// -// See -// http://http2.github.io/http2-spec/compression.html#integer.representation -func appendVarInt(dst []byte, n byte, i uint64) []byte { - k := uint64((1 << n) - 1) - if i < k { - return append(dst, byte(i)) - } - dst = append(dst, byte(k)) - i -= k - for ; i >= 128; i >>= 7 { - dst = append(dst, byte(0x80|(i&0x7f))) - } - return append(dst, byte(i)) -} - -// appendHpackString appends s, as encoded in "String Literal" -// representation, to dst and returns the the extended buffer. -// -// s will be encoded in Huffman codes only when it produces strictly -// shorter byte string. -func appendHpackString(dst []byte, s string) []byte { - huffmanLength := HuffmanEncodeLength(s) - if huffmanLength < uint64(len(s)) { - first := len(dst) - dst = appendVarInt(dst, 7, huffmanLength) - dst = AppendHuffmanString(dst, s) - dst[first] |= 0x80 - } else { - dst = appendVarInt(dst, 7, uint64(len(s))) - dst = append(dst, s...) - } - return dst -} - -// encodeTypeByte returns type byte. If sensitive is true, type byte -// for "Never Indexed" representation is returned. If sensitive is -// false and indexing is true, type byte for "Incremental Indexing" -// representation is returned. Otherwise, type byte for "Without -// Indexing" is returned. -func encodeTypeByte(indexing, sensitive bool) byte { - if sensitive { - return 0x10 - } - if indexing { - return 0x40 - } - return 0 -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/hpack.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/hpack.go deleted file mode 100644 index dcf257afa41..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/hpack.go +++ /dev/null @@ -1,542 +0,0 @@ -// Copyright 2014 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 hpack implements HPACK, a compression format for -// efficiently representing HTTP header fields in the context of HTTP/2. -// -// See http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-09 -package hpack - -import ( - "bytes" - "errors" - "fmt" -) - -// A DecodingError is something the spec defines as a decoding error. -type DecodingError struct { - Err error -} - -func (de DecodingError) Error() string { - return fmt.Sprintf("decoding error: %v", de.Err) -} - -// An InvalidIndexError is returned when an encoder references a table -// entry before the static table or after the end of the dynamic table. -type InvalidIndexError int - -func (e InvalidIndexError) Error() string { - return fmt.Sprintf("invalid indexed representation index %d", int(e)) -} - -// A HeaderField is a name-value pair. Both the name and value are -// treated as opaque sequences of octets. -type HeaderField struct { - Name, Value string - - // Sensitive means that this header field should never be - // indexed. - Sensitive bool -} - -// IsPseudo reports whether the header field is an http2 pseudo header. -// That is, it reports whether it starts with a colon. -// It is not otherwise guaranteed to be a valid psuedo header field, -// though. -func (hf HeaderField) IsPseudo() bool { - return len(hf.Name) != 0 && hf.Name[0] == ':' -} - -func (hf HeaderField) String() string { - var suffix string - if hf.Sensitive { - suffix = " (sensitive)" - } - return fmt.Sprintf("header field %q = %q%s", hf.Name, hf.Value, suffix) -} - -// Size returns the size of an entry per RFC 7540 section 5.2. -func (hf HeaderField) Size() uint32 { - // http://http2.github.io/http2-spec/compression.html#rfc.section.4.1 - // "The size of the dynamic table is the sum of the size of - // its entries. The size of an entry is the sum of its name's - // length in octets (as defined in Section 5.2), its value's - // length in octets (see Section 5.2), plus 32. The size of - // an entry is calculated using the length of the name and - // value without any Huffman encoding applied." - - // This can overflow if somebody makes a large HeaderField - // Name and/or Value by hand, but we don't care, because that - // won't happen on the wire because the encoding doesn't allow - // it. - return uint32(len(hf.Name) + len(hf.Value) + 32) -} - -// A Decoder is the decoding context for incremental processing of -// header blocks. -type Decoder struct { - dynTab dynamicTable - emit func(f HeaderField) - - emitEnabled bool // whether calls to emit are enabled - maxStrLen int // 0 means unlimited - - // buf is the unparsed buffer. It's only written to - // saveBuf if it was truncated in the middle of a header - // block. Because it's usually not owned, we can only - // process it under Write. - buf []byte // not owned; only valid during Write - - // saveBuf is previous data passed to Write which we weren't able - // to fully parse before. Unlike buf, we own this data. - saveBuf bytes.Buffer -} - -// NewDecoder returns a new decoder with the provided maximum dynamic -// table size. The emitFunc will be called for each valid field -// parsed, in the same goroutine as calls to Write, before Write returns. -func NewDecoder(maxDynamicTableSize uint32, emitFunc func(f HeaderField)) *Decoder { - d := &Decoder{ - emit: emitFunc, - emitEnabled: true, - } - d.dynTab.allowedMaxSize = maxDynamicTableSize - d.dynTab.setMaxSize(maxDynamicTableSize) - return d -} - -// ErrStringLength is returned by Decoder.Write when the max string length -// (as configured by Decoder.SetMaxStringLength) would be violated. -var ErrStringLength = errors.New("hpack: string too long") - -// SetMaxStringLength sets the maximum size of a HeaderField name or -// value string. If a string exceeds this length (even after any -// decompression), Write will return ErrStringLength. -// A value of 0 means unlimited and is the default from NewDecoder. -func (d *Decoder) SetMaxStringLength(n int) { - d.maxStrLen = n -} - -// SetEmitFunc changes the callback used when new header fields -// are decoded. -// It must be non-nil. It does not affect EmitEnabled. -func (d *Decoder) SetEmitFunc(emitFunc func(f HeaderField)) { - d.emit = emitFunc -} - -// SetEmitEnabled controls whether the emitFunc provided to NewDecoder -// should be called. The default is true. -// -// This facility exists to let servers enforce MAX_HEADER_LIST_SIZE -// while still decoding and keeping in-sync with decoder state, but -// without doing unnecessary decompression or generating unnecessary -// garbage for header fields past the limit. -func (d *Decoder) SetEmitEnabled(v bool) { d.emitEnabled = v } - -// EmitEnabled reports whether calls to the emitFunc provided to NewDecoder -// are currently enabled. The default is true. -func (d *Decoder) EmitEnabled() bool { return d.emitEnabled } - -// TODO: add method *Decoder.Reset(maxSize, emitFunc) to let callers re-use Decoders and their -// underlying buffers for garbage reasons. - -func (d *Decoder) SetMaxDynamicTableSize(v uint32) { - d.dynTab.setMaxSize(v) -} - -// SetAllowedMaxDynamicTableSize sets the upper bound that the encoded -// stream (via dynamic table size updates) may set the maximum size -// to. -func (d *Decoder) SetAllowedMaxDynamicTableSize(v uint32) { - d.dynTab.allowedMaxSize = v -} - -type dynamicTable struct { - // ents is the FIFO described at - // http://http2.github.io/http2-spec/compression.html#rfc.section.2.3.2 - // The newest (low index) is append at the end, and items are - // evicted from the front. - ents []HeaderField - size uint32 - maxSize uint32 // current maxSize - allowedMaxSize uint32 // maxSize may go up to this, inclusive -} - -func (dt *dynamicTable) setMaxSize(v uint32) { - dt.maxSize = v - dt.evict() -} - -// TODO: change dynamicTable to be a struct with a slice and a size int field, -// per http://http2.github.io/http2-spec/compression.html#rfc.section.4.1: -// -// -// Then make add increment the size. maybe the max size should move from Decoder to -// dynamicTable and add should return an ok bool if there was enough space. -// -// Later we'll need a remove operation on dynamicTable. - -func (dt *dynamicTable) add(f HeaderField) { - dt.ents = append(dt.ents, f) - dt.size += f.Size() - dt.evict() -} - -// If we're too big, evict old stuff (front of the slice) -func (dt *dynamicTable) evict() { - base := dt.ents // keep base pointer of slice - for dt.size > dt.maxSize { - dt.size -= dt.ents[0].Size() - dt.ents = dt.ents[1:] - } - - // Shift slice contents down if we evicted things. - if len(dt.ents) != len(base) { - copy(base, dt.ents) - dt.ents = base[:len(dt.ents)] - } -} - -// constantTimeStringCompare compares string a and b in a constant -// time manner. -func constantTimeStringCompare(a, b string) bool { - if len(a) != len(b) { - return false - } - - c := byte(0) - - for i := 0; i < len(a); i++ { - c |= a[i] ^ b[i] - } - - return c == 0 -} - -// Search searches f in the table. The return value i is 0 if there is -// no name match. If there is name match or name/value match, i is the -// index of that entry (1-based). If both name and value match, -// nameValueMatch becomes true. -func (dt *dynamicTable) search(f HeaderField) (i uint64, nameValueMatch bool) { - l := len(dt.ents) - for j := l - 1; j >= 0; j-- { - ent := dt.ents[j] - if !constantTimeStringCompare(ent.Name, f.Name) { - continue - } - if i == 0 { - i = uint64(l - j) - } - if f.Sensitive { - continue - } - if !constantTimeStringCompare(ent.Value, f.Value) { - continue - } - i = uint64(l - j) - nameValueMatch = true - return - } - return -} - -func (d *Decoder) maxTableIndex() int { - return len(d.dynTab.ents) + len(staticTable) -} - -func (d *Decoder) at(i uint64) (hf HeaderField, ok bool) { - if i < 1 { - return - } - if i > uint64(d.maxTableIndex()) { - return - } - if i <= uint64(len(staticTable)) { - return staticTable[i-1], true - } - dents := d.dynTab.ents - return dents[len(dents)-(int(i)-len(staticTable))], true -} - -// Decode decodes an entire block. -// -// TODO: remove this method and make it incremental later? This is -// easier for debugging now. -func (d *Decoder) DecodeFull(p []byte) ([]HeaderField, error) { - var hf []HeaderField - saveFunc := d.emit - defer func() { d.emit = saveFunc }() - d.emit = func(f HeaderField) { hf = append(hf, f) } - if _, err := d.Write(p); err != nil { - return nil, err - } - if err := d.Close(); err != nil { - return nil, err - } - return hf, nil -} - -func (d *Decoder) Close() error { - if d.saveBuf.Len() > 0 { - d.saveBuf.Reset() - return DecodingError{errors.New("truncated headers")} - } - return nil -} - -func (d *Decoder) Write(p []byte) (n int, err error) { - if len(p) == 0 { - // Prevent state machine CPU attacks (making us redo - // work up to the point of finding out we don't have - // enough data) - return - } - // Only copy the data if we have to. Optimistically assume - // that p will contain a complete header block. - if d.saveBuf.Len() == 0 { - d.buf = p - } else { - d.saveBuf.Write(p) - d.buf = d.saveBuf.Bytes() - d.saveBuf.Reset() - } - - for len(d.buf) > 0 { - err = d.parseHeaderFieldRepr() - if err == errNeedMore { - // Extra paranoia, making sure saveBuf won't - // get too large. All the varint and string - // reading code earlier should already catch - // overlong things and return ErrStringLength, - // but keep this as a last resort. - const varIntOverhead = 8 // conservative - if d.maxStrLen != 0 && int64(len(d.buf)) > 2*(int64(d.maxStrLen)+varIntOverhead) { - return 0, ErrStringLength - } - d.saveBuf.Write(d.buf) - return len(p), nil - } - if err != nil { - break - } - } - return len(p), err -} - -// errNeedMore is an internal sentinel error value that means the -// buffer is truncated and we need to read more data before we can -// continue parsing. -var errNeedMore = errors.New("need more data") - -type indexType int - -const ( - indexedTrue indexType = iota - indexedFalse - indexedNever -) - -func (v indexType) indexed() bool { return v == indexedTrue } -func (v indexType) sensitive() bool { return v == indexedNever } - -// returns errNeedMore if there isn't enough data available. -// any other error is fatal. -// consumes d.buf iff it returns nil. -// precondition: must be called with len(d.buf) > 0 -func (d *Decoder) parseHeaderFieldRepr() error { - b := d.buf[0] - switch { - case b&128 != 0: - // Indexed representation. - // High bit set? - // http://http2.github.io/http2-spec/compression.html#rfc.section.6.1 - return d.parseFieldIndexed() - case b&192 == 64: - // 6.2.1 Literal Header Field with Incremental Indexing - // 0b10xxxxxx: top two bits are 10 - // http://http2.github.io/http2-spec/compression.html#rfc.section.6.2.1 - return d.parseFieldLiteral(6, indexedTrue) - case b&240 == 0: - // 6.2.2 Literal Header Field without Indexing - // 0b0000xxxx: top four bits are 0000 - // http://http2.github.io/http2-spec/compression.html#rfc.section.6.2.2 - return d.parseFieldLiteral(4, indexedFalse) - case b&240 == 16: - // 6.2.3 Literal Header Field never Indexed - // 0b0001xxxx: top four bits are 0001 - // http://http2.github.io/http2-spec/compression.html#rfc.section.6.2.3 - return d.parseFieldLiteral(4, indexedNever) - case b&224 == 32: - // 6.3 Dynamic Table Size Update - // Top three bits are '001'. - // http://http2.github.io/http2-spec/compression.html#rfc.section.6.3 - return d.parseDynamicTableSizeUpdate() - } - - return DecodingError{errors.New("invalid encoding")} -} - -// (same invariants and behavior as parseHeaderFieldRepr) -func (d *Decoder) parseFieldIndexed() error { - buf := d.buf - idx, buf, err := readVarInt(7, buf) - if err != nil { - return err - } - hf, ok := d.at(idx) - if !ok { - return DecodingError{InvalidIndexError(idx)} - } - d.buf = buf - return d.callEmit(HeaderField{Name: hf.Name, Value: hf.Value}) -} - -// (same invariants and behavior as parseHeaderFieldRepr) -func (d *Decoder) parseFieldLiteral(n uint8, it indexType) error { - buf := d.buf - nameIdx, buf, err := readVarInt(n, buf) - if err != nil { - return err - } - - var hf HeaderField - wantStr := d.emitEnabled || it.indexed() - if nameIdx > 0 { - ihf, ok := d.at(nameIdx) - if !ok { - return DecodingError{InvalidIndexError(nameIdx)} - } - hf.Name = ihf.Name - } else { - hf.Name, buf, err = d.readString(buf, wantStr) - if err != nil { - return err - } - } - hf.Value, buf, err = d.readString(buf, wantStr) - if err != nil { - return err - } - d.buf = buf - if it.indexed() { - d.dynTab.add(hf) - } - hf.Sensitive = it.sensitive() - return d.callEmit(hf) -} - -func (d *Decoder) callEmit(hf HeaderField) error { - if d.maxStrLen != 0 { - if len(hf.Name) > d.maxStrLen || len(hf.Value) > d.maxStrLen { - return ErrStringLength - } - } - if d.emitEnabled { - d.emit(hf) - } - return nil -} - -// (same invariants and behavior as parseHeaderFieldRepr) -func (d *Decoder) parseDynamicTableSizeUpdate() error { - buf := d.buf - size, buf, err := readVarInt(5, buf) - if err != nil { - return err - } - if size > uint64(d.dynTab.allowedMaxSize) { - return DecodingError{errors.New("dynamic table size update too large")} - } - d.dynTab.setMaxSize(uint32(size)) - d.buf = buf - return nil -} - -var errVarintOverflow = DecodingError{errors.New("varint integer overflow")} - -// readVarInt reads an unsigned variable length integer off the -// beginning of p. n is the parameter as described in -// http://http2.github.io/http2-spec/compression.html#rfc.section.5.1. -// -// n must always be between 1 and 8. -// -// The returned remain buffer is either a smaller suffix of p, or err != nil. -// The error is errNeedMore if p doesn't contain a complete integer. -func readVarInt(n byte, p []byte) (i uint64, remain []byte, err error) { - if n < 1 || n > 8 { - panic("bad n") - } - if len(p) == 0 { - return 0, p, errNeedMore - } - i = uint64(p[0]) - if n < 8 { - i &= (1 << uint64(n)) - 1 - } - if i < (1< 0 { - b := p[0] - p = p[1:] - i += uint64(b&127) << m - if b&128 == 0 { - return i, p, nil - } - m += 7 - if m >= 63 { // TODO: proper overflow check. making this up. - return 0, origP, errVarintOverflow - } - } - return 0, origP, errNeedMore -} - -// readString decodes an hpack string from p. -// -// wantStr is whether s will be used. If false, decompression and -// []byte->string garbage are skipped if s will be ignored -// anyway. This does mean that huffman decoding errors for non-indexed -// strings past the MAX_HEADER_LIST_SIZE are ignored, but the server -// is returning an error anyway, and because they're not indexed, the error -// won't affect the decoding state. -func (d *Decoder) readString(p []byte, wantStr bool) (s string, remain []byte, err error) { - if len(p) == 0 { - return "", p, errNeedMore - } - isHuff := p[0]&128 != 0 - strLen, p, err := readVarInt(7, p) - if err != nil { - return "", p, err - } - if d.maxStrLen != 0 && strLen > uint64(d.maxStrLen) { - return "", nil, ErrStringLength - } - if uint64(len(p)) < strLen { - return "", p, errNeedMore - } - if !isHuff { - if wantStr { - s = string(p[:strLen]) - } - return s, p[strLen:], nil - } - - if wantStr { - buf := bufPool.Get().(*bytes.Buffer) - buf.Reset() // don't trust others - defer bufPool.Put(buf) - if err := huffmanDecode(buf, d.maxStrLen, p[:strLen]); err != nil { - buf.Reset() - return "", nil, err - } - s = buf.String() - buf.Reset() // be nice to GC - } - return s, p[strLen:], nil -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/huffman.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/huffman.go deleted file mode 100644 index eb4b1f05cd0..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/huffman.go +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright 2014 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 hpack - -import ( - "bytes" - "errors" - "io" - "sync" -) - -var bufPool = sync.Pool{ - New: func() interface{} { return new(bytes.Buffer) }, -} - -// HuffmanDecode decodes the string in v and writes the expanded -// result to w, returning the number of bytes written to w and the -// Write call's return value. At most one Write call is made. -func HuffmanDecode(w io.Writer, v []byte) (int, error) { - buf := bufPool.Get().(*bytes.Buffer) - buf.Reset() - defer bufPool.Put(buf) - if err := huffmanDecode(buf, 0, v); err != nil { - return 0, err - } - return w.Write(buf.Bytes()) -} - -// HuffmanDecodeToString decodes the string in v. -func HuffmanDecodeToString(v []byte) (string, error) { - buf := bufPool.Get().(*bytes.Buffer) - buf.Reset() - defer bufPool.Put(buf) - if err := huffmanDecode(buf, 0, v); err != nil { - return "", err - } - return buf.String(), nil -} - -// ErrInvalidHuffman is returned for errors found decoding -// Huffman-encoded strings. -var ErrInvalidHuffman = errors.New("hpack: invalid Huffman-encoded data") - -// huffmanDecode decodes v to buf. -// If maxLen is greater than 0, attempts to write more to buf than -// maxLen bytes will return ErrStringLength. -func huffmanDecode(buf *bytes.Buffer, maxLen int, v []byte) error { - n := rootHuffmanNode - cur, nbits := uint(0), uint8(0) - for _, b := range v { - cur = cur<<8 | uint(b) - nbits += 8 - for nbits >= 8 { - idx := byte(cur >> (nbits - 8)) - n = n.children[idx] - if n == nil { - return ErrInvalidHuffman - } - if n.children == nil { - if maxLen != 0 && buf.Len() == maxLen { - return ErrStringLength - } - buf.WriteByte(n.sym) - nbits -= n.codeLen - n = rootHuffmanNode - } else { - nbits -= 8 - } - } - } - for nbits > 0 { - n = n.children[byte(cur<<(8-nbits))] - if n.children != nil || n.codeLen > nbits { - break - } - buf.WriteByte(n.sym) - nbits -= n.codeLen - n = rootHuffmanNode - } - return nil -} - -type node struct { - // children is non-nil for internal nodes - children []*node - - // The following are only valid if children is nil: - codeLen uint8 // number of bits that led to the output of sym - sym byte // output symbol -} - -func newInternalNode() *node { - return &node{children: make([]*node, 256)} -} - -var rootHuffmanNode = newInternalNode() - -func init() { - if len(huffmanCodes) != 256 { - panic("unexpected size") - } - for i, code := range huffmanCodes { - addDecoderNode(byte(i), code, huffmanCodeLen[i]) - } -} - -func addDecoderNode(sym byte, code uint32, codeLen uint8) { - cur := rootHuffmanNode - for codeLen > 8 { - codeLen -= 8 - i := uint8(code >> codeLen) - if cur.children[i] == nil { - cur.children[i] = newInternalNode() - } - cur = cur.children[i] - } - shift := 8 - codeLen - start, end := int(uint8(code<> (nbits - rembits)) - dst[len(dst)-1] |= t - } - - return dst -} - -// HuffmanEncodeLength returns the number of bytes required to encode -// s in Huffman codes. The result is round up to byte boundary. -func HuffmanEncodeLength(s string) uint64 { - n := uint64(0) - for i := 0; i < len(s); i++ { - n += uint64(huffmanCodeLen[s[i]]) - } - return (n + 7) / 8 -} - -// appendByteToHuffmanCode appends Huffman code for c to dst and -// returns the extended buffer and the remaining bits in the last -// element. The appending is not byte aligned and the remaining bits -// in the last element of dst is given in rembits. -func appendByteToHuffmanCode(dst []byte, rembits uint8, c byte) ([]byte, uint8) { - code := huffmanCodes[c] - nbits := huffmanCodeLen[c] - - for { - if rembits > nbits { - t := uint8(code << (rembits - nbits)) - dst[len(dst)-1] |= t - rembits -= nbits - break - } - - t := uint8(code >> (nbits - rembits)) - dst[len(dst)-1] |= t - - nbits -= rembits - rembits = 8 - - if nbits == 0 { - break - } - - dst = append(dst, 0) - } - - return dst, rembits -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/tables.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/tables.go deleted file mode 100644 index b9283a02330..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/hpack/tables.go +++ /dev/null @@ -1,352 +0,0 @@ -// Copyright 2014 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 hpack - -func pair(name, value string) HeaderField { - return HeaderField{Name: name, Value: value} -} - -// http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-07#appendix-B -var staticTable = [...]HeaderField{ - pair(":authority", ""), // index 1 (1-based) - pair(":method", "GET"), - pair(":method", "POST"), - pair(":path", "/"), - pair(":path", "/index.html"), - pair(":scheme", "http"), - pair(":scheme", "https"), - pair(":status", "200"), - pair(":status", "204"), - pair(":status", "206"), - pair(":status", "304"), - pair(":status", "400"), - pair(":status", "404"), - pair(":status", "500"), - pair("accept-charset", ""), - pair("accept-encoding", "gzip, deflate"), - pair("accept-language", ""), - pair("accept-ranges", ""), - pair("accept", ""), - pair("access-control-allow-origin", ""), - pair("age", ""), - pair("allow", ""), - pair("authorization", ""), - pair("cache-control", ""), - pair("content-disposition", ""), - pair("content-encoding", ""), - pair("content-language", ""), - pair("content-length", ""), - pair("content-location", ""), - pair("content-range", ""), - pair("content-type", ""), - pair("cookie", ""), - pair("date", ""), - pair("etag", ""), - pair("expect", ""), - pair("expires", ""), - pair("from", ""), - pair("host", ""), - pair("if-match", ""), - pair("if-modified-since", ""), - pair("if-none-match", ""), - pair("if-range", ""), - pair("if-unmodified-since", ""), - pair("last-modified", ""), - pair("link", ""), - pair("location", ""), - pair("max-forwards", ""), - pair("proxy-authenticate", ""), - pair("proxy-authorization", ""), - pair("range", ""), - pair("referer", ""), - pair("refresh", ""), - pair("retry-after", ""), - pair("server", ""), - pair("set-cookie", ""), - pair("strict-transport-security", ""), - pair("transfer-encoding", ""), - pair("user-agent", ""), - pair("vary", ""), - pair("via", ""), - pair("www-authenticate", ""), -} - -var huffmanCodes = [256]uint32{ - 0x1ff8, - 0x7fffd8, - 0xfffffe2, - 0xfffffe3, - 0xfffffe4, - 0xfffffe5, - 0xfffffe6, - 0xfffffe7, - 0xfffffe8, - 0xffffea, - 0x3ffffffc, - 0xfffffe9, - 0xfffffea, - 0x3ffffffd, - 0xfffffeb, - 0xfffffec, - 0xfffffed, - 0xfffffee, - 0xfffffef, - 0xffffff0, - 0xffffff1, - 0xffffff2, - 0x3ffffffe, - 0xffffff3, - 0xffffff4, - 0xffffff5, - 0xffffff6, - 0xffffff7, - 0xffffff8, - 0xffffff9, - 0xffffffa, - 0xffffffb, - 0x14, - 0x3f8, - 0x3f9, - 0xffa, - 0x1ff9, - 0x15, - 0xf8, - 0x7fa, - 0x3fa, - 0x3fb, - 0xf9, - 0x7fb, - 0xfa, - 0x16, - 0x17, - 0x18, - 0x0, - 0x1, - 0x2, - 0x19, - 0x1a, - 0x1b, - 0x1c, - 0x1d, - 0x1e, - 0x1f, - 0x5c, - 0xfb, - 0x7ffc, - 0x20, - 0xffb, - 0x3fc, - 0x1ffa, - 0x21, - 0x5d, - 0x5e, - 0x5f, - 0x60, - 0x61, - 0x62, - 0x63, - 0x64, - 0x65, - 0x66, - 0x67, - 0x68, - 0x69, - 0x6a, - 0x6b, - 0x6c, - 0x6d, - 0x6e, - 0x6f, - 0x70, - 0x71, - 0x72, - 0xfc, - 0x73, - 0xfd, - 0x1ffb, - 0x7fff0, - 0x1ffc, - 0x3ffc, - 0x22, - 0x7ffd, - 0x3, - 0x23, - 0x4, - 0x24, - 0x5, - 0x25, - 0x26, - 0x27, - 0x6, - 0x74, - 0x75, - 0x28, - 0x29, - 0x2a, - 0x7, - 0x2b, - 0x76, - 0x2c, - 0x8, - 0x9, - 0x2d, - 0x77, - 0x78, - 0x79, - 0x7a, - 0x7b, - 0x7ffe, - 0x7fc, - 0x3ffd, - 0x1ffd, - 0xffffffc, - 0xfffe6, - 0x3fffd2, - 0xfffe7, - 0xfffe8, - 0x3fffd3, - 0x3fffd4, - 0x3fffd5, - 0x7fffd9, - 0x3fffd6, - 0x7fffda, - 0x7fffdb, - 0x7fffdc, - 0x7fffdd, - 0x7fffde, - 0xffffeb, - 0x7fffdf, - 0xffffec, - 0xffffed, - 0x3fffd7, - 0x7fffe0, - 0xffffee, - 0x7fffe1, - 0x7fffe2, - 0x7fffe3, - 0x7fffe4, - 0x1fffdc, - 0x3fffd8, - 0x7fffe5, - 0x3fffd9, - 0x7fffe6, - 0x7fffe7, - 0xffffef, - 0x3fffda, - 0x1fffdd, - 0xfffe9, - 0x3fffdb, - 0x3fffdc, - 0x7fffe8, - 0x7fffe9, - 0x1fffde, - 0x7fffea, - 0x3fffdd, - 0x3fffde, - 0xfffff0, - 0x1fffdf, - 0x3fffdf, - 0x7fffeb, - 0x7fffec, - 0x1fffe0, - 0x1fffe1, - 0x3fffe0, - 0x1fffe2, - 0x7fffed, - 0x3fffe1, - 0x7fffee, - 0x7fffef, - 0xfffea, - 0x3fffe2, - 0x3fffe3, - 0x3fffe4, - 0x7ffff0, - 0x3fffe5, - 0x3fffe6, - 0x7ffff1, - 0x3ffffe0, - 0x3ffffe1, - 0xfffeb, - 0x7fff1, - 0x3fffe7, - 0x7ffff2, - 0x3fffe8, - 0x1ffffec, - 0x3ffffe2, - 0x3ffffe3, - 0x3ffffe4, - 0x7ffffde, - 0x7ffffdf, - 0x3ffffe5, - 0xfffff1, - 0x1ffffed, - 0x7fff2, - 0x1fffe3, - 0x3ffffe6, - 0x7ffffe0, - 0x7ffffe1, - 0x3ffffe7, - 0x7ffffe2, - 0xfffff2, - 0x1fffe4, - 0x1fffe5, - 0x3ffffe8, - 0x3ffffe9, - 0xffffffd, - 0x7ffffe3, - 0x7ffffe4, - 0x7ffffe5, - 0xfffec, - 0xfffff3, - 0xfffed, - 0x1fffe6, - 0x3fffe9, - 0x1fffe7, - 0x1fffe8, - 0x7ffff3, - 0x3fffea, - 0x3fffeb, - 0x1ffffee, - 0x1ffffef, - 0xfffff4, - 0xfffff5, - 0x3ffffea, - 0x7ffff4, - 0x3ffffeb, - 0x7ffffe6, - 0x3ffffec, - 0x3ffffed, - 0x7ffffe7, - 0x7ffffe8, - 0x7ffffe9, - 0x7ffffea, - 0x7ffffeb, - 0xffffffe, - 0x7ffffec, - 0x7ffffed, - 0x7ffffee, - 0x7ffffef, - 0x7fffff0, - 0x3ffffee, -} - -var huffmanCodeLen = [256]uint8{ - 13, 23, 28, 28, 28, 28, 28, 28, 28, 24, 30, 28, 28, 30, 28, 28, - 28, 28, 28, 28, 28, 28, 30, 28, 28, 28, 28, 28, 28, 28, 28, 28, - 6, 10, 10, 12, 13, 6, 8, 11, 10, 10, 8, 11, 8, 6, 6, 6, - 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 8, 15, 6, 12, 10, - 13, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 8, 7, 8, 13, 19, 13, 14, 6, - 15, 5, 6, 5, 6, 5, 6, 6, 6, 5, 7, 7, 6, 6, 6, 5, - 6, 7, 6, 5, 5, 6, 7, 7, 7, 7, 7, 15, 11, 14, 13, 28, - 20, 22, 20, 20, 22, 22, 22, 23, 22, 23, 23, 23, 23, 23, 24, 23, - 24, 24, 22, 23, 24, 23, 23, 23, 23, 21, 22, 23, 22, 23, 23, 24, - 22, 21, 20, 22, 22, 23, 23, 21, 23, 22, 22, 24, 21, 22, 23, 23, - 21, 21, 22, 21, 23, 22, 23, 23, 20, 22, 22, 22, 23, 22, 22, 23, - 26, 26, 20, 19, 22, 23, 22, 25, 26, 26, 26, 27, 27, 26, 24, 25, - 19, 21, 26, 27, 27, 26, 27, 24, 21, 21, 26, 26, 28, 27, 27, 27, - 20, 24, 20, 21, 22, 21, 21, 23, 22, 22, 25, 25, 24, 24, 26, 23, - 26, 27, 26, 26, 27, 27, 27, 27, 27, 28, 27, 27, 27, 27, 27, 26, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/http2.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/http2.go deleted file mode 100644 index 4c5e11ac2cd..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/http2.go +++ /dev/null @@ -1,429 +0,0 @@ -// Copyright 2014 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 http2 implements the HTTP/2 protocol. -// -// This package is low-level and intended to be used directly by very -// few people. Most users will use it indirectly through the automatic -// use by the net/http package (from Go 1.6 and later). -// For use in earlier Go versions see ConfigureServer. (Transport support -// requires Go 1.6 or later) -// -// See https://http2.github.io/ for more information on HTTP/2. -// -// See https://http2.golang.org/ for a test server running this code. -package http2 - -import ( - "bufio" - "crypto/tls" - "errors" - "fmt" - "io" - "net/http" - "os" - "strconv" - "strings" - "sync" -) - -var ( - VerboseLogs bool - logFrameWrites bool - logFrameReads bool -) - -func init() { - e := os.Getenv("GODEBUG") - if strings.Contains(e, "http2debug=1") { - VerboseLogs = true - } - if strings.Contains(e, "http2debug=2") { - VerboseLogs = true - logFrameWrites = true - logFrameReads = true - } -} - -const ( - // ClientPreface is the string that must be sent by new - // connections from clients. - ClientPreface = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" - - // SETTINGS_MAX_FRAME_SIZE default - // http://http2.github.io/http2-spec/#rfc.section.6.5.2 - initialMaxFrameSize = 16384 - - // NextProtoTLS is the NPN/ALPN protocol negotiated during - // HTTP/2's TLS setup. - NextProtoTLS = "h2" - - // http://http2.github.io/http2-spec/#SettingValues - initialHeaderTableSize = 4096 - - initialWindowSize = 65535 // 6.9.2 Initial Flow Control Window Size - - defaultMaxReadFrameSize = 1 << 20 -) - -var ( - clientPreface = []byte(ClientPreface) -) - -type streamState int - -const ( - stateIdle streamState = iota - stateOpen - stateHalfClosedLocal - stateHalfClosedRemote - stateResvLocal - stateResvRemote - stateClosed -) - -var stateName = [...]string{ - stateIdle: "Idle", - stateOpen: "Open", - stateHalfClosedLocal: "HalfClosedLocal", - stateHalfClosedRemote: "HalfClosedRemote", - stateResvLocal: "ResvLocal", - stateResvRemote: "ResvRemote", - stateClosed: "Closed", -} - -func (st streamState) String() string { - return stateName[st] -} - -// Setting is a setting parameter: which setting it is, and its value. -type Setting struct { - // ID is which setting is being set. - // See http://http2.github.io/http2-spec/#SettingValues - ID SettingID - - // Val is the value. - Val uint32 -} - -func (s Setting) String() string { - return fmt.Sprintf("[%v = %d]", s.ID, s.Val) -} - -// Valid reports whether the setting is valid. -func (s Setting) Valid() error { - // Limits and error codes from 6.5.2 Defined SETTINGS Parameters - switch s.ID { - case SettingEnablePush: - if s.Val != 1 && s.Val != 0 { - return ConnectionError(ErrCodeProtocol) - } - case SettingInitialWindowSize: - if s.Val > 1<<31-1 { - return ConnectionError(ErrCodeFlowControl) - } - case SettingMaxFrameSize: - if s.Val < 16384 || s.Val > 1<<24-1 { - return ConnectionError(ErrCodeProtocol) - } - } - return nil -} - -// A SettingID is an HTTP/2 setting as defined in -// http://http2.github.io/http2-spec/#iana-settings -type SettingID uint16 - -const ( - SettingHeaderTableSize SettingID = 0x1 - SettingEnablePush SettingID = 0x2 - SettingMaxConcurrentStreams SettingID = 0x3 - SettingInitialWindowSize SettingID = 0x4 - SettingMaxFrameSize SettingID = 0x5 - SettingMaxHeaderListSize SettingID = 0x6 -) - -var settingName = map[SettingID]string{ - SettingHeaderTableSize: "HEADER_TABLE_SIZE", - SettingEnablePush: "ENABLE_PUSH", - SettingMaxConcurrentStreams: "MAX_CONCURRENT_STREAMS", - SettingInitialWindowSize: "INITIAL_WINDOW_SIZE", - SettingMaxFrameSize: "MAX_FRAME_SIZE", - SettingMaxHeaderListSize: "MAX_HEADER_LIST_SIZE", -} - -func (s SettingID) String() string { - if v, ok := settingName[s]; ok { - return v - } - return fmt.Sprintf("UNKNOWN_SETTING_%d", uint16(s)) -} - -var ( - errInvalidHeaderFieldName = errors.New("http2: invalid header field name") - errInvalidHeaderFieldValue = errors.New("http2: invalid header field value") -) - -// validHeaderFieldName reports whether v is a valid header field name (key). -// RFC 7230 says: -// header-field = field-name ":" OWS field-value OWS -// field-name = token -// tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." / -// "^" / "_" / " -// Further, http2 says: -// "Just as in HTTP/1.x, header field names are strings of ASCII -// characters that are compared in a case-insensitive -// fashion. However, header field names MUST be converted to -// lowercase prior to their encoding in HTTP/2. " -func validHeaderFieldName(v string) bool { - if len(v) == 0 { - return false - } - for _, r := range v { - if int(r) >= len(isTokenTable) || ('A' <= r && r <= 'Z') { - return false - } - if !isTokenTable[byte(r)] { - return false - } - } - return true -} - -// validHeaderFieldValue reports whether v is a valid header field value. -// -// RFC 7230 says: -// field-value = *( field-content / obs-fold ) -// obj-fold = N/A to http2, and deprecated -// field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] -// field-vchar = VCHAR / obs-text -// obs-text = %x80-FF -// VCHAR = "any visible [USASCII] character" -// -// http2 further says: "Similarly, HTTP/2 allows header field values -// that are not valid. While most of the values that can be encoded -// will not alter header field parsing, carriage return (CR, ASCII -// 0xd), line feed (LF, ASCII 0xa), and the zero character (NUL, ASCII -// 0x0) might be exploited by an attacker if they are translated -// verbatim. Any request or response that contains a character not -// permitted in a header field value MUST be treated as malformed -// (Section 8.1.2.6). Valid characters are defined by the -// field-content ABNF rule in Section 3.2 of [RFC7230]." -// -// This function does not (yet?) properly handle the rejection of -// strings that begin or end with SP or HTAB. -func validHeaderFieldValue(v string) bool { - for i := 0; i < len(v); i++ { - if b := v[i]; b < ' ' && b != '\t' || b == 0x7f { - return false - } - } - return true -} - -var httpCodeStringCommon = map[int]string{} // n -> strconv.Itoa(n) - -func init() { - for i := 100; i <= 999; i++ { - if v := http.StatusText(i); v != "" { - httpCodeStringCommon[i] = strconv.Itoa(i) - } - } -} - -func httpCodeString(code int) string { - if s, ok := httpCodeStringCommon[code]; ok { - return s - } - return strconv.Itoa(code) -} - -// from pkg io -type stringWriter interface { - WriteString(s string) (n int, err error) -} - -// A gate lets two goroutines coordinate their activities. -type gate chan struct{} - -func (g gate) Done() { g <- struct{}{} } -func (g gate) Wait() { <-g } - -// A closeWaiter is like a sync.WaitGroup but only goes 1 to 0 (open to closed). -type closeWaiter chan struct{} - -// Init makes a closeWaiter usable. -// It exists because so a closeWaiter value can be placed inside a -// larger struct and have the Mutex and Cond's memory in the same -// allocation. -func (cw *closeWaiter) Init() { - *cw = make(chan struct{}) -} - -// Close marks the closeWaiter as closed and unblocks any waiters. -func (cw closeWaiter) Close() { - close(cw) -} - -// Wait waits for the closeWaiter to become closed. -func (cw closeWaiter) Wait() { - <-cw -} - -// bufferedWriter is a buffered writer that writes to w. -// Its buffered writer is lazily allocated as needed, to minimize -// idle memory usage with many connections. -type bufferedWriter struct { - w io.Writer // immutable - bw *bufio.Writer // non-nil when data is buffered -} - -func newBufferedWriter(w io.Writer) *bufferedWriter { - return &bufferedWriter{w: w} -} - -var bufWriterPool = sync.Pool{ - New: func() interface{} { - // TODO: pick something better? this is a bit under - // (3 x typical 1500 byte MTU) at least. - return bufio.NewWriterSize(nil, 4<<10) - }, -} - -func (w *bufferedWriter) Write(p []byte) (n int, err error) { - if w.bw == nil { - bw := bufWriterPool.Get().(*bufio.Writer) - bw.Reset(w.w) - w.bw = bw - } - return w.bw.Write(p) -} - -func (w *bufferedWriter) Flush() error { - bw := w.bw - if bw == nil { - return nil - } - err := bw.Flush() - bw.Reset(nil) - bufWriterPool.Put(bw) - w.bw = nil - return err -} - -func mustUint31(v int32) uint32 { - if v < 0 || v > 2147483647 { - panic("out of range") - } - return uint32(v) -} - -// bodyAllowedForStatus reports whether a given response status code -// permits a body. See RFC2616, section 4.4. -func bodyAllowedForStatus(status int) bool { - switch { - case status >= 100 && status <= 199: - return false - case status == 204: - return false - case status == 304: - return false - } - return true -} - -type httpError struct { - msg string - timeout bool -} - -func (e *httpError) Error() string { return e.msg } -func (e *httpError) Timeout() bool { return e.timeout } -func (e *httpError) Temporary() bool { return true } - -var errTimeout error = &httpError{msg: "http2: timeout awaiting response headers", timeout: true} - -var isTokenTable = [127]bool{ - '!': true, - '#': true, - '$': true, - '%': true, - '&': true, - '\'': true, - '*': true, - '+': true, - '-': true, - '.': true, - '0': true, - '1': true, - '2': true, - '3': true, - '4': true, - '5': true, - '6': true, - '7': true, - '8': true, - '9': true, - 'A': true, - 'B': true, - 'C': true, - 'D': true, - 'E': true, - 'F': true, - 'G': true, - 'H': true, - 'I': true, - 'J': true, - 'K': true, - 'L': true, - 'M': true, - 'N': true, - 'O': true, - 'P': true, - 'Q': true, - 'R': true, - 'S': true, - 'T': true, - 'U': true, - 'W': true, - 'V': true, - 'X': true, - 'Y': true, - 'Z': true, - '^': true, - '_': true, - '`': true, - 'a': true, - 'b': true, - 'c': true, - 'd': true, - 'e': true, - 'f': true, - 'g': true, - 'h': true, - 'i': true, - 'j': true, - 'k': true, - 'l': true, - 'm': true, - 'n': true, - 'o': true, - 'p': true, - 'q': true, - 'r': true, - 's': true, - 't': true, - 'u': true, - 'v': true, - 'w': true, - 'x': true, - 'y': true, - 'z': true, - '|': true, - '~': true, -} - -type connectionStater interface { - ConnectionState() tls.ConnectionState -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/not_go15.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/not_go15.go deleted file mode 100644 index d0fa5c89069..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/not_go15.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2015 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. - -// +build !go1.5 - -package http2 - -import "net/http" - -func requestCancel(req *http.Request) <-chan struct{} { return nil } diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/not_go16.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/not_go16.go deleted file mode 100644 index db53c5b8cbf..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/not_go16.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2015 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. - -// +build !go1.6 - -package http2 - -import "net/http" - -func configureTransport(t1 *http.Transport) (*Transport, error) { - return nil, errTransportVersion -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/pipe.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/pipe.go deleted file mode 100644 index 69446e7a370..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/pipe.go +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright 2014 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 http2 - -import ( - "errors" - "io" - "sync" -) - -// pipe is a goroutine-safe io.Reader/io.Writer pair. It's like -// io.Pipe except there are no PipeReader/PipeWriter halves, and the -// underlying buffer is an interface. (io.Pipe is always unbuffered) -type pipe struct { - mu sync.Mutex - c sync.Cond // c.L lazily initialized to &p.mu - b pipeBuffer - err error // read error once empty. non-nil means closed. - breakErr error // immediate read error (caller doesn't see rest of b) - donec chan struct{} // closed on error - readFn func() // optional code to run in Read before error -} - -type pipeBuffer interface { - Len() int - io.Writer - io.Reader -} - -// Read waits until data is available and copies bytes -// from the buffer into p. -func (p *pipe) Read(d []byte) (n int, err error) { - p.mu.Lock() - defer p.mu.Unlock() - if p.c.L == nil { - p.c.L = &p.mu - } - for { - if p.breakErr != nil { - return 0, p.breakErr - } - if p.b.Len() > 0 { - return p.b.Read(d) - } - if p.err != nil { - if p.readFn != nil { - p.readFn() // e.g. copy trailers - p.readFn = nil // not sticky like p.err - } - return 0, p.err - } - p.c.Wait() - } -} - -var errClosedPipeWrite = errors.New("write on closed buffer") - -// Write copies bytes from p into the buffer and wakes a reader. -// It is an error to write more data than the buffer can hold. -func (p *pipe) Write(d []byte) (n int, err error) { - p.mu.Lock() - defer p.mu.Unlock() - if p.c.L == nil { - p.c.L = &p.mu - } - defer p.c.Signal() - if p.err != nil { - return 0, errClosedPipeWrite - } - return p.b.Write(d) -} - -// CloseWithError causes the next Read (waking up a current blocked -// Read if needed) to return the provided err after all data has been -// read. -// -// The error must be non-nil. -func (p *pipe) CloseWithError(err error) { p.closeWithError(&p.err, err, nil) } - -// BreakWithError causes the next Read (waking up a current blocked -// Read if needed) to return the provided err immediately, without -// waiting for unread data. -func (p *pipe) BreakWithError(err error) { p.closeWithError(&p.breakErr, err, nil) } - -// closeWithErrorAndCode is like CloseWithError but also sets some code to run -// in the caller's goroutine before returning the error. -func (p *pipe) closeWithErrorAndCode(err error, fn func()) { p.closeWithError(&p.err, err, fn) } - -func (p *pipe) closeWithError(dst *error, err error, fn func()) { - if err == nil { - panic("err must be non-nil") - } - p.mu.Lock() - defer p.mu.Unlock() - if p.c.L == nil { - p.c.L = &p.mu - } - defer p.c.Signal() - if *dst != nil { - // Already been done. - return - } - p.readFn = fn - *dst = err - p.closeDoneLocked() -} - -// requires p.mu be held. -func (p *pipe) closeDoneLocked() { - if p.donec == nil { - return - } - // Close if unclosed. This isn't racy since we always - // hold p.mu while closing. - select { - case <-p.donec: - default: - close(p.donec) - } -} - -// Err returns the error (if any) first set by BreakWithError or CloseWithError. -func (p *pipe) Err() error { - p.mu.Lock() - defer p.mu.Unlock() - if p.breakErr != nil { - return p.breakErr - } - return p.err -} - -// Done returns a channel which is closed if and when this pipe is closed -// with CloseWithError. -func (p *pipe) Done() <-chan struct{} { - p.mu.Lock() - defer p.mu.Unlock() - if p.donec == nil { - p.donec = make(chan struct{}) - if p.err != nil || p.breakErr != nil { - // Already hit an error. - p.closeDoneLocked() - } - } - return p.donec -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/server.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/server.go deleted file mode 100644 index 915e257164b..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/server.go +++ /dev/null @@ -1,2149 +0,0 @@ -// Copyright 2014 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. - -// TODO: replace all <-sc.doneServing with reads from the stream's cw -// instead, and make sure that on close we close all open -// streams. then remove doneServing? - -// TODO: re-audit GOAWAY support. Consider each incoming frame type and -// whether it should be ignored during graceful shutdown. - -// TODO: disconnect idle clients. GFE seems to do 4 minutes. make -// configurable? or maximum number of idle clients and remove the -// oldest? - -// TODO: turn off the serve goroutine when idle, so -// an idle conn only has the readFrames goroutine active. (which could -// also be optimized probably to pin less memory in crypto/tls). This -// would involve tracking when the serve goroutine is active (atomic -// int32 read/CAS probably?) and starting it up when frames arrive, -// and shutting it down when all handlers exit. the occasional PING -// packets could use time.AfterFunc to call sc.wakeStartServeLoop() -// (which is a no-op if already running) and then queue the PING write -// as normal. The serve loop would then exit in most cases (if no -// Handlers running) and not be woken up again until the PING packet -// returns. - -// TODO (maybe): add a mechanism for Handlers to going into -// half-closed-local mode (rw.(io.Closer) test?) but not exit their -// handler, and continue to be able to read from the -// Request.Body. This would be a somewhat semantic change from HTTP/1 -// (or at least what we expose in net/http), so I'd probably want to -// add it there too. For now, this package says that returning from -// the Handler ServeHTTP function means you're both done reading and -// done writing, without a way to stop just one or the other. - -package http2 - -import ( - "bufio" - "bytes" - "crypto/tls" - "errors" - "fmt" - "io" - "log" - "net" - "net/http" - "net/textproto" - "net/url" - "os" - "reflect" - "runtime" - "sort" - "strconv" - "strings" - "sync" - "time" - - "golang.org/x/net/http2/hpack" -) - -const ( - prefaceTimeout = 10 * time.Second - firstSettingsTimeout = 2 * time.Second // should be in-flight with preface anyway - handlerChunkWriteSize = 4 << 10 - defaultMaxStreams = 250 // TODO: make this 100 as the GFE seems to? -) - -var ( - errClientDisconnected = errors.New("client disconnected") - errClosedBody = errors.New("body closed by handler") - errHandlerComplete = errors.New("http2: request body closed due to handler exiting") - errStreamClosed = errors.New("http2: stream closed") -) - -var responseWriterStatePool = sync.Pool{ - New: func() interface{} { - rws := &responseWriterState{} - rws.bw = bufio.NewWriterSize(chunkWriter{rws}, handlerChunkWriteSize) - return rws - }, -} - -// Test hooks. -var ( - testHookOnConn func() - testHookGetServerConn func(*serverConn) - testHookOnPanicMu *sync.Mutex // nil except in tests - testHookOnPanic func(sc *serverConn, panicVal interface{}) (rePanic bool) -) - -// Server is an HTTP/2 server. -type Server struct { - // MaxHandlers limits the number of http.Handler ServeHTTP goroutines - // which may run at a time over all connections. - // Negative or zero no limit. - // TODO: implement - MaxHandlers int - - // MaxConcurrentStreams optionally specifies the number of - // concurrent streams that each client may have open at a - // time. This is unrelated to the number of http.Handler goroutines - // which may be active globally, which is MaxHandlers. - // If zero, MaxConcurrentStreams defaults to at least 100, per - // the HTTP/2 spec's recommendations. - MaxConcurrentStreams uint32 - - // MaxReadFrameSize optionally specifies the largest frame - // this server is willing to read. A valid value is between - // 16k and 16M, inclusive. If zero or otherwise invalid, a - // default value is used. - MaxReadFrameSize uint32 - - // PermitProhibitedCipherSuites, if true, permits the use of - // cipher suites prohibited by the HTTP/2 spec. - PermitProhibitedCipherSuites bool -} - -func (s *Server) maxReadFrameSize() uint32 { - if v := s.MaxReadFrameSize; v >= minMaxFrameSize && v <= maxFrameSize { - return v - } - return defaultMaxReadFrameSize -} - -func (s *Server) maxConcurrentStreams() uint32 { - if v := s.MaxConcurrentStreams; v > 0 { - return v - } - return defaultMaxStreams -} - -// ConfigureServer adds HTTP/2 support to a net/http Server. -// -// The configuration conf may be nil. -// -// ConfigureServer must be called before s begins serving. -func ConfigureServer(s *http.Server, conf *Server) error { - if conf == nil { - conf = new(Server) - } - - if s.TLSConfig == nil { - s.TLSConfig = new(tls.Config) - } else if s.TLSConfig.CipherSuites != nil { - // If they already provided a CipherSuite list, return - // an error if it has a bad order or is missing - // ECDHE_RSA_WITH_AES_128_GCM_SHA256. - const requiredCipher = tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 - haveRequired := false - sawBad := false - for i, cs := range s.TLSConfig.CipherSuites { - if cs == requiredCipher { - haveRequired = true - } - if isBadCipher(cs) { - sawBad = true - } else if sawBad { - return fmt.Errorf("http2: TLSConfig.CipherSuites index %d contains an HTTP/2-approved cipher suite (%#04x), but it comes after unapproved cipher suites. With this configuration, clients that don't support previous, approved cipher suites may be given an unapproved one and reject the connection.", i, cs) - } - } - if !haveRequired { - return fmt.Errorf("http2: TLSConfig.CipherSuites is missing HTTP/2-required TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256") - } - } - - // Note: not setting MinVersion to tls.VersionTLS12, - // as we don't want to interfere with HTTP/1.1 traffic - // on the user's server. We enforce TLS 1.2 later once - // we accept a connection. Ideally this should be done - // during next-proto selection, but using TLS <1.2 with - // HTTP/2 is still the client's bug. - - s.TLSConfig.PreferServerCipherSuites = true - - haveNPN := false - for _, p := range s.TLSConfig.NextProtos { - if p == NextProtoTLS { - haveNPN = true - break - } - } - if !haveNPN { - s.TLSConfig.NextProtos = append(s.TLSConfig.NextProtos, NextProtoTLS) - } - // h2-14 is temporary (as of 2015-03-05) while we wait for all browsers - // to switch to "h2". - s.TLSConfig.NextProtos = append(s.TLSConfig.NextProtos, "h2-14") - - if s.TLSNextProto == nil { - s.TLSNextProto = map[string]func(*http.Server, *tls.Conn, http.Handler){} - } - protoHandler := func(hs *http.Server, c *tls.Conn, h http.Handler) { - if testHookOnConn != nil { - testHookOnConn() - } - conf.ServeConn(c, &ServeConnOpts{ - Handler: h, - BaseConfig: hs, - }) - } - s.TLSNextProto[NextProtoTLS] = protoHandler - s.TLSNextProto["h2-14"] = protoHandler // temporary; see above. - return nil -} - -// ServeConnOpts are options for the Server.ServeConn method. -type ServeConnOpts struct { - // BaseConfig optionally sets the base configuration - // for values. If nil, defaults are used. - BaseConfig *http.Server - - // Handler specifies which handler to use for processing - // requests. If nil, BaseConfig.Handler is used. If BaseConfig - // or BaseConfig.Handler is nil, http.DefaultServeMux is used. - Handler http.Handler -} - -func (o *ServeConnOpts) baseConfig() *http.Server { - if o != nil && o.BaseConfig != nil { - return o.BaseConfig - } - return new(http.Server) -} - -func (o *ServeConnOpts) handler() http.Handler { - if o != nil { - if o.Handler != nil { - return o.Handler - } - if o.BaseConfig != nil && o.BaseConfig.Handler != nil { - return o.BaseConfig.Handler - } - } - return http.DefaultServeMux -} - -// ServeConn serves HTTP/2 requests on the provided connection and -// blocks until the connection is no longer readable. -// -// ServeConn starts speaking HTTP/2 assuming that c has not had any -// reads or writes. It writes its initial settings frame and expects -// to be able to read the preface and settings frame from the -// client. If c has a ConnectionState method like a *tls.Conn, the -// ConnectionState is used to verify the TLS ciphersuite and to set -// the Request.TLS field in Handlers. -// -// ServeConn does not support h2c by itself. Any h2c support must be -// implemented in terms of providing a suitably-behaving net.Conn. -// -// The opts parameter is optional. If nil, default values are used. -func (s *Server) ServeConn(c net.Conn, opts *ServeConnOpts) { - sc := &serverConn{ - srv: s, - hs: opts.baseConfig(), - conn: c, - remoteAddrStr: c.RemoteAddr().String(), - bw: newBufferedWriter(c), - handler: opts.handler(), - streams: make(map[uint32]*stream), - readFrameCh: make(chan readFrameResult), - wantWriteFrameCh: make(chan frameWriteMsg, 8), - wroteFrameCh: make(chan frameWriteResult, 1), // buffered; one send in writeFrameAsync - bodyReadCh: make(chan bodyReadMsg), // buffering doesn't matter either way - doneServing: make(chan struct{}), - advMaxStreams: s.maxConcurrentStreams(), - writeSched: writeScheduler{ - maxFrameSize: initialMaxFrameSize, - }, - initialWindowSize: initialWindowSize, - headerTableSize: initialHeaderTableSize, - serveG: newGoroutineLock(), - pushEnabled: true, - } - sc.flow.add(initialWindowSize) - sc.inflow.add(initialWindowSize) - sc.hpackEncoder = hpack.NewEncoder(&sc.headerWriteBuf) - - fr := NewFramer(sc.bw, c) - fr.ReadMetaHeaders = hpack.NewDecoder(initialHeaderTableSize, nil) - fr.MaxHeaderListSize = sc.maxHeaderListSize() - fr.SetMaxReadFrameSize(s.maxReadFrameSize()) - sc.framer = fr - - if tc, ok := c.(connectionStater); ok { - sc.tlsState = new(tls.ConnectionState) - *sc.tlsState = tc.ConnectionState() - // 9.2 Use of TLS Features - // An implementation of HTTP/2 over TLS MUST use TLS - // 1.2 or higher with the restrictions on feature set - // and cipher suite described in this section. Due to - // implementation limitations, it might not be - // possible to fail TLS negotiation. An endpoint MUST - // immediately terminate an HTTP/2 connection that - // does not meet the TLS requirements described in - // this section with a connection error (Section - // 5.4.1) of type INADEQUATE_SECURITY. - if sc.tlsState.Version < tls.VersionTLS12 { - sc.rejectConn(ErrCodeInadequateSecurity, "TLS version too low") - return - } - - if sc.tlsState.ServerName == "" { - // Client must use SNI, but we don't enforce that anymore, - // since it was causing problems when connecting to bare IP - // addresses during development. - // - // TODO: optionally enforce? Or enforce at the time we receive - // a new request, and verify the the ServerName matches the :authority? - // But that precludes proxy situations, perhaps. - // - // So for now, do nothing here again. - } - - if !s.PermitProhibitedCipherSuites && isBadCipher(sc.tlsState.CipherSuite) { - // "Endpoints MAY choose to generate a connection error - // (Section 5.4.1) of type INADEQUATE_SECURITY if one of - // the prohibited cipher suites are negotiated." - // - // We choose that. In my opinion, the spec is weak - // here. It also says both parties must support at least - // TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 so there's no - // excuses here. If we really must, we could allow an - // "AllowInsecureWeakCiphers" option on the server later. - // Let's see how it plays out first. - sc.rejectConn(ErrCodeInadequateSecurity, fmt.Sprintf("Prohibited TLS 1.2 Cipher Suite: %x", sc.tlsState.CipherSuite)) - return - } - } - - if hook := testHookGetServerConn; hook != nil { - hook(sc) - } - sc.serve() -} - -// isBadCipher reports whether the cipher is blacklisted by the HTTP/2 spec. -func isBadCipher(cipher uint16) bool { - switch cipher { - case tls.TLS_RSA_WITH_RC4_128_SHA, - tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA, - tls.TLS_RSA_WITH_AES_128_CBC_SHA, - tls.TLS_RSA_WITH_AES_256_CBC_SHA, - tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, - tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, - tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, - tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA, - tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, - tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, - tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA: - // Reject cipher suites from Appendix A. - // "This list includes those cipher suites that do not - // offer an ephemeral key exchange and those that are - // based on the TLS null, stream or block cipher type" - return true - default: - return false - } -} - -func (sc *serverConn) rejectConn(err ErrCode, debug string) { - sc.vlogf("http2: server rejecting conn: %v, %s", err, debug) - // ignoring errors. hanging up anyway. - sc.framer.WriteGoAway(0, err, []byte(debug)) - sc.bw.Flush() - sc.conn.Close() -} - -type serverConn struct { - // Immutable: - srv *Server - hs *http.Server - conn net.Conn - bw *bufferedWriter // writing to conn - handler http.Handler - framer *Framer - doneServing chan struct{} // closed when serverConn.serve ends - readFrameCh chan readFrameResult // written by serverConn.readFrames - wantWriteFrameCh chan frameWriteMsg // from handlers -> serve - wroteFrameCh chan frameWriteResult // from writeFrameAsync -> serve, tickles more frame writes - bodyReadCh chan bodyReadMsg // from handlers -> serve - testHookCh chan func(int) // code to run on the serve loop - flow flow // conn-wide (not stream-specific) outbound flow control - inflow flow // conn-wide inbound flow control - tlsState *tls.ConnectionState // shared by all handlers, like net/http - remoteAddrStr string - - // Everything following is owned by the serve loop; use serveG.check(): - serveG goroutineLock // used to verify funcs are on serve() - pushEnabled bool - sawFirstSettings bool // got the initial SETTINGS frame after the preface - needToSendSettingsAck bool - unackedSettings int // how many SETTINGS have we sent without ACKs? - clientMaxStreams uint32 // SETTINGS_MAX_CONCURRENT_STREAMS from client (our PUSH_PROMISE limit) - advMaxStreams uint32 // our SETTINGS_MAX_CONCURRENT_STREAMS advertised the client - curOpenStreams uint32 // client's number of open streams - maxStreamID uint32 // max ever seen - streams map[uint32]*stream - initialWindowSize int32 - headerTableSize uint32 - peerMaxHeaderListSize uint32 // zero means unknown (default) - canonHeader map[string]string // http2-lower-case -> Go-Canonical-Case - writingFrame bool // started write goroutine but haven't heard back on wroteFrameCh - needsFrameFlush bool // last frame write wasn't a flush - writeSched writeScheduler - inGoAway bool // we've started to or sent GOAWAY - needToSendGoAway bool // we need to schedule a GOAWAY frame write - goAwayCode ErrCode - shutdownTimerCh <-chan time.Time // nil until used - shutdownTimer *time.Timer // nil until used - - // Owned by the writeFrameAsync goroutine: - headerWriteBuf bytes.Buffer - hpackEncoder *hpack.Encoder -} - -func (sc *serverConn) maxHeaderListSize() uint32 { - n := sc.hs.MaxHeaderBytes - if n <= 0 { - n = http.DefaultMaxHeaderBytes - } - // http2's count is in a slightly different unit and includes 32 bytes per pair. - // So, take the net/http.Server value and pad it up a bit, assuming 10 headers. - const perFieldOverhead = 32 // per http2 spec - const typicalHeaders = 10 // conservative - return uint32(n + typicalHeaders*perFieldOverhead) -} - -// stream represents a stream. This is the minimal metadata needed by -// the serve goroutine. Most of the actual stream state is owned by -// the http.Handler's goroutine in the responseWriter. Because the -// responseWriter's responseWriterState is recycled at the end of a -// handler, this struct intentionally has no pointer to the -// *responseWriter{,State} itself, as the Handler ending nils out the -// responseWriter's state field. -type stream struct { - // immutable: - sc *serverConn - id uint32 - body *pipe // non-nil if expecting DATA frames - cw closeWaiter // closed wait stream transitions to closed state - - // owned by serverConn's serve loop: - bodyBytes int64 // body bytes seen so far - declBodyBytes int64 // or -1 if undeclared - flow flow // limits writing from Handler to client - inflow flow // what the client is allowed to POST/etc to us - parent *stream // or nil - numTrailerValues int64 - weight uint8 - state streamState - sentReset bool // only true once detached from streams map - gotReset bool // only true once detacted from streams map - gotTrailerHeader bool // HEADER frame for trailers was seen - - trailer http.Header // accumulated trailers - reqTrailer http.Header // handler's Request.Trailer -} - -func (sc *serverConn) Framer() *Framer { return sc.framer } -func (sc *serverConn) CloseConn() error { return sc.conn.Close() } -func (sc *serverConn) Flush() error { return sc.bw.Flush() } -func (sc *serverConn) HeaderEncoder() (*hpack.Encoder, *bytes.Buffer) { - return sc.hpackEncoder, &sc.headerWriteBuf -} - -func (sc *serverConn) state(streamID uint32) (streamState, *stream) { - sc.serveG.check() - // http://http2.github.io/http2-spec/#rfc.section.5.1 - if st, ok := sc.streams[streamID]; ok { - return st.state, st - } - // "The first use of a new stream identifier implicitly closes all - // streams in the "idle" state that might have been initiated by - // that peer with a lower-valued stream identifier. For example, if - // a client sends a HEADERS frame on stream 7 without ever sending a - // frame on stream 5, then stream 5 transitions to the "closed" - // state when the first frame for stream 7 is sent or received." - if streamID <= sc.maxStreamID { - return stateClosed, nil - } - return stateIdle, nil -} - -// setConnState calls the net/http ConnState hook for this connection, if configured. -// Note that the net/http package does StateNew and StateClosed for us. -// There is currently no plan for StateHijacked or hijacking HTTP/2 connections. -func (sc *serverConn) setConnState(state http.ConnState) { - if sc.hs.ConnState != nil { - sc.hs.ConnState(sc.conn, state) - } -} - -func (sc *serverConn) vlogf(format string, args ...interface{}) { - if VerboseLogs { - sc.logf(format, args...) - } -} - -func (sc *serverConn) logf(format string, args ...interface{}) { - if lg := sc.hs.ErrorLog; lg != nil { - lg.Printf(format, args...) - } else { - log.Printf(format, args...) - } -} - -// errno returns v's underlying uintptr, else 0. -// -// TODO: remove this helper function once http2 can use build -// tags. See comment in isClosedConnError. -func errno(v error) uintptr { - if rv := reflect.ValueOf(v); rv.Kind() == reflect.Uintptr { - return uintptr(rv.Uint()) - } - return 0 -} - -// isClosedConnError reports whether err is an error from use of a closed -// network connection. -func isClosedConnError(err error) bool { - if err == nil { - return false - } - - // TODO: remove this string search and be more like the Windows - // case below. That might involve modifying the standard library - // to return better error types. - str := err.Error() - if strings.Contains(str, "use of closed network connection") { - return true - } - - // TODO(bradfitz): x/tools/cmd/bundle doesn't really support - // build tags, so I can't make an http2_windows.go file with - // Windows-specific stuff. Fix that and move this, once we - // have a way to bundle this into std's net/http somehow. - if runtime.GOOS == "windows" { - if oe, ok := err.(*net.OpError); ok && oe.Op == "read" { - if se, ok := oe.Err.(*os.SyscallError); ok && se.Syscall == "wsarecv" { - const WSAECONNABORTED = 10053 - const WSAECONNRESET = 10054 - if n := errno(se.Err); n == WSAECONNRESET || n == WSAECONNABORTED { - return true - } - } - } - } - return false -} - -func (sc *serverConn) condlogf(err error, format string, args ...interface{}) { - if err == nil { - return - } - if err == io.EOF || err == io.ErrUnexpectedEOF || isClosedConnError(err) { - // Boring, expected errors. - sc.vlogf(format, args...) - } else { - sc.logf(format, args...) - } -} - -func (sc *serverConn) canonicalHeader(v string) string { - sc.serveG.check() - cv, ok := commonCanonHeader[v] - if ok { - return cv - } - cv, ok = sc.canonHeader[v] - if ok { - return cv - } - if sc.canonHeader == nil { - sc.canonHeader = make(map[string]string) - } - cv = http.CanonicalHeaderKey(v) - sc.canonHeader[v] = cv - return cv -} - -type readFrameResult struct { - f Frame // valid until readMore is called - err error - - // readMore should be called once the consumer no longer needs or - // retains f. After readMore, f is invalid and more frames can be - // read. - readMore func() -} - -// readFrames is the loop that reads incoming frames. -// It takes care to only read one frame at a time, blocking until the -// consumer is done with the frame. -// It's run on its own goroutine. -func (sc *serverConn) readFrames() { - gate := make(gate) - for { - f, err := sc.framer.ReadFrame() - select { - case sc.readFrameCh <- readFrameResult{f, err, gate.Done}: - case <-sc.doneServing: - return - } - select { - case <-gate: - case <-sc.doneServing: - return - } - if terminalReadFrameError(err) { - return - } - } -} - -// frameWriteResult is the message passed from writeFrameAsync to the serve goroutine. -type frameWriteResult struct { - wm frameWriteMsg // what was written (or attempted) - err error // result of the writeFrame call -} - -// writeFrameAsync runs in its own goroutine and writes a single frame -// and then reports when it's done. -// At most one goroutine can be running writeFrameAsync at a time per -// serverConn. -func (sc *serverConn) writeFrameAsync(wm frameWriteMsg) { - err := wm.write.writeFrame(sc) - sc.wroteFrameCh <- frameWriteResult{wm, err} -} - -func (sc *serverConn) closeAllStreamsOnConnClose() { - sc.serveG.check() - for _, st := range sc.streams { - sc.closeStream(st, errClientDisconnected) - } -} - -func (sc *serverConn) stopShutdownTimer() { - sc.serveG.check() - if t := sc.shutdownTimer; t != nil { - t.Stop() - } -} - -func (sc *serverConn) notePanic() { - // Note: this is for serverConn.serve panicking, not http.Handler code. - if testHookOnPanicMu != nil { - testHookOnPanicMu.Lock() - defer testHookOnPanicMu.Unlock() - } - if testHookOnPanic != nil { - if e := recover(); e != nil { - if testHookOnPanic(sc, e) { - panic(e) - } - } - } -} - -func (sc *serverConn) serve() { - sc.serveG.check() - defer sc.notePanic() - defer sc.conn.Close() - defer sc.closeAllStreamsOnConnClose() - defer sc.stopShutdownTimer() - defer close(sc.doneServing) // unblocks handlers trying to send - - if VerboseLogs { - sc.vlogf("http2: server connection from %v on %p", sc.conn.RemoteAddr(), sc.hs) - } - - sc.writeFrame(frameWriteMsg{ - write: writeSettings{ - {SettingMaxFrameSize, sc.srv.maxReadFrameSize()}, - {SettingMaxConcurrentStreams, sc.advMaxStreams}, - {SettingMaxHeaderListSize, sc.maxHeaderListSize()}, - - // TODO: more actual settings, notably - // SettingInitialWindowSize, but then we also - // want to bump up the conn window size the - // same amount here right after the settings - }, - }) - sc.unackedSettings++ - - if err := sc.readPreface(); err != nil { - sc.condlogf(err, "http2: server: error reading preface from client %v: %v", sc.conn.RemoteAddr(), err) - return - } - // Now that we've got the preface, get us out of the - // "StateNew" state. We can't go directly to idle, though. - // Active means we read some data and anticipate a request. We'll - // do another Active when we get a HEADERS frame. - sc.setConnState(http.StateActive) - sc.setConnState(http.StateIdle) - - go sc.readFrames() // closed by defer sc.conn.Close above - - settingsTimer := time.NewTimer(firstSettingsTimeout) - loopNum := 0 - for { - loopNum++ - select { - case wm := <-sc.wantWriteFrameCh: - sc.writeFrame(wm) - case res := <-sc.wroteFrameCh: - sc.wroteFrame(res) - case res := <-sc.readFrameCh: - if !sc.processFrameFromReader(res) { - return - } - res.readMore() - if settingsTimer.C != nil { - settingsTimer.Stop() - settingsTimer.C = nil - } - case m := <-sc.bodyReadCh: - sc.noteBodyRead(m.st, m.n) - case <-settingsTimer.C: - sc.logf("timeout waiting for SETTINGS frames from %v", sc.conn.RemoteAddr()) - return - case <-sc.shutdownTimerCh: - sc.vlogf("GOAWAY close timer fired; closing conn from %v", sc.conn.RemoteAddr()) - return - case fn := <-sc.testHookCh: - fn(loopNum) - } - } -} - -// readPreface reads the ClientPreface greeting from the peer -// or returns an error on timeout or an invalid greeting. -func (sc *serverConn) readPreface() error { - errc := make(chan error, 1) - go func() { - // Read the client preface - buf := make([]byte, len(ClientPreface)) - if _, err := io.ReadFull(sc.conn, buf); err != nil { - errc <- err - } else if !bytes.Equal(buf, clientPreface) { - errc <- fmt.Errorf("bogus greeting %q", buf) - } else { - errc <- nil - } - }() - timer := time.NewTimer(prefaceTimeout) // TODO: configurable on *Server? - defer timer.Stop() - select { - case <-timer.C: - return errors.New("timeout waiting for client preface") - case err := <-errc: - if err == nil { - if VerboseLogs { - sc.vlogf("http2: server: client %v said hello", sc.conn.RemoteAddr()) - } - } - return err - } -} - -var errChanPool = sync.Pool{ - New: func() interface{} { return make(chan error, 1) }, -} - -var writeDataPool = sync.Pool{ - New: func() interface{} { return new(writeData) }, -} - -// writeDataFromHandler writes DATA response frames from a handler on -// the given stream. -func (sc *serverConn) writeDataFromHandler(stream *stream, data []byte, endStream bool) error { - ch := errChanPool.Get().(chan error) - writeArg := writeDataPool.Get().(*writeData) - *writeArg = writeData{stream.id, data, endStream} - err := sc.writeFrameFromHandler(frameWriteMsg{ - write: writeArg, - stream: stream, - done: ch, - }) - if err != nil { - return err - } - var frameWriteDone bool // the frame write is done (successfully or not) - select { - case err = <-ch: - frameWriteDone = true - case <-sc.doneServing: - return errClientDisconnected - case <-stream.cw: - // If both ch and stream.cw were ready (as might - // happen on the final Write after an http.Handler - // ends), prefer the write result. Otherwise this - // might just be us successfully closing the stream. - // The writeFrameAsync and serve goroutines guarantee - // that the ch send will happen before the stream.cw - // close. - select { - case err = <-ch: - frameWriteDone = true - default: - return errStreamClosed - } - } - errChanPool.Put(ch) - if frameWriteDone { - writeDataPool.Put(writeArg) - } - return err -} - -// writeFrameFromHandler sends wm to sc.wantWriteFrameCh, but aborts -// if the connection has gone away. -// -// This must not be run from the serve goroutine itself, else it might -// deadlock writing to sc.wantWriteFrameCh (which is only mildly -// buffered and is read by serve itself). If you're on the serve -// goroutine, call writeFrame instead. -func (sc *serverConn) writeFrameFromHandler(wm frameWriteMsg) error { - sc.serveG.checkNotOn() // NOT - select { - case sc.wantWriteFrameCh <- wm: - return nil - case <-sc.doneServing: - // Serve loop is gone. - // Client has closed their connection to the server. - return errClientDisconnected - } -} - -// writeFrame schedules a frame to write and sends it if there's nothing -// already being written. -// -// There is no pushback here (the serve goroutine never blocks). It's -// the http.Handlers that block, waiting for their previous frames to -// make it onto the wire -// -// If you're not on the serve goroutine, use writeFrameFromHandler instead. -func (sc *serverConn) writeFrame(wm frameWriteMsg) { - sc.serveG.check() - sc.writeSched.add(wm) - sc.scheduleFrameWrite() -} - -// startFrameWrite starts a goroutine to write wm (in a separate -// goroutine since that might block on the network), and updates the -// serve goroutine's state about the world, updated from info in wm. -func (sc *serverConn) startFrameWrite(wm frameWriteMsg) { - sc.serveG.check() - if sc.writingFrame { - panic("internal error: can only be writing one frame at a time") - } - - st := wm.stream - if st != nil { - switch st.state { - case stateHalfClosedLocal: - panic("internal error: attempt to send frame on half-closed-local stream") - case stateClosed: - if st.sentReset || st.gotReset { - // Skip this frame. - sc.scheduleFrameWrite() - return - } - panic(fmt.Sprintf("internal error: attempt to send a write %v on a closed stream", wm)) - } - } - - sc.writingFrame = true - sc.needsFrameFlush = true - go sc.writeFrameAsync(wm) -} - -// errHandlerPanicked is the error given to any callers blocked in a read from -// Request.Body when the main goroutine panics. Since most handlers read in the -// the main ServeHTTP goroutine, this will show up rarely. -var errHandlerPanicked = errors.New("http2: handler panicked") - -// wroteFrame is called on the serve goroutine with the result of -// whatever happened on writeFrameAsync. -func (sc *serverConn) wroteFrame(res frameWriteResult) { - sc.serveG.check() - if !sc.writingFrame { - panic("internal error: expected to be already writing a frame") - } - sc.writingFrame = false - - wm := res.wm - st := wm.stream - - closeStream := endsStream(wm.write) - - if _, ok := wm.write.(handlerPanicRST); ok { - sc.closeStream(st, errHandlerPanicked) - } - - // Reply (if requested) to the blocked ServeHTTP goroutine. - if ch := wm.done; ch != nil { - select { - case ch <- res.err: - default: - panic(fmt.Sprintf("unbuffered done channel passed in for type %T", wm.write)) - } - } - wm.write = nil // prevent use (assume it's tainted after wm.done send) - - if closeStream { - if st == nil { - panic("internal error: expecting non-nil stream") - } - switch st.state { - case stateOpen: - // Here we would go to stateHalfClosedLocal in - // theory, but since our handler is done and - // the net/http package provides no mechanism - // for finishing writing to a ResponseWriter - // while still reading data (see possible TODO - // at top of this file), we go into closed - // state here anyway, after telling the peer - // we're hanging up on them. - st.state = stateHalfClosedLocal // won't last long, but necessary for closeStream via resetStream - errCancel := StreamError{st.id, ErrCodeCancel} - sc.resetStream(errCancel) - case stateHalfClosedRemote: - sc.closeStream(st, errHandlerComplete) - } - } - - sc.scheduleFrameWrite() -} - -// scheduleFrameWrite tickles the frame writing scheduler. -// -// If a frame is already being written, nothing happens. This will be called again -// when the frame is done being written. -// -// If a frame isn't being written we need to send one, the best frame -// to send is selected, preferring first things that aren't -// stream-specific (e.g. ACKing settings), and then finding the -// highest priority stream. -// -// If a frame isn't being written and there's nothing else to send, we -// flush the write buffer. -func (sc *serverConn) scheduleFrameWrite() { - sc.serveG.check() - if sc.writingFrame { - return - } - if sc.needToSendGoAway { - sc.needToSendGoAway = false - sc.startFrameWrite(frameWriteMsg{ - write: &writeGoAway{ - maxStreamID: sc.maxStreamID, - code: sc.goAwayCode, - }, - }) - return - } - if sc.needToSendSettingsAck { - sc.needToSendSettingsAck = false - sc.startFrameWrite(frameWriteMsg{write: writeSettingsAck{}}) - return - } - if !sc.inGoAway { - if wm, ok := sc.writeSched.take(); ok { - sc.startFrameWrite(wm) - return - } - } - if sc.needsFrameFlush { - sc.startFrameWrite(frameWriteMsg{write: flushFrameWriter{}}) - sc.needsFrameFlush = false // after startFrameWrite, since it sets this true - return - } -} - -func (sc *serverConn) goAway(code ErrCode) { - sc.serveG.check() - if sc.inGoAway { - return - } - if code != ErrCodeNo { - sc.shutDownIn(250 * time.Millisecond) - } else { - // TODO: configurable - sc.shutDownIn(1 * time.Second) - } - sc.inGoAway = true - sc.needToSendGoAway = true - sc.goAwayCode = code - sc.scheduleFrameWrite() -} - -func (sc *serverConn) shutDownIn(d time.Duration) { - sc.serveG.check() - sc.shutdownTimer = time.NewTimer(d) - sc.shutdownTimerCh = sc.shutdownTimer.C -} - -func (sc *serverConn) resetStream(se StreamError) { - sc.serveG.check() - sc.writeFrame(frameWriteMsg{write: se}) - if st, ok := sc.streams[se.StreamID]; ok { - st.sentReset = true - sc.closeStream(st, se) - } -} - -// processFrameFromReader processes the serve loop's read from readFrameCh from the -// frame-reading goroutine. -// processFrameFromReader returns whether the connection should be kept open. -func (sc *serverConn) processFrameFromReader(res readFrameResult) bool { - sc.serveG.check() - err := res.err - if err != nil { - if err == ErrFrameTooLarge { - sc.goAway(ErrCodeFrameSize) - return true // goAway will close the loop - } - clientGone := err == io.EOF || err == io.ErrUnexpectedEOF || isClosedConnError(err) - if clientGone { - // TODO: could we also get into this state if - // the peer does a half close - // (e.g. CloseWrite) because they're done - // sending frames but they're still wanting - // our open replies? Investigate. - // TODO: add CloseWrite to crypto/tls.Conn first - // so we have a way to test this? I suppose - // just for testing we could have a non-TLS mode. - return false - } - } else { - f := res.f - if VerboseLogs { - sc.vlogf("http2: server read frame %v", summarizeFrame(f)) - } - err = sc.processFrame(f) - if err == nil { - return true - } - } - - switch ev := err.(type) { - case StreamError: - sc.resetStream(ev) - return true - case goAwayFlowError: - sc.goAway(ErrCodeFlowControl) - return true - case ConnectionError: - sc.logf("http2: server connection error from %v: %v", sc.conn.RemoteAddr(), ev) - sc.goAway(ErrCode(ev)) - return true // goAway will handle shutdown - default: - if res.err != nil { - sc.vlogf("http2: server closing client connection; error reading frame from client %s: %v", sc.conn.RemoteAddr(), err) - } else { - sc.logf("http2: server closing client connection: %v", err) - } - return false - } -} - -func (sc *serverConn) processFrame(f Frame) error { - sc.serveG.check() - - // First frame received must be SETTINGS. - if !sc.sawFirstSettings { - if _, ok := f.(*SettingsFrame); !ok { - return ConnectionError(ErrCodeProtocol) - } - sc.sawFirstSettings = true - } - - switch f := f.(type) { - case *SettingsFrame: - return sc.processSettings(f) - case *MetaHeadersFrame: - return sc.processHeaders(f) - case *WindowUpdateFrame: - return sc.processWindowUpdate(f) - case *PingFrame: - return sc.processPing(f) - case *DataFrame: - return sc.processData(f) - case *RSTStreamFrame: - return sc.processResetStream(f) - case *PriorityFrame: - return sc.processPriority(f) - case *PushPromiseFrame: - // A client cannot push. Thus, servers MUST treat the receipt of a PUSH_PROMISE - // frame as a connection error (Section 5.4.1) of type PROTOCOL_ERROR. - return ConnectionError(ErrCodeProtocol) - default: - sc.vlogf("http2: server ignoring frame: %v", f.Header()) - return nil - } -} - -func (sc *serverConn) processPing(f *PingFrame) error { - sc.serveG.check() - if f.IsAck() { - // 6.7 PING: " An endpoint MUST NOT respond to PING frames - // containing this flag." - return nil - } - if f.StreamID != 0 { - // "PING frames are not associated with any individual - // stream. If a PING frame is received with a stream - // identifier field value other than 0x0, the recipient MUST - // respond with a connection error (Section 5.4.1) of type - // PROTOCOL_ERROR." - return ConnectionError(ErrCodeProtocol) - } - sc.writeFrame(frameWriteMsg{write: writePingAck{f}}) - return nil -} - -func (sc *serverConn) processWindowUpdate(f *WindowUpdateFrame) error { - sc.serveG.check() - switch { - case f.StreamID != 0: // stream-level flow control - st := sc.streams[f.StreamID] - if st == nil { - // "WINDOW_UPDATE can be sent by a peer that has sent a - // frame bearing the END_STREAM flag. This means that a - // receiver could receive a WINDOW_UPDATE frame on a "half - // closed (remote)" or "closed" stream. A receiver MUST - // NOT treat this as an error, see Section 5.1." - return nil - } - if !st.flow.add(int32(f.Increment)) { - return StreamError{f.StreamID, ErrCodeFlowControl} - } - default: // connection-level flow control - if !sc.flow.add(int32(f.Increment)) { - return goAwayFlowError{} - } - } - sc.scheduleFrameWrite() - return nil -} - -func (sc *serverConn) processResetStream(f *RSTStreamFrame) error { - sc.serveG.check() - - state, st := sc.state(f.StreamID) - if state == stateIdle { - // 6.4 "RST_STREAM frames MUST NOT be sent for a - // stream in the "idle" state. If a RST_STREAM frame - // identifying an idle stream is received, the - // recipient MUST treat this as a connection error - // (Section 5.4.1) of type PROTOCOL_ERROR. - return ConnectionError(ErrCodeProtocol) - } - if st != nil { - st.gotReset = true - sc.closeStream(st, StreamError{f.StreamID, f.ErrCode}) - } - return nil -} - -func (sc *serverConn) closeStream(st *stream, err error) { - sc.serveG.check() - if st.state == stateIdle || st.state == stateClosed { - panic(fmt.Sprintf("invariant; can't close stream in state %v", st.state)) - } - st.state = stateClosed - sc.curOpenStreams-- - if sc.curOpenStreams == 0 { - sc.setConnState(http.StateIdle) - } - delete(sc.streams, st.id) - if p := st.body; p != nil { - p.CloseWithError(err) - } - st.cw.Close() // signals Handler's CloseNotifier, unblocks writes, etc - sc.writeSched.forgetStream(st.id) -} - -func (sc *serverConn) processSettings(f *SettingsFrame) error { - sc.serveG.check() - if f.IsAck() { - sc.unackedSettings-- - if sc.unackedSettings < 0 { - // Why is the peer ACKing settings we never sent? - // The spec doesn't mention this case, but - // hang up on them anyway. - return ConnectionError(ErrCodeProtocol) - } - return nil - } - if err := f.ForeachSetting(sc.processSetting); err != nil { - return err - } - sc.needToSendSettingsAck = true - sc.scheduleFrameWrite() - return nil -} - -func (sc *serverConn) processSetting(s Setting) error { - sc.serveG.check() - if err := s.Valid(); err != nil { - return err - } - if VerboseLogs { - sc.vlogf("http2: server processing setting %v", s) - } - switch s.ID { - case SettingHeaderTableSize: - sc.headerTableSize = s.Val - sc.hpackEncoder.SetMaxDynamicTableSize(s.Val) - case SettingEnablePush: - sc.pushEnabled = s.Val != 0 - case SettingMaxConcurrentStreams: - sc.clientMaxStreams = s.Val - case SettingInitialWindowSize: - return sc.processSettingInitialWindowSize(s.Val) - case SettingMaxFrameSize: - sc.writeSched.maxFrameSize = s.Val - case SettingMaxHeaderListSize: - sc.peerMaxHeaderListSize = s.Val - default: - // Unknown setting: "An endpoint that receives a SETTINGS - // frame with any unknown or unsupported identifier MUST - // ignore that setting." - if VerboseLogs { - sc.vlogf("http2: server ignoring unknown setting %v", s) - } - } - return nil -} - -func (sc *serverConn) processSettingInitialWindowSize(val uint32) error { - sc.serveG.check() - // Note: val already validated to be within range by - // processSetting's Valid call. - - // "A SETTINGS frame can alter the initial flow control window - // size for all current streams. When the value of - // SETTINGS_INITIAL_WINDOW_SIZE changes, a receiver MUST - // adjust the size of all stream flow control windows that it - // maintains by the difference between the new value and the - // old value." - old := sc.initialWindowSize - sc.initialWindowSize = int32(val) - growth := sc.initialWindowSize - old // may be negative - for _, st := range sc.streams { - if !st.flow.add(growth) { - // 6.9.2 Initial Flow Control Window Size - // "An endpoint MUST treat a change to - // SETTINGS_INITIAL_WINDOW_SIZE that causes any flow - // control window to exceed the maximum size as a - // connection error (Section 5.4.1) of type - // FLOW_CONTROL_ERROR." - return ConnectionError(ErrCodeFlowControl) - } - } - return nil -} - -func (sc *serverConn) processData(f *DataFrame) error { - sc.serveG.check() - // "If a DATA frame is received whose stream is not in "open" - // or "half closed (local)" state, the recipient MUST respond - // with a stream error (Section 5.4.2) of type STREAM_CLOSED." - id := f.Header().StreamID - st, ok := sc.streams[id] - if !ok || st.state != stateOpen || st.gotTrailerHeader { - // This includes sending a RST_STREAM if the stream is - // in stateHalfClosedLocal (which currently means that - // the http.Handler returned, so it's done reading & - // done writing). Try to stop the client from sending - // more DATA. - return StreamError{id, ErrCodeStreamClosed} - } - if st.body == nil { - panic("internal error: should have a body in this state") - } - data := f.Data() - - // Sender sending more than they'd declared? - if st.declBodyBytes != -1 && st.bodyBytes+int64(len(data)) > st.declBodyBytes { - st.body.CloseWithError(fmt.Errorf("sender tried to send more than declared Content-Length of %d bytes", st.declBodyBytes)) - return StreamError{id, ErrCodeStreamClosed} - } - if len(data) > 0 { - // Check whether the client has flow control quota. - if int(st.inflow.available()) < len(data) { - return StreamError{id, ErrCodeFlowControl} - } - st.inflow.take(int32(len(data))) - wrote, err := st.body.Write(data) - if err != nil { - return StreamError{id, ErrCodeStreamClosed} - } - if wrote != len(data) { - panic("internal error: bad Writer") - } - st.bodyBytes += int64(len(data)) - } - if f.StreamEnded() { - st.endStream() - } - return nil -} - -// endStream closes a Request.Body's pipe. It is called when a DATA -// frame says a request body is over (or after trailers). -func (st *stream) endStream() { - sc := st.sc - sc.serveG.check() - - if st.declBodyBytes != -1 && st.declBodyBytes != st.bodyBytes { - st.body.CloseWithError(fmt.Errorf("request declared a Content-Length of %d but only wrote %d bytes", - st.declBodyBytes, st.bodyBytes)) - } else { - st.body.closeWithErrorAndCode(io.EOF, st.copyTrailersToHandlerRequest) - st.body.CloseWithError(io.EOF) - } - st.state = stateHalfClosedRemote -} - -// copyTrailersToHandlerRequest is run in the Handler's goroutine in -// its Request.Body.Read just before it gets io.EOF. -func (st *stream) copyTrailersToHandlerRequest() { - for k, vv := range st.trailer { - if _, ok := st.reqTrailer[k]; ok { - // Only copy it over it was pre-declared. - st.reqTrailer[k] = vv - } - } -} - -func (sc *serverConn) processHeaders(f *MetaHeadersFrame) error { - sc.serveG.check() - id := f.Header().StreamID - if sc.inGoAway { - // Ignore. - return nil - } - // http://http2.github.io/http2-spec/#rfc.section.5.1.1 - // Streams initiated by a client MUST use odd-numbered stream - // identifiers. [...] An endpoint that receives an unexpected - // stream identifier MUST respond with a connection error - // (Section 5.4.1) of type PROTOCOL_ERROR. - if id%2 != 1 { - return ConnectionError(ErrCodeProtocol) - } - // A HEADERS frame can be used to create a new stream or - // send a trailer for an open one. If we already have a stream - // open, let it process its own HEADERS frame (trailers at this - // point, if it's valid). - st := sc.streams[f.Header().StreamID] - if st != nil { - return st.processTrailerHeaders(f) - } - - // [...] The identifier of a newly established stream MUST be - // numerically greater than all streams that the initiating - // endpoint has opened or reserved. [...] An endpoint that - // receives an unexpected stream identifier MUST respond with - // a connection error (Section 5.4.1) of type PROTOCOL_ERROR. - if id <= sc.maxStreamID { - return ConnectionError(ErrCodeProtocol) - } - sc.maxStreamID = id - - st = &stream{ - sc: sc, - id: id, - state: stateOpen, - } - if f.StreamEnded() { - st.state = stateHalfClosedRemote - } - st.cw.Init() - - st.flow.conn = &sc.flow // link to conn-level counter - st.flow.add(sc.initialWindowSize) - st.inflow.conn = &sc.inflow // link to conn-level counter - st.inflow.add(initialWindowSize) // TODO: update this when we send a higher initial window size in the initial settings - - sc.streams[id] = st - if f.HasPriority() { - adjustStreamPriority(sc.streams, st.id, f.Priority) - } - sc.curOpenStreams++ - if sc.curOpenStreams == 1 { - sc.setConnState(http.StateActive) - } - if sc.curOpenStreams > sc.advMaxStreams { - // "Endpoints MUST NOT exceed the limit set by their - // peer. An endpoint that receives a HEADERS frame - // that causes their advertised concurrent stream - // limit to be exceeded MUST treat this as a stream - // error (Section 5.4.2) of type PROTOCOL_ERROR or - // REFUSED_STREAM." - if sc.unackedSettings == 0 { - // They should know better. - return StreamError{st.id, ErrCodeProtocol} - } - // Assume it's a network race, where they just haven't - // received our last SETTINGS update. But actually - // this can't happen yet, because we don't yet provide - // a way for users to adjust server parameters at - // runtime. - return StreamError{st.id, ErrCodeRefusedStream} - } - - rw, req, err := sc.newWriterAndRequest(st, f) - if err != nil { - return err - } - st.reqTrailer = req.Trailer - if st.reqTrailer != nil { - st.trailer = make(http.Header) - } - st.body = req.Body.(*requestBody).pipe // may be nil - st.declBodyBytes = req.ContentLength - - handler := sc.handler.ServeHTTP - if f.Truncated { - // Their header list was too long. Send a 431 error. - handler = handleHeaderListTooLong - } - - go sc.runHandler(rw, req, handler) - return nil -} - -func (st *stream) processTrailerHeaders(f *MetaHeadersFrame) error { - sc := st.sc - sc.serveG.check() - if st.gotTrailerHeader { - return ConnectionError(ErrCodeProtocol) - } - st.gotTrailerHeader = true - if !f.StreamEnded() { - return StreamError{st.id, ErrCodeProtocol} - } - - if len(f.PseudoFields()) > 0 { - return StreamError{st.id, ErrCodeProtocol} - } - if st.trailer != nil { - for _, hf := range f.RegularFields() { - key := sc.canonicalHeader(hf.Name) - st.trailer[key] = append(st.trailer[key], hf.Value) - } - } - st.endStream() - return nil -} - -func (sc *serverConn) processPriority(f *PriorityFrame) error { - adjustStreamPriority(sc.streams, f.StreamID, f.PriorityParam) - return nil -} - -func adjustStreamPriority(streams map[uint32]*stream, streamID uint32, priority PriorityParam) { - st, ok := streams[streamID] - if !ok { - // TODO: not quite correct (this streamID might - // already exist in the dep tree, but be closed), but - // close enough for now. - return - } - st.weight = priority.Weight - parent := streams[priority.StreamDep] // might be nil - if parent == st { - // if client tries to set this stream to be the parent of itself - // ignore and keep going - return - } - - // section 5.3.3: If a stream is made dependent on one of its - // own dependencies, the formerly dependent stream is first - // moved to be dependent on the reprioritized stream's previous - // parent. The moved dependency retains its weight. - for piter := parent; piter != nil; piter = piter.parent { - if piter == st { - parent.parent = st.parent - break - } - } - st.parent = parent - if priority.Exclusive && (st.parent != nil || priority.StreamDep == 0) { - for _, openStream := range streams { - if openStream != st && openStream.parent == st.parent { - openStream.parent = st - } - } - } -} - -func (sc *serverConn) newWriterAndRequest(st *stream, f *MetaHeadersFrame) (*responseWriter, *http.Request, error) { - sc.serveG.check() - - method := f.PseudoValue("method") - path := f.PseudoValue("path") - scheme := f.PseudoValue("scheme") - authority := f.PseudoValue("authority") - - isConnect := method == "CONNECT" - if isConnect { - if path != "" || scheme != "" || authority == "" { - return nil, nil, StreamError{f.StreamID, ErrCodeProtocol} - } - } else if method == "" || path == "" || - (scheme != "https" && scheme != "http") { - // See 8.1.2.6 Malformed Requests and Responses: - // - // Malformed requests or responses that are detected - // MUST be treated as a stream error (Section 5.4.2) - // of type PROTOCOL_ERROR." - // - // 8.1.2.3 Request Pseudo-Header Fields - // "All HTTP/2 requests MUST include exactly one valid - // value for the :method, :scheme, and :path - // pseudo-header fields" - return nil, nil, StreamError{f.StreamID, ErrCodeProtocol} - } - - bodyOpen := !f.StreamEnded() - if method == "HEAD" && bodyOpen { - // HEAD requests can't have bodies - return nil, nil, StreamError{f.StreamID, ErrCodeProtocol} - } - var tlsState *tls.ConnectionState // nil if not scheme https - - if scheme == "https" { - tlsState = sc.tlsState - } - - header := make(http.Header) - for _, hf := range f.RegularFields() { - header.Add(sc.canonicalHeader(hf.Name), hf.Value) - } - - if authority == "" { - authority = header.Get("Host") - } - needsContinue := header.Get("Expect") == "100-continue" - if needsContinue { - header.Del("Expect") - } - // Merge Cookie headers into one "; "-delimited value. - if cookies := header["Cookie"]; len(cookies) > 1 { - header.Set("Cookie", strings.Join(cookies, "; ")) - } - - // Setup Trailers - var trailer http.Header - for _, v := range header["Trailer"] { - for _, key := range strings.Split(v, ",") { - key = http.CanonicalHeaderKey(strings.TrimSpace(key)) - switch key { - case "Transfer-Encoding", "Trailer", "Content-Length": - // Bogus. (copy of http1 rules) - // Ignore. - default: - if trailer == nil { - trailer = make(http.Header) - } - trailer[key] = nil - } - } - } - delete(header, "Trailer") - - body := &requestBody{ - conn: sc, - stream: st, - needsContinue: needsContinue, - } - var url_ *url.URL - var requestURI string - if isConnect { - url_ = &url.URL{Host: authority} - requestURI = authority // mimic HTTP/1 server behavior - } else { - var err error - url_, err = url.ParseRequestURI(path) - if err != nil { - return nil, nil, StreamError{f.StreamID, ErrCodeProtocol} - } - requestURI = path - } - req := &http.Request{ - Method: method, - URL: url_, - RemoteAddr: sc.remoteAddrStr, - Header: header, - RequestURI: requestURI, - Proto: "HTTP/2.0", - ProtoMajor: 2, - ProtoMinor: 0, - TLS: tlsState, - Host: authority, - Body: body, - Trailer: trailer, - } - if bodyOpen { - body.pipe = &pipe{ - b: &fixedBuffer{buf: make([]byte, initialWindowSize)}, // TODO: garbage - } - - if vv, ok := header["Content-Length"]; ok { - req.ContentLength, _ = strconv.ParseInt(vv[0], 10, 64) - } else { - req.ContentLength = -1 - } - } - - rws := responseWriterStatePool.Get().(*responseWriterState) - bwSave := rws.bw - *rws = responseWriterState{} // zero all the fields - rws.conn = sc - rws.bw = bwSave - rws.bw.Reset(chunkWriter{rws}) - rws.stream = st - rws.req = req - rws.body = body - - rw := &responseWriter{rws: rws} - return rw, req, nil -} - -// Run on its own goroutine. -func (sc *serverConn) runHandler(rw *responseWriter, req *http.Request, handler func(http.ResponseWriter, *http.Request)) { - didPanic := true - defer func() { - if didPanic { - e := recover() - // Same as net/http: - const size = 64 << 10 - buf := make([]byte, size) - buf = buf[:runtime.Stack(buf, false)] - sc.writeFrameFromHandler(frameWriteMsg{ - write: handlerPanicRST{rw.rws.stream.id}, - stream: rw.rws.stream, - }) - sc.logf("http2: panic serving %v: %v\n%s", sc.conn.RemoteAddr(), e, buf) - return - } - rw.handlerDone() - }() - handler(rw, req) - didPanic = false -} - -func handleHeaderListTooLong(w http.ResponseWriter, r *http.Request) { - // 10.5.1 Limits on Header Block Size: - // .. "A server that receives a larger header block than it is - // willing to handle can send an HTTP 431 (Request Header Fields Too - // Large) status code" - const statusRequestHeaderFieldsTooLarge = 431 // only in Go 1.6+ - w.WriteHeader(statusRequestHeaderFieldsTooLarge) - io.WriteString(w, "

HTTP Error 431

Request Header Field(s) Too Large

") -} - -// called from handler goroutines. -// h may be nil. -func (sc *serverConn) writeHeaders(st *stream, headerData *writeResHeaders) error { - sc.serveG.checkNotOn() // NOT on - var errc chan error - if headerData.h != nil { - // If there's a header map (which we don't own), so we have to block on - // waiting for this frame to be written, so an http.Flush mid-handler - // writes out the correct value of keys, before a handler later potentially - // mutates it. - errc = errChanPool.Get().(chan error) - } - if err := sc.writeFrameFromHandler(frameWriteMsg{ - write: headerData, - stream: st, - done: errc, - }); err != nil { - return err - } - if errc != nil { - select { - case err := <-errc: - errChanPool.Put(errc) - return err - case <-sc.doneServing: - return errClientDisconnected - case <-st.cw: - return errStreamClosed - } - } - return nil -} - -// called from handler goroutines. -func (sc *serverConn) write100ContinueHeaders(st *stream) { - sc.writeFrameFromHandler(frameWriteMsg{ - write: write100ContinueHeadersFrame{st.id}, - stream: st, - }) -} - -// A bodyReadMsg tells the server loop that the http.Handler read n -// bytes of the DATA from the client on the given stream. -type bodyReadMsg struct { - st *stream - n int -} - -// called from handler goroutines. -// Notes that the handler for the given stream ID read n bytes of its body -// and schedules flow control tokens to be sent. -func (sc *serverConn) noteBodyReadFromHandler(st *stream, n int) { - sc.serveG.checkNotOn() // NOT on - select { - case sc.bodyReadCh <- bodyReadMsg{st, n}: - case <-sc.doneServing: - } -} - -func (sc *serverConn) noteBodyRead(st *stream, n int) { - sc.serveG.check() - sc.sendWindowUpdate(nil, n) // conn-level - if st.state != stateHalfClosedRemote && st.state != stateClosed { - // Don't send this WINDOW_UPDATE if the stream is closed - // remotely. - sc.sendWindowUpdate(st, n) - } -} - -// st may be nil for conn-level -func (sc *serverConn) sendWindowUpdate(st *stream, n int) { - sc.serveG.check() - // "The legal range for the increment to the flow control - // window is 1 to 2^31-1 (2,147,483,647) octets." - // A Go Read call on 64-bit machines could in theory read - // a larger Read than this. Very unlikely, but we handle it here - // rather than elsewhere for now. - const maxUint31 = 1<<31 - 1 - for n >= maxUint31 { - sc.sendWindowUpdate32(st, maxUint31) - n -= maxUint31 - } - sc.sendWindowUpdate32(st, int32(n)) -} - -// st may be nil for conn-level -func (sc *serverConn) sendWindowUpdate32(st *stream, n int32) { - sc.serveG.check() - if n == 0 { - return - } - if n < 0 { - panic("negative update") - } - var streamID uint32 - if st != nil { - streamID = st.id - } - sc.writeFrame(frameWriteMsg{ - write: writeWindowUpdate{streamID: streamID, n: uint32(n)}, - stream: st, - }) - var ok bool - if st == nil { - ok = sc.inflow.add(n) - } else { - ok = st.inflow.add(n) - } - if !ok { - panic("internal error; sent too many window updates without decrements?") - } -} - -type requestBody struct { - stream *stream - conn *serverConn - closed bool - pipe *pipe // non-nil if we have a HTTP entity message body - needsContinue bool // need to send a 100-continue -} - -func (b *requestBody) Close() error { - if b.pipe != nil { - b.pipe.CloseWithError(errClosedBody) - } - b.closed = true - return nil -} - -func (b *requestBody) Read(p []byte) (n int, err error) { - if b.needsContinue { - b.needsContinue = false - b.conn.write100ContinueHeaders(b.stream) - } - if b.pipe == nil { - return 0, io.EOF - } - n, err = b.pipe.Read(p) - if n > 0 { - b.conn.noteBodyReadFromHandler(b.stream, n) - } - return -} - -// responseWriter is the http.ResponseWriter implementation. It's -// intentionally small (1 pointer wide) to minimize garbage. The -// responseWriterState pointer inside is zeroed at the end of a -// request (in handlerDone) and calls on the responseWriter thereafter -// simply crash (caller's mistake), but the much larger responseWriterState -// and buffers are reused between multiple requests. -type responseWriter struct { - rws *responseWriterState -} - -// Optional http.ResponseWriter interfaces implemented. -var ( - _ http.CloseNotifier = (*responseWriter)(nil) - _ http.Flusher = (*responseWriter)(nil) - _ stringWriter = (*responseWriter)(nil) -) - -type responseWriterState struct { - // immutable within a request: - stream *stream - req *http.Request - body *requestBody // to close at end of request, if DATA frames didn't - conn *serverConn - - // TODO: adjust buffer writing sizes based on server config, frame size updates from peer, etc - bw *bufio.Writer // writing to a chunkWriter{this *responseWriterState} - - // mutated by http.Handler goroutine: - handlerHeader http.Header // nil until called - snapHeader http.Header // snapshot of handlerHeader at WriteHeader time - trailers []string // set in writeChunk - status int // status code passed to WriteHeader - wroteHeader bool // WriteHeader called (explicitly or implicitly). Not necessarily sent to user yet. - sentHeader bool // have we sent the header frame? - handlerDone bool // handler has finished - - sentContentLen int64 // non-zero if handler set a Content-Length header - wroteBytes int64 - - closeNotifierMu sync.Mutex // guards closeNotifierCh - closeNotifierCh chan bool // nil until first used -} - -type chunkWriter struct{ rws *responseWriterState } - -func (cw chunkWriter) Write(p []byte) (n int, err error) { return cw.rws.writeChunk(p) } - -func (rws *responseWriterState) hasTrailers() bool { return len(rws.trailers) != 0 } - -// declareTrailer is called for each Trailer header when the -// response header is written. It notes that a header will need to be -// written in the trailers at the end of the response. -func (rws *responseWriterState) declareTrailer(k string) { - k = http.CanonicalHeaderKey(k) - switch k { - case "Transfer-Encoding", "Content-Length", "Trailer": - // Forbidden by RFC 2616 14.40. - return - } - if !strSliceContains(rws.trailers, k) { - rws.trailers = append(rws.trailers, k) - } -} - -// writeChunk writes chunks from the bufio.Writer. But because -// bufio.Writer may bypass its chunking, sometimes p may be -// arbitrarily large. -// -// writeChunk is also responsible (on the first chunk) for sending the -// HEADER response. -func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) { - if !rws.wroteHeader { - rws.writeHeader(200) - } - - isHeadResp := rws.req.Method == "HEAD" - if !rws.sentHeader { - rws.sentHeader = true - var ctype, clen string - if clen = rws.snapHeader.Get("Content-Length"); clen != "" { - rws.snapHeader.Del("Content-Length") - clen64, err := strconv.ParseInt(clen, 10, 64) - if err == nil && clen64 >= 0 { - rws.sentContentLen = clen64 - } else { - clen = "" - } - } - if clen == "" && rws.handlerDone && bodyAllowedForStatus(rws.status) && (len(p) > 0 || !isHeadResp) { - clen = strconv.Itoa(len(p)) - } - _, hasContentType := rws.snapHeader["Content-Type"] - if !hasContentType && bodyAllowedForStatus(rws.status) { - ctype = http.DetectContentType(p) - } - var date string - if _, ok := rws.snapHeader["Date"]; !ok { - // TODO(bradfitz): be faster here, like net/http? measure. - date = time.Now().UTC().Format(http.TimeFormat) - } - - for _, v := range rws.snapHeader["Trailer"] { - foreachHeaderElement(v, rws.declareTrailer) - } - - endStream := (rws.handlerDone && !rws.hasTrailers() && len(p) == 0) || isHeadResp - err = rws.conn.writeHeaders(rws.stream, &writeResHeaders{ - streamID: rws.stream.id, - httpResCode: rws.status, - h: rws.snapHeader, - endStream: endStream, - contentType: ctype, - contentLength: clen, - date: date, - }) - if err != nil { - return 0, err - } - if endStream { - return 0, nil - } - } - if isHeadResp { - return len(p), nil - } - if len(p) == 0 && !rws.handlerDone { - return 0, nil - } - - if rws.handlerDone { - rws.promoteUndeclaredTrailers() - } - - endStream := rws.handlerDone && !rws.hasTrailers() - if len(p) > 0 || endStream { - // only send a 0 byte DATA frame if we're ending the stream. - if err := rws.conn.writeDataFromHandler(rws.stream, p, endStream); err != nil { - return 0, err - } - } - - if rws.handlerDone && rws.hasTrailers() { - err = rws.conn.writeHeaders(rws.stream, &writeResHeaders{ - streamID: rws.stream.id, - h: rws.handlerHeader, - trailers: rws.trailers, - endStream: true, - }) - return len(p), err - } - return len(p), nil -} - -// TrailerPrefix is a magic prefix for ResponseWriter.Header map keys -// that, if present, signals that the map entry is actually for -// the response trailers, and not the response headers. The prefix -// is stripped after the ServeHTTP call finishes and the values are -// sent in the trailers. -// -// This mechanism is intended only for trailers that are not known -// prior to the headers being written. If the set of trailers is fixed -// or known before the header is written, the normal Go trailers mechanism -// is preferred: -// https://golang.org/pkg/net/http/#ResponseWriter -// https://golang.org/pkg/net/http/#example_ResponseWriter_trailers -const TrailerPrefix = "Trailer:" - -// promoteUndeclaredTrailers permits http.Handlers to set trailers -// after the header has already been flushed. Because the Go -// ResponseWriter interface has no way to set Trailers (only the -// Header), and because we didn't want to expand the ResponseWriter -// interface, and because nobody used trailers, and because RFC 2616 -// says you SHOULD (but not must) predeclare any trailers in the -// header, the official ResponseWriter rules said trailers in Go must -// be predeclared, and then we reuse the same ResponseWriter.Header() -// map to mean both Headers and Trailers. When it's time to write the -// Trailers, we pick out the fields of Headers that were declared as -// trailers. That worked for a while, until we found the first major -// user of Trailers in the wild: gRPC (using them only over http2), -// and gRPC libraries permit setting trailers mid-stream without -// predeclarnig them. So: change of plans. We still permit the old -// way, but we also permit this hack: if a Header() key begins with -// "Trailer:", the suffix of that key is a Trailer. Because ':' is an -// invalid token byte anyway, there is no ambiguity. (And it's already -// filtered out) It's mildly hacky, but not terrible. -// -// This method runs after the Handler is done and promotes any Header -// fields to be trailers. -func (rws *responseWriterState) promoteUndeclaredTrailers() { - for k, vv := range rws.handlerHeader { - if !strings.HasPrefix(k, TrailerPrefix) { - continue - } - trailerKey := strings.TrimPrefix(k, TrailerPrefix) - rws.declareTrailer(trailerKey) - rws.handlerHeader[http.CanonicalHeaderKey(trailerKey)] = vv - } - sort.Strings(rws.trailers) -} - -func (w *responseWriter) Flush() { - rws := w.rws - if rws == nil { - panic("Header called after Handler finished") - } - if rws.bw.Buffered() > 0 { - if err := rws.bw.Flush(); err != nil { - // Ignore the error. The frame writer already knows. - return - } - } else { - // The bufio.Writer won't call chunkWriter.Write - // (writeChunk with zero bytes, so we have to do it - // ourselves to force the HTTP response header and/or - // final DATA frame (with END_STREAM) to be sent. - rws.writeChunk(nil) - } -} - -func (w *responseWriter) CloseNotify() <-chan bool { - rws := w.rws - if rws == nil { - panic("CloseNotify called after Handler finished") - } - rws.closeNotifierMu.Lock() - ch := rws.closeNotifierCh - if ch == nil { - ch = make(chan bool, 1) - rws.closeNotifierCh = ch - go func() { - rws.stream.cw.Wait() // wait for close - ch <- true - }() - } - rws.closeNotifierMu.Unlock() - return ch -} - -func (w *responseWriter) Header() http.Header { - rws := w.rws - if rws == nil { - panic("Header called after Handler finished") - } - if rws.handlerHeader == nil { - rws.handlerHeader = make(http.Header) - } - return rws.handlerHeader -} - -func (w *responseWriter) WriteHeader(code int) { - rws := w.rws - if rws == nil { - panic("WriteHeader called after Handler finished") - } - rws.writeHeader(code) -} - -func (rws *responseWriterState) writeHeader(code int) { - if !rws.wroteHeader { - rws.wroteHeader = true - rws.status = code - if len(rws.handlerHeader) > 0 { - rws.snapHeader = cloneHeader(rws.handlerHeader) - } - } -} - -func cloneHeader(h http.Header) http.Header { - h2 := make(http.Header, len(h)) - for k, vv := range h { - vv2 := make([]string, len(vv)) - copy(vv2, vv) - h2[k] = vv2 - } - return h2 -} - -// The Life Of A Write is like this: -// -// * Handler calls w.Write or w.WriteString -> -// * -> rws.bw (*bufio.Writer) -> -// * (Handler migth call Flush) -// * -> chunkWriter{rws} -// * -> responseWriterState.writeChunk(p []byte) -// * -> responseWriterState.writeChunk (most of the magic; see comment there) -func (w *responseWriter) Write(p []byte) (n int, err error) { - return w.write(len(p), p, "") -} - -func (w *responseWriter) WriteString(s string) (n int, err error) { - return w.write(len(s), nil, s) -} - -// either dataB or dataS is non-zero. -func (w *responseWriter) write(lenData int, dataB []byte, dataS string) (n int, err error) { - rws := w.rws - if rws == nil { - panic("Write called after Handler finished") - } - if !rws.wroteHeader { - w.WriteHeader(200) - } - if !bodyAllowedForStatus(rws.status) { - return 0, http.ErrBodyNotAllowed - } - rws.wroteBytes += int64(len(dataB)) + int64(len(dataS)) // only one can be set - if rws.sentContentLen != 0 && rws.wroteBytes > rws.sentContentLen { - // TODO: send a RST_STREAM - return 0, errors.New("http2: handler wrote more than declared Content-Length") - } - - if dataB != nil { - return rws.bw.Write(dataB) - } else { - return rws.bw.WriteString(dataS) - } -} - -func (w *responseWriter) handlerDone() { - rws := w.rws - rws.handlerDone = true - w.Flush() - w.rws = nil - responseWriterStatePool.Put(rws) -} - -// foreachHeaderElement splits v according to the "#rule" construction -// in RFC 2616 section 2.1 and calls fn for each non-empty element. -func foreachHeaderElement(v string, fn func(string)) { - v = textproto.TrimString(v) - if v == "" { - return - } - if !strings.Contains(v, ",") { - fn(v) - return - } - for _, f := range strings.Split(v, ",") { - if f = textproto.TrimString(f); f != "" { - fn(f) - } - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/transport.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/transport.go deleted file mode 100644 index 7fe267bb302..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/transport.go +++ /dev/null @@ -1,1666 +0,0 @@ -// Copyright 2015 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. - -// Transport code. - -package http2 - -import ( - "bufio" - "bytes" - "compress/gzip" - "crypto/tls" - "errors" - "fmt" - "io" - "io/ioutil" - "log" - "net" - "net/http" - "sort" - "strconv" - "strings" - "sync" - "time" - - "golang.org/x/net/http2/hpack" -) - -const ( - // transportDefaultConnFlow is how many connection-level flow control - // tokens we give the server at start-up, past the default 64k. - transportDefaultConnFlow = 1 << 30 - - // transportDefaultStreamFlow is how many stream-level flow - // control tokens we announce to the peer, and how many bytes - // we buffer per stream. - transportDefaultStreamFlow = 4 << 20 - - // transportDefaultStreamMinRefresh is the minimum number of bytes we'll send - // a stream-level WINDOW_UPDATE for at a time. - transportDefaultStreamMinRefresh = 4 << 10 - - defaultUserAgent = "Go-http-client/2.0" -) - -// Transport is an HTTP/2 Transport. -// -// A Transport internally caches connections to servers. It is safe -// for concurrent use by multiple goroutines. -type Transport struct { - // DialTLS specifies an optional dial function for creating - // TLS connections for requests. - // - // If DialTLS is nil, tls.Dial is used. - // - // If the returned net.Conn has a ConnectionState method like tls.Conn, - // it will be used to set http.Response.TLS. - DialTLS func(network, addr string, cfg *tls.Config) (net.Conn, error) - - // TLSClientConfig specifies the TLS configuration to use with - // tls.Client. If nil, the default configuration is used. - TLSClientConfig *tls.Config - - // ConnPool optionally specifies an alternate connection pool to use. - // If nil, the default is used. - ConnPool ClientConnPool - - // DisableCompression, if true, prevents the Transport from - // requesting compression with an "Accept-Encoding: gzip" - // request header when the Request contains no existing - // Accept-Encoding value. If the Transport requests gzip on - // its own and gets a gzipped response, it's transparently - // decoded in the Response.Body. However, if the user - // explicitly requested gzip it is not automatically - // uncompressed. - DisableCompression bool - - // MaxHeaderListSize is the http2 SETTINGS_MAX_HEADER_LIST_SIZE to - // send in the initial settings frame. It is how many bytes - // of response headers are allow. Unlike the http2 spec, zero here - // means to use a default limit (currently 10MB). If you actually - // want to advertise an ulimited value to the peer, Transport - // interprets the highest possible value here (0xffffffff or 1<<32-1) - // to mean no limit. - MaxHeaderListSize uint32 - - // t1, if non-nil, is the standard library Transport using - // this transport. Its settings are used (but not its - // RoundTrip method, etc). - t1 *http.Transport - - connPoolOnce sync.Once - connPoolOrDef ClientConnPool // non-nil version of ConnPool -} - -func (t *Transport) maxHeaderListSize() uint32 { - if t.MaxHeaderListSize == 0 { - return 10 << 20 - } - if t.MaxHeaderListSize == 0xffffffff { - return 0 - } - return t.MaxHeaderListSize -} - -func (t *Transport) disableCompression() bool { - return t.DisableCompression || (t.t1 != nil && t.t1.DisableCompression) -} - -var errTransportVersion = errors.New("http2: ConfigureTransport is only supported starting at Go 1.6") - -// ConfigureTransport configures a net/http HTTP/1 Transport to use HTTP/2. -// It requires Go 1.6 or later and returns an error if the net/http package is too old -// or if t1 has already been HTTP/2-enabled. -func ConfigureTransport(t1 *http.Transport) error { - _, err := configureTransport(t1) // in configure_transport.go (go1.6) or not_go16.go - return err -} - -func (t *Transport) connPool() ClientConnPool { - t.connPoolOnce.Do(t.initConnPool) - return t.connPoolOrDef -} - -func (t *Transport) initConnPool() { - if t.ConnPool != nil { - t.connPoolOrDef = t.ConnPool - } else { - t.connPoolOrDef = &clientConnPool{t: t} - } -} - -// ClientConn is the state of a single HTTP/2 client connection to an -// HTTP/2 server. -type ClientConn struct { - t *Transport - tconn net.Conn // usually *tls.Conn, except specialized impls - tlsState *tls.ConnectionState // nil only for specialized impls - - // readLoop goroutine fields: - readerDone chan struct{} // closed on error - readerErr error // set before readerDone is closed - - mu sync.Mutex // guards following - cond *sync.Cond // hold mu; broadcast on flow/closed changes - flow flow // our conn-level flow control quota (cs.flow is per stream) - inflow flow // peer's conn-level flow control - closed bool - goAway *GoAwayFrame // if non-nil, the GoAwayFrame we received - streams map[uint32]*clientStream // client-initiated - nextStreamID uint32 - bw *bufio.Writer - br *bufio.Reader - fr *Framer - // Settings from peer: - maxFrameSize uint32 - maxConcurrentStreams uint32 - initialWindowSize uint32 - hbuf bytes.Buffer // HPACK encoder writes into this - henc *hpack.Encoder - freeBuf [][]byte - - wmu sync.Mutex // held while writing; acquire AFTER mu if holding both - werr error // first write error that has occurred -} - -// clientStream is the state for a single HTTP/2 stream. One of these -// is created for each Transport.RoundTrip call. -type clientStream struct { - cc *ClientConn - req *http.Request - ID uint32 - resc chan resAndError - bufPipe pipe // buffered pipe with the flow-controlled response payload - requestedGzip bool - - flow flow // guarded by cc.mu - inflow flow // guarded by cc.mu - bytesRemain int64 // -1 means unknown; owned by transportResponseBody.Read - readErr error // sticky read error; owned by transportResponseBody.Read - stopReqBody error // if non-nil, stop writing req body; guarded by cc.mu - - peerReset chan struct{} // closed on peer reset - resetErr error // populated before peerReset is closed - - done chan struct{} // closed when stream remove from cc.streams map; close calls guarded by cc.mu - - // owned by clientConnReadLoop: - pastHeaders bool // got first MetaHeadersFrame (actual headers) - pastTrailers bool // got optional second MetaHeadersFrame (trailers) - - trailer http.Header // accumulated trailers - resTrailer *http.Header // client's Response.Trailer -} - -// awaitRequestCancel runs in its own goroutine and waits for the user -// to either cancel a RoundTrip request (using the provided -// Request.Cancel channel), or for the request to be done (any way it -// might be removed from the cc.streams map: peer reset, successful -// completion, TCP connection breakage, etc) -func (cs *clientStream) awaitRequestCancel(cancel <-chan struct{}) { - if cancel == nil { - return - } - select { - case <-cancel: - cs.bufPipe.CloseWithError(errRequestCanceled) - cs.cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) - case <-cs.done: - } -} - -// checkReset reports any error sent in a RST_STREAM frame by the -// server. -func (cs *clientStream) checkReset() error { - select { - case <-cs.peerReset: - return cs.resetErr - default: - return nil - } -} - -func (cs *clientStream) abortRequestBodyWrite(err error) { - if err == nil { - panic("nil error") - } - cc := cs.cc - cc.mu.Lock() - cs.stopReqBody = err - cc.cond.Broadcast() - cc.mu.Unlock() -} - -type stickyErrWriter struct { - w io.Writer - err *error -} - -func (sew stickyErrWriter) Write(p []byte) (n int, err error) { - if *sew.err != nil { - return 0, *sew.err - } - n, err = sew.w.Write(p) - *sew.err = err - return -} - -var ErrNoCachedConn = errors.New("http2: no cached connection was available") - -// RoundTripOpt are options for the Transport.RoundTripOpt method. -type RoundTripOpt struct { - // OnlyCachedConn controls whether RoundTripOpt may - // create a new TCP connection. If set true and - // no cached connection is available, RoundTripOpt - // will return ErrNoCachedConn. - OnlyCachedConn bool -} - -func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) { - return t.RoundTripOpt(req, RoundTripOpt{}) -} - -// authorityAddr returns a given authority (a host/IP, or host:port / ip:port) -// and returns a host:port. The port 443 is added if needed. -func authorityAddr(authority string) (addr string) { - if _, _, err := net.SplitHostPort(authority); err == nil { - return authority - } - return net.JoinHostPort(authority, "443") -} - -// RoundTripOpt is like RoundTrip, but takes options. -func (t *Transport) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Response, error) { - if req.URL.Scheme != "https" { - return nil, errors.New("http2: unsupported scheme") - } - - addr := authorityAddr(req.URL.Host) - for { - cc, err := t.connPool().GetClientConn(req, addr) - if err != nil { - t.vlogf("http2: Transport failed to get client conn for %s: %v", addr, err) - return nil, err - } - res, err := cc.RoundTrip(req) - if shouldRetryRequest(req, err) { - continue - } - if err != nil { - t.vlogf("RoundTrip failure: %v", err) - return nil, err - } - return res, nil - } -} - -// CloseIdleConnections closes any connections which were previously -// connected from previous requests but are now sitting idle. -// It does not interrupt any connections currently in use. -func (t *Transport) CloseIdleConnections() { - if cp, ok := t.connPool().(*clientConnPool); ok { - cp.closeIdleConnections() - } -} - -var ( - errClientConnClosed = errors.New("http2: client conn is closed") - errClientConnUnusable = errors.New("http2: client conn not usable") -) - -func shouldRetryRequest(req *http.Request, err error) bool { - // TODO: retry GET requests (no bodies) more aggressively, if shutdown - // before response. - return err == errClientConnUnusable -} - -func (t *Transport) dialClientConn(addr string) (*ClientConn, error) { - host, _, err := net.SplitHostPort(addr) - if err != nil { - return nil, err - } - tconn, err := t.dialTLS()("tcp", addr, t.newTLSConfig(host)) - if err != nil { - return nil, err - } - return t.NewClientConn(tconn) -} - -func (t *Transport) newTLSConfig(host string) *tls.Config { - cfg := new(tls.Config) - if t.TLSClientConfig != nil { - *cfg = *t.TLSClientConfig - } - if !strSliceContains(cfg.NextProtos, NextProtoTLS) { - cfg.NextProtos = append([]string{NextProtoTLS}, cfg.NextProtos...) - } - if cfg.ServerName == "" { - cfg.ServerName = host - } - return cfg -} - -func (t *Transport) dialTLS() func(string, string, *tls.Config) (net.Conn, error) { - if t.DialTLS != nil { - return t.DialTLS - } - return t.dialTLSDefault -} - -func (t *Transport) dialTLSDefault(network, addr string, cfg *tls.Config) (net.Conn, error) { - cn, err := tls.Dial(network, addr, cfg) - if err != nil { - return nil, err - } - if err := cn.Handshake(); err != nil { - return nil, err - } - if !cfg.InsecureSkipVerify { - if err := cn.VerifyHostname(cfg.ServerName); err != nil { - return nil, err - } - } - state := cn.ConnectionState() - if p := state.NegotiatedProtocol; p != NextProtoTLS { - return nil, fmt.Errorf("http2: unexpected ALPN protocol %q; want %q", p, NextProtoTLS) - } - if !state.NegotiatedProtocolIsMutual { - return nil, errors.New("http2: could not negotiate protocol mutually") - } - return cn, nil -} - -// disableKeepAlives reports whether connections should be closed as -// soon as possible after handling the first request. -func (t *Transport) disableKeepAlives() bool { - return t.t1 != nil && t.t1.DisableKeepAlives -} - -func (t *Transport) NewClientConn(c net.Conn) (*ClientConn, error) { - if VerboseLogs { - t.vlogf("http2: Transport creating client conn to %v", c.RemoteAddr()) - } - if _, err := c.Write(clientPreface); err != nil { - t.vlogf("client preface write error: %v", err) - return nil, err - } - - cc := &ClientConn{ - t: t, - tconn: c, - readerDone: make(chan struct{}), - nextStreamID: 1, - maxFrameSize: 16 << 10, // spec default - initialWindowSize: 65535, // spec default - maxConcurrentStreams: 1000, // "infinite", per spec. 1000 seems good enough. - streams: make(map[uint32]*clientStream), - } - cc.cond = sync.NewCond(&cc.mu) - cc.flow.add(int32(initialWindowSize)) - - // TODO: adjust this writer size to account for frame size + - // MTU + crypto/tls record padding. - cc.bw = bufio.NewWriter(stickyErrWriter{c, &cc.werr}) - cc.br = bufio.NewReader(c) - cc.fr = NewFramer(cc.bw, cc.br) - cc.fr.ReadMetaHeaders = hpack.NewDecoder(initialHeaderTableSize, nil) - cc.fr.MaxHeaderListSize = t.maxHeaderListSize() - - // TODO: SetMaxDynamicTableSize, SetMaxDynamicTableSizeLimit on - // henc in response to SETTINGS frames? - cc.henc = hpack.NewEncoder(&cc.hbuf) - - if cs, ok := c.(connectionStater); ok { - state := cs.ConnectionState() - cc.tlsState = &state - } - - initialSettings := []Setting{ - Setting{ID: SettingEnablePush, Val: 0}, - Setting{ID: SettingInitialWindowSize, Val: transportDefaultStreamFlow}, - } - if max := t.maxHeaderListSize(); max != 0 { - initialSettings = append(initialSettings, Setting{ID: SettingMaxHeaderListSize, Val: max}) - } - cc.fr.WriteSettings(initialSettings...) - cc.fr.WriteWindowUpdate(0, transportDefaultConnFlow) - cc.inflow.add(transportDefaultConnFlow + initialWindowSize) - cc.bw.Flush() - if cc.werr != nil { - return nil, cc.werr - } - - // Read the obligatory SETTINGS frame - f, err := cc.fr.ReadFrame() - if err != nil { - return nil, err - } - sf, ok := f.(*SettingsFrame) - if !ok { - return nil, fmt.Errorf("expected settings frame, got: %T", f) - } - cc.fr.WriteSettingsAck() - cc.bw.Flush() - - sf.ForeachSetting(func(s Setting) error { - switch s.ID { - case SettingMaxFrameSize: - cc.maxFrameSize = s.Val - case SettingMaxConcurrentStreams: - cc.maxConcurrentStreams = s.Val - case SettingInitialWindowSize: - cc.initialWindowSize = s.Val - default: - // TODO(bradfitz): handle more; at least SETTINGS_HEADER_TABLE_SIZE? - t.vlogf("Unhandled Setting: %v", s) - } - return nil - }) - - go cc.readLoop() - return cc, nil -} - -func (cc *ClientConn) setGoAway(f *GoAwayFrame) { - cc.mu.Lock() - defer cc.mu.Unlock() - cc.goAway = f -} - -func (cc *ClientConn) CanTakeNewRequest() bool { - cc.mu.Lock() - defer cc.mu.Unlock() - return cc.canTakeNewRequestLocked() -} - -func (cc *ClientConn) canTakeNewRequestLocked() bool { - return cc.goAway == nil && !cc.closed && - int64(len(cc.streams)+1) < int64(cc.maxConcurrentStreams) && - cc.nextStreamID < 2147483647 -} - -func (cc *ClientConn) closeIfIdle() { - cc.mu.Lock() - if len(cc.streams) > 0 { - cc.mu.Unlock() - return - } - cc.closed = true - // TODO: do clients send GOAWAY too? maybe? Just Close: - cc.mu.Unlock() - - cc.tconn.Close() -} - -const maxAllocFrameSize = 512 << 10 - -// frameBuffer returns a scratch buffer suitable for writing DATA frames. -// They're capped at the min of the peer's max frame size or 512KB -// (kinda arbitrarily), but definitely capped so we don't allocate 4GB -// bufers. -func (cc *ClientConn) frameScratchBuffer() []byte { - cc.mu.Lock() - size := cc.maxFrameSize - if size > maxAllocFrameSize { - size = maxAllocFrameSize - } - for i, buf := range cc.freeBuf { - if len(buf) >= int(size) { - cc.freeBuf[i] = nil - cc.mu.Unlock() - return buf[:size] - } - } - cc.mu.Unlock() - return make([]byte, size) -} - -func (cc *ClientConn) putFrameScratchBuffer(buf []byte) { - cc.mu.Lock() - defer cc.mu.Unlock() - const maxBufs = 4 // arbitrary; 4 concurrent requests per conn? investigate. - if len(cc.freeBuf) < maxBufs { - cc.freeBuf = append(cc.freeBuf, buf) - return - } - for i, old := range cc.freeBuf { - if old == nil { - cc.freeBuf[i] = buf - return - } - } - // forget about it. -} - -// errRequestCanceled is a copy of net/http's errRequestCanceled because it's not -// exported. At least they'll be DeepEqual for h1-vs-h2 comparisons tests. -var errRequestCanceled = errors.New("net/http: request canceled") - -func commaSeparatedTrailers(req *http.Request) (string, error) { - keys := make([]string, 0, len(req.Trailer)) - for k := range req.Trailer { - k = http.CanonicalHeaderKey(k) - switch k { - case "Transfer-Encoding", "Trailer", "Content-Length": - return "", &badStringError{"invalid Trailer key", k} - } - keys = append(keys, k) - } - if len(keys) > 0 { - sort.Strings(keys) - // TODO: could do better allocation-wise here, but trailers are rare, - // so being lazy for now. - return strings.Join(keys, ","), nil - } - return "", nil -} - -func (cc *ClientConn) responseHeaderTimeout() time.Duration { - if cc.t.t1 != nil { - return cc.t.t1.ResponseHeaderTimeout - } - // No way to do this (yet?) with just an http2.Transport. Probably - // no need. Request.Cancel this is the new way. We only need to support - // this for compatibility with the old http.Transport fields when - // we're doing transparent http2. - return 0 -} - -// checkConnHeaders checks whether req has any invalid connection-level headers. -// per RFC 7540 section 8.1.2.2: Connection-Specific Header Fields. -// Certain headers are special-cased as okay but not transmitted later. -func checkConnHeaders(req *http.Request) error { - if v := req.Header.Get("Upgrade"); v != "" { - return errors.New("http2: invalid Upgrade request header") - } - if v := req.Header.Get("Transfer-Encoding"); (v != "" && v != "chunked") || len(req.Header["Transfer-Encoding"]) > 1 { - return errors.New("http2: invalid Transfer-Encoding request header") - } - if v := req.Header.Get("Connection"); (v != "" && v != "close" && v != "keep-alive") || len(req.Header["Connection"]) > 1 { - return errors.New("http2: invalid Connection request header") - } - return nil -} - -func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) { - if err := checkConnHeaders(req); err != nil { - return nil, err - } - - trailers, err := commaSeparatedTrailers(req) - if err != nil { - return nil, err - } - hasTrailers := trailers != "" - - var body io.Reader = req.Body - contentLen := req.ContentLength - if req.Body != nil && contentLen == 0 { - // Test to see if it's actually zero or just unset. - var buf [1]byte - n, rerr := io.ReadFull(body, buf[:]) - if rerr != nil && rerr != io.EOF { - contentLen = -1 - body = errorReader{rerr} - } else if n == 1 { - // Oh, guess there is data in this Body Reader after all. - // The ContentLength field just wasn't set. - // Stich the Body back together again, re-attaching our - // consumed byte. - contentLen = -1 - body = io.MultiReader(bytes.NewReader(buf[:]), body) - } else { - // Body is actually empty. - body = nil - } - } - - cc.mu.Lock() - if cc.closed || !cc.canTakeNewRequestLocked() { - cc.mu.Unlock() - return nil, errClientConnUnusable - } - - cs := cc.newStream() - cs.req = req - hasBody := body != nil - - // TODO(bradfitz): this is a copy of the logic in net/http. Unify somewhere? - if !cc.t.disableCompression() && - req.Header.Get("Accept-Encoding") == "" && - req.Header.Get("Range") == "" && - req.Method != "HEAD" { - // Request gzip only, not deflate. Deflate is ambiguous and - // not as universally supported anyway. - // See: http://www.gzip.org/zlib/zlib_faq.html#faq38 - // - // Note that we don't request this for HEAD requests, - // due to a bug in nginx: - // http://trac.nginx.org/nginx/ticket/358 - // https://golang.org/issue/5522 - // - // We don't request gzip if the request is for a range, since - // auto-decoding a portion of a gzipped document will just fail - // anyway. See https://golang.org/issue/8923 - cs.requestedGzip = true - } - - // we send: HEADERS{1}, CONTINUATION{0,} + DATA{0,} (DATA is - // sent by writeRequestBody below, along with any Trailers, - // again in form HEADERS{1}, CONTINUATION{0,}) - hdrs := cc.encodeHeaders(req, cs.requestedGzip, trailers, contentLen) - cc.wmu.Lock() - endStream := !hasBody && !hasTrailers - werr := cc.writeHeaders(cs.ID, endStream, hdrs) - cc.wmu.Unlock() - cc.mu.Unlock() - - if werr != nil { - if hasBody { - req.Body.Close() // per RoundTripper contract - } - cc.forgetStreamID(cs.ID) - // Don't bother sending a RST_STREAM (our write already failed; - // no need to keep writing) - return nil, werr - } - - var respHeaderTimer <-chan time.Time - var bodyCopyErrc chan error // result of body copy - if hasBody { - bodyCopyErrc = make(chan error, 1) - go func() { - bodyCopyErrc <- cs.writeRequestBody(body, req.Body) - }() - } else { - if d := cc.responseHeaderTimeout(); d != 0 { - timer := time.NewTimer(d) - defer timer.Stop() - respHeaderTimer = timer.C - } - } - - readLoopResCh := cs.resc - requestCanceledCh := requestCancel(req) - bodyWritten := false - - for { - select { - case re := <-readLoopResCh: - res := re.res - if re.err != nil || res.StatusCode > 299 { - // On error or status code 3xx, 4xx, 5xx, etc abort any - // ongoing write, assuming that the server doesn't care - // about our request body. If the server replied with 1xx or - // 2xx, however, then assume the server DOES potentially - // want our body (e.g. full-duplex streaming: - // golang.org/issue/13444). If it turns out the server - // doesn't, they'll RST_STREAM us soon enough. This is a - // heuristic to avoid adding knobs to Transport. Hopefully - // we can keep it. - cs.abortRequestBodyWrite(errStopReqBodyWrite) - } - if re.err != nil { - cc.forgetStreamID(cs.ID) - return nil, re.err - } - res.Request = req - res.TLS = cc.tlsState - return res, nil - case <-respHeaderTimer: - cc.forgetStreamID(cs.ID) - if !hasBody || bodyWritten { - cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) - } else { - cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel) - } - return nil, errTimeout - case <-requestCanceledCh: - cc.forgetStreamID(cs.ID) - if !hasBody || bodyWritten { - cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) - } else { - cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel) - } - return nil, errRequestCanceled - case <-cs.peerReset: - // processResetStream already removed the - // stream from the streams map; no need for - // forgetStreamID. - return nil, cs.resetErr - case err := <-bodyCopyErrc: - if err != nil { - return nil, err - } - bodyWritten = true - if d := cc.responseHeaderTimeout(); d != 0 { - timer := time.NewTimer(d) - defer timer.Stop() - respHeaderTimer = timer.C - } - } - } -} - -// requires cc.wmu be held -func (cc *ClientConn) writeHeaders(streamID uint32, endStream bool, hdrs []byte) error { - first := true // first frame written (HEADERS is first, then CONTINUATION) - frameSize := int(cc.maxFrameSize) - for len(hdrs) > 0 && cc.werr == nil { - chunk := hdrs - if len(chunk) > frameSize { - chunk = chunk[:frameSize] - } - hdrs = hdrs[len(chunk):] - endHeaders := len(hdrs) == 0 - if first { - cc.fr.WriteHeaders(HeadersFrameParam{ - StreamID: streamID, - BlockFragment: chunk, - EndStream: endStream, - EndHeaders: endHeaders, - }) - first = false - } else { - cc.fr.WriteContinuation(streamID, endHeaders, chunk) - } - } - // TODO(bradfitz): this Flush could potentially block (as - // could the WriteHeaders call(s) above), which means they - // wouldn't respond to Request.Cancel being readable. That's - // rare, but this should probably be in a goroutine. - cc.bw.Flush() - return cc.werr -} - -// internal error values; they don't escape to callers -var ( - // abort request body write; don't send cancel - errStopReqBodyWrite = errors.New("http2: aborting request body write") - - // abort request body write, but send stream reset of cancel. - errStopReqBodyWriteAndCancel = errors.New("http2: canceling request") -) - -func (cs *clientStream) writeRequestBody(body io.Reader, bodyCloser io.Closer) (err error) { - cc := cs.cc - sentEnd := false // whether we sent the final DATA frame w/ END_STREAM - buf := cc.frameScratchBuffer() - defer cc.putFrameScratchBuffer(buf) - - defer func() { - // TODO: write h12Compare test showing whether - // Request.Body is closed by the Transport, - // and in multiple cases: server replies <=299 and >299 - // while still writing request body - cerr := bodyCloser.Close() - if err == nil { - err = cerr - } - }() - - req := cs.req - hasTrailers := req.Trailer != nil - - var sawEOF bool - for !sawEOF { - n, err := body.Read(buf) - if err == io.EOF { - sawEOF = true - err = nil - } else if err != nil { - return err - } - - remain := buf[:n] - for len(remain) > 0 && err == nil { - var allowed int32 - allowed, err = cs.awaitFlowControl(len(remain)) - switch { - case err == errStopReqBodyWrite: - return err - case err == errStopReqBodyWriteAndCancel: - cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) - return err - case err != nil: - return err - } - cc.wmu.Lock() - data := remain[:allowed] - remain = remain[allowed:] - sentEnd = sawEOF && len(remain) == 0 && !hasTrailers - err = cc.fr.WriteData(cs.ID, sentEnd, data) - if err == nil { - // TODO(bradfitz): this flush is for latency, not bandwidth. - // Most requests won't need this. Make this opt-in or opt-out? - // Use some heuristic on the body type? Nagel-like timers? - // Based on 'n'? Only last chunk of this for loop, unless flow control - // tokens are low? For now, always: - err = cc.bw.Flush() - } - cc.wmu.Unlock() - } - if err != nil { - return err - } - } - - cc.wmu.Lock() - if !sentEnd { - var trls []byte - if hasTrailers { - cc.mu.Lock() - trls = cc.encodeTrailers(req) - cc.mu.Unlock() - } - - // Avoid forgetting to send an END_STREAM if the encoded - // trailers are 0 bytes. Both results produce and END_STREAM. - if len(trls) > 0 { - err = cc.writeHeaders(cs.ID, true, trls) - } else { - err = cc.fr.WriteData(cs.ID, true, nil) - } - } - if ferr := cc.bw.Flush(); ferr != nil && err == nil { - err = ferr - } - cc.wmu.Unlock() - - return err -} - -// awaitFlowControl waits for [1, min(maxBytes, cc.cs.maxFrameSize)] flow -// control tokens from the server. -// It returns either the non-zero number of tokens taken or an error -// if the stream is dead. -func (cs *clientStream) awaitFlowControl(maxBytes int) (taken int32, err error) { - cc := cs.cc - cc.mu.Lock() - defer cc.mu.Unlock() - for { - if cc.closed { - return 0, errClientConnClosed - } - if cs.stopReqBody != nil { - return 0, cs.stopReqBody - } - if err := cs.checkReset(); err != nil { - return 0, err - } - if a := cs.flow.available(); a > 0 { - take := a - if int(take) > maxBytes { - - take = int32(maxBytes) // can't truncate int; take is int32 - } - if take > int32(cc.maxFrameSize) { - take = int32(cc.maxFrameSize) - } - cs.flow.take(take) - return take, nil - } - cc.cond.Wait() - } -} - -type badStringError struct { - what string - str string -} - -func (e *badStringError) Error() string { return fmt.Sprintf("%s %q", e.what, e.str) } - -// requires cc.mu be held. -func (cc *ClientConn) encodeHeaders(req *http.Request, addGzipHeader bool, trailers string, contentLength int64) []byte { - cc.hbuf.Reset() - - host := req.Host - if host == "" { - host = req.URL.Host - } - - // 8.1.2.3 Request Pseudo-Header Fields - // The :path pseudo-header field includes the path and query parts of the - // target URI (the path-absolute production and optionally a '?' character - // followed by the query production (see Sections 3.3 and 3.4 of - // [RFC3986]). - cc.writeHeader(":authority", host) - cc.writeHeader(":method", req.Method) - if req.Method != "CONNECT" { - cc.writeHeader(":path", req.URL.RequestURI()) - cc.writeHeader(":scheme", "https") - } - if trailers != "" { - cc.writeHeader("trailer", trailers) - } - - var didUA bool - for k, vv := range req.Header { - lowKey := strings.ToLower(k) - switch lowKey { - case "host", "content-length": - // Host is :authority, already sent. - // Content-Length is automatic, set below. - continue - case "connection", "proxy-connection", "transfer-encoding", "upgrade": - // Per 8.1.2.2 Connection-Specific Header - // Fields, don't send connection-specific - // fields. We deal with these earlier in - // RoundTrip, deciding whether they're - // error-worthy, but we don't want to mutate - // the user's *Request so at this point, just - // skip over them at this point. - continue - case "user-agent": - // Match Go's http1 behavior: at most one - // User-Agent. If set to nil or empty string, - // then omit it. Otherwise if not mentioned, - // include the default (below). - didUA = true - if len(vv) < 1 { - continue - } - vv = vv[:1] - if vv[0] == "" { - continue - } - } - for _, v := range vv { - cc.writeHeader(lowKey, v) - } - } - if shouldSendReqContentLength(req.Method, contentLength) { - cc.writeHeader("content-length", strconv.FormatInt(contentLength, 10)) - } - if addGzipHeader { - cc.writeHeader("accept-encoding", "gzip") - } - if !didUA { - cc.writeHeader("user-agent", defaultUserAgent) - } - return cc.hbuf.Bytes() -} - -// shouldSendReqContentLength reports whether the http2.Transport should send -// a "content-length" request header. This logic is basically a copy of the net/http -// transferWriter.shouldSendContentLength. -// The contentLength is the corrected contentLength (so 0 means actually 0, not unknown). -// -1 means unknown. -func shouldSendReqContentLength(method string, contentLength int64) bool { - if contentLength > 0 { - return true - } - if contentLength < 0 { - return false - } - // For zero bodies, whether we send a content-length depends on the method. - // It also kinda doesn't matter for http2 either way, with END_STREAM. - switch method { - case "POST", "PUT", "PATCH": - return true - default: - return false - } -} - -// requires cc.mu be held. -func (cc *ClientConn) encodeTrailers(req *http.Request) []byte { - cc.hbuf.Reset() - for k, vv := range req.Trailer { - // Transfer-Encoding, etc.. have already been filter at the - // start of RoundTrip - lowKey := strings.ToLower(k) - for _, v := range vv { - cc.writeHeader(lowKey, v) - } - } - return cc.hbuf.Bytes() -} - -func (cc *ClientConn) writeHeader(name, value string) { - if VerboseLogs { - log.Printf("http2: Transport encoding header %q = %q", name, value) - } - cc.henc.WriteField(hpack.HeaderField{Name: name, Value: value}) -} - -type resAndError struct { - res *http.Response - err error -} - -// requires cc.mu be held. -func (cc *ClientConn) newStream() *clientStream { - cs := &clientStream{ - cc: cc, - ID: cc.nextStreamID, - resc: make(chan resAndError, 1), - peerReset: make(chan struct{}), - done: make(chan struct{}), - } - cs.flow.add(int32(cc.initialWindowSize)) - cs.flow.setConnFlow(&cc.flow) - cs.inflow.add(transportDefaultStreamFlow) - cs.inflow.setConnFlow(&cc.inflow) - cc.nextStreamID += 2 - cc.streams[cs.ID] = cs - return cs -} - -func (cc *ClientConn) forgetStreamID(id uint32) { - cc.streamByID(id, true) -} - -func (cc *ClientConn) streamByID(id uint32, andRemove bool) *clientStream { - cc.mu.Lock() - defer cc.mu.Unlock() - cs := cc.streams[id] - if andRemove && cs != nil && !cc.closed { - delete(cc.streams, id) - close(cs.done) - } - return cs -} - -// clientConnReadLoop is the state owned by the clientConn's frame-reading readLoop. -type clientConnReadLoop struct { - cc *ClientConn - activeRes map[uint32]*clientStream // keyed by streamID - closeWhenIdle bool -} - -// readLoop runs in its own goroutine and reads and dispatches frames. -func (cc *ClientConn) readLoop() { - rl := &clientConnReadLoop{ - cc: cc, - activeRes: make(map[uint32]*clientStream), - } - - defer rl.cleanup() - cc.readerErr = rl.run() - if ce, ok := cc.readerErr.(ConnectionError); ok { - cc.wmu.Lock() - cc.fr.WriteGoAway(0, ErrCode(ce), nil) - cc.wmu.Unlock() - } -} - -func (rl *clientConnReadLoop) cleanup() { - cc := rl.cc - defer cc.tconn.Close() - defer cc.t.connPool().MarkDead(cc) - defer close(cc.readerDone) - - // Close any response bodies if the server closes prematurely. - // TODO: also do this if we've written the headers but not - // gotten a response yet. - err := cc.readerErr - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - cc.mu.Lock() - for _, cs := range rl.activeRes { - cs.bufPipe.CloseWithError(err) - } - for _, cs := range cc.streams { - select { - case cs.resc <- resAndError{err: err}: - default: - } - close(cs.done) - } - cc.closed = true - cc.cond.Broadcast() - cc.mu.Unlock() -} - -func (rl *clientConnReadLoop) run() error { - cc := rl.cc - rl.closeWhenIdle = cc.t.disableKeepAlives() - gotReply := false // ever saw a reply - for { - f, err := cc.fr.ReadFrame() - if err != nil { - cc.vlogf("Transport readFrame error: (%T) %v", err, err) - } - if se, ok := err.(StreamError); ok { - if cs := cc.streamByID(se.StreamID, true /*ended; remove it*/); cs != nil { - rl.endStreamError(cs, cc.fr.errDetail) - } - continue - } else if err != nil { - return err - } - if VerboseLogs { - cc.vlogf("http2: Transport received %s", summarizeFrame(f)) - } - maybeIdle := false // whether frame might transition us to idle - - switch f := f.(type) { - case *MetaHeadersFrame: - err = rl.processHeaders(f) - maybeIdle = true - gotReply = true - case *DataFrame: - err = rl.processData(f) - maybeIdle = true - case *GoAwayFrame: - err = rl.processGoAway(f) - maybeIdle = true - case *RSTStreamFrame: - err = rl.processResetStream(f) - maybeIdle = true - case *SettingsFrame: - err = rl.processSettings(f) - case *PushPromiseFrame: - err = rl.processPushPromise(f) - case *WindowUpdateFrame: - err = rl.processWindowUpdate(f) - case *PingFrame: - err = rl.processPing(f) - default: - cc.logf("Transport: unhandled response frame type %T", f) - } - if err != nil { - return err - } - if rl.closeWhenIdle && gotReply && maybeIdle && len(rl.activeRes) == 0 { - cc.closeIfIdle() - } - } -} - -func (rl *clientConnReadLoop) processHeaders(f *MetaHeadersFrame) error { - cc := rl.cc - cs := cc.streamByID(f.StreamID, f.StreamEnded()) - if cs == nil { - // We'd get here if we canceled a request while the - // server had its response still in flight. So if this - // was just something we canceled, ignore it. - return nil - } - if !cs.pastHeaders { - cs.pastHeaders = true - } else { - return rl.processTrailers(cs, f) - } - - res, err := rl.handleResponse(cs, f) - if err != nil { - if _, ok := err.(ConnectionError); ok { - return err - } - // Any other error type is a stream error. - cs.cc.writeStreamReset(f.StreamID, ErrCodeProtocol, err) - cs.resc <- resAndError{err: err} - return nil // return nil from process* funcs to keep conn alive - } - if res == nil { - // (nil, nil) special case. See handleResponse docs. - return nil - } - if res.Body != noBody { - rl.activeRes[cs.ID] = cs - } - cs.resTrailer = &res.Trailer - cs.resc <- resAndError{res: res} - return nil -} - -// may return error types nil, or ConnectionError. Any other error value -// is a StreamError of type ErrCodeProtocol. The returned error in that case -// is the detail. -// -// As a special case, handleResponse may return (nil, nil) to skip the -// frame (currently only used for 100 expect continue). This special -// case is going away after Issue 13851 is fixed. -func (rl *clientConnReadLoop) handleResponse(cs *clientStream, f *MetaHeadersFrame) (*http.Response, error) { - if f.Truncated { - return nil, errResponseHeaderListSize - } - - status := f.PseudoValue("status") - if status == "" { - return nil, errors.New("missing status pseudo header") - } - statusCode, err := strconv.Atoi(status) - if err != nil { - return nil, errors.New("malformed non-numeric status pseudo header") - } - - if statusCode == 100 { - // Just skip 100-continue response headers for now. - // TODO: golang.org/issue/13851 for doing it properly. - cs.pastHeaders = false // do it all again - return nil, nil - } - - header := make(http.Header) - res := &http.Response{ - Proto: "HTTP/2.0", - ProtoMajor: 2, - Header: header, - StatusCode: statusCode, - Status: status + " " + http.StatusText(statusCode), - } - for _, hf := range f.RegularFields() { - key := http.CanonicalHeaderKey(hf.Name) - if key == "Trailer" { - t := res.Trailer - if t == nil { - t = make(http.Header) - res.Trailer = t - } - foreachHeaderElement(hf.Value, func(v string) { - t[http.CanonicalHeaderKey(v)] = nil - }) - } else { - header[key] = append(header[key], hf.Value) - } - } - - streamEnded := f.StreamEnded() - if !streamEnded || cs.req.Method == "HEAD" { - res.ContentLength = -1 - if clens := res.Header["Content-Length"]; len(clens) == 1 { - if clen64, err := strconv.ParseInt(clens[0], 10, 64); err == nil { - res.ContentLength = clen64 - } else { - // TODO: care? unlike http/1, it won't mess up our framing, so it's - // more safe smuggling-wise to ignore. - } - } else if len(clens) > 1 { - // TODO: care? unlike http/1, it won't mess up our framing, so it's - // more safe smuggling-wise to ignore. - } - } - - if streamEnded { - res.Body = noBody - return res, nil - } - - buf := new(bytes.Buffer) // TODO(bradfitz): recycle this garbage - cs.bufPipe = pipe{b: buf} - cs.bytesRemain = res.ContentLength - res.Body = transportResponseBody{cs} - go cs.awaitRequestCancel(requestCancel(cs.req)) - - if cs.requestedGzip && res.Header.Get("Content-Encoding") == "gzip" { - res.Header.Del("Content-Encoding") - res.Header.Del("Content-Length") - res.ContentLength = -1 - res.Body = &gzipReader{body: res.Body} - } - return res, nil -} - -func (rl *clientConnReadLoop) processTrailers(cs *clientStream, f *MetaHeadersFrame) error { - if cs.pastTrailers { - // Too many HEADERS frames for this stream. - return ConnectionError(ErrCodeProtocol) - } - cs.pastTrailers = true - if !f.StreamEnded() { - // We expect that any headers for trailers also - // has END_STREAM. - return ConnectionError(ErrCodeProtocol) - } - if len(f.PseudoFields()) > 0 { - // No pseudo header fields are defined for trailers. - // TODO: ConnectionError might be overly harsh? Check. - return ConnectionError(ErrCodeProtocol) - } - - trailer := make(http.Header) - for _, hf := range f.RegularFields() { - key := http.CanonicalHeaderKey(hf.Name) - trailer[key] = append(trailer[key], hf.Value) - } - cs.trailer = trailer - - rl.endStream(cs) - return nil -} - -// transportResponseBody is the concrete type of Transport.RoundTrip's -// Response.Body. It is an io.ReadCloser. On Read, it reads from cs.body. -// On Close it sends RST_STREAM if EOF wasn't already seen. -type transportResponseBody struct { - cs *clientStream -} - -func (b transportResponseBody) Read(p []byte) (n int, err error) { - cs := b.cs - cc := cs.cc - - if cs.readErr != nil { - return 0, cs.readErr - } - n, err = b.cs.bufPipe.Read(p) - if cs.bytesRemain != -1 { - if int64(n) > cs.bytesRemain { - n = int(cs.bytesRemain) - if err == nil { - err = errors.New("net/http: server replied with more than declared Content-Length; truncated") - cc.writeStreamReset(cs.ID, ErrCodeProtocol, err) - } - cs.readErr = err - return int(cs.bytesRemain), err - } - cs.bytesRemain -= int64(n) - if err == io.EOF && cs.bytesRemain > 0 { - err = io.ErrUnexpectedEOF - cs.readErr = err - return n, err - } - } - if n == 0 { - // No flow control tokens to send back. - return - } - - cc.mu.Lock() - defer cc.mu.Unlock() - - var connAdd, streamAdd int32 - // Check the conn-level first, before the stream-level. - if v := cc.inflow.available(); v < transportDefaultConnFlow/2 { - connAdd = transportDefaultConnFlow - v - cc.inflow.add(connAdd) - } - if err == nil { // No need to refresh if the stream is over or failed. - if v := cs.inflow.available(); v < transportDefaultStreamFlow-transportDefaultStreamMinRefresh { - streamAdd = transportDefaultStreamFlow - v - cs.inflow.add(streamAdd) - } - } - if connAdd != 0 || streamAdd != 0 { - cc.wmu.Lock() - defer cc.wmu.Unlock() - if connAdd != 0 { - cc.fr.WriteWindowUpdate(0, mustUint31(connAdd)) - } - if streamAdd != 0 { - cc.fr.WriteWindowUpdate(cs.ID, mustUint31(streamAdd)) - } - cc.bw.Flush() - } - return -} - -var errClosedResponseBody = errors.New("http2: response body closed") - -func (b transportResponseBody) Close() error { - cs := b.cs - if cs.bufPipe.Err() != io.EOF { - // TODO: write test for this - cs.cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) - } - cs.bufPipe.BreakWithError(errClosedResponseBody) - return nil -} - -func (rl *clientConnReadLoop) processData(f *DataFrame) error { - cc := rl.cc - cs := cc.streamByID(f.StreamID, f.StreamEnded()) - if cs == nil { - cc.mu.Lock() - neverSent := cc.nextStreamID - cc.mu.Unlock() - if f.StreamID >= neverSent { - // We never asked for this. - cc.logf("http2: Transport received unsolicited DATA frame; closing connection") - return ConnectionError(ErrCodeProtocol) - } - // We probably did ask for this, but canceled. Just ignore it. - // TODO: be stricter here? only silently ignore things which - // we canceled, but not things which were closed normally - // by the peer? Tough without accumulating too much state. - return nil - } - if data := f.Data(); len(data) > 0 { - if cs.bufPipe.b == nil { - // Data frame after it's already closed? - cc.logf("http2: Transport received DATA frame for closed stream; closing connection") - return ConnectionError(ErrCodeProtocol) - } - - // Check connection-level flow control. - cc.mu.Lock() - if cs.inflow.available() >= int32(len(data)) { - cs.inflow.take(int32(len(data))) - } else { - cc.mu.Unlock() - return ConnectionError(ErrCodeFlowControl) - } - cc.mu.Unlock() - - if _, err := cs.bufPipe.Write(data); err != nil { - rl.endStreamError(cs, err) - return err - } - } - - if f.StreamEnded() { - rl.endStream(cs) - } - return nil -} - -var errInvalidTrailers = errors.New("http2: invalid trailers") - -func (rl *clientConnReadLoop) endStream(cs *clientStream) { - // TODO: check that any declared content-length matches, like - // server.go's (*stream).endStream method. - rl.endStreamError(cs, nil) -} - -func (rl *clientConnReadLoop) endStreamError(cs *clientStream, err error) { - var code func() - if err == nil { - err = io.EOF - code = cs.copyTrailers - } - cs.bufPipe.closeWithErrorAndCode(err, code) - delete(rl.activeRes, cs.ID) - if cs.req.Close || cs.req.Header.Get("Connection") == "close" { - rl.closeWhenIdle = true - } -} - -func (cs *clientStream) copyTrailers() { - for k, vv := range cs.trailer { - t := cs.resTrailer - if *t == nil { - *t = make(http.Header) - } - (*t)[k] = vv - } -} - -func (rl *clientConnReadLoop) processGoAway(f *GoAwayFrame) error { - cc := rl.cc - cc.t.connPool().MarkDead(cc) - if f.ErrCode != 0 { - // TODO: deal with GOAWAY more. particularly the error code - cc.vlogf("transport got GOAWAY with error code = %v", f.ErrCode) - } - cc.setGoAway(f) - return nil -} - -func (rl *clientConnReadLoop) processSettings(f *SettingsFrame) error { - cc := rl.cc - cc.mu.Lock() - defer cc.mu.Unlock() - return f.ForeachSetting(func(s Setting) error { - switch s.ID { - case SettingMaxFrameSize: - cc.maxFrameSize = s.Val - case SettingMaxConcurrentStreams: - cc.maxConcurrentStreams = s.Val - case SettingInitialWindowSize: - // TODO: error if this is too large. - - // TODO: adjust flow control of still-open - // frames by the difference of the old initial - // window size and this one. - cc.initialWindowSize = s.Val - default: - // TODO(bradfitz): handle more settings? SETTINGS_HEADER_TABLE_SIZE probably. - cc.vlogf("Unhandled Setting: %v", s) - } - return nil - }) -} - -func (rl *clientConnReadLoop) processWindowUpdate(f *WindowUpdateFrame) error { - cc := rl.cc - cs := cc.streamByID(f.StreamID, false) - if f.StreamID != 0 && cs == nil { - return nil - } - - cc.mu.Lock() - defer cc.mu.Unlock() - - fl := &cc.flow - if cs != nil { - fl = &cs.flow - } - if !fl.add(int32(f.Increment)) { - return ConnectionError(ErrCodeFlowControl) - } - cc.cond.Broadcast() - return nil -} - -func (rl *clientConnReadLoop) processResetStream(f *RSTStreamFrame) error { - cs := rl.cc.streamByID(f.StreamID, true) - if cs == nil { - // TODO: return error if server tries to RST_STEAM an idle stream - return nil - } - select { - case <-cs.peerReset: - // Already reset. - // This is the only goroutine - // which closes this, so there - // isn't a race. - default: - err := StreamError{cs.ID, f.ErrCode} - cs.resetErr = err - close(cs.peerReset) - cs.bufPipe.CloseWithError(err) - cs.cc.cond.Broadcast() // wake up checkReset via clientStream.awaitFlowControl - } - delete(rl.activeRes, cs.ID) - return nil -} - -func (rl *clientConnReadLoop) processPing(f *PingFrame) error { - if f.IsAck() { - // 6.7 PING: " An endpoint MUST NOT respond to PING frames - // containing this flag." - return nil - } - cc := rl.cc - cc.wmu.Lock() - defer cc.wmu.Unlock() - if err := cc.fr.WritePing(true, f.Data); err != nil { - return err - } - return cc.bw.Flush() -} - -func (rl *clientConnReadLoop) processPushPromise(f *PushPromiseFrame) error { - // We told the peer we don't want them. - // Spec says: - // "PUSH_PROMISE MUST NOT be sent if the SETTINGS_ENABLE_PUSH - // setting of the peer endpoint is set to 0. An endpoint that - // has set this setting and has received acknowledgement MUST - // treat the receipt of a PUSH_PROMISE frame as a connection - // error (Section 5.4.1) of type PROTOCOL_ERROR." - return ConnectionError(ErrCodeProtocol) -} - -func (cc *ClientConn) writeStreamReset(streamID uint32, code ErrCode, err error) { - // TODO: do something with err? send it as a debug frame to the peer? - // But that's only in GOAWAY. Invent a new frame type? Is there one already? - cc.wmu.Lock() - cc.fr.WriteRSTStream(streamID, code) - cc.bw.Flush() - cc.wmu.Unlock() -} - -var ( - errResponseHeaderListSize = errors.New("http2: response header list larger than advertised limit") - errPseudoTrailers = errors.New("http2: invalid pseudo header in trailers") -) - -func (cc *ClientConn) logf(format string, args ...interface{}) { - cc.t.logf(format, args...) -} - -func (cc *ClientConn) vlogf(format string, args ...interface{}) { - cc.t.vlogf(format, args...) -} - -func (t *Transport) vlogf(format string, args ...interface{}) { - if VerboseLogs { - t.logf(format, args...) - } -} - -func (t *Transport) logf(format string, args ...interface{}) { - log.Printf(format, args...) -} - -var noBody io.ReadCloser = ioutil.NopCloser(bytes.NewReader(nil)) - -func strSliceContains(ss []string, s string) bool { - for _, v := range ss { - if v == s { - return true - } - } - return false -} - -type erringRoundTripper struct{ err error } - -func (rt erringRoundTripper) RoundTrip(*http.Request) (*http.Response, error) { return nil, rt.err } - -// gzipReader wraps a response body so it can lazily -// call gzip.NewReader on the first call to Read -type gzipReader struct { - body io.ReadCloser // underlying Response.Body - zr *gzip.Reader // lazily-initialized gzip reader - zerr error // sticky error -} - -func (gz *gzipReader) Read(p []byte) (n int, err error) { - if gz.zerr != nil { - return 0, gz.zerr - } - if gz.zr == nil { - gz.zr, err = gzip.NewReader(gz.body) - if err != nil { - gz.zerr = err - return 0, err - } - } - return gz.zr.Read(p) -} - -func (gz *gzipReader) Close() error { - return gz.body.Close() -} - -type errorReader struct{ err error } - -func (r errorReader) Read(p []byte) (int, error) { return 0, r.err } diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/write.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/write.go deleted file mode 100644 index 5297a4bfe3d..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/write.go +++ /dev/null @@ -1,263 +0,0 @@ -// Copyright 2014 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 http2 - -import ( - "bytes" - "fmt" - "log" - "net/http" - "sort" - "time" - - "golang.org/x/net/http2/hpack" -) - -// writeFramer is implemented by any type that is used to write frames. -type writeFramer interface { - writeFrame(writeContext) error -} - -// writeContext is the interface needed by the various frame writer -// types below. All the writeFrame methods below are scheduled via the -// frame writing scheduler (see writeScheduler in writesched.go). -// -// This interface is implemented by *serverConn. -// -// TODO: decide whether to a) use this in the client code (which didn't -// end up using this yet, because it has a simpler design, not -// currently implementing priorities), or b) delete this and -// make the server code a bit more concrete. -type writeContext interface { - Framer() *Framer - Flush() error - CloseConn() error - // HeaderEncoder returns an HPACK encoder that writes to the - // returned buffer. - HeaderEncoder() (*hpack.Encoder, *bytes.Buffer) -} - -// endsStream reports whether the given frame writer w will locally -// close the stream. -func endsStream(w writeFramer) bool { - switch v := w.(type) { - case *writeData: - return v.endStream - case *writeResHeaders: - return v.endStream - case nil: - // This can only happen if the caller reuses w after it's - // been intentionally nil'ed out to prevent use. Keep this - // here to catch future refactoring breaking it. - panic("endsStream called on nil writeFramer") - } - return false -} - -type flushFrameWriter struct{} - -func (flushFrameWriter) writeFrame(ctx writeContext) error { - return ctx.Flush() -} - -type writeSettings []Setting - -func (s writeSettings) writeFrame(ctx writeContext) error { - return ctx.Framer().WriteSettings([]Setting(s)...) -} - -type writeGoAway struct { - maxStreamID uint32 - code ErrCode -} - -func (p *writeGoAway) writeFrame(ctx writeContext) error { - err := ctx.Framer().WriteGoAway(p.maxStreamID, p.code, nil) - if p.code != 0 { - ctx.Flush() // ignore error: we're hanging up on them anyway - time.Sleep(50 * time.Millisecond) - ctx.CloseConn() - } - return err -} - -type writeData struct { - streamID uint32 - p []byte - endStream bool -} - -func (w *writeData) String() string { - return fmt.Sprintf("writeData(stream=%d, p=%d, endStream=%v)", w.streamID, len(w.p), w.endStream) -} - -func (w *writeData) writeFrame(ctx writeContext) error { - return ctx.Framer().WriteData(w.streamID, w.endStream, w.p) -} - -// handlerPanicRST is the message sent from handler goroutines when -// the handler panics. -type handlerPanicRST struct { - StreamID uint32 -} - -func (hp handlerPanicRST) writeFrame(ctx writeContext) error { - return ctx.Framer().WriteRSTStream(hp.StreamID, ErrCodeInternal) -} - -func (se StreamError) writeFrame(ctx writeContext) error { - return ctx.Framer().WriteRSTStream(se.StreamID, se.Code) -} - -type writePingAck struct{ pf *PingFrame } - -func (w writePingAck) writeFrame(ctx writeContext) error { - return ctx.Framer().WritePing(true, w.pf.Data) -} - -type writeSettingsAck struct{} - -func (writeSettingsAck) writeFrame(ctx writeContext) error { - return ctx.Framer().WriteSettingsAck() -} - -// writeResHeaders is a request to write a HEADERS and 0+ CONTINUATION frames -// for HTTP response headers or trailers from a server handler. -type writeResHeaders struct { - streamID uint32 - httpResCode int // 0 means no ":status" line - h http.Header // may be nil - trailers []string // if non-nil, which keys of h to write. nil means all. - endStream bool - - date string - contentType string - contentLength string -} - -func encKV(enc *hpack.Encoder, k, v string) { - if VerboseLogs { - log.Printf("http2: server encoding header %q = %q", k, v) - } - enc.WriteField(hpack.HeaderField{Name: k, Value: v}) -} - -func (w *writeResHeaders) writeFrame(ctx writeContext) error { - enc, buf := ctx.HeaderEncoder() - buf.Reset() - - if w.httpResCode != 0 { - encKV(enc, ":status", httpCodeString(w.httpResCode)) - } - - encodeHeaders(enc, w.h, w.trailers) - - if w.contentType != "" { - encKV(enc, "content-type", w.contentType) - } - if w.contentLength != "" { - encKV(enc, "content-length", w.contentLength) - } - if w.date != "" { - encKV(enc, "date", w.date) - } - - headerBlock := buf.Bytes() - if len(headerBlock) == 0 && w.trailers == nil { - panic("unexpected empty hpack") - } - - // For now we're lazy and just pick the minimum MAX_FRAME_SIZE - // that all peers must support (16KB). Later we could care - // more and send larger frames if the peer advertised it, but - // there's little point. Most headers are small anyway (so we - // generally won't have CONTINUATION frames), and extra frames - // only waste 9 bytes anyway. - const maxFrameSize = 16384 - - first := true - for len(headerBlock) > 0 { - frag := headerBlock - if len(frag) > maxFrameSize { - frag = frag[:maxFrameSize] - } - headerBlock = headerBlock[len(frag):] - endHeaders := len(headerBlock) == 0 - var err error - if first { - first = false - err = ctx.Framer().WriteHeaders(HeadersFrameParam{ - StreamID: w.streamID, - BlockFragment: frag, - EndStream: w.endStream, - EndHeaders: endHeaders, - }) - } else { - err = ctx.Framer().WriteContinuation(w.streamID, endHeaders, frag) - } - if err != nil { - return err - } - } - return nil -} - -type write100ContinueHeadersFrame struct { - streamID uint32 -} - -func (w write100ContinueHeadersFrame) writeFrame(ctx writeContext) error { - enc, buf := ctx.HeaderEncoder() - buf.Reset() - encKV(enc, ":status", "100") - return ctx.Framer().WriteHeaders(HeadersFrameParam{ - StreamID: w.streamID, - BlockFragment: buf.Bytes(), - EndStream: false, - EndHeaders: true, - }) -} - -type writeWindowUpdate struct { - streamID uint32 // or 0 for conn-level - n uint32 -} - -func (wu writeWindowUpdate) writeFrame(ctx writeContext) error { - return ctx.Framer().WriteWindowUpdate(wu.streamID, wu.n) -} - -func encodeHeaders(enc *hpack.Encoder, h http.Header, keys []string) { - // TODO: garbage. pool sorters like http1? hot path for 1 key? - if keys == nil { - keys = make([]string, 0, len(h)) - for k := range h { - keys = append(keys, k) - } - sort.Strings(keys) - } - for _, k := range keys { - vv := h[k] - k = lowerHeader(k) - if !validHeaderFieldName(k) { - // TODO: return an error? golang.org/issue/14048 - // For now just omit it. - continue - } - isTE := k == "transfer-encoding" - for _, v := range vv { - if !validHeaderFieldValue(v) { - // TODO: return an error? golang.org/issue/14048 - // For now just omit it. - continue - } - // TODO: more of "8.1.2.2 Connection-Specific Header Fields" - if isTE && v != "trailers" { - continue - } - encKV(enc, k, v) - } - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/writesched.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/writesched.go deleted file mode 100644 index c24316ce7b2..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/http2/writesched.go +++ /dev/null @@ -1,283 +0,0 @@ -// Copyright 2014 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 http2 - -import "fmt" - -// frameWriteMsg is a request to write a frame. -type frameWriteMsg struct { - // write is the interface value that does the writing, once the - // writeScheduler (below) has decided to select this frame - // to write. The write functions are all defined in write.go. - write writeFramer - - stream *stream // used for prioritization. nil for non-stream frames. - - // done, if non-nil, must be a buffered channel with space for - // 1 message and is sent the return value from write (or an - // earlier error) when the frame has been written. - done chan error -} - -// for debugging only: -func (wm frameWriteMsg) String() string { - var streamID uint32 - if wm.stream != nil { - streamID = wm.stream.id - } - var des string - if s, ok := wm.write.(fmt.Stringer); ok { - des = s.String() - } else { - des = fmt.Sprintf("%T", wm.write) - } - return fmt.Sprintf("[frameWriteMsg stream=%d, ch=%v, type: %v]", streamID, wm.done != nil, des) -} - -// writeScheduler tracks pending frames to write, priorities, and decides -// the next one to use. It is not thread-safe. -type writeScheduler struct { - // zero are frames not associated with a specific stream. - // They're sent before any stream-specific freams. - zero writeQueue - - // maxFrameSize is the maximum size of a DATA frame - // we'll write. Must be non-zero and between 16K-16M. - maxFrameSize uint32 - - // sq contains the stream-specific queues, keyed by stream ID. - // when a stream is idle, it's deleted from the map. - sq map[uint32]*writeQueue - - // canSend is a slice of memory that's reused between frame - // scheduling decisions to hold the list of writeQueues (from sq) - // which have enough flow control data to send. After canSend is - // built, the best is selected. - canSend []*writeQueue - - // pool of empty queues for reuse. - queuePool []*writeQueue -} - -func (ws *writeScheduler) putEmptyQueue(q *writeQueue) { - if len(q.s) != 0 { - panic("queue must be empty") - } - ws.queuePool = append(ws.queuePool, q) -} - -func (ws *writeScheduler) getEmptyQueue() *writeQueue { - ln := len(ws.queuePool) - if ln == 0 { - return new(writeQueue) - } - q := ws.queuePool[ln-1] - ws.queuePool = ws.queuePool[:ln-1] - return q -} - -func (ws *writeScheduler) empty() bool { return ws.zero.empty() && len(ws.sq) == 0 } - -func (ws *writeScheduler) add(wm frameWriteMsg) { - st := wm.stream - if st == nil { - ws.zero.push(wm) - } else { - ws.streamQueue(st.id).push(wm) - } -} - -func (ws *writeScheduler) streamQueue(streamID uint32) *writeQueue { - if q, ok := ws.sq[streamID]; ok { - return q - } - if ws.sq == nil { - ws.sq = make(map[uint32]*writeQueue) - } - q := ws.getEmptyQueue() - ws.sq[streamID] = q - return q -} - -// take returns the most important frame to write and removes it from the scheduler. -// It is illegal to call this if the scheduler is empty or if there are no connection-level -// flow control bytes available. -func (ws *writeScheduler) take() (wm frameWriteMsg, ok bool) { - if ws.maxFrameSize == 0 { - panic("internal error: ws.maxFrameSize not initialized or invalid") - } - - // If there any frames not associated with streams, prefer those first. - // These are usually SETTINGS, etc. - if !ws.zero.empty() { - return ws.zero.shift(), true - } - if len(ws.sq) == 0 { - return - } - - // Next, prioritize frames on streams that aren't DATA frames (no cost). - for id, q := range ws.sq { - if q.firstIsNoCost() { - return ws.takeFrom(id, q) - } - } - - // Now, all that remains are DATA frames with non-zero bytes to - // send. So pick the best one. - if len(ws.canSend) != 0 { - panic("should be empty") - } - for _, q := range ws.sq { - if n := ws.streamWritableBytes(q); n > 0 { - ws.canSend = append(ws.canSend, q) - } - } - if len(ws.canSend) == 0 { - return - } - defer ws.zeroCanSend() - - // TODO: find the best queue - q := ws.canSend[0] - - return ws.takeFrom(q.streamID(), q) -} - -// zeroCanSend is defered from take. -func (ws *writeScheduler) zeroCanSend() { - for i := range ws.canSend { - ws.canSend[i] = nil - } - ws.canSend = ws.canSend[:0] -} - -// streamWritableBytes returns the number of DATA bytes we could write -// from the given queue's stream, if this stream/queue were -// selected. It is an error to call this if q's head isn't a -// *writeData. -func (ws *writeScheduler) streamWritableBytes(q *writeQueue) int32 { - wm := q.head() - ret := wm.stream.flow.available() // max we can write - if ret == 0 { - return 0 - } - if int32(ws.maxFrameSize) < ret { - ret = int32(ws.maxFrameSize) - } - if ret == 0 { - panic("internal error: ws.maxFrameSize not initialized or invalid") - } - wd := wm.write.(*writeData) - if len(wd.p) < int(ret) { - ret = int32(len(wd.p)) - } - return ret -} - -func (ws *writeScheduler) takeFrom(id uint32, q *writeQueue) (wm frameWriteMsg, ok bool) { - wm = q.head() - // If the first item in this queue costs flow control tokens - // and we don't have enough, write as much as we can. - if wd, ok := wm.write.(*writeData); ok && len(wd.p) > 0 { - allowed := wm.stream.flow.available() // max we can write - if allowed == 0 { - // No quota available. Caller can try the next stream. - return frameWriteMsg{}, false - } - if int32(ws.maxFrameSize) < allowed { - allowed = int32(ws.maxFrameSize) - } - // TODO: further restrict the allowed size, because even if - // the peer says it's okay to write 16MB data frames, we might - // want to write smaller ones to properly weight competing - // streams' priorities. - - if len(wd.p) > int(allowed) { - wm.stream.flow.take(allowed) - chunk := wd.p[:allowed] - wd.p = wd.p[allowed:] - // Make up a new write message of a valid size, rather - // than shifting one off the queue. - return frameWriteMsg{ - stream: wm.stream, - write: &writeData{ - streamID: wd.streamID, - p: chunk, - // even if the original had endStream set, there - // arebytes remaining because len(wd.p) > allowed, - // so we know endStream is false: - endStream: false, - }, - // our caller is blocking on the final DATA frame, not - // these intermediates, so no need to wait: - done: nil, - }, true - } - wm.stream.flow.take(int32(len(wd.p))) - } - - q.shift() - if q.empty() { - ws.putEmptyQueue(q) - delete(ws.sq, id) - } - return wm, true -} - -func (ws *writeScheduler) forgetStream(id uint32) { - q, ok := ws.sq[id] - if !ok { - return - } - delete(ws.sq, id) - - // But keep it for others later. - for i := range q.s { - q.s[i] = frameWriteMsg{} - } - q.s = q.s[:0] - ws.putEmptyQueue(q) -} - -type writeQueue struct { - s []frameWriteMsg -} - -// streamID returns the stream ID for a non-empty stream-specific queue. -func (q *writeQueue) streamID() uint32 { return q.s[0].stream.id } - -func (q *writeQueue) empty() bool { return len(q.s) == 0 } - -func (q *writeQueue) push(wm frameWriteMsg) { - q.s = append(q.s, wm) -} - -// head returns the next item that would be removed by shift. -func (q *writeQueue) head() frameWriteMsg { - if len(q.s) == 0 { - panic("invalid use of queue") - } - return q.s[0] -} - -func (q *writeQueue) shift() frameWriteMsg { - if len(q.s) == 0 { - panic("invalid use of queue") - } - wm := q.s[0] - // TODO: less copy-happy queue. - copy(q.s, q.s[1:]) - q.s[len(q.s)-1] = frameWriteMsg{} - q.s = q.s[:len(q.s)-1] - return wm -} - -func (q *writeQueue) firstIsNoCost() bool { - if df, ok := q.s[0].write.(*writeData); ok { - return len(df.p) == 0 - } - return true -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/internal/timeseries/timeseries.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/internal/timeseries/timeseries.go deleted file mode 100644 index 1119f344822..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/internal/timeseries/timeseries.go +++ /dev/null @@ -1,525 +0,0 @@ -// Copyright 2015 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 timeseries implements a time series structure for stats collection. -package timeseries // import "golang.org/x/net/internal/timeseries" - -import ( - "fmt" - "log" - "time" -) - -const ( - timeSeriesNumBuckets = 64 - minuteHourSeriesNumBuckets = 60 -) - -var timeSeriesResolutions = []time.Duration{ - 1 * time.Second, - 10 * time.Second, - 1 * time.Minute, - 10 * time.Minute, - 1 * time.Hour, - 6 * time.Hour, - 24 * time.Hour, // 1 day - 7 * 24 * time.Hour, // 1 week - 4 * 7 * 24 * time.Hour, // 4 weeks - 16 * 7 * 24 * time.Hour, // 16 weeks -} - -var minuteHourSeriesResolutions = []time.Duration{ - 1 * time.Second, - 1 * time.Minute, -} - -// An Observable is a kind of data that can be aggregated in a time series. -type Observable interface { - Multiply(ratio float64) // Multiplies the data in self by a given ratio - Add(other Observable) // Adds the data from a different observation to self - Clear() // Clears the observation so it can be reused. - CopyFrom(other Observable) // Copies the contents of a given observation to self -} - -// Float attaches the methods of Observable to a float64. -type Float float64 - -// NewFloat returns a Float. -func NewFloat() Observable { - f := Float(0) - return &f -} - -// String returns the float as a string. -func (f *Float) String() string { return fmt.Sprintf("%g", f.Value()) } - -// Value returns the float's value. -func (f *Float) Value() float64 { return float64(*f) } - -func (f *Float) Multiply(ratio float64) { *f *= Float(ratio) } - -func (f *Float) Add(other Observable) { - o := other.(*Float) - *f += *o -} - -func (f *Float) Clear() { *f = 0 } - -func (f *Float) CopyFrom(other Observable) { - o := other.(*Float) - *f = *o -} - -// A Clock tells the current time. -type Clock interface { - Time() time.Time -} - -type defaultClock int - -var defaultClockInstance defaultClock - -func (defaultClock) Time() time.Time { return time.Now() } - -// Information kept per level. Each level consists of a circular list of -// observations. The start of the level may be derived from end and the -// len(buckets) * sizeInMillis. -type tsLevel struct { - oldest int // index to oldest bucketed Observable - newest int // index to newest bucketed Observable - end time.Time // end timestamp for this level - size time.Duration // duration of the bucketed Observable - buckets []Observable // collections of observations - provider func() Observable // used for creating new Observable -} - -func (l *tsLevel) Clear() { - l.oldest = 0 - l.newest = len(l.buckets) - 1 - l.end = time.Time{} - for i := range l.buckets { - if l.buckets[i] != nil { - l.buckets[i].Clear() - l.buckets[i] = nil - } - } -} - -func (l *tsLevel) InitLevel(size time.Duration, numBuckets int, f func() Observable) { - l.size = size - l.provider = f - l.buckets = make([]Observable, numBuckets) -} - -// Keeps a sequence of levels. Each level is responsible for storing data at -// a given resolution. For example, the first level stores data at a one -// minute resolution while the second level stores data at a one hour -// resolution. - -// Each level is represented by a sequence of buckets. Each bucket spans an -// interval equal to the resolution of the level. New observations are added -// to the last bucket. -type timeSeries struct { - provider func() Observable // make more Observable - numBuckets int // number of buckets in each level - levels []*tsLevel // levels of bucketed Observable - lastAdd time.Time // time of last Observable tracked - total Observable // convenient aggregation of all Observable - clock Clock // Clock for getting current time - pending Observable // observations not yet bucketed - pendingTime time.Time // what time are we keeping in pending - dirty bool // if there are pending observations -} - -// init initializes a level according to the supplied criteria. -func (ts *timeSeries) init(resolutions []time.Duration, f func() Observable, numBuckets int, clock Clock) { - ts.provider = f - ts.numBuckets = numBuckets - ts.clock = clock - ts.levels = make([]*tsLevel, len(resolutions)) - - for i := range resolutions { - if i > 0 && resolutions[i-1] >= resolutions[i] { - log.Print("timeseries: resolutions must be monotonically increasing") - break - } - newLevel := new(tsLevel) - newLevel.InitLevel(resolutions[i], ts.numBuckets, ts.provider) - ts.levels[i] = newLevel - } - - ts.Clear() -} - -// Clear removes all observations from the time series. -func (ts *timeSeries) Clear() { - ts.lastAdd = time.Time{} - ts.total = ts.resetObservation(ts.total) - ts.pending = ts.resetObservation(ts.pending) - ts.pendingTime = time.Time{} - ts.dirty = false - - for i := range ts.levels { - ts.levels[i].Clear() - } -} - -// Add records an observation at the current time. -func (ts *timeSeries) Add(observation Observable) { - ts.AddWithTime(observation, ts.clock.Time()) -} - -// AddWithTime records an observation at the specified time. -func (ts *timeSeries) AddWithTime(observation Observable, t time.Time) { - - smallBucketDuration := ts.levels[0].size - - if t.After(ts.lastAdd) { - ts.lastAdd = t - } - - if t.After(ts.pendingTime) { - ts.advance(t) - ts.mergePendingUpdates() - ts.pendingTime = ts.levels[0].end - ts.pending.CopyFrom(observation) - ts.dirty = true - } else if t.After(ts.pendingTime.Add(-1 * smallBucketDuration)) { - // The observation is close enough to go into the pending bucket. - // This compensates for clock skewing and small scheduling delays - // by letting the update stay in the fast path. - ts.pending.Add(observation) - ts.dirty = true - } else { - ts.mergeValue(observation, t) - } -} - -// mergeValue inserts the observation at the specified time in the past into all levels. -func (ts *timeSeries) mergeValue(observation Observable, t time.Time) { - for _, level := range ts.levels { - index := (ts.numBuckets - 1) - int(level.end.Sub(t)/level.size) - if 0 <= index && index < ts.numBuckets { - bucketNumber := (level.oldest + index) % ts.numBuckets - if level.buckets[bucketNumber] == nil { - level.buckets[bucketNumber] = level.provider() - } - level.buckets[bucketNumber].Add(observation) - } - } - ts.total.Add(observation) -} - -// mergePendingUpdates applies the pending updates into all levels. -func (ts *timeSeries) mergePendingUpdates() { - if ts.dirty { - ts.mergeValue(ts.pending, ts.pendingTime) - ts.pending = ts.resetObservation(ts.pending) - ts.dirty = false - } -} - -// advance cycles the buckets at each level until the latest bucket in -// each level can hold the time specified. -func (ts *timeSeries) advance(t time.Time) { - if !t.After(ts.levels[0].end) { - return - } - for i := 0; i < len(ts.levels); i++ { - level := ts.levels[i] - if !level.end.Before(t) { - break - } - - // If the time is sufficiently far, just clear the level and advance - // directly. - if !t.Before(level.end.Add(level.size * time.Duration(ts.numBuckets))) { - for _, b := range level.buckets { - ts.resetObservation(b) - } - level.end = time.Unix(0, (t.UnixNano()/level.size.Nanoseconds())*level.size.Nanoseconds()) - } - - for t.After(level.end) { - level.end = level.end.Add(level.size) - level.newest = level.oldest - level.oldest = (level.oldest + 1) % ts.numBuckets - ts.resetObservation(level.buckets[level.newest]) - } - - t = level.end - } -} - -// Latest returns the sum of the num latest buckets from the level. -func (ts *timeSeries) Latest(level, num int) Observable { - now := ts.clock.Time() - if ts.levels[0].end.Before(now) { - ts.advance(now) - } - - ts.mergePendingUpdates() - - result := ts.provider() - l := ts.levels[level] - index := l.newest - - for i := 0; i < num; i++ { - if l.buckets[index] != nil { - result.Add(l.buckets[index]) - } - if index == 0 { - index = ts.numBuckets - } - index-- - } - - return result -} - -// LatestBuckets returns a copy of the num latest buckets from level. -func (ts *timeSeries) LatestBuckets(level, num int) []Observable { - if level < 0 || level > len(ts.levels) { - log.Print("timeseries: bad level argument: ", level) - return nil - } - if num < 0 || num >= ts.numBuckets { - log.Print("timeseries: bad num argument: ", num) - return nil - } - - results := make([]Observable, num) - now := ts.clock.Time() - if ts.levels[0].end.Before(now) { - ts.advance(now) - } - - ts.mergePendingUpdates() - - l := ts.levels[level] - index := l.newest - - for i := 0; i < num; i++ { - result := ts.provider() - results[i] = result - if l.buckets[index] != nil { - result.CopyFrom(l.buckets[index]) - } - - if index == 0 { - index = ts.numBuckets - } - index -= 1 - } - return results -} - -// ScaleBy updates observations by scaling by factor. -func (ts *timeSeries) ScaleBy(factor float64) { - for _, l := range ts.levels { - for i := 0; i < ts.numBuckets; i++ { - l.buckets[i].Multiply(factor) - } - } - - ts.total.Multiply(factor) - ts.pending.Multiply(factor) -} - -// Range returns the sum of observations added over the specified time range. -// If start or finish times don't fall on bucket boundaries of the same -// level, then return values are approximate answers. -func (ts *timeSeries) Range(start, finish time.Time) Observable { - return ts.ComputeRange(start, finish, 1)[0] -} - -// Recent returns the sum of observations from the last delta. -func (ts *timeSeries) Recent(delta time.Duration) Observable { - now := ts.clock.Time() - return ts.Range(now.Add(-delta), now) -} - -// Total returns the total of all observations. -func (ts *timeSeries) Total() Observable { - ts.mergePendingUpdates() - return ts.total -} - -// ComputeRange computes a specified number of values into a slice using -// the observations recorded over the specified time period. The return -// values are approximate if the start or finish times don't fall on the -// bucket boundaries at the same level or if the number of buckets spanning -// the range is not an integral multiple of num. -func (ts *timeSeries) ComputeRange(start, finish time.Time, num int) []Observable { - if start.After(finish) { - log.Printf("timeseries: start > finish, %v>%v", start, finish) - return nil - } - - if num < 0 { - log.Printf("timeseries: num < 0, %v", num) - return nil - } - - results := make([]Observable, num) - - for _, l := range ts.levels { - if !start.Before(l.end.Add(-l.size * time.Duration(ts.numBuckets))) { - ts.extract(l, start, finish, num, results) - return results - } - } - - // Failed to find a level that covers the desired range. So just - // extract from the last level, even if it doesn't cover the entire - // desired range. - ts.extract(ts.levels[len(ts.levels)-1], start, finish, num, results) - - return results -} - -// RecentList returns the specified number of values in slice over the most -// recent time period of the specified range. -func (ts *timeSeries) RecentList(delta time.Duration, num int) []Observable { - if delta < 0 { - return nil - } - now := ts.clock.Time() - return ts.ComputeRange(now.Add(-delta), now, num) -} - -// extract returns a slice of specified number of observations from a given -// level over a given range. -func (ts *timeSeries) extract(l *tsLevel, start, finish time.Time, num int, results []Observable) { - ts.mergePendingUpdates() - - srcInterval := l.size - dstInterval := finish.Sub(start) / time.Duration(num) - dstStart := start - srcStart := l.end.Add(-srcInterval * time.Duration(ts.numBuckets)) - - srcIndex := 0 - - // Where should scanning start? - if dstStart.After(srcStart) { - advance := dstStart.Sub(srcStart) / srcInterval - srcIndex += int(advance) - srcStart = srcStart.Add(advance * srcInterval) - } - - // The i'th value is computed as show below. - // interval = (finish/start)/num - // i'th value = sum of observation in range - // [ start + i * interval, - // start + (i + 1) * interval ) - for i := 0; i < num; i++ { - results[i] = ts.resetObservation(results[i]) - dstEnd := dstStart.Add(dstInterval) - for srcIndex < ts.numBuckets && srcStart.Before(dstEnd) { - srcEnd := srcStart.Add(srcInterval) - if srcEnd.After(ts.lastAdd) { - srcEnd = ts.lastAdd - } - - if !srcEnd.Before(dstStart) { - srcValue := l.buckets[(srcIndex+l.oldest)%ts.numBuckets] - if !srcStart.Before(dstStart) && !srcEnd.After(dstEnd) { - // dst completely contains src. - if srcValue != nil { - results[i].Add(srcValue) - } - } else { - // dst partially overlaps src. - overlapStart := maxTime(srcStart, dstStart) - overlapEnd := minTime(srcEnd, dstEnd) - base := srcEnd.Sub(srcStart) - fraction := overlapEnd.Sub(overlapStart).Seconds() / base.Seconds() - - used := ts.provider() - if srcValue != nil { - used.CopyFrom(srcValue) - } - used.Multiply(fraction) - results[i].Add(used) - } - - if srcEnd.After(dstEnd) { - break - } - } - srcIndex++ - srcStart = srcStart.Add(srcInterval) - } - dstStart = dstStart.Add(dstInterval) - } -} - -// resetObservation clears the content so the struct may be reused. -func (ts *timeSeries) resetObservation(observation Observable) Observable { - if observation == nil { - observation = ts.provider() - } else { - observation.Clear() - } - return observation -} - -// TimeSeries tracks data at granularities from 1 second to 16 weeks. -type TimeSeries struct { - timeSeries -} - -// NewTimeSeries creates a new TimeSeries using the function provided for creating new Observable. -func NewTimeSeries(f func() Observable) *TimeSeries { - return NewTimeSeriesWithClock(f, defaultClockInstance) -} - -// NewTimeSeriesWithClock creates a new TimeSeries using the function provided for creating new Observable and the clock for -// assigning timestamps. -func NewTimeSeriesWithClock(f func() Observable, clock Clock) *TimeSeries { - ts := new(TimeSeries) - ts.timeSeries.init(timeSeriesResolutions, f, timeSeriesNumBuckets, clock) - return ts -} - -// MinuteHourSeries tracks data at granularities of 1 minute and 1 hour. -type MinuteHourSeries struct { - timeSeries -} - -// NewMinuteHourSeries creates a new MinuteHourSeries using the function provided for creating new Observable. -func NewMinuteHourSeries(f func() Observable) *MinuteHourSeries { - return NewMinuteHourSeriesWithClock(f, defaultClockInstance) -} - -// NewMinuteHourSeriesWithClock creates a new MinuteHourSeries using the function provided for creating new Observable and the clock for -// assigning timestamps. -func NewMinuteHourSeriesWithClock(f func() Observable, clock Clock) *MinuteHourSeries { - ts := new(MinuteHourSeries) - ts.timeSeries.init(minuteHourSeriesResolutions, f, - minuteHourSeriesNumBuckets, clock) - return ts -} - -func (ts *MinuteHourSeries) Minute() Observable { - return ts.timeSeries.Latest(0, 60) -} - -func (ts *MinuteHourSeries) Hour() Observable { - return ts.timeSeries.Latest(1, 60) -} - -func minTime(a, b time.Time) time.Time { - if a.Before(b) { - return a - } - return b -} - -func maxTime(a, b time.Time) time.Time { - if a.After(b) { - return a - } - return b -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/events.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/events.go deleted file mode 100644 index e66c7e32828..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/events.go +++ /dev/null @@ -1,524 +0,0 @@ -// Copyright 2015 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 trace - -import ( - "bytes" - "fmt" - "html/template" - "io" - "log" - "net/http" - "runtime" - "sort" - "strconv" - "strings" - "sync" - "sync/atomic" - "text/tabwriter" - "time" -) - -var eventsTmpl = template.Must(template.New("events").Funcs(template.FuncMap{ - "elapsed": elapsed, - "trimSpace": strings.TrimSpace, -}).Parse(eventsHTML)) - -const maxEventsPerLog = 100 - -type bucket struct { - MaxErrAge time.Duration - String string -} - -var buckets = []bucket{ - {0, "total"}, - {10 * time.Second, "errs<10s"}, - {1 * time.Minute, "errs<1m"}, - {10 * time.Minute, "errs<10m"}, - {1 * time.Hour, "errs<1h"}, - {10 * time.Hour, "errs<10h"}, - {24000 * time.Hour, "errors"}, -} - -// RenderEvents renders the HTML page typically served at /debug/events. -// It does not do any auth checking; see AuthRequest for the default auth check -// used by the handler registered on http.DefaultServeMux. -// req may be nil. -func RenderEvents(w http.ResponseWriter, req *http.Request, sensitive bool) { - now := time.Now() - data := &struct { - Families []string // family names - Buckets []bucket - Counts [][]int // eventLog count per family/bucket - - // Set when a bucket has been selected. - Family string - Bucket int - EventLogs eventLogs - Expanded bool - }{ - Buckets: buckets, - } - - data.Families = make([]string, 0, len(families)) - famMu.RLock() - for name := range families { - data.Families = append(data.Families, name) - } - famMu.RUnlock() - sort.Strings(data.Families) - - // Count the number of eventLogs in each family for each error age. - data.Counts = make([][]int, len(data.Families)) - for i, name := range data.Families { - // TODO(sameer): move this loop under the family lock. - f := getEventFamily(name) - data.Counts[i] = make([]int, len(data.Buckets)) - for j, b := range data.Buckets { - data.Counts[i][j] = f.Count(now, b.MaxErrAge) - } - } - - if req != nil { - var ok bool - data.Family, data.Bucket, ok = parseEventsArgs(req) - if !ok { - // No-op - } else { - data.EventLogs = getEventFamily(data.Family).Copy(now, buckets[data.Bucket].MaxErrAge) - } - if data.EventLogs != nil { - defer data.EventLogs.Free() - sort.Sort(data.EventLogs) - } - if exp, err := strconv.ParseBool(req.FormValue("exp")); err == nil { - data.Expanded = exp - } - } - - famMu.RLock() - defer famMu.RUnlock() - if err := eventsTmpl.Execute(w, data); err != nil { - log.Printf("net/trace: Failed executing template: %v", err) - } -} - -func parseEventsArgs(req *http.Request) (fam string, b int, ok bool) { - fam, bStr := req.FormValue("fam"), req.FormValue("b") - if fam == "" || bStr == "" { - return "", 0, false - } - b, err := strconv.Atoi(bStr) - if err != nil || b < 0 || b >= len(buckets) { - return "", 0, false - } - return fam, b, true -} - -// An EventLog provides a log of events associated with a specific object. -type EventLog interface { - // Printf formats its arguments with fmt.Sprintf and adds the - // result to the event log. - Printf(format string, a ...interface{}) - - // Errorf is like Printf, but it marks this event as an error. - Errorf(format string, a ...interface{}) - - // Finish declares that this event log is complete. - // The event log should not be used after calling this method. - Finish() -} - -// NewEventLog returns a new EventLog with the specified family name -// and title. -func NewEventLog(family, title string) EventLog { - el := newEventLog() - el.ref() - el.Family, el.Title = family, title - el.Start = time.Now() - el.events = make([]logEntry, 0, maxEventsPerLog) - el.stack = make([]uintptr, 32) - n := runtime.Callers(2, el.stack) - el.stack = el.stack[:n] - - getEventFamily(family).add(el) - return el -} - -func (el *eventLog) Finish() { - getEventFamily(el.Family).remove(el) - el.unref() // matches ref in New -} - -var ( - famMu sync.RWMutex - families = make(map[string]*eventFamily) // family name => family -) - -func getEventFamily(fam string) *eventFamily { - famMu.Lock() - defer famMu.Unlock() - f := families[fam] - if f == nil { - f = &eventFamily{} - families[fam] = f - } - return f -} - -type eventFamily struct { - mu sync.RWMutex - eventLogs eventLogs -} - -func (f *eventFamily) add(el *eventLog) { - f.mu.Lock() - f.eventLogs = append(f.eventLogs, el) - f.mu.Unlock() -} - -func (f *eventFamily) remove(el *eventLog) { - f.mu.Lock() - defer f.mu.Unlock() - for i, el0 := range f.eventLogs { - if el == el0 { - copy(f.eventLogs[i:], f.eventLogs[i+1:]) - f.eventLogs = f.eventLogs[:len(f.eventLogs)-1] - return - } - } -} - -func (f *eventFamily) Count(now time.Time, maxErrAge time.Duration) (n int) { - f.mu.RLock() - defer f.mu.RUnlock() - for _, el := range f.eventLogs { - if el.hasRecentError(now, maxErrAge) { - n++ - } - } - return -} - -func (f *eventFamily) Copy(now time.Time, maxErrAge time.Duration) (els eventLogs) { - f.mu.RLock() - defer f.mu.RUnlock() - els = make(eventLogs, 0, len(f.eventLogs)) - for _, el := range f.eventLogs { - if el.hasRecentError(now, maxErrAge) { - el.ref() - els = append(els, el) - } - } - return -} - -type eventLogs []*eventLog - -// Free calls unref on each element of the list. -func (els eventLogs) Free() { - for _, el := range els { - el.unref() - } -} - -// eventLogs may be sorted in reverse chronological order. -func (els eventLogs) Len() int { return len(els) } -func (els eventLogs) Less(i, j int) bool { return els[i].Start.After(els[j].Start) } -func (els eventLogs) Swap(i, j int) { els[i], els[j] = els[j], els[i] } - -// A logEntry is a timestamped log entry in an event log. -type logEntry struct { - When time.Time - Elapsed time.Duration // since previous event in log - NewDay bool // whether this event is on a different day to the previous event - What string - IsErr bool -} - -// WhenString returns a string representation of the elapsed time of the event. -// It will include the date if midnight was crossed. -func (e logEntry) WhenString() string { - if e.NewDay { - return e.When.Format("2006/01/02 15:04:05.000000") - } - return e.When.Format("15:04:05.000000") -} - -// An eventLog represents an active event log. -type eventLog struct { - // Family is the top-level grouping of event logs to which this belongs. - Family string - - // Title is the title of this event log. - Title string - - // Timing information. - Start time.Time - - // Call stack where this event log was created. - stack []uintptr - - // Append-only sequence of events. - // - // TODO(sameer): change this to a ring buffer to avoid the array copy - // when we hit maxEventsPerLog. - mu sync.RWMutex - events []logEntry - LastErrorTime time.Time - discarded int - - refs int32 // how many buckets this is in -} - -func (el *eventLog) reset() { - // Clear all but the mutex. Mutexes may not be copied, even when unlocked. - el.Family = "" - el.Title = "" - el.Start = time.Time{} - el.stack = nil - el.events = nil - el.LastErrorTime = time.Time{} - el.discarded = 0 - el.refs = 0 -} - -func (el *eventLog) hasRecentError(now time.Time, maxErrAge time.Duration) bool { - if maxErrAge == 0 { - return true - } - el.mu.RLock() - defer el.mu.RUnlock() - return now.Sub(el.LastErrorTime) < maxErrAge -} - -// delta returns the elapsed time since the last event or the log start, -// and whether it spans midnight. -// L >= el.mu -func (el *eventLog) delta(t time.Time) (time.Duration, bool) { - if len(el.events) == 0 { - return t.Sub(el.Start), false - } - prev := el.events[len(el.events)-1].When - return t.Sub(prev), prev.Day() != t.Day() - -} - -func (el *eventLog) Printf(format string, a ...interface{}) { - el.printf(false, format, a...) -} - -func (el *eventLog) Errorf(format string, a ...interface{}) { - el.printf(true, format, a...) -} - -func (el *eventLog) printf(isErr bool, format string, a ...interface{}) { - e := logEntry{When: time.Now(), IsErr: isErr, What: fmt.Sprintf(format, a...)} - el.mu.Lock() - e.Elapsed, e.NewDay = el.delta(e.When) - if len(el.events) < maxEventsPerLog { - el.events = append(el.events, e) - } else { - // Discard the oldest event. - if el.discarded == 0 { - // el.discarded starts at two to count for the event it - // is replacing, plus the next one that we are about to - // drop. - el.discarded = 2 - } else { - el.discarded++ - } - // TODO(sameer): if this causes allocations on a critical path, - // change eventLog.What to be a fmt.Stringer, as in trace.go. - el.events[0].What = fmt.Sprintf("(%d events discarded)", el.discarded) - // The timestamp of the discarded meta-event should be - // the time of the last event it is representing. - el.events[0].When = el.events[1].When - copy(el.events[1:], el.events[2:]) - el.events[maxEventsPerLog-1] = e - } - if e.IsErr { - el.LastErrorTime = e.When - } - el.mu.Unlock() -} - -func (el *eventLog) ref() { - atomic.AddInt32(&el.refs, 1) -} - -func (el *eventLog) unref() { - if atomic.AddInt32(&el.refs, -1) == 0 { - freeEventLog(el) - } -} - -func (el *eventLog) When() string { - return el.Start.Format("2006/01/02 15:04:05.000000") -} - -func (el *eventLog) ElapsedTime() string { - elapsed := time.Since(el.Start) - return fmt.Sprintf("%.6f", elapsed.Seconds()) -} - -func (el *eventLog) Stack() string { - buf := new(bytes.Buffer) - tw := tabwriter.NewWriter(buf, 1, 8, 1, '\t', 0) - printStackRecord(tw, el.stack) - tw.Flush() - return buf.String() -} - -// printStackRecord prints the function + source line information -// for a single stack trace. -// Adapted from runtime/pprof/pprof.go. -func printStackRecord(w io.Writer, stk []uintptr) { - for _, pc := range stk { - f := runtime.FuncForPC(pc) - if f == nil { - continue - } - file, line := f.FileLine(pc) - name := f.Name() - // Hide runtime.goexit and any runtime functions at the beginning. - if strings.HasPrefix(name, "runtime.") { - continue - } - fmt.Fprintf(w, "# %s\t%s:%d\n", name, file, line) - } -} - -func (el *eventLog) Events() []logEntry { - el.mu.RLock() - defer el.mu.RUnlock() - return el.events -} - -// freeEventLogs is a freelist of *eventLog -var freeEventLogs = make(chan *eventLog, 1000) - -// newEventLog returns a event log ready to use. -func newEventLog() *eventLog { - select { - case el := <-freeEventLogs: - return el - default: - return new(eventLog) - } -} - -// freeEventLog adds el to freeEventLogs if there's room. -// This is non-blocking. -func freeEventLog(el *eventLog) { - el.reset() - select { - case freeEventLogs <- el: - default: - } -} - -const eventsHTML = ` - - - events - - - - -

/debug/events

- - - {{range $i, $fam := .Families}} - - - - {{range $j, $bucket := $.Buckets}} - {{$n := index $.Counts $i $j}} - - {{end}} - - {{end}} -
{{$fam}} - {{if $n}}{{end}} - [{{$n}} {{$bucket.String}}] - {{if $n}}{{end}} -
- -{{if $.EventLogs}} -
-

Family: {{$.Family}}

- -{{if $.Expanded}}{{end}} -[Summary]{{if $.Expanded}}{{end}} - -{{if not $.Expanded}}{{end}} -[Expanded]{{if not $.Expanded}}{{end}} - - - - {{range $el := $.EventLogs}} - - - - - {{if $.Expanded}} - - - - - - {{range $el.Events}} - - - - - - {{end}} - {{end}} - {{end}} -
WhenElapsed
{{$el.When}}{{$el.ElapsedTime}}{{$el.Title}} -
{{$el.Stack|trimSpace}}
{{.WhenString}}{{elapsed .Elapsed}}.{{if .IsErr}}E{{else}}.{{end}}. {{.What}}
-{{end}} - - -` diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/histogram.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/histogram.go deleted file mode 100644 index bb42aa5320d..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/histogram.go +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright 2015 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 trace - -// This file implements histogramming for RPC statistics collection. - -import ( - "bytes" - "fmt" - "html/template" - "log" - "math" - - "golang.org/x/net/internal/timeseries" -) - -const ( - bucketCount = 38 -) - -// histogram keeps counts of values in buckets that are spaced -// out in powers of 2: 0-1, 2-3, 4-7... -// histogram implements timeseries.Observable -type histogram struct { - sum int64 // running total of measurements - sumOfSquares float64 // square of running total - buckets []int64 // bucketed values for histogram - value int // holds a single value as an optimization - valueCount int64 // number of values recorded for single value -} - -// AddMeasurement records a value measurement observation to the histogram. -func (h *histogram) addMeasurement(value int64) { - // TODO: assert invariant - h.sum += value - h.sumOfSquares += float64(value) * float64(value) - - bucketIndex := getBucket(value) - - if h.valueCount == 0 || (h.valueCount > 0 && h.value == bucketIndex) { - h.value = bucketIndex - h.valueCount++ - } else { - h.allocateBuckets() - h.buckets[bucketIndex]++ - } -} - -func (h *histogram) allocateBuckets() { - if h.buckets == nil { - h.buckets = make([]int64, bucketCount) - h.buckets[h.value] = h.valueCount - h.value = 0 - h.valueCount = -1 - } -} - -func log2(i int64) int { - n := 0 - for ; i >= 0x100; i >>= 8 { - n += 8 - } - for ; i > 0; i >>= 1 { - n += 1 - } - return n -} - -func getBucket(i int64) (index int) { - index = log2(i) - 1 - if index < 0 { - index = 0 - } - if index >= bucketCount { - index = bucketCount - 1 - } - return -} - -// Total returns the number of recorded observations. -func (h *histogram) total() (total int64) { - if h.valueCount >= 0 { - total = h.valueCount - } - for _, val := range h.buckets { - total += int64(val) - } - return -} - -// Average returns the average value of recorded observations. -func (h *histogram) average() float64 { - t := h.total() - if t == 0 { - return 0 - } - return float64(h.sum) / float64(t) -} - -// Variance returns the variance of recorded observations. -func (h *histogram) variance() float64 { - t := float64(h.total()) - if t == 0 { - return 0 - } - s := float64(h.sum) / t - return h.sumOfSquares/t - s*s -} - -// StandardDeviation returns the standard deviation of recorded observations. -func (h *histogram) standardDeviation() float64 { - return math.Sqrt(h.variance()) -} - -// PercentileBoundary estimates the value that the given fraction of recorded -// observations are less than. -func (h *histogram) percentileBoundary(percentile float64) int64 { - total := h.total() - - // Corner cases (make sure result is strictly less than Total()) - if total == 0 { - return 0 - } else if total == 1 { - return int64(h.average()) - } - - percentOfTotal := round(float64(total) * percentile) - var runningTotal int64 - - for i := range h.buckets { - value := h.buckets[i] - runningTotal += value - if runningTotal == percentOfTotal { - // We hit an exact bucket boundary. If the next bucket has data, it is a - // good estimate of the value. If the bucket is empty, we interpolate the - // midpoint between the next bucket's boundary and the next non-zero - // bucket. If the remaining buckets are all empty, then we use the - // boundary for the next bucket as the estimate. - j := uint8(i + 1) - min := bucketBoundary(j) - if runningTotal < total { - for h.buckets[j] == 0 { - j++ - } - } - max := bucketBoundary(j) - return min + round(float64(max-min)/2) - } else if runningTotal > percentOfTotal { - // The value is in this bucket. Interpolate the value. - delta := runningTotal - percentOfTotal - percentBucket := float64(value-delta) / float64(value) - bucketMin := bucketBoundary(uint8(i)) - nextBucketMin := bucketBoundary(uint8(i + 1)) - bucketSize := nextBucketMin - bucketMin - return bucketMin + round(percentBucket*float64(bucketSize)) - } - } - return bucketBoundary(bucketCount - 1) -} - -// Median returns the estimated median of the observed values. -func (h *histogram) median() int64 { - return h.percentileBoundary(0.5) -} - -// Add adds other to h. -func (h *histogram) Add(other timeseries.Observable) { - o := other.(*histogram) - if o.valueCount == 0 { - // Other histogram is empty - } else if h.valueCount >= 0 && o.valueCount > 0 && h.value == o.value { - // Both have a single bucketed value, aggregate them - h.valueCount += o.valueCount - } else { - // Two different values necessitate buckets in this histogram - h.allocateBuckets() - if o.valueCount >= 0 { - h.buckets[o.value] += o.valueCount - } else { - for i := range h.buckets { - h.buckets[i] += o.buckets[i] - } - } - } - h.sumOfSquares += o.sumOfSquares - h.sum += o.sum -} - -// Clear resets the histogram to an empty state, removing all observed values. -func (h *histogram) Clear() { - h.buckets = nil - h.value = 0 - h.valueCount = 0 - h.sum = 0 - h.sumOfSquares = 0 -} - -// CopyFrom copies from other, which must be a *histogram, into h. -func (h *histogram) CopyFrom(other timeseries.Observable) { - o := other.(*histogram) - if o.valueCount == -1 { - h.allocateBuckets() - copy(h.buckets, o.buckets) - } - h.sum = o.sum - h.sumOfSquares = o.sumOfSquares - h.value = o.value - h.valueCount = o.valueCount -} - -// Multiply scales the histogram by the specified ratio. -func (h *histogram) Multiply(ratio float64) { - if h.valueCount == -1 { - for i := range h.buckets { - h.buckets[i] = int64(float64(h.buckets[i]) * ratio) - } - } else { - h.valueCount = int64(float64(h.valueCount) * ratio) - } - h.sum = int64(float64(h.sum) * ratio) - h.sumOfSquares = h.sumOfSquares * ratio -} - -// New creates a new histogram. -func (h *histogram) New() timeseries.Observable { - r := new(histogram) - r.Clear() - return r -} - -func (h *histogram) String() string { - return fmt.Sprintf("%d, %f, %d, %d, %v", - h.sum, h.sumOfSquares, h.value, h.valueCount, h.buckets) -} - -// round returns the closest int64 to the argument -func round(in float64) int64 { - return int64(math.Floor(in + 0.5)) -} - -// bucketBoundary returns the first value in the bucket. -func bucketBoundary(bucket uint8) int64 { - if bucket == 0 { - return 0 - } - return 1 << bucket -} - -// bucketData holds data about a specific bucket for use in distTmpl. -type bucketData struct { - Lower, Upper int64 - N int64 - Pct, CumulativePct float64 - GraphWidth int -} - -// data holds data about a Distribution for use in distTmpl. -type data struct { - Buckets []*bucketData - Count, Median int64 - Mean, StandardDeviation float64 -} - -// maxHTMLBarWidth is the maximum width of the HTML bar for visualizing buckets. -const maxHTMLBarWidth = 350.0 - -// newData returns data representing h for use in distTmpl. -func (h *histogram) newData() *data { - // Force the allocation of buckets to simplify the rendering implementation - h.allocateBuckets() - // We scale the bars on the right so that the largest bar is - // maxHTMLBarWidth pixels in width. - maxBucket := int64(0) - for _, n := range h.buckets { - if n > maxBucket { - maxBucket = n - } - } - total := h.total() - barsizeMult := maxHTMLBarWidth / float64(maxBucket) - var pctMult float64 - if total == 0 { - pctMult = 1.0 - } else { - pctMult = 100.0 / float64(total) - } - - buckets := make([]*bucketData, len(h.buckets)) - runningTotal := int64(0) - for i, n := range h.buckets { - if n == 0 { - continue - } - runningTotal += n - var upperBound int64 - if i < bucketCount-1 { - upperBound = bucketBoundary(uint8(i + 1)) - } else { - upperBound = math.MaxInt64 - } - buckets[i] = &bucketData{ - Lower: bucketBoundary(uint8(i)), - Upper: upperBound, - N: n, - Pct: float64(n) * pctMult, - CumulativePct: float64(runningTotal) * pctMult, - GraphWidth: int(float64(n) * barsizeMult), - } - } - return &data{ - Buckets: buckets, - Count: total, - Median: h.median(), - Mean: h.average(), - StandardDeviation: h.standardDeviation(), - } -} - -func (h *histogram) html() template.HTML { - buf := new(bytes.Buffer) - if err := distTmpl.Execute(buf, h.newData()); err != nil { - buf.Reset() - log.Printf("net/trace: couldn't execute template: %v", err) - } - return template.HTML(buf.String()) -} - -// Input: data -var distTmpl = template.Must(template.New("distTmpl").Parse(` - - - - - - - -
Count: {{.Count}}Mean: {{printf "%.0f" .Mean}}StdDev: {{printf "%.0f" .StandardDeviation}}Median: {{.Median}}
-
- -{{range $b := .Buckets}} -{{if $b}} - - - - - - - - - -{{end}} -{{end}} -
[{{.Lower}},{{.Upper}}){{.N}}{{printf "%#.3f" .Pct}}%{{printf "%#.3f" .CumulativePct}}%
-`)) diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/trace.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/trace.go deleted file mode 100644 index 0767c8c69d9..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/net/trace/trace.go +++ /dev/null @@ -1,1059 +0,0 @@ -// Copyright 2015 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 trace implements tracing of requests and long-lived objects. -It exports HTTP interfaces on /debug/requests and /debug/events. - -A trace.Trace provides tracing for short-lived objects, usually requests. -A request handler might be implemented like this: - - func fooHandler(w http.ResponseWriter, req *http.Request) { - tr := trace.New("mypkg.Foo", req.URL.Path) - defer tr.Finish() - ... - tr.LazyPrintf("some event %q happened", str) - ... - if err := somethingImportant(); err != nil { - tr.LazyPrintf("somethingImportant failed: %v", err) - tr.SetError() - } - } - -The /debug/requests HTTP endpoint organizes the traces by family, -errors, and duration. It also provides histogram of request duration -for each family. - -A trace.EventLog provides tracing for long-lived objects, such as RPC -connections. - - // A Fetcher fetches URL paths for a single domain. - type Fetcher struct { - domain string - events trace.EventLog - } - - func NewFetcher(domain string) *Fetcher { - return &Fetcher{ - domain, - trace.NewEventLog("mypkg.Fetcher", domain), - } - } - - func (f *Fetcher) Fetch(path string) (string, error) { - resp, err := http.Get("http://" + f.domain + "/" + path) - if err != nil { - f.events.Errorf("Get(%q) = %v", path, err) - return "", err - } - f.events.Printf("Get(%q) = %s", path, resp.Status) - ... - } - - func (f *Fetcher) Close() error { - f.events.Finish() - return nil - } - -The /debug/events HTTP endpoint organizes the event logs by family and -by time since the last error. The expanded view displays recent log -entries and the log's call stack. -*/ -package trace // import "golang.org/x/net/trace" - -import ( - "bytes" - "fmt" - "html/template" - "io" - "log" - "net" - "net/http" - "runtime" - "sort" - "strconv" - "sync" - "sync/atomic" - "time" - - "golang.org/x/net/context" - "golang.org/x/net/internal/timeseries" -) - -// DebugUseAfterFinish controls whether to debug uses of Trace values after finishing. -// FOR DEBUGGING ONLY. This will slow down the program. -var DebugUseAfterFinish = false - -// AuthRequest determines whether a specific request is permitted to load the -// /debug/requests or /debug/events pages. -// -// It returns two bools; the first indicates whether the page may be viewed at all, -// and the second indicates whether sensitive events will be shown. -// -// AuthRequest may be replaced by a program to customise its authorisation requirements. -// -// The default AuthRequest function returns (true, true) iff the request comes from localhost/127.0.0.1/[::1]. -var AuthRequest = func(req *http.Request) (any, sensitive bool) { - host, _, err := net.SplitHostPort(req.RemoteAddr) - switch { - case err != nil: // Badly formed address; fail closed. - return false, false - case host == "localhost" || host == "127.0.0.1" || host == "::1": - return true, true - default: - return false, false - } -} - -func init() { - http.HandleFunc("/debug/requests", func(w http.ResponseWriter, req *http.Request) { - any, sensitive := AuthRequest(req) - if !any { - http.Error(w, "not allowed", http.StatusUnauthorized) - return - } - w.Header().Set("Content-Type", "text/html; charset=utf-8") - Render(w, req, sensitive) - }) - http.HandleFunc("/debug/events", func(w http.ResponseWriter, req *http.Request) { - any, sensitive := AuthRequest(req) - if !any { - http.Error(w, "not allowed", http.StatusUnauthorized) - return - } - w.Header().Set("Content-Type", "text/html; charset=utf-8") - RenderEvents(w, req, sensitive) - }) -} - -// Render renders the HTML page typically served at /debug/requests. -// It does not do any auth checking; see AuthRequest for the default auth check -// used by the handler registered on http.DefaultServeMux. -// req may be nil. -func Render(w io.Writer, req *http.Request, sensitive bool) { - data := &struct { - Families []string - ActiveTraceCount map[string]int - CompletedTraces map[string]*family - - // Set when a bucket has been selected. - Traces traceList - Family string - Bucket int - Expanded bool - Traced bool - Active bool - ShowSensitive bool // whether to show sensitive events - - Histogram template.HTML - HistogramWindow string // e.g. "last minute", "last hour", "all time" - - // If non-zero, the set of traces is a partial set, - // and this is the total number. - Total int - }{ - CompletedTraces: completedTraces, - } - - data.ShowSensitive = sensitive - if req != nil { - // Allow show_sensitive=0 to force hiding of sensitive data for testing. - // This only goes one way; you can't use show_sensitive=1 to see things. - if req.FormValue("show_sensitive") == "0" { - data.ShowSensitive = false - } - - if exp, err := strconv.ParseBool(req.FormValue("exp")); err == nil { - data.Expanded = exp - } - if exp, err := strconv.ParseBool(req.FormValue("rtraced")); err == nil { - data.Traced = exp - } - } - - completedMu.RLock() - data.Families = make([]string, 0, len(completedTraces)) - for fam := range completedTraces { - data.Families = append(data.Families, fam) - } - completedMu.RUnlock() - sort.Strings(data.Families) - - // We are careful here to minimize the time spent locking activeMu, - // since that lock is required every time an RPC starts and finishes. - data.ActiveTraceCount = make(map[string]int, len(data.Families)) - activeMu.RLock() - for fam, s := range activeTraces { - data.ActiveTraceCount[fam] = s.Len() - } - activeMu.RUnlock() - - var ok bool - data.Family, data.Bucket, ok = parseArgs(req) - switch { - case !ok: - // No-op - case data.Bucket == -1: - data.Active = true - n := data.ActiveTraceCount[data.Family] - data.Traces = getActiveTraces(data.Family) - if len(data.Traces) < n { - data.Total = n - } - case data.Bucket < bucketsPerFamily: - if b := lookupBucket(data.Family, data.Bucket); b != nil { - data.Traces = b.Copy(data.Traced) - } - default: - if f := getFamily(data.Family, false); f != nil { - var obs timeseries.Observable - f.LatencyMu.RLock() - switch o := data.Bucket - bucketsPerFamily; o { - case 0: - obs = f.Latency.Minute() - data.HistogramWindow = "last minute" - case 1: - obs = f.Latency.Hour() - data.HistogramWindow = "last hour" - case 2: - obs = f.Latency.Total() - data.HistogramWindow = "all time" - } - f.LatencyMu.RUnlock() - if obs != nil { - data.Histogram = obs.(*histogram).html() - } - } - } - - if data.Traces != nil { - defer data.Traces.Free() - sort.Sort(data.Traces) - } - - completedMu.RLock() - defer completedMu.RUnlock() - if err := pageTmpl.ExecuteTemplate(w, "Page", data); err != nil { - log.Printf("net/trace: Failed executing template: %v", err) - } -} - -func parseArgs(req *http.Request) (fam string, b int, ok bool) { - if req == nil { - return "", 0, false - } - fam, bStr := req.FormValue("fam"), req.FormValue("b") - if fam == "" || bStr == "" { - return "", 0, false - } - b, err := strconv.Atoi(bStr) - if err != nil || b < -1 { - return "", 0, false - } - - return fam, b, true -} - -func lookupBucket(fam string, b int) *traceBucket { - f := getFamily(fam, false) - if f == nil || b < 0 || b >= len(f.Buckets) { - return nil - } - return f.Buckets[b] -} - -type contextKeyT string - -var contextKey = contextKeyT("golang.org/x/net/trace.Trace") - -// NewContext returns a copy of the parent context -// and associates it with a Trace. -func NewContext(ctx context.Context, tr Trace) context.Context { - return context.WithValue(ctx, contextKey, tr) -} - -// FromContext returns the Trace bound to the context, if any. -func FromContext(ctx context.Context) (tr Trace, ok bool) { - tr, ok = ctx.Value(contextKey).(Trace) - return -} - -// Trace represents an active request. -type Trace interface { - // LazyLog adds x to the event log. It will be evaluated each time the - // /debug/requests page is rendered. Any memory referenced by x will be - // pinned until the trace is finished and later discarded. - LazyLog(x fmt.Stringer, sensitive bool) - - // LazyPrintf evaluates its arguments with fmt.Sprintf each time the - // /debug/requests page is rendered. Any memory referenced by a will be - // pinned until the trace is finished and later discarded. - LazyPrintf(format string, a ...interface{}) - - // SetError declares that this trace resulted in an error. - SetError() - - // SetRecycler sets a recycler for the trace. - // f will be called for each event passed to LazyLog at a time when - // it is no longer required, whether while the trace is still active - // and the event is discarded, or when a completed trace is discarded. - SetRecycler(f func(interface{})) - - // SetTraceInfo sets the trace info for the trace. - // This is currently unused. - SetTraceInfo(traceID, spanID uint64) - - // SetMaxEvents sets the maximum number of events that will be stored - // in the trace. This has no effect if any events have already been - // added to the trace. - SetMaxEvents(m int) - - // Finish declares that this trace is complete. - // The trace should not be used after calling this method. - Finish() -} - -type lazySprintf struct { - format string - a []interface{} -} - -func (l *lazySprintf) String() string { - return fmt.Sprintf(l.format, l.a...) -} - -// New returns a new Trace with the specified family and title. -func New(family, title string) Trace { - tr := newTrace() - tr.ref() - tr.Family, tr.Title = family, title - tr.Start = time.Now() - tr.events = make([]event, 0, maxEventsPerTrace) - - activeMu.RLock() - s := activeTraces[tr.Family] - activeMu.RUnlock() - if s == nil { - activeMu.Lock() - s = activeTraces[tr.Family] // check again - if s == nil { - s = new(traceSet) - activeTraces[tr.Family] = s - } - activeMu.Unlock() - } - s.Add(tr) - - // Trigger allocation of the completed trace structure for this family. - // This will cause the family to be present in the request page during - // the first trace of this family. We don't care about the return value, - // nor is there any need for this to run inline, so we execute it in its - // own goroutine, but only if the family isn't allocated yet. - completedMu.RLock() - if _, ok := completedTraces[tr.Family]; !ok { - go allocFamily(tr.Family) - } - completedMu.RUnlock() - - return tr -} - -func (tr *trace) Finish() { - tr.Elapsed = time.Now().Sub(tr.Start) - if DebugUseAfterFinish { - buf := make([]byte, 4<<10) // 4 KB should be enough - n := runtime.Stack(buf, false) - tr.finishStack = buf[:n] - } - - activeMu.RLock() - m := activeTraces[tr.Family] - activeMu.RUnlock() - m.Remove(tr) - - f := getFamily(tr.Family, true) - for _, b := range f.Buckets { - if b.Cond.match(tr) { - b.Add(tr) - } - } - // Add a sample of elapsed time as microseconds to the family's timeseries - h := new(histogram) - h.addMeasurement(tr.Elapsed.Nanoseconds() / 1e3) - f.LatencyMu.Lock() - f.Latency.Add(h) - f.LatencyMu.Unlock() - - tr.unref() // matches ref in New -} - -const ( - bucketsPerFamily = 9 - tracesPerBucket = 10 - maxActiveTraces = 20 // Maximum number of active traces to show. - maxEventsPerTrace = 10 - numHistogramBuckets = 38 -) - -var ( - // The active traces. - activeMu sync.RWMutex - activeTraces = make(map[string]*traceSet) // family -> traces - - // Families of completed traces. - completedMu sync.RWMutex - completedTraces = make(map[string]*family) // family -> traces -) - -type traceSet struct { - mu sync.RWMutex - m map[*trace]bool - - // We could avoid the entire map scan in FirstN by having a slice of all the traces - // ordered by start time, and an index into that from the trace struct, with a periodic - // repack of the slice after enough traces finish; we could also use a skip list or similar. - // However, that would shift some of the expense from /debug/requests time to RPC time, - // which is probably the wrong trade-off. -} - -func (ts *traceSet) Len() int { - ts.mu.RLock() - defer ts.mu.RUnlock() - return len(ts.m) -} - -func (ts *traceSet) Add(tr *trace) { - ts.mu.Lock() - if ts.m == nil { - ts.m = make(map[*trace]bool) - } - ts.m[tr] = true - ts.mu.Unlock() -} - -func (ts *traceSet) Remove(tr *trace) { - ts.mu.Lock() - delete(ts.m, tr) - ts.mu.Unlock() -} - -// FirstN returns the first n traces ordered by time. -func (ts *traceSet) FirstN(n int) traceList { - ts.mu.RLock() - defer ts.mu.RUnlock() - - if n > len(ts.m) { - n = len(ts.m) - } - trl := make(traceList, 0, n) - - // Fast path for when no selectivity is needed. - if n == len(ts.m) { - for tr := range ts.m { - tr.ref() - trl = append(trl, tr) - } - sort.Sort(trl) - return trl - } - - // Pick the oldest n traces. - // This is inefficient. See the comment in the traceSet struct. - for tr := range ts.m { - // Put the first n traces into trl in the order they occur. - // When we have n, sort trl, and thereafter maintain its order. - if len(trl) < n { - tr.ref() - trl = append(trl, tr) - if len(trl) == n { - // This is guaranteed to happen exactly once during this loop. - sort.Sort(trl) - } - continue - } - if tr.Start.After(trl[n-1].Start) { - continue - } - - // Find where to insert this one. - tr.ref() - i := sort.Search(n, func(i int) bool { return trl[i].Start.After(tr.Start) }) - trl[n-1].unref() - copy(trl[i+1:], trl[i:]) - trl[i] = tr - } - - return trl -} - -func getActiveTraces(fam string) traceList { - activeMu.RLock() - s := activeTraces[fam] - activeMu.RUnlock() - if s == nil { - return nil - } - return s.FirstN(maxActiveTraces) -} - -func getFamily(fam string, allocNew bool) *family { - completedMu.RLock() - f := completedTraces[fam] - completedMu.RUnlock() - if f == nil && allocNew { - f = allocFamily(fam) - } - return f -} - -func allocFamily(fam string) *family { - completedMu.Lock() - defer completedMu.Unlock() - f := completedTraces[fam] - if f == nil { - f = newFamily() - completedTraces[fam] = f - } - return f -} - -// family represents a set of trace buckets and associated latency information. -type family struct { - // traces may occur in multiple buckets. - Buckets [bucketsPerFamily]*traceBucket - - // latency time series - LatencyMu sync.RWMutex - Latency *timeseries.MinuteHourSeries -} - -func newFamily() *family { - return &family{ - Buckets: [bucketsPerFamily]*traceBucket{ - {Cond: minCond(0)}, - {Cond: minCond(50 * time.Millisecond)}, - {Cond: minCond(100 * time.Millisecond)}, - {Cond: minCond(200 * time.Millisecond)}, - {Cond: minCond(500 * time.Millisecond)}, - {Cond: minCond(1 * time.Second)}, - {Cond: minCond(10 * time.Second)}, - {Cond: minCond(100 * time.Second)}, - {Cond: errorCond{}}, - }, - Latency: timeseries.NewMinuteHourSeries(func() timeseries.Observable { return new(histogram) }), - } -} - -// traceBucket represents a size-capped bucket of historic traces, -// along with a condition for a trace to belong to the bucket. -type traceBucket struct { - Cond cond - - // Ring buffer implementation of a fixed-size FIFO queue. - mu sync.RWMutex - buf [tracesPerBucket]*trace - start int // < tracesPerBucket - length int // <= tracesPerBucket -} - -func (b *traceBucket) Add(tr *trace) { - b.mu.Lock() - defer b.mu.Unlock() - - i := b.start + b.length - if i >= tracesPerBucket { - i -= tracesPerBucket - } - if b.length == tracesPerBucket { - // "Remove" an element from the bucket. - b.buf[i].unref() - b.start++ - if b.start == tracesPerBucket { - b.start = 0 - } - } - b.buf[i] = tr - if b.length < tracesPerBucket { - b.length++ - } - tr.ref() -} - -// Copy returns a copy of the traces in the bucket. -// If tracedOnly is true, only the traces with trace information will be returned. -// The logs will be ref'd before returning; the caller should call -// the Free method when it is done with them. -// TODO(dsymonds): keep track of traced requests in separate buckets. -func (b *traceBucket) Copy(tracedOnly bool) traceList { - b.mu.RLock() - defer b.mu.RUnlock() - - trl := make(traceList, 0, b.length) - for i, x := 0, b.start; i < b.length; i++ { - tr := b.buf[x] - if !tracedOnly || tr.spanID != 0 { - tr.ref() - trl = append(trl, tr) - } - x++ - if x == b.length { - x = 0 - } - } - return trl -} - -func (b *traceBucket) Empty() bool { - b.mu.RLock() - defer b.mu.RUnlock() - return b.length == 0 -} - -// cond represents a condition on a trace. -type cond interface { - match(t *trace) bool - String() string -} - -type minCond time.Duration - -func (m minCond) match(t *trace) bool { return t.Elapsed >= time.Duration(m) } -func (m minCond) String() string { return fmt.Sprintf("≥%gs", time.Duration(m).Seconds()) } - -type errorCond struct{} - -func (e errorCond) match(t *trace) bool { return t.IsError } -func (e errorCond) String() string { return "errors" } - -type traceList []*trace - -// Free calls unref on each element of the list. -func (trl traceList) Free() { - for _, t := range trl { - t.unref() - } -} - -// traceList may be sorted in reverse chronological order. -func (trl traceList) Len() int { return len(trl) } -func (trl traceList) Less(i, j int) bool { return trl[i].Start.After(trl[j].Start) } -func (trl traceList) Swap(i, j int) { trl[i], trl[j] = trl[j], trl[i] } - -// An event is a timestamped log entry in a trace. -type event struct { - When time.Time - Elapsed time.Duration // since previous event in trace - NewDay bool // whether this event is on a different day to the previous event - Recyclable bool // whether this event was passed via LazyLog - What interface{} // string or fmt.Stringer - Sensitive bool // whether this event contains sensitive information -} - -// WhenString returns a string representation of the elapsed time of the event. -// It will include the date if midnight was crossed. -func (e event) WhenString() string { - if e.NewDay { - return e.When.Format("2006/01/02 15:04:05.000000") - } - return e.When.Format("15:04:05.000000") -} - -// discarded represents a number of discarded events. -// It is stored as *discarded to make it easier to update in-place. -type discarded int - -func (d *discarded) String() string { - return fmt.Sprintf("(%d events discarded)", int(*d)) -} - -// trace represents an active or complete request, -// either sent or received by this program. -type trace struct { - // Family is the top-level grouping of traces to which this belongs. - Family string - - // Title is the title of this trace. - Title string - - // Timing information. - Start time.Time - Elapsed time.Duration // zero while active - - // Trace information if non-zero. - traceID uint64 - spanID uint64 - - // Whether this trace resulted in an error. - IsError bool - - // Append-only sequence of events (modulo discards). - mu sync.RWMutex - events []event - - refs int32 // how many buckets this is in - recycler func(interface{}) - disc discarded // scratch space to avoid allocation - - finishStack []byte // where finish was called, if DebugUseAfterFinish is set -} - -func (tr *trace) reset() { - // Clear all but the mutex. Mutexes may not be copied, even when unlocked. - tr.Family = "" - tr.Title = "" - tr.Start = time.Time{} - tr.Elapsed = 0 - tr.traceID = 0 - tr.spanID = 0 - tr.IsError = false - tr.events = nil - tr.refs = 0 - tr.recycler = nil - tr.disc = 0 - tr.finishStack = nil -} - -// delta returns the elapsed time since the last event or the trace start, -// and whether it spans midnight. -// L >= tr.mu -func (tr *trace) delta(t time.Time) (time.Duration, bool) { - if len(tr.events) == 0 { - return t.Sub(tr.Start), false - } - prev := tr.events[len(tr.events)-1].When - return t.Sub(prev), prev.Day() != t.Day() -} - -func (tr *trace) addEvent(x interface{}, recyclable, sensitive bool) { - if DebugUseAfterFinish && tr.finishStack != nil { - buf := make([]byte, 4<<10) // 4 KB should be enough - n := runtime.Stack(buf, false) - log.Printf("net/trace: trace used after finish:\nFinished at:\n%s\nUsed at:\n%s", tr.finishStack, buf[:n]) - } - - /* - NOTE TO DEBUGGERS - - If you are here because your program panicked in this code, - it is almost definitely the fault of code using this package, - and very unlikely to be the fault of this code. - - The most likely scenario is that some code elsewhere is using - a requestz.Trace after its Finish method is called. - You can temporarily set the DebugUseAfterFinish var - to help discover where that is; do not leave that var set, - since it makes this package much less efficient. - */ - - e := event{When: time.Now(), What: x, Recyclable: recyclable, Sensitive: sensitive} - tr.mu.Lock() - e.Elapsed, e.NewDay = tr.delta(e.When) - if len(tr.events) < cap(tr.events) { - tr.events = append(tr.events, e) - } else { - // Discard the middle events. - di := int((cap(tr.events) - 1) / 2) - if d, ok := tr.events[di].What.(*discarded); ok { - (*d)++ - } else { - // disc starts at two to count for the event it is replacing, - // plus the next one that we are about to drop. - tr.disc = 2 - if tr.recycler != nil && tr.events[di].Recyclable { - go tr.recycler(tr.events[di].What) - } - tr.events[di].What = &tr.disc - } - // The timestamp of the discarded meta-event should be - // the time of the last event it is representing. - tr.events[di].When = tr.events[di+1].When - - if tr.recycler != nil && tr.events[di+1].Recyclable { - go tr.recycler(tr.events[di+1].What) - } - copy(tr.events[di+1:], tr.events[di+2:]) - tr.events[cap(tr.events)-1] = e - } - tr.mu.Unlock() -} - -func (tr *trace) LazyLog(x fmt.Stringer, sensitive bool) { - tr.addEvent(x, true, sensitive) -} - -func (tr *trace) LazyPrintf(format string, a ...interface{}) { - tr.addEvent(&lazySprintf{format, a}, false, false) -} - -func (tr *trace) SetError() { tr.IsError = true } - -func (tr *trace) SetRecycler(f func(interface{})) { - tr.recycler = f -} - -func (tr *trace) SetTraceInfo(traceID, spanID uint64) { - tr.traceID, tr.spanID = traceID, spanID -} - -func (tr *trace) SetMaxEvents(m int) { - // Always keep at least three events: first, discarded count, last. - if len(tr.events) == 0 && m > 3 { - tr.events = make([]event, 0, m) - } -} - -func (tr *trace) ref() { - atomic.AddInt32(&tr.refs, 1) -} - -func (tr *trace) unref() { - if atomic.AddInt32(&tr.refs, -1) == 0 { - if tr.recycler != nil { - // freeTrace clears tr, so we hold tr.recycler and tr.events here. - go func(f func(interface{}), es []event) { - for _, e := range es { - if e.Recyclable { - f(e.What) - } - } - }(tr.recycler, tr.events) - } - - freeTrace(tr) - } -} - -func (tr *trace) When() string { - return tr.Start.Format("2006/01/02 15:04:05.000000") -} - -func (tr *trace) ElapsedTime() string { - t := tr.Elapsed - if t == 0 { - // Active trace. - t = time.Since(tr.Start) - } - return fmt.Sprintf("%.6f", t.Seconds()) -} - -func (tr *trace) Events() []event { - tr.mu.RLock() - defer tr.mu.RUnlock() - return tr.events -} - -var traceFreeList = make(chan *trace, 1000) // TODO(dsymonds): Use sync.Pool? - -// newTrace returns a trace ready to use. -func newTrace() *trace { - select { - case tr := <-traceFreeList: - return tr - default: - return new(trace) - } -} - -// freeTrace adds tr to traceFreeList if there's room. -// This is non-blocking. -func freeTrace(tr *trace) { - if DebugUseAfterFinish { - return // never reuse - } - tr.reset() - select { - case traceFreeList <- tr: - default: - } -} - -func elapsed(d time.Duration) string { - b := []byte(fmt.Sprintf("%.6f", d.Seconds())) - - // For subsecond durations, blank all zeros before decimal point, - // and all zeros between the decimal point and the first non-zero digit. - if d < time.Second { - dot := bytes.IndexByte(b, '.') - for i := 0; i < dot; i++ { - b[i] = ' ' - } - for i := dot + 1; i < len(b); i++ { - if b[i] == '0' { - b[i] = ' ' - } else { - break - } - } - } - - return string(b) -} - -var pageTmpl = template.Must(template.New("Page").Funcs(template.FuncMap{ - "elapsed": elapsed, - "add": func(a, b int) int { return a + b }, -}).Parse(pageHTML)) - -const pageHTML = ` -{{template "Prolog" .}} -{{template "StatusTable" .}} -{{template "Epilog" .}} - -{{define "Prolog"}} - - - /debug/requests - - - - -

/debug/requests

-{{end}} {{/* end of Prolog */}} - -{{define "StatusTable"}} - - {{range $fam := .Families}} - - - - {{$n := index $.ActiveTraceCount $fam}} - - - {{$f := index $.CompletedTraces $fam}} - {{range $i, $b := $f.Buckets}} - {{$empty := $b.Empty}} - - {{end}} - - {{$nb := len $f.Buckets}} - - - - - - {{end}} -
{{$fam}} - {{if $n}}{{end}} - [{{$n}} active] - {{if $n}}{{end}} - - {{if not $empty}}{{end}} - [{{.Cond}}] - {{if not $empty}}{{end}} - - [minute] - - [hour] - - [total] -
-{{end}} {{/* end of StatusTable */}} - -{{define "Epilog"}} -{{if $.Traces}} -
-

Family: {{$.Family}}

- -{{if or $.Expanded $.Traced}} - [Normal/Summary] -{{else}} - [Normal/Summary] -{{end}} - -{{if or (not $.Expanded) $.Traced}} - [Normal/Expanded] -{{else}} - [Normal/Expanded] -{{end}} - -{{if not $.Active}} - {{if or $.Expanded (not $.Traced)}} - [Traced/Summary] - {{else}} - [Traced/Summary] - {{end}} - {{if or (not $.Expanded) (not $.Traced)}} - [Traced/Expanded] - {{else}} - [Traced/Expanded] - {{end}} -{{end}} - -{{if $.Total}} -

Showing {{len $.Traces}} of {{$.Total}} traces.

-{{end}} - - - - - {{range $tr := $.Traces}} - - - - - {{/* TODO: include traceID/spanID */}} - - {{if $.Expanded}} - {{range $tr.Events}} - - - - - - {{end}} - {{end}} - {{end}} -
- {{if $.Active}}Active{{else}}Completed{{end}} Requests -
WhenElapsed (s)
{{$tr.When}}{{$tr.ElapsedTime}}{{$tr.Title}}
{{.WhenString}}{{elapsed .Elapsed}}{{if or $.ShowSensitive (not .Sensitive)}}... {{.What}}{{else}}[redacted]{{end}}
-{{end}} {{/* if $.Traces */}} - -{{if $.Histogram}} -

Latency (µs) of {{$.Family}} over {{$.HistogramWindow}}

-{{$.Histogram}} -{{end}} {{/* if $.Histogram */}} - - - -{{end}} {{/* end of Epilog */}} -` diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/text/LICENSE b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/text/LICENSE deleted file mode 100644 index 6a66aea5eaf..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/text/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 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/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/text/secure/bidirule/bidirule.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/text/secure/bidirule/bidirule.go deleted file mode 100644 index a7161bdd9b6..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/text/secure/bidirule/bidirule.go +++ /dev/null @@ -1,342 +0,0 @@ -// Copyright 2016 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 bidirule implements the Bidi Rule defined by RFC 5893. -// -// This package is under development. The API may change without notice and -// without preserving backward compatibility. -package bidirule - -import ( - "errors" - "unicode/utf8" - - "golang.org/x/text/transform" - "golang.org/x/text/unicode/bidi" -) - -// This file contains an implementation of RFC 5893: Right-to-Left Scripts for -// Internationalized Domain Names for Applications (IDNA) -// -// A label is an individual component of a domain name. Labels are usually -// shown separated by dots; for example, the domain name "www.example.com" is -// composed of three labels: "www", "example", and "com". -// -// An RTL label is a label that contains at least one character of class R, AL, -// or AN. An LTR label is any label that is not an RTL label. -// -// A "Bidi domain name" is a domain name that contains at least one RTL label. -// -// The following guarantees can be made based on the above: -// -// o In a domain name consisting of only labels that satisfy the rule, -// the requirements of Section 3 are satisfied. Note that even LTR -// labels and pure ASCII labels have to be tested. -// -// o In a domain name consisting of only LDH labels (as defined in the -// Definitions document [RFC5890]) and labels that satisfy the rule, -// the requirements of Section 3 are satisfied as long as a label -// that starts with an ASCII digit does not come after a -// right-to-left label. -// -// No guarantee is given for other combinations. - -// ErrInvalid indicates a label is invalid according to the Bidi Rule. -var ErrInvalid = errors.New("bidirule: failed Bidi Rule") - -type ruleState uint8 - -const ( - ruleInitial ruleState = iota - ruleLTR - ruleLTRFinal - ruleRTL - ruleRTLFinal - ruleInvalid -) - -type ruleTransition struct { - next ruleState - mask uint16 -} - -var transitions = [...][2]ruleTransition{ - // [2.1] The first character must be a character with Bidi property L, R, or - // AL. If it has the R or AL property, it is an RTL label; if it has the L - // property, it is an LTR label. - ruleInitial: { - {ruleLTRFinal, 1 << bidi.L}, - {ruleRTLFinal, 1< 0, sets runtime.MemProfileRate") - - options = &imports.Options{ - TabWidth: 8, - TabIndent: true, - Comments: true, - Fragment: true, - } - exitCode = 0 -) - -func init() { - flag.BoolVar(&options.AllErrors, "e", false, "report all errors (not just the first 10 on different lines)") - flag.StringVar(&imports.LocalPrefix, "local", "", "put imports beginning with this string after 3rd-party packages") -} - -func report(err error) { - scanner.PrintError(os.Stderr, err) - exitCode = 2 -} - -func usage() { - fmt.Fprintf(os.Stderr, "usage: goimports [flags] [path ...]\n") - flag.PrintDefaults() - os.Exit(2) -} - -func isGoFile(f os.FileInfo) bool { - // ignore non-Go files - name := f.Name() - return !f.IsDir() && !strings.HasPrefix(name, ".") && strings.HasSuffix(name, ".go") -} - -// argumentType is which mode goimports was invoked as. -type argumentType int - -const ( - // fromStdin means the user is piping their source into goimports. - fromStdin argumentType = iota - - // singleArg is the common case from editors, when goimports is run on - // a single file. - singleArg - - // multipleArg is when the user ran "goimports file1.go file2.go" - // or ran goimports on a directory tree. - multipleArg -) - -func processFile(filename string, in io.Reader, out io.Writer, argType argumentType) error { - opt := options - if argType == fromStdin { - nopt := *options - nopt.Fragment = true - opt = &nopt - } - - if in == nil { - f, err := os.Open(filename) - if err != nil { - return err - } - defer f.Close() - in = f - } - - src, err := ioutil.ReadAll(in) - if err != nil { - return err - } - - target := filename - if *srcdir != "" { - // Determine whether the provided -srcdirc is a directory or file - // and then use it to override the target. - // - // See https://github.com/dominikh/go-mode.el/issues/146 - if isFile(*srcdir) { - if argType == multipleArg { - return errors.New("-srcdir value can't be a file when passing multiple arguments or when walking directories") - } - target = *srcdir - } else if argType == singleArg && strings.HasSuffix(*srcdir, ".go") && !isDir(*srcdir) { - // For a file which doesn't exist on disk yet, but might shortly. - // e.g. user in editor opens $DIR/newfile.go and newfile.go doesn't yet exist on disk. - // The goimports on-save hook writes the buffer to a temp file - // first and runs goimports before the actual save to newfile.go. - // The editor's buffer is named "newfile.go" so that is passed to goimports as: - // goimports -srcdir=/gopath/src/pkg/newfile.go /tmp/gofmtXXXXXXXX.go - // and then the editor reloads the result from the tmp file and writes - // it to newfile.go. - target = *srcdir - } else { - // Pretend that file is from *srcdir in order to decide - // visible imports correctly. - target = filepath.Join(*srcdir, filepath.Base(filename)) - } - } - - res, err := imports.Process(target, src, opt) - if err != nil { - return err - } - - if !bytes.Equal(src, res) { - // formatting has changed - if *list { - fmt.Fprintln(out, filename) - } - if *write { - err = ioutil.WriteFile(filename, res, 0) - if err != nil { - return err - } - } - if *doDiff { - data, err := diff(src, res) - if err != nil { - return fmt.Errorf("computing diff: %s", err) - } - fmt.Printf("diff %s gofmt/%s\n", filename, filename) - out.Write(data) - } - } - - if !*list && !*write && !*doDiff { - _, err = out.Write(res) - } - - return err -} - -func visitFile(path string, f os.FileInfo, err error) error { - if err == nil && isGoFile(f) { - err = processFile(path, nil, os.Stdout, multipleArg) - } - if err != nil { - report(err) - } - return nil -} - -func walkDir(path string) { - filepath.Walk(path, visitFile) -} - -func main() { - runtime.GOMAXPROCS(runtime.NumCPU()) - - // call gofmtMain in a separate function - // so that it can use defer and have them - // run before the exit. - gofmtMain() - os.Exit(exitCode) -} - -// parseFlags parses command line flags and returns the paths to process. -// It's a var so that custom implementations can replace it in other files. -var parseFlags = func() []string { - flag.BoolVar(&verbose, "v", false, "verbose logging") - - flag.Parse() - return flag.Args() -} - -func bufferedFileWriter(dest string) (w io.Writer, close func()) { - f, err := os.Create(dest) - if err != nil { - log.Fatal(err) - } - bw := bufio.NewWriter(f) - return bw, func() { - if err := bw.Flush(); err != nil { - log.Fatalf("error flushing %v: %v", dest, err) - } - if err := f.Close(); err != nil { - log.Fatal(err) - } - } -} - -func gofmtMain() { - flag.Usage = usage - paths := parseFlags() - - if *cpuProfile != "" { - bw, flush := bufferedFileWriter(*cpuProfile) - pprof.StartCPUProfile(bw) - defer flush() - defer pprof.StopCPUProfile() - } - // doTrace is a conditionally compiled wrapper around runtime/trace. It is - // used to allow goimports to compile under gccgo, which does not support - // runtime/trace. See https://golang.org/issue/15544. - defer doTrace()() - if *memProfileRate > 0 { - runtime.MemProfileRate = *memProfileRate - bw, flush := bufferedFileWriter(*memProfile) - defer func() { - runtime.GC() // materialize all statistics - if err := pprof.WriteHeapProfile(bw); err != nil { - log.Fatal(err) - } - flush() - }() - } - - if verbose { - log.SetFlags(log.LstdFlags | log.Lmicroseconds) - imports.Debug = true - } - if options.TabWidth < 0 { - fmt.Fprintf(os.Stderr, "negative tabwidth %d\n", options.TabWidth) - exitCode = 2 - return - } - - if len(paths) == 0 { - if err := processFile("", os.Stdin, os.Stdout, fromStdin); err != nil { - report(err) - } - return - } - - argType := singleArg - if len(paths) > 1 { - argType = multipleArg - } - - for _, path := range paths { - switch dir, err := os.Stat(path); { - case err != nil: - report(err) - case dir.IsDir(): - walkDir(path) - default: - if err := processFile(path, nil, os.Stdout, argType); err != nil { - report(err) - } - } - } -} - -func diff(b1, b2 []byte) (data []byte, err error) { - f1, err := ioutil.TempFile("", "gofmt") - if err != nil { - return - } - defer os.Remove(f1.Name()) - defer f1.Close() - - f2, err := ioutil.TempFile("", "gofmt") - if err != nil { - return - } - defer os.Remove(f2.Name()) - defer f2.Close() - - f1.Write(b1) - f2.Write(b2) - - data, err = exec.Command("diff", "-u", f1.Name(), f2.Name()).CombinedOutput() - if len(data) > 0 { - // diff exits with a non-zero status when the files don't match. - // Ignore that failure as long as we get output. - err = nil - } - return -} - -// isFile reports whether name is a file. -func isFile(name string) bool { - fi, err := os.Stat(name) - return err == nil && fi.Mode().IsRegular() -} - -// isDir reports whether name is a directory. -func isDir(name string) bool { - fi, err := os.Stat(name) - return err == nil && fi.IsDir() -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/cmd/goimports/goimports_gc.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/cmd/goimports/goimports_gc.go deleted file mode 100644 index 21d867eaab5..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/cmd/goimports/goimports_gc.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2016 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. - -// +build gc - -package main - -import ( - "flag" - "runtime/trace" -) - -var traceProfile = flag.String("trace", "", "trace profile output") - -func doTrace() func() { - if *traceProfile != "" { - bw, flush := bufferedFileWriter(*traceProfile) - trace.Start(bw) - return func() { - flush() - trace.Stop() - } - } - return func() {} -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/cmd/goimports/goimports_not_gc.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/cmd/goimports/goimports_not_gc.go deleted file mode 100644 index f5531ceb317..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/cmd/goimports/goimports_not_gc.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2016 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. - -// +build !gc - -package main - -func doTrace() func() { - return func() {} -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/enclosing.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/enclosing.go deleted file mode 100644 index 6b7052b892c..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/enclosing.go +++ /dev/null @@ -1,627 +0,0 @@ -// Copyright 2013 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 astutil - -// This file defines utilities for working with source positions. - -import ( - "fmt" - "go/ast" - "go/token" - "sort" -) - -// PathEnclosingInterval returns the node that encloses the source -// interval [start, end), and all its ancestors up to the AST root. -// -// The definition of "enclosing" used by this function considers -// additional whitespace abutting a node to be enclosed by it. -// In this example: -// -// z := x + y // add them -// <-A-> -// <----B-----> -// -// the ast.BinaryExpr(+) node is considered to enclose interval B -// even though its [Pos()..End()) is actually only interval A. -// This behaviour makes user interfaces more tolerant of imperfect -// input. -// -// This function treats tokens as nodes, though they are not included -// in the result. e.g. PathEnclosingInterval("+") returns the -// enclosing ast.BinaryExpr("x + y"). -// -// If start==end, the 1-char interval following start is used instead. -// -// The 'exact' result is true if the interval contains only path[0] -// and perhaps some adjacent whitespace. It is false if the interval -// overlaps multiple children of path[0], or if it contains only -// interior whitespace of path[0]. -// In this example: -// -// z := x + y // add them -// <--C--> <---E--> -// ^ -// D -// -// intervals C, D and E are inexact. C is contained by the -// z-assignment statement, because it spans three of its children (:=, -// x, +). So too is the 1-char interval D, because it contains only -// interior whitespace of the assignment. E is considered interior -// whitespace of the BlockStmt containing the assignment. -// -// Precondition: [start, end) both lie within the same file as root. -// TODO(adonovan): return (nil, false) in this case and remove precond. -// Requires FileSet; see loader.tokenFileContainsPos. -// -// Postcondition: path is never nil; it always contains at least 'root'. -// -func PathEnclosingInterval(root *ast.File, start, end token.Pos) (path []ast.Node, exact bool) { - // fmt.Printf("EnclosingInterval %d %d\n", start, end) // debugging - - // Precondition: node.[Pos..End) and adjoining whitespace contain [start, end). - var visit func(node ast.Node) bool - visit = func(node ast.Node) bool { - path = append(path, node) - - nodePos := node.Pos() - nodeEnd := node.End() - - // fmt.Printf("visit(%T, %d, %d)\n", node, nodePos, nodeEnd) // debugging - - // Intersect [start, end) with interval of node. - if start < nodePos { - start = nodePos - } - if end > nodeEnd { - end = nodeEnd - } - - // Find sole child that contains [start, end). - children := childrenOf(node) - l := len(children) - for i, child := range children { - // [childPos, childEnd) is unaugmented interval of child. - childPos := child.Pos() - childEnd := child.End() - - // [augPos, augEnd) is whitespace-augmented interval of child. - augPos := childPos - augEnd := childEnd - if i > 0 { - augPos = children[i-1].End() // start of preceding whitespace - } - if i < l-1 { - nextChildPos := children[i+1].Pos() - // Does [start, end) lie between child and next child? - if start >= augEnd && end <= nextChildPos { - return false // inexact match - } - augEnd = nextChildPos // end of following whitespace - } - - // fmt.Printf("\tchild %d: [%d..%d)\tcontains interval [%d..%d)?\n", - // i, augPos, augEnd, start, end) // debugging - - // Does augmented child strictly contain [start, end)? - if augPos <= start && end <= augEnd { - _, isToken := child.(tokenNode) - return isToken || visit(child) - } - - // Does [start, end) overlap multiple children? - // i.e. left-augmented child contains start - // but LR-augmented child does not contain end. - if start < childEnd && end > augEnd { - break - } - } - - // No single child contained [start, end), - // so node is the result. Is it exact? - - // (It's tempting to put this condition before the - // child loop, but it gives the wrong result in the - // case where a node (e.g. ExprStmt) and its sole - // child have equal intervals.) - if start == nodePos && end == nodeEnd { - return true // exact match - } - - return false // inexact: overlaps multiple children - } - - if start > end { - start, end = end, start - } - - if start < root.End() && end > root.Pos() { - if start == end { - end = start + 1 // empty interval => interval of size 1 - } - exact = visit(root) - - // Reverse the path: - for i, l := 0, len(path); i < l/2; i++ { - path[i], path[l-1-i] = path[l-1-i], path[i] - } - } else { - // Selection lies within whitespace preceding the - // first (or following the last) declaration in the file. - // The result nonetheless always includes the ast.File. - path = append(path, root) - } - - return -} - -// tokenNode is a dummy implementation of ast.Node for a single token. -// They are used transiently by PathEnclosingInterval but never escape -// this package. -// -type tokenNode struct { - pos token.Pos - end token.Pos -} - -func (n tokenNode) Pos() token.Pos { - return n.pos -} - -func (n tokenNode) End() token.Pos { - return n.end -} - -func tok(pos token.Pos, len int) ast.Node { - return tokenNode{pos, pos + token.Pos(len)} -} - -// childrenOf returns the direct non-nil children of ast.Node n. -// It may include fake ast.Node implementations for bare tokens. -// it is not safe to call (e.g.) ast.Walk on such nodes. -// -func childrenOf(n ast.Node) []ast.Node { - var children []ast.Node - - // First add nodes for all true subtrees. - ast.Inspect(n, func(node ast.Node) bool { - if node == n { // push n - return true // recur - } - if node != nil { // push child - children = append(children, node) - } - return false // no recursion - }) - - // Then add fake Nodes for bare tokens. - switch n := n.(type) { - case *ast.ArrayType: - children = append(children, - tok(n.Lbrack, len("[")), - tok(n.Elt.End(), len("]"))) - - case *ast.AssignStmt: - children = append(children, - tok(n.TokPos, len(n.Tok.String()))) - - case *ast.BasicLit: - children = append(children, - tok(n.ValuePos, len(n.Value))) - - case *ast.BinaryExpr: - children = append(children, tok(n.OpPos, len(n.Op.String()))) - - case *ast.BlockStmt: - children = append(children, - tok(n.Lbrace, len("{")), - tok(n.Rbrace, len("}"))) - - case *ast.BranchStmt: - children = append(children, - tok(n.TokPos, len(n.Tok.String()))) - - case *ast.CallExpr: - children = append(children, - tok(n.Lparen, len("(")), - tok(n.Rparen, len(")"))) - if n.Ellipsis != 0 { - children = append(children, tok(n.Ellipsis, len("..."))) - } - - case *ast.CaseClause: - if n.List == nil { - children = append(children, - tok(n.Case, len("default"))) - } else { - children = append(children, - tok(n.Case, len("case"))) - } - children = append(children, tok(n.Colon, len(":"))) - - case *ast.ChanType: - switch n.Dir { - case ast.RECV: - children = append(children, tok(n.Begin, len("<-chan"))) - case ast.SEND: - children = append(children, tok(n.Begin, len("chan<-"))) - case ast.RECV | ast.SEND: - children = append(children, tok(n.Begin, len("chan"))) - } - - case *ast.CommClause: - if n.Comm == nil { - children = append(children, - tok(n.Case, len("default"))) - } else { - children = append(children, - tok(n.Case, len("case"))) - } - children = append(children, tok(n.Colon, len(":"))) - - case *ast.Comment: - // nop - - case *ast.CommentGroup: - // nop - - case *ast.CompositeLit: - children = append(children, - tok(n.Lbrace, len("{")), - tok(n.Rbrace, len("{"))) - - case *ast.DeclStmt: - // nop - - case *ast.DeferStmt: - children = append(children, - tok(n.Defer, len("defer"))) - - case *ast.Ellipsis: - children = append(children, - tok(n.Ellipsis, len("..."))) - - case *ast.EmptyStmt: - // nop - - case *ast.ExprStmt: - // nop - - case *ast.Field: - // TODO(adonovan): Field.{Doc,Comment,Tag}? - - case *ast.FieldList: - children = append(children, - tok(n.Opening, len("(")), - tok(n.Closing, len(")"))) - - case *ast.File: - // TODO test: Doc - children = append(children, - tok(n.Package, len("package"))) - - case *ast.ForStmt: - children = append(children, - tok(n.For, len("for"))) - - case *ast.FuncDecl: - // TODO(adonovan): FuncDecl.Comment? - - // Uniquely, FuncDecl breaks the invariant that - // preorder traversal yields tokens in lexical order: - // in fact, FuncDecl.Recv precedes FuncDecl.Type.Func. - // - // As a workaround, we inline the case for FuncType - // here and order things correctly. - // - children = nil // discard ast.Walk(FuncDecl) info subtrees - children = append(children, tok(n.Type.Func, len("func"))) - if n.Recv != nil { - children = append(children, n.Recv) - } - children = append(children, n.Name) - if n.Type.Params != nil { - children = append(children, n.Type.Params) - } - if n.Type.Results != nil { - children = append(children, n.Type.Results) - } - if n.Body != nil { - children = append(children, n.Body) - } - - case *ast.FuncLit: - // nop - - case *ast.FuncType: - if n.Func != 0 { - children = append(children, - tok(n.Func, len("func"))) - } - - case *ast.GenDecl: - children = append(children, - tok(n.TokPos, len(n.Tok.String()))) - if n.Lparen != 0 { - children = append(children, - tok(n.Lparen, len("(")), - tok(n.Rparen, len(")"))) - } - - case *ast.GoStmt: - children = append(children, - tok(n.Go, len("go"))) - - case *ast.Ident: - children = append(children, - tok(n.NamePos, len(n.Name))) - - case *ast.IfStmt: - children = append(children, - tok(n.If, len("if"))) - - case *ast.ImportSpec: - // TODO(adonovan): ImportSpec.{Doc,EndPos}? - - case *ast.IncDecStmt: - children = append(children, - tok(n.TokPos, len(n.Tok.String()))) - - case *ast.IndexExpr: - children = append(children, - tok(n.Lbrack, len("{")), - tok(n.Rbrack, len("}"))) - - case *ast.InterfaceType: - children = append(children, - tok(n.Interface, len("interface"))) - - case *ast.KeyValueExpr: - children = append(children, - tok(n.Colon, len(":"))) - - case *ast.LabeledStmt: - children = append(children, - tok(n.Colon, len(":"))) - - case *ast.MapType: - children = append(children, - tok(n.Map, len("map"))) - - case *ast.ParenExpr: - children = append(children, - tok(n.Lparen, len("(")), - tok(n.Rparen, len(")"))) - - case *ast.RangeStmt: - children = append(children, - tok(n.For, len("for")), - tok(n.TokPos, len(n.Tok.String()))) - - case *ast.ReturnStmt: - children = append(children, - tok(n.Return, len("return"))) - - case *ast.SelectStmt: - children = append(children, - tok(n.Select, len("select"))) - - case *ast.SelectorExpr: - // nop - - case *ast.SendStmt: - children = append(children, - tok(n.Arrow, len("<-"))) - - case *ast.SliceExpr: - children = append(children, - tok(n.Lbrack, len("[")), - tok(n.Rbrack, len("]"))) - - case *ast.StarExpr: - children = append(children, tok(n.Star, len("*"))) - - case *ast.StructType: - children = append(children, tok(n.Struct, len("struct"))) - - case *ast.SwitchStmt: - children = append(children, tok(n.Switch, len("switch"))) - - case *ast.TypeAssertExpr: - children = append(children, - tok(n.Lparen-1, len(".")), - tok(n.Lparen, len("(")), - tok(n.Rparen, len(")"))) - - case *ast.TypeSpec: - // TODO(adonovan): TypeSpec.{Doc,Comment}? - - case *ast.TypeSwitchStmt: - children = append(children, tok(n.Switch, len("switch"))) - - case *ast.UnaryExpr: - children = append(children, tok(n.OpPos, len(n.Op.String()))) - - case *ast.ValueSpec: - // TODO(adonovan): ValueSpec.{Doc,Comment}? - - case *ast.BadDecl, *ast.BadExpr, *ast.BadStmt: - // nop - } - - // TODO(adonovan): opt: merge the logic of ast.Inspect() into - // the switch above so we can make interleaved callbacks for - // both Nodes and Tokens in the right order and avoid the need - // to sort. - sort.Sort(byPos(children)) - - return children -} - -type byPos []ast.Node - -func (sl byPos) Len() int { - return len(sl) -} -func (sl byPos) Less(i, j int) bool { - return sl[i].Pos() < sl[j].Pos() -} -func (sl byPos) Swap(i, j int) { - sl[i], sl[j] = sl[j], sl[i] -} - -// NodeDescription returns a description of the concrete type of n suitable -// for a user interface. -// -// TODO(adonovan): in some cases (e.g. Field, FieldList, Ident, -// StarExpr) we could be much more specific given the path to the AST -// root. Perhaps we should do that. -// -func NodeDescription(n ast.Node) string { - switch n := n.(type) { - case *ast.ArrayType: - return "array type" - case *ast.AssignStmt: - return "assignment" - case *ast.BadDecl: - return "bad declaration" - case *ast.BadExpr: - return "bad expression" - case *ast.BadStmt: - return "bad statement" - case *ast.BasicLit: - return "basic literal" - case *ast.BinaryExpr: - return fmt.Sprintf("binary %s operation", n.Op) - case *ast.BlockStmt: - return "block" - case *ast.BranchStmt: - switch n.Tok { - case token.BREAK: - return "break statement" - case token.CONTINUE: - return "continue statement" - case token.GOTO: - return "goto statement" - case token.FALLTHROUGH: - return "fall-through statement" - } - case *ast.CallExpr: - if len(n.Args) == 1 && !n.Ellipsis.IsValid() { - return "function call (or conversion)" - } - return "function call" - case *ast.CaseClause: - return "case clause" - case *ast.ChanType: - return "channel type" - case *ast.CommClause: - return "communication clause" - case *ast.Comment: - return "comment" - case *ast.CommentGroup: - return "comment group" - case *ast.CompositeLit: - return "composite literal" - case *ast.DeclStmt: - return NodeDescription(n.Decl) + " statement" - case *ast.DeferStmt: - return "defer statement" - case *ast.Ellipsis: - return "ellipsis" - case *ast.EmptyStmt: - return "empty statement" - case *ast.ExprStmt: - return "expression statement" - case *ast.Field: - // Can be any of these: - // struct {x, y int} -- struct field(s) - // struct {T} -- anon struct field - // interface {I} -- interface embedding - // interface {f()} -- interface method - // func (A) func(B) C -- receiver, param(s), result(s) - return "field/method/parameter" - case *ast.FieldList: - return "field/method/parameter list" - case *ast.File: - return "source file" - case *ast.ForStmt: - return "for loop" - case *ast.FuncDecl: - return "function declaration" - case *ast.FuncLit: - return "function literal" - case *ast.FuncType: - return "function type" - case *ast.GenDecl: - switch n.Tok { - case token.IMPORT: - return "import declaration" - case token.CONST: - return "constant declaration" - case token.TYPE: - return "type declaration" - case token.VAR: - return "variable declaration" - } - case *ast.GoStmt: - return "go statement" - case *ast.Ident: - return "identifier" - case *ast.IfStmt: - return "if statement" - case *ast.ImportSpec: - return "import specification" - case *ast.IncDecStmt: - if n.Tok == token.INC { - return "increment statement" - } - return "decrement statement" - case *ast.IndexExpr: - return "index expression" - case *ast.InterfaceType: - return "interface type" - case *ast.KeyValueExpr: - return "key/value association" - case *ast.LabeledStmt: - return "statement label" - case *ast.MapType: - return "map type" - case *ast.Package: - return "package" - case *ast.ParenExpr: - return "parenthesized " + NodeDescription(n.X) - case *ast.RangeStmt: - return "range loop" - case *ast.ReturnStmt: - return "return statement" - case *ast.SelectStmt: - return "select statement" - case *ast.SelectorExpr: - return "selector" - case *ast.SendStmt: - return "channel send" - case *ast.SliceExpr: - return "slice expression" - case *ast.StarExpr: - return "*-operation" // load/store expr or pointer type - case *ast.StructType: - return "struct type" - case *ast.SwitchStmt: - return "switch statement" - case *ast.TypeAssertExpr: - return "type assertion" - case *ast.TypeSpec: - return "type specification" - case *ast.TypeSwitchStmt: - return "type switch" - case *ast.UnaryExpr: - return fmt.Sprintf("unary %s operation", n.Op) - case *ast.ValueSpec: - return "value specification" - - } - panic(fmt.Sprintf("unexpected node type: %T", n)) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/imports.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/imports.go deleted file mode 100644 index 2e81f4d3ae2..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/imports.go +++ /dev/null @@ -1,449 +0,0 @@ -// Copyright 2013 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 astutil contains common utilities for working with the Go AST. -package astutil // import "golang.org/x/tools/go/ast/astutil" - -import ( - "fmt" - "go/ast" - "go/token" - "strconv" - "strings" -) - -// AddImport adds the import path to the file f, if absent. -func AddImport(fset *token.FileSet, f *ast.File, ipath string) (added bool) { - return AddNamedImport(fset, f, "", ipath) -} - -// AddNamedImport adds the import path to the file f, if absent. -// If name is not empty, it is used to rename the import. -// -// For example, calling -// AddNamedImport(fset, f, "pathpkg", "path") -// adds -// import pathpkg "path" -func AddNamedImport(fset *token.FileSet, f *ast.File, name, ipath string) (added bool) { - if imports(f, ipath) { - return false - } - - newImport := &ast.ImportSpec{ - Path: &ast.BasicLit{ - Kind: token.STRING, - Value: strconv.Quote(ipath), - }, - } - if name != "" { - newImport.Name = &ast.Ident{Name: name} - } - - // Find an import decl to add to. - // The goal is to find an existing import - // whose import path has the longest shared - // prefix with ipath. - var ( - bestMatch = -1 // length of longest shared prefix - lastImport = -1 // index in f.Decls of the file's final import decl - impDecl *ast.GenDecl // import decl containing the best match - impIndex = -1 // spec index in impDecl containing the best match - ) - for i, decl := range f.Decls { - gen, ok := decl.(*ast.GenDecl) - if ok && gen.Tok == token.IMPORT { - lastImport = i - // Do not add to import "C", to avoid disrupting the - // association with its doc comment, breaking cgo. - if declImports(gen, "C") { - continue - } - - // Match an empty import decl if that's all that is available. - if len(gen.Specs) == 0 && bestMatch == -1 { - impDecl = gen - } - - // Compute longest shared prefix with imports in this group. - for j, spec := range gen.Specs { - impspec := spec.(*ast.ImportSpec) - n := matchLen(importPath(impspec), ipath) - if n > bestMatch { - bestMatch = n - impDecl = gen - impIndex = j - } - } - } - } - - // If no import decl found, add one after the last import. - if impDecl == nil { - impDecl = &ast.GenDecl{ - Tok: token.IMPORT, - } - if lastImport >= 0 { - impDecl.TokPos = f.Decls[lastImport].End() - } else { - // There are no existing imports. - // Our new import goes after the package declaration and after - // the comment, if any, that starts on the same line as the - // package declaration. - impDecl.TokPos = f.Package - - file := fset.File(f.Package) - pkgLine := file.Line(f.Package) - for _, c := range f.Comments { - if file.Line(c.Pos()) > pkgLine { - break - } - impDecl.TokPos = c.End() - } - } - f.Decls = append(f.Decls, nil) - copy(f.Decls[lastImport+2:], f.Decls[lastImport+1:]) - f.Decls[lastImport+1] = impDecl - } - - // Insert new import at insertAt. - insertAt := 0 - if impIndex >= 0 { - // insert after the found import - insertAt = impIndex + 1 - } - impDecl.Specs = append(impDecl.Specs, nil) - copy(impDecl.Specs[insertAt+1:], impDecl.Specs[insertAt:]) - impDecl.Specs[insertAt] = newImport - pos := impDecl.Pos() - if insertAt > 0 { - // If there is a comment after an existing import, preserve the comment - // position by adding the new import after the comment. - if spec, ok := impDecl.Specs[insertAt-1].(*ast.ImportSpec); ok && spec.Comment != nil { - pos = spec.Comment.End() - } else { - // Assign same position as the previous import, - // so that the sorter sees it as being in the same block. - pos = impDecl.Specs[insertAt-1].Pos() - } - } - if newImport.Name != nil { - newImport.Name.NamePos = pos - } - newImport.Path.ValuePos = pos - newImport.EndPos = pos - - // Clean up parens. impDecl contains at least one spec. - if len(impDecl.Specs) == 1 { - // Remove unneeded parens. - impDecl.Lparen = token.NoPos - } else if !impDecl.Lparen.IsValid() { - // impDecl needs parens added. - impDecl.Lparen = impDecl.Specs[0].Pos() - } - - f.Imports = append(f.Imports, newImport) - - if len(f.Decls) <= 1 { - return true - } - - // Merge all the import declarations into the first one. - var first *ast.GenDecl - for i := 0; i < len(f.Decls); i++ { - decl := f.Decls[i] - gen, ok := decl.(*ast.GenDecl) - if !ok || gen.Tok != token.IMPORT || declImports(gen, "C") { - continue - } - if first == nil { - first = gen - continue // Don't touch the first one. - } - // We now know there is more than one package in this import - // declaration. Ensure that it ends up parenthesized. - first.Lparen = first.Pos() - // Move the imports of the other import declaration to the first one. - for _, spec := range gen.Specs { - spec.(*ast.ImportSpec).Path.ValuePos = first.Pos() - first.Specs = append(first.Specs, spec) - } - f.Decls = append(f.Decls[:i], f.Decls[i+1:]...) - i-- - } - - return true -} - -// DeleteImport deletes the import path from the file f, if present. -func DeleteImport(fset *token.FileSet, f *ast.File, path string) (deleted bool) { - return DeleteNamedImport(fset, f, "", path) -} - -// DeleteNamedImport deletes the import with the given name and path from the file f, if present. -func DeleteNamedImport(fset *token.FileSet, f *ast.File, name, path string) (deleted bool) { - var delspecs []*ast.ImportSpec - var delcomments []*ast.CommentGroup - - // Find the import nodes that import path, if any. - for i := 0; i < len(f.Decls); i++ { - decl := f.Decls[i] - gen, ok := decl.(*ast.GenDecl) - if !ok || gen.Tok != token.IMPORT { - continue - } - for j := 0; j < len(gen.Specs); j++ { - spec := gen.Specs[j] - impspec := spec.(*ast.ImportSpec) - if impspec.Name == nil && name != "" { - continue - } - if impspec.Name != nil && impspec.Name.Name != name { - continue - } - if importPath(impspec) != path { - continue - } - - // We found an import spec that imports path. - // Delete it. - delspecs = append(delspecs, impspec) - deleted = true - copy(gen.Specs[j:], gen.Specs[j+1:]) - gen.Specs = gen.Specs[:len(gen.Specs)-1] - - // If this was the last import spec in this decl, - // delete the decl, too. - if len(gen.Specs) == 0 { - copy(f.Decls[i:], f.Decls[i+1:]) - f.Decls = f.Decls[:len(f.Decls)-1] - i-- - break - } else if len(gen.Specs) == 1 { - if impspec.Doc != nil { - delcomments = append(delcomments, impspec.Doc) - } - if impspec.Comment != nil { - delcomments = append(delcomments, impspec.Comment) - } - for _, cg := range f.Comments { - // Found comment on the same line as the import spec. - if cg.End() < impspec.Pos() && fset.Position(cg.End()).Line == fset.Position(impspec.Pos()).Line { - delcomments = append(delcomments, cg) - break - } - } - - gen.Lparen = token.NoPos // drop parens - spec := gen.Specs[0].(*ast.ImportSpec) - if spec.Doc != nil { - // Move the documentation above the import statement. - gen.TokPos = spec.Doc.End() + 1 - } - - for _, cg := range f.Comments { - if cg.End() < spec.Pos() && fset.Position(cg.End()).Line == fset.Position(spec.Pos()).Line { - for fset.Position(gen.TokPos).Line != fset.Position(spec.Pos()).Line { - fset.File(gen.TokPos).MergeLine(fset.Position(gen.TokPos).Line) - } - break - } - } - } - if j > 0 { - lastImpspec := gen.Specs[j-1].(*ast.ImportSpec) - lastLine := fset.Position(lastImpspec.Path.ValuePos).Line - line := fset.Position(impspec.Path.ValuePos).Line - - // We deleted an entry but now there may be - // a blank line-sized hole where the import was. - if line-lastLine > 1 { - // There was a blank line immediately preceding the deleted import, - // so there's no need to close the hole. - // Do nothing. - } else { - // There was no blank line. Close the hole. - fset.File(gen.Rparen).MergeLine(line) - } - } - j-- - } - } - - // Delete imports from f.Imports. - for i := 0; i < len(f.Imports); i++ { - imp := f.Imports[i] - for j, del := range delspecs { - if imp == del { - copy(f.Imports[i:], f.Imports[i+1:]) - f.Imports = f.Imports[:len(f.Imports)-1] - copy(delspecs[j:], delspecs[j+1:]) - delspecs = delspecs[:len(delspecs)-1] - i-- - break - } - } - } - - // Delete comments from f.Comments. - for i := 0; i < len(f.Comments); i++ { - cg := f.Comments[i] - for j, del := range delcomments { - if cg == del { - copy(f.Comments[i:], f.Comments[i+1:]) - f.Comments = f.Comments[:len(f.Comments)-1] - copy(delcomments[j:], delcomments[j+1:]) - delcomments = delcomments[:len(delcomments)-1] - i-- - break - } - } - } - - if len(delspecs) > 0 { - panic(fmt.Sprintf("deleted specs from Decls but not Imports: %v", delspecs)) - } - - return -} - -// RewriteImport rewrites any import of path oldPath to path newPath. -func RewriteImport(fset *token.FileSet, f *ast.File, oldPath, newPath string) (rewrote bool) { - for _, imp := range f.Imports { - if importPath(imp) == oldPath { - rewrote = true - // record old End, because the default is to compute - // it using the length of imp.Path.Value. - imp.EndPos = imp.End() - imp.Path.Value = strconv.Quote(newPath) - } - } - return -} - -// UsesImport reports whether a given import is used. -func UsesImport(f *ast.File, path string) (used bool) { - spec := importSpec(f, path) - if spec == nil { - return - } - - name := spec.Name.String() - switch name { - case "": - // If the package name is not explicitly specified, - // make an educated guess. This is not guaranteed to be correct. - lastSlash := strings.LastIndex(path, "/") - if lastSlash == -1 { - name = path - } else { - name = path[lastSlash+1:] - } - case "_", ".": - // Not sure if this import is used - err on the side of caution. - return true - } - - ast.Walk(visitFn(func(n ast.Node) { - sel, ok := n.(*ast.SelectorExpr) - if ok && isTopName(sel.X, name) { - used = true - } - }), f) - - return -} - -type visitFn func(node ast.Node) - -func (fn visitFn) Visit(node ast.Node) ast.Visitor { - fn(node) - return fn -} - -// imports returns true if f imports path. -func imports(f *ast.File, path string) bool { - return importSpec(f, path) != nil -} - -// importSpec returns the import spec if f imports path, -// or nil otherwise. -func importSpec(f *ast.File, path string) *ast.ImportSpec { - for _, s := range f.Imports { - if importPath(s) == path { - return s - } - } - return nil -} - -// importPath returns the unquoted import path of s, -// or "" if the path is not properly quoted. -func importPath(s *ast.ImportSpec) string { - t, err := strconv.Unquote(s.Path.Value) - if err == nil { - return t - } - return "" -} - -// declImports reports whether gen contains an import of path. -func declImports(gen *ast.GenDecl, path string) bool { - if gen.Tok != token.IMPORT { - return false - } - for _, spec := range gen.Specs { - impspec := spec.(*ast.ImportSpec) - if importPath(impspec) == path { - return true - } - } - return false -} - -// matchLen returns the length of the longest path segment prefix shared by x and y. -func matchLen(x, y string) int { - n := 0 - for i := 0; i < len(x) && i < len(y) && x[i] == y[i]; i++ { - if x[i] == '/' { - n++ - } - } - return n -} - -// isTopName returns true if n is a top-level unresolved identifier with the given name. -func isTopName(n ast.Expr, name string) bool { - id, ok := n.(*ast.Ident) - return ok && id.Name == name && id.Obj == nil -} - -// Imports returns the file imports grouped by paragraph. -func Imports(fset *token.FileSet, f *ast.File) [][]*ast.ImportSpec { - var groups [][]*ast.ImportSpec - - for _, decl := range f.Decls { - genDecl, ok := decl.(*ast.GenDecl) - if !ok || genDecl.Tok != token.IMPORT { - break - } - - group := []*ast.ImportSpec{} - - var lastLine int - for _, spec := range genDecl.Specs { - importSpec := spec.(*ast.ImportSpec) - pos := importSpec.Path.ValuePos - line := fset.Position(pos).Line - if lastLine > 0 && pos > 0 && line-lastLine > 1 { - groups = append(groups, group) - group = []*ast.ImportSpec{} - } - group = append(group, importSpec) - lastLine = line - } - groups = append(groups, group) - } - - return groups -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/util.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/util.go deleted file mode 100644 index 7630629824a..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/go/ast/astutil/util.go +++ /dev/null @@ -1,14 +0,0 @@ -package astutil - -import "go/ast" - -// Unparen returns e with any enclosing parentheses stripped. -func Unparen(e ast.Expr) ast.Expr { - for { - p, ok := e.(*ast.ParenExpr) - if !ok { - return e - } - e = p.X - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk.go deleted file mode 100644 index 157c79225b4..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk.go +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2016 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. - -// A faster implementation of filepath.Walk. -// -// filepath.Walk's design necessarily calls os.Lstat on each file, -// even if the caller needs less info. And goimports only need to know -// the type of each file. The kernel interface provides the type in -// the Readdir call but the standard library ignored it. -// fastwalk_unix.go contains a fork of the syscall routines. -// -// See golang.org/issue/16399 - -package imports - -import ( - "errors" - "os" - "path/filepath" - "runtime" -) - -// traverseLink is a sentinel error for fastWalk, similar to filepath.SkipDir. -var traverseLink = errors.New("traverse symlink, assuming target is a directory") - -// fastWalk walks the file tree rooted at root, calling walkFn for -// each file or directory in the tree, including root. -// -// If fastWalk returns filepath.SkipDir, the directory is skipped. -// -// Unlike filepath.Walk: -// * file stat calls must be done by the user. -// The only provided metadata is the file type, which does not include -// any permission bits. -// * multiple goroutines stat the filesystem concurrently. The provided -// walkFn must be safe for concurrent use. -// * fastWalk can follow symlinks if walkFn returns the traverseLink -// sentinel error. It is the walkFn's responsibility to prevent -// fastWalk from going into symlink cycles. -func fastWalk(root string, walkFn func(path string, typ os.FileMode) error) error { - // TODO(bradfitz): make numWorkers configurable? We used a - // minimum of 4 to give the kernel more info about multiple - // things we want, in hopes its I/O scheduling can take - // advantage of that. Hopefully most are in cache. Maybe 4 is - // even too low of a minimum. Profile more. - numWorkers := 4 - if n := runtime.NumCPU(); n > numWorkers { - numWorkers = n - } - w := &walker{ - fn: walkFn, - enqueuec: make(chan walkItem, numWorkers), // buffered for performance - workc: make(chan walkItem, numWorkers), // buffered for performance - donec: make(chan struct{}), - - // buffered for correctness & not leaking goroutines: - resc: make(chan error, numWorkers), - } - defer close(w.donec) - // TODO(bradfitz): start the workers as needed? maybe not worth it. - for i := 0; i < numWorkers; i++ { - go w.doWork() - } - todo := []walkItem{{dir: root}} - out := 0 - for { - workc := w.workc - var workItem walkItem - if len(todo) == 0 { - workc = nil - } else { - workItem = todo[len(todo)-1] - } - select { - case workc <- workItem: - todo = todo[:len(todo)-1] - out++ - case it := <-w.enqueuec: - todo = append(todo, it) - case err := <-w.resc: - out-- - if err != nil { - return err - } - if out == 0 && len(todo) == 0 { - // It's safe to quit here, as long as the buffered - // enqueue channel isn't also readable, which might - // happen if the worker sends both another unit of - // work and its result before the other select was - // scheduled and both w.resc and w.enqueuec were - // readable. - select { - case it := <-w.enqueuec: - todo = append(todo, it) - default: - return nil - } - } - } - } -} - -// doWork reads directories as instructed (via workc) and runs the -// user's callback function. -func (w *walker) doWork() { - for { - select { - case <-w.donec: - return - case it := <-w.workc: - w.resc <- w.walk(it.dir, !it.callbackDone) - } - } -} - -type walker struct { - fn func(path string, typ os.FileMode) error - - donec chan struct{} // closed on fastWalk's return - workc chan walkItem // to workers - enqueuec chan walkItem // from workers - resc chan error // from workers -} - -type walkItem struct { - dir string - callbackDone bool // callback already called; don't do it again -} - -func (w *walker) enqueue(it walkItem) { - select { - case w.enqueuec <- it: - case <-w.donec: - } -} - -func (w *walker) onDirEnt(dirName, baseName string, typ os.FileMode) error { - joined := dirName + string(os.PathSeparator) + baseName - if typ == os.ModeDir { - w.enqueue(walkItem{dir: joined}) - return nil - } - - err := w.fn(joined, typ) - if typ == os.ModeSymlink { - if err == traverseLink { - // Set callbackDone so we don't call it twice for both the - // symlink-as-symlink and the symlink-as-directory later: - w.enqueue(walkItem{dir: joined, callbackDone: true}) - return nil - } - if err == filepath.SkipDir { - // Permit SkipDir on symlinks too. - return nil - } - } - return err -} -func (w *walker) walk(root string, runUserCallback bool) error { - if runUserCallback { - err := w.fn(root, os.ModeDir) - if err == filepath.SkipDir { - return nil - } - if err != nil { - return err - } - } - - return readDir(root, w.onDirEnt) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_dirent_fileno.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_dirent_fileno.go deleted file mode 100644 index f1fd64949db..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_dirent_fileno.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2016 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. - -// +build freebsd openbsd netbsd - -package imports - -import "syscall" - -func direntInode(dirent *syscall.Dirent) uint64 { - return uint64(dirent.Fileno) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_dirent_ino.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_dirent_ino.go deleted file mode 100644 index ee85bc4dd4d..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_dirent_ino.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2016 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. - -// +build linux,!appengine darwin - -package imports - -import "syscall" - -func direntInode(dirent *syscall.Dirent) uint64 { - return uint64(dirent.Ino) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_portable.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_portable.go deleted file mode 100644 index 6c2658347d1..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_portable.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016 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. - -// +build appengine !linux,!darwin,!freebsd,!openbsd,!netbsd - -package imports - -import ( - "io/ioutil" - "os" -) - -// readDir calls fn for each directory entry in dirName. -// It does not descend into directories or follow symlinks. -// If fn returns a non-nil error, readDir returns with that error -// immediately. -func readDir(dirName string, fn func(dirName, entName string, typ os.FileMode) error) error { - fis, err := ioutil.ReadDir(dirName) - if err != nil { - return err - } - for _, fi := range fis { - if err := fn(dirName, fi.Name(), fi.Mode()&os.ModeType); err != nil { - return err - } - } - return nil -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_unix.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_unix.go deleted file mode 100644 index 5854233db92..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fastwalk_unix.go +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright 2016 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. - -// +build linux,!appengine darwin freebsd openbsd netbsd - -package imports - -import ( - "bytes" - "fmt" - "os" - "syscall" - "unsafe" -) - -const blockSize = 8 << 10 - -// unknownFileMode is a sentinel (and bogus) os.FileMode -// value used to represent a syscall.DT_UNKNOWN Dirent.Type. -const unknownFileMode os.FileMode = os.ModeNamedPipe | os.ModeSocket | os.ModeDevice - -func readDir(dirName string, fn func(dirName, entName string, typ os.FileMode) error) error { - fd, err := syscall.Open(dirName, 0, 0) - if err != nil { - return err - } - defer syscall.Close(fd) - - // The buffer must be at least a block long. - buf := make([]byte, blockSize) // stack-allocated; doesn't escape - bufp := 0 // starting read position in buf - nbuf := 0 // end valid data in buf - for { - if bufp >= nbuf { - bufp = 0 - nbuf, err = syscall.ReadDirent(fd, buf) - if err != nil { - return os.NewSyscallError("readdirent", err) - } - if nbuf <= 0 { - return nil - } - } - consumed, name, typ := parseDirEnt(buf[bufp:nbuf]) - bufp += consumed - if name == "" || name == "." || name == ".." { - continue - } - // Fallback for filesystems (like old XFS) that don't - // support Dirent.Type and have DT_UNKNOWN (0) there - // instead. - if typ == unknownFileMode { - fi, err := os.Lstat(dirName + "/" + name) - if err != nil { - // It got deleted in the meantime. - if os.IsNotExist(err) { - continue - } - return err - } - typ = fi.Mode() & os.ModeType - } - if err := fn(dirName, name, typ); err != nil { - return err - } - } -} - -func parseDirEnt(buf []byte) (consumed int, name string, typ os.FileMode) { - // golang.org/issue/15653 - dirent := (*syscall.Dirent)(unsafe.Pointer(&buf[0])) - if v := unsafe.Offsetof(dirent.Reclen) + unsafe.Sizeof(dirent.Reclen); uintptr(len(buf)) < v { - panic(fmt.Sprintf("buf size of %d smaller than dirent header size %d", len(buf), v)) - } - if len(buf) < int(dirent.Reclen) { - panic(fmt.Sprintf("buf size %d < record length %d", len(buf), dirent.Reclen)) - } - consumed = int(dirent.Reclen) - if direntInode(dirent) == 0 { // File absent in directory. - return - } - switch dirent.Type { - case syscall.DT_REG: - typ = 0 - case syscall.DT_DIR: - typ = os.ModeDir - case syscall.DT_LNK: - typ = os.ModeSymlink - case syscall.DT_BLK: - typ = os.ModeDevice - case syscall.DT_FIFO: - typ = os.ModeNamedPipe - case syscall.DT_SOCK: - typ = os.ModeSocket - case syscall.DT_UNKNOWN: - typ = unknownFileMode - default: - // Skip weird things. - // It's probably a DT_WHT (http://lwn.net/Articles/325369/) - // or something. Revisit if/when this package is moved outside - // of goimports. goimports only cares about regular files, - // symlinks, and directories. - return - } - - nameBuf := (*[unsafe.Sizeof(dirent.Name)]byte)(unsafe.Pointer(&dirent.Name[0])) - nameLen := bytes.IndexByte(nameBuf[:], 0) - if nameLen < 0 { - panic("failed to find terminating 0 byte in dirent") - } - - // Special cases for common things: - if nameLen == 1 && nameBuf[0] == '.' { - name = "." - } else if nameLen == 2 && nameBuf[0] == '.' && nameBuf[1] == '.' { - name = ".." - } else { - name = string(nameBuf[:nameLen]) - } - return -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fix.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fix.go deleted file mode 100644 index c74bdd2c02e..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/fix.go +++ /dev/null @@ -1,978 +0,0 @@ -// Copyright 2013 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 imports - -import ( - "bufio" - "bytes" - "fmt" - "go/ast" - "go/build" - "go/parser" - "go/token" - "io/ioutil" - "log" - "os" - "path" - "path/filepath" - "sort" - "strings" - "sync" - - "golang.org/x/tools/go/ast/astutil" -) - -// Debug controls verbose logging. -var Debug = false - -var ( - inTests = false // set true by fix_test.go; if false, no need to use testMu - testMu sync.RWMutex // guards globals reset by tests; used only if inTests -) - -// If set, LocalPrefix instructs Process to sort import paths with the given -// prefix into another group after 3rd-party packages. -var LocalPrefix string - -// importToGroup is a list of functions which map from an import path to -// a group number. -var importToGroup = []func(importPath string) (num int, ok bool){ - func(importPath string) (num int, ok bool) { - if LocalPrefix != "" && strings.HasPrefix(importPath, LocalPrefix) { - return 3, true - } - return - }, - func(importPath string) (num int, ok bool) { - if strings.HasPrefix(importPath, "appengine") { - return 2, true - } - return - }, - func(importPath string) (num int, ok bool) { - if strings.Contains(importPath, ".") { - return 1, true - } - return - }, -} - -func importGroup(importPath string) int { - for _, fn := range importToGroup { - if n, ok := fn(importPath); ok { - return n - } - } - return 0 -} - -// packageInfo is a summary of features found in a package. -type packageInfo struct { - Globals map[string]bool // symbol => true -} - -// dirPackageInfo gets information from other files in the package. -func dirPackageInfo(srcDir, filename string) (*packageInfo, error) { - considerTests := strings.HasSuffix(filename, "_test.go") - - // Handle file from stdin - if _, err := os.Stat(filename); err != nil { - if os.IsNotExist(err) { - return &packageInfo{}, nil - } - return nil, err - } - - fileBase := filepath.Base(filename) - packageFileInfos, err := ioutil.ReadDir(srcDir) - if err != nil { - return nil, err - } - - info := &packageInfo{Globals: make(map[string]bool)} - for _, fi := range packageFileInfos { - if fi.Name() == fileBase || !strings.HasSuffix(fi.Name(), ".go") { - continue - } - if !considerTests && strings.HasSuffix(fi.Name(), "_test.go") { - continue - } - - fileSet := token.NewFileSet() - root, err := parser.ParseFile(fileSet, filepath.Join(srcDir, fi.Name()), nil, 0) - if err != nil { - continue - } - - for _, decl := range root.Decls { - genDecl, ok := decl.(*ast.GenDecl) - if !ok { - continue - } - - for _, spec := range genDecl.Specs { - valueSpec, ok := spec.(*ast.ValueSpec) - if !ok { - continue - } - info.Globals[valueSpec.Names[0].Name] = true - } - } - } - return info, nil -} - -func fixImports(fset *token.FileSet, f *ast.File, filename string) (added []string, err error) { - // refs are a set of possible package references currently unsatisfied by imports. - // first key: either base package (e.g. "fmt") or renamed package - // second key: referenced package symbol (e.g. "Println") - refs := make(map[string]map[string]bool) - - // decls are the current package imports. key is base package or renamed package. - decls := make(map[string]*ast.ImportSpec) - - abs, err := filepath.Abs(filename) - if err != nil { - return nil, err - } - srcDir := filepath.Dir(abs) - if Debug { - log.Printf("fixImports(filename=%q), abs=%q, srcDir=%q ...", filename, abs, srcDir) - } - - var packageInfo *packageInfo - var loadedPackageInfo bool - - // collect potential uses of packages. - var visitor visitFn - visitor = visitFn(func(node ast.Node) ast.Visitor { - if node == nil { - return visitor - } - switch v := node.(type) { - case *ast.ImportSpec: - if v.Name != nil { - decls[v.Name.Name] = v - break - } - ipath := strings.Trim(v.Path.Value, `"`) - if ipath == "C" { - break - } - local := importPathToName(ipath, srcDir) - decls[local] = v - case *ast.SelectorExpr: - xident, ok := v.X.(*ast.Ident) - if !ok { - break - } - if xident.Obj != nil { - // if the parser can resolve it, it's not a package ref - break - } - pkgName := xident.Name - if refs[pkgName] == nil { - refs[pkgName] = make(map[string]bool) - } - if !loadedPackageInfo { - loadedPackageInfo = true - packageInfo, _ = dirPackageInfo(srcDir, filename) - } - if decls[pkgName] == nil && (packageInfo == nil || !packageInfo.Globals[pkgName]) { - refs[pkgName][v.Sel.Name] = true - } - } - return visitor - }) - ast.Walk(visitor, f) - - // Nil out any unused ImportSpecs, to be removed in following passes - unusedImport := map[string]string{} - for pkg, is := range decls { - if refs[pkg] == nil && pkg != "_" && pkg != "." { - name := "" - if is.Name != nil { - name = is.Name.Name - } - unusedImport[strings.Trim(is.Path.Value, `"`)] = name - } - } - for ipath, name := range unusedImport { - if ipath == "C" { - // Don't remove cgo stuff. - continue - } - astutil.DeleteNamedImport(fset, f, name, ipath) - } - - for pkgName, symbols := range refs { - if len(symbols) == 0 { - // skip over packages already imported - delete(refs, pkgName) - } - } - - // Search for imports matching potential package references. - searches := 0 - type result struct { - ipath string // import path (if err == nil) - name string // optional name to rename import as - err error - } - results := make(chan result) - for pkgName, symbols := range refs { - go func(pkgName string, symbols map[string]bool) { - ipath, rename, err := findImport(pkgName, symbols, filename) - r := result{ipath: ipath, err: err} - if rename { - r.name = pkgName - } - results <- r - }(pkgName, symbols) - searches++ - } - for i := 0; i < searches; i++ { - result := <-results - if result.err != nil { - return nil, result.err - } - if result.ipath != "" { - if result.name != "" { - astutil.AddNamedImport(fset, f, result.name, result.ipath) - } else { - astutil.AddImport(fset, f, result.ipath) - } - added = append(added, result.ipath) - } - } - - return added, nil -} - -// importPathToName returns the package name for the given import path. -var importPathToName func(importPath, srcDir string) (packageName string) = importPathToNameGoPath - -// importPathToNameBasic assumes the package name is the base of import path. -func importPathToNameBasic(importPath, srcDir string) (packageName string) { - return path.Base(importPath) -} - -// importPathToNameGoPath finds out the actual package name, as declared in its .go files. -// If there's a problem, it falls back to using importPathToNameBasic. -func importPathToNameGoPath(importPath, srcDir string) (packageName string) { - // Fast path for standard library without going to disk. - if pkg, ok := stdImportPackage[importPath]; ok { - return pkg - } - - pkgName, err := importPathToNameGoPathParse(importPath, srcDir) - if Debug { - log.Printf("importPathToNameGoPathParse(%q, srcDir=%q) = %q, %v", importPath, srcDir, pkgName, err) - } - if err == nil { - return pkgName - } - return importPathToNameBasic(importPath, srcDir) -} - -// importPathToNameGoPathParse is a faster version of build.Import if -// the only thing desired is the package name. It uses build.FindOnly -// to find the directory and then only parses one file in the package, -// trusting that the files in the directory are consistent. -func importPathToNameGoPathParse(importPath, srcDir string) (packageName string, err error) { - buildPkg, err := build.Import(importPath, srcDir, build.FindOnly) - if err != nil { - return "", err - } - d, err := os.Open(buildPkg.Dir) - if err != nil { - return "", err - } - names, err := d.Readdirnames(-1) - d.Close() - if err != nil { - return "", err - } - sort.Strings(names) // to have predictable behavior - var lastErr error - var nfile int - for _, name := range names { - if !strings.HasSuffix(name, ".go") { - continue - } - if strings.HasSuffix(name, "_test.go") { - continue - } - nfile++ - fullFile := filepath.Join(buildPkg.Dir, name) - - fset := token.NewFileSet() - f, err := parser.ParseFile(fset, fullFile, nil, parser.PackageClauseOnly) - if err != nil { - lastErr = err - continue - } - pkgName := f.Name.Name - if pkgName == "documentation" { - // Special case from go/build.ImportDir, not - // handled by ctx.MatchFile. - continue - } - if pkgName == "main" { - // Also skip package main, assuming it's a +build ignore generator or example. - // Since you can't import a package main anyway, there's no harm here. - continue - } - return pkgName, nil - } - if lastErr != nil { - return "", lastErr - } - return "", fmt.Errorf("no importable package found in %d Go files", nfile) -} - -var stdImportPackage = map[string]string{} // "net/http" => "http" - -func init() { - // Nothing in the standard library has a package name not - // matching its import base name. - for _, pkg := range stdlib { - if _, ok := stdImportPackage[pkg]; !ok { - stdImportPackage[pkg] = path.Base(pkg) - } - } -} - -// Directory-scanning state. -var ( - // scanGoRootOnce guards calling scanGoRoot (for $GOROOT) - scanGoRootOnce sync.Once - // scanGoPathOnce guards calling scanGoPath (for $GOPATH) - scanGoPathOnce sync.Once - - // populateIgnoreOnce guards calling populateIgnore - populateIgnoreOnce sync.Once - ignoredDirs []os.FileInfo - - dirScanMu sync.RWMutex - dirScan map[string]*pkg // abs dir path => *pkg -) - -type pkg struct { - dir string // absolute file path to pkg directory ("/usr/lib/go/src/net/http") - importPath string // full pkg import path ("net/http", "foo/bar/vendor/a/b") - importPathShort string // vendorless import path ("net/http", "a/b") -} - -// byImportPathShortLength sorts by the short import path length, breaking ties on the -// import string itself. -type byImportPathShortLength []*pkg - -func (s byImportPathShortLength) Len() int { return len(s) } -func (s byImportPathShortLength) Less(i, j int) bool { - vi, vj := s[i].importPathShort, s[j].importPathShort - return len(vi) < len(vj) || (len(vi) == len(vj) && vi < vj) - -} -func (s byImportPathShortLength) Swap(i, j int) { s[i], s[j] = s[j], s[i] } - -// gate is a semaphore for limiting concurrency. -type gate chan struct{} - -func (g gate) enter() { g <- struct{}{} } -func (g gate) leave() { <-g } - -var visitedSymlinks struct { - sync.Mutex - m map[string]struct{} -} - -// guarded by populateIgnoreOnce; populates ignoredDirs. -func populateIgnore() { - for _, srcDir := range build.Default.SrcDirs() { - if srcDir == filepath.Join(build.Default.GOROOT, "src") { - continue - } - populateIgnoredDirs(srcDir) - } -} - -// populateIgnoredDirs reads an optional config file at /.goimportsignore -// of relative directories to ignore when scanning for go files. -// The provided path is one of the $GOPATH entries with "src" appended. -func populateIgnoredDirs(path string) { - file := filepath.Join(path, ".goimportsignore") - slurp, err := ioutil.ReadFile(file) - if Debug { - if err != nil { - log.Print(err) - } else { - log.Printf("Read %s", file) - } - } - if err != nil { - return - } - bs := bufio.NewScanner(bytes.NewReader(slurp)) - for bs.Scan() { - line := strings.TrimSpace(bs.Text()) - if line == "" || strings.HasPrefix(line, "#") { - continue - } - full := filepath.Join(path, line) - if fi, err := os.Stat(full); err == nil { - ignoredDirs = append(ignoredDirs, fi) - if Debug { - log.Printf("Directory added to ignore list: %s", full) - } - } else if Debug { - log.Printf("Error statting entry in .goimportsignore: %v", err) - } - } -} - -func skipDir(fi os.FileInfo) bool { - for _, ignoredDir := range ignoredDirs { - if os.SameFile(fi, ignoredDir) { - return true - } - } - return false -} - -// shouldTraverse reports whether the symlink fi should, found in dir, -// should be followed. It makes sure symlinks were never visited -// before to avoid symlink loops. -func shouldTraverse(dir string, fi os.FileInfo) bool { - path := filepath.Join(dir, fi.Name()) - target, err := filepath.EvalSymlinks(path) - if err != nil { - if !os.IsNotExist(err) { - fmt.Fprintln(os.Stderr, err) - } - return false - } - ts, err := os.Stat(target) - if err != nil { - fmt.Fprintln(os.Stderr, err) - return false - } - if !ts.IsDir() { - return false - } - if skipDir(ts) { - return false - } - - realParent, err := filepath.EvalSymlinks(dir) - if err != nil { - fmt.Fprint(os.Stderr, err) - return false - } - realPath := filepath.Join(realParent, fi.Name()) - visitedSymlinks.Lock() - defer visitedSymlinks.Unlock() - if visitedSymlinks.m == nil { - visitedSymlinks.m = make(map[string]struct{}) - } - if _, ok := visitedSymlinks.m[realPath]; ok { - return false - } - visitedSymlinks.m[realPath] = struct{}{} - return true -} - -var testHookScanDir = func(dir string) {} - -var scanGoRootDone = make(chan struct{}) // closed when scanGoRoot is done - -func scanGoRoot() { - go func() { - scanGoDirs(true) - close(scanGoRootDone) - }() -} - -func scanGoPath() { scanGoDirs(false) } - -func scanGoDirs(goRoot bool) { - if Debug { - which := "$GOROOT" - if !goRoot { - which = "$GOPATH" - } - log.Printf("scanning " + which) - defer log.Printf("scanned " + which) - } - dirScanMu.Lock() - if dirScan == nil { - dirScan = make(map[string]*pkg) - } - dirScanMu.Unlock() - - for _, srcDir := range build.Default.SrcDirs() { - isGoroot := srcDir == filepath.Join(build.Default.GOROOT, "src") - if isGoroot != goRoot { - continue - } - testHookScanDir(srcDir) - walkFn := func(path string, typ os.FileMode) error { - dir := filepath.Dir(path) - if typ.IsRegular() { - if dir == srcDir { - // Doesn't make sense to have regular files - // directly in your $GOPATH/src or $GOROOT/src. - return nil - } - if !strings.HasSuffix(path, ".go") { - return nil - } - dirScanMu.Lock() - if _, dup := dirScan[dir]; !dup { - importpath := filepath.ToSlash(dir[len(srcDir)+len("/"):]) - dirScan[dir] = &pkg{ - importPath: importpath, - importPathShort: vendorlessImportPath(importpath), - dir: dir, - } - } - dirScanMu.Unlock() - return nil - } - if typ == os.ModeDir { - base := filepath.Base(path) - if base == "" || base[0] == '.' || base[0] == '_' || - base == "testdata" || base == "node_modules" { - return filepath.SkipDir - } - fi, err := os.Lstat(path) - if err == nil && skipDir(fi) { - if Debug { - log.Printf("skipping directory %q under %s", fi.Name(), dir) - } - return filepath.SkipDir - } - return nil - } - if typ == os.ModeSymlink { - base := filepath.Base(path) - if strings.HasPrefix(base, ".#") { - // Emacs noise. - return nil - } - fi, err := os.Lstat(path) - if err != nil { - // Just ignore it. - return nil - } - if shouldTraverse(dir, fi) { - return traverseLink - } - } - return nil - } - if err := fastWalk(srcDir, walkFn); err != nil { - log.Printf("goimports: scanning directory %v: %v", srcDir, err) - } - } -} - -// vendorlessImportPath returns the devendorized version of the provided import path. -// e.g. "foo/bar/vendor/a/b" => "a/b" -func vendorlessImportPath(ipath string) string { - // Devendorize for use in import statement. - if i := strings.LastIndex(ipath, "/vendor/"); i >= 0 { - return ipath[i+len("/vendor/"):] - } - if strings.HasPrefix(ipath, "vendor/") { - return ipath[len("vendor/"):] - } - return ipath -} - -// loadExports returns the set of exported symbols in the package at dir. -// It returns nil on error or if the package name in dir does not match expectPackage. -var loadExports func(expectPackage, dir string) map[string]bool = loadExportsGoPath - -func loadExportsGoPath(expectPackage, dir string) map[string]bool { - if Debug { - log.Printf("loading exports in dir %s (seeking package %s)", dir, expectPackage) - } - exports := make(map[string]bool) - - ctx := build.Default - - // ReadDir is like ioutil.ReadDir, but only returns *.go files - // and filters out _test.go files since they're not relevant - // and only slow things down. - ctx.ReadDir = func(dir string) (notTests []os.FileInfo, err error) { - all, err := ioutil.ReadDir(dir) - if err != nil { - return nil, err - } - notTests = all[:0] - for _, fi := range all { - name := fi.Name() - if strings.HasSuffix(name, ".go") && !strings.HasSuffix(name, "_test.go") { - notTests = append(notTests, fi) - } - } - return notTests, nil - } - - files, err := ctx.ReadDir(dir) - if err != nil { - log.Print(err) - return nil - } - - fset := token.NewFileSet() - - for _, fi := range files { - match, err := ctx.MatchFile(dir, fi.Name()) - if err != nil || !match { - continue - } - fullFile := filepath.Join(dir, fi.Name()) - f, err := parser.ParseFile(fset, fullFile, nil, 0) - if err != nil { - if Debug { - log.Printf("Parsing %s: %v", fullFile, err) - } - return nil - } - pkgName := f.Name.Name - if pkgName == "documentation" { - // Special case from go/build.ImportDir, not - // handled by ctx.MatchFile. - continue - } - if pkgName != expectPackage { - if Debug { - log.Printf("scan of dir %v is not expected package %v (actually %v)", dir, expectPackage, pkgName) - } - return nil - } - for name := range f.Scope.Objects { - if ast.IsExported(name) { - exports[name] = true - } - } - } - - if Debug { - exportList := make([]string, 0, len(exports)) - for k := range exports { - exportList = append(exportList, k) - } - sort.Strings(exportList) - log.Printf("loaded exports in dir %v (package %v): %v", dir, expectPackage, strings.Join(exportList, ", ")) - } - return exports -} - -// findImport searches for a package with the given symbols. -// If no package is found, findImport returns ("", false, nil) -// -// This is declared as a variable rather than a function so goimports -// can be easily extended by adding a file with an init function. -// -// The rename value tells goimports whether to use the package name as -// a local qualifier in an import. For example, if findImports("pkg", -// "X") returns ("foo/bar", rename=true), then goimports adds the -// import line: -// import pkg "foo/bar" -// to satisfy uses of pkg.X in the file. -var findImport func(pkgName string, symbols map[string]bool, filename string) (foundPkg string, rename bool, err error) = findImportGoPath - -// findImportGoPath is the normal implementation of findImport. -// (Some companies have their own internally.) -func findImportGoPath(pkgName string, symbols map[string]bool, filename string) (foundPkg string, rename bool, err error) { - if inTests { - testMu.RLock() - defer testMu.RUnlock() - } - - // Fast path for the standard library. - // In the common case we hopefully never have to scan the GOPATH, which can - // be slow with moving disks. - if pkg, rename, ok := findImportStdlib(pkgName, symbols); ok { - return pkg, rename, nil - } - if pkgName == "rand" && symbols["Read"] { - // Special-case rand.Read. - // - // If findImportStdlib didn't find it above, don't go - // searching for it, lest it find and pick math/rand - // in GOROOT (new as of Go 1.6) - // - // crypto/rand is the safer choice. - return "", false, nil - } - - // TODO(sameer): look at the import lines for other Go files in the - // local directory, since the user is likely to import the same packages - // in the current Go file. Return rename=true when the other Go files - // use a renamed package that's also used in the current file. - - // Read all the $GOPATH/src/.goimportsignore files before scanning directories. - populateIgnoreOnce.Do(populateIgnore) - - // Start scanning the $GOROOT asynchronously, then run the - // GOPATH scan synchronously if needed, and then wait for the - // $GOROOT to finish. - // - // TODO(bradfitz): run each $GOPATH entry async. But nobody - // really has more than one anyway, so low priority. - scanGoRootOnce.Do(scanGoRoot) // async - if !fileInDir(filename, build.Default.GOROOT) { - scanGoPathOnce.Do(scanGoPath) // blocking - } - <-scanGoRootDone - - // Find candidate packages, looking only at their directory names first. - var candidates []*pkg - for _, pkg := range dirScan { - if pkgIsCandidate(filename, pkgName, pkg) { - candidates = append(candidates, pkg) - } - } - - // Sort the candidates by their import package length, - // assuming that shorter package names are better than long - // ones. Note that this sorts by the de-vendored name, so - // there's no "penalty" for vendoring. - sort.Sort(byImportPathShortLength(candidates)) - if Debug { - for i, pkg := range candidates { - log.Printf("%s candidate %d/%d: %v", pkgName, i+1, len(candidates), pkg.importPathShort) - } - } - - // Collect exports for packages with matching names. - - done := make(chan struct{}) // closed when we find the answer - defer close(done) - - rescv := make([]chan *pkg, len(candidates)) - for i := range candidates { - rescv[i] = make(chan *pkg) - } - const maxConcurrentPackageImport = 4 - loadExportsSem := make(chan struct{}, maxConcurrentPackageImport) - - go func() { - for i, pkg := range candidates { - select { - case loadExportsSem <- struct{}{}: - select { - case <-done: - default: - } - case <-done: - return - } - pkg := pkg - resc := rescv[i] - go func() { - if inTests { - testMu.RLock() - defer testMu.RUnlock() - } - defer func() { <-loadExportsSem }() - exports := loadExports(pkgName, pkg.dir) - - // If it doesn't have the right - // symbols, send nil to mean no match. - for symbol := range symbols { - if !exports[symbol] { - pkg = nil - break - } - } - select { - case resc <- pkg: - case <-done: - } - }() - } - }() - for _, resc := range rescv { - pkg := <-resc - if pkg == nil { - continue - } - // If the package name in the source doesn't match the import path's base, - // return true so the rewriter adds a name (import foo "github.com/bar/go-foo") - needsRename := path.Base(pkg.importPath) != pkgName - return pkg.importPathShort, needsRename, nil - } - return "", false, nil -} - -// pkgIsCandidate reports whether pkg is a candidate for satisfying the -// finding which package pkgIdent in the file named by filename is trying -// to refer to. -// -// This check is purely lexical and is meant to be as fast as possible -// because it's run over all $GOPATH directories to filter out poor -// candidates in order to limit the CPU and I/O later parsing the -// exports in candidate packages. -// -// filename is the file being formatted. -// pkgIdent is the package being searched for, like "client" (if -// searching for "client.New") -func pkgIsCandidate(filename, pkgIdent string, pkg *pkg) bool { - // Check "internal" and "vendor" visibility: - if !canUse(filename, pkg.dir) { - return false - } - - // Speed optimization to minimize disk I/O: - // the last two components on disk must contain the - // package name somewhere. - // - // This permits mismatch naming like directory - // "go-foo" being package "foo", or "pkg.v3" being "pkg", - // or directory "google.golang.org/api/cloudbilling/v1" - // being package "cloudbilling", but doesn't - // permit a directory "foo" to be package - // "bar", which is strongly discouraged - // anyway. There's no reason goimports needs - // to be slow just to accomodate that. - lastTwo := lastTwoComponents(pkg.importPathShort) - if strings.Contains(lastTwo, pkgIdent) { - return true - } - if hasHyphenOrUpperASCII(lastTwo) && !hasHyphenOrUpperASCII(pkgIdent) { - lastTwo = lowerASCIIAndRemoveHyphen(lastTwo) - if strings.Contains(lastTwo, pkgIdent) { - return true - } - } - - return false -} - -func hasHyphenOrUpperASCII(s string) bool { - for i := 0; i < len(s); i++ { - b := s[i] - if b == '-' || ('A' <= b && b <= 'Z') { - return true - } - } - return false -} - -func lowerASCIIAndRemoveHyphen(s string) (ret string) { - buf := make([]byte, 0, len(s)) - for i := 0; i < len(s); i++ { - b := s[i] - switch { - case b == '-': - continue - case 'A' <= b && b <= 'Z': - buf = append(buf, b+('a'-'A')) - default: - buf = append(buf, b) - } - } - return string(buf) -} - -// canUse reports whether the package in dir is usable from filename, -// respecting the Go "internal" and "vendor" visibility rules. -func canUse(filename, dir string) bool { - // Fast path check, before any allocations. If it doesn't contain vendor - // or internal, it's not tricky: - // Note that this can false-negative on directories like "notinternal", - // but we check it correctly below. This is just a fast path. - if !strings.Contains(dir, "vendor") && !strings.Contains(dir, "internal") { - return true - } - - dirSlash := filepath.ToSlash(dir) - if !strings.Contains(dirSlash, "/vendor/") && !strings.Contains(dirSlash, "/internal/") && !strings.HasSuffix(dirSlash, "/internal") { - return true - } - // Vendor or internal directory only visible from children of parent. - // That means the path from the current directory to the target directory - // can contain ../vendor or ../internal but not ../foo/vendor or ../foo/internal - // or bar/vendor or bar/internal. - // After stripping all the leading ../, the only okay place to see vendor or internal - // is at the very beginning of the path. - absfile, err := filepath.Abs(filename) - if err != nil { - return false - } - absdir, err := filepath.Abs(dir) - if err != nil { - return false - } - rel, err := filepath.Rel(absfile, absdir) - if err != nil { - return false - } - relSlash := filepath.ToSlash(rel) - if i := strings.LastIndex(relSlash, "../"); i >= 0 { - relSlash = relSlash[i+len("../"):] - } - return !strings.Contains(relSlash, "/vendor/") && !strings.Contains(relSlash, "/internal/") && !strings.HasSuffix(relSlash, "/internal") -} - -// lastTwoComponents returns at most the last two path components -// of v, using either / or \ as the path separator. -func lastTwoComponents(v string) string { - nslash := 0 - for i := len(v) - 1; i >= 0; i-- { - if v[i] == '/' || v[i] == '\\' { - nslash++ - if nslash == 2 { - return v[i:] - } - } - } - return v -} - -type visitFn func(node ast.Node) ast.Visitor - -func (fn visitFn) Visit(node ast.Node) ast.Visitor { - return fn(node) -} - -func findImportStdlib(shortPkg string, symbols map[string]bool) (importPath string, rename, ok bool) { - for symbol := range symbols { - key := shortPkg + "." + symbol - path := stdlib[key] - if path == "" { - if key == "rand.Read" { - continue - } - return "", false, false - } - if importPath != "" && importPath != path { - // Ambiguous. Symbols pointed to different things. - return "", false, false - } - importPath = path - } - if importPath == "" && shortPkg == "rand" && symbols["Read"] { - return "crypto/rand", false, true - } - return importPath, false, importPath != "" -} - -// fileInDir reports whether the provided file path looks like -// it's in dir. (without hitting the filesystem) -func fileInDir(file, dir string) bool { - rest := strings.TrimPrefix(file, dir) - if len(rest) == len(file) { - // dir is not a prefix of file. - return false - } - // Check for boundary: either nothing (file == dir), or a slash. - return len(rest) == 0 || rest[0] == '/' || rest[0] == '\\' -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/imports.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/imports.go deleted file mode 100644 index c26c1946a6b..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/imports.go +++ /dev/null @@ -1,289 +0,0 @@ -// Copyright 2013 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:generate go run mkstdlib.go - -// Package imports implements a Go pretty-printer (like package "go/format") -// that also adds or removes import statements as necessary. -package imports // import "golang.org/x/tools/imports" - -import ( - "bufio" - "bytes" - "fmt" - "go/ast" - "go/format" - "go/parser" - "go/printer" - "go/token" - "io" - "regexp" - "strconv" - "strings" - - "golang.org/x/tools/go/ast/astutil" -) - -// Options specifies options for processing files. -type Options struct { - Fragment bool // Accept fragment of a source file (no package statement) - AllErrors bool // Report all errors (not just the first 10 on different lines) - - Comments bool // Print comments (true if nil *Options provided) - TabIndent bool // Use tabs for indent (true if nil *Options provided) - TabWidth int // Tab width (8 if nil *Options provided) - - FormatOnly bool // Disable the insertion and deletion of imports -} - -// Process formats and adjusts imports for the provided file. -// If opt is nil the defaults are used. -// -// Note that filename's directory influences which imports can be chosen, -// so it is important that filename be accurate. -// To process data ``as if'' it were in filename, pass the data as a non-nil src. -func Process(filename string, src []byte, opt *Options) ([]byte, error) { - if opt == nil { - opt = &Options{Comments: true, TabIndent: true, TabWidth: 8} - } - - fileSet := token.NewFileSet() - file, adjust, err := parse(fileSet, filename, src, opt) - if err != nil { - return nil, err - } - - if !opt.FormatOnly { - _, err = fixImports(fileSet, file, filename) - if err != nil { - return nil, err - } - } - - sortImports(fileSet, file) - imps := astutil.Imports(fileSet, file) - - var spacesBefore []string // import paths we need spaces before - for _, impSection := range imps { - // Within each block of contiguous imports, see if any - // import lines are in different group numbers. If so, - // we'll need to put a space between them so it's - // compatible with gofmt. - lastGroup := -1 - for _, importSpec := range impSection { - importPath, _ := strconv.Unquote(importSpec.Path.Value) - groupNum := importGroup(importPath) - if groupNum != lastGroup && lastGroup != -1 { - spacesBefore = append(spacesBefore, importPath) - } - lastGroup = groupNum - } - - } - - printerMode := printer.UseSpaces - if opt.TabIndent { - printerMode |= printer.TabIndent - } - printConfig := &printer.Config{Mode: printerMode, Tabwidth: opt.TabWidth} - - var buf bytes.Buffer - err = printConfig.Fprint(&buf, fileSet, file) - if err != nil { - return nil, err - } - out := buf.Bytes() - if adjust != nil { - out = adjust(src, out) - } - if len(spacesBefore) > 0 { - out = addImportSpaces(bytes.NewReader(out), spacesBefore) - } - - out, err = format.Source(out) - if err != nil { - return nil, err - } - return out, nil -} - -// parse parses src, which was read from filename, -// as a Go source file or statement list. -func parse(fset *token.FileSet, filename string, src []byte, opt *Options) (*ast.File, func(orig, src []byte) []byte, error) { - parserMode := parser.Mode(0) - if opt.Comments { - parserMode |= parser.ParseComments - } - if opt.AllErrors { - parserMode |= parser.AllErrors - } - - // Try as whole source file. - file, err := parser.ParseFile(fset, filename, src, parserMode) - if err == nil { - return file, nil, nil - } - // If the error is that the source file didn't begin with a - // package line and we accept fragmented input, fall through to - // try as a source fragment. Stop and return on any other error. - if !opt.Fragment || !strings.Contains(err.Error(), "expected 'package'") { - return nil, nil, err - } - - // If this is a declaration list, make it a source file - // by inserting a package clause. - // Insert using a ;, not a newline, so that the line numbers - // in psrc match the ones in src. - psrc := append([]byte("package main;"), src...) - file, err = parser.ParseFile(fset, filename, psrc, parserMode) - if err == nil { - // If a main function exists, we will assume this is a main - // package and leave the file. - if containsMainFunc(file) { - return file, nil, nil - } - - adjust := func(orig, src []byte) []byte { - // Remove the package clause. - // Gofmt has turned the ; into a \n. - src = src[len("package main\n"):] - return matchSpace(orig, src) - } - return file, adjust, nil - } - // If the error is that the source file didn't begin with a - // declaration, fall through to try as a statement list. - // Stop and return on any other error. - if !strings.Contains(err.Error(), "expected declaration") { - return nil, nil, err - } - - // If this is a statement list, make it a source file - // by inserting a package clause and turning the list - // into a function body. This handles expressions too. - // Insert using a ;, not a newline, so that the line numbers - // in fsrc match the ones in src. - fsrc := append(append([]byte("package p; func _() {"), src...), '}') - file, err = parser.ParseFile(fset, filename, fsrc, parserMode) - if err == nil { - adjust := func(orig, src []byte) []byte { - // Remove the wrapping. - // Gofmt has turned the ; into a \n\n. - src = src[len("package p\n\nfunc _() {"):] - src = src[:len(src)-len("}\n")] - // Gofmt has also indented the function body one level. - // Remove that indent. - src = bytes.Replace(src, []byte("\n\t"), []byte("\n"), -1) - return matchSpace(orig, src) - } - return file, adjust, nil - } - - // Failed, and out of options. - return nil, nil, err -} - -// containsMainFunc checks if a file contains a function declaration with the -// function signature 'func main()' -func containsMainFunc(file *ast.File) bool { - for _, decl := range file.Decls { - if f, ok := decl.(*ast.FuncDecl); ok { - if f.Name.Name != "main" { - continue - } - - if len(f.Type.Params.List) != 0 { - continue - } - - if f.Type.Results != nil && len(f.Type.Results.List) != 0 { - continue - } - - return true - } - } - - return false -} - -func cutSpace(b []byte) (before, middle, after []byte) { - i := 0 - for i < len(b) && (b[i] == ' ' || b[i] == '\t' || b[i] == '\n') { - i++ - } - j := len(b) - for j > 0 && (b[j-1] == ' ' || b[j-1] == '\t' || b[j-1] == '\n') { - j-- - } - if i <= j { - return b[:i], b[i:j], b[j:] - } - return nil, nil, b[j:] -} - -// matchSpace reformats src to use the same space context as orig. -// 1) If orig begins with blank lines, matchSpace inserts them at the beginning of src. -// 2) matchSpace copies the indentation of the first non-blank line in orig -// to every non-blank line in src. -// 3) matchSpace copies the trailing space from orig and uses it in place -// of src's trailing space. -func matchSpace(orig []byte, src []byte) []byte { - before, _, after := cutSpace(orig) - i := bytes.LastIndex(before, []byte{'\n'}) - before, indent := before[:i+1], before[i+1:] - - _, src, _ = cutSpace(src) - - var b bytes.Buffer - b.Write(before) - for len(src) > 0 { - line := src - if i := bytes.IndexByte(line, '\n'); i >= 0 { - line, src = line[:i+1], line[i+1:] - } else { - src = nil - } - if len(line) > 0 && line[0] != '\n' { // not blank - b.Write(indent) - } - b.Write(line) - } - b.Write(after) - return b.Bytes() -} - -var impLine = regexp.MustCompile(`^\s+(?:[\w\.]+\s+)?"(.+)"`) - -func addImportSpaces(r io.Reader, breaks []string) []byte { - var out bytes.Buffer - sc := bufio.NewScanner(r) - inImports := false - done := false - for sc.Scan() { - s := sc.Text() - - if !inImports && !done && strings.HasPrefix(s, "import") { - inImports = true - } - if inImports && (strings.HasPrefix(s, "var") || - strings.HasPrefix(s, "func") || - strings.HasPrefix(s, "const") || - strings.HasPrefix(s, "type")) { - done = true - inImports = false - } - if inImports && len(breaks) > 0 { - if m := impLine.FindStringSubmatch(s); m != nil { - if m[1] == string(breaks[0]) { - out.WriteByte('\n') - breaks = breaks[1:] - } - } - } - - fmt.Fprintln(&out, s) - } - return out.Bytes() -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/mkindex.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/mkindex.go deleted file mode 100644 index 755e2394f2d..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/mkindex.go +++ /dev/null @@ -1,173 +0,0 @@ -// +build ignore - -// Copyright 2013 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. - -// Command mkindex creates the file "pkgindex.go" containing an index of the Go -// standard library. The file is intended to be built as part of the imports -// package, so that the package may be used in environments where a GOROOT is -// not available (such as App Engine). -package main - -import ( - "bytes" - "fmt" - "go/ast" - "go/build" - "go/format" - "go/parser" - "go/token" - "io/ioutil" - "log" - "os" - "path" - "path/filepath" - "strings" -) - -var ( - pkgIndex = make(map[string][]pkg) - exports = make(map[string]map[string]bool) -) - -func main() { - // Don't use GOPATH. - ctx := build.Default - ctx.GOPATH = "" - - // Populate pkgIndex global from GOROOT. - for _, path := range ctx.SrcDirs() { - f, err := os.Open(path) - if err != nil { - log.Print(err) - continue - } - children, err := f.Readdir(-1) - f.Close() - if err != nil { - log.Print(err) - continue - } - for _, child := range children { - if child.IsDir() { - loadPkg(path, child.Name()) - } - } - } - // Populate exports global. - for _, ps := range pkgIndex { - for _, p := range ps { - e := loadExports(p.dir) - if e != nil { - exports[p.dir] = e - } - } - } - - // Construct source file. - var buf bytes.Buffer - fmt.Fprint(&buf, pkgIndexHead) - fmt.Fprintf(&buf, "var pkgIndexMaster = %#v\n", pkgIndex) - fmt.Fprintf(&buf, "var exportsMaster = %#v\n", exports) - src := buf.Bytes() - - // Replace main.pkg type name with pkg. - src = bytes.Replace(src, []byte("main.pkg"), []byte("pkg"), -1) - // Replace actual GOROOT with "/go". - src = bytes.Replace(src, []byte(ctx.GOROOT), []byte("/go"), -1) - // Add some line wrapping. - src = bytes.Replace(src, []byte("}, "), []byte("},\n"), -1) - src = bytes.Replace(src, []byte("true, "), []byte("true,\n"), -1) - - var err error - src, err = format.Source(src) - if err != nil { - log.Fatal(err) - } - - // Write out source file. - err = ioutil.WriteFile("pkgindex.go", src, 0644) - if err != nil { - log.Fatal(err) - } -} - -const pkgIndexHead = `package imports - -func init() { - pkgIndexOnce.Do(func() { - pkgIndex.m = pkgIndexMaster - }) - loadExports = func(dir string) map[string]bool { - return exportsMaster[dir] - } -} -` - -type pkg struct { - importpath string // full pkg import path, e.g. "net/http" - dir string // absolute file path to pkg directory e.g. "/usr/lib/go/src/fmt" -} - -var fset = token.NewFileSet() - -func loadPkg(root, importpath string) { - shortName := path.Base(importpath) - if shortName == "testdata" { - return - } - - dir := filepath.Join(root, importpath) - pkgIndex[shortName] = append(pkgIndex[shortName], pkg{ - importpath: importpath, - dir: dir, - }) - - pkgDir, err := os.Open(dir) - if err != nil { - return - } - children, err := pkgDir.Readdir(-1) - pkgDir.Close() - if err != nil { - return - } - for _, child := range children { - name := child.Name() - if name == "" { - continue - } - if c := name[0]; c == '.' || ('0' <= c && c <= '9') { - continue - } - if child.IsDir() { - loadPkg(root, filepath.Join(importpath, name)) - } - } -} - -func loadExports(dir string) map[string]bool { - exports := make(map[string]bool) - buildPkg, err := build.ImportDir(dir, 0) - if err != nil { - if strings.Contains(err.Error(), "no buildable Go source files in") { - return nil - } - log.Printf("could not import %q: %v", dir, err) - return nil - } - for _, file := range buildPkg.GoFiles { - f, err := parser.ParseFile(fset, filepath.Join(dir, file), nil, 0) - if err != nil { - log.Printf("could not parse %q: %v", file, err) - continue - } - for name := range f.Scope.Objects { - if ast.IsExported(name) { - exports[name] = true - } - } - } - return exports -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/mkstdlib.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/mkstdlib.go deleted file mode 100644 index 1e559e9f504..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/mkstdlib.go +++ /dev/null @@ -1,103 +0,0 @@ -// +build ignore - -// mkstdlib generates the zstdlib.go file, containing the Go standard -// library API symbols. It's baked into the binary to avoid scanning -// GOPATH in the common case. -package main - -import ( - "bufio" - "bytes" - "fmt" - "go/format" - "io" - "io/ioutil" - "log" - "os" - "path" - "path/filepath" - "regexp" - "sort" - "strings" -) - -func mustOpen(name string) io.Reader { - f, err := os.Open(name) - if err != nil { - log.Fatal(err) - } - return f -} - -func api(base string) string { - return filepath.Join(os.Getenv("GOROOT"), "api", base) -} - -var sym = regexp.MustCompile(`^pkg (\S+).*?, (?:var|func|type|const) ([A-Z]\w*)`) - -func main() { - var buf bytes.Buffer - outf := func(format string, args ...interface{}) { - fmt.Fprintf(&buf, format, args...) - } - outf("// AUTO-GENERATED BY mkstdlib.go\n\n") - outf("package imports\n") - outf("var stdlib = map[string]string{\n") - f := io.MultiReader( - mustOpen(api("go1.txt")), - mustOpen(api("go1.1.txt")), - mustOpen(api("go1.2.txt")), - mustOpen(api("go1.3.txt")), - mustOpen(api("go1.4.txt")), - mustOpen(api("go1.5.txt")), - mustOpen(api("go1.6.txt")), - mustOpen(api("go1.7.txt")), - ) - sc := bufio.NewScanner(f) - fullImport := map[string]string{} // "zip.NewReader" => "archive/zip" - ambiguous := map[string]bool{} - var keys []string - for sc.Scan() { - l := sc.Text() - has := func(v string) bool { return strings.Contains(l, v) } - if has("struct, ") || has("interface, ") || has(", method (") { - continue - } - if m := sym.FindStringSubmatch(l); m != nil { - full := m[1] - key := path.Base(full) + "." + m[2] - if exist, ok := fullImport[key]; ok { - if exist != full { - ambiguous[key] = true - } - } else { - fullImport[key] = full - keys = append(keys, key) - } - } - } - if err := sc.Err(); err != nil { - log.Fatal(err) - } - sort.Strings(keys) - for _, key := range keys { - if ambiguous[key] { - outf("\t// %q is ambiguous\n", key) - } else { - outf("\t%q: %q,\n", key, fullImport[key]) - } - } - outf("\n") - for _, sym := range [...]string{"Alignof", "ArbitraryType", "Offsetof", "Pointer", "Sizeof"} { - outf("\t%q: %q,\n", "unsafe."+sym, "unsafe") - } - outf("}\n") - fmtbuf, err := format.Source(buf.Bytes()) - if err != nil { - log.Fatal(err) - } - err = ioutil.WriteFile("zstdlib.go", fmtbuf, 0666) - if err != nil { - log.Fatal(err) - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/sortimports.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/sortimports.go deleted file mode 100644 index 653afc51776..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/sortimports.go +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright 2013 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. - -// Hacked up copy of go/ast/import.go - -package imports - -import ( - "go/ast" - "go/token" - "sort" - "strconv" -) - -// sortImports sorts runs of consecutive import lines in import blocks in f. -// It also removes duplicate imports when it is possible to do so without data loss. -func sortImports(fset *token.FileSet, f *ast.File) { - for i, d := range f.Decls { - d, ok := d.(*ast.GenDecl) - if !ok || d.Tok != token.IMPORT { - // Not an import declaration, so we're done. - // Imports are always first. - break - } - - if len(d.Specs) == 0 { - // Empty import block, remove it. - f.Decls = append(f.Decls[:i], f.Decls[i+1:]...) - } - - if !d.Lparen.IsValid() { - // Not a block: sorted by default. - continue - } - - // Identify and sort runs of specs on successive lines. - i := 0 - specs := d.Specs[:0] - for j, s := range d.Specs { - if j > i && fset.Position(s.Pos()).Line > 1+fset.Position(d.Specs[j-1].End()).Line { - // j begins a new run. End this one. - specs = append(specs, sortSpecs(fset, f, d.Specs[i:j])...) - i = j - } - } - specs = append(specs, sortSpecs(fset, f, d.Specs[i:])...) - d.Specs = specs - - // Deduping can leave a blank line before the rparen; clean that up. - if len(d.Specs) > 0 { - lastSpec := d.Specs[len(d.Specs)-1] - lastLine := fset.Position(lastSpec.Pos()).Line - if rParenLine := fset.Position(d.Rparen).Line; rParenLine > lastLine+1 { - fset.File(d.Rparen).MergeLine(rParenLine - 1) - } - } - } -} - -func importPath(s ast.Spec) string { - t, err := strconv.Unquote(s.(*ast.ImportSpec).Path.Value) - if err == nil { - return t - } - return "" -} - -func importName(s ast.Spec) string { - n := s.(*ast.ImportSpec).Name - if n == nil { - return "" - } - return n.Name -} - -func importComment(s ast.Spec) string { - c := s.(*ast.ImportSpec).Comment - if c == nil { - return "" - } - return c.Text() -} - -// collapse indicates whether prev may be removed, leaving only next. -func collapse(prev, next ast.Spec) bool { - if importPath(next) != importPath(prev) || importName(next) != importName(prev) { - return false - } - return prev.(*ast.ImportSpec).Comment == nil -} - -type posSpan struct { - Start token.Pos - End token.Pos -} - -func sortSpecs(fset *token.FileSet, f *ast.File, specs []ast.Spec) []ast.Spec { - // Can't short-circuit here even if specs are already sorted, - // since they might yet need deduplication. - // A lone import, however, may be safely ignored. - if len(specs) <= 1 { - return specs - } - - // Record positions for specs. - pos := make([]posSpan, len(specs)) - for i, s := range specs { - pos[i] = posSpan{s.Pos(), s.End()} - } - - // Identify comments in this range. - // Any comment from pos[0].Start to the final line counts. - lastLine := fset.Position(pos[len(pos)-1].End).Line - cstart := len(f.Comments) - cend := len(f.Comments) - for i, g := range f.Comments { - if g.Pos() < pos[0].Start { - continue - } - if i < cstart { - cstart = i - } - if fset.Position(g.End()).Line > lastLine { - cend = i - break - } - } - comments := f.Comments[cstart:cend] - - // Assign each comment to the import spec preceding it. - importComment := map[*ast.ImportSpec][]*ast.CommentGroup{} - specIndex := 0 - for _, g := range comments { - for specIndex+1 < len(specs) && pos[specIndex+1].Start <= g.Pos() { - specIndex++ - } - s := specs[specIndex].(*ast.ImportSpec) - importComment[s] = append(importComment[s], g) - } - - // Sort the import specs by import path. - // Remove duplicates, when possible without data loss. - // Reassign the import paths to have the same position sequence. - // Reassign each comment to abut the end of its spec. - // Sort the comments by new position. - sort.Sort(byImportSpec(specs)) - - // Dedup. Thanks to our sorting, we can just consider - // adjacent pairs of imports. - deduped := specs[:0] - for i, s := range specs { - if i == len(specs)-1 || !collapse(s, specs[i+1]) { - deduped = append(deduped, s) - } else { - p := s.Pos() - fset.File(p).MergeLine(fset.Position(p).Line) - } - } - specs = deduped - - // Fix up comment positions - for i, s := range specs { - s := s.(*ast.ImportSpec) - if s.Name != nil { - s.Name.NamePos = pos[i].Start - } - s.Path.ValuePos = pos[i].Start - s.EndPos = pos[i].End - for _, g := range importComment[s] { - for _, c := range g.List { - c.Slash = pos[i].End - } - } - } - - sort.Sort(byCommentPos(comments)) - - return specs -} - -type byImportSpec []ast.Spec // slice of *ast.ImportSpec - -func (x byImportSpec) Len() int { return len(x) } -func (x byImportSpec) Swap(i, j int) { x[i], x[j] = x[j], x[i] } -func (x byImportSpec) Less(i, j int) bool { - ipath := importPath(x[i]) - jpath := importPath(x[j]) - - igroup := importGroup(ipath) - jgroup := importGroup(jpath) - if igroup != jgroup { - return igroup < jgroup - } - - if ipath != jpath { - return ipath < jpath - } - iname := importName(x[i]) - jname := importName(x[j]) - - if iname != jname { - return iname < jname - } - return importComment(x[i]) < importComment(x[j]) -} - -type byCommentPos []*ast.CommentGroup - -func (x byCommentPos) Len() int { return len(x) } -func (x byCommentPos) Swap(i, j int) { x[i], x[j] = x[j], x[i] } -func (x byCommentPos) Less(i, j int) bool { return x[i].Pos() < x[j].Pos() } diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/zstdlib.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/zstdlib.go deleted file mode 100644 index 28835da0314..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/golang.org/x/tools/imports/zstdlib.go +++ /dev/null @@ -1,9289 +0,0 @@ -// AUTO-GENERATED BY mkstdlib.go - -package imports - -var stdlib = map[string]string{ - "adler32.Checksum": "hash/adler32", - "adler32.New": "hash/adler32", - "adler32.Size": "hash/adler32", - "aes.BlockSize": "crypto/aes", - "aes.KeySizeError": "crypto/aes", - "aes.NewCipher": "crypto/aes", - "ascii85.CorruptInputError": "encoding/ascii85", - "ascii85.Decode": "encoding/ascii85", - "ascii85.Encode": "encoding/ascii85", - "ascii85.MaxEncodedLen": "encoding/ascii85", - "ascii85.NewDecoder": "encoding/ascii85", - "ascii85.NewEncoder": "encoding/ascii85", - "asn1.BitString": "encoding/asn1", - "asn1.ClassApplication": "encoding/asn1", - "asn1.ClassContextSpecific": "encoding/asn1", - "asn1.ClassPrivate": "encoding/asn1", - "asn1.ClassUniversal": "encoding/asn1", - "asn1.Enumerated": "encoding/asn1", - "asn1.Flag": "encoding/asn1", - "asn1.Marshal": "encoding/asn1", - "asn1.ObjectIdentifier": "encoding/asn1", - "asn1.RawContent": "encoding/asn1", - "asn1.RawValue": "encoding/asn1", - "asn1.StructuralError": "encoding/asn1", - "asn1.SyntaxError": "encoding/asn1", - "asn1.TagBitString": "encoding/asn1", - "asn1.TagBoolean": "encoding/asn1", - "asn1.TagEnum": "encoding/asn1", - "asn1.TagGeneralString": "encoding/asn1", - "asn1.TagGeneralizedTime": "encoding/asn1", - "asn1.TagIA5String": "encoding/asn1", - "asn1.TagInteger": "encoding/asn1", - "asn1.TagOID": "encoding/asn1", - "asn1.TagOctetString": "encoding/asn1", - "asn1.TagPrintableString": "encoding/asn1", - "asn1.TagSequence": "encoding/asn1", - "asn1.TagSet": "encoding/asn1", - "asn1.TagT61String": "encoding/asn1", - "asn1.TagUTCTime": "encoding/asn1", - "asn1.TagUTF8String": "encoding/asn1", - "asn1.Unmarshal": "encoding/asn1", - "asn1.UnmarshalWithParams": "encoding/asn1", - "ast.ArrayType": "go/ast", - "ast.AssignStmt": "go/ast", - "ast.Bad": "go/ast", - "ast.BadDecl": "go/ast", - "ast.BadExpr": "go/ast", - "ast.BadStmt": "go/ast", - "ast.BasicLit": "go/ast", - "ast.BinaryExpr": "go/ast", - "ast.BlockStmt": "go/ast", - "ast.BranchStmt": "go/ast", - "ast.CallExpr": "go/ast", - "ast.CaseClause": "go/ast", - "ast.ChanDir": "go/ast", - "ast.ChanType": "go/ast", - "ast.CommClause": "go/ast", - "ast.Comment": "go/ast", - "ast.CommentGroup": "go/ast", - "ast.CommentMap": "go/ast", - "ast.CompositeLit": "go/ast", - "ast.Con": "go/ast", - "ast.DeclStmt": "go/ast", - "ast.DeferStmt": "go/ast", - "ast.Ellipsis": "go/ast", - "ast.EmptyStmt": "go/ast", - "ast.ExprStmt": "go/ast", - "ast.Field": "go/ast", - "ast.FieldFilter": "go/ast", - "ast.FieldList": "go/ast", - "ast.File": "go/ast", - "ast.FileExports": "go/ast", - "ast.Filter": "go/ast", - "ast.FilterDecl": "go/ast", - "ast.FilterFile": "go/ast", - "ast.FilterFuncDuplicates": "go/ast", - "ast.FilterImportDuplicates": "go/ast", - "ast.FilterPackage": "go/ast", - "ast.FilterUnassociatedComments": "go/ast", - "ast.ForStmt": "go/ast", - "ast.Fprint": "go/ast", - "ast.Fun": "go/ast", - "ast.FuncDecl": "go/ast", - "ast.FuncLit": "go/ast", - "ast.FuncType": "go/ast", - "ast.GenDecl": "go/ast", - "ast.GoStmt": "go/ast", - "ast.Ident": "go/ast", - "ast.IfStmt": "go/ast", - "ast.ImportSpec": "go/ast", - "ast.Importer": "go/ast", - "ast.IncDecStmt": "go/ast", - "ast.IndexExpr": "go/ast", - "ast.Inspect": "go/ast", - "ast.InterfaceType": "go/ast", - "ast.IsExported": "go/ast", - "ast.KeyValueExpr": "go/ast", - "ast.LabeledStmt": "go/ast", - "ast.Lbl": "go/ast", - "ast.MapType": "go/ast", - "ast.MergeMode": "go/ast", - "ast.MergePackageFiles": "go/ast", - "ast.NewCommentMap": "go/ast", - "ast.NewIdent": "go/ast", - "ast.NewObj": "go/ast", - "ast.NewPackage": "go/ast", - "ast.NewScope": "go/ast", - "ast.Node": "go/ast", - "ast.NotNilFilter": "go/ast", - "ast.ObjKind": "go/ast", - "ast.Object": "go/ast", - "ast.Package": "go/ast", - "ast.PackageExports": "go/ast", - "ast.ParenExpr": "go/ast", - "ast.Pkg": "go/ast", - "ast.Print": "go/ast", - "ast.RECV": "go/ast", - "ast.RangeStmt": "go/ast", - "ast.ReturnStmt": "go/ast", - "ast.SEND": "go/ast", - "ast.Scope": "go/ast", - "ast.SelectStmt": "go/ast", - "ast.SelectorExpr": "go/ast", - "ast.SendStmt": "go/ast", - "ast.SliceExpr": "go/ast", - "ast.SortImports": "go/ast", - "ast.StarExpr": "go/ast", - "ast.StructType": "go/ast", - "ast.SwitchStmt": "go/ast", - "ast.Typ": "go/ast", - "ast.TypeAssertExpr": "go/ast", - "ast.TypeSpec": "go/ast", - "ast.TypeSwitchStmt": "go/ast", - "ast.UnaryExpr": "go/ast", - "ast.ValueSpec": "go/ast", - "ast.Var": "go/ast", - "ast.Visitor": "go/ast", - "ast.Walk": "go/ast", - "atomic.AddInt32": "sync/atomic", - "atomic.AddInt64": "sync/atomic", - "atomic.AddUint32": "sync/atomic", - "atomic.AddUint64": "sync/atomic", - "atomic.AddUintptr": "sync/atomic", - "atomic.CompareAndSwapInt32": "sync/atomic", - "atomic.CompareAndSwapInt64": "sync/atomic", - "atomic.CompareAndSwapPointer": "sync/atomic", - "atomic.CompareAndSwapUint32": "sync/atomic", - "atomic.CompareAndSwapUint64": "sync/atomic", - "atomic.CompareAndSwapUintptr": "sync/atomic", - "atomic.LoadInt32": "sync/atomic", - "atomic.LoadInt64": "sync/atomic", - "atomic.LoadPointer": "sync/atomic", - "atomic.LoadUint32": "sync/atomic", - "atomic.LoadUint64": "sync/atomic", - "atomic.LoadUintptr": "sync/atomic", - "atomic.StoreInt32": "sync/atomic", - "atomic.StoreInt64": "sync/atomic", - "atomic.StorePointer": "sync/atomic", - "atomic.StoreUint32": "sync/atomic", - "atomic.StoreUint64": "sync/atomic", - "atomic.StoreUintptr": "sync/atomic", - "atomic.SwapInt32": "sync/atomic", - "atomic.SwapInt64": "sync/atomic", - "atomic.SwapPointer": "sync/atomic", - "atomic.SwapUint32": "sync/atomic", - "atomic.SwapUint64": "sync/atomic", - "atomic.SwapUintptr": "sync/atomic", - "atomic.Value": "sync/atomic", - "base32.CorruptInputError": "encoding/base32", - "base32.Encoding": "encoding/base32", - "base32.HexEncoding": "encoding/base32", - "base32.NewDecoder": "encoding/base32", - "base32.NewEncoder": "encoding/base32", - "base32.NewEncoding": "encoding/base32", - "base32.StdEncoding": "encoding/base32", - "base64.CorruptInputError": "encoding/base64", - "base64.Encoding": "encoding/base64", - "base64.NewDecoder": "encoding/base64", - "base64.NewEncoder": "encoding/base64", - "base64.NewEncoding": "encoding/base64", - "base64.NoPadding": "encoding/base64", - "base64.RawStdEncoding": "encoding/base64", - "base64.RawURLEncoding": "encoding/base64", - "base64.StdEncoding": "encoding/base64", - "base64.StdPadding": "encoding/base64", - "base64.URLEncoding": "encoding/base64", - "big.Above": "math/big", - "big.Accuracy": "math/big", - "big.AwayFromZero": "math/big", - "big.Below": "math/big", - "big.ErrNaN": "math/big", - "big.Exact": "math/big", - "big.Float": "math/big", - "big.Int": "math/big", - "big.Jacobi": "math/big", - "big.MaxBase": "math/big", - "big.MaxExp": "math/big", - "big.MaxPrec": "math/big", - "big.MinExp": "math/big", - "big.NewFloat": "math/big", - "big.NewInt": "math/big", - "big.NewRat": "math/big", - "big.ParseFloat": "math/big", - "big.Rat": "math/big", - "big.RoundingMode": "math/big", - "big.ToNearestAway": "math/big", - "big.ToNearestEven": "math/big", - "big.ToNegativeInf": "math/big", - "big.ToPositiveInf": "math/big", - "big.ToZero": "math/big", - "big.Word": "math/big", - "binary.BigEndian": "encoding/binary", - "binary.ByteOrder": "encoding/binary", - "binary.LittleEndian": "encoding/binary", - "binary.MaxVarintLen16": "encoding/binary", - "binary.MaxVarintLen32": "encoding/binary", - "binary.MaxVarintLen64": "encoding/binary", - "binary.PutUvarint": "encoding/binary", - "binary.PutVarint": "encoding/binary", - "binary.Read": "encoding/binary", - "binary.ReadUvarint": "encoding/binary", - "binary.ReadVarint": "encoding/binary", - "binary.Size": "encoding/binary", - "binary.Uvarint": "encoding/binary", - "binary.Varint": "encoding/binary", - "binary.Write": "encoding/binary", - "bufio.ErrAdvanceTooFar": "bufio", - "bufio.ErrBufferFull": "bufio", - "bufio.ErrFinalToken": "bufio", - "bufio.ErrInvalidUnreadByte": "bufio", - "bufio.ErrInvalidUnreadRune": "bufio", - "bufio.ErrNegativeAdvance": "bufio", - "bufio.ErrNegativeCount": "bufio", - "bufio.ErrTooLong": "bufio", - "bufio.MaxScanTokenSize": "bufio", - "bufio.NewReadWriter": "bufio", - "bufio.NewReader": "bufio", - "bufio.NewReaderSize": "bufio", - "bufio.NewScanner": "bufio", - "bufio.NewWriter": "bufio", - "bufio.NewWriterSize": "bufio", - "bufio.ReadWriter": "bufio", - "bufio.Reader": "bufio", - "bufio.ScanBytes": "bufio", - "bufio.ScanLines": "bufio", - "bufio.ScanRunes": "bufio", - "bufio.ScanWords": "bufio", - "bufio.Scanner": "bufio", - "bufio.SplitFunc": "bufio", - "bufio.Writer": "bufio", - "build.AllowBinary": "go/build", - "build.ArchChar": "go/build", - "build.Context": "go/build", - "build.Default": "go/build", - "build.FindOnly": "go/build", - "build.IgnoreVendor": "go/build", - "build.Import": "go/build", - "build.ImportComment": "go/build", - "build.ImportDir": "go/build", - "build.ImportMode": "go/build", - "build.IsLocalImport": "go/build", - "build.MultiplePackageError": "go/build", - "build.NoGoError": "go/build", - "build.Package": "go/build", - "build.ToolDir": "go/build", - "bytes.Buffer": "bytes", - "bytes.Compare": "bytes", - "bytes.Contains": "bytes", - "bytes.ContainsAny": "bytes", - "bytes.ContainsRune": "bytes", - "bytes.Count": "bytes", - "bytes.Equal": "bytes", - "bytes.EqualFold": "bytes", - "bytes.ErrTooLarge": "bytes", - "bytes.Fields": "bytes", - "bytes.FieldsFunc": "bytes", - "bytes.HasPrefix": "bytes", - "bytes.HasSuffix": "bytes", - "bytes.Index": "bytes", - "bytes.IndexAny": "bytes", - "bytes.IndexByte": "bytes", - "bytes.IndexFunc": "bytes", - "bytes.IndexRune": "bytes", - "bytes.Join": "bytes", - "bytes.LastIndex": "bytes", - "bytes.LastIndexAny": "bytes", - "bytes.LastIndexByte": "bytes", - "bytes.LastIndexFunc": "bytes", - "bytes.Map": "bytes", - "bytes.MinRead": "bytes", - "bytes.NewBuffer": "bytes", - "bytes.NewBufferString": "bytes", - "bytes.NewReader": "bytes", - "bytes.Reader": "bytes", - "bytes.Repeat": "bytes", - "bytes.Replace": "bytes", - "bytes.Runes": "bytes", - "bytes.Split": "bytes", - "bytes.SplitAfter": "bytes", - "bytes.SplitAfterN": "bytes", - "bytes.SplitN": "bytes", - "bytes.Title": "bytes", - "bytes.ToLower": "bytes", - "bytes.ToLowerSpecial": "bytes", - "bytes.ToTitle": "bytes", - "bytes.ToTitleSpecial": "bytes", - "bytes.ToUpper": "bytes", - "bytes.ToUpperSpecial": "bytes", - "bytes.Trim": "bytes", - "bytes.TrimFunc": "bytes", - "bytes.TrimLeft": "bytes", - "bytes.TrimLeftFunc": "bytes", - "bytes.TrimPrefix": "bytes", - "bytes.TrimRight": "bytes", - "bytes.TrimRightFunc": "bytes", - "bytes.TrimSpace": "bytes", - "bytes.TrimSuffix": "bytes", - "bzip2.NewReader": "compress/bzip2", - "bzip2.StructuralError": "compress/bzip2", - "cgi.Handler": "net/http/cgi", - "cgi.Request": "net/http/cgi", - "cgi.RequestFromMap": "net/http/cgi", - "cgi.Serve": "net/http/cgi", - "cipher.AEAD": "crypto/cipher", - "cipher.Block": "crypto/cipher", - "cipher.BlockMode": "crypto/cipher", - "cipher.NewCBCDecrypter": "crypto/cipher", - "cipher.NewCBCEncrypter": "crypto/cipher", - "cipher.NewCFBDecrypter": "crypto/cipher", - "cipher.NewCFBEncrypter": "crypto/cipher", - "cipher.NewCTR": "crypto/cipher", - "cipher.NewGCM": "crypto/cipher", - "cipher.NewGCMWithNonceSize": "crypto/cipher", - "cipher.NewOFB": "crypto/cipher", - "cipher.Stream": "crypto/cipher", - "cipher.StreamReader": "crypto/cipher", - "cipher.StreamWriter": "crypto/cipher", - "cmplx.Abs": "math/cmplx", - "cmplx.Acos": "math/cmplx", - "cmplx.Acosh": "math/cmplx", - "cmplx.Asin": "math/cmplx", - "cmplx.Asinh": "math/cmplx", - "cmplx.Atan": "math/cmplx", - "cmplx.Atanh": "math/cmplx", - "cmplx.Conj": "math/cmplx", - "cmplx.Cos": "math/cmplx", - "cmplx.Cosh": "math/cmplx", - "cmplx.Cot": "math/cmplx", - "cmplx.Exp": "math/cmplx", - "cmplx.Inf": "math/cmplx", - "cmplx.IsInf": "math/cmplx", - "cmplx.IsNaN": "math/cmplx", - "cmplx.Log": "math/cmplx", - "cmplx.Log10": "math/cmplx", - "cmplx.NaN": "math/cmplx", - "cmplx.Phase": "math/cmplx", - "cmplx.Polar": "math/cmplx", - "cmplx.Pow": "math/cmplx", - "cmplx.Rect": "math/cmplx", - "cmplx.Sin": "math/cmplx", - "cmplx.Sinh": "math/cmplx", - "cmplx.Sqrt": "math/cmplx", - "cmplx.Tan": "math/cmplx", - "cmplx.Tanh": "math/cmplx", - "color.Alpha": "image/color", - "color.Alpha16": "image/color", - "color.Alpha16Model": "image/color", - "color.AlphaModel": "image/color", - "color.Black": "image/color", - "color.CMYK": "image/color", - "color.CMYKModel": "image/color", - "color.CMYKToRGB": "image/color", - "color.Color": "image/color", - "color.Gray": "image/color", - "color.Gray16": "image/color", - "color.Gray16Model": "image/color", - "color.GrayModel": "image/color", - "color.Model": "image/color", - "color.ModelFunc": "image/color", - "color.NRGBA": "image/color", - "color.NRGBA64": "image/color", - "color.NRGBA64Model": "image/color", - "color.NRGBAModel": "image/color", - "color.NYCbCrA": "image/color", - "color.NYCbCrAModel": "image/color", - "color.Opaque": "image/color", - "color.Palette": "image/color", - "color.RGBA": "image/color", - "color.RGBA64": "image/color", - "color.RGBA64Model": "image/color", - "color.RGBAModel": "image/color", - "color.RGBToCMYK": "image/color", - "color.RGBToYCbCr": "image/color", - "color.Transparent": "image/color", - "color.White": "image/color", - "color.YCbCr": "image/color", - "color.YCbCrModel": "image/color", - "color.YCbCrToRGB": "image/color", - "constant.BinaryOp": "go/constant", - "constant.BitLen": "go/constant", - "constant.Bool": "go/constant", - "constant.BoolVal": "go/constant", - "constant.Bytes": "go/constant", - "constant.Compare": "go/constant", - "constant.Complex": "go/constant", - "constant.Denom": "go/constant", - "constant.Float": "go/constant", - "constant.Float32Val": "go/constant", - "constant.Float64Val": "go/constant", - "constant.Imag": "go/constant", - "constant.Int": "go/constant", - "constant.Int64Val": "go/constant", - "constant.Kind": "go/constant", - "constant.MakeBool": "go/constant", - "constant.MakeFloat64": "go/constant", - "constant.MakeFromBytes": "go/constant", - "constant.MakeFromLiteral": "go/constant", - "constant.MakeImag": "go/constant", - "constant.MakeInt64": "go/constant", - "constant.MakeString": "go/constant", - "constant.MakeUint64": "go/constant", - "constant.MakeUnknown": "go/constant", - "constant.Num": "go/constant", - "constant.Real": "go/constant", - "constant.Shift": "go/constant", - "constant.Sign": "go/constant", - "constant.String": "go/constant", - "constant.StringVal": "go/constant", - "constant.ToComplex": "go/constant", - "constant.ToFloat": "go/constant", - "constant.ToInt": "go/constant", - "constant.Uint64Val": "go/constant", - "constant.UnaryOp": "go/constant", - "constant.Unknown": "go/constant", - "context.Background": "context", - "context.CancelFunc": "context", - "context.Canceled": "context", - "context.Context": "context", - "context.DeadlineExceeded": "context", - "context.TODO": "context", - "context.WithCancel": "context", - "context.WithDeadline": "context", - "context.WithTimeout": "context", - "context.WithValue": "context", - "cookiejar.Jar": "net/http/cookiejar", - "cookiejar.New": "net/http/cookiejar", - "cookiejar.Options": "net/http/cookiejar", - "cookiejar.PublicSuffixList": "net/http/cookiejar", - "crc32.Castagnoli": "hash/crc32", - "crc32.Checksum": "hash/crc32", - "crc32.ChecksumIEEE": "hash/crc32", - "crc32.IEEE": "hash/crc32", - "crc32.IEEETable": "hash/crc32", - "crc32.Koopman": "hash/crc32", - "crc32.MakeTable": "hash/crc32", - "crc32.New": "hash/crc32", - "crc32.NewIEEE": "hash/crc32", - "crc32.Size": "hash/crc32", - "crc32.Table": "hash/crc32", - "crc32.Update": "hash/crc32", - "crc64.Checksum": "hash/crc64", - "crc64.ECMA": "hash/crc64", - "crc64.ISO": "hash/crc64", - "crc64.MakeTable": "hash/crc64", - "crc64.New": "hash/crc64", - "crc64.Size": "hash/crc64", - "crc64.Table": "hash/crc64", - "crc64.Update": "hash/crc64", - "crypto.Decrypter": "crypto", - "crypto.DecrypterOpts": "crypto", - "crypto.Hash": "crypto", - "crypto.MD4": "crypto", - "crypto.MD5": "crypto", - "crypto.MD5SHA1": "crypto", - "crypto.PrivateKey": "crypto", - "crypto.PublicKey": "crypto", - "crypto.RIPEMD160": "crypto", - "crypto.RegisterHash": "crypto", - "crypto.SHA1": "crypto", - "crypto.SHA224": "crypto", - "crypto.SHA256": "crypto", - "crypto.SHA384": "crypto", - "crypto.SHA3_224": "crypto", - "crypto.SHA3_256": "crypto", - "crypto.SHA3_384": "crypto", - "crypto.SHA3_512": "crypto", - "crypto.SHA512": "crypto", - "crypto.SHA512_224": "crypto", - "crypto.SHA512_256": "crypto", - "crypto.Signer": "crypto", - "crypto.SignerOpts": "crypto", - "csv.ErrBareQuote": "encoding/csv", - "csv.ErrFieldCount": "encoding/csv", - "csv.ErrQuote": "encoding/csv", - "csv.ErrTrailingComma": "encoding/csv", - "csv.NewReader": "encoding/csv", - "csv.NewWriter": "encoding/csv", - "csv.ParseError": "encoding/csv", - "csv.Reader": "encoding/csv", - "csv.Writer": "encoding/csv", - "debug.FreeOSMemory": "runtime/debug", - "debug.GCStats": "runtime/debug", - "debug.PrintStack": "runtime/debug", - "debug.ReadGCStats": "runtime/debug", - "debug.SetGCPercent": "runtime/debug", - "debug.SetMaxStack": "runtime/debug", - "debug.SetMaxThreads": "runtime/debug", - "debug.SetPanicOnFault": "runtime/debug", - "debug.SetTraceback": "runtime/debug", - "debug.Stack": "runtime/debug", - "debug.WriteHeapDump": "runtime/debug", - "des.BlockSize": "crypto/des", - "des.KeySizeError": "crypto/des", - "des.NewCipher": "crypto/des", - "des.NewTripleDESCipher": "crypto/des", - "doc.AllDecls": "go/doc", - "doc.AllMethods": "go/doc", - "doc.Example": "go/doc", - "doc.Examples": "go/doc", - "doc.Filter": "go/doc", - "doc.Func": "go/doc", - "doc.IllegalPrefixes": "go/doc", - "doc.Mode": "go/doc", - "doc.New": "go/doc", - "doc.Note": "go/doc", - "doc.Package": "go/doc", - "doc.Synopsis": "go/doc", - "doc.ToHTML": "go/doc", - "doc.ToText": "go/doc", - "doc.Type": "go/doc", - "doc.Value": "go/doc", - "draw.Draw": "image/draw", - "draw.DrawMask": "image/draw", - "draw.Drawer": "image/draw", - "draw.FloydSteinberg": "image/draw", - "draw.Image": "image/draw", - "draw.Op": "image/draw", - "draw.Over": "image/draw", - "draw.Quantizer": "image/draw", - "draw.Src": "image/draw", - "driver.Bool": "database/sql/driver", - "driver.ColumnConverter": "database/sql/driver", - "driver.Conn": "database/sql/driver", - "driver.DefaultParameterConverter": "database/sql/driver", - "driver.Driver": "database/sql/driver", - "driver.ErrBadConn": "database/sql/driver", - "driver.ErrSkip": "database/sql/driver", - "driver.Execer": "database/sql/driver", - "driver.Int32": "database/sql/driver", - "driver.IsScanValue": "database/sql/driver", - "driver.IsValue": "database/sql/driver", - "driver.NotNull": "database/sql/driver", - "driver.Null": "database/sql/driver", - "driver.Queryer": "database/sql/driver", - "driver.Result": "database/sql/driver", - "driver.ResultNoRows": "database/sql/driver", - "driver.Rows": "database/sql/driver", - "driver.RowsAffected": "database/sql/driver", - "driver.Stmt": "database/sql/driver", - "driver.String": "database/sql/driver", - "driver.Tx": "database/sql/driver", - "driver.Value": "database/sql/driver", - "driver.ValueConverter": "database/sql/driver", - "driver.Valuer": "database/sql/driver", - "dsa.ErrInvalidPublicKey": "crypto/dsa", - "dsa.GenerateKey": "crypto/dsa", - "dsa.GenerateParameters": "crypto/dsa", - "dsa.L1024N160": "crypto/dsa", - "dsa.L2048N224": "crypto/dsa", - "dsa.L2048N256": "crypto/dsa", - "dsa.L3072N256": "crypto/dsa", - "dsa.ParameterSizes": "crypto/dsa", - "dsa.Parameters": "crypto/dsa", - "dsa.PrivateKey": "crypto/dsa", - "dsa.PublicKey": "crypto/dsa", - "dsa.Sign": "crypto/dsa", - "dsa.Verify": "crypto/dsa", - "dwarf.AddrType": "debug/dwarf", - "dwarf.ArrayType": "debug/dwarf", - "dwarf.Attr": "debug/dwarf", - "dwarf.AttrAbstractOrigin": "debug/dwarf", - "dwarf.AttrAccessibility": "debug/dwarf", - "dwarf.AttrAddrClass": "debug/dwarf", - "dwarf.AttrAllocated": "debug/dwarf", - "dwarf.AttrArtificial": "debug/dwarf", - "dwarf.AttrAssociated": "debug/dwarf", - "dwarf.AttrBaseTypes": "debug/dwarf", - "dwarf.AttrBitOffset": "debug/dwarf", - "dwarf.AttrBitSize": "debug/dwarf", - "dwarf.AttrByteSize": "debug/dwarf", - "dwarf.AttrCallColumn": "debug/dwarf", - "dwarf.AttrCallFile": "debug/dwarf", - "dwarf.AttrCallLine": "debug/dwarf", - "dwarf.AttrCalling": "debug/dwarf", - "dwarf.AttrCommonRef": "debug/dwarf", - "dwarf.AttrCompDir": "debug/dwarf", - "dwarf.AttrConstValue": "debug/dwarf", - "dwarf.AttrContainingType": "debug/dwarf", - "dwarf.AttrCount": "debug/dwarf", - "dwarf.AttrDataLocation": "debug/dwarf", - "dwarf.AttrDataMemberLoc": "debug/dwarf", - "dwarf.AttrDeclColumn": "debug/dwarf", - "dwarf.AttrDeclFile": "debug/dwarf", - "dwarf.AttrDeclLine": "debug/dwarf", - "dwarf.AttrDeclaration": "debug/dwarf", - "dwarf.AttrDefaultValue": "debug/dwarf", - "dwarf.AttrDescription": "debug/dwarf", - "dwarf.AttrDiscr": "debug/dwarf", - "dwarf.AttrDiscrList": "debug/dwarf", - "dwarf.AttrDiscrValue": "debug/dwarf", - "dwarf.AttrEncoding": "debug/dwarf", - "dwarf.AttrEntrypc": "debug/dwarf", - "dwarf.AttrExtension": "debug/dwarf", - "dwarf.AttrExternal": "debug/dwarf", - "dwarf.AttrFrameBase": "debug/dwarf", - "dwarf.AttrFriend": "debug/dwarf", - "dwarf.AttrHighpc": "debug/dwarf", - "dwarf.AttrIdentifierCase": "debug/dwarf", - "dwarf.AttrImport": "debug/dwarf", - "dwarf.AttrInline": "debug/dwarf", - "dwarf.AttrIsOptional": "debug/dwarf", - "dwarf.AttrLanguage": "debug/dwarf", - "dwarf.AttrLocation": "debug/dwarf", - "dwarf.AttrLowerBound": "debug/dwarf", - "dwarf.AttrLowpc": "debug/dwarf", - "dwarf.AttrMacroInfo": "debug/dwarf", - "dwarf.AttrName": "debug/dwarf", - "dwarf.AttrNamelistItem": "debug/dwarf", - "dwarf.AttrOrdering": "debug/dwarf", - "dwarf.AttrPriority": "debug/dwarf", - "dwarf.AttrProducer": "debug/dwarf", - "dwarf.AttrPrototyped": "debug/dwarf", - "dwarf.AttrRanges": "debug/dwarf", - "dwarf.AttrReturnAddr": "debug/dwarf", - "dwarf.AttrSegment": "debug/dwarf", - "dwarf.AttrSibling": "debug/dwarf", - "dwarf.AttrSpecification": "debug/dwarf", - "dwarf.AttrStartScope": "debug/dwarf", - "dwarf.AttrStaticLink": "debug/dwarf", - "dwarf.AttrStmtList": "debug/dwarf", - "dwarf.AttrStride": "debug/dwarf", - "dwarf.AttrStrideSize": "debug/dwarf", - "dwarf.AttrStringLength": "debug/dwarf", - "dwarf.AttrTrampoline": "debug/dwarf", - "dwarf.AttrType": "debug/dwarf", - "dwarf.AttrUpperBound": "debug/dwarf", - "dwarf.AttrUseLocation": "debug/dwarf", - "dwarf.AttrUseUTF8": "debug/dwarf", - "dwarf.AttrVarParam": "debug/dwarf", - "dwarf.AttrVirtuality": "debug/dwarf", - "dwarf.AttrVisibility": "debug/dwarf", - "dwarf.AttrVtableElemLoc": "debug/dwarf", - "dwarf.BasicType": "debug/dwarf", - "dwarf.BoolType": "debug/dwarf", - "dwarf.CharType": "debug/dwarf", - "dwarf.Class": "debug/dwarf", - "dwarf.ClassAddress": "debug/dwarf", - "dwarf.ClassBlock": "debug/dwarf", - "dwarf.ClassConstant": "debug/dwarf", - "dwarf.ClassExprLoc": "debug/dwarf", - "dwarf.ClassFlag": "debug/dwarf", - "dwarf.ClassLinePtr": "debug/dwarf", - "dwarf.ClassLocListPtr": "debug/dwarf", - "dwarf.ClassMacPtr": "debug/dwarf", - "dwarf.ClassRangeListPtr": "debug/dwarf", - "dwarf.ClassReference": "debug/dwarf", - "dwarf.ClassReferenceAlt": "debug/dwarf", - "dwarf.ClassReferenceSig": "debug/dwarf", - "dwarf.ClassString": "debug/dwarf", - "dwarf.ClassStringAlt": "debug/dwarf", - "dwarf.ClassUnknown": "debug/dwarf", - "dwarf.CommonType": "debug/dwarf", - "dwarf.ComplexType": "debug/dwarf", - "dwarf.Data": "debug/dwarf", - "dwarf.DecodeError": "debug/dwarf", - "dwarf.DotDotDotType": "debug/dwarf", - "dwarf.Entry": "debug/dwarf", - "dwarf.EnumType": "debug/dwarf", - "dwarf.EnumValue": "debug/dwarf", - "dwarf.ErrUnknownPC": "debug/dwarf", - "dwarf.Field": "debug/dwarf", - "dwarf.FloatType": "debug/dwarf", - "dwarf.FuncType": "debug/dwarf", - "dwarf.IntType": "debug/dwarf", - "dwarf.LineEntry": "debug/dwarf", - "dwarf.LineFile": "debug/dwarf", - "dwarf.LineReader": "debug/dwarf", - "dwarf.LineReaderPos": "debug/dwarf", - "dwarf.New": "debug/dwarf", - "dwarf.Offset": "debug/dwarf", - "dwarf.PtrType": "debug/dwarf", - "dwarf.QualType": "debug/dwarf", - "dwarf.Reader": "debug/dwarf", - "dwarf.StructField": "debug/dwarf", - "dwarf.StructType": "debug/dwarf", - "dwarf.Tag": "debug/dwarf", - "dwarf.TagAccessDeclaration": "debug/dwarf", - "dwarf.TagArrayType": "debug/dwarf", - "dwarf.TagBaseType": "debug/dwarf", - "dwarf.TagCatchDwarfBlock": "debug/dwarf", - "dwarf.TagClassType": "debug/dwarf", - "dwarf.TagCommonDwarfBlock": "debug/dwarf", - "dwarf.TagCommonInclusion": "debug/dwarf", - "dwarf.TagCompileUnit": "debug/dwarf", - "dwarf.TagCondition": "debug/dwarf", - "dwarf.TagConstType": "debug/dwarf", - "dwarf.TagConstant": "debug/dwarf", - "dwarf.TagDwarfProcedure": "debug/dwarf", - "dwarf.TagEntryPoint": "debug/dwarf", - "dwarf.TagEnumerationType": "debug/dwarf", - "dwarf.TagEnumerator": "debug/dwarf", - "dwarf.TagFileType": "debug/dwarf", - "dwarf.TagFormalParameter": "debug/dwarf", - "dwarf.TagFriend": "debug/dwarf", - "dwarf.TagImportedDeclaration": "debug/dwarf", - "dwarf.TagImportedModule": "debug/dwarf", - "dwarf.TagImportedUnit": "debug/dwarf", - "dwarf.TagInheritance": "debug/dwarf", - "dwarf.TagInlinedSubroutine": "debug/dwarf", - "dwarf.TagInterfaceType": "debug/dwarf", - "dwarf.TagLabel": "debug/dwarf", - "dwarf.TagLexDwarfBlock": "debug/dwarf", - "dwarf.TagMember": "debug/dwarf", - "dwarf.TagModule": "debug/dwarf", - "dwarf.TagMutableType": "debug/dwarf", - "dwarf.TagNamelist": "debug/dwarf", - "dwarf.TagNamelistItem": "debug/dwarf", - "dwarf.TagNamespace": "debug/dwarf", - "dwarf.TagPackedType": "debug/dwarf", - "dwarf.TagPartialUnit": "debug/dwarf", - "dwarf.TagPointerType": "debug/dwarf", - "dwarf.TagPtrToMemberType": "debug/dwarf", - "dwarf.TagReferenceType": "debug/dwarf", - "dwarf.TagRestrictType": "debug/dwarf", - "dwarf.TagRvalueReferenceType": "debug/dwarf", - "dwarf.TagSetType": "debug/dwarf", - "dwarf.TagSharedType": "debug/dwarf", - "dwarf.TagStringType": "debug/dwarf", - "dwarf.TagStructType": "debug/dwarf", - "dwarf.TagSubprogram": "debug/dwarf", - "dwarf.TagSubrangeType": "debug/dwarf", - "dwarf.TagSubroutineType": "debug/dwarf", - "dwarf.TagTemplateAlias": "debug/dwarf", - "dwarf.TagTemplateTypeParameter": "debug/dwarf", - "dwarf.TagTemplateValueParameter": "debug/dwarf", - "dwarf.TagThrownType": "debug/dwarf", - "dwarf.TagTryDwarfBlock": "debug/dwarf", - "dwarf.TagTypeUnit": "debug/dwarf", - "dwarf.TagTypedef": "debug/dwarf", - "dwarf.TagUnionType": "debug/dwarf", - "dwarf.TagUnspecifiedParameters": "debug/dwarf", - "dwarf.TagUnspecifiedType": "debug/dwarf", - "dwarf.TagVariable": "debug/dwarf", - "dwarf.TagVariant": "debug/dwarf", - "dwarf.TagVariantPart": "debug/dwarf", - "dwarf.TagVolatileType": "debug/dwarf", - "dwarf.TagWithStmt": "debug/dwarf", - "dwarf.Type": "debug/dwarf", - "dwarf.TypedefType": "debug/dwarf", - "dwarf.UcharType": "debug/dwarf", - "dwarf.UintType": "debug/dwarf", - "dwarf.UnspecifiedType": "debug/dwarf", - "dwarf.VoidType": "debug/dwarf", - "ecdsa.GenerateKey": "crypto/ecdsa", - "ecdsa.PrivateKey": "crypto/ecdsa", - "ecdsa.PublicKey": "crypto/ecdsa", - "ecdsa.Sign": "crypto/ecdsa", - "ecdsa.Verify": "crypto/ecdsa", - "elf.ARM_MAGIC_TRAMP_NUMBER": "debug/elf", - "elf.COMPRESS_HIOS": "debug/elf", - "elf.COMPRESS_HIPROC": "debug/elf", - "elf.COMPRESS_LOOS": "debug/elf", - "elf.COMPRESS_LOPROC": "debug/elf", - "elf.COMPRESS_ZLIB": "debug/elf", - "elf.Chdr32": "debug/elf", - "elf.Chdr64": "debug/elf", - "elf.Class": "debug/elf", - "elf.CompressionType": "debug/elf", - "elf.DF_BIND_NOW": "debug/elf", - "elf.DF_ORIGIN": "debug/elf", - "elf.DF_STATIC_TLS": "debug/elf", - "elf.DF_SYMBOLIC": "debug/elf", - "elf.DF_TEXTREL": "debug/elf", - "elf.DT_BIND_NOW": "debug/elf", - "elf.DT_DEBUG": "debug/elf", - "elf.DT_ENCODING": "debug/elf", - "elf.DT_FINI": "debug/elf", - "elf.DT_FINI_ARRAY": "debug/elf", - "elf.DT_FINI_ARRAYSZ": "debug/elf", - "elf.DT_FLAGS": "debug/elf", - "elf.DT_HASH": "debug/elf", - "elf.DT_HIOS": "debug/elf", - "elf.DT_HIPROC": "debug/elf", - "elf.DT_INIT": "debug/elf", - "elf.DT_INIT_ARRAY": "debug/elf", - "elf.DT_INIT_ARRAYSZ": "debug/elf", - "elf.DT_JMPREL": "debug/elf", - "elf.DT_LOOS": "debug/elf", - "elf.DT_LOPROC": "debug/elf", - "elf.DT_NEEDED": "debug/elf", - "elf.DT_NULL": "debug/elf", - "elf.DT_PLTGOT": "debug/elf", - "elf.DT_PLTREL": "debug/elf", - "elf.DT_PLTRELSZ": "debug/elf", - "elf.DT_PREINIT_ARRAY": "debug/elf", - "elf.DT_PREINIT_ARRAYSZ": "debug/elf", - "elf.DT_REL": "debug/elf", - "elf.DT_RELA": "debug/elf", - "elf.DT_RELAENT": "debug/elf", - "elf.DT_RELASZ": "debug/elf", - "elf.DT_RELENT": "debug/elf", - "elf.DT_RELSZ": "debug/elf", - "elf.DT_RPATH": "debug/elf", - "elf.DT_RUNPATH": "debug/elf", - "elf.DT_SONAME": "debug/elf", - "elf.DT_STRSZ": "debug/elf", - "elf.DT_STRTAB": "debug/elf", - "elf.DT_SYMBOLIC": "debug/elf", - "elf.DT_SYMENT": "debug/elf", - "elf.DT_SYMTAB": "debug/elf", - "elf.DT_TEXTREL": "debug/elf", - "elf.DT_VERNEED": "debug/elf", - "elf.DT_VERNEEDNUM": "debug/elf", - "elf.DT_VERSYM": "debug/elf", - "elf.Data": "debug/elf", - "elf.Dyn32": "debug/elf", - "elf.Dyn64": "debug/elf", - "elf.DynFlag": "debug/elf", - "elf.DynTag": "debug/elf", - "elf.EI_ABIVERSION": "debug/elf", - "elf.EI_CLASS": "debug/elf", - "elf.EI_DATA": "debug/elf", - "elf.EI_NIDENT": "debug/elf", - "elf.EI_OSABI": "debug/elf", - "elf.EI_PAD": "debug/elf", - "elf.EI_VERSION": "debug/elf", - "elf.ELFCLASS32": "debug/elf", - "elf.ELFCLASS64": "debug/elf", - "elf.ELFCLASSNONE": "debug/elf", - "elf.ELFDATA2LSB": "debug/elf", - "elf.ELFDATA2MSB": "debug/elf", - "elf.ELFDATANONE": "debug/elf", - "elf.ELFMAG": "debug/elf", - "elf.ELFOSABI_86OPEN": "debug/elf", - "elf.ELFOSABI_AIX": "debug/elf", - "elf.ELFOSABI_ARM": "debug/elf", - "elf.ELFOSABI_FREEBSD": "debug/elf", - "elf.ELFOSABI_HPUX": "debug/elf", - "elf.ELFOSABI_HURD": "debug/elf", - "elf.ELFOSABI_IRIX": "debug/elf", - "elf.ELFOSABI_LINUX": "debug/elf", - "elf.ELFOSABI_MODESTO": "debug/elf", - "elf.ELFOSABI_NETBSD": "debug/elf", - "elf.ELFOSABI_NONE": "debug/elf", - "elf.ELFOSABI_NSK": "debug/elf", - "elf.ELFOSABI_OPENBSD": "debug/elf", - "elf.ELFOSABI_OPENVMS": "debug/elf", - "elf.ELFOSABI_SOLARIS": "debug/elf", - "elf.ELFOSABI_STANDALONE": "debug/elf", - "elf.ELFOSABI_TRU64": "debug/elf", - "elf.EM_386": "debug/elf", - "elf.EM_486": "debug/elf", - "elf.EM_68HC12": "debug/elf", - "elf.EM_68K": "debug/elf", - "elf.EM_860": "debug/elf", - "elf.EM_88K": "debug/elf", - "elf.EM_960": "debug/elf", - "elf.EM_AARCH64": "debug/elf", - "elf.EM_ALPHA": "debug/elf", - "elf.EM_ALPHA_STD": "debug/elf", - "elf.EM_ARC": "debug/elf", - "elf.EM_ARM": "debug/elf", - "elf.EM_COLDFIRE": "debug/elf", - "elf.EM_FR20": "debug/elf", - "elf.EM_H8S": "debug/elf", - "elf.EM_H8_300": "debug/elf", - "elf.EM_H8_300H": "debug/elf", - "elf.EM_H8_500": "debug/elf", - "elf.EM_IA_64": "debug/elf", - "elf.EM_M32": "debug/elf", - "elf.EM_ME16": "debug/elf", - "elf.EM_MIPS": "debug/elf", - "elf.EM_MIPS_RS3_LE": "debug/elf", - "elf.EM_MIPS_RS4_BE": "debug/elf", - "elf.EM_MIPS_X": "debug/elf", - "elf.EM_MMA": "debug/elf", - "elf.EM_NCPU": "debug/elf", - "elf.EM_NDR1": "debug/elf", - "elf.EM_NONE": "debug/elf", - "elf.EM_PARISC": "debug/elf", - "elf.EM_PCP": "debug/elf", - "elf.EM_PPC": "debug/elf", - "elf.EM_PPC64": "debug/elf", - "elf.EM_RCE": "debug/elf", - "elf.EM_RH32": "debug/elf", - "elf.EM_S370": "debug/elf", - "elf.EM_S390": "debug/elf", - "elf.EM_SH": "debug/elf", - "elf.EM_SPARC": "debug/elf", - "elf.EM_SPARC32PLUS": "debug/elf", - "elf.EM_SPARCV9": "debug/elf", - "elf.EM_ST100": "debug/elf", - "elf.EM_STARCORE": "debug/elf", - "elf.EM_TINYJ": "debug/elf", - "elf.EM_TRICORE": "debug/elf", - "elf.EM_V800": "debug/elf", - "elf.EM_VPP500": "debug/elf", - "elf.EM_X86_64": "debug/elf", - "elf.ET_CORE": "debug/elf", - "elf.ET_DYN": "debug/elf", - "elf.ET_EXEC": "debug/elf", - "elf.ET_HIOS": "debug/elf", - "elf.ET_HIPROC": "debug/elf", - "elf.ET_LOOS": "debug/elf", - "elf.ET_LOPROC": "debug/elf", - "elf.ET_NONE": "debug/elf", - "elf.ET_REL": "debug/elf", - "elf.EV_CURRENT": "debug/elf", - "elf.EV_NONE": "debug/elf", - "elf.ErrNoSymbols": "debug/elf", - "elf.File": "debug/elf", - "elf.FileHeader": "debug/elf", - "elf.FormatError": "debug/elf", - "elf.Header32": "debug/elf", - "elf.Header64": "debug/elf", - "elf.ImportedSymbol": "debug/elf", - "elf.Machine": "debug/elf", - "elf.NT_FPREGSET": "debug/elf", - "elf.NT_PRPSINFO": "debug/elf", - "elf.NT_PRSTATUS": "debug/elf", - "elf.NType": "debug/elf", - "elf.NewFile": "debug/elf", - "elf.OSABI": "debug/elf", - "elf.Open": "debug/elf", - "elf.PF_MASKOS": "debug/elf", - "elf.PF_MASKPROC": "debug/elf", - "elf.PF_R": "debug/elf", - "elf.PF_W": "debug/elf", - "elf.PF_X": "debug/elf", - "elf.PT_DYNAMIC": "debug/elf", - "elf.PT_HIOS": "debug/elf", - "elf.PT_HIPROC": "debug/elf", - "elf.PT_INTERP": "debug/elf", - "elf.PT_LOAD": "debug/elf", - "elf.PT_LOOS": "debug/elf", - "elf.PT_LOPROC": "debug/elf", - "elf.PT_NOTE": "debug/elf", - "elf.PT_NULL": "debug/elf", - "elf.PT_PHDR": "debug/elf", - "elf.PT_SHLIB": "debug/elf", - "elf.PT_TLS": "debug/elf", - "elf.Prog": "debug/elf", - "elf.Prog32": "debug/elf", - "elf.Prog64": "debug/elf", - "elf.ProgFlag": "debug/elf", - "elf.ProgHeader": "debug/elf", - "elf.ProgType": "debug/elf", - "elf.R_386": "debug/elf", - "elf.R_386_32": "debug/elf", - "elf.R_386_COPY": "debug/elf", - "elf.R_386_GLOB_DAT": "debug/elf", - "elf.R_386_GOT32": "debug/elf", - "elf.R_386_GOTOFF": "debug/elf", - "elf.R_386_GOTPC": "debug/elf", - "elf.R_386_JMP_SLOT": "debug/elf", - "elf.R_386_NONE": "debug/elf", - "elf.R_386_PC32": "debug/elf", - "elf.R_386_PLT32": "debug/elf", - "elf.R_386_RELATIVE": "debug/elf", - "elf.R_386_TLS_DTPMOD32": "debug/elf", - "elf.R_386_TLS_DTPOFF32": "debug/elf", - "elf.R_386_TLS_GD": "debug/elf", - "elf.R_386_TLS_GD_32": "debug/elf", - "elf.R_386_TLS_GD_CALL": "debug/elf", - "elf.R_386_TLS_GD_POP": "debug/elf", - "elf.R_386_TLS_GD_PUSH": "debug/elf", - "elf.R_386_TLS_GOTIE": "debug/elf", - "elf.R_386_TLS_IE": "debug/elf", - "elf.R_386_TLS_IE_32": "debug/elf", - "elf.R_386_TLS_LDM": "debug/elf", - "elf.R_386_TLS_LDM_32": "debug/elf", - "elf.R_386_TLS_LDM_CALL": "debug/elf", - "elf.R_386_TLS_LDM_POP": "debug/elf", - "elf.R_386_TLS_LDM_PUSH": "debug/elf", - "elf.R_386_TLS_LDO_32": "debug/elf", - "elf.R_386_TLS_LE": "debug/elf", - "elf.R_386_TLS_LE_32": "debug/elf", - "elf.R_386_TLS_TPOFF": "debug/elf", - "elf.R_386_TLS_TPOFF32": "debug/elf", - "elf.R_390": "debug/elf", - "elf.R_390_12": "debug/elf", - "elf.R_390_16": "debug/elf", - "elf.R_390_20": "debug/elf", - "elf.R_390_32": "debug/elf", - "elf.R_390_64": "debug/elf", - "elf.R_390_8": "debug/elf", - "elf.R_390_COPY": "debug/elf", - "elf.R_390_GLOB_DAT": "debug/elf", - "elf.R_390_GOT12": "debug/elf", - "elf.R_390_GOT16": "debug/elf", - "elf.R_390_GOT20": "debug/elf", - "elf.R_390_GOT32": "debug/elf", - "elf.R_390_GOT64": "debug/elf", - "elf.R_390_GOTENT": "debug/elf", - "elf.R_390_GOTOFF": "debug/elf", - "elf.R_390_GOTOFF16": "debug/elf", - "elf.R_390_GOTOFF64": "debug/elf", - "elf.R_390_GOTPC": "debug/elf", - "elf.R_390_GOTPCDBL": "debug/elf", - "elf.R_390_GOTPLT12": "debug/elf", - "elf.R_390_GOTPLT16": "debug/elf", - "elf.R_390_GOTPLT20": "debug/elf", - "elf.R_390_GOTPLT32": "debug/elf", - "elf.R_390_GOTPLT64": "debug/elf", - "elf.R_390_GOTPLTENT": "debug/elf", - "elf.R_390_GOTPLTOFF16": "debug/elf", - "elf.R_390_GOTPLTOFF32": "debug/elf", - "elf.R_390_GOTPLTOFF64": "debug/elf", - "elf.R_390_JMP_SLOT": "debug/elf", - "elf.R_390_NONE": "debug/elf", - "elf.R_390_PC16": "debug/elf", - "elf.R_390_PC16DBL": "debug/elf", - "elf.R_390_PC32": "debug/elf", - "elf.R_390_PC32DBL": "debug/elf", - "elf.R_390_PC64": "debug/elf", - "elf.R_390_PLT16DBL": "debug/elf", - "elf.R_390_PLT32": "debug/elf", - "elf.R_390_PLT32DBL": "debug/elf", - "elf.R_390_PLT64": "debug/elf", - "elf.R_390_RELATIVE": "debug/elf", - "elf.R_390_TLS_DTPMOD": "debug/elf", - "elf.R_390_TLS_DTPOFF": "debug/elf", - "elf.R_390_TLS_GD32": "debug/elf", - "elf.R_390_TLS_GD64": "debug/elf", - "elf.R_390_TLS_GDCALL": "debug/elf", - "elf.R_390_TLS_GOTIE12": "debug/elf", - "elf.R_390_TLS_GOTIE20": "debug/elf", - "elf.R_390_TLS_GOTIE32": "debug/elf", - "elf.R_390_TLS_GOTIE64": "debug/elf", - "elf.R_390_TLS_IE32": "debug/elf", - "elf.R_390_TLS_IE64": "debug/elf", - "elf.R_390_TLS_IEENT": "debug/elf", - "elf.R_390_TLS_LDCALL": "debug/elf", - "elf.R_390_TLS_LDM32": "debug/elf", - "elf.R_390_TLS_LDM64": "debug/elf", - "elf.R_390_TLS_LDO32": "debug/elf", - "elf.R_390_TLS_LDO64": "debug/elf", - "elf.R_390_TLS_LE32": "debug/elf", - "elf.R_390_TLS_LE64": "debug/elf", - "elf.R_390_TLS_LOAD": "debug/elf", - "elf.R_390_TLS_TPOFF": "debug/elf", - "elf.R_AARCH64": "debug/elf", - "elf.R_AARCH64_ABS16": "debug/elf", - "elf.R_AARCH64_ABS32": "debug/elf", - "elf.R_AARCH64_ABS64": "debug/elf", - "elf.R_AARCH64_ADD_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_ADR_GOT_PAGE": "debug/elf", - "elf.R_AARCH64_ADR_PREL_LO21": "debug/elf", - "elf.R_AARCH64_ADR_PREL_PG_HI21": "debug/elf", - "elf.R_AARCH64_ADR_PREL_PG_HI21_NC": "debug/elf", - "elf.R_AARCH64_CALL26": "debug/elf", - "elf.R_AARCH64_CONDBR19": "debug/elf", - "elf.R_AARCH64_COPY": "debug/elf", - "elf.R_AARCH64_GLOB_DAT": "debug/elf", - "elf.R_AARCH64_GOT_LD_PREL19": "debug/elf", - "elf.R_AARCH64_IRELATIVE": "debug/elf", - "elf.R_AARCH64_JUMP26": "debug/elf", - "elf.R_AARCH64_JUMP_SLOT": "debug/elf", - "elf.R_AARCH64_LD64_GOT_LO12_NC": "debug/elf", - "elf.R_AARCH64_LDST128_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_LDST16_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_LDST32_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_LDST64_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_LDST8_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_LD_PREL_LO19": "debug/elf", - "elf.R_AARCH64_MOVW_SABS_G0": "debug/elf", - "elf.R_AARCH64_MOVW_SABS_G1": "debug/elf", - "elf.R_AARCH64_MOVW_SABS_G2": "debug/elf", - "elf.R_AARCH64_MOVW_UABS_G0": "debug/elf", - "elf.R_AARCH64_MOVW_UABS_G0_NC": "debug/elf", - "elf.R_AARCH64_MOVW_UABS_G1": "debug/elf", - "elf.R_AARCH64_MOVW_UABS_G1_NC": "debug/elf", - "elf.R_AARCH64_MOVW_UABS_G2": "debug/elf", - "elf.R_AARCH64_MOVW_UABS_G2_NC": "debug/elf", - "elf.R_AARCH64_MOVW_UABS_G3": "debug/elf", - "elf.R_AARCH64_NONE": "debug/elf", - "elf.R_AARCH64_NULL": "debug/elf", - "elf.R_AARCH64_P32_ABS16": "debug/elf", - "elf.R_AARCH64_P32_ABS32": "debug/elf", - "elf.R_AARCH64_P32_ADD_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_ADR_GOT_PAGE": "debug/elf", - "elf.R_AARCH64_P32_ADR_PREL_LO21": "debug/elf", - "elf.R_AARCH64_P32_ADR_PREL_PG_HI21": "debug/elf", - "elf.R_AARCH64_P32_CALL26": "debug/elf", - "elf.R_AARCH64_P32_CONDBR19": "debug/elf", - "elf.R_AARCH64_P32_COPY": "debug/elf", - "elf.R_AARCH64_P32_GLOB_DAT": "debug/elf", - "elf.R_AARCH64_P32_GOT_LD_PREL19": "debug/elf", - "elf.R_AARCH64_P32_IRELATIVE": "debug/elf", - "elf.R_AARCH64_P32_JUMP26": "debug/elf", - "elf.R_AARCH64_P32_JUMP_SLOT": "debug/elf", - "elf.R_AARCH64_P32_LD32_GOT_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_LDST128_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_LDST16_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_LDST32_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_LDST64_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_LDST8_ABS_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_LD_PREL_LO19": "debug/elf", - "elf.R_AARCH64_P32_MOVW_SABS_G0": "debug/elf", - "elf.R_AARCH64_P32_MOVW_UABS_G0": "debug/elf", - "elf.R_AARCH64_P32_MOVW_UABS_G0_NC": "debug/elf", - "elf.R_AARCH64_P32_MOVW_UABS_G1": "debug/elf", - "elf.R_AARCH64_P32_PREL16": "debug/elf", - "elf.R_AARCH64_P32_PREL32": "debug/elf", - "elf.R_AARCH64_P32_RELATIVE": "debug/elf", - "elf.R_AARCH64_P32_TLSDESC": "debug/elf", - "elf.R_AARCH64_P32_TLSDESC_ADD_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_TLSDESC_ADR_PAGE21": "debug/elf", - "elf.R_AARCH64_P32_TLSDESC_ADR_PREL21": "debug/elf", - "elf.R_AARCH64_P32_TLSDESC_CALL": "debug/elf", - "elf.R_AARCH64_P32_TLSDESC_LD32_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_TLSDESC_LD_PREL19": "debug/elf", - "elf.R_AARCH64_P32_TLSGD_ADD_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_TLSGD_ADR_PAGE21": "debug/elf", - "elf.R_AARCH64_P32_TLSIE_ADR_GOTTPREL_PAGE21": "debug/elf", - "elf.R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_TLSIE_LD_GOTTPREL_PREL19": "debug/elf", - "elf.R_AARCH64_P32_TLSLE_ADD_TPREL_HI12": "debug/elf", - "elf.R_AARCH64_P32_TLSLE_ADD_TPREL_LO12": "debug/elf", - "elf.R_AARCH64_P32_TLSLE_ADD_TPREL_LO12_NC": "debug/elf", - "elf.R_AARCH64_P32_TLSLE_MOVW_TPREL_G0": "debug/elf", - "elf.R_AARCH64_P32_TLSLE_MOVW_TPREL_G0_NC": "debug/elf", - "elf.R_AARCH64_P32_TLSLE_MOVW_TPREL_G1": "debug/elf", - "elf.R_AARCH64_P32_TLS_DTPMOD": "debug/elf", - "elf.R_AARCH64_P32_TLS_DTPREL": "debug/elf", - "elf.R_AARCH64_P32_TLS_TPREL": "debug/elf", - "elf.R_AARCH64_P32_TSTBR14": "debug/elf", - "elf.R_AARCH64_PREL16": "debug/elf", - "elf.R_AARCH64_PREL32": "debug/elf", - "elf.R_AARCH64_PREL64": "debug/elf", - "elf.R_AARCH64_RELATIVE": "debug/elf", - "elf.R_AARCH64_TLSDESC": "debug/elf", - "elf.R_AARCH64_TLSDESC_ADD": "debug/elf", - "elf.R_AARCH64_TLSDESC_ADD_LO12_NC": "debug/elf", - "elf.R_AARCH64_TLSDESC_ADR_PAGE21": "debug/elf", - "elf.R_AARCH64_TLSDESC_ADR_PREL21": "debug/elf", - "elf.R_AARCH64_TLSDESC_CALL": "debug/elf", - "elf.R_AARCH64_TLSDESC_LD64_LO12_NC": "debug/elf", - "elf.R_AARCH64_TLSDESC_LDR": "debug/elf", - "elf.R_AARCH64_TLSDESC_LD_PREL19": "debug/elf", - "elf.R_AARCH64_TLSDESC_OFF_G0_NC": "debug/elf", - "elf.R_AARCH64_TLSDESC_OFF_G1": "debug/elf", - "elf.R_AARCH64_TLSGD_ADD_LO12_NC": "debug/elf", - "elf.R_AARCH64_TLSGD_ADR_PAGE21": "debug/elf", - "elf.R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21": "debug/elf", - "elf.R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC": "debug/elf", - "elf.R_AARCH64_TLSIE_LD_GOTTPREL_PREL19": "debug/elf", - "elf.R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC": "debug/elf", - "elf.R_AARCH64_TLSIE_MOVW_GOTTPREL_G1": "debug/elf", - "elf.R_AARCH64_TLSLE_ADD_TPREL_HI12": "debug/elf", - "elf.R_AARCH64_TLSLE_ADD_TPREL_LO12": "debug/elf", - "elf.R_AARCH64_TLSLE_ADD_TPREL_LO12_NC": "debug/elf", - "elf.R_AARCH64_TLSLE_MOVW_TPREL_G0": "debug/elf", - "elf.R_AARCH64_TLSLE_MOVW_TPREL_G0_NC": "debug/elf", - "elf.R_AARCH64_TLSLE_MOVW_TPREL_G1": "debug/elf", - "elf.R_AARCH64_TLSLE_MOVW_TPREL_G1_NC": "debug/elf", - "elf.R_AARCH64_TLSLE_MOVW_TPREL_G2": "debug/elf", - "elf.R_AARCH64_TLS_DTPMOD64": "debug/elf", - "elf.R_AARCH64_TLS_DTPREL64": "debug/elf", - "elf.R_AARCH64_TLS_TPREL64": "debug/elf", - "elf.R_AARCH64_TSTBR14": "debug/elf", - "elf.R_ALPHA": "debug/elf", - "elf.R_ALPHA_BRADDR": "debug/elf", - "elf.R_ALPHA_COPY": "debug/elf", - "elf.R_ALPHA_GLOB_DAT": "debug/elf", - "elf.R_ALPHA_GPDISP": "debug/elf", - "elf.R_ALPHA_GPREL32": "debug/elf", - "elf.R_ALPHA_GPRELHIGH": "debug/elf", - "elf.R_ALPHA_GPRELLOW": "debug/elf", - "elf.R_ALPHA_GPVALUE": "debug/elf", - "elf.R_ALPHA_HINT": "debug/elf", - "elf.R_ALPHA_IMMED_BR_HI32": "debug/elf", - "elf.R_ALPHA_IMMED_GP_16": "debug/elf", - "elf.R_ALPHA_IMMED_GP_HI32": "debug/elf", - "elf.R_ALPHA_IMMED_LO32": "debug/elf", - "elf.R_ALPHA_IMMED_SCN_HI32": "debug/elf", - "elf.R_ALPHA_JMP_SLOT": "debug/elf", - "elf.R_ALPHA_LITERAL": "debug/elf", - "elf.R_ALPHA_LITUSE": "debug/elf", - "elf.R_ALPHA_NONE": "debug/elf", - "elf.R_ALPHA_OP_PRSHIFT": "debug/elf", - "elf.R_ALPHA_OP_PSUB": "debug/elf", - "elf.R_ALPHA_OP_PUSH": "debug/elf", - "elf.R_ALPHA_OP_STORE": "debug/elf", - "elf.R_ALPHA_REFLONG": "debug/elf", - "elf.R_ALPHA_REFQUAD": "debug/elf", - "elf.R_ALPHA_RELATIVE": "debug/elf", - "elf.R_ALPHA_SREL16": "debug/elf", - "elf.R_ALPHA_SREL32": "debug/elf", - "elf.R_ALPHA_SREL64": "debug/elf", - "elf.R_ARM": "debug/elf", - "elf.R_ARM_ABS12": "debug/elf", - "elf.R_ARM_ABS16": "debug/elf", - "elf.R_ARM_ABS32": "debug/elf", - "elf.R_ARM_ABS8": "debug/elf", - "elf.R_ARM_AMP_VCALL9": "debug/elf", - "elf.R_ARM_COPY": "debug/elf", - "elf.R_ARM_GLOB_DAT": "debug/elf", - "elf.R_ARM_GNU_VTENTRY": "debug/elf", - "elf.R_ARM_GNU_VTINHERIT": "debug/elf", - "elf.R_ARM_GOT32": "debug/elf", - "elf.R_ARM_GOTOFF": "debug/elf", - "elf.R_ARM_GOTPC": "debug/elf", - "elf.R_ARM_JUMP_SLOT": "debug/elf", - "elf.R_ARM_NONE": "debug/elf", - "elf.R_ARM_PC13": "debug/elf", - "elf.R_ARM_PC24": "debug/elf", - "elf.R_ARM_PLT32": "debug/elf", - "elf.R_ARM_RABS32": "debug/elf", - "elf.R_ARM_RBASE": "debug/elf", - "elf.R_ARM_REL32": "debug/elf", - "elf.R_ARM_RELATIVE": "debug/elf", - "elf.R_ARM_RPC24": "debug/elf", - "elf.R_ARM_RREL32": "debug/elf", - "elf.R_ARM_RSBREL32": "debug/elf", - "elf.R_ARM_SBREL32": "debug/elf", - "elf.R_ARM_SWI24": "debug/elf", - "elf.R_ARM_THM_ABS5": "debug/elf", - "elf.R_ARM_THM_PC22": "debug/elf", - "elf.R_ARM_THM_PC8": "debug/elf", - "elf.R_ARM_THM_RPC22": "debug/elf", - "elf.R_ARM_THM_SWI8": "debug/elf", - "elf.R_ARM_THM_XPC22": "debug/elf", - "elf.R_ARM_XPC25": "debug/elf", - "elf.R_INFO": "debug/elf", - "elf.R_INFO32": "debug/elf", - "elf.R_MIPS": "debug/elf", - "elf.R_MIPS_16": "debug/elf", - "elf.R_MIPS_26": "debug/elf", - "elf.R_MIPS_32": "debug/elf", - "elf.R_MIPS_64": "debug/elf", - "elf.R_MIPS_ADD_IMMEDIATE": "debug/elf", - "elf.R_MIPS_CALL16": "debug/elf", - "elf.R_MIPS_CALL_HI16": "debug/elf", - "elf.R_MIPS_CALL_LO16": "debug/elf", - "elf.R_MIPS_DELETE": "debug/elf", - "elf.R_MIPS_GOT16": "debug/elf", - "elf.R_MIPS_GOT_DISP": "debug/elf", - "elf.R_MIPS_GOT_HI16": "debug/elf", - "elf.R_MIPS_GOT_LO16": "debug/elf", - "elf.R_MIPS_GOT_OFST": "debug/elf", - "elf.R_MIPS_GOT_PAGE": "debug/elf", - "elf.R_MIPS_GPREL16": "debug/elf", - "elf.R_MIPS_GPREL32": "debug/elf", - "elf.R_MIPS_HI16": "debug/elf", - "elf.R_MIPS_HIGHER": "debug/elf", - "elf.R_MIPS_HIGHEST": "debug/elf", - "elf.R_MIPS_INSERT_A": "debug/elf", - "elf.R_MIPS_INSERT_B": "debug/elf", - "elf.R_MIPS_JALR": "debug/elf", - "elf.R_MIPS_LITERAL": "debug/elf", - "elf.R_MIPS_LO16": "debug/elf", - "elf.R_MIPS_NONE": "debug/elf", - "elf.R_MIPS_PC16": "debug/elf", - "elf.R_MIPS_PJUMP": "debug/elf", - "elf.R_MIPS_REL16": "debug/elf", - "elf.R_MIPS_REL32": "debug/elf", - "elf.R_MIPS_RELGOT": "debug/elf", - "elf.R_MIPS_SCN_DISP": "debug/elf", - "elf.R_MIPS_SHIFT5": "debug/elf", - "elf.R_MIPS_SHIFT6": "debug/elf", - "elf.R_MIPS_SUB": "debug/elf", - "elf.R_MIPS_TLS_DTPMOD32": "debug/elf", - "elf.R_MIPS_TLS_DTPMOD64": "debug/elf", - "elf.R_MIPS_TLS_DTPREL32": "debug/elf", - "elf.R_MIPS_TLS_DTPREL64": "debug/elf", - "elf.R_MIPS_TLS_DTPREL_HI16": "debug/elf", - "elf.R_MIPS_TLS_DTPREL_LO16": "debug/elf", - "elf.R_MIPS_TLS_GD": "debug/elf", - "elf.R_MIPS_TLS_GOTTPREL": "debug/elf", - "elf.R_MIPS_TLS_LDM": "debug/elf", - "elf.R_MIPS_TLS_TPREL32": "debug/elf", - "elf.R_MIPS_TLS_TPREL64": "debug/elf", - "elf.R_MIPS_TLS_TPREL_HI16": "debug/elf", - "elf.R_MIPS_TLS_TPREL_LO16": "debug/elf", - "elf.R_PPC": "debug/elf", - "elf.R_PPC64": "debug/elf", - "elf.R_PPC64_ADDR14": "debug/elf", - "elf.R_PPC64_ADDR14_BRNTAKEN": "debug/elf", - "elf.R_PPC64_ADDR14_BRTAKEN": "debug/elf", - "elf.R_PPC64_ADDR16": "debug/elf", - "elf.R_PPC64_ADDR16_DS": "debug/elf", - "elf.R_PPC64_ADDR16_HA": "debug/elf", - "elf.R_PPC64_ADDR16_HI": "debug/elf", - "elf.R_PPC64_ADDR16_HIGHER": "debug/elf", - "elf.R_PPC64_ADDR16_HIGHERA": "debug/elf", - "elf.R_PPC64_ADDR16_HIGHEST": "debug/elf", - "elf.R_PPC64_ADDR16_HIGHESTA": "debug/elf", - "elf.R_PPC64_ADDR16_LO": "debug/elf", - "elf.R_PPC64_ADDR16_LO_DS": "debug/elf", - "elf.R_PPC64_ADDR24": "debug/elf", - "elf.R_PPC64_ADDR32": "debug/elf", - "elf.R_PPC64_ADDR64": "debug/elf", - "elf.R_PPC64_DTPMOD64": "debug/elf", - "elf.R_PPC64_DTPREL16": "debug/elf", - "elf.R_PPC64_DTPREL16_DS": "debug/elf", - "elf.R_PPC64_DTPREL16_HA": "debug/elf", - "elf.R_PPC64_DTPREL16_HI": "debug/elf", - "elf.R_PPC64_DTPREL16_HIGHER": "debug/elf", - "elf.R_PPC64_DTPREL16_HIGHERA": "debug/elf", - "elf.R_PPC64_DTPREL16_HIGHEST": "debug/elf", - "elf.R_PPC64_DTPREL16_HIGHESTA": "debug/elf", - "elf.R_PPC64_DTPREL16_LO": "debug/elf", - "elf.R_PPC64_DTPREL16_LO_DS": "debug/elf", - "elf.R_PPC64_DTPREL64": "debug/elf", - "elf.R_PPC64_GOT16": "debug/elf", - "elf.R_PPC64_GOT16_DS": "debug/elf", - "elf.R_PPC64_GOT16_HA": "debug/elf", - "elf.R_PPC64_GOT16_HI": "debug/elf", - "elf.R_PPC64_GOT16_LO": "debug/elf", - "elf.R_PPC64_GOT16_LO_DS": "debug/elf", - "elf.R_PPC64_GOT_DTPREL16_DS": "debug/elf", - "elf.R_PPC64_GOT_DTPREL16_HA": "debug/elf", - "elf.R_PPC64_GOT_DTPREL16_HI": "debug/elf", - "elf.R_PPC64_GOT_DTPREL16_LO_DS": "debug/elf", - "elf.R_PPC64_GOT_TLSGD16": "debug/elf", - "elf.R_PPC64_GOT_TLSGD16_HA": "debug/elf", - "elf.R_PPC64_GOT_TLSGD16_HI": "debug/elf", - "elf.R_PPC64_GOT_TLSGD16_LO": "debug/elf", - "elf.R_PPC64_GOT_TLSLD16": "debug/elf", - "elf.R_PPC64_GOT_TLSLD16_HA": "debug/elf", - "elf.R_PPC64_GOT_TLSLD16_HI": "debug/elf", - "elf.R_PPC64_GOT_TLSLD16_LO": "debug/elf", - "elf.R_PPC64_GOT_TPREL16_DS": "debug/elf", - "elf.R_PPC64_GOT_TPREL16_HA": "debug/elf", - "elf.R_PPC64_GOT_TPREL16_HI": "debug/elf", - "elf.R_PPC64_GOT_TPREL16_LO_DS": "debug/elf", - "elf.R_PPC64_JMP_SLOT": "debug/elf", - "elf.R_PPC64_NONE": "debug/elf", - "elf.R_PPC64_REL14": "debug/elf", - "elf.R_PPC64_REL14_BRNTAKEN": "debug/elf", - "elf.R_PPC64_REL14_BRTAKEN": "debug/elf", - "elf.R_PPC64_REL16": "debug/elf", - "elf.R_PPC64_REL16_HA": "debug/elf", - "elf.R_PPC64_REL16_HI": "debug/elf", - "elf.R_PPC64_REL16_LO": "debug/elf", - "elf.R_PPC64_REL24": "debug/elf", - "elf.R_PPC64_REL32": "debug/elf", - "elf.R_PPC64_REL64": "debug/elf", - "elf.R_PPC64_TLS": "debug/elf", - "elf.R_PPC64_TLSGD": "debug/elf", - "elf.R_PPC64_TLSLD": "debug/elf", - "elf.R_PPC64_TOC": "debug/elf", - "elf.R_PPC64_TOC16": "debug/elf", - "elf.R_PPC64_TOC16_DS": "debug/elf", - "elf.R_PPC64_TOC16_HA": "debug/elf", - "elf.R_PPC64_TOC16_HI": "debug/elf", - "elf.R_PPC64_TOC16_LO": "debug/elf", - "elf.R_PPC64_TOC16_LO_DS": "debug/elf", - "elf.R_PPC64_TPREL16": "debug/elf", - "elf.R_PPC64_TPREL16_DS": "debug/elf", - "elf.R_PPC64_TPREL16_HA": "debug/elf", - "elf.R_PPC64_TPREL16_HI": "debug/elf", - "elf.R_PPC64_TPREL16_HIGHER": "debug/elf", - "elf.R_PPC64_TPREL16_HIGHERA": "debug/elf", - "elf.R_PPC64_TPREL16_HIGHEST": "debug/elf", - "elf.R_PPC64_TPREL16_HIGHESTA": "debug/elf", - "elf.R_PPC64_TPREL16_LO": "debug/elf", - "elf.R_PPC64_TPREL16_LO_DS": "debug/elf", - "elf.R_PPC64_TPREL64": "debug/elf", - "elf.R_PPC_ADDR14": "debug/elf", - "elf.R_PPC_ADDR14_BRNTAKEN": "debug/elf", - "elf.R_PPC_ADDR14_BRTAKEN": "debug/elf", - "elf.R_PPC_ADDR16": "debug/elf", - "elf.R_PPC_ADDR16_HA": "debug/elf", - "elf.R_PPC_ADDR16_HI": "debug/elf", - "elf.R_PPC_ADDR16_LO": "debug/elf", - "elf.R_PPC_ADDR24": "debug/elf", - "elf.R_PPC_ADDR32": "debug/elf", - "elf.R_PPC_COPY": "debug/elf", - "elf.R_PPC_DTPMOD32": "debug/elf", - "elf.R_PPC_DTPREL16": "debug/elf", - "elf.R_PPC_DTPREL16_HA": "debug/elf", - "elf.R_PPC_DTPREL16_HI": "debug/elf", - "elf.R_PPC_DTPREL16_LO": "debug/elf", - "elf.R_PPC_DTPREL32": "debug/elf", - "elf.R_PPC_EMB_BIT_FLD": "debug/elf", - "elf.R_PPC_EMB_MRKREF": "debug/elf", - "elf.R_PPC_EMB_NADDR16": "debug/elf", - "elf.R_PPC_EMB_NADDR16_HA": "debug/elf", - "elf.R_PPC_EMB_NADDR16_HI": "debug/elf", - "elf.R_PPC_EMB_NADDR16_LO": "debug/elf", - "elf.R_PPC_EMB_NADDR32": "debug/elf", - "elf.R_PPC_EMB_RELSDA": "debug/elf", - "elf.R_PPC_EMB_RELSEC16": "debug/elf", - "elf.R_PPC_EMB_RELST_HA": "debug/elf", - "elf.R_PPC_EMB_RELST_HI": "debug/elf", - "elf.R_PPC_EMB_RELST_LO": "debug/elf", - "elf.R_PPC_EMB_SDA21": "debug/elf", - "elf.R_PPC_EMB_SDA2I16": "debug/elf", - "elf.R_PPC_EMB_SDA2REL": "debug/elf", - "elf.R_PPC_EMB_SDAI16": "debug/elf", - "elf.R_PPC_GLOB_DAT": "debug/elf", - "elf.R_PPC_GOT16": "debug/elf", - "elf.R_PPC_GOT16_HA": "debug/elf", - "elf.R_PPC_GOT16_HI": "debug/elf", - "elf.R_PPC_GOT16_LO": "debug/elf", - "elf.R_PPC_GOT_TLSGD16": "debug/elf", - "elf.R_PPC_GOT_TLSGD16_HA": "debug/elf", - "elf.R_PPC_GOT_TLSGD16_HI": "debug/elf", - "elf.R_PPC_GOT_TLSGD16_LO": "debug/elf", - "elf.R_PPC_GOT_TLSLD16": "debug/elf", - "elf.R_PPC_GOT_TLSLD16_HA": "debug/elf", - "elf.R_PPC_GOT_TLSLD16_HI": "debug/elf", - "elf.R_PPC_GOT_TLSLD16_LO": "debug/elf", - "elf.R_PPC_GOT_TPREL16": "debug/elf", - "elf.R_PPC_GOT_TPREL16_HA": "debug/elf", - "elf.R_PPC_GOT_TPREL16_HI": "debug/elf", - "elf.R_PPC_GOT_TPREL16_LO": "debug/elf", - "elf.R_PPC_JMP_SLOT": "debug/elf", - "elf.R_PPC_LOCAL24PC": "debug/elf", - "elf.R_PPC_NONE": "debug/elf", - "elf.R_PPC_PLT16_HA": "debug/elf", - "elf.R_PPC_PLT16_HI": "debug/elf", - "elf.R_PPC_PLT16_LO": "debug/elf", - "elf.R_PPC_PLT32": "debug/elf", - "elf.R_PPC_PLTREL24": "debug/elf", - "elf.R_PPC_PLTREL32": "debug/elf", - "elf.R_PPC_REL14": "debug/elf", - "elf.R_PPC_REL14_BRNTAKEN": "debug/elf", - "elf.R_PPC_REL14_BRTAKEN": "debug/elf", - "elf.R_PPC_REL24": "debug/elf", - "elf.R_PPC_REL32": "debug/elf", - "elf.R_PPC_RELATIVE": "debug/elf", - "elf.R_PPC_SDAREL16": "debug/elf", - "elf.R_PPC_SECTOFF": "debug/elf", - "elf.R_PPC_SECTOFF_HA": "debug/elf", - "elf.R_PPC_SECTOFF_HI": "debug/elf", - "elf.R_PPC_SECTOFF_LO": "debug/elf", - "elf.R_PPC_TLS": "debug/elf", - "elf.R_PPC_TPREL16": "debug/elf", - "elf.R_PPC_TPREL16_HA": "debug/elf", - "elf.R_PPC_TPREL16_HI": "debug/elf", - "elf.R_PPC_TPREL16_LO": "debug/elf", - "elf.R_PPC_TPREL32": "debug/elf", - "elf.R_PPC_UADDR16": "debug/elf", - "elf.R_PPC_UADDR32": "debug/elf", - "elf.R_SPARC": "debug/elf", - "elf.R_SPARC_10": "debug/elf", - "elf.R_SPARC_11": "debug/elf", - "elf.R_SPARC_13": "debug/elf", - "elf.R_SPARC_16": "debug/elf", - "elf.R_SPARC_22": "debug/elf", - "elf.R_SPARC_32": "debug/elf", - "elf.R_SPARC_5": "debug/elf", - "elf.R_SPARC_6": "debug/elf", - "elf.R_SPARC_64": "debug/elf", - "elf.R_SPARC_7": "debug/elf", - "elf.R_SPARC_8": "debug/elf", - "elf.R_SPARC_COPY": "debug/elf", - "elf.R_SPARC_DISP16": "debug/elf", - "elf.R_SPARC_DISP32": "debug/elf", - "elf.R_SPARC_DISP64": "debug/elf", - "elf.R_SPARC_DISP8": "debug/elf", - "elf.R_SPARC_GLOB_DAT": "debug/elf", - "elf.R_SPARC_GLOB_JMP": "debug/elf", - "elf.R_SPARC_GOT10": "debug/elf", - "elf.R_SPARC_GOT13": "debug/elf", - "elf.R_SPARC_GOT22": "debug/elf", - "elf.R_SPARC_H44": "debug/elf", - "elf.R_SPARC_HH22": "debug/elf", - "elf.R_SPARC_HI22": "debug/elf", - "elf.R_SPARC_HIPLT22": "debug/elf", - "elf.R_SPARC_HIX22": "debug/elf", - "elf.R_SPARC_HM10": "debug/elf", - "elf.R_SPARC_JMP_SLOT": "debug/elf", - "elf.R_SPARC_L44": "debug/elf", - "elf.R_SPARC_LM22": "debug/elf", - "elf.R_SPARC_LO10": "debug/elf", - "elf.R_SPARC_LOPLT10": "debug/elf", - "elf.R_SPARC_LOX10": "debug/elf", - "elf.R_SPARC_M44": "debug/elf", - "elf.R_SPARC_NONE": "debug/elf", - "elf.R_SPARC_OLO10": "debug/elf", - "elf.R_SPARC_PC10": "debug/elf", - "elf.R_SPARC_PC22": "debug/elf", - "elf.R_SPARC_PCPLT10": "debug/elf", - "elf.R_SPARC_PCPLT22": "debug/elf", - "elf.R_SPARC_PCPLT32": "debug/elf", - "elf.R_SPARC_PC_HH22": "debug/elf", - "elf.R_SPARC_PC_HM10": "debug/elf", - "elf.R_SPARC_PC_LM22": "debug/elf", - "elf.R_SPARC_PLT32": "debug/elf", - "elf.R_SPARC_PLT64": "debug/elf", - "elf.R_SPARC_REGISTER": "debug/elf", - "elf.R_SPARC_RELATIVE": "debug/elf", - "elf.R_SPARC_UA16": "debug/elf", - "elf.R_SPARC_UA32": "debug/elf", - "elf.R_SPARC_UA64": "debug/elf", - "elf.R_SPARC_WDISP16": "debug/elf", - "elf.R_SPARC_WDISP19": "debug/elf", - "elf.R_SPARC_WDISP22": "debug/elf", - "elf.R_SPARC_WDISP30": "debug/elf", - "elf.R_SPARC_WPLT30": "debug/elf", - "elf.R_SYM32": "debug/elf", - "elf.R_SYM64": "debug/elf", - "elf.R_TYPE32": "debug/elf", - "elf.R_TYPE64": "debug/elf", - "elf.R_X86_64": "debug/elf", - "elf.R_X86_64_16": "debug/elf", - "elf.R_X86_64_32": "debug/elf", - "elf.R_X86_64_32S": "debug/elf", - "elf.R_X86_64_64": "debug/elf", - "elf.R_X86_64_8": "debug/elf", - "elf.R_X86_64_COPY": "debug/elf", - "elf.R_X86_64_DTPMOD64": "debug/elf", - "elf.R_X86_64_DTPOFF32": "debug/elf", - "elf.R_X86_64_DTPOFF64": "debug/elf", - "elf.R_X86_64_GLOB_DAT": "debug/elf", - "elf.R_X86_64_GOT32": "debug/elf", - "elf.R_X86_64_GOTPCREL": "debug/elf", - "elf.R_X86_64_GOTTPOFF": "debug/elf", - "elf.R_X86_64_JMP_SLOT": "debug/elf", - "elf.R_X86_64_NONE": "debug/elf", - "elf.R_X86_64_PC16": "debug/elf", - "elf.R_X86_64_PC32": "debug/elf", - "elf.R_X86_64_PC8": "debug/elf", - "elf.R_X86_64_PLT32": "debug/elf", - "elf.R_X86_64_RELATIVE": "debug/elf", - "elf.R_X86_64_TLSGD": "debug/elf", - "elf.R_X86_64_TLSLD": "debug/elf", - "elf.R_X86_64_TPOFF32": "debug/elf", - "elf.R_X86_64_TPOFF64": "debug/elf", - "elf.Rel32": "debug/elf", - "elf.Rel64": "debug/elf", - "elf.Rela32": "debug/elf", - "elf.Rela64": "debug/elf", - "elf.SHF_ALLOC": "debug/elf", - "elf.SHF_COMPRESSED": "debug/elf", - "elf.SHF_EXECINSTR": "debug/elf", - "elf.SHF_GROUP": "debug/elf", - "elf.SHF_INFO_LINK": "debug/elf", - "elf.SHF_LINK_ORDER": "debug/elf", - "elf.SHF_MASKOS": "debug/elf", - "elf.SHF_MASKPROC": "debug/elf", - "elf.SHF_MERGE": "debug/elf", - "elf.SHF_OS_NONCONFORMING": "debug/elf", - "elf.SHF_STRINGS": "debug/elf", - "elf.SHF_TLS": "debug/elf", - "elf.SHF_WRITE": "debug/elf", - "elf.SHN_ABS": "debug/elf", - "elf.SHN_COMMON": "debug/elf", - "elf.SHN_HIOS": "debug/elf", - "elf.SHN_HIPROC": "debug/elf", - "elf.SHN_HIRESERVE": "debug/elf", - "elf.SHN_LOOS": "debug/elf", - "elf.SHN_LOPROC": "debug/elf", - "elf.SHN_LORESERVE": "debug/elf", - "elf.SHN_UNDEF": "debug/elf", - "elf.SHN_XINDEX": "debug/elf", - "elf.SHT_DYNAMIC": "debug/elf", - "elf.SHT_DYNSYM": "debug/elf", - "elf.SHT_FINI_ARRAY": "debug/elf", - "elf.SHT_GNU_ATTRIBUTES": "debug/elf", - "elf.SHT_GNU_HASH": "debug/elf", - "elf.SHT_GNU_LIBLIST": "debug/elf", - "elf.SHT_GNU_VERDEF": "debug/elf", - "elf.SHT_GNU_VERNEED": "debug/elf", - "elf.SHT_GNU_VERSYM": "debug/elf", - "elf.SHT_GROUP": "debug/elf", - "elf.SHT_HASH": "debug/elf", - "elf.SHT_HIOS": "debug/elf", - "elf.SHT_HIPROC": "debug/elf", - "elf.SHT_HIUSER": "debug/elf", - "elf.SHT_INIT_ARRAY": "debug/elf", - "elf.SHT_LOOS": "debug/elf", - "elf.SHT_LOPROC": "debug/elf", - "elf.SHT_LOUSER": "debug/elf", - "elf.SHT_NOBITS": "debug/elf", - "elf.SHT_NOTE": "debug/elf", - "elf.SHT_NULL": "debug/elf", - "elf.SHT_PREINIT_ARRAY": "debug/elf", - "elf.SHT_PROGBITS": "debug/elf", - "elf.SHT_REL": "debug/elf", - "elf.SHT_RELA": "debug/elf", - "elf.SHT_SHLIB": "debug/elf", - "elf.SHT_STRTAB": "debug/elf", - "elf.SHT_SYMTAB": "debug/elf", - "elf.SHT_SYMTAB_SHNDX": "debug/elf", - "elf.STB_GLOBAL": "debug/elf", - "elf.STB_HIOS": "debug/elf", - "elf.STB_HIPROC": "debug/elf", - "elf.STB_LOCAL": "debug/elf", - "elf.STB_LOOS": "debug/elf", - "elf.STB_LOPROC": "debug/elf", - "elf.STB_WEAK": "debug/elf", - "elf.STT_COMMON": "debug/elf", - "elf.STT_FILE": "debug/elf", - "elf.STT_FUNC": "debug/elf", - "elf.STT_HIOS": "debug/elf", - "elf.STT_HIPROC": "debug/elf", - "elf.STT_LOOS": "debug/elf", - "elf.STT_LOPROC": "debug/elf", - "elf.STT_NOTYPE": "debug/elf", - "elf.STT_OBJECT": "debug/elf", - "elf.STT_SECTION": "debug/elf", - "elf.STT_TLS": "debug/elf", - "elf.STV_DEFAULT": "debug/elf", - "elf.STV_HIDDEN": "debug/elf", - "elf.STV_INTERNAL": "debug/elf", - "elf.STV_PROTECTED": "debug/elf", - "elf.ST_BIND": "debug/elf", - "elf.ST_INFO": "debug/elf", - "elf.ST_TYPE": "debug/elf", - "elf.ST_VISIBILITY": "debug/elf", - "elf.Section": "debug/elf", - "elf.Section32": "debug/elf", - "elf.Section64": "debug/elf", - "elf.SectionFlag": "debug/elf", - "elf.SectionHeader": "debug/elf", - "elf.SectionIndex": "debug/elf", - "elf.SectionType": "debug/elf", - "elf.Sym32": "debug/elf", - "elf.Sym32Size": "debug/elf", - "elf.Sym64": "debug/elf", - "elf.Sym64Size": "debug/elf", - "elf.SymBind": "debug/elf", - "elf.SymType": "debug/elf", - "elf.SymVis": "debug/elf", - "elf.Symbol": "debug/elf", - "elf.Type": "debug/elf", - "elf.Version": "debug/elf", - "elliptic.Curve": "crypto/elliptic", - "elliptic.CurveParams": "crypto/elliptic", - "elliptic.GenerateKey": "crypto/elliptic", - "elliptic.Marshal": "crypto/elliptic", - "elliptic.P224": "crypto/elliptic", - "elliptic.P256": "crypto/elliptic", - "elliptic.P384": "crypto/elliptic", - "elliptic.P521": "crypto/elliptic", - "elliptic.Unmarshal": "crypto/elliptic", - "encoding.BinaryMarshaler": "encoding", - "encoding.BinaryUnmarshaler": "encoding", - "encoding.TextMarshaler": "encoding", - "encoding.TextUnmarshaler": "encoding", - "errors.New": "errors", - "exec.Cmd": "os/exec", - "exec.Command": "os/exec", - "exec.CommandContext": "os/exec", - "exec.ErrNotFound": "os/exec", - "exec.Error": "os/exec", - "exec.ExitError": "os/exec", - "exec.LookPath": "os/exec", - "expvar.Do": "expvar", - "expvar.Float": "expvar", - "expvar.Func": "expvar", - "expvar.Get": "expvar", - "expvar.Int": "expvar", - "expvar.KeyValue": "expvar", - "expvar.Map": "expvar", - "expvar.NewFloat": "expvar", - "expvar.NewInt": "expvar", - "expvar.NewMap": "expvar", - "expvar.NewString": "expvar", - "expvar.Publish": "expvar", - "expvar.String": "expvar", - "expvar.Var": "expvar", - "fcgi.ErrConnClosed": "net/http/fcgi", - "fcgi.ErrRequestAborted": "net/http/fcgi", - "fcgi.Serve": "net/http/fcgi", - "filepath.Abs": "path/filepath", - "filepath.Base": "path/filepath", - "filepath.Clean": "path/filepath", - "filepath.Dir": "path/filepath", - "filepath.ErrBadPattern": "path/filepath", - "filepath.EvalSymlinks": "path/filepath", - "filepath.Ext": "path/filepath", - "filepath.FromSlash": "path/filepath", - "filepath.Glob": "path/filepath", - "filepath.HasPrefix": "path/filepath", - "filepath.IsAbs": "path/filepath", - "filepath.Join": "path/filepath", - "filepath.ListSeparator": "path/filepath", - "filepath.Match": "path/filepath", - "filepath.Rel": "path/filepath", - "filepath.Separator": "path/filepath", - "filepath.SkipDir": "path/filepath", - "filepath.Split": "path/filepath", - "filepath.SplitList": "path/filepath", - "filepath.ToSlash": "path/filepath", - "filepath.VolumeName": "path/filepath", - "filepath.Walk": "path/filepath", - "filepath.WalkFunc": "path/filepath", - "flag.Arg": "flag", - "flag.Args": "flag", - "flag.Bool": "flag", - "flag.BoolVar": "flag", - "flag.CommandLine": "flag", - "flag.ContinueOnError": "flag", - "flag.Duration": "flag", - "flag.DurationVar": "flag", - "flag.ErrHelp": "flag", - "flag.ErrorHandling": "flag", - "flag.ExitOnError": "flag", - "flag.Flag": "flag", - "flag.FlagSet": "flag", - "flag.Float64": "flag", - "flag.Float64Var": "flag", - "flag.Getter": "flag", - "flag.Int": "flag", - "flag.Int64": "flag", - "flag.Int64Var": "flag", - "flag.IntVar": "flag", - "flag.Lookup": "flag", - "flag.NArg": "flag", - "flag.NFlag": "flag", - "flag.NewFlagSet": "flag", - "flag.PanicOnError": "flag", - "flag.Parse": "flag", - "flag.Parsed": "flag", - "flag.PrintDefaults": "flag", - "flag.Set": "flag", - "flag.String": "flag", - "flag.StringVar": "flag", - "flag.Uint": "flag", - "flag.Uint64": "flag", - "flag.Uint64Var": "flag", - "flag.UintVar": "flag", - "flag.UnquoteUsage": "flag", - "flag.Usage": "flag", - "flag.Value": "flag", - "flag.Var": "flag", - "flag.Visit": "flag", - "flag.VisitAll": "flag", - "flate.BestCompression": "compress/flate", - "flate.BestSpeed": "compress/flate", - "flate.CorruptInputError": "compress/flate", - "flate.DefaultCompression": "compress/flate", - "flate.HuffmanOnly": "compress/flate", - "flate.InternalError": "compress/flate", - "flate.NewReader": "compress/flate", - "flate.NewReaderDict": "compress/flate", - "flate.NewWriter": "compress/flate", - "flate.NewWriterDict": "compress/flate", - "flate.NoCompression": "compress/flate", - "flate.ReadError": "compress/flate", - "flate.Reader": "compress/flate", - "flate.Resetter": "compress/flate", - "flate.WriteError": "compress/flate", - "flate.Writer": "compress/flate", - "fmt.Errorf": "fmt", - "fmt.Formatter": "fmt", - "fmt.Fprint": "fmt", - "fmt.Fprintf": "fmt", - "fmt.Fprintln": "fmt", - "fmt.Fscan": "fmt", - "fmt.Fscanf": "fmt", - "fmt.Fscanln": "fmt", - "fmt.GoStringer": "fmt", - "fmt.Print": "fmt", - "fmt.Printf": "fmt", - "fmt.Println": "fmt", - "fmt.Scan": "fmt", - "fmt.ScanState": "fmt", - "fmt.Scanf": "fmt", - "fmt.Scanln": "fmt", - "fmt.Scanner": "fmt", - "fmt.Sprint": "fmt", - "fmt.Sprintf": "fmt", - "fmt.Sprintln": "fmt", - "fmt.Sscan": "fmt", - "fmt.Sscanf": "fmt", - "fmt.Sscanln": "fmt", - "fmt.State": "fmt", - "fmt.Stringer": "fmt", - "fnv.New32": "hash/fnv", - "fnv.New32a": "hash/fnv", - "fnv.New64": "hash/fnv", - "fnv.New64a": "hash/fnv", - "format.Node": "go/format", - "format.Source": "go/format", - "gif.Decode": "image/gif", - "gif.DecodeAll": "image/gif", - "gif.DecodeConfig": "image/gif", - "gif.DisposalBackground": "image/gif", - "gif.DisposalNone": "image/gif", - "gif.DisposalPrevious": "image/gif", - "gif.Encode": "image/gif", - "gif.EncodeAll": "image/gif", - "gif.GIF": "image/gif", - "gif.Options": "image/gif", - "gob.CommonType": "encoding/gob", - "gob.Decoder": "encoding/gob", - "gob.Encoder": "encoding/gob", - "gob.GobDecoder": "encoding/gob", - "gob.GobEncoder": "encoding/gob", - "gob.NewDecoder": "encoding/gob", - "gob.NewEncoder": "encoding/gob", - "gob.Register": "encoding/gob", - "gob.RegisterName": "encoding/gob", - "gosym.DecodingError": "debug/gosym", - "gosym.Func": "debug/gosym", - "gosym.LineTable": "debug/gosym", - "gosym.NewLineTable": "debug/gosym", - "gosym.NewTable": "debug/gosym", - "gosym.Obj": "debug/gosym", - "gosym.Sym": "debug/gosym", - "gosym.Table": "debug/gosym", - "gosym.UnknownFileError": "debug/gosym", - "gosym.UnknownLineError": "debug/gosym", - "gzip.BestCompression": "compress/gzip", - "gzip.BestSpeed": "compress/gzip", - "gzip.DefaultCompression": "compress/gzip", - "gzip.ErrChecksum": "compress/gzip", - "gzip.ErrHeader": "compress/gzip", - "gzip.Header": "compress/gzip", - "gzip.NewReader": "compress/gzip", - "gzip.NewWriter": "compress/gzip", - "gzip.NewWriterLevel": "compress/gzip", - "gzip.NoCompression": "compress/gzip", - "gzip.Reader": "compress/gzip", - "gzip.Writer": "compress/gzip", - "hash.Hash": "hash", - "hash.Hash32": "hash", - "hash.Hash64": "hash", - "heap.Fix": "container/heap", - "heap.Init": "container/heap", - "heap.Interface": "container/heap", - "heap.Pop": "container/heap", - "heap.Push": "container/heap", - "heap.Remove": "container/heap", - "hex.Decode": "encoding/hex", - "hex.DecodeString": "encoding/hex", - "hex.DecodedLen": "encoding/hex", - "hex.Dump": "encoding/hex", - "hex.Dumper": "encoding/hex", - "hex.Encode": "encoding/hex", - "hex.EncodeToString": "encoding/hex", - "hex.EncodedLen": "encoding/hex", - "hex.ErrLength": "encoding/hex", - "hex.InvalidByteError": "encoding/hex", - "hmac.Equal": "crypto/hmac", - "hmac.New": "crypto/hmac", - "html.EscapeString": "html", - "html.UnescapeString": "html", - "http.CanonicalHeaderKey": "net/http", - "http.Client": "net/http", - "http.CloseNotifier": "net/http", - "http.ConnState": "net/http", - "http.Cookie": "net/http", - "http.CookieJar": "net/http", - "http.DefaultClient": "net/http", - "http.DefaultMaxHeaderBytes": "net/http", - "http.DefaultMaxIdleConnsPerHost": "net/http", - "http.DefaultServeMux": "net/http", - "http.DefaultTransport": "net/http", - "http.DetectContentType": "net/http", - "http.Dir": "net/http", - "http.ErrBodyNotAllowed": "net/http", - "http.ErrBodyReadAfterClose": "net/http", - "http.ErrContentLength": "net/http", - "http.ErrHandlerTimeout": "net/http", - "http.ErrHeaderTooLong": "net/http", - "http.ErrHijacked": "net/http", - "http.ErrLineTooLong": "net/http", - "http.ErrMissingBoundary": "net/http", - "http.ErrMissingContentLength": "net/http", - "http.ErrMissingFile": "net/http", - "http.ErrNoCookie": "net/http", - "http.ErrNoLocation": "net/http", - "http.ErrNotMultipart": "net/http", - "http.ErrNotSupported": "net/http", - "http.ErrShortBody": "net/http", - "http.ErrSkipAltProtocol": "net/http", - "http.ErrUnexpectedTrailer": "net/http", - "http.ErrUseLastResponse": "net/http", - "http.ErrWriteAfterFlush": "net/http", - "http.Error": "net/http", - "http.File": "net/http", - "http.FileServer": "net/http", - "http.FileSystem": "net/http", - "http.Flusher": "net/http", - "http.Get": "net/http", - "http.Handle": "net/http", - "http.HandleFunc": "net/http", - "http.Handler": "net/http", - "http.HandlerFunc": "net/http", - "http.Head": "net/http", - "http.Header": "net/http", - "http.Hijacker": "net/http", - "http.ListenAndServe": "net/http", - "http.ListenAndServeTLS": "net/http", - "http.LocalAddrContextKey": "net/http", - "http.MaxBytesReader": "net/http", - "http.MethodConnect": "net/http", - "http.MethodDelete": "net/http", - "http.MethodGet": "net/http", - "http.MethodHead": "net/http", - "http.MethodOptions": "net/http", - "http.MethodPatch": "net/http", - "http.MethodPost": "net/http", - "http.MethodPut": "net/http", - "http.MethodTrace": "net/http", - "http.NewFileTransport": "net/http", - "http.NewRequest": "net/http", - "http.NewServeMux": "net/http", - "http.NotFound": "net/http", - "http.NotFoundHandler": "net/http", - "http.ParseHTTPVersion": "net/http", - "http.ParseTime": "net/http", - "http.Post": "net/http", - "http.PostForm": "net/http", - "http.ProtocolError": "net/http", - "http.ProxyFromEnvironment": "net/http", - "http.ProxyURL": "net/http", - "http.ReadRequest": "net/http", - "http.ReadResponse": "net/http", - "http.Redirect": "net/http", - "http.RedirectHandler": "net/http", - "http.Request": "net/http", - "http.Response": "net/http", - "http.ResponseWriter": "net/http", - "http.RoundTripper": "net/http", - "http.Serve": "net/http", - "http.ServeContent": "net/http", - "http.ServeFile": "net/http", - "http.ServeMux": "net/http", - "http.Server": "net/http", - "http.ServerContextKey": "net/http", - "http.SetCookie": "net/http", - "http.StateActive": "net/http", - "http.StateClosed": "net/http", - "http.StateHijacked": "net/http", - "http.StateIdle": "net/http", - "http.StateNew": "net/http", - "http.StatusAccepted": "net/http", - "http.StatusAlreadyReported": "net/http", - "http.StatusBadGateway": "net/http", - "http.StatusBadRequest": "net/http", - "http.StatusConflict": "net/http", - "http.StatusContinue": "net/http", - "http.StatusCreated": "net/http", - "http.StatusExpectationFailed": "net/http", - "http.StatusFailedDependency": "net/http", - "http.StatusForbidden": "net/http", - "http.StatusFound": "net/http", - "http.StatusGatewayTimeout": "net/http", - "http.StatusGone": "net/http", - "http.StatusHTTPVersionNotSupported": "net/http", - "http.StatusIMUsed": "net/http", - "http.StatusInsufficientStorage": "net/http", - "http.StatusInternalServerError": "net/http", - "http.StatusLengthRequired": "net/http", - "http.StatusLocked": "net/http", - "http.StatusLoopDetected": "net/http", - "http.StatusMethodNotAllowed": "net/http", - "http.StatusMovedPermanently": "net/http", - "http.StatusMultiStatus": "net/http", - "http.StatusMultipleChoices": "net/http", - "http.StatusNetworkAuthenticationRequired": "net/http", - "http.StatusNoContent": "net/http", - "http.StatusNonAuthoritativeInfo": "net/http", - "http.StatusNotAcceptable": "net/http", - "http.StatusNotExtended": "net/http", - "http.StatusNotFound": "net/http", - "http.StatusNotImplemented": "net/http", - "http.StatusNotModified": "net/http", - "http.StatusOK": "net/http", - "http.StatusPartialContent": "net/http", - "http.StatusPaymentRequired": "net/http", - "http.StatusPermanentRedirect": "net/http", - "http.StatusPreconditionFailed": "net/http", - "http.StatusPreconditionRequired": "net/http", - "http.StatusProcessing": "net/http", - "http.StatusProxyAuthRequired": "net/http", - "http.StatusRequestEntityTooLarge": "net/http", - "http.StatusRequestHeaderFieldsTooLarge": "net/http", - "http.StatusRequestTimeout": "net/http", - "http.StatusRequestURITooLong": "net/http", - "http.StatusRequestedRangeNotSatisfiable": "net/http", - "http.StatusResetContent": "net/http", - "http.StatusSeeOther": "net/http", - "http.StatusServiceUnavailable": "net/http", - "http.StatusSwitchingProtocols": "net/http", - "http.StatusTeapot": "net/http", - "http.StatusTemporaryRedirect": "net/http", - "http.StatusText": "net/http", - "http.StatusTooManyRequests": "net/http", - "http.StatusUnauthorized": "net/http", - "http.StatusUnavailableForLegalReasons": "net/http", - "http.StatusUnprocessableEntity": "net/http", - "http.StatusUnsupportedMediaType": "net/http", - "http.StatusUpgradeRequired": "net/http", - "http.StatusUseProxy": "net/http", - "http.StatusVariantAlsoNegotiates": "net/http", - "http.StripPrefix": "net/http", - "http.TimeFormat": "net/http", - "http.TimeoutHandler": "net/http", - "http.Transport": "net/http", - "httptest.DefaultRemoteAddr": "net/http/httptest", - "httptest.NewRecorder": "net/http/httptest", - "httptest.NewRequest": "net/http/httptest", - "httptest.NewServer": "net/http/httptest", - "httptest.NewTLSServer": "net/http/httptest", - "httptest.NewUnstartedServer": "net/http/httptest", - "httptest.ResponseRecorder": "net/http/httptest", - "httptest.Server": "net/http/httptest", - "httptrace.ClientTrace": "net/http/httptrace", - "httptrace.ContextClientTrace": "net/http/httptrace", - "httptrace.DNSDoneInfo": "net/http/httptrace", - "httptrace.DNSStartInfo": "net/http/httptrace", - "httptrace.GotConnInfo": "net/http/httptrace", - "httptrace.WithClientTrace": "net/http/httptrace", - "httptrace.WroteRequestInfo": "net/http/httptrace", - "httputil.BufferPool": "net/http/httputil", - "httputil.ClientConn": "net/http/httputil", - "httputil.DumpRequest": "net/http/httputil", - "httputil.DumpRequestOut": "net/http/httputil", - "httputil.DumpResponse": "net/http/httputil", - "httputil.ErrClosed": "net/http/httputil", - "httputil.ErrLineTooLong": "net/http/httputil", - "httputil.ErrPersistEOF": "net/http/httputil", - "httputil.ErrPipeline": "net/http/httputil", - "httputil.NewChunkedReader": "net/http/httputil", - "httputil.NewChunkedWriter": "net/http/httputil", - "httputil.NewClientConn": "net/http/httputil", - "httputil.NewProxyClientConn": "net/http/httputil", - "httputil.NewServerConn": "net/http/httputil", - "httputil.NewSingleHostReverseProxy": "net/http/httputil", - "httputil.ReverseProxy": "net/http/httputil", - "httputil.ServerConn": "net/http/httputil", - "image.Alpha": "image", - "image.Alpha16": "image", - "image.Black": "image", - "image.CMYK": "image", - "image.Config": "image", - "image.Decode": "image", - "image.DecodeConfig": "image", - "image.ErrFormat": "image", - "image.Gray": "image", - "image.Gray16": "image", - "image.Image": "image", - "image.NRGBA": "image", - "image.NRGBA64": "image", - "image.NYCbCrA": "image", - "image.NewAlpha": "image", - "image.NewAlpha16": "image", - "image.NewCMYK": "image", - "image.NewGray": "image", - "image.NewGray16": "image", - "image.NewNRGBA": "image", - "image.NewNRGBA64": "image", - "image.NewNYCbCrA": "image", - "image.NewPaletted": "image", - "image.NewRGBA": "image", - "image.NewRGBA64": "image", - "image.NewUniform": "image", - "image.NewYCbCr": "image", - "image.Opaque": "image", - "image.Paletted": "image", - "image.PalettedImage": "image", - "image.Point": "image", - "image.Pt": "image", - "image.RGBA": "image", - "image.RGBA64": "image", - "image.Rect": "image", - "image.Rectangle": "image", - "image.RegisterFormat": "image", - "image.Transparent": "image", - "image.Uniform": "image", - "image.White": "image", - "image.YCbCr": "image", - "image.YCbCrSubsampleRatio": "image", - "image.YCbCrSubsampleRatio410": "image", - "image.YCbCrSubsampleRatio411": "image", - "image.YCbCrSubsampleRatio420": "image", - "image.YCbCrSubsampleRatio422": "image", - "image.YCbCrSubsampleRatio440": "image", - "image.YCbCrSubsampleRatio444": "image", - "image.ZP": "image", - "image.ZR": "image", - "importer.Default": "go/importer", - "importer.For": "go/importer", - "importer.Lookup": "go/importer", - "io.ByteReader": "io", - "io.ByteScanner": "io", - "io.ByteWriter": "io", - "io.Closer": "io", - "io.Copy": "io", - "io.CopyBuffer": "io", - "io.CopyN": "io", - "io.EOF": "io", - "io.ErrClosedPipe": "io", - "io.ErrNoProgress": "io", - "io.ErrShortBuffer": "io", - "io.ErrShortWrite": "io", - "io.ErrUnexpectedEOF": "io", - "io.LimitReader": "io", - "io.LimitedReader": "io", - "io.MultiReader": "io", - "io.MultiWriter": "io", - "io.NewSectionReader": "io", - "io.Pipe": "io", - "io.PipeReader": "io", - "io.PipeWriter": "io", - "io.ReadAtLeast": "io", - "io.ReadCloser": "io", - "io.ReadFull": "io", - "io.ReadSeeker": "io", - "io.ReadWriteCloser": "io", - "io.ReadWriteSeeker": "io", - "io.ReadWriter": "io", - "io.Reader": "io", - "io.ReaderAt": "io", - "io.ReaderFrom": "io", - "io.RuneReader": "io", - "io.RuneScanner": "io", - "io.SectionReader": "io", - "io.SeekCurrent": "io", - "io.SeekEnd": "io", - "io.SeekStart": "io", - "io.Seeker": "io", - "io.TeeReader": "io", - "io.WriteCloser": "io", - "io.WriteSeeker": "io", - "io.WriteString": "io", - "io.Writer": "io", - "io.WriterAt": "io", - "io.WriterTo": "io", - "iotest.DataErrReader": "testing/iotest", - "iotest.ErrTimeout": "testing/iotest", - "iotest.HalfReader": "testing/iotest", - "iotest.NewReadLogger": "testing/iotest", - "iotest.NewWriteLogger": "testing/iotest", - "iotest.OneByteReader": "testing/iotest", - "iotest.TimeoutReader": "testing/iotest", - "iotest.TruncateWriter": "testing/iotest", - "ioutil.Discard": "io/ioutil", - "ioutil.NopCloser": "io/ioutil", - "ioutil.ReadAll": "io/ioutil", - "ioutil.ReadDir": "io/ioutil", - "ioutil.ReadFile": "io/ioutil", - "ioutil.TempDir": "io/ioutil", - "ioutil.TempFile": "io/ioutil", - "ioutil.WriteFile": "io/ioutil", - "jpeg.Decode": "image/jpeg", - "jpeg.DecodeConfig": "image/jpeg", - "jpeg.DefaultQuality": "image/jpeg", - "jpeg.Encode": "image/jpeg", - "jpeg.FormatError": "image/jpeg", - "jpeg.Options": "image/jpeg", - "jpeg.Reader": "image/jpeg", - "jpeg.UnsupportedError": "image/jpeg", - "json.Compact": "encoding/json", - "json.Decoder": "encoding/json", - "json.Delim": "encoding/json", - "json.Encoder": "encoding/json", - "json.HTMLEscape": "encoding/json", - "json.Indent": "encoding/json", - "json.InvalidUTF8Error": "encoding/json", - "json.InvalidUnmarshalError": "encoding/json", - "json.Marshal": "encoding/json", - "json.MarshalIndent": "encoding/json", - "json.Marshaler": "encoding/json", - "json.MarshalerError": "encoding/json", - "json.NewDecoder": "encoding/json", - "json.NewEncoder": "encoding/json", - "json.Number": "encoding/json", - "json.RawMessage": "encoding/json", - "json.SyntaxError": "encoding/json", - "json.Token": "encoding/json", - "json.Unmarshal": "encoding/json", - "json.UnmarshalFieldError": "encoding/json", - "json.UnmarshalTypeError": "encoding/json", - "json.Unmarshaler": "encoding/json", - "json.UnsupportedTypeError": "encoding/json", - "json.UnsupportedValueError": "encoding/json", - "jsonrpc.Dial": "net/rpc/jsonrpc", - "jsonrpc.NewClient": "net/rpc/jsonrpc", - "jsonrpc.NewClientCodec": "net/rpc/jsonrpc", - "jsonrpc.NewServerCodec": "net/rpc/jsonrpc", - "jsonrpc.ServeConn": "net/rpc/jsonrpc", - "list.Element": "container/list", - "list.List": "container/list", - "list.New": "container/list", - "log.Fatal": "log", - "log.Fatalf": "log", - "log.Fatalln": "log", - "log.Flags": "log", - "log.LUTC": "log", - "log.Ldate": "log", - "log.Llongfile": "log", - "log.Lmicroseconds": "log", - "log.Logger": "log", - "log.Lshortfile": "log", - "log.LstdFlags": "log", - "log.Ltime": "log", - "log.New": "log", - "log.Output": "log", - "log.Panic": "log", - "log.Panicf": "log", - "log.Panicln": "log", - "log.Prefix": "log", - "log.Print": "log", - "log.Printf": "log", - "log.Println": "log", - "log.SetFlags": "log", - "log.SetOutput": "log", - "log.SetPrefix": "log", - "lzw.LSB": "compress/lzw", - "lzw.MSB": "compress/lzw", - "lzw.NewReader": "compress/lzw", - "lzw.NewWriter": "compress/lzw", - "lzw.Order": "compress/lzw", - "macho.Cpu": "debug/macho", - "macho.Cpu386": "debug/macho", - "macho.CpuAmd64": "debug/macho", - "macho.CpuArm": "debug/macho", - "macho.CpuPpc": "debug/macho", - "macho.CpuPpc64": "debug/macho", - "macho.Dylib": "debug/macho", - "macho.DylibCmd": "debug/macho", - "macho.Dysymtab": "debug/macho", - "macho.DysymtabCmd": "debug/macho", - "macho.ErrNotFat": "debug/macho", - "macho.FatArch": "debug/macho", - "macho.FatArchHeader": "debug/macho", - "macho.FatFile": "debug/macho", - "macho.File": "debug/macho", - "macho.FileHeader": "debug/macho", - "macho.FormatError": "debug/macho", - "macho.Load": "debug/macho", - "macho.LoadBytes": "debug/macho", - "macho.LoadCmd": "debug/macho", - "macho.LoadCmdDylib": "debug/macho", - "macho.LoadCmdDylinker": "debug/macho", - "macho.LoadCmdDysymtab": "debug/macho", - "macho.LoadCmdSegment": "debug/macho", - "macho.LoadCmdSegment64": "debug/macho", - "macho.LoadCmdSymtab": "debug/macho", - "macho.LoadCmdThread": "debug/macho", - "macho.LoadCmdUnixThread": "debug/macho", - "macho.Magic32": "debug/macho", - "macho.Magic64": "debug/macho", - "macho.MagicFat": "debug/macho", - "macho.NewFatFile": "debug/macho", - "macho.NewFile": "debug/macho", - "macho.Nlist32": "debug/macho", - "macho.Nlist64": "debug/macho", - "macho.Open": "debug/macho", - "macho.OpenFat": "debug/macho", - "macho.Regs386": "debug/macho", - "macho.RegsAMD64": "debug/macho", - "macho.Section": "debug/macho", - "macho.Section32": "debug/macho", - "macho.Section64": "debug/macho", - "macho.SectionHeader": "debug/macho", - "macho.Segment": "debug/macho", - "macho.Segment32": "debug/macho", - "macho.Segment64": "debug/macho", - "macho.SegmentHeader": "debug/macho", - "macho.Symbol": "debug/macho", - "macho.Symtab": "debug/macho", - "macho.SymtabCmd": "debug/macho", - "macho.Thread": "debug/macho", - "macho.Type": "debug/macho", - "macho.TypeBundle": "debug/macho", - "macho.TypeDylib": "debug/macho", - "macho.TypeExec": "debug/macho", - "macho.TypeObj": "debug/macho", - "mail.Address": "net/mail", - "mail.AddressParser": "net/mail", - "mail.ErrHeaderNotPresent": "net/mail", - "mail.Header": "net/mail", - "mail.Message": "net/mail", - "mail.ParseAddress": "net/mail", - "mail.ParseAddressList": "net/mail", - "mail.ReadMessage": "net/mail", - "math.Abs": "math", - "math.Acos": "math", - "math.Acosh": "math", - "math.Asin": "math", - "math.Asinh": "math", - "math.Atan": "math", - "math.Atan2": "math", - "math.Atanh": "math", - "math.Cbrt": "math", - "math.Ceil": "math", - "math.Copysign": "math", - "math.Cos": "math", - "math.Cosh": "math", - "math.Dim": "math", - "math.E": "math", - "math.Erf": "math", - "math.Erfc": "math", - "math.Exp": "math", - "math.Exp2": "math", - "math.Expm1": "math", - "math.Float32bits": "math", - "math.Float32frombits": "math", - "math.Float64bits": "math", - "math.Float64frombits": "math", - "math.Floor": "math", - "math.Frexp": "math", - "math.Gamma": "math", - "math.Hypot": "math", - "math.Ilogb": "math", - "math.Inf": "math", - "math.IsInf": "math", - "math.IsNaN": "math", - "math.J0": "math", - "math.J1": "math", - "math.Jn": "math", - "math.Ldexp": "math", - "math.Lgamma": "math", - "math.Ln10": "math", - "math.Ln2": "math", - "math.Log": "math", - "math.Log10": "math", - "math.Log10E": "math", - "math.Log1p": "math", - "math.Log2": "math", - "math.Log2E": "math", - "math.Logb": "math", - "math.Max": "math", - "math.MaxFloat32": "math", - "math.MaxFloat64": "math", - "math.MaxInt16": "math", - "math.MaxInt32": "math", - "math.MaxInt64": "math", - "math.MaxInt8": "math", - "math.MaxUint16": "math", - "math.MaxUint32": "math", - "math.MaxUint64": "math", - "math.MaxUint8": "math", - "math.Min": "math", - "math.MinInt16": "math", - "math.MinInt32": "math", - "math.MinInt64": "math", - "math.MinInt8": "math", - "math.Mod": "math", - "math.Modf": "math", - "math.NaN": "math", - "math.Nextafter": "math", - "math.Nextafter32": "math", - "math.Phi": "math", - "math.Pi": "math", - "math.Pow": "math", - "math.Pow10": "math", - "math.Remainder": "math", - "math.Signbit": "math", - "math.Sin": "math", - "math.Sincos": "math", - "math.Sinh": "math", - "math.SmallestNonzeroFloat32": "math", - "math.SmallestNonzeroFloat64": "math", - "math.Sqrt": "math", - "math.Sqrt2": "math", - "math.SqrtE": "math", - "math.SqrtPhi": "math", - "math.SqrtPi": "math", - "math.Tan": "math", - "math.Tanh": "math", - "math.Trunc": "math", - "math.Y0": "math", - "math.Y1": "math", - "math.Yn": "math", - "md5.BlockSize": "crypto/md5", - "md5.New": "crypto/md5", - "md5.Size": "crypto/md5", - "md5.Sum": "crypto/md5", - "mime.AddExtensionType": "mime", - "mime.BEncoding": "mime", - "mime.ExtensionsByType": "mime", - "mime.FormatMediaType": "mime", - "mime.ParseMediaType": "mime", - "mime.QEncoding": "mime", - "mime.TypeByExtension": "mime", - "mime.WordDecoder": "mime", - "mime.WordEncoder": "mime", - "multipart.File": "mime/multipart", - "multipart.FileHeader": "mime/multipart", - "multipart.Form": "mime/multipart", - "multipart.NewReader": "mime/multipart", - "multipart.NewWriter": "mime/multipart", - "multipart.Part": "mime/multipart", - "multipart.Reader": "mime/multipart", - "multipart.Writer": "mime/multipart", - "net.Addr": "net", - "net.AddrError": "net", - "net.CIDRMask": "net", - "net.Conn": "net", - "net.DNSConfigError": "net", - "net.DNSError": "net", - "net.Dial": "net", - "net.DialIP": "net", - "net.DialTCP": "net", - "net.DialTimeout": "net", - "net.DialUDP": "net", - "net.DialUnix": "net", - "net.Dialer": "net", - "net.ErrWriteToConnected": "net", - "net.Error": "net", - "net.FileConn": "net", - "net.FileListener": "net", - "net.FilePacketConn": "net", - "net.FlagBroadcast": "net", - "net.FlagLoopback": "net", - "net.FlagMulticast": "net", - "net.FlagPointToPoint": "net", - "net.FlagUp": "net", - "net.Flags": "net", - "net.HardwareAddr": "net", - "net.IP": "net", - "net.IPAddr": "net", - "net.IPConn": "net", - "net.IPMask": "net", - "net.IPNet": "net", - "net.IPv4": "net", - "net.IPv4Mask": "net", - "net.IPv4allrouter": "net", - "net.IPv4allsys": "net", - "net.IPv4bcast": "net", - "net.IPv4len": "net", - "net.IPv4zero": "net", - "net.IPv6interfacelocalallnodes": "net", - "net.IPv6len": "net", - "net.IPv6linklocalallnodes": "net", - "net.IPv6linklocalallrouters": "net", - "net.IPv6loopback": "net", - "net.IPv6unspecified": "net", - "net.IPv6zero": "net", - "net.Interface": "net", - "net.InterfaceAddrs": "net", - "net.InterfaceByIndex": "net", - "net.InterfaceByName": "net", - "net.Interfaces": "net", - "net.InvalidAddrError": "net", - "net.JoinHostPort": "net", - "net.Listen": "net", - "net.ListenIP": "net", - "net.ListenMulticastUDP": "net", - "net.ListenPacket": "net", - "net.ListenTCP": "net", - "net.ListenUDP": "net", - "net.ListenUnix": "net", - "net.ListenUnixgram": "net", - "net.Listener": "net", - "net.LookupAddr": "net", - "net.LookupCNAME": "net", - "net.LookupHost": "net", - "net.LookupIP": "net", - "net.LookupMX": "net", - "net.LookupNS": "net", - "net.LookupPort": "net", - "net.LookupSRV": "net", - "net.LookupTXT": "net", - "net.MX": "net", - "net.NS": "net", - "net.OpError": "net", - "net.PacketConn": "net", - "net.ParseCIDR": "net", - "net.ParseError": "net", - "net.ParseIP": "net", - "net.ParseMAC": "net", - "net.Pipe": "net", - "net.ResolveIPAddr": "net", - "net.ResolveTCPAddr": "net", - "net.ResolveUDPAddr": "net", - "net.ResolveUnixAddr": "net", - "net.SRV": "net", - "net.SplitHostPort": "net", - "net.TCPAddr": "net", - "net.TCPConn": "net", - "net.TCPListener": "net", - "net.UDPAddr": "net", - "net.UDPConn": "net", - "net.UnixAddr": "net", - "net.UnixConn": "net", - "net.UnixListener": "net", - "net.UnknownNetworkError": "net", - "os.Args": "os", - "os.Chdir": "os", - "os.Chmod": "os", - "os.Chown": "os", - "os.Chtimes": "os", - "os.Clearenv": "os", - "os.Create": "os", - "os.DevNull": "os", - "os.Environ": "os", - "os.ErrExist": "os", - "os.ErrInvalid": "os", - "os.ErrNotExist": "os", - "os.ErrPermission": "os", - "os.Exit": "os", - "os.Expand": "os", - "os.ExpandEnv": "os", - "os.File": "os", - "os.FileInfo": "os", - "os.FileMode": "os", - "os.FindProcess": "os", - "os.Getegid": "os", - "os.Getenv": "os", - "os.Geteuid": "os", - "os.Getgid": "os", - "os.Getgroups": "os", - "os.Getpagesize": "os", - "os.Getpid": "os", - "os.Getppid": "os", - "os.Getuid": "os", - "os.Getwd": "os", - "os.Hostname": "os", - "os.Interrupt": "os", - "os.IsExist": "os", - "os.IsNotExist": "os", - "os.IsPathSeparator": "os", - "os.IsPermission": "os", - "os.Kill": "os", - "os.Lchown": "os", - "os.Link": "os", - "os.LinkError": "os", - "os.LookupEnv": "os", - "os.Lstat": "os", - "os.Mkdir": "os", - "os.MkdirAll": "os", - "os.ModeAppend": "os", - "os.ModeCharDevice": "os", - "os.ModeDevice": "os", - "os.ModeDir": "os", - "os.ModeExclusive": "os", - "os.ModeNamedPipe": "os", - "os.ModePerm": "os", - "os.ModeSetgid": "os", - "os.ModeSetuid": "os", - "os.ModeSocket": "os", - "os.ModeSticky": "os", - "os.ModeSymlink": "os", - "os.ModeTemporary": "os", - "os.ModeType": "os", - "os.NewFile": "os", - "os.NewSyscallError": "os", - "os.O_APPEND": "os", - "os.O_CREATE": "os", - "os.O_EXCL": "os", - "os.O_RDONLY": "os", - "os.O_RDWR": "os", - "os.O_SYNC": "os", - "os.O_TRUNC": "os", - "os.O_WRONLY": "os", - "os.Open": "os", - "os.OpenFile": "os", - "os.PathError": "os", - "os.PathListSeparator": "os", - "os.PathSeparator": "os", - "os.Pipe": "os", - "os.ProcAttr": "os", - "os.Process": "os", - "os.ProcessState": "os", - "os.Readlink": "os", - "os.Remove": "os", - "os.RemoveAll": "os", - "os.Rename": "os", - "os.SEEK_CUR": "os", - "os.SEEK_END": "os", - "os.SEEK_SET": "os", - "os.SameFile": "os", - "os.Setenv": "os", - "os.Signal": "os", - "os.StartProcess": "os", - "os.Stat": "os", - "os.Stderr": "os", - "os.Stdin": "os", - "os.Stdout": "os", - "os.Symlink": "os", - "os.SyscallError": "os", - "os.TempDir": "os", - "os.Truncate": "os", - "os.Unsetenv": "os", - "palette.Plan9": "image/color/palette", - "palette.WebSafe": "image/color/palette", - "parse.ActionNode": "text/template/parse", - "parse.BoolNode": "text/template/parse", - "parse.BranchNode": "text/template/parse", - "parse.ChainNode": "text/template/parse", - "parse.CommandNode": "text/template/parse", - "parse.DotNode": "text/template/parse", - "parse.FieldNode": "text/template/parse", - "parse.IdentifierNode": "text/template/parse", - "parse.IfNode": "text/template/parse", - "parse.IsEmptyTree": "text/template/parse", - "parse.ListNode": "text/template/parse", - "parse.New": "text/template/parse", - "parse.NewIdentifier": "text/template/parse", - "parse.NilNode": "text/template/parse", - "parse.Node": "text/template/parse", - "parse.NodeAction": "text/template/parse", - "parse.NodeBool": "text/template/parse", - "parse.NodeChain": "text/template/parse", - "parse.NodeCommand": "text/template/parse", - "parse.NodeDot": "text/template/parse", - "parse.NodeField": "text/template/parse", - "parse.NodeIdentifier": "text/template/parse", - "parse.NodeIf": "text/template/parse", - "parse.NodeList": "text/template/parse", - "parse.NodeNil": "text/template/parse", - "parse.NodeNumber": "text/template/parse", - "parse.NodePipe": "text/template/parse", - "parse.NodeRange": "text/template/parse", - "parse.NodeString": "text/template/parse", - "parse.NodeTemplate": "text/template/parse", - "parse.NodeText": "text/template/parse", - "parse.NodeType": "text/template/parse", - "parse.NodeVariable": "text/template/parse", - "parse.NodeWith": "text/template/parse", - "parse.NumberNode": "text/template/parse", - "parse.Parse": "text/template/parse", - "parse.PipeNode": "text/template/parse", - "parse.Pos": "text/template/parse", - "parse.RangeNode": "text/template/parse", - "parse.StringNode": "text/template/parse", - "parse.TemplateNode": "text/template/parse", - "parse.TextNode": "text/template/parse", - "parse.Tree": "text/template/parse", - "parse.VariableNode": "text/template/parse", - "parse.WithNode": "text/template/parse", - "parser.AllErrors": "go/parser", - "parser.DeclarationErrors": "go/parser", - "parser.ImportsOnly": "go/parser", - "parser.Mode": "go/parser", - "parser.PackageClauseOnly": "go/parser", - "parser.ParseComments": "go/parser", - "parser.ParseDir": "go/parser", - "parser.ParseExpr": "go/parser", - "parser.ParseExprFrom": "go/parser", - "parser.ParseFile": "go/parser", - "parser.SpuriousErrors": "go/parser", - "parser.Trace": "go/parser", - "path.Base": "path", - "path.Clean": "path", - "path.Dir": "path", - "path.ErrBadPattern": "path", - "path.Ext": "path", - "path.IsAbs": "path", - "path.Join": "path", - "path.Match": "path", - "path.Split": "path", - "pe.COFFSymbol": "debug/pe", - "pe.COFFSymbolSize": "debug/pe", - "pe.DataDirectory": "debug/pe", - "pe.File": "debug/pe", - "pe.FileHeader": "debug/pe", - "pe.FormatError": "debug/pe", - "pe.IMAGE_FILE_MACHINE_AM33": "debug/pe", - "pe.IMAGE_FILE_MACHINE_AMD64": "debug/pe", - "pe.IMAGE_FILE_MACHINE_ARM": "debug/pe", - "pe.IMAGE_FILE_MACHINE_EBC": "debug/pe", - "pe.IMAGE_FILE_MACHINE_I386": "debug/pe", - "pe.IMAGE_FILE_MACHINE_IA64": "debug/pe", - "pe.IMAGE_FILE_MACHINE_M32R": "debug/pe", - "pe.IMAGE_FILE_MACHINE_MIPS16": "debug/pe", - "pe.IMAGE_FILE_MACHINE_MIPSFPU": "debug/pe", - "pe.IMAGE_FILE_MACHINE_MIPSFPU16": "debug/pe", - "pe.IMAGE_FILE_MACHINE_POWERPC": "debug/pe", - "pe.IMAGE_FILE_MACHINE_POWERPCFP": "debug/pe", - "pe.IMAGE_FILE_MACHINE_R4000": "debug/pe", - "pe.IMAGE_FILE_MACHINE_SH3": "debug/pe", - "pe.IMAGE_FILE_MACHINE_SH3DSP": "debug/pe", - "pe.IMAGE_FILE_MACHINE_SH4": "debug/pe", - "pe.IMAGE_FILE_MACHINE_SH5": "debug/pe", - "pe.IMAGE_FILE_MACHINE_THUMB": "debug/pe", - "pe.IMAGE_FILE_MACHINE_UNKNOWN": "debug/pe", - "pe.IMAGE_FILE_MACHINE_WCEMIPSV2": "debug/pe", - "pe.ImportDirectory": "debug/pe", - "pe.NewFile": "debug/pe", - "pe.Open": "debug/pe", - "pe.OptionalHeader32": "debug/pe", - "pe.OptionalHeader64": "debug/pe", - "pe.Section": "debug/pe", - "pe.SectionHeader": "debug/pe", - "pe.SectionHeader32": "debug/pe", - "pe.Symbol": "debug/pe", - "pem.Block": "encoding/pem", - "pem.Decode": "encoding/pem", - "pem.Encode": "encoding/pem", - "pem.EncodeToMemory": "encoding/pem", - "pkix.AlgorithmIdentifier": "crypto/x509/pkix", - "pkix.AttributeTypeAndValue": "crypto/x509/pkix", - "pkix.AttributeTypeAndValueSET": "crypto/x509/pkix", - "pkix.CertificateList": "crypto/x509/pkix", - "pkix.Extension": "crypto/x509/pkix", - "pkix.Name": "crypto/x509/pkix", - "pkix.RDNSequence": "crypto/x509/pkix", - "pkix.RelativeDistinguishedNameSET": "crypto/x509/pkix", - "pkix.RevokedCertificate": "crypto/x509/pkix", - "pkix.TBSCertificateList": "crypto/x509/pkix", - "plan9obj.File": "debug/plan9obj", - "plan9obj.FileHeader": "debug/plan9obj", - "plan9obj.Magic386": "debug/plan9obj", - "plan9obj.Magic64": "debug/plan9obj", - "plan9obj.MagicAMD64": "debug/plan9obj", - "plan9obj.MagicARM": "debug/plan9obj", - "plan9obj.NewFile": "debug/plan9obj", - "plan9obj.Open": "debug/plan9obj", - "plan9obj.Section": "debug/plan9obj", - "plan9obj.SectionHeader": "debug/plan9obj", - "plan9obj.Sym": "debug/plan9obj", - "png.BestCompression": "image/png", - "png.BestSpeed": "image/png", - "png.CompressionLevel": "image/png", - "png.Decode": "image/png", - "png.DecodeConfig": "image/png", - "png.DefaultCompression": "image/png", - "png.Encode": "image/png", - "png.Encoder": "image/png", - "png.FormatError": "image/png", - "png.NoCompression": "image/png", - "png.UnsupportedError": "image/png", - "pprof.Cmdline": "net/http/pprof", - "pprof.Handler": "net/http/pprof", - "pprof.Index": "net/http/pprof", - "pprof.Lookup": "runtime/pprof", - "pprof.NewProfile": "runtime/pprof", - // "pprof.Profile" is ambiguous - "pprof.Profiles": "runtime/pprof", - "pprof.StartCPUProfile": "runtime/pprof", - "pprof.StopCPUProfile": "runtime/pprof", - "pprof.Symbol": "net/http/pprof", - "pprof.Trace": "net/http/pprof", - "pprof.WriteHeapProfile": "runtime/pprof", - "printer.CommentedNode": "go/printer", - "printer.Config": "go/printer", - "printer.Fprint": "go/printer", - "printer.Mode": "go/printer", - "printer.RawFormat": "go/printer", - "printer.SourcePos": "go/printer", - "printer.TabIndent": "go/printer", - "printer.UseSpaces": "go/printer", - "quick.Check": "testing/quick", - "quick.CheckEqual": "testing/quick", - "quick.CheckEqualError": "testing/quick", - "quick.CheckError": "testing/quick", - "quick.Config": "testing/quick", - "quick.Generator": "testing/quick", - "quick.SetupError": "testing/quick", - "quick.Value": "testing/quick", - "quotedprintable.NewReader": "mime/quotedprintable", - "quotedprintable.NewWriter": "mime/quotedprintable", - "quotedprintable.Reader": "mime/quotedprintable", - "quotedprintable.Writer": "mime/quotedprintable", - "rand.ExpFloat64": "math/rand", - "rand.Float32": "math/rand", - "rand.Float64": "math/rand", - // "rand.Int" is ambiguous - "rand.Int31": "math/rand", - "rand.Int31n": "math/rand", - "rand.Int63": "math/rand", - "rand.Int63n": "math/rand", - "rand.Intn": "math/rand", - "rand.New": "math/rand", - "rand.NewSource": "math/rand", - "rand.NewZipf": "math/rand", - "rand.NormFloat64": "math/rand", - "rand.Perm": "math/rand", - "rand.Prime": "crypto/rand", - "rand.Rand": "math/rand", - // "rand.Read" is ambiguous - "rand.Reader": "crypto/rand", - "rand.Seed": "math/rand", - "rand.Source": "math/rand", - "rand.Uint32": "math/rand", - "rand.Zipf": "math/rand", - "rc4.Cipher": "crypto/rc4", - "rc4.KeySizeError": "crypto/rc4", - "rc4.NewCipher": "crypto/rc4", - "reflect.Append": "reflect", - "reflect.AppendSlice": "reflect", - "reflect.Array": "reflect", - "reflect.ArrayOf": "reflect", - "reflect.Bool": "reflect", - "reflect.BothDir": "reflect", - "reflect.Chan": "reflect", - "reflect.ChanDir": "reflect", - "reflect.ChanOf": "reflect", - "reflect.Complex128": "reflect", - "reflect.Complex64": "reflect", - "reflect.Copy": "reflect", - "reflect.DeepEqual": "reflect", - "reflect.Float32": "reflect", - "reflect.Float64": "reflect", - "reflect.Func": "reflect", - "reflect.FuncOf": "reflect", - "reflect.Indirect": "reflect", - "reflect.Int": "reflect", - "reflect.Int16": "reflect", - "reflect.Int32": "reflect", - "reflect.Int64": "reflect", - "reflect.Int8": "reflect", - "reflect.Interface": "reflect", - "reflect.Invalid": "reflect", - "reflect.Kind": "reflect", - "reflect.MakeChan": "reflect", - "reflect.MakeFunc": "reflect", - "reflect.MakeMap": "reflect", - "reflect.MakeSlice": "reflect", - "reflect.Map": "reflect", - "reflect.MapOf": "reflect", - "reflect.Method": "reflect", - "reflect.New": "reflect", - "reflect.NewAt": "reflect", - "reflect.Ptr": "reflect", - "reflect.PtrTo": "reflect", - "reflect.RecvDir": "reflect", - "reflect.Select": "reflect", - "reflect.SelectCase": "reflect", - "reflect.SelectDefault": "reflect", - "reflect.SelectDir": "reflect", - "reflect.SelectRecv": "reflect", - "reflect.SelectSend": "reflect", - "reflect.SendDir": "reflect", - "reflect.Slice": "reflect", - "reflect.SliceHeader": "reflect", - "reflect.SliceOf": "reflect", - "reflect.String": "reflect", - "reflect.StringHeader": "reflect", - "reflect.Struct": "reflect", - "reflect.StructField": "reflect", - "reflect.StructOf": "reflect", - "reflect.StructTag": "reflect", - "reflect.TypeOf": "reflect", - "reflect.Uint": "reflect", - "reflect.Uint16": "reflect", - "reflect.Uint32": "reflect", - "reflect.Uint64": "reflect", - "reflect.Uint8": "reflect", - "reflect.Uintptr": "reflect", - "reflect.UnsafePointer": "reflect", - "reflect.Value": "reflect", - "reflect.ValueError": "reflect", - "reflect.ValueOf": "reflect", - "reflect.Zero": "reflect", - "regexp.Compile": "regexp", - "regexp.CompilePOSIX": "regexp", - "regexp.Match": "regexp", - "regexp.MatchReader": "regexp", - "regexp.MatchString": "regexp", - "regexp.MustCompile": "regexp", - "regexp.MustCompilePOSIX": "regexp", - "regexp.QuoteMeta": "regexp", - "regexp.Regexp": "regexp", - "ring.New": "container/ring", - "ring.Ring": "container/ring", - "rpc.Accept": "net/rpc", - "rpc.Call": "net/rpc", - "rpc.Client": "net/rpc", - "rpc.ClientCodec": "net/rpc", - "rpc.DefaultDebugPath": "net/rpc", - "rpc.DefaultRPCPath": "net/rpc", - "rpc.DefaultServer": "net/rpc", - "rpc.Dial": "net/rpc", - "rpc.DialHTTP": "net/rpc", - "rpc.DialHTTPPath": "net/rpc", - "rpc.ErrShutdown": "net/rpc", - "rpc.HandleHTTP": "net/rpc", - "rpc.NewClient": "net/rpc", - "rpc.NewClientWithCodec": "net/rpc", - "rpc.NewServer": "net/rpc", - "rpc.Register": "net/rpc", - "rpc.RegisterName": "net/rpc", - "rpc.Request": "net/rpc", - "rpc.Response": "net/rpc", - "rpc.ServeCodec": "net/rpc", - "rpc.ServeConn": "net/rpc", - "rpc.ServeRequest": "net/rpc", - "rpc.Server": "net/rpc", - "rpc.ServerCodec": "net/rpc", - "rpc.ServerError": "net/rpc", - "rsa.CRTValue": "crypto/rsa", - "rsa.DecryptOAEP": "crypto/rsa", - "rsa.DecryptPKCS1v15": "crypto/rsa", - "rsa.DecryptPKCS1v15SessionKey": "crypto/rsa", - "rsa.EncryptOAEP": "crypto/rsa", - "rsa.EncryptPKCS1v15": "crypto/rsa", - "rsa.ErrDecryption": "crypto/rsa", - "rsa.ErrMessageTooLong": "crypto/rsa", - "rsa.ErrVerification": "crypto/rsa", - "rsa.GenerateKey": "crypto/rsa", - "rsa.GenerateMultiPrimeKey": "crypto/rsa", - "rsa.OAEPOptions": "crypto/rsa", - "rsa.PKCS1v15DecryptOptions": "crypto/rsa", - "rsa.PSSOptions": "crypto/rsa", - "rsa.PSSSaltLengthAuto": "crypto/rsa", - "rsa.PSSSaltLengthEqualsHash": "crypto/rsa", - "rsa.PrecomputedValues": "crypto/rsa", - "rsa.PrivateKey": "crypto/rsa", - "rsa.PublicKey": "crypto/rsa", - "rsa.SignPKCS1v15": "crypto/rsa", - "rsa.SignPSS": "crypto/rsa", - "rsa.VerifyPKCS1v15": "crypto/rsa", - "rsa.VerifyPSS": "crypto/rsa", - "runtime.BlockProfile": "runtime", - "runtime.BlockProfileRecord": "runtime", - "runtime.Breakpoint": "runtime", - "runtime.CPUProfile": "runtime", - "runtime.Caller": "runtime", - "runtime.Callers": "runtime", - "runtime.CallersFrames": "runtime", - "runtime.Compiler": "runtime", - "runtime.Error": "runtime", - "runtime.Frame": "runtime", - "runtime.Frames": "runtime", - "runtime.Func": "runtime", - "runtime.FuncForPC": "runtime", - "runtime.GC": "runtime", - "runtime.GOARCH": "runtime", - "runtime.GOMAXPROCS": "runtime", - "runtime.GOOS": "runtime", - "runtime.GOROOT": "runtime", - "runtime.Goexit": "runtime", - "runtime.GoroutineProfile": "runtime", - "runtime.Gosched": "runtime", - "runtime.KeepAlive": "runtime", - "runtime.LockOSThread": "runtime", - "runtime.MemProfile": "runtime", - "runtime.MemProfileRate": "runtime", - "runtime.MemProfileRecord": "runtime", - "runtime.MemStats": "runtime", - "runtime.NumCPU": "runtime", - "runtime.NumCgoCall": "runtime", - "runtime.NumGoroutine": "runtime", - "runtime.ReadMemStats": "runtime", - "runtime.ReadTrace": "runtime", - "runtime.SetBlockProfileRate": "runtime", - "runtime.SetCPUProfileRate": "runtime", - "runtime.SetCgoTraceback": "runtime", - "runtime.SetFinalizer": "runtime", - "runtime.Stack": "runtime", - "runtime.StackRecord": "runtime", - "runtime.StartTrace": "runtime", - "runtime.StopTrace": "runtime", - "runtime.ThreadCreateProfile": "runtime", - "runtime.TypeAssertionError": "runtime", - "runtime.UnlockOSThread": "runtime", - "runtime.Version": "runtime", - "scanner.Char": "text/scanner", - "scanner.Comment": "text/scanner", - "scanner.EOF": "text/scanner", - "scanner.Error": "go/scanner", - "scanner.ErrorHandler": "go/scanner", - "scanner.ErrorList": "go/scanner", - "scanner.Float": "text/scanner", - "scanner.GoTokens": "text/scanner", - "scanner.GoWhitespace": "text/scanner", - "scanner.Ident": "text/scanner", - "scanner.Int": "text/scanner", - "scanner.Mode": "go/scanner", - "scanner.Position": "text/scanner", - "scanner.PrintError": "go/scanner", - "scanner.RawString": "text/scanner", - "scanner.ScanChars": "text/scanner", - // "scanner.ScanComments" is ambiguous - "scanner.ScanFloats": "text/scanner", - "scanner.ScanIdents": "text/scanner", - "scanner.ScanInts": "text/scanner", - "scanner.ScanRawStrings": "text/scanner", - "scanner.ScanStrings": "text/scanner", - // "scanner.Scanner" is ambiguous - "scanner.SkipComments": "text/scanner", - "scanner.String": "text/scanner", - "scanner.TokenString": "text/scanner", - "sha1.BlockSize": "crypto/sha1", - "sha1.New": "crypto/sha1", - "sha1.Size": "crypto/sha1", - "sha1.Sum": "crypto/sha1", - "sha256.BlockSize": "crypto/sha256", - "sha256.New": "crypto/sha256", - "sha256.New224": "crypto/sha256", - "sha256.Size": "crypto/sha256", - "sha256.Size224": "crypto/sha256", - "sha256.Sum224": "crypto/sha256", - "sha256.Sum256": "crypto/sha256", - "sha512.BlockSize": "crypto/sha512", - "sha512.New": "crypto/sha512", - "sha512.New384": "crypto/sha512", - "sha512.New512_224": "crypto/sha512", - "sha512.New512_256": "crypto/sha512", - "sha512.Size": "crypto/sha512", - "sha512.Size224": "crypto/sha512", - "sha512.Size256": "crypto/sha512", - "sha512.Size384": "crypto/sha512", - "sha512.Sum384": "crypto/sha512", - "sha512.Sum512": "crypto/sha512", - "sha512.Sum512_224": "crypto/sha512", - "sha512.Sum512_256": "crypto/sha512", - "signal.Ignore": "os/signal", - "signal.Notify": "os/signal", - "signal.Reset": "os/signal", - "signal.Stop": "os/signal", - "smtp.Auth": "net/smtp", - "smtp.CRAMMD5Auth": "net/smtp", - "smtp.Client": "net/smtp", - "smtp.Dial": "net/smtp", - "smtp.NewClient": "net/smtp", - "smtp.PlainAuth": "net/smtp", - "smtp.SendMail": "net/smtp", - "smtp.ServerInfo": "net/smtp", - "sort.Float64Slice": "sort", - "sort.Float64s": "sort", - "sort.Float64sAreSorted": "sort", - "sort.IntSlice": "sort", - "sort.Interface": "sort", - "sort.Ints": "sort", - "sort.IntsAreSorted": "sort", - "sort.IsSorted": "sort", - "sort.Reverse": "sort", - "sort.Search": "sort", - "sort.SearchFloat64s": "sort", - "sort.SearchInts": "sort", - "sort.SearchStrings": "sort", - "sort.Sort": "sort", - "sort.Stable": "sort", - "sort.StringSlice": "sort", - "sort.Strings": "sort", - "sort.StringsAreSorted": "sort", - "sql.DB": "database/sql", - "sql.DBStats": "database/sql", - "sql.Drivers": "database/sql", - "sql.ErrNoRows": "database/sql", - "sql.ErrTxDone": "database/sql", - "sql.NullBool": "database/sql", - "sql.NullFloat64": "database/sql", - "sql.NullInt64": "database/sql", - "sql.NullString": "database/sql", - "sql.Open": "database/sql", - "sql.RawBytes": "database/sql", - "sql.Register": "database/sql", - "sql.Result": "database/sql", - "sql.Row": "database/sql", - "sql.Rows": "database/sql", - "sql.Scanner": "database/sql", - "sql.Stmt": "database/sql", - "sql.Tx": "database/sql", - "strconv.AppendBool": "strconv", - "strconv.AppendFloat": "strconv", - "strconv.AppendInt": "strconv", - "strconv.AppendQuote": "strconv", - "strconv.AppendQuoteRune": "strconv", - "strconv.AppendQuoteRuneToASCII": "strconv", - "strconv.AppendQuoteRuneToGraphic": "strconv", - "strconv.AppendQuoteToASCII": "strconv", - "strconv.AppendQuoteToGraphic": "strconv", - "strconv.AppendUint": "strconv", - "strconv.Atoi": "strconv", - "strconv.CanBackquote": "strconv", - "strconv.ErrRange": "strconv", - "strconv.ErrSyntax": "strconv", - "strconv.FormatBool": "strconv", - "strconv.FormatFloat": "strconv", - "strconv.FormatInt": "strconv", - "strconv.FormatUint": "strconv", - "strconv.IntSize": "strconv", - "strconv.IsGraphic": "strconv", - "strconv.IsPrint": "strconv", - "strconv.Itoa": "strconv", - "strconv.NumError": "strconv", - "strconv.ParseBool": "strconv", - "strconv.ParseFloat": "strconv", - "strconv.ParseInt": "strconv", - "strconv.ParseUint": "strconv", - "strconv.Quote": "strconv", - "strconv.QuoteRune": "strconv", - "strconv.QuoteRuneToASCII": "strconv", - "strconv.QuoteRuneToGraphic": "strconv", - "strconv.QuoteToASCII": "strconv", - "strconv.QuoteToGraphic": "strconv", - "strconv.Unquote": "strconv", - "strconv.UnquoteChar": "strconv", - "strings.Compare": "strings", - "strings.Contains": "strings", - "strings.ContainsAny": "strings", - "strings.ContainsRune": "strings", - "strings.Count": "strings", - "strings.EqualFold": "strings", - "strings.Fields": "strings", - "strings.FieldsFunc": "strings", - "strings.HasPrefix": "strings", - "strings.HasSuffix": "strings", - "strings.Index": "strings", - "strings.IndexAny": "strings", - "strings.IndexByte": "strings", - "strings.IndexFunc": "strings", - "strings.IndexRune": "strings", - "strings.Join": "strings", - "strings.LastIndex": "strings", - "strings.LastIndexAny": "strings", - "strings.LastIndexByte": "strings", - "strings.LastIndexFunc": "strings", - "strings.Map": "strings", - "strings.NewReader": "strings", - "strings.NewReplacer": "strings", - "strings.Reader": "strings", - "strings.Repeat": "strings", - "strings.Replace": "strings", - "strings.Replacer": "strings", - "strings.Split": "strings", - "strings.SplitAfter": "strings", - "strings.SplitAfterN": "strings", - "strings.SplitN": "strings", - "strings.Title": "strings", - "strings.ToLower": "strings", - "strings.ToLowerSpecial": "strings", - "strings.ToTitle": "strings", - "strings.ToTitleSpecial": "strings", - "strings.ToUpper": "strings", - "strings.ToUpperSpecial": "strings", - "strings.Trim": "strings", - "strings.TrimFunc": "strings", - "strings.TrimLeft": "strings", - "strings.TrimLeftFunc": "strings", - "strings.TrimPrefix": "strings", - "strings.TrimRight": "strings", - "strings.TrimRightFunc": "strings", - "strings.TrimSpace": "strings", - "strings.TrimSuffix": "strings", - "subtle.ConstantTimeByteEq": "crypto/subtle", - "subtle.ConstantTimeCompare": "crypto/subtle", - "subtle.ConstantTimeCopy": "crypto/subtle", - "subtle.ConstantTimeEq": "crypto/subtle", - "subtle.ConstantTimeLessOrEq": "crypto/subtle", - "subtle.ConstantTimeSelect": "crypto/subtle", - "suffixarray.Index": "index/suffixarray", - "suffixarray.New": "index/suffixarray", - "sync.Cond": "sync", - "sync.Locker": "sync", - "sync.Mutex": "sync", - "sync.NewCond": "sync", - "sync.Once": "sync", - "sync.Pool": "sync", - "sync.RWMutex": "sync", - "sync.WaitGroup": "sync", - "syntax.ClassNL": "regexp/syntax", - "syntax.Compile": "regexp/syntax", - "syntax.DotNL": "regexp/syntax", - "syntax.EmptyBeginLine": "regexp/syntax", - "syntax.EmptyBeginText": "regexp/syntax", - "syntax.EmptyEndLine": "regexp/syntax", - "syntax.EmptyEndText": "regexp/syntax", - "syntax.EmptyNoWordBoundary": "regexp/syntax", - "syntax.EmptyOp": "regexp/syntax", - "syntax.EmptyOpContext": "regexp/syntax", - "syntax.EmptyWordBoundary": "regexp/syntax", - "syntax.ErrInternalError": "regexp/syntax", - "syntax.ErrInvalidCharClass": "regexp/syntax", - "syntax.ErrInvalidCharRange": "regexp/syntax", - "syntax.ErrInvalidEscape": "regexp/syntax", - "syntax.ErrInvalidNamedCapture": "regexp/syntax", - "syntax.ErrInvalidPerlOp": "regexp/syntax", - "syntax.ErrInvalidRepeatOp": "regexp/syntax", - "syntax.ErrInvalidRepeatSize": "regexp/syntax", - "syntax.ErrInvalidUTF8": "regexp/syntax", - "syntax.ErrMissingBracket": "regexp/syntax", - "syntax.ErrMissingParen": "regexp/syntax", - "syntax.ErrMissingRepeatArgument": "regexp/syntax", - "syntax.ErrTrailingBackslash": "regexp/syntax", - "syntax.ErrUnexpectedParen": "regexp/syntax", - "syntax.Error": "regexp/syntax", - "syntax.ErrorCode": "regexp/syntax", - "syntax.Flags": "regexp/syntax", - "syntax.FoldCase": "regexp/syntax", - "syntax.Inst": "regexp/syntax", - "syntax.InstAlt": "regexp/syntax", - "syntax.InstAltMatch": "regexp/syntax", - "syntax.InstCapture": "regexp/syntax", - "syntax.InstEmptyWidth": "regexp/syntax", - "syntax.InstFail": "regexp/syntax", - "syntax.InstMatch": "regexp/syntax", - "syntax.InstNop": "regexp/syntax", - "syntax.InstOp": "regexp/syntax", - "syntax.InstRune": "regexp/syntax", - "syntax.InstRune1": "regexp/syntax", - "syntax.InstRuneAny": "regexp/syntax", - "syntax.InstRuneAnyNotNL": "regexp/syntax", - "syntax.IsWordChar": "regexp/syntax", - "syntax.Literal": "regexp/syntax", - "syntax.MatchNL": "regexp/syntax", - "syntax.NonGreedy": "regexp/syntax", - "syntax.OneLine": "regexp/syntax", - "syntax.Op": "regexp/syntax", - "syntax.OpAlternate": "regexp/syntax", - "syntax.OpAnyChar": "regexp/syntax", - "syntax.OpAnyCharNotNL": "regexp/syntax", - "syntax.OpBeginLine": "regexp/syntax", - "syntax.OpBeginText": "regexp/syntax", - "syntax.OpCapture": "regexp/syntax", - "syntax.OpCharClass": "regexp/syntax", - "syntax.OpConcat": "regexp/syntax", - "syntax.OpEmptyMatch": "regexp/syntax", - "syntax.OpEndLine": "regexp/syntax", - "syntax.OpEndText": "regexp/syntax", - "syntax.OpLiteral": "regexp/syntax", - "syntax.OpNoMatch": "regexp/syntax", - "syntax.OpNoWordBoundary": "regexp/syntax", - "syntax.OpPlus": "regexp/syntax", - "syntax.OpQuest": "regexp/syntax", - "syntax.OpRepeat": "regexp/syntax", - "syntax.OpStar": "regexp/syntax", - "syntax.OpWordBoundary": "regexp/syntax", - "syntax.POSIX": "regexp/syntax", - "syntax.Parse": "regexp/syntax", - "syntax.Perl": "regexp/syntax", - "syntax.PerlX": "regexp/syntax", - "syntax.Prog": "regexp/syntax", - "syntax.Regexp": "regexp/syntax", - "syntax.Simple": "regexp/syntax", - "syntax.UnicodeGroups": "regexp/syntax", - "syntax.WasDollar": "regexp/syntax", - "syscall.AF_ALG": "syscall", - "syscall.AF_APPLETALK": "syscall", - "syscall.AF_ARP": "syscall", - "syscall.AF_ASH": "syscall", - "syscall.AF_ATM": "syscall", - "syscall.AF_ATMPVC": "syscall", - "syscall.AF_ATMSVC": "syscall", - "syscall.AF_AX25": "syscall", - "syscall.AF_BLUETOOTH": "syscall", - "syscall.AF_BRIDGE": "syscall", - "syscall.AF_CAIF": "syscall", - "syscall.AF_CAN": "syscall", - "syscall.AF_CCITT": "syscall", - "syscall.AF_CHAOS": "syscall", - "syscall.AF_CNT": "syscall", - "syscall.AF_COIP": "syscall", - "syscall.AF_DATAKIT": "syscall", - "syscall.AF_DECnet": "syscall", - "syscall.AF_DLI": "syscall", - "syscall.AF_E164": "syscall", - "syscall.AF_ECMA": "syscall", - "syscall.AF_ECONET": "syscall", - "syscall.AF_ENCAP": "syscall", - "syscall.AF_FILE": "syscall", - "syscall.AF_HYLINK": "syscall", - "syscall.AF_IEEE80211": "syscall", - "syscall.AF_IEEE802154": "syscall", - "syscall.AF_IMPLINK": "syscall", - "syscall.AF_INET": "syscall", - "syscall.AF_INET6": "syscall", - "syscall.AF_INET6_SDP": "syscall", - "syscall.AF_INET_SDP": "syscall", - "syscall.AF_IPX": "syscall", - "syscall.AF_IRDA": "syscall", - "syscall.AF_ISDN": "syscall", - "syscall.AF_ISO": "syscall", - "syscall.AF_IUCV": "syscall", - "syscall.AF_KEY": "syscall", - "syscall.AF_LAT": "syscall", - "syscall.AF_LINK": "syscall", - "syscall.AF_LLC": "syscall", - "syscall.AF_LOCAL": "syscall", - "syscall.AF_MAX": "syscall", - "syscall.AF_MPLS": "syscall", - "syscall.AF_NATM": "syscall", - "syscall.AF_NDRV": "syscall", - "syscall.AF_NETBEUI": "syscall", - "syscall.AF_NETBIOS": "syscall", - "syscall.AF_NETGRAPH": "syscall", - "syscall.AF_NETLINK": "syscall", - "syscall.AF_NETROM": "syscall", - "syscall.AF_NS": "syscall", - "syscall.AF_OROUTE": "syscall", - "syscall.AF_OSI": "syscall", - "syscall.AF_PACKET": "syscall", - "syscall.AF_PHONET": "syscall", - "syscall.AF_PPP": "syscall", - "syscall.AF_PPPOX": "syscall", - "syscall.AF_PUP": "syscall", - "syscall.AF_RDS": "syscall", - "syscall.AF_RESERVED_36": "syscall", - "syscall.AF_ROSE": "syscall", - "syscall.AF_ROUTE": "syscall", - "syscall.AF_RXRPC": "syscall", - "syscall.AF_SCLUSTER": "syscall", - "syscall.AF_SECURITY": "syscall", - "syscall.AF_SIP": "syscall", - "syscall.AF_SLOW": "syscall", - "syscall.AF_SNA": "syscall", - "syscall.AF_SYSTEM": "syscall", - "syscall.AF_TIPC": "syscall", - "syscall.AF_UNIX": "syscall", - "syscall.AF_UNSPEC": "syscall", - "syscall.AF_VENDOR00": "syscall", - "syscall.AF_VENDOR01": "syscall", - "syscall.AF_VENDOR02": "syscall", - "syscall.AF_VENDOR03": "syscall", - "syscall.AF_VENDOR04": "syscall", - "syscall.AF_VENDOR05": "syscall", - "syscall.AF_VENDOR06": "syscall", - "syscall.AF_VENDOR07": "syscall", - "syscall.AF_VENDOR08": "syscall", - "syscall.AF_VENDOR09": "syscall", - "syscall.AF_VENDOR10": "syscall", - "syscall.AF_VENDOR11": "syscall", - "syscall.AF_VENDOR12": "syscall", - "syscall.AF_VENDOR13": "syscall", - "syscall.AF_VENDOR14": "syscall", - "syscall.AF_VENDOR15": "syscall", - "syscall.AF_VENDOR16": "syscall", - "syscall.AF_VENDOR17": "syscall", - "syscall.AF_VENDOR18": "syscall", - "syscall.AF_VENDOR19": "syscall", - "syscall.AF_VENDOR20": "syscall", - "syscall.AF_VENDOR21": "syscall", - "syscall.AF_VENDOR22": "syscall", - "syscall.AF_VENDOR23": "syscall", - "syscall.AF_VENDOR24": "syscall", - "syscall.AF_VENDOR25": "syscall", - "syscall.AF_VENDOR26": "syscall", - "syscall.AF_VENDOR27": "syscall", - "syscall.AF_VENDOR28": "syscall", - "syscall.AF_VENDOR29": "syscall", - "syscall.AF_VENDOR30": "syscall", - "syscall.AF_VENDOR31": "syscall", - "syscall.AF_VENDOR32": "syscall", - "syscall.AF_VENDOR33": "syscall", - "syscall.AF_VENDOR34": "syscall", - "syscall.AF_VENDOR35": "syscall", - "syscall.AF_VENDOR36": "syscall", - "syscall.AF_VENDOR37": "syscall", - "syscall.AF_VENDOR38": "syscall", - "syscall.AF_VENDOR39": "syscall", - "syscall.AF_VENDOR40": "syscall", - "syscall.AF_VENDOR41": "syscall", - "syscall.AF_VENDOR42": "syscall", - "syscall.AF_VENDOR43": "syscall", - "syscall.AF_VENDOR44": "syscall", - "syscall.AF_VENDOR45": "syscall", - "syscall.AF_VENDOR46": "syscall", - "syscall.AF_VENDOR47": "syscall", - "syscall.AF_WANPIPE": "syscall", - "syscall.AF_X25": "syscall", - "syscall.AI_CANONNAME": "syscall", - "syscall.AI_NUMERICHOST": "syscall", - "syscall.AI_PASSIVE": "syscall", - "syscall.APPLICATION_ERROR": "syscall", - "syscall.ARPHRD_ADAPT": "syscall", - "syscall.ARPHRD_APPLETLK": "syscall", - "syscall.ARPHRD_ARCNET": "syscall", - "syscall.ARPHRD_ASH": "syscall", - "syscall.ARPHRD_ATM": "syscall", - "syscall.ARPHRD_AX25": "syscall", - "syscall.ARPHRD_BIF": "syscall", - "syscall.ARPHRD_CHAOS": "syscall", - "syscall.ARPHRD_CISCO": "syscall", - "syscall.ARPHRD_CSLIP": "syscall", - "syscall.ARPHRD_CSLIP6": "syscall", - "syscall.ARPHRD_DDCMP": "syscall", - "syscall.ARPHRD_DLCI": "syscall", - "syscall.ARPHRD_ECONET": "syscall", - "syscall.ARPHRD_EETHER": "syscall", - "syscall.ARPHRD_ETHER": "syscall", - "syscall.ARPHRD_EUI64": "syscall", - "syscall.ARPHRD_FCAL": "syscall", - "syscall.ARPHRD_FCFABRIC": "syscall", - "syscall.ARPHRD_FCPL": "syscall", - "syscall.ARPHRD_FCPP": "syscall", - "syscall.ARPHRD_FDDI": "syscall", - "syscall.ARPHRD_FRAD": "syscall", - "syscall.ARPHRD_FRELAY": "syscall", - "syscall.ARPHRD_HDLC": "syscall", - "syscall.ARPHRD_HIPPI": "syscall", - "syscall.ARPHRD_HWX25": "syscall", - "syscall.ARPHRD_IEEE1394": "syscall", - "syscall.ARPHRD_IEEE802": "syscall", - "syscall.ARPHRD_IEEE80211": "syscall", - "syscall.ARPHRD_IEEE80211_PRISM": "syscall", - "syscall.ARPHRD_IEEE80211_RADIOTAP": "syscall", - "syscall.ARPHRD_IEEE802154": "syscall", - "syscall.ARPHRD_IEEE802154_PHY": "syscall", - "syscall.ARPHRD_IEEE802_TR": "syscall", - "syscall.ARPHRD_INFINIBAND": "syscall", - "syscall.ARPHRD_IPDDP": "syscall", - "syscall.ARPHRD_IPGRE": "syscall", - "syscall.ARPHRD_IRDA": "syscall", - "syscall.ARPHRD_LAPB": "syscall", - "syscall.ARPHRD_LOCALTLK": "syscall", - "syscall.ARPHRD_LOOPBACK": "syscall", - "syscall.ARPHRD_METRICOM": "syscall", - "syscall.ARPHRD_NETROM": "syscall", - "syscall.ARPHRD_NONE": "syscall", - "syscall.ARPHRD_PIMREG": "syscall", - "syscall.ARPHRD_PPP": "syscall", - "syscall.ARPHRD_PRONET": "syscall", - "syscall.ARPHRD_RAWHDLC": "syscall", - "syscall.ARPHRD_ROSE": "syscall", - "syscall.ARPHRD_RSRVD": "syscall", - "syscall.ARPHRD_SIT": "syscall", - "syscall.ARPHRD_SKIP": "syscall", - "syscall.ARPHRD_SLIP": "syscall", - "syscall.ARPHRD_SLIP6": "syscall", - "syscall.ARPHRD_STRIP": "syscall", - "syscall.ARPHRD_TUNNEL": "syscall", - "syscall.ARPHRD_TUNNEL6": "syscall", - "syscall.ARPHRD_VOID": "syscall", - "syscall.ARPHRD_X25": "syscall", - "syscall.AUTHTYPE_CLIENT": "syscall", - "syscall.AUTHTYPE_SERVER": "syscall", - "syscall.Accept": "syscall", - "syscall.Accept4": "syscall", - "syscall.AcceptEx": "syscall", - "syscall.Access": "syscall", - "syscall.Acct": "syscall", - "syscall.AddrinfoW": "syscall", - "syscall.Adjtime": "syscall", - "syscall.Adjtimex": "syscall", - "syscall.AttachLsf": "syscall", - "syscall.B0": "syscall", - "syscall.B1000000": "syscall", - "syscall.B110": "syscall", - "syscall.B115200": "syscall", - "syscall.B1152000": "syscall", - "syscall.B1200": "syscall", - "syscall.B134": "syscall", - "syscall.B14400": "syscall", - "syscall.B150": "syscall", - "syscall.B1500000": "syscall", - "syscall.B1800": "syscall", - "syscall.B19200": "syscall", - "syscall.B200": "syscall", - "syscall.B2000000": "syscall", - "syscall.B230400": "syscall", - "syscall.B2400": "syscall", - "syscall.B2500000": "syscall", - "syscall.B28800": "syscall", - "syscall.B300": "syscall", - "syscall.B3000000": "syscall", - "syscall.B3500000": "syscall", - "syscall.B38400": "syscall", - "syscall.B4000000": "syscall", - "syscall.B460800": "syscall", - "syscall.B4800": "syscall", - "syscall.B50": "syscall", - "syscall.B500000": "syscall", - "syscall.B57600": "syscall", - "syscall.B576000": "syscall", - "syscall.B600": "syscall", - "syscall.B7200": "syscall", - "syscall.B75": "syscall", - "syscall.B76800": "syscall", - "syscall.B921600": "syscall", - "syscall.B9600": "syscall", - "syscall.BASE_PROTOCOL": "syscall", - "syscall.BIOCFEEDBACK": "syscall", - "syscall.BIOCFLUSH": "syscall", - "syscall.BIOCGBLEN": "syscall", - "syscall.BIOCGDIRECTION": "syscall", - "syscall.BIOCGDIRFILT": "syscall", - "syscall.BIOCGDLT": "syscall", - "syscall.BIOCGDLTLIST": "syscall", - "syscall.BIOCGETBUFMODE": "syscall", - "syscall.BIOCGETIF": "syscall", - "syscall.BIOCGETZMAX": "syscall", - "syscall.BIOCGFEEDBACK": "syscall", - "syscall.BIOCGFILDROP": "syscall", - "syscall.BIOCGHDRCMPLT": "syscall", - "syscall.BIOCGRSIG": "syscall", - "syscall.BIOCGRTIMEOUT": "syscall", - "syscall.BIOCGSEESENT": "syscall", - "syscall.BIOCGSTATS": "syscall", - "syscall.BIOCGSTATSOLD": "syscall", - "syscall.BIOCGTSTAMP": "syscall", - "syscall.BIOCIMMEDIATE": "syscall", - "syscall.BIOCLOCK": "syscall", - "syscall.BIOCPROMISC": "syscall", - "syscall.BIOCROTZBUF": "syscall", - "syscall.BIOCSBLEN": "syscall", - "syscall.BIOCSDIRECTION": "syscall", - "syscall.BIOCSDIRFILT": "syscall", - "syscall.BIOCSDLT": "syscall", - "syscall.BIOCSETBUFMODE": "syscall", - "syscall.BIOCSETF": "syscall", - "syscall.BIOCSETFNR": "syscall", - "syscall.BIOCSETIF": "syscall", - "syscall.BIOCSETWF": "syscall", - "syscall.BIOCSETZBUF": "syscall", - "syscall.BIOCSFEEDBACK": "syscall", - "syscall.BIOCSFILDROP": "syscall", - "syscall.BIOCSHDRCMPLT": "syscall", - "syscall.BIOCSRSIG": "syscall", - "syscall.BIOCSRTIMEOUT": "syscall", - "syscall.BIOCSSEESENT": "syscall", - "syscall.BIOCSTCPF": "syscall", - "syscall.BIOCSTSTAMP": "syscall", - "syscall.BIOCSUDPF": "syscall", - "syscall.BIOCVERSION": "syscall", - "syscall.BPF_A": "syscall", - "syscall.BPF_ABS": "syscall", - "syscall.BPF_ADD": "syscall", - "syscall.BPF_ALIGNMENT": "syscall", - "syscall.BPF_ALIGNMENT32": "syscall", - "syscall.BPF_ALU": "syscall", - "syscall.BPF_AND": "syscall", - "syscall.BPF_B": "syscall", - "syscall.BPF_BUFMODE_BUFFER": "syscall", - "syscall.BPF_BUFMODE_ZBUF": "syscall", - "syscall.BPF_DFLTBUFSIZE": "syscall", - "syscall.BPF_DIRECTION_IN": "syscall", - "syscall.BPF_DIRECTION_OUT": "syscall", - "syscall.BPF_DIV": "syscall", - "syscall.BPF_H": "syscall", - "syscall.BPF_IMM": "syscall", - "syscall.BPF_IND": "syscall", - "syscall.BPF_JA": "syscall", - "syscall.BPF_JEQ": "syscall", - "syscall.BPF_JGE": "syscall", - "syscall.BPF_JGT": "syscall", - "syscall.BPF_JMP": "syscall", - "syscall.BPF_JSET": "syscall", - "syscall.BPF_K": "syscall", - "syscall.BPF_LD": "syscall", - "syscall.BPF_LDX": "syscall", - "syscall.BPF_LEN": "syscall", - "syscall.BPF_LSH": "syscall", - "syscall.BPF_MAJOR_VERSION": "syscall", - "syscall.BPF_MAXBUFSIZE": "syscall", - "syscall.BPF_MAXINSNS": "syscall", - "syscall.BPF_MEM": "syscall", - "syscall.BPF_MEMWORDS": "syscall", - "syscall.BPF_MINBUFSIZE": "syscall", - "syscall.BPF_MINOR_VERSION": "syscall", - "syscall.BPF_MISC": "syscall", - "syscall.BPF_MSH": "syscall", - "syscall.BPF_MUL": "syscall", - "syscall.BPF_NEG": "syscall", - "syscall.BPF_OR": "syscall", - "syscall.BPF_RELEASE": "syscall", - "syscall.BPF_RET": "syscall", - "syscall.BPF_RSH": "syscall", - "syscall.BPF_ST": "syscall", - "syscall.BPF_STX": "syscall", - "syscall.BPF_SUB": "syscall", - "syscall.BPF_TAX": "syscall", - "syscall.BPF_TXA": "syscall", - "syscall.BPF_T_BINTIME": "syscall", - "syscall.BPF_T_BINTIME_FAST": "syscall", - "syscall.BPF_T_BINTIME_MONOTONIC": "syscall", - "syscall.BPF_T_BINTIME_MONOTONIC_FAST": "syscall", - "syscall.BPF_T_FAST": "syscall", - "syscall.BPF_T_FLAG_MASK": "syscall", - "syscall.BPF_T_FORMAT_MASK": "syscall", - "syscall.BPF_T_MICROTIME": "syscall", - "syscall.BPF_T_MICROTIME_FAST": "syscall", - "syscall.BPF_T_MICROTIME_MONOTONIC": "syscall", - "syscall.BPF_T_MICROTIME_MONOTONIC_FAST": "syscall", - "syscall.BPF_T_MONOTONIC": "syscall", - "syscall.BPF_T_MONOTONIC_FAST": "syscall", - "syscall.BPF_T_NANOTIME": "syscall", - "syscall.BPF_T_NANOTIME_FAST": "syscall", - "syscall.BPF_T_NANOTIME_MONOTONIC": "syscall", - "syscall.BPF_T_NANOTIME_MONOTONIC_FAST": "syscall", - "syscall.BPF_T_NONE": "syscall", - "syscall.BPF_T_NORMAL": "syscall", - "syscall.BPF_W": "syscall", - "syscall.BPF_X": "syscall", - "syscall.BRKINT": "syscall", - "syscall.Bind": "syscall", - "syscall.BindToDevice": "syscall", - "syscall.BpfBuflen": "syscall", - "syscall.BpfDatalink": "syscall", - "syscall.BpfHdr": "syscall", - "syscall.BpfHeadercmpl": "syscall", - "syscall.BpfInsn": "syscall", - "syscall.BpfInterface": "syscall", - "syscall.BpfJump": "syscall", - "syscall.BpfProgram": "syscall", - "syscall.BpfStat": "syscall", - "syscall.BpfStats": "syscall", - "syscall.BpfStmt": "syscall", - "syscall.BpfTimeout": "syscall", - "syscall.BpfTimeval": "syscall", - "syscall.BpfVersion": "syscall", - "syscall.BpfZbuf": "syscall", - "syscall.BpfZbufHeader": "syscall", - "syscall.ByHandleFileInformation": "syscall", - "syscall.BytePtrFromString": "syscall", - "syscall.ByteSliceFromString": "syscall", - "syscall.CCR0_FLUSH": "syscall", - "syscall.CERT_CHAIN_POLICY_AUTHENTICODE": "syscall", - "syscall.CERT_CHAIN_POLICY_AUTHENTICODE_TS": "syscall", - "syscall.CERT_CHAIN_POLICY_BASE": "syscall", - "syscall.CERT_CHAIN_POLICY_BASIC_CONSTRAINTS": "syscall", - "syscall.CERT_CHAIN_POLICY_EV": "syscall", - "syscall.CERT_CHAIN_POLICY_MICROSOFT_ROOT": "syscall", - "syscall.CERT_CHAIN_POLICY_NT_AUTH": "syscall", - "syscall.CERT_CHAIN_POLICY_SSL": "syscall", - "syscall.CERT_E_CN_NO_MATCH": "syscall", - "syscall.CERT_E_EXPIRED": "syscall", - "syscall.CERT_E_PURPOSE": "syscall", - "syscall.CERT_E_ROLE": "syscall", - "syscall.CERT_E_UNTRUSTEDROOT": "syscall", - "syscall.CERT_STORE_ADD_ALWAYS": "syscall", - "syscall.CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG": "syscall", - "syscall.CERT_STORE_PROV_MEMORY": "syscall", - "syscall.CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT": "syscall", - "syscall.CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT": "syscall", - "syscall.CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT": "syscall", - "syscall.CERT_TRUST_HAS_NOT_SUPPORTED_CRITICAL_EXT": "syscall", - "syscall.CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT": "syscall", - "syscall.CERT_TRUST_INVALID_BASIC_CONSTRAINTS": "syscall", - "syscall.CERT_TRUST_INVALID_EXTENSION": "syscall", - "syscall.CERT_TRUST_INVALID_NAME_CONSTRAINTS": "syscall", - "syscall.CERT_TRUST_INVALID_POLICY_CONSTRAINTS": "syscall", - "syscall.CERT_TRUST_IS_CYCLIC": "syscall", - "syscall.CERT_TRUST_IS_EXPLICIT_DISTRUST": "syscall", - "syscall.CERT_TRUST_IS_NOT_SIGNATURE_VALID": "syscall", - "syscall.CERT_TRUST_IS_NOT_TIME_VALID": "syscall", - "syscall.CERT_TRUST_IS_NOT_VALID_FOR_USAGE": "syscall", - "syscall.CERT_TRUST_IS_OFFLINE_REVOCATION": "syscall", - "syscall.CERT_TRUST_IS_REVOKED": "syscall", - "syscall.CERT_TRUST_IS_UNTRUSTED_ROOT": "syscall", - "syscall.CERT_TRUST_NO_ERROR": "syscall", - "syscall.CERT_TRUST_NO_ISSUANCE_CHAIN_POLICY": "syscall", - "syscall.CERT_TRUST_REVOCATION_STATUS_UNKNOWN": "syscall", - "syscall.CFLUSH": "syscall", - "syscall.CLOCAL": "syscall", - "syscall.CLONE_CHILD_CLEARTID": "syscall", - "syscall.CLONE_CHILD_SETTID": "syscall", - "syscall.CLONE_CSIGNAL": "syscall", - "syscall.CLONE_DETACHED": "syscall", - "syscall.CLONE_FILES": "syscall", - "syscall.CLONE_FS": "syscall", - "syscall.CLONE_IO": "syscall", - "syscall.CLONE_NEWIPC": "syscall", - "syscall.CLONE_NEWNET": "syscall", - "syscall.CLONE_NEWNS": "syscall", - "syscall.CLONE_NEWPID": "syscall", - "syscall.CLONE_NEWUSER": "syscall", - "syscall.CLONE_NEWUTS": "syscall", - "syscall.CLONE_PARENT": "syscall", - "syscall.CLONE_PARENT_SETTID": "syscall", - "syscall.CLONE_PID": "syscall", - "syscall.CLONE_PTRACE": "syscall", - "syscall.CLONE_SETTLS": "syscall", - "syscall.CLONE_SIGHAND": "syscall", - "syscall.CLONE_SYSVSEM": "syscall", - "syscall.CLONE_THREAD": "syscall", - "syscall.CLONE_UNTRACED": "syscall", - "syscall.CLONE_VFORK": "syscall", - "syscall.CLONE_VM": "syscall", - "syscall.CPUID_CFLUSH": "syscall", - "syscall.CREAD": "syscall", - "syscall.CREATE_ALWAYS": "syscall", - "syscall.CREATE_NEW": "syscall", - "syscall.CREATE_NEW_PROCESS_GROUP": "syscall", - "syscall.CREATE_UNICODE_ENVIRONMENT": "syscall", - "syscall.CRYPT_DEFAULT_CONTAINER_OPTIONAL": "syscall", - "syscall.CRYPT_DELETEKEYSET": "syscall", - "syscall.CRYPT_MACHINE_KEYSET": "syscall", - "syscall.CRYPT_NEWKEYSET": "syscall", - "syscall.CRYPT_SILENT": "syscall", - "syscall.CRYPT_VERIFYCONTEXT": "syscall", - "syscall.CS5": "syscall", - "syscall.CS6": "syscall", - "syscall.CS7": "syscall", - "syscall.CS8": "syscall", - "syscall.CSIZE": "syscall", - "syscall.CSTART": "syscall", - "syscall.CSTATUS": "syscall", - "syscall.CSTOP": "syscall", - "syscall.CSTOPB": "syscall", - "syscall.CSUSP": "syscall", - "syscall.CTL_MAXNAME": "syscall", - "syscall.CTL_NET": "syscall", - "syscall.CTL_QUERY": "syscall", - "syscall.CTRL_BREAK_EVENT": "syscall", - "syscall.CTRL_C_EVENT": "syscall", - "syscall.CancelIo": "syscall", - "syscall.CancelIoEx": "syscall", - "syscall.CertAddCertificateContextToStore": "syscall", - "syscall.CertChainContext": "syscall", - "syscall.CertChainElement": "syscall", - "syscall.CertChainPara": "syscall", - "syscall.CertChainPolicyPara": "syscall", - "syscall.CertChainPolicyStatus": "syscall", - "syscall.CertCloseStore": "syscall", - "syscall.CertContext": "syscall", - "syscall.CertCreateCertificateContext": "syscall", - "syscall.CertEnhKeyUsage": "syscall", - "syscall.CertEnumCertificatesInStore": "syscall", - "syscall.CertFreeCertificateChain": "syscall", - "syscall.CertFreeCertificateContext": "syscall", - "syscall.CertGetCertificateChain": "syscall", - "syscall.CertOpenStore": "syscall", - "syscall.CertOpenSystemStore": "syscall", - "syscall.CertRevocationInfo": "syscall", - "syscall.CertSimpleChain": "syscall", - "syscall.CertTrustStatus": "syscall", - "syscall.CertUsageMatch": "syscall", - "syscall.CertVerifyCertificateChainPolicy": "syscall", - "syscall.Chdir": "syscall", - "syscall.CheckBpfVersion": "syscall", - "syscall.Chflags": "syscall", - "syscall.Chmod": "syscall", - "syscall.Chown": "syscall", - "syscall.Chroot": "syscall", - "syscall.Clearenv": "syscall", - "syscall.Close": "syscall", - "syscall.CloseHandle": "syscall", - "syscall.CloseOnExec": "syscall", - "syscall.Closesocket": "syscall", - "syscall.CmsgLen": "syscall", - "syscall.CmsgSpace": "syscall", - "syscall.Cmsghdr": "syscall", - "syscall.CommandLineToArgv": "syscall", - "syscall.ComputerName": "syscall", - "syscall.Connect": "syscall", - "syscall.ConnectEx": "syscall", - "syscall.ConvertSidToStringSid": "syscall", - "syscall.ConvertStringSidToSid": "syscall", - "syscall.CopySid": "syscall", - "syscall.Creat": "syscall", - "syscall.CreateDirectory": "syscall", - "syscall.CreateFile": "syscall", - "syscall.CreateFileMapping": "syscall", - "syscall.CreateHardLink": "syscall", - "syscall.CreateIoCompletionPort": "syscall", - "syscall.CreatePipe": "syscall", - "syscall.CreateProcess": "syscall", - "syscall.CreateSymbolicLink": "syscall", - "syscall.CreateToolhelp32Snapshot": "syscall", - "syscall.Credential": "syscall", - "syscall.CryptAcquireContext": "syscall", - "syscall.CryptGenRandom": "syscall", - "syscall.CryptReleaseContext": "syscall", - "syscall.DIOCBSFLUSH": "syscall", - "syscall.DIOCOSFPFLUSH": "syscall", - "syscall.DLL": "syscall", - "syscall.DLLError": "syscall", - "syscall.DLT_A429": "syscall", - "syscall.DLT_A653_ICM": "syscall", - "syscall.DLT_AIRONET_HEADER": "syscall", - "syscall.DLT_AOS": "syscall", - "syscall.DLT_APPLE_IP_OVER_IEEE1394": "syscall", - "syscall.DLT_ARCNET": "syscall", - "syscall.DLT_ARCNET_LINUX": "syscall", - "syscall.DLT_ATM_CLIP": "syscall", - "syscall.DLT_ATM_RFC1483": "syscall", - "syscall.DLT_AURORA": "syscall", - "syscall.DLT_AX25": "syscall", - "syscall.DLT_AX25_KISS": "syscall", - "syscall.DLT_BACNET_MS_TP": "syscall", - "syscall.DLT_BLUETOOTH_HCI_H4": "syscall", - "syscall.DLT_BLUETOOTH_HCI_H4_WITH_PHDR": "syscall", - "syscall.DLT_CAN20B": "syscall", - "syscall.DLT_CAN_SOCKETCAN": "syscall", - "syscall.DLT_CHAOS": "syscall", - "syscall.DLT_CHDLC": "syscall", - "syscall.DLT_CISCO_IOS": "syscall", - "syscall.DLT_C_HDLC": "syscall", - "syscall.DLT_C_HDLC_WITH_DIR": "syscall", - "syscall.DLT_DBUS": "syscall", - "syscall.DLT_DECT": "syscall", - "syscall.DLT_DOCSIS": "syscall", - "syscall.DLT_DVB_CI": "syscall", - "syscall.DLT_ECONET": "syscall", - "syscall.DLT_EN10MB": "syscall", - "syscall.DLT_EN3MB": "syscall", - "syscall.DLT_ENC": "syscall", - "syscall.DLT_ERF": "syscall", - "syscall.DLT_ERF_ETH": "syscall", - "syscall.DLT_ERF_POS": "syscall", - "syscall.DLT_FC_2": "syscall", - "syscall.DLT_FC_2_WITH_FRAME_DELIMS": "syscall", - "syscall.DLT_FDDI": "syscall", - "syscall.DLT_FLEXRAY": "syscall", - "syscall.DLT_FRELAY": "syscall", - "syscall.DLT_FRELAY_WITH_DIR": "syscall", - "syscall.DLT_GCOM_SERIAL": "syscall", - "syscall.DLT_GCOM_T1E1": "syscall", - "syscall.DLT_GPF_F": "syscall", - "syscall.DLT_GPF_T": "syscall", - "syscall.DLT_GPRS_LLC": "syscall", - "syscall.DLT_GSMTAP_ABIS": "syscall", - "syscall.DLT_GSMTAP_UM": "syscall", - "syscall.DLT_HDLC": "syscall", - "syscall.DLT_HHDLC": "syscall", - "syscall.DLT_HIPPI": "syscall", - "syscall.DLT_IBM_SN": "syscall", - "syscall.DLT_IBM_SP": "syscall", - "syscall.DLT_IEEE802": "syscall", - "syscall.DLT_IEEE802_11": "syscall", - "syscall.DLT_IEEE802_11_RADIO": "syscall", - "syscall.DLT_IEEE802_11_RADIO_AVS": "syscall", - "syscall.DLT_IEEE802_15_4": "syscall", - "syscall.DLT_IEEE802_15_4_LINUX": "syscall", - "syscall.DLT_IEEE802_15_4_NOFCS": "syscall", - "syscall.DLT_IEEE802_15_4_NONASK_PHY": "syscall", - "syscall.DLT_IEEE802_16_MAC_CPS": "syscall", - "syscall.DLT_IEEE802_16_MAC_CPS_RADIO": "syscall", - "syscall.DLT_IPFILTER": "syscall", - "syscall.DLT_IPMB": "syscall", - "syscall.DLT_IPMB_LINUX": "syscall", - "syscall.DLT_IPNET": "syscall", - "syscall.DLT_IPOIB": "syscall", - "syscall.DLT_IPV4": "syscall", - "syscall.DLT_IPV6": "syscall", - "syscall.DLT_IP_OVER_FC": "syscall", - "syscall.DLT_JUNIPER_ATM1": "syscall", - "syscall.DLT_JUNIPER_ATM2": "syscall", - "syscall.DLT_JUNIPER_ATM_CEMIC": "syscall", - "syscall.DLT_JUNIPER_CHDLC": "syscall", - "syscall.DLT_JUNIPER_ES": "syscall", - "syscall.DLT_JUNIPER_ETHER": "syscall", - "syscall.DLT_JUNIPER_FIBRECHANNEL": "syscall", - "syscall.DLT_JUNIPER_FRELAY": "syscall", - "syscall.DLT_JUNIPER_GGSN": "syscall", - "syscall.DLT_JUNIPER_ISM": "syscall", - "syscall.DLT_JUNIPER_MFR": "syscall", - "syscall.DLT_JUNIPER_MLFR": "syscall", - "syscall.DLT_JUNIPER_MLPPP": "syscall", - "syscall.DLT_JUNIPER_MONITOR": "syscall", - "syscall.DLT_JUNIPER_PIC_PEER": "syscall", - "syscall.DLT_JUNIPER_PPP": "syscall", - "syscall.DLT_JUNIPER_PPPOE": "syscall", - "syscall.DLT_JUNIPER_PPPOE_ATM": "syscall", - "syscall.DLT_JUNIPER_SERVICES": "syscall", - "syscall.DLT_JUNIPER_SRX_E2E": "syscall", - "syscall.DLT_JUNIPER_ST": "syscall", - "syscall.DLT_JUNIPER_VP": "syscall", - "syscall.DLT_JUNIPER_VS": "syscall", - "syscall.DLT_LAPB_WITH_DIR": "syscall", - "syscall.DLT_LAPD": "syscall", - "syscall.DLT_LIN": "syscall", - "syscall.DLT_LINUX_EVDEV": "syscall", - "syscall.DLT_LINUX_IRDA": "syscall", - "syscall.DLT_LINUX_LAPD": "syscall", - "syscall.DLT_LINUX_PPP_WITHDIRECTION": "syscall", - "syscall.DLT_LINUX_SLL": "syscall", - "syscall.DLT_LOOP": "syscall", - "syscall.DLT_LTALK": "syscall", - "syscall.DLT_MATCHING_MAX": "syscall", - "syscall.DLT_MATCHING_MIN": "syscall", - "syscall.DLT_MFR": "syscall", - "syscall.DLT_MOST": "syscall", - "syscall.DLT_MPEG_2_TS": "syscall", - "syscall.DLT_MPLS": "syscall", - "syscall.DLT_MTP2": "syscall", - "syscall.DLT_MTP2_WITH_PHDR": "syscall", - "syscall.DLT_MTP3": "syscall", - "syscall.DLT_MUX27010": "syscall", - "syscall.DLT_NETANALYZER": "syscall", - "syscall.DLT_NETANALYZER_TRANSPARENT": "syscall", - "syscall.DLT_NFC_LLCP": "syscall", - "syscall.DLT_NFLOG": "syscall", - "syscall.DLT_NG40": "syscall", - "syscall.DLT_NULL": "syscall", - "syscall.DLT_PCI_EXP": "syscall", - "syscall.DLT_PFLOG": "syscall", - "syscall.DLT_PFSYNC": "syscall", - "syscall.DLT_PPI": "syscall", - "syscall.DLT_PPP": "syscall", - "syscall.DLT_PPP_BSDOS": "syscall", - "syscall.DLT_PPP_ETHER": "syscall", - "syscall.DLT_PPP_PPPD": "syscall", - "syscall.DLT_PPP_SERIAL": "syscall", - "syscall.DLT_PPP_WITH_DIR": "syscall", - "syscall.DLT_PPP_WITH_DIRECTION": "syscall", - "syscall.DLT_PRISM_HEADER": "syscall", - "syscall.DLT_PRONET": "syscall", - "syscall.DLT_RAIF1": "syscall", - "syscall.DLT_RAW": "syscall", - "syscall.DLT_RAWAF_MASK": "syscall", - "syscall.DLT_RIO": "syscall", - "syscall.DLT_SCCP": "syscall", - "syscall.DLT_SITA": "syscall", - "syscall.DLT_SLIP": "syscall", - "syscall.DLT_SLIP_BSDOS": "syscall", - "syscall.DLT_STANAG_5066_D_PDU": "syscall", - "syscall.DLT_SUNATM": "syscall", - "syscall.DLT_SYMANTEC_FIREWALL": "syscall", - "syscall.DLT_TZSP": "syscall", - "syscall.DLT_USB": "syscall", - "syscall.DLT_USB_LINUX": "syscall", - "syscall.DLT_USB_LINUX_MMAPPED": "syscall", - "syscall.DLT_USER0": "syscall", - "syscall.DLT_USER1": "syscall", - "syscall.DLT_USER10": "syscall", - "syscall.DLT_USER11": "syscall", - "syscall.DLT_USER12": "syscall", - "syscall.DLT_USER13": "syscall", - "syscall.DLT_USER14": "syscall", - "syscall.DLT_USER15": "syscall", - "syscall.DLT_USER2": "syscall", - "syscall.DLT_USER3": "syscall", - "syscall.DLT_USER4": "syscall", - "syscall.DLT_USER5": "syscall", - "syscall.DLT_USER6": "syscall", - "syscall.DLT_USER7": "syscall", - "syscall.DLT_USER8": "syscall", - "syscall.DLT_USER9": "syscall", - "syscall.DLT_WIHART": "syscall", - "syscall.DLT_X2E_SERIAL": "syscall", - "syscall.DLT_X2E_XORAYA": "syscall", - "syscall.DNSMXData": "syscall", - "syscall.DNSPTRData": "syscall", - "syscall.DNSRecord": "syscall", - "syscall.DNSSRVData": "syscall", - "syscall.DNSTXTData": "syscall", - "syscall.DNS_INFO_NO_RECORDS": "syscall", - "syscall.DNS_TYPE_A": "syscall", - "syscall.DNS_TYPE_A6": "syscall", - "syscall.DNS_TYPE_AAAA": "syscall", - "syscall.DNS_TYPE_ADDRS": "syscall", - "syscall.DNS_TYPE_AFSDB": "syscall", - "syscall.DNS_TYPE_ALL": "syscall", - "syscall.DNS_TYPE_ANY": "syscall", - "syscall.DNS_TYPE_ATMA": "syscall", - "syscall.DNS_TYPE_AXFR": "syscall", - "syscall.DNS_TYPE_CERT": "syscall", - "syscall.DNS_TYPE_CNAME": "syscall", - "syscall.DNS_TYPE_DHCID": "syscall", - "syscall.DNS_TYPE_DNAME": "syscall", - "syscall.DNS_TYPE_DNSKEY": "syscall", - "syscall.DNS_TYPE_DS": "syscall", - "syscall.DNS_TYPE_EID": "syscall", - "syscall.DNS_TYPE_GID": "syscall", - "syscall.DNS_TYPE_GPOS": "syscall", - "syscall.DNS_TYPE_HINFO": "syscall", - "syscall.DNS_TYPE_ISDN": "syscall", - "syscall.DNS_TYPE_IXFR": "syscall", - "syscall.DNS_TYPE_KEY": "syscall", - "syscall.DNS_TYPE_KX": "syscall", - "syscall.DNS_TYPE_LOC": "syscall", - "syscall.DNS_TYPE_MAILA": "syscall", - "syscall.DNS_TYPE_MAILB": "syscall", - "syscall.DNS_TYPE_MB": "syscall", - "syscall.DNS_TYPE_MD": "syscall", - "syscall.DNS_TYPE_MF": "syscall", - "syscall.DNS_TYPE_MG": "syscall", - "syscall.DNS_TYPE_MINFO": "syscall", - "syscall.DNS_TYPE_MR": "syscall", - "syscall.DNS_TYPE_MX": "syscall", - "syscall.DNS_TYPE_NAPTR": "syscall", - "syscall.DNS_TYPE_NBSTAT": "syscall", - "syscall.DNS_TYPE_NIMLOC": "syscall", - "syscall.DNS_TYPE_NS": "syscall", - "syscall.DNS_TYPE_NSAP": "syscall", - "syscall.DNS_TYPE_NSAPPTR": "syscall", - "syscall.DNS_TYPE_NSEC": "syscall", - "syscall.DNS_TYPE_NULL": "syscall", - "syscall.DNS_TYPE_NXT": "syscall", - "syscall.DNS_TYPE_OPT": "syscall", - "syscall.DNS_TYPE_PTR": "syscall", - "syscall.DNS_TYPE_PX": "syscall", - "syscall.DNS_TYPE_RP": "syscall", - "syscall.DNS_TYPE_RRSIG": "syscall", - "syscall.DNS_TYPE_RT": "syscall", - "syscall.DNS_TYPE_SIG": "syscall", - "syscall.DNS_TYPE_SINK": "syscall", - "syscall.DNS_TYPE_SOA": "syscall", - "syscall.DNS_TYPE_SRV": "syscall", - "syscall.DNS_TYPE_TEXT": "syscall", - "syscall.DNS_TYPE_TKEY": "syscall", - "syscall.DNS_TYPE_TSIG": "syscall", - "syscall.DNS_TYPE_UID": "syscall", - "syscall.DNS_TYPE_UINFO": "syscall", - "syscall.DNS_TYPE_UNSPEC": "syscall", - "syscall.DNS_TYPE_WINS": "syscall", - "syscall.DNS_TYPE_WINSR": "syscall", - "syscall.DNS_TYPE_WKS": "syscall", - "syscall.DNS_TYPE_X25": "syscall", - "syscall.DT_BLK": "syscall", - "syscall.DT_CHR": "syscall", - "syscall.DT_DIR": "syscall", - "syscall.DT_FIFO": "syscall", - "syscall.DT_LNK": "syscall", - "syscall.DT_REG": "syscall", - "syscall.DT_SOCK": "syscall", - "syscall.DT_UNKNOWN": "syscall", - "syscall.DT_WHT": "syscall", - "syscall.DUPLICATE_CLOSE_SOURCE": "syscall", - "syscall.DUPLICATE_SAME_ACCESS": "syscall", - "syscall.DeleteFile": "syscall", - "syscall.DetachLsf": "syscall", - "syscall.DeviceIoControl": "syscall", - "syscall.Dirent": "syscall", - "syscall.DnsNameCompare": "syscall", - "syscall.DnsQuery": "syscall", - "syscall.DnsRecordListFree": "syscall", - "syscall.DnsSectionAdditional": "syscall", - "syscall.DnsSectionAnswer": "syscall", - "syscall.DnsSectionAuthority": "syscall", - "syscall.DnsSectionQuestion": "syscall", - "syscall.Dup": "syscall", - "syscall.Dup2": "syscall", - "syscall.Dup3": "syscall", - "syscall.DuplicateHandle": "syscall", - "syscall.E2BIG": "syscall", - "syscall.EACCES": "syscall", - "syscall.EADDRINUSE": "syscall", - "syscall.EADDRNOTAVAIL": "syscall", - "syscall.EADV": "syscall", - "syscall.EAFNOSUPPORT": "syscall", - "syscall.EAGAIN": "syscall", - "syscall.EALREADY": "syscall", - "syscall.EAUTH": "syscall", - "syscall.EBADARCH": "syscall", - "syscall.EBADE": "syscall", - "syscall.EBADEXEC": "syscall", - "syscall.EBADF": "syscall", - "syscall.EBADFD": "syscall", - "syscall.EBADMACHO": "syscall", - "syscall.EBADMSG": "syscall", - "syscall.EBADR": "syscall", - "syscall.EBADRPC": "syscall", - "syscall.EBADRQC": "syscall", - "syscall.EBADSLT": "syscall", - "syscall.EBFONT": "syscall", - "syscall.EBUSY": "syscall", - "syscall.ECANCELED": "syscall", - "syscall.ECAPMODE": "syscall", - "syscall.ECHILD": "syscall", - "syscall.ECHO": "syscall", - "syscall.ECHOCTL": "syscall", - "syscall.ECHOE": "syscall", - "syscall.ECHOK": "syscall", - "syscall.ECHOKE": "syscall", - "syscall.ECHONL": "syscall", - "syscall.ECHOPRT": "syscall", - "syscall.ECHRNG": "syscall", - "syscall.ECOMM": "syscall", - "syscall.ECONNABORTED": "syscall", - "syscall.ECONNREFUSED": "syscall", - "syscall.ECONNRESET": "syscall", - "syscall.EDEADLK": "syscall", - "syscall.EDEADLOCK": "syscall", - "syscall.EDESTADDRREQ": "syscall", - "syscall.EDEVERR": "syscall", - "syscall.EDOM": "syscall", - "syscall.EDOOFUS": "syscall", - "syscall.EDOTDOT": "syscall", - "syscall.EDQUOT": "syscall", - "syscall.EEXIST": "syscall", - "syscall.EFAULT": "syscall", - "syscall.EFBIG": "syscall", - "syscall.EFER_LMA": "syscall", - "syscall.EFER_LME": "syscall", - "syscall.EFER_NXE": "syscall", - "syscall.EFER_SCE": "syscall", - "syscall.EFTYPE": "syscall", - "syscall.EHOSTDOWN": "syscall", - "syscall.EHOSTUNREACH": "syscall", - "syscall.EHWPOISON": "syscall", - "syscall.EIDRM": "syscall", - "syscall.EILSEQ": "syscall", - "syscall.EINPROGRESS": "syscall", - "syscall.EINTR": "syscall", - "syscall.EINVAL": "syscall", - "syscall.EIO": "syscall", - "syscall.EIPSEC": "syscall", - "syscall.EISCONN": "syscall", - "syscall.EISDIR": "syscall", - "syscall.EISNAM": "syscall", - "syscall.EKEYEXPIRED": "syscall", - "syscall.EKEYREJECTED": "syscall", - "syscall.EKEYREVOKED": "syscall", - "syscall.EL2HLT": "syscall", - "syscall.EL2NSYNC": "syscall", - "syscall.EL3HLT": "syscall", - "syscall.EL3RST": "syscall", - "syscall.ELAST": "syscall", - "syscall.ELF_NGREG": "syscall", - "syscall.ELF_PRARGSZ": "syscall", - "syscall.ELIBACC": "syscall", - "syscall.ELIBBAD": "syscall", - "syscall.ELIBEXEC": "syscall", - "syscall.ELIBMAX": "syscall", - "syscall.ELIBSCN": "syscall", - "syscall.ELNRNG": "syscall", - "syscall.ELOOP": "syscall", - "syscall.EMEDIUMTYPE": "syscall", - "syscall.EMFILE": "syscall", - "syscall.EMLINK": "syscall", - "syscall.EMSGSIZE": "syscall", - "syscall.EMT_TAGOVF": "syscall", - "syscall.EMULTIHOP": "syscall", - "syscall.EMUL_ENABLED": "syscall", - "syscall.EMUL_LINUX": "syscall", - "syscall.EMUL_LINUX32": "syscall", - "syscall.EMUL_MAXID": "syscall", - "syscall.EMUL_NATIVE": "syscall", - "syscall.ENAMETOOLONG": "syscall", - "syscall.ENAVAIL": "syscall", - "syscall.ENDRUNDISC": "syscall", - "syscall.ENEEDAUTH": "syscall", - "syscall.ENETDOWN": "syscall", - "syscall.ENETRESET": "syscall", - "syscall.ENETUNREACH": "syscall", - "syscall.ENFILE": "syscall", - "syscall.ENOANO": "syscall", - "syscall.ENOATTR": "syscall", - "syscall.ENOBUFS": "syscall", - "syscall.ENOCSI": "syscall", - "syscall.ENODATA": "syscall", - "syscall.ENODEV": "syscall", - "syscall.ENOENT": "syscall", - "syscall.ENOEXEC": "syscall", - "syscall.ENOKEY": "syscall", - "syscall.ENOLCK": "syscall", - "syscall.ENOLINK": "syscall", - "syscall.ENOMEDIUM": "syscall", - "syscall.ENOMEM": "syscall", - "syscall.ENOMSG": "syscall", - "syscall.ENONET": "syscall", - "syscall.ENOPKG": "syscall", - "syscall.ENOPOLICY": "syscall", - "syscall.ENOPROTOOPT": "syscall", - "syscall.ENOSPC": "syscall", - "syscall.ENOSR": "syscall", - "syscall.ENOSTR": "syscall", - "syscall.ENOSYS": "syscall", - "syscall.ENOTBLK": "syscall", - "syscall.ENOTCAPABLE": "syscall", - "syscall.ENOTCONN": "syscall", - "syscall.ENOTDIR": "syscall", - "syscall.ENOTEMPTY": "syscall", - "syscall.ENOTNAM": "syscall", - "syscall.ENOTRECOVERABLE": "syscall", - "syscall.ENOTSOCK": "syscall", - "syscall.ENOTSUP": "syscall", - "syscall.ENOTTY": "syscall", - "syscall.ENOTUNIQ": "syscall", - "syscall.ENXIO": "syscall", - "syscall.EN_SW_CTL_INF": "syscall", - "syscall.EN_SW_CTL_PREC": "syscall", - "syscall.EN_SW_CTL_ROUND": "syscall", - "syscall.EN_SW_DATACHAIN": "syscall", - "syscall.EN_SW_DENORM": "syscall", - "syscall.EN_SW_INVOP": "syscall", - "syscall.EN_SW_OVERFLOW": "syscall", - "syscall.EN_SW_PRECLOSS": "syscall", - "syscall.EN_SW_UNDERFLOW": "syscall", - "syscall.EN_SW_ZERODIV": "syscall", - "syscall.EOPNOTSUPP": "syscall", - "syscall.EOVERFLOW": "syscall", - "syscall.EOWNERDEAD": "syscall", - "syscall.EPERM": "syscall", - "syscall.EPFNOSUPPORT": "syscall", - "syscall.EPIPE": "syscall", - "syscall.EPOLLERR": "syscall", - "syscall.EPOLLET": "syscall", - "syscall.EPOLLHUP": "syscall", - "syscall.EPOLLIN": "syscall", - "syscall.EPOLLMSG": "syscall", - "syscall.EPOLLONESHOT": "syscall", - "syscall.EPOLLOUT": "syscall", - "syscall.EPOLLPRI": "syscall", - "syscall.EPOLLRDBAND": "syscall", - "syscall.EPOLLRDHUP": "syscall", - "syscall.EPOLLRDNORM": "syscall", - "syscall.EPOLLWRBAND": "syscall", - "syscall.EPOLLWRNORM": "syscall", - "syscall.EPOLL_CLOEXEC": "syscall", - "syscall.EPOLL_CTL_ADD": "syscall", - "syscall.EPOLL_CTL_DEL": "syscall", - "syscall.EPOLL_CTL_MOD": "syscall", - "syscall.EPOLL_NONBLOCK": "syscall", - "syscall.EPROCLIM": "syscall", - "syscall.EPROCUNAVAIL": "syscall", - "syscall.EPROGMISMATCH": "syscall", - "syscall.EPROGUNAVAIL": "syscall", - "syscall.EPROTO": "syscall", - "syscall.EPROTONOSUPPORT": "syscall", - "syscall.EPROTOTYPE": "syscall", - "syscall.EPWROFF": "syscall", - "syscall.ERANGE": "syscall", - "syscall.EREMCHG": "syscall", - "syscall.EREMOTE": "syscall", - "syscall.EREMOTEIO": "syscall", - "syscall.ERESTART": "syscall", - "syscall.ERFKILL": "syscall", - "syscall.EROFS": "syscall", - "syscall.ERPCMISMATCH": "syscall", - "syscall.ERROR_ACCESS_DENIED": "syscall", - "syscall.ERROR_ALREADY_EXISTS": "syscall", - "syscall.ERROR_BROKEN_PIPE": "syscall", - "syscall.ERROR_BUFFER_OVERFLOW": "syscall", - "syscall.ERROR_ENVVAR_NOT_FOUND": "syscall", - "syscall.ERROR_FILE_EXISTS": "syscall", - "syscall.ERROR_FILE_NOT_FOUND": "syscall", - "syscall.ERROR_HANDLE_EOF": "syscall", - "syscall.ERROR_INSUFFICIENT_BUFFER": "syscall", - "syscall.ERROR_IO_PENDING": "syscall", - "syscall.ERROR_MOD_NOT_FOUND": "syscall", - "syscall.ERROR_MORE_DATA": "syscall", - "syscall.ERROR_NETNAME_DELETED": "syscall", - "syscall.ERROR_NOT_FOUND": "syscall", - "syscall.ERROR_NO_MORE_FILES": "syscall", - "syscall.ERROR_OPERATION_ABORTED": "syscall", - "syscall.ERROR_PATH_NOT_FOUND": "syscall", - "syscall.ERROR_PRIVILEGE_NOT_HELD": "syscall", - "syscall.ERROR_PROC_NOT_FOUND": "syscall", - "syscall.ESHLIBVERS": "syscall", - "syscall.ESHUTDOWN": "syscall", - "syscall.ESOCKTNOSUPPORT": "syscall", - "syscall.ESPIPE": "syscall", - "syscall.ESRCH": "syscall", - "syscall.ESRMNT": "syscall", - "syscall.ESTALE": "syscall", - "syscall.ESTRPIPE": "syscall", - "syscall.ETHERCAP_JUMBO_MTU": "syscall", - "syscall.ETHERCAP_VLAN_HWTAGGING": "syscall", - "syscall.ETHERCAP_VLAN_MTU": "syscall", - "syscall.ETHERMIN": "syscall", - "syscall.ETHERMTU": "syscall", - "syscall.ETHERMTU_JUMBO": "syscall", - "syscall.ETHERTYPE_8023": "syscall", - "syscall.ETHERTYPE_AARP": "syscall", - "syscall.ETHERTYPE_ACCTON": "syscall", - "syscall.ETHERTYPE_AEONIC": "syscall", - "syscall.ETHERTYPE_ALPHA": "syscall", - "syscall.ETHERTYPE_AMBER": "syscall", - "syscall.ETHERTYPE_AMOEBA": "syscall", - "syscall.ETHERTYPE_AOE": "syscall", - "syscall.ETHERTYPE_APOLLO": "syscall", - "syscall.ETHERTYPE_APOLLODOMAIN": "syscall", - "syscall.ETHERTYPE_APPLETALK": "syscall", - "syscall.ETHERTYPE_APPLITEK": "syscall", - "syscall.ETHERTYPE_ARGONAUT": "syscall", - "syscall.ETHERTYPE_ARP": "syscall", - "syscall.ETHERTYPE_AT": "syscall", - "syscall.ETHERTYPE_ATALK": "syscall", - "syscall.ETHERTYPE_ATOMIC": "syscall", - "syscall.ETHERTYPE_ATT": "syscall", - "syscall.ETHERTYPE_ATTSTANFORD": "syscall", - "syscall.ETHERTYPE_AUTOPHON": "syscall", - "syscall.ETHERTYPE_AXIS": "syscall", - "syscall.ETHERTYPE_BCLOOP": "syscall", - "syscall.ETHERTYPE_BOFL": "syscall", - "syscall.ETHERTYPE_CABLETRON": "syscall", - "syscall.ETHERTYPE_CHAOS": "syscall", - "syscall.ETHERTYPE_COMDESIGN": "syscall", - "syscall.ETHERTYPE_COMPUGRAPHIC": "syscall", - "syscall.ETHERTYPE_COUNTERPOINT": "syscall", - "syscall.ETHERTYPE_CRONUS": "syscall", - "syscall.ETHERTYPE_CRONUSVLN": "syscall", - "syscall.ETHERTYPE_DCA": "syscall", - "syscall.ETHERTYPE_DDE": "syscall", - "syscall.ETHERTYPE_DEBNI": "syscall", - "syscall.ETHERTYPE_DECAM": "syscall", - "syscall.ETHERTYPE_DECCUST": "syscall", - "syscall.ETHERTYPE_DECDIAG": "syscall", - "syscall.ETHERTYPE_DECDNS": "syscall", - "syscall.ETHERTYPE_DECDTS": "syscall", - "syscall.ETHERTYPE_DECEXPER": "syscall", - "syscall.ETHERTYPE_DECLAST": "syscall", - "syscall.ETHERTYPE_DECLTM": "syscall", - "syscall.ETHERTYPE_DECMUMPS": "syscall", - "syscall.ETHERTYPE_DECNETBIOS": "syscall", - "syscall.ETHERTYPE_DELTACON": "syscall", - "syscall.ETHERTYPE_DIDDLE": "syscall", - "syscall.ETHERTYPE_DLOG1": "syscall", - "syscall.ETHERTYPE_DLOG2": "syscall", - "syscall.ETHERTYPE_DN": "syscall", - "syscall.ETHERTYPE_DOGFIGHT": "syscall", - "syscall.ETHERTYPE_DSMD": "syscall", - "syscall.ETHERTYPE_ECMA": "syscall", - "syscall.ETHERTYPE_ENCRYPT": "syscall", - "syscall.ETHERTYPE_ES": "syscall", - "syscall.ETHERTYPE_EXCELAN": "syscall", - "syscall.ETHERTYPE_EXPERDATA": "syscall", - "syscall.ETHERTYPE_FLIP": "syscall", - "syscall.ETHERTYPE_FLOWCONTROL": "syscall", - "syscall.ETHERTYPE_FRARP": "syscall", - "syscall.ETHERTYPE_GENDYN": "syscall", - "syscall.ETHERTYPE_HAYES": "syscall", - "syscall.ETHERTYPE_HIPPI_FP": "syscall", - "syscall.ETHERTYPE_HITACHI": "syscall", - "syscall.ETHERTYPE_HP": "syscall", - "syscall.ETHERTYPE_IEEEPUP": "syscall", - "syscall.ETHERTYPE_IEEEPUPAT": "syscall", - "syscall.ETHERTYPE_IMLBL": "syscall", - "syscall.ETHERTYPE_IMLBLDIAG": "syscall", - "syscall.ETHERTYPE_IP": "syscall", - "syscall.ETHERTYPE_IPAS": "syscall", - "syscall.ETHERTYPE_IPV6": "syscall", - "syscall.ETHERTYPE_IPX": "syscall", - "syscall.ETHERTYPE_IPXNEW": "syscall", - "syscall.ETHERTYPE_KALPANA": "syscall", - "syscall.ETHERTYPE_LANBRIDGE": "syscall", - "syscall.ETHERTYPE_LANPROBE": "syscall", - "syscall.ETHERTYPE_LAT": "syscall", - "syscall.ETHERTYPE_LBACK": "syscall", - "syscall.ETHERTYPE_LITTLE": "syscall", - "syscall.ETHERTYPE_LLDP": "syscall", - "syscall.ETHERTYPE_LOGICRAFT": "syscall", - "syscall.ETHERTYPE_LOOPBACK": "syscall", - "syscall.ETHERTYPE_MATRA": "syscall", - "syscall.ETHERTYPE_MAX": "syscall", - "syscall.ETHERTYPE_MERIT": "syscall", - "syscall.ETHERTYPE_MICP": "syscall", - "syscall.ETHERTYPE_MOPDL": "syscall", - "syscall.ETHERTYPE_MOPRC": "syscall", - "syscall.ETHERTYPE_MOTOROLA": "syscall", - "syscall.ETHERTYPE_MPLS": "syscall", - "syscall.ETHERTYPE_MPLS_MCAST": "syscall", - "syscall.ETHERTYPE_MUMPS": "syscall", - "syscall.ETHERTYPE_NBPCC": "syscall", - "syscall.ETHERTYPE_NBPCLAIM": "syscall", - "syscall.ETHERTYPE_NBPCLREQ": "syscall", - "syscall.ETHERTYPE_NBPCLRSP": "syscall", - "syscall.ETHERTYPE_NBPCREQ": "syscall", - "syscall.ETHERTYPE_NBPCRSP": "syscall", - "syscall.ETHERTYPE_NBPDG": "syscall", - "syscall.ETHERTYPE_NBPDGB": "syscall", - "syscall.ETHERTYPE_NBPDLTE": "syscall", - "syscall.ETHERTYPE_NBPRAR": "syscall", - "syscall.ETHERTYPE_NBPRAS": "syscall", - "syscall.ETHERTYPE_NBPRST": "syscall", - "syscall.ETHERTYPE_NBPSCD": "syscall", - "syscall.ETHERTYPE_NBPVCD": "syscall", - "syscall.ETHERTYPE_NBS": "syscall", - "syscall.ETHERTYPE_NCD": "syscall", - "syscall.ETHERTYPE_NESTAR": "syscall", - "syscall.ETHERTYPE_NETBEUI": "syscall", - "syscall.ETHERTYPE_NOVELL": "syscall", - "syscall.ETHERTYPE_NS": "syscall", - "syscall.ETHERTYPE_NSAT": "syscall", - "syscall.ETHERTYPE_NSCOMPAT": "syscall", - "syscall.ETHERTYPE_NTRAILER": "syscall", - "syscall.ETHERTYPE_OS9": "syscall", - "syscall.ETHERTYPE_OS9NET": "syscall", - "syscall.ETHERTYPE_PACER": "syscall", - "syscall.ETHERTYPE_PAE": "syscall", - "syscall.ETHERTYPE_PCS": "syscall", - "syscall.ETHERTYPE_PLANNING": "syscall", - "syscall.ETHERTYPE_PPP": "syscall", - "syscall.ETHERTYPE_PPPOE": "syscall", - "syscall.ETHERTYPE_PPPOEDISC": "syscall", - "syscall.ETHERTYPE_PRIMENTS": "syscall", - "syscall.ETHERTYPE_PUP": "syscall", - "syscall.ETHERTYPE_PUPAT": "syscall", - "syscall.ETHERTYPE_QINQ": "syscall", - "syscall.ETHERTYPE_RACAL": "syscall", - "syscall.ETHERTYPE_RATIONAL": "syscall", - "syscall.ETHERTYPE_RAWFR": "syscall", - "syscall.ETHERTYPE_RCL": "syscall", - "syscall.ETHERTYPE_RDP": "syscall", - "syscall.ETHERTYPE_RETIX": "syscall", - "syscall.ETHERTYPE_REVARP": "syscall", - "syscall.ETHERTYPE_SCA": "syscall", - "syscall.ETHERTYPE_SECTRA": "syscall", - "syscall.ETHERTYPE_SECUREDATA": "syscall", - "syscall.ETHERTYPE_SGITW": "syscall", - "syscall.ETHERTYPE_SG_BOUNCE": "syscall", - "syscall.ETHERTYPE_SG_DIAG": "syscall", - "syscall.ETHERTYPE_SG_NETGAMES": "syscall", - "syscall.ETHERTYPE_SG_RESV": "syscall", - "syscall.ETHERTYPE_SIMNET": "syscall", - "syscall.ETHERTYPE_SLOW": "syscall", - "syscall.ETHERTYPE_SLOWPROTOCOLS": "syscall", - "syscall.ETHERTYPE_SNA": "syscall", - "syscall.ETHERTYPE_SNMP": "syscall", - "syscall.ETHERTYPE_SONIX": "syscall", - "syscall.ETHERTYPE_SPIDER": "syscall", - "syscall.ETHERTYPE_SPRITE": "syscall", - "syscall.ETHERTYPE_STP": "syscall", - "syscall.ETHERTYPE_TALARIS": "syscall", - "syscall.ETHERTYPE_TALARISMC": "syscall", - "syscall.ETHERTYPE_TCPCOMP": "syscall", - "syscall.ETHERTYPE_TCPSM": "syscall", - "syscall.ETHERTYPE_TEC": "syscall", - "syscall.ETHERTYPE_TIGAN": "syscall", - "syscall.ETHERTYPE_TRAIL": "syscall", - "syscall.ETHERTYPE_TRANSETHER": "syscall", - "syscall.ETHERTYPE_TYMSHARE": "syscall", - "syscall.ETHERTYPE_UBBST": "syscall", - "syscall.ETHERTYPE_UBDEBUG": "syscall", - "syscall.ETHERTYPE_UBDIAGLOOP": "syscall", - "syscall.ETHERTYPE_UBDL": "syscall", - "syscall.ETHERTYPE_UBNIU": "syscall", - "syscall.ETHERTYPE_UBNMC": "syscall", - "syscall.ETHERTYPE_VALID": "syscall", - "syscall.ETHERTYPE_VARIAN": "syscall", - "syscall.ETHERTYPE_VAXELN": "syscall", - "syscall.ETHERTYPE_VEECO": "syscall", - "syscall.ETHERTYPE_VEXP": "syscall", - "syscall.ETHERTYPE_VGLAB": "syscall", - "syscall.ETHERTYPE_VINES": "syscall", - "syscall.ETHERTYPE_VINESECHO": "syscall", - "syscall.ETHERTYPE_VINESLOOP": "syscall", - "syscall.ETHERTYPE_VITAL": "syscall", - "syscall.ETHERTYPE_VLAN": "syscall", - "syscall.ETHERTYPE_VLTLMAN": "syscall", - "syscall.ETHERTYPE_VPROD": "syscall", - "syscall.ETHERTYPE_VURESERVED": "syscall", - "syscall.ETHERTYPE_WATERLOO": "syscall", - "syscall.ETHERTYPE_WELLFLEET": "syscall", - "syscall.ETHERTYPE_X25": "syscall", - "syscall.ETHERTYPE_X75": "syscall", - "syscall.ETHERTYPE_XNSSM": "syscall", - "syscall.ETHERTYPE_XTP": "syscall", - "syscall.ETHER_ADDR_LEN": "syscall", - "syscall.ETHER_ALIGN": "syscall", - "syscall.ETHER_CRC_LEN": "syscall", - "syscall.ETHER_CRC_POLY_BE": "syscall", - "syscall.ETHER_CRC_POLY_LE": "syscall", - "syscall.ETHER_HDR_LEN": "syscall", - "syscall.ETHER_MAX_DIX_LEN": "syscall", - "syscall.ETHER_MAX_LEN": "syscall", - "syscall.ETHER_MAX_LEN_JUMBO": "syscall", - "syscall.ETHER_MIN_LEN": "syscall", - "syscall.ETHER_PPPOE_ENCAP_LEN": "syscall", - "syscall.ETHER_TYPE_LEN": "syscall", - "syscall.ETHER_VLAN_ENCAP_LEN": "syscall", - "syscall.ETH_P_1588": "syscall", - "syscall.ETH_P_8021Q": "syscall", - "syscall.ETH_P_802_2": "syscall", - "syscall.ETH_P_802_3": "syscall", - "syscall.ETH_P_AARP": "syscall", - "syscall.ETH_P_ALL": "syscall", - "syscall.ETH_P_AOE": "syscall", - "syscall.ETH_P_ARCNET": "syscall", - "syscall.ETH_P_ARP": "syscall", - "syscall.ETH_P_ATALK": "syscall", - "syscall.ETH_P_ATMFATE": "syscall", - "syscall.ETH_P_ATMMPOA": "syscall", - "syscall.ETH_P_AX25": "syscall", - "syscall.ETH_P_BPQ": "syscall", - "syscall.ETH_P_CAIF": "syscall", - "syscall.ETH_P_CAN": "syscall", - "syscall.ETH_P_CONTROL": "syscall", - "syscall.ETH_P_CUST": "syscall", - "syscall.ETH_P_DDCMP": "syscall", - "syscall.ETH_P_DEC": "syscall", - "syscall.ETH_P_DIAG": "syscall", - "syscall.ETH_P_DNA_DL": "syscall", - "syscall.ETH_P_DNA_RC": "syscall", - "syscall.ETH_P_DNA_RT": "syscall", - "syscall.ETH_P_DSA": "syscall", - "syscall.ETH_P_ECONET": "syscall", - "syscall.ETH_P_EDSA": "syscall", - "syscall.ETH_P_FCOE": "syscall", - "syscall.ETH_P_FIP": "syscall", - "syscall.ETH_P_HDLC": "syscall", - "syscall.ETH_P_IEEE802154": "syscall", - "syscall.ETH_P_IEEEPUP": "syscall", - "syscall.ETH_P_IEEEPUPAT": "syscall", - "syscall.ETH_P_IP": "syscall", - "syscall.ETH_P_IPV6": "syscall", - "syscall.ETH_P_IPX": "syscall", - "syscall.ETH_P_IRDA": "syscall", - "syscall.ETH_P_LAT": "syscall", - "syscall.ETH_P_LINK_CTL": "syscall", - "syscall.ETH_P_LOCALTALK": "syscall", - "syscall.ETH_P_LOOP": "syscall", - "syscall.ETH_P_MOBITEX": "syscall", - "syscall.ETH_P_MPLS_MC": "syscall", - "syscall.ETH_P_MPLS_UC": "syscall", - "syscall.ETH_P_PAE": "syscall", - "syscall.ETH_P_PAUSE": "syscall", - "syscall.ETH_P_PHONET": "syscall", - "syscall.ETH_P_PPPTALK": "syscall", - "syscall.ETH_P_PPP_DISC": "syscall", - "syscall.ETH_P_PPP_MP": "syscall", - "syscall.ETH_P_PPP_SES": "syscall", - "syscall.ETH_P_PUP": "syscall", - "syscall.ETH_P_PUPAT": "syscall", - "syscall.ETH_P_RARP": "syscall", - "syscall.ETH_P_SCA": "syscall", - "syscall.ETH_P_SLOW": "syscall", - "syscall.ETH_P_SNAP": "syscall", - "syscall.ETH_P_TEB": "syscall", - "syscall.ETH_P_TIPC": "syscall", - "syscall.ETH_P_TRAILER": "syscall", - "syscall.ETH_P_TR_802_2": "syscall", - "syscall.ETH_P_WAN_PPP": "syscall", - "syscall.ETH_P_WCCP": "syscall", - "syscall.ETH_P_X25": "syscall", - "syscall.ETIME": "syscall", - "syscall.ETIMEDOUT": "syscall", - "syscall.ETOOMANYREFS": "syscall", - "syscall.ETXTBSY": "syscall", - "syscall.EUCLEAN": "syscall", - "syscall.EUNATCH": "syscall", - "syscall.EUSERS": "syscall", - "syscall.EVFILT_AIO": "syscall", - "syscall.EVFILT_FS": "syscall", - "syscall.EVFILT_LIO": "syscall", - "syscall.EVFILT_MACHPORT": "syscall", - "syscall.EVFILT_PROC": "syscall", - "syscall.EVFILT_READ": "syscall", - "syscall.EVFILT_SIGNAL": "syscall", - "syscall.EVFILT_SYSCOUNT": "syscall", - "syscall.EVFILT_THREADMARKER": "syscall", - "syscall.EVFILT_TIMER": "syscall", - "syscall.EVFILT_USER": "syscall", - "syscall.EVFILT_VM": "syscall", - "syscall.EVFILT_VNODE": "syscall", - "syscall.EVFILT_WRITE": "syscall", - "syscall.EV_ADD": "syscall", - "syscall.EV_CLEAR": "syscall", - "syscall.EV_DELETE": "syscall", - "syscall.EV_DISABLE": "syscall", - "syscall.EV_DISPATCH": "syscall", - "syscall.EV_DROP": "syscall", - "syscall.EV_ENABLE": "syscall", - "syscall.EV_EOF": "syscall", - "syscall.EV_ERROR": "syscall", - "syscall.EV_FLAG0": "syscall", - "syscall.EV_FLAG1": "syscall", - "syscall.EV_ONESHOT": "syscall", - "syscall.EV_OOBAND": "syscall", - "syscall.EV_POLL": "syscall", - "syscall.EV_RECEIPT": "syscall", - "syscall.EV_SYSFLAGS": "syscall", - "syscall.EWINDOWS": "syscall", - "syscall.EWOULDBLOCK": "syscall", - "syscall.EXDEV": "syscall", - "syscall.EXFULL": "syscall", - "syscall.EXTA": "syscall", - "syscall.EXTB": "syscall", - "syscall.EXTPROC": "syscall", - "syscall.Environ": "syscall", - "syscall.EpollCreate": "syscall", - "syscall.EpollCreate1": "syscall", - "syscall.EpollCtl": "syscall", - "syscall.EpollEvent": "syscall", - "syscall.EpollWait": "syscall", - "syscall.Errno": "syscall", - "syscall.EscapeArg": "syscall", - "syscall.Exchangedata": "syscall", - "syscall.Exec": "syscall", - "syscall.Exit": "syscall", - "syscall.ExitProcess": "syscall", - "syscall.FD_CLOEXEC": "syscall", - "syscall.FD_SETSIZE": "syscall", - "syscall.FILE_ACTION_ADDED": "syscall", - "syscall.FILE_ACTION_MODIFIED": "syscall", - "syscall.FILE_ACTION_REMOVED": "syscall", - "syscall.FILE_ACTION_RENAMED_NEW_NAME": "syscall", - "syscall.FILE_ACTION_RENAMED_OLD_NAME": "syscall", - "syscall.FILE_APPEND_DATA": "syscall", - "syscall.FILE_ATTRIBUTE_ARCHIVE": "syscall", - "syscall.FILE_ATTRIBUTE_DIRECTORY": "syscall", - "syscall.FILE_ATTRIBUTE_HIDDEN": "syscall", - "syscall.FILE_ATTRIBUTE_NORMAL": "syscall", - "syscall.FILE_ATTRIBUTE_READONLY": "syscall", - "syscall.FILE_ATTRIBUTE_REPARSE_POINT": "syscall", - "syscall.FILE_ATTRIBUTE_SYSTEM": "syscall", - "syscall.FILE_BEGIN": "syscall", - "syscall.FILE_CURRENT": "syscall", - "syscall.FILE_END": "syscall", - "syscall.FILE_FLAG_BACKUP_SEMANTICS": "syscall", - "syscall.FILE_FLAG_OPEN_REPARSE_POINT": "syscall", - "syscall.FILE_FLAG_OVERLAPPED": "syscall", - "syscall.FILE_LIST_DIRECTORY": "syscall", - "syscall.FILE_MAP_COPY": "syscall", - "syscall.FILE_MAP_EXECUTE": "syscall", - "syscall.FILE_MAP_READ": "syscall", - "syscall.FILE_MAP_WRITE": "syscall", - "syscall.FILE_NOTIFY_CHANGE_ATTRIBUTES": "syscall", - "syscall.FILE_NOTIFY_CHANGE_CREATION": "syscall", - "syscall.FILE_NOTIFY_CHANGE_DIR_NAME": "syscall", - "syscall.FILE_NOTIFY_CHANGE_FILE_NAME": "syscall", - "syscall.FILE_NOTIFY_CHANGE_LAST_ACCESS": "syscall", - "syscall.FILE_NOTIFY_CHANGE_LAST_WRITE": "syscall", - "syscall.FILE_NOTIFY_CHANGE_SIZE": "syscall", - "syscall.FILE_SHARE_DELETE": "syscall", - "syscall.FILE_SHARE_READ": "syscall", - "syscall.FILE_SHARE_WRITE": "syscall", - "syscall.FILE_SKIP_COMPLETION_PORT_ON_SUCCESS": "syscall", - "syscall.FILE_SKIP_SET_EVENT_ON_HANDLE": "syscall", - "syscall.FILE_TYPE_CHAR": "syscall", - "syscall.FILE_TYPE_DISK": "syscall", - "syscall.FILE_TYPE_PIPE": "syscall", - "syscall.FILE_TYPE_REMOTE": "syscall", - "syscall.FILE_TYPE_UNKNOWN": "syscall", - "syscall.FILE_WRITE_ATTRIBUTES": "syscall", - "syscall.FLUSHO": "syscall", - "syscall.FORMAT_MESSAGE_ALLOCATE_BUFFER": "syscall", - "syscall.FORMAT_MESSAGE_ARGUMENT_ARRAY": "syscall", - "syscall.FORMAT_MESSAGE_FROM_HMODULE": "syscall", - "syscall.FORMAT_MESSAGE_FROM_STRING": "syscall", - "syscall.FORMAT_MESSAGE_FROM_SYSTEM": "syscall", - "syscall.FORMAT_MESSAGE_IGNORE_INSERTS": "syscall", - "syscall.FORMAT_MESSAGE_MAX_WIDTH_MASK": "syscall", - "syscall.FSCTL_GET_REPARSE_POINT": "syscall", - "syscall.F_ADDFILESIGS": "syscall", - "syscall.F_ADDSIGS": "syscall", - "syscall.F_ALLOCATEALL": "syscall", - "syscall.F_ALLOCATECONTIG": "syscall", - "syscall.F_CANCEL": "syscall", - "syscall.F_CHKCLEAN": "syscall", - "syscall.F_CLOSEM": "syscall", - "syscall.F_DUP2FD": "syscall", - "syscall.F_DUP2FD_CLOEXEC": "syscall", - "syscall.F_DUPFD": "syscall", - "syscall.F_DUPFD_CLOEXEC": "syscall", - "syscall.F_EXLCK": "syscall", - "syscall.F_FLUSH_DATA": "syscall", - "syscall.F_FREEZE_FS": "syscall", - "syscall.F_FSCTL": "syscall", - "syscall.F_FSDIRMASK": "syscall", - "syscall.F_FSIN": "syscall", - "syscall.F_FSINOUT": "syscall", - "syscall.F_FSOUT": "syscall", - "syscall.F_FSPRIV": "syscall", - "syscall.F_FSVOID": "syscall", - "syscall.F_FULLFSYNC": "syscall", - "syscall.F_GETFD": "syscall", - "syscall.F_GETFL": "syscall", - "syscall.F_GETLEASE": "syscall", - "syscall.F_GETLK": "syscall", - "syscall.F_GETLK64": "syscall", - "syscall.F_GETLKPID": "syscall", - "syscall.F_GETNOSIGPIPE": "syscall", - "syscall.F_GETOWN": "syscall", - "syscall.F_GETOWN_EX": "syscall", - "syscall.F_GETPATH": "syscall", - "syscall.F_GETPATH_MTMINFO": "syscall", - "syscall.F_GETPIPE_SZ": "syscall", - "syscall.F_GETPROTECTIONCLASS": "syscall", - "syscall.F_GETSIG": "syscall", - "syscall.F_GLOBAL_NOCACHE": "syscall", - "syscall.F_LOCK": "syscall", - "syscall.F_LOG2PHYS": "syscall", - "syscall.F_LOG2PHYS_EXT": "syscall", - "syscall.F_MARKDEPENDENCY": "syscall", - "syscall.F_MAXFD": "syscall", - "syscall.F_NOCACHE": "syscall", - "syscall.F_NODIRECT": "syscall", - "syscall.F_NOTIFY": "syscall", - "syscall.F_OGETLK": "syscall", - "syscall.F_OK": "syscall", - "syscall.F_OSETLK": "syscall", - "syscall.F_OSETLKW": "syscall", - "syscall.F_PARAM_MASK": "syscall", - "syscall.F_PARAM_MAX": "syscall", - "syscall.F_PATHPKG_CHECK": "syscall", - "syscall.F_PEOFPOSMODE": "syscall", - "syscall.F_PREALLOCATE": "syscall", - "syscall.F_RDADVISE": "syscall", - "syscall.F_RDAHEAD": "syscall", - "syscall.F_RDLCK": "syscall", - "syscall.F_READAHEAD": "syscall", - "syscall.F_READBOOTSTRAP": "syscall", - "syscall.F_SETBACKINGSTORE": "syscall", - "syscall.F_SETFD": "syscall", - "syscall.F_SETFL": "syscall", - "syscall.F_SETLEASE": "syscall", - "syscall.F_SETLK": "syscall", - "syscall.F_SETLK64": "syscall", - "syscall.F_SETLKW": "syscall", - "syscall.F_SETLKW64": "syscall", - "syscall.F_SETLK_REMOTE": "syscall", - "syscall.F_SETNOSIGPIPE": "syscall", - "syscall.F_SETOWN": "syscall", - "syscall.F_SETOWN_EX": "syscall", - "syscall.F_SETPIPE_SZ": "syscall", - "syscall.F_SETPROTECTIONCLASS": "syscall", - "syscall.F_SETSIG": "syscall", - "syscall.F_SETSIZE": "syscall", - "syscall.F_SHLCK": "syscall", - "syscall.F_TEST": "syscall", - "syscall.F_THAW_FS": "syscall", - "syscall.F_TLOCK": "syscall", - "syscall.F_ULOCK": "syscall", - "syscall.F_UNLCK": "syscall", - "syscall.F_UNLCKSYS": "syscall", - "syscall.F_VOLPOSMODE": "syscall", - "syscall.F_WRITEBOOTSTRAP": "syscall", - "syscall.F_WRLCK": "syscall", - "syscall.Faccessat": "syscall", - "syscall.Fallocate": "syscall", - "syscall.Fbootstraptransfer_t": "syscall", - "syscall.Fchdir": "syscall", - "syscall.Fchflags": "syscall", - "syscall.Fchmod": "syscall", - "syscall.Fchmodat": "syscall", - "syscall.Fchown": "syscall", - "syscall.Fchownat": "syscall", - "syscall.FcntlFlock": "syscall", - "syscall.FdSet": "syscall", - "syscall.Fdatasync": "syscall", - "syscall.FileNotifyInformation": "syscall", - "syscall.Filetime": "syscall", - "syscall.FindClose": "syscall", - "syscall.FindFirstFile": "syscall", - "syscall.FindNextFile": "syscall", - "syscall.Flock": "syscall", - "syscall.Flock_t": "syscall", - "syscall.FlushBpf": "syscall", - "syscall.FlushFileBuffers": "syscall", - "syscall.FlushViewOfFile": "syscall", - "syscall.ForkExec": "syscall", - "syscall.ForkLock": "syscall", - "syscall.FormatMessage": "syscall", - "syscall.Fpathconf": "syscall", - "syscall.FreeAddrInfoW": "syscall", - "syscall.FreeEnvironmentStrings": "syscall", - "syscall.FreeLibrary": "syscall", - "syscall.Fsid": "syscall", - "syscall.Fstat": "syscall", - "syscall.Fstatfs": "syscall", - "syscall.Fstore_t": "syscall", - "syscall.Fsync": "syscall", - "syscall.Ftruncate": "syscall", - "syscall.FullPath": "syscall", - "syscall.Futimes": "syscall", - "syscall.Futimesat": "syscall", - "syscall.GENERIC_ALL": "syscall", - "syscall.GENERIC_EXECUTE": "syscall", - "syscall.GENERIC_READ": "syscall", - "syscall.GENERIC_WRITE": "syscall", - "syscall.GUID": "syscall", - "syscall.GetAcceptExSockaddrs": "syscall", - "syscall.GetAdaptersInfo": "syscall", - "syscall.GetAddrInfoW": "syscall", - "syscall.GetCommandLine": "syscall", - "syscall.GetComputerName": "syscall", - "syscall.GetConsoleMode": "syscall", - "syscall.GetCurrentDirectory": "syscall", - "syscall.GetCurrentProcess": "syscall", - "syscall.GetEnvironmentStrings": "syscall", - "syscall.GetEnvironmentVariable": "syscall", - "syscall.GetExitCodeProcess": "syscall", - "syscall.GetFileAttributes": "syscall", - "syscall.GetFileAttributesEx": "syscall", - "syscall.GetFileExInfoStandard": "syscall", - "syscall.GetFileExMaxInfoLevel": "syscall", - "syscall.GetFileInformationByHandle": "syscall", - "syscall.GetFileType": "syscall", - "syscall.GetFullPathName": "syscall", - "syscall.GetHostByName": "syscall", - "syscall.GetIfEntry": "syscall", - "syscall.GetLastError": "syscall", - "syscall.GetLengthSid": "syscall", - "syscall.GetLongPathName": "syscall", - "syscall.GetProcAddress": "syscall", - "syscall.GetProcessTimes": "syscall", - "syscall.GetProtoByName": "syscall", - "syscall.GetQueuedCompletionStatus": "syscall", - "syscall.GetServByName": "syscall", - "syscall.GetShortPathName": "syscall", - "syscall.GetStartupInfo": "syscall", - "syscall.GetStdHandle": "syscall", - "syscall.GetSystemTimeAsFileTime": "syscall", - "syscall.GetTempPath": "syscall", - "syscall.GetTimeZoneInformation": "syscall", - "syscall.GetTokenInformation": "syscall", - "syscall.GetUserNameEx": "syscall", - "syscall.GetUserProfileDirectory": "syscall", - "syscall.GetVersion": "syscall", - "syscall.Getcwd": "syscall", - "syscall.Getdents": "syscall", - "syscall.Getdirentries": "syscall", - "syscall.Getdtablesize": "syscall", - "syscall.Getegid": "syscall", - "syscall.Getenv": "syscall", - "syscall.Geteuid": "syscall", - "syscall.Getfsstat": "syscall", - "syscall.Getgid": "syscall", - "syscall.Getgroups": "syscall", - "syscall.Getpagesize": "syscall", - "syscall.Getpeername": "syscall", - "syscall.Getpgid": "syscall", - "syscall.Getpgrp": "syscall", - "syscall.Getpid": "syscall", - "syscall.Getppid": "syscall", - "syscall.Getpriority": "syscall", - "syscall.Getrlimit": "syscall", - "syscall.Getrusage": "syscall", - "syscall.Getsid": "syscall", - "syscall.Getsockname": "syscall", - "syscall.Getsockopt": "syscall", - "syscall.GetsockoptByte": "syscall", - "syscall.GetsockoptICMPv6Filter": "syscall", - "syscall.GetsockoptIPMreq": "syscall", - "syscall.GetsockoptIPMreqn": "syscall", - "syscall.GetsockoptIPv6MTUInfo": "syscall", - "syscall.GetsockoptIPv6Mreq": "syscall", - "syscall.GetsockoptInet4Addr": "syscall", - "syscall.GetsockoptInt": "syscall", - "syscall.GetsockoptUcred": "syscall", - "syscall.Gettid": "syscall", - "syscall.Gettimeofday": "syscall", - "syscall.Getuid": "syscall", - "syscall.Getwd": "syscall", - "syscall.Getxattr": "syscall", - "syscall.HANDLE_FLAG_INHERIT": "syscall", - "syscall.HKEY_CLASSES_ROOT": "syscall", - "syscall.HKEY_CURRENT_CONFIG": "syscall", - "syscall.HKEY_CURRENT_USER": "syscall", - "syscall.HKEY_DYN_DATA": "syscall", - "syscall.HKEY_LOCAL_MACHINE": "syscall", - "syscall.HKEY_PERFORMANCE_DATA": "syscall", - "syscall.HKEY_USERS": "syscall", - "syscall.HUPCL": "syscall", - "syscall.Handle": "syscall", - "syscall.Hostent": "syscall", - "syscall.ICANON": "syscall", - "syscall.ICMP6_FILTER": "syscall", - "syscall.ICMPV6_FILTER": "syscall", - "syscall.ICMPv6Filter": "syscall", - "syscall.ICRNL": "syscall", - "syscall.IEXTEN": "syscall", - "syscall.IFAN_ARRIVAL": "syscall", - "syscall.IFAN_DEPARTURE": "syscall", - "syscall.IFA_ADDRESS": "syscall", - "syscall.IFA_ANYCAST": "syscall", - "syscall.IFA_BROADCAST": "syscall", - "syscall.IFA_CACHEINFO": "syscall", - "syscall.IFA_F_DADFAILED": "syscall", - "syscall.IFA_F_DEPRECATED": "syscall", - "syscall.IFA_F_HOMEADDRESS": "syscall", - "syscall.IFA_F_NODAD": "syscall", - "syscall.IFA_F_OPTIMISTIC": "syscall", - "syscall.IFA_F_PERMANENT": "syscall", - "syscall.IFA_F_SECONDARY": "syscall", - "syscall.IFA_F_TEMPORARY": "syscall", - "syscall.IFA_F_TENTATIVE": "syscall", - "syscall.IFA_LABEL": "syscall", - "syscall.IFA_LOCAL": "syscall", - "syscall.IFA_MAX": "syscall", - "syscall.IFA_MULTICAST": "syscall", - "syscall.IFA_ROUTE": "syscall", - "syscall.IFA_UNSPEC": "syscall", - "syscall.IFF_ALLMULTI": "syscall", - "syscall.IFF_ALTPHYS": "syscall", - "syscall.IFF_AUTOMEDIA": "syscall", - "syscall.IFF_BROADCAST": "syscall", - "syscall.IFF_CANTCHANGE": "syscall", - "syscall.IFF_CANTCONFIG": "syscall", - "syscall.IFF_DEBUG": "syscall", - "syscall.IFF_DRV_OACTIVE": "syscall", - "syscall.IFF_DRV_RUNNING": "syscall", - "syscall.IFF_DYING": "syscall", - "syscall.IFF_DYNAMIC": "syscall", - "syscall.IFF_LINK0": "syscall", - "syscall.IFF_LINK1": "syscall", - "syscall.IFF_LINK2": "syscall", - "syscall.IFF_LOOPBACK": "syscall", - "syscall.IFF_MASTER": "syscall", - "syscall.IFF_MONITOR": "syscall", - "syscall.IFF_MULTICAST": "syscall", - "syscall.IFF_NOARP": "syscall", - "syscall.IFF_NOTRAILERS": "syscall", - "syscall.IFF_NO_PI": "syscall", - "syscall.IFF_OACTIVE": "syscall", - "syscall.IFF_ONE_QUEUE": "syscall", - "syscall.IFF_POINTOPOINT": "syscall", - "syscall.IFF_POINTTOPOINT": "syscall", - "syscall.IFF_PORTSEL": "syscall", - "syscall.IFF_PPROMISC": "syscall", - "syscall.IFF_PROMISC": "syscall", - "syscall.IFF_RENAMING": "syscall", - "syscall.IFF_RUNNING": "syscall", - "syscall.IFF_SIMPLEX": "syscall", - "syscall.IFF_SLAVE": "syscall", - "syscall.IFF_SMART": "syscall", - "syscall.IFF_STATICARP": "syscall", - "syscall.IFF_TAP": "syscall", - "syscall.IFF_TUN": "syscall", - "syscall.IFF_TUN_EXCL": "syscall", - "syscall.IFF_UP": "syscall", - "syscall.IFF_VNET_HDR": "syscall", - "syscall.IFLA_ADDRESS": "syscall", - "syscall.IFLA_BROADCAST": "syscall", - "syscall.IFLA_COST": "syscall", - "syscall.IFLA_IFALIAS": "syscall", - "syscall.IFLA_IFNAME": "syscall", - "syscall.IFLA_LINK": "syscall", - "syscall.IFLA_LINKINFO": "syscall", - "syscall.IFLA_LINKMODE": "syscall", - "syscall.IFLA_MAP": "syscall", - "syscall.IFLA_MASTER": "syscall", - "syscall.IFLA_MAX": "syscall", - "syscall.IFLA_MTU": "syscall", - "syscall.IFLA_NET_NS_PID": "syscall", - "syscall.IFLA_OPERSTATE": "syscall", - "syscall.IFLA_PRIORITY": "syscall", - "syscall.IFLA_PROTINFO": "syscall", - "syscall.IFLA_QDISC": "syscall", - "syscall.IFLA_STATS": "syscall", - "syscall.IFLA_TXQLEN": "syscall", - "syscall.IFLA_UNSPEC": "syscall", - "syscall.IFLA_WEIGHT": "syscall", - "syscall.IFLA_WIRELESS": "syscall", - "syscall.IFNAMSIZ": "syscall", - "syscall.IFT_1822": "syscall", - "syscall.IFT_A12MPPSWITCH": "syscall", - "syscall.IFT_AAL2": "syscall", - "syscall.IFT_AAL5": "syscall", - "syscall.IFT_ADSL": "syscall", - "syscall.IFT_AFLANE8023": "syscall", - "syscall.IFT_AFLANE8025": "syscall", - "syscall.IFT_ARAP": "syscall", - "syscall.IFT_ARCNET": "syscall", - "syscall.IFT_ARCNETPLUS": "syscall", - "syscall.IFT_ASYNC": "syscall", - "syscall.IFT_ATM": "syscall", - "syscall.IFT_ATMDXI": "syscall", - "syscall.IFT_ATMFUNI": "syscall", - "syscall.IFT_ATMIMA": "syscall", - "syscall.IFT_ATMLOGICAL": "syscall", - "syscall.IFT_ATMRADIO": "syscall", - "syscall.IFT_ATMSUBINTERFACE": "syscall", - "syscall.IFT_ATMVCIENDPT": "syscall", - "syscall.IFT_ATMVIRTUAL": "syscall", - "syscall.IFT_BGPPOLICYACCOUNTING": "syscall", - "syscall.IFT_BLUETOOTH": "syscall", - "syscall.IFT_BRIDGE": "syscall", - "syscall.IFT_BSC": "syscall", - "syscall.IFT_CARP": "syscall", - "syscall.IFT_CCTEMUL": "syscall", - "syscall.IFT_CELLULAR": "syscall", - "syscall.IFT_CEPT": "syscall", - "syscall.IFT_CES": "syscall", - "syscall.IFT_CHANNEL": "syscall", - "syscall.IFT_CNR": "syscall", - "syscall.IFT_COFFEE": "syscall", - "syscall.IFT_COMPOSITELINK": "syscall", - "syscall.IFT_DCN": "syscall", - "syscall.IFT_DIGITALPOWERLINE": "syscall", - "syscall.IFT_DIGITALWRAPPEROVERHEADCHANNEL": "syscall", - "syscall.IFT_DLSW": "syscall", - "syscall.IFT_DOCSCABLEDOWNSTREAM": "syscall", - "syscall.IFT_DOCSCABLEMACLAYER": "syscall", - "syscall.IFT_DOCSCABLEUPSTREAM": "syscall", - "syscall.IFT_DOCSCABLEUPSTREAMCHANNEL": "syscall", - "syscall.IFT_DS0": "syscall", - "syscall.IFT_DS0BUNDLE": "syscall", - "syscall.IFT_DS1FDL": "syscall", - "syscall.IFT_DS3": "syscall", - "syscall.IFT_DTM": "syscall", - "syscall.IFT_DUMMY": "syscall", - "syscall.IFT_DVBASILN": "syscall", - "syscall.IFT_DVBASIOUT": "syscall", - "syscall.IFT_DVBRCCDOWNSTREAM": "syscall", - "syscall.IFT_DVBRCCMACLAYER": "syscall", - "syscall.IFT_DVBRCCUPSTREAM": "syscall", - "syscall.IFT_ECONET": "syscall", - "syscall.IFT_ENC": "syscall", - "syscall.IFT_EON": "syscall", - "syscall.IFT_EPLRS": "syscall", - "syscall.IFT_ESCON": "syscall", - "syscall.IFT_ETHER": "syscall", - "syscall.IFT_FAITH": "syscall", - "syscall.IFT_FAST": "syscall", - "syscall.IFT_FASTETHER": "syscall", - "syscall.IFT_FASTETHERFX": "syscall", - "syscall.IFT_FDDI": "syscall", - "syscall.IFT_FIBRECHANNEL": "syscall", - "syscall.IFT_FRAMERELAYINTERCONNECT": "syscall", - "syscall.IFT_FRAMERELAYMPI": "syscall", - "syscall.IFT_FRDLCIENDPT": "syscall", - "syscall.IFT_FRELAY": "syscall", - "syscall.IFT_FRELAYDCE": "syscall", - "syscall.IFT_FRF16MFRBUNDLE": "syscall", - "syscall.IFT_FRFORWARD": "syscall", - "syscall.IFT_G703AT2MB": "syscall", - "syscall.IFT_G703AT64K": "syscall", - "syscall.IFT_GIF": "syscall", - "syscall.IFT_GIGABITETHERNET": "syscall", - "syscall.IFT_GR303IDT": "syscall", - "syscall.IFT_GR303RDT": "syscall", - "syscall.IFT_H323GATEKEEPER": "syscall", - "syscall.IFT_H323PROXY": "syscall", - "syscall.IFT_HDH1822": "syscall", - "syscall.IFT_HDLC": "syscall", - "syscall.IFT_HDSL2": "syscall", - "syscall.IFT_HIPERLAN2": "syscall", - "syscall.IFT_HIPPI": "syscall", - "syscall.IFT_HIPPIINTERFACE": "syscall", - "syscall.IFT_HOSTPAD": "syscall", - "syscall.IFT_HSSI": "syscall", - "syscall.IFT_HY": "syscall", - "syscall.IFT_IBM370PARCHAN": "syscall", - "syscall.IFT_IDSL": "syscall", - "syscall.IFT_IEEE1394": "syscall", - "syscall.IFT_IEEE80211": "syscall", - "syscall.IFT_IEEE80212": "syscall", - "syscall.IFT_IEEE8023ADLAG": "syscall", - "syscall.IFT_IFGSN": "syscall", - "syscall.IFT_IMT": "syscall", - "syscall.IFT_INFINIBAND": "syscall", - "syscall.IFT_INTERLEAVE": "syscall", - "syscall.IFT_IP": "syscall", - "syscall.IFT_IPFORWARD": "syscall", - "syscall.IFT_IPOVERATM": "syscall", - "syscall.IFT_IPOVERCDLC": "syscall", - "syscall.IFT_IPOVERCLAW": "syscall", - "syscall.IFT_IPSWITCH": "syscall", - "syscall.IFT_IPXIP": "syscall", - "syscall.IFT_ISDN": "syscall", - "syscall.IFT_ISDNBASIC": "syscall", - "syscall.IFT_ISDNPRIMARY": "syscall", - "syscall.IFT_ISDNS": "syscall", - "syscall.IFT_ISDNU": "syscall", - "syscall.IFT_ISO88022LLC": "syscall", - "syscall.IFT_ISO88023": "syscall", - "syscall.IFT_ISO88024": "syscall", - "syscall.IFT_ISO88025": "syscall", - "syscall.IFT_ISO88025CRFPINT": "syscall", - "syscall.IFT_ISO88025DTR": "syscall", - "syscall.IFT_ISO88025FIBER": "syscall", - "syscall.IFT_ISO88026": "syscall", - "syscall.IFT_ISUP": "syscall", - "syscall.IFT_L2VLAN": "syscall", - "syscall.IFT_L3IPVLAN": "syscall", - "syscall.IFT_L3IPXVLAN": "syscall", - "syscall.IFT_LAPB": "syscall", - "syscall.IFT_LAPD": "syscall", - "syscall.IFT_LAPF": "syscall", - "syscall.IFT_LINEGROUP": "syscall", - "syscall.IFT_LOCALTALK": "syscall", - "syscall.IFT_LOOP": "syscall", - "syscall.IFT_MEDIAMAILOVERIP": "syscall", - "syscall.IFT_MFSIGLINK": "syscall", - "syscall.IFT_MIOX25": "syscall", - "syscall.IFT_MODEM": "syscall", - "syscall.IFT_MPC": "syscall", - "syscall.IFT_MPLS": "syscall", - "syscall.IFT_MPLSTUNNEL": "syscall", - "syscall.IFT_MSDSL": "syscall", - "syscall.IFT_MVL": "syscall", - "syscall.IFT_MYRINET": "syscall", - "syscall.IFT_NFAS": "syscall", - "syscall.IFT_NSIP": "syscall", - "syscall.IFT_OPTICALCHANNEL": "syscall", - "syscall.IFT_OPTICALTRANSPORT": "syscall", - "syscall.IFT_OTHER": "syscall", - "syscall.IFT_P10": "syscall", - "syscall.IFT_P80": "syscall", - "syscall.IFT_PARA": "syscall", - "syscall.IFT_PDP": "syscall", - "syscall.IFT_PFLOG": "syscall", - "syscall.IFT_PFLOW": "syscall", - "syscall.IFT_PFSYNC": "syscall", - "syscall.IFT_PLC": "syscall", - "syscall.IFT_PON155": "syscall", - "syscall.IFT_PON622": "syscall", - "syscall.IFT_POS": "syscall", - "syscall.IFT_PPP": "syscall", - "syscall.IFT_PPPMULTILINKBUNDLE": "syscall", - "syscall.IFT_PROPATM": "syscall", - "syscall.IFT_PROPBWAP2MP": "syscall", - "syscall.IFT_PROPCNLS": "syscall", - "syscall.IFT_PROPDOCSWIRELESSDOWNSTREAM": "syscall", - "syscall.IFT_PROPDOCSWIRELESSMACLAYER": "syscall", - "syscall.IFT_PROPDOCSWIRELESSUPSTREAM": "syscall", - "syscall.IFT_PROPMUX": "syscall", - "syscall.IFT_PROPVIRTUAL": "syscall", - "syscall.IFT_PROPWIRELESSP2P": "syscall", - "syscall.IFT_PTPSERIAL": "syscall", - "syscall.IFT_PVC": "syscall", - "syscall.IFT_Q2931": "syscall", - "syscall.IFT_QLLC": "syscall", - "syscall.IFT_RADIOMAC": "syscall", - "syscall.IFT_RADSL": "syscall", - "syscall.IFT_REACHDSL": "syscall", - "syscall.IFT_RFC1483": "syscall", - "syscall.IFT_RS232": "syscall", - "syscall.IFT_RSRB": "syscall", - "syscall.IFT_SDLC": "syscall", - "syscall.IFT_SDSL": "syscall", - "syscall.IFT_SHDSL": "syscall", - "syscall.IFT_SIP": "syscall", - "syscall.IFT_SIPSIG": "syscall", - "syscall.IFT_SIPTG": "syscall", - "syscall.IFT_SLIP": "syscall", - "syscall.IFT_SMDSDXI": "syscall", - "syscall.IFT_SMDSICIP": "syscall", - "syscall.IFT_SONET": "syscall", - "syscall.IFT_SONETOVERHEADCHANNEL": "syscall", - "syscall.IFT_SONETPATH": "syscall", - "syscall.IFT_SONETVT": "syscall", - "syscall.IFT_SRP": "syscall", - "syscall.IFT_SS7SIGLINK": "syscall", - "syscall.IFT_STACKTOSTACK": "syscall", - "syscall.IFT_STARLAN": "syscall", - "syscall.IFT_STF": "syscall", - "syscall.IFT_T1": "syscall", - "syscall.IFT_TDLC": "syscall", - "syscall.IFT_TELINK": "syscall", - "syscall.IFT_TERMPAD": "syscall", - "syscall.IFT_TR008": "syscall", - "syscall.IFT_TRANSPHDLC": "syscall", - "syscall.IFT_TUNNEL": "syscall", - "syscall.IFT_ULTRA": "syscall", - "syscall.IFT_USB": "syscall", - "syscall.IFT_V11": "syscall", - "syscall.IFT_V35": "syscall", - "syscall.IFT_V36": "syscall", - "syscall.IFT_V37": "syscall", - "syscall.IFT_VDSL": "syscall", - "syscall.IFT_VIRTUALIPADDRESS": "syscall", - "syscall.IFT_VIRTUALTG": "syscall", - "syscall.IFT_VOICEDID": "syscall", - "syscall.IFT_VOICEEM": "syscall", - "syscall.IFT_VOICEEMFGD": "syscall", - "syscall.IFT_VOICEENCAP": "syscall", - "syscall.IFT_VOICEFGDEANA": "syscall", - "syscall.IFT_VOICEFXO": "syscall", - "syscall.IFT_VOICEFXS": "syscall", - "syscall.IFT_VOICEOVERATM": "syscall", - "syscall.IFT_VOICEOVERCABLE": "syscall", - "syscall.IFT_VOICEOVERFRAMERELAY": "syscall", - "syscall.IFT_VOICEOVERIP": "syscall", - "syscall.IFT_X213": "syscall", - "syscall.IFT_X25": "syscall", - "syscall.IFT_X25DDN": "syscall", - "syscall.IFT_X25HUNTGROUP": "syscall", - "syscall.IFT_X25MLP": "syscall", - "syscall.IFT_X25PLE": "syscall", - "syscall.IFT_XETHER": "syscall", - "syscall.IGNBRK": "syscall", - "syscall.IGNCR": "syscall", - "syscall.IGNORE": "syscall", - "syscall.IGNPAR": "syscall", - "syscall.IMAXBEL": "syscall", - "syscall.INFINITE": "syscall", - "syscall.INLCR": "syscall", - "syscall.INPCK": "syscall", - "syscall.INVALID_FILE_ATTRIBUTES": "syscall", - "syscall.IN_ACCESS": "syscall", - "syscall.IN_ALL_EVENTS": "syscall", - "syscall.IN_ATTRIB": "syscall", - "syscall.IN_CLASSA_HOST": "syscall", - "syscall.IN_CLASSA_MAX": "syscall", - "syscall.IN_CLASSA_NET": "syscall", - "syscall.IN_CLASSA_NSHIFT": "syscall", - "syscall.IN_CLASSB_HOST": "syscall", - "syscall.IN_CLASSB_MAX": "syscall", - "syscall.IN_CLASSB_NET": "syscall", - "syscall.IN_CLASSB_NSHIFT": "syscall", - "syscall.IN_CLASSC_HOST": "syscall", - "syscall.IN_CLASSC_NET": "syscall", - "syscall.IN_CLASSC_NSHIFT": "syscall", - "syscall.IN_CLASSD_HOST": "syscall", - "syscall.IN_CLASSD_NET": "syscall", - "syscall.IN_CLASSD_NSHIFT": "syscall", - "syscall.IN_CLOEXEC": "syscall", - "syscall.IN_CLOSE": "syscall", - "syscall.IN_CLOSE_NOWRITE": "syscall", - "syscall.IN_CLOSE_WRITE": "syscall", - "syscall.IN_CREATE": "syscall", - "syscall.IN_DELETE": "syscall", - "syscall.IN_DELETE_SELF": "syscall", - "syscall.IN_DONT_FOLLOW": "syscall", - "syscall.IN_EXCL_UNLINK": "syscall", - "syscall.IN_IGNORED": "syscall", - "syscall.IN_ISDIR": "syscall", - "syscall.IN_LINKLOCALNETNUM": "syscall", - "syscall.IN_LOOPBACKNET": "syscall", - "syscall.IN_MASK_ADD": "syscall", - "syscall.IN_MODIFY": "syscall", - "syscall.IN_MOVE": "syscall", - "syscall.IN_MOVED_FROM": "syscall", - "syscall.IN_MOVED_TO": "syscall", - "syscall.IN_MOVE_SELF": "syscall", - "syscall.IN_NONBLOCK": "syscall", - "syscall.IN_ONESHOT": "syscall", - "syscall.IN_ONLYDIR": "syscall", - "syscall.IN_OPEN": "syscall", - "syscall.IN_Q_OVERFLOW": "syscall", - "syscall.IN_RFC3021_HOST": "syscall", - "syscall.IN_RFC3021_MASK": "syscall", - "syscall.IN_RFC3021_NET": "syscall", - "syscall.IN_RFC3021_NSHIFT": "syscall", - "syscall.IN_UNMOUNT": "syscall", - "syscall.IOC_IN": "syscall", - "syscall.IOC_INOUT": "syscall", - "syscall.IOC_OUT": "syscall", - "syscall.IOC_VENDOR": "syscall", - "syscall.IOC_WS2": "syscall", - "syscall.IO_REPARSE_TAG_SYMLINK": "syscall", - "syscall.IPMreq": "syscall", - "syscall.IPMreqn": "syscall", - "syscall.IPPROTO_3PC": "syscall", - "syscall.IPPROTO_ADFS": "syscall", - "syscall.IPPROTO_AH": "syscall", - "syscall.IPPROTO_AHIP": "syscall", - "syscall.IPPROTO_APES": "syscall", - "syscall.IPPROTO_ARGUS": "syscall", - "syscall.IPPROTO_AX25": "syscall", - "syscall.IPPROTO_BHA": "syscall", - "syscall.IPPROTO_BLT": "syscall", - "syscall.IPPROTO_BRSATMON": "syscall", - "syscall.IPPROTO_CARP": "syscall", - "syscall.IPPROTO_CFTP": "syscall", - "syscall.IPPROTO_CHAOS": "syscall", - "syscall.IPPROTO_CMTP": "syscall", - "syscall.IPPROTO_COMP": "syscall", - "syscall.IPPROTO_CPHB": "syscall", - "syscall.IPPROTO_CPNX": "syscall", - "syscall.IPPROTO_DCCP": "syscall", - "syscall.IPPROTO_DDP": "syscall", - "syscall.IPPROTO_DGP": "syscall", - "syscall.IPPROTO_DIVERT": "syscall", - "syscall.IPPROTO_DIVERT_INIT": "syscall", - "syscall.IPPROTO_DIVERT_RESP": "syscall", - "syscall.IPPROTO_DONE": "syscall", - "syscall.IPPROTO_DSTOPTS": "syscall", - "syscall.IPPROTO_EGP": "syscall", - "syscall.IPPROTO_EMCON": "syscall", - "syscall.IPPROTO_ENCAP": "syscall", - "syscall.IPPROTO_EON": "syscall", - "syscall.IPPROTO_ESP": "syscall", - "syscall.IPPROTO_ETHERIP": "syscall", - "syscall.IPPROTO_FRAGMENT": "syscall", - "syscall.IPPROTO_GGP": "syscall", - "syscall.IPPROTO_GMTP": "syscall", - "syscall.IPPROTO_GRE": "syscall", - "syscall.IPPROTO_HELLO": "syscall", - "syscall.IPPROTO_HMP": "syscall", - "syscall.IPPROTO_HOPOPTS": "syscall", - "syscall.IPPROTO_ICMP": "syscall", - "syscall.IPPROTO_ICMPV6": "syscall", - "syscall.IPPROTO_IDP": "syscall", - "syscall.IPPROTO_IDPR": "syscall", - "syscall.IPPROTO_IDRP": "syscall", - "syscall.IPPROTO_IGMP": "syscall", - "syscall.IPPROTO_IGP": "syscall", - "syscall.IPPROTO_IGRP": "syscall", - "syscall.IPPROTO_IL": "syscall", - "syscall.IPPROTO_INLSP": "syscall", - "syscall.IPPROTO_INP": "syscall", - "syscall.IPPROTO_IP": "syscall", - "syscall.IPPROTO_IPCOMP": "syscall", - "syscall.IPPROTO_IPCV": "syscall", - "syscall.IPPROTO_IPEIP": "syscall", - "syscall.IPPROTO_IPIP": "syscall", - "syscall.IPPROTO_IPPC": "syscall", - "syscall.IPPROTO_IPV4": "syscall", - "syscall.IPPROTO_IPV6": "syscall", - "syscall.IPPROTO_IPV6_ICMP": "syscall", - "syscall.IPPROTO_IRTP": "syscall", - "syscall.IPPROTO_KRYPTOLAN": "syscall", - "syscall.IPPROTO_LARP": "syscall", - "syscall.IPPROTO_LEAF1": "syscall", - "syscall.IPPROTO_LEAF2": "syscall", - "syscall.IPPROTO_MAX": "syscall", - "syscall.IPPROTO_MAXID": "syscall", - "syscall.IPPROTO_MEAS": "syscall", - "syscall.IPPROTO_MH": "syscall", - "syscall.IPPROTO_MHRP": "syscall", - "syscall.IPPROTO_MICP": "syscall", - "syscall.IPPROTO_MOBILE": "syscall", - "syscall.IPPROTO_MPLS": "syscall", - "syscall.IPPROTO_MTP": "syscall", - "syscall.IPPROTO_MUX": "syscall", - "syscall.IPPROTO_ND": "syscall", - "syscall.IPPROTO_NHRP": "syscall", - "syscall.IPPROTO_NONE": "syscall", - "syscall.IPPROTO_NSP": "syscall", - "syscall.IPPROTO_NVPII": "syscall", - "syscall.IPPROTO_OLD_DIVERT": "syscall", - "syscall.IPPROTO_OSPFIGP": "syscall", - "syscall.IPPROTO_PFSYNC": "syscall", - "syscall.IPPROTO_PGM": "syscall", - "syscall.IPPROTO_PIGP": "syscall", - "syscall.IPPROTO_PIM": "syscall", - "syscall.IPPROTO_PRM": "syscall", - "syscall.IPPROTO_PUP": "syscall", - "syscall.IPPROTO_PVP": "syscall", - "syscall.IPPROTO_RAW": "syscall", - "syscall.IPPROTO_RCCMON": "syscall", - "syscall.IPPROTO_RDP": "syscall", - "syscall.IPPROTO_ROUTING": "syscall", - "syscall.IPPROTO_RSVP": "syscall", - "syscall.IPPROTO_RVD": "syscall", - "syscall.IPPROTO_SATEXPAK": "syscall", - "syscall.IPPROTO_SATMON": "syscall", - "syscall.IPPROTO_SCCSP": "syscall", - "syscall.IPPROTO_SCTP": "syscall", - "syscall.IPPROTO_SDRP": "syscall", - "syscall.IPPROTO_SEND": "syscall", - "syscall.IPPROTO_SEP": "syscall", - "syscall.IPPROTO_SKIP": "syscall", - "syscall.IPPROTO_SPACER": "syscall", - "syscall.IPPROTO_SRPC": "syscall", - "syscall.IPPROTO_ST": "syscall", - "syscall.IPPROTO_SVMTP": "syscall", - "syscall.IPPROTO_SWIPE": "syscall", - "syscall.IPPROTO_TCF": "syscall", - "syscall.IPPROTO_TCP": "syscall", - "syscall.IPPROTO_TLSP": "syscall", - "syscall.IPPROTO_TP": "syscall", - "syscall.IPPROTO_TPXX": "syscall", - "syscall.IPPROTO_TRUNK1": "syscall", - "syscall.IPPROTO_TRUNK2": "syscall", - "syscall.IPPROTO_TTP": "syscall", - "syscall.IPPROTO_UDP": "syscall", - "syscall.IPPROTO_UDPLITE": "syscall", - "syscall.IPPROTO_VINES": "syscall", - "syscall.IPPROTO_VISA": "syscall", - "syscall.IPPROTO_VMTP": "syscall", - "syscall.IPPROTO_VRRP": "syscall", - "syscall.IPPROTO_WBEXPAK": "syscall", - "syscall.IPPROTO_WBMON": "syscall", - "syscall.IPPROTO_WSN": "syscall", - "syscall.IPPROTO_XNET": "syscall", - "syscall.IPPROTO_XTP": "syscall", - "syscall.IPV6_2292DSTOPTS": "syscall", - "syscall.IPV6_2292HOPLIMIT": "syscall", - "syscall.IPV6_2292HOPOPTS": "syscall", - "syscall.IPV6_2292NEXTHOP": "syscall", - "syscall.IPV6_2292PKTINFO": "syscall", - "syscall.IPV6_2292PKTOPTIONS": "syscall", - "syscall.IPV6_2292RTHDR": "syscall", - "syscall.IPV6_ADDRFORM": "syscall", - "syscall.IPV6_ADD_MEMBERSHIP": "syscall", - "syscall.IPV6_AUTHHDR": "syscall", - "syscall.IPV6_AUTH_LEVEL": "syscall", - "syscall.IPV6_AUTOFLOWLABEL": "syscall", - "syscall.IPV6_BINDANY": "syscall", - "syscall.IPV6_BINDV6ONLY": "syscall", - "syscall.IPV6_BOUND_IF": "syscall", - "syscall.IPV6_CHECKSUM": "syscall", - "syscall.IPV6_DEFAULT_MULTICAST_HOPS": "syscall", - "syscall.IPV6_DEFAULT_MULTICAST_LOOP": "syscall", - "syscall.IPV6_DEFHLIM": "syscall", - "syscall.IPV6_DONTFRAG": "syscall", - "syscall.IPV6_DROP_MEMBERSHIP": "syscall", - "syscall.IPV6_DSTOPTS": "syscall", - "syscall.IPV6_ESP_NETWORK_LEVEL": "syscall", - "syscall.IPV6_ESP_TRANS_LEVEL": "syscall", - "syscall.IPV6_FAITH": "syscall", - "syscall.IPV6_FLOWINFO_MASK": "syscall", - "syscall.IPV6_FLOWLABEL_MASK": "syscall", - "syscall.IPV6_FRAGTTL": "syscall", - "syscall.IPV6_FW_ADD": "syscall", - "syscall.IPV6_FW_DEL": "syscall", - "syscall.IPV6_FW_FLUSH": "syscall", - "syscall.IPV6_FW_GET": "syscall", - "syscall.IPV6_FW_ZERO": "syscall", - "syscall.IPV6_HLIMDEC": "syscall", - "syscall.IPV6_HOPLIMIT": "syscall", - "syscall.IPV6_HOPOPTS": "syscall", - "syscall.IPV6_IPCOMP_LEVEL": "syscall", - "syscall.IPV6_IPSEC_POLICY": "syscall", - "syscall.IPV6_JOIN_ANYCAST": "syscall", - "syscall.IPV6_JOIN_GROUP": "syscall", - "syscall.IPV6_LEAVE_ANYCAST": "syscall", - "syscall.IPV6_LEAVE_GROUP": "syscall", - "syscall.IPV6_MAXHLIM": "syscall", - "syscall.IPV6_MAXOPTHDR": "syscall", - "syscall.IPV6_MAXPACKET": "syscall", - "syscall.IPV6_MAX_GROUP_SRC_FILTER": "syscall", - "syscall.IPV6_MAX_MEMBERSHIPS": "syscall", - "syscall.IPV6_MAX_SOCK_SRC_FILTER": "syscall", - "syscall.IPV6_MIN_MEMBERSHIPS": "syscall", - "syscall.IPV6_MMTU": "syscall", - "syscall.IPV6_MSFILTER": "syscall", - "syscall.IPV6_MTU": "syscall", - "syscall.IPV6_MTU_DISCOVER": "syscall", - "syscall.IPV6_MULTICAST_HOPS": "syscall", - "syscall.IPV6_MULTICAST_IF": "syscall", - "syscall.IPV6_MULTICAST_LOOP": "syscall", - "syscall.IPV6_NEXTHOP": "syscall", - "syscall.IPV6_OPTIONS": "syscall", - "syscall.IPV6_PATHMTU": "syscall", - "syscall.IPV6_PIPEX": "syscall", - "syscall.IPV6_PKTINFO": "syscall", - "syscall.IPV6_PMTUDISC_DO": "syscall", - "syscall.IPV6_PMTUDISC_DONT": "syscall", - "syscall.IPV6_PMTUDISC_PROBE": "syscall", - "syscall.IPV6_PMTUDISC_WANT": "syscall", - "syscall.IPV6_PORTRANGE": "syscall", - "syscall.IPV6_PORTRANGE_DEFAULT": "syscall", - "syscall.IPV6_PORTRANGE_HIGH": "syscall", - "syscall.IPV6_PORTRANGE_LOW": "syscall", - "syscall.IPV6_PREFER_TEMPADDR": "syscall", - "syscall.IPV6_RECVDSTOPTS": "syscall", - "syscall.IPV6_RECVDSTPORT": "syscall", - "syscall.IPV6_RECVERR": "syscall", - "syscall.IPV6_RECVHOPLIMIT": "syscall", - "syscall.IPV6_RECVHOPOPTS": "syscall", - "syscall.IPV6_RECVPATHMTU": "syscall", - "syscall.IPV6_RECVPKTINFO": "syscall", - "syscall.IPV6_RECVRTHDR": "syscall", - "syscall.IPV6_RECVTCLASS": "syscall", - "syscall.IPV6_ROUTER_ALERT": "syscall", - "syscall.IPV6_RTABLE": "syscall", - "syscall.IPV6_RTHDR": "syscall", - "syscall.IPV6_RTHDRDSTOPTS": "syscall", - "syscall.IPV6_RTHDR_LOOSE": "syscall", - "syscall.IPV6_RTHDR_STRICT": "syscall", - "syscall.IPV6_RTHDR_TYPE_0": "syscall", - "syscall.IPV6_RXDSTOPTS": "syscall", - "syscall.IPV6_RXHOPOPTS": "syscall", - "syscall.IPV6_SOCKOPT_RESERVED1": "syscall", - "syscall.IPV6_TCLASS": "syscall", - "syscall.IPV6_UNICAST_HOPS": "syscall", - "syscall.IPV6_USE_MIN_MTU": "syscall", - "syscall.IPV6_V6ONLY": "syscall", - "syscall.IPV6_VERSION": "syscall", - "syscall.IPV6_VERSION_MASK": "syscall", - "syscall.IPV6_XFRM_POLICY": "syscall", - "syscall.IP_ADD_MEMBERSHIP": "syscall", - "syscall.IP_ADD_SOURCE_MEMBERSHIP": "syscall", - "syscall.IP_AUTH_LEVEL": "syscall", - "syscall.IP_BINDANY": "syscall", - "syscall.IP_BLOCK_SOURCE": "syscall", - "syscall.IP_BOUND_IF": "syscall", - "syscall.IP_DEFAULT_MULTICAST_LOOP": "syscall", - "syscall.IP_DEFAULT_MULTICAST_TTL": "syscall", - "syscall.IP_DF": "syscall", - "syscall.IP_DIVERTFL": "syscall", - "syscall.IP_DONTFRAG": "syscall", - "syscall.IP_DROP_MEMBERSHIP": "syscall", - "syscall.IP_DROP_SOURCE_MEMBERSHIP": "syscall", - "syscall.IP_DUMMYNET3": "syscall", - "syscall.IP_DUMMYNET_CONFIGURE": "syscall", - "syscall.IP_DUMMYNET_DEL": "syscall", - "syscall.IP_DUMMYNET_FLUSH": "syscall", - "syscall.IP_DUMMYNET_GET": "syscall", - "syscall.IP_EF": "syscall", - "syscall.IP_ERRORMTU": "syscall", - "syscall.IP_ESP_NETWORK_LEVEL": "syscall", - "syscall.IP_ESP_TRANS_LEVEL": "syscall", - "syscall.IP_FAITH": "syscall", - "syscall.IP_FREEBIND": "syscall", - "syscall.IP_FW3": "syscall", - "syscall.IP_FW_ADD": "syscall", - "syscall.IP_FW_DEL": "syscall", - "syscall.IP_FW_FLUSH": "syscall", - "syscall.IP_FW_GET": "syscall", - "syscall.IP_FW_NAT_CFG": "syscall", - "syscall.IP_FW_NAT_DEL": "syscall", - "syscall.IP_FW_NAT_GET_CONFIG": "syscall", - "syscall.IP_FW_NAT_GET_LOG": "syscall", - "syscall.IP_FW_RESETLOG": "syscall", - "syscall.IP_FW_TABLE_ADD": "syscall", - "syscall.IP_FW_TABLE_DEL": "syscall", - "syscall.IP_FW_TABLE_FLUSH": "syscall", - "syscall.IP_FW_TABLE_GETSIZE": "syscall", - "syscall.IP_FW_TABLE_LIST": "syscall", - "syscall.IP_FW_ZERO": "syscall", - "syscall.IP_HDRINCL": "syscall", - "syscall.IP_IPCOMP_LEVEL": "syscall", - "syscall.IP_IPSECFLOWINFO": "syscall", - "syscall.IP_IPSEC_LOCAL_AUTH": "syscall", - "syscall.IP_IPSEC_LOCAL_CRED": "syscall", - "syscall.IP_IPSEC_LOCAL_ID": "syscall", - "syscall.IP_IPSEC_POLICY": "syscall", - "syscall.IP_IPSEC_REMOTE_AUTH": "syscall", - "syscall.IP_IPSEC_REMOTE_CRED": "syscall", - "syscall.IP_IPSEC_REMOTE_ID": "syscall", - "syscall.IP_MAXPACKET": "syscall", - "syscall.IP_MAX_GROUP_SRC_FILTER": "syscall", - "syscall.IP_MAX_MEMBERSHIPS": "syscall", - "syscall.IP_MAX_SOCK_MUTE_FILTER": "syscall", - "syscall.IP_MAX_SOCK_SRC_FILTER": "syscall", - "syscall.IP_MAX_SOURCE_FILTER": "syscall", - "syscall.IP_MF": "syscall", - "syscall.IP_MINFRAGSIZE": "syscall", - "syscall.IP_MINTTL": "syscall", - "syscall.IP_MIN_MEMBERSHIPS": "syscall", - "syscall.IP_MSFILTER": "syscall", - "syscall.IP_MSS": "syscall", - "syscall.IP_MTU": "syscall", - "syscall.IP_MTU_DISCOVER": "syscall", - "syscall.IP_MULTICAST_IF": "syscall", - "syscall.IP_MULTICAST_IFINDEX": "syscall", - "syscall.IP_MULTICAST_LOOP": "syscall", - "syscall.IP_MULTICAST_TTL": "syscall", - "syscall.IP_MULTICAST_VIF": "syscall", - "syscall.IP_NAT__XXX": "syscall", - "syscall.IP_OFFMASK": "syscall", - "syscall.IP_OLD_FW_ADD": "syscall", - "syscall.IP_OLD_FW_DEL": "syscall", - "syscall.IP_OLD_FW_FLUSH": "syscall", - "syscall.IP_OLD_FW_GET": "syscall", - "syscall.IP_OLD_FW_RESETLOG": "syscall", - "syscall.IP_OLD_FW_ZERO": "syscall", - "syscall.IP_ONESBCAST": "syscall", - "syscall.IP_OPTIONS": "syscall", - "syscall.IP_ORIGDSTADDR": "syscall", - "syscall.IP_PASSSEC": "syscall", - "syscall.IP_PIPEX": "syscall", - "syscall.IP_PKTINFO": "syscall", - "syscall.IP_PKTOPTIONS": "syscall", - "syscall.IP_PMTUDISC": "syscall", - "syscall.IP_PMTUDISC_DO": "syscall", - "syscall.IP_PMTUDISC_DONT": "syscall", - "syscall.IP_PMTUDISC_PROBE": "syscall", - "syscall.IP_PMTUDISC_WANT": "syscall", - "syscall.IP_PORTRANGE": "syscall", - "syscall.IP_PORTRANGE_DEFAULT": "syscall", - "syscall.IP_PORTRANGE_HIGH": "syscall", - "syscall.IP_PORTRANGE_LOW": "syscall", - "syscall.IP_RECVDSTADDR": "syscall", - "syscall.IP_RECVDSTPORT": "syscall", - "syscall.IP_RECVERR": "syscall", - "syscall.IP_RECVIF": "syscall", - "syscall.IP_RECVOPTS": "syscall", - "syscall.IP_RECVORIGDSTADDR": "syscall", - "syscall.IP_RECVPKTINFO": "syscall", - "syscall.IP_RECVRETOPTS": "syscall", - "syscall.IP_RECVRTABLE": "syscall", - "syscall.IP_RECVTOS": "syscall", - "syscall.IP_RECVTTL": "syscall", - "syscall.IP_RETOPTS": "syscall", - "syscall.IP_RF": "syscall", - "syscall.IP_ROUTER_ALERT": "syscall", - "syscall.IP_RSVP_OFF": "syscall", - "syscall.IP_RSVP_ON": "syscall", - "syscall.IP_RSVP_VIF_OFF": "syscall", - "syscall.IP_RSVP_VIF_ON": "syscall", - "syscall.IP_RTABLE": "syscall", - "syscall.IP_SENDSRCADDR": "syscall", - "syscall.IP_STRIPHDR": "syscall", - "syscall.IP_TOS": "syscall", - "syscall.IP_TRAFFIC_MGT_BACKGROUND": "syscall", - "syscall.IP_TRANSPARENT": "syscall", - "syscall.IP_TTL": "syscall", - "syscall.IP_UNBLOCK_SOURCE": "syscall", - "syscall.IP_XFRM_POLICY": "syscall", - "syscall.IPv6MTUInfo": "syscall", - "syscall.IPv6Mreq": "syscall", - "syscall.ISIG": "syscall", - "syscall.ISTRIP": "syscall", - "syscall.IUCLC": "syscall", - "syscall.IUTF8": "syscall", - "syscall.IXANY": "syscall", - "syscall.IXOFF": "syscall", - "syscall.IXON": "syscall", - "syscall.IfAddrmsg": "syscall", - "syscall.IfAnnounceMsghdr": "syscall", - "syscall.IfData": "syscall", - "syscall.IfInfomsg": "syscall", - "syscall.IfMsghdr": "syscall", - "syscall.IfaMsghdr": "syscall", - "syscall.IfmaMsghdr": "syscall", - "syscall.IfmaMsghdr2": "syscall", - "syscall.ImplementsGetwd": "syscall", - "syscall.Inet4Pktinfo": "syscall", - "syscall.Inet6Pktinfo": "syscall", - "syscall.InotifyAddWatch": "syscall", - "syscall.InotifyEvent": "syscall", - "syscall.InotifyInit": "syscall", - "syscall.InotifyInit1": "syscall", - "syscall.InotifyRmWatch": "syscall", - "syscall.InterfaceAddrMessage": "syscall", - "syscall.InterfaceAnnounceMessage": "syscall", - "syscall.InterfaceInfo": "syscall", - "syscall.InterfaceMessage": "syscall", - "syscall.InterfaceMulticastAddrMessage": "syscall", - "syscall.InvalidHandle": "syscall", - "syscall.Ioperm": "syscall", - "syscall.Iopl": "syscall", - "syscall.Iovec": "syscall", - "syscall.IpAdapterInfo": "syscall", - "syscall.IpAddrString": "syscall", - "syscall.IpAddressString": "syscall", - "syscall.IpMaskString": "syscall", - "syscall.Issetugid": "syscall", - "syscall.KEY_ALL_ACCESS": "syscall", - "syscall.KEY_CREATE_LINK": "syscall", - "syscall.KEY_CREATE_SUB_KEY": "syscall", - "syscall.KEY_ENUMERATE_SUB_KEYS": "syscall", - "syscall.KEY_EXECUTE": "syscall", - "syscall.KEY_NOTIFY": "syscall", - "syscall.KEY_QUERY_VALUE": "syscall", - "syscall.KEY_READ": "syscall", - "syscall.KEY_SET_VALUE": "syscall", - "syscall.KEY_WOW64_32KEY": "syscall", - "syscall.KEY_WOW64_64KEY": "syscall", - "syscall.KEY_WRITE": "syscall", - "syscall.Kevent": "syscall", - "syscall.Kevent_t": "syscall", - "syscall.Kill": "syscall", - "syscall.Klogctl": "syscall", - "syscall.Kqueue": "syscall", - "syscall.LANG_ENGLISH": "syscall", - "syscall.LAYERED_PROTOCOL": "syscall", - "syscall.LCNT_OVERLOAD_FLUSH": "syscall", - "syscall.LINUX_REBOOT_CMD_CAD_OFF": "syscall", - "syscall.LINUX_REBOOT_CMD_CAD_ON": "syscall", - "syscall.LINUX_REBOOT_CMD_HALT": "syscall", - "syscall.LINUX_REBOOT_CMD_KEXEC": "syscall", - "syscall.LINUX_REBOOT_CMD_POWER_OFF": "syscall", - "syscall.LINUX_REBOOT_CMD_RESTART": "syscall", - "syscall.LINUX_REBOOT_CMD_RESTART2": "syscall", - "syscall.LINUX_REBOOT_CMD_SW_SUSPEND": "syscall", - "syscall.LINUX_REBOOT_MAGIC1": "syscall", - "syscall.LINUX_REBOOT_MAGIC2": "syscall", - "syscall.LOCK_EX": "syscall", - "syscall.LOCK_NB": "syscall", - "syscall.LOCK_SH": "syscall", - "syscall.LOCK_UN": "syscall", - "syscall.LazyDLL": "syscall", - "syscall.LazyProc": "syscall", - "syscall.Lchown": "syscall", - "syscall.Linger": "syscall", - "syscall.Link": "syscall", - "syscall.Listen": "syscall", - "syscall.Listxattr": "syscall", - "syscall.LoadCancelIoEx": "syscall", - "syscall.LoadConnectEx": "syscall", - "syscall.LoadCreateSymbolicLink": "syscall", - "syscall.LoadDLL": "syscall", - "syscall.LoadGetAddrInfo": "syscall", - "syscall.LoadLibrary": "syscall", - "syscall.LoadSetFileCompletionNotificationModes": "syscall", - "syscall.LocalFree": "syscall", - "syscall.Log2phys_t": "syscall", - "syscall.LookupAccountName": "syscall", - "syscall.LookupAccountSid": "syscall", - "syscall.LookupSID": "syscall", - "syscall.LsfJump": "syscall", - "syscall.LsfSocket": "syscall", - "syscall.LsfStmt": "syscall", - "syscall.Lstat": "syscall", - "syscall.MADV_AUTOSYNC": "syscall", - "syscall.MADV_CAN_REUSE": "syscall", - "syscall.MADV_CORE": "syscall", - "syscall.MADV_DOFORK": "syscall", - "syscall.MADV_DONTFORK": "syscall", - "syscall.MADV_DONTNEED": "syscall", - "syscall.MADV_FREE": "syscall", - "syscall.MADV_FREE_REUSABLE": "syscall", - "syscall.MADV_FREE_REUSE": "syscall", - "syscall.MADV_HUGEPAGE": "syscall", - "syscall.MADV_HWPOISON": "syscall", - "syscall.MADV_MERGEABLE": "syscall", - "syscall.MADV_NOCORE": "syscall", - "syscall.MADV_NOHUGEPAGE": "syscall", - "syscall.MADV_NORMAL": "syscall", - "syscall.MADV_NOSYNC": "syscall", - "syscall.MADV_PROTECT": "syscall", - "syscall.MADV_RANDOM": "syscall", - "syscall.MADV_REMOVE": "syscall", - "syscall.MADV_SEQUENTIAL": "syscall", - "syscall.MADV_SPACEAVAIL": "syscall", - "syscall.MADV_UNMERGEABLE": "syscall", - "syscall.MADV_WILLNEED": "syscall", - "syscall.MADV_ZERO_WIRED_PAGES": "syscall", - "syscall.MAP_32BIT": "syscall", - "syscall.MAP_ALIGNED_SUPER": "syscall", - "syscall.MAP_ALIGNMENT_16MB": "syscall", - "syscall.MAP_ALIGNMENT_1TB": "syscall", - "syscall.MAP_ALIGNMENT_256TB": "syscall", - "syscall.MAP_ALIGNMENT_4GB": "syscall", - "syscall.MAP_ALIGNMENT_64KB": "syscall", - "syscall.MAP_ALIGNMENT_64PB": "syscall", - "syscall.MAP_ALIGNMENT_MASK": "syscall", - "syscall.MAP_ALIGNMENT_SHIFT": "syscall", - "syscall.MAP_ANON": "syscall", - "syscall.MAP_ANONYMOUS": "syscall", - "syscall.MAP_COPY": "syscall", - "syscall.MAP_DENYWRITE": "syscall", - "syscall.MAP_EXECUTABLE": "syscall", - "syscall.MAP_FILE": "syscall", - "syscall.MAP_FIXED": "syscall", - "syscall.MAP_FLAGMASK": "syscall", - "syscall.MAP_GROWSDOWN": "syscall", - "syscall.MAP_HASSEMAPHORE": "syscall", - "syscall.MAP_HUGETLB": "syscall", - "syscall.MAP_INHERIT": "syscall", - "syscall.MAP_INHERIT_COPY": "syscall", - "syscall.MAP_INHERIT_DEFAULT": "syscall", - "syscall.MAP_INHERIT_DONATE_COPY": "syscall", - "syscall.MAP_INHERIT_NONE": "syscall", - "syscall.MAP_INHERIT_SHARE": "syscall", - "syscall.MAP_JIT": "syscall", - "syscall.MAP_LOCKED": "syscall", - "syscall.MAP_NOCACHE": "syscall", - "syscall.MAP_NOCORE": "syscall", - "syscall.MAP_NOEXTEND": "syscall", - "syscall.MAP_NONBLOCK": "syscall", - "syscall.MAP_NORESERVE": "syscall", - "syscall.MAP_NOSYNC": "syscall", - "syscall.MAP_POPULATE": "syscall", - "syscall.MAP_PREFAULT_READ": "syscall", - "syscall.MAP_PRIVATE": "syscall", - "syscall.MAP_RENAME": "syscall", - "syscall.MAP_RESERVED0080": "syscall", - "syscall.MAP_RESERVED0100": "syscall", - "syscall.MAP_SHARED": "syscall", - "syscall.MAP_STACK": "syscall", - "syscall.MAP_TRYFIXED": "syscall", - "syscall.MAP_TYPE": "syscall", - "syscall.MAP_WIRED": "syscall", - "syscall.MAXIMUM_REPARSE_DATA_BUFFER_SIZE": "syscall", - "syscall.MAXLEN_IFDESCR": "syscall", - "syscall.MAXLEN_PHYSADDR": "syscall", - "syscall.MAX_ADAPTER_ADDRESS_LENGTH": "syscall", - "syscall.MAX_ADAPTER_DESCRIPTION_LENGTH": "syscall", - "syscall.MAX_ADAPTER_NAME_LENGTH": "syscall", - "syscall.MAX_COMPUTERNAME_LENGTH": "syscall", - "syscall.MAX_INTERFACE_NAME_LEN": "syscall", - "syscall.MAX_LONG_PATH": "syscall", - "syscall.MAX_PATH": "syscall", - "syscall.MAX_PROTOCOL_CHAIN": "syscall", - "syscall.MCL_CURRENT": "syscall", - "syscall.MCL_FUTURE": "syscall", - "syscall.MNT_DETACH": "syscall", - "syscall.MNT_EXPIRE": "syscall", - "syscall.MNT_FORCE": "syscall", - "syscall.MSG_BCAST": "syscall", - "syscall.MSG_CMSG_CLOEXEC": "syscall", - "syscall.MSG_COMPAT": "syscall", - "syscall.MSG_CONFIRM": "syscall", - "syscall.MSG_CONTROLMBUF": "syscall", - "syscall.MSG_CTRUNC": "syscall", - "syscall.MSG_DONTROUTE": "syscall", - "syscall.MSG_DONTWAIT": "syscall", - "syscall.MSG_EOF": "syscall", - "syscall.MSG_EOR": "syscall", - "syscall.MSG_ERRQUEUE": "syscall", - "syscall.MSG_FASTOPEN": "syscall", - "syscall.MSG_FIN": "syscall", - "syscall.MSG_FLUSH": "syscall", - "syscall.MSG_HAVEMORE": "syscall", - "syscall.MSG_HOLD": "syscall", - "syscall.MSG_IOVUSRSPACE": "syscall", - "syscall.MSG_LENUSRSPACE": "syscall", - "syscall.MSG_MCAST": "syscall", - "syscall.MSG_MORE": "syscall", - "syscall.MSG_NAMEMBUF": "syscall", - "syscall.MSG_NBIO": "syscall", - "syscall.MSG_NEEDSA": "syscall", - "syscall.MSG_NOSIGNAL": "syscall", - "syscall.MSG_NOTIFICATION": "syscall", - "syscall.MSG_OOB": "syscall", - "syscall.MSG_PEEK": "syscall", - "syscall.MSG_PROXY": "syscall", - "syscall.MSG_RCVMORE": "syscall", - "syscall.MSG_RST": "syscall", - "syscall.MSG_SEND": "syscall", - "syscall.MSG_SYN": "syscall", - "syscall.MSG_TRUNC": "syscall", - "syscall.MSG_TRYHARD": "syscall", - "syscall.MSG_USERFLAGS": "syscall", - "syscall.MSG_WAITALL": "syscall", - "syscall.MSG_WAITFORONE": "syscall", - "syscall.MSG_WAITSTREAM": "syscall", - "syscall.MS_ACTIVE": "syscall", - "syscall.MS_ASYNC": "syscall", - "syscall.MS_BIND": "syscall", - "syscall.MS_DEACTIVATE": "syscall", - "syscall.MS_DIRSYNC": "syscall", - "syscall.MS_INVALIDATE": "syscall", - "syscall.MS_I_VERSION": "syscall", - "syscall.MS_KERNMOUNT": "syscall", - "syscall.MS_KILLPAGES": "syscall", - "syscall.MS_MANDLOCK": "syscall", - "syscall.MS_MGC_MSK": "syscall", - "syscall.MS_MGC_VAL": "syscall", - "syscall.MS_MOVE": "syscall", - "syscall.MS_NOATIME": "syscall", - "syscall.MS_NODEV": "syscall", - "syscall.MS_NODIRATIME": "syscall", - "syscall.MS_NOEXEC": "syscall", - "syscall.MS_NOSUID": "syscall", - "syscall.MS_NOUSER": "syscall", - "syscall.MS_POSIXACL": "syscall", - "syscall.MS_PRIVATE": "syscall", - "syscall.MS_RDONLY": "syscall", - "syscall.MS_REC": "syscall", - "syscall.MS_RELATIME": "syscall", - "syscall.MS_REMOUNT": "syscall", - "syscall.MS_RMT_MASK": "syscall", - "syscall.MS_SHARED": "syscall", - "syscall.MS_SILENT": "syscall", - "syscall.MS_SLAVE": "syscall", - "syscall.MS_STRICTATIME": "syscall", - "syscall.MS_SYNC": "syscall", - "syscall.MS_SYNCHRONOUS": "syscall", - "syscall.MS_UNBINDABLE": "syscall", - "syscall.Madvise": "syscall", - "syscall.MapViewOfFile": "syscall", - "syscall.MaxTokenInfoClass": "syscall", - "syscall.Mclpool": "syscall", - "syscall.MibIfRow": "syscall", - "syscall.Mkdir": "syscall", - "syscall.Mkdirat": "syscall", - "syscall.Mkfifo": "syscall", - "syscall.Mknod": "syscall", - "syscall.Mknodat": "syscall", - "syscall.Mlock": "syscall", - "syscall.Mlockall": "syscall", - "syscall.Mmap": "syscall", - "syscall.Mount": "syscall", - "syscall.MoveFile": "syscall", - "syscall.Mprotect": "syscall", - "syscall.Msghdr": "syscall", - "syscall.Munlock": "syscall", - "syscall.Munlockall": "syscall", - "syscall.Munmap": "syscall", - "syscall.MustLoadDLL": "syscall", - "syscall.NAME_MAX": "syscall", - "syscall.NETLINK_ADD_MEMBERSHIP": "syscall", - "syscall.NETLINK_AUDIT": "syscall", - "syscall.NETLINK_BROADCAST_ERROR": "syscall", - "syscall.NETLINK_CONNECTOR": "syscall", - "syscall.NETLINK_DNRTMSG": "syscall", - "syscall.NETLINK_DROP_MEMBERSHIP": "syscall", - "syscall.NETLINK_ECRYPTFS": "syscall", - "syscall.NETLINK_FIB_LOOKUP": "syscall", - "syscall.NETLINK_FIREWALL": "syscall", - "syscall.NETLINK_GENERIC": "syscall", - "syscall.NETLINK_INET_DIAG": "syscall", - "syscall.NETLINK_IP6_FW": "syscall", - "syscall.NETLINK_ISCSI": "syscall", - "syscall.NETLINK_KOBJECT_UEVENT": "syscall", - "syscall.NETLINK_NETFILTER": "syscall", - "syscall.NETLINK_NFLOG": "syscall", - "syscall.NETLINK_NO_ENOBUFS": "syscall", - "syscall.NETLINK_PKTINFO": "syscall", - "syscall.NETLINK_RDMA": "syscall", - "syscall.NETLINK_ROUTE": "syscall", - "syscall.NETLINK_SCSITRANSPORT": "syscall", - "syscall.NETLINK_SELINUX": "syscall", - "syscall.NETLINK_UNUSED": "syscall", - "syscall.NETLINK_USERSOCK": "syscall", - "syscall.NETLINK_XFRM": "syscall", - "syscall.NET_RT_DUMP": "syscall", - "syscall.NET_RT_DUMP2": "syscall", - "syscall.NET_RT_FLAGS": "syscall", - "syscall.NET_RT_IFLIST": "syscall", - "syscall.NET_RT_IFLIST2": "syscall", - "syscall.NET_RT_IFLISTL": "syscall", - "syscall.NET_RT_IFMALIST": "syscall", - "syscall.NET_RT_MAXID": "syscall", - "syscall.NET_RT_OIFLIST": "syscall", - "syscall.NET_RT_OOIFLIST": "syscall", - "syscall.NET_RT_STAT": "syscall", - "syscall.NET_RT_STATS": "syscall", - "syscall.NET_RT_TABLE": "syscall", - "syscall.NET_RT_TRASH": "syscall", - "syscall.NLA_ALIGNTO": "syscall", - "syscall.NLA_F_NESTED": "syscall", - "syscall.NLA_F_NET_BYTEORDER": "syscall", - "syscall.NLA_HDRLEN": "syscall", - "syscall.NLMSG_ALIGNTO": "syscall", - "syscall.NLMSG_DONE": "syscall", - "syscall.NLMSG_ERROR": "syscall", - "syscall.NLMSG_HDRLEN": "syscall", - "syscall.NLMSG_MIN_TYPE": "syscall", - "syscall.NLMSG_NOOP": "syscall", - "syscall.NLMSG_OVERRUN": "syscall", - "syscall.NLM_F_ACK": "syscall", - "syscall.NLM_F_APPEND": "syscall", - "syscall.NLM_F_ATOMIC": "syscall", - "syscall.NLM_F_CREATE": "syscall", - "syscall.NLM_F_DUMP": "syscall", - "syscall.NLM_F_ECHO": "syscall", - "syscall.NLM_F_EXCL": "syscall", - "syscall.NLM_F_MATCH": "syscall", - "syscall.NLM_F_MULTI": "syscall", - "syscall.NLM_F_REPLACE": "syscall", - "syscall.NLM_F_REQUEST": "syscall", - "syscall.NLM_F_ROOT": "syscall", - "syscall.NOFLSH": "syscall", - "syscall.NOTE_ABSOLUTE": "syscall", - "syscall.NOTE_ATTRIB": "syscall", - "syscall.NOTE_CHILD": "syscall", - "syscall.NOTE_DELETE": "syscall", - "syscall.NOTE_EOF": "syscall", - "syscall.NOTE_EXEC": "syscall", - "syscall.NOTE_EXIT": "syscall", - "syscall.NOTE_EXITSTATUS": "syscall", - "syscall.NOTE_EXTEND": "syscall", - "syscall.NOTE_FFAND": "syscall", - "syscall.NOTE_FFCOPY": "syscall", - "syscall.NOTE_FFCTRLMASK": "syscall", - "syscall.NOTE_FFLAGSMASK": "syscall", - "syscall.NOTE_FFNOP": "syscall", - "syscall.NOTE_FFOR": "syscall", - "syscall.NOTE_FORK": "syscall", - "syscall.NOTE_LINK": "syscall", - "syscall.NOTE_LOWAT": "syscall", - "syscall.NOTE_NONE": "syscall", - "syscall.NOTE_NSECONDS": "syscall", - "syscall.NOTE_PCTRLMASK": "syscall", - "syscall.NOTE_PDATAMASK": "syscall", - "syscall.NOTE_REAP": "syscall", - "syscall.NOTE_RENAME": "syscall", - "syscall.NOTE_RESOURCEEND": "syscall", - "syscall.NOTE_REVOKE": "syscall", - "syscall.NOTE_SECONDS": "syscall", - "syscall.NOTE_SIGNAL": "syscall", - "syscall.NOTE_TRACK": "syscall", - "syscall.NOTE_TRACKERR": "syscall", - "syscall.NOTE_TRIGGER": "syscall", - "syscall.NOTE_TRUNCATE": "syscall", - "syscall.NOTE_USECONDS": "syscall", - "syscall.NOTE_VM_ERROR": "syscall", - "syscall.NOTE_VM_PRESSURE": "syscall", - "syscall.NOTE_VM_PRESSURE_SUDDEN_TERMINATE": "syscall", - "syscall.NOTE_VM_PRESSURE_TERMINATE": "syscall", - "syscall.NOTE_WRITE": "syscall", - "syscall.NameCanonical": "syscall", - "syscall.NameCanonicalEx": "syscall", - "syscall.NameDisplay": "syscall", - "syscall.NameDnsDomain": "syscall", - "syscall.NameFullyQualifiedDN": "syscall", - "syscall.NameSamCompatible": "syscall", - "syscall.NameServicePrincipal": "syscall", - "syscall.NameUniqueId": "syscall", - "syscall.NameUnknown": "syscall", - "syscall.NameUserPrincipal": "syscall", - "syscall.Nanosleep": "syscall", - "syscall.NetApiBufferFree": "syscall", - "syscall.NetGetJoinInformation": "syscall", - "syscall.NetSetupDomainName": "syscall", - "syscall.NetSetupUnjoined": "syscall", - "syscall.NetSetupUnknownStatus": "syscall", - "syscall.NetSetupWorkgroupName": "syscall", - "syscall.NetUserGetInfo": "syscall", - "syscall.NetlinkMessage": "syscall", - "syscall.NetlinkRIB": "syscall", - "syscall.NetlinkRouteAttr": "syscall", - "syscall.NetlinkRouteRequest": "syscall", - "syscall.NewCallback": "syscall", - "syscall.NewCallbackCDecl": "syscall", - "syscall.NewLazyDLL": "syscall", - "syscall.NlAttr": "syscall", - "syscall.NlMsgerr": "syscall", - "syscall.NlMsghdr": "syscall", - "syscall.NsecToFiletime": "syscall", - "syscall.NsecToTimespec": "syscall", - "syscall.NsecToTimeval": "syscall", - "syscall.Ntohs": "syscall", - "syscall.OCRNL": "syscall", - "syscall.OFDEL": "syscall", - "syscall.OFILL": "syscall", - "syscall.OFIOGETBMAP": "syscall", - "syscall.OID_PKIX_KP_SERVER_AUTH": "syscall", - "syscall.OID_SERVER_GATED_CRYPTO": "syscall", - "syscall.OID_SGC_NETSCAPE": "syscall", - "syscall.OLCUC": "syscall", - "syscall.ONLCR": "syscall", - "syscall.ONLRET": "syscall", - "syscall.ONOCR": "syscall", - "syscall.ONOEOT": "syscall", - "syscall.OPEN_ALWAYS": "syscall", - "syscall.OPEN_EXISTING": "syscall", - "syscall.OPOST": "syscall", - "syscall.O_ACCMODE": "syscall", - "syscall.O_ALERT": "syscall", - "syscall.O_ALT_IO": "syscall", - "syscall.O_APPEND": "syscall", - "syscall.O_ASYNC": "syscall", - "syscall.O_CLOEXEC": "syscall", - "syscall.O_CREAT": "syscall", - "syscall.O_DIRECT": "syscall", - "syscall.O_DIRECTORY": "syscall", - "syscall.O_DSYNC": "syscall", - "syscall.O_EVTONLY": "syscall", - "syscall.O_EXCL": "syscall", - "syscall.O_EXEC": "syscall", - "syscall.O_EXLOCK": "syscall", - "syscall.O_FSYNC": "syscall", - "syscall.O_LARGEFILE": "syscall", - "syscall.O_NDELAY": "syscall", - "syscall.O_NOATIME": "syscall", - "syscall.O_NOCTTY": "syscall", - "syscall.O_NOFOLLOW": "syscall", - "syscall.O_NONBLOCK": "syscall", - "syscall.O_NOSIGPIPE": "syscall", - "syscall.O_POPUP": "syscall", - "syscall.O_RDONLY": "syscall", - "syscall.O_RDWR": "syscall", - "syscall.O_RSYNC": "syscall", - "syscall.O_SHLOCK": "syscall", - "syscall.O_SYMLINK": "syscall", - "syscall.O_SYNC": "syscall", - "syscall.O_TRUNC": "syscall", - "syscall.O_TTY_INIT": "syscall", - "syscall.O_WRONLY": "syscall", - "syscall.Open": "syscall", - "syscall.OpenCurrentProcessToken": "syscall", - "syscall.OpenProcess": "syscall", - "syscall.OpenProcessToken": "syscall", - "syscall.Openat": "syscall", - "syscall.Overlapped": "syscall", - "syscall.PACKET_ADD_MEMBERSHIP": "syscall", - "syscall.PACKET_BROADCAST": "syscall", - "syscall.PACKET_DROP_MEMBERSHIP": "syscall", - "syscall.PACKET_FASTROUTE": "syscall", - "syscall.PACKET_HOST": "syscall", - "syscall.PACKET_LOOPBACK": "syscall", - "syscall.PACKET_MR_ALLMULTI": "syscall", - "syscall.PACKET_MR_MULTICAST": "syscall", - "syscall.PACKET_MR_PROMISC": "syscall", - "syscall.PACKET_MULTICAST": "syscall", - "syscall.PACKET_OTHERHOST": "syscall", - "syscall.PACKET_OUTGOING": "syscall", - "syscall.PACKET_RECV_OUTPUT": "syscall", - "syscall.PACKET_RX_RING": "syscall", - "syscall.PACKET_STATISTICS": "syscall", - "syscall.PAGE_EXECUTE_READ": "syscall", - "syscall.PAGE_EXECUTE_READWRITE": "syscall", - "syscall.PAGE_EXECUTE_WRITECOPY": "syscall", - "syscall.PAGE_READONLY": "syscall", - "syscall.PAGE_READWRITE": "syscall", - "syscall.PAGE_WRITECOPY": "syscall", - "syscall.PARENB": "syscall", - "syscall.PARMRK": "syscall", - "syscall.PARODD": "syscall", - "syscall.PENDIN": "syscall", - "syscall.PFL_HIDDEN": "syscall", - "syscall.PFL_MATCHES_PROTOCOL_ZERO": "syscall", - "syscall.PFL_MULTIPLE_PROTO_ENTRIES": "syscall", - "syscall.PFL_NETWORKDIRECT_PROVIDER": "syscall", - "syscall.PFL_RECOMMENDED_PROTO_ENTRY": "syscall", - "syscall.PF_FLUSH": "syscall", - "syscall.PKCS_7_ASN_ENCODING": "syscall", - "syscall.PMC5_PIPELINE_FLUSH": "syscall", - "syscall.PRIO_PGRP": "syscall", - "syscall.PRIO_PROCESS": "syscall", - "syscall.PRIO_USER": "syscall", - "syscall.PRI_IOFLUSH": "syscall", - "syscall.PROCESS_QUERY_INFORMATION": "syscall", - "syscall.PROCESS_TERMINATE": "syscall", - "syscall.PROT_EXEC": "syscall", - "syscall.PROT_GROWSDOWN": "syscall", - "syscall.PROT_GROWSUP": "syscall", - "syscall.PROT_NONE": "syscall", - "syscall.PROT_READ": "syscall", - "syscall.PROT_WRITE": "syscall", - "syscall.PROV_DH_SCHANNEL": "syscall", - "syscall.PROV_DSS": "syscall", - "syscall.PROV_DSS_DH": "syscall", - "syscall.PROV_EC_ECDSA_FULL": "syscall", - "syscall.PROV_EC_ECDSA_SIG": "syscall", - "syscall.PROV_EC_ECNRA_FULL": "syscall", - "syscall.PROV_EC_ECNRA_SIG": "syscall", - "syscall.PROV_FORTEZZA": "syscall", - "syscall.PROV_INTEL_SEC": "syscall", - "syscall.PROV_MS_EXCHANGE": "syscall", - "syscall.PROV_REPLACE_OWF": "syscall", - "syscall.PROV_RNG": "syscall", - "syscall.PROV_RSA_AES": "syscall", - "syscall.PROV_RSA_FULL": "syscall", - "syscall.PROV_RSA_SCHANNEL": "syscall", - "syscall.PROV_RSA_SIG": "syscall", - "syscall.PROV_SPYRUS_LYNKS": "syscall", - "syscall.PROV_SSL": "syscall", - "syscall.PR_CAPBSET_DROP": "syscall", - "syscall.PR_CAPBSET_READ": "syscall", - "syscall.PR_CLEAR_SECCOMP_FILTER": "syscall", - "syscall.PR_ENDIAN_BIG": "syscall", - "syscall.PR_ENDIAN_LITTLE": "syscall", - "syscall.PR_ENDIAN_PPC_LITTLE": "syscall", - "syscall.PR_FPEMU_NOPRINT": "syscall", - "syscall.PR_FPEMU_SIGFPE": "syscall", - "syscall.PR_FP_EXC_ASYNC": "syscall", - "syscall.PR_FP_EXC_DISABLED": "syscall", - "syscall.PR_FP_EXC_DIV": "syscall", - "syscall.PR_FP_EXC_INV": "syscall", - "syscall.PR_FP_EXC_NONRECOV": "syscall", - "syscall.PR_FP_EXC_OVF": "syscall", - "syscall.PR_FP_EXC_PRECISE": "syscall", - "syscall.PR_FP_EXC_RES": "syscall", - "syscall.PR_FP_EXC_SW_ENABLE": "syscall", - "syscall.PR_FP_EXC_UND": "syscall", - "syscall.PR_GET_DUMPABLE": "syscall", - "syscall.PR_GET_ENDIAN": "syscall", - "syscall.PR_GET_FPEMU": "syscall", - "syscall.PR_GET_FPEXC": "syscall", - "syscall.PR_GET_KEEPCAPS": "syscall", - "syscall.PR_GET_NAME": "syscall", - "syscall.PR_GET_PDEATHSIG": "syscall", - "syscall.PR_GET_SECCOMP": "syscall", - "syscall.PR_GET_SECCOMP_FILTER": "syscall", - "syscall.PR_GET_SECUREBITS": "syscall", - "syscall.PR_GET_TIMERSLACK": "syscall", - "syscall.PR_GET_TIMING": "syscall", - "syscall.PR_GET_TSC": "syscall", - "syscall.PR_GET_UNALIGN": "syscall", - "syscall.PR_MCE_KILL": "syscall", - "syscall.PR_MCE_KILL_CLEAR": "syscall", - "syscall.PR_MCE_KILL_DEFAULT": "syscall", - "syscall.PR_MCE_KILL_EARLY": "syscall", - "syscall.PR_MCE_KILL_GET": "syscall", - "syscall.PR_MCE_KILL_LATE": "syscall", - "syscall.PR_MCE_KILL_SET": "syscall", - "syscall.PR_SECCOMP_FILTER_EVENT": "syscall", - "syscall.PR_SECCOMP_FILTER_SYSCALL": "syscall", - "syscall.PR_SET_DUMPABLE": "syscall", - "syscall.PR_SET_ENDIAN": "syscall", - "syscall.PR_SET_FPEMU": "syscall", - "syscall.PR_SET_FPEXC": "syscall", - "syscall.PR_SET_KEEPCAPS": "syscall", - "syscall.PR_SET_NAME": "syscall", - "syscall.PR_SET_PDEATHSIG": "syscall", - "syscall.PR_SET_PTRACER": "syscall", - "syscall.PR_SET_SECCOMP": "syscall", - "syscall.PR_SET_SECCOMP_FILTER": "syscall", - "syscall.PR_SET_SECUREBITS": "syscall", - "syscall.PR_SET_TIMERSLACK": "syscall", - "syscall.PR_SET_TIMING": "syscall", - "syscall.PR_SET_TSC": "syscall", - "syscall.PR_SET_UNALIGN": "syscall", - "syscall.PR_TASK_PERF_EVENTS_DISABLE": "syscall", - "syscall.PR_TASK_PERF_EVENTS_ENABLE": "syscall", - "syscall.PR_TIMING_STATISTICAL": "syscall", - "syscall.PR_TIMING_TIMESTAMP": "syscall", - "syscall.PR_TSC_ENABLE": "syscall", - "syscall.PR_TSC_SIGSEGV": "syscall", - "syscall.PR_UNALIGN_NOPRINT": "syscall", - "syscall.PR_UNALIGN_SIGBUS": "syscall", - "syscall.PTRACE_ARCH_PRCTL": "syscall", - "syscall.PTRACE_ATTACH": "syscall", - "syscall.PTRACE_CONT": "syscall", - "syscall.PTRACE_DETACH": "syscall", - "syscall.PTRACE_EVENT_CLONE": "syscall", - "syscall.PTRACE_EVENT_EXEC": "syscall", - "syscall.PTRACE_EVENT_EXIT": "syscall", - "syscall.PTRACE_EVENT_FORK": "syscall", - "syscall.PTRACE_EVENT_VFORK": "syscall", - "syscall.PTRACE_EVENT_VFORK_DONE": "syscall", - "syscall.PTRACE_GETCRUNCHREGS": "syscall", - "syscall.PTRACE_GETEVENTMSG": "syscall", - "syscall.PTRACE_GETFPREGS": "syscall", - "syscall.PTRACE_GETFPXREGS": "syscall", - "syscall.PTRACE_GETHBPREGS": "syscall", - "syscall.PTRACE_GETREGS": "syscall", - "syscall.PTRACE_GETREGSET": "syscall", - "syscall.PTRACE_GETSIGINFO": "syscall", - "syscall.PTRACE_GETVFPREGS": "syscall", - "syscall.PTRACE_GETWMMXREGS": "syscall", - "syscall.PTRACE_GET_THREAD_AREA": "syscall", - "syscall.PTRACE_KILL": "syscall", - "syscall.PTRACE_OLDSETOPTIONS": "syscall", - "syscall.PTRACE_O_MASK": "syscall", - "syscall.PTRACE_O_TRACECLONE": "syscall", - "syscall.PTRACE_O_TRACEEXEC": "syscall", - "syscall.PTRACE_O_TRACEEXIT": "syscall", - "syscall.PTRACE_O_TRACEFORK": "syscall", - "syscall.PTRACE_O_TRACESYSGOOD": "syscall", - "syscall.PTRACE_O_TRACEVFORK": "syscall", - "syscall.PTRACE_O_TRACEVFORKDONE": "syscall", - "syscall.PTRACE_PEEKDATA": "syscall", - "syscall.PTRACE_PEEKTEXT": "syscall", - "syscall.PTRACE_PEEKUSR": "syscall", - "syscall.PTRACE_POKEDATA": "syscall", - "syscall.PTRACE_POKETEXT": "syscall", - "syscall.PTRACE_POKEUSR": "syscall", - "syscall.PTRACE_SETCRUNCHREGS": "syscall", - "syscall.PTRACE_SETFPREGS": "syscall", - "syscall.PTRACE_SETFPXREGS": "syscall", - "syscall.PTRACE_SETHBPREGS": "syscall", - "syscall.PTRACE_SETOPTIONS": "syscall", - "syscall.PTRACE_SETREGS": "syscall", - "syscall.PTRACE_SETREGSET": "syscall", - "syscall.PTRACE_SETSIGINFO": "syscall", - "syscall.PTRACE_SETVFPREGS": "syscall", - "syscall.PTRACE_SETWMMXREGS": "syscall", - "syscall.PTRACE_SET_SYSCALL": "syscall", - "syscall.PTRACE_SET_THREAD_AREA": "syscall", - "syscall.PTRACE_SINGLEBLOCK": "syscall", - "syscall.PTRACE_SINGLESTEP": "syscall", - "syscall.PTRACE_SYSCALL": "syscall", - "syscall.PTRACE_SYSEMU": "syscall", - "syscall.PTRACE_SYSEMU_SINGLESTEP": "syscall", - "syscall.PTRACE_TRACEME": "syscall", - "syscall.PT_ATTACH": "syscall", - "syscall.PT_ATTACHEXC": "syscall", - "syscall.PT_CONTINUE": "syscall", - "syscall.PT_DATA_ADDR": "syscall", - "syscall.PT_DENY_ATTACH": "syscall", - "syscall.PT_DETACH": "syscall", - "syscall.PT_FIRSTMACH": "syscall", - "syscall.PT_FORCEQUOTA": "syscall", - "syscall.PT_KILL": "syscall", - "syscall.PT_MASK": "syscall", - "syscall.PT_READ_D": "syscall", - "syscall.PT_READ_I": "syscall", - "syscall.PT_READ_U": "syscall", - "syscall.PT_SIGEXC": "syscall", - "syscall.PT_STEP": "syscall", - "syscall.PT_TEXT_ADDR": "syscall", - "syscall.PT_TEXT_END_ADDR": "syscall", - "syscall.PT_THUPDATE": "syscall", - "syscall.PT_TRACE_ME": "syscall", - "syscall.PT_WRITE_D": "syscall", - "syscall.PT_WRITE_I": "syscall", - "syscall.PT_WRITE_U": "syscall", - "syscall.ParseDirent": "syscall", - "syscall.ParseNetlinkMessage": "syscall", - "syscall.ParseNetlinkRouteAttr": "syscall", - "syscall.ParseRoutingMessage": "syscall", - "syscall.ParseRoutingSockaddr": "syscall", - "syscall.ParseSocketControlMessage": "syscall", - "syscall.ParseUnixCredentials": "syscall", - "syscall.ParseUnixRights": "syscall", - "syscall.PathMax": "syscall", - "syscall.Pathconf": "syscall", - "syscall.Pause": "syscall", - "syscall.Pipe": "syscall", - "syscall.Pipe2": "syscall", - "syscall.PivotRoot": "syscall", - "syscall.PostQueuedCompletionStatus": "syscall", - "syscall.Pread": "syscall", - "syscall.Proc": "syscall", - "syscall.ProcAttr": "syscall", - "syscall.Process32First": "syscall", - "syscall.Process32Next": "syscall", - "syscall.ProcessEntry32": "syscall", - "syscall.ProcessInformation": "syscall", - "syscall.Protoent": "syscall", - "syscall.PtraceAttach": "syscall", - "syscall.PtraceCont": "syscall", - "syscall.PtraceDetach": "syscall", - "syscall.PtraceGetEventMsg": "syscall", - "syscall.PtraceGetRegs": "syscall", - "syscall.PtracePeekData": "syscall", - "syscall.PtracePeekText": "syscall", - "syscall.PtracePokeData": "syscall", - "syscall.PtracePokeText": "syscall", - "syscall.PtraceRegs": "syscall", - "syscall.PtraceSetOptions": "syscall", - "syscall.PtraceSetRegs": "syscall", - "syscall.PtraceSingleStep": "syscall", - "syscall.PtraceSyscall": "syscall", - "syscall.Pwrite": "syscall", - "syscall.REG_BINARY": "syscall", - "syscall.REG_DWORD": "syscall", - "syscall.REG_DWORD_BIG_ENDIAN": "syscall", - "syscall.REG_DWORD_LITTLE_ENDIAN": "syscall", - "syscall.REG_EXPAND_SZ": "syscall", - "syscall.REG_FULL_RESOURCE_DESCRIPTOR": "syscall", - "syscall.REG_LINK": "syscall", - "syscall.REG_MULTI_SZ": "syscall", - "syscall.REG_NONE": "syscall", - "syscall.REG_QWORD": "syscall", - "syscall.REG_QWORD_LITTLE_ENDIAN": "syscall", - "syscall.REG_RESOURCE_LIST": "syscall", - "syscall.REG_RESOURCE_REQUIREMENTS_LIST": "syscall", - "syscall.REG_SZ": "syscall", - "syscall.RLIMIT_AS": "syscall", - "syscall.RLIMIT_CORE": "syscall", - "syscall.RLIMIT_CPU": "syscall", - "syscall.RLIMIT_DATA": "syscall", - "syscall.RLIMIT_FSIZE": "syscall", - "syscall.RLIMIT_NOFILE": "syscall", - "syscall.RLIMIT_STACK": "syscall", - "syscall.RLIM_INFINITY": "syscall", - "syscall.RTAX_ADVMSS": "syscall", - "syscall.RTAX_AUTHOR": "syscall", - "syscall.RTAX_BRD": "syscall", - "syscall.RTAX_CWND": "syscall", - "syscall.RTAX_DST": "syscall", - "syscall.RTAX_FEATURES": "syscall", - "syscall.RTAX_FEATURE_ALLFRAG": "syscall", - "syscall.RTAX_FEATURE_ECN": "syscall", - "syscall.RTAX_FEATURE_SACK": "syscall", - "syscall.RTAX_FEATURE_TIMESTAMP": "syscall", - "syscall.RTAX_GATEWAY": "syscall", - "syscall.RTAX_GENMASK": "syscall", - "syscall.RTAX_HOPLIMIT": "syscall", - "syscall.RTAX_IFA": "syscall", - "syscall.RTAX_IFP": "syscall", - "syscall.RTAX_INITCWND": "syscall", - "syscall.RTAX_INITRWND": "syscall", - "syscall.RTAX_LABEL": "syscall", - "syscall.RTAX_LOCK": "syscall", - "syscall.RTAX_MAX": "syscall", - "syscall.RTAX_MTU": "syscall", - "syscall.RTAX_NETMASK": "syscall", - "syscall.RTAX_REORDERING": "syscall", - "syscall.RTAX_RTO_MIN": "syscall", - "syscall.RTAX_RTT": "syscall", - "syscall.RTAX_RTTVAR": "syscall", - "syscall.RTAX_SRC": "syscall", - "syscall.RTAX_SRCMASK": "syscall", - "syscall.RTAX_SSTHRESH": "syscall", - "syscall.RTAX_TAG": "syscall", - "syscall.RTAX_UNSPEC": "syscall", - "syscall.RTAX_WINDOW": "syscall", - "syscall.RTA_ALIGNTO": "syscall", - "syscall.RTA_AUTHOR": "syscall", - "syscall.RTA_BRD": "syscall", - "syscall.RTA_CACHEINFO": "syscall", - "syscall.RTA_DST": "syscall", - "syscall.RTA_FLOW": "syscall", - "syscall.RTA_GATEWAY": "syscall", - "syscall.RTA_GENMASK": "syscall", - "syscall.RTA_IFA": "syscall", - "syscall.RTA_IFP": "syscall", - "syscall.RTA_IIF": "syscall", - "syscall.RTA_LABEL": "syscall", - "syscall.RTA_MAX": "syscall", - "syscall.RTA_METRICS": "syscall", - "syscall.RTA_MULTIPATH": "syscall", - "syscall.RTA_NETMASK": "syscall", - "syscall.RTA_OIF": "syscall", - "syscall.RTA_PREFSRC": "syscall", - "syscall.RTA_PRIORITY": "syscall", - "syscall.RTA_SRC": "syscall", - "syscall.RTA_SRCMASK": "syscall", - "syscall.RTA_TABLE": "syscall", - "syscall.RTA_TAG": "syscall", - "syscall.RTA_UNSPEC": "syscall", - "syscall.RTCF_DIRECTSRC": "syscall", - "syscall.RTCF_DOREDIRECT": "syscall", - "syscall.RTCF_LOG": "syscall", - "syscall.RTCF_MASQ": "syscall", - "syscall.RTCF_NAT": "syscall", - "syscall.RTCF_VALVE": "syscall", - "syscall.RTF_ADDRCLASSMASK": "syscall", - "syscall.RTF_ADDRCONF": "syscall", - "syscall.RTF_ALLONLINK": "syscall", - "syscall.RTF_ANNOUNCE": "syscall", - "syscall.RTF_BLACKHOLE": "syscall", - "syscall.RTF_BROADCAST": "syscall", - "syscall.RTF_CACHE": "syscall", - "syscall.RTF_CLONED": "syscall", - "syscall.RTF_CLONING": "syscall", - "syscall.RTF_CONDEMNED": "syscall", - "syscall.RTF_DEFAULT": "syscall", - "syscall.RTF_DELCLONE": "syscall", - "syscall.RTF_DONE": "syscall", - "syscall.RTF_DYNAMIC": "syscall", - "syscall.RTF_FLOW": "syscall", - "syscall.RTF_FMASK": "syscall", - "syscall.RTF_GATEWAY": "syscall", - "syscall.RTF_GWFLAG_COMPAT": "syscall", - "syscall.RTF_HOST": "syscall", - "syscall.RTF_IFREF": "syscall", - "syscall.RTF_IFSCOPE": "syscall", - "syscall.RTF_INTERFACE": "syscall", - "syscall.RTF_IRTT": "syscall", - "syscall.RTF_LINKRT": "syscall", - "syscall.RTF_LLDATA": "syscall", - "syscall.RTF_LLINFO": "syscall", - "syscall.RTF_LOCAL": "syscall", - "syscall.RTF_MASK": "syscall", - "syscall.RTF_MODIFIED": "syscall", - "syscall.RTF_MPATH": "syscall", - "syscall.RTF_MPLS": "syscall", - "syscall.RTF_MSS": "syscall", - "syscall.RTF_MTU": "syscall", - "syscall.RTF_MULTICAST": "syscall", - "syscall.RTF_NAT": "syscall", - "syscall.RTF_NOFORWARD": "syscall", - "syscall.RTF_NONEXTHOP": "syscall", - "syscall.RTF_NOPMTUDISC": "syscall", - "syscall.RTF_PERMANENT_ARP": "syscall", - "syscall.RTF_PINNED": "syscall", - "syscall.RTF_POLICY": "syscall", - "syscall.RTF_PRCLONING": "syscall", - "syscall.RTF_PROTO1": "syscall", - "syscall.RTF_PROTO2": "syscall", - "syscall.RTF_PROTO3": "syscall", - "syscall.RTF_REINSTATE": "syscall", - "syscall.RTF_REJECT": "syscall", - "syscall.RTF_RNH_LOCKED": "syscall", - "syscall.RTF_SOURCE": "syscall", - "syscall.RTF_SRC": "syscall", - "syscall.RTF_STATIC": "syscall", - "syscall.RTF_STICKY": "syscall", - "syscall.RTF_THROW": "syscall", - "syscall.RTF_TUNNEL": "syscall", - "syscall.RTF_UP": "syscall", - "syscall.RTF_USETRAILERS": "syscall", - "syscall.RTF_WASCLONED": "syscall", - "syscall.RTF_WINDOW": "syscall", - "syscall.RTF_XRESOLVE": "syscall", - "syscall.RTM_ADD": "syscall", - "syscall.RTM_BASE": "syscall", - "syscall.RTM_CHANGE": "syscall", - "syscall.RTM_CHGADDR": "syscall", - "syscall.RTM_DELACTION": "syscall", - "syscall.RTM_DELADDR": "syscall", - "syscall.RTM_DELADDRLABEL": "syscall", - "syscall.RTM_DELETE": "syscall", - "syscall.RTM_DELLINK": "syscall", - "syscall.RTM_DELMADDR": "syscall", - "syscall.RTM_DELNEIGH": "syscall", - "syscall.RTM_DELQDISC": "syscall", - "syscall.RTM_DELROUTE": "syscall", - "syscall.RTM_DELRULE": "syscall", - "syscall.RTM_DELTCLASS": "syscall", - "syscall.RTM_DELTFILTER": "syscall", - "syscall.RTM_DESYNC": "syscall", - "syscall.RTM_F_CLONED": "syscall", - "syscall.RTM_F_EQUALIZE": "syscall", - "syscall.RTM_F_NOTIFY": "syscall", - "syscall.RTM_F_PREFIX": "syscall", - "syscall.RTM_GET": "syscall", - "syscall.RTM_GET2": "syscall", - "syscall.RTM_GETACTION": "syscall", - "syscall.RTM_GETADDR": "syscall", - "syscall.RTM_GETADDRLABEL": "syscall", - "syscall.RTM_GETANYCAST": "syscall", - "syscall.RTM_GETDCB": "syscall", - "syscall.RTM_GETLINK": "syscall", - "syscall.RTM_GETMULTICAST": "syscall", - "syscall.RTM_GETNEIGH": "syscall", - "syscall.RTM_GETNEIGHTBL": "syscall", - "syscall.RTM_GETQDISC": "syscall", - "syscall.RTM_GETROUTE": "syscall", - "syscall.RTM_GETRULE": "syscall", - "syscall.RTM_GETTCLASS": "syscall", - "syscall.RTM_GETTFILTER": "syscall", - "syscall.RTM_IEEE80211": "syscall", - "syscall.RTM_IFANNOUNCE": "syscall", - "syscall.RTM_IFINFO": "syscall", - "syscall.RTM_IFINFO2": "syscall", - "syscall.RTM_LLINFO_UPD": "syscall", - "syscall.RTM_LOCK": "syscall", - "syscall.RTM_LOSING": "syscall", - "syscall.RTM_MAX": "syscall", - "syscall.RTM_MAXSIZE": "syscall", - "syscall.RTM_MISS": "syscall", - "syscall.RTM_NEWACTION": "syscall", - "syscall.RTM_NEWADDR": "syscall", - "syscall.RTM_NEWADDRLABEL": "syscall", - "syscall.RTM_NEWLINK": "syscall", - "syscall.RTM_NEWMADDR": "syscall", - "syscall.RTM_NEWMADDR2": "syscall", - "syscall.RTM_NEWNDUSEROPT": "syscall", - "syscall.RTM_NEWNEIGH": "syscall", - "syscall.RTM_NEWNEIGHTBL": "syscall", - "syscall.RTM_NEWPREFIX": "syscall", - "syscall.RTM_NEWQDISC": "syscall", - "syscall.RTM_NEWROUTE": "syscall", - "syscall.RTM_NEWRULE": "syscall", - "syscall.RTM_NEWTCLASS": "syscall", - "syscall.RTM_NEWTFILTER": "syscall", - "syscall.RTM_NR_FAMILIES": "syscall", - "syscall.RTM_NR_MSGTYPES": "syscall", - "syscall.RTM_OIFINFO": "syscall", - "syscall.RTM_OLDADD": "syscall", - "syscall.RTM_OLDDEL": "syscall", - "syscall.RTM_OOIFINFO": "syscall", - "syscall.RTM_REDIRECT": "syscall", - "syscall.RTM_RESOLVE": "syscall", - "syscall.RTM_RTTUNIT": "syscall", - "syscall.RTM_SETDCB": "syscall", - "syscall.RTM_SETGATE": "syscall", - "syscall.RTM_SETLINK": "syscall", - "syscall.RTM_SETNEIGHTBL": "syscall", - "syscall.RTM_VERSION": "syscall", - "syscall.RTNH_ALIGNTO": "syscall", - "syscall.RTNH_F_DEAD": "syscall", - "syscall.RTNH_F_ONLINK": "syscall", - "syscall.RTNH_F_PERVASIVE": "syscall", - "syscall.RTNLGRP_IPV4_IFADDR": "syscall", - "syscall.RTNLGRP_IPV4_MROUTE": "syscall", - "syscall.RTNLGRP_IPV4_ROUTE": "syscall", - "syscall.RTNLGRP_IPV4_RULE": "syscall", - "syscall.RTNLGRP_IPV6_IFADDR": "syscall", - "syscall.RTNLGRP_IPV6_IFINFO": "syscall", - "syscall.RTNLGRP_IPV6_MROUTE": "syscall", - "syscall.RTNLGRP_IPV6_PREFIX": "syscall", - "syscall.RTNLGRP_IPV6_ROUTE": "syscall", - "syscall.RTNLGRP_IPV6_RULE": "syscall", - "syscall.RTNLGRP_LINK": "syscall", - "syscall.RTNLGRP_ND_USEROPT": "syscall", - "syscall.RTNLGRP_NEIGH": "syscall", - "syscall.RTNLGRP_NONE": "syscall", - "syscall.RTNLGRP_NOTIFY": "syscall", - "syscall.RTNLGRP_TC": "syscall", - "syscall.RTN_ANYCAST": "syscall", - "syscall.RTN_BLACKHOLE": "syscall", - "syscall.RTN_BROADCAST": "syscall", - "syscall.RTN_LOCAL": "syscall", - "syscall.RTN_MAX": "syscall", - "syscall.RTN_MULTICAST": "syscall", - "syscall.RTN_NAT": "syscall", - "syscall.RTN_PROHIBIT": "syscall", - "syscall.RTN_THROW": "syscall", - "syscall.RTN_UNICAST": "syscall", - "syscall.RTN_UNREACHABLE": "syscall", - "syscall.RTN_UNSPEC": "syscall", - "syscall.RTN_XRESOLVE": "syscall", - "syscall.RTPROT_BIRD": "syscall", - "syscall.RTPROT_BOOT": "syscall", - "syscall.RTPROT_DHCP": "syscall", - "syscall.RTPROT_DNROUTED": "syscall", - "syscall.RTPROT_GATED": "syscall", - "syscall.RTPROT_KERNEL": "syscall", - "syscall.RTPROT_MRT": "syscall", - "syscall.RTPROT_NTK": "syscall", - "syscall.RTPROT_RA": "syscall", - "syscall.RTPROT_REDIRECT": "syscall", - "syscall.RTPROT_STATIC": "syscall", - "syscall.RTPROT_UNSPEC": "syscall", - "syscall.RTPROT_XORP": "syscall", - "syscall.RTPROT_ZEBRA": "syscall", - "syscall.RTV_EXPIRE": "syscall", - "syscall.RTV_HOPCOUNT": "syscall", - "syscall.RTV_MTU": "syscall", - "syscall.RTV_RPIPE": "syscall", - "syscall.RTV_RTT": "syscall", - "syscall.RTV_RTTVAR": "syscall", - "syscall.RTV_SPIPE": "syscall", - "syscall.RTV_SSTHRESH": "syscall", - "syscall.RTV_WEIGHT": "syscall", - "syscall.RT_CACHING_CONTEXT": "syscall", - "syscall.RT_CLASS_DEFAULT": "syscall", - "syscall.RT_CLASS_LOCAL": "syscall", - "syscall.RT_CLASS_MAIN": "syscall", - "syscall.RT_CLASS_MAX": "syscall", - "syscall.RT_CLASS_UNSPEC": "syscall", - "syscall.RT_DEFAULT_FIB": "syscall", - "syscall.RT_NORTREF": "syscall", - "syscall.RT_SCOPE_HOST": "syscall", - "syscall.RT_SCOPE_LINK": "syscall", - "syscall.RT_SCOPE_NOWHERE": "syscall", - "syscall.RT_SCOPE_SITE": "syscall", - "syscall.RT_SCOPE_UNIVERSE": "syscall", - "syscall.RT_TABLEID_MAX": "syscall", - "syscall.RT_TABLE_COMPAT": "syscall", - "syscall.RT_TABLE_DEFAULT": "syscall", - "syscall.RT_TABLE_LOCAL": "syscall", - "syscall.RT_TABLE_MAIN": "syscall", - "syscall.RT_TABLE_MAX": "syscall", - "syscall.RT_TABLE_UNSPEC": "syscall", - "syscall.RUSAGE_CHILDREN": "syscall", - "syscall.RUSAGE_SELF": "syscall", - "syscall.RUSAGE_THREAD": "syscall", - "syscall.Radvisory_t": "syscall", - "syscall.RawSockaddr": "syscall", - "syscall.RawSockaddrAny": "syscall", - "syscall.RawSockaddrDatalink": "syscall", - "syscall.RawSockaddrInet4": "syscall", - "syscall.RawSockaddrInet6": "syscall", - "syscall.RawSockaddrLinklayer": "syscall", - "syscall.RawSockaddrNetlink": "syscall", - "syscall.RawSockaddrUnix": "syscall", - "syscall.RawSyscall": "syscall", - "syscall.RawSyscall6": "syscall", - "syscall.Read": "syscall", - "syscall.ReadConsole": "syscall", - "syscall.ReadDirectoryChanges": "syscall", - "syscall.ReadDirent": "syscall", - "syscall.ReadFile": "syscall", - "syscall.Readlink": "syscall", - "syscall.Reboot": "syscall", - "syscall.Recvfrom": "syscall", - "syscall.Recvmsg": "syscall", - "syscall.RegCloseKey": "syscall", - "syscall.RegEnumKeyEx": "syscall", - "syscall.RegOpenKeyEx": "syscall", - "syscall.RegQueryInfoKey": "syscall", - "syscall.RegQueryValueEx": "syscall", - "syscall.RemoveDirectory": "syscall", - "syscall.Removexattr": "syscall", - "syscall.Rename": "syscall", - "syscall.Renameat": "syscall", - "syscall.Revoke": "syscall", - "syscall.Rlimit": "syscall", - "syscall.Rmdir": "syscall", - "syscall.RouteMessage": "syscall", - "syscall.RouteRIB": "syscall", - "syscall.RtAttr": "syscall", - "syscall.RtGenmsg": "syscall", - "syscall.RtMetrics": "syscall", - "syscall.RtMsg": "syscall", - "syscall.RtMsghdr": "syscall", - "syscall.RtNexthop": "syscall", - "syscall.Rusage": "syscall", - "syscall.SCM_BINTIME": "syscall", - "syscall.SCM_CREDENTIALS": "syscall", - "syscall.SCM_CREDS": "syscall", - "syscall.SCM_RIGHTS": "syscall", - "syscall.SCM_TIMESTAMP": "syscall", - "syscall.SCM_TIMESTAMPING": "syscall", - "syscall.SCM_TIMESTAMPNS": "syscall", - "syscall.SCM_TIMESTAMP_MONOTONIC": "syscall", - "syscall.SHUT_RD": "syscall", - "syscall.SHUT_RDWR": "syscall", - "syscall.SHUT_WR": "syscall", - "syscall.SID": "syscall", - "syscall.SIDAndAttributes": "syscall", - "syscall.SIGABRT": "syscall", - "syscall.SIGALRM": "syscall", - "syscall.SIGBUS": "syscall", - "syscall.SIGCHLD": "syscall", - "syscall.SIGCLD": "syscall", - "syscall.SIGCONT": "syscall", - "syscall.SIGEMT": "syscall", - "syscall.SIGFPE": "syscall", - "syscall.SIGHUP": "syscall", - "syscall.SIGILL": "syscall", - "syscall.SIGINFO": "syscall", - "syscall.SIGINT": "syscall", - "syscall.SIGIO": "syscall", - "syscall.SIGIOT": "syscall", - "syscall.SIGKILL": "syscall", - "syscall.SIGLIBRT": "syscall", - "syscall.SIGLWP": "syscall", - "syscall.SIGPIPE": "syscall", - "syscall.SIGPOLL": "syscall", - "syscall.SIGPROF": "syscall", - "syscall.SIGPWR": "syscall", - "syscall.SIGQUIT": "syscall", - "syscall.SIGSEGV": "syscall", - "syscall.SIGSTKFLT": "syscall", - "syscall.SIGSTOP": "syscall", - "syscall.SIGSYS": "syscall", - "syscall.SIGTERM": "syscall", - "syscall.SIGTHR": "syscall", - "syscall.SIGTRAP": "syscall", - "syscall.SIGTSTP": "syscall", - "syscall.SIGTTIN": "syscall", - "syscall.SIGTTOU": "syscall", - "syscall.SIGUNUSED": "syscall", - "syscall.SIGURG": "syscall", - "syscall.SIGUSR1": "syscall", - "syscall.SIGUSR2": "syscall", - "syscall.SIGVTALRM": "syscall", - "syscall.SIGWINCH": "syscall", - "syscall.SIGXCPU": "syscall", - "syscall.SIGXFSZ": "syscall", - "syscall.SIOCADDDLCI": "syscall", - "syscall.SIOCADDMULTI": "syscall", - "syscall.SIOCADDRT": "syscall", - "syscall.SIOCAIFADDR": "syscall", - "syscall.SIOCAIFGROUP": "syscall", - "syscall.SIOCALIFADDR": "syscall", - "syscall.SIOCARPIPLL": "syscall", - "syscall.SIOCATMARK": "syscall", - "syscall.SIOCAUTOADDR": "syscall", - "syscall.SIOCAUTONETMASK": "syscall", - "syscall.SIOCBRDGADD": "syscall", - "syscall.SIOCBRDGADDS": "syscall", - "syscall.SIOCBRDGARL": "syscall", - "syscall.SIOCBRDGDADDR": "syscall", - "syscall.SIOCBRDGDEL": "syscall", - "syscall.SIOCBRDGDELS": "syscall", - "syscall.SIOCBRDGFLUSH": "syscall", - "syscall.SIOCBRDGFRL": "syscall", - "syscall.SIOCBRDGGCACHE": "syscall", - "syscall.SIOCBRDGGFD": "syscall", - "syscall.SIOCBRDGGHT": "syscall", - "syscall.SIOCBRDGGIFFLGS": "syscall", - "syscall.SIOCBRDGGMA": "syscall", - "syscall.SIOCBRDGGPARAM": "syscall", - "syscall.SIOCBRDGGPRI": "syscall", - "syscall.SIOCBRDGGRL": "syscall", - "syscall.SIOCBRDGGSIFS": "syscall", - "syscall.SIOCBRDGGTO": "syscall", - "syscall.SIOCBRDGIFS": "syscall", - "syscall.SIOCBRDGRTS": "syscall", - "syscall.SIOCBRDGSADDR": "syscall", - "syscall.SIOCBRDGSCACHE": "syscall", - "syscall.SIOCBRDGSFD": "syscall", - "syscall.SIOCBRDGSHT": "syscall", - "syscall.SIOCBRDGSIFCOST": "syscall", - "syscall.SIOCBRDGSIFFLGS": "syscall", - "syscall.SIOCBRDGSIFPRIO": "syscall", - "syscall.SIOCBRDGSMA": "syscall", - "syscall.SIOCBRDGSPRI": "syscall", - "syscall.SIOCBRDGSPROTO": "syscall", - "syscall.SIOCBRDGSTO": "syscall", - "syscall.SIOCBRDGSTXHC": "syscall", - "syscall.SIOCDARP": "syscall", - "syscall.SIOCDELDLCI": "syscall", - "syscall.SIOCDELMULTI": "syscall", - "syscall.SIOCDELRT": "syscall", - "syscall.SIOCDEVPRIVATE": "syscall", - "syscall.SIOCDIFADDR": "syscall", - "syscall.SIOCDIFGROUP": "syscall", - "syscall.SIOCDIFPHYADDR": "syscall", - "syscall.SIOCDLIFADDR": "syscall", - "syscall.SIOCDRARP": "syscall", - "syscall.SIOCGARP": "syscall", - "syscall.SIOCGDRVSPEC": "syscall", - "syscall.SIOCGETKALIVE": "syscall", - "syscall.SIOCGETLABEL": "syscall", - "syscall.SIOCGETPFLOW": "syscall", - "syscall.SIOCGETPFSYNC": "syscall", - "syscall.SIOCGETSGCNT": "syscall", - "syscall.SIOCGETVIFCNT": "syscall", - "syscall.SIOCGETVLAN": "syscall", - "syscall.SIOCGHIWAT": "syscall", - "syscall.SIOCGIFADDR": "syscall", - "syscall.SIOCGIFADDRPREF": "syscall", - "syscall.SIOCGIFALIAS": "syscall", - "syscall.SIOCGIFALTMTU": "syscall", - "syscall.SIOCGIFASYNCMAP": "syscall", - "syscall.SIOCGIFBOND": "syscall", - "syscall.SIOCGIFBR": "syscall", - "syscall.SIOCGIFBRDADDR": "syscall", - "syscall.SIOCGIFCAP": "syscall", - "syscall.SIOCGIFCONF": "syscall", - "syscall.SIOCGIFCOUNT": "syscall", - "syscall.SIOCGIFDATA": "syscall", - "syscall.SIOCGIFDESCR": "syscall", - "syscall.SIOCGIFDEVMTU": "syscall", - "syscall.SIOCGIFDLT": "syscall", - "syscall.SIOCGIFDSTADDR": "syscall", - "syscall.SIOCGIFENCAP": "syscall", - "syscall.SIOCGIFFIB": "syscall", - "syscall.SIOCGIFFLAGS": "syscall", - "syscall.SIOCGIFGATTR": "syscall", - "syscall.SIOCGIFGENERIC": "syscall", - "syscall.SIOCGIFGMEMB": "syscall", - "syscall.SIOCGIFGROUP": "syscall", - "syscall.SIOCGIFHARDMTU": "syscall", - "syscall.SIOCGIFHWADDR": "syscall", - "syscall.SIOCGIFINDEX": "syscall", - "syscall.SIOCGIFKPI": "syscall", - "syscall.SIOCGIFMAC": "syscall", - "syscall.SIOCGIFMAP": "syscall", - "syscall.SIOCGIFMEDIA": "syscall", - "syscall.SIOCGIFMEM": "syscall", - "syscall.SIOCGIFMETRIC": "syscall", - "syscall.SIOCGIFMTU": "syscall", - "syscall.SIOCGIFNAME": "syscall", - "syscall.SIOCGIFNETMASK": "syscall", - "syscall.SIOCGIFPDSTADDR": "syscall", - "syscall.SIOCGIFPFLAGS": "syscall", - "syscall.SIOCGIFPHYS": "syscall", - "syscall.SIOCGIFPRIORITY": "syscall", - "syscall.SIOCGIFPSRCADDR": "syscall", - "syscall.SIOCGIFRDOMAIN": "syscall", - "syscall.SIOCGIFRTLABEL": "syscall", - "syscall.SIOCGIFSLAVE": "syscall", - "syscall.SIOCGIFSTATUS": "syscall", - "syscall.SIOCGIFTIMESLOT": "syscall", - "syscall.SIOCGIFTXQLEN": "syscall", - "syscall.SIOCGIFVLAN": "syscall", - "syscall.SIOCGIFWAKEFLAGS": "syscall", - "syscall.SIOCGIFXFLAGS": "syscall", - "syscall.SIOCGLIFADDR": "syscall", - "syscall.SIOCGLIFPHYADDR": "syscall", - "syscall.SIOCGLIFPHYRTABLE": "syscall", - "syscall.SIOCGLIFPHYTTL": "syscall", - "syscall.SIOCGLINKSTR": "syscall", - "syscall.SIOCGLOWAT": "syscall", - "syscall.SIOCGPGRP": "syscall", - "syscall.SIOCGPRIVATE_0": "syscall", - "syscall.SIOCGPRIVATE_1": "syscall", - "syscall.SIOCGRARP": "syscall", - "syscall.SIOCGSPPPPARAMS": "syscall", - "syscall.SIOCGSTAMP": "syscall", - "syscall.SIOCGSTAMPNS": "syscall", - "syscall.SIOCGVH": "syscall", - "syscall.SIOCGVNETID": "syscall", - "syscall.SIOCIFCREATE": "syscall", - "syscall.SIOCIFCREATE2": "syscall", - "syscall.SIOCIFDESTROY": "syscall", - "syscall.SIOCIFGCLONERS": "syscall", - "syscall.SIOCINITIFADDR": "syscall", - "syscall.SIOCPROTOPRIVATE": "syscall", - "syscall.SIOCRSLVMULTI": "syscall", - "syscall.SIOCRTMSG": "syscall", - "syscall.SIOCSARP": "syscall", - "syscall.SIOCSDRVSPEC": "syscall", - "syscall.SIOCSETKALIVE": "syscall", - "syscall.SIOCSETLABEL": "syscall", - "syscall.SIOCSETPFLOW": "syscall", - "syscall.SIOCSETPFSYNC": "syscall", - "syscall.SIOCSETVLAN": "syscall", - "syscall.SIOCSHIWAT": "syscall", - "syscall.SIOCSIFADDR": "syscall", - "syscall.SIOCSIFADDRPREF": "syscall", - "syscall.SIOCSIFALTMTU": "syscall", - "syscall.SIOCSIFASYNCMAP": "syscall", - "syscall.SIOCSIFBOND": "syscall", - "syscall.SIOCSIFBR": "syscall", - "syscall.SIOCSIFBRDADDR": "syscall", - "syscall.SIOCSIFCAP": "syscall", - "syscall.SIOCSIFDESCR": "syscall", - "syscall.SIOCSIFDSTADDR": "syscall", - "syscall.SIOCSIFENCAP": "syscall", - "syscall.SIOCSIFFIB": "syscall", - "syscall.SIOCSIFFLAGS": "syscall", - "syscall.SIOCSIFGATTR": "syscall", - "syscall.SIOCSIFGENERIC": "syscall", - "syscall.SIOCSIFHWADDR": "syscall", - "syscall.SIOCSIFHWBROADCAST": "syscall", - "syscall.SIOCSIFKPI": "syscall", - "syscall.SIOCSIFLINK": "syscall", - "syscall.SIOCSIFLLADDR": "syscall", - "syscall.SIOCSIFMAC": "syscall", - "syscall.SIOCSIFMAP": "syscall", - "syscall.SIOCSIFMEDIA": "syscall", - "syscall.SIOCSIFMEM": "syscall", - "syscall.SIOCSIFMETRIC": "syscall", - "syscall.SIOCSIFMTU": "syscall", - "syscall.SIOCSIFNAME": "syscall", - "syscall.SIOCSIFNETMASK": "syscall", - "syscall.SIOCSIFPFLAGS": "syscall", - "syscall.SIOCSIFPHYADDR": "syscall", - "syscall.SIOCSIFPHYS": "syscall", - "syscall.SIOCSIFPRIORITY": "syscall", - "syscall.SIOCSIFRDOMAIN": "syscall", - "syscall.SIOCSIFRTLABEL": "syscall", - "syscall.SIOCSIFRVNET": "syscall", - "syscall.SIOCSIFSLAVE": "syscall", - "syscall.SIOCSIFTIMESLOT": "syscall", - "syscall.SIOCSIFTXQLEN": "syscall", - "syscall.SIOCSIFVLAN": "syscall", - "syscall.SIOCSIFVNET": "syscall", - "syscall.SIOCSIFXFLAGS": "syscall", - "syscall.SIOCSLIFPHYADDR": "syscall", - "syscall.SIOCSLIFPHYRTABLE": "syscall", - "syscall.SIOCSLIFPHYTTL": "syscall", - "syscall.SIOCSLINKSTR": "syscall", - "syscall.SIOCSLOWAT": "syscall", - "syscall.SIOCSPGRP": "syscall", - "syscall.SIOCSRARP": "syscall", - "syscall.SIOCSSPPPPARAMS": "syscall", - "syscall.SIOCSVH": "syscall", - "syscall.SIOCSVNETID": "syscall", - "syscall.SIOCZIFDATA": "syscall", - "syscall.SIO_GET_EXTENSION_FUNCTION_POINTER": "syscall", - "syscall.SIO_GET_INTERFACE_LIST": "syscall", - "syscall.SIO_KEEPALIVE_VALS": "syscall", - "syscall.SIO_UDP_CONNRESET": "syscall", - "syscall.SOCK_CLOEXEC": "syscall", - "syscall.SOCK_DCCP": "syscall", - "syscall.SOCK_DGRAM": "syscall", - "syscall.SOCK_FLAGS_MASK": "syscall", - "syscall.SOCK_MAXADDRLEN": "syscall", - "syscall.SOCK_NONBLOCK": "syscall", - "syscall.SOCK_NOSIGPIPE": "syscall", - "syscall.SOCK_PACKET": "syscall", - "syscall.SOCK_RAW": "syscall", - "syscall.SOCK_RDM": "syscall", - "syscall.SOCK_SEQPACKET": "syscall", - "syscall.SOCK_STREAM": "syscall", - "syscall.SOL_AAL": "syscall", - "syscall.SOL_ATM": "syscall", - "syscall.SOL_DECNET": "syscall", - "syscall.SOL_ICMPV6": "syscall", - "syscall.SOL_IP": "syscall", - "syscall.SOL_IPV6": "syscall", - "syscall.SOL_IRDA": "syscall", - "syscall.SOL_PACKET": "syscall", - "syscall.SOL_RAW": "syscall", - "syscall.SOL_SOCKET": "syscall", - "syscall.SOL_TCP": "syscall", - "syscall.SOL_X25": "syscall", - "syscall.SOMAXCONN": "syscall", - "syscall.SO_ACCEPTCONN": "syscall", - "syscall.SO_ACCEPTFILTER": "syscall", - "syscall.SO_ATTACH_FILTER": "syscall", - "syscall.SO_BINDANY": "syscall", - "syscall.SO_BINDTODEVICE": "syscall", - "syscall.SO_BINTIME": "syscall", - "syscall.SO_BROADCAST": "syscall", - "syscall.SO_BSDCOMPAT": "syscall", - "syscall.SO_DEBUG": "syscall", - "syscall.SO_DETACH_FILTER": "syscall", - "syscall.SO_DOMAIN": "syscall", - "syscall.SO_DONTROUTE": "syscall", - "syscall.SO_DONTTRUNC": "syscall", - "syscall.SO_ERROR": "syscall", - "syscall.SO_KEEPALIVE": "syscall", - "syscall.SO_LABEL": "syscall", - "syscall.SO_LINGER": "syscall", - "syscall.SO_LINGER_SEC": "syscall", - "syscall.SO_LISTENINCQLEN": "syscall", - "syscall.SO_LISTENQLEN": "syscall", - "syscall.SO_LISTENQLIMIT": "syscall", - "syscall.SO_MARK": "syscall", - "syscall.SO_NETPROC": "syscall", - "syscall.SO_NKE": "syscall", - "syscall.SO_NOADDRERR": "syscall", - "syscall.SO_NOHEADER": "syscall", - "syscall.SO_NOSIGPIPE": "syscall", - "syscall.SO_NOTIFYCONFLICT": "syscall", - "syscall.SO_NO_CHECK": "syscall", - "syscall.SO_NO_DDP": "syscall", - "syscall.SO_NO_OFFLOAD": "syscall", - "syscall.SO_NP_EXTENSIONS": "syscall", - "syscall.SO_NREAD": "syscall", - "syscall.SO_NWRITE": "syscall", - "syscall.SO_OOBINLINE": "syscall", - "syscall.SO_OVERFLOWED": "syscall", - "syscall.SO_PASSCRED": "syscall", - "syscall.SO_PASSSEC": "syscall", - "syscall.SO_PEERCRED": "syscall", - "syscall.SO_PEERLABEL": "syscall", - "syscall.SO_PEERNAME": "syscall", - "syscall.SO_PEERSEC": "syscall", - "syscall.SO_PRIORITY": "syscall", - "syscall.SO_PROTOCOL": "syscall", - "syscall.SO_PROTOTYPE": "syscall", - "syscall.SO_RANDOMPORT": "syscall", - "syscall.SO_RCVBUF": "syscall", - "syscall.SO_RCVBUFFORCE": "syscall", - "syscall.SO_RCVLOWAT": "syscall", - "syscall.SO_RCVTIMEO": "syscall", - "syscall.SO_RESTRICTIONS": "syscall", - "syscall.SO_RESTRICT_DENYIN": "syscall", - "syscall.SO_RESTRICT_DENYOUT": "syscall", - "syscall.SO_RESTRICT_DENYSET": "syscall", - "syscall.SO_REUSEADDR": "syscall", - "syscall.SO_REUSEPORT": "syscall", - "syscall.SO_REUSESHAREUID": "syscall", - "syscall.SO_RTABLE": "syscall", - "syscall.SO_RXQ_OVFL": "syscall", - "syscall.SO_SECURITY_AUTHENTICATION": "syscall", - "syscall.SO_SECURITY_ENCRYPTION_NETWORK": "syscall", - "syscall.SO_SECURITY_ENCRYPTION_TRANSPORT": "syscall", - "syscall.SO_SETFIB": "syscall", - "syscall.SO_SNDBUF": "syscall", - "syscall.SO_SNDBUFFORCE": "syscall", - "syscall.SO_SNDLOWAT": "syscall", - "syscall.SO_SNDTIMEO": "syscall", - "syscall.SO_SPLICE": "syscall", - "syscall.SO_TIMESTAMP": "syscall", - "syscall.SO_TIMESTAMPING": "syscall", - "syscall.SO_TIMESTAMPNS": "syscall", - "syscall.SO_TIMESTAMP_MONOTONIC": "syscall", - "syscall.SO_TYPE": "syscall", - "syscall.SO_UPCALLCLOSEWAIT": "syscall", - "syscall.SO_UPDATE_ACCEPT_CONTEXT": "syscall", - "syscall.SO_UPDATE_CONNECT_CONTEXT": "syscall", - "syscall.SO_USELOOPBACK": "syscall", - "syscall.SO_USER_COOKIE": "syscall", - "syscall.SO_VENDOR": "syscall", - "syscall.SO_WANTMORE": "syscall", - "syscall.SO_WANTOOBFLAG": "syscall", - "syscall.SSLExtraCertChainPolicyPara": "syscall", - "syscall.STANDARD_RIGHTS_ALL": "syscall", - "syscall.STANDARD_RIGHTS_EXECUTE": "syscall", - "syscall.STANDARD_RIGHTS_READ": "syscall", - "syscall.STANDARD_RIGHTS_REQUIRED": "syscall", - "syscall.STANDARD_RIGHTS_WRITE": "syscall", - "syscall.STARTF_USESHOWWINDOW": "syscall", - "syscall.STARTF_USESTDHANDLES": "syscall", - "syscall.STD_ERROR_HANDLE": "syscall", - "syscall.STD_INPUT_HANDLE": "syscall", - "syscall.STD_OUTPUT_HANDLE": "syscall", - "syscall.SUBLANG_ENGLISH_US": "syscall", - "syscall.SW_FORCEMINIMIZE": "syscall", - "syscall.SW_HIDE": "syscall", - "syscall.SW_MAXIMIZE": "syscall", - "syscall.SW_MINIMIZE": "syscall", - "syscall.SW_NORMAL": "syscall", - "syscall.SW_RESTORE": "syscall", - "syscall.SW_SHOW": "syscall", - "syscall.SW_SHOWDEFAULT": "syscall", - "syscall.SW_SHOWMAXIMIZED": "syscall", - "syscall.SW_SHOWMINIMIZED": "syscall", - "syscall.SW_SHOWMINNOACTIVE": "syscall", - "syscall.SW_SHOWNA": "syscall", - "syscall.SW_SHOWNOACTIVATE": "syscall", - "syscall.SW_SHOWNORMAL": "syscall", - "syscall.SYMBOLIC_LINK_FLAG_DIRECTORY": "syscall", - "syscall.SYNCHRONIZE": "syscall", - "syscall.SYSCTL_VERSION": "syscall", - "syscall.SYSCTL_VERS_0": "syscall", - "syscall.SYSCTL_VERS_1": "syscall", - "syscall.SYSCTL_VERS_MASK": "syscall", - "syscall.SYS_ABORT2": "syscall", - "syscall.SYS_ACCEPT": "syscall", - "syscall.SYS_ACCEPT4": "syscall", - "syscall.SYS_ACCEPT_NOCANCEL": "syscall", - "syscall.SYS_ACCESS": "syscall", - "syscall.SYS_ACCESS_EXTENDED": "syscall", - "syscall.SYS_ACCT": "syscall", - "syscall.SYS_ADD_KEY": "syscall", - "syscall.SYS_ADD_PROFIL": "syscall", - "syscall.SYS_ADJFREQ": "syscall", - "syscall.SYS_ADJTIME": "syscall", - "syscall.SYS_ADJTIMEX": "syscall", - "syscall.SYS_AFS_SYSCALL": "syscall", - "syscall.SYS_AIO_CANCEL": "syscall", - "syscall.SYS_AIO_ERROR": "syscall", - "syscall.SYS_AIO_FSYNC": "syscall", - "syscall.SYS_AIO_READ": "syscall", - "syscall.SYS_AIO_RETURN": "syscall", - "syscall.SYS_AIO_SUSPEND": "syscall", - "syscall.SYS_AIO_SUSPEND_NOCANCEL": "syscall", - "syscall.SYS_AIO_WRITE": "syscall", - "syscall.SYS_ALARM": "syscall", - "syscall.SYS_ARCH_PRCTL": "syscall", - "syscall.SYS_ARM_FADVISE64_64": "syscall", - "syscall.SYS_ARM_SYNC_FILE_RANGE": "syscall", - "syscall.SYS_ATGETMSG": "syscall", - "syscall.SYS_ATPGETREQ": "syscall", - "syscall.SYS_ATPGETRSP": "syscall", - "syscall.SYS_ATPSNDREQ": "syscall", - "syscall.SYS_ATPSNDRSP": "syscall", - "syscall.SYS_ATPUTMSG": "syscall", - "syscall.SYS_ATSOCKET": "syscall", - "syscall.SYS_AUDIT": "syscall", - "syscall.SYS_AUDITCTL": "syscall", - "syscall.SYS_AUDITON": "syscall", - "syscall.SYS_AUDIT_SESSION_JOIN": "syscall", - "syscall.SYS_AUDIT_SESSION_PORT": "syscall", - "syscall.SYS_AUDIT_SESSION_SELF": "syscall", - "syscall.SYS_BDFLUSH": "syscall", - "syscall.SYS_BIND": "syscall", - "syscall.SYS_BINDAT": "syscall", - "syscall.SYS_BREAK": "syscall", - "syscall.SYS_BRK": "syscall", - "syscall.SYS_BSDTHREAD_CREATE": "syscall", - "syscall.SYS_BSDTHREAD_REGISTER": "syscall", - "syscall.SYS_BSDTHREAD_TERMINATE": "syscall", - "syscall.SYS_CAPGET": "syscall", - "syscall.SYS_CAPSET": "syscall", - "syscall.SYS_CAP_ENTER": "syscall", - "syscall.SYS_CAP_FCNTLS_GET": "syscall", - "syscall.SYS_CAP_FCNTLS_LIMIT": "syscall", - "syscall.SYS_CAP_GETMODE": "syscall", - "syscall.SYS_CAP_GETRIGHTS": "syscall", - "syscall.SYS_CAP_IOCTLS_GET": "syscall", - "syscall.SYS_CAP_IOCTLS_LIMIT": "syscall", - "syscall.SYS_CAP_NEW": "syscall", - "syscall.SYS_CAP_RIGHTS_GET": "syscall", - "syscall.SYS_CAP_RIGHTS_LIMIT": "syscall", - "syscall.SYS_CHDIR": "syscall", - "syscall.SYS_CHFLAGS": "syscall", - "syscall.SYS_CHFLAGSAT": "syscall", - "syscall.SYS_CHMOD": "syscall", - "syscall.SYS_CHMOD_EXTENDED": "syscall", - "syscall.SYS_CHOWN": "syscall", - "syscall.SYS_CHOWN32": "syscall", - "syscall.SYS_CHROOT": "syscall", - "syscall.SYS_CHUD": "syscall", - "syscall.SYS_CLOCK_ADJTIME": "syscall", - "syscall.SYS_CLOCK_GETCPUCLOCKID2": "syscall", - "syscall.SYS_CLOCK_GETRES": "syscall", - "syscall.SYS_CLOCK_GETTIME": "syscall", - "syscall.SYS_CLOCK_NANOSLEEP": "syscall", - "syscall.SYS_CLOCK_SETTIME": "syscall", - "syscall.SYS_CLONE": "syscall", - "syscall.SYS_CLOSE": "syscall", - "syscall.SYS_CLOSEFROM": "syscall", - "syscall.SYS_CLOSE_NOCANCEL": "syscall", - "syscall.SYS_CONNECT": "syscall", - "syscall.SYS_CONNECTAT": "syscall", - "syscall.SYS_CONNECT_NOCANCEL": "syscall", - "syscall.SYS_COPYFILE": "syscall", - "syscall.SYS_CPUSET": "syscall", - "syscall.SYS_CPUSET_GETAFFINITY": "syscall", - "syscall.SYS_CPUSET_GETID": "syscall", - "syscall.SYS_CPUSET_SETAFFINITY": "syscall", - "syscall.SYS_CPUSET_SETID": "syscall", - "syscall.SYS_CREAT": "syscall", - "syscall.SYS_CREATE_MODULE": "syscall", - "syscall.SYS_CSOPS": "syscall", - "syscall.SYS_DELETE": "syscall", - "syscall.SYS_DELETE_MODULE": "syscall", - "syscall.SYS_DUP": "syscall", - "syscall.SYS_DUP2": "syscall", - "syscall.SYS_DUP3": "syscall", - "syscall.SYS_EACCESS": "syscall", - "syscall.SYS_EPOLL_CREATE": "syscall", - "syscall.SYS_EPOLL_CREATE1": "syscall", - "syscall.SYS_EPOLL_CTL": "syscall", - "syscall.SYS_EPOLL_CTL_OLD": "syscall", - "syscall.SYS_EPOLL_PWAIT": "syscall", - "syscall.SYS_EPOLL_WAIT": "syscall", - "syscall.SYS_EPOLL_WAIT_OLD": "syscall", - "syscall.SYS_EVENTFD": "syscall", - "syscall.SYS_EVENTFD2": "syscall", - "syscall.SYS_EXCHANGEDATA": "syscall", - "syscall.SYS_EXECVE": "syscall", - "syscall.SYS_EXIT": "syscall", - "syscall.SYS_EXIT_GROUP": "syscall", - "syscall.SYS_EXTATTRCTL": "syscall", - "syscall.SYS_EXTATTR_DELETE_FD": "syscall", - "syscall.SYS_EXTATTR_DELETE_FILE": "syscall", - "syscall.SYS_EXTATTR_DELETE_LINK": "syscall", - "syscall.SYS_EXTATTR_GET_FD": "syscall", - "syscall.SYS_EXTATTR_GET_FILE": "syscall", - "syscall.SYS_EXTATTR_GET_LINK": "syscall", - "syscall.SYS_EXTATTR_LIST_FD": "syscall", - "syscall.SYS_EXTATTR_LIST_FILE": "syscall", - "syscall.SYS_EXTATTR_LIST_LINK": "syscall", - "syscall.SYS_EXTATTR_SET_FD": "syscall", - "syscall.SYS_EXTATTR_SET_FILE": "syscall", - "syscall.SYS_EXTATTR_SET_LINK": "syscall", - "syscall.SYS_FACCESSAT": "syscall", - "syscall.SYS_FADVISE64": "syscall", - "syscall.SYS_FADVISE64_64": "syscall", - "syscall.SYS_FALLOCATE": "syscall", - "syscall.SYS_FANOTIFY_INIT": "syscall", - "syscall.SYS_FANOTIFY_MARK": "syscall", - "syscall.SYS_FCHDIR": "syscall", - "syscall.SYS_FCHFLAGS": "syscall", - "syscall.SYS_FCHMOD": "syscall", - "syscall.SYS_FCHMODAT": "syscall", - "syscall.SYS_FCHMOD_EXTENDED": "syscall", - "syscall.SYS_FCHOWN": "syscall", - "syscall.SYS_FCHOWN32": "syscall", - "syscall.SYS_FCHOWNAT": "syscall", - "syscall.SYS_FCHROOT": "syscall", - "syscall.SYS_FCNTL": "syscall", - "syscall.SYS_FCNTL64": "syscall", - "syscall.SYS_FCNTL_NOCANCEL": "syscall", - "syscall.SYS_FDATASYNC": "syscall", - "syscall.SYS_FEXECVE": "syscall", - "syscall.SYS_FFCLOCK_GETCOUNTER": "syscall", - "syscall.SYS_FFCLOCK_GETESTIMATE": "syscall", - "syscall.SYS_FFCLOCK_SETESTIMATE": "syscall", - "syscall.SYS_FFSCTL": "syscall", - "syscall.SYS_FGETATTRLIST": "syscall", - "syscall.SYS_FGETXATTR": "syscall", - "syscall.SYS_FHOPEN": "syscall", - "syscall.SYS_FHSTAT": "syscall", - "syscall.SYS_FHSTATFS": "syscall", - "syscall.SYS_FILEPORT_MAKEFD": "syscall", - "syscall.SYS_FILEPORT_MAKEPORT": "syscall", - "syscall.SYS_FKTRACE": "syscall", - "syscall.SYS_FLISTXATTR": "syscall", - "syscall.SYS_FLOCK": "syscall", - "syscall.SYS_FORK": "syscall", - "syscall.SYS_FPATHCONF": "syscall", - "syscall.SYS_FREEBSD6_FTRUNCATE": "syscall", - "syscall.SYS_FREEBSD6_LSEEK": "syscall", - "syscall.SYS_FREEBSD6_MMAP": "syscall", - "syscall.SYS_FREEBSD6_PREAD": "syscall", - "syscall.SYS_FREEBSD6_PWRITE": "syscall", - "syscall.SYS_FREEBSD6_TRUNCATE": "syscall", - "syscall.SYS_FREMOVEXATTR": "syscall", - "syscall.SYS_FSCTL": "syscall", - "syscall.SYS_FSETATTRLIST": "syscall", - "syscall.SYS_FSETXATTR": "syscall", - "syscall.SYS_FSGETPATH": "syscall", - "syscall.SYS_FSTAT": "syscall", - "syscall.SYS_FSTAT64": "syscall", - "syscall.SYS_FSTAT64_EXTENDED": "syscall", - "syscall.SYS_FSTATAT": "syscall", - "syscall.SYS_FSTATAT64": "syscall", - "syscall.SYS_FSTATFS": "syscall", - "syscall.SYS_FSTATFS64": "syscall", - "syscall.SYS_FSTATV": "syscall", - "syscall.SYS_FSTATVFS1": "syscall", - "syscall.SYS_FSTAT_EXTENDED": "syscall", - "syscall.SYS_FSYNC": "syscall", - "syscall.SYS_FSYNC_NOCANCEL": "syscall", - "syscall.SYS_FSYNC_RANGE": "syscall", - "syscall.SYS_FTIME": "syscall", - "syscall.SYS_FTRUNCATE": "syscall", - "syscall.SYS_FTRUNCATE64": "syscall", - "syscall.SYS_FUTEX": "syscall", - "syscall.SYS_FUTIMENS": "syscall", - "syscall.SYS_FUTIMES": "syscall", - "syscall.SYS_FUTIMESAT": "syscall", - "syscall.SYS_GETATTRLIST": "syscall", - "syscall.SYS_GETAUDIT": "syscall", - "syscall.SYS_GETAUDIT_ADDR": "syscall", - "syscall.SYS_GETAUID": "syscall", - "syscall.SYS_GETCONTEXT": "syscall", - "syscall.SYS_GETCPU": "syscall", - "syscall.SYS_GETCWD": "syscall", - "syscall.SYS_GETDENTS": "syscall", - "syscall.SYS_GETDENTS64": "syscall", - "syscall.SYS_GETDIRENTRIES": "syscall", - "syscall.SYS_GETDIRENTRIES64": "syscall", - "syscall.SYS_GETDIRENTRIESATTR": "syscall", - "syscall.SYS_GETDTABLECOUNT": "syscall", - "syscall.SYS_GETDTABLESIZE": "syscall", - "syscall.SYS_GETEGID": "syscall", - "syscall.SYS_GETEGID32": "syscall", - "syscall.SYS_GETEUID": "syscall", - "syscall.SYS_GETEUID32": "syscall", - "syscall.SYS_GETFH": "syscall", - "syscall.SYS_GETFSSTAT": "syscall", - "syscall.SYS_GETFSSTAT64": "syscall", - "syscall.SYS_GETGID": "syscall", - "syscall.SYS_GETGID32": "syscall", - "syscall.SYS_GETGROUPS": "syscall", - "syscall.SYS_GETGROUPS32": "syscall", - "syscall.SYS_GETHOSTUUID": "syscall", - "syscall.SYS_GETITIMER": "syscall", - "syscall.SYS_GETLCID": "syscall", - "syscall.SYS_GETLOGIN": "syscall", - "syscall.SYS_GETLOGINCLASS": "syscall", - "syscall.SYS_GETPEERNAME": "syscall", - "syscall.SYS_GETPGID": "syscall", - "syscall.SYS_GETPGRP": "syscall", - "syscall.SYS_GETPID": "syscall", - "syscall.SYS_GETPMSG": "syscall", - "syscall.SYS_GETPPID": "syscall", - "syscall.SYS_GETPRIORITY": "syscall", - "syscall.SYS_GETRESGID": "syscall", - "syscall.SYS_GETRESGID32": "syscall", - "syscall.SYS_GETRESUID": "syscall", - "syscall.SYS_GETRESUID32": "syscall", - "syscall.SYS_GETRLIMIT": "syscall", - "syscall.SYS_GETRTABLE": "syscall", - "syscall.SYS_GETRUSAGE": "syscall", - "syscall.SYS_GETSGROUPS": "syscall", - "syscall.SYS_GETSID": "syscall", - "syscall.SYS_GETSOCKNAME": "syscall", - "syscall.SYS_GETSOCKOPT": "syscall", - "syscall.SYS_GETTHRID": "syscall", - "syscall.SYS_GETTID": "syscall", - "syscall.SYS_GETTIMEOFDAY": "syscall", - "syscall.SYS_GETUID": "syscall", - "syscall.SYS_GETUID32": "syscall", - "syscall.SYS_GETVFSSTAT": "syscall", - "syscall.SYS_GETWGROUPS": "syscall", - "syscall.SYS_GETXATTR": "syscall", - "syscall.SYS_GET_KERNEL_SYMS": "syscall", - "syscall.SYS_GET_MEMPOLICY": "syscall", - "syscall.SYS_GET_ROBUST_LIST": "syscall", - "syscall.SYS_GET_THREAD_AREA": "syscall", - "syscall.SYS_GTTY": "syscall", - "syscall.SYS_IDENTITYSVC": "syscall", - "syscall.SYS_IDLE": "syscall", - "syscall.SYS_INITGROUPS": "syscall", - "syscall.SYS_INIT_MODULE": "syscall", - "syscall.SYS_INOTIFY_ADD_WATCH": "syscall", - "syscall.SYS_INOTIFY_INIT": "syscall", - "syscall.SYS_INOTIFY_INIT1": "syscall", - "syscall.SYS_INOTIFY_RM_WATCH": "syscall", - "syscall.SYS_IOCTL": "syscall", - "syscall.SYS_IOPERM": "syscall", - "syscall.SYS_IOPL": "syscall", - "syscall.SYS_IOPOLICYSYS": "syscall", - "syscall.SYS_IOPRIO_GET": "syscall", - "syscall.SYS_IOPRIO_SET": "syscall", - "syscall.SYS_IO_CANCEL": "syscall", - "syscall.SYS_IO_DESTROY": "syscall", - "syscall.SYS_IO_GETEVENTS": "syscall", - "syscall.SYS_IO_SETUP": "syscall", - "syscall.SYS_IO_SUBMIT": "syscall", - "syscall.SYS_IPC": "syscall", - "syscall.SYS_ISSETUGID": "syscall", - "syscall.SYS_JAIL": "syscall", - "syscall.SYS_JAIL_ATTACH": "syscall", - "syscall.SYS_JAIL_GET": "syscall", - "syscall.SYS_JAIL_REMOVE": "syscall", - "syscall.SYS_JAIL_SET": "syscall", - "syscall.SYS_KDEBUG_TRACE": "syscall", - "syscall.SYS_KENV": "syscall", - "syscall.SYS_KEVENT": "syscall", - "syscall.SYS_KEVENT64": "syscall", - "syscall.SYS_KEXEC_LOAD": "syscall", - "syscall.SYS_KEYCTL": "syscall", - "syscall.SYS_KILL": "syscall", - "syscall.SYS_KLDFIND": "syscall", - "syscall.SYS_KLDFIRSTMOD": "syscall", - "syscall.SYS_KLDLOAD": "syscall", - "syscall.SYS_KLDNEXT": "syscall", - "syscall.SYS_KLDSTAT": "syscall", - "syscall.SYS_KLDSYM": "syscall", - "syscall.SYS_KLDUNLOAD": "syscall", - "syscall.SYS_KLDUNLOADF": "syscall", - "syscall.SYS_KQUEUE": "syscall", - "syscall.SYS_KQUEUE1": "syscall", - "syscall.SYS_KTIMER_CREATE": "syscall", - "syscall.SYS_KTIMER_DELETE": "syscall", - "syscall.SYS_KTIMER_GETOVERRUN": "syscall", - "syscall.SYS_KTIMER_GETTIME": "syscall", - "syscall.SYS_KTIMER_SETTIME": "syscall", - "syscall.SYS_KTRACE": "syscall", - "syscall.SYS_LCHFLAGS": "syscall", - "syscall.SYS_LCHMOD": "syscall", - "syscall.SYS_LCHOWN": "syscall", - "syscall.SYS_LCHOWN32": "syscall", - "syscall.SYS_LGETFH": "syscall", - "syscall.SYS_LGETXATTR": "syscall", - "syscall.SYS_LINK": "syscall", - "syscall.SYS_LINKAT": "syscall", - "syscall.SYS_LIO_LISTIO": "syscall", - "syscall.SYS_LISTEN": "syscall", - "syscall.SYS_LISTXATTR": "syscall", - "syscall.SYS_LLISTXATTR": "syscall", - "syscall.SYS_LOCK": "syscall", - "syscall.SYS_LOOKUP_DCOOKIE": "syscall", - "syscall.SYS_LPATHCONF": "syscall", - "syscall.SYS_LREMOVEXATTR": "syscall", - "syscall.SYS_LSEEK": "syscall", - "syscall.SYS_LSETXATTR": "syscall", - "syscall.SYS_LSTAT": "syscall", - "syscall.SYS_LSTAT64": "syscall", - "syscall.SYS_LSTAT64_EXTENDED": "syscall", - "syscall.SYS_LSTATV": "syscall", - "syscall.SYS_LSTAT_EXTENDED": "syscall", - "syscall.SYS_LUTIMES": "syscall", - "syscall.SYS_MAC_SYSCALL": "syscall", - "syscall.SYS_MADVISE": "syscall", - "syscall.SYS_MADVISE1": "syscall", - "syscall.SYS_MAXSYSCALL": "syscall", - "syscall.SYS_MBIND": "syscall", - "syscall.SYS_MIGRATE_PAGES": "syscall", - "syscall.SYS_MINCORE": "syscall", - "syscall.SYS_MINHERIT": "syscall", - "syscall.SYS_MKCOMPLEX": "syscall", - "syscall.SYS_MKDIR": "syscall", - "syscall.SYS_MKDIRAT": "syscall", - "syscall.SYS_MKDIR_EXTENDED": "syscall", - "syscall.SYS_MKFIFO": "syscall", - "syscall.SYS_MKFIFOAT": "syscall", - "syscall.SYS_MKFIFO_EXTENDED": "syscall", - "syscall.SYS_MKNOD": "syscall", - "syscall.SYS_MKNODAT": "syscall", - "syscall.SYS_MLOCK": "syscall", - "syscall.SYS_MLOCKALL": "syscall", - "syscall.SYS_MMAP": "syscall", - "syscall.SYS_MMAP2": "syscall", - "syscall.SYS_MODCTL": "syscall", - "syscall.SYS_MODFIND": "syscall", - "syscall.SYS_MODFNEXT": "syscall", - "syscall.SYS_MODIFY_LDT": "syscall", - "syscall.SYS_MODNEXT": "syscall", - "syscall.SYS_MODSTAT": "syscall", - "syscall.SYS_MODWATCH": "syscall", - "syscall.SYS_MOUNT": "syscall", - "syscall.SYS_MOVE_PAGES": "syscall", - "syscall.SYS_MPROTECT": "syscall", - "syscall.SYS_MPX": "syscall", - "syscall.SYS_MQUERY": "syscall", - "syscall.SYS_MQ_GETSETATTR": "syscall", - "syscall.SYS_MQ_NOTIFY": "syscall", - "syscall.SYS_MQ_OPEN": "syscall", - "syscall.SYS_MQ_TIMEDRECEIVE": "syscall", - "syscall.SYS_MQ_TIMEDSEND": "syscall", - "syscall.SYS_MQ_UNLINK": "syscall", - "syscall.SYS_MREMAP": "syscall", - "syscall.SYS_MSGCTL": "syscall", - "syscall.SYS_MSGGET": "syscall", - "syscall.SYS_MSGRCV": "syscall", - "syscall.SYS_MSGRCV_NOCANCEL": "syscall", - "syscall.SYS_MSGSND": "syscall", - "syscall.SYS_MSGSND_NOCANCEL": "syscall", - "syscall.SYS_MSGSYS": "syscall", - "syscall.SYS_MSYNC": "syscall", - "syscall.SYS_MSYNC_NOCANCEL": "syscall", - "syscall.SYS_MUNLOCK": "syscall", - "syscall.SYS_MUNLOCKALL": "syscall", - "syscall.SYS_MUNMAP": "syscall", - "syscall.SYS_NAME_TO_HANDLE_AT": "syscall", - "syscall.SYS_NANOSLEEP": "syscall", - "syscall.SYS_NEWFSTATAT": "syscall", - "syscall.SYS_NFSCLNT": "syscall", - "syscall.SYS_NFSSERVCTL": "syscall", - "syscall.SYS_NFSSVC": "syscall", - "syscall.SYS_NFSTAT": "syscall", - "syscall.SYS_NICE": "syscall", - "syscall.SYS_NLSTAT": "syscall", - "syscall.SYS_NMOUNT": "syscall", - "syscall.SYS_NSTAT": "syscall", - "syscall.SYS_NTP_ADJTIME": "syscall", - "syscall.SYS_NTP_GETTIME": "syscall", - "syscall.SYS_OABI_SYSCALL_BASE": "syscall", - "syscall.SYS_OBREAK": "syscall", - "syscall.SYS_OLDFSTAT": "syscall", - "syscall.SYS_OLDLSTAT": "syscall", - "syscall.SYS_OLDOLDUNAME": "syscall", - "syscall.SYS_OLDSTAT": "syscall", - "syscall.SYS_OLDUNAME": "syscall", - "syscall.SYS_OPEN": "syscall", - "syscall.SYS_OPENAT": "syscall", - "syscall.SYS_OPENBSD_POLL": "syscall", - "syscall.SYS_OPEN_BY_HANDLE_AT": "syscall", - "syscall.SYS_OPEN_EXTENDED": "syscall", - "syscall.SYS_OPEN_NOCANCEL": "syscall", - "syscall.SYS_OVADVISE": "syscall", - "syscall.SYS_PACCEPT": "syscall", - "syscall.SYS_PATHCONF": "syscall", - "syscall.SYS_PAUSE": "syscall", - "syscall.SYS_PCICONFIG_IOBASE": "syscall", - "syscall.SYS_PCICONFIG_READ": "syscall", - "syscall.SYS_PCICONFIG_WRITE": "syscall", - "syscall.SYS_PDFORK": "syscall", - "syscall.SYS_PDGETPID": "syscall", - "syscall.SYS_PDKILL": "syscall", - "syscall.SYS_PERF_EVENT_OPEN": "syscall", - "syscall.SYS_PERSONALITY": "syscall", - "syscall.SYS_PID_HIBERNATE": "syscall", - "syscall.SYS_PID_RESUME": "syscall", - "syscall.SYS_PID_SHUTDOWN_SOCKETS": "syscall", - "syscall.SYS_PID_SUSPEND": "syscall", - "syscall.SYS_PIPE": "syscall", - "syscall.SYS_PIPE2": "syscall", - "syscall.SYS_PIVOT_ROOT": "syscall", - "syscall.SYS_PMC_CONTROL": "syscall", - "syscall.SYS_PMC_GET_INFO": "syscall", - "syscall.SYS_POLL": "syscall", - "syscall.SYS_POLLTS": "syscall", - "syscall.SYS_POLL_NOCANCEL": "syscall", - "syscall.SYS_POSIX_FADVISE": "syscall", - "syscall.SYS_POSIX_FALLOCATE": "syscall", - "syscall.SYS_POSIX_OPENPT": "syscall", - "syscall.SYS_POSIX_SPAWN": "syscall", - "syscall.SYS_PPOLL": "syscall", - "syscall.SYS_PRCTL": "syscall", - "syscall.SYS_PREAD": "syscall", - "syscall.SYS_PREAD64": "syscall", - "syscall.SYS_PREADV": "syscall", - "syscall.SYS_PREAD_NOCANCEL": "syscall", - "syscall.SYS_PRLIMIT64": "syscall", - "syscall.SYS_PROCCTL": "syscall", - "syscall.SYS_PROCESS_POLICY": "syscall", - "syscall.SYS_PROCESS_VM_READV": "syscall", - "syscall.SYS_PROCESS_VM_WRITEV": "syscall", - "syscall.SYS_PROC_INFO": "syscall", - "syscall.SYS_PROF": "syscall", - "syscall.SYS_PROFIL": "syscall", - "syscall.SYS_PSELECT": "syscall", - "syscall.SYS_PSELECT6": "syscall", - "syscall.SYS_PSET_ASSIGN": "syscall", - "syscall.SYS_PSET_CREATE": "syscall", - "syscall.SYS_PSET_DESTROY": "syscall", - "syscall.SYS_PSYNCH_CVBROAD": "syscall", - "syscall.SYS_PSYNCH_CVCLRPREPOST": "syscall", - "syscall.SYS_PSYNCH_CVSIGNAL": "syscall", - "syscall.SYS_PSYNCH_CVWAIT": "syscall", - "syscall.SYS_PSYNCH_MUTEXDROP": "syscall", - "syscall.SYS_PSYNCH_MUTEXWAIT": "syscall", - "syscall.SYS_PSYNCH_RW_DOWNGRADE": "syscall", - "syscall.SYS_PSYNCH_RW_LONGRDLOCK": "syscall", - "syscall.SYS_PSYNCH_RW_RDLOCK": "syscall", - "syscall.SYS_PSYNCH_RW_UNLOCK": "syscall", - "syscall.SYS_PSYNCH_RW_UNLOCK2": "syscall", - "syscall.SYS_PSYNCH_RW_UPGRADE": "syscall", - "syscall.SYS_PSYNCH_RW_WRLOCK": "syscall", - "syscall.SYS_PSYNCH_RW_YIELDWRLOCK": "syscall", - "syscall.SYS_PTRACE": "syscall", - "syscall.SYS_PUTPMSG": "syscall", - "syscall.SYS_PWRITE": "syscall", - "syscall.SYS_PWRITE64": "syscall", - "syscall.SYS_PWRITEV": "syscall", - "syscall.SYS_PWRITE_NOCANCEL": "syscall", - "syscall.SYS_QUERY_MODULE": "syscall", - "syscall.SYS_QUOTACTL": "syscall", - "syscall.SYS_RASCTL": "syscall", - "syscall.SYS_RCTL_ADD_RULE": "syscall", - "syscall.SYS_RCTL_GET_LIMITS": "syscall", - "syscall.SYS_RCTL_GET_RACCT": "syscall", - "syscall.SYS_RCTL_GET_RULES": "syscall", - "syscall.SYS_RCTL_REMOVE_RULE": "syscall", - "syscall.SYS_READ": "syscall", - "syscall.SYS_READAHEAD": "syscall", - "syscall.SYS_READDIR": "syscall", - "syscall.SYS_READLINK": "syscall", - "syscall.SYS_READLINKAT": "syscall", - "syscall.SYS_READV": "syscall", - "syscall.SYS_READV_NOCANCEL": "syscall", - "syscall.SYS_READ_NOCANCEL": "syscall", - "syscall.SYS_REBOOT": "syscall", - "syscall.SYS_RECV": "syscall", - "syscall.SYS_RECVFROM": "syscall", - "syscall.SYS_RECVFROM_NOCANCEL": "syscall", - "syscall.SYS_RECVMMSG": "syscall", - "syscall.SYS_RECVMSG": "syscall", - "syscall.SYS_RECVMSG_NOCANCEL": "syscall", - "syscall.SYS_REMAP_FILE_PAGES": "syscall", - "syscall.SYS_REMOVEXATTR": "syscall", - "syscall.SYS_RENAME": "syscall", - "syscall.SYS_RENAMEAT": "syscall", - "syscall.SYS_REQUEST_KEY": "syscall", - "syscall.SYS_RESTART_SYSCALL": "syscall", - "syscall.SYS_REVOKE": "syscall", - "syscall.SYS_RFORK": "syscall", - "syscall.SYS_RMDIR": "syscall", - "syscall.SYS_RTPRIO": "syscall", - "syscall.SYS_RTPRIO_THREAD": "syscall", - "syscall.SYS_RT_SIGACTION": "syscall", - "syscall.SYS_RT_SIGPENDING": "syscall", - "syscall.SYS_RT_SIGPROCMASK": "syscall", - "syscall.SYS_RT_SIGQUEUEINFO": "syscall", - "syscall.SYS_RT_SIGRETURN": "syscall", - "syscall.SYS_RT_SIGSUSPEND": "syscall", - "syscall.SYS_RT_SIGTIMEDWAIT": "syscall", - "syscall.SYS_RT_TGSIGQUEUEINFO": "syscall", - "syscall.SYS_SBRK": "syscall", - "syscall.SYS_SCHED_GETAFFINITY": "syscall", - "syscall.SYS_SCHED_GETPARAM": "syscall", - "syscall.SYS_SCHED_GETSCHEDULER": "syscall", - "syscall.SYS_SCHED_GET_PRIORITY_MAX": "syscall", - "syscall.SYS_SCHED_GET_PRIORITY_MIN": "syscall", - "syscall.SYS_SCHED_RR_GET_INTERVAL": "syscall", - "syscall.SYS_SCHED_SETAFFINITY": "syscall", - "syscall.SYS_SCHED_SETPARAM": "syscall", - "syscall.SYS_SCHED_SETSCHEDULER": "syscall", - "syscall.SYS_SCHED_YIELD": "syscall", - "syscall.SYS_SCTP_GENERIC_RECVMSG": "syscall", - "syscall.SYS_SCTP_GENERIC_SENDMSG": "syscall", - "syscall.SYS_SCTP_GENERIC_SENDMSG_IOV": "syscall", - "syscall.SYS_SCTP_PEELOFF": "syscall", - "syscall.SYS_SEARCHFS": "syscall", - "syscall.SYS_SECURITY": "syscall", - "syscall.SYS_SELECT": "syscall", - "syscall.SYS_SELECT_NOCANCEL": "syscall", - "syscall.SYS_SEMCONFIG": "syscall", - "syscall.SYS_SEMCTL": "syscall", - "syscall.SYS_SEMGET": "syscall", - "syscall.SYS_SEMOP": "syscall", - "syscall.SYS_SEMSYS": "syscall", - "syscall.SYS_SEMTIMEDOP": "syscall", - "syscall.SYS_SEM_CLOSE": "syscall", - "syscall.SYS_SEM_DESTROY": "syscall", - "syscall.SYS_SEM_GETVALUE": "syscall", - "syscall.SYS_SEM_INIT": "syscall", - "syscall.SYS_SEM_OPEN": "syscall", - "syscall.SYS_SEM_POST": "syscall", - "syscall.SYS_SEM_TRYWAIT": "syscall", - "syscall.SYS_SEM_UNLINK": "syscall", - "syscall.SYS_SEM_WAIT": "syscall", - "syscall.SYS_SEM_WAIT_NOCANCEL": "syscall", - "syscall.SYS_SEND": "syscall", - "syscall.SYS_SENDFILE": "syscall", - "syscall.SYS_SENDFILE64": "syscall", - "syscall.SYS_SENDMMSG": "syscall", - "syscall.SYS_SENDMSG": "syscall", - "syscall.SYS_SENDMSG_NOCANCEL": "syscall", - "syscall.SYS_SENDTO": "syscall", - "syscall.SYS_SENDTO_NOCANCEL": "syscall", - "syscall.SYS_SETATTRLIST": "syscall", - "syscall.SYS_SETAUDIT": "syscall", - "syscall.SYS_SETAUDIT_ADDR": "syscall", - "syscall.SYS_SETAUID": "syscall", - "syscall.SYS_SETCONTEXT": "syscall", - "syscall.SYS_SETDOMAINNAME": "syscall", - "syscall.SYS_SETEGID": "syscall", - "syscall.SYS_SETEUID": "syscall", - "syscall.SYS_SETFIB": "syscall", - "syscall.SYS_SETFSGID": "syscall", - "syscall.SYS_SETFSGID32": "syscall", - "syscall.SYS_SETFSUID": "syscall", - "syscall.SYS_SETFSUID32": "syscall", - "syscall.SYS_SETGID": "syscall", - "syscall.SYS_SETGID32": "syscall", - "syscall.SYS_SETGROUPS": "syscall", - "syscall.SYS_SETGROUPS32": "syscall", - "syscall.SYS_SETHOSTNAME": "syscall", - "syscall.SYS_SETITIMER": "syscall", - "syscall.SYS_SETLCID": "syscall", - "syscall.SYS_SETLOGIN": "syscall", - "syscall.SYS_SETLOGINCLASS": "syscall", - "syscall.SYS_SETNS": "syscall", - "syscall.SYS_SETPGID": "syscall", - "syscall.SYS_SETPRIORITY": "syscall", - "syscall.SYS_SETPRIVEXEC": "syscall", - "syscall.SYS_SETREGID": "syscall", - "syscall.SYS_SETREGID32": "syscall", - "syscall.SYS_SETRESGID": "syscall", - "syscall.SYS_SETRESGID32": "syscall", - "syscall.SYS_SETRESUID": "syscall", - "syscall.SYS_SETRESUID32": "syscall", - "syscall.SYS_SETREUID": "syscall", - "syscall.SYS_SETREUID32": "syscall", - "syscall.SYS_SETRLIMIT": "syscall", - "syscall.SYS_SETRTABLE": "syscall", - "syscall.SYS_SETSGROUPS": "syscall", - "syscall.SYS_SETSID": "syscall", - "syscall.SYS_SETSOCKOPT": "syscall", - "syscall.SYS_SETTID": "syscall", - "syscall.SYS_SETTID_WITH_PID": "syscall", - "syscall.SYS_SETTIMEOFDAY": "syscall", - "syscall.SYS_SETUID": "syscall", - "syscall.SYS_SETUID32": "syscall", - "syscall.SYS_SETWGROUPS": "syscall", - "syscall.SYS_SETXATTR": "syscall", - "syscall.SYS_SET_MEMPOLICY": "syscall", - "syscall.SYS_SET_ROBUST_LIST": "syscall", - "syscall.SYS_SET_THREAD_AREA": "syscall", - "syscall.SYS_SET_TID_ADDRESS": "syscall", - "syscall.SYS_SGETMASK": "syscall", - "syscall.SYS_SHARED_REGION_CHECK_NP": "syscall", - "syscall.SYS_SHARED_REGION_MAP_AND_SLIDE_NP": "syscall", - "syscall.SYS_SHMAT": "syscall", - "syscall.SYS_SHMCTL": "syscall", - "syscall.SYS_SHMDT": "syscall", - "syscall.SYS_SHMGET": "syscall", - "syscall.SYS_SHMSYS": "syscall", - "syscall.SYS_SHM_OPEN": "syscall", - "syscall.SYS_SHM_UNLINK": "syscall", - "syscall.SYS_SHUTDOWN": "syscall", - "syscall.SYS_SIGACTION": "syscall", - "syscall.SYS_SIGALTSTACK": "syscall", - "syscall.SYS_SIGNAL": "syscall", - "syscall.SYS_SIGNALFD": "syscall", - "syscall.SYS_SIGNALFD4": "syscall", - "syscall.SYS_SIGPENDING": "syscall", - "syscall.SYS_SIGPROCMASK": "syscall", - "syscall.SYS_SIGQUEUE": "syscall", - "syscall.SYS_SIGQUEUEINFO": "syscall", - "syscall.SYS_SIGRETURN": "syscall", - "syscall.SYS_SIGSUSPEND": "syscall", - "syscall.SYS_SIGSUSPEND_NOCANCEL": "syscall", - "syscall.SYS_SIGTIMEDWAIT": "syscall", - "syscall.SYS_SIGWAIT": "syscall", - "syscall.SYS_SIGWAITINFO": "syscall", - "syscall.SYS_SOCKET": "syscall", - "syscall.SYS_SOCKETCALL": "syscall", - "syscall.SYS_SOCKETPAIR": "syscall", - "syscall.SYS_SPLICE": "syscall", - "syscall.SYS_SSETMASK": "syscall", - "syscall.SYS_SSTK": "syscall", - "syscall.SYS_STACK_SNAPSHOT": "syscall", - "syscall.SYS_STAT": "syscall", - "syscall.SYS_STAT64": "syscall", - "syscall.SYS_STAT64_EXTENDED": "syscall", - "syscall.SYS_STATFS": "syscall", - "syscall.SYS_STATFS64": "syscall", - "syscall.SYS_STATV": "syscall", - "syscall.SYS_STATVFS1": "syscall", - "syscall.SYS_STAT_EXTENDED": "syscall", - "syscall.SYS_STIME": "syscall", - "syscall.SYS_STTY": "syscall", - "syscall.SYS_SWAPCONTEXT": "syscall", - "syscall.SYS_SWAPCTL": "syscall", - "syscall.SYS_SWAPOFF": "syscall", - "syscall.SYS_SWAPON": "syscall", - "syscall.SYS_SYMLINK": "syscall", - "syscall.SYS_SYMLINKAT": "syscall", - "syscall.SYS_SYNC": "syscall", - "syscall.SYS_SYNCFS": "syscall", - "syscall.SYS_SYNC_FILE_RANGE": "syscall", - "syscall.SYS_SYSARCH": "syscall", - "syscall.SYS_SYSCALL": "syscall", - "syscall.SYS_SYSCALL_BASE": "syscall", - "syscall.SYS_SYSFS": "syscall", - "syscall.SYS_SYSINFO": "syscall", - "syscall.SYS_SYSLOG": "syscall", - "syscall.SYS_TEE": "syscall", - "syscall.SYS_TGKILL": "syscall", - "syscall.SYS_THREAD_SELFID": "syscall", - "syscall.SYS_THR_CREATE": "syscall", - "syscall.SYS_THR_EXIT": "syscall", - "syscall.SYS_THR_KILL": "syscall", - "syscall.SYS_THR_KILL2": "syscall", - "syscall.SYS_THR_NEW": "syscall", - "syscall.SYS_THR_SELF": "syscall", - "syscall.SYS_THR_SET_NAME": "syscall", - "syscall.SYS_THR_SUSPEND": "syscall", - "syscall.SYS_THR_WAKE": "syscall", - "syscall.SYS_TIME": "syscall", - "syscall.SYS_TIMERFD_CREATE": "syscall", - "syscall.SYS_TIMERFD_GETTIME": "syscall", - "syscall.SYS_TIMERFD_SETTIME": "syscall", - "syscall.SYS_TIMER_CREATE": "syscall", - "syscall.SYS_TIMER_DELETE": "syscall", - "syscall.SYS_TIMER_GETOVERRUN": "syscall", - "syscall.SYS_TIMER_GETTIME": "syscall", - "syscall.SYS_TIMER_SETTIME": "syscall", - "syscall.SYS_TIMES": "syscall", - "syscall.SYS_TKILL": "syscall", - "syscall.SYS_TRUNCATE": "syscall", - "syscall.SYS_TRUNCATE64": "syscall", - "syscall.SYS_TUXCALL": "syscall", - "syscall.SYS_UGETRLIMIT": "syscall", - "syscall.SYS_ULIMIT": "syscall", - "syscall.SYS_UMASK": "syscall", - "syscall.SYS_UMASK_EXTENDED": "syscall", - "syscall.SYS_UMOUNT": "syscall", - "syscall.SYS_UMOUNT2": "syscall", - "syscall.SYS_UNAME": "syscall", - "syscall.SYS_UNDELETE": "syscall", - "syscall.SYS_UNLINK": "syscall", - "syscall.SYS_UNLINKAT": "syscall", - "syscall.SYS_UNMOUNT": "syscall", - "syscall.SYS_UNSHARE": "syscall", - "syscall.SYS_USELIB": "syscall", - "syscall.SYS_USTAT": "syscall", - "syscall.SYS_UTIME": "syscall", - "syscall.SYS_UTIMENSAT": "syscall", - "syscall.SYS_UTIMES": "syscall", - "syscall.SYS_UTRACE": "syscall", - "syscall.SYS_UUIDGEN": "syscall", - "syscall.SYS_VADVISE": "syscall", - "syscall.SYS_VFORK": "syscall", - "syscall.SYS_VHANGUP": "syscall", - "syscall.SYS_VM86": "syscall", - "syscall.SYS_VM86OLD": "syscall", - "syscall.SYS_VMSPLICE": "syscall", - "syscall.SYS_VM_PRESSURE_MONITOR": "syscall", - "syscall.SYS_VSERVER": "syscall", - "syscall.SYS_WAIT4": "syscall", - "syscall.SYS_WAIT4_NOCANCEL": "syscall", - "syscall.SYS_WAIT6": "syscall", - "syscall.SYS_WAITEVENT": "syscall", - "syscall.SYS_WAITID": "syscall", - "syscall.SYS_WAITID_NOCANCEL": "syscall", - "syscall.SYS_WAITPID": "syscall", - "syscall.SYS_WATCHEVENT": "syscall", - "syscall.SYS_WORKQ_KERNRETURN": "syscall", - "syscall.SYS_WORKQ_OPEN": "syscall", - "syscall.SYS_WRITE": "syscall", - "syscall.SYS_WRITEV": "syscall", - "syscall.SYS_WRITEV_NOCANCEL": "syscall", - "syscall.SYS_WRITE_NOCANCEL": "syscall", - "syscall.SYS_YIELD": "syscall", - "syscall.SYS__LLSEEK": "syscall", - "syscall.SYS__LWP_CONTINUE": "syscall", - "syscall.SYS__LWP_CREATE": "syscall", - "syscall.SYS__LWP_CTL": "syscall", - "syscall.SYS__LWP_DETACH": "syscall", - "syscall.SYS__LWP_EXIT": "syscall", - "syscall.SYS__LWP_GETNAME": "syscall", - "syscall.SYS__LWP_GETPRIVATE": "syscall", - "syscall.SYS__LWP_KILL": "syscall", - "syscall.SYS__LWP_PARK": "syscall", - "syscall.SYS__LWP_SELF": "syscall", - "syscall.SYS__LWP_SETNAME": "syscall", - "syscall.SYS__LWP_SETPRIVATE": "syscall", - "syscall.SYS__LWP_SUSPEND": "syscall", - "syscall.SYS__LWP_UNPARK": "syscall", - "syscall.SYS__LWP_UNPARK_ALL": "syscall", - "syscall.SYS__LWP_WAIT": "syscall", - "syscall.SYS__LWP_WAKEUP": "syscall", - "syscall.SYS__NEWSELECT": "syscall", - "syscall.SYS__PSET_BIND": "syscall", - "syscall.SYS__SCHED_GETAFFINITY": "syscall", - "syscall.SYS__SCHED_GETPARAM": "syscall", - "syscall.SYS__SCHED_SETAFFINITY": "syscall", - "syscall.SYS__SCHED_SETPARAM": "syscall", - "syscall.SYS__SYSCTL": "syscall", - "syscall.SYS__UMTX_LOCK": "syscall", - "syscall.SYS__UMTX_OP": "syscall", - "syscall.SYS__UMTX_UNLOCK": "syscall", - "syscall.SYS___ACL_ACLCHECK_FD": "syscall", - "syscall.SYS___ACL_ACLCHECK_FILE": "syscall", - "syscall.SYS___ACL_ACLCHECK_LINK": "syscall", - "syscall.SYS___ACL_DELETE_FD": "syscall", - "syscall.SYS___ACL_DELETE_FILE": "syscall", - "syscall.SYS___ACL_DELETE_LINK": "syscall", - "syscall.SYS___ACL_GET_FD": "syscall", - "syscall.SYS___ACL_GET_FILE": "syscall", - "syscall.SYS___ACL_GET_LINK": "syscall", - "syscall.SYS___ACL_SET_FD": "syscall", - "syscall.SYS___ACL_SET_FILE": "syscall", - "syscall.SYS___ACL_SET_LINK": "syscall", - "syscall.SYS___CLONE": "syscall", - "syscall.SYS___DISABLE_THREADSIGNAL": "syscall", - "syscall.SYS___GETCWD": "syscall", - "syscall.SYS___GETLOGIN": "syscall", - "syscall.SYS___GET_TCB": "syscall", - "syscall.SYS___MAC_EXECVE": "syscall", - "syscall.SYS___MAC_GETFSSTAT": "syscall", - "syscall.SYS___MAC_GET_FD": "syscall", - "syscall.SYS___MAC_GET_FILE": "syscall", - "syscall.SYS___MAC_GET_LCID": "syscall", - "syscall.SYS___MAC_GET_LCTX": "syscall", - "syscall.SYS___MAC_GET_LINK": "syscall", - "syscall.SYS___MAC_GET_MOUNT": "syscall", - "syscall.SYS___MAC_GET_PID": "syscall", - "syscall.SYS___MAC_GET_PROC": "syscall", - "syscall.SYS___MAC_MOUNT": "syscall", - "syscall.SYS___MAC_SET_FD": "syscall", - "syscall.SYS___MAC_SET_FILE": "syscall", - "syscall.SYS___MAC_SET_LCTX": "syscall", - "syscall.SYS___MAC_SET_LINK": "syscall", - "syscall.SYS___MAC_SET_PROC": "syscall", - "syscall.SYS___MAC_SYSCALL": "syscall", - "syscall.SYS___OLD_SEMWAIT_SIGNAL": "syscall", - "syscall.SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL": "syscall", - "syscall.SYS___POSIX_CHOWN": "syscall", - "syscall.SYS___POSIX_FCHOWN": "syscall", - "syscall.SYS___POSIX_LCHOWN": "syscall", - "syscall.SYS___POSIX_RENAME": "syscall", - "syscall.SYS___PTHREAD_CANCELED": "syscall", - "syscall.SYS___PTHREAD_CHDIR": "syscall", - "syscall.SYS___PTHREAD_FCHDIR": "syscall", - "syscall.SYS___PTHREAD_KILL": "syscall", - "syscall.SYS___PTHREAD_MARKCANCEL": "syscall", - "syscall.SYS___PTHREAD_SIGMASK": "syscall", - "syscall.SYS___QUOTACTL": "syscall", - "syscall.SYS___SEMCTL": "syscall", - "syscall.SYS___SEMWAIT_SIGNAL": "syscall", - "syscall.SYS___SEMWAIT_SIGNAL_NOCANCEL": "syscall", - "syscall.SYS___SETLOGIN": "syscall", - "syscall.SYS___SETUGID": "syscall", - "syscall.SYS___SET_TCB": "syscall", - "syscall.SYS___SIGACTION_SIGTRAMP": "syscall", - "syscall.SYS___SIGTIMEDWAIT": "syscall", - "syscall.SYS___SIGWAIT": "syscall", - "syscall.SYS___SIGWAIT_NOCANCEL": "syscall", - "syscall.SYS___SYSCTL": "syscall", - "syscall.SYS___TFORK": "syscall", - "syscall.SYS___THREXIT": "syscall", - "syscall.SYS___THRSIGDIVERT": "syscall", - "syscall.SYS___THRSLEEP": "syscall", - "syscall.SYS___THRWAKEUP": "syscall", - "syscall.S_ARCH1": "syscall", - "syscall.S_ARCH2": "syscall", - "syscall.S_BLKSIZE": "syscall", - "syscall.S_IEXEC": "syscall", - "syscall.S_IFBLK": "syscall", - "syscall.S_IFCHR": "syscall", - "syscall.S_IFDIR": "syscall", - "syscall.S_IFIFO": "syscall", - "syscall.S_IFLNK": "syscall", - "syscall.S_IFMT": "syscall", - "syscall.S_IFREG": "syscall", - "syscall.S_IFSOCK": "syscall", - "syscall.S_IFWHT": "syscall", - "syscall.S_IREAD": "syscall", - "syscall.S_IRGRP": "syscall", - "syscall.S_IROTH": "syscall", - "syscall.S_IRUSR": "syscall", - "syscall.S_IRWXG": "syscall", - "syscall.S_IRWXO": "syscall", - "syscall.S_IRWXU": "syscall", - "syscall.S_ISGID": "syscall", - "syscall.S_ISTXT": "syscall", - "syscall.S_ISUID": "syscall", - "syscall.S_ISVTX": "syscall", - "syscall.S_IWGRP": "syscall", - "syscall.S_IWOTH": "syscall", - "syscall.S_IWRITE": "syscall", - "syscall.S_IWUSR": "syscall", - "syscall.S_IXGRP": "syscall", - "syscall.S_IXOTH": "syscall", - "syscall.S_IXUSR": "syscall", - "syscall.S_LOGIN_SET": "syscall", - "syscall.SecurityAttributes": "syscall", - "syscall.Seek": "syscall", - "syscall.Select": "syscall", - "syscall.Sendfile": "syscall", - "syscall.Sendmsg": "syscall", - "syscall.SendmsgN": "syscall", - "syscall.Sendto": "syscall", - "syscall.Servent": "syscall", - "syscall.SetBpf": "syscall", - "syscall.SetBpfBuflen": "syscall", - "syscall.SetBpfDatalink": "syscall", - "syscall.SetBpfHeadercmpl": "syscall", - "syscall.SetBpfImmediate": "syscall", - "syscall.SetBpfInterface": "syscall", - "syscall.SetBpfPromisc": "syscall", - "syscall.SetBpfTimeout": "syscall", - "syscall.SetCurrentDirectory": "syscall", - "syscall.SetEndOfFile": "syscall", - "syscall.SetEnvironmentVariable": "syscall", - "syscall.SetFileAttributes": "syscall", - "syscall.SetFileCompletionNotificationModes": "syscall", - "syscall.SetFilePointer": "syscall", - "syscall.SetFileTime": "syscall", - "syscall.SetHandleInformation": "syscall", - "syscall.SetKevent": "syscall", - "syscall.SetLsfPromisc": "syscall", - "syscall.SetNonblock": "syscall", - "syscall.Setdomainname": "syscall", - "syscall.Setegid": "syscall", - "syscall.Setenv": "syscall", - "syscall.Seteuid": "syscall", - "syscall.Setfsgid": "syscall", - "syscall.Setfsuid": "syscall", - "syscall.Setgid": "syscall", - "syscall.Setgroups": "syscall", - "syscall.Sethostname": "syscall", - "syscall.Setlogin": "syscall", - "syscall.Setpgid": "syscall", - "syscall.Setpriority": "syscall", - "syscall.Setprivexec": "syscall", - "syscall.Setregid": "syscall", - "syscall.Setresgid": "syscall", - "syscall.Setresuid": "syscall", - "syscall.Setreuid": "syscall", - "syscall.Setrlimit": "syscall", - "syscall.Setsid": "syscall", - "syscall.Setsockopt": "syscall", - "syscall.SetsockoptByte": "syscall", - "syscall.SetsockoptICMPv6Filter": "syscall", - "syscall.SetsockoptIPMreq": "syscall", - "syscall.SetsockoptIPMreqn": "syscall", - "syscall.SetsockoptIPv6Mreq": "syscall", - "syscall.SetsockoptInet4Addr": "syscall", - "syscall.SetsockoptInt": "syscall", - "syscall.SetsockoptLinger": "syscall", - "syscall.SetsockoptString": "syscall", - "syscall.SetsockoptTimeval": "syscall", - "syscall.Settimeofday": "syscall", - "syscall.Setuid": "syscall", - "syscall.Setxattr": "syscall", - "syscall.Shutdown": "syscall", - "syscall.SidTypeAlias": "syscall", - "syscall.SidTypeComputer": "syscall", - "syscall.SidTypeDeletedAccount": "syscall", - "syscall.SidTypeDomain": "syscall", - "syscall.SidTypeGroup": "syscall", - "syscall.SidTypeInvalid": "syscall", - "syscall.SidTypeLabel": "syscall", - "syscall.SidTypeUnknown": "syscall", - "syscall.SidTypeUser": "syscall", - "syscall.SidTypeWellKnownGroup": "syscall", - "syscall.Signal": "syscall", - "syscall.SizeofBpfHdr": "syscall", - "syscall.SizeofBpfInsn": "syscall", - "syscall.SizeofBpfProgram": "syscall", - "syscall.SizeofBpfStat": "syscall", - "syscall.SizeofBpfVersion": "syscall", - "syscall.SizeofBpfZbuf": "syscall", - "syscall.SizeofBpfZbufHeader": "syscall", - "syscall.SizeofCmsghdr": "syscall", - "syscall.SizeofICMPv6Filter": "syscall", - "syscall.SizeofIPMreq": "syscall", - "syscall.SizeofIPMreqn": "syscall", - "syscall.SizeofIPv6MTUInfo": "syscall", - "syscall.SizeofIPv6Mreq": "syscall", - "syscall.SizeofIfAddrmsg": "syscall", - "syscall.SizeofIfAnnounceMsghdr": "syscall", - "syscall.SizeofIfData": "syscall", - "syscall.SizeofIfInfomsg": "syscall", - "syscall.SizeofIfMsghdr": "syscall", - "syscall.SizeofIfaMsghdr": "syscall", - "syscall.SizeofIfmaMsghdr": "syscall", - "syscall.SizeofIfmaMsghdr2": "syscall", - "syscall.SizeofInet4Pktinfo": "syscall", - "syscall.SizeofInet6Pktinfo": "syscall", - "syscall.SizeofInotifyEvent": "syscall", - "syscall.SizeofLinger": "syscall", - "syscall.SizeofMsghdr": "syscall", - "syscall.SizeofNlAttr": "syscall", - "syscall.SizeofNlMsgerr": "syscall", - "syscall.SizeofNlMsghdr": "syscall", - "syscall.SizeofRtAttr": "syscall", - "syscall.SizeofRtGenmsg": "syscall", - "syscall.SizeofRtMetrics": "syscall", - "syscall.SizeofRtMsg": "syscall", - "syscall.SizeofRtMsghdr": "syscall", - "syscall.SizeofRtNexthop": "syscall", - "syscall.SizeofSockFilter": "syscall", - "syscall.SizeofSockFprog": "syscall", - "syscall.SizeofSockaddrAny": "syscall", - "syscall.SizeofSockaddrDatalink": "syscall", - "syscall.SizeofSockaddrInet4": "syscall", - "syscall.SizeofSockaddrInet6": "syscall", - "syscall.SizeofSockaddrLinklayer": "syscall", - "syscall.SizeofSockaddrNetlink": "syscall", - "syscall.SizeofSockaddrUnix": "syscall", - "syscall.SizeofTCPInfo": "syscall", - "syscall.SizeofUcred": "syscall", - "syscall.SlicePtrFromStrings": "syscall", - "syscall.SockFilter": "syscall", - "syscall.SockFprog": "syscall", - "syscall.SockaddrDatalink": "syscall", - "syscall.SockaddrGen": "syscall", - "syscall.SockaddrInet4": "syscall", - "syscall.SockaddrInet6": "syscall", - "syscall.SockaddrLinklayer": "syscall", - "syscall.SockaddrNetlink": "syscall", - "syscall.SockaddrUnix": "syscall", - "syscall.Socket": "syscall", - "syscall.SocketControlMessage": "syscall", - "syscall.SocketDisableIPv6": "syscall", - "syscall.Socketpair": "syscall", - "syscall.Splice": "syscall", - "syscall.StartProcess": "syscall", - "syscall.StartupInfo": "syscall", - "syscall.Stat": "syscall", - "syscall.Stat_t": "syscall", - "syscall.Statfs": "syscall", - "syscall.Statfs_t": "syscall", - "syscall.Stderr": "syscall", - "syscall.Stdin": "syscall", - "syscall.Stdout": "syscall", - "syscall.StringBytePtr": "syscall", - "syscall.StringByteSlice": "syscall", - "syscall.StringSlicePtr": "syscall", - "syscall.StringToSid": "syscall", - "syscall.StringToUTF16": "syscall", - "syscall.StringToUTF16Ptr": "syscall", - "syscall.Symlink": "syscall", - "syscall.Sync": "syscall", - "syscall.SyncFileRange": "syscall", - "syscall.SysProcAttr": "syscall", - "syscall.SysProcIDMap": "syscall", - "syscall.Syscall": "syscall", - "syscall.Syscall12": "syscall", - "syscall.Syscall15": "syscall", - "syscall.Syscall6": "syscall", - "syscall.Syscall9": "syscall", - "syscall.Sysctl": "syscall", - "syscall.SysctlUint32": "syscall", - "syscall.Sysctlnode": "syscall", - "syscall.Sysinfo": "syscall", - "syscall.Sysinfo_t": "syscall", - "syscall.Systemtime": "syscall", - "syscall.TCGETS": "syscall", - "syscall.TCIFLUSH": "syscall", - "syscall.TCIOFLUSH": "syscall", - "syscall.TCOFLUSH": "syscall", - "syscall.TCPInfo": "syscall", - "syscall.TCPKeepalive": "syscall", - "syscall.TCP_CA_NAME_MAX": "syscall", - "syscall.TCP_CONGCTL": "syscall", - "syscall.TCP_CONGESTION": "syscall", - "syscall.TCP_CONNECTIONTIMEOUT": "syscall", - "syscall.TCP_CORK": "syscall", - "syscall.TCP_DEFER_ACCEPT": "syscall", - "syscall.TCP_INFO": "syscall", - "syscall.TCP_KEEPALIVE": "syscall", - "syscall.TCP_KEEPCNT": "syscall", - "syscall.TCP_KEEPIDLE": "syscall", - "syscall.TCP_KEEPINIT": "syscall", - "syscall.TCP_KEEPINTVL": "syscall", - "syscall.TCP_LINGER2": "syscall", - "syscall.TCP_MAXBURST": "syscall", - "syscall.TCP_MAXHLEN": "syscall", - "syscall.TCP_MAXOLEN": "syscall", - "syscall.TCP_MAXSEG": "syscall", - "syscall.TCP_MAXWIN": "syscall", - "syscall.TCP_MAX_SACK": "syscall", - "syscall.TCP_MAX_WINSHIFT": "syscall", - "syscall.TCP_MD5SIG": "syscall", - "syscall.TCP_MD5SIG_MAXKEYLEN": "syscall", - "syscall.TCP_MINMSS": "syscall", - "syscall.TCP_MINMSSOVERLOAD": "syscall", - "syscall.TCP_MSS": "syscall", - "syscall.TCP_NODELAY": "syscall", - "syscall.TCP_NOOPT": "syscall", - "syscall.TCP_NOPUSH": "syscall", - "syscall.TCP_NSTATES": "syscall", - "syscall.TCP_QUICKACK": "syscall", - "syscall.TCP_RXT_CONNDROPTIME": "syscall", - "syscall.TCP_RXT_FINDROP": "syscall", - "syscall.TCP_SACK_ENABLE": "syscall", - "syscall.TCP_SYNCNT": "syscall", - "syscall.TCP_VENDOR": "syscall", - "syscall.TCP_WINDOW_CLAMP": "syscall", - "syscall.TCSAFLUSH": "syscall", - "syscall.TCSETS": "syscall", - "syscall.TF_DISCONNECT": "syscall", - "syscall.TF_REUSE_SOCKET": "syscall", - "syscall.TF_USE_DEFAULT_WORKER": "syscall", - "syscall.TF_USE_KERNEL_APC": "syscall", - "syscall.TF_USE_SYSTEM_THREAD": "syscall", - "syscall.TF_WRITE_BEHIND": "syscall", - "syscall.TH32CS_INHERIT": "syscall", - "syscall.TH32CS_SNAPALL": "syscall", - "syscall.TH32CS_SNAPHEAPLIST": "syscall", - "syscall.TH32CS_SNAPMODULE": "syscall", - "syscall.TH32CS_SNAPMODULE32": "syscall", - "syscall.TH32CS_SNAPPROCESS": "syscall", - "syscall.TH32CS_SNAPTHREAD": "syscall", - "syscall.TIME_ZONE_ID_DAYLIGHT": "syscall", - "syscall.TIME_ZONE_ID_STANDARD": "syscall", - "syscall.TIME_ZONE_ID_UNKNOWN": "syscall", - "syscall.TIOCCBRK": "syscall", - "syscall.TIOCCDTR": "syscall", - "syscall.TIOCCONS": "syscall", - "syscall.TIOCDCDTIMESTAMP": "syscall", - "syscall.TIOCDRAIN": "syscall", - "syscall.TIOCDSIMICROCODE": "syscall", - "syscall.TIOCEXCL": "syscall", - "syscall.TIOCEXT": "syscall", - "syscall.TIOCFLAG_CDTRCTS": "syscall", - "syscall.TIOCFLAG_CLOCAL": "syscall", - "syscall.TIOCFLAG_CRTSCTS": "syscall", - "syscall.TIOCFLAG_MDMBUF": "syscall", - "syscall.TIOCFLAG_PPS": "syscall", - "syscall.TIOCFLAG_SOFTCAR": "syscall", - "syscall.TIOCFLUSH": "syscall", - "syscall.TIOCGDEV": "syscall", - "syscall.TIOCGDRAINWAIT": "syscall", - "syscall.TIOCGETA": "syscall", - "syscall.TIOCGETD": "syscall", - "syscall.TIOCGFLAGS": "syscall", - "syscall.TIOCGICOUNT": "syscall", - "syscall.TIOCGLCKTRMIOS": "syscall", - "syscall.TIOCGLINED": "syscall", - "syscall.TIOCGPGRP": "syscall", - "syscall.TIOCGPTN": "syscall", - "syscall.TIOCGQSIZE": "syscall", - "syscall.TIOCGRANTPT": "syscall", - "syscall.TIOCGRS485": "syscall", - "syscall.TIOCGSERIAL": "syscall", - "syscall.TIOCGSID": "syscall", - "syscall.TIOCGSIZE": "syscall", - "syscall.TIOCGSOFTCAR": "syscall", - "syscall.TIOCGTSTAMP": "syscall", - "syscall.TIOCGWINSZ": "syscall", - "syscall.TIOCINQ": "syscall", - "syscall.TIOCIXOFF": "syscall", - "syscall.TIOCIXON": "syscall", - "syscall.TIOCLINUX": "syscall", - "syscall.TIOCMBIC": "syscall", - "syscall.TIOCMBIS": "syscall", - "syscall.TIOCMGDTRWAIT": "syscall", - "syscall.TIOCMGET": "syscall", - "syscall.TIOCMIWAIT": "syscall", - "syscall.TIOCMODG": "syscall", - "syscall.TIOCMODS": "syscall", - "syscall.TIOCMSDTRWAIT": "syscall", - "syscall.TIOCMSET": "syscall", - "syscall.TIOCM_CAR": "syscall", - "syscall.TIOCM_CD": "syscall", - "syscall.TIOCM_CTS": "syscall", - "syscall.TIOCM_DCD": "syscall", - "syscall.TIOCM_DSR": "syscall", - "syscall.TIOCM_DTR": "syscall", - "syscall.TIOCM_LE": "syscall", - "syscall.TIOCM_RI": "syscall", - "syscall.TIOCM_RNG": "syscall", - "syscall.TIOCM_RTS": "syscall", - "syscall.TIOCM_SR": "syscall", - "syscall.TIOCM_ST": "syscall", - "syscall.TIOCNOTTY": "syscall", - "syscall.TIOCNXCL": "syscall", - "syscall.TIOCOUTQ": "syscall", - "syscall.TIOCPKT": "syscall", - "syscall.TIOCPKT_DATA": "syscall", - "syscall.TIOCPKT_DOSTOP": "syscall", - "syscall.TIOCPKT_FLUSHREAD": "syscall", - "syscall.TIOCPKT_FLUSHWRITE": "syscall", - "syscall.TIOCPKT_IOCTL": "syscall", - "syscall.TIOCPKT_NOSTOP": "syscall", - "syscall.TIOCPKT_START": "syscall", - "syscall.TIOCPKT_STOP": "syscall", - "syscall.TIOCPTMASTER": "syscall", - "syscall.TIOCPTMGET": "syscall", - "syscall.TIOCPTSNAME": "syscall", - "syscall.TIOCPTYGNAME": "syscall", - "syscall.TIOCPTYGRANT": "syscall", - "syscall.TIOCPTYUNLK": "syscall", - "syscall.TIOCRCVFRAME": "syscall", - "syscall.TIOCREMOTE": "syscall", - "syscall.TIOCSBRK": "syscall", - "syscall.TIOCSCONS": "syscall", - "syscall.TIOCSCTTY": "syscall", - "syscall.TIOCSDRAINWAIT": "syscall", - "syscall.TIOCSDTR": "syscall", - "syscall.TIOCSERCONFIG": "syscall", - "syscall.TIOCSERGETLSR": "syscall", - "syscall.TIOCSERGETMULTI": "syscall", - "syscall.TIOCSERGSTRUCT": "syscall", - "syscall.TIOCSERGWILD": "syscall", - "syscall.TIOCSERSETMULTI": "syscall", - "syscall.TIOCSERSWILD": "syscall", - "syscall.TIOCSER_TEMT": "syscall", - "syscall.TIOCSETA": "syscall", - "syscall.TIOCSETAF": "syscall", - "syscall.TIOCSETAW": "syscall", - "syscall.TIOCSETD": "syscall", - "syscall.TIOCSFLAGS": "syscall", - "syscall.TIOCSIG": "syscall", - "syscall.TIOCSLCKTRMIOS": "syscall", - "syscall.TIOCSLINED": "syscall", - "syscall.TIOCSPGRP": "syscall", - "syscall.TIOCSPTLCK": "syscall", - "syscall.TIOCSQSIZE": "syscall", - "syscall.TIOCSRS485": "syscall", - "syscall.TIOCSSERIAL": "syscall", - "syscall.TIOCSSIZE": "syscall", - "syscall.TIOCSSOFTCAR": "syscall", - "syscall.TIOCSTART": "syscall", - "syscall.TIOCSTAT": "syscall", - "syscall.TIOCSTI": "syscall", - "syscall.TIOCSTOP": "syscall", - "syscall.TIOCSTSTAMP": "syscall", - "syscall.TIOCSWINSZ": "syscall", - "syscall.TIOCTIMESTAMP": "syscall", - "syscall.TIOCUCNTL": "syscall", - "syscall.TIOCVHANGUP": "syscall", - "syscall.TIOCXMTFRAME": "syscall", - "syscall.TOKEN_ADJUST_DEFAULT": "syscall", - "syscall.TOKEN_ADJUST_GROUPS": "syscall", - "syscall.TOKEN_ADJUST_PRIVILEGES": "syscall", - "syscall.TOKEN_ALL_ACCESS": "syscall", - "syscall.TOKEN_ASSIGN_PRIMARY": "syscall", - "syscall.TOKEN_DUPLICATE": "syscall", - "syscall.TOKEN_EXECUTE": "syscall", - "syscall.TOKEN_IMPERSONATE": "syscall", - "syscall.TOKEN_QUERY": "syscall", - "syscall.TOKEN_QUERY_SOURCE": "syscall", - "syscall.TOKEN_READ": "syscall", - "syscall.TOKEN_WRITE": "syscall", - "syscall.TOSTOP": "syscall", - "syscall.TRUNCATE_EXISTING": "syscall", - "syscall.TUNATTACHFILTER": "syscall", - "syscall.TUNDETACHFILTER": "syscall", - "syscall.TUNGETFEATURES": "syscall", - "syscall.TUNGETIFF": "syscall", - "syscall.TUNGETSNDBUF": "syscall", - "syscall.TUNGETVNETHDRSZ": "syscall", - "syscall.TUNSETDEBUG": "syscall", - "syscall.TUNSETGROUP": "syscall", - "syscall.TUNSETIFF": "syscall", - "syscall.TUNSETLINK": "syscall", - "syscall.TUNSETNOCSUM": "syscall", - "syscall.TUNSETOFFLOAD": "syscall", - "syscall.TUNSETOWNER": "syscall", - "syscall.TUNSETPERSIST": "syscall", - "syscall.TUNSETSNDBUF": "syscall", - "syscall.TUNSETTXFILTER": "syscall", - "syscall.TUNSETVNETHDRSZ": "syscall", - "syscall.Tee": "syscall", - "syscall.TerminateProcess": "syscall", - "syscall.Termios": "syscall", - "syscall.Tgkill": "syscall", - "syscall.Time": "syscall", - "syscall.Time_t": "syscall", - "syscall.Times": "syscall", - "syscall.Timespec": "syscall", - "syscall.TimespecToNsec": "syscall", - "syscall.Timeval": "syscall", - "syscall.Timeval32": "syscall", - "syscall.TimevalToNsec": "syscall", - "syscall.Timex": "syscall", - "syscall.Timezoneinformation": "syscall", - "syscall.Tms": "syscall", - "syscall.Token": "syscall", - "syscall.TokenAccessInformation": "syscall", - "syscall.TokenAuditPolicy": "syscall", - "syscall.TokenDefaultDacl": "syscall", - "syscall.TokenElevation": "syscall", - "syscall.TokenElevationType": "syscall", - "syscall.TokenGroups": "syscall", - "syscall.TokenGroupsAndPrivileges": "syscall", - "syscall.TokenHasRestrictions": "syscall", - "syscall.TokenImpersonationLevel": "syscall", - "syscall.TokenIntegrityLevel": "syscall", - "syscall.TokenLinkedToken": "syscall", - "syscall.TokenLogonSid": "syscall", - "syscall.TokenMandatoryPolicy": "syscall", - "syscall.TokenOrigin": "syscall", - "syscall.TokenOwner": "syscall", - "syscall.TokenPrimaryGroup": "syscall", - "syscall.TokenPrivileges": "syscall", - "syscall.TokenRestrictedSids": "syscall", - "syscall.TokenSandBoxInert": "syscall", - "syscall.TokenSessionId": "syscall", - "syscall.TokenSessionReference": "syscall", - "syscall.TokenSource": "syscall", - "syscall.TokenStatistics": "syscall", - "syscall.TokenType": "syscall", - "syscall.TokenUIAccess": "syscall", - "syscall.TokenUser": "syscall", - "syscall.TokenVirtualizationAllowed": "syscall", - "syscall.TokenVirtualizationEnabled": "syscall", - "syscall.Tokenprimarygroup": "syscall", - "syscall.Tokenuser": "syscall", - "syscall.TranslateAccountName": "syscall", - "syscall.TranslateName": "syscall", - "syscall.TransmitFile": "syscall", - "syscall.TransmitFileBuffers": "syscall", - "syscall.Truncate": "syscall", - "syscall.USAGE_MATCH_TYPE_AND": "syscall", - "syscall.USAGE_MATCH_TYPE_OR": "syscall", - "syscall.UTF16FromString": "syscall", - "syscall.UTF16PtrFromString": "syscall", - "syscall.UTF16ToString": "syscall", - "syscall.Ucred": "syscall", - "syscall.Umask": "syscall", - "syscall.Uname": "syscall", - "syscall.Undelete": "syscall", - "syscall.UnixCredentials": "syscall", - "syscall.UnixRights": "syscall", - "syscall.Unlink": "syscall", - "syscall.Unlinkat": "syscall", - "syscall.UnmapViewOfFile": "syscall", - "syscall.Unmount": "syscall", - "syscall.Unsetenv": "syscall", - "syscall.Unshare": "syscall", - "syscall.UserInfo10": "syscall", - "syscall.Ustat": "syscall", - "syscall.Ustat_t": "syscall", - "syscall.Utimbuf": "syscall", - "syscall.Utime": "syscall", - "syscall.Utimes": "syscall", - "syscall.UtimesNano": "syscall", - "syscall.Utsname": "syscall", - "syscall.VDISCARD": "syscall", - "syscall.VDSUSP": "syscall", - "syscall.VEOF": "syscall", - "syscall.VEOL": "syscall", - "syscall.VEOL2": "syscall", - "syscall.VERASE": "syscall", - "syscall.VERASE2": "syscall", - "syscall.VINTR": "syscall", - "syscall.VKILL": "syscall", - "syscall.VLNEXT": "syscall", - "syscall.VMIN": "syscall", - "syscall.VQUIT": "syscall", - "syscall.VREPRINT": "syscall", - "syscall.VSTART": "syscall", - "syscall.VSTATUS": "syscall", - "syscall.VSTOP": "syscall", - "syscall.VSUSP": "syscall", - "syscall.VSWTC": "syscall", - "syscall.VT0": "syscall", - "syscall.VT1": "syscall", - "syscall.VTDLY": "syscall", - "syscall.VTIME": "syscall", - "syscall.VWERASE": "syscall", - "syscall.VirtualLock": "syscall", - "syscall.VirtualUnlock": "syscall", - "syscall.WAIT_ABANDONED": "syscall", - "syscall.WAIT_FAILED": "syscall", - "syscall.WAIT_OBJECT_0": "syscall", - "syscall.WAIT_TIMEOUT": "syscall", - "syscall.WALL": "syscall", - "syscall.WALLSIG": "syscall", - "syscall.WALTSIG": "syscall", - "syscall.WCLONE": "syscall", - "syscall.WCONTINUED": "syscall", - "syscall.WCOREFLAG": "syscall", - "syscall.WEXITED": "syscall", - "syscall.WLINUXCLONE": "syscall", - "syscall.WNOHANG": "syscall", - "syscall.WNOTHREAD": "syscall", - "syscall.WNOWAIT": "syscall", - "syscall.WNOZOMBIE": "syscall", - "syscall.WOPTSCHECKED": "syscall", - "syscall.WORDSIZE": "syscall", - "syscall.WSABuf": "syscall", - "syscall.WSACleanup": "syscall", - "syscall.WSADESCRIPTION_LEN": "syscall", - "syscall.WSAData": "syscall", - "syscall.WSAEACCES": "syscall", - "syscall.WSAECONNRESET": "syscall", - "syscall.WSAEnumProtocols": "syscall", - "syscall.WSAID_CONNECTEX": "syscall", - "syscall.WSAIoctl": "syscall", - "syscall.WSAPROTOCOL_LEN": "syscall", - "syscall.WSAProtocolChain": "syscall", - "syscall.WSAProtocolInfo": "syscall", - "syscall.WSARecv": "syscall", - "syscall.WSARecvFrom": "syscall", - "syscall.WSASYS_STATUS_LEN": "syscall", - "syscall.WSASend": "syscall", - "syscall.WSASendTo": "syscall", - "syscall.WSASendto": "syscall", - "syscall.WSAStartup": "syscall", - "syscall.WSTOPPED": "syscall", - "syscall.WTRAPPED": "syscall", - "syscall.WUNTRACED": "syscall", - "syscall.Wait4": "syscall", - "syscall.WaitForSingleObject": "syscall", - "syscall.WaitStatus": "syscall", - "syscall.Win32FileAttributeData": "syscall", - "syscall.Win32finddata": "syscall", - "syscall.Write": "syscall", - "syscall.WriteConsole": "syscall", - "syscall.WriteFile": "syscall", - "syscall.X509_ASN_ENCODING": "syscall", - "syscall.XCASE": "syscall", - "syscall.XP1_CONNECTIONLESS": "syscall", - "syscall.XP1_CONNECT_DATA": "syscall", - "syscall.XP1_DISCONNECT_DATA": "syscall", - "syscall.XP1_EXPEDITED_DATA": "syscall", - "syscall.XP1_GRACEFUL_CLOSE": "syscall", - "syscall.XP1_GUARANTEED_DELIVERY": "syscall", - "syscall.XP1_GUARANTEED_ORDER": "syscall", - "syscall.XP1_IFS_HANDLES": "syscall", - "syscall.XP1_MESSAGE_ORIENTED": "syscall", - "syscall.XP1_MULTIPOINT_CONTROL_PLANE": "syscall", - "syscall.XP1_MULTIPOINT_DATA_PLANE": "syscall", - "syscall.XP1_PARTIAL_MESSAGE": "syscall", - "syscall.XP1_PSEUDO_STREAM": "syscall", - "syscall.XP1_QOS_SUPPORTED": "syscall", - "syscall.XP1_SAN_SUPPORT_SDP": "syscall", - "syscall.XP1_SUPPORT_BROADCAST": "syscall", - "syscall.XP1_SUPPORT_MULTIPOINT": "syscall", - "syscall.XP1_UNI_RECV": "syscall", - "syscall.XP1_UNI_SEND": "syscall", - "syslog.Dial": "log/syslog", - "syslog.LOG_ALERT": "log/syslog", - "syslog.LOG_AUTH": "log/syslog", - "syslog.LOG_AUTHPRIV": "log/syslog", - "syslog.LOG_CRIT": "log/syslog", - "syslog.LOG_CRON": "log/syslog", - "syslog.LOG_DAEMON": "log/syslog", - "syslog.LOG_DEBUG": "log/syslog", - "syslog.LOG_EMERG": "log/syslog", - "syslog.LOG_ERR": "log/syslog", - "syslog.LOG_FTP": "log/syslog", - "syslog.LOG_INFO": "log/syslog", - "syslog.LOG_KERN": "log/syslog", - "syslog.LOG_LOCAL0": "log/syslog", - "syslog.LOG_LOCAL1": "log/syslog", - "syslog.LOG_LOCAL2": "log/syslog", - "syslog.LOG_LOCAL3": "log/syslog", - "syslog.LOG_LOCAL4": "log/syslog", - "syslog.LOG_LOCAL5": "log/syslog", - "syslog.LOG_LOCAL6": "log/syslog", - "syslog.LOG_LOCAL7": "log/syslog", - "syslog.LOG_LPR": "log/syslog", - "syslog.LOG_MAIL": "log/syslog", - "syslog.LOG_NEWS": "log/syslog", - "syslog.LOG_NOTICE": "log/syslog", - "syslog.LOG_SYSLOG": "log/syslog", - "syslog.LOG_USER": "log/syslog", - "syslog.LOG_UUCP": "log/syslog", - "syslog.LOG_WARNING": "log/syslog", - "syslog.New": "log/syslog", - "syslog.NewLogger": "log/syslog", - "syslog.Priority": "log/syslog", - "syslog.Writer": "log/syslog", - "tabwriter.AlignRight": "text/tabwriter", - "tabwriter.Debug": "text/tabwriter", - "tabwriter.DiscardEmptyColumns": "text/tabwriter", - "tabwriter.Escape": "text/tabwriter", - "tabwriter.FilterHTML": "text/tabwriter", - "tabwriter.NewWriter": "text/tabwriter", - "tabwriter.StripEscape": "text/tabwriter", - "tabwriter.TabIndent": "text/tabwriter", - "tabwriter.Writer": "text/tabwriter", - "tar.ErrFieldTooLong": "archive/tar", - "tar.ErrHeader": "archive/tar", - "tar.ErrWriteAfterClose": "archive/tar", - "tar.ErrWriteTooLong": "archive/tar", - "tar.FileInfoHeader": "archive/tar", - "tar.Header": "archive/tar", - "tar.NewReader": "archive/tar", - "tar.NewWriter": "archive/tar", - "tar.Reader": "archive/tar", - "tar.TypeBlock": "archive/tar", - "tar.TypeChar": "archive/tar", - "tar.TypeCont": "archive/tar", - "tar.TypeDir": "archive/tar", - "tar.TypeFifo": "archive/tar", - "tar.TypeGNULongLink": "archive/tar", - "tar.TypeGNULongName": "archive/tar", - "tar.TypeGNUSparse": "archive/tar", - "tar.TypeLink": "archive/tar", - "tar.TypeReg": "archive/tar", - "tar.TypeRegA": "archive/tar", - "tar.TypeSymlink": "archive/tar", - "tar.TypeXGlobalHeader": "archive/tar", - "tar.TypeXHeader": "archive/tar", - "tar.Writer": "archive/tar", - "template.CSS": "html/template", - "template.ErrAmbigContext": "html/template", - "template.ErrBadHTML": "html/template", - "template.ErrBranchEnd": "html/template", - "template.ErrEndContext": "html/template", - "template.ErrNoSuchTemplate": "html/template", - "template.ErrOutputContext": "html/template", - "template.ErrPartialCharset": "html/template", - "template.ErrPartialEscape": "html/template", - "template.ErrRangeLoopReentry": "html/template", - "template.ErrSlashAmbig": "html/template", - "template.Error": "html/template", - "template.ErrorCode": "html/template", - "template.ExecError": "text/template", - // "template.FuncMap" is ambiguous - "template.HTML": "html/template", - "template.HTMLAttr": "html/template", - // "template.HTMLEscape" is ambiguous - // "template.HTMLEscapeString" is ambiguous - // "template.HTMLEscaper" is ambiguous - // "template.IsTrue" is ambiguous - "template.JS": "html/template", - // "template.JSEscape" is ambiguous - // "template.JSEscapeString" is ambiguous - // "template.JSEscaper" is ambiguous - "template.JSStr": "html/template", - // "template.Must" is ambiguous - // "template.New" is ambiguous - "template.OK": "html/template", - // "template.ParseFiles" is ambiguous - // "template.ParseGlob" is ambiguous - // "template.Template" is ambiguous - "template.URL": "html/template", - // "template.URLQueryEscaper" is ambiguous - "testing.AllocsPerRun": "testing", - "testing.B": "testing", - "testing.Benchmark": "testing", - "testing.BenchmarkResult": "testing", - "testing.Cover": "testing", - "testing.CoverBlock": "testing", - "testing.Coverage": "testing", - "testing.InternalBenchmark": "testing", - "testing.InternalExample": "testing", - "testing.InternalTest": "testing", - "testing.M": "testing", - "testing.Main": "testing", - "testing.MainStart": "testing", - "testing.PB": "testing", - "testing.RegisterCover": "testing", - "testing.RunBenchmarks": "testing", - "testing.RunExamples": "testing", - "testing.RunTests": "testing", - "testing.Short": "testing", - "testing.T": "testing", - "testing.Verbose": "testing", - "textproto.CanonicalMIMEHeaderKey": "net/textproto", - "textproto.Conn": "net/textproto", - "textproto.Dial": "net/textproto", - "textproto.Error": "net/textproto", - "textproto.MIMEHeader": "net/textproto", - "textproto.NewConn": "net/textproto", - "textproto.NewReader": "net/textproto", - "textproto.NewWriter": "net/textproto", - "textproto.Pipeline": "net/textproto", - "textproto.ProtocolError": "net/textproto", - "textproto.Reader": "net/textproto", - "textproto.TrimBytes": "net/textproto", - "textproto.TrimString": "net/textproto", - "textproto.Writer": "net/textproto", - "time.ANSIC": "time", - "time.After": "time", - "time.AfterFunc": "time", - "time.April": "time", - "time.August": "time", - "time.Date": "time", - "time.December": "time", - "time.Duration": "time", - "time.February": "time", - "time.FixedZone": "time", - "time.Friday": "time", - "time.Hour": "time", - "time.January": "time", - "time.July": "time", - "time.June": "time", - "time.Kitchen": "time", - "time.LoadLocation": "time", - "time.Local": "time", - "time.Location": "time", - "time.March": "time", - "time.May": "time", - "time.Microsecond": "time", - "time.Millisecond": "time", - "time.Minute": "time", - "time.Monday": "time", - "time.Month": "time", - "time.Nanosecond": "time", - "time.NewTicker": "time", - "time.NewTimer": "time", - "time.November": "time", - "time.Now": "time", - "time.October": "time", - "time.Parse": "time", - "time.ParseDuration": "time", - "time.ParseError": "time", - "time.ParseInLocation": "time", - "time.RFC1123": "time", - "time.RFC1123Z": "time", - "time.RFC3339": "time", - "time.RFC3339Nano": "time", - "time.RFC822": "time", - "time.RFC822Z": "time", - "time.RFC850": "time", - "time.RubyDate": "time", - "time.Saturday": "time", - "time.Second": "time", - "time.September": "time", - "time.Since": "time", - "time.Sleep": "time", - "time.Stamp": "time", - "time.StampMicro": "time", - "time.StampMilli": "time", - "time.StampNano": "time", - "time.Sunday": "time", - "time.Thursday": "time", - "time.Tick": "time", - "time.Ticker": "time", - "time.Time": "time", - "time.Timer": "time", - "time.Tuesday": "time", - "time.UTC": "time", - "time.Unix": "time", - "time.UnixDate": "time", - "time.Wednesday": "time", - "time.Weekday": "time", - "tls.Certificate": "crypto/tls", - "tls.Client": "crypto/tls", - "tls.ClientAuthType": "crypto/tls", - "tls.ClientHelloInfo": "crypto/tls", - "tls.ClientSessionCache": "crypto/tls", - "tls.ClientSessionState": "crypto/tls", - "tls.Config": "crypto/tls", - "tls.Conn": "crypto/tls", - "tls.ConnectionState": "crypto/tls", - "tls.CurveID": "crypto/tls", - "tls.CurveP256": "crypto/tls", - "tls.CurveP384": "crypto/tls", - "tls.CurveP521": "crypto/tls", - "tls.Dial": "crypto/tls", - "tls.DialWithDialer": "crypto/tls", - "tls.Listen": "crypto/tls", - "tls.LoadX509KeyPair": "crypto/tls", - "tls.NewLRUClientSessionCache": "crypto/tls", - "tls.NewListener": "crypto/tls", - "tls.NoClientCert": "crypto/tls", - "tls.RecordHeaderError": "crypto/tls", - "tls.RenegotiateFreelyAsClient": "crypto/tls", - "tls.RenegotiateNever": "crypto/tls", - "tls.RenegotiateOnceAsClient": "crypto/tls", - "tls.RenegotiationSupport": "crypto/tls", - "tls.RequestClientCert": "crypto/tls", - "tls.RequireAndVerifyClientCert": "crypto/tls", - "tls.RequireAnyClientCert": "crypto/tls", - "tls.Server": "crypto/tls", - "tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA": "crypto/tls", - "tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256": "crypto/tls", - "tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA": "crypto/tls", - "tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384": "crypto/tls", - "tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA": "crypto/tls", - "tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA": "crypto/tls", - "tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA": "crypto/tls", - "tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256": "crypto/tls", - "tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA": "crypto/tls", - "tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384": "crypto/tls", - "tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA": "crypto/tls", - "tls.TLS_FALLBACK_SCSV": "crypto/tls", - "tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA": "crypto/tls", - "tls.TLS_RSA_WITH_AES_128_CBC_SHA": "crypto/tls", - "tls.TLS_RSA_WITH_AES_128_GCM_SHA256": "crypto/tls", - "tls.TLS_RSA_WITH_AES_256_CBC_SHA": "crypto/tls", - "tls.TLS_RSA_WITH_AES_256_GCM_SHA384": "crypto/tls", - "tls.TLS_RSA_WITH_RC4_128_SHA": "crypto/tls", - "tls.VerifyClientCertIfGiven": "crypto/tls", - "tls.VersionSSL30": "crypto/tls", - "tls.VersionTLS10": "crypto/tls", - "tls.VersionTLS11": "crypto/tls", - "tls.VersionTLS12": "crypto/tls", - "tls.X509KeyPair": "crypto/tls", - "token.ADD": "go/token", - "token.ADD_ASSIGN": "go/token", - "token.AND": "go/token", - "token.AND_ASSIGN": "go/token", - "token.AND_NOT": "go/token", - "token.AND_NOT_ASSIGN": "go/token", - "token.ARROW": "go/token", - "token.ASSIGN": "go/token", - "token.BREAK": "go/token", - "token.CASE": "go/token", - "token.CHAN": "go/token", - "token.CHAR": "go/token", - "token.COLON": "go/token", - "token.COMMA": "go/token", - "token.COMMENT": "go/token", - "token.CONST": "go/token", - "token.CONTINUE": "go/token", - "token.DEC": "go/token", - "token.DEFAULT": "go/token", - "token.DEFER": "go/token", - "token.DEFINE": "go/token", - "token.ELLIPSIS": "go/token", - "token.ELSE": "go/token", - "token.EOF": "go/token", - "token.EQL": "go/token", - "token.FALLTHROUGH": "go/token", - "token.FLOAT": "go/token", - "token.FOR": "go/token", - "token.FUNC": "go/token", - "token.File": "go/token", - "token.FileSet": "go/token", - "token.GEQ": "go/token", - "token.GO": "go/token", - "token.GOTO": "go/token", - "token.GTR": "go/token", - "token.HighestPrec": "go/token", - "token.IDENT": "go/token", - "token.IF": "go/token", - "token.ILLEGAL": "go/token", - "token.IMAG": "go/token", - "token.IMPORT": "go/token", - "token.INC": "go/token", - "token.INT": "go/token", - "token.INTERFACE": "go/token", - "token.LAND": "go/token", - "token.LBRACE": "go/token", - "token.LBRACK": "go/token", - "token.LEQ": "go/token", - "token.LOR": "go/token", - "token.LPAREN": "go/token", - "token.LSS": "go/token", - "token.Lookup": "go/token", - "token.LowestPrec": "go/token", - "token.MAP": "go/token", - "token.MUL": "go/token", - "token.MUL_ASSIGN": "go/token", - "token.NEQ": "go/token", - "token.NOT": "go/token", - "token.NewFileSet": "go/token", - "token.NoPos": "go/token", - "token.OR": "go/token", - "token.OR_ASSIGN": "go/token", - "token.PACKAGE": "go/token", - "token.PERIOD": "go/token", - "token.Pos": "go/token", - "token.Position": "go/token", - "token.QUO": "go/token", - "token.QUO_ASSIGN": "go/token", - "token.RANGE": "go/token", - "token.RBRACE": "go/token", - "token.RBRACK": "go/token", - "token.REM": "go/token", - "token.REM_ASSIGN": "go/token", - "token.RETURN": "go/token", - "token.RPAREN": "go/token", - "token.SELECT": "go/token", - "token.SEMICOLON": "go/token", - "token.SHL": "go/token", - "token.SHL_ASSIGN": "go/token", - "token.SHR": "go/token", - "token.SHR_ASSIGN": "go/token", - "token.STRING": "go/token", - "token.STRUCT": "go/token", - "token.SUB": "go/token", - "token.SUB_ASSIGN": "go/token", - "token.SWITCH": "go/token", - "token.TYPE": "go/token", - "token.Token": "go/token", - "token.UnaryPrec": "go/token", - "token.VAR": "go/token", - "token.XOR": "go/token", - "token.XOR_ASSIGN": "go/token", - "trace.Start": "runtime/trace", - "trace.Stop": "runtime/trace", - "types.Array": "go/types", - "types.AssertableTo": "go/types", - "types.AssignableTo": "go/types", - "types.Basic": "go/types", - "types.BasicInfo": "go/types", - "types.BasicKind": "go/types", - "types.Bool": "go/types", - "types.Builtin": "go/types", - "types.Byte": "go/types", - "types.Chan": "go/types", - "types.ChanDir": "go/types", - "types.Checker": "go/types", - "types.Comparable": "go/types", - "types.Complex128": "go/types", - "types.Complex64": "go/types", - "types.Config": "go/types", - "types.Const": "go/types", - "types.ConvertibleTo": "go/types", - "types.DefPredeclaredTestFuncs": "go/types", - "types.Error": "go/types", - "types.Eval": "go/types", - "types.ExprString": "go/types", - "types.FieldVal": "go/types", - "types.Float32": "go/types", - "types.Float64": "go/types", - "types.Func": "go/types", - "types.Id": "go/types", - "types.Identical": "go/types", - "types.Implements": "go/types", - "types.ImportMode": "go/types", - "types.Importer": "go/types", - "types.ImporterFrom": "go/types", - "types.Info": "go/types", - "types.Initializer": "go/types", - "types.Int": "go/types", - "types.Int16": "go/types", - "types.Int32": "go/types", - "types.Int64": "go/types", - "types.Int8": "go/types", - "types.Interface": "go/types", - "types.Invalid": "go/types", - "types.IsBoolean": "go/types", - "types.IsComplex": "go/types", - "types.IsConstType": "go/types", - "types.IsFloat": "go/types", - "types.IsInteger": "go/types", - "types.IsInterface": "go/types", - "types.IsNumeric": "go/types", - "types.IsOrdered": "go/types", - "types.IsString": "go/types", - "types.IsUnsigned": "go/types", - "types.IsUntyped": "go/types", - "types.Label": "go/types", - "types.LookupFieldOrMethod": "go/types", - "types.Map": "go/types", - "types.MethodExpr": "go/types", - "types.MethodSet": "go/types", - "types.MethodVal": "go/types", - "types.MissingMethod": "go/types", - "types.Named": "go/types", - "types.NewArray": "go/types", - "types.NewChan": "go/types", - "types.NewChecker": "go/types", - "types.NewConst": "go/types", - "types.NewField": "go/types", - "types.NewFunc": "go/types", - "types.NewInterface": "go/types", - "types.NewLabel": "go/types", - "types.NewMap": "go/types", - "types.NewMethodSet": "go/types", - "types.NewNamed": "go/types", - "types.NewPackage": "go/types", - "types.NewParam": "go/types", - "types.NewPkgName": "go/types", - "types.NewPointer": "go/types", - "types.NewScope": "go/types", - "types.NewSignature": "go/types", - "types.NewSlice": "go/types", - "types.NewStruct": "go/types", - "types.NewTuple": "go/types", - "types.NewTypeName": "go/types", - "types.NewVar": "go/types", - "types.Nil": "go/types", - "types.ObjectString": "go/types", - "types.Package": "go/types", - "types.PkgName": "go/types", - "types.Pointer": "go/types", - "types.Qualifier": "go/types", - "types.RecvOnly": "go/types", - "types.RelativeTo": "go/types", - "types.Rune": "go/types", - "types.Scope": "go/types", - "types.Selection": "go/types", - "types.SelectionKind": "go/types", - "types.SelectionString": "go/types", - "types.SendOnly": "go/types", - "types.SendRecv": "go/types", - "types.Signature": "go/types", - "types.Sizes": "go/types", - "types.Slice": "go/types", - "types.StdSizes": "go/types", - "types.String": "go/types", - "types.Struct": "go/types", - "types.Tuple": "go/types", - "types.Typ": "go/types", - "types.Type": "go/types", - "types.TypeAndValue": "go/types", - "types.TypeName": "go/types", - "types.TypeString": "go/types", - "types.Uint": "go/types", - "types.Uint16": "go/types", - "types.Uint32": "go/types", - "types.Uint64": "go/types", - "types.Uint8": "go/types", - "types.Uintptr": "go/types", - "types.Universe": "go/types", - "types.Unsafe": "go/types", - "types.UnsafePointer": "go/types", - "types.UntypedBool": "go/types", - "types.UntypedComplex": "go/types", - "types.UntypedFloat": "go/types", - "types.UntypedInt": "go/types", - "types.UntypedNil": "go/types", - "types.UntypedRune": "go/types", - "types.UntypedString": "go/types", - "types.Var": "go/types", - "types.WriteExpr": "go/types", - "types.WriteSignature": "go/types", - "types.WriteType": "go/types", - "unicode.ASCII_Hex_Digit": "unicode", - "unicode.Adlam": "unicode", - "unicode.Ahom": "unicode", - "unicode.Anatolian_Hieroglyphs": "unicode", - "unicode.Arabic": "unicode", - "unicode.Armenian": "unicode", - "unicode.Avestan": "unicode", - "unicode.AzeriCase": "unicode", - "unicode.Balinese": "unicode", - "unicode.Bamum": "unicode", - "unicode.Bassa_Vah": "unicode", - "unicode.Batak": "unicode", - "unicode.Bengali": "unicode", - "unicode.Bhaiksuki": "unicode", - "unicode.Bidi_Control": "unicode", - "unicode.Bopomofo": "unicode", - "unicode.Brahmi": "unicode", - "unicode.Braille": "unicode", - "unicode.Buginese": "unicode", - "unicode.Buhid": "unicode", - "unicode.C": "unicode", - "unicode.Canadian_Aboriginal": "unicode", - "unicode.Carian": "unicode", - "unicode.CaseRange": "unicode", - "unicode.CaseRanges": "unicode", - "unicode.Categories": "unicode", - "unicode.Caucasian_Albanian": "unicode", - "unicode.Cc": "unicode", - "unicode.Cf": "unicode", - "unicode.Chakma": "unicode", - "unicode.Cham": "unicode", - "unicode.Cherokee": "unicode", - "unicode.Co": "unicode", - "unicode.Common": "unicode", - "unicode.Coptic": "unicode", - "unicode.Cs": "unicode", - "unicode.Cuneiform": "unicode", - "unicode.Cypriot": "unicode", - "unicode.Cyrillic": "unicode", - "unicode.Dash": "unicode", - "unicode.Deprecated": "unicode", - "unicode.Deseret": "unicode", - "unicode.Devanagari": "unicode", - "unicode.Diacritic": "unicode", - "unicode.Digit": "unicode", - "unicode.Duployan": "unicode", - "unicode.Egyptian_Hieroglyphs": "unicode", - "unicode.Elbasan": "unicode", - "unicode.Ethiopic": "unicode", - "unicode.Extender": "unicode", - "unicode.FoldCategory": "unicode", - "unicode.FoldScript": "unicode", - "unicode.Georgian": "unicode", - "unicode.Glagolitic": "unicode", - "unicode.Gothic": "unicode", - "unicode.Grantha": "unicode", - "unicode.GraphicRanges": "unicode", - "unicode.Greek": "unicode", - "unicode.Gujarati": "unicode", - "unicode.Gurmukhi": "unicode", - "unicode.Han": "unicode", - "unicode.Hangul": "unicode", - "unicode.Hanunoo": "unicode", - "unicode.Hatran": "unicode", - "unicode.Hebrew": "unicode", - "unicode.Hex_Digit": "unicode", - "unicode.Hiragana": "unicode", - "unicode.Hyphen": "unicode", - "unicode.IDS_Binary_Operator": "unicode", - "unicode.IDS_Trinary_Operator": "unicode", - "unicode.Ideographic": "unicode", - "unicode.Imperial_Aramaic": "unicode", - "unicode.In": "unicode", - "unicode.Inherited": "unicode", - "unicode.Inscriptional_Pahlavi": "unicode", - "unicode.Inscriptional_Parthian": "unicode", - "unicode.Is": "unicode", - "unicode.IsControl": "unicode", - "unicode.IsDigit": "unicode", - "unicode.IsGraphic": "unicode", - "unicode.IsLetter": "unicode", - "unicode.IsLower": "unicode", - "unicode.IsMark": "unicode", - "unicode.IsNumber": "unicode", - "unicode.IsOneOf": "unicode", - "unicode.IsPrint": "unicode", - "unicode.IsPunct": "unicode", - "unicode.IsSpace": "unicode", - "unicode.IsSymbol": "unicode", - "unicode.IsTitle": "unicode", - "unicode.IsUpper": "unicode", - "unicode.Javanese": "unicode", - "unicode.Join_Control": "unicode", - "unicode.Kaithi": "unicode", - "unicode.Kannada": "unicode", - "unicode.Katakana": "unicode", - "unicode.Kayah_Li": "unicode", - "unicode.Kharoshthi": "unicode", - "unicode.Khmer": "unicode", - "unicode.Khojki": "unicode", - "unicode.Khudawadi": "unicode", - "unicode.L": "unicode", - "unicode.Lao": "unicode", - "unicode.Latin": "unicode", - "unicode.Lepcha": "unicode", - "unicode.Letter": "unicode", - "unicode.Limbu": "unicode", - "unicode.Linear_A": "unicode", - "unicode.Linear_B": "unicode", - "unicode.Lisu": "unicode", - "unicode.Ll": "unicode", - "unicode.Lm": "unicode", - "unicode.Lo": "unicode", - "unicode.Logical_Order_Exception": "unicode", - "unicode.Lower": "unicode", - "unicode.LowerCase": "unicode", - "unicode.Lt": "unicode", - "unicode.Lu": "unicode", - "unicode.Lycian": "unicode", - "unicode.Lydian": "unicode", - "unicode.M": "unicode", - "unicode.Mahajani": "unicode", - "unicode.Malayalam": "unicode", - "unicode.Mandaic": "unicode", - "unicode.Manichaean": "unicode", - "unicode.Marchen": "unicode", - "unicode.Mark": "unicode", - "unicode.MaxASCII": "unicode", - "unicode.MaxCase": "unicode", - "unicode.MaxLatin1": "unicode", - "unicode.MaxRune": "unicode", - "unicode.Mc": "unicode", - "unicode.Me": "unicode", - "unicode.Meetei_Mayek": "unicode", - "unicode.Mende_Kikakui": "unicode", - "unicode.Meroitic_Cursive": "unicode", - "unicode.Meroitic_Hieroglyphs": "unicode", - "unicode.Miao": "unicode", - "unicode.Mn": "unicode", - "unicode.Modi": "unicode", - "unicode.Mongolian": "unicode", - "unicode.Mro": "unicode", - "unicode.Multani": "unicode", - "unicode.Myanmar": "unicode", - "unicode.N": "unicode", - "unicode.Nabataean": "unicode", - "unicode.Nd": "unicode", - "unicode.New_Tai_Lue": "unicode", - "unicode.Newa": "unicode", - "unicode.Nko": "unicode", - "unicode.Nl": "unicode", - "unicode.No": "unicode", - "unicode.Noncharacter_Code_Point": "unicode", - "unicode.Number": "unicode", - "unicode.Ogham": "unicode", - "unicode.Ol_Chiki": "unicode", - "unicode.Old_Hungarian": "unicode", - "unicode.Old_Italic": "unicode", - "unicode.Old_North_Arabian": "unicode", - "unicode.Old_Permic": "unicode", - "unicode.Old_Persian": "unicode", - "unicode.Old_South_Arabian": "unicode", - "unicode.Old_Turkic": "unicode", - "unicode.Oriya": "unicode", - "unicode.Osage": "unicode", - "unicode.Osmanya": "unicode", - "unicode.Other": "unicode", - "unicode.Other_Alphabetic": "unicode", - "unicode.Other_Default_Ignorable_Code_Point": "unicode", - "unicode.Other_Grapheme_Extend": "unicode", - "unicode.Other_ID_Continue": "unicode", - "unicode.Other_ID_Start": "unicode", - "unicode.Other_Lowercase": "unicode", - "unicode.Other_Math": "unicode", - "unicode.Other_Uppercase": "unicode", - "unicode.P": "unicode", - "unicode.Pahawh_Hmong": "unicode", - "unicode.Palmyrene": "unicode", - "unicode.Pattern_Syntax": "unicode", - "unicode.Pattern_White_Space": "unicode", - "unicode.Pau_Cin_Hau": "unicode", - "unicode.Pc": "unicode", - "unicode.Pd": "unicode", - "unicode.Pe": "unicode", - "unicode.Pf": "unicode", - "unicode.Phags_Pa": "unicode", - "unicode.Phoenician": "unicode", - "unicode.Pi": "unicode", - "unicode.Po": "unicode", - "unicode.Prepended_Concatenation_Mark": "unicode", - "unicode.PrintRanges": "unicode", - "unicode.Properties": "unicode", - "unicode.Ps": "unicode", - "unicode.Psalter_Pahlavi": "unicode", - "unicode.Punct": "unicode", - "unicode.Quotation_Mark": "unicode", - "unicode.Radical": "unicode", - "unicode.Range16": "unicode", - "unicode.Range32": "unicode", - "unicode.RangeTable": "unicode", - "unicode.Rejang": "unicode", - "unicode.ReplacementChar": "unicode", - "unicode.Runic": "unicode", - "unicode.S": "unicode", - "unicode.STerm": "unicode", - "unicode.Samaritan": "unicode", - "unicode.Saurashtra": "unicode", - "unicode.Sc": "unicode", - "unicode.Scripts": "unicode", - "unicode.Sentence_Terminal": "unicode", - "unicode.Sharada": "unicode", - "unicode.Shavian": "unicode", - "unicode.Siddham": "unicode", - "unicode.SignWriting": "unicode", - "unicode.SimpleFold": "unicode", - "unicode.Sinhala": "unicode", - "unicode.Sk": "unicode", - "unicode.Sm": "unicode", - "unicode.So": "unicode", - "unicode.Soft_Dotted": "unicode", - "unicode.Sora_Sompeng": "unicode", - "unicode.Space": "unicode", - "unicode.SpecialCase": "unicode", - "unicode.Sundanese": "unicode", - "unicode.Syloti_Nagri": "unicode", - "unicode.Symbol": "unicode", - "unicode.Syriac": "unicode", - "unicode.Tagalog": "unicode", - "unicode.Tagbanwa": "unicode", - "unicode.Tai_Le": "unicode", - "unicode.Tai_Tham": "unicode", - "unicode.Tai_Viet": "unicode", - "unicode.Takri": "unicode", - "unicode.Tamil": "unicode", - "unicode.Tangut": "unicode", - "unicode.Telugu": "unicode", - "unicode.Terminal_Punctuation": "unicode", - "unicode.Thaana": "unicode", - "unicode.Thai": "unicode", - "unicode.Tibetan": "unicode", - "unicode.Tifinagh": "unicode", - "unicode.Tirhuta": "unicode", - "unicode.Title": "unicode", - "unicode.TitleCase": "unicode", - "unicode.To": "unicode", - "unicode.ToLower": "unicode", - "unicode.ToTitle": "unicode", - "unicode.ToUpper": "unicode", - "unicode.TurkishCase": "unicode", - "unicode.Ugaritic": "unicode", - "unicode.Unified_Ideograph": "unicode", - "unicode.Upper": "unicode", - "unicode.UpperCase": "unicode", - "unicode.UpperLower": "unicode", - "unicode.Vai": "unicode", - "unicode.Variation_Selector": "unicode", - "unicode.Version": "unicode", - "unicode.Warang_Citi": "unicode", - "unicode.White_Space": "unicode", - "unicode.Yi": "unicode", - "unicode.Z": "unicode", - "unicode.Zl": "unicode", - "unicode.Zp": "unicode", - "unicode.Zs": "unicode", - "url.Error": "net/url", - "url.EscapeError": "net/url", - "url.InvalidHostError": "net/url", - "url.Parse": "net/url", - "url.ParseQuery": "net/url", - "url.ParseRequestURI": "net/url", - "url.QueryEscape": "net/url", - "url.QueryUnescape": "net/url", - "url.URL": "net/url", - "url.User": "net/url", - "url.UserPassword": "net/url", - "url.Userinfo": "net/url", - "url.Values": "net/url", - "user.Current": "os/user", - "user.Group": "os/user", - "user.Lookup": "os/user", - "user.LookupGroup": "os/user", - "user.LookupGroupId": "os/user", - "user.LookupId": "os/user", - "user.UnknownGroupError": "os/user", - "user.UnknownGroupIdError": "os/user", - "user.UnknownUserError": "os/user", - "user.UnknownUserIdError": "os/user", - "user.User": "os/user", - "utf16.Decode": "unicode/utf16", - "utf16.DecodeRune": "unicode/utf16", - "utf16.Encode": "unicode/utf16", - "utf16.EncodeRune": "unicode/utf16", - "utf16.IsSurrogate": "unicode/utf16", - "utf8.DecodeLastRune": "unicode/utf8", - "utf8.DecodeLastRuneInString": "unicode/utf8", - "utf8.DecodeRune": "unicode/utf8", - "utf8.DecodeRuneInString": "unicode/utf8", - "utf8.EncodeRune": "unicode/utf8", - "utf8.FullRune": "unicode/utf8", - "utf8.FullRuneInString": "unicode/utf8", - "utf8.MaxRune": "unicode/utf8", - "utf8.RuneCount": "unicode/utf8", - "utf8.RuneCountInString": "unicode/utf8", - "utf8.RuneError": "unicode/utf8", - "utf8.RuneLen": "unicode/utf8", - "utf8.RuneSelf": "unicode/utf8", - "utf8.RuneStart": "unicode/utf8", - "utf8.UTFMax": "unicode/utf8", - "utf8.Valid": "unicode/utf8", - "utf8.ValidRune": "unicode/utf8", - "utf8.ValidString": "unicode/utf8", - "x509.CANotAuthorizedForThisName": "crypto/x509", - "x509.CertPool": "crypto/x509", - "x509.Certificate": "crypto/x509", - "x509.CertificateInvalidError": "crypto/x509", - "x509.CertificateRequest": "crypto/x509", - "x509.ConstraintViolationError": "crypto/x509", - "x509.CreateCertificate": "crypto/x509", - "x509.CreateCertificateRequest": "crypto/x509", - "x509.DSA": "crypto/x509", - "x509.DSAWithSHA1": "crypto/x509", - "x509.DSAWithSHA256": "crypto/x509", - "x509.DecryptPEMBlock": "crypto/x509", - "x509.ECDSA": "crypto/x509", - "x509.ECDSAWithSHA1": "crypto/x509", - "x509.ECDSAWithSHA256": "crypto/x509", - "x509.ECDSAWithSHA384": "crypto/x509", - "x509.ECDSAWithSHA512": "crypto/x509", - "x509.EncryptPEMBlock": "crypto/x509", - "x509.ErrUnsupportedAlgorithm": "crypto/x509", - "x509.Expired": "crypto/x509", - "x509.ExtKeyUsage": "crypto/x509", - "x509.ExtKeyUsageAny": "crypto/x509", - "x509.ExtKeyUsageClientAuth": "crypto/x509", - "x509.ExtKeyUsageCodeSigning": "crypto/x509", - "x509.ExtKeyUsageEmailProtection": "crypto/x509", - "x509.ExtKeyUsageIPSECEndSystem": "crypto/x509", - "x509.ExtKeyUsageIPSECTunnel": "crypto/x509", - "x509.ExtKeyUsageIPSECUser": "crypto/x509", - "x509.ExtKeyUsageMicrosoftServerGatedCrypto": "crypto/x509", - "x509.ExtKeyUsageNetscapeServerGatedCrypto": "crypto/x509", - "x509.ExtKeyUsageOCSPSigning": "crypto/x509", - "x509.ExtKeyUsageServerAuth": "crypto/x509", - "x509.ExtKeyUsageTimeStamping": "crypto/x509", - "x509.HostnameError": "crypto/x509", - "x509.IncompatibleUsage": "crypto/x509", - "x509.IncorrectPasswordError": "crypto/x509", - "x509.InsecureAlgorithmError": "crypto/x509", - "x509.InvalidReason": "crypto/x509", - "x509.IsEncryptedPEMBlock": "crypto/x509", - "x509.KeyUsage": "crypto/x509", - "x509.KeyUsageCRLSign": "crypto/x509", - "x509.KeyUsageCertSign": "crypto/x509", - "x509.KeyUsageContentCommitment": "crypto/x509", - "x509.KeyUsageDataEncipherment": "crypto/x509", - "x509.KeyUsageDecipherOnly": "crypto/x509", - "x509.KeyUsageDigitalSignature": "crypto/x509", - "x509.KeyUsageEncipherOnly": "crypto/x509", - "x509.KeyUsageKeyAgreement": "crypto/x509", - "x509.KeyUsageKeyEncipherment": "crypto/x509", - "x509.MD2WithRSA": "crypto/x509", - "x509.MD5WithRSA": "crypto/x509", - "x509.MarshalECPrivateKey": "crypto/x509", - "x509.MarshalPKCS1PrivateKey": "crypto/x509", - "x509.MarshalPKIXPublicKey": "crypto/x509", - "x509.NewCertPool": "crypto/x509", - "x509.NotAuthorizedToSign": "crypto/x509", - "x509.PEMCipher": "crypto/x509", - "x509.PEMCipher3DES": "crypto/x509", - "x509.PEMCipherAES128": "crypto/x509", - "x509.PEMCipherAES192": "crypto/x509", - "x509.PEMCipherAES256": "crypto/x509", - "x509.PEMCipherDES": "crypto/x509", - "x509.ParseCRL": "crypto/x509", - "x509.ParseCertificate": "crypto/x509", - "x509.ParseCertificateRequest": "crypto/x509", - "x509.ParseCertificates": "crypto/x509", - "x509.ParseDERCRL": "crypto/x509", - "x509.ParseECPrivateKey": "crypto/x509", - "x509.ParsePKCS1PrivateKey": "crypto/x509", - "x509.ParsePKCS8PrivateKey": "crypto/x509", - "x509.ParsePKIXPublicKey": "crypto/x509", - "x509.PublicKeyAlgorithm": "crypto/x509", - "x509.RSA": "crypto/x509", - "x509.SHA1WithRSA": "crypto/x509", - "x509.SHA256WithRSA": "crypto/x509", - "x509.SHA384WithRSA": "crypto/x509", - "x509.SHA512WithRSA": "crypto/x509", - "x509.SignatureAlgorithm": "crypto/x509", - "x509.SystemCertPool": "crypto/x509", - "x509.SystemRootsError": "crypto/x509", - "x509.TooManyIntermediates": "crypto/x509", - "x509.UnhandledCriticalExtension": "crypto/x509", - "x509.UnknownAuthorityError": "crypto/x509", - "x509.UnknownPublicKeyAlgorithm": "crypto/x509", - "x509.UnknownSignatureAlgorithm": "crypto/x509", - "x509.VerifyOptions": "crypto/x509", - "xml.Attr": "encoding/xml", - "xml.CharData": "encoding/xml", - "xml.Comment": "encoding/xml", - "xml.CopyToken": "encoding/xml", - "xml.Decoder": "encoding/xml", - "xml.Directive": "encoding/xml", - "xml.Encoder": "encoding/xml", - "xml.EndElement": "encoding/xml", - "xml.Escape": "encoding/xml", - "xml.EscapeText": "encoding/xml", - "xml.HTMLAutoClose": "encoding/xml", - "xml.HTMLEntity": "encoding/xml", - "xml.Header": "encoding/xml", - "xml.Marshal": "encoding/xml", - "xml.MarshalIndent": "encoding/xml", - "xml.Marshaler": "encoding/xml", - "xml.MarshalerAttr": "encoding/xml", - "xml.Name": "encoding/xml", - "xml.NewDecoder": "encoding/xml", - "xml.NewEncoder": "encoding/xml", - "xml.ProcInst": "encoding/xml", - "xml.StartElement": "encoding/xml", - "xml.SyntaxError": "encoding/xml", - "xml.TagPathError": "encoding/xml", - "xml.Token": "encoding/xml", - "xml.Unmarshal": "encoding/xml", - "xml.UnmarshalError": "encoding/xml", - "xml.Unmarshaler": "encoding/xml", - "xml.UnmarshalerAttr": "encoding/xml", - "xml.UnsupportedTypeError": "encoding/xml", - "zip.Compressor": "archive/zip", - "zip.Decompressor": "archive/zip", - "zip.Deflate": "archive/zip", - "zip.ErrAlgorithm": "archive/zip", - "zip.ErrChecksum": "archive/zip", - "zip.ErrFormat": "archive/zip", - "zip.File": "archive/zip", - "zip.FileHeader": "archive/zip", - "zip.FileInfoHeader": "archive/zip", - "zip.NewReader": "archive/zip", - "zip.NewWriter": "archive/zip", - "zip.OpenReader": "archive/zip", - "zip.ReadCloser": "archive/zip", - "zip.Reader": "archive/zip", - "zip.RegisterCompressor": "archive/zip", - "zip.RegisterDecompressor": "archive/zip", - "zip.Store": "archive/zip", - "zip.Writer": "archive/zip", - "zlib.BestCompression": "compress/zlib", - "zlib.BestSpeed": "compress/zlib", - "zlib.DefaultCompression": "compress/zlib", - "zlib.ErrChecksum": "compress/zlib", - "zlib.ErrDictionary": "compress/zlib", - "zlib.ErrHeader": "compress/zlib", - "zlib.NewReader": "compress/zlib", - "zlib.NewReaderDict": "compress/zlib", - "zlib.NewWriter": "compress/zlib", - "zlib.NewWriterLevel": "compress/zlib", - "zlib.NewWriterLevelDict": "compress/zlib", - "zlib.NoCompression": "compress/zlib", - "zlib.Resetter": "compress/zlib", - "zlib.Writer": "compress/zlib", - - "unsafe.Alignof": "unsafe", - "unsafe.ArbitraryType": "unsafe", - "unsafe.Offsetof": "unsafe", - "unsafe.Pointer": "unsafe", - "unsafe.Sizeof": "unsafe", -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/LICENSE b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/LICENSE deleted file mode 100644 index f4988b45079..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -Copyright 2014, Google Inc. -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/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/PATENTS b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/PATENTS deleted file mode 100644 index 69b47959fab..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/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 gRPC 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 gRPC, 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 gRPC. 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 gRPC or any code incorporated within this -implementation of gRPC 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 gRPC -shall terminate as of the date such litigation is filed. diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/backoff.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/backoff.go deleted file mode 100644 index c99024ee302..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/backoff.go +++ /dev/null @@ -1,80 +0,0 @@ -package grpc - -import ( - "math/rand" - "time" -) - -// DefaultBackoffConfig uses values specified for backoff in -// https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md. -var ( - DefaultBackoffConfig = BackoffConfig{ - MaxDelay: 120 * time.Second, - baseDelay: 1.0 * time.Second, - factor: 1.6, - jitter: 0.2, - } -) - -// backoffStrategy defines the methodology for backing off after a grpc -// connection failure. -// -// This is unexported until the gRPC project decides whether or not to allow -// alternative backoff strategies. Once a decision is made, this type and its -// method may be exported. -type backoffStrategy interface { - // backoff returns the amount of time to wait before the next retry given - // the number of consecutive failures. - backoff(retries int) time.Duration -} - -// BackoffConfig defines the parameters for the default gRPC backoff strategy. -type BackoffConfig struct { - // MaxDelay is the upper bound of backoff delay. - MaxDelay time.Duration - - // TODO(stevvooe): The following fields are not exported, as allowing - // changes would violate the current gRPC specification for backoff. If - // gRPC decides to allow more interesting backoff strategies, these fields - // may be opened up in the future. - - // baseDelay is the amount of time to wait before retrying after the first - // failure. - baseDelay time.Duration - - // factor is applied to the backoff after each retry. - factor float64 - - // jitter provides a range to randomize backoff delays. - jitter float64 -} - -func setDefaults(bc *BackoffConfig) { - md := bc.MaxDelay - *bc = DefaultBackoffConfig - - if md > 0 { - bc.MaxDelay = md - } -} - -func (bc BackoffConfig) backoff(retries int) time.Duration { - if retries == 0 { - return bc.baseDelay - } - backoff, max := float64(bc.baseDelay), float64(bc.MaxDelay) - for backoff < max && retries > 0 { - backoff *= bc.factor - retries-- - } - if backoff > max { - backoff = max - } - // Randomize backoff delays so that if a cluster of requests start at - // the same time, they won't operate in lockstep. - backoff *= 1 + bc.jitter*(rand.Float64()*2-1) - if backoff < 0 { - return 0 - } - return time.Duration(backoff) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/balancer.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/balancer.go deleted file mode 100644 index 9d943fbadae..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/balancer.go +++ /dev/null @@ -1,400 +0,0 @@ -/* - * - * Copyright 2016, Google Inc. - * 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. - * - */ - -package grpc - -import ( - "fmt" - "sync" - - "golang.org/x/net/context" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/naming" -) - -// Address represents a server the client connects to. -// This is the EXPERIMENTAL API and may be changed or extended in the future. -type Address struct { - // Addr is the server address on which a connection will be established. - Addr string - // Metadata is the information associated with Addr, which may be used - // to make load balancing decision. - Metadata interface{} -} - -// BalancerConfig specifies the configurations for Balancer. -type BalancerConfig struct { - // DialCreds is the transport credential the Balancer implementation can - // use to dial to a remote load balancer server. The Balancer implementations - // can ignore this if it does not need to talk to another party securely. - DialCreds credentials.TransportCredentials -} - -// BalancerGetOptions configures a Get call. -// This is the EXPERIMENTAL API and may be changed or extended in the future. -type BalancerGetOptions struct { - // BlockingWait specifies whether Get should block when there is no - // connected address. - BlockingWait bool -} - -// Balancer chooses network addresses for RPCs. -// This is the EXPERIMENTAL API and may be changed or extended in the future. -type Balancer interface { - // Start does the initialization work to bootstrap a Balancer. For example, - // this function may start the name resolution and watch the updates. It will - // be called when dialing. - Start(target string, config BalancerConfig) error - // Up informs the Balancer that gRPC has a connection to the server at - // addr. It returns down which is called once the connection to addr gets - // lost or closed. - // TODO: It is not clear how to construct and take advantage of the meaningful error - // parameter for down. Need realistic demands to guide. - Up(addr Address) (down func(error)) - // Get gets the address of a server for the RPC corresponding to ctx. - // i) If it returns a connected address, gRPC internals issues the RPC on the - // connection to this address; - // ii) If it returns an address on which the connection is under construction - // (initiated by Notify(...)) but not connected, gRPC internals - // * fails RPC if the RPC is fail-fast and connection is in the TransientFailure or - // Shutdown state; - // or - // * issues RPC on the connection otherwise. - // iii) If it returns an address on which the connection does not exist, gRPC - // internals treats it as an error and will fail the corresponding RPC. - // - // Therefore, the following is the recommended rule when writing a custom Balancer. - // If opts.BlockingWait is true, it should return a connected address or - // block if there is no connected address. It should respect the timeout or - // cancellation of ctx when blocking. If opts.BlockingWait is false (for fail-fast - // RPCs), it should return an address it has notified via Notify(...) immediately - // instead of blocking. - // - // The function returns put which is called once the rpc has completed or failed. - // put can collect and report RPC stats to a remote load balancer. - // - // This function should only return the errors Balancer cannot recover by itself. - // gRPC internals will fail the RPC if an error is returned. - Get(ctx context.Context, opts BalancerGetOptions) (addr Address, put func(), err error) - // Notify returns a channel that is used by gRPC internals to watch the addresses - // gRPC needs to connect. The addresses might be from a name resolver or remote - // load balancer. gRPC internals will compare it with the existing connected - // addresses. If the address Balancer notified is not in the existing connected - // addresses, gRPC starts to connect the address. If an address in the existing - // connected addresses is not in the notification list, the corresponding connection - // is shutdown gracefully. Otherwise, there are no operations to take. Note that - // the Address slice must be the full list of the Addresses which should be connected. - // It is NOT delta. - Notify() <-chan []Address - // Close shuts down the balancer. - Close() error -} - -// downErr implements net.Error. It is constructed by gRPC internals and passed to the down -// call of Balancer. -type downErr struct { - timeout bool - temporary bool - desc string -} - -func (e downErr) Error() string { return e.desc } -func (e downErr) Timeout() bool { return e.timeout } -func (e downErr) Temporary() bool { return e.temporary } - -func downErrorf(timeout, temporary bool, format string, a ...interface{}) downErr { - return downErr{ - timeout: timeout, - temporary: temporary, - desc: fmt.Sprintf(format, a...), - } -} - -// RoundRobin returns a Balancer that selects addresses round-robin. It uses r to watch -// the name resolution updates and updates the addresses available correspondingly. -func RoundRobin(r naming.Resolver) Balancer { - return &roundRobin{r: r} -} - -type addrInfo struct { - addr Address - connected bool -} - -type roundRobin struct { - r naming.Resolver - w naming.Watcher - addrs []*addrInfo // all the addresses the client should potentially connect - mu sync.Mutex - addrCh chan []Address // the channel to notify gRPC internals the list of addresses the client should connect to. - next int // index of the next address to return for Get() - waitCh chan struct{} // the channel to block when there is no connected address available - done bool // The Balancer is closed. -} - -func (rr *roundRobin) watchAddrUpdates() error { - updates, err := rr.w.Next() - if err != nil { - grpclog.Printf("grpc: the naming watcher stops working due to %v.\n", err) - return err - } - rr.mu.Lock() - defer rr.mu.Unlock() - for _, update := range updates { - addr := Address{ - Addr: update.Addr, - Metadata: update.Metadata, - } - switch update.Op { - case naming.Add: - var exist bool - for _, v := range rr.addrs { - if addr == v.addr { - exist = true - grpclog.Println("grpc: The name resolver wanted to add an existing address: ", addr) - break - } - } - if exist { - continue - } - rr.addrs = append(rr.addrs, &addrInfo{addr: addr}) - case naming.Delete: - for i, v := range rr.addrs { - if addr == v.addr { - copy(rr.addrs[i:], rr.addrs[i+1:]) - rr.addrs = rr.addrs[:len(rr.addrs)-1] - break - } - } - default: - grpclog.Println("Unknown update.Op ", update.Op) - } - } - // Make a copy of rr.addrs and write it onto rr.addrCh so that gRPC internals gets notified. - open := make([]Address, len(rr.addrs)) - for i, v := range rr.addrs { - open[i] = v.addr - } - if rr.done { - return ErrClientConnClosing - } - rr.addrCh <- open - return nil -} - -func (rr *roundRobin) Start(target string, config BalancerConfig) error { - rr.mu.Lock() - defer rr.mu.Unlock() - if rr.done { - return ErrClientConnClosing - } - if rr.r == nil { - // If there is no name resolver installed, it is not needed to - // do name resolution. In this case, target is added into rr.addrs - // as the only address available and rr.addrCh stays nil. - rr.addrs = append(rr.addrs, &addrInfo{addr: Address{Addr: target}}) - return nil - } - w, err := rr.r.Resolve(target) - if err != nil { - return err - } - rr.w = w - rr.addrCh = make(chan []Address) - go func() { - for { - if err := rr.watchAddrUpdates(); err != nil { - return - } - } - }() - return nil -} - -// Up sets the connected state of addr and sends notification if there are pending -// Get() calls. -func (rr *roundRobin) Up(addr Address) func(error) { - rr.mu.Lock() - defer rr.mu.Unlock() - var cnt int - for _, a := range rr.addrs { - if a.addr == addr { - if a.connected { - return nil - } - a.connected = true - } - if a.connected { - cnt++ - } - } - // addr is only one which is connected. Notify the Get() callers who are blocking. - if cnt == 1 && rr.waitCh != nil { - close(rr.waitCh) - rr.waitCh = nil - } - return func(err error) { - rr.down(addr, err) - } -} - -// down unsets the connected state of addr. -func (rr *roundRobin) down(addr Address, err error) { - rr.mu.Lock() - defer rr.mu.Unlock() - for _, a := range rr.addrs { - if addr == a.addr { - a.connected = false - break - } - } -} - -// Get returns the next addr in the rotation. -func (rr *roundRobin) Get(ctx context.Context, opts BalancerGetOptions) (addr Address, put func(), err error) { - var ch chan struct{} - rr.mu.Lock() - if rr.done { - rr.mu.Unlock() - err = ErrClientConnClosing - return - } - - if len(rr.addrs) > 0 { - if rr.next >= len(rr.addrs) { - rr.next = 0 - } - next := rr.next - for { - a := rr.addrs[next] - next = (next + 1) % len(rr.addrs) - if a.connected { - addr = a.addr - rr.next = next - rr.mu.Unlock() - return - } - if next == rr.next { - // Has iterated all the possible address but none is connected. - break - } - } - } - if !opts.BlockingWait { - if len(rr.addrs) == 0 { - rr.mu.Unlock() - err = Errorf(codes.Unavailable, "there is no address available") - return - } - // Returns the next addr on rr.addrs for failfast RPCs. - addr = rr.addrs[rr.next].addr - rr.next++ - rr.mu.Unlock() - return - } - // Wait on rr.waitCh for non-failfast RPCs. - if rr.waitCh == nil { - ch = make(chan struct{}) - rr.waitCh = ch - } else { - ch = rr.waitCh - } - rr.mu.Unlock() - for { - select { - case <-ctx.Done(): - err = ctx.Err() - return - case <-ch: - rr.mu.Lock() - if rr.done { - rr.mu.Unlock() - err = ErrClientConnClosing - return - } - - if len(rr.addrs) > 0 { - if rr.next >= len(rr.addrs) { - rr.next = 0 - } - next := rr.next - for { - a := rr.addrs[next] - next = (next + 1) % len(rr.addrs) - if a.connected { - addr = a.addr - rr.next = next - rr.mu.Unlock() - return - } - if next == rr.next { - // Has iterated all the possible address but none is connected. - break - } - } - } - // The newly added addr got removed by Down() again. - if rr.waitCh == nil { - ch = make(chan struct{}) - rr.waitCh = ch - } else { - ch = rr.waitCh - } - rr.mu.Unlock() - } - } -} - -func (rr *roundRobin) Notify() <-chan []Address { - return rr.addrCh -} - -func (rr *roundRobin) Close() error { - rr.mu.Lock() - defer rr.mu.Unlock() - rr.done = true - if rr.w != nil { - rr.w.Close() - } - if rr.waitCh != nil { - close(rr.waitCh) - rr.waitCh = nil - } - if rr.addrCh != nil { - close(rr.addrCh) - } - return nil -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/call.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/call.go deleted file mode 100644 index c1588c6375c..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/call.go +++ /dev/null @@ -1,289 +0,0 @@ -/* - * - * Copyright 2014, Google Inc. - * 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. - * - */ - -package grpc - -import ( - "bytes" - "io" - "time" - - "golang.org/x/net/context" - "golang.org/x/net/trace" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/peer" - "google.golang.org/grpc/stats" - "google.golang.org/grpc/transport" -) - -// recvResponse receives and parses an RPC response. -// On error, it returns the error and indicates whether the call should be retried. -// -// TODO(zhaoq): Check whether the received message sequence is valid. -// TODO ctx is used for stats collection and processing. It is the context passed from the application. -func recvResponse(ctx context.Context, dopts dialOptions, t transport.ClientTransport, c *callInfo, stream *transport.Stream, reply interface{}) (err error) { - // Try to acquire header metadata from the server if there is any. - defer func() { - if err != nil { - if _, ok := err.(transport.ConnectionError); !ok { - t.CloseStream(stream, err) - } - } - }() - c.headerMD, err = stream.Header() - if err != nil { - return - } - p := &parser{r: stream} - var inPayload *stats.InPayload - if dopts.copts.StatsHandler != nil { - inPayload = &stats.InPayload{ - Client: true, - } - } - for { - if err = recv(p, dopts.codec, stream, dopts.dc, reply, dopts.maxMsgSize, inPayload); err != nil { - if err == io.EOF { - break - } - return - } - } - if inPayload != nil && err == io.EOF && stream.StatusCode() == codes.OK { - // TODO in the current implementation, inTrailer may be handled before inPayload in some cases. - // Fix the order if necessary. - dopts.copts.StatsHandler.HandleRPC(ctx, inPayload) - } - c.trailerMD = stream.Trailer() - if peer, ok := peer.FromContext(stream.Context()); ok { - c.peer = peer - } - return nil -} - -// sendRequest writes out various information of an RPC such as Context and Message. -func sendRequest(ctx context.Context, dopts dialOptions, compressor Compressor, callHdr *transport.CallHdr, t transport.ClientTransport, args interface{}, opts *transport.Options) (_ *transport.Stream, err error) { - stream, err := t.NewStream(ctx, callHdr) - if err != nil { - return nil, err - } - defer func() { - if err != nil { - // If err is connection error, t will be closed, no need to close stream here. - if _, ok := err.(transport.ConnectionError); !ok { - t.CloseStream(stream, err) - } - } - }() - var ( - cbuf *bytes.Buffer - outPayload *stats.OutPayload - ) - if compressor != nil { - cbuf = new(bytes.Buffer) - } - if dopts.copts.StatsHandler != nil { - outPayload = &stats.OutPayload{ - Client: true, - } - } - outBuf, err := encode(dopts.codec, args, compressor, cbuf, outPayload) - if err != nil { - return nil, Errorf(codes.Internal, "grpc: %v", err) - } - err = t.Write(stream, outBuf, opts) - if err == nil && outPayload != nil { - outPayload.SentTime = time.Now() - dopts.copts.StatsHandler.HandleRPC(ctx, outPayload) - } - // t.NewStream(...) could lead to an early rejection of the RPC (e.g., the service/method - // does not exist.) so that t.Write could get io.EOF from wait(...). Leave the following - // recvResponse to get the final status. - if err != nil && err != io.EOF { - return nil, err - } - // Sent successfully. - return stream, nil -} - -// Invoke sends the RPC request on the wire and returns after response is received. -// Invoke is called by generated code. Also users can call Invoke directly when it -// is really needed in their use cases. -func Invoke(ctx context.Context, method string, args, reply interface{}, cc *ClientConn, opts ...CallOption) error { - if cc.dopts.unaryInt != nil { - return cc.dopts.unaryInt(ctx, method, args, reply, cc, invoke, opts...) - } - return invoke(ctx, method, args, reply, cc, opts...) -} - -func invoke(ctx context.Context, method string, args, reply interface{}, cc *ClientConn, opts ...CallOption) (e error) { - c := defaultCallInfo - if mc, ok := cc.getMethodConfig(method); ok { - c.failFast = !mc.WaitForReady - if mc.Timeout > 0 { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, mc.Timeout) - defer cancel() - } - } - for _, o := range opts { - if err := o.before(&c); err != nil { - return toRPCErr(err) - } - } - defer func() { - for _, o := range opts { - o.after(&c) - } - }() - if EnableTracing { - c.traceInfo.tr = trace.New("grpc.Sent."+methodFamily(method), method) - defer c.traceInfo.tr.Finish() - c.traceInfo.firstLine.client = true - if deadline, ok := ctx.Deadline(); ok { - c.traceInfo.firstLine.deadline = deadline.Sub(time.Now()) - } - c.traceInfo.tr.LazyLog(&c.traceInfo.firstLine, false) - // TODO(dsymonds): Arrange for c.traceInfo.firstLine.remoteAddr to be set. - defer func() { - if e != nil { - c.traceInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{e}}, true) - c.traceInfo.tr.SetError() - } - }() - } - sh := cc.dopts.copts.StatsHandler - if sh != nil { - ctx = sh.TagRPC(ctx, &stats.RPCTagInfo{FullMethodName: method}) - begin := &stats.Begin{ - Client: true, - BeginTime: time.Now(), - FailFast: c.failFast, - } - sh.HandleRPC(ctx, begin) - } - defer func() { - if sh != nil { - end := &stats.End{ - Client: true, - EndTime: time.Now(), - Error: e, - } - sh.HandleRPC(ctx, end) - } - }() - topts := &transport.Options{ - Last: true, - Delay: false, - } - for { - var ( - err error - t transport.ClientTransport - stream *transport.Stream - // Record the put handler from Balancer.Get(...). It is called once the - // RPC has completed or failed. - put func() - ) - // TODO(zhaoq): Need a formal spec of fail-fast. - callHdr := &transport.CallHdr{ - Host: cc.authority, - Method: method, - } - if cc.dopts.cp != nil { - callHdr.SendCompress = cc.dopts.cp.Type() - } - - gopts := BalancerGetOptions{ - BlockingWait: !c.failFast, - } - t, put, err = cc.getTransport(ctx, gopts) - if err != nil { - // TODO(zhaoq): Probably revisit the error handling. - if _, ok := err.(*rpcError); ok { - return err - } - if err == errConnClosing || err == errConnUnavailable { - if c.failFast { - return Errorf(codes.Unavailable, "%v", err) - } - continue - } - // All the other errors are treated as Internal errors. - return Errorf(codes.Internal, "%v", err) - } - if c.traceInfo.tr != nil { - c.traceInfo.tr.LazyLog(&payload{sent: true, msg: args}, true) - } - stream, err = sendRequest(ctx, cc.dopts, cc.dopts.cp, callHdr, t, args, topts) - if err != nil { - if put != nil { - put() - put = nil - } - // Retry a non-failfast RPC when - // i) there is a connection error; or - // ii) the server started to drain before this RPC was initiated. - if _, ok := err.(transport.ConnectionError); ok || err == transport.ErrStreamDrain { - if c.failFast { - return toRPCErr(err) - } - continue - } - return toRPCErr(err) - } - err = recvResponse(ctx, cc.dopts, t, &c, stream, reply) - if err != nil { - if put != nil { - put() - put = nil - } - if _, ok := err.(transport.ConnectionError); ok || err == transport.ErrStreamDrain { - if c.failFast { - return toRPCErr(err) - } - continue - } - return toRPCErr(err) - } - if c.traceInfo.tr != nil { - c.traceInfo.tr.LazyLog(&payload{sent: false, msg: reply}, true) - } - t.CloseStream(stream, nil) - if put != nil { - put() - put = nil - } - return Errorf(stream.StatusCode(), "%s", stream.StatusDesc()) - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/clientconn.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/clientconn.go deleted file mode 100644 index 9858fe574d7..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/clientconn.go +++ /dev/null @@ -1,1006 +0,0 @@ -/* - * - * Copyright 2014, Google Inc. - * 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. - * - */ - -package grpc - -import ( - "errors" - "fmt" - "math" - "net" - "strings" - "sync" - "time" - - "golang.org/x/net/context" - "golang.org/x/net/trace" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/keepalive" - "google.golang.org/grpc/stats" - "google.golang.org/grpc/transport" -) - -var ( - // ErrClientConnClosing indicates that the operation is illegal because - // the ClientConn is closing. - ErrClientConnClosing = errors.New("grpc: the client connection is closing") - // ErrClientConnTimeout indicates that the ClientConn cannot establish the - // underlying connections within the specified timeout. - // DEPRECATED: Please use context.DeadlineExceeded instead. This error will be - // removed in Q1 2017. - ErrClientConnTimeout = errors.New("grpc: timed out when dialing") - - // errNoTransportSecurity indicates that there is no transport security - // being set for ClientConn. Users should either set one or explicitly - // call WithInsecure DialOption to disable security. - errNoTransportSecurity = errors.New("grpc: no transport security set (use grpc.WithInsecure() explicitly or set credentials)") - // errTransportCredentialsMissing indicates that users want to transmit security - // information (e.g., oauth2 token) which requires secure connection on an insecure - // connection. - errTransportCredentialsMissing = errors.New("grpc: the credentials require transport level security (use grpc.WithTransportCredentials() to set)") - // errCredentialsConflict indicates that grpc.WithTransportCredentials() - // and grpc.WithInsecure() are both called for a connection. - errCredentialsConflict = errors.New("grpc: transport credentials are set for an insecure connection (grpc.WithTransportCredentials() and grpc.WithInsecure() are both called)") - // errNetworkIO indicates that the connection is down due to some network I/O error. - errNetworkIO = errors.New("grpc: failed with network I/O error") - // errConnDrain indicates that the connection starts to be drained and does not accept any new RPCs. - errConnDrain = errors.New("grpc: the connection is drained") - // errConnClosing indicates that the connection is closing. - errConnClosing = errors.New("grpc: the connection is closing") - // errConnUnavailable indicates that the connection is unavailable. - errConnUnavailable = errors.New("grpc: the connection is unavailable") - errNoAddr = errors.New("grpc: there is no address available to dial") - // minimum time to give a connection to complete - minConnectTimeout = 20 * time.Second -) - -// dialOptions configure a Dial call. dialOptions are set by the DialOption -// values passed to Dial. -type dialOptions struct { - unaryInt UnaryClientInterceptor - streamInt StreamClientInterceptor - codec Codec - cp Compressor - dc Decompressor - bs backoffStrategy - balancer Balancer - block bool - insecure bool - timeout time.Duration - scChan <-chan ServiceConfig - copts transport.ConnectOptions - maxMsgSize int -} - -const defaultClientMaxMsgSize = math.MaxInt32 - -// DialOption configures how we set up the connection. -type DialOption func(*dialOptions) - -// WithMaxMsgSize returns a DialOption which sets the maximum message size the client can receive. -func WithMaxMsgSize(s int) DialOption { - return func(o *dialOptions) { - o.maxMsgSize = s - } -} - -// WithCodec returns a DialOption which sets a codec for message marshaling and unmarshaling. -func WithCodec(c Codec) DialOption { - return func(o *dialOptions) { - o.codec = c - } -} - -// WithCompressor returns a DialOption which sets a CompressorGenerator for generating message -// compressor. -func WithCompressor(cp Compressor) DialOption { - return func(o *dialOptions) { - o.cp = cp - } -} - -// WithDecompressor returns a DialOption which sets a DecompressorGenerator for generating -// message decompressor. -func WithDecompressor(dc Decompressor) DialOption { - return func(o *dialOptions) { - o.dc = dc - } -} - -// WithBalancer returns a DialOption which sets a load balancer. -func WithBalancer(b Balancer) DialOption { - return func(o *dialOptions) { - o.balancer = b - } -} - -// WithServiceConfig returns a DialOption which has a channel to read the service configuration. -func WithServiceConfig(c <-chan ServiceConfig) DialOption { - return func(o *dialOptions) { - o.scChan = c - } -} - -// WithBackoffMaxDelay configures the dialer to use the provided maximum delay -// when backing off after failed connection attempts. -func WithBackoffMaxDelay(md time.Duration) DialOption { - return WithBackoffConfig(BackoffConfig{MaxDelay: md}) -} - -// WithBackoffConfig configures the dialer to use the provided backoff -// parameters after connection failures. -// -// Use WithBackoffMaxDelay until more parameters on BackoffConfig are opened up -// for use. -func WithBackoffConfig(b BackoffConfig) DialOption { - // Set defaults to ensure that provided BackoffConfig is valid and - // unexported fields get default values. - setDefaults(&b) - return withBackoff(b) -} - -// withBackoff sets the backoff strategy used for retries after a -// failed connection attempt. -// -// This can be exported if arbitrary backoff strategies are allowed by gRPC. -func withBackoff(bs backoffStrategy) DialOption { - return func(o *dialOptions) { - o.bs = bs - } -} - -// WithBlock returns a DialOption which makes caller of Dial blocks until the underlying -// connection is up. Without this, Dial returns immediately and connecting the server -// happens in background. -func WithBlock() DialOption { - return func(o *dialOptions) { - o.block = true - } -} - -// WithInsecure returns a DialOption which disables transport security for this ClientConn. -// Note that transport security is required unless WithInsecure is set. -func WithInsecure() DialOption { - return func(o *dialOptions) { - o.insecure = true - } -} - -// WithTransportCredentials returns a DialOption which configures a -// connection level security credentials (e.g., TLS/SSL). -func WithTransportCredentials(creds credentials.TransportCredentials) DialOption { - return func(o *dialOptions) { - o.copts.TransportCredentials = creds - } -} - -// WithPerRPCCredentials returns a DialOption which sets -// credentials which will place auth state on each outbound RPC. -func WithPerRPCCredentials(creds credentials.PerRPCCredentials) DialOption { - return func(o *dialOptions) { - o.copts.PerRPCCredentials = append(o.copts.PerRPCCredentials, creds) - } -} - -// WithTimeout returns a DialOption that configures a timeout for dialing a ClientConn -// initially. This is valid if and only if WithBlock() is present. -func WithTimeout(d time.Duration) DialOption { - return func(o *dialOptions) { - o.timeout = d - } -} - -// WithDialer returns a DialOption that specifies a function to use for dialing network addresses. -// If FailOnNonTempDialError() is set to true, and an error is returned by f, gRPC checks the error's -// Temporary() method to decide if it should try to reconnect to the network address. -func WithDialer(f func(string, time.Duration) (net.Conn, error)) DialOption { - return func(o *dialOptions) { - o.copts.Dialer = func(ctx context.Context, addr string) (net.Conn, error) { - if deadline, ok := ctx.Deadline(); ok { - return f(addr, deadline.Sub(time.Now())) - } - return f(addr, 0) - } - } -} - -// WithStatsHandler returns a DialOption that specifies the stats handler -// for all the RPCs and underlying network connections in this ClientConn. -func WithStatsHandler(h stats.Handler) DialOption { - return func(o *dialOptions) { - o.copts.StatsHandler = h - } -} - -// FailOnNonTempDialError returns a DialOption that specified if gRPC fails on non-temporary dial errors. -// If f is true, and dialer returns a non-temporary error, gRPC will fail the connection to the network -// address and won't try to reconnect. -// The default value of FailOnNonTempDialError is false. -// This is an EXPERIMENTAL API. -func FailOnNonTempDialError(f bool) DialOption { - return func(o *dialOptions) { - o.copts.FailOnNonTempDialError = f - } -} - -// WithUserAgent returns a DialOption that specifies a user agent string for all the RPCs. -func WithUserAgent(s string) DialOption { - return func(o *dialOptions) { - o.copts.UserAgent = s - } -} - -// WithKeepaliveParams returns a DialOption that specifies keepalive paramaters for the client transport. -func WithKeepaliveParams(kp keepalive.ClientParameters) DialOption { - return func(o *dialOptions) { - o.copts.KeepaliveParams = kp - } -} - -// WithUnaryInterceptor returns a DialOption that specifies the interceptor for unary RPCs. -func WithUnaryInterceptor(f UnaryClientInterceptor) DialOption { - return func(o *dialOptions) { - o.unaryInt = f - } -} - -// WithStreamInterceptor returns a DialOption that specifies the interceptor for streaming RPCs. -func WithStreamInterceptor(f StreamClientInterceptor) DialOption { - return func(o *dialOptions) { - o.streamInt = f - } -} - -// WithAuthority returns a DialOption that specifies the value to be used as -// the :authority pseudo-header. This value only works with WithInsecure and -// has no effect if TransportCredentials are present. -func WithAuthority(a string) DialOption { - return func(o *dialOptions) { - o.copts.Authority = a - } -} - -// Dial creates a client connection to the given target. -func Dial(target string, opts ...DialOption) (*ClientConn, error) { - return DialContext(context.Background(), target, opts...) -} - -// DialContext creates a client connection to the given target. ctx can be used to -// cancel or expire the pending connecting. Once this function returns, the -// cancellation and expiration of ctx will be noop. Users should call ClientConn.Close -// to terminate all the pending operations after this function returns. -// This is the EXPERIMENTAL API. -func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *ClientConn, err error) { - cc := &ClientConn{ - target: target, - conns: make(map[Address]*addrConn), - } - cc.ctx, cc.cancel = context.WithCancel(context.Background()) - cc.dopts.maxMsgSize = defaultClientMaxMsgSize - for _, opt := range opts { - opt(&cc.dopts) - } - - grpcUA := "grpc-go/" + Version - if cc.dopts.copts.UserAgent != "" { - cc.dopts.copts.UserAgent += " " + grpcUA - } else { - cc.dopts.copts.UserAgent = grpcUA - } - - if cc.dopts.timeout > 0 { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, cc.dopts.timeout) - defer cancel() - } - - defer func() { - select { - case <-ctx.Done(): - conn, err = nil, ctx.Err() - default: - } - - if err != nil { - cc.Close() - } - }() - - if cc.dopts.scChan != nil { - // Wait for the initial service config. - select { - case sc, ok := <-cc.dopts.scChan: - if ok { - cc.sc = sc - } - case <-ctx.Done(): - return nil, ctx.Err() - } - } - // Set defaults. - if cc.dopts.codec == nil { - cc.dopts.codec = protoCodec{} - } - if cc.dopts.bs == nil { - cc.dopts.bs = DefaultBackoffConfig - } - creds := cc.dopts.copts.TransportCredentials - if creds != nil && creds.Info().ServerName != "" { - cc.authority = creds.Info().ServerName - } else if cc.dopts.insecure && cc.dopts.copts.Authority != "" { - cc.authority = cc.dopts.copts.Authority - } else { - colonPos := strings.LastIndex(target, ":") - if colonPos == -1 { - colonPos = len(target) - } - cc.authority = target[:colonPos] - } - var ok bool - waitC := make(chan error, 1) - go func() { - var addrs []Address - if cc.dopts.balancer == nil && cc.sc.LB != nil { - cc.dopts.balancer = cc.sc.LB - } - if cc.dopts.balancer == nil { - // Connect to target directly if balancer is nil. - addrs = append(addrs, Address{Addr: target}) - } else { - var credsClone credentials.TransportCredentials - if creds != nil { - credsClone = creds.Clone() - } - config := BalancerConfig{ - DialCreds: credsClone, - } - if err := cc.dopts.balancer.Start(target, config); err != nil { - waitC <- err - return - } - ch := cc.dopts.balancer.Notify() - if ch == nil { - // There is no name resolver installed. - addrs = append(addrs, Address{Addr: target}) - } else { - addrs, ok = <-ch - if !ok || len(addrs) == 0 { - waitC <- errNoAddr - return - } - } - } - for _, a := range addrs { - if err := cc.resetAddrConn(a, false, nil); err != nil { - waitC <- err - return - } - } - close(waitC) - }() - select { - case <-ctx.Done(): - return nil, ctx.Err() - case err := <-waitC: - if err != nil { - return nil, err - } - } - - // If balancer is nil or balancer.Notify() is nil, ok will be false here. - // The lbWatcher goroutine will not be created. - if ok { - go cc.lbWatcher() - } - - if cc.dopts.scChan != nil { - go cc.scWatcher() - } - return cc, nil -} - -// ConnectivityState indicates the state of a client connection. -type ConnectivityState int - -const ( - // Idle indicates the ClientConn is idle. - Idle ConnectivityState = iota - // Connecting indicates the ClienConn is connecting. - Connecting - // Ready indicates the ClientConn is ready for work. - Ready - // TransientFailure indicates the ClientConn has seen a failure but expects to recover. - TransientFailure - // Shutdown indicates the ClientConn has started shutting down. - Shutdown -) - -func (s ConnectivityState) String() string { - switch s { - case Idle: - return "IDLE" - case Connecting: - return "CONNECTING" - case Ready: - return "READY" - case TransientFailure: - return "TRANSIENT_FAILURE" - case Shutdown: - return "SHUTDOWN" - default: - panic(fmt.Sprintf("unknown connectivity state: %d", s)) - } -} - -// ClientConn represents a client connection to an RPC server. -type ClientConn struct { - ctx context.Context - cancel context.CancelFunc - - target string - authority string - dopts dialOptions - - mu sync.RWMutex - sc ServiceConfig - conns map[Address]*addrConn -} - -func (cc *ClientConn) lbWatcher() { - for addrs := range cc.dopts.balancer.Notify() { - var ( - add []Address // Addresses need to setup connections. - del []*addrConn // Connections need to tear down. - ) - cc.mu.Lock() - for _, a := range addrs { - if _, ok := cc.conns[a]; !ok { - add = append(add, a) - } - } - for k, c := range cc.conns { - var keep bool - for _, a := range addrs { - if k == a { - keep = true - break - } - } - if !keep { - del = append(del, c) - delete(cc.conns, c.addr) - } - } - cc.mu.Unlock() - for _, a := range add { - cc.resetAddrConn(a, true, nil) - } - for _, c := range del { - c.tearDown(errConnDrain) - } - } -} - -func (cc *ClientConn) scWatcher() { - for { - select { - case sc, ok := <-cc.dopts.scChan: - if !ok { - return - } - cc.mu.Lock() - // TODO: load balance policy runtime change is ignored. - // We may revist this decision in the future. - cc.sc = sc - cc.mu.Unlock() - case <-cc.ctx.Done(): - return - } - } -} - -// resetAddrConn creates an addrConn for addr and adds it to cc.conns. -// If there is an old addrConn for addr, it will be torn down, using tearDownErr as the reason. -// If tearDownErr is nil, errConnDrain will be used instead. -func (cc *ClientConn) resetAddrConn(addr Address, skipWait bool, tearDownErr error) error { - ac := &addrConn{ - cc: cc, - addr: addr, - dopts: cc.dopts, - } - ac.ctx, ac.cancel = context.WithCancel(cc.ctx) - ac.stateCV = sync.NewCond(&ac.mu) - if EnableTracing { - ac.events = trace.NewEventLog("grpc.ClientConn", ac.addr.Addr) - } - if !ac.dopts.insecure { - if ac.dopts.copts.TransportCredentials == nil { - return errNoTransportSecurity - } - } else { - if ac.dopts.copts.TransportCredentials != nil { - return errCredentialsConflict - } - for _, cd := range ac.dopts.copts.PerRPCCredentials { - if cd.RequireTransportSecurity() { - return errTransportCredentialsMissing - } - } - } - // Track ac in cc. This needs to be done before any getTransport(...) is called. - cc.mu.Lock() - if cc.conns == nil { - cc.mu.Unlock() - return ErrClientConnClosing - } - stale := cc.conns[ac.addr] - cc.conns[ac.addr] = ac - cc.mu.Unlock() - if stale != nil { - // There is an addrConn alive on ac.addr already. This could be due to - // 1) a buggy Balancer notifies duplicated Addresses; - // 2) goaway was received, a new ac will replace the old ac. - // The old ac should be deleted from cc.conns, but the - // underlying transport should drain rather than close. - if tearDownErr == nil { - // tearDownErr is nil if resetAddrConn is called by - // 1) Dial - // 2) lbWatcher - // In both cases, the stale ac should drain, not close. - stale.tearDown(errConnDrain) - } else { - stale.tearDown(tearDownErr) - } - } - // skipWait may overwrite the decision in ac.dopts.block. - if ac.dopts.block && !skipWait { - if err := ac.resetTransport(false); err != nil { - if err != errConnClosing { - // Tear down ac and delete it from cc.conns. - cc.mu.Lock() - delete(cc.conns, ac.addr) - cc.mu.Unlock() - ac.tearDown(err) - } - if e, ok := err.(transport.ConnectionError); ok && !e.Temporary() { - return e.Origin() - } - return err - } - // Start to monitor the error status of transport. - go ac.transportMonitor() - } else { - // Start a goroutine connecting to the server asynchronously. - go func() { - if err := ac.resetTransport(false); err != nil { - grpclog.Printf("Failed to dial %s: %v; please retry.", ac.addr.Addr, err) - if err != errConnClosing { - // Keep this ac in cc.conns, to get the reason it's torn down. - ac.tearDown(err) - } - return - } - ac.transportMonitor() - }() - } - return nil -} - -// TODO: Avoid the locking here. -func (cc *ClientConn) getMethodConfig(method string) (m MethodConfig, ok bool) { - cc.mu.RLock() - defer cc.mu.RUnlock() - m, ok = cc.sc.Methods[method] - return -} - -func (cc *ClientConn) getTransport(ctx context.Context, opts BalancerGetOptions) (transport.ClientTransport, func(), error) { - var ( - ac *addrConn - ok bool - put func() - ) - if cc.dopts.balancer == nil { - // If balancer is nil, there should be only one addrConn available. - cc.mu.RLock() - if cc.conns == nil { - cc.mu.RUnlock() - return nil, nil, toRPCErr(ErrClientConnClosing) - } - for _, ac = range cc.conns { - // Break after the first iteration to get the first addrConn. - ok = true - break - } - cc.mu.RUnlock() - } else { - var ( - addr Address - err error - ) - addr, put, err = cc.dopts.balancer.Get(ctx, opts) - if err != nil { - return nil, nil, toRPCErr(err) - } - cc.mu.RLock() - if cc.conns == nil { - cc.mu.RUnlock() - return nil, nil, toRPCErr(ErrClientConnClosing) - } - ac, ok = cc.conns[addr] - cc.mu.RUnlock() - } - if !ok { - if put != nil { - put() - } - return nil, nil, errConnClosing - } - t, err := ac.wait(ctx, cc.dopts.balancer != nil, !opts.BlockingWait) - if err != nil { - if put != nil { - put() - } - return nil, nil, err - } - return t, put, nil -} - -// Close tears down the ClientConn and all underlying connections. -func (cc *ClientConn) Close() error { - cc.cancel() - - cc.mu.Lock() - if cc.conns == nil { - cc.mu.Unlock() - return ErrClientConnClosing - } - conns := cc.conns - cc.conns = nil - cc.mu.Unlock() - if cc.dopts.balancer != nil { - cc.dopts.balancer.Close() - } - for _, ac := range conns { - ac.tearDown(ErrClientConnClosing) - } - return nil -} - -// addrConn is a network connection to a given address. -type addrConn struct { - ctx context.Context - cancel context.CancelFunc - - cc *ClientConn - addr Address - dopts dialOptions - events trace.EventLog - - mu sync.Mutex - state ConnectivityState - stateCV *sync.Cond - down func(error) // the handler called when a connection is down. - // ready is closed and becomes nil when a new transport is up or failed - // due to timeout. - ready chan struct{} - transport transport.ClientTransport - - // The reason this addrConn is torn down. - tearDownErr error -} - -// printf records an event in ac's event log, unless ac has been closed. -// REQUIRES ac.mu is held. -func (ac *addrConn) printf(format string, a ...interface{}) { - if ac.events != nil { - ac.events.Printf(format, a...) - } -} - -// errorf records an error in ac's event log, unless ac has been closed. -// REQUIRES ac.mu is held. -func (ac *addrConn) errorf(format string, a ...interface{}) { - if ac.events != nil { - ac.events.Errorf(format, a...) - } -} - -// getState returns the connectivity state of the Conn -func (ac *addrConn) getState() ConnectivityState { - ac.mu.Lock() - defer ac.mu.Unlock() - return ac.state -} - -// waitForStateChange blocks until the state changes to something other than the sourceState. -func (ac *addrConn) waitForStateChange(ctx context.Context, sourceState ConnectivityState) (ConnectivityState, error) { - ac.mu.Lock() - defer ac.mu.Unlock() - if sourceState != ac.state { - return ac.state, nil - } - done := make(chan struct{}) - var err error - go func() { - select { - case <-ctx.Done(): - ac.mu.Lock() - err = ctx.Err() - ac.stateCV.Broadcast() - ac.mu.Unlock() - case <-done: - } - }() - defer close(done) - for sourceState == ac.state { - ac.stateCV.Wait() - if err != nil { - return ac.state, err - } - } - return ac.state, nil -} - -func (ac *addrConn) resetTransport(closeTransport bool) error { - for retries := 0; ; retries++ { - ac.mu.Lock() - ac.printf("connecting") - if ac.state == Shutdown { - // ac.tearDown(...) has been invoked. - ac.mu.Unlock() - return errConnClosing - } - if ac.down != nil { - ac.down(downErrorf(false, true, "%v", errNetworkIO)) - ac.down = nil - } - ac.state = Connecting - ac.stateCV.Broadcast() - t := ac.transport - ac.mu.Unlock() - if closeTransport && t != nil { - t.Close() - } - sleepTime := ac.dopts.bs.backoff(retries) - timeout := minConnectTimeout - if timeout < sleepTime { - timeout = sleepTime - } - ctx, cancel := context.WithTimeout(ac.ctx, timeout) - connectTime := time.Now() - sinfo := transport.TargetInfo{ - Addr: ac.addr.Addr, - Metadata: ac.addr.Metadata, - } - newTransport, err := transport.NewClientTransport(ctx, sinfo, ac.dopts.copts) - // Don't call cancel in success path due to a race in Go 1.6: - // https://github.com/golang/go/issues/15078. - if err != nil { - cancel() - - if e, ok := err.(transport.ConnectionError); ok && !e.Temporary() { - return err - } - grpclog.Printf("grpc: addrConn.resetTransport failed to create client transport: %v; Reconnecting to %v", err, ac.addr) - ac.mu.Lock() - if ac.state == Shutdown { - // ac.tearDown(...) has been invoked. - ac.mu.Unlock() - return errConnClosing - } - ac.errorf("transient failure: %v", err) - ac.state = TransientFailure - ac.stateCV.Broadcast() - if ac.ready != nil { - close(ac.ready) - ac.ready = nil - } - ac.mu.Unlock() - closeTransport = false - select { - case <-time.After(sleepTime - time.Since(connectTime)): - case <-ac.ctx.Done(): - return ac.ctx.Err() - } - continue - } - ac.mu.Lock() - ac.printf("ready") - if ac.state == Shutdown { - // ac.tearDown(...) has been invoked. - ac.mu.Unlock() - newTransport.Close() - return errConnClosing - } - ac.state = Ready - ac.stateCV.Broadcast() - ac.transport = newTransport - if ac.ready != nil { - close(ac.ready) - ac.ready = nil - } - if ac.cc.dopts.balancer != nil { - ac.down = ac.cc.dopts.balancer.Up(ac.addr) - } - ac.mu.Unlock() - return nil - } -} - -// Run in a goroutine to track the error in transport and create the -// new transport if an error happens. It returns when the channel is closing. -func (ac *addrConn) transportMonitor() { - for { - ac.mu.Lock() - t := ac.transport - ac.mu.Unlock() - select { - // This is needed to detect the teardown when - // the addrConn is idle (i.e., no RPC in flight). - case <-ac.ctx.Done(): - select { - case <-t.Error(): - t.Close() - default: - } - return - case <-t.GoAway(): - // If GoAway happens without any network I/O error, ac is closed without shutting down the - // underlying transport (the transport will be closed when all the pending RPCs finished or - // failed.). - // If GoAway and some network I/O error happen concurrently, ac and its underlying transport - // are closed. - // In both cases, a new ac is created. - select { - case <-t.Error(): - ac.cc.resetAddrConn(ac.addr, true, errNetworkIO) - default: - ac.cc.resetAddrConn(ac.addr, true, errConnDrain) - } - return - case <-t.Error(): - select { - case <-ac.ctx.Done(): - t.Close() - return - case <-t.GoAway(): - ac.cc.resetAddrConn(ac.addr, true, errNetworkIO) - return - default: - } - ac.mu.Lock() - if ac.state == Shutdown { - // ac has been shutdown. - ac.mu.Unlock() - return - } - ac.state = TransientFailure - ac.stateCV.Broadcast() - ac.mu.Unlock() - if err := ac.resetTransport(true); err != nil { - ac.mu.Lock() - ac.printf("transport exiting: %v", err) - ac.mu.Unlock() - grpclog.Printf("grpc: addrConn.transportMonitor exits due to: %v", err) - if err != errConnClosing { - // Keep this ac in cc.conns, to get the reason it's torn down. - ac.tearDown(err) - } - return - } - } - } -} - -// wait blocks until i) the new transport is up or ii) ctx is done or iii) ac is closed or -// iv) transport is in TransientFailure and there is a balancer/failfast is true. -func (ac *addrConn) wait(ctx context.Context, hasBalancer, failfast bool) (transport.ClientTransport, error) { - for { - ac.mu.Lock() - switch { - case ac.state == Shutdown: - if failfast || !hasBalancer { - // RPC is failfast or balancer is nil. This RPC should fail with ac.tearDownErr. - err := ac.tearDownErr - ac.mu.Unlock() - return nil, err - } - ac.mu.Unlock() - return nil, errConnClosing - case ac.state == Ready: - ct := ac.transport - ac.mu.Unlock() - return ct, nil - case ac.state == TransientFailure: - if failfast || hasBalancer { - ac.mu.Unlock() - return nil, errConnUnavailable - } - } - ready := ac.ready - if ready == nil { - ready = make(chan struct{}) - ac.ready = ready - } - ac.mu.Unlock() - select { - case <-ctx.Done(): - return nil, toRPCErr(ctx.Err()) - // Wait until the new transport is ready or failed. - case <-ready: - } - } -} - -// tearDown starts to tear down the addrConn. -// TODO(zhaoq): Make this synchronous to avoid unbounded memory consumption in -// some edge cases (e.g., the caller opens and closes many addrConn's in a -// tight loop. -// tearDown doesn't remove ac from ac.cc.conns. -func (ac *addrConn) tearDown(err error) { - ac.cancel() - - ac.mu.Lock() - defer ac.mu.Unlock() - if ac.down != nil { - ac.down(downErrorf(false, false, "%v", err)) - ac.down = nil - } - if err == errConnDrain && ac.transport != nil { - // GracefulClose(...) may be executed multiple times when - // i) receiving multiple GoAway frames from the server; or - // ii) there are concurrent name resolver/Balancer triggered - // address removal and GoAway. - ac.transport.GracefulClose() - } - if ac.state == Shutdown { - return - } - ac.state = Shutdown - ac.tearDownErr = err - ac.stateCV.Broadcast() - if ac.events != nil { - ac.events.Finish() - ac.events = nil - } - if ac.ready != nil { - close(ac.ready) - ac.ready = nil - } - if ac.transport != nil && err != errConnDrain { - ac.transport.Close() - } - return -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codegen.sh b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codegen.sh deleted file mode 100755 index 4cdc6ba7c09..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codegen.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -# This script serves as an example to demonstrate how to generate the gRPC-Go -# interface and the related messages from .proto file. -# -# It assumes the installation of i) Google proto buffer compiler at -# https://github.com/google/protobuf (after v2.6.1) and ii) the Go codegen -# plugin at https://github.com/golang/protobuf (after 2015-02-20). If you have -# not, please install them first. -# -# We recommend running this script at $GOPATH/src. -# -# If this is not what you need, feel free to make your own scripts. Again, this -# script is for demonstration purpose. -# -proto=$1 -protoc --go_out=plugins=grpc:. $proto diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codes/code_string.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codes/code_string.go deleted file mode 100644 index e6762d08455..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codes/code_string.go +++ /dev/null @@ -1,16 +0,0 @@ -// generated by stringer -type=Code; DO NOT EDIT - -package codes - -import "fmt" - -const _Code_name = "OKCanceledUnknownInvalidArgumentDeadlineExceededNotFoundAlreadyExistsPermissionDeniedResourceExhaustedFailedPreconditionAbortedOutOfRangeUnimplementedInternalUnavailableDataLossUnauthenticated" - -var _Code_index = [...]uint8{0, 2, 10, 17, 32, 48, 56, 69, 85, 102, 120, 127, 137, 150, 158, 169, 177, 192} - -func (i Code) String() string { - if i+1 >= Code(len(_Code_index)) { - return fmt.Sprintf("Code(%d)", i) - } - return _Code_name[_Code_index[i]:_Code_index[i+1]] -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codes/codes.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codes/codes.go deleted file mode 100644 index e14b464acfd..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/codes/codes.go +++ /dev/null @@ -1,159 +0,0 @@ -/* - * - * Copyright 2014, Google Inc. - * 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. - * - */ - -// Package codes defines the canonical error codes used by gRPC. It is -// consistent across various languages. -package codes // import "google.golang.org/grpc/codes" - -// A Code is an unsigned 32-bit error code as defined in the gRPC spec. -type Code uint32 - -//go:generate stringer -type=Code - -const ( - // OK is returned on success. - OK Code = 0 - - // Canceled indicates the operation was cancelled (typically by the caller). - Canceled Code = 1 - - // Unknown error. An example of where this error may be returned is - // if a Status value received from another address space belongs to - // an error-space that is not known in this address space. Also - // errors raised by APIs that do not return enough error information - // may be converted to this error. - Unknown Code = 2 - - // InvalidArgument indicates client specified an invalid argument. - // Note that this differs from FailedPrecondition. It indicates arguments - // that are problematic regardless of the state of the system - // (e.g., a malformed file name). - InvalidArgument Code = 3 - - // DeadlineExceeded means operation expired before completion. - // For operations that change the state of the system, this error may be - // returned even if the operation has completed successfully. For - // example, a successful response from a server could have been delayed - // long enough for the deadline to expire. - DeadlineExceeded Code = 4 - - // NotFound means some requested entity (e.g., file or directory) was - // not found. - NotFound Code = 5 - - // AlreadyExists means an attempt to create an entity failed because one - // already exists. - AlreadyExists Code = 6 - - // PermissionDenied indicates the caller does not have permission to - // execute the specified operation. It must not be used for rejections - // caused by exhausting some resource (use ResourceExhausted - // instead for those errors). It must not be - // used if the caller cannot be identified (use Unauthenticated - // instead for those errors). - PermissionDenied Code = 7 - - // Unauthenticated indicates the request does not have valid - // authentication credentials for the operation. - Unauthenticated Code = 16 - - // ResourceExhausted indicates some resource has been exhausted, perhaps - // a per-user quota, or perhaps the entire file system is out of space. - ResourceExhausted Code = 8 - - // FailedPrecondition indicates operation was rejected because the - // system is not in a state required for the operation's execution. - // For example, directory to be deleted may be non-empty, an rmdir - // operation is applied to a non-directory, etc. - // - // A litmus test that may help a service implementor in deciding - // between FailedPrecondition, Aborted, and Unavailable: - // (a) Use Unavailable if the client can retry just the failing call. - // (b) Use Aborted if the client should retry at a higher-level - // (e.g., restarting a read-modify-write sequence). - // (c) Use FailedPrecondition if the client should not retry until - // the system state has been explicitly fixed. E.g., if an "rmdir" - // fails because the directory is non-empty, FailedPrecondition - // should be returned since the client should not retry unless - // they have first fixed up the directory by deleting files from it. - // (d) Use FailedPrecondition if the client performs conditional - // REST Get/Update/Delete on a resource and the resource on the - // server does not match the condition. E.g., conflicting - // read-modify-write on the same resource. - FailedPrecondition Code = 9 - - // Aborted indicates the operation was aborted, typically due to a - // concurrency issue like sequencer check failures, transaction aborts, - // etc. - // - // See litmus test above for deciding between FailedPrecondition, - // Aborted, and Unavailable. - Aborted Code = 10 - - // OutOfRange means operation was attempted past the valid range. - // E.g., seeking or reading past end of file. - // - // Unlike InvalidArgument, this error indicates a problem that may - // be fixed if the system state changes. For example, a 32-bit file - // system will generate InvalidArgument if asked to read at an - // offset that is not in the range [0,2^32-1], but it will generate - // OutOfRange if asked to read from an offset past the current - // file size. - // - // There is a fair bit of overlap between FailedPrecondition and - // OutOfRange. We recommend using OutOfRange (the more specific - // error) when it applies so that callers who are iterating through - // a space can easily look for an OutOfRange error to detect when - // they are done. - OutOfRange Code = 11 - - // Unimplemented indicates operation is not implemented or not - // supported/enabled in this service. - Unimplemented Code = 12 - - // Internal errors. Means some invariants expected by underlying - // system has been broken. If you see one of these errors, - // something is very broken. - Internal Code = 13 - - // Unavailable indicates the service is currently unavailable. - // This is a most likely a transient condition and may be corrected - // by retrying with a backoff. - // - // See litmus test above for deciding between FailedPrecondition, - // Aborted, and Unavailable. - Unavailable Code = 14 - - // DataLoss indicates unrecoverable data loss or corruption. - DataLoss Code = 15 -) diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/coverage.sh b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/coverage.sh deleted file mode 100755 index b85f9181dee..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/coverage.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash - - -set -e - -workdir=.cover -profile="$workdir/cover.out" -mode=set -end2endtest="google.golang.org/grpc/test" - -generate_cover_data() { - rm -rf "$workdir" - mkdir "$workdir" - - for pkg in "$@"; do - if [ $pkg == "google.golang.org/grpc" -o $pkg == "google.golang.org/grpc/transport" -o $pkg == "google.golang.org/grpc/metadata" -o $pkg == "google.golang.org/grpc/credentials" ] - then - f="$workdir/$(echo $pkg | tr / -)" - go test -covermode="$mode" -coverprofile="$f.cover" "$pkg" - go test -covermode="$mode" -coverpkg "$pkg" -coverprofile="$f.e2e.cover" "$end2endtest" - fi - done - - echo "mode: $mode" >"$profile" - grep -h -v "^mode:" "$workdir"/*.cover >>"$profile" -} - -show_cover_report() { - go tool cover -${1}="$profile" -} - -push_to_coveralls() { - goveralls -coverprofile="$profile" -} - -generate_cover_data $(go list ./...) -show_cover_report func -case "$1" in -"") - ;; ---html) - show_cover_report html ;; ---coveralls) - push_to_coveralls ;; -*) - echo >&2 "error: invalid option: $1" ;; -esac -rm -rf "$workdir" diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials.go deleted file mode 100644 index 4d45c3e3c7f..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials.go +++ /dev/null @@ -1,230 +0,0 @@ -/* - * - * Copyright 2014, Google Inc. - * 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. - * - */ - -// Package credentials implements various credentials supported by gRPC library, -// which encapsulate all the state needed by a client to authenticate with a -// server and make various assertions, e.g., about the client's identity, role, -// or whether it is authorized to make a particular call. -package credentials // import "google.golang.org/grpc/credentials" - -import ( - "crypto/tls" - "crypto/x509" - "errors" - "fmt" - "io/ioutil" - "net" - "strings" - - "golang.org/x/net/context" -) - -var ( - // alpnProtoStr are the specified application level protocols for gRPC. - alpnProtoStr = []string{"h2"} -) - -// PerRPCCredentials defines the common interface for the credentials which need to -// attach security information to every RPC (e.g., oauth2). -type PerRPCCredentials interface { - // GetRequestMetadata gets the current request metadata, refreshing - // tokens if required. This should be called by the transport layer on - // each request, and the data should be populated in headers or other - // context. uri is the URI of the entry point for the request. When - // supported by the underlying implementation, ctx can be used for - // timeout and cancellation. - // TODO(zhaoq): Define the set of the qualified keys instead of leaving - // it as an arbitrary string. - GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) - // RequireTransportSecurity indicates whether the credentials requires - // transport security. - RequireTransportSecurity() bool -} - -// ProtocolInfo provides information regarding the gRPC wire protocol version, -// security protocol, security protocol version in use, server name, etc. -type ProtocolInfo struct { - // ProtocolVersion is the gRPC wire protocol version. - ProtocolVersion string - // SecurityProtocol is the security protocol in use. - SecurityProtocol string - // SecurityVersion is the security protocol version. - SecurityVersion string - // ServerName is the user-configured server name. - ServerName string -} - -// AuthInfo defines the common interface for the auth information the users are interested in. -type AuthInfo interface { - AuthType() string -} - -var ( - // ErrConnDispatched indicates that rawConn has been dispatched out of gRPC - // and the caller should not close rawConn. - ErrConnDispatched = errors.New("credentials: rawConn is dispatched out of gRPC") -) - -// TransportCredentials defines the common interface for all the live gRPC wire -// protocols and supported transport security protocols (e.g., TLS, SSL). -type TransportCredentials interface { - // ClientHandshake does the authentication handshake specified by the corresponding - // authentication protocol on rawConn for clients. It returns the authenticated - // connection and the corresponding auth information about the connection. - // Implementations must use the provided context to implement timely cancellation. - ClientHandshake(context.Context, string, net.Conn) (net.Conn, AuthInfo, error) - // ServerHandshake does the authentication handshake for servers. It returns - // the authenticated connection and the corresponding auth information about - // the connection. - ServerHandshake(net.Conn) (net.Conn, AuthInfo, error) - // Info provides the ProtocolInfo of this TransportCredentials. - Info() ProtocolInfo - // Clone makes a copy of this TransportCredentials. - Clone() TransportCredentials - // OverrideServerName overrides the server name used to verify the hostname on the returned certificates from the server. - // gRPC internals also use it to override the virtual hosting name if it is set. - // It must be called before dialing. Currently, this is only used by grpclb. - OverrideServerName(string) error -} - -// TLSInfo contains the auth information for a TLS authenticated connection. -// It implements the AuthInfo interface. -type TLSInfo struct { - State tls.ConnectionState -} - -// AuthType returns the type of TLSInfo as a string. -func (t TLSInfo) AuthType() string { - return "tls" -} - -// tlsCreds is the credentials required for authenticating a connection using TLS. -type tlsCreds struct { - // TLS configuration - config *tls.Config -} - -func (c tlsCreds) Info() ProtocolInfo { - return ProtocolInfo{ - SecurityProtocol: "tls", - SecurityVersion: "1.2", - ServerName: c.config.ServerName, - } -} - -func (c *tlsCreds) ClientHandshake(ctx context.Context, addr string, rawConn net.Conn) (_ net.Conn, _ AuthInfo, err error) { - // use local cfg to avoid clobbering ServerName if using multiple endpoints - cfg := cloneTLSConfig(c.config) - if cfg.ServerName == "" { - colonPos := strings.LastIndex(addr, ":") - if colonPos == -1 { - colonPos = len(addr) - } - cfg.ServerName = addr[:colonPos] - } - conn := tls.Client(rawConn, cfg) - errChannel := make(chan error, 1) - go func() { - errChannel <- conn.Handshake() - }() - select { - case err := <-errChannel: - if err != nil { - return nil, nil, err - } - case <-ctx.Done(): - return nil, nil, ctx.Err() - } - return conn, TLSInfo{conn.ConnectionState()}, nil -} - -func (c *tlsCreds) ServerHandshake(rawConn net.Conn) (net.Conn, AuthInfo, error) { - conn := tls.Server(rawConn, c.config) - if err := conn.Handshake(); err != nil { - return nil, nil, err - } - return conn, TLSInfo{conn.ConnectionState()}, nil -} - -func (c *tlsCreds) Clone() TransportCredentials { - return NewTLS(c.config) -} - -func (c *tlsCreds) OverrideServerName(serverNameOverride string) error { - c.config.ServerName = serverNameOverride - return nil -} - -// NewTLS uses c to construct a TransportCredentials based on TLS. -func NewTLS(c *tls.Config) TransportCredentials { - tc := &tlsCreds{cloneTLSConfig(c)} - tc.config.NextProtos = alpnProtoStr - return tc -} - -// NewClientTLSFromCert constructs a TLS from the input certificate for client. -// serverNameOverride is for testing only. If set to a non empty string, -// it will override the virtual host name of authority (e.g. :authority header field) in requests. -func NewClientTLSFromCert(cp *x509.CertPool, serverNameOverride string) TransportCredentials { - return NewTLS(&tls.Config{ServerName: serverNameOverride, RootCAs: cp}) -} - -// NewClientTLSFromFile constructs a TLS from the input certificate file for client. -// serverNameOverride is for testing only. If set to a non empty string, -// it will override the virtual host name of authority (e.g. :authority header field) in requests. -func NewClientTLSFromFile(certFile, serverNameOverride string) (TransportCredentials, error) { - b, err := ioutil.ReadFile(certFile) - if err != nil { - return nil, err - } - cp := x509.NewCertPool() - if !cp.AppendCertsFromPEM(b) { - return nil, fmt.Errorf("credentials: failed to append certificates") - } - return NewTLS(&tls.Config{ServerName: serverNameOverride, RootCAs: cp}), nil -} - -// NewServerTLSFromCert constructs a TLS from the input certificate for server. -func NewServerTLSFromCert(cert *tls.Certificate) TransportCredentials { - return NewTLS(&tls.Config{Certificates: []tls.Certificate{*cert}}) -} - -// NewServerTLSFromFile constructs a TLS from the input certificate file and key -// file for server. -func NewServerTLSFromFile(certFile, keyFile string) (TransportCredentials, error) { - cert, err := tls.LoadX509KeyPair(certFile, keyFile) - if err != nil { - return nil, err - } - return NewTLS(&tls.Config{Certificates: []tls.Certificate{cert}}), nil -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_go17.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_go17.go deleted file mode 100644 index 7597b09e358..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_go17.go +++ /dev/null @@ -1,75 +0,0 @@ -// +build go1.7 -// +build !go1.8 - -/* - * - * Copyright 2016, Google Inc. - * 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. - * - */ - -package credentials - -import ( - "crypto/tls" -) - -// cloneTLSConfig returns a shallow clone of the exported -// fields of cfg, ignoring the unexported sync.Once, which -// contains a mutex and must not be copied. -// -// If cfg is nil, a new zero tls.Config is returned. -func cloneTLSConfig(cfg *tls.Config) *tls.Config { - if cfg == nil { - return &tls.Config{} - } - return &tls.Config{ - Rand: cfg.Rand, - Time: cfg.Time, - Certificates: cfg.Certificates, - NameToCertificate: cfg.NameToCertificate, - GetCertificate: cfg.GetCertificate, - RootCAs: cfg.RootCAs, - NextProtos: cfg.NextProtos, - ServerName: cfg.ServerName, - ClientAuth: cfg.ClientAuth, - ClientCAs: cfg.ClientCAs, - InsecureSkipVerify: cfg.InsecureSkipVerify, - CipherSuites: cfg.CipherSuites, - PreferServerCipherSuites: cfg.PreferServerCipherSuites, - SessionTicketsDisabled: cfg.SessionTicketsDisabled, - SessionTicketKey: cfg.SessionTicketKey, - ClientSessionCache: cfg.ClientSessionCache, - MinVersion: cfg.MinVersion, - MaxVersion: cfg.MaxVersion, - CurvePreferences: cfg.CurvePreferences, - DynamicRecordSizingDisabled: cfg.DynamicRecordSizingDisabled, - Renegotiation: cfg.Renegotiation, - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_go18.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_go18.go deleted file mode 100644 index 0ecf342da84..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_go18.go +++ /dev/null @@ -1,53 +0,0 @@ -// +build go1.8 - -/* - * - * Copyright 2017, Google Inc. - * 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. - * - */ - -package credentials - -import ( - "crypto/tls" -) - -// cloneTLSConfig returns a shallow clone of the exported -// fields of cfg, ignoring the unexported sync.Once, which -// contains a mutex and must not be copied. -// -// If cfg is nil, a new zero tls.Config is returned. -func cloneTLSConfig(cfg *tls.Config) *tls.Config { - if cfg == nil { - return &tls.Config{} - } - - return cfg.Clone() -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_pre_go17.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_pre_go17.go deleted file mode 100644 index cfd40dfa34a..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/credentials/credentials_util_pre_go17.go +++ /dev/null @@ -1,72 +0,0 @@ -// +build !go1.7 - -/* - * - * Copyright 2016, Google Inc. - * 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. - * - */ - -package credentials - -import ( - "crypto/tls" -) - -// cloneTLSConfig returns a shallow clone of the exported -// fields of cfg, ignoring the unexported sync.Once, which -// contains a mutex and must not be copied. -// -// If cfg is nil, a new zero tls.Config is returned. -func cloneTLSConfig(cfg *tls.Config) *tls.Config { - if cfg == nil { - return &tls.Config{} - } - return &tls.Config{ - Rand: cfg.Rand, - Time: cfg.Time, - Certificates: cfg.Certificates, - NameToCertificate: cfg.NameToCertificate, - GetCertificate: cfg.GetCertificate, - RootCAs: cfg.RootCAs, - NextProtos: cfg.NextProtos, - ServerName: cfg.ServerName, - ClientAuth: cfg.ClientAuth, - ClientCAs: cfg.ClientCAs, - InsecureSkipVerify: cfg.InsecureSkipVerify, - CipherSuites: cfg.CipherSuites, - PreferServerCipherSuites: cfg.PreferServerCipherSuites, - SessionTicketsDisabled: cfg.SessionTicketsDisabled, - SessionTicketKey: cfg.SessionTicketKey, - ClientSessionCache: cfg.ClientSessionCache, - MinVersion: cfg.MinVersion, - MaxVersion: cfg.MaxVersion, - CurvePreferences: cfg.CurvePreferences, - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/doc.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/doc.go deleted file mode 100644 index a35f218852b..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -/* -Package grpc implements an RPC system called gRPC. - -See www.grpc.io for more information about gRPC. -*/ -package grpc // import "google.golang.org/grpc" diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/grpclog/logger.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/grpclog/logger.go deleted file mode 100644 index 3b2933079e9..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/grpclog/logger.go +++ /dev/null @@ -1,93 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * 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. - * - */ - -/* -Package grpclog defines logging for grpc. -*/ -package grpclog // import "google.golang.org/grpc/grpclog" - -import ( - "log" - "os" -) - -// Use golang's standard logger by default. -// Access is not mutex-protected: do not modify except in init() -// functions. -var logger Logger = log.New(os.Stderr, "", log.LstdFlags) - -// Logger mimics golang's standard Logger as an interface. -type Logger interface { - Fatal(args ...interface{}) - Fatalf(format string, args ...interface{}) - Fatalln(args ...interface{}) - Print(args ...interface{}) - Printf(format string, args ...interface{}) - Println(args ...interface{}) -} - -// SetLogger sets the logger that is used in grpc. Call only from -// init() functions. -func SetLogger(l Logger) { - logger = l -} - -// Fatal is equivalent to Print() followed by a call to os.Exit() with a non-zero exit code. -func Fatal(args ...interface{}) { - logger.Fatal(args...) -} - -// Fatalf is equivalent to Printf() followed by a call to os.Exit() with a non-zero exit code. -func Fatalf(format string, args ...interface{}) { - logger.Fatalf(format, args...) -} - -// Fatalln is equivalent to Println() followed by a call to os.Exit()) with a non-zero exit code. -func Fatalln(args ...interface{}) { - logger.Fatalln(args...) -} - -// Print prints to the logger. Arguments are handled in the manner of fmt.Print. -func Print(args ...interface{}) { - logger.Print(args...) -} - -// Printf prints to the logger. Arguments are handled in the manner of fmt.Printf. -func Printf(format string, args ...interface{}) { - logger.Printf(format, args...) -} - -// Println prints to the logger. Arguments are handled in the manner of fmt.Println. -func Println(args ...interface{}) { - logger.Println(args...) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/interceptor.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/interceptor.go deleted file mode 100644 index 8d932efed7e..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/interceptor.go +++ /dev/null @@ -1,90 +0,0 @@ -/* - * - * Copyright 2016, Google Inc. - * 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. - * - */ - -package grpc - -import ( - "golang.org/x/net/context" -) - -// UnaryInvoker is called by UnaryClientInterceptor to complete RPCs. -type UnaryInvoker func(ctx context.Context, method string, req, reply interface{}, cc *ClientConn, opts ...CallOption) error - -// UnaryClientInterceptor intercepts the execution of a unary RPC on the client. inovker is the handler to complete the RPC -// and it is the responsibility of the interceptor to call it. -// This is the EXPERIMENTAL API. -type UnaryClientInterceptor func(ctx context.Context, method string, req, reply interface{}, cc *ClientConn, invoker UnaryInvoker, opts ...CallOption) error - -// Streamer is called by StreamClientInterceptor to create a ClientStream. -type Streamer func(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (ClientStream, error) - -// StreamClientInterceptor intercepts the creation of ClientStream. It may return a custom ClientStream to intercept all I/O -// operations. streamer is the handlder to create a ClientStream and it is the responsibility of the interceptor to call it. -// This is the EXPERIMENTAL API. -type StreamClientInterceptor func(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, streamer Streamer, opts ...CallOption) (ClientStream, error) - -// UnaryServerInfo consists of various information about a unary RPC on -// server side. All per-rpc information may be mutated by the interceptor. -type UnaryServerInfo struct { - // Server is the service implementation the user provides. This is read-only. - Server interface{} - // FullMethod is the full RPC method string, i.e., /package.service/method. - FullMethod string -} - -// UnaryHandler defines the handler invoked by UnaryServerInterceptor to complete the normal -// execution of a unary RPC. -type UnaryHandler func(ctx context.Context, req interface{}) (interface{}, error) - -// UnaryServerInterceptor provides a hook to intercept the execution of a unary RPC on the server. info -// contains all the information of this RPC the interceptor can operate on. And handler is the wrapper -// of the service method implementation. It is the responsibility of the interceptor to invoke handler -// to complete the RPC. -type UnaryServerInterceptor func(ctx context.Context, req interface{}, info *UnaryServerInfo, handler UnaryHandler) (resp interface{}, err error) - -// StreamServerInfo consists of various information about a streaming RPC on -// server side. All per-rpc information may be mutated by the interceptor. -type StreamServerInfo struct { - // FullMethod is the full RPC method string, i.e., /package.service/method. - FullMethod string - // IsClientStream indicates whether the RPC is a client streaming RPC. - IsClientStream bool - // IsServerStream indicates whether the RPC is a server streaming RPC. - IsServerStream bool -} - -// StreamServerInterceptor provides a hook to intercept the execution of a streaming RPC on the server. -// info contains all the information of this RPC the interceptor can operate on. And handler is the -// service method implementation. It is the responsibility of the interceptor to invoke handler to -// complete the RPC. -type StreamServerInterceptor func(srv interface{}, ss ServerStream, info *StreamServerInfo, handler StreamHandler) error diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/internal/internal.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/internal/internal.go deleted file mode 100644 index 5489143a85c..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/internal/internal.go +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2016, Google Inc. - * 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. - * - */ - -// Package internal contains gRPC-internal code for testing, to avoid polluting -// the godoc of the top-level grpc package. -package internal - -// TestingCloseConns closes all existing transports but keeps -// grpcServer.lis accepting new connections. -// -// The provided grpcServer must be of type *grpc.Server. It is untyped -// for circular dependency reasons. -var TestingCloseConns func(grpcServer interface{}) - -// TestingUseHandlerImpl enables the http.Handler-based server implementation. -// It must be called before Serve and requires TLS credentials. -// -// The provided grpcServer must be of type *grpc.Server. It is untyped -// for circular dependency reasons. -var TestingUseHandlerImpl func(grpcServer interface{}) diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/keepalive/keepalive.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/keepalive/keepalive.go deleted file mode 100644 index 20672e49d90..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/keepalive/keepalive.go +++ /dev/null @@ -1,52 +0,0 @@ -/* - * - * Copyright 2017, Google Inc. - * 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. - * - */ - -// Package keepalive defines configurable parameters for point-to-point healthcheck. -package keepalive - -import ( - "time" -) - -// ClientParameters is used to set keepalive parameters on the client-side. -// These configure how the client will actively probe to notice when a connection broken -// and to cause activity so intermediaries are aware the connection is still in use. -type ClientParameters struct { - // After a duration of this time if the client doesn't see any activity it pings the server to see if the transport is still alive. - Time time.Duration // The current default value is infinity. - // After having pinged for keepalive check, the client waits for a duration of Timeout and if no activity is seen even after that - // the connection is closed. - Timeout time.Duration // The current default value is 20 seconds. - // If true, client runs keepalive checks even with no active RPCs. - PermitWithoutStream bool -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/metadata/metadata.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/metadata/metadata.go deleted file mode 100644 index 73323950286..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/metadata/metadata.go +++ /dev/null @@ -1,152 +0,0 @@ -/* - * - * Copyright 2014, Google Inc. - * 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. - * - */ - -// Package metadata define the structure of the metadata supported by gRPC library. -// Please refer to http://www.grpc.io/docs/guides/wire.html for more information about custom-metadata. -package metadata // import "google.golang.org/grpc/metadata" - -import ( - "encoding/base64" - "fmt" - "strings" - - "golang.org/x/net/context" -) - -const ( - binHdrSuffix = "-bin" -) - -// encodeKeyValue encodes key and value qualified for transmission via gRPC. -// Transmitting binary headers violates HTTP/2 spec. -// TODO(zhaoq): Maybe check if k is ASCII also. -func encodeKeyValue(k, v string) (string, string) { - k = strings.ToLower(k) - if strings.HasSuffix(k, binHdrSuffix) { - val := base64.StdEncoding.EncodeToString([]byte(v)) - v = string(val) - } - return k, v -} - -// DecodeKeyValue returns the original key and value corresponding to the -// encoded data in k, v. -// If k is a binary header and v contains comma, v is split on comma before decoded, -// and the decoded v will be joined with comma before returned. -func DecodeKeyValue(k, v string) (string, string, error) { - if !strings.HasSuffix(k, binHdrSuffix) { - return k, v, nil - } - vvs := strings.Split(v, ",") - for i, vv := range vvs { - val, err := base64.StdEncoding.DecodeString(vv) - if err != nil { - return "", "", err - } - vvs[i] = string(val) - } - return k, strings.Join(vvs, ","), nil -} - -// MD is a mapping from metadata keys to values. Users should use the following -// two convenience functions New and Pairs to generate MD. -type MD map[string][]string - -// New creates a MD from given key-value map. -// Keys are automatically converted to lowercase. And for keys having "-bin" as suffix, their values will be applied Base64 encoding. -func New(m map[string]string) MD { - md := MD{} - for k, v := range m { - key, val := encodeKeyValue(k, v) - md[key] = append(md[key], val) - } - return md -} - -// Pairs returns an MD formed by the mapping of key, value ... -// Pairs panics if len(kv) is odd. -// Keys are automatically converted to lowercase. And for keys having "-bin" as suffix, their values will be appplied Base64 encoding. -func Pairs(kv ...string) MD { - if len(kv)%2 == 1 { - panic(fmt.Sprintf("metadata: Pairs got the odd number of input pairs for metadata: %d", len(kv))) - } - md := MD{} - var k string - for i, s := range kv { - if i%2 == 0 { - k = s - continue - } - key, val := encodeKeyValue(k, s) - md[key] = append(md[key], val) - } - return md -} - -// Len returns the number of items in md. -func (md MD) Len() int { - return len(md) -} - -// Copy returns a copy of md. -func (md MD) Copy() MD { - return Join(md) -} - -// Join joins any number of MDs into a single MD. -// The order of values for each key is determined by the order in which -// the MDs containing those values are presented to Join. -func Join(mds ...MD) MD { - out := MD{} - for _, md := range mds { - for k, v := range md { - out[k] = append(out[k], v...) - } - } - return out -} - -type mdKey struct{} - -// NewContext creates a new context with md attached. -func NewContext(ctx context.Context, md MD) context.Context { - return context.WithValue(ctx, mdKey{}, md) -} - -// FromContext returns the MD in ctx if it exists. -// The returned md should be immutable, writing to it may cause races. -// Modification should be made to the copies of the returned md. -func FromContext(ctx context.Context) (md MD, ok bool) { - md, ok = ctx.Value(mdKey{}).(MD) - return -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/naming/naming.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/naming/naming.go deleted file mode 100644 index c2e0871e6f8..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/naming/naming.go +++ /dev/null @@ -1,74 +0,0 @@ -/* - * - * Copyright 2014, Google Inc. - * 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. - * - */ - -// Package naming defines the naming API and related data structures for gRPC. -// The interface is EXPERIMENTAL and may be suject to change. -package naming - -// Operation defines the corresponding operations for a name resolution change. -type Operation uint8 - -const ( - // Add indicates a new address is added. - Add Operation = iota - // Delete indicates an exisiting address is deleted. - Delete -) - -// Update defines a name resolution update. Notice that it is not valid having both -// empty string Addr and nil Metadata in an Update. -type Update struct { - // Op indicates the operation of the update. - Op Operation - // Addr is the updated address. It is empty string if there is no address update. - Addr string - // Metadata is the updated metadata. It is nil if there is no metadata update. - // Metadata is not required for a custom naming implementation. - Metadata interface{} -} - -// Resolver creates a Watcher for a target to track its resolution changes. -type Resolver interface { - // Resolve creates a Watcher for target. - Resolve(target string) (Watcher, error) -} - -// Watcher watches for the updates on the specified target. -type Watcher interface { - // Next blocks until an update or error happens. It may return one or more - // updates. The first call should get the full set of the results. It should - // return an error if and only if Watcher cannot recover. - Next() ([]*Update, error) - // Close closes the Watcher. - Close() -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/peer/peer.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/peer/peer.go deleted file mode 100644 index bfa6205ba9e..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/peer/peer.go +++ /dev/null @@ -1,65 +0,0 @@ -/* - * - * Copyright 2014, Google Inc. - * 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. - * - */ - -// Package peer defines various peer information associated with RPCs and -// corresponding utils. -package peer - -import ( - "net" - - "golang.org/x/net/context" - "google.golang.org/grpc/credentials" -) - -// Peer contains the information of the peer for an RPC. -type Peer struct { - // Addr is the peer address. - Addr net.Addr - // AuthInfo is the authentication information of the transport. - // It is nil if there is no transport security being used. - AuthInfo credentials.AuthInfo -} - -type peerKey struct{} - -// NewContext creates a new context with peer information attached. -func NewContext(ctx context.Context, p *Peer) context.Context { - return context.WithValue(ctx, peerKey{}, p) -} - -// FromContext returns the peer information in ctx if it exists. -func FromContext(ctx context.Context) (p *Peer, ok bool) { - p, ok = ctx.Value(peerKey{}).(*Peer) - return -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/rpc_util.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/rpc_util.go deleted file mode 100644 index 28aab0a3f98..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/rpc_util.go +++ /dev/null @@ -1,532 +0,0 @@ -/* - * - * Copyright 2014, Google Inc. - * 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. - * - */ - -package grpc - -import ( - "bytes" - "compress/gzip" - "encoding/binary" - "fmt" - "io" - "io/ioutil" - "math" - "os" - "time" - - "github.com/golang/protobuf/proto" - "golang.org/x/net/context" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/peer" - "google.golang.org/grpc/stats" - "google.golang.org/grpc/transport" -) - -// Codec defines the interface gRPC uses to encode and decode messages. -type Codec interface { - // Marshal returns the wire format of v. - Marshal(v interface{}) ([]byte, error) - // Unmarshal parses the wire format into v. - Unmarshal(data []byte, v interface{}) error - // String returns the name of the Codec implementation. The returned - // string will be used as part of content type in transmission. - String() string -} - -// protoCodec is a Codec implementation with protobuf. It is the default codec for gRPC. -type protoCodec struct{} - -func (protoCodec) Marshal(v interface{}) ([]byte, error) { - return proto.Marshal(v.(proto.Message)) -} - -func (protoCodec) Unmarshal(data []byte, v interface{}) error { - return proto.Unmarshal(data, v.(proto.Message)) -} - -func (protoCodec) String() string { - return "proto" -} - -// Compressor defines the interface gRPC uses to compress a message. -type Compressor interface { - // Do compresses p into w. - Do(w io.Writer, p []byte) error - // Type returns the compression algorithm the Compressor uses. - Type() string -} - -// NewGZIPCompressor creates a Compressor based on GZIP. -func NewGZIPCompressor() Compressor { - return &gzipCompressor{} -} - -type gzipCompressor struct { -} - -func (c *gzipCompressor) Do(w io.Writer, p []byte) error { - z := gzip.NewWriter(w) - if _, err := z.Write(p); err != nil { - return err - } - return z.Close() -} - -func (c *gzipCompressor) Type() string { - return "gzip" -} - -// Decompressor defines the interface gRPC uses to decompress a message. -type Decompressor interface { - // Do reads the data from r and uncompress them. - Do(r io.Reader) ([]byte, error) - // Type returns the compression algorithm the Decompressor uses. - Type() string -} - -type gzipDecompressor struct { -} - -// NewGZIPDecompressor creates a Decompressor based on GZIP. -func NewGZIPDecompressor() Decompressor { - return &gzipDecompressor{} -} - -func (d *gzipDecompressor) Do(r io.Reader) ([]byte, error) { - z, err := gzip.NewReader(r) - if err != nil { - return nil, err - } - defer z.Close() - return ioutil.ReadAll(z) -} - -func (d *gzipDecompressor) Type() string { - return "gzip" -} - -// callInfo contains all related configuration and information about an RPC. -type callInfo struct { - failFast bool - headerMD metadata.MD - trailerMD metadata.MD - peer *peer.Peer - traceInfo traceInfo // in trace.go -} - -var defaultCallInfo = callInfo{failFast: true} - -// CallOption configures a Call before it starts or extracts information from -// a Call after it completes. -type CallOption interface { - // before is called before the call is sent to any server. If before - // returns a non-nil error, the RPC fails with that error. - before(*callInfo) error - - // after is called after the call has completed. after cannot return an - // error, so any failures should be reported via output parameters. - after(*callInfo) -} - -type beforeCall func(c *callInfo) error - -func (o beforeCall) before(c *callInfo) error { return o(c) } -func (o beforeCall) after(c *callInfo) {} - -type afterCall func(c *callInfo) - -func (o afterCall) before(c *callInfo) error { return nil } -func (o afterCall) after(c *callInfo) { o(c) } - -// Header returns a CallOptions that retrieves the header metadata -// for a unary RPC. -func Header(md *metadata.MD) CallOption { - return afterCall(func(c *callInfo) { - *md = c.headerMD - }) -} - -// Trailer returns a CallOptions that retrieves the trailer metadata -// for a unary RPC. -func Trailer(md *metadata.MD) CallOption { - return afterCall(func(c *callInfo) { - *md = c.trailerMD - }) -} - -// Peer returns a CallOption that retrieves peer information for a -// unary RPC. -func Peer(peer *peer.Peer) CallOption { - return afterCall(func(c *callInfo) { - *peer = *c.peer - }) -} - -// FailFast configures the action to take when an RPC is attempted on broken -// connections or unreachable servers. If failfast is true, the RPC will fail -// immediately. Otherwise, the RPC client will block the call until a -// connection is available (or the call is canceled or times out) and will retry -// the call if it fails due to a transient error. Please refer to -// https://github.com/grpc/grpc/blob/master/doc/fail_fast.md. Note: failFast is default to true. -func FailFast(failFast bool) CallOption { - return beforeCall(func(c *callInfo) error { - c.failFast = failFast - return nil - }) -} - -// The format of the payload: compressed or not? -type payloadFormat uint8 - -const ( - compressionNone payloadFormat = iota // no compression - compressionMade -) - -// parser reads complete gRPC messages from the underlying reader. -type parser struct { - // r is the underlying reader. - // See the comment on recvMsg for the permissible - // error types. - r io.Reader - - // The header of a gRPC message. Find more detail - // at http://www.grpc.io/docs/guides/wire.html. - header [5]byte -} - -// recvMsg reads a complete gRPC message from the stream. -// -// It returns the message and its payload (compression/encoding) -// format. The caller owns the returned msg memory. -// -// If there is an error, possible values are: -// * io.EOF, when no messages remain -// * io.ErrUnexpectedEOF -// * of type transport.ConnectionError -// * of type transport.StreamError -// No other error values or types must be returned, which also means -// that the underlying io.Reader must not return an incompatible -// error. -func (p *parser) recvMsg(maxMsgSize int) (pf payloadFormat, msg []byte, err error) { - if _, err := io.ReadFull(p.r, p.header[:]); err != nil { - return 0, nil, err - } - - pf = payloadFormat(p.header[0]) - length := binary.BigEndian.Uint32(p.header[1:]) - - if length == 0 { - return pf, nil, nil - } - if length > uint32(maxMsgSize) { - return 0, nil, Errorf(codes.Internal, "grpc: received message length %d exceeding the max size %d", length, maxMsgSize) - } - // TODO(bradfitz,zhaoq): garbage. reuse buffer after proto decoding instead - // of making it for each message: - msg = make([]byte, int(length)) - if _, err := io.ReadFull(p.r, msg); err != nil { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - return 0, nil, err - } - return pf, msg, nil -} - -// encode serializes msg and prepends the message header. If msg is nil, it -// generates the message header of 0 message length. -func encode(c Codec, msg interface{}, cp Compressor, cbuf *bytes.Buffer, outPayload *stats.OutPayload) ([]byte, error) { - var ( - b []byte - length uint - ) - if msg != nil { - var err error - // TODO(zhaoq): optimize to reduce memory alloc and copying. - b, err = c.Marshal(msg) - if err != nil { - return nil, err - } - if outPayload != nil { - outPayload.Payload = msg - // TODO truncate large payload. - outPayload.Data = b - outPayload.Length = len(b) - } - if cp != nil { - if err := cp.Do(cbuf, b); err != nil { - return nil, err - } - b = cbuf.Bytes() - } - length = uint(len(b)) - } - if length > math.MaxUint32 { - return nil, Errorf(codes.InvalidArgument, "grpc: message too large (%d bytes)", length) - } - - const ( - payloadLen = 1 - sizeLen = 4 - ) - - var buf = make([]byte, payloadLen+sizeLen+len(b)) - - // Write payload format - if cp == nil { - buf[0] = byte(compressionNone) - } else { - buf[0] = byte(compressionMade) - } - // Write length of b into buf - binary.BigEndian.PutUint32(buf[1:], uint32(length)) - // Copy encoded msg to buf - copy(buf[5:], b) - - if outPayload != nil { - outPayload.WireLength = len(buf) - } - - return buf, nil -} - -func checkRecvPayload(pf payloadFormat, recvCompress string, dc Decompressor) error { - switch pf { - case compressionNone: - case compressionMade: - if dc == nil || recvCompress != dc.Type() { - return Errorf(codes.Unimplemented, "grpc: Decompressor is not installed for grpc-encoding %q", recvCompress) - } - default: - return Errorf(codes.Internal, "grpc: received unexpected payload format %d", pf) - } - return nil -} - -func recv(p *parser, c Codec, s *transport.Stream, dc Decompressor, m interface{}, maxMsgSize int, inPayload *stats.InPayload) error { - pf, d, err := p.recvMsg(maxMsgSize) - if err != nil { - return err - } - if inPayload != nil { - inPayload.WireLength = len(d) - } - if err := checkRecvPayload(pf, s.RecvCompress(), dc); err != nil { - return err - } - if pf == compressionMade { - d, err = dc.Do(bytes.NewReader(d)) - if err != nil { - return Errorf(codes.Internal, "grpc: failed to decompress the received message %v", err) - } - } - if len(d) > maxMsgSize { - // TODO: Revisit the error code. Currently keep it consistent with java - // implementation. - return Errorf(codes.Internal, "grpc: received a message of %d bytes exceeding %d limit", len(d), maxMsgSize) - } - if err := c.Unmarshal(d, m); err != nil { - return Errorf(codes.Internal, "grpc: failed to unmarshal the received message %v", err) - } - if inPayload != nil { - inPayload.RecvTime = time.Now() - inPayload.Payload = m - // TODO truncate large payload. - inPayload.Data = d - inPayload.Length = len(d) - } - return nil -} - -// rpcError defines the status from an RPC. -type rpcError struct { - code codes.Code - desc string -} - -func (e *rpcError) Error() string { - return fmt.Sprintf("rpc error: code = %s desc = %s", e.code, e.desc) -} - -// Code returns the error code for err if it was produced by the rpc system. -// Otherwise, it returns codes.Unknown. -func Code(err error) codes.Code { - if err == nil { - return codes.OK - } - if e, ok := err.(*rpcError); ok { - return e.code - } - return codes.Unknown -} - -// ErrorDesc returns the error description of err if it was produced by the rpc system. -// Otherwise, it returns err.Error() or empty string when err is nil. -func ErrorDesc(err error) string { - if err == nil { - return "" - } - if e, ok := err.(*rpcError); ok { - return e.desc - } - return err.Error() -} - -// Errorf returns an error containing an error code and a description; -// Errorf returns nil if c is OK. -func Errorf(c codes.Code, format string, a ...interface{}) error { - if c == codes.OK { - return nil - } - return &rpcError{ - code: c, - desc: fmt.Sprintf(format, a...), - } -} - -// toRPCErr converts an error into a rpcError. -func toRPCErr(err error) error { - switch e := err.(type) { - case *rpcError: - return err - case transport.StreamError: - return &rpcError{ - code: e.Code, - desc: e.Desc, - } - case transport.ConnectionError: - return &rpcError{ - code: codes.Internal, - desc: e.Desc, - } - default: - switch err { - case context.DeadlineExceeded: - return &rpcError{ - code: codes.DeadlineExceeded, - desc: err.Error(), - } - case context.Canceled: - return &rpcError{ - code: codes.Canceled, - desc: err.Error(), - } - case ErrClientConnClosing: - return &rpcError{ - code: codes.FailedPrecondition, - desc: err.Error(), - } - } - - } - return Errorf(codes.Unknown, "%v", err) -} - -// convertCode converts a standard Go error into its canonical code. Note that -// this is only used to translate the error returned by the server applications. -func convertCode(err error) codes.Code { - switch err { - case nil: - return codes.OK - case io.EOF: - return codes.OutOfRange - case io.ErrClosedPipe, io.ErrNoProgress, io.ErrShortBuffer, io.ErrShortWrite, io.ErrUnexpectedEOF: - return codes.FailedPrecondition - case os.ErrInvalid: - return codes.InvalidArgument - case context.Canceled: - return codes.Canceled - case context.DeadlineExceeded: - return codes.DeadlineExceeded - } - switch { - case os.IsExist(err): - return codes.AlreadyExists - case os.IsNotExist(err): - return codes.NotFound - case os.IsPermission(err): - return codes.PermissionDenied - } - return codes.Unknown -} - -// MethodConfig defines the configuration recommended by the service providers for a -// particular method. -// This is EXPERIMENTAL and subject to change. -type MethodConfig struct { - // WaitForReady indicates whether RPCs sent to this method should wait until - // the connection is ready by default (!failfast). The value specified via the - // gRPC client API will override the value set here. - WaitForReady bool - // Timeout is the default timeout for RPCs sent to this method. The actual - // deadline used will be the minimum of the value specified here and the value - // set by the application via the gRPC client API. If either one is not set, - // then the other will be used. If neither is set, then the RPC has no deadline. - Timeout time.Duration - // MaxReqSize is the maximum allowed payload size for an individual request in a - // stream (client->server) in bytes. The size which is measured is the serialized - // payload after per-message compression (but before stream compression) in bytes. - // The actual value used is the minumum of the value specified here and the value set - // by the application via the gRPC client API. If either one is not set, then the other - // will be used. If neither is set, then the built-in default is used. - // TODO: support this. - MaxReqSize uint32 - // MaxRespSize is the maximum allowed payload size for an individual response in a - // stream (server->client) in bytes. - // TODO: support this. - MaxRespSize uint32 -} - -// ServiceConfig is provided by the service provider and contains parameters for how -// clients that connect to the service should behave. -// This is EXPERIMENTAL and subject to change. -type ServiceConfig struct { - // LB is the load balancer the service providers recommends. The balancer specified - // via grpc.WithBalancer will override this. - LB Balancer - // Methods contains a map for the methods in this service. - Methods map[string]MethodConfig -} - -// SupportPackageIsVersion4 is referenced from generated protocol buffer files -// to assert that that code is compatible with this version of the grpc package. -// -// This constant may be renamed in the future if a change in the generated code -// requires a synchronised update of grpc-go and protoc-gen-go. This constant -// should not be referenced from any other code. -const SupportPackageIsVersion4 = true - -// Version is the current grpc version. -const Version = "1.2.1" diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/server.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/server.go deleted file mode 100644 index 157f35eea50..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/server.go +++ /dev/null @@ -1,1085 +0,0 @@ -/* - * - * Copyright 2014, Google Inc. - * 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. - * - */ - -package grpc - -import ( - "bytes" - "errors" - "fmt" - "io" - "net" - "net/http" - "reflect" - "runtime" - "strings" - "sync" - "time" - - "golang.org/x/net/context" - "golang.org/x/net/http2" - "golang.org/x/net/trace" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/internal" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/stats" - "google.golang.org/grpc/tap" - "google.golang.org/grpc/transport" -) - -type methodHandler func(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor UnaryServerInterceptor) (interface{}, error) - -// MethodDesc represents an RPC service's method specification. -type MethodDesc struct { - MethodName string - Handler methodHandler -} - -// ServiceDesc represents an RPC service's specification. -type ServiceDesc struct { - ServiceName string - // The pointer to the service interface. Used to check whether the user - // provided implementation satisfies the interface requirements. - HandlerType interface{} - Methods []MethodDesc - Streams []StreamDesc - Metadata interface{} -} - -// service consists of the information of the server serving this service and -// the methods in this service. -type service struct { - server interface{} // the server for service methods - md map[string]*MethodDesc - sd map[string]*StreamDesc - mdata interface{} -} - -// Server is a gRPC server to serve RPC requests. -type Server struct { - opts options - - mu sync.Mutex // guards following - lis map[net.Listener]bool - conns map[io.Closer]bool - drain bool - ctx context.Context - cancel context.CancelFunc - // A CondVar to let GracefulStop() blocks until all the pending RPCs are finished - // and all the transport goes away. - cv *sync.Cond - m map[string]*service // service name -> service info - events trace.EventLog -} - -type options struct { - creds credentials.TransportCredentials - codec Codec - cp Compressor - dc Decompressor - maxMsgSize int - unaryInt UnaryServerInterceptor - streamInt StreamServerInterceptor - inTapHandle tap.ServerInHandle - statsHandler stats.Handler - maxConcurrentStreams uint32 - useHandlerImpl bool // use http.Handler-based server - unknownStreamDesc *StreamDesc -} - -var defaultMaxMsgSize = 1024 * 1024 * 4 // use 4MB as the default message size limit - -// A ServerOption sets options. -type ServerOption func(*options) - -// CustomCodec returns a ServerOption that sets a codec for message marshaling and unmarshaling. -func CustomCodec(codec Codec) ServerOption { - return func(o *options) { - o.codec = codec - } -} - -// RPCCompressor returns a ServerOption that sets a compressor for outbound messages. -func RPCCompressor(cp Compressor) ServerOption { - return func(o *options) { - o.cp = cp - } -} - -// RPCDecompressor returns a ServerOption that sets a decompressor for inbound messages. -func RPCDecompressor(dc Decompressor) ServerOption { - return func(o *options) { - o.dc = dc - } -} - -// MaxMsgSize returns a ServerOption to set the max message size in bytes for inbound mesages. -// If this is not set, gRPC uses the default 4MB. -func MaxMsgSize(m int) ServerOption { - return func(o *options) { - o.maxMsgSize = m - } -} - -// MaxConcurrentStreams returns a ServerOption that will apply a limit on the number -// of concurrent streams to each ServerTransport. -func MaxConcurrentStreams(n uint32) ServerOption { - return func(o *options) { - o.maxConcurrentStreams = n - } -} - -// Creds returns a ServerOption that sets credentials for server connections. -func Creds(c credentials.TransportCredentials) ServerOption { - return func(o *options) { - o.creds = c - } -} - -// UnaryInterceptor returns a ServerOption that sets the UnaryServerInterceptor for the -// server. Only one unary interceptor can be installed. The construction of multiple -// interceptors (e.g., chaining) can be implemented at the caller. -func UnaryInterceptor(i UnaryServerInterceptor) ServerOption { - return func(o *options) { - if o.unaryInt != nil { - panic("The unary server interceptor has been set.") - } - o.unaryInt = i - } -} - -// StreamInterceptor returns a ServerOption that sets the StreamServerInterceptor for the -// server. Only one stream interceptor can be installed. -func StreamInterceptor(i StreamServerInterceptor) ServerOption { - return func(o *options) { - if o.streamInt != nil { - panic("The stream server interceptor has been set.") - } - o.streamInt = i - } -} - -// InTapHandle returns a ServerOption that sets the tap handle for all the server -// transport to be created. Only one can be installed. -func InTapHandle(h tap.ServerInHandle) ServerOption { - return func(o *options) { - if o.inTapHandle != nil { - panic("The tap handle has been set.") - } - o.inTapHandle = h - } -} - -// StatsHandler returns a ServerOption that sets the stats handler for the server. -func StatsHandler(h stats.Handler) ServerOption { - return func(o *options) { - o.statsHandler = h - } -} - -// UnknownServiceHandler returns a ServerOption that allows for adding a custom -// unknown service handler. The provided method is a bidi-streaming RPC service -// handler that will be invoked instead of returning the the "unimplemented" gRPC -// error whenever a request is received for an unregistered service or method. -// The handling function has full access to the Context of the request and the -// stream, and the invocation passes through interceptors. -func UnknownServiceHandler(streamHandler StreamHandler) ServerOption { - return func(o *options) { - o.unknownStreamDesc = &StreamDesc{ - StreamName: "unknown_service_handler", - Handler: streamHandler, - // We need to assume that the users of the streamHandler will want to use both. - ClientStreams: true, - ServerStreams: true, - } - } -} - -// NewServer creates a gRPC server which has no service registered and has not -// started to accept requests yet. -func NewServer(opt ...ServerOption) *Server { - var opts options - opts.maxMsgSize = defaultMaxMsgSize - for _, o := range opt { - o(&opts) - } - if opts.codec == nil { - // Set the default codec. - opts.codec = protoCodec{} - } - s := &Server{ - lis: make(map[net.Listener]bool), - opts: opts, - conns: make(map[io.Closer]bool), - m: make(map[string]*service), - } - s.cv = sync.NewCond(&s.mu) - s.ctx, s.cancel = context.WithCancel(context.Background()) - if EnableTracing { - _, file, line, _ := runtime.Caller(1) - s.events = trace.NewEventLog("grpc.Server", fmt.Sprintf("%s:%d", file, line)) - } - return s -} - -// printf records an event in s's event log, unless s has been stopped. -// REQUIRES s.mu is held. -func (s *Server) printf(format string, a ...interface{}) { - if s.events != nil { - s.events.Printf(format, a...) - } -} - -// errorf records an error in s's event log, unless s has been stopped. -// REQUIRES s.mu is held. -func (s *Server) errorf(format string, a ...interface{}) { - if s.events != nil { - s.events.Errorf(format, a...) - } -} - -// RegisterService register a service and its implementation to the gRPC -// server. Called from the IDL generated code. This must be called before -// invoking Serve. -func (s *Server) RegisterService(sd *ServiceDesc, ss interface{}) { - ht := reflect.TypeOf(sd.HandlerType).Elem() - st := reflect.TypeOf(ss) - if !st.Implements(ht) { - grpclog.Fatalf("grpc: Server.RegisterService found the handler of type %v that does not satisfy %v", st, ht) - } - s.register(sd, ss) -} - -func (s *Server) register(sd *ServiceDesc, ss interface{}) { - s.mu.Lock() - defer s.mu.Unlock() - s.printf("RegisterService(%q)", sd.ServiceName) - if _, ok := s.m[sd.ServiceName]; ok { - grpclog.Fatalf("grpc: Server.RegisterService found duplicate service registration for %q", sd.ServiceName) - } - srv := &service{ - server: ss, - md: make(map[string]*MethodDesc), - sd: make(map[string]*StreamDesc), - mdata: sd.Metadata, - } - for i := range sd.Methods { - d := &sd.Methods[i] - srv.md[d.MethodName] = d - } - for i := range sd.Streams { - d := &sd.Streams[i] - srv.sd[d.StreamName] = d - } - s.m[sd.ServiceName] = srv -} - -// MethodInfo contains the information of an RPC including its method name and type. -type MethodInfo struct { - // Name is the method name only, without the service name or package name. - Name string - // IsClientStream indicates whether the RPC is a client streaming RPC. - IsClientStream bool - // IsServerStream indicates whether the RPC is a server streaming RPC. - IsServerStream bool -} - -// ServiceInfo contains unary RPC method info, streaming RPC methid info and metadata for a service. -type ServiceInfo struct { - Methods []MethodInfo - // Metadata is the metadata specified in ServiceDesc when registering service. - Metadata interface{} -} - -// GetServiceInfo returns a map from service names to ServiceInfo. -// Service names include the package names, in the form of .. -func (s *Server) GetServiceInfo() map[string]ServiceInfo { - ret := make(map[string]ServiceInfo) - for n, srv := range s.m { - methods := make([]MethodInfo, 0, len(srv.md)+len(srv.sd)) - for m := range srv.md { - methods = append(methods, MethodInfo{ - Name: m, - IsClientStream: false, - IsServerStream: false, - }) - } - for m, d := range srv.sd { - methods = append(methods, MethodInfo{ - Name: m, - IsClientStream: d.ClientStreams, - IsServerStream: d.ServerStreams, - }) - } - - ret[n] = ServiceInfo{ - Methods: methods, - Metadata: srv.mdata, - } - } - return ret -} - -var ( - // ErrServerStopped indicates that the operation is now illegal because of - // the server being stopped. - ErrServerStopped = errors.New("grpc: the server has been stopped") -) - -func (s *Server) useTransportAuthenticator(rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) { - if s.opts.creds == nil { - return rawConn, nil, nil - } - return s.opts.creds.ServerHandshake(rawConn) -} - -// Serve accepts incoming connections on the listener lis, creating a new -// ServerTransport and service goroutine for each. The service goroutines -// read gRPC requests and then call the registered handlers to reply to them. -// Serve returns when lis.Accept fails with fatal errors. lis will be closed when -// this method returns. -// Serve always returns non-nil error. -func (s *Server) Serve(lis net.Listener) error { - s.mu.Lock() - s.printf("serving") - if s.lis == nil { - s.mu.Unlock() - lis.Close() - return ErrServerStopped - } - s.lis[lis] = true - s.mu.Unlock() - defer func() { - s.mu.Lock() - if s.lis != nil && s.lis[lis] { - lis.Close() - delete(s.lis, lis) - } - s.mu.Unlock() - }() - - var tempDelay time.Duration // how long to sleep on accept failure - - for { - rawConn, err := lis.Accept() - if err != nil { - if ne, ok := err.(interface { - Temporary() bool - }); ok && ne.Temporary() { - if tempDelay == 0 { - tempDelay = 5 * time.Millisecond - } else { - tempDelay *= 2 - } - if max := 1 * time.Second; tempDelay > max { - tempDelay = max - } - s.mu.Lock() - s.printf("Accept error: %v; retrying in %v", err, tempDelay) - s.mu.Unlock() - select { - case <-time.After(tempDelay): - case <-s.ctx.Done(): - } - continue - } - s.mu.Lock() - s.printf("done serving; Accept = %v", err) - s.mu.Unlock() - return err - } - tempDelay = 0 - // Start a new goroutine to deal with rawConn - // so we don't stall this Accept loop goroutine. - go s.handleRawConn(rawConn) - } -} - -// handleRawConn is run in its own goroutine and handles a just-accepted -// connection that has not had any I/O performed on it yet. -func (s *Server) handleRawConn(rawConn net.Conn) { - conn, authInfo, err := s.useTransportAuthenticator(rawConn) - if err != nil { - s.mu.Lock() - s.errorf("ServerHandshake(%q) failed: %v", rawConn.RemoteAddr(), err) - s.mu.Unlock() - grpclog.Printf("grpc: Server.Serve failed to complete security handshake from %q: %v", rawConn.RemoteAddr(), err) - // If serverHandShake returns ErrConnDispatched, keep rawConn open. - if err != credentials.ErrConnDispatched { - rawConn.Close() - } - return - } - - s.mu.Lock() - if s.conns == nil { - s.mu.Unlock() - conn.Close() - return - } - s.mu.Unlock() - - if s.opts.useHandlerImpl { - s.serveUsingHandler(conn) - } else { - s.serveHTTP2Transport(conn, authInfo) - } -} - -// serveHTTP2Transport sets up a http/2 transport (using the -// gRPC http2 server transport in transport/http2_server.go) and -// serves streams on it. -// This is run in its own goroutine (it does network I/O in -// transport.NewServerTransport). -func (s *Server) serveHTTP2Transport(c net.Conn, authInfo credentials.AuthInfo) { - config := &transport.ServerConfig{ - MaxStreams: s.opts.maxConcurrentStreams, - AuthInfo: authInfo, - InTapHandle: s.opts.inTapHandle, - StatsHandler: s.opts.statsHandler, - } - st, err := transport.NewServerTransport("http2", c, config) - if err != nil { - s.mu.Lock() - s.errorf("NewServerTransport(%q) failed: %v", c.RemoteAddr(), err) - s.mu.Unlock() - c.Close() - grpclog.Println("grpc: Server.Serve failed to create ServerTransport: ", err) - return - } - if !s.addConn(st) { - st.Close() - return - } - s.serveStreams(st) -} - -func (s *Server) serveStreams(st transport.ServerTransport) { - defer s.removeConn(st) - defer st.Close() - var wg sync.WaitGroup - st.HandleStreams(func(stream *transport.Stream) { - wg.Add(1) - go func() { - defer wg.Done() - s.handleStream(st, stream, s.traceInfo(st, stream)) - }() - }, func(ctx context.Context, method string) context.Context { - if !EnableTracing { - return ctx - } - tr := trace.New("grpc.Recv."+methodFamily(method), method) - return trace.NewContext(ctx, tr) - }) - wg.Wait() -} - -var _ http.Handler = (*Server)(nil) - -// serveUsingHandler is called from handleRawConn when s is configured -// to handle requests via the http.Handler interface. It sets up a -// net/http.Server to handle the just-accepted conn. The http.Server -// is configured to route all incoming requests (all HTTP/2 streams) -// to ServeHTTP, which creates a new ServerTransport for each stream. -// serveUsingHandler blocks until conn closes. -// -// This codepath is only used when Server.TestingUseHandlerImpl has -// been configured. This lets the end2end tests exercise the ServeHTTP -// method as one of the environment types. -// -// conn is the *tls.Conn that's already been authenticated. -func (s *Server) serveUsingHandler(conn net.Conn) { - if !s.addConn(conn) { - conn.Close() - return - } - defer s.removeConn(conn) - h2s := &http2.Server{ - MaxConcurrentStreams: s.opts.maxConcurrentStreams, - } - h2s.ServeConn(conn, &http2.ServeConnOpts{ - Handler: s, - }) -} - -func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { - st, err := transport.NewServerHandlerTransport(w, r) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - if !s.addConn(st) { - st.Close() - return - } - defer s.removeConn(st) - s.serveStreams(st) -} - -// traceInfo returns a traceInfo and associates it with stream, if tracing is enabled. -// If tracing is not enabled, it returns nil. -func (s *Server) traceInfo(st transport.ServerTransport, stream *transport.Stream) (trInfo *traceInfo) { - tr, ok := trace.FromContext(stream.Context()) - if !ok { - return nil - } - - trInfo = &traceInfo{ - tr: tr, - } - trInfo.firstLine.client = false - trInfo.firstLine.remoteAddr = st.RemoteAddr() - - if dl, ok := stream.Context().Deadline(); ok { - trInfo.firstLine.deadline = dl.Sub(time.Now()) - } - return trInfo -} - -func (s *Server) addConn(c io.Closer) bool { - s.mu.Lock() - defer s.mu.Unlock() - if s.conns == nil || s.drain { - return false - } - s.conns[c] = true - return true -} - -func (s *Server) removeConn(c io.Closer) { - s.mu.Lock() - defer s.mu.Unlock() - if s.conns != nil { - delete(s.conns, c) - s.cv.Broadcast() - } -} - -func (s *Server) sendResponse(t transport.ServerTransport, stream *transport.Stream, msg interface{}, cp Compressor, opts *transport.Options) error { - var ( - cbuf *bytes.Buffer - outPayload *stats.OutPayload - ) - if cp != nil { - cbuf = new(bytes.Buffer) - } - if s.opts.statsHandler != nil { - outPayload = &stats.OutPayload{} - } - p, err := encode(s.opts.codec, msg, cp, cbuf, outPayload) - if err != nil { - // This typically indicates a fatal issue (e.g., memory - // corruption or hardware faults) the application program - // cannot handle. - // - // TODO(zhaoq): There exist other options also such as only closing the - // faulty stream locally and remotely (Other streams can keep going). Find - // the optimal option. - grpclog.Fatalf("grpc: Server failed to encode response %v", err) - } - err = t.Write(stream, p, opts) - if err == nil && outPayload != nil { - outPayload.SentTime = time.Now() - s.opts.statsHandler.HandleRPC(stream.Context(), outPayload) - } - return err -} - -func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.Stream, srv *service, md *MethodDesc, trInfo *traceInfo) (err error) { - sh := s.opts.statsHandler - if sh != nil { - begin := &stats.Begin{ - BeginTime: time.Now(), - } - sh.HandleRPC(stream.Context(), begin) - } - defer func() { - if sh != nil { - end := &stats.End{ - EndTime: time.Now(), - } - if err != nil && err != io.EOF { - end.Error = toRPCErr(err) - } - sh.HandleRPC(stream.Context(), end) - } - }() - if trInfo != nil { - defer trInfo.tr.Finish() - trInfo.firstLine.client = false - trInfo.tr.LazyLog(&trInfo.firstLine, false) - defer func() { - if err != nil && err != io.EOF { - trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) - trInfo.tr.SetError() - } - }() - } - if s.opts.cp != nil { - // NOTE: this needs to be ahead of all handling, https://github.com/grpc/grpc-go/issues/686. - stream.SetSendCompress(s.opts.cp.Type()) - } - p := &parser{r: stream} - for { - pf, req, err := p.recvMsg(s.opts.maxMsgSize) - if err == io.EOF { - // The entire stream is done (for unary RPC only). - return err - } - if err == io.ErrUnexpectedEOF { - err = Errorf(codes.Internal, io.ErrUnexpectedEOF.Error()) - } - if err != nil { - switch err := err.(type) { - case *rpcError: - if e := t.WriteStatus(stream, err.code, err.desc); e != nil { - grpclog.Printf("grpc: Server.processUnaryRPC failed to write status %v", e) - } - case transport.ConnectionError: - // Nothing to do here. - case transport.StreamError: - if e := t.WriteStatus(stream, err.Code, err.Desc); e != nil { - grpclog.Printf("grpc: Server.processUnaryRPC failed to write status %v", e) - } - default: - panic(fmt.Sprintf("grpc: Unexpected error (%T) from recvMsg: %v", err, err)) - } - return err - } - - if err := checkRecvPayload(pf, stream.RecvCompress(), s.opts.dc); err != nil { - switch err := err.(type) { - case *rpcError: - if e := t.WriteStatus(stream, err.code, err.desc); e != nil { - grpclog.Printf("grpc: Server.processUnaryRPC failed to write status %v", e) - } - return err - default: - if e := t.WriteStatus(stream, codes.Internal, err.Error()); e != nil { - grpclog.Printf("grpc: Server.processUnaryRPC failed to write status %v", e) - } - // TODO checkRecvPayload always return RPC error. Add a return here if necessary. - } - } - var inPayload *stats.InPayload - if sh != nil { - inPayload = &stats.InPayload{ - RecvTime: time.Now(), - } - } - statusCode := codes.OK - statusDesc := "" - df := func(v interface{}) error { - if inPayload != nil { - inPayload.WireLength = len(req) - } - if pf == compressionMade { - var err error - req, err = s.opts.dc.Do(bytes.NewReader(req)) - if err != nil { - if err := t.WriteStatus(stream, codes.Internal, err.Error()); err != nil { - grpclog.Printf("grpc: Server.processUnaryRPC failed to write status %v", err) - } - return Errorf(codes.Internal, err.Error()) - } - } - if len(req) > s.opts.maxMsgSize { - // TODO: Revisit the error code. Currently keep it consistent with - // java implementation. - statusCode = codes.Internal - statusDesc = fmt.Sprintf("grpc: server received a message of %d bytes exceeding %d limit", len(req), s.opts.maxMsgSize) - } - if err := s.opts.codec.Unmarshal(req, v); err != nil { - return err - } - if inPayload != nil { - inPayload.Payload = v - inPayload.Data = req - inPayload.Length = len(req) - sh.HandleRPC(stream.Context(), inPayload) - } - if trInfo != nil { - trInfo.tr.LazyLog(&payload{sent: false, msg: v}, true) - } - return nil - } - reply, appErr := md.Handler(srv.server, stream.Context(), df, s.opts.unaryInt) - if appErr != nil { - if err, ok := appErr.(*rpcError); ok { - statusCode = err.code - statusDesc = err.desc - } else { - statusCode = convertCode(appErr) - statusDesc = appErr.Error() - } - if trInfo != nil && statusCode != codes.OK { - trInfo.tr.LazyLog(stringer(statusDesc), true) - trInfo.tr.SetError() - } - if err := t.WriteStatus(stream, statusCode, statusDesc); err != nil { - grpclog.Printf("grpc: Server.processUnaryRPC failed to write status: %v", err) - } - return Errorf(statusCode, statusDesc) - } - if trInfo != nil { - trInfo.tr.LazyLog(stringer("OK"), false) - } - opts := &transport.Options{ - Last: true, - Delay: false, - } - if err := s.sendResponse(t, stream, reply, s.opts.cp, opts); err != nil { - switch err := err.(type) { - case transport.ConnectionError: - // Nothing to do here. - case transport.StreamError: - statusCode = err.Code - statusDesc = err.Desc - default: - statusCode = codes.Unknown - statusDesc = err.Error() - } - return err - } - if trInfo != nil { - trInfo.tr.LazyLog(&payload{sent: true, msg: reply}, true) - } - errWrite := t.WriteStatus(stream, statusCode, statusDesc) - if statusCode != codes.OK { - return Errorf(statusCode, statusDesc) - } - return errWrite - } -} - -func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transport.Stream, srv *service, sd *StreamDesc, trInfo *traceInfo) (err error) { - sh := s.opts.statsHandler - if sh != nil { - begin := &stats.Begin{ - BeginTime: time.Now(), - } - sh.HandleRPC(stream.Context(), begin) - } - defer func() { - if sh != nil { - end := &stats.End{ - EndTime: time.Now(), - } - if err != nil && err != io.EOF { - end.Error = toRPCErr(err) - } - sh.HandleRPC(stream.Context(), end) - } - }() - if s.opts.cp != nil { - stream.SetSendCompress(s.opts.cp.Type()) - } - ss := &serverStream{ - t: t, - s: stream, - p: &parser{r: stream}, - codec: s.opts.codec, - cp: s.opts.cp, - dc: s.opts.dc, - maxMsgSize: s.opts.maxMsgSize, - trInfo: trInfo, - statsHandler: sh, - } - if ss.cp != nil { - ss.cbuf = new(bytes.Buffer) - } - if trInfo != nil { - trInfo.tr.LazyLog(&trInfo.firstLine, false) - defer func() { - ss.mu.Lock() - if err != nil && err != io.EOF { - ss.trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) - ss.trInfo.tr.SetError() - } - ss.trInfo.tr.Finish() - ss.trInfo.tr = nil - ss.mu.Unlock() - }() - } - var appErr error - var server interface{} - if srv != nil { - server = srv.server - } - if s.opts.streamInt == nil { - appErr = sd.Handler(server, ss) - } else { - info := &StreamServerInfo{ - FullMethod: stream.Method(), - IsClientStream: sd.ClientStreams, - IsServerStream: sd.ServerStreams, - } - appErr = s.opts.streamInt(server, ss, info, sd.Handler) - } - if appErr != nil { - if err, ok := appErr.(*rpcError); ok { - ss.statusCode = err.code - ss.statusDesc = err.desc - } else if err, ok := appErr.(transport.StreamError); ok { - ss.statusCode = err.Code - ss.statusDesc = err.Desc - } else { - ss.statusCode = convertCode(appErr) - ss.statusDesc = appErr.Error() - } - } - if trInfo != nil { - ss.mu.Lock() - if ss.statusCode != codes.OK { - ss.trInfo.tr.LazyLog(stringer(ss.statusDesc), true) - ss.trInfo.tr.SetError() - } else { - ss.trInfo.tr.LazyLog(stringer("OK"), false) - } - ss.mu.Unlock() - } - errWrite := t.WriteStatus(ss.s, ss.statusCode, ss.statusDesc) - if ss.statusCode != codes.OK { - return Errorf(ss.statusCode, ss.statusDesc) - } - return errWrite - -} - -func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Stream, trInfo *traceInfo) { - sm := stream.Method() - if sm != "" && sm[0] == '/' { - sm = sm[1:] - } - pos := strings.LastIndex(sm, "/") - if pos == -1 { - if trInfo != nil { - trInfo.tr.LazyLog(&fmtStringer{"Malformed method name %q", []interface{}{sm}}, true) - trInfo.tr.SetError() - } - errDesc := fmt.Sprintf("malformed method name: %q", stream.Method()) - if err := t.WriteStatus(stream, codes.InvalidArgument, errDesc); err != nil { - if trInfo != nil { - trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) - trInfo.tr.SetError() - } - grpclog.Printf("grpc: Server.handleStream failed to write status: %v", err) - } - if trInfo != nil { - trInfo.tr.Finish() - } - return - } - service := sm[:pos] - method := sm[pos+1:] - srv, ok := s.m[service] - if !ok { - if unknownDesc := s.opts.unknownStreamDesc; unknownDesc != nil { - s.processStreamingRPC(t, stream, nil, unknownDesc, trInfo) - return - } - if trInfo != nil { - trInfo.tr.LazyLog(&fmtStringer{"Unknown service %v", []interface{}{service}}, true) - trInfo.tr.SetError() - } - errDesc := fmt.Sprintf("unknown service %v", service) - if err := t.WriteStatus(stream, codes.Unimplemented, errDesc); err != nil { - if trInfo != nil { - trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) - trInfo.tr.SetError() - } - grpclog.Printf("grpc: Server.handleStream failed to write status: %v", err) - } - if trInfo != nil { - trInfo.tr.Finish() - } - return - } - // Unary RPC or Streaming RPC? - if md, ok := srv.md[method]; ok { - s.processUnaryRPC(t, stream, srv, md, trInfo) - return - } - if sd, ok := srv.sd[method]; ok { - s.processStreamingRPC(t, stream, srv, sd, trInfo) - return - } - if trInfo != nil { - trInfo.tr.LazyLog(&fmtStringer{"Unknown method %v", []interface{}{method}}, true) - trInfo.tr.SetError() - } - if unknownDesc := s.opts.unknownStreamDesc; unknownDesc != nil { - s.processStreamingRPC(t, stream, nil, unknownDesc, trInfo) - return - } - errDesc := fmt.Sprintf("unknown method %v", method) - if err := t.WriteStatus(stream, codes.Unimplemented, errDesc); err != nil { - if trInfo != nil { - trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) - trInfo.tr.SetError() - } - grpclog.Printf("grpc: Server.handleStream failed to write status: %v", err) - } - if trInfo != nil { - trInfo.tr.Finish() - } -} - -// Stop stops the gRPC server. It immediately closes all open -// connections and listeners. -// It cancels all active RPCs on the server side and the corresponding -// pending RPCs on the client side will get notified by connection -// errors. -func (s *Server) Stop() { - s.mu.Lock() - listeners := s.lis - s.lis = nil - st := s.conns - s.conns = nil - // interrupt GracefulStop if Stop and GracefulStop are called concurrently. - s.cv.Broadcast() - s.mu.Unlock() - - for lis := range listeners { - lis.Close() - } - for c := range st { - c.Close() - } - - s.mu.Lock() - s.cancel() - if s.events != nil { - s.events.Finish() - s.events = nil - } - s.mu.Unlock() -} - -// GracefulStop stops the gRPC server gracefully. It stops the server to accept new -// connections and RPCs and blocks until all the pending RPCs are finished. -func (s *Server) GracefulStop() { - s.mu.Lock() - defer s.mu.Unlock() - if s.conns == nil { - return - } - for lis := range s.lis { - lis.Close() - } - s.lis = nil - s.cancel() - if !s.drain { - for c := range s.conns { - c.(transport.ServerTransport).Drain() - } - s.drain = true - } - for len(s.conns) != 0 { - s.cv.Wait() - } - s.conns = nil - if s.events != nil { - s.events.Finish() - s.events = nil - } -} - -func init() { - internal.TestingCloseConns = func(arg interface{}) { - arg.(*Server).testingCloseConns() - } - internal.TestingUseHandlerImpl = func(arg interface{}) { - arg.(*Server).opts.useHandlerImpl = true - } -} - -// testingCloseConns closes all existing transports but keeps s.lis -// accepting new connections. -func (s *Server) testingCloseConns() { - s.mu.Lock() - for c := range s.conns { - c.Close() - delete(s.conns, c) - } - s.mu.Unlock() -} - -// SetHeader sets the header metadata. -// When called multiple times, all the provided metadata will be merged. -// All the metadata will be sent out when one of the following happens: -// - grpc.SendHeader() is called; -// - The first response is sent out; -// - An RPC status is sent out (error or success). -func SetHeader(ctx context.Context, md metadata.MD) error { - if md.Len() == 0 { - return nil - } - stream, ok := transport.StreamFromContext(ctx) - if !ok { - return Errorf(codes.Internal, "grpc: failed to fetch the stream from the context %v", ctx) - } - return stream.SetHeader(md) -} - -// SendHeader sends header metadata. It may be called at most once. -// The provided md and headers set by SetHeader() will be sent. -func SendHeader(ctx context.Context, md metadata.MD) error { - stream, ok := transport.StreamFromContext(ctx) - if !ok { - return Errorf(codes.Internal, "grpc: failed to fetch the stream from the context %v", ctx) - } - t := stream.ServerTransport() - if t == nil { - grpclog.Fatalf("grpc: SendHeader: %v has no ServerTransport to send header metadata.", stream) - } - if err := t.WriteHeader(stream, md); err != nil { - return toRPCErr(err) - } - return nil -} - -// SetTrailer sets the trailer metadata that will be sent when an RPC returns. -// When called more than once, all the provided metadata will be merged. -func SetTrailer(ctx context.Context, md metadata.MD) error { - if md.Len() == 0 { - return nil - } - stream, ok := transport.StreamFromContext(ctx) - if !ok { - return Errorf(codes.Internal, "grpc: failed to fetch the stream from the context %v", ctx) - } - return stream.SetTrailer(md) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stats/handlers.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stats/handlers.go deleted file mode 100644 index 26e1a8e2f08..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stats/handlers.go +++ /dev/null @@ -1,76 +0,0 @@ -/* - * - * Copyright 2016, Google Inc. - * 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. - * - */ - -package stats - -import ( - "net" - - "golang.org/x/net/context" -) - -// ConnTagInfo defines the relevant information needed by connection context tagger. -type ConnTagInfo struct { - // RemoteAddr is the remote address of the corresponding connection. - RemoteAddr net.Addr - // LocalAddr is the local address of the corresponding connection. - LocalAddr net.Addr - // TODO add QOS related fields. -} - -// RPCTagInfo defines the relevant information needed by RPC context tagger. -type RPCTagInfo struct { - // FullMethodName is the RPC method in the format of /package.service/method. - FullMethodName string -} - -// Handler defines the interface for the related stats handling (e.g., RPCs, connections). -type Handler interface { - // TagRPC can attach some information to the given context. - // The returned context is used in the rest lifetime of the RPC. - TagRPC(context.Context, *RPCTagInfo) context.Context - // HandleRPC processes the RPC stats. - HandleRPC(context.Context, RPCStats) - - // TagConn can attach some information to the given context. - // The returned context will be used for stats handling. - // For conn stats handling, the context used in HandleConn for this - // connection will be derived from the context returned. - // For RPC stats handling, - // - On server side, the context used in HandleRPC for all RPCs on this - // connection will be derived from the context returned. - // - On client side, the context is not derived from the context returned. - TagConn(context.Context, *ConnTagInfo) context.Context - // HandleConn processes the Conn stats. - HandleConn(context.Context, ConnStats) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stats/stats.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stats/stats.go deleted file mode 100644 index a82448a68bb..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stats/stats.go +++ /dev/null @@ -1,223 +0,0 @@ -/* - * - * Copyright 2016, Google Inc. - * 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. - * - */ - -// Package stats is for collecting and reporting various network and RPC stats. -// This package is for monitoring purpose only. All fields are read-only. -// All APIs are experimental. -package stats // import "google.golang.org/grpc/stats" - -import ( - "net" - "time" -) - -// RPCStats contains stats information about RPCs. -type RPCStats interface { - isRPCStats() - // IsClient returns true if this RPCStats is from client side. - IsClient() bool -} - -// Begin contains stats when an RPC begins. -// FailFast are only valid if Client is true. -type Begin struct { - // Client is true if this Begin is from client side. - Client bool - // BeginTime is the time when the RPC begins. - BeginTime time.Time - // FailFast indicates if this RPC is failfast. - FailFast bool -} - -// IsClient indicates if this is from client side. -func (s *Begin) IsClient() bool { return s.Client } - -func (s *Begin) isRPCStats() {} - -// InPayload contains the information for an incoming payload. -type InPayload struct { - // Client is true if this InPayload is from client side. - Client bool - // Payload is the payload with original type. - Payload interface{} - // Data is the serialized message payload. - Data []byte - // Length is the length of uncompressed data. - Length int - // WireLength is the length of data on wire (compressed, signed, encrypted). - WireLength int - // RecvTime is the time when the payload is received. - RecvTime time.Time -} - -// IsClient indicates if this is from client side. -func (s *InPayload) IsClient() bool { return s.Client } - -func (s *InPayload) isRPCStats() {} - -// InHeader contains stats when a header is received. -// FullMethod, addresses and Compression are only valid if Client is false. -type InHeader struct { - // Client is true if this InHeader is from client side. - Client bool - // WireLength is the wire length of header. - WireLength int - - // FullMethod is the full RPC method string, i.e., /package.service/method. - FullMethod string - // RemoteAddr is the remote address of the corresponding connection. - RemoteAddr net.Addr - // LocalAddr is the local address of the corresponding connection. - LocalAddr net.Addr - // Compression is the compression algorithm used for the RPC. - Compression string -} - -// IsClient indicates if this is from client side. -func (s *InHeader) IsClient() bool { return s.Client } - -func (s *InHeader) isRPCStats() {} - -// InTrailer contains stats when a trailer is received. -type InTrailer struct { - // Client is true if this InTrailer is from client side. - Client bool - // WireLength is the wire length of trailer. - WireLength int -} - -// IsClient indicates if this is from client side. -func (s *InTrailer) IsClient() bool { return s.Client } - -func (s *InTrailer) isRPCStats() {} - -// OutPayload contains the information for an outgoing payload. -type OutPayload struct { - // Client is true if this OutPayload is from client side. - Client bool - // Payload is the payload with original type. - Payload interface{} - // Data is the serialized message payload. - Data []byte - // Length is the length of uncompressed data. - Length int - // WireLength is the length of data on wire (compressed, signed, encrypted). - WireLength int - // SentTime is the time when the payload is sent. - SentTime time.Time -} - -// IsClient indicates if this is from client side. -func (s *OutPayload) IsClient() bool { return s.Client } - -func (s *OutPayload) isRPCStats() {} - -// OutHeader contains stats when a header is sent. -// FullMethod, addresses and Compression are only valid if Client is true. -type OutHeader struct { - // Client is true if this OutHeader is from client side. - Client bool - // WireLength is the wire length of header. - WireLength int - - // FullMethod is the full RPC method string, i.e., /package.service/method. - FullMethod string - // RemoteAddr is the remote address of the corresponding connection. - RemoteAddr net.Addr - // LocalAddr is the local address of the corresponding connection. - LocalAddr net.Addr - // Compression is the compression algorithm used for the RPC. - Compression string -} - -// IsClient indicates if this is from client side. -func (s *OutHeader) IsClient() bool { return s.Client } - -func (s *OutHeader) isRPCStats() {} - -// OutTrailer contains stats when a trailer is sent. -type OutTrailer struct { - // Client is true if this OutTrailer is from client side. - Client bool - // WireLength is the wire length of trailer. - WireLength int -} - -// IsClient indicates if this is from client side. -func (s *OutTrailer) IsClient() bool { return s.Client } - -func (s *OutTrailer) isRPCStats() {} - -// End contains stats when an RPC ends. -type End struct { - // Client is true if this End is from client side. - Client bool - // EndTime is the time when the RPC ends. - EndTime time.Time - // Error is the error just happened. Its type is gRPC error. - Error error -} - -// IsClient indicates if this is from client side. -func (s *End) IsClient() bool { return s.Client } - -func (s *End) isRPCStats() {} - -// ConnStats contains stats information about connections. -type ConnStats interface { - isConnStats() - // IsClient returns true if this ConnStats is from client side. - IsClient() bool -} - -// ConnBegin contains the stats of a connection when it is established. -type ConnBegin struct { - // Client is true if this ConnBegin is from client side. - Client bool -} - -// IsClient indicates if this is from client side. -func (s *ConnBegin) IsClient() bool { return s.Client } - -func (s *ConnBegin) isConnStats() {} - -// ConnEnd contains the stats of a connection when it ends. -type ConnEnd struct { - // Client is true if this ConnEnd is from client side. - Client bool -} - -// IsClient indicates if this is from client side. -func (s *ConnEnd) IsClient() bool { return s.Client } - -func (s *ConnEnd) isConnStats() {} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stream.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stream.go deleted file mode 100644 index 0ef2077ce25..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/stream.go +++ /dev/null @@ -1,626 +0,0 @@ -/* - * - * Copyright 2014, Google Inc. - * 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. - * - */ - -package grpc - -import ( - "bytes" - "errors" - "io" - "sync" - "time" - - "golang.org/x/net/context" - "golang.org/x/net/trace" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/stats" - "google.golang.org/grpc/transport" -) - -// StreamHandler defines the handler called by gRPC server to complete the -// execution of a streaming RPC. -type StreamHandler func(srv interface{}, stream ServerStream) error - -// StreamDesc represents a streaming RPC service's method specification. -type StreamDesc struct { - StreamName string - Handler StreamHandler - - // At least one of these is true. - ServerStreams bool - ClientStreams bool -} - -// Stream defines the common interface a client or server stream has to satisfy. -type Stream interface { - // Context returns the context for this stream. - Context() context.Context - // SendMsg blocks until it sends m, the stream is done or the stream - // breaks. - // On error, it aborts the stream and returns an RPC status on client - // side. On server side, it simply returns the error to the caller. - // SendMsg is called by generated code. Also Users can call SendMsg - // directly when it is really needed in their use cases. - SendMsg(m interface{}) error - // RecvMsg blocks until it receives a message or the stream is - // done. On client side, it returns io.EOF when the stream is done. On - // any other error, it aborts the stream and returns an RPC status. On - // server side, it simply returns the error to the caller. - RecvMsg(m interface{}) error -} - -// ClientStream defines the interface a client stream has to satisfy. -type ClientStream interface { - // Header returns the header metadata received from the server if there - // is any. It blocks if the metadata is not ready to read. - Header() (metadata.MD, error) - // Trailer returns the trailer metadata from the server, if there is any. - // It must only be called after stream.CloseAndRecv has returned, or - // stream.Recv has returned a non-nil error (including io.EOF). - Trailer() metadata.MD - // CloseSend closes the send direction of the stream. It closes the stream - // when non-nil error is met. - CloseSend() error - Stream -} - -// NewClientStream creates a new Stream for the client side. This is called -// by generated code. -func NewClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (_ ClientStream, err error) { - if cc.dopts.streamInt != nil { - return cc.dopts.streamInt(ctx, desc, cc, method, newClientStream, opts...) - } - return newClientStream(ctx, desc, cc, method, opts...) -} - -func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (_ ClientStream, err error) { - var ( - t transport.ClientTransport - s *transport.Stream - put func() - cancel context.CancelFunc - ) - c := defaultCallInfo - if mc, ok := cc.getMethodConfig(method); ok { - c.failFast = !mc.WaitForReady - if mc.Timeout > 0 { - ctx, cancel = context.WithTimeout(ctx, mc.Timeout) - } - } - for _, o := range opts { - if err := o.before(&c); err != nil { - return nil, toRPCErr(err) - } - } - callHdr := &transport.CallHdr{ - Host: cc.authority, - Method: method, - Flush: desc.ServerStreams && desc.ClientStreams, - } - if cc.dopts.cp != nil { - callHdr.SendCompress = cc.dopts.cp.Type() - } - var trInfo traceInfo - if EnableTracing { - trInfo.tr = trace.New("grpc.Sent."+methodFamily(method), method) - trInfo.firstLine.client = true - if deadline, ok := ctx.Deadline(); ok { - trInfo.firstLine.deadline = deadline.Sub(time.Now()) - } - trInfo.tr.LazyLog(&trInfo.firstLine, false) - ctx = trace.NewContext(ctx, trInfo.tr) - defer func() { - if err != nil { - // Need to call tr.finish() if error is returned. - // Because tr will not be returned to caller. - trInfo.tr.LazyPrintf("RPC: [%v]", err) - trInfo.tr.SetError() - trInfo.tr.Finish() - } - }() - } - sh := cc.dopts.copts.StatsHandler - if sh != nil { - ctx = sh.TagRPC(ctx, &stats.RPCTagInfo{FullMethodName: method}) - begin := &stats.Begin{ - Client: true, - BeginTime: time.Now(), - FailFast: c.failFast, - } - sh.HandleRPC(ctx, begin) - } - defer func() { - if err != nil && sh != nil { - // Only handle end stats if err != nil. - end := &stats.End{ - Client: true, - Error: err, - } - sh.HandleRPC(ctx, end) - } - }() - gopts := BalancerGetOptions{ - BlockingWait: !c.failFast, - } - for { - t, put, err = cc.getTransport(ctx, gopts) - if err != nil { - // TODO(zhaoq): Probably revisit the error handling. - if _, ok := err.(*rpcError); ok { - return nil, err - } - if err == errConnClosing || err == errConnUnavailable { - if c.failFast { - return nil, Errorf(codes.Unavailable, "%v", err) - } - continue - } - // All the other errors are treated as Internal errors. - return nil, Errorf(codes.Internal, "%v", err) - } - - s, err = t.NewStream(ctx, callHdr) - if err != nil { - if put != nil { - put() - put = nil - } - if _, ok := err.(transport.ConnectionError); ok || err == transport.ErrStreamDrain { - if c.failFast { - return nil, toRPCErr(err) - } - continue - } - return nil, toRPCErr(err) - } - break - } - cs := &clientStream{ - opts: opts, - c: c, - desc: desc, - codec: cc.dopts.codec, - cp: cc.dopts.cp, - dc: cc.dopts.dc, - maxMsgSize: cc.dopts.maxMsgSize, - cancel: cancel, - - put: put, - t: t, - s: s, - p: &parser{r: s}, - - tracing: EnableTracing, - trInfo: trInfo, - - statsCtx: ctx, - statsHandler: cc.dopts.copts.StatsHandler, - } - if cc.dopts.cp != nil { - cs.cbuf = new(bytes.Buffer) - } - // Listen on ctx.Done() to detect cancellation and s.Done() to detect normal termination - // when there is no pending I/O operations on this stream. - go func() { - select { - case <-t.Error(): - // Incur transport error, simply exit. - case <-s.Done(): - // TODO: The trace of the RPC is terminated here when there is no pending - // I/O, which is probably not the optimal solution. - if s.StatusCode() == codes.OK { - cs.finish(nil) - } else { - cs.finish(Errorf(s.StatusCode(), "%s", s.StatusDesc())) - } - cs.closeTransportStream(nil) - case <-s.GoAway(): - cs.finish(errConnDrain) - cs.closeTransportStream(errConnDrain) - case <-s.Context().Done(): - err := s.Context().Err() - cs.finish(err) - cs.closeTransportStream(transport.ContextErr(err)) - } - }() - return cs, nil -} - -// clientStream implements a client side Stream. -type clientStream struct { - opts []CallOption - c callInfo - t transport.ClientTransport - s *transport.Stream - p *parser - desc *StreamDesc - codec Codec - cp Compressor - cbuf *bytes.Buffer - dc Decompressor - maxMsgSize int - cancel context.CancelFunc - - tracing bool // set to EnableTracing when the clientStream is created. - - mu sync.Mutex - put func() - closed bool - // trInfo.tr is set when the clientStream is created (if EnableTracing is true), - // and is set to nil when the clientStream's finish method is called. - trInfo traceInfo - - // statsCtx keeps the user context for stats handling. - // All stats collection should use the statsCtx (instead of the stream context) - // so that all the generated stats for a particular RPC can be associated in the processing phase. - statsCtx context.Context - statsHandler stats.Handler -} - -func (cs *clientStream) Context() context.Context { - return cs.s.Context() -} - -func (cs *clientStream) Header() (metadata.MD, error) { - m, err := cs.s.Header() - if err != nil { - if _, ok := err.(transport.ConnectionError); !ok { - cs.closeTransportStream(err) - } - } - return m, err -} - -func (cs *clientStream) Trailer() metadata.MD { - return cs.s.Trailer() -} - -func (cs *clientStream) SendMsg(m interface{}) (err error) { - if cs.tracing { - cs.mu.Lock() - if cs.trInfo.tr != nil { - cs.trInfo.tr.LazyLog(&payload{sent: true, msg: m}, true) - } - cs.mu.Unlock() - } - // TODO Investigate how to signal the stats handling party. - // generate error stats if err != nil && err != io.EOF? - defer func() { - if err != nil { - cs.finish(err) - } - if err == nil { - return - } - if err == io.EOF { - // Specialize the process for server streaming. SendMesg is only called - // once when creating the stream object. io.EOF needs to be skipped when - // the rpc is early finished (before the stream object is created.). - // TODO: It is probably better to move this into the generated code. - if !cs.desc.ClientStreams && cs.desc.ServerStreams { - err = nil - } - return - } - if _, ok := err.(transport.ConnectionError); !ok { - cs.closeTransportStream(err) - } - err = toRPCErr(err) - }() - var outPayload *stats.OutPayload - if cs.statsHandler != nil { - outPayload = &stats.OutPayload{ - Client: true, - } - } - out, err := encode(cs.codec, m, cs.cp, cs.cbuf, outPayload) - defer func() { - if cs.cbuf != nil { - cs.cbuf.Reset() - } - }() - if err != nil { - return Errorf(codes.Internal, "grpc: %v", err) - } - err = cs.t.Write(cs.s, out, &transport.Options{Last: false}) - if err == nil && outPayload != nil { - outPayload.SentTime = time.Now() - cs.statsHandler.HandleRPC(cs.statsCtx, outPayload) - } - return err -} - -func (cs *clientStream) RecvMsg(m interface{}) (err error) { - defer func() { - if err != nil && cs.statsHandler != nil { - // Only generate End if err != nil. - // If err == nil, it's not the last RecvMsg. - // The last RecvMsg gets either an RPC error or io.EOF. - end := &stats.End{ - Client: true, - EndTime: time.Now(), - } - if err != io.EOF { - end.Error = toRPCErr(err) - } - cs.statsHandler.HandleRPC(cs.statsCtx, end) - } - }() - var inPayload *stats.InPayload - if cs.statsHandler != nil { - inPayload = &stats.InPayload{ - Client: true, - } - } - err = recv(cs.p, cs.codec, cs.s, cs.dc, m, cs.maxMsgSize, inPayload) - defer func() { - // err != nil indicates the termination of the stream. - if err != nil { - cs.finish(err) - } - }() - if err == nil { - if cs.tracing { - cs.mu.Lock() - if cs.trInfo.tr != nil { - cs.trInfo.tr.LazyLog(&payload{sent: false, msg: m}, true) - } - cs.mu.Unlock() - } - if inPayload != nil { - cs.statsHandler.HandleRPC(cs.statsCtx, inPayload) - } - if !cs.desc.ClientStreams || cs.desc.ServerStreams { - return - } - // Special handling for client streaming rpc. - // This recv expects EOF or errors, so we don't collect inPayload. - err = recv(cs.p, cs.codec, cs.s, cs.dc, m, cs.maxMsgSize, nil) - cs.closeTransportStream(err) - if err == nil { - return toRPCErr(errors.New("grpc: client streaming protocol violation: get , want ")) - } - if err == io.EOF { - if cs.s.StatusCode() == codes.OK { - cs.finish(err) - return nil - } - return Errorf(cs.s.StatusCode(), "%s", cs.s.StatusDesc()) - } - return toRPCErr(err) - } - if _, ok := err.(transport.ConnectionError); !ok { - cs.closeTransportStream(err) - } - if err == io.EOF { - if cs.s.StatusCode() == codes.OK { - // Returns io.EOF to indicate the end of the stream. - return - } - return Errorf(cs.s.StatusCode(), "%s", cs.s.StatusDesc()) - } - return toRPCErr(err) -} - -func (cs *clientStream) CloseSend() (err error) { - err = cs.t.Write(cs.s, nil, &transport.Options{Last: true}) - defer func() { - if err != nil { - cs.finish(err) - } - }() - if err == nil || err == io.EOF { - return nil - } - if _, ok := err.(transport.ConnectionError); !ok { - cs.closeTransportStream(err) - } - err = toRPCErr(err) - return -} - -func (cs *clientStream) closeTransportStream(err error) { - cs.mu.Lock() - if cs.closed { - cs.mu.Unlock() - return - } - cs.closed = true - cs.mu.Unlock() - cs.t.CloseStream(cs.s, err) -} - -func (cs *clientStream) finish(err error) { - defer func() { - if cs.cancel != nil { - cs.cancel() - } - }() - cs.mu.Lock() - defer cs.mu.Unlock() - for _, o := range cs.opts { - o.after(&cs.c) - } - if cs.put != nil { - cs.put() - cs.put = nil - } - if !cs.tracing { - return - } - if cs.trInfo.tr != nil { - if err == nil || err == io.EOF { - cs.trInfo.tr.LazyPrintf("RPC: [OK]") - } else { - cs.trInfo.tr.LazyPrintf("RPC: [%v]", err) - cs.trInfo.tr.SetError() - } - cs.trInfo.tr.Finish() - cs.trInfo.tr = nil - } -} - -// ServerStream defines the interface a server stream has to satisfy. -type ServerStream interface { - // SetHeader sets the header metadata. It may be called multiple times. - // When call multiple times, all the provided metadata will be merged. - // All the metadata will be sent out when one of the following happens: - // - ServerStream.SendHeader() is called; - // - The first response is sent out; - // - An RPC status is sent out (error or success). - SetHeader(metadata.MD) error - // SendHeader sends the header metadata. - // The provided md and headers set by SetHeader() will be sent. - // It fails if called multiple times. - SendHeader(metadata.MD) error - // SetTrailer sets the trailer metadata which will be sent with the RPC status. - // When called more than once, all the provided metadata will be merged. - SetTrailer(metadata.MD) - Stream -} - -// serverStream implements a server side Stream. -type serverStream struct { - t transport.ServerTransport - s *transport.Stream - p *parser - codec Codec - cp Compressor - dc Decompressor - cbuf *bytes.Buffer - maxMsgSize int - statusCode codes.Code - statusDesc string - trInfo *traceInfo - - statsHandler stats.Handler - - mu sync.Mutex // protects trInfo.tr after the service handler runs. -} - -func (ss *serverStream) Context() context.Context { - return ss.s.Context() -} - -func (ss *serverStream) SetHeader(md metadata.MD) error { - if md.Len() == 0 { - return nil - } - return ss.s.SetHeader(md) -} - -func (ss *serverStream) SendHeader(md metadata.MD) error { - return ss.t.WriteHeader(ss.s, md) -} - -func (ss *serverStream) SetTrailer(md metadata.MD) { - if md.Len() == 0 { - return - } - ss.s.SetTrailer(md) - return -} - -func (ss *serverStream) SendMsg(m interface{}) (err error) { - defer func() { - if ss.trInfo != nil { - ss.mu.Lock() - if ss.trInfo.tr != nil { - if err == nil { - ss.trInfo.tr.LazyLog(&payload{sent: true, msg: m}, true) - } else { - ss.trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) - ss.trInfo.tr.SetError() - } - } - ss.mu.Unlock() - } - }() - var outPayload *stats.OutPayload - if ss.statsHandler != nil { - outPayload = &stats.OutPayload{} - } - out, err := encode(ss.codec, m, ss.cp, ss.cbuf, outPayload) - defer func() { - if ss.cbuf != nil { - ss.cbuf.Reset() - } - }() - if err != nil { - err = Errorf(codes.Internal, "grpc: %v", err) - return err - } - if err := ss.t.Write(ss.s, out, &transport.Options{Last: false}); err != nil { - return toRPCErr(err) - } - if outPayload != nil { - outPayload.SentTime = time.Now() - ss.statsHandler.HandleRPC(ss.s.Context(), outPayload) - } - return nil -} - -func (ss *serverStream) RecvMsg(m interface{}) (err error) { - defer func() { - if ss.trInfo != nil { - ss.mu.Lock() - if ss.trInfo.tr != nil { - if err == nil { - ss.trInfo.tr.LazyLog(&payload{sent: false, msg: m}, true) - } else if err != io.EOF { - ss.trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) - ss.trInfo.tr.SetError() - } - } - ss.mu.Unlock() - } - }() - var inPayload *stats.InPayload - if ss.statsHandler != nil { - inPayload = &stats.InPayload{} - } - if err := recv(ss.p, ss.codec, ss.s, ss.dc, m, ss.maxMsgSize, inPayload); err != nil { - if err == io.EOF { - return err - } - if err == io.ErrUnexpectedEOF { - err = Errorf(codes.Internal, io.ErrUnexpectedEOF.Error()) - } - return toRPCErr(err) - } - if inPayload != nil { - ss.statsHandler.HandleRPC(ss.s.Context(), inPayload) - } - return nil -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/tap/tap.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/tap/tap.go deleted file mode 100644 index 0f366476742..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/tap/tap.go +++ /dev/null @@ -1,54 +0,0 @@ -/* - * - * Copyright 2016, Google Inc. - * 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. - * - */ - -// Package tap defines the function handles which are executed on the transport -// layer of gRPC-Go and related information. Everything here is EXPERIMENTAL. -package tap - -import ( - "golang.org/x/net/context" -) - -// Info defines the relevant information needed by the handles. -type Info struct { - // FullMethodName is the string of grpc method (in the format of - // /package.service/method). - FullMethodName string - // TODO: More to be added. -} - -// ServerInHandle defines the function which runs when a new stream is created -// on the server side. Note that it is executed in the per-connection I/O goroutine(s) instead -// of per-RPC goroutine. Therefore, users should NOT have any blocking/time-consuming -// work in this handle. Otherwise all the RPCs would slow down. -type ServerInHandle func(ctx context.Context, info *Info) (context.Context, error) diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/trace.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/trace.go deleted file mode 100644 index f6747e1dfa4..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/trace.go +++ /dev/null @@ -1,119 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * 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. - * - */ - -package grpc - -import ( - "bytes" - "fmt" - "io" - "net" - "strings" - "time" - - "golang.org/x/net/trace" -) - -// EnableTracing controls whether to trace RPCs using the golang.org/x/net/trace package. -// This should only be set before any RPCs are sent or received by this program. -var EnableTracing = true - -// methodFamily returns the trace family for the given method. -// It turns "/pkg.Service/GetFoo" into "pkg.Service". -func methodFamily(m string) string { - m = strings.TrimPrefix(m, "/") // remove leading slash - if i := strings.Index(m, "/"); i >= 0 { - m = m[:i] // remove everything from second slash - } - if i := strings.LastIndex(m, "."); i >= 0 { - m = m[i+1:] // cut down to last dotted component - } - return m -} - -// traceInfo contains tracing information for an RPC. -type traceInfo struct { - tr trace.Trace - firstLine firstLine -} - -// firstLine is the first line of an RPC trace. -type firstLine struct { - client bool // whether this is a client (outgoing) RPC - remoteAddr net.Addr - deadline time.Duration // may be zero -} - -func (f *firstLine) String() string { - var line bytes.Buffer - io.WriteString(&line, "RPC: ") - if f.client { - io.WriteString(&line, "to") - } else { - io.WriteString(&line, "from") - } - fmt.Fprintf(&line, " %v deadline:", f.remoteAddr) - if f.deadline != 0 { - fmt.Fprint(&line, f.deadline) - } else { - io.WriteString(&line, "none") - } - return line.String() -} - -// payload represents an RPC request or response payload. -type payload struct { - sent bool // whether this is an outgoing payload - msg interface{} // e.g. a proto.Message - // TODO(dsymonds): add stringifying info to codec, and limit how much we hold here? -} - -func (p payload) String() string { - if p.sent { - return fmt.Sprintf("sent: %v", p.msg) - } - return fmt.Sprintf("recv: %v", p.msg) -} - -type fmtStringer struct { - format string - a []interface{} -} - -func (f *fmtStringer) String() string { - return fmt.Sprintf(f.format, f.a...) -} - -type stringer string - -func (s stringer) String() string { return string(s) } diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/control.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/control.go deleted file mode 100644 index 0edbe53a700..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/control.go +++ /dev/null @@ -1,199 +0,0 @@ -/* - * - * Copyright 2014, Google Inc. - * 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. - * - */ - -package transport - -import ( - "fmt" - "math" - "sync" - "time" - - "golang.org/x/net/http2" -) - -const ( - // The default value of flow control window size in HTTP2 spec. - defaultWindowSize = 65535 - // The initial window size for flow control. - initialWindowSize = defaultWindowSize // for an RPC - initialConnWindowSize = defaultWindowSize * 16 // for a connection - infinity = time.Duration(math.MaxInt64) - defaultKeepaliveTime = infinity - defaultKeepaliveTimeout = time.Duration(20 * time.Second) - defaultMaxStreamsClient = 100 -) - -// The following defines various control items which could flow through -// the control buffer of transport. They represent different aspects of -// control tasks, e.g., flow control, settings, streaming resetting, etc. -type windowUpdate struct { - streamID uint32 - increment uint32 -} - -func (*windowUpdate) item() {} - -type settings struct { - ack bool - ss []http2.Setting -} - -func (*settings) item() {} - -type resetStream struct { - streamID uint32 - code http2.ErrCode -} - -func (*resetStream) item() {} - -type goAway struct { -} - -func (*goAway) item() {} - -type flushIO struct { -} - -func (*flushIO) item() {} - -type ping struct { - ack bool - data [8]byte -} - -func (*ping) item() {} - -// quotaPool is a pool which accumulates the quota and sends it to acquire() -// when it is available. -type quotaPool struct { - c chan int - - mu sync.Mutex - quota int -} - -// newQuotaPool creates a quotaPool which has quota q available to consume. -func newQuotaPool(q int) *quotaPool { - qb := "aPool{ - c: make(chan int, 1), - } - if q > 0 { - qb.c <- q - } else { - qb.quota = q - } - return qb -} - -// add cancels the pending quota sent on acquired, incremented by v and sends -// it back on acquire. -func (qb *quotaPool) add(v int) { - qb.mu.Lock() - defer qb.mu.Unlock() - select { - case n := <-qb.c: - qb.quota += n - default: - } - qb.quota += v - if qb.quota <= 0 { - return - } - // After the pool has been created, this is the only place that sends on - // the channel. Since mu is held at this point and any quota that was sent - // on the channel has been retrieved, we know that this code will always - // place any positive quota value on the channel. - select { - case qb.c <- qb.quota: - qb.quota = 0 - default: - } -} - -// acquire returns the channel on which available quota amounts are sent. -func (qb *quotaPool) acquire() <-chan int { - return qb.c -} - -// inFlow deals with inbound flow control -type inFlow struct { - // The inbound flow control limit for pending data. - limit uint32 - - mu sync.Mutex - // pendingData is the overall data which have been received but not been - // consumed by applications. - pendingData uint32 - // The amount of data the application has consumed but grpc has not sent - // window update for them. Used to reduce window update frequency. - pendingUpdate uint32 -} - -// onData is invoked when some data frame is received. It updates pendingData. -func (f *inFlow) onData(n uint32) error { - f.mu.Lock() - defer f.mu.Unlock() - f.pendingData += n - if f.pendingData+f.pendingUpdate > f.limit { - return fmt.Errorf("received %d-bytes data exceeding the limit %d bytes", f.pendingData+f.pendingUpdate, f.limit) - } - return nil -} - -// onRead is invoked when the application reads the data. It returns the window size -// to be sent to the peer. -func (f *inFlow) onRead(n uint32) uint32 { - f.mu.Lock() - defer f.mu.Unlock() - if f.pendingData == 0 { - return 0 - } - f.pendingData -= n - f.pendingUpdate += n - if f.pendingUpdate >= f.limit/4 { - wu := f.pendingUpdate - f.pendingUpdate = 0 - return wu - } - return 0 -} - -func (f *inFlow) resetPendingData() uint32 { - f.mu.Lock() - defer f.mu.Unlock() - n := f.pendingData - f.pendingData = 0 - return n -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/go16.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/go16.go deleted file mode 100644 index ee1c46bad57..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/go16.go +++ /dev/null @@ -1,46 +0,0 @@ -// +build go1.6,!go1.7 - -/* - * Copyright 2016, Google Inc. - * 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. - * - */ - -package transport - -import ( - "net" - - "golang.org/x/net/context" -) - -// dialContext connects to the address on the named network. -func dialContext(ctx context.Context, network, address string) (net.Conn, error) { - return (&net.Dialer{Cancel: ctx.Done()}).Dial(network, address) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/go17.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/go17.go deleted file mode 100644 index 356f13ff197..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/go17.go +++ /dev/null @@ -1,46 +0,0 @@ -// +build go1.7 - -/* - * Copyright 2016, Google Inc. - * 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. - * - */ - -package transport - -import ( - "net" - - "golang.org/x/net/context" -) - -// dialContext connects to the address on the named network. -func dialContext(ctx context.Context, network, address string) (net.Conn, error) { - return (&net.Dialer{}).DialContext(ctx, network, address) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/handler_server.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/handler_server.go deleted file mode 100644 index 10b6dc0b19d..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/handler_server.go +++ /dev/null @@ -1,397 +0,0 @@ -/* - * Copyright 2016, Google Inc. - * 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. - * - */ - -// This file is the implementation of a gRPC server using HTTP/2 which -// uses the standard Go http2 Server implementation (via the -// http.Handler interface), rather than speaking low-level HTTP/2 -// frames itself. It is the implementation of *grpc.Server.ServeHTTP. - -package transport - -import ( - "errors" - "fmt" - "io" - "net" - "net/http" - "strings" - "sync" - "time" - - "golang.org/x/net/context" - "golang.org/x/net/http2" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/peer" -) - -// NewServerHandlerTransport returns a ServerTransport handling gRPC -// from inside an http.Handler. It requires that the http Server -// supports HTTP/2. -func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request) (ServerTransport, error) { - if r.ProtoMajor != 2 { - return nil, errors.New("gRPC requires HTTP/2") - } - if r.Method != "POST" { - return nil, errors.New("invalid gRPC request method") - } - if !validContentType(r.Header.Get("Content-Type")) { - return nil, errors.New("invalid gRPC request content-type") - } - if _, ok := w.(http.Flusher); !ok { - return nil, errors.New("gRPC requires a ResponseWriter supporting http.Flusher") - } - if _, ok := w.(http.CloseNotifier); !ok { - return nil, errors.New("gRPC requires a ResponseWriter supporting http.CloseNotifier") - } - - st := &serverHandlerTransport{ - rw: w, - req: r, - closedCh: make(chan struct{}), - writes: make(chan func()), - } - - if v := r.Header.Get("grpc-timeout"); v != "" { - to, err := decodeTimeout(v) - if err != nil { - return nil, streamErrorf(codes.Internal, "malformed time-out: %v", err) - } - st.timeoutSet = true - st.timeout = to - } - - var metakv []string - if r.Host != "" { - metakv = append(metakv, ":authority", r.Host) - } - for k, vv := range r.Header { - k = strings.ToLower(k) - if isReservedHeader(k) && !isWhitelistedPseudoHeader(k) { - continue - } - for _, v := range vv { - if k == "user-agent" { - // user-agent is special. Copying logic of http_util.go. - if i := strings.LastIndex(v, " "); i == -1 { - // There is no application user agent string being set - continue - } else { - v = v[:i] - } - } - metakv = append(metakv, k, v) - } - } - st.headerMD = metadata.Pairs(metakv...) - - return st, nil -} - -// serverHandlerTransport is an implementation of ServerTransport -// which replies to exactly one gRPC request (exactly one HTTP request), -// using the net/http.Handler interface. This http.Handler is guaranteed -// at this point to be speaking over HTTP/2, so it's able to speak valid -// gRPC. -type serverHandlerTransport struct { - rw http.ResponseWriter - req *http.Request - timeoutSet bool - timeout time.Duration - didCommonHeaders bool - - headerMD metadata.MD - - closeOnce sync.Once - closedCh chan struct{} // closed on Close - - // writes is a channel of code to run serialized in the - // ServeHTTP (HandleStreams) goroutine. The channel is closed - // when WriteStatus is called. - writes chan func() -} - -func (ht *serverHandlerTransport) Close() error { - ht.closeOnce.Do(ht.closeCloseChanOnce) - return nil -} - -func (ht *serverHandlerTransport) closeCloseChanOnce() { close(ht.closedCh) } - -func (ht *serverHandlerTransport) RemoteAddr() net.Addr { return strAddr(ht.req.RemoteAddr) } - -// strAddr is a net.Addr backed by either a TCP "ip:port" string, or -// the empty string if unknown. -type strAddr string - -func (a strAddr) Network() string { - if a != "" { - // Per the documentation on net/http.Request.RemoteAddr, if this is - // set, it's set to the IP:port of the peer (hence, TCP): - // https://golang.org/pkg/net/http/#Request - // - // If we want to support Unix sockets later, we can - // add our own grpc-specific convention within the - // grpc codebase to set RemoteAddr to a different - // format, or probably better: we can attach it to the - // context and use that from serverHandlerTransport.RemoteAddr. - return "tcp" - } - return "" -} - -func (a strAddr) String() string { return string(a) } - -// do runs fn in the ServeHTTP goroutine. -func (ht *serverHandlerTransport) do(fn func()) error { - select { - case ht.writes <- fn: - return nil - case <-ht.closedCh: - return ErrConnClosing - } -} - -func (ht *serverHandlerTransport) WriteStatus(s *Stream, statusCode codes.Code, statusDesc string) error { - err := ht.do(func() { - ht.writeCommonHeaders(s) - - // And flush, in case no header or body has been sent yet. - // This forces a separation of headers and trailers if this is the - // first call (for example, in end2end tests's TestNoService). - ht.rw.(http.Flusher).Flush() - - h := ht.rw.Header() - h.Set("Grpc-Status", fmt.Sprintf("%d", statusCode)) - if statusDesc != "" { - h.Set("Grpc-Message", encodeGrpcMessage(statusDesc)) - } - if md := s.Trailer(); len(md) > 0 { - for k, vv := range md { - // Clients don't tolerate reading restricted headers after some non restricted ones were sent. - if isReservedHeader(k) { - continue - } - for _, v := range vv { - // http2 ResponseWriter mechanism to - // send undeclared Trailers after the - // headers have possibly been written. - h.Add(http2.TrailerPrefix+k, v) - } - } - } - }) - close(ht.writes) - return err -} - -// writeCommonHeaders sets common headers on the first write -// call (Write, WriteHeader, or WriteStatus). -func (ht *serverHandlerTransport) writeCommonHeaders(s *Stream) { - if ht.didCommonHeaders { - return - } - ht.didCommonHeaders = true - - h := ht.rw.Header() - h["Date"] = nil // suppress Date to make tests happy; TODO: restore - h.Set("Content-Type", "application/grpc") - - // Predeclare trailers we'll set later in WriteStatus (after the body). - // This is a SHOULD in the HTTP RFC, and the way you add (known) - // Trailers per the net/http.ResponseWriter contract. - // See https://golang.org/pkg/net/http/#ResponseWriter - // and https://golang.org/pkg/net/http/#example_ResponseWriter_trailers - h.Add("Trailer", "Grpc-Status") - h.Add("Trailer", "Grpc-Message") - - if s.sendCompress != "" { - h.Set("Grpc-Encoding", s.sendCompress) - } -} - -func (ht *serverHandlerTransport) Write(s *Stream, data []byte, opts *Options) error { - return ht.do(func() { - ht.writeCommonHeaders(s) - ht.rw.Write(data) - if !opts.Delay { - ht.rw.(http.Flusher).Flush() - } - }) -} - -func (ht *serverHandlerTransport) WriteHeader(s *Stream, md metadata.MD) error { - return ht.do(func() { - ht.writeCommonHeaders(s) - h := ht.rw.Header() - for k, vv := range md { - // Clients don't tolerate reading restricted headers after some non restricted ones were sent. - if isReservedHeader(k) { - continue - } - for _, v := range vv { - h.Add(k, v) - } - } - ht.rw.WriteHeader(200) - ht.rw.(http.Flusher).Flush() - }) -} - -func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), traceCtx func(context.Context, string) context.Context) { - // With this transport type there will be exactly 1 stream: this HTTP request. - - var ctx context.Context - var cancel context.CancelFunc - if ht.timeoutSet { - ctx, cancel = context.WithTimeout(context.Background(), ht.timeout) - } else { - ctx, cancel = context.WithCancel(context.Background()) - } - - // requestOver is closed when either the request's context is done - // or the status has been written via WriteStatus. - requestOver := make(chan struct{}) - - // clientGone receives a single value if peer is gone, either - // because the underlying connection is dead or because the - // peer sends an http2 RST_STREAM. - clientGone := ht.rw.(http.CloseNotifier).CloseNotify() - go func() { - select { - case <-requestOver: - return - case <-ht.closedCh: - case <-clientGone: - } - cancel() - }() - - req := ht.req - - s := &Stream{ - id: 0, // irrelevant - windowHandler: func(int) {}, // nothing - cancel: cancel, - buf: newRecvBuffer(), - st: ht, - method: req.URL.Path, - recvCompress: req.Header.Get("grpc-encoding"), - } - pr := &peer.Peer{ - Addr: ht.RemoteAddr(), - } - if req.TLS != nil { - pr.AuthInfo = credentials.TLSInfo{State: *req.TLS} - } - ctx = metadata.NewContext(ctx, ht.headerMD) - ctx = peer.NewContext(ctx, pr) - s.ctx = newContextWithStream(ctx, s) - s.dec = &recvBufferReader{ctx: s.ctx, recv: s.buf} - - // readerDone is closed when the Body.Read-ing goroutine exits. - readerDone := make(chan struct{}) - go func() { - defer close(readerDone) - - // TODO: minimize garbage, optimize recvBuffer code/ownership - const readSize = 8196 - for buf := make([]byte, readSize); ; { - n, err := req.Body.Read(buf) - if n > 0 { - s.buf.put(&recvMsg{data: buf[:n:n]}) - buf = buf[n:] - } - if err != nil { - s.buf.put(&recvMsg{err: mapRecvMsgError(err)}) - return - } - if len(buf) == 0 { - buf = make([]byte, readSize) - } - } - }() - - // startStream is provided by the *grpc.Server's serveStreams. - // It starts a goroutine serving s and exits immediately. - // The goroutine that is started is the one that then calls - // into ht, calling WriteHeader, Write, WriteStatus, Close, etc. - startStream(s) - - ht.runStream() - close(requestOver) - - // Wait for reading goroutine to finish. - req.Body.Close() - <-readerDone -} - -func (ht *serverHandlerTransport) runStream() { - for { - select { - case fn, ok := <-ht.writes: - if !ok { - return - } - fn() - case <-ht.closedCh: - return - } - } -} - -func (ht *serverHandlerTransport) Drain() { - panic("Drain() is not implemented") -} - -// mapRecvMsgError returns the non-nil err into the appropriate -// error value as expected by callers of *grpc.parser.recvMsg. -// In particular, in can only be: -// * io.EOF -// * io.ErrUnexpectedEOF -// * of type transport.ConnectionError -// * of type transport.StreamError -func mapRecvMsgError(err error) error { - if err == io.EOF || err == io.ErrUnexpectedEOF { - return err - } - if se, ok := err.(http2.StreamError); ok { - if code, ok := http2ErrConvTab[se.Code]; ok { - return StreamError{ - Code: code, - Desc: se.Error(), - } - } - } - return connectionErrorf(true, err, err.Error()) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http2_client.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http2_client.go deleted file mode 100644 index 5f579b8b01b..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http2_client.go +++ /dev/null @@ -1,1230 +0,0 @@ -/* - * - * Copyright 2014, Google Inc. - * 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. - * - */ - -package transport - -import ( - "bytes" - "fmt" - "io" - "math" - "net" - "strings" - "sync" - "sync/atomic" - "time" - - "golang.org/x/net/context" - "golang.org/x/net/http2" - "golang.org/x/net/http2/hpack" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/keepalive" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/peer" - "google.golang.org/grpc/stats" -) - -// http2Client implements the ClientTransport interface with HTTP2. -type http2Client struct { - ctx context.Context - target string // server name/addr - userAgent string - md interface{} - conn net.Conn // underlying communication channel - remoteAddr net.Addr - localAddr net.Addr - authInfo credentials.AuthInfo // auth info about the connection - nextID uint32 // the next stream ID to be used - - // writableChan synchronizes write access to the transport. - // A writer acquires the write lock by sending a value on writableChan - // and releases it by receiving from writableChan. - writableChan chan int - // shutdownChan is closed when Close is called. - // Blocking operations should select on shutdownChan to avoid - // blocking forever after Close. - // TODO(zhaoq): Maybe have a channel context? - shutdownChan chan struct{} - // errorChan is closed to notify the I/O error to the caller. - errorChan chan struct{} - // goAway is closed to notify the upper layer (i.e., addrConn.transportMonitor) - // that the server sent GoAway on this transport. - goAway chan struct{} - // awakenKeepalive is used to wake up keepalive when after it has gone dormant. - awakenKeepalive chan struct{} - - framer *framer - hBuf *bytes.Buffer // the buffer for HPACK encoding - hEnc *hpack.Encoder // HPACK encoder - - // controlBuf delivers all the control related tasks (e.g., window - // updates, reset streams, and various settings) to the controller. - controlBuf *recvBuffer - fc *inFlow - // sendQuotaPool provides flow control to outbound message. - sendQuotaPool *quotaPool - // streamsQuota limits the max number of concurrent streams. - streamsQuota *quotaPool - - // The scheme used: https if TLS is on, http otherwise. - scheme string - - creds []credentials.PerRPCCredentials - - // Boolean to keep track of reading activity on transport. - // 1 is true and 0 is false. - activity uint32 // Accessed atomically. - kp keepalive.ClientParameters - - statsHandler stats.Handler - - mu sync.Mutex // guard the following variables - state transportState // the state of underlying connection - activeStreams map[uint32]*Stream - // The max number of concurrent streams - maxStreams int - // the per-stream outbound flow control window size set by the peer. - streamSendQuota uint32 - // goAwayID records the Last-Stream-ID in the GoAway frame from the server. - goAwayID uint32 - // prevGoAway ID records the Last-Stream-ID in the previous GOAway frame. - prevGoAwayID uint32 -} - -func dial(ctx context.Context, fn func(context.Context, string) (net.Conn, error), addr string) (net.Conn, error) { - if fn != nil { - return fn(ctx, addr) - } - return dialContext(ctx, "tcp", addr) -} - -func isTemporary(err error) bool { - switch err { - case io.EOF: - // Connection closures may be resolved upon retry, and are thus - // treated as temporary. - return true - case context.DeadlineExceeded: - // In Go 1.7, context.DeadlineExceeded implements Timeout(), and this - // special case is not needed. Until then, we need to keep this - // clause. - return true - } - - switch err := err.(type) { - case interface { - Temporary() bool - }: - return err.Temporary() - case interface { - Timeout() bool - }: - // Timeouts may be resolved upon retry, and are thus treated as - // temporary. - return err.Timeout() - } - return false -} - -// newHTTP2Client constructs a connected ClientTransport to addr based on HTTP2 -// and starts to receive messages on it. Non-nil error returns if construction -// fails. -func newHTTP2Client(ctx context.Context, addr TargetInfo, opts ConnectOptions) (_ ClientTransport, err error) { - scheme := "http" - conn, err := dial(ctx, opts.Dialer, addr.Addr) - if err != nil { - if opts.FailOnNonTempDialError { - return nil, connectionErrorf(isTemporary(err), err, "transport: %v", err) - } - return nil, connectionErrorf(true, err, "transport: %v", err) - } - // Any further errors will close the underlying connection - defer func(conn net.Conn) { - if err != nil { - conn.Close() - } - }(conn) - var authInfo credentials.AuthInfo - if creds := opts.TransportCredentials; creds != nil { - scheme = "https" - conn, authInfo, err = creds.ClientHandshake(ctx, addr.Addr, conn) - if err != nil { - // Credentials handshake errors are typically considered permanent - // to avoid retrying on e.g. bad certificates. - temp := isTemporary(err) - return nil, connectionErrorf(temp, err, "transport: %v", err) - } - } - kp := opts.KeepaliveParams - // Validate keepalive parameters. - if kp.Time == 0 { - kp.Time = defaultKeepaliveTime - } - if kp.Timeout == 0 { - kp.Timeout = defaultKeepaliveTimeout - } - var buf bytes.Buffer - t := &http2Client{ - ctx: ctx, - target: addr.Addr, - userAgent: opts.UserAgent, - md: addr.Metadata, - conn: conn, - remoteAddr: conn.RemoteAddr(), - localAddr: conn.LocalAddr(), - authInfo: authInfo, - // The client initiated stream id is odd starting from 1. - nextID: 1, - writableChan: make(chan int, 1), - shutdownChan: make(chan struct{}), - errorChan: make(chan struct{}), - goAway: make(chan struct{}), - awakenKeepalive: make(chan struct{}, 1), - framer: newFramer(conn), - hBuf: &buf, - hEnc: hpack.NewEncoder(&buf), - controlBuf: newRecvBuffer(), - fc: &inFlow{limit: initialConnWindowSize}, - sendQuotaPool: newQuotaPool(defaultWindowSize), - scheme: scheme, - state: reachable, - activeStreams: make(map[uint32]*Stream), - creds: opts.PerRPCCredentials, - maxStreams: defaultMaxStreamsClient, - streamsQuota: newQuotaPool(defaultMaxStreamsClient), - streamSendQuota: defaultWindowSize, - kp: kp, - statsHandler: opts.StatsHandler, - } - // Make sure awakenKeepalive can't be written upon. - // keepalive routine will make it writable, if need be. - t.awakenKeepalive <- struct{}{} - if t.statsHandler != nil { - t.ctx = t.statsHandler.TagConn(t.ctx, &stats.ConnTagInfo{ - RemoteAddr: t.remoteAddr, - LocalAddr: t.localAddr, - }) - connBegin := &stats.ConnBegin{ - Client: true, - } - t.statsHandler.HandleConn(t.ctx, connBegin) - } - // Start the reader goroutine for incoming message. Each transport has - // a dedicated goroutine which reads HTTP2 frame from network. Then it - // dispatches the frame to the corresponding stream entity. - go t.reader() - // Send connection preface to server. - n, err := t.conn.Write(clientPreface) - if err != nil { - t.Close() - return nil, connectionErrorf(true, err, "transport: %v", err) - } - if n != len(clientPreface) { - t.Close() - return nil, connectionErrorf(true, err, "transport: preface mismatch, wrote %d bytes; want %d", n, len(clientPreface)) - } - if initialWindowSize != defaultWindowSize { - err = t.framer.writeSettings(true, http2.Setting{ - ID: http2.SettingInitialWindowSize, - Val: uint32(initialWindowSize), - }) - } else { - err = t.framer.writeSettings(true) - } - if err != nil { - t.Close() - return nil, connectionErrorf(true, err, "transport: %v", err) - } - // Adjust the connection flow control window if needed. - if delta := uint32(initialConnWindowSize - defaultWindowSize); delta > 0 { - if err := t.framer.writeWindowUpdate(true, 0, delta); err != nil { - t.Close() - return nil, connectionErrorf(true, err, "transport: %v", err) - } - } - go t.controller() - if t.kp.Time != infinity { - go t.keepalive() - } - t.writableChan <- 0 - return t, nil -} - -func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr) *Stream { - // TODO(zhaoq): Handle uint32 overflow of Stream.id. - s := &Stream{ - id: t.nextID, - done: make(chan struct{}), - goAway: make(chan struct{}), - method: callHdr.Method, - sendCompress: callHdr.SendCompress, - buf: newRecvBuffer(), - fc: &inFlow{limit: initialWindowSize}, - sendQuotaPool: newQuotaPool(int(t.streamSendQuota)), - headerChan: make(chan struct{}), - } - t.nextID += 2 - s.windowHandler = func(n int) { - t.updateWindow(s, uint32(n)) - } - // The client side stream context should have exactly the same life cycle with the user provided context. - // That means, s.ctx should be read-only. And s.ctx is done iff ctx is done. - // So we use the original context here instead of creating a copy. - s.ctx = ctx - s.dec = &recvBufferReader{ - ctx: s.ctx, - goAway: s.goAway, - recv: s.buf, - } - return s -} - -// NewStream creates a stream and register it into the transport as "active" -// streams. -func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Stream, err error) { - pr := &peer.Peer{ - Addr: t.remoteAddr, - } - // Attach Auth info if there is any. - if t.authInfo != nil { - pr.AuthInfo = t.authInfo - } - userCtx := ctx - ctx = peer.NewContext(ctx, pr) - authData := make(map[string]string) - for _, c := range t.creds { - // Construct URI required to get auth request metadata. - var port string - if pos := strings.LastIndex(t.target, ":"); pos != -1 { - // Omit port if it is the default one. - if t.target[pos+1:] != "443" { - port = ":" + t.target[pos+1:] - } - } - pos := strings.LastIndex(callHdr.Method, "/") - if pos == -1 { - return nil, streamErrorf(codes.InvalidArgument, "transport: malformed method name: %q", callHdr.Method) - } - audience := "https://" + callHdr.Host + port + callHdr.Method[:pos] - data, err := c.GetRequestMetadata(ctx, audience) - if err != nil { - return nil, streamErrorf(codes.InvalidArgument, "transport: %v", err) - } - for k, v := range data { - authData[k] = v - } - } - t.mu.Lock() - if t.activeStreams == nil { - t.mu.Unlock() - return nil, ErrConnClosing - } - if t.state == draining { - t.mu.Unlock() - return nil, ErrStreamDrain - } - if t.state != reachable { - t.mu.Unlock() - return nil, ErrConnClosing - } - t.mu.Unlock() - sq, err := wait(ctx, nil, nil, t.shutdownChan, t.streamsQuota.acquire()) - if err != nil { - return nil, err - } - // Returns the quota balance back. - if sq > 1 { - t.streamsQuota.add(sq - 1) - } - if _, err := wait(ctx, nil, nil, t.shutdownChan, t.writableChan); err != nil { - // Return the quota back now because there is no stream returned to the caller. - if _, ok := err.(StreamError); ok { - t.streamsQuota.add(1) - } - return nil, err - } - t.mu.Lock() - if t.state == draining { - t.mu.Unlock() - t.streamsQuota.add(1) - // Need to make t writable again so that the rpc in flight can still proceed. - t.writableChan <- 0 - return nil, ErrStreamDrain - } - if t.state != reachable { - t.mu.Unlock() - return nil, ErrConnClosing - } - s := t.newStream(ctx, callHdr) - s.clientStatsCtx = userCtx - t.activeStreams[s.id] = s - // If the number of active streams change from 0 to 1, then check if keepalive - // has gone dormant. If so, wake it up. - if len(t.activeStreams) == 1 { - select { - case t.awakenKeepalive <- struct{}{}: - t.framer.writePing(false, false, [8]byte{}) - default: - } - } - - t.mu.Unlock() - - // HPACK encodes various headers. Note that once WriteField(...) is - // called, the corresponding headers/continuation frame has to be sent - // because hpack.Encoder is stateful. - t.hBuf.Reset() - t.hEnc.WriteField(hpack.HeaderField{Name: ":method", Value: "POST"}) - t.hEnc.WriteField(hpack.HeaderField{Name: ":scheme", Value: t.scheme}) - t.hEnc.WriteField(hpack.HeaderField{Name: ":path", Value: callHdr.Method}) - t.hEnc.WriteField(hpack.HeaderField{Name: ":authority", Value: callHdr.Host}) - t.hEnc.WriteField(hpack.HeaderField{Name: "content-type", Value: "application/grpc"}) - t.hEnc.WriteField(hpack.HeaderField{Name: "user-agent", Value: t.userAgent}) - t.hEnc.WriteField(hpack.HeaderField{Name: "te", Value: "trailers"}) - - if callHdr.SendCompress != "" { - t.hEnc.WriteField(hpack.HeaderField{Name: "grpc-encoding", Value: callHdr.SendCompress}) - } - if dl, ok := ctx.Deadline(); ok { - // Send out timeout regardless its value. The server can detect timeout context by itself. - timeout := dl.Sub(time.Now()) - t.hEnc.WriteField(hpack.HeaderField{Name: "grpc-timeout", Value: encodeTimeout(timeout)}) - } - - for k, v := range authData { - // Capital header names are illegal in HTTP/2. - k = strings.ToLower(k) - t.hEnc.WriteField(hpack.HeaderField{Name: k, Value: v}) - } - var ( - hasMD bool - endHeaders bool - ) - if md, ok := metadata.FromContext(ctx); ok { - hasMD = true - for k, v := range md { - // HTTP doesn't allow you to set pseudoheaders after non pseudoheaders were set. - if isReservedHeader(k) { - continue - } - for _, entry := range v { - t.hEnc.WriteField(hpack.HeaderField{Name: k, Value: entry}) - } - } - } - if md, ok := t.md.(*metadata.MD); ok { - for k, v := range *md { - if isReservedHeader(k) { - continue - } - for _, entry := range v { - t.hEnc.WriteField(hpack.HeaderField{Name: k, Value: entry}) - } - } - } - first := true - bufLen := t.hBuf.Len() - // Sends the headers in a single batch even when they span multiple frames. - for !endHeaders { - size := t.hBuf.Len() - if size > http2MaxFrameLen { - size = http2MaxFrameLen - } else { - endHeaders = true - } - var flush bool - if endHeaders && (hasMD || callHdr.Flush) { - flush = true - } - if first { - // Sends a HeadersFrame to server to start a new stream. - p := http2.HeadersFrameParam{ - StreamID: s.id, - BlockFragment: t.hBuf.Next(size), - EndStream: false, - EndHeaders: endHeaders, - } - // Do a force flush for the buffered frames iff it is the last headers frame - // and there is header metadata to be sent. Otherwise, there is flushing until - // the corresponding data frame is written. - err = t.framer.writeHeaders(flush, p) - first = false - } else { - // Sends Continuation frames for the leftover headers. - err = t.framer.writeContinuation(flush, s.id, endHeaders, t.hBuf.Next(size)) - } - if err != nil { - t.notifyError(err) - return nil, connectionErrorf(true, err, "transport: %v", err) - } - } - if t.statsHandler != nil { - outHeader := &stats.OutHeader{ - Client: true, - WireLength: bufLen, - FullMethod: callHdr.Method, - RemoteAddr: t.remoteAddr, - LocalAddr: t.localAddr, - Compression: callHdr.SendCompress, - } - t.statsHandler.HandleRPC(s.clientStatsCtx, outHeader) - } - t.writableChan <- 0 - return s, nil -} - -// CloseStream clears the footprint of a stream when the stream is not needed any more. -// This must not be executed in reader's goroutine. -func (t *http2Client) CloseStream(s *Stream, err error) { - t.mu.Lock() - if t.activeStreams == nil { - t.mu.Unlock() - return - } - delete(t.activeStreams, s.id) - if t.state == draining && len(t.activeStreams) == 0 { - // The transport is draining and s is the last live stream on t. - t.mu.Unlock() - t.Close() - return - } - t.mu.Unlock() - // rstStream is true in case the stream is being closed at the client-side - // and the server needs to be intimated about it by sending a RST_STREAM - // frame. - // To make sure this frame is written to the wire before the headers of the - // next stream waiting for streamsQuota, we add to streamsQuota pool only - // after having acquired the writableChan to send RST_STREAM out (look at - // the controller() routine). - var rstStream bool - var rstError http2.ErrCode - defer func() { - // In case, the client doesn't have to send RST_STREAM to server - // we can safely add back to streamsQuota pool now. - if !rstStream { - t.streamsQuota.add(1) - return - } - t.controlBuf.put(&resetStream{s.id, rstError}) - }() - s.mu.Lock() - rstStream = s.rstStream - rstError = s.rstError - if q := s.fc.resetPendingData(); q > 0 { - if n := t.fc.onRead(q); n > 0 { - t.controlBuf.put(&windowUpdate{0, n}) - } - } - if s.state == streamDone { - s.mu.Unlock() - return - } - if !s.headerDone { - close(s.headerChan) - s.headerDone = true - } - s.state = streamDone - s.mu.Unlock() - if _, ok := err.(StreamError); ok { - rstStream = true - rstError = http2.ErrCodeCancel - } -} - -// Close kicks off the shutdown process of the transport. This should be called -// only once on a transport. Once it is called, the transport should not be -// accessed any more. -func (t *http2Client) Close() (err error) { - t.mu.Lock() - if t.state == closing { - t.mu.Unlock() - return - } - if t.state == reachable || t.state == draining { - close(t.errorChan) - } - t.state = closing - t.mu.Unlock() - close(t.shutdownChan) - err = t.conn.Close() - t.mu.Lock() - streams := t.activeStreams - t.activeStreams = nil - t.mu.Unlock() - // Notify all active streams. - for _, s := range streams { - s.mu.Lock() - if !s.headerDone { - close(s.headerChan) - s.headerDone = true - } - s.mu.Unlock() - s.write(recvMsg{err: ErrConnClosing}) - } - if t.statsHandler != nil { - connEnd := &stats.ConnEnd{ - Client: true, - } - t.statsHandler.HandleConn(t.ctx, connEnd) - } - return -} - -func (t *http2Client) GracefulClose() error { - t.mu.Lock() - switch t.state { - case unreachable: - // The server may close the connection concurrently. t is not available for - // any streams. Close it now. - t.mu.Unlock() - t.Close() - return nil - case closing: - t.mu.Unlock() - return nil - } - // Notify the streams which were initiated after the server sent GOAWAY. - select { - case <-t.goAway: - n := t.prevGoAwayID - if n == 0 && t.nextID > 1 { - n = t.nextID - 2 - } - m := t.goAwayID + 2 - if m == 2 { - m = 1 - } - for i := m; i <= n; i += 2 { - if s, ok := t.activeStreams[i]; ok { - close(s.goAway) - } - } - default: - } - if t.state == draining { - t.mu.Unlock() - return nil - } - t.state = draining - active := len(t.activeStreams) - t.mu.Unlock() - if active == 0 { - return t.Close() - } - return nil -} - -// Write formats the data into HTTP2 data frame(s) and sends it out. The caller -// should proceed only if Write returns nil. -// TODO(zhaoq): opts.Delay is ignored in this implementation. Support it later -// if it improves the performance. -func (t *http2Client) Write(s *Stream, data []byte, opts *Options) error { - r := bytes.NewBuffer(data) - for { - var p []byte - if r.Len() > 0 { - size := http2MaxFrameLen - // Wait until the stream has some quota to send the data. - sq, err := wait(s.ctx, s.done, s.goAway, t.shutdownChan, s.sendQuotaPool.acquire()) - if err != nil { - return err - } - // Wait until the transport has some quota to send the data. - tq, err := wait(s.ctx, s.done, s.goAway, t.shutdownChan, t.sendQuotaPool.acquire()) - if err != nil { - return err - } - if sq < size { - size = sq - } - if tq < size { - size = tq - } - p = r.Next(size) - ps := len(p) - if ps < sq { - // Overbooked stream quota. Return it back. - s.sendQuotaPool.add(sq - ps) - } - if ps < tq { - // Overbooked transport quota. Return it back. - t.sendQuotaPool.add(tq - ps) - } - } - var ( - endStream bool - forceFlush bool - ) - if opts.Last && r.Len() == 0 { - endStream = true - } - // Indicate there is a writer who is about to write a data frame. - t.framer.adjustNumWriters(1) - // Got some quota. Try to acquire writing privilege on the transport. - if _, err := wait(s.ctx, s.done, s.goAway, t.shutdownChan, t.writableChan); err != nil { - if _, ok := err.(StreamError); ok || err == io.EOF { - // Return the connection quota back. - t.sendQuotaPool.add(len(p)) - } - if t.framer.adjustNumWriters(-1) == 0 { - // This writer is the last one in this batch and has the - // responsibility to flush the buffered frames. It queues - // a flush request to controlBuf instead of flushing directly - // in order to avoid the race with other writing or flushing. - t.controlBuf.put(&flushIO{}) - } - return err - } - select { - case <-s.ctx.Done(): - t.sendQuotaPool.add(len(p)) - if t.framer.adjustNumWriters(-1) == 0 { - t.controlBuf.put(&flushIO{}) - } - t.writableChan <- 0 - return ContextErr(s.ctx.Err()) - default: - } - if r.Len() == 0 && t.framer.adjustNumWriters(0) == 1 { - // Do a force flush iff this is last frame for the entire gRPC message - // and the caller is the only writer at this moment. - forceFlush = true - } - // If WriteData fails, all the pending streams will be handled - // by http2Client.Close(). No explicit CloseStream() needs to be - // invoked. - if err := t.framer.writeData(forceFlush, s.id, endStream, p); err != nil { - t.notifyError(err) - return connectionErrorf(true, err, "transport: %v", err) - } - if t.framer.adjustNumWriters(-1) == 0 { - t.framer.flushWrite() - } - t.writableChan <- 0 - if r.Len() == 0 { - break - } - } - if !opts.Last { - return nil - } - s.mu.Lock() - if s.state != streamDone { - s.state = streamWriteDone - } - s.mu.Unlock() - return nil -} - -func (t *http2Client) getStream(f http2.Frame) (*Stream, bool) { - t.mu.Lock() - defer t.mu.Unlock() - s, ok := t.activeStreams[f.Header().StreamID] - return s, ok -} - -// updateWindow adjusts the inbound quota for the stream and the transport. -// Window updates will deliver to the controller for sending when -// the cumulative quota exceeds the corresponding threshold. -func (t *http2Client) updateWindow(s *Stream, n uint32) { - s.mu.Lock() - defer s.mu.Unlock() - if s.state == streamDone { - return - } - if w := t.fc.onRead(n); w > 0 { - t.controlBuf.put(&windowUpdate{0, w}) - } - if w := s.fc.onRead(n); w > 0 { - t.controlBuf.put(&windowUpdate{s.id, w}) - } -} - -func (t *http2Client) handleData(f *http2.DataFrame) { - size := f.Header().Length - if err := t.fc.onData(uint32(size)); err != nil { - t.notifyError(connectionErrorf(true, err, "%v", err)) - return - } - // Select the right stream to dispatch. - s, ok := t.getStream(f) - if !ok { - if w := t.fc.onRead(uint32(size)); w > 0 { - t.controlBuf.put(&windowUpdate{0, w}) - } - return - } - if size > 0 { - if f.Header().Flags.Has(http2.FlagDataPadded) { - if w := t.fc.onRead(uint32(size) - uint32(len(f.Data()))); w > 0 { - t.controlBuf.put(&windowUpdate{0, w}) - } - } - s.mu.Lock() - if s.state == streamDone { - s.mu.Unlock() - // The stream has been closed. Release the corresponding quota. - if w := t.fc.onRead(uint32(size)); w > 0 { - t.controlBuf.put(&windowUpdate{0, w}) - } - return - } - if err := s.fc.onData(uint32(size)); err != nil { - s.state = streamDone - s.statusCode = codes.Internal - s.statusDesc = err.Error() - s.rstStream = true - s.rstError = http2.ErrCodeFlowControl - close(s.done) - s.mu.Unlock() - s.write(recvMsg{err: io.EOF}) - return - } - if f.Header().Flags.Has(http2.FlagDataPadded) { - if w := s.fc.onRead(uint32(size) - uint32(len(f.Data()))); w > 0 { - t.controlBuf.put(&windowUpdate{s.id, w}) - } - } - s.mu.Unlock() - // TODO(bradfitz, zhaoq): A copy is required here because there is no - // guarantee f.Data() is consumed before the arrival of next frame. - // Can this copy be eliminated? - if len(f.Data()) > 0 { - data := make([]byte, len(f.Data())) - copy(data, f.Data()) - s.write(recvMsg{data: data}) - } - } - // The server has closed the stream without sending trailers. Record that - // the read direction is closed, and set the status appropriately. - if f.FrameHeader.Flags.Has(http2.FlagDataEndStream) { - s.mu.Lock() - if s.state == streamDone { - s.mu.Unlock() - return - } - s.state = streamDone - s.statusCode = codes.Internal - s.statusDesc = "server closed the stream without sending trailers" - close(s.done) - s.mu.Unlock() - s.write(recvMsg{err: io.EOF}) - } -} - -func (t *http2Client) handleRSTStream(f *http2.RSTStreamFrame) { - s, ok := t.getStream(f) - if !ok { - return - } - s.mu.Lock() - if s.state == streamDone { - s.mu.Unlock() - return - } - s.state = streamDone - if !s.headerDone { - close(s.headerChan) - s.headerDone = true - } - s.statusCode, ok = http2ErrConvTab[http2.ErrCode(f.ErrCode)] - if !ok { - grpclog.Println("transport: http2Client.handleRSTStream found no mapped gRPC status for the received http2 error ", f.ErrCode) - s.statusCode = codes.Unknown - } - s.statusDesc = fmt.Sprintf("stream terminated by RST_STREAM with error code: %d", f.ErrCode) - close(s.done) - s.mu.Unlock() - s.write(recvMsg{err: io.EOF}) -} - -func (t *http2Client) handleSettings(f *http2.SettingsFrame) { - if f.IsAck() { - return - } - var ss []http2.Setting - f.ForeachSetting(func(s http2.Setting) error { - ss = append(ss, s) - return nil - }) - // The settings will be applied once the ack is sent. - t.controlBuf.put(&settings{ack: true, ss: ss}) -} - -func (t *http2Client) handlePing(f *http2.PingFrame) { - if f.IsAck() { // Do nothing. - return - } - pingAck := &ping{ack: true} - copy(pingAck.data[:], f.Data[:]) - t.controlBuf.put(pingAck) -} - -func (t *http2Client) handleGoAway(f *http2.GoAwayFrame) { - t.mu.Lock() - if t.state == reachable || t.state == draining { - if f.LastStreamID > 0 && f.LastStreamID%2 != 1 { - t.mu.Unlock() - t.notifyError(connectionErrorf(true, nil, "received illegal http2 GOAWAY frame: stream ID %d is even", f.LastStreamID)) - return - } - select { - case <-t.goAway: - id := t.goAwayID - // t.goAway has been closed (i.e.,multiple GoAways). - if id < f.LastStreamID { - t.mu.Unlock() - t.notifyError(connectionErrorf(true, nil, "received illegal http2 GOAWAY frame: previously recv GOAWAY frame with LastStramID %d, currently recv %d", id, f.LastStreamID)) - return - } - t.prevGoAwayID = id - t.goAwayID = f.LastStreamID - t.mu.Unlock() - return - default: - } - t.goAwayID = f.LastStreamID - close(t.goAway) - } - t.mu.Unlock() -} - -func (t *http2Client) handleWindowUpdate(f *http2.WindowUpdateFrame) { - id := f.Header().StreamID - incr := f.Increment - if id == 0 { - t.sendQuotaPool.add(int(incr)) - return - } - if s, ok := t.getStream(f); ok { - s.sendQuotaPool.add(int(incr)) - } -} - -// operateHeaders takes action on the decoded headers. -func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { - s, ok := t.getStream(frame) - if !ok { - return - } - var state decodeState - for _, hf := range frame.Fields { - state.processHeaderField(hf) - } - if state.err != nil { - s.mu.Lock() - if !s.headerDone { - close(s.headerChan) - s.headerDone = true - } - s.mu.Unlock() - s.write(recvMsg{err: state.err}) - // Something wrong. Stops reading even when there is remaining. - return - } - - endStream := frame.StreamEnded() - var isHeader bool - defer func() { - if t.statsHandler != nil { - if isHeader { - inHeader := &stats.InHeader{ - Client: true, - WireLength: int(frame.Header().Length), - } - t.statsHandler.HandleRPC(s.clientStatsCtx, inHeader) - } else { - inTrailer := &stats.InTrailer{ - Client: true, - WireLength: int(frame.Header().Length), - } - t.statsHandler.HandleRPC(s.clientStatsCtx, inTrailer) - } - } - }() - - s.mu.Lock() - if !endStream { - s.recvCompress = state.encoding - } - if !s.headerDone { - if !endStream && len(state.mdata) > 0 { - s.header = state.mdata - } - close(s.headerChan) - s.headerDone = true - isHeader = true - } - if !endStream || s.state == streamDone { - s.mu.Unlock() - return - } - - if len(state.mdata) > 0 { - s.trailer = state.mdata - } - s.statusCode = state.statusCode - s.statusDesc = state.statusDesc - close(s.done) - s.state = streamDone - s.mu.Unlock() - s.write(recvMsg{err: io.EOF}) -} - -func handleMalformedHTTP2(s *Stream, err error) { - s.mu.Lock() - if !s.headerDone { - close(s.headerChan) - s.headerDone = true - } - s.mu.Unlock() - s.write(recvMsg{err: err}) -} - -// reader runs as a separate goroutine in charge of reading data from network -// connection. -// -// TODO(zhaoq): currently one reader per transport. Investigate whether this is -// optimal. -// TODO(zhaoq): Check the validity of the incoming frame sequence. -func (t *http2Client) reader() { - // Check the validity of server preface. - frame, err := t.framer.readFrame() - if err != nil { - t.notifyError(err) - return - } - atomic.CompareAndSwapUint32(&t.activity, 0, 1) - sf, ok := frame.(*http2.SettingsFrame) - if !ok { - t.notifyError(err) - return - } - t.handleSettings(sf) - - // loop to keep reading incoming messages on this transport. - for { - frame, err := t.framer.readFrame() - atomic.CompareAndSwapUint32(&t.activity, 0, 1) - if err != nil { - // Abort an active stream if the http2.Framer returns a - // http2.StreamError. This can happen only if the server's response - // is malformed http2. - if se, ok := err.(http2.StreamError); ok { - t.mu.Lock() - s := t.activeStreams[se.StreamID] - t.mu.Unlock() - if s != nil { - // use error detail to provide better err message - handleMalformedHTTP2(s, streamErrorf(http2ErrConvTab[se.Code], "%v", t.framer.errorDetail())) - } - continue - } else { - // Transport error. - t.notifyError(err) - return - } - } - switch frame := frame.(type) { - case *http2.MetaHeadersFrame: - t.operateHeaders(frame) - case *http2.DataFrame: - t.handleData(frame) - case *http2.RSTStreamFrame: - t.handleRSTStream(frame) - case *http2.SettingsFrame: - t.handleSettings(frame) - case *http2.PingFrame: - t.handlePing(frame) - case *http2.GoAwayFrame: - t.handleGoAway(frame) - case *http2.WindowUpdateFrame: - t.handleWindowUpdate(frame) - default: - grpclog.Printf("transport: http2Client.reader got unhandled frame type %v.", frame) - } - } -} - -func (t *http2Client) applySettings(ss []http2.Setting) { - for _, s := range ss { - switch s.ID { - case http2.SettingMaxConcurrentStreams: - // TODO(zhaoq): This is a hack to avoid significant refactoring of the - // code to deal with the unrealistic int32 overflow. Probably will try - // to find a better way to handle this later. - if s.Val > math.MaxInt32 { - s.Val = math.MaxInt32 - } - t.mu.Lock() - ms := t.maxStreams - t.maxStreams = int(s.Val) - t.mu.Unlock() - t.streamsQuota.add(int(s.Val) - ms) - case http2.SettingInitialWindowSize: - t.mu.Lock() - for _, stream := range t.activeStreams { - // Adjust the sending quota for each stream. - stream.sendQuotaPool.add(int(s.Val - t.streamSendQuota)) - } - t.streamSendQuota = s.Val - t.mu.Unlock() - } - } -} - -// controller running in a separate goroutine takes charge of sending control -// frames (e.g., window update, reset stream, setting, etc.) to the server. -func (t *http2Client) controller() { - for { - select { - case i := <-t.controlBuf.get(): - t.controlBuf.load() - select { - case <-t.writableChan: - switch i := i.(type) { - case *windowUpdate: - t.framer.writeWindowUpdate(true, i.streamID, i.increment) - case *settings: - if i.ack { - t.framer.writeSettingsAck(true) - t.applySettings(i.ss) - } else { - t.framer.writeSettings(true, i.ss...) - } - case *resetStream: - // If the server needs to be to intimated about stream closing, - // then we need to make sure the RST_STREAM frame is written to - // the wire before the headers of the next stream waiting on - // streamQuota. We ensure this by adding to the streamsQuota pool - // only after having acquired the writableChan to send RST_STREAM. - t.streamsQuota.add(1) - t.framer.writeRSTStream(true, i.streamID, i.code) - case *flushIO: - t.framer.flushWrite() - case *ping: - t.framer.writePing(true, i.ack, i.data) - default: - grpclog.Printf("transport: http2Client.controller got unexpected item type %v\n", i) - } - t.writableChan <- 0 - continue - case <-t.shutdownChan: - return - } - case <-t.shutdownChan: - return - } - } -} - -// keepalive running in a separate goroutune makes sure the connection is alive by sending pings. -func (t *http2Client) keepalive() { - p := &ping{data: [8]byte{}} - timer := time.NewTimer(t.kp.Time) - for { - select { - case <-timer.C: - if atomic.CompareAndSwapUint32(&t.activity, 1, 0) { - timer.Reset(t.kp.Time) - continue - } - // Check if keepalive should go dormant. - t.mu.Lock() - if len(t.activeStreams) < 1 && !t.kp.PermitWithoutStream { - // Make awakenKeepalive writable. - <-t.awakenKeepalive - t.mu.Unlock() - select { - case <-t.awakenKeepalive: - // If the control gets here a ping has been sent - // need to reset the timer with keepalive.Timeout. - case <-t.shutdownChan: - return - } - } else { - t.mu.Unlock() - // Send ping. - t.controlBuf.put(p) - } - - // By the time control gets here a ping has been sent one way or the other. - timer.Reset(t.kp.Timeout) - select { - case <-timer.C: - if atomic.CompareAndSwapUint32(&t.activity, 1, 0) { - timer.Reset(t.kp.Time) - continue - } - t.Close() - return - case <-t.shutdownChan: - if !timer.Stop() { - <-timer.C - } - return - } - case <-t.shutdownChan: - if !timer.Stop() { - <-timer.C - } - return - } - } -} - -func (t *http2Client) Error() <-chan struct{} { - return t.errorChan -} - -func (t *http2Client) GoAway() <-chan struct{} { - return t.goAway -} - -func (t *http2Client) notifyError(err error) { - t.mu.Lock() - // make sure t.errorChan is closed only once. - if t.state == draining { - t.mu.Unlock() - t.Close() - return - } - if t.state == reachable { - t.state = unreachable - close(t.errorChan) - grpclog.Printf("transport: http2Client.notifyError got notified that the client transport was broken %v.", err) - } - t.mu.Unlock() -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http2_server.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http2_server.go deleted file mode 100644 index f5c590f438f..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http2_server.go +++ /dev/null @@ -1,847 +0,0 @@ -/* - * - * Copyright 2014, Google Inc. - * 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. - * - */ - -package transport - -import ( - "bytes" - "errors" - "io" - "math" - "net" - "strconv" - "sync" - - "golang.org/x/net/context" - "golang.org/x/net/http2" - "golang.org/x/net/http2/hpack" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/peer" - "google.golang.org/grpc/stats" - "google.golang.org/grpc/tap" -) - -// ErrIllegalHeaderWrite indicates that setting header is illegal because of -// the stream's state. -var ErrIllegalHeaderWrite = errors.New("transport: the stream is done or WriteHeader was already called") - -// http2Server implements the ServerTransport interface with HTTP2. -type http2Server struct { - ctx context.Context - conn net.Conn - remoteAddr net.Addr - localAddr net.Addr - maxStreamID uint32 // max stream ID ever seen - authInfo credentials.AuthInfo // auth info about the connection - inTapHandle tap.ServerInHandle - // writableChan synchronizes write access to the transport. - // A writer acquires the write lock by receiving a value on writableChan - // and releases it by sending on writableChan. - writableChan chan int - // shutdownChan is closed when Close is called. - // Blocking operations should select on shutdownChan to avoid - // blocking forever after Close. - shutdownChan chan struct{} - framer *framer - hBuf *bytes.Buffer // the buffer for HPACK encoding - hEnc *hpack.Encoder // HPACK encoder - - // The max number of concurrent streams. - maxStreams uint32 - // controlBuf delivers all the control related tasks (e.g., window - // updates, reset streams, and various settings) to the controller. - controlBuf *recvBuffer - fc *inFlow - // sendQuotaPool provides flow control to outbound message. - sendQuotaPool *quotaPool - - stats stats.Handler - - mu sync.Mutex // guard the following - state transportState - activeStreams map[uint32]*Stream - // the per-stream outbound flow control window size set by the peer. - streamSendQuota uint32 -} - -// newHTTP2Server constructs a ServerTransport based on HTTP2. ConnectionError is -// returned if something goes wrong. -func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err error) { - framer := newFramer(conn) - // Send initial settings as connection preface to client. - var settings []http2.Setting - // TODO(zhaoq): Have a better way to signal "no limit" because 0 is - // permitted in the HTTP2 spec. - maxStreams := config.MaxStreams - if maxStreams == 0 { - maxStreams = math.MaxUint32 - } else { - settings = append(settings, http2.Setting{ - ID: http2.SettingMaxConcurrentStreams, - Val: maxStreams, - }) - } - if initialWindowSize != defaultWindowSize { - settings = append(settings, http2.Setting{ - ID: http2.SettingInitialWindowSize, - Val: uint32(initialWindowSize)}) - } - if err := framer.writeSettings(true, settings...); err != nil { - return nil, connectionErrorf(true, err, "transport: %v", err) - } - // Adjust the connection flow control window if needed. - if delta := uint32(initialConnWindowSize - defaultWindowSize); delta > 0 { - if err := framer.writeWindowUpdate(true, 0, delta); err != nil { - return nil, connectionErrorf(true, err, "transport: %v", err) - } - } - var buf bytes.Buffer - t := &http2Server{ - ctx: context.Background(), - conn: conn, - remoteAddr: conn.RemoteAddr(), - localAddr: conn.LocalAddr(), - authInfo: config.AuthInfo, - framer: framer, - hBuf: &buf, - hEnc: hpack.NewEncoder(&buf), - maxStreams: maxStreams, - inTapHandle: config.InTapHandle, - controlBuf: newRecvBuffer(), - fc: &inFlow{limit: initialConnWindowSize}, - sendQuotaPool: newQuotaPool(defaultWindowSize), - state: reachable, - writableChan: make(chan int, 1), - shutdownChan: make(chan struct{}), - activeStreams: make(map[uint32]*Stream), - streamSendQuota: defaultWindowSize, - stats: config.StatsHandler, - } - if t.stats != nil { - t.ctx = t.stats.TagConn(t.ctx, &stats.ConnTagInfo{ - RemoteAddr: t.remoteAddr, - LocalAddr: t.localAddr, - }) - connBegin := &stats.ConnBegin{} - t.stats.HandleConn(t.ctx, connBegin) - } - go t.controller() - t.writableChan <- 0 - return t, nil -} - -// operateHeader takes action on the decoded headers. -func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(*Stream), traceCtx func(context.Context, string) context.Context) (close bool) { - buf := newRecvBuffer() - s := &Stream{ - id: frame.Header().StreamID, - st: t, - buf: buf, - fc: &inFlow{limit: initialWindowSize}, - } - - var state decodeState - for _, hf := range frame.Fields { - state.processHeaderField(hf) - } - if err := state.err; err != nil { - if se, ok := err.(StreamError); ok { - t.controlBuf.put(&resetStream{s.id, statusCodeConvTab[se.Code]}) - } - return - } - - if frame.StreamEnded() { - // s is just created by the caller. No lock needed. - s.state = streamReadDone - } - s.recvCompress = state.encoding - if state.timeoutSet { - s.ctx, s.cancel = context.WithTimeout(t.ctx, state.timeout) - } else { - s.ctx, s.cancel = context.WithCancel(t.ctx) - } - pr := &peer.Peer{ - Addr: t.remoteAddr, - } - // Attach Auth info if there is any. - if t.authInfo != nil { - pr.AuthInfo = t.authInfo - } - s.ctx = peer.NewContext(s.ctx, pr) - // Cache the current stream to the context so that the server application - // can find out. Required when the server wants to send some metadata - // back to the client (unary call only). - s.ctx = newContextWithStream(s.ctx, s) - // Attach the received metadata to the context. - if len(state.mdata) > 0 { - s.ctx = metadata.NewContext(s.ctx, state.mdata) - } - - s.dec = &recvBufferReader{ - ctx: s.ctx, - recv: s.buf, - } - s.recvCompress = state.encoding - s.method = state.method - if t.inTapHandle != nil { - var err error - info := &tap.Info{ - FullMethodName: state.method, - } - s.ctx, err = t.inTapHandle(s.ctx, info) - if err != nil { - // TODO: Log the real error. - t.controlBuf.put(&resetStream{s.id, http2.ErrCodeRefusedStream}) - return - } - } - t.mu.Lock() - if t.state != reachable { - t.mu.Unlock() - return - } - if uint32(len(t.activeStreams)) >= t.maxStreams { - t.mu.Unlock() - t.controlBuf.put(&resetStream{s.id, http2.ErrCodeRefusedStream}) - return - } - if s.id%2 != 1 || s.id <= t.maxStreamID { - t.mu.Unlock() - // illegal gRPC stream id. - grpclog.Println("transport: http2Server.HandleStreams received an illegal stream id: ", s.id) - return true - } - t.maxStreamID = s.id - s.sendQuotaPool = newQuotaPool(int(t.streamSendQuota)) - t.activeStreams[s.id] = s - t.mu.Unlock() - s.windowHandler = func(n int) { - t.updateWindow(s, uint32(n)) - } - s.ctx = traceCtx(s.ctx, s.method) - if t.stats != nil { - s.ctx = t.stats.TagRPC(s.ctx, &stats.RPCTagInfo{FullMethodName: s.method}) - inHeader := &stats.InHeader{ - FullMethod: s.method, - RemoteAddr: t.remoteAddr, - LocalAddr: t.localAddr, - Compression: s.recvCompress, - WireLength: int(frame.Header().Length), - } - t.stats.HandleRPC(s.ctx, inHeader) - } - handle(s) - return -} - -// HandleStreams receives incoming streams using the given handler. This is -// typically run in a separate goroutine. -// traceCtx attaches trace to ctx and returns the new context. -func (t *http2Server) HandleStreams(handle func(*Stream), traceCtx func(context.Context, string) context.Context) { - // Check the validity of client preface. - preface := make([]byte, len(clientPreface)) - if _, err := io.ReadFull(t.conn, preface); err != nil { - grpclog.Printf("transport: http2Server.HandleStreams failed to receive the preface from client: %v", err) - t.Close() - return - } - if !bytes.Equal(preface, clientPreface) { - grpclog.Printf("transport: http2Server.HandleStreams received bogus greeting from client: %q", preface) - t.Close() - return - } - - frame, err := t.framer.readFrame() - if err == io.EOF || err == io.ErrUnexpectedEOF { - t.Close() - return - } - if err != nil { - grpclog.Printf("transport: http2Server.HandleStreams failed to read frame: %v", err) - t.Close() - return - } - sf, ok := frame.(*http2.SettingsFrame) - if !ok { - grpclog.Printf("transport: http2Server.HandleStreams saw invalid preface type %T from client", frame) - t.Close() - return - } - t.handleSettings(sf) - - for { - frame, err := t.framer.readFrame() - if err != nil { - if se, ok := err.(http2.StreamError); ok { - t.mu.Lock() - s := t.activeStreams[se.StreamID] - t.mu.Unlock() - if s != nil { - t.closeStream(s) - } - t.controlBuf.put(&resetStream{se.StreamID, se.Code}) - continue - } - if err == io.EOF || err == io.ErrUnexpectedEOF { - t.Close() - return - } - grpclog.Printf("transport: http2Server.HandleStreams failed to read frame: %v", err) - t.Close() - return - } - switch frame := frame.(type) { - case *http2.MetaHeadersFrame: - if t.operateHeaders(frame, handle, traceCtx) { - t.Close() - break - } - case *http2.DataFrame: - t.handleData(frame) - case *http2.RSTStreamFrame: - t.handleRSTStream(frame) - case *http2.SettingsFrame: - t.handleSettings(frame) - case *http2.PingFrame: - t.handlePing(frame) - case *http2.WindowUpdateFrame: - t.handleWindowUpdate(frame) - case *http2.GoAwayFrame: - // TODO: Handle GoAway from the client appropriately. - default: - grpclog.Printf("transport: http2Server.HandleStreams found unhandled frame type %v.", frame) - } - } -} - -func (t *http2Server) getStream(f http2.Frame) (*Stream, bool) { - t.mu.Lock() - defer t.mu.Unlock() - if t.activeStreams == nil { - // The transport is closing. - return nil, false - } - s, ok := t.activeStreams[f.Header().StreamID] - if !ok { - // The stream is already done. - return nil, false - } - return s, true -} - -// updateWindow adjusts the inbound quota for the stream and the transport. -// Window updates will deliver to the controller for sending when -// the cumulative quota exceeds the corresponding threshold. -func (t *http2Server) updateWindow(s *Stream, n uint32) { - s.mu.Lock() - defer s.mu.Unlock() - if s.state == streamDone { - return - } - if w := t.fc.onRead(n); w > 0 { - t.controlBuf.put(&windowUpdate{0, w}) - } - if w := s.fc.onRead(n); w > 0 { - t.controlBuf.put(&windowUpdate{s.id, w}) - } -} - -func (t *http2Server) handleData(f *http2.DataFrame) { - size := f.Header().Length - if err := t.fc.onData(uint32(size)); err != nil { - grpclog.Printf("transport: http2Server %v", err) - t.Close() - return - } - // Select the right stream to dispatch. - s, ok := t.getStream(f) - if !ok { - if w := t.fc.onRead(uint32(size)); w > 0 { - t.controlBuf.put(&windowUpdate{0, w}) - } - return - } - if size > 0 { - if f.Header().Flags.Has(http2.FlagDataPadded) { - if w := t.fc.onRead(uint32(size) - uint32(len(f.Data()))); w > 0 { - t.controlBuf.put(&windowUpdate{0, w}) - } - } - s.mu.Lock() - if s.state == streamDone { - s.mu.Unlock() - // The stream has been closed. Release the corresponding quota. - if w := t.fc.onRead(uint32(size)); w > 0 { - t.controlBuf.put(&windowUpdate{0, w}) - } - return - } - if err := s.fc.onData(uint32(size)); err != nil { - s.mu.Unlock() - t.closeStream(s) - t.controlBuf.put(&resetStream{s.id, http2.ErrCodeFlowControl}) - return - } - if f.Header().Flags.Has(http2.FlagDataPadded) { - if w := s.fc.onRead(uint32(size) - uint32(len(f.Data()))); w > 0 { - t.controlBuf.put(&windowUpdate{s.id, w}) - } - } - s.mu.Unlock() - // TODO(bradfitz, zhaoq): A copy is required here because there is no - // guarantee f.Data() is consumed before the arrival of next frame. - // Can this copy be eliminated? - if len(f.Data()) > 0 { - data := make([]byte, len(f.Data())) - copy(data, f.Data()) - s.write(recvMsg{data: data}) - } - } - if f.Header().Flags.Has(http2.FlagDataEndStream) { - // Received the end of stream from the client. - s.mu.Lock() - if s.state != streamDone { - s.state = streamReadDone - } - s.mu.Unlock() - s.write(recvMsg{err: io.EOF}) - } -} - -func (t *http2Server) handleRSTStream(f *http2.RSTStreamFrame) { - s, ok := t.getStream(f) - if !ok { - return - } - t.closeStream(s) -} - -func (t *http2Server) handleSettings(f *http2.SettingsFrame) { - if f.IsAck() { - return - } - var ss []http2.Setting - f.ForeachSetting(func(s http2.Setting) error { - ss = append(ss, s) - return nil - }) - // The settings will be applied once the ack is sent. - t.controlBuf.put(&settings{ack: true, ss: ss}) -} - -func (t *http2Server) handlePing(f *http2.PingFrame) { - if f.IsAck() { // Do nothing. - return - } - pingAck := &ping{ack: true} - copy(pingAck.data[:], f.Data[:]) - t.controlBuf.put(pingAck) -} - -func (t *http2Server) handleWindowUpdate(f *http2.WindowUpdateFrame) { - id := f.Header().StreamID - incr := f.Increment - if id == 0 { - t.sendQuotaPool.add(int(incr)) - return - } - if s, ok := t.getStream(f); ok { - s.sendQuotaPool.add(int(incr)) - } -} - -func (t *http2Server) writeHeaders(s *Stream, b *bytes.Buffer, endStream bool) error { - first := true - endHeaders := false - var err error - // Sends the headers in a single batch. - for !endHeaders { - size := t.hBuf.Len() - if size > http2MaxFrameLen { - size = http2MaxFrameLen - } else { - endHeaders = true - } - if first { - p := http2.HeadersFrameParam{ - StreamID: s.id, - BlockFragment: b.Next(size), - EndStream: endStream, - EndHeaders: endHeaders, - } - err = t.framer.writeHeaders(endHeaders, p) - first = false - } else { - err = t.framer.writeContinuation(endHeaders, s.id, endHeaders, b.Next(size)) - } - if err != nil { - t.Close() - return connectionErrorf(true, err, "transport: %v", err) - } - } - return nil -} - -// WriteHeader sends the header metedata md back to the client. -func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error { - s.mu.Lock() - if s.headerOk || s.state == streamDone { - s.mu.Unlock() - return ErrIllegalHeaderWrite - } - s.headerOk = true - if md.Len() > 0 { - if s.header.Len() > 0 { - s.header = metadata.Join(s.header, md) - } else { - s.header = md - } - } - md = s.header - s.mu.Unlock() - if _, err := wait(s.ctx, nil, nil, t.shutdownChan, t.writableChan); err != nil { - return err - } - t.hBuf.Reset() - t.hEnc.WriteField(hpack.HeaderField{Name: ":status", Value: "200"}) - t.hEnc.WriteField(hpack.HeaderField{Name: "content-type", Value: "application/grpc"}) - if s.sendCompress != "" { - t.hEnc.WriteField(hpack.HeaderField{Name: "grpc-encoding", Value: s.sendCompress}) - } - for k, v := range md { - if isReservedHeader(k) { - // Clients don't tolerate reading restricted headers after some non restricted ones were sent. - continue - } - for _, entry := range v { - t.hEnc.WriteField(hpack.HeaderField{Name: k, Value: entry}) - } - } - bufLen := t.hBuf.Len() - if err := t.writeHeaders(s, t.hBuf, false); err != nil { - return err - } - if t.stats != nil { - outHeader := &stats.OutHeader{ - WireLength: bufLen, - } - t.stats.HandleRPC(s.Context(), outHeader) - } - t.writableChan <- 0 - return nil -} - -// WriteStatus sends stream status to the client and terminates the stream. -// There is no further I/O operations being able to perform on this stream. -// TODO(zhaoq): Now it indicates the end of entire stream. Revisit if early -// OK is adopted. -func (t *http2Server) WriteStatus(s *Stream, statusCode codes.Code, statusDesc string) error { - var headersSent, hasHeader bool - s.mu.Lock() - if s.state == streamDone { - s.mu.Unlock() - return nil - } - if s.headerOk { - headersSent = true - } - if s.header.Len() > 0 { - hasHeader = true - } - s.mu.Unlock() - - if !headersSent && hasHeader { - t.WriteHeader(s, nil) - headersSent = true - } - - if _, err := wait(s.ctx, nil, nil, t.shutdownChan, t.writableChan); err != nil { - return err - } - t.hBuf.Reset() - if !headersSent { - t.hEnc.WriteField(hpack.HeaderField{Name: ":status", Value: "200"}) - t.hEnc.WriteField(hpack.HeaderField{Name: "content-type", Value: "application/grpc"}) - } - t.hEnc.WriteField( - hpack.HeaderField{ - Name: "grpc-status", - Value: strconv.Itoa(int(statusCode)), - }) - t.hEnc.WriteField(hpack.HeaderField{Name: "grpc-message", Value: encodeGrpcMessage(statusDesc)}) - // Attach the trailer metadata. - for k, v := range s.trailer { - // Clients don't tolerate reading restricted headers after some non restricted ones were sent. - if isReservedHeader(k) { - continue - } - for _, entry := range v { - t.hEnc.WriteField(hpack.HeaderField{Name: k, Value: entry}) - } - } - bufLen := t.hBuf.Len() - if err := t.writeHeaders(s, t.hBuf, true); err != nil { - t.Close() - return err - } - if t.stats != nil { - outTrailer := &stats.OutTrailer{ - WireLength: bufLen, - } - t.stats.HandleRPC(s.Context(), outTrailer) - } - t.closeStream(s) - t.writableChan <- 0 - return nil -} - -// Write converts the data into HTTP2 data frame and sends it out. Non-nil error -// is returns if it fails (e.g., framing error, transport error). -func (t *http2Server) Write(s *Stream, data []byte, opts *Options) error { - // TODO(zhaoq): Support multi-writers for a single stream. - var writeHeaderFrame bool - s.mu.Lock() - if s.state == streamDone { - s.mu.Unlock() - return streamErrorf(codes.Unknown, "the stream has been done") - } - if !s.headerOk { - writeHeaderFrame = true - } - s.mu.Unlock() - if writeHeaderFrame { - t.WriteHeader(s, nil) - } - r := bytes.NewBuffer(data) - for { - if r.Len() == 0 { - return nil - } - size := http2MaxFrameLen - // Wait until the stream has some quota to send the data. - sq, err := wait(s.ctx, nil, nil, t.shutdownChan, s.sendQuotaPool.acquire()) - if err != nil { - return err - } - // Wait until the transport has some quota to send the data. - tq, err := wait(s.ctx, nil, nil, t.shutdownChan, t.sendQuotaPool.acquire()) - if err != nil { - return err - } - if sq < size { - size = sq - } - if tq < size { - size = tq - } - p := r.Next(size) - ps := len(p) - if ps < sq { - // Overbooked stream quota. Return it back. - s.sendQuotaPool.add(sq - ps) - } - if ps < tq { - // Overbooked transport quota. Return it back. - t.sendQuotaPool.add(tq - ps) - } - t.framer.adjustNumWriters(1) - // Got some quota. Try to acquire writing privilege on the - // transport. - if _, err := wait(s.ctx, nil, nil, t.shutdownChan, t.writableChan); err != nil { - if _, ok := err.(StreamError); ok { - // Return the connection quota back. - t.sendQuotaPool.add(ps) - } - if t.framer.adjustNumWriters(-1) == 0 { - // This writer is the last one in this batch and has the - // responsibility to flush the buffered frames. It queues - // a flush request to controlBuf instead of flushing directly - // in order to avoid the race with other writing or flushing. - t.controlBuf.put(&flushIO{}) - } - return err - } - select { - case <-s.ctx.Done(): - t.sendQuotaPool.add(ps) - if t.framer.adjustNumWriters(-1) == 0 { - t.controlBuf.put(&flushIO{}) - } - t.writableChan <- 0 - return ContextErr(s.ctx.Err()) - default: - } - var forceFlush bool - if r.Len() == 0 && t.framer.adjustNumWriters(0) == 1 && !opts.Last { - forceFlush = true - } - if err := t.framer.writeData(forceFlush, s.id, false, p); err != nil { - t.Close() - return connectionErrorf(true, err, "transport: %v", err) - } - if t.framer.adjustNumWriters(-1) == 0 { - t.framer.flushWrite() - } - t.writableChan <- 0 - } - -} - -func (t *http2Server) applySettings(ss []http2.Setting) { - for _, s := range ss { - if s.ID == http2.SettingInitialWindowSize { - t.mu.Lock() - defer t.mu.Unlock() - for _, stream := range t.activeStreams { - stream.sendQuotaPool.add(int(s.Val - t.streamSendQuota)) - } - t.streamSendQuota = s.Val - } - - } -} - -// controller running in a separate goroutine takes charge of sending control -// frames (e.g., window update, reset stream, setting, etc.) to the server. -func (t *http2Server) controller() { - for { - select { - case i := <-t.controlBuf.get(): - t.controlBuf.load() - select { - case <-t.writableChan: - switch i := i.(type) { - case *windowUpdate: - t.framer.writeWindowUpdate(true, i.streamID, i.increment) - case *settings: - if i.ack { - t.framer.writeSettingsAck(true) - t.applySettings(i.ss) - } else { - t.framer.writeSettings(true, i.ss...) - } - case *resetStream: - t.framer.writeRSTStream(true, i.streamID, i.code) - case *goAway: - t.mu.Lock() - if t.state == closing { - t.mu.Unlock() - // The transport is closing. - return - } - sid := t.maxStreamID - t.state = draining - t.mu.Unlock() - t.framer.writeGoAway(true, sid, http2.ErrCodeNo, nil) - case *flushIO: - t.framer.flushWrite() - case *ping: - t.framer.writePing(true, i.ack, i.data) - default: - grpclog.Printf("transport: http2Server.controller got unexpected item type %v\n", i) - } - t.writableChan <- 0 - continue - case <-t.shutdownChan: - return - } - case <-t.shutdownChan: - return - } - } -} - -// Close starts shutting down the http2Server transport. -// TODO(zhaoq): Now the destruction is not blocked on any pending streams. This -// could cause some resource issue. Revisit this later. -func (t *http2Server) Close() (err error) { - t.mu.Lock() - if t.state == closing { - t.mu.Unlock() - return errors.New("transport: Close() was already called") - } - t.state = closing - streams := t.activeStreams - t.activeStreams = nil - t.mu.Unlock() - close(t.shutdownChan) - err = t.conn.Close() - // Cancel all active streams. - for _, s := range streams { - s.cancel() - } - if t.stats != nil { - connEnd := &stats.ConnEnd{} - t.stats.HandleConn(t.ctx, connEnd) - } - return -} - -// closeStream clears the footprint of a stream when the stream is not needed -// any more. -func (t *http2Server) closeStream(s *Stream) { - t.mu.Lock() - delete(t.activeStreams, s.id) - if t.state == draining && len(t.activeStreams) == 0 { - defer t.Close() - } - t.mu.Unlock() - // In case stream sending and receiving are invoked in separate - // goroutines (e.g., bi-directional streaming), cancel needs to be - // called to interrupt the potential blocking on other goroutines. - s.cancel() - s.mu.Lock() - if q := s.fc.resetPendingData(); q > 0 { - if w := t.fc.onRead(q); w > 0 { - t.controlBuf.put(&windowUpdate{0, w}) - } - } - if s.state == streamDone { - s.mu.Unlock() - return - } - s.state = streamDone - s.mu.Unlock() -} - -func (t *http2Server) RemoteAddr() net.Addr { - return t.remoteAddr -} - -func (t *http2Server) Drain() { - t.controlBuf.put(&goAway{}) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http_util.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http_util.go deleted file mode 100644 index 6ce43c332e6..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/http_util.go +++ /dev/null @@ -1,511 +0,0 @@ -/* - * - * Copyright 2014, Google Inc. - * 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. - * - */ - -package transport - -import ( - "bufio" - "bytes" - "fmt" - "io" - "net" - "strconv" - "strings" - "sync/atomic" - "time" - - "golang.org/x/net/http2" - "golang.org/x/net/http2/hpack" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" -) - -const ( - // http2MaxFrameLen specifies the max length of a HTTP2 frame. - http2MaxFrameLen = 16384 // 16KB frame - // http://http2.github.io/http2-spec/#SettingValues - http2InitHeaderTableSize = 4096 - // http2IOBufSize specifies the buffer size for sending frames. - http2IOBufSize = 32 * 1024 -) - -var ( - clientPreface = []byte(http2.ClientPreface) - http2ErrConvTab = map[http2.ErrCode]codes.Code{ - http2.ErrCodeNo: codes.Internal, - http2.ErrCodeProtocol: codes.Internal, - http2.ErrCodeInternal: codes.Internal, - http2.ErrCodeFlowControl: codes.ResourceExhausted, - http2.ErrCodeSettingsTimeout: codes.Internal, - http2.ErrCodeStreamClosed: codes.Internal, - http2.ErrCodeFrameSize: codes.Internal, - http2.ErrCodeRefusedStream: codes.Unavailable, - http2.ErrCodeCancel: codes.Canceled, - http2.ErrCodeCompression: codes.Internal, - http2.ErrCodeConnect: codes.Internal, - http2.ErrCodeEnhanceYourCalm: codes.ResourceExhausted, - http2.ErrCodeInadequateSecurity: codes.PermissionDenied, - http2.ErrCodeHTTP11Required: codes.FailedPrecondition, - } - statusCodeConvTab = map[codes.Code]http2.ErrCode{ - codes.Internal: http2.ErrCodeInternal, - codes.Canceled: http2.ErrCodeCancel, - codes.Unavailable: http2.ErrCodeRefusedStream, - codes.ResourceExhausted: http2.ErrCodeEnhanceYourCalm, - codes.PermissionDenied: http2.ErrCodeInadequateSecurity, - } -) - -// Records the states during HPACK decoding. Must be reset once the -// decoding of the entire headers are finished. -type decodeState struct { - err error // first error encountered decoding - - encoding string - // statusCode caches the stream status received from the trailer - // the server sent. Client side only. - statusCode codes.Code - statusDesc string - // Server side only fields. - timeoutSet bool - timeout time.Duration - method string - // key-value metadata map from the peer. - mdata map[string][]string -} - -// isReservedHeader checks whether hdr belongs to HTTP2 headers -// reserved by gRPC protocol. Any other headers are classified as the -// user-specified metadata. -func isReservedHeader(hdr string) bool { - if hdr != "" && hdr[0] == ':' { - return true - } - switch hdr { - case "content-type", - "grpc-message-type", - "grpc-encoding", - "grpc-message", - "grpc-status", - "grpc-timeout", - "te": - return true - default: - return false - } -} - -// isWhitelistedPseudoHeader checks whether hdr belongs to HTTP2 pseudoheaders -// that should be propagated into metadata visible to users. -func isWhitelistedPseudoHeader(hdr string) bool { - switch hdr { - case ":authority": - return true - default: - return false - } -} - -func (d *decodeState) setErr(err error) { - if d.err == nil { - d.err = err - } -} - -func validContentType(t string) bool { - e := "application/grpc" - if !strings.HasPrefix(t, e) { - return false - } - // Support variations on the content-type - // (e.g. "application/grpc+blah", "application/grpc;blah"). - if len(t) > len(e) && t[len(e)] != '+' && t[len(e)] != ';' { - return false - } - return true -} - -func (d *decodeState) processHeaderField(f hpack.HeaderField) { - switch f.Name { - case "content-type": - if !validContentType(f.Value) { - d.setErr(streamErrorf(codes.FailedPrecondition, "transport: received the unexpected content-type %q", f.Value)) - return - } - case "grpc-encoding": - d.encoding = f.Value - case "grpc-status": - code, err := strconv.Atoi(f.Value) - if err != nil { - d.setErr(streamErrorf(codes.Internal, "transport: malformed grpc-status: %v", err)) - return - } - d.statusCode = codes.Code(code) - case "grpc-message": - d.statusDesc = decodeGrpcMessage(f.Value) - case "grpc-timeout": - d.timeoutSet = true - var err error - d.timeout, err = decodeTimeout(f.Value) - if err != nil { - d.setErr(streamErrorf(codes.Internal, "transport: malformed time-out: %v", err)) - return - } - case ":path": - d.method = f.Value - default: - if !isReservedHeader(f.Name) || isWhitelistedPseudoHeader(f.Name) { - if f.Name == "user-agent" { - i := strings.LastIndex(f.Value, " ") - if i == -1 { - // There is no application user agent string being set. - return - } - // Extract the application user agent string. - f.Value = f.Value[:i] - } - if d.mdata == nil { - d.mdata = make(map[string][]string) - } - k, v, err := metadata.DecodeKeyValue(f.Name, f.Value) - if err != nil { - grpclog.Printf("Failed to decode (%q, %q): %v", f.Name, f.Value, err) - return - } - d.mdata[k] = append(d.mdata[k], v) - } - } -} - -type timeoutUnit uint8 - -const ( - hour timeoutUnit = 'H' - minute timeoutUnit = 'M' - second timeoutUnit = 'S' - millisecond timeoutUnit = 'm' - microsecond timeoutUnit = 'u' - nanosecond timeoutUnit = 'n' -) - -func timeoutUnitToDuration(u timeoutUnit) (d time.Duration, ok bool) { - switch u { - case hour: - return time.Hour, true - case minute: - return time.Minute, true - case second: - return time.Second, true - case millisecond: - return time.Millisecond, true - case microsecond: - return time.Microsecond, true - case nanosecond: - return time.Nanosecond, true - default: - } - return -} - -const maxTimeoutValue int64 = 100000000 - 1 - -// div does integer division and round-up the result. Note that this is -// equivalent to (d+r-1)/r but has less chance to overflow. -func div(d, r time.Duration) int64 { - if m := d % r; m > 0 { - return int64(d/r + 1) - } - return int64(d / r) -} - -// TODO(zhaoq): It is the simplistic and not bandwidth efficient. Improve it. -func encodeTimeout(t time.Duration) string { - if t <= 0 { - return "0n" - } - if d := div(t, time.Nanosecond); d <= maxTimeoutValue { - return strconv.FormatInt(d, 10) + "n" - } - if d := div(t, time.Microsecond); d <= maxTimeoutValue { - return strconv.FormatInt(d, 10) + "u" - } - if d := div(t, time.Millisecond); d <= maxTimeoutValue { - return strconv.FormatInt(d, 10) + "m" - } - if d := div(t, time.Second); d <= maxTimeoutValue { - return strconv.FormatInt(d, 10) + "S" - } - if d := div(t, time.Minute); d <= maxTimeoutValue { - return strconv.FormatInt(d, 10) + "M" - } - // Note that maxTimeoutValue * time.Hour > MaxInt64. - return strconv.FormatInt(div(t, time.Hour), 10) + "H" -} - -func decodeTimeout(s string) (time.Duration, error) { - size := len(s) - if size < 2 { - return 0, fmt.Errorf("transport: timeout string is too short: %q", s) - } - unit := timeoutUnit(s[size-1]) - d, ok := timeoutUnitToDuration(unit) - if !ok { - return 0, fmt.Errorf("transport: timeout unit is not recognized: %q", s) - } - t, err := strconv.ParseInt(s[:size-1], 10, 64) - if err != nil { - return 0, err - } - return d * time.Duration(t), nil -} - -const ( - spaceByte = ' ' - tildaByte = '~' - percentByte = '%' -) - -// encodeGrpcMessage is used to encode status code in header field -// "grpc-message". -// It checks to see if each individual byte in msg is an -// allowable byte, and then either percent encoding or passing it through. -// When percent encoding, the byte is converted into hexadecimal notation -// with a '%' prepended. -func encodeGrpcMessage(msg string) string { - if msg == "" { - return "" - } - lenMsg := len(msg) - for i := 0; i < lenMsg; i++ { - c := msg[i] - if !(c >= spaceByte && c < tildaByte && c != percentByte) { - return encodeGrpcMessageUnchecked(msg) - } - } - return msg -} - -func encodeGrpcMessageUnchecked(msg string) string { - var buf bytes.Buffer - lenMsg := len(msg) - for i := 0; i < lenMsg; i++ { - c := msg[i] - if c >= spaceByte && c < tildaByte && c != percentByte { - buf.WriteByte(c) - } else { - buf.WriteString(fmt.Sprintf("%%%02X", c)) - } - } - return buf.String() -} - -// decodeGrpcMessage decodes the msg encoded by encodeGrpcMessage. -func decodeGrpcMessage(msg string) string { - if msg == "" { - return "" - } - lenMsg := len(msg) - for i := 0; i < lenMsg; i++ { - if msg[i] == percentByte && i+2 < lenMsg { - return decodeGrpcMessageUnchecked(msg) - } - } - return msg -} - -func decodeGrpcMessageUnchecked(msg string) string { - var buf bytes.Buffer - lenMsg := len(msg) - for i := 0; i < lenMsg; i++ { - c := msg[i] - if c == percentByte && i+2 < lenMsg { - parsed, err := strconv.ParseUint(msg[i+1:i+3], 16, 8) - if err != nil { - buf.WriteByte(c) - } else { - buf.WriteByte(byte(parsed)) - i += 2 - } - } else { - buf.WriteByte(c) - } - } - return buf.String() -} - -type framer struct { - numWriters int32 - reader io.Reader - writer *bufio.Writer - fr *http2.Framer -} - -func newFramer(conn net.Conn) *framer { - f := &framer{ - reader: bufio.NewReaderSize(conn, http2IOBufSize), - writer: bufio.NewWriterSize(conn, http2IOBufSize), - } - f.fr = http2.NewFramer(f.writer, f.reader) - f.fr.ReadMetaHeaders = hpack.NewDecoder(http2InitHeaderTableSize, nil) - return f -} - -func (f *framer) adjustNumWriters(i int32) int32 { - return atomic.AddInt32(&f.numWriters, i) -} - -// The following writeXXX functions can only be called when the caller gets -// unblocked from writableChan channel (i.e., owns the privilege to write). - -func (f *framer) writeContinuation(forceFlush bool, streamID uint32, endHeaders bool, headerBlockFragment []byte) error { - if err := f.fr.WriteContinuation(streamID, endHeaders, headerBlockFragment); err != nil { - return err - } - if forceFlush { - return f.writer.Flush() - } - return nil -} - -func (f *framer) writeData(forceFlush bool, streamID uint32, endStream bool, data []byte) error { - if err := f.fr.WriteData(streamID, endStream, data); err != nil { - return err - } - if forceFlush { - return f.writer.Flush() - } - return nil -} - -func (f *framer) writeGoAway(forceFlush bool, maxStreamID uint32, code http2.ErrCode, debugData []byte) error { - if err := f.fr.WriteGoAway(maxStreamID, code, debugData); err != nil { - return err - } - if forceFlush { - return f.writer.Flush() - } - return nil -} - -func (f *framer) writeHeaders(forceFlush bool, p http2.HeadersFrameParam) error { - if err := f.fr.WriteHeaders(p); err != nil { - return err - } - if forceFlush { - return f.writer.Flush() - } - return nil -} - -func (f *framer) writePing(forceFlush, ack bool, data [8]byte) error { - if err := f.fr.WritePing(ack, data); err != nil { - return err - } - if forceFlush { - return f.writer.Flush() - } - return nil -} - -func (f *framer) writePriority(forceFlush bool, streamID uint32, p http2.PriorityParam) error { - if err := f.fr.WritePriority(streamID, p); err != nil { - return err - } - if forceFlush { - return f.writer.Flush() - } - return nil -} - -func (f *framer) writePushPromise(forceFlush bool, p http2.PushPromiseParam) error { - if err := f.fr.WritePushPromise(p); err != nil { - return err - } - if forceFlush { - return f.writer.Flush() - } - return nil -} - -func (f *framer) writeRSTStream(forceFlush bool, streamID uint32, code http2.ErrCode) error { - if err := f.fr.WriteRSTStream(streamID, code); err != nil { - return err - } - if forceFlush { - return f.writer.Flush() - } - return nil -} - -func (f *framer) writeSettings(forceFlush bool, settings ...http2.Setting) error { - if err := f.fr.WriteSettings(settings...); err != nil { - return err - } - if forceFlush { - return f.writer.Flush() - } - return nil -} - -func (f *framer) writeSettingsAck(forceFlush bool) error { - if err := f.fr.WriteSettingsAck(); err != nil { - return err - } - if forceFlush { - return f.writer.Flush() - } - return nil -} - -func (f *framer) writeWindowUpdate(forceFlush bool, streamID, incr uint32) error { - if err := f.fr.WriteWindowUpdate(streamID, incr); err != nil { - return err - } - if forceFlush { - return f.writer.Flush() - } - return nil -} - -func (f *framer) flushWrite() error { - return f.writer.Flush() -} - -func (f *framer) readFrame() (http2.Frame, error) { - return f.fr.ReadFrame() -} - -func (f *framer) errorDetail() error { - return f.fr.ErrorDetail() -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/pre_go16.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/pre_go16.go deleted file mode 100644 index 33d91c17c4e..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/pre_go16.go +++ /dev/null @@ -1,51 +0,0 @@ -// +build !go1.6 - -/* - * Copyright 2016, Google Inc. - * 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. - * - */ - -package transport - -import ( - "net" - "time" - - "golang.org/x/net/context" -) - -// dialContext connects to the address on the named network. -func dialContext(ctx context.Context, network, address string) (net.Conn, error) { - var dialer net.Dialer - if deadline, ok := ctx.Deadline(); ok { - dialer.Timeout = deadline.Sub(time.Now()) - } - return dialer.Dial(network, address) -} diff --git a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/transport.go b/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/transport.go deleted file mode 100644 index 0fc4c146f90..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/_vendor/src/google.golang.org/grpc/transport/transport.go +++ /dev/null @@ -1,626 +0,0 @@ -/* - * - * Copyright 2014, Google Inc. - * 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. - * - */ - -/* -Package transport defines and implements message oriented communication channel -to complete various transactions (e.g., an RPC). -*/ -package transport // import "google.golang.org/grpc/transport" - -import ( - "bytes" - "fmt" - "io" - "net" - "sync" - - "golang.org/x/net/context" - "golang.org/x/net/http2" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/keepalive" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/stats" - "google.golang.org/grpc/tap" -) - -// recvMsg represents the received msg from the transport. All transport -// protocol specific info has been removed. -type recvMsg struct { - data []byte - // nil: received some data - // io.EOF: stream is completed. data is nil. - // other non-nil error: transport failure. data is nil. - err error -} - -func (*recvMsg) item() {} - -// All items in an out of a recvBuffer should be the same type. -type item interface { - item() -} - -// recvBuffer is an unbounded channel of item. -type recvBuffer struct { - c chan item - mu sync.Mutex - backlog []item -} - -func newRecvBuffer() *recvBuffer { - b := &recvBuffer{ - c: make(chan item, 1), - } - return b -} - -func (b *recvBuffer) put(r item) { - b.mu.Lock() - defer b.mu.Unlock() - if len(b.backlog) == 0 { - select { - case b.c <- r: - return - default: - } - } - b.backlog = append(b.backlog, r) -} - -func (b *recvBuffer) load() { - b.mu.Lock() - defer b.mu.Unlock() - if len(b.backlog) > 0 { - select { - case b.c <- b.backlog[0]: - b.backlog = b.backlog[1:] - default: - } - } -} - -// get returns the channel that receives an item in the buffer. -// -// Upon receipt of an item, the caller should call load to send another -// item onto the channel if there is any. -func (b *recvBuffer) get() <-chan item { - return b.c -} - -// recvBufferReader implements io.Reader interface to read the data from -// recvBuffer. -type recvBufferReader struct { - ctx context.Context - goAway chan struct{} - recv *recvBuffer - last *bytes.Reader // Stores the remaining data in the previous calls. - err error -} - -// Read reads the next len(p) bytes from last. If last is drained, it tries to -// read additional data from recv. It blocks if there no additional data available -// in recv. If Read returns any non-nil error, it will continue to return that error. -func (r *recvBufferReader) Read(p []byte) (n int, err error) { - if r.err != nil { - return 0, r.err - } - defer func() { r.err = err }() - if r.last != nil && r.last.Len() > 0 { - // Read remaining data left in last call. - return r.last.Read(p) - } - select { - case <-r.ctx.Done(): - return 0, ContextErr(r.ctx.Err()) - case <-r.goAway: - return 0, ErrStreamDrain - case i := <-r.recv.get(): - r.recv.load() - m := i.(*recvMsg) - if m.err != nil { - return 0, m.err - } - r.last = bytes.NewReader(m.data) - return r.last.Read(p) - } -} - -type streamState uint8 - -const ( - streamActive streamState = iota - streamWriteDone // EndStream sent - streamReadDone // EndStream received - streamDone // the entire stream is finished. -) - -// Stream represents an RPC in the transport layer. -type Stream struct { - id uint32 - // nil for client side Stream. - st ServerTransport - // clientStatsCtx keeps the user context for stats handling. - // It's only valid on client side. Server side stats context is same as s.ctx. - // All client side stats collection should use the clientStatsCtx (instead of the stream context) - // so that all the generated stats for a particular RPC can be associated in the processing phase. - clientStatsCtx context.Context - // ctx is the associated context of the stream. - ctx context.Context - // cancel is always nil for client side Stream. - cancel context.CancelFunc - // done is closed when the final status arrives. - done chan struct{} - // goAway is closed when the server sent GoAways signal before this stream was initiated. - goAway chan struct{} - // method records the associated RPC method of the stream. - method string - recvCompress string - sendCompress string - buf *recvBuffer - dec io.Reader - fc *inFlow - recvQuota uint32 - // The accumulated inbound quota pending for window update. - updateQuota uint32 - // The handler to control the window update procedure for both this - // particular stream and the associated transport. - windowHandler func(int) - - sendQuotaPool *quotaPool - // Close headerChan to indicate the end of reception of header metadata. - headerChan chan struct{} - // header caches the received header metadata. - header metadata.MD - // The key-value map of trailer metadata. - trailer metadata.MD - - mu sync.RWMutex // guard the following - // headerOK becomes true from the first header is about to send. - headerOk bool - state streamState - // true iff headerChan is closed. Used to avoid closing headerChan - // multiple times. - headerDone bool - // the status received from the server. - statusCode codes.Code - statusDesc string - // rstStream indicates whether a RST_STREAM frame needs to be sent - // to the server to signify that this stream is closing. - rstStream bool - // rstError is the error that needs to be sent along with the RST_STREAM frame. - rstError http2.ErrCode -} - -// RecvCompress returns the compression algorithm applied to the inbound -// message. It is empty string if there is no compression applied. -func (s *Stream) RecvCompress() string { - return s.recvCompress -} - -// SetSendCompress sets the compression algorithm to the stream. -func (s *Stream) SetSendCompress(str string) { - s.sendCompress = str -} - -// Done returns a chanel which is closed when it receives the final status -// from the server. -func (s *Stream) Done() <-chan struct{} { - return s.done -} - -// GoAway returns a channel which is closed when the server sent GoAways signal -// before this stream was initiated. -func (s *Stream) GoAway() <-chan struct{} { - return s.goAway -} - -// Header acquires the key-value pairs of header metadata once it -// is available. It blocks until i) the metadata is ready or ii) there is no -// header metadata or iii) the stream is cancelled/expired. -func (s *Stream) Header() (metadata.MD, error) { - select { - case <-s.ctx.Done(): - return nil, ContextErr(s.ctx.Err()) - case <-s.goAway: - return nil, ErrStreamDrain - case <-s.headerChan: - return s.header.Copy(), nil - } -} - -// Trailer returns the cached trailer metedata. Note that if it is not called -// after the entire stream is done, it could return an empty MD. Client -// side only. -func (s *Stream) Trailer() metadata.MD { - s.mu.RLock() - defer s.mu.RUnlock() - return s.trailer.Copy() -} - -// ServerTransport returns the underlying ServerTransport for the stream. -// The client side stream always returns nil. -func (s *Stream) ServerTransport() ServerTransport { - return s.st -} - -// Context returns the context of the stream. -func (s *Stream) Context() context.Context { - return s.ctx -} - -// Method returns the method for the stream. -func (s *Stream) Method() string { - return s.method -} - -// StatusCode returns statusCode received from the server. -func (s *Stream) StatusCode() codes.Code { - return s.statusCode -} - -// StatusDesc returns statusDesc received from the server. -func (s *Stream) StatusDesc() string { - return s.statusDesc -} - -// SetHeader sets the header metadata. This can be called multiple times. -// Server side only. -func (s *Stream) SetHeader(md metadata.MD) error { - s.mu.Lock() - defer s.mu.Unlock() - if s.headerOk || s.state == streamDone { - return ErrIllegalHeaderWrite - } - if md.Len() == 0 { - return nil - } - s.header = metadata.Join(s.header, md) - return nil -} - -// SetTrailer sets the trailer metadata which will be sent with the RPC status -// by the server. This can be called multiple times. Server side only. -func (s *Stream) SetTrailer(md metadata.MD) error { - if md.Len() == 0 { - return nil - } - s.mu.Lock() - defer s.mu.Unlock() - s.trailer = metadata.Join(s.trailer, md) - return nil -} - -func (s *Stream) write(m recvMsg) { - s.buf.put(&m) -} - -// Read reads all the data available for this Stream from the transport and -// passes them into the decoder, which converts them into a gRPC message stream. -// The error is io.EOF when the stream is done or another non-nil error if -// the stream broke. -func (s *Stream) Read(p []byte) (n int, err error) { - n, err = s.dec.Read(p) - if err != nil { - return - } - s.windowHandler(n) - return -} - -// GoString is implemented by Stream so context.String() won't -// race when printing %#v. -func (s *Stream) GoString() string { - return fmt.Sprintf("", s, s.method) -} - -// The key to save transport.Stream in the context. -type streamKey struct{} - -// newContextWithStream creates a new context from ctx and attaches stream -// to it. -func newContextWithStream(ctx context.Context, stream *Stream) context.Context { - return context.WithValue(ctx, streamKey{}, stream) -} - -// StreamFromContext returns the stream saved in ctx. -func StreamFromContext(ctx context.Context) (s *Stream, ok bool) { - s, ok = ctx.Value(streamKey{}).(*Stream) - return -} - -// state of transport -type transportState int - -const ( - reachable transportState = iota - unreachable - closing - draining -) - -// ServerConfig consists of all the configurations to establish a server transport. -type ServerConfig struct { - MaxStreams uint32 - AuthInfo credentials.AuthInfo - InTapHandle tap.ServerInHandle - StatsHandler stats.Handler -} - -// NewServerTransport creates a ServerTransport with conn or non-nil error -// if it fails. -func NewServerTransport(protocol string, conn net.Conn, config *ServerConfig) (ServerTransport, error) { - return newHTTP2Server(conn, config) -} - -// ConnectOptions covers all relevant options for communicating with the server. -type ConnectOptions struct { - // UserAgent is the application user agent. - UserAgent string - // Authority is the :authority pseudo-header to use. This field has no effect if - // TransportCredentials is set. - Authority string - // Dialer specifies how to dial a network address. - Dialer func(context.Context, string) (net.Conn, error) - // FailOnNonTempDialError specifies if gRPC fails on non-temporary dial errors. - FailOnNonTempDialError bool - // PerRPCCredentials stores the PerRPCCredentials required to issue RPCs. - PerRPCCredentials []credentials.PerRPCCredentials - // TransportCredentials stores the Authenticator required to setup a client connection. - TransportCredentials credentials.TransportCredentials - // KeepaliveParams stores the keepalive parameters. - KeepaliveParams keepalive.ClientParameters - // StatsHandler stores the handler for stats. - StatsHandler stats.Handler -} - -// TargetInfo contains the information of the target such as network address and metadata. -type TargetInfo struct { - Addr string - Metadata interface{} -} - -// NewClientTransport establishes the transport with the required ConnectOptions -// and returns it to the caller. -func NewClientTransport(ctx context.Context, target TargetInfo, opts ConnectOptions) (ClientTransport, error) { - return newHTTP2Client(ctx, target, opts) -} - -// Options provides additional hints and information for message -// transmission. -type Options struct { - // Last indicates whether this write is the last piece for - // this stream. - Last bool - - // Delay is a hint to the transport implementation for whether - // the data could be buffered for a batching write. The - // Transport implementation may ignore the hint. - Delay bool -} - -// CallHdr carries the information of a particular RPC. -type CallHdr struct { - // Host specifies the peer's host. - Host string - - // Method specifies the operation to perform. - Method string - - // RecvCompress specifies the compression algorithm applied on - // inbound messages. - RecvCompress string - - // SendCompress specifies the compression algorithm applied on - // outbound message. - SendCompress string - - // Flush indicates whether a new stream command should be sent - // to the peer without waiting for the first data. This is - // only a hint. The transport may modify the flush decision - // for performance purposes. - Flush bool -} - -// ClientTransport is the common interface for all gRPC client-side transport -// implementations. -type ClientTransport interface { - // Close tears down this transport. Once it returns, the transport - // should not be accessed any more. The caller must make sure this - // is called only once. - Close() error - - // GracefulClose starts to tear down the transport. It stops accepting - // new RPCs and wait the completion of the pending RPCs. - GracefulClose() error - - // Write sends the data for the given stream. A nil stream indicates - // the write is to be performed on the transport as a whole. - Write(s *Stream, data []byte, opts *Options) error - - // NewStream creates a Stream for an RPC. - NewStream(ctx context.Context, callHdr *CallHdr) (*Stream, error) - - // CloseStream clears the footprint of a stream when the stream is - // not needed any more. The err indicates the error incurred when - // CloseStream is called. Must be called when a stream is finished - // unless the associated transport is closing. - CloseStream(stream *Stream, err error) - - // Error returns a channel that is closed when some I/O error - // happens. Typically the caller should have a goroutine to monitor - // this in order to take action (e.g., close the current transport - // and create a new one) in error case. It should not return nil - // once the transport is initiated. - Error() <-chan struct{} - - // GoAway returns a channel that is closed when ClientTranspor - // receives the draining signal from the server (e.g., GOAWAY frame in - // HTTP/2). - GoAway() <-chan struct{} -} - -// ServerTransport is the common interface for all gRPC server-side transport -// implementations. -// -// Methods may be called concurrently from multiple goroutines, but -// Write methods for a given Stream will be called serially. -type ServerTransport interface { - // HandleStreams receives incoming streams using the given handler. - HandleStreams(func(*Stream), func(context.Context, string) context.Context) - - // WriteHeader sends the header metadata for the given stream. - // WriteHeader may not be called on all streams. - WriteHeader(s *Stream, md metadata.MD) error - - // Write sends the data for the given stream. - // Write may not be called on all streams. - Write(s *Stream, data []byte, opts *Options) error - - // WriteStatus sends the status of a stream to the client. - // WriteStatus is the final call made on a stream and always - // occurs. - WriteStatus(s *Stream, statusCode codes.Code, statusDesc string) error - - // Close tears down the transport. Once it is called, the transport - // should not be accessed any more. All the pending streams and their - // handlers will be terminated asynchronously. - Close() error - - // RemoteAddr returns the remote network address. - RemoteAddr() net.Addr - - // Drain notifies the client this ServerTransport stops accepting new RPCs. - Drain() -} - -// streamErrorf creates an StreamError with the specified error code and description. -func streamErrorf(c codes.Code, format string, a ...interface{}) StreamError { - return StreamError{ - Code: c, - Desc: fmt.Sprintf(format, a...), - } -} - -// connectionErrorf creates an ConnectionError with the specified error description. -func connectionErrorf(temp bool, e error, format string, a ...interface{}) ConnectionError { - return ConnectionError{ - Desc: fmt.Sprintf(format, a...), - temp: temp, - err: e, - } -} - -// ConnectionError is an error that results in the termination of the -// entire connection and the retry of all the active streams. -type ConnectionError struct { - Desc string - temp bool - err error -} - -func (e ConnectionError) Error() string { - return fmt.Sprintf("connection error: desc = %q", e.Desc) -} - -// Temporary indicates if this connection error is temporary or fatal. -func (e ConnectionError) Temporary() bool { - return e.temp -} - -// Origin returns the original error of this connection error. -func (e ConnectionError) Origin() error { - // Never return nil error here. - // If the original error is nil, return itself. - if e.err == nil { - return e - } - return e.err -} - -var ( - // ErrConnClosing indicates that the transport is closing. - ErrConnClosing = connectionErrorf(true, nil, "transport is closing") - // ErrStreamDrain indicates that the stream is rejected by the server because - // the server stops accepting new RPCs. - ErrStreamDrain = streamErrorf(codes.Unavailable, "the server stops accepting new RPCs") -) - -// StreamError is an error that only affects one stream within a connection. -type StreamError struct { - Code codes.Code - Desc string -} - -func (e StreamError) Error() string { - return fmt.Sprintf("stream error: code = %s desc = %q", e.Code, e.Desc) -} - -// ContextErr converts the error from context package into a StreamError. -func ContextErr(err error) StreamError { - switch err { - case context.DeadlineExceeded: - return streamErrorf(codes.DeadlineExceeded, "%v", err) - case context.Canceled: - return streamErrorf(codes.Canceled, "%v", err) - } - panic(fmt.Sprintf("Unexpected error from context packet: %v", err)) -} - -// wait blocks until it can receive from ctx.Done, closing, or proceed. -// If it receives from ctx.Done, it returns 0, the StreamError for ctx.Err. -// If it receives from done, it returns 0, io.EOF if ctx is not done; otherwise -// it return the StreamError for ctx.Err. -// If it receives from goAway, it returns 0, ErrStreamDrain. -// If it receives from closing, it returns 0, ErrConnClosing. -// If it receives from proceed, it returns the received integer, nil. -func wait(ctx context.Context, done, goAway, closing <-chan struct{}, proceed <-chan int) (int, error) { - select { - case <-ctx.Done(): - return 0, ContextErr(ctx.Err()) - case <-done: - // User cancellation has precedence. - select { - case <-ctx.Done(): - return 0, ContextErr(ctx.Err()) - default: - } - return 0, io.EOF - case <-goAway: - return 0, ErrStreamDrain - case <-closing: - return 0, ErrConnClosing - case i := <-proceed: - return i, nil - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/circle.yml b/_vendor/src/github.com/pingcap/kvproto/circle.yml deleted file mode 100644 index e910ff6c8be..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/circle.yml +++ /dev/null @@ -1,51 +0,0 @@ -machine: - environment: - PATH: "$HOME/.cargo/bin:$HOME/.local/bin:$PATH" - GODIST: "go1.7.3.linux-amd64.tar.gz" - LD_LIBRARY_PATH: "$LD_LIBRARY_PATH:$HOME/.local/lib" - LD_RUN_PATH: "$LD_RUN_PATH:$HOME/.local/lib" - DYLD_LIBRARY_PATH: "$DYLD_LIBRARY_PATH:$HOME/.local/lib" - LDFLAGS: "-L$HOME/.local/lib" - CPPFLAGS: "-I$HOME/.local/include" - CXXFLAGS: "-I$HOME/.local/include" - PKG_CONFIG_PATH: "$PKG_CONFIG_PATH:$HOME/.local/lib/pkgconfig" - RUSTC_DATE: "2017-03-28" - LOCAL_PREFIX: "$HOME/.local" - # used by cargo - LIBRARY_PATH: "$LIBRARY_PATH:$HOME/.local/lib" - RUST_TEST_THREADS: 1 - RUST_BACKTRACE: 1 - RUSTFLAGS: "-Dwarnings" - RUSTFMT_VERSION: "v0.6.0" - post: - - mkdir -p download - - test -e download/$GODIST || curl -o download/$GODIST https://storage.googleapis.com/golang/$GODIST - - sudo rm -rf /usr/local/go - - sudo tar -C /usr/local -xzf download/$GODIST - # Fixes: cargo under CircleCI - - sed -i 's/github/git-non-exist-hub/g' ~/.gitconfig - -dependencies: - cache_directories: - - ~/download - - ~/.multirust - - ~/.cargo - - ~/.local - pre: - # install rust/cargo - - | - if [[ ! -e $HOME/.cargo ]]; then - curl https://sh.rustup.rs -sSf | - sh -s -- --no-modify-path --default-toolchain "nightly-${RUSTC_DATE}" -y; - rustup default "nightly-${RUSTC_DATE}"; - else - rustup default "nightly-${RUSTC_DATE}"; - fi - override: - - mkdir -p $HOME/.go_project/src/github.com/$CIRCLE_PROJECT_USERNAME - - ln -fs $HOME/$CIRCLE_PROJECT_REPONAME $HOME/.go_project/src/github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME - - echo 'export GOPATH=$GOPATH:$HOME/.go_project' >> ~/.circlerc - -test: - override: - - cd $HOME/.go_project/src/github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME && make test diff --git a/_vendor/src/github.com/pingcap/kvproto/common.sh b/_vendor/src/github.com/pingcap/kvproto/common.sh deleted file mode 100755 index 828afa34bae..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/common.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash - -check_protoc_version() { - version=$(protoc --version) - major=$(echo ${version} | sed -n -e 's/.*\([0-9]\{1,\}\)\.[0-9]\{1,\}\.[0-9]\{1,\}.*/\1/p') - minor=$(echo ${version} | sed -n -e 's/.*[0-9]\{1,\}\.\([0-9]\{1,\}\)\.[0-9]\{1,\}.*/\1/p') - if [ "$major" -gt 3 ]; then - return 0 - fi - if [ "$major" -eq 3 ] && [ "$minor" -ge 1 ]; then - return 0 - fi - echo "protoc version not match, version 3.1.x is needed, current version: ${version}" - return 1 -} - -push () { - pushd $1 >/dev/null 2>&1 -} - -pop () { - popd $1 >/dev/null 2>&1 -} - -cmd_exists () { - which "$1" 1>/dev/null 2>&1 -} diff --git a/_vendor/src/github.com/pingcap/kvproto/generate_go.sh b/_vendor/src/github.com/pingcap/kvproto/generate_go.sh deleted file mode 100755 index 3c716e00863..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/generate_go.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env bash -. ./common.sh - -if ! check_protoc_version; then - exit 1 -fi - -PROGRAM=$(basename "$0") - -if [ -z $GOPATH ]; then - printf "Error: the environment variable GOPATH is not set, please set it before running %s\n" $PROGRAM > /dev/stderr - exit 1 -fi - -GO_PREFIX_PATH=github.com/pingcap/kvproto/pkg - -gogo_protobuf_url=github.com/gogo/protobuf -GOGO_ROOT=${GOPATH}/src/${gogo_protobuf_url} -GO_OUT_M= -GO_INSTALL='go install' - -echo "install gogoproto code/generator ..." -${GO_INSTALL} ${gogo_protobuf_url}/proto -${GO_INSTALL} ${gogo_protobuf_url}/protoc-gen-gofast -${GO_INSTALL} ${gogo_protobuf_url}/gogoproto - -echo "install goimports ..." -${GO_INSTALL} golang.org/x/tools/cmd/goimports - -# add the bin path of gogoproto generator into PATH if it's missing -if ! cmd_exists protoc-gen-gofast; then - for path in $(echo "${GOPATH}" | sed -e 's/:/ /g'); do - gogo_proto_bin="${path}/bin/protoc-gen-gofast" - if [ -e "${gogo_proto_bin}" ]; then - export PATH=$(dirname "${gogo_proto_bin}"):$PATH - break - fi - done -fi - -cd proto -for file in `ls *.proto` - do - base_name=$(basename $file ".proto") - mkdir -p ../pkg/$base_name - if [ -z $GO_OUT_M ]; then - GO_OUT_M="M$file=$GO_PREFIX_PATH/$base_name" - else - GO_OUT_M="$GO_OUT_M,M$file=$GO_PREFIX_PATH/$base_name" - fi -done - -echo "generate go code..." -ret=0 -for file in `ls *.proto` - do - base_name=$(basename $file ".proto") - protoc -I.:${GOGO_ROOT}:${GOGO_ROOT}/protobuf --gofast_out=plugins=grpc,$GO_OUT_M:../pkg/$base_name $file || ret=$? - cd ../pkg/$base_name - sed -i.bak -E 's/import _ \"gogoproto\"//g' *.pb.go - sed -i.bak -E 's/import fmt \"fmt\"//g' *.pb.go - sed -i.bak -E 's/import io \"io\"//g' *.pb.go - sed -i.bak -E 's/import math \"math\"//g' *.pb.go - rm -f *.bak - goimports -w *.pb.go - cd ../../proto -done -exit $ret diff --git a/_vendor/src/github.com/pingcap/kvproto/generate_rust.sh b/_vendor/src/github.com/pingcap/kvproto/generate_rust.sh deleted file mode 100755 index c7fdfd37d95..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/generate_rust.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -. ./common.sh - -if ! check_protoc_version; then - exit 1 -fi - -# install rust-protobuf if it's missing -if ! cmd_exists protoc-gen-rust; then - echo "missing rust-protobuf, try to download/install it" - cargo install protobuf || exit 1 -fi - -if ! cmd_exists grpc_rust_plugin; then - echo "missing grpc_rust_plugin, try to download/install it" - cargo install grpcio-compiler || exit 1 -fi - -push proto -echo "generate rust code..." -gogo_protobuf_url=github.com/gogo/protobuf -GOGO_ROOT=${GOPATH}/src/github.com/gogo/protobuf -GO_INSTALL='go install' - -echo "install gogoproto code/generator ..." -${GO_INSTALL} ${gogo_protobuf_url}/proto -${GO_INSTALL} ${gogo_protobuf_url}/protoc-gen-gofast -${GO_INSTALL} ${gogo_protobuf_url}/gogoproto - -# add the bin path of gogoproto generator into PATH if it's missing -if ! cmd_exists protoc-gen-gofast; then - for path in $(echo "${GOPATH}" | sed -e 's/:/ /g'); do - gogo_proto_bin="${path}/bin/protoc-gen-gofast" - if [ -e "${gogo_proto_bin}" ]; then - export PATH=$(dirname "${gogo_proto_bin}"):$PATH - break - fi - done -fi - -protoc -I.:${GOGO_ROOT}:${GOGO_ROOT}/protobuf --rust_out ../src *.proto || exit $? -protoc -I.:${GOGO_ROOT}:${GOGO_ROOT}/protobuf --grpc_out ../src --plugin=protoc-gen-grpc=`which grpc_rust_plugin` *.proto || exit $? -pop - -push src -LIB_RS=`mktemp` -rm -f lib.rs -echo "extern crate protobuf;" > ${LIB_RS} -echo "extern crate futures;" >> ${LIB_RS} -echo "extern crate grpcio;" >> ${LIB_RS} -echo >> ${LIB_RS} -for file in `ls *.rs` - do - base_name=$(basename $file ".rs") - echo "pub mod $base_name;" >> ${LIB_RS} -done -mv ${LIB_RS} lib.rs -pop - -cargo build diff --git a/_vendor/src/github.com/pingcap/kvproto/glide.lock b/_vendor/src/github.com/pingcap/kvproto/glide.lock deleted file mode 100644 index 694240803bf..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/glide.lock +++ /dev/null @@ -1,104 +0,0 @@ -hash: 59555dc62b5af00d71ef4f1f4f990d17ccad5b6d10dc89f4b2be14065247a065 -updated: 2017-04-26T11:12:14.754942661+08:00 -imports: -- name: github.com/gogo/protobuf - version: 06ec6c31ff1bac6ed4e205a547a3d72934813ef3 - subpackages: - - _conformance - - _conformance/conformance_proto - - codec - - gogoproto - - gogoreplace - - io - - jsonpb - - plugin/compare - - plugin/defaultcheck - - plugin/description - - plugin/embedcheck - - plugin/enumstringer - - plugin/equal - - plugin/face - - plugin/gostring - - plugin/grpc - - plugin/marshalto - - plugin/oneofcheck - - plugin/populate - - plugin/size - - plugin/stringer - - plugin/testgen - - plugin/union - - plugin/unmarshal - - proto - - proto/proto3_proto - - protobuf/google/protobuf - - protobuf/google/protobuf/compiler - - protobuf/protobuf - - protoc-gen-combo - - protoc-gen-gofast - - protoc-gen-gogo - - protoc-gen-gogo/descriptor - - protoc-gen-gogo/generator - - protoc-gen-gogo/grpc - - protoc-gen-gogo/plugin - - protoc-gen-gogofast - - protoc-gen-gogofaster - - protoc-gen-gogoslick - - protoc-gen-gogotypes - - protoc-gen-gostring - - protoc-min-version - - sortkeys - - types - - vanity - - vanity/command - - vanity/test - - vanity/test/fast - - vanity/test/faster - - vanity/test/slick - - version -- name: github.com/golang/protobuf - version: 8ee79997227bf9b34611aee7946ae64735e6fd93 - subpackages: - - proto -- name: github.com/juju/errors - version: 6f54ff6318409d31ff16261533ce2c8381a4fd5d -- name: github.com/pingcap/tipb - version: 1043caee48da56ffc3521406a041db8e5feac9a8 - subpackages: - - sharedbytes -- name: golang.org/x/net - version: 6acef71eb69611914f7a30939ea9f6e194c78172 - subpackages: - - context - - http2 - - http2/hpack - - internal/timeseries - - trace -- name: golang.org/x/text - version: 723492b65e225eafcba054e76ba18bb9c5ac1ea2 - subpackages: - - secure/bidirule -- name: golang.org/x/tools - version: dd796641777bce15ee87fb6bea64943b648bdcf3 - repo: https://github.com/golang/tools.git - vcs: git - subpackages: - - cmd/goimports - - go/ast/astutil - - imports -- name: google.golang.org/grpc - version: 8050b9cbc271307e5a716a9d782803d09b0d6f2d - subpackages: - - codes - - credentials - - grpclog - - internal - - keepalive - - metadata - - naming - - peer - - stats - - tap - - transport -testImports: -- name: github.com/pingcap/check - version: "" diff --git a/_vendor/src/github.com/pingcap/kvproto/glide.yaml b/_vendor/src/github.com/pingcap/kvproto/glide.yaml deleted file mode 100644 index 09e9754e7d8..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/glide.yaml +++ /dev/null @@ -1,81 +0,0 @@ -package: github.com/pingcap/kvproto -import: -- package: github.com/gogo/protobuf - version: 06ec6c31ff1bac6ed4e205a547a3d72934813ef3 - subpackages: - - codec - - _conformance - - _conformance/conformance_proto - - gogoproto - - gogoreplace - - io - - jsonpb - - plugin/compare - - plugin/defaultcheck - - plugin/description - - plugin/embedcheck - - plugin/enumstringer - - plugin/equal - - plugin/face - - plugin/grpc - - plugin/gostring - - plugin/marshalto - - plugin/oneofcheck - - plugin/populate - - plugin/size - - plugin/stringer - - plugin/testgen - - plugin/union - - plugin/unmarshal - - proto - - protobuf/protobuf - - protobuf/google/protobuf - - protobuf/google/protobuf/compiler - - protoc-gen-combo - - protoc-gen-gofast - - protoc-gen-gogo - - protoc-gen-gogo/descriptor - - protoc-gen-gogofast - - protoc-gen-gogofaster - - protoc-gen-gogo/generator - - protoc-gen-gogo/grpc - - protoc-gen-gogo/plugin - - protoc-gen-gogoslick - - protoc-gen-gogotypes - - protoc-gen-gostring - - protoc-min-version - - proto/proto3_proto - - sortkeys - - types - - vanity - - vanity/command - - vanity/test - - vanity/test/fast - - vanity/test/faster - - vanity/test/slick - - version -- package: github.com/golang/protobuf - version: 8ee79997227bf9b34611aee7946ae64735e6fd93 - subpackages: - - proto -- package: github.com/juju/errors - version: 6f54ff6318409d31ff16261533ce2c8381a4fd5d -- package: golang.org/x/tools - version: dd796641777bce15ee87fb6bea64943b648bdcf3 - repo: https://github.com/golang/tools.git - vcs: git - subpackages: - - imports - - cmd/goimports - - go/ast/astutil -- package: github.com/pingcap/tipb - version: 1043caee48da56ffc3521406a041db8e5feac9a8 - subpackages: - - sharedbytes -- package: google.golang.org/grpc - version: ^1.2.1 -- package: golang.org/x/text - subpackages: - - secure/bidirule -testImport: -- package: github.com/pingcap/check diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/coprocessor/coprocessor.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/coprocessor/coprocessor.pb.go deleted file mode 100644 index cb9c785ba1e..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/pkg/coprocessor/coprocessor.pb.go +++ /dev/null @@ -1,960 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: coprocessor.proto -// DO NOT EDIT! - -/* - Package coprocessor is a generated protocol buffer package. - - It is generated from these files: - coprocessor.proto - - It has these top-level messages: - KeyRange - Request - Response -*/ -package coprocessor - -import ( - "fmt" - "io" - "math" - - proto "github.com/golang/protobuf/proto" - - errorpb "github.com/pingcap/kvproto/pkg/errorpb" - - kvrpcpb "github.com/pingcap/kvproto/pkg/kvrpcpb" - - github_com_pingcap_tipb_sharedbytes "github.com/pingcap/tipb/sharedbytes" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -// [start, end) -type KeyRange struct { - Start []byte `protobuf:"bytes,1,opt,name=start,proto3" json:"start,omitempty"` - End []byte `protobuf:"bytes,2,opt,name=end,proto3" json:"end,omitempty"` -} - -func (m *KeyRange) Reset() { *m = KeyRange{} } -func (m *KeyRange) String() string { return proto.CompactTextString(m) } -func (*KeyRange) ProtoMessage() {} -func (*KeyRange) Descriptor() ([]byte, []int) { return fileDescriptorCoprocessor, []int{0} } - -func (m *KeyRange) GetStart() []byte { - if m != nil { - return m.Start - } - return nil -} - -func (m *KeyRange) GetEnd() []byte { - if m != nil { - return m.End - } - return nil -} - -type Request struct { - Context *kvrpcpb.Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` - Tp int64 `protobuf:"varint,2,opt,name=tp,proto3" json:"tp,omitempty"` - Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` - Ranges []*KeyRange `protobuf:"bytes,4,rep,name=ranges" json:"ranges,omitempty"` -} - -func (m *Request) Reset() { *m = Request{} } -func (m *Request) String() string { return proto.CompactTextString(m) } -func (*Request) ProtoMessage() {} -func (*Request) Descriptor() ([]byte, []int) { return fileDescriptorCoprocessor, []int{1} } - -func (m *Request) GetContext() *kvrpcpb.Context { - if m != nil { - return m.Context - } - return nil -} - -func (m *Request) GetTp() int64 { - if m != nil { - return m.Tp - } - return 0 -} - -func (m *Request) GetData() []byte { - if m != nil { - return m.Data - } - return nil -} - -func (m *Request) GetRanges() []*KeyRange { - if m != nil { - return m.Ranges - } - return nil -} - -type Response struct { - Data github_com_pingcap_tipb_sharedbytes.SharedBytes `protobuf:"bytes,1,opt,name=data,proto3,customtype=github.com/pingcap/tipb/sharedbytes.SharedBytes" json:"data"` - RegionError *errorpb.Error `protobuf:"bytes,2,opt,name=region_error,json=regionError" json:"region_error,omitempty"` - Locked *kvrpcpb.LockInfo `protobuf:"bytes,3,opt,name=locked" json:"locked,omitempty"` - OtherError string `protobuf:"bytes,4,opt,name=other_error,json=otherError,proto3" json:"other_error,omitempty"` -} - -func (m *Response) Reset() { *m = Response{} } -func (m *Response) String() string { return proto.CompactTextString(m) } -func (*Response) ProtoMessage() {} -func (*Response) Descriptor() ([]byte, []int) { return fileDescriptorCoprocessor, []int{2} } - -func (m *Response) GetRegionError() *errorpb.Error { - if m != nil { - return m.RegionError - } - return nil -} - -func (m *Response) GetLocked() *kvrpcpb.LockInfo { - if m != nil { - return m.Locked - } - return nil -} - -func (m *Response) GetOtherError() string { - if m != nil { - return m.OtherError - } - return "" -} - -func init() { - proto.RegisterType((*KeyRange)(nil), "coprocessor.KeyRange") - proto.RegisterType((*Request)(nil), "coprocessor.Request") - proto.RegisterType((*Response)(nil), "coprocessor.Response") -} -func (m *KeyRange) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *KeyRange) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Start) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintCoprocessor(dAtA, i, uint64(len(m.Start))) - i += copy(dAtA[i:], m.Start) - } - if len(m.End) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintCoprocessor(dAtA, i, uint64(len(m.End))) - i += copy(dAtA[i:], m.End) - } - return i, nil -} - -func (m *Request) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Request) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Context != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintCoprocessor(dAtA, i, uint64(m.Context.Size())) - n1, err := m.Context.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } - if m.Tp != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintCoprocessor(dAtA, i, uint64(m.Tp)) - } - if len(m.Data) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintCoprocessor(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) - } - if len(m.Ranges) > 0 { - for _, msg := range m.Ranges { - dAtA[i] = 0x22 - i++ - i = encodeVarintCoprocessor(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - return i, nil -} - -func (m *Response) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Response) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintCoprocessor(dAtA, i, uint64(m.Data.Size())) - n2, err := m.Data.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 - if m.RegionError != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintCoprocessor(dAtA, i, uint64(m.RegionError.Size())) - n3, err := m.RegionError.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n3 - } - if m.Locked != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintCoprocessor(dAtA, i, uint64(m.Locked.Size())) - n4, err := m.Locked.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n4 - } - if len(m.OtherError) > 0 { - dAtA[i] = 0x22 - i++ - i = encodeVarintCoprocessor(dAtA, i, uint64(len(m.OtherError))) - i += copy(dAtA[i:], m.OtherError) - } - return i, nil -} - -func encodeFixed64Coprocessor(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Coprocessor(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintCoprocessor(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *KeyRange) Size() (n int) { - var l int - _ = l - l = len(m.Start) - if l > 0 { - n += 1 + l + sovCoprocessor(uint64(l)) - } - l = len(m.End) - if l > 0 { - n += 1 + l + sovCoprocessor(uint64(l)) - } - return n -} - -func (m *Request) Size() (n int) { - var l int - _ = l - if m.Context != nil { - l = m.Context.Size() - n += 1 + l + sovCoprocessor(uint64(l)) - } - if m.Tp != 0 { - n += 1 + sovCoprocessor(uint64(m.Tp)) - } - l = len(m.Data) - if l > 0 { - n += 1 + l + sovCoprocessor(uint64(l)) - } - if len(m.Ranges) > 0 { - for _, e := range m.Ranges { - l = e.Size() - n += 1 + l + sovCoprocessor(uint64(l)) - } - } - return n -} - -func (m *Response) Size() (n int) { - var l int - _ = l - l = m.Data.Size() - n += 1 + l + sovCoprocessor(uint64(l)) - if m.RegionError != nil { - l = m.RegionError.Size() - n += 1 + l + sovCoprocessor(uint64(l)) - } - if m.Locked != nil { - l = m.Locked.Size() - n += 1 + l + sovCoprocessor(uint64(l)) - } - l = len(m.OtherError) - if l > 0 { - n += 1 + l + sovCoprocessor(uint64(l)) - } - return n -} - -func sovCoprocessor(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozCoprocessor(x uint64) (n int) { - return sovCoprocessor(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *KeyRange) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoprocessor - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: KeyRange: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: KeyRange: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Start", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoprocessor - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthCoprocessor - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Start = append(m.Start[:0], dAtA[iNdEx:postIndex]...) - if m.Start == nil { - m.Start = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field End", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoprocessor - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthCoprocessor - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.End = append(m.End[:0], dAtA[iNdEx:postIndex]...) - if m.End == nil { - m.End = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCoprocessor(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCoprocessor - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Request) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoprocessor - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Request: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Request: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoprocessor - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCoprocessor - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Context == nil { - m.Context = &kvrpcpb.Context{} - } - if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Tp", wireType) - } - m.Tp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoprocessor - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Tp |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoprocessor - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthCoprocessor - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ranges", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoprocessor - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCoprocessor - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Ranges = append(m.Ranges, &KeyRange{}) - if err := m.Ranges[len(m.Ranges)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCoprocessor(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCoprocessor - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Response) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoprocessor - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Response: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Response: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoprocessor - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthCoprocessor - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoprocessor - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCoprocessor - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionError == nil { - m.RegionError = &errorpb.Error{} - } - if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Locked", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoprocessor - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCoprocessor - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Locked == nil { - m.Locked = &kvrpcpb.LockInfo{} - } - if err := m.Locked.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OtherError", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoprocessor - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCoprocessor - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OtherError = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCoprocessor(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCoprocessor - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipCoprocessor(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCoprocessor - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCoprocessor - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCoprocessor - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthCoprocessor - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCoprocessor - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipCoprocessor(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthCoprocessor = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowCoprocessor = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("coprocessor.proto", fileDescriptorCoprocessor) } - -var fileDescriptorCoprocessor = []byte{ - // 379 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x51, 0xb1, 0xae, 0xda, 0x30, - 0x14, 0xc5, 0x84, 0x02, 0x75, 0x00, 0x81, 0x45, 0xa5, 0x88, 0x21, 0x20, 0x26, 0x8a, 0x54, 0x47, - 0x4d, 0x87, 0xee, 0x54, 0x1d, 0x2a, 0x3a, 0xb9, 0x1f, 0x50, 0x25, 0x8e, 0x1b, 0xa2, 0x94, 0x5c, - 0xd7, 0x36, 0xa8, 0xfc, 0x41, 0x3f, 0xa1, 0x9f, 0xc4, 0xf8, 0xa6, 0x37, 0xbc, 0x01, 0x3d, 0xf1, - 0x7e, 0xe4, 0x29, 0x4e, 0x82, 0x98, 0xee, 0xb9, 0xc7, 0xc7, 0xc7, 0xe7, 0x5e, 0xe3, 0x09, 0x07, - 0xa9, 0x80, 0x0b, 0xad, 0x41, 0x51, 0xa9, 0xc0, 0x00, 0x71, 0xef, 0xa8, 0xd9, 0x50, 0x28, 0x05, - 0x4a, 0xc6, 0xd5, 0xd9, 0x6c, 0x98, 0x1f, 0x95, 0xe4, 0xb7, 0x76, 0x9a, 0x42, 0x0a, 0x16, 0x06, - 0x25, 0xaa, 0xd8, 0x65, 0x88, 0xfb, 0x5b, 0x71, 0x62, 0x51, 0x91, 0x0a, 0x32, 0xc5, 0x6f, 0xb4, - 0x89, 0x94, 0xf1, 0xd0, 0x02, 0xad, 0x06, 0xac, 0x6a, 0xc8, 0x18, 0x3b, 0xa2, 0x48, 0xbc, 0xb6, - 0xe5, 0x4a, 0xb8, 0xfc, 0x87, 0x70, 0x8f, 0x89, 0x3f, 0x07, 0xa1, 0x0d, 0x59, 0xe3, 0x1e, 0x87, - 0xc2, 0x88, 0xbf, 0xd5, 0x2d, 0x37, 0x1c, 0xd3, 0xe6, 0xd9, 0x2f, 0x15, 0xcf, 0x1a, 0x01, 0x19, - 0xe1, 0xb6, 0x91, 0xd6, 0xc8, 0x61, 0x6d, 0x23, 0x09, 0xc1, 0x9d, 0x24, 0x32, 0x91, 0xe7, 0x58, - 0x6b, 0x8b, 0xc9, 0x07, 0xdc, 0x55, 0x65, 0x18, 0xed, 0x75, 0x16, 0xce, 0xca, 0x0d, 0xdf, 0xd1, - 0xfb, 0xa1, 0x9b, 0xa8, 0xac, 0x16, 0x2d, 0x1f, 0x11, 0xee, 0x33, 0xa1, 0x25, 0x14, 0x5a, 0x90, - 0x6d, 0xed, 0x67, 0xe3, 0x6f, 0x3e, 0x9f, 0x2f, 0xf3, 0xd6, 0xd3, 0x65, 0x1e, 0xa4, 0x99, 0xd9, - 0x1d, 0x62, 0xca, 0x61, 0x1f, 0xc8, 0xac, 0x48, 0x79, 0x24, 0x03, 0x93, 0xc9, 0x38, 0xd0, 0xbb, - 0x48, 0x89, 0x24, 0x3e, 0x19, 0xa1, 0xe9, 0x0f, 0x8b, 0x37, 0x25, 0xae, 0x83, 0x7c, 0xc4, 0x03, - 0x25, 0xd2, 0x0c, 0x8a, 0x9f, 0x76, 0xab, 0x36, 0xb6, 0x1b, 0x8e, 0x68, 0xb3, 0xe3, 0xaf, 0x65, - 0x65, 0x6e, 0xa5, 0xb1, 0x0d, 0x79, 0x8f, 0xbb, 0xbf, 0x81, 0xe7, 0x22, 0xb1, 0x13, 0xb9, 0xe1, - 0xe4, 0xb6, 0x8a, 0xef, 0xc0, 0xf3, 0x6f, 0xc5, 0x2f, 0x60, 0xb5, 0x80, 0xcc, 0xb1, 0x0b, 0x66, - 0x27, 0x54, 0x6d, 0xde, 0x59, 0xa0, 0xd5, 0x5b, 0x86, 0x2d, 0x65, 0xbd, 0x36, 0xeb, 0xf3, 0xd5, - 0x47, 0x0f, 0x57, 0x1f, 0x3d, 0x5f, 0x7d, 0xf4, 0xff, 0xc5, 0x6f, 0x61, 0x8f, 0xc3, 0x9e, 0xd6, - 0x03, 0x50, 0x93, 0xe5, 0x47, 0x9a, 0x1f, 0xed, 0x1f, 0xc6, 0x5d, 0x5b, 0x3e, 0xbd, 0x06, 0x00, - 0x00, 0xff, 0xff, 0xfa, 0xd0, 0xd4, 0xd5, 0x20, 0x02, 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/eraftpb/eraftpb.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/eraftpb/eraftpb.pb.go deleted file mode 100644 index 9ff98fe0b58..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/pkg/eraftpb/eraftpb.pb.go +++ /dev/null @@ -1,2219 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: eraftpb.proto -// DO NOT EDIT! - -/* - Package eraftpb is a generated protocol buffer package. - - It is generated from these files: - eraftpb.proto - - It has these top-level messages: - Entry - SnapshotMetadata - Snapshot - Message - HardState - ConfState - ConfChange -*/ -package eraftpb - -import ( - "fmt" - "io" - "math" - - proto "github.com/golang/protobuf/proto" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type EntryType int32 - -const ( - EntryType_EntryNormal EntryType = 0 - EntryType_EntryConfChange EntryType = 1 -) - -var EntryType_name = map[int32]string{ - 0: "EntryNormal", - 1: "EntryConfChange", -} -var EntryType_value = map[string]int32{ - "EntryNormal": 0, - "EntryConfChange": 1, -} - -func (x EntryType) Enum() *EntryType { - p := new(EntryType) - *p = x - return p -} -func (x EntryType) String() string { - return proto.EnumName(EntryType_name, int32(x)) -} -func (x *EntryType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(EntryType_value, data, "EntryType") - if err != nil { - return err - } - *x = EntryType(value) - return nil -} -func (EntryType) EnumDescriptor() ([]byte, []int) { return fileDescriptorEraftpb, []int{0} } - -type MessageType int32 - -const ( - MessageType_MsgHup MessageType = 0 - MessageType_MsgBeat MessageType = 1 - MessageType_MsgPropose MessageType = 2 - MessageType_MsgAppend MessageType = 3 - MessageType_MsgAppendResponse MessageType = 4 - MessageType_MsgRequestVote MessageType = 5 - MessageType_MsgRequestVoteResponse MessageType = 6 - MessageType_MsgSnapshot MessageType = 7 - MessageType_MsgHeartbeat MessageType = 8 - MessageType_MsgHeartbeatResponse MessageType = 9 - MessageType_MsgUnreachable MessageType = 10 - MessageType_MsgSnapStatus MessageType = 11 - MessageType_MsgCheckQuorum MessageType = 12 - MessageType_MsgTransferLeader MessageType = 13 - MessageType_MsgTimeoutNow MessageType = 14 - MessageType_MsgReadIndex MessageType = 15 - MessageType_MsgReadIndexResp MessageType = 16 - MessageType_MsgRequestPreVote MessageType = 17 - MessageType_MsgRequestPreVoteResponse MessageType = 18 -) - -var MessageType_name = map[int32]string{ - 0: "MsgHup", - 1: "MsgBeat", - 2: "MsgPropose", - 3: "MsgAppend", - 4: "MsgAppendResponse", - 5: "MsgRequestVote", - 6: "MsgRequestVoteResponse", - 7: "MsgSnapshot", - 8: "MsgHeartbeat", - 9: "MsgHeartbeatResponse", - 10: "MsgUnreachable", - 11: "MsgSnapStatus", - 12: "MsgCheckQuorum", - 13: "MsgTransferLeader", - 14: "MsgTimeoutNow", - 15: "MsgReadIndex", - 16: "MsgReadIndexResp", - 17: "MsgRequestPreVote", - 18: "MsgRequestPreVoteResponse", -} -var MessageType_value = map[string]int32{ - "MsgHup": 0, - "MsgBeat": 1, - "MsgPropose": 2, - "MsgAppend": 3, - "MsgAppendResponse": 4, - "MsgRequestVote": 5, - "MsgRequestVoteResponse": 6, - "MsgSnapshot": 7, - "MsgHeartbeat": 8, - "MsgHeartbeatResponse": 9, - "MsgUnreachable": 10, - "MsgSnapStatus": 11, - "MsgCheckQuorum": 12, - "MsgTransferLeader": 13, - "MsgTimeoutNow": 14, - "MsgReadIndex": 15, - "MsgReadIndexResp": 16, - "MsgRequestPreVote": 17, - "MsgRequestPreVoteResponse": 18, -} - -func (x MessageType) Enum() *MessageType { - p := new(MessageType) - *p = x - return p -} -func (x MessageType) String() string { - return proto.EnumName(MessageType_name, int32(x)) -} -func (x *MessageType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(MessageType_value, data, "MessageType") - if err != nil { - return err - } - *x = MessageType(value) - return nil -} -func (MessageType) EnumDescriptor() ([]byte, []int) { return fileDescriptorEraftpb, []int{1} } - -type ConfChangeType int32 - -const ( - ConfChangeType_AddNode ConfChangeType = 0 - ConfChangeType_RemoveNode ConfChangeType = 1 -) - -var ConfChangeType_name = map[int32]string{ - 0: "AddNode", - 1: "RemoveNode", -} -var ConfChangeType_value = map[string]int32{ - "AddNode": 0, - "RemoveNode": 1, -} - -func (x ConfChangeType) Enum() *ConfChangeType { - p := new(ConfChangeType) - *p = x - return p -} -func (x ConfChangeType) String() string { - return proto.EnumName(ConfChangeType_name, int32(x)) -} -func (x *ConfChangeType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(ConfChangeType_value, data, "ConfChangeType") - if err != nil { - return err - } - *x = ConfChangeType(value) - return nil -} -func (ConfChangeType) EnumDescriptor() ([]byte, []int) { return fileDescriptorEraftpb, []int{2} } - -type Entry struct { - EntryType *EntryType `protobuf:"varint,1,opt,name=entry_type,json=entryType,enum=eraftpb.EntryType" json:"entry_type,omitempty"` - Term *uint64 `protobuf:"varint,2,opt,name=term" json:"term,omitempty"` - Index *uint64 `protobuf:"varint,3,opt,name=index" json:"index,omitempty"` - Data []byte `protobuf:"bytes,4,opt,name=data" json:"data,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Entry) Reset() { *m = Entry{} } -func (m *Entry) String() string { return proto.CompactTextString(m) } -func (*Entry) ProtoMessage() {} -func (*Entry) Descriptor() ([]byte, []int) { return fileDescriptorEraftpb, []int{0} } - -func (m *Entry) GetEntryType() EntryType { - if m != nil && m.EntryType != nil { - return *m.EntryType - } - return EntryType_EntryNormal -} - -func (m *Entry) GetTerm() uint64 { - if m != nil && m.Term != nil { - return *m.Term - } - return 0 -} - -func (m *Entry) GetIndex() uint64 { - if m != nil && m.Index != nil { - return *m.Index - } - return 0 -} - -func (m *Entry) GetData() []byte { - if m != nil { - return m.Data - } - return nil -} - -type SnapshotMetadata struct { - ConfState *ConfState `protobuf:"bytes,1,opt,name=conf_state,json=confState" json:"conf_state,omitempty"` - Index *uint64 `protobuf:"varint,2,opt,name=index" json:"index,omitempty"` - Term *uint64 `protobuf:"varint,3,opt,name=term" json:"term,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *SnapshotMetadata) Reset() { *m = SnapshotMetadata{} } -func (m *SnapshotMetadata) String() string { return proto.CompactTextString(m) } -func (*SnapshotMetadata) ProtoMessage() {} -func (*SnapshotMetadata) Descriptor() ([]byte, []int) { return fileDescriptorEraftpb, []int{1} } - -func (m *SnapshotMetadata) GetConfState() *ConfState { - if m != nil { - return m.ConfState - } - return nil -} - -func (m *SnapshotMetadata) GetIndex() uint64 { - if m != nil && m.Index != nil { - return *m.Index - } - return 0 -} - -func (m *SnapshotMetadata) GetTerm() uint64 { - if m != nil && m.Term != nil { - return *m.Term - } - return 0 -} - -type Snapshot struct { - Data []byte `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"` - Metadata *SnapshotMetadata `protobuf:"bytes,2,opt,name=metadata" json:"metadata,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Snapshot) Reset() { *m = Snapshot{} } -func (m *Snapshot) String() string { return proto.CompactTextString(m) } -func (*Snapshot) ProtoMessage() {} -func (*Snapshot) Descriptor() ([]byte, []int) { return fileDescriptorEraftpb, []int{2} } - -func (m *Snapshot) GetData() []byte { - if m != nil { - return m.Data - } - return nil -} - -func (m *Snapshot) GetMetadata() *SnapshotMetadata { - if m != nil { - return m.Metadata - } - return nil -} - -type Message struct { - MsgType *MessageType `protobuf:"varint,1,opt,name=msg_type,json=msgType,enum=eraftpb.MessageType" json:"msg_type,omitempty"` - To *uint64 `protobuf:"varint,2,opt,name=to" json:"to,omitempty"` - From *uint64 `protobuf:"varint,3,opt,name=from" json:"from,omitempty"` - Term *uint64 `protobuf:"varint,4,opt,name=term" json:"term,omitempty"` - LogTerm *uint64 `protobuf:"varint,5,opt,name=log_term,json=logTerm" json:"log_term,omitempty"` - Index *uint64 `protobuf:"varint,6,opt,name=index" json:"index,omitempty"` - Entries []*Entry `protobuf:"bytes,7,rep,name=entries" json:"entries,omitempty"` - Commit *uint64 `protobuf:"varint,8,opt,name=commit" json:"commit,omitempty"` - Snapshot *Snapshot `protobuf:"bytes,9,opt,name=snapshot" json:"snapshot,omitempty"` - Reject *bool `protobuf:"varint,10,opt,name=reject" json:"reject,omitempty"` - RejectHint *uint64 `protobuf:"varint,11,opt,name=reject_hint,json=rejectHint" json:"reject_hint,omitempty"` - Context []byte `protobuf:"bytes,12,opt,name=context" json:"context,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Message) Reset() { *m = Message{} } -func (m *Message) String() string { return proto.CompactTextString(m) } -func (*Message) ProtoMessage() {} -func (*Message) Descriptor() ([]byte, []int) { return fileDescriptorEraftpb, []int{3} } - -func (m *Message) GetMsgType() MessageType { - if m != nil && m.MsgType != nil { - return *m.MsgType - } - return MessageType_MsgHup -} - -func (m *Message) GetTo() uint64 { - if m != nil && m.To != nil { - return *m.To - } - return 0 -} - -func (m *Message) GetFrom() uint64 { - if m != nil && m.From != nil { - return *m.From - } - return 0 -} - -func (m *Message) GetTerm() uint64 { - if m != nil && m.Term != nil { - return *m.Term - } - return 0 -} - -func (m *Message) GetLogTerm() uint64 { - if m != nil && m.LogTerm != nil { - return *m.LogTerm - } - return 0 -} - -func (m *Message) GetIndex() uint64 { - if m != nil && m.Index != nil { - return *m.Index - } - return 0 -} - -func (m *Message) GetEntries() []*Entry { - if m != nil { - return m.Entries - } - return nil -} - -func (m *Message) GetCommit() uint64 { - if m != nil && m.Commit != nil { - return *m.Commit - } - return 0 -} - -func (m *Message) GetSnapshot() *Snapshot { - if m != nil { - return m.Snapshot - } - return nil -} - -func (m *Message) GetReject() bool { - if m != nil && m.Reject != nil { - return *m.Reject - } - return false -} - -func (m *Message) GetRejectHint() uint64 { - if m != nil && m.RejectHint != nil { - return *m.RejectHint - } - return 0 -} - -func (m *Message) GetContext() []byte { - if m != nil { - return m.Context - } - return nil -} - -type HardState struct { - Term *uint64 `protobuf:"varint,1,opt,name=term" json:"term,omitempty"` - Vote *uint64 `protobuf:"varint,2,opt,name=vote" json:"vote,omitempty"` - Commit *uint64 `protobuf:"varint,3,opt,name=commit" json:"commit,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *HardState) Reset() { *m = HardState{} } -func (m *HardState) String() string { return proto.CompactTextString(m) } -func (*HardState) ProtoMessage() {} -func (*HardState) Descriptor() ([]byte, []int) { return fileDescriptorEraftpb, []int{4} } - -func (m *HardState) GetTerm() uint64 { - if m != nil && m.Term != nil { - return *m.Term - } - return 0 -} - -func (m *HardState) GetVote() uint64 { - if m != nil && m.Vote != nil { - return *m.Vote - } - return 0 -} - -func (m *HardState) GetCommit() uint64 { - if m != nil && m.Commit != nil { - return *m.Commit - } - return 0 -} - -type ConfState struct { - Nodes []uint64 `protobuf:"varint,1,rep,name=nodes" json:"nodes,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *ConfState) Reset() { *m = ConfState{} } -func (m *ConfState) String() string { return proto.CompactTextString(m) } -func (*ConfState) ProtoMessage() {} -func (*ConfState) Descriptor() ([]byte, []int) { return fileDescriptorEraftpb, []int{5} } - -func (m *ConfState) GetNodes() []uint64 { - if m != nil { - return m.Nodes - } - return nil -} - -type ConfChange struct { - Id *uint64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` - ChangeType *ConfChangeType `protobuf:"varint,2,opt,name=change_type,json=changeType,enum=eraftpb.ConfChangeType" json:"change_type,omitempty"` - NodeId *uint64 `protobuf:"varint,3,opt,name=node_id,json=nodeId" json:"node_id,omitempty"` - Context []byte `protobuf:"bytes,4,opt,name=context" json:"context,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *ConfChange) Reset() { *m = ConfChange{} } -func (m *ConfChange) String() string { return proto.CompactTextString(m) } -func (*ConfChange) ProtoMessage() {} -func (*ConfChange) Descriptor() ([]byte, []int) { return fileDescriptorEraftpb, []int{6} } - -func (m *ConfChange) GetId() uint64 { - if m != nil && m.Id != nil { - return *m.Id - } - return 0 -} - -func (m *ConfChange) GetChangeType() ConfChangeType { - if m != nil && m.ChangeType != nil { - return *m.ChangeType - } - return ConfChangeType_AddNode -} - -func (m *ConfChange) GetNodeId() uint64 { - if m != nil && m.NodeId != nil { - return *m.NodeId - } - return 0 -} - -func (m *ConfChange) GetContext() []byte { - if m != nil { - return m.Context - } - return nil -} - -func init() { - proto.RegisterType((*Entry)(nil), "eraftpb.Entry") - proto.RegisterType((*SnapshotMetadata)(nil), "eraftpb.SnapshotMetadata") - proto.RegisterType((*Snapshot)(nil), "eraftpb.Snapshot") - proto.RegisterType((*Message)(nil), "eraftpb.Message") - proto.RegisterType((*HardState)(nil), "eraftpb.HardState") - proto.RegisterType((*ConfState)(nil), "eraftpb.ConfState") - proto.RegisterType((*ConfChange)(nil), "eraftpb.ConfChange") - proto.RegisterEnum("eraftpb.EntryType", EntryType_name, EntryType_value) - proto.RegisterEnum("eraftpb.MessageType", MessageType_name, MessageType_value) - proto.RegisterEnum("eraftpb.ConfChangeType", ConfChangeType_name, ConfChangeType_value) -} -func (m *Entry) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Entry) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.EntryType != nil { - dAtA[i] = 0x8 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(*m.EntryType)) - } - if m.Term != nil { - dAtA[i] = 0x10 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(*m.Term)) - } - if m.Index != nil { - dAtA[i] = 0x18 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(*m.Index)) - } - if m.Data != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *SnapshotMetadata) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SnapshotMetadata) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.ConfState != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(m.ConfState.Size())) - n1, err := m.ConfState.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } - if m.Index != nil { - dAtA[i] = 0x10 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(*m.Index)) - } - if m.Term != nil { - dAtA[i] = 0x18 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(*m.Term)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Snapshot) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Snapshot) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Data != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) - } - if m.Metadata != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(m.Metadata.Size())) - n2, err := m.Metadata.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Message) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Message) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.MsgType != nil { - dAtA[i] = 0x8 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(*m.MsgType)) - } - if m.To != nil { - dAtA[i] = 0x10 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(*m.To)) - } - if m.From != nil { - dAtA[i] = 0x18 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(*m.From)) - } - if m.Term != nil { - dAtA[i] = 0x20 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(*m.Term)) - } - if m.LogTerm != nil { - dAtA[i] = 0x28 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(*m.LogTerm)) - } - if m.Index != nil { - dAtA[i] = 0x30 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(*m.Index)) - } - if len(m.Entries) > 0 { - for _, msg := range m.Entries { - dAtA[i] = 0x3a - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.Commit != nil { - dAtA[i] = 0x40 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(*m.Commit)) - } - if m.Snapshot != nil { - dAtA[i] = 0x4a - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(m.Snapshot.Size())) - n3, err := m.Snapshot.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n3 - } - if m.Reject != nil { - dAtA[i] = 0x50 - i++ - if *m.Reject { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - } - if m.RejectHint != nil { - dAtA[i] = 0x58 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(*m.RejectHint)) - } - if m.Context != nil { - dAtA[i] = 0x62 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(len(m.Context))) - i += copy(dAtA[i:], m.Context) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *HardState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HardState) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Term != nil { - dAtA[i] = 0x8 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(*m.Term)) - } - if m.Vote != nil { - dAtA[i] = 0x10 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(*m.Vote)) - } - if m.Commit != nil { - dAtA[i] = 0x18 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(*m.Commit)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *ConfState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ConfState) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Nodes) > 0 { - for _, num := range m.Nodes { - dAtA[i] = 0x8 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(num)) - } - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *ConfChange) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ConfChange) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Id != nil { - dAtA[i] = 0x8 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(*m.Id)) - } - if m.ChangeType != nil { - dAtA[i] = 0x10 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(*m.ChangeType)) - } - if m.NodeId != nil { - dAtA[i] = 0x18 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(*m.NodeId)) - } - if m.Context != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintEraftpb(dAtA, i, uint64(len(m.Context))) - i += copy(dAtA[i:], m.Context) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func encodeFixed64Eraftpb(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Eraftpb(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintEraftpb(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *Entry) Size() (n int) { - var l int - _ = l - if m.EntryType != nil { - n += 1 + sovEraftpb(uint64(*m.EntryType)) - } - if m.Term != nil { - n += 1 + sovEraftpb(uint64(*m.Term)) - } - if m.Index != nil { - n += 1 + sovEraftpb(uint64(*m.Index)) - } - if m.Data != nil { - l = len(m.Data) - n += 1 + l + sovEraftpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SnapshotMetadata) Size() (n int) { - var l int - _ = l - if m.ConfState != nil { - l = m.ConfState.Size() - n += 1 + l + sovEraftpb(uint64(l)) - } - if m.Index != nil { - n += 1 + sovEraftpb(uint64(*m.Index)) - } - if m.Term != nil { - n += 1 + sovEraftpb(uint64(*m.Term)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Snapshot) Size() (n int) { - var l int - _ = l - if m.Data != nil { - l = len(m.Data) - n += 1 + l + sovEraftpb(uint64(l)) - } - if m.Metadata != nil { - l = m.Metadata.Size() - n += 1 + l + sovEraftpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Message) Size() (n int) { - var l int - _ = l - if m.MsgType != nil { - n += 1 + sovEraftpb(uint64(*m.MsgType)) - } - if m.To != nil { - n += 1 + sovEraftpb(uint64(*m.To)) - } - if m.From != nil { - n += 1 + sovEraftpb(uint64(*m.From)) - } - if m.Term != nil { - n += 1 + sovEraftpb(uint64(*m.Term)) - } - if m.LogTerm != nil { - n += 1 + sovEraftpb(uint64(*m.LogTerm)) - } - if m.Index != nil { - n += 1 + sovEraftpb(uint64(*m.Index)) - } - if len(m.Entries) > 0 { - for _, e := range m.Entries { - l = e.Size() - n += 1 + l + sovEraftpb(uint64(l)) - } - } - if m.Commit != nil { - n += 1 + sovEraftpb(uint64(*m.Commit)) - } - if m.Snapshot != nil { - l = m.Snapshot.Size() - n += 1 + l + sovEraftpb(uint64(l)) - } - if m.Reject != nil { - n += 2 - } - if m.RejectHint != nil { - n += 1 + sovEraftpb(uint64(*m.RejectHint)) - } - if m.Context != nil { - l = len(m.Context) - n += 1 + l + sovEraftpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *HardState) Size() (n int) { - var l int - _ = l - if m.Term != nil { - n += 1 + sovEraftpb(uint64(*m.Term)) - } - if m.Vote != nil { - n += 1 + sovEraftpb(uint64(*m.Vote)) - } - if m.Commit != nil { - n += 1 + sovEraftpb(uint64(*m.Commit)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ConfState) Size() (n int) { - var l int - _ = l - if len(m.Nodes) > 0 { - for _, e := range m.Nodes { - n += 1 + sovEraftpb(uint64(e)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ConfChange) Size() (n int) { - var l int - _ = l - if m.Id != nil { - n += 1 + sovEraftpb(uint64(*m.Id)) - } - if m.ChangeType != nil { - n += 1 + sovEraftpb(uint64(*m.ChangeType)) - } - if m.NodeId != nil { - n += 1 + sovEraftpb(uint64(*m.NodeId)) - } - if m.Context != nil { - l = len(m.Context) - n += 1 + l + sovEraftpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovEraftpb(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozEraftpb(x uint64) (n int) { - return sovEraftpb(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Entry) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Entry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Entry: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EntryType", wireType) - } - var v EntryType - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (EntryType(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.EntryType = &v - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Term = &v - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Index = &v - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEraftpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEraftpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthEraftpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SnapshotMetadata) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SnapshotMetadata: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SnapshotMetadata: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConfState", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEraftpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ConfState == nil { - m.ConfState = &ConfState{} - } - if err := m.ConfState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Index = &v - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Term = &v - default: - iNdEx = preIndex - skippy, err := skipEraftpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthEraftpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Snapshot) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Snapshot: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Snapshot: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEraftpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEraftpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Metadata == nil { - m.Metadata = &SnapshotMetadata{} - } - if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEraftpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthEraftpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Message) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Message: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Message: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgType", wireType) - } - var v MessageType - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (MessageType(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.MsgType = &v - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field To", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.To = &v - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.From = &v - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Term = &v - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LogTerm", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.LogTerm = &v - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Index = &v - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEraftpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Entries = append(m.Entries, &Entry{}) - if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Commit", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Commit = &v - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Snapshot", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEraftpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Snapshot == nil { - m.Snapshot = &Snapshot{} - } - if err := m.Snapshot.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Reject", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.Reject = &b - case 11: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RejectHint", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.RejectHint = &v - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEraftpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Context = append(m.Context[:0], dAtA[iNdEx:postIndex]...) - if m.Context == nil { - m.Context = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEraftpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthEraftpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HardState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HardState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HardState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Term = &v - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Vote", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Vote = &v - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Commit", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Commit = &v - default: - iNdEx = preIndex - skippy, err := skipEraftpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthEraftpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ConfState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ConfState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ConfState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Nodes", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Nodes = append(m.Nodes, v) - default: - iNdEx = preIndex - skippy, err := skipEraftpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthEraftpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ConfChange) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ConfChange: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ConfChange: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Id = &v - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ChangeType", wireType) - } - var v ConfChangeType - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (ConfChangeType(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.ChangeType = &v - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeId", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.NodeId = &v - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEraftpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEraftpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Context = append(m.Context[:0], dAtA[iNdEx:postIndex]...) - if m.Context == nil { - m.Context = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEraftpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthEraftpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipEraftpb(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEraftpb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEraftpb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEraftpb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthEraftpb - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEraftpb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipEraftpb(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthEraftpb = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowEraftpb = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("eraftpb.proto", fileDescriptorEraftpb) } - -var fileDescriptorEraftpb = []byte{ - // 785 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x54, 0x51, 0x6f, 0xe3, 0x44, - 0x10, 0xae, 0x9d, 0xb4, 0xb6, 0xc7, 0x6d, 0xba, 0x5d, 0xca, 0x9d, 0x8b, 0x44, 0x09, 0x79, 0x8a, - 0x2a, 0x5d, 0xd0, 0x55, 0x42, 0xe2, 0xf5, 0x2e, 0x42, 0xea, 0x09, 0x5c, 0x1d, 0xbe, 0x1c, 0xaf, - 0xd1, 0xd6, 0x9e, 0x38, 0xa6, 0xb1, 0xd7, 0xec, 0x6e, 0x42, 0xfb, 0x13, 0x90, 0xf8, 0x01, 0xfc, - 0x24, 0x1e, 0xf9, 0x09, 0xa8, 0x3c, 0xf0, 0x37, 0xd0, 0x6e, 0xd6, 0x8e, 0x73, 0x7d, 0x9b, 0xf9, - 0x3c, 0x3b, 0xf3, 0xcd, 0xf7, 0x4d, 0x02, 0x27, 0x28, 0xd8, 0x42, 0xd5, 0x77, 0x93, 0x5a, 0x70, - 0xc5, 0xa9, 0x67, 0xd3, 0xd1, 0x03, 0x1c, 0x7e, 0x5f, 0x29, 0xf1, 0x48, 0x5f, 0x03, 0xa0, 0x0e, - 0xe6, 0xea, 0xb1, 0xc6, 0xc8, 0x19, 0x3a, 0xe3, 0xc1, 0x35, 0x9d, 0x34, 0xaf, 0x4c, 0xcd, 0xec, - 0xb1, 0xc6, 0x24, 0xc0, 0x26, 0xa4, 0x14, 0xfa, 0x0a, 0x45, 0x19, 0xb9, 0x43, 0x67, 0xdc, 0x4f, - 0x4c, 0x4c, 0xcf, 0xe1, 0xb0, 0xa8, 0x32, 0x7c, 0x88, 0x7a, 0x06, 0xdc, 0x26, 0xba, 0x32, 0x63, - 0x8a, 0x45, 0xfd, 0xa1, 0x33, 0x3e, 0x4e, 0x4c, 0x3c, 0xe2, 0x40, 0x3e, 0x54, 0xac, 0x96, 0x4b, - 0xae, 0x62, 0x54, 0x4c, 0x63, 0x9a, 0x44, 0xca, 0xab, 0xc5, 0x5c, 0x2a, 0xa6, 0xb6, 0x24, 0xc2, - 0x0e, 0x89, 0x29, 0xaf, 0x16, 0x1f, 0xf4, 0x97, 0x24, 0x48, 0x9b, 0x70, 0x37, 0xd0, 0xfd, 0x64, - 0xa0, 0xa1, 0xd6, 0xdb, 0x51, 0x1b, 0x7d, 0x04, 0xbf, 0x19, 0xd8, 0x12, 0x72, 0x76, 0x84, 0xe8, - 0xb7, 0xe0, 0x97, 0x96, 0x88, 0x69, 0x16, 0x5e, 0x5f, 0xb4, 0xa3, 0x3f, 0x65, 0x9a, 0xb4, 0xa5, - 0xa3, 0xff, 0x5c, 0xf0, 0x62, 0x94, 0x92, 0xe5, 0x48, 0xbf, 0x01, 0xbf, 0x94, 0x79, 0x57, 0xc2, - 0xf3, 0xb6, 0x85, 0xad, 0x31, 0x22, 0x7a, 0xa5, 0xcc, 0x8d, 0x84, 0x03, 0x70, 0x15, 0xb7, 0xd4, - 0x5d, 0xc5, 0x35, 0xaf, 0x85, 0xe0, 0x2d, 0x6f, 0x1d, 0xb7, 0xbb, 0xf4, 0x3b, 0x32, 0x5f, 0x80, - 0xbf, 0xe2, 0xf9, 0xdc, 0xe0, 0x87, 0x06, 0xf7, 0x56, 0x3c, 0x9f, 0xed, 0x39, 0x70, 0xd4, 0x15, - 0x64, 0x0c, 0x9e, 0x36, 0xae, 0x40, 0x19, 0x79, 0xc3, 0xde, 0x38, 0xbc, 0x1e, 0xec, 0x7b, 0x9b, - 0x34, 0x9f, 0xe9, 0x0b, 0x38, 0x4a, 0x79, 0x59, 0x16, 0x2a, 0xf2, 0x4d, 0x03, 0x9b, 0xd1, 0x57, - 0xe0, 0x4b, 0xab, 0x42, 0x14, 0x18, 0x79, 0xce, 0x9e, 0xc9, 0x93, 0xb4, 0x25, 0xba, 0x8d, 0xc0, - 0x5f, 0x30, 0x55, 0x11, 0x0c, 0x9d, 0xb1, 0x9f, 0xd8, 0x8c, 0x7e, 0x05, 0xe1, 0x36, 0x9a, 0x2f, - 0x8b, 0x4a, 0x45, 0xa1, 0x99, 0x01, 0x5b, 0xe8, 0xa6, 0xa8, 0x14, 0x8d, 0xc0, 0x4b, 0x79, 0xa5, - 0xf0, 0x41, 0x45, 0xc7, 0xc6, 0x9d, 0x26, 0x1d, 0xfd, 0x00, 0xc1, 0x0d, 0x13, 0xd9, 0xd6, 0xf7, - 0x46, 0x15, 0xa7, 0xa3, 0x0a, 0x85, 0xfe, 0x86, 0x2b, 0x6c, 0x0e, 0x52, 0xc7, 0x9d, 0x75, 0x7a, - 0xdd, 0x75, 0x46, 0x5f, 0x43, 0x30, 0xed, 0x1e, 0x51, 0xc5, 0x33, 0x94, 0x91, 0x33, 0xec, 0x69, - 0xcd, 0x4c, 0x32, 0xfa, 0xdd, 0x01, 0xd0, 0x35, 0xd3, 0x25, 0xab, 0x72, 0xe3, 0x55, 0x91, 0xd9, - 0x79, 0x6e, 0x91, 0xd1, 0xef, 0x20, 0x4c, 0xcd, 0x97, 0xad, 0xdf, 0xae, 0xf1, 0xfb, 0xe5, 0xde, - 0xb5, 0x6e, 0x5f, 0x1a, 0xcb, 0x21, 0x6d, 0x63, 0xfa, 0x12, 0x3c, 0x3d, 0x61, 0x5e, 0x64, 0x0d, - 0x29, 0x9d, 0xbe, 0xcb, 0xba, 0xbb, 0xf7, 0xf7, 0x76, 0xbf, 0x7a, 0x0d, 0x41, 0xfb, 0x1b, 0xa4, - 0xa7, 0x10, 0x9a, 0xe4, 0x96, 0x8b, 0x92, 0xad, 0xc8, 0x01, 0xfd, 0x0c, 0x4e, 0x0d, 0xb0, 0x9b, - 0x49, 0x9c, 0xab, 0x3f, 0x7a, 0x10, 0x76, 0x8e, 0x8e, 0x02, 0x1c, 0xc5, 0x32, 0xbf, 0x59, 0xd7, - 0xe4, 0x80, 0x86, 0xe0, 0xc5, 0x32, 0x7f, 0x8b, 0x4c, 0x11, 0x87, 0x0e, 0x00, 0x62, 0x99, 0xbf, - 0x17, 0xbc, 0xe6, 0x12, 0x89, 0x4b, 0x4f, 0x20, 0x88, 0x65, 0xfe, 0xa6, 0xae, 0xb1, 0xca, 0x48, - 0x8f, 0x7e, 0x0e, 0x67, 0x6d, 0x9a, 0xa0, 0xac, 0x79, 0x25, 0x91, 0xf4, 0x29, 0x85, 0x41, 0x2c, - 0xf3, 0x04, 0x7f, 0x5d, 0xa3, 0x54, 0x3f, 0x73, 0x85, 0xe4, 0x90, 0x7e, 0x01, 0x2f, 0xf6, 0xb1, - 0xb6, 0xfe, 0x48, 0x93, 0x8e, 0x65, 0xde, 0x5c, 0x0a, 0xf1, 0x28, 0x81, 0x63, 0xcd, 0x07, 0x99, - 0x50, 0x77, 0x9a, 0x88, 0x4f, 0x23, 0x38, 0xef, 0x22, 0xed, 0xe3, 0xc0, 0x0e, 0xfb, 0x58, 0x09, - 0x64, 0xe9, 0x92, 0xdd, 0xad, 0x90, 0x00, 0x3d, 0x83, 0x13, 0xdb, 0x50, 0x9b, 0xb8, 0x96, 0x24, - 0xb4, 0x65, 0xd3, 0x25, 0xa6, 0xf7, 0x3f, 0xad, 0xb9, 0x58, 0x97, 0xe4, 0xd8, 0xd2, 0x9f, 0x09, - 0x56, 0xc9, 0x05, 0x8a, 0x1f, 0x91, 0x65, 0x28, 0xc8, 0x89, 0x7d, 0x3d, 0x2b, 0x4a, 0xe4, 0x6b, - 0x75, 0xcb, 0x7f, 0x23, 0x03, 0x4b, 0x28, 0x41, 0x96, 0xbd, 0xd3, 0xbf, 0x19, 0x72, 0x4a, 0xcf, - 0x81, 0x74, 0x11, 0x4d, 0x88, 0x10, 0xdb, 0xd1, 0x6e, 0xf9, 0x5e, 0xa0, 0x59, 0xfe, 0x8c, 0x7e, - 0x09, 0x17, 0xcf, 0xe0, 0x76, 0x05, 0x7a, 0xf5, 0x0a, 0x06, 0xfb, 0x27, 0xa1, 0x4d, 0x78, 0x93, - 0x65, 0xb7, 0x3c, 0x43, 0x72, 0xa0, 0x4d, 0x48, 0xb0, 0xe4, 0x1b, 0x34, 0xb9, 0xf3, 0xf6, 0xea, - 0xaf, 0xa7, 0x4b, 0xe7, 0xef, 0xa7, 0x4b, 0xe7, 0x9f, 0xa7, 0x4b, 0xe7, 0xcf, 0x7f, 0x2f, 0x0f, - 0x20, 0x4a, 0x79, 0x39, 0xa9, 0x8b, 0x2a, 0x4f, 0x59, 0x3d, 0x51, 0xc5, 0xfd, 0x66, 0x72, 0xbf, - 0x31, 0xff, 0xe6, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0x3a, 0xd7, 0x7c, 0x3c, 0xdd, 0x05, 0x00, - 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/errorpb/errorpb.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/errorpb/errorpb.pb.go deleted file mode 100644 index 0fd66ab25a3..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/pkg/errorpb/errorpb.pb.go +++ /dev/null @@ -1,2027 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: errorpb.proto -// DO NOT EDIT! - -/* - Package errorpb is a generated protocol buffer package. - - It is generated from these files: - errorpb.proto - - It has these top-level messages: - NotLeader - StoreNotMatch - RegionNotFound - KeyNotInRegion - StaleEpoch - ServerIsBusy - StaleCommand - RaftEntryTooLarge - Error -*/ -package errorpb - -import ( - "fmt" - "io" - "math" - - proto "github.com/golang/protobuf/proto" - - metapb "github.com/pingcap/kvproto/pkg/metapb" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type NotLeader struct { - RegionId *uint64 `protobuf:"varint,1,opt,name=region_id,json=regionId" json:"region_id,omitempty"` - Leader *metapb.Peer `protobuf:"bytes,2,opt,name=leader" json:"leader,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *NotLeader) Reset() { *m = NotLeader{} } -func (m *NotLeader) String() string { return proto.CompactTextString(m) } -func (*NotLeader) ProtoMessage() {} -func (*NotLeader) Descriptor() ([]byte, []int) { return fileDescriptorErrorpb, []int{0} } - -func (m *NotLeader) GetRegionId() uint64 { - if m != nil && m.RegionId != nil { - return *m.RegionId - } - return 0 -} - -func (m *NotLeader) GetLeader() *metapb.Peer { - if m != nil { - return m.Leader - } - return nil -} - -type StoreNotMatch struct { - XXX_unrecognized []byte `json:"-"` -} - -func (m *StoreNotMatch) Reset() { *m = StoreNotMatch{} } -func (m *StoreNotMatch) String() string { return proto.CompactTextString(m) } -func (*StoreNotMatch) ProtoMessage() {} -func (*StoreNotMatch) Descriptor() ([]byte, []int) { return fileDescriptorErrorpb, []int{1} } - -type RegionNotFound struct { - RegionId *uint64 `protobuf:"varint,1,opt,name=region_id,json=regionId" json:"region_id,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *RegionNotFound) Reset() { *m = RegionNotFound{} } -func (m *RegionNotFound) String() string { return proto.CompactTextString(m) } -func (*RegionNotFound) ProtoMessage() {} -func (*RegionNotFound) Descriptor() ([]byte, []int) { return fileDescriptorErrorpb, []int{2} } - -func (m *RegionNotFound) GetRegionId() uint64 { - if m != nil && m.RegionId != nil { - return *m.RegionId - } - return 0 -} - -type KeyNotInRegion struct { - Key []byte `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` - RegionId *uint64 `protobuf:"varint,2,opt,name=region_id,json=regionId" json:"region_id,omitempty"` - StartKey []byte `protobuf:"bytes,3,opt,name=start_key,json=startKey" json:"start_key,omitempty"` - EndKey []byte `protobuf:"bytes,4,opt,name=end_key,json=endKey" json:"end_key,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *KeyNotInRegion) Reset() { *m = KeyNotInRegion{} } -func (m *KeyNotInRegion) String() string { return proto.CompactTextString(m) } -func (*KeyNotInRegion) ProtoMessage() {} -func (*KeyNotInRegion) Descriptor() ([]byte, []int) { return fileDescriptorErrorpb, []int{3} } - -func (m *KeyNotInRegion) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *KeyNotInRegion) GetRegionId() uint64 { - if m != nil && m.RegionId != nil { - return *m.RegionId - } - return 0 -} - -func (m *KeyNotInRegion) GetStartKey() []byte { - if m != nil { - return m.StartKey - } - return nil -} - -func (m *KeyNotInRegion) GetEndKey() []byte { - if m != nil { - return m.EndKey - } - return nil -} - -type StaleEpoch struct { - NewRegions []*metapb.Region `protobuf:"bytes,1,rep,name=new_regions,json=newRegions" json:"new_regions,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *StaleEpoch) Reset() { *m = StaleEpoch{} } -func (m *StaleEpoch) String() string { return proto.CompactTextString(m) } -func (*StaleEpoch) ProtoMessage() {} -func (*StaleEpoch) Descriptor() ([]byte, []int) { return fileDescriptorErrorpb, []int{4} } - -func (m *StaleEpoch) GetNewRegions() []*metapb.Region { - if m != nil { - return m.NewRegions - } - return nil -} - -type ServerIsBusy struct { - Reason *string `protobuf:"bytes,1,opt,name=reason" json:"reason,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *ServerIsBusy) Reset() { *m = ServerIsBusy{} } -func (m *ServerIsBusy) String() string { return proto.CompactTextString(m) } -func (*ServerIsBusy) ProtoMessage() {} -func (*ServerIsBusy) Descriptor() ([]byte, []int) { return fileDescriptorErrorpb, []int{5} } - -func (m *ServerIsBusy) GetReason() string { - if m != nil && m.Reason != nil { - return *m.Reason - } - return "" -} - -type StaleCommand struct { - XXX_unrecognized []byte `json:"-"` -} - -func (m *StaleCommand) Reset() { *m = StaleCommand{} } -func (m *StaleCommand) String() string { return proto.CompactTextString(m) } -func (*StaleCommand) ProtoMessage() {} -func (*StaleCommand) Descriptor() ([]byte, []int) { return fileDescriptorErrorpb, []int{6} } - -type RaftEntryTooLarge struct { - RegionId *uint64 `protobuf:"varint,1,opt,name=region_id,json=regionId" json:"region_id,omitempty"` - EntrySize *uint64 `protobuf:"varint,2,opt,name=entry_size,json=entrySize" json:"entry_size,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *RaftEntryTooLarge) Reset() { *m = RaftEntryTooLarge{} } -func (m *RaftEntryTooLarge) String() string { return proto.CompactTextString(m) } -func (*RaftEntryTooLarge) ProtoMessage() {} -func (*RaftEntryTooLarge) Descriptor() ([]byte, []int) { return fileDescriptorErrorpb, []int{7} } - -func (m *RaftEntryTooLarge) GetRegionId() uint64 { - if m != nil && m.RegionId != nil { - return *m.RegionId - } - return 0 -} - -func (m *RaftEntryTooLarge) GetEntrySize() uint64 { - if m != nil && m.EntrySize != nil { - return *m.EntrySize - } - return 0 -} - -type Error struct { - Message *string `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"` - NotLeader *NotLeader `protobuf:"bytes,2,opt,name=not_leader,json=notLeader" json:"not_leader,omitempty"` - RegionNotFound *RegionNotFound `protobuf:"bytes,3,opt,name=region_not_found,json=regionNotFound" json:"region_not_found,omitempty"` - KeyNotInRegion *KeyNotInRegion `protobuf:"bytes,4,opt,name=key_not_in_region,json=keyNotInRegion" json:"key_not_in_region,omitempty"` - StaleEpoch *StaleEpoch `protobuf:"bytes,5,opt,name=stale_epoch,json=staleEpoch" json:"stale_epoch,omitempty"` - ServerIsBusy *ServerIsBusy `protobuf:"bytes,6,opt,name=server_is_busy,json=serverIsBusy" json:"server_is_busy,omitempty"` - StaleCommand *StaleCommand `protobuf:"bytes,7,opt,name=stale_command,json=staleCommand" json:"stale_command,omitempty"` - StoreNotMatch *StoreNotMatch `protobuf:"bytes,8,opt,name=store_not_match,json=storeNotMatch" json:"store_not_match,omitempty"` - RaftEntryTooLarge *RaftEntryTooLarge `protobuf:"bytes,9,opt,name=raft_entry_too_large,json=raftEntryTooLarge" json:"raft_entry_too_large,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Error) Reset() { *m = Error{} } -func (m *Error) String() string { return proto.CompactTextString(m) } -func (*Error) ProtoMessage() {} -func (*Error) Descriptor() ([]byte, []int) { return fileDescriptorErrorpb, []int{8} } - -func (m *Error) GetMessage() string { - if m != nil && m.Message != nil { - return *m.Message - } - return "" -} - -func (m *Error) GetNotLeader() *NotLeader { - if m != nil { - return m.NotLeader - } - return nil -} - -func (m *Error) GetRegionNotFound() *RegionNotFound { - if m != nil { - return m.RegionNotFound - } - return nil -} - -func (m *Error) GetKeyNotInRegion() *KeyNotInRegion { - if m != nil { - return m.KeyNotInRegion - } - return nil -} - -func (m *Error) GetStaleEpoch() *StaleEpoch { - if m != nil { - return m.StaleEpoch - } - return nil -} - -func (m *Error) GetServerIsBusy() *ServerIsBusy { - if m != nil { - return m.ServerIsBusy - } - return nil -} - -func (m *Error) GetStaleCommand() *StaleCommand { - if m != nil { - return m.StaleCommand - } - return nil -} - -func (m *Error) GetStoreNotMatch() *StoreNotMatch { - if m != nil { - return m.StoreNotMatch - } - return nil -} - -func (m *Error) GetRaftEntryTooLarge() *RaftEntryTooLarge { - if m != nil { - return m.RaftEntryTooLarge - } - return nil -} - -func init() { - proto.RegisterType((*NotLeader)(nil), "errorpb.NotLeader") - proto.RegisterType((*StoreNotMatch)(nil), "errorpb.StoreNotMatch") - proto.RegisterType((*RegionNotFound)(nil), "errorpb.RegionNotFound") - proto.RegisterType((*KeyNotInRegion)(nil), "errorpb.KeyNotInRegion") - proto.RegisterType((*StaleEpoch)(nil), "errorpb.StaleEpoch") - proto.RegisterType((*ServerIsBusy)(nil), "errorpb.ServerIsBusy") - proto.RegisterType((*StaleCommand)(nil), "errorpb.StaleCommand") - proto.RegisterType((*RaftEntryTooLarge)(nil), "errorpb.RaftEntryTooLarge") - proto.RegisterType((*Error)(nil), "errorpb.Error") -} -func (m *NotLeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NotLeader) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionId != nil { - dAtA[i] = 0x8 - i++ - i = encodeVarintErrorpb(dAtA, i, uint64(*m.RegionId)) - } - if m.Leader != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintErrorpb(dAtA, i, uint64(m.Leader.Size())) - n1, err := m.Leader.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *StoreNotMatch) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StoreNotMatch) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *RegionNotFound) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RegionNotFound) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionId != nil { - dAtA[i] = 0x8 - i++ - i = encodeVarintErrorpb(dAtA, i, uint64(*m.RegionId)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *KeyNotInRegion) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *KeyNotInRegion) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Key != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintErrorpb(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - if m.RegionId != nil { - dAtA[i] = 0x10 - i++ - i = encodeVarintErrorpb(dAtA, i, uint64(*m.RegionId)) - } - if m.StartKey != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintErrorpb(dAtA, i, uint64(len(m.StartKey))) - i += copy(dAtA[i:], m.StartKey) - } - if m.EndKey != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintErrorpb(dAtA, i, uint64(len(m.EndKey))) - i += copy(dAtA[i:], m.EndKey) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *StaleEpoch) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StaleEpoch) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.NewRegions) > 0 { - for _, msg := range m.NewRegions { - dAtA[i] = 0xa - i++ - i = encodeVarintErrorpb(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *ServerIsBusy) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ServerIsBusy) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Reason != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintErrorpb(dAtA, i, uint64(len(*m.Reason))) - i += copy(dAtA[i:], *m.Reason) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *StaleCommand) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StaleCommand) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *RaftEntryTooLarge) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RaftEntryTooLarge) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionId != nil { - dAtA[i] = 0x8 - i++ - i = encodeVarintErrorpb(dAtA, i, uint64(*m.RegionId)) - } - if m.EntrySize != nil { - dAtA[i] = 0x10 - i++ - i = encodeVarintErrorpb(dAtA, i, uint64(*m.EntrySize)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Error) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Error) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Message != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintErrorpb(dAtA, i, uint64(len(*m.Message))) - i += copy(dAtA[i:], *m.Message) - } - if m.NotLeader != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintErrorpb(dAtA, i, uint64(m.NotLeader.Size())) - n2, err := m.NotLeader.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 - } - if m.RegionNotFound != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintErrorpb(dAtA, i, uint64(m.RegionNotFound.Size())) - n3, err := m.RegionNotFound.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n3 - } - if m.KeyNotInRegion != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintErrorpb(dAtA, i, uint64(m.KeyNotInRegion.Size())) - n4, err := m.KeyNotInRegion.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n4 - } - if m.StaleEpoch != nil { - dAtA[i] = 0x2a - i++ - i = encodeVarintErrorpb(dAtA, i, uint64(m.StaleEpoch.Size())) - n5, err := m.StaleEpoch.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n5 - } - if m.ServerIsBusy != nil { - dAtA[i] = 0x32 - i++ - i = encodeVarintErrorpb(dAtA, i, uint64(m.ServerIsBusy.Size())) - n6, err := m.ServerIsBusy.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n6 - } - if m.StaleCommand != nil { - dAtA[i] = 0x3a - i++ - i = encodeVarintErrorpb(dAtA, i, uint64(m.StaleCommand.Size())) - n7, err := m.StaleCommand.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n7 - } - if m.StoreNotMatch != nil { - dAtA[i] = 0x42 - i++ - i = encodeVarintErrorpb(dAtA, i, uint64(m.StoreNotMatch.Size())) - n8, err := m.StoreNotMatch.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n8 - } - if m.RaftEntryTooLarge != nil { - dAtA[i] = 0x4a - i++ - i = encodeVarintErrorpb(dAtA, i, uint64(m.RaftEntryTooLarge.Size())) - n9, err := m.RaftEntryTooLarge.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n9 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func encodeFixed64Errorpb(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Errorpb(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintErrorpb(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *NotLeader) Size() (n int) { - var l int - _ = l - if m.RegionId != nil { - n += 1 + sovErrorpb(uint64(*m.RegionId)) - } - if m.Leader != nil { - l = m.Leader.Size() - n += 1 + l + sovErrorpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *StoreNotMatch) Size() (n int) { - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RegionNotFound) Size() (n int) { - var l int - _ = l - if m.RegionId != nil { - n += 1 + sovErrorpb(uint64(*m.RegionId)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *KeyNotInRegion) Size() (n int) { - var l int - _ = l - if m.Key != nil { - l = len(m.Key) - n += 1 + l + sovErrorpb(uint64(l)) - } - if m.RegionId != nil { - n += 1 + sovErrorpb(uint64(*m.RegionId)) - } - if m.StartKey != nil { - l = len(m.StartKey) - n += 1 + l + sovErrorpb(uint64(l)) - } - if m.EndKey != nil { - l = len(m.EndKey) - n += 1 + l + sovErrorpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *StaleEpoch) Size() (n int) { - var l int - _ = l - if len(m.NewRegions) > 0 { - for _, e := range m.NewRegions { - l = e.Size() - n += 1 + l + sovErrorpb(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ServerIsBusy) Size() (n int) { - var l int - _ = l - if m.Reason != nil { - l = len(*m.Reason) - n += 1 + l + sovErrorpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *StaleCommand) Size() (n int) { - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RaftEntryTooLarge) Size() (n int) { - var l int - _ = l - if m.RegionId != nil { - n += 1 + sovErrorpb(uint64(*m.RegionId)) - } - if m.EntrySize != nil { - n += 1 + sovErrorpb(uint64(*m.EntrySize)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Error) Size() (n int) { - var l int - _ = l - if m.Message != nil { - l = len(*m.Message) - n += 1 + l + sovErrorpb(uint64(l)) - } - if m.NotLeader != nil { - l = m.NotLeader.Size() - n += 1 + l + sovErrorpb(uint64(l)) - } - if m.RegionNotFound != nil { - l = m.RegionNotFound.Size() - n += 1 + l + sovErrorpb(uint64(l)) - } - if m.KeyNotInRegion != nil { - l = m.KeyNotInRegion.Size() - n += 1 + l + sovErrorpb(uint64(l)) - } - if m.StaleEpoch != nil { - l = m.StaleEpoch.Size() - n += 1 + l + sovErrorpb(uint64(l)) - } - if m.ServerIsBusy != nil { - l = m.ServerIsBusy.Size() - n += 1 + l + sovErrorpb(uint64(l)) - } - if m.StaleCommand != nil { - l = m.StaleCommand.Size() - n += 1 + l + sovErrorpb(uint64(l)) - } - if m.StoreNotMatch != nil { - l = m.StoreNotMatch.Size() - n += 1 + l + sovErrorpb(uint64(l)) - } - if m.RaftEntryTooLarge != nil { - l = m.RaftEntryTooLarge.Size() - n += 1 + l + sovErrorpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovErrorpb(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozErrorpb(x uint64) (n int) { - return sovErrorpb(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *NotLeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NotLeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NotLeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionId", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.RegionId = &v - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Leader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthErrorpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Leader == nil { - m.Leader = &metapb.Peer{} - } - if err := m.Leader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipErrorpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthErrorpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *StoreNotMatch) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StoreNotMatch: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StoreNotMatch: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipErrorpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthErrorpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RegionNotFound) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RegionNotFound: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RegionNotFound: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionId", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.RegionId = &v - default: - iNdEx = preIndex - skippy, err := skipErrorpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthErrorpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *KeyNotInRegion) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: KeyNotInRegion: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: KeyNotInRegion: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthErrorpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionId", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.RegionId = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StartKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthErrorpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StartKey = append(m.StartKey[:0], dAtA[iNdEx:postIndex]...) - if m.StartKey == nil { - m.StartKey = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EndKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthErrorpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.EndKey = append(m.EndKey[:0], dAtA[iNdEx:postIndex]...) - if m.EndKey == nil { - m.EndKey = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipErrorpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthErrorpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *StaleEpoch) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StaleEpoch: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StaleEpoch: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NewRegions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthErrorpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NewRegions = append(m.NewRegions, &metapb.Region{}) - if err := m.NewRegions[len(m.NewRegions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipErrorpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthErrorpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ServerIsBusy) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ServerIsBusy: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ServerIsBusy: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reason", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthErrorpb - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Reason = &s - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipErrorpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthErrorpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *StaleCommand) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StaleCommand: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StaleCommand: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipErrorpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthErrorpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RaftEntryTooLarge) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RaftEntryTooLarge: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RaftEntryTooLarge: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionId", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.RegionId = &v - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EntrySize", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.EntrySize = &v - default: - iNdEx = preIndex - skippy, err := skipErrorpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthErrorpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Error) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Error: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Error: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthErrorpb - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Message = &s - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NotLeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthErrorpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.NotLeader == nil { - m.NotLeader = &NotLeader{} - } - if err := m.NotLeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionNotFound", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthErrorpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionNotFound == nil { - m.RegionNotFound = &RegionNotFound{} - } - if err := m.RegionNotFound.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field KeyNotInRegion", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthErrorpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.KeyNotInRegion == nil { - m.KeyNotInRegion = &KeyNotInRegion{} - } - if err := m.KeyNotInRegion.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StaleEpoch", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthErrorpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.StaleEpoch == nil { - m.StaleEpoch = &StaleEpoch{} - } - if err := m.StaleEpoch.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServerIsBusy", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthErrorpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ServerIsBusy == nil { - m.ServerIsBusy = &ServerIsBusy{} - } - if err := m.ServerIsBusy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StaleCommand", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthErrorpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.StaleCommand == nil { - m.StaleCommand = &StaleCommand{} - } - if err := m.StaleCommand.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StoreNotMatch", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthErrorpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.StoreNotMatch == nil { - m.StoreNotMatch = &StoreNotMatch{} - } - if err := m.StoreNotMatch.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RaftEntryTooLarge", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowErrorpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthErrorpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RaftEntryTooLarge == nil { - m.RaftEntryTooLarge = &RaftEntryTooLarge{} - } - if err := m.RaftEntryTooLarge.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipErrorpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthErrorpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipErrorpb(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowErrorpb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowErrorpb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowErrorpb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthErrorpb - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowErrorpb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipErrorpb(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthErrorpb = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowErrorpb = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("errorpb.proto", fileDescriptorErrorpb) } - -var fileDescriptorErrorpb = []byte{ - // 583 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x94, 0xdf, 0x6f, 0xd3, 0x30, - 0x10, 0xc7, 0xc9, 0x7e, 0xb4, 0xcb, 0x35, 0xcd, 0x36, 0x33, 0xb6, 0x68, 0x13, 0xd5, 0x14, 0x21, - 0x34, 0x21, 0x91, 0x89, 0x89, 0x27, 0x10, 0x48, 0x0c, 0x0d, 0x69, 0xea, 0x28, 0xc8, 0xe5, 0x3d, - 0xf2, 0x9a, 0x5b, 0x16, 0x75, 0xb1, 0x2b, 0xdb, 0xdd, 0x94, 0xfd, 0x23, 0xf0, 0x27, 0xf1, 0xc8, - 0x9f, 0x80, 0xc6, 0x3f, 0x82, 0xec, 0xa4, 0x6d, 0xd2, 0x87, 0xbd, 0xdd, 0x9d, 0xfd, 0x3d, 0x9f, - 0xef, 0x73, 0x36, 0x74, 0x51, 0x4a, 0x21, 0x27, 0x97, 0xd1, 0x44, 0x0a, 0x2d, 0x48, 0xbb, 0x72, - 0xf7, 0xbd, 0x1c, 0x35, 0x9b, 0x85, 0xf7, 0x77, 0x52, 0x91, 0x0a, 0x6b, 0x1e, 0x1b, 0xab, 0x8c, - 0x86, 0x03, 0x70, 0x07, 0x42, 0x5f, 0x20, 0x4b, 0x50, 0x92, 0x03, 0x70, 0x25, 0xa6, 0x99, 0xe0, - 0x71, 0x96, 0x04, 0xce, 0xa1, 0x73, 0xb4, 0x46, 0x37, 0xca, 0xc0, 0x79, 0x42, 0x5e, 0x40, 0xeb, - 0xc6, 0x6e, 0x0b, 0x56, 0x0e, 0x9d, 0xa3, 0xce, 0x89, 0x17, 0x55, 0xe9, 0xbf, 0x23, 0x4a, 0x5a, - 0xad, 0x85, 0x9b, 0xd0, 0x1d, 0x6a, 0x21, 0x71, 0x20, 0xf4, 0x57, 0xa6, 0x47, 0xd7, 0xe1, 0x6b, - 0xf0, 0xa9, 0x4d, 0x31, 0x10, 0xfa, 0x8b, 0x98, 0xf2, 0xe4, 0xd1, 0x53, 0xc2, 0x29, 0xf8, 0x7d, - 0x2c, 0x06, 0x42, 0x9f, 0xf3, 0x52, 0x46, 0xb6, 0x60, 0x75, 0x8c, 0x85, 0xdd, 0xe8, 0x51, 0x63, - 0x36, 0x13, 0xac, 0x2c, 0x95, 0x79, 0x00, 0xae, 0xd2, 0x4c, 0xea, 0xd8, 0x88, 0x56, 0xad, 0x68, - 0xc3, 0x06, 0xfa, 0x58, 0x90, 0x3d, 0x68, 0x23, 0x4f, 0xec, 0xd2, 0x9a, 0x5d, 0x6a, 0x21, 0x4f, - 0xfa, 0x58, 0x84, 0x1f, 0x00, 0x86, 0x9a, 0xdd, 0xe0, 0xd9, 0x44, 0x8c, 0xae, 0xc9, 0x31, 0x74, - 0x38, 0xde, 0xc5, 0x65, 0x4e, 0x15, 0x38, 0x87, 0xab, 0x47, 0x9d, 0x13, 0x7f, 0x76, 0xdf, 0xb2, - 0x2e, 0x0a, 0x1c, 0xef, 0x4a, 0x53, 0x85, 0x2f, 0xc1, 0x1b, 0xa2, 0xbc, 0x45, 0x79, 0xae, 0x4e, - 0xa7, 0xaa, 0x20, 0xbb, 0xd0, 0x92, 0xc8, 0x94, 0xe0, 0xb6, 0x6c, 0x97, 0x56, 0x5e, 0xe8, 0x83, - 0x67, 0x8f, 0xf9, 0x2c, 0xf2, 0x9c, 0xf1, 0x24, 0xfc, 0x06, 0xdb, 0x94, 0x5d, 0xe9, 0x33, 0xae, - 0x65, 0xf1, 0x43, 0x88, 0x0b, 0x26, 0x53, 0x7c, 0x9c, 0xc2, 0x73, 0x00, 0x34, 0xbb, 0x63, 0x95, - 0xdd, 0x63, 0x75, 0x79, 0xd7, 0x46, 0x86, 0xd9, 0x3d, 0x86, 0x3f, 0xd7, 0x60, 0xfd, 0xcc, 0xe0, - 0x27, 0x01, 0xb4, 0x73, 0x54, 0x8a, 0xa5, 0x58, 0xd5, 0x30, 0x73, 0xc9, 0x1b, 0x00, 0x2e, 0x74, - 0xdc, 0x80, 0x49, 0xa2, 0xd9, 0x0c, 0xcd, 0xa7, 0x81, 0xba, 0x7c, 0x3e, 0x18, 0x9f, 0x60, 0xab, - 0x2a, 0xc9, 0x28, 0xaf, 0x0c, 0x46, 0xdb, 0xdb, 0xce, 0xc9, 0xde, 0x5c, 0xd8, 0xa4, 0x4c, 0x7d, - 0xd9, 0xa4, 0x7e, 0x0a, 0xdb, 0x63, 0x2c, 0xac, 0x3e, 0xe3, 0x55, 0x6b, 0x2d, 0x84, 0x7a, 0x8e, - 0x26, 0x7a, 0xea, 0x8f, 0x9b, 0xa3, 0xf0, 0x16, 0x3a, 0xca, 0xb4, 0x2f, 0x46, 0x83, 0x29, 0x58, - 0xb7, 0xea, 0xa7, 0x73, 0xf5, 0x82, 0x20, 0x05, 0xb5, 0xa0, 0xf9, 0x1e, 0x7c, 0x65, 0xe1, 0xc4, - 0x99, 0x8a, 0x2f, 0xa7, 0xaa, 0x08, 0x5a, 0x56, 0xf8, 0x6c, 0x21, 0xac, 0xb1, 0xa3, 0x9e, 0xaa, - 0x93, 0x7c, 0x07, 0xdd, 0xf2, 0xc8, 0x51, 0x89, 0x2c, 0x68, 0x2f, 0x6b, 0x6b, 0x3c, 0xa9, 0xa7, - 0x6a, 0x1e, 0xf9, 0x08, 0x9b, 0xca, 0xbc, 0x05, 0x7b, 0xe9, 0xdc, 0xbc, 0x86, 0x60, 0xc3, 0xaa, - 0x77, 0x6b, 0xea, 0xda, 0x5b, 0xa1, 0x5d, 0x55, 0x77, 0x49, 0x1f, 0x76, 0x24, 0xbb, 0xd2, 0x71, - 0x09, 0x5c, 0x0b, 0x11, 0xdf, 0x98, 0x01, 0x09, 0x5c, 0x9b, 0x64, 0x7f, 0xd1, 0xf9, 0xe5, 0x11, - 0xa2, 0xdb, 0x72, 0x39, 0x74, 0xfa, 0xea, 0xf7, 0x43, 0xcf, 0xf9, 0xf3, 0xd0, 0x73, 0xfe, 0x3e, - 0xf4, 0x9c, 0x5f, 0xff, 0x7a, 0x4f, 0x20, 0x18, 0x89, 0x3c, 0x9a, 0x64, 0x3c, 0x1d, 0xb1, 0x49, - 0xa4, 0xb3, 0xf1, 0x6d, 0x34, 0xbe, 0xb5, 0x9f, 0xc2, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x65, - 0xf5, 0x06, 0x9b, 0x51, 0x04, 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/kvrpcpb/kvrpcpb.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/kvrpcpb/kvrpcpb.pb.go deleted file mode 100644 index 012e6c60d4a..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/pkg/kvrpcpb/kvrpcpb.pb.go +++ /dev/null @@ -1,10053 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: kvrpcpb.proto -// DO NOT EDIT! - -/* - Package kvrpcpb is a generated protocol buffer package. - - It is generated from these files: - kvrpcpb.proto - - It has these top-level messages: - LockInfo - KeyError - Context - GetRequest - GetResponse - ScanRequest - KvPair - ScanResponse - Mutation - PrewriteRequest - PrewriteResponse - CommitRequest - CommitResponse - ImportRequest - ImportResponse - BatchRollbackRequest - BatchRollbackResponse - CleanupRequest - CleanupResponse - BatchGetRequest - BatchGetResponse - ScanLockRequest - ScanLockResponse - ResolveLockRequest - ResolveLockResponse - GCRequest - GCResponse - RawGetRequest - RawGetResponse - RawPutRequest - RawPutResponse - RawDeleteRequest - RawDeleteResponse - DeleteRangeRequest - DeleteRangeResponse - RawScanRequest - RawScanResponse - WriteInfo - ValueInfo - MvccInfo - MvccGetByKeyRequest - MvccGetByKeyResponse - MvccGetByStartTsRequest - MvccGetByStartTsResponse -*/ -package kvrpcpb - -import ( - "fmt" - "io" - "math" - - proto "github.com/golang/protobuf/proto" - - metapb "github.com/pingcap/kvproto/pkg/metapb" - - errorpb "github.com/pingcap/kvproto/pkg/errorpb" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type CommandPri int32 - -const ( - CommandPri_Normal CommandPri = 0 - CommandPri_Low CommandPri = 1 - CommandPri_High CommandPri = 2 -) - -var CommandPri_name = map[int32]string{ - 0: "Normal", - 1: "Low", - 2: "High", -} -var CommandPri_value = map[string]int32{ - "Normal": 0, - "Low": 1, - "High": 2, -} - -func (x CommandPri) String() string { - return proto.EnumName(CommandPri_name, int32(x)) -} -func (CommandPri) EnumDescriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{0} } - -type IsolationLevel int32 - -const ( - IsolationLevel_SI IsolationLevel = 0 - IsolationLevel_RC IsolationLevel = 1 -) - -var IsolationLevel_name = map[int32]string{ - 0: "SI", - 1: "RC", -} -var IsolationLevel_value = map[string]int32{ - "SI": 0, - "RC": 1, -} - -func (x IsolationLevel) String() string { - return proto.EnumName(IsolationLevel_name, int32(x)) -} -func (IsolationLevel) EnumDescriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{1} } - -type Op int32 - -const ( - Op_Put Op = 0 - Op_Del Op = 1 - Op_Lock Op = 2 - Op_Rollback Op = 3 -) - -var Op_name = map[int32]string{ - 0: "Put", - 1: "Del", - 2: "Lock", - 3: "Rollback", -} -var Op_value = map[string]int32{ - "Put": 0, - "Del": 1, - "Lock": 2, - "Rollback": 3, -} - -func (x Op) String() string { - return proto.EnumName(Op_name, int32(x)) -} -func (Op) EnumDescriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{2} } - -type LockInfo struct { - PrimaryLock []byte `protobuf:"bytes,1,opt,name=primary_lock,json=primaryLock,proto3" json:"primary_lock,omitempty"` - LockVersion uint64 `protobuf:"varint,2,opt,name=lock_version,json=lockVersion,proto3" json:"lock_version,omitempty"` - Key []byte `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` - LockTtl uint64 `protobuf:"varint,4,opt,name=lock_ttl,json=lockTtl,proto3" json:"lock_ttl,omitempty"` -} - -func (m *LockInfo) Reset() { *m = LockInfo{} } -func (m *LockInfo) String() string { return proto.CompactTextString(m) } -func (*LockInfo) ProtoMessage() {} -func (*LockInfo) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{0} } - -func (m *LockInfo) GetPrimaryLock() []byte { - if m != nil { - return m.PrimaryLock - } - return nil -} - -func (m *LockInfo) GetLockVersion() uint64 { - if m != nil { - return m.LockVersion - } - return 0 -} - -func (m *LockInfo) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *LockInfo) GetLockTtl() uint64 { - if m != nil { - return m.LockTtl - } - return 0 -} - -type KeyError struct { - Locked *LockInfo `protobuf:"bytes,1,opt,name=locked" json:"locked,omitempty"` - Retryable string `protobuf:"bytes,2,opt,name=retryable,proto3" json:"retryable,omitempty"` - Abort string `protobuf:"bytes,3,opt,name=abort,proto3" json:"abort,omitempty"` -} - -func (m *KeyError) Reset() { *m = KeyError{} } -func (m *KeyError) String() string { return proto.CompactTextString(m) } -func (*KeyError) ProtoMessage() {} -func (*KeyError) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{1} } - -func (m *KeyError) GetLocked() *LockInfo { - if m != nil { - return m.Locked - } - return nil -} - -func (m *KeyError) GetRetryable() string { - if m != nil { - return m.Retryable - } - return "" -} - -func (m *KeyError) GetAbort() string { - if m != nil { - return m.Abort - } - return "" -} - -type Context struct { - RegionId uint64 `protobuf:"varint,1,opt,name=region_id,json=regionId,proto3" json:"region_id,omitempty"` - RegionEpoch *metapb.RegionEpoch `protobuf:"bytes,2,opt,name=region_epoch,json=regionEpoch" json:"region_epoch,omitempty"` - Peer *metapb.Peer `protobuf:"bytes,3,opt,name=peer" json:"peer,omitempty"` - Term uint64 `protobuf:"varint,5,opt,name=term,proto3" json:"term,omitempty"` - Priority CommandPri `protobuf:"varint,6,opt,name=priority,proto3,enum=kvrpcpb.CommandPri" json:"priority,omitempty"` - IsolationLevel IsolationLevel `protobuf:"varint,7,opt,name=isolation_level,json=isolationLevel,proto3,enum=kvrpcpb.IsolationLevel" json:"isolation_level,omitempty"` -} - -func (m *Context) Reset() { *m = Context{} } -func (m *Context) String() string { return proto.CompactTextString(m) } -func (*Context) ProtoMessage() {} -func (*Context) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{2} } - -func (m *Context) GetRegionId() uint64 { - if m != nil { - return m.RegionId - } - return 0 -} - -func (m *Context) GetRegionEpoch() *metapb.RegionEpoch { - if m != nil { - return m.RegionEpoch - } - return nil -} - -func (m *Context) GetPeer() *metapb.Peer { - if m != nil { - return m.Peer - } - return nil -} - -func (m *Context) GetTerm() uint64 { - if m != nil { - return m.Term - } - return 0 -} - -func (m *Context) GetPriority() CommandPri { - if m != nil { - return m.Priority - } - return CommandPri_Normal -} - -func (m *Context) GetIsolationLevel() IsolationLevel { - if m != nil { - return m.IsolationLevel - } - return IsolationLevel_SI -} - -type GetRequest struct { - Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` - Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - Version uint64 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` -} - -func (m *GetRequest) Reset() { *m = GetRequest{} } -func (m *GetRequest) String() string { return proto.CompactTextString(m) } -func (*GetRequest) ProtoMessage() {} -func (*GetRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{3} } - -func (m *GetRequest) GetContext() *Context { - if m != nil { - return m.Context - } - return nil -} - -func (m *GetRequest) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *GetRequest) GetVersion() uint64 { - if m != nil { - return m.Version - } - return 0 -} - -type GetResponse struct { - RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` - Error *KeyError `protobuf:"bytes,2,opt,name=error" json:"error,omitempty"` - Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *GetResponse) Reset() { *m = GetResponse{} } -func (m *GetResponse) String() string { return proto.CompactTextString(m) } -func (*GetResponse) ProtoMessage() {} -func (*GetResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{4} } - -func (m *GetResponse) GetRegionError() *errorpb.Error { - if m != nil { - return m.RegionError - } - return nil -} - -func (m *GetResponse) GetError() *KeyError { - if m != nil { - return m.Error - } - return nil -} - -func (m *GetResponse) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -type ScanRequest struct { - Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` - StartKey []byte `protobuf:"bytes,2,opt,name=start_key,json=startKey,proto3" json:"start_key,omitempty"` - Limit uint32 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` - Version uint64 `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"` - KeyOnly bool `protobuf:"varint,5,opt,name=key_only,json=keyOnly,proto3" json:"key_only,omitempty"` -} - -func (m *ScanRequest) Reset() { *m = ScanRequest{} } -func (m *ScanRequest) String() string { return proto.CompactTextString(m) } -func (*ScanRequest) ProtoMessage() {} -func (*ScanRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{5} } - -func (m *ScanRequest) GetContext() *Context { - if m != nil { - return m.Context - } - return nil -} - -func (m *ScanRequest) GetStartKey() []byte { - if m != nil { - return m.StartKey - } - return nil -} - -func (m *ScanRequest) GetLimit() uint32 { - if m != nil { - return m.Limit - } - return 0 -} - -func (m *ScanRequest) GetVersion() uint64 { - if m != nil { - return m.Version - } - return 0 -} - -func (m *ScanRequest) GetKeyOnly() bool { - if m != nil { - return m.KeyOnly - } - return false -} - -type KvPair struct { - Error *KeyError `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"` - Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *KvPair) Reset() { *m = KvPair{} } -func (m *KvPair) String() string { return proto.CompactTextString(m) } -func (*KvPair) ProtoMessage() {} -func (*KvPair) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{6} } - -func (m *KvPair) GetError() *KeyError { - if m != nil { - return m.Error - } - return nil -} - -func (m *KvPair) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *KvPair) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -type ScanResponse struct { - RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` - Pairs []*KvPair `protobuf:"bytes,2,rep,name=pairs" json:"pairs,omitempty"` -} - -func (m *ScanResponse) Reset() { *m = ScanResponse{} } -func (m *ScanResponse) String() string { return proto.CompactTextString(m) } -func (*ScanResponse) ProtoMessage() {} -func (*ScanResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{7} } - -func (m *ScanResponse) GetRegionError() *errorpb.Error { - if m != nil { - return m.RegionError - } - return nil -} - -func (m *ScanResponse) GetPairs() []*KvPair { - if m != nil { - return m.Pairs - } - return nil -} - -type Mutation struct { - Op Op `protobuf:"varint,1,opt,name=op,proto3,enum=kvrpcpb.Op" json:"op,omitempty"` - Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *Mutation) Reset() { *m = Mutation{} } -func (m *Mutation) String() string { return proto.CompactTextString(m) } -func (*Mutation) ProtoMessage() {} -func (*Mutation) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{8} } - -func (m *Mutation) GetOp() Op { - if m != nil { - return m.Op - } - return Op_Put -} - -func (m *Mutation) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *Mutation) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -type PrewriteRequest struct { - Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` - Mutations []*Mutation `protobuf:"bytes,2,rep,name=mutations" json:"mutations,omitempty"` - // primary_lock_key - PrimaryLock []byte `protobuf:"bytes,3,opt,name=primary_lock,json=primaryLock,proto3" json:"primary_lock,omitempty"` - StartVersion uint64 `protobuf:"varint,4,opt,name=start_version,json=startVersion,proto3" json:"start_version,omitempty"` - LockTtl uint64 `protobuf:"varint,5,opt,name=lock_ttl,json=lockTtl,proto3" json:"lock_ttl,omitempty"` - SkipConstraintCheck bool `protobuf:"varint,6,opt,name=skip_constraint_check,json=skipConstraintCheck,proto3" json:"skip_constraint_check,omitempty"` -} - -func (m *PrewriteRequest) Reset() { *m = PrewriteRequest{} } -func (m *PrewriteRequest) String() string { return proto.CompactTextString(m) } -func (*PrewriteRequest) ProtoMessage() {} -func (*PrewriteRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{9} } - -func (m *PrewriteRequest) GetContext() *Context { - if m != nil { - return m.Context - } - return nil -} - -func (m *PrewriteRequest) GetMutations() []*Mutation { - if m != nil { - return m.Mutations - } - return nil -} - -func (m *PrewriteRequest) GetPrimaryLock() []byte { - if m != nil { - return m.PrimaryLock - } - return nil -} - -func (m *PrewriteRequest) GetStartVersion() uint64 { - if m != nil { - return m.StartVersion - } - return 0 -} - -func (m *PrewriteRequest) GetLockTtl() uint64 { - if m != nil { - return m.LockTtl - } - return 0 -} - -func (m *PrewriteRequest) GetSkipConstraintCheck() bool { - if m != nil { - return m.SkipConstraintCheck - } - return false -} - -type PrewriteResponse struct { - RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` - Errors []*KeyError `protobuf:"bytes,2,rep,name=errors" json:"errors,omitempty"` -} - -func (m *PrewriteResponse) Reset() { *m = PrewriteResponse{} } -func (m *PrewriteResponse) String() string { return proto.CompactTextString(m) } -func (*PrewriteResponse) ProtoMessage() {} -func (*PrewriteResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{10} } - -func (m *PrewriteResponse) GetRegionError() *errorpb.Error { - if m != nil { - return m.RegionError - } - return nil -} - -func (m *PrewriteResponse) GetErrors() []*KeyError { - if m != nil { - return m.Errors - } - return nil -} - -type CommitRequest struct { - Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` - StartVersion uint64 `protobuf:"varint,2,opt,name=start_version,json=startVersion,proto3" json:"start_version,omitempty"` - Keys [][]byte `protobuf:"bytes,3,rep,name=keys" json:"keys,omitempty"` - CommitVersion uint64 `protobuf:"varint,4,opt,name=commit_version,json=commitVersion,proto3" json:"commit_version,omitempty"` -} - -func (m *CommitRequest) Reset() { *m = CommitRequest{} } -func (m *CommitRequest) String() string { return proto.CompactTextString(m) } -func (*CommitRequest) ProtoMessage() {} -func (*CommitRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{11} } - -func (m *CommitRequest) GetContext() *Context { - if m != nil { - return m.Context - } - return nil -} - -func (m *CommitRequest) GetStartVersion() uint64 { - if m != nil { - return m.StartVersion - } - return 0 -} - -func (m *CommitRequest) GetKeys() [][]byte { - if m != nil { - return m.Keys - } - return nil -} - -func (m *CommitRequest) GetCommitVersion() uint64 { - if m != nil { - return m.CommitVersion - } - return 0 -} - -type CommitResponse struct { - RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` - Error *KeyError `protobuf:"bytes,2,opt,name=error" json:"error,omitempty"` -} - -func (m *CommitResponse) Reset() { *m = CommitResponse{} } -func (m *CommitResponse) String() string { return proto.CompactTextString(m) } -func (*CommitResponse) ProtoMessage() {} -func (*CommitResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{12} } - -func (m *CommitResponse) GetRegionError() *errorpb.Error { - if m != nil { - return m.RegionError - } - return nil -} - -func (m *CommitResponse) GetError() *KeyError { - if m != nil { - return m.Error - } - return nil -} - -type ImportRequest struct { - Mutations []*Mutation `protobuf:"bytes,1,rep,name=mutations" json:"mutations,omitempty"` - CommitVersion uint64 `protobuf:"varint,2,opt,name=commit_version,json=commitVersion,proto3" json:"commit_version,omitempty"` -} - -func (m *ImportRequest) Reset() { *m = ImportRequest{} } -func (m *ImportRequest) String() string { return proto.CompactTextString(m) } -func (*ImportRequest) ProtoMessage() {} -func (*ImportRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{13} } - -func (m *ImportRequest) GetMutations() []*Mutation { - if m != nil { - return m.Mutations - } - return nil -} - -func (m *ImportRequest) GetCommitVersion() uint64 { - if m != nil { - return m.CommitVersion - } - return 0 -} - -type ImportResponse struct { - RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` - Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` -} - -func (m *ImportResponse) Reset() { *m = ImportResponse{} } -func (m *ImportResponse) String() string { return proto.CompactTextString(m) } -func (*ImportResponse) ProtoMessage() {} -func (*ImportResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{14} } - -func (m *ImportResponse) GetRegionError() *errorpb.Error { - if m != nil { - return m.RegionError - } - return nil -} - -func (m *ImportResponse) GetError() string { - if m != nil { - return m.Error - } - return "" -} - -type BatchRollbackRequest struct { - Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` - StartVersion uint64 `protobuf:"varint,2,opt,name=start_version,json=startVersion,proto3" json:"start_version,omitempty"` - Keys [][]byte `protobuf:"bytes,3,rep,name=keys" json:"keys,omitempty"` -} - -func (m *BatchRollbackRequest) Reset() { *m = BatchRollbackRequest{} } -func (m *BatchRollbackRequest) String() string { return proto.CompactTextString(m) } -func (*BatchRollbackRequest) ProtoMessage() {} -func (*BatchRollbackRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{15} } - -func (m *BatchRollbackRequest) GetContext() *Context { - if m != nil { - return m.Context - } - return nil -} - -func (m *BatchRollbackRequest) GetStartVersion() uint64 { - if m != nil { - return m.StartVersion - } - return 0 -} - -func (m *BatchRollbackRequest) GetKeys() [][]byte { - if m != nil { - return m.Keys - } - return nil -} - -type BatchRollbackResponse struct { - RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` - Error *KeyError `protobuf:"bytes,2,opt,name=error" json:"error,omitempty"` -} - -func (m *BatchRollbackResponse) Reset() { *m = BatchRollbackResponse{} } -func (m *BatchRollbackResponse) String() string { return proto.CompactTextString(m) } -func (*BatchRollbackResponse) ProtoMessage() {} -func (*BatchRollbackResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{16} } - -func (m *BatchRollbackResponse) GetRegionError() *errorpb.Error { - if m != nil { - return m.RegionError - } - return nil -} - -func (m *BatchRollbackResponse) GetError() *KeyError { - if m != nil { - return m.Error - } - return nil -} - -type CleanupRequest struct { - Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` - Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - StartVersion uint64 `protobuf:"varint,3,opt,name=start_version,json=startVersion,proto3" json:"start_version,omitempty"` -} - -func (m *CleanupRequest) Reset() { *m = CleanupRequest{} } -func (m *CleanupRequest) String() string { return proto.CompactTextString(m) } -func (*CleanupRequest) ProtoMessage() {} -func (*CleanupRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{17} } - -func (m *CleanupRequest) GetContext() *Context { - if m != nil { - return m.Context - } - return nil -} - -func (m *CleanupRequest) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *CleanupRequest) GetStartVersion() uint64 { - if m != nil { - return m.StartVersion - } - return 0 -} - -type CleanupResponse struct { - RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` - Error *KeyError `protobuf:"bytes,2,opt,name=error" json:"error,omitempty"` - CommitVersion uint64 `protobuf:"varint,3,opt,name=commit_version,json=commitVersion,proto3" json:"commit_version,omitempty"` -} - -func (m *CleanupResponse) Reset() { *m = CleanupResponse{} } -func (m *CleanupResponse) String() string { return proto.CompactTextString(m) } -func (*CleanupResponse) ProtoMessage() {} -func (*CleanupResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{18} } - -func (m *CleanupResponse) GetRegionError() *errorpb.Error { - if m != nil { - return m.RegionError - } - return nil -} - -func (m *CleanupResponse) GetError() *KeyError { - if m != nil { - return m.Error - } - return nil -} - -func (m *CleanupResponse) GetCommitVersion() uint64 { - if m != nil { - return m.CommitVersion - } - return 0 -} - -type BatchGetRequest struct { - Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` - Keys [][]byte `protobuf:"bytes,2,rep,name=keys" json:"keys,omitempty"` - Version uint64 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` -} - -func (m *BatchGetRequest) Reset() { *m = BatchGetRequest{} } -func (m *BatchGetRequest) String() string { return proto.CompactTextString(m) } -func (*BatchGetRequest) ProtoMessage() {} -func (*BatchGetRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{19} } - -func (m *BatchGetRequest) GetContext() *Context { - if m != nil { - return m.Context - } - return nil -} - -func (m *BatchGetRequest) GetKeys() [][]byte { - if m != nil { - return m.Keys - } - return nil -} - -func (m *BatchGetRequest) GetVersion() uint64 { - if m != nil { - return m.Version - } - return 0 -} - -type BatchGetResponse struct { - RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` - Pairs []*KvPair `protobuf:"bytes,2,rep,name=pairs" json:"pairs,omitempty"` -} - -func (m *BatchGetResponse) Reset() { *m = BatchGetResponse{} } -func (m *BatchGetResponse) String() string { return proto.CompactTextString(m) } -func (*BatchGetResponse) ProtoMessage() {} -func (*BatchGetResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{20} } - -func (m *BatchGetResponse) GetRegionError() *errorpb.Error { - if m != nil { - return m.RegionError - } - return nil -} - -func (m *BatchGetResponse) GetPairs() []*KvPair { - if m != nil { - return m.Pairs - } - return nil -} - -type ScanLockRequest struct { - Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` - MaxVersion uint64 `protobuf:"varint,2,opt,name=max_version,json=maxVersion,proto3" json:"max_version,omitempty"` -} - -func (m *ScanLockRequest) Reset() { *m = ScanLockRequest{} } -func (m *ScanLockRequest) String() string { return proto.CompactTextString(m) } -func (*ScanLockRequest) ProtoMessage() {} -func (*ScanLockRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{21} } - -func (m *ScanLockRequest) GetContext() *Context { - if m != nil { - return m.Context - } - return nil -} - -func (m *ScanLockRequest) GetMaxVersion() uint64 { - if m != nil { - return m.MaxVersion - } - return 0 -} - -type ScanLockResponse struct { - RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` - Error *KeyError `protobuf:"bytes,2,opt,name=error" json:"error,omitempty"` - Locks []*LockInfo `protobuf:"bytes,3,rep,name=locks" json:"locks,omitempty"` -} - -func (m *ScanLockResponse) Reset() { *m = ScanLockResponse{} } -func (m *ScanLockResponse) String() string { return proto.CompactTextString(m) } -func (*ScanLockResponse) ProtoMessage() {} -func (*ScanLockResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{22} } - -func (m *ScanLockResponse) GetRegionError() *errorpb.Error { - if m != nil { - return m.RegionError - } - return nil -} - -func (m *ScanLockResponse) GetError() *KeyError { - if m != nil { - return m.Error - } - return nil -} - -func (m *ScanLockResponse) GetLocks() []*LockInfo { - if m != nil { - return m.Locks - } - return nil -} - -type ResolveLockRequest struct { - Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` - StartVersion uint64 `protobuf:"varint,2,opt,name=start_version,json=startVersion,proto3" json:"start_version,omitempty"` - // If the txn is rolled back, do not set it. - CommitVersion uint64 `protobuf:"varint,3,opt,name=commit_version,json=commitVersion,proto3" json:"commit_version,omitempty"` -} - -func (m *ResolveLockRequest) Reset() { *m = ResolveLockRequest{} } -func (m *ResolveLockRequest) String() string { return proto.CompactTextString(m) } -func (*ResolveLockRequest) ProtoMessage() {} -func (*ResolveLockRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{23} } - -func (m *ResolveLockRequest) GetContext() *Context { - if m != nil { - return m.Context - } - return nil -} - -func (m *ResolveLockRequest) GetStartVersion() uint64 { - if m != nil { - return m.StartVersion - } - return 0 -} - -func (m *ResolveLockRequest) GetCommitVersion() uint64 { - if m != nil { - return m.CommitVersion - } - return 0 -} - -type ResolveLockResponse struct { - RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` - Error *KeyError `protobuf:"bytes,2,opt,name=error" json:"error,omitempty"` -} - -func (m *ResolveLockResponse) Reset() { *m = ResolveLockResponse{} } -func (m *ResolveLockResponse) String() string { return proto.CompactTextString(m) } -func (*ResolveLockResponse) ProtoMessage() {} -func (*ResolveLockResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{24} } - -func (m *ResolveLockResponse) GetRegionError() *errorpb.Error { - if m != nil { - return m.RegionError - } - return nil -} - -func (m *ResolveLockResponse) GetError() *KeyError { - if m != nil { - return m.Error - } - return nil -} - -type GCRequest struct { - Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` - SafePoint uint64 `protobuf:"varint,2,opt,name=safe_point,json=safePoint,proto3" json:"safe_point,omitempty"` -} - -func (m *GCRequest) Reset() { *m = GCRequest{} } -func (m *GCRequest) String() string { return proto.CompactTextString(m) } -func (*GCRequest) ProtoMessage() {} -func (*GCRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{25} } - -func (m *GCRequest) GetContext() *Context { - if m != nil { - return m.Context - } - return nil -} - -func (m *GCRequest) GetSafePoint() uint64 { - if m != nil { - return m.SafePoint - } - return 0 -} - -type GCResponse struct { - RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` - Error *KeyError `protobuf:"bytes,2,opt,name=error" json:"error,omitempty"` -} - -func (m *GCResponse) Reset() { *m = GCResponse{} } -func (m *GCResponse) String() string { return proto.CompactTextString(m) } -func (*GCResponse) ProtoMessage() {} -func (*GCResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{26} } - -func (m *GCResponse) GetRegionError() *errorpb.Error { - if m != nil { - return m.RegionError - } - return nil -} - -func (m *GCResponse) GetError() *KeyError { - if m != nil { - return m.Error - } - return nil -} - -type RawGetRequest struct { - Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` - Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` -} - -func (m *RawGetRequest) Reset() { *m = RawGetRequest{} } -func (m *RawGetRequest) String() string { return proto.CompactTextString(m) } -func (*RawGetRequest) ProtoMessage() {} -func (*RawGetRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{27} } - -func (m *RawGetRequest) GetContext() *Context { - if m != nil { - return m.Context - } - return nil -} - -func (m *RawGetRequest) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -type RawGetResponse struct { - RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` - Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` - Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *RawGetResponse) Reset() { *m = RawGetResponse{} } -func (m *RawGetResponse) String() string { return proto.CompactTextString(m) } -func (*RawGetResponse) ProtoMessage() {} -func (*RawGetResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{28} } - -func (m *RawGetResponse) GetRegionError() *errorpb.Error { - if m != nil { - return m.RegionError - } - return nil -} - -func (m *RawGetResponse) GetError() string { - if m != nil { - return m.Error - } - return "" -} - -func (m *RawGetResponse) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -type RawPutRequest struct { - Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` - Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *RawPutRequest) Reset() { *m = RawPutRequest{} } -func (m *RawPutRequest) String() string { return proto.CompactTextString(m) } -func (*RawPutRequest) ProtoMessage() {} -func (*RawPutRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{29} } - -func (m *RawPutRequest) GetContext() *Context { - if m != nil { - return m.Context - } - return nil -} - -func (m *RawPutRequest) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *RawPutRequest) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -type RawPutResponse struct { - RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` - Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` -} - -func (m *RawPutResponse) Reset() { *m = RawPutResponse{} } -func (m *RawPutResponse) String() string { return proto.CompactTextString(m) } -func (*RawPutResponse) ProtoMessage() {} -func (*RawPutResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{30} } - -func (m *RawPutResponse) GetRegionError() *errorpb.Error { - if m != nil { - return m.RegionError - } - return nil -} - -func (m *RawPutResponse) GetError() string { - if m != nil { - return m.Error - } - return "" -} - -type RawDeleteRequest struct { - Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` - Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` -} - -func (m *RawDeleteRequest) Reset() { *m = RawDeleteRequest{} } -func (m *RawDeleteRequest) String() string { return proto.CompactTextString(m) } -func (*RawDeleteRequest) ProtoMessage() {} -func (*RawDeleteRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{31} } - -func (m *RawDeleteRequest) GetContext() *Context { - if m != nil { - return m.Context - } - return nil -} - -func (m *RawDeleteRequest) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -type RawDeleteResponse struct { - RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` - Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` -} - -func (m *RawDeleteResponse) Reset() { *m = RawDeleteResponse{} } -func (m *RawDeleteResponse) String() string { return proto.CompactTextString(m) } -func (*RawDeleteResponse) ProtoMessage() {} -func (*RawDeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{32} } - -func (m *RawDeleteResponse) GetRegionError() *errorpb.Error { - if m != nil { - return m.RegionError - } - return nil -} - -func (m *RawDeleteResponse) GetError() string { - if m != nil { - return m.Error - } - return "" -} - -type DeleteRangeRequest struct { - Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` - StartKey []byte `protobuf:"bytes,2,opt,name=start_key,json=startKey,proto3" json:"start_key,omitempty"` - EndKey []byte `protobuf:"bytes,3,opt,name=end_key,json=endKey,proto3" json:"end_key,omitempty"` -} - -func (m *DeleteRangeRequest) Reset() { *m = DeleteRangeRequest{} } -func (m *DeleteRangeRequest) String() string { return proto.CompactTextString(m) } -func (*DeleteRangeRequest) ProtoMessage() {} -func (*DeleteRangeRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{33} } - -func (m *DeleteRangeRequest) GetContext() *Context { - if m != nil { - return m.Context - } - return nil -} - -func (m *DeleteRangeRequest) GetStartKey() []byte { - if m != nil { - return m.StartKey - } - return nil -} - -func (m *DeleteRangeRequest) GetEndKey() []byte { - if m != nil { - return m.EndKey - } - return nil -} - -type DeleteRangeResponse struct { - RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` - Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` -} - -func (m *DeleteRangeResponse) Reset() { *m = DeleteRangeResponse{} } -func (m *DeleteRangeResponse) String() string { return proto.CompactTextString(m) } -func (*DeleteRangeResponse) ProtoMessage() {} -func (*DeleteRangeResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{34} } - -func (m *DeleteRangeResponse) GetRegionError() *errorpb.Error { - if m != nil { - return m.RegionError - } - return nil -} - -func (m *DeleteRangeResponse) GetError() string { - if m != nil { - return m.Error - } - return "" -} - -type RawScanRequest struct { - Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` - StartKey []byte `protobuf:"bytes,2,opt,name=start_key,json=startKey,proto3" json:"start_key,omitempty"` - Limit uint32 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` -} - -func (m *RawScanRequest) Reset() { *m = RawScanRequest{} } -func (m *RawScanRequest) String() string { return proto.CompactTextString(m) } -func (*RawScanRequest) ProtoMessage() {} -func (*RawScanRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{35} } - -func (m *RawScanRequest) GetContext() *Context { - if m != nil { - return m.Context - } - return nil -} - -func (m *RawScanRequest) GetStartKey() []byte { - if m != nil { - return m.StartKey - } - return nil -} - -func (m *RawScanRequest) GetLimit() uint32 { - if m != nil { - return m.Limit - } - return 0 -} - -type RawScanResponse struct { - RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` - Kvs []*KvPair `protobuf:"bytes,2,rep,name=kvs" json:"kvs,omitempty"` -} - -func (m *RawScanResponse) Reset() { *m = RawScanResponse{} } -func (m *RawScanResponse) String() string { return proto.CompactTextString(m) } -func (*RawScanResponse) ProtoMessage() {} -func (*RawScanResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{36} } - -func (m *RawScanResponse) GetRegionError() *errorpb.Error { - if m != nil { - return m.RegionError - } - return nil -} - -func (m *RawScanResponse) GetKvs() []*KvPair { - if m != nil { - return m.Kvs - } - return nil -} - -type WriteInfo struct { - StartTs uint64 `protobuf:"varint,1,opt,name=start_ts,json=startTs,proto3" json:"start_ts,omitempty"` - Type Op `protobuf:"varint,2,opt,name=type,proto3,enum=kvrpcpb.Op" json:"type,omitempty"` - CommitTs uint64 `protobuf:"varint,3,opt,name=commit_ts,json=commitTs,proto3" json:"commit_ts,omitempty"` -} - -func (m *WriteInfo) Reset() { *m = WriteInfo{} } -func (m *WriteInfo) String() string { return proto.CompactTextString(m) } -func (*WriteInfo) ProtoMessage() {} -func (*WriteInfo) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{37} } - -func (m *WriteInfo) GetStartTs() uint64 { - if m != nil { - return m.StartTs - } - return 0 -} - -func (m *WriteInfo) GetType() Op { - if m != nil { - return m.Type - } - return Op_Put -} - -func (m *WriteInfo) GetCommitTs() uint64 { - if m != nil { - return m.CommitTs - } - return 0 -} - -type ValueInfo struct { - Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` - Ts uint64 `protobuf:"varint,2,opt,name=ts,proto3" json:"ts,omitempty"` - IsShortValue bool `protobuf:"varint,3,opt,name=is_short_value,json=isShortValue,proto3" json:"is_short_value,omitempty"` -} - -func (m *ValueInfo) Reset() { *m = ValueInfo{} } -func (m *ValueInfo) String() string { return proto.CompactTextString(m) } -func (*ValueInfo) ProtoMessage() {} -func (*ValueInfo) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{38} } - -func (m *ValueInfo) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -func (m *ValueInfo) GetTs() uint64 { - if m != nil { - return m.Ts - } - return 0 -} - -func (m *ValueInfo) GetIsShortValue() bool { - if m != nil { - return m.IsShortValue - } - return false -} - -type MvccInfo struct { - Lock *LockInfo `protobuf:"bytes,1,opt,name=lock" json:"lock,omitempty"` - Writes []*WriteInfo `protobuf:"bytes,2,rep,name=writes" json:"writes,omitempty"` - Values []*ValueInfo `protobuf:"bytes,3,rep,name=values" json:"values,omitempty"` -} - -func (m *MvccInfo) Reset() { *m = MvccInfo{} } -func (m *MvccInfo) String() string { return proto.CompactTextString(m) } -func (*MvccInfo) ProtoMessage() {} -func (*MvccInfo) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{39} } - -func (m *MvccInfo) GetLock() *LockInfo { - if m != nil { - return m.Lock - } - return nil -} - -func (m *MvccInfo) GetWrites() []*WriteInfo { - if m != nil { - return m.Writes - } - return nil -} - -func (m *MvccInfo) GetValues() []*ValueInfo { - if m != nil { - return m.Values - } - return nil -} - -type MvccGetByKeyRequest struct { - Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` - Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` -} - -func (m *MvccGetByKeyRequest) Reset() { *m = MvccGetByKeyRequest{} } -func (m *MvccGetByKeyRequest) String() string { return proto.CompactTextString(m) } -func (*MvccGetByKeyRequest) ProtoMessage() {} -func (*MvccGetByKeyRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{40} } - -func (m *MvccGetByKeyRequest) GetContext() *Context { - if m != nil { - return m.Context - } - return nil -} - -func (m *MvccGetByKeyRequest) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -type MvccGetByKeyResponse struct { - RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` - Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` - Info *MvccInfo `protobuf:"bytes,3,opt,name=info" json:"info,omitempty"` -} - -func (m *MvccGetByKeyResponse) Reset() { *m = MvccGetByKeyResponse{} } -func (m *MvccGetByKeyResponse) String() string { return proto.CompactTextString(m) } -func (*MvccGetByKeyResponse) ProtoMessage() {} -func (*MvccGetByKeyResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{41} } - -func (m *MvccGetByKeyResponse) GetRegionError() *errorpb.Error { - if m != nil { - return m.RegionError - } - return nil -} - -func (m *MvccGetByKeyResponse) GetError() string { - if m != nil { - return m.Error - } - return "" -} - -func (m *MvccGetByKeyResponse) GetInfo() *MvccInfo { - if m != nil { - return m.Info - } - return nil -} - -type MvccGetByStartTsRequest struct { - Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` - StartTs uint64 `protobuf:"varint,2,opt,name=start_ts,json=startTs,proto3" json:"start_ts,omitempty"` -} - -func (m *MvccGetByStartTsRequest) Reset() { *m = MvccGetByStartTsRequest{} } -func (m *MvccGetByStartTsRequest) String() string { return proto.CompactTextString(m) } -func (*MvccGetByStartTsRequest) ProtoMessage() {} -func (*MvccGetByStartTsRequest) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{42} } - -func (m *MvccGetByStartTsRequest) GetContext() *Context { - if m != nil { - return m.Context - } - return nil -} - -func (m *MvccGetByStartTsRequest) GetStartTs() uint64 { - if m != nil { - return m.StartTs - } - return 0 -} - -type MvccGetByStartTsResponse struct { - RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError" json:"region_error,omitempty"` - Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` - Key []byte `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` - Info *MvccInfo `protobuf:"bytes,4,opt,name=info" json:"info,omitempty"` -} - -func (m *MvccGetByStartTsResponse) Reset() { *m = MvccGetByStartTsResponse{} } -func (m *MvccGetByStartTsResponse) String() string { return proto.CompactTextString(m) } -func (*MvccGetByStartTsResponse) ProtoMessage() {} -func (*MvccGetByStartTsResponse) Descriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{43} } - -func (m *MvccGetByStartTsResponse) GetRegionError() *errorpb.Error { - if m != nil { - return m.RegionError - } - return nil -} - -func (m *MvccGetByStartTsResponse) GetError() string { - if m != nil { - return m.Error - } - return "" -} - -func (m *MvccGetByStartTsResponse) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *MvccGetByStartTsResponse) GetInfo() *MvccInfo { - if m != nil { - return m.Info - } - return nil -} - -func init() { - proto.RegisterType((*LockInfo)(nil), "kvrpcpb.LockInfo") - proto.RegisterType((*KeyError)(nil), "kvrpcpb.KeyError") - proto.RegisterType((*Context)(nil), "kvrpcpb.Context") - proto.RegisterType((*GetRequest)(nil), "kvrpcpb.GetRequest") - proto.RegisterType((*GetResponse)(nil), "kvrpcpb.GetResponse") - proto.RegisterType((*ScanRequest)(nil), "kvrpcpb.ScanRequest") - proto.RegisterType((*KvPair)(nil), "kvrpcpb.KvPair") - proto.RegisterType((*ScanResponse)(nil), "kvrpcpb.ScanResponse") - proto.RegisterType((*Mutation)(nil), "kvrpcpb.Mutation") - proto.RegisterType((*PrewriteRequest)(nil), "kvrpcpb.PrewriteRequest") - proto.RegisterType((*PrewriteResponse)(nil), "kvrpcpb.PrewriteResponse") - proto.RegisterType((*CommitRequest)(nil), "kvrpcpb.CommitRequest") - proto.RegisterType((*CommitResponse)(nil), "kvrpcpb.CommitResponse") - proto.RegisterType((*ImportRequest)(nil), "kvrpcpb.ImportRequest") - proto.RegisterType((*ImportResponse)(nil), "kvrpcpb.ImportResponse") - proto.RegisterType((*BatchRollbackRequest)(nil), "kvrpcpb.BatchRollbackRequest") - proto.RegisterType((*BatchRollbackResponse)(nil), "kvrpcpb.BatchRollbackResponse") - proto.RegisterType((*CleanupRequest)(nil), "kvrpcpb.CleanupRequest") - proto.RegisterType((*CleanupResponse)(nil), "kvrpcpb.CleanupResponse") - proto.RegisterType((*BatchGetRequest)(nil), "kvrpcpb.BatchGetRequest") - proto.RegisterType((*BatchGetResponse)(nil), "kvrpcpb.BatchGetResponse") - proto.RegisterType((*ScanLockRequest)(nil), "kvrpcpb.ScanLockRequest") - proto.RegisterType((*ScanLockResponse)(nil), "kvrpcpb.ScanLockResponse") - proto.RegisterType((*ResolveLockRequest)(nil), "kvrpcpb.ResolveLockRequest") - proto.RegisterType((*ResolveLockResponse)(nil), "kvrpcpb.ResolveLockResponse") - proto.RegisterType((*GCRequest)(nil), "kvrpcpb.GCRequest") - proto.RegisterType((*GCResponse)(nil), "kvrpcpb.GCResponse") - proto.RegisterType((*RawGetRequest)(nil), "kvrpcpb.RawGetRequest") - proto.RegisterType((*RawGetResponse)(nil), "kvrpcpb.RawGetResponse") - proto.RegisterType((*RawPutRequest)(nil), "kvrpcpb.RawPutRequest") - proto.RegisterType((*RawPutResponse)(nil), "kvrpcpb.RawPutResponse") - proto.RegisterType((*RawDeleteRequest)(nil), "kvrpcpb.RawDeleteRequest") - proto.RegisterType((*RawDeleteResponse)(nil), "kvrpcpb.RawDeleteResponse") - proto.RegisterType((*DeleteRangeRequest)(nil), "kvrpcpb.DeleteRangeRequest") - proto.RegisterType((*DeleteRangeResponse)(nil), "kvrpcpb.DeleteRangeResponse") - proto.RegisterType((*RawScanRequest)(nil), "kvrpcpb.RawScanRequest") - proto.RegisterType((*RawScanResponse)(nil), "kvrpcpb.RawScanResponse") - proto.RegisterType((*WriteInfo)(nil), "kvrpcpb.WriteInfo") - proto.RegisterType((*ValueInfo)(nil), "kvrpcpb.ValueInfo") - proto.RegisterType((*MvccInfo)(nil), "kvrpcpb.MvccInfo") - proto.RegisterType((*MvccGetByKeyRequest)(nil), "kvrpcpb.MvccGetByKeyRequest") - proto.RegisterType((*MvccGetByKeyResponse)(nil), "kvrpcpb.MvccGetByKeyResponse") - proto.RegisterType((*MvccGetByStartTsRequest)(nil), "kvrpcpb.MvccGetByStartTsRequest") - proto.RegisterType((*MvccGetByStartTsResponse)(nil), "kvrpcpb.MvccGetByStartTsResponse") - proto.RegisterEnum("kvrpcpb.CommandPri", CommandPri_name, CommandPri_value) - proto.RegisterEnum("kvrpcpb.IsolationLevel", IsolationLevel_name, IsolationLevel_value) - proto.RegisterEnum("kvrpcpb.Op", Op_name, Op_value) -} -func (m *LockInfo) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LockInfo) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.PrimaryLock) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.PrimaryLock))) - i += copy(dAtA[i:], m.PrimaryLock) - } - if m.LockVersion != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.LockVersion)) - } - if len(m.Key) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - if m.LockTtl != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.LockTtl)) - } - return i, nil -} - -func (m *KeyError) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *KeyError) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Locked != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Locked.Size())) - n1, err := m.Locked.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } - if len(m.Retryable) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Retryable))) - i += copy(dAtA[i:], m.Retryable) - } - if len(m.Abort) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Abort))) - i += copy(dAtA[i:], m.Abort) - } - return i, nil -} - -func (m *Context) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Context) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionId != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionId)) - } - if m.RegionEpoch != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionEpoch.Size())) - n2, err := m.RegionEpoch.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 - } - if m.Peer != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Peer.Size())) - n3, err := m.Peer.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n3 - } - if m.Term != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Term)) - } - if m.Priority != 0 { - dAtA[i] = 0x30 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Priority)) - } - if m.IsolationLevel != 0 { - dAtA[i] = 0x38 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.IsolationLevel)) - } - return i, nil -} - -func (m *GetRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Context != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) - n4, err := m.Context.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n4 - } - if len(m.Key) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - if m.Version != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Version)) - } - return i, nil -} - -func (m *GetResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionError != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) - n5, err := m.RegionError.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n5 - } - if m.Error != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Error.Size())) - n6, err := m.Error.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n6 - } - if len(m.Value) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) - } - return i, nil -} - -func (m *ScanRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ScanRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Context != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) - n7, err := m.Context.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n7 - } - if len(m.StartKey) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.StartKey))) - i += copy(dAtA[i:], m.StartKey) - } - if m.Limit != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Limit)) - } - if m.Version != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Version)) - } - if m.KeyOnly { - dAtA[i] = 0x28 - i++ - if m.KeyOnly { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - } - return i, nil -} - -func (m *KvPair) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *KvPair) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Error != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Error.Size())) - n8, err := m.Error.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n8 - } - if len(m.Key) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - if len(m.Value) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) - } - return i, nil -} - -func (m *ScanResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ScanResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionError != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) - n9, err := m.RegionError.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n9 - } - if len(m.Pairs) > 0 { - for _, msg := range m.Pairs { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - return i, nil -} - -func (m *Mutation) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Mutation) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Op != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Op)) - } - if len(m.Key) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - if len(m.Value) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) - } - return i, nil -} - -func (m *PrewriteRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PrewriteRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Context != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) - n10, err := m.Context.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n10 - } - if len(m.Mutations) > 0 { - for _, msg := range m.Mutations { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if len(m.PrimaryLock) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.PrimaryLock))) - i += copy(dAtA[i:], m.PrimaryLock) - } - if m.StartVersion != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.StartVersion)) - } - if m.LockTtl != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.LockTtl)) - } - if m.SkipConstraintCheck { - dAtA[i] = 0x30 - i++ - if m.SkipConstraintCheck { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - } - return i, nil -} - -func (m *PrewriteResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PrewriteResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionError != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) - n11, err := m.RegionError.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n11 - } - if len(m.Errors) > 0 { - for _, msg := range m.Errors { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - return i, nil -} - -func (m *CommitRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CommitRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Context != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) - n12, err := m.Context.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n12 - } - if m.StartVersion != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.StartVersion)) - } - if len(m.Keys) > 0 { - for _, b := range m.Keys { - dAtA[i] = 0x1a - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(b))) - i += copy(dAtA[i:], b) - } - } - if m.CommitVersion != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.CommitVersion)) - } - return i, nil -} - -func (m *CommitResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CommitResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionError != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) - n13, err := m.RegionError.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n13 - } - if m.Error != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Error.Size())) - n14, err := m.Error.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n14 - } - return i, nil -} - -func (m *ImportRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ImportRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Mutations) > 0 { - for _, msg := range m.Mutations { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.CommitVersion != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.CommitVersion)) - } - return i, nil -} - -func (m *ImportResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ImportResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionError != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) - n15, err := m.RegionError.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n15 - } - if len(m.Error) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Error))) - i += copy(dAtA[i:], m.Error) - } - return i, nil -} - -func (m *BatchRollbackRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BatchRollbackRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Context != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) - n16, err := m.Context.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n16 - } - if m.StartVersion != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.StartVersion)) - } - if len(m.Keys) > 0 { - for _, b := range m.Keys { - dAtA[i] = 0x1a - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(b))) - i += copy(dAtA[i:], b) - } - } - return i, nil -} - -func (m *BatchRollbackResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BatchRollbackResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionError != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) - n17, err := m.RegionError.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n17 - } - if m.Error != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Error.Size())) - n18, err := m.Error.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n18 - } - return i, nil -} - -func (m *CleanupRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CleanupRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Context != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) - n19, err := m.Context.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n19 - } - if len(m.Key) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - if m.StartVersion != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.StartVersion)) - } - return i, nil -} - -func (m *CleanupResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CleanupResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionError != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) - n20, err := m.RegionError.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n20 - } - if m.Error != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Error.Size())) - n21, err := m.Error.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n21 - } - if m.CommitVersion != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.CommitVersion)) - } - return i, nil -} - -func (m *BatchGetRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BatchGetRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Context != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) - n22, err := m.Context.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n22 - } - if len(m.Keys) > 0 { - for _, b := range m.Keys { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(b))) - i += copy(dAtA[i:], b) - } - } - if m.Version != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Version)) - } - return i, nil -} - -func (m *BatchGetResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BatchGetResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionError != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) - n23, err := m.RegionError.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n23 - } - if len(m.Pairs) > 0 { - for _, msg := range m.Pairs { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - return i, nil -} - -func (m *ScanLockRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ScanLockRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Context != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) - n24, err := m.Context.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n24 - } - if m.MaxVersion != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.MaxVersion)) - } - return i, nil -} - -func (m *ScanLockResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ScanLockResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionError != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) - n25, err := m.RegionError.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n25 - } - if m.Error != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Error.Size())) - n26, err := m.Error.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n26 - } - if len(m.Locks) > 0 { - for _, msg := range m.Locks { - dAtA[i] = 0x1a - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - return i, nil -} - -func (m *ResolveLockRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ResolveLockRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Context != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) - n27, err := m.Context.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n27 - } - if m.StartVersion != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.StartVersion)) - } - if m.CommitVersion != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.CommitVersion)) - } - return i, nil -} - -func (m *ResolveLockResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ResolveLockResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionError != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) - n28, err := m.RegionError.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n28 - } - if m.Error != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Error.Size())) - n29, err := m.Error.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n29 - } - return i, nil -} - -func (m *GCRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GCRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Context != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) - n30, err := m.Context.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n30 - } - if m.SafePoint != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.SafePoint)) - } - return i, nil -} - -func (m *GCResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GCResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionError != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) - n31, err := m.RegionError.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n31 - } - if m.Error != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Error.Size())) - n32, err := m.Error.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n32 - } - return i, nil -} - -func (m *RawGetRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RawGetRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Context != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) - n33, err := m.Context.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n33 - } - if len(m.Key) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - return i, nil -} - -func (m *RawGetResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RawGetResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionError != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) - n34, err := m.RegionError.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n34 - } - if len(m.Error) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Error))) - i += copy(dAtA[i:], m.Error) - } - if len(m.Value) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) - } - return i, nil -} - -func (m *RawPutRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RawPutRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Context != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) - n35, err := m.Context.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n35 - } - if len(m.Key) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - if len(m.Value) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) - } - return i, nil -} - -func (m *RawPutResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RawPutResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionError != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) - n36, err := m.RegionError.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n36 - } - if len(m.Error) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Error))) - i += copy(dAtA[i:], m.Error) - } - return i, nil -} - -func (m *RawDeleteRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RawDeleteRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Context != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) - n37, err := m.Context.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n37 - } - if len(m.Key) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - return i, nil -} - -func (m *RawDeleteResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RawDeleteResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionError != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) - n38, err := m.RegionError.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n38 - } - if len(m.Error) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Error))) - i += copy(dAtA[i:], m.Error) - } - return i, nil -} - -func (m *DeleteRangeRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteRangeRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Context != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) - n39, err := m.Context.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n39 - } - if len(m.StartKey) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.StartKey))) - i += copy(dAtA[i:], m.StartKey) - } - if len(m.EndKey) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.EndKey))) - i += copy(dAtA[i:], m.EndKey) - } - return i, nil -} - -func (m *DeleteRangeResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteRangeResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionError != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) - n40, err := m.RegionError.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n40 - } - if len(m.Error) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Error))) - i += copy(dAtA[i:], m.Error) - } - return i, nil -} - -func (m *RawScanRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RawScanRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Context != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) - n41, err := m.Context.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n41 - } - if len(m.StartKey) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.StartKey))) - i += copy(dAtA[i:], m.StartKey) - } - if m.Limit != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Limit)) - } - return i, nil -} - -func (m *RawScanResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RawScanResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionError != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) - n42, err := m.RegionError.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n42 - } - if len(m.Kvs) > 0 { - for _, msg := range m.Kvs { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - return i, nil -} - -func (m *WriteInfo) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WriteInfo) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.StartTs != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.StartTs)) - } - if m.Type != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Type)) - } - if m.CommitTs != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.CommitTs)) - } - return i, nil -} - -func (m *ValueInfo) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ValueInfo) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Value) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) - } - if m.Ts != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Ts)) - } - if m.IsShortValue { - dAtA[i] = 0x18 - i++ - if m.IsShortValue { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - } - return i, nil -} - -func (m *MvccInfo) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MvccInfo) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Lock != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Lock.Size())) - n43, err := m.Lock.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n43 - } - if len(m.Writes) > 0 { - for _, msg := range m.Writes { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if len(m.Values) > 0 { - for _, msg := range m.Values { - dAtA[i] = 0x1a - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - return i, nil -} - -func (m *MvccGetByKeyRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MvccGetByKeyRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Context != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) - n44, err := m.Context.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n44 - } - if len(m.Key) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - return i, nil -} - -func (m *MvccGetByKeyResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MvccGetByKeyResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionError != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) - n45, err := m.RegionError.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n45 - } - if len(m.Error) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Error))) - i += copy(dAtA[i:], m.Error) - } - if m.Info != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Info.Size())) - n46, err := m.Info.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n46 - } - return i, nil -} - -func (m *MvccGetByStartTsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MvccGetByStartTsRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Context != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Context.Size())) - n47, err := m.Context.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n47 - } - if m.StartTs != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.StartTs)) - } - return i, nil -} - -func (m *MvccGetByStartTsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MvccGetByStartTsResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionError != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.RegionError.Size())) - n48, err := m.RegionError.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n48 - } - if len(m.Error) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Error))) - i += copy(dAtA[i:], m.Error) - } - if len(m.Key) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - if m.Info != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintKvrpcpb(dAtA, i, uint64(m.Info.Size())) - n49, err := m.Info.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n49 - } - return i, nil -} - -func encodeFixed64Kvrpcpb(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Kvrpcpb(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintKvrpcpb(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *LockInfo) Size() (n int) { - var l int - _ = l - l = len(m.PrimaryLock) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.LockVersion != 0 { - n += 1 + sovKvrpcpb(uint64(m.LockVersion)) - } - l = len(m.Key) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.LockTtl != 0 { - n += 1 + sovKvrpcpb(uint64(m.LockTtl)) - } - return n -} - -func (m *KeyError) Size() (n int) { - var l int - _ = l - if m.Locked != nil { - l = m.Locked.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.Retryable) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.Abort) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - return n -} - -func (m *Context) Size() (n int) { - var l int - _ = l - if m.RegionId != 0 { - n += 1 + sovKvrpcpb(uint64(m.RegionId)) - } - if m.RegionEpoch != nil { - l = m.RegionEpoch.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.Peer != nil { - l = m.Peer.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.Term != 0 { - n += 1 + sovKvrpcpb(uint64(m.Term)) - } - if m.Priority != 0 { - n += 1 + sovKvrpcpb(uint64(m.Priority)) - } - if m.IsolationLevel != 0 { - n += 1 + sovKvrpcpb(uint64(m.IsolationLevel)) - } - return n -} - -func (m *GetRequest) Size() (n int) { - var l int - _ = l - if m.Context != nil { - l = m.Context.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.Key) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.Version != 0 { - n += 1 + sovKvrpcpb(uint64(m.Version)) - } - return n -} - -func (m *GetResponse) Size() (n int) { - var l int - _ = l - if m.RegionError != nil { - l = m.RegionError.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.Error != nil { - l = m.Error.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - return n -} - -func (m *ScanRequest) Size() (n int) { - var l int - _ = l - if m.Context != nil { - l = m.Context.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.StartKey) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.Limit != 0 { - n += 1 + sovKvrpcpb(uint64(m.Limit)) - } - if m.Version != 0 { - n += 1 + sovKvrpcpb(uint64(m.Version)) - } - if m.KeyOnly { - n += 2 - } - return n -} - -func (m *KvPair) Size() (n int) { - var l int - _ = l - if m.Error != nil { - l = m.Error.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.Key) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - return n -} - -func (m *ScanResponse) Size() (n int) { - var l int - _ = l - if m.RegionError != nil { - l = m.RegionError.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if len(m.Pairs) > 0 { - for _, e := range m.Pairs { - l = e.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - } - return n -} - -func (m *Mutation) Size() (n int) { - var l int - _ = l - if m.Op != 0 { - n += 1 + sovKvrpcpb(uint64(m.Op)) - } - l = len(m.Key) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - return n -} - -func (m *PrewriteRequest) Size() (n int) { - var l int - _ = l - if m.Context != nil { - l = m.Context.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if len(m.Mutations) > 0 { - for _, e := range m.Mutations { - l = e.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - } - l = len(m.PrimaryLock) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.StartVersion != 0 { - n += 1 + sovKvrpcpb(uint64(m.StartVersion)) - } - if m.LockTtl != 0 { - n += 1 + sovKvrpcpb(uint64(m.LockTtl)) - } - if m.SkipConstraintCheck { - n += 2 - } - return n -} - -func (m *PrewriteResponse) Size() (n int) { - var l int - _ = l - if m.RegionError != nil { - l = m.RegionError.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if len(m.Errors) > 0 { - for _, e := range m.Errors { - l = e.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - } - return n -} - -func (m *CommitRequest) Size() (n int) { - var l int - _ = l - if m.Context != nil { - l = m.Context.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.StartVersion != 0 { - n += 1 + sovKvrpcpb(uint64(m.StartVersion)) - } - if len(m.Keys) > 0 { - for _, b := range m.Keys { - l = len(b) - n += 1 + l + sovKvrpcpb(uint64(l)) - } - } - if m.CommitVersion != 0 { - n += 1 + sovKvrpcpb(uint64(m.CommitVersion)) - } - return n -} - -func (m *CommitResponse) Size() (n int) { - var l int - _ = l - if m.RegionError != nil { - l = m.RegionError.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.Error != nil { - l = m.Error.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - return n -} - -func (m *ImportRequest) Size() (n int) { - var l int - _ = l - if len(m.Mutations) > 0 { - for _, e := range m.Mutations { - l = e.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - } - if m.CommitVersion != 0 { - n += 1 + sovKvrpcpb(uint64(m.CommitVersion)) - } - return n -} - -func (m *ImportResponse) Size() (n int) { - var l int - _ = l - if m.RegionError != nil { - l = m.RegionError.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.Error) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - return n -} - -func (m *BatchRollbackRequest) Size() (n int) { - var l int - _ = l - if m.Context != nil { - l = m.Context.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.StartVersion != 0 { - n += 1 + sovKvrpcpb(uint64(m.StartVersion)) - } - if len(m.Keys) > 0 { - for _, b := range m.Keys { - l = len(b) - n += 1 + l + sovKvrpcpb(uint64(l)) - } - } - return n -} - -func (m *BatchRollbackResponse) Size() (n int) { - var l int - _ = l - if m.RegionError != nil { - l = m.RegionError.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.Error != nil { - l = m.Error.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - return n -} - -func (m *CleanupRequest) Size() (n int) { - var l int - _ = l - if m.Context != nil { - l = m.Context.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.Key) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.StartVersion != 0 { - n += 1 + sovKvrpcpb(uint64(m.StartVersion)) - } - return n -} - -func (m *CleanupResponse) Size() (n int) { - var l int - _ = l - if m.RegionError != nil { - l = m.RegionError.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.Error != nil { - l = m.Error.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.CommitVersion != 0 { - n += 1 + sovKvrpcpb(uint64(m.CommitVersion)) - } - return n -} - -func (m *BatchGetRequest) Size() (n int) { - var l int - _ = l - if m.Context != nil { - l = m.Context.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if len(m.Keys) > 0 { - for _, b := range m.Keys { - l = len(b) - n += 1 + l + sovKvrpcpb(uint64(l)) - } - } - if m.Version != 0 { - n += 1 + sovKvrpcpb(uint64(m.Version)) - } - return n -} - -func (m *BatchGetResponse) Size() (n int) { - var l int - _ = l - if m.RegionError != nil { - l = m.RegionError.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if len(m.Pairs) > 0 { - for _, e := range m.Pairs { - l = e.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - } - return n -} - -func (m *ScanLockRequest) Size() (n int) { - var l int - _ = l - if m.Context != nil { - l = m.Context.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.MaxVersion != 0 { - n += 1 + sovKvrpcpb(uint64(m.MaxVersion)) - } - return n -} - -func (m *ScanLockResponse) Size() (n int) { - var l int - _ = l - if m.RegionError != nil { - l = m.RegionError.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.Error != nil { - l = m.Error.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if len(m.Locks) > 0 { - for _, e := range m.Locks { - l = e.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - } - return n -} - -func (m *ResolveLockRequest) Size() (n int) { - var l int - _ = l - if m.Context != nil { - l = m.Context.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.StartVersion != 0 { - n += 1 + sovKvrpcpb(uint64(m.StartVersion)) - } - if m.CommitVersion != 0 { - n += 1 + sovKvrpcpb(uint64(m.CommitVersion)) - } - return n -} - -func (m *ResolveLockResponse) Size() (n int) { - var l int - _ = l - if m.RegionError != nil { - l = m.RegionError.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.Error != nil { - l = m.Error.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - return n -} - -func (m *GCRequest) Size() (n int) { - var l int - _ = l - if m.Context != nil { - l = m.Context.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.SafePoint != 0 { - n += 1 + sovKvrpcpb(uint64(m.SafePoint)) - } - return n -} - -func (m *GCResponse) Size() (n int) { - var l int - _ = l - if m.RegionError != nil { - l = m.RegionError.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.Error != nil { - l = m.Error.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - return n -} - -func (m *RawGetRequest) Size() (n int) { - var l int - _ = l - if m.Context != nil { - l = m.Context.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.Key) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - return n -} - -func (m *RawGetResponse) Size() (n int) { - var l int - _ = l - if m.RegionError != nil { - l = m.RegionError.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.Error) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - return n -} - -func (m *RawPutRequest) Size() (n int) { - var l int - _ = l - if m.Context != nil { - l = m.Context.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.Key) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - return n -} - -func (m *RawPutResponse) Size() (n int) { - var l int - _ = l - if m.RegionError != nil { - l = m.RegionError.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.Error) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - return n -} - -func (m *RawDeleteRequest) Size() (n int) { - var l int - _ = l - if m.Context != nil { - l = m.Context.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.Key) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - return n -} - -func (m *RawDeleteResponse) Size() (n int) { - var l int - _ = l - if m.RegionError != nil { - l = m.RegionError.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.Error) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - return n -} - -func (m *DeleteRangeRequest) Size() (n int) { - var l int - _ = l - if m.Context != nil { - l = m.Context.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.StartKey) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.EndKey) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - return n -} - -func (m *DeleteRangeResponse) Size() (n int) { - var l int - _ = l - if m.RegionError != nil { - l = m.RegionError.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.Error) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - return n -} - -func (m *RawScanRequest) Size() (n int) { - var l int - _ = l - if m.Context != nil { - l = m.Context.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.StartKey) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.Limit != 0 { - n += 1 + sovKvrpcpb(uint64(m.Limit)) - } - return n -} - -func (m *RawScanResponse) Size() (n int) { - var l int - _ = l - if m.RegionError != nil { - l = m.RegionError.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if len(m.Kvs) > 0 { - for _, e := range m.Kvs { - l = e.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - } - return n -} - -func (m *WriteInfo) Size() (n int) { - var l int - _ = l - if m.StartTs != 0 { - n += 1 + sovKvrpcpb(uint64(m.StartTs)) - } - if m.Type != 0 { - n += 1 + sovKvrpcpb(uint64(m.Type)) - } - if m.CommitTs != 0 { - n += 1 + sovKvrpcpb(uint64(m.CommitTs)) - } - return n -} - -func (m *ValueInfo) Size() (n int) { - var l int - _ = l - l = len(m.Value) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.Ts != 0 { - n += 1 + sovKvrpcpb(uint64(m.Ts)) - } - if m.IsShortValue { - n += 2 - } - return n -} - -func (m *MvccInfo) Size() (n int) { - var l int - _ = l - if m.Lock != nil { - l = m.Lock.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if len(m.Writes) > 0 { - for _, e := range m.Writes { - l = e.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - } - if len(m.Values) > 0 { - for _, e := range m.Values { - l = e.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - } - return n -} - -func (m *MvccGetByKeyRequest) Size() (n int) { - var l int - _ = l - if m.Context != nil { - l = m.Context.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.Key) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - return n -} - -func (m *MvccGetByKeyResponse) Size() (n int) { - var l int - _ = l - if m.RegionError != nil { - l = m.RegionError.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.Error) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.Info != nil { - l = m.Info.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - return n -} - -func (m *MvccGetByStartTsRequest) Size() (n int) { - var l int - _ = l - if m.Context != nil { - l = m.Context.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.StartTs != 0 { - n += 1 + sovKvrpcpb(uint64(m.StartTs)) - } - return n -} - -func (m *MvccGetByStartTsResponse) Size() (n int) { - var l int - _ = l - if m.RegionError != nil { - l = m.RegionError.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.Error) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - l = len(m.Key) - if l > 0 { - n += 1 + l + sovKvrpcpb(uint64(l)) - } - if m.Info != nil { - l = m.Info.Size() - n += 1 + l + sovKvrpcpb(uint64(l)) - } - return n -} - -func sovKvrpcpb(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozKvrpcpb(x uint64) (n int) { - return sovKvrpcpb(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *LockInfo) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LockInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LockInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PrimaryLock", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PrimaryLock = append(m.PrimaryLock[:0], dAtA[iNdEx:postIndex]...) - if m.PrimaryLock == nil { - m.PrimaryLock = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LockVersion", wireType) - } - m.LockVersion = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.LockVersion |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LockTtl", wireType) - } - m.LockTtl = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.LockTtl |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *KeyError) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: KeyError: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: KeyError: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Locked", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Locked == nil { - m.Locked = &LockInfo{} - } - if err := m.Locked.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Retryable", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Retryable = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Abort", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Abort = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Context) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Context: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Context: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionId", wireType) - } - m.RegionId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RegionId |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionEpoch", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionEpoch == nil { - m.RegionEpoch = &metapb.RegionEpoch{} - } - if err := m.RegionEpoch.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Peer", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Peer == nil { - m.Peer = &metapb.Peer{} - } - if err := m.Peer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) - } - m.Term = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Term |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Priority", wireType) - } - m.Priority = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Priority |= (CommandPri(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsolationLevel", wireType) - } - m.IsolationLevel = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.IsolationLevel |= (IsolationLevel(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Context == nil { - m.Context = &Context{} - } - if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - m.Version = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Version |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionError == nil { - m.RegionError = &errorpb.Error{} - } - if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Error == nil { - m.Error = &KeyError{} - } - if err := m.Error.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ScanRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ScanRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ScanRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Context == nil { - m.Context = &Context{} - } - if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StartKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StartKey = append(m.StartKey[:0], dAtA[iNdEx:postIndex]...) - if m.StartKey == nil { - m.StartKey = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) - } - m.Limit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Limit |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - m.Version = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Version |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field KeyOnly", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.KeyOnly = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *KvPair) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: KvPair: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: KvPair: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Error == nil { - m.Error = &KeyError{} - } - if err := m.Error.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ScanResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ScanResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ScanResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionError == nil { - m.RegionError = &errorpb.Error{} - } - if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pairs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Pairs = append(m.Pairs, &KvPair{}) - if err := m.Pairs[len(m.Pairs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Mutation) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Mutation: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Mutation: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) - } - m.Op = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Op |= (Op(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PrewriteRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PrewriteRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PrewriteRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Context == nil { - m.Context = &Context{} - } - if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Mutations", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Mutations = append(m.Mutations, &Mutation{}) - if err := m.Mutations[len(m.Mutations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PrimaryLock", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PrimaryLock = append(m.PrimaryLock[:0], dAtA[iNdEx:postIndex]...) - if m.PrimaryLock == nil { - m.PrimaryLock = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartVersion", wireType) - } - m.StartVersion = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartVersion |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LockTtl", wireType) - } - m.LockTtl = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.LockTtl |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SkipConstraintCheck", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.SkipConstraintCheck = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PrewriteResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PrewriteResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PrewriteResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionError == nil { - m.RegionError = &errorpb.Error{} - } - if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Errors", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Errors = append(m.Errors, &KeyError{}) - if err := m.Errors[len(m.Errors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CommitRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CommitRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CommitRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Context == nil { - m.Context = &Context{} - } - if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartVersion", wireType) - } - m.StartVersion = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartVersion |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Keys", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Keys = append(m.Keys, make([]byte, postIndex-iNdEx)) - copy(m.Keys[len(m.Keys)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CommitVersion", wireType) - } - m.CommitVersion = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CommitVersion |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CommitResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CommitResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CommitResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionError == nil { - m.RegionError = &errorpb.Error{} - } - if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Error == nil { - m.Error = &KeyError{} - } - if err := m.Error.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ImportRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ImportRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ImportRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Mutations", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Mutations = append(m.Mutations, &Mutation{}) - if err := m.Mutations[len(m.Mutations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CommitVersion", wireType) - } - m.CommitVersion = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CommitVersion |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ImportResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ImportResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ImportResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionError == nil { - m.RegionError = &errorpb.Error{} - } - if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Error = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BatchRollbackRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BatchRollbackRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BatchRollbackRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Context == nil { - m.Context = &Context{} - } - if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartVersion", wireType) - } - m.StartVersion = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartVersion |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Keys", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Keys = append(m.Keys, make([]byte, postIndex-iNdEx)) - copy(m.Keys[len(m.Keys)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BatchRollbackResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BatchRollbackResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BatchRollbackResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionError == nil { - m.RegionError = &errorpb.Error{} - } - if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Error == nil { - m.Error = &KeyError{} - } - if err := m.Error.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CleanupRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CleanupRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CleanupRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Context == nil { - m.Context = &Context{} - } - if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartVersion", wireType) - } - m.StartVersion = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartVersion |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CleanupResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CleanupResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CleanupResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionError == nil { - m.RegionError = &errorpb.Error{} - } - if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Error == nil { - m.Error = &KeyError{} - } - if err := m.Error.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CommitVersion", wireType) - } - m.CommitVersion = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CommitVersion |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BatchGetRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BatchGetRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BatchGetRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Context == nil { - m.Context = &Context{} - } - if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Keys", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Keys = append(m.Keys, make([]byte, postIndex-iNdEx)) - copy(m.Keys[len(m.Keys)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - m.Version = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Version |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BatchGetResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BatchGetResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BatchGetResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionError == nil { - m.RegionError = &errorpb.Error{} - } - if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pairs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Pairs = append(m.Pairs, &KvPair{}) - if err := m.Pairs[len(m.Pairs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ScanLockRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ScanLockRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ScanLockRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Context == nil { - m.Context = &Context{} - } - if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxVersion", wireType) - } - m.MaxVersion = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxVersion |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ScanLockResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ScanLockResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ScanLockResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionError == nil { - m.RegionError = &errorpb.Error{} - } - if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Error == nil { - m.Error = &KeyError{} - } - if err := m.Error.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Locks", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Locks = append(m.Locks, &LockInfo{}) - if err := m.Locks[len(m.Locks)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ResolveLockRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ResolveLockRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ResolveLockRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Context == nil { - m.Context = &Context{} - } - if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartVersion", wireType) - } - m.StartVersion = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartVersion |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CommitVersion", wireType) - } - m.CommitVersion = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CommitVersion |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ResolveLockResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ResolveLockResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ResolveLockResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionError == nil { - m.RegionError = &errorpb.Error{} - } - if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Error == nil { - m.Error = &KeyError{} - } - if err := m.Error.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GCRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GCRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GCRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Context == nil { - m.Context = &Context{} - } - if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SafePoint", wireType) - } - m.SafePoint = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SafePoint |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GCResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GCResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GCResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionError == nil { - m.RegionError = &errorpb.Error{} - } - if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Error == nil { - m.Error = &KeyError{} - } - if err := m.Error.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RawGetRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RawGetRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RawGetRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Context == nil { - m.Context = &Context{} - } - if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RawGetResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RawGetResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RawGetResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionError == nil { - m.RegionError = &errorpb.Error{} - } - if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Error = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RawPutRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RawPutRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RawPutRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Context == nil { - m.Context = &Context{} - } - if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RawPutResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RawPutResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RawPutResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionError == nil { - m.RegionError = &errorpb.Error{} - } - if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Error = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RawDeleteRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RawDeleteRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RawDeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Context == nil { - m.Context = &Context{} - } - if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RawDeleteResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RawDeleteResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RawDeleteResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionError == nil { - m.RegionError = &errorpb.Error{} - } - if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Error = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteRangeRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeleteRangeRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteRangeRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Context == nil { - m.Context = &Context{} - } - if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StartKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StartKey = append(m.StartKey[:0], dAtA[iNdEx:postIndex]...) - if m.StartKey == nil { - m.StartKey = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EndKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.EndKey = append(m.EndKey[:0], dAtA[iNdEx:postIndex]...) - if m.EndKey == nil { - m.EndKey = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteRangeResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeleteRangeResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteRangeResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionError == nil { - m.RegionError = &errorpb.Error{} - } - if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Error = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RawScanRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RawScanRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RawScanRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Context == nil { - m.Context = &Context{} - } - if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StartKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StartKey = append(m.StartKey[:0], dAtA[iNdEx:postIndex]...) - if m.StartKey == nil { - m.StartKey = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) - } - m.Limit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Limit |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RawScanResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RawScanResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RawScanResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionError == nil { - m.RegionError = &errorpb.Error{} - } - if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Kvs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Kvs = append(m.Kvs, &KvPair{}) - if err := m.Kvs[len(m.Kvs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WriteInfo) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WriteInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WriteInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartTs", wireType) - } - m.StartTs = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartTs |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= (Op(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CommitTs", wireType) - } - m.CommitTs = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CommitTs |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ValueInfo) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ValueInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ValueInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Ts", wireType) - } - m.Ts = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Ts |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsShortValue", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.IsShortValue = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MvccInfo) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MvccInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MvccInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Lock", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Lock == nil { - m.Lock = &LockInfo{} - } - if err := m.Lock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Writes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Writes = append(m.Writes, &WriteInfo{}) - if err := m.Writes[len(m.Writes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Values = append(m.Values, &ValueInfo{}) - if err := m.Values[len(m.Values)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MvccGetByKeyRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MvccGetByKeyRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MvccGetByKeyRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Context == nil { - m.Context = &Context{} - } - if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MvccGetByKeyResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MvccGetByKeyResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MvccGetByKeyResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionError == nil { - m.RegionError = &errorpb.Error{} - } - if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Error = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Info == nil { - m.Info = &MvccInfo{} - } - if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MvccGetByStartTsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MvccGetByStartTsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MvccGetByStartTsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Context == nil { - m.Context = &Context{} - } - if err := m.Context.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartTs", wireType) - } - m.StartTs = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartTs |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MvccGetByStartTsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MvccGetByStartTsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MvccGetByStartTsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionError", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionError == nil { - m.RegionError = &errorpb.Error{} - } - if err := m.RegionError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Error = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKvrpcpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Info == nil { - m.Info = &MvccInfo{} - } - if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKvrpcpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthKvrpcpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipKvrpcpb(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthKvrpcpb - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowKvrpcpb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipKvrpcpb(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthKvrpcpb = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowKvrpcpb = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("kvrpcpb.proto", fileDescriptorKvrpcpb) } - -var fileDescriptorKvrpcpb = []byte{ - // 1445 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x5f, 0x8f, 0xdb, 0x44, - 0x10, 0xaf, 0x1d, 0x27, 0x71, 0x26, 0xff, 0xdc, 0xbd, 0xab, 0x9a, 0xb6, 0x70, 0x4d, 0x0d, 0xa7, - 0x5e, 0x0f, 0x29, 0x15, 0x41, 0xe2, 0x19, 0x35, 0xad, 0xca, 0xf5, 0x5a, 0x2e, 0xda, 0xab, 0xae, - 0xaa, 0x84, 0x1a, 0x7c, 0xce, 0x36, 0xb1, 0xec, 0x78, 0x5d, 0x7b, 0x93, 0xab, 0x85, 0x10, 0x4f, - 0x20, 0x21, 0xf1, 0x88, 0x04, 0x42, 0xbc, 0xf0, 0xc8, 0x37, 0xe1, 0x91, 0x8f, 0x80, 0xca, 0x17, - 0x41, 0xbb, 0xfe, 0x97, 0x5c, 0x52, 0x38, 0x59, 0x69, 0x9e, 0x92, 0x9d, 0x99, 0xdd, 0x99, 0xdf, - 0xcc, 0x6f, 0x67, 0xbd, 0x0b, 0x75, 0x7b, 0xe6, 0x7b, 0xa6, 0x77, 0xda, 0xf1, 0x7c, 0xca, 0x28, - 0x2a, 0xc7, 0xc3, 0xeb, 0xb5, 0x09, 0x61, 0x46, 0x22, 0xbe, 0x5e, 0x27, 0xbe, 0x4f, 0xfd, 0x74, - 0xb8, 0x3d, 0xa2, 0x23, 0x2a, 0xfe, 0xde, 0xe5, 0xff, 0x22, 0xa9, 0xfe, 0x0d, 0xa8, 0x8f, 0xa9, - 0x69, 0x1f, 0xb8, 0x2f, 0x29, 0xba, 0x05, 0x35, 0xcf, 0xb7, 0x26, 0x86, 0x1f, 0x0e, 0x1c, 0x6a, - 0xda, 0x2d, 0xa9, 0x2d, 0xed, 0xd5, 0x70, 0x35, 0x96, 0x71, 0x33, 0x6e, 0xc2, 0x55, 0x83, 0x19, - 0xf1, 0x03, 0x8b, 0xba, 0x2d, 0xb9, 0x2d, 0xed, 0x29, 0xb8, 0xca, 0x65, 0x27, 0x91, 0x08, 0x69, - 0x50, 0xb0, 0x49, 0xd8, 0x2a, 0x88, 0xc9, 0xfc, 0x2f, 0xba, 0x06, 0xaa, 0x98, 0xc4, 0x98, 0xd3, - 0x52, 0xc4, 0x84, 0x32, 0x1f, 0x3f, 0x65, 0x8e, 0x6e, 0x81, 0x7a, 0x48, 0xc2, 0x07, 0x3c, 0x50, - 0x74, 0x07, 0x4a, 0x5c, 0x4c, 0x86, 0xc2, 0x71, 0xb5, 0x7b, 0xb9, 0x93, 0xc0, 0x4c, 0x22, 0xc4, - 0xb1, 0x01, 0x7a, 0x0f, 0x2a, 0x3e, 0x61, 0x7e, 0x68, 0x9c, 0x3a, 0x44, 0xc4, 0x50, 0xc1, 0x99, - 0x00, 0x6d, 0x43, 0xd1, 0x38, 0xa5, 0x3e, 0x13, 0x31, 0x54, 0x70, 0x34, 0xd0, 0x7f, 0x95, 0xa1, - 0xdc, 0xa3, 0x2e, 0x23, 0xaf, 0x19, 0xba, 0xc1, 0xe7, 0x8f, 0x2c, 0xea, 0x0e, 0xac, 0xc8, 0x9b, - 0x82, 0xd5, 0x48, 0x70, 0x30, 0x44, 0x9f, 0x42, 0x2d, 0x56, 0x12, 0x8f, 0x9a, 0x63, 0xb1, 0x7e, - 0xb5, 0xbb, 0xd5, 0x89, 0x93, 0x8b, 0x85, 0xee, 0x01, 0x57, 0xe1, 0xaa, 0x9f, 0x0d, 0x50, 0x1b, - 0x14, 0x8f, 0x10, 0x5f, 0x78, 0xad, 0x76, 0x6b, 0x89, 0x7d, 0x9f, 0x10, 0x1f, 0x0b, 0x0d, 0x42, - 0xa0, 0x30, 0xe2, 0x4f, 0x5a, 0x45, 0xe1, 0x51, 0xfc, 0x47, 0x77, 0x41, 0xf5, 0x7c, 0x8b, 0xfa, - 0x16, 0x0b, 0x5b, 0xa5, 0xb6, 0xb4, 0xd7, 0xe8, 0x6e, 0xa5, 0xb8, 0x7b, 0x74, 0x32, 0x31, 0xdc, - 0x61, 0xdf, 0xb7, 0x70, 0x6a, 0x84, 0x3e, 0x83, 0xa6, 0x15, 0x50, 0xc7, 0x60, 0x3c, 0x42, 0x87, - 0xcc, 0x88, 0xd3, 0x2a, 0x8b, 0x79, 0x57, 0xd3, 0x79, 0x07, 0x89, 0xfe, 0x31, 0x57, 0xe3, 0x86, - 0xb5, 0x30, 0x7e, 0xa4, 0xa8, 0x8a, 0x56, 0xe4, 0xb1, 0x1b, 0xc3, 0xc1, 0xab, 0x29, 0xf5, 0xa7, - 0x13, 0x7d, 0x08, 0xf0, 0x90, 0x30, 0x4c, 0x5e, 0x4d, 0x49, 0xc0, 0xd0, 0x3e, 0x94, 0xcd, 0x28, - 0x53, 0x71, 0x29, 0xb4, 0xb9, 0x90, 0x84, 0x1c, 0x27, 0x06, 0x49, 0xb9, 0xe5, 0xac, 0xdc, 0x2d, - 0x28, 0x27, 0xf4, 0x28, 0x44, 0xd5, 0x8e, 0x87, 0xfa, 0xb7, 0x50, 0x15, 0x5e, 0x02, 0x8f, 0xba, - 0x01, 0x41, 0x1f, 0x67, 0x89, 0xe6, 0x04, 0x88, 0x7d, 0x35, 0x3a, 0x09, 0x6f, 0x05, 0x2d, 0xd2, - 0x1c, 0x0b, 0x8e, 0xdc, 0x86, 0x62, 0x64, 0x2b, 0x9f, 0xa3, 0x48, 0xc2, 0x22, 0x1c, 0xe9, 0x39, - 0x07, 0x66, 0x86, 0x33, 0x25, 0x31, 0x0f, 0xa3, 0x81, 0xfe, 0xbb, 0x04, 0xd5, 0x63, 0xd3, 0x70, - 0xf3, 0x00, 0xbd, 0x01, 0x95, 0x80, 0x19, 0x3e, 0x1b, 0x64, 0x70, 0x55, 0x21, 0x38, 0x24, 0x21, - 0x77, 0xe7, 0x58, 0x13, 0x2b, 0xa2, 0x5c, 0x1d, 0x47, 0x83, 0xf9, 0x4c, 0x28, 0x0b, 0x99, 0xe0, - 0x5b, 0xc2, 0x26, 0xe1, 0x80, 0xba, 0x4e, 0x28, 0xd8, 0xa0, 0xe2, 0xb2, 0x4d, 0xc2, 0x23, 0xd7, - 0x09, 0xf5, 0xe7, 0x50, 0x3a, 0x9c, 0xf5, 0x0d, 0x6b, 0x0e, 0xac, 0xf4, 0x3f, 0x60, 0x97, 0x6b, - 0xb0, 0x1a, 0xfe, 0x18, 0x6a, 0x11, 0xfa, 0xfc, 0x05, 0xd8, 0x85, 0xa2, 0x67, 0x58, 0x7e, 0xd0, - 0x92, 0xdb, 0x85, 0xbd, 0x6a, 0xb7, 0x99, 0xc5, 0x24, 0x62, 0xc6, 0x91, 0x56, 0x3f, 0x02, 0xf5, - 0xc9, 0x94, 0x09, 0xce, 0xa1, 0x1b, 0x20, 0x53, 0x4f, 0xac, 0xdd, 0xe8, 0x56, 0x53, 0xfb, 0x23, - 0x0f, 0xcb, 0xd4, 0xbb, 0x70, 0xe8, 0xdf, 0xc9, 0xd0, 0xec, 0xfb, 0xe4, 0xcc, 0xb7, 0x18, 0xc9, - 0x53, 0xbd, 0xbb, 0x50, 0x99, 0xc4, 0x01, 0x25, 0xb1, 0x67, 0xf9, 0x4c, 0x42, 0xc5, 0x99, 0xcd, - 0x52, 0x33, 0x2c, 0x2c, 0x37, 0xc3, 0x0f, 0xa0, 0x1e, 0x31, 0x62, 0xb1, 0xc8, 0x35, 0x21, 0x3c, - 0xc9, 0x2a, 0x9d, 0x36, 0xbf, 0xe2, 0x42, 0xf3, 0x43, 0x5d, 0xb8, 0x12, 0xd8, 0x96, 0x37, 0x30, - 0xa9, 0x1b, 0x30, 0xdf, 0xb0, 0x5c, 0x36, 0x30, 0xc7, 0xc4, 0xb4, 0x45, 0x1f, 0x50, 0xf1, 0x16, - 0x57, 0xf6, 0x52, 0x5d, 0x8f, 0xab, 0x74, 0x0f, 0xb4, 0x2c, 0x0d, 0xf9, 0xcb, 0x78, 0x07, 0x4a, - 0x42, 0xbb, 0x9c, 0x8b, 0x94, 0x5b, 0xb1, 0x81, 0xfe, 0x87, 0x04, 0x75, 0xde, 0x88, 0xac, 0x5c, - 0xed, 0x61, 0x29, 0x47, 0xf2, 0x8a, 0x1c, 0x21, 0x50, 0x6c, 0x12, 0x06, 0xad, 0x42, 0xbb, 0xb0, - 0x57, 0xc3, 0xe2, 0x3f, 0xda, 0x85, 0x86, 0x29, 0xbc, 0x9e, 0xcb, 0x6e, 0x3d, 0x92, 0xc6, 0x53, - 0x1f, 0x29, 0x6a, 0x51, 0x2b, 0xe1, 0xd2, 0xa9, 0xe5, 0x3a, 0x74, 0xa4, 0x3b, 0xd0, 0x48, 0x42, - 0x7d, 0xf7, 0x3d, 0x46, 0x1f, 0x41, 0xfd, 0x60, 0xe2, 0x51, 0x3f, 0x4d, 0xcc, 0x02, 0xc9, 0xa4, - 0x0b, 0x90, 0x6c, 0x19, 0xa4, 0xbc, 0x02, 0xa4, 0xfe, 0x1c, 0x1a, 0x89, 0xa3, 0xfc, 0xb0, 0xb6, - 0xe7, 0x61, 0x55, 0x12, 0x0c, 0x5f, 0xc3, 0xf6, 0x3d, 0x83, 0x99, 0x63, 0x4c, 0x1d, 0xe7, 0xd4, - 0x30, 0xed, 0x4d, 0xd6, 0x58, 0x0f, 0xe0, 0xca, 0x39, 0xe7, 0x1b, 0xa8, 0x5a, 0x00, 0x8d, 0x9e, - 0x43, 0x0c, 0x77, 0xea, 0xad, 0xe7, 0xb8, 0x5b, 0x42, 0x5f, 0x58, 0x46, 0xaf, 0xff, 0x24, 0x41, - 0x33, 0xf5, 0xba, 0x81, 0xe3, 0x6f, 0x99, 0x58, 0x85, 0x55, 0xc4, 0xb2, 0xa1, 0x29, 0x0a, 0x90, - 0xf3, 0xec, 0x4f, 0x6a, 0x2a, 0xcf, 0xed, 0xdb, 0xb7, 0x9f, 0xfe, 0x0e, 0x68, 0x99, 0xb3, 0x77, - 0x7e, 0x02, 0xbd, 0x80, 0x26, 0x3f, 0xeb, 0x78, 0xa3, 0xce, 0x03, 0xed, 0x26, 0x54, 0x27, 0xc6, - 0xeb, 0x73, 0x8c, 0x86, 0x89, 0xf1, 0x3a, 0x49, 0xdd, 0xcf, 0x12, 0x68, 0x99, 0x83, 0x0d, 0x94, - 0xf4, 0x36, 0x14, 0xf9, 0xc1, 0x11, 0xed, 0xa0, 0x95, 0x5f, 0xc7, 0x91, 0x5e, 0xff, 0x51, 0x02, - 0x84, 0x49, 0x40, 0x9d, 0x19, 0xc9, 0x8b, 0xfe, 0x42, 0x3b, 0xfa, 0x82, 0x1c, 0x7b, 0x05, 0x5b, - 0x0b, 0xd1, 0x6c, 0x60, 0x8b, 0x9f, 0x40, 0xe5, 0x61, 0x2f, 0x0f, 0xee, 0xf7, 0x01, 0x02, 0xe3, - 0x25, 0x19, 0x78, 0xd4, 0x72, 0x59, 0x0c, 0xba, 0xc2, 0x25, 0x7d, 0x2e, 0xd0, 0xc7, 0x00, 0x7c, - 0xdd, 0x0d, 0x20, 0x78, 0x02, 0x75, 0x6c, 0x9c, 0xad, 0xeb, 0x93, 0x5c, 0xa7, 0xd0, 0x48, 0x96, - 0x5b, 0xf3, 0x01, 0xf2, 0x96, 0xcf, 0x35, 0x53, 0xc4, 0xdf, 0x9f, 0xae, 0xe9, 0x4a, 0xb1, 0xda, - 0xc9, 0x73, 0x81, 0x4a, 0x38, 0x59, 0xf7, 0xb1, 0xd8, 0x07, 0x0d, 0x1b, 0x67, 0xf7, 0x89, 0x43, - 0xf2, 0x7d, 0x6e, 0x2e, 0x97, 0xe0, 0x4b, 0xb8, 0x3c, 0xb7, 0xe2, 0xba, 0xe3, 0x9d, 0x01, 0x8a, - 0x97, 0x36, 0xdc, 0x11, 0x59, 0xfb, 0xf5, 0xe6, 0x2a, 0x94, 0x89, 0x3b, 0x1c, 0x64, 0xf7, 0xfa, - 0x12, 0x71, 0x87, 0x87, 0x24, 0xd4, 0x5f, 0xc0, 0xd6, 0x82, 0xdf, 0x75, 0xe3, 0x8a, 0x88, 0xbb, - 0xb9, 0x2b, 0x9b, 0x3e, 0x82, 0x66, 0xea, 0x30, 0x3f, 0x98, 0x5b, 0x50, 0xb0, 0x67, 0x6f, 0x3d, - 0xa1, 0xb8, 0x4e, 0x1f, 0x42, 0xe5, 0x19, 0xff, 0x8a, 0x17, 0x2f, 0x2f, 0xd7, 0x20, 0x8a, 0x6b, - 0xc0, 0x82, 0xf8, 0x39, 0xa2, 0x2c, 0xc6, 0x4f, 0x03, 0x74, 0x13, 0x14, 0x16, 0x7a, 0xd1, 0x2b, - 0xc7, 0xb9, 0xfb, 0x93, 0x50, 0x70, 0x90, 0x71, 0x1b, 0x66, 0x41, 0xdc, 0x81, 0xd5, 0x48, 0xf0, - 0x34, 0xd0, 0x9f, 0x41, 0xe5, 0x84, 0xef, 0x15, 0xe1, 0x25, 0xdd, 0x45, 0xd2, 0xdc, 0x2e, 0x42, - 0x0d, 0x90, 0x59, 0x10, 0xf7, 0x3a, 0x99, 0x05, 0xe8, 0x43, 0x68, 0x58, 0xc1, 0x20, 0x18, 0x53, - 0xde, 0xfe, 0xd3, 0x4d, 0xa7, 0xe2, 0x9a, 0x15, 0x1c, 0x73, 0xa1, 0x58, 0x4f, 0xff, 0x41, 0x02, - 0xf5, 0xc9, 0xcc, 0x34, 0xc5, 0xc2, 0xbb, 0xa0, 0xa4, 0x0f, 0x46, 0x2b, 0x4f, 0x26, 0xa1, 0x46, - 0xfb, 0x50, 0x12, 0x17, 0x97, 0x24, 0x31, 0x28, 0x35, 0x4c, 0x33, 0x81, 0x63, 0x0b, 0x6e, 0x2b, - 0x9c, 0x27, 0xc7, 0x5d, 0x66, 0x9b, 0xe2, 0xc1, 0xb1, 0x85, 0x7e, 0x0c, 0x5b, 0x3c, 0x94, 0x87, - 0x84, 0xdd, 0x0b, 0x0f, 0x49, 0xb8, 0x9e, 0xfd, 0xfa, 0xbd, 0x04, 0xdb, 0x8b, 0xab, 0xae, 0xbb, - 0x73, 0xee, 0x82, 0x62, 0xb9, 0x2f, 0x69, 0xfc, 0x5e, 0x34, 0x77, 0x51, 0x88, 0xd3, 0x8a, 0x85, - 0x5a, 0xff, 0x0a, 0xae, 0xa6, 0x71, 0x1c, 0x47, 0xa4, 0xc8, 0x83, 0x70, 0x9e, 0x62, 0xf2, 0x02, - 0xc5, 0xf4, 0xdf, 0x24, 0x68, 0x2d, 0xbb, 0x58, 0x37, 0xdc, 0xe5, 0x77, 0xc1, 0x24, 0x01, 0xca, - 0x7f, 0x26, 0x60, 0xff, 0x23, 0x80, 0xec, 0x21, 0x0c, 0x01, 0x94, 0xbe, 0xa0, 0xfe, 0xc4, 0x70, - 0xb4, 0x4b, 0xa8, 0x0c, 0x85, 0xc7, 0xf4, 0x4c, 0x93, 0x90, 0x0a, 0xca, 0xe7, 0xd6, 0x68, 0xac, - 0xc9, 0xfb, 0x6d, 0x68, 0x2c, 0xbe, 0x7e, 0xa1, 0x12, 0xc8, 0xc7, 0x07, 0xda, 0x25, 0xfe, 0x8b, - 0x7b, 0x9a, 0xb4, 0xdf, 0x01, 0xf9, 0xc8, 0xe3, 0x53, 0xfb, 0x53, 0x16, 0xad, 0x71, 0x9f, 0x38, - 0xd1, 0x1a, 0x9c, 0xaf, 0x9a, 0x8c, 0x6a, 0xa0, 0x26, 0x37, 0x12, 0xad, 0x70, 0x6f, 0xff, 0xcf, - 0x37, 0x3b, 0xd2, 0x5f, 0x6f, 0x76, 0xa4, 0xbf, 0xdf, 0xec, 0x48, 0xbf, 0xfc, 0xb3, 0x73, 0x09, - 0x5a, 0x26, 0x9d, 0x74, 0x3c, 0xcb, 0x1d, 0x99, 0x86, 0xd7, 0x61, 0x96, 0x3d, 0xeb, 0xd8, 0x33, - 0xf1, 0x9a, 0x7a, 0x5a, 0x12, 0x3f, 0x9f, 0xfc, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x76, 0x89, - 0x7e, 0xa1, 0x15, 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/metapb/metapb.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/metapb/metapb.pb.go index 782798e0e30..ed950209e5d 100644 --- a/_vendor/src/github.com/pingcap/kvproto/pkg/metapb/metapb.pb.go +++ b/_vendor/src/github.com/pingcap/kvproto/pkg/metapb/metapb.pb.go @@ -1453,7 +1453,7 @@ func init() { proto.RegisterFile("metapb.proto", fileDescriptorMetapb) } var fileDescriptorMetapb = []byte{ // 463 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x52, 0xcd, 0x6e, 0xd3, 0x40, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x52, 0xcd, 0x6e, 0xd3, 0x40, 0x10, 0xce, 0xe6, 0xc7, 0x4e, 0xc6, 0x6e, 0x15, 0x2d, 0x15, 0x58, 0x45, 0x72, 0x2c, 0x9f, 0xac, 0x1c, 0x0c, 0xea, 0x81, 0x1b, 0x12, 0x6a, 0xc5, 0x01, 0x15, 0x01, 0x72, 0x81, 0xab, 0xe5, 0xd8, 0x93, 0x60, 0xc5, 0xf6, 0x5a, 0xbb, 0x1b, 0xab, 0x7d, 0x13, 0x78, 0x0b, 0x1e, 0xa3, 0x47, 0x9e, diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/raft_cmdpb/raft_cmdpb.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/raft_cmdpb/raft_cmdpb.pb.go deleted file mode 100644 index 764f0a85410..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/pkg/raft_cmdpb/raft_cmdpb.pb.go +++ /dev/null @@ -1,7803 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: raft_cmdpb.proto -// DO NOT EDIT! - -/* - Package raft_cmdpb is a generated protocol buffer package. - - It is generated from these files: - raft_cmdpb.proto - - It has these top-level messages: - GetRequest - GetResponse - PutRequest - PutResponse - DeleteRequest - DeleteResponse - DeleteRangeRequest - DeleteRangeResponse - SnapRequest - SnapResponse - PrewriteRequest - PrewriteResponse - Request - Response - ChangePeerRequest - ChangePeerResponse - SplitRequest - SplitResponse - CompactLogRequest - CompactLogResponse - TransferLeaderRequest - TransferLeaderResponse - VerifyHashRequest - VerifyHashResponse - AdminRequest - AdminResponse - RegionLeaderRequest - RegionLeaderResponse - RegionDetailRequest - RegionDetailResponse - StatusRequest - StatusResponse - RaftRequestHeader - RaftResponseHeader - RaftCmdRequest - RaftCmdResponse -*/ -package raft_cmdpb - -import ( - "fmt" - "io" - "math" - - proto "github.com/golang/protobuf/proto" - - metapb "github.com/pingcap/kvproto/pkg/metapb" - - errorpb "github.com/pingcap/kvproto/pkg/errorpb" - - eraftpb "github.com/pingcap/kvproto/pkg/eraftpb" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type CmdType int32 - -const ( - CmdType_Invalid CmdType = 0 - CmdType_Get CmdType = 1 - CmdType_Put CmdType = 3 - CmdType_Delete CmdType = 4 - CmdType_Snap CmdType = 5 - CmdType_Prewrite CmdType = 6 - CmdType_DeleteRange CmdType = 7 -) - -var CmdType_name = map[int32]string{ - 0: "Invalid", - 1: "Get", - 3: "Put", - 4: "Delete", - 5: "Snap", - 6: "Prewrite", - 7: "DeleteRange", -} -var CmdType_value = map[string]int32{ - "Invalid": 0, - "Get": 1, - "Put": 3, - "Delete": 4, - "Snap": 5, - "Prewrite": 6, - "DeleteRange": 7, -} - -func (x CmdType) Enum() *CmdType { - p := new(CmdType) - *p = x - return p -} -func (x CmdType) String() string { - return proto.EnumName(CmdType_name, int32(x)) -} -func (x *CmdType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(CmdType_value, data, "CmdType") - if err != nil { - return err - } - *x = CmdType(value) - return nil -} -func (CmdType) EnumDescriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{0} } - -type AdminCmdType int32 - -const ( - AdminCmdType_InvalidAdmin AdminCmdType = 0 - AdminCmdType_ChangePeer AdminCmdType = 1 - AdminCmdType_Split AdminCmdType = 2 - AdminCmdType_CompactLog AdminCmdType = 3 - AdminCmdType_TransferLeader AdminCmdType = 4 - AdminCmdType_ComputeHash AdminCmdType = 5 - AdminCmdType_VerifyHash AdminCmdType = 6 -) - -var AdminCmdType_name = map[int32]string{ - 0: "InvalidAdmin", - 1: "ChangePeer", - 2: "Split", - 3: "CompactLog", - 4: "TransferLeader", - 5: "ComputeHash", - 6: "VerifyHash", -} -var AdminCmdType_value = map[string]int32{ - "InvalidAdmin": 0, - "ChangePeer": 1, - "Split": 2, - "CompactLog": 3, - "TransferLeader": 4, - "ComputeHash": 5, - "VerifyHash": 6, -} - -func (x AdminCmdType) Enum() *AdminCmdType { - p := new(AdminCmdType) - *p = x - return p -} -func (x AdminCmdType) String() string { - return proto.EnumName(AdminCmdType_name, int32(x)) -} -func (x *AdminCmdType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(AdminCmdType_value, data, "AdminCmdType") - if err != nil { - return err - } - *x = AdminCmdType(value) - return nil -} -func (AdminCmdType) EnumDescriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{1} } - -type StatusCmdType int32 - -const ( - StatusCmdType_InvalidStatus StatusCmdType = 0 - StatusCmdType_RegionLeader StatusCmdType = 1 - StatusCmdType_RegionDetail StatusCmdType = 2 -) - -var StatusCmdType_name = map[int32]string{ - 0: "InvalidStatus", - 1: "RegionLeader", - 2: "RegionDetail", -} -var StatusCmdType_value = map[string]int32{ - "InvalidStatus": 0, - "RegionLeader": 1, - "RegionDetail": 2, -} - -func (x StatusCmdType) Enum() *StatusCmdType { - p := new(StatusCmdType) - *p = x - return p -} -func (x StatusCmdType) String() string { - return proto.EnumName(StatusCmdType_name, int32(x)) -} -func (x *StatusCmdType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(StatusCmdType_value, data, "StatusCmdType") - if err != nil { - return err - } - *x = StatusCmdType(value) - return nil -} -func (StatusCmdType) EnumDescriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{2} } - -type GetRequest struct { - Cf *string `protobuf:"bytes,1,opt,name=cf" json:"cf,omitempty"` - Key []byte `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GetRequest) Reset() { *m = GetRequest{} } -func (m *GetRequest) String() string { return proto.CompactTextString(m) } -func (*GetRequest) ProtoMessage() {} -func (*GetRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{0} } - -func (m *GetRequest) GetCf() string { - if m != nil && m.Cf != nil { - return *m.Cf - } - return "" -} - -func (m *GetRequest) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -type GetResponse struct { - Value []byte `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GetResponse) Reset() { *m = GetResponse{} } -func (m *GetResponse) String() string { return proto.CompactTextString(m) } -func (*GetResponse) ProtoMessage() {} -func (*GetResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{1} } - -func (m *GetResponse) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -type PutRequest struct { - Cf *string `protobuf:"bytes,1,opt,name=cf" json:"cf,omitempty"` - Key []byte `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"` - Value []byte `protobuf:"bytes,3,opt,name=value" json:"value,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *PutRequest) Reset() { *m = PutRequest{} } -func (m *PutRequest) String() string { return proto.CompactTextString(m) } -func (*PutRequest) ProtoMessage() {} -func (*PutRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{2} } - -func (m *PutRequest) GetCf() string { - if m != nil && m.Cf != nil { - return *m.Cf - } - return "" -} - -func (m *PutRequest) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *PutRequest) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -type PutResponse struct { - XXX_unrecognized []byte `json:"-"` -} - -func (m *PutResponse) Reset() { *m = PutResponse{} } -func (m *PutResponse) String() string { return proto.CompactTextString(m) } -func (*PutResponse) ProtoMessage() {} -func (*PutResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{3} } - -type DeleteRequest struct { - Cf *string `protobuf:"bytes,1,opt,name=cf" json:"cf,omitempty"` - Key []byte `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } -func (m *DeleteRequest) String() string { return proto.CompactTextString(m) } -func (*DeleteRequest) ProtoMessage() {} -func (*DeleteRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{4} } - -func (m *DeleteRequest) GetCf() string { - if m != nil && m.Cf != nil { - return *m.Cf - } - return "" -} - -func (m *DeleteRequest) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -type DeleteResponse struct { - XXX_unrecognized []byte `json:"-"` -} - -func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } -func (m *DeleteResponse) String() string { return proto.CompactTextString(m) } -func (*DeleteResponse) ProtoMessage() {} -func (*DeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{5} } - -type DeleteRangeRequest struct { - Cf *string `protobuf:"bytes,1,opt,name=cf" json:"cf,omitempty"` - StartKey []byte `protobuf:"bytes,2,opt,name=start_key,json=startKey" json:"start_key,omitempty"` - EndKey []byte `protobuf:"bytes,3,opt,name=end_key,json=endKey" json:"end_key,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *DeleteRangeRequest) Reset() { *m = DeleteRangeRequest{} } -func (m *DeleteRangeRequest) String() string { return proto.CompactTextString(m) } -func (*DeleteRangeRequest) ProtoMessage() {} -func (*DeleteRangeRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{6} } - -func (m *DeleteRangeRequest) GetCf() string { - if m != nil && m.Cf != nil { - return *m.Cf - } - return "" -} - -func (m *DeleteRangeRequest) GetStartKey() []byte { - if m != nil { - return m.StartKey - } - return nil -} - -func (m *DeleteRangeRequest) GetEndKey() []byte { - if m != nil { - return m.EndKey - } - return nil -} - -type DeleteRangeResponse struct { - XXX_unrecognized []byte `json:"-"` -} - -func (m *DeleteRangeResponse) Reset() { *m = DeleteRangeResponse{} } -func (m *DeleteRangeResponse) String() string { return proto.CompactTextString(m) } -func (*DeleteRangeResponse) ProtoMessage() {} -func (*DeleteRangeResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{7} } - -type SnapRequest struct { - XXX_unrecognized []byte `json:"-"` -} - -func (m *SnapRequest) Reset() { *m = SnapRequest{} } -func (m *SnapRequest) String() string { return proto.CompactTextString(m) } -func (*SnapRequest) ProtoMessage() {} -func (*SnapRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{8} } - -type SnapResponse struct { - Region *metapb.Region `protobuf:"bytes,1,opt,name=region" json:"region,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *SnapResponse) Reset() { *m = SnapResponse{} } -func (m *SnapResponse) String() string { return proto.CompactTextString(m) } -func (*SnapResponse) ProtoMessage() {} -func (*SnapResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{9} } - -func (m *SnapResponse) GetRegion() *metapb.Region { - if m != nil { - return m.Region - } - return nil -} - -type PrewriteRequest struct { - Key []byte `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` - Value []byte `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` - Lock []byte `protobuf:"bytes,3,opt,name=lock" json:"lock,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *PrewriteRequest) Reset() { *m = PrewriteRequest{} } -func (m *PrewriteRequest) String() string { return proto.CompactTextString(m) } -func (*PrewriteRequest) ProtoMessage() {} -func (*PrewriteRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{10} } - -func (m *PrewriteRequest) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *PrewriteRequest) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -func (m *PrewriteRequest) GetLock() []byte { - if m != nil { - return m.Lock - } - return nil -} - -type PrewriteResponse struct { - XXX_unrecognized []byte `json:"-"` -} - -func (m *PrewriteResponse) Reset() { *m = PrewriteResponse{} } -func (m *PrewriteResponse) String() string { return proto.CompactTextString(m) } -func (*PrewriteResponse) ProtoMessage() {} -func (*PrewriteResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{11} } - -type Request struct { - CmdType *CmdType `protobuf:"varint,1,opt,name=cmd_type,json=cmdType,enum=raft_cmdpb.CmdType" json:"cmd_type,omitempty"` - Get *GetRequest `protobuf:"bytes,2,opt,name=get" json:"get,omitempty"` - Put *PutRequest `protobuf:"bytes,4,opt,name=put" json:"put,omitempty"` - Delete *DeleteRequest `protobuf:"bytes,5,opt,name=delete" json:"delete,omitempty"` - Snap *SnapRequest `protobuf:"bytes,6,opt,name=snap" json:"snap,omitempty"` - Prewrite *PrewriteRequest `protobuf:"bytes,7,opt,name=prewrite" json:"prewrite,omitempty"` - DeleteRange *DeleteRangeRequest `protobuf:"bytes,8,opt,name=delete_range,json=deleteRange" json:"delete_range,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Request) Reset() { *m = Request{} } -func (m *Request) String() string { return proto.CompactTextString(m) } -func (*Request) ProtoMessage() {} -func (*Request) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{12} } - -func (m *Request) GetCmdType() CmdType { - if m != nil && m.CmdType != nil { - return *m.CmdType - } - return CmdType_Invalid -} - -func (m *Request) GetGet() *GetRequest { - if m != nil { - return m.Get - } - return nil -} - -func (m *Request) GetPut() *PutRequest { - if m != nil { - return m.Put - } - return nil -} - -func (m *Request) GetDelete() *DeleteRequest { - if m != nil { - return m.Delete - } - return nil -} - -func (m *Request) GetSnap() *SnapRequest { - if m != nil { - return m.Snap - } - return nil -} - -func (m *Request) GetPrewrite() *PrewriteRequest { - if m != nil { - return m.Prewrite - } - return nil -} - -func (m *Request) GetDeleteRange() *DeleteRangeRequest { - if m != nil { - return m.DeleteRange - } - return nil -} - -type Response struct { - CmdType *CmdType `protobuf:"varint,1,opt,name=cmd_type,json=cmdType,enum=raft_cmdpb.CmdType" json:"cmd_type,omitempty"` - Get *GetResponse `protobuf:"bytes,2,opt,name=get" json:"get,omitempty"` - Put *PutResponse `protobuf:"bytes,4,opt,name=put" json:"put,omitempty"` - Delete *DeleteResponse `protobuf:"bytes,5,opt,name=delete" json:"delete,omitempty"` - Snap *SnapResponse `protobuf:"bytes,6,opt,name=snap" json:"snap,omitempty"` - Prewrite *PrewriteResponse `protobuf:"bytes,7,opt,name=prewrite" json:"prewrite,omitempty"` - DelteRange *DeleteRangeResponse `protobuf:"bytes,8,opt,name=delte_range,json=delteRange" json:"delte_range,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *Response) Reset() { *m = Response{} } -func (m *Response) String() string { return proto.CompactTextString(m) } -func (*Response) ProtoMessage() {} -func (*Response) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{13} } - -func (m *Response) GetCmdType() CmdType { - if m != nil && m.CmdType != nil { - return *m.CmdType - } - return CmdType_Invalid -} - -func (m *Response) GetGet() *GetResponse { - if m != nil { - return m.Get - } - return nil -} - -func (m *Response) GetPut() *PutResponse { - if m != nil { - return m.Put - } - return nil -} - -func (m *Response) GetDelete() *DeleteResponse { - if m != nil { - return m.Delete - } - return nil -} - -func (m *Response) GetSnap() *SnapResponse { - if m != nil { - return m.Snap - } - return nil -} - -func (m *Response) GetPrewrite() *PrewriteResponse { - if m != nil { - return m.Prewrite - } - return nil -} - -func (m *Response) GetDelteRange() *DeleteRangeResponse { - if m != nil { - return m.DelteRange - } - return nil -} - -type ChangePeerRequest struct { - // This can be only called in internal RaftStore now. - ChangeType *eraftpb.ConfChangeType `protobuf:"varint,1,opt,name=change_type,json=changeType,enum=eraftpb.ConfChangeType" json:"change_type,omitempty"` - Peer *metapb.Peer `protobuf:"bytes,2,opt,name=peer" json:"peer,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *ChangePeerRequest) Reset() { *m = ChangePeerRequest{} } -func (m *ChangePeerRequest) String() string { return proto.CompactTextString(m) } -func (*ChangePeerRequest) ProtoMessage() {} -func (*ChangePeerRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{14} } - -func (m *ChangePeerRequest) GetChangeType() eraftpb.ConfChangeType { - if m != nil && m.ChangeType != nil { - return *m.ChangeType - } - return eraftpb.ConfChangeType_AddNode -} - -func (m *ChangePeerRequest) GetPeer() *metapb.Peer { - if m != nil { - return m.Peer - } - return nil -} - -type ChangePeerResponse struct { - Region *metapb.Region `protobuf:"bytes,1,opt,name=region" json:"region,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *ChangePeerResponse) Reset() { *m = ChangePeerResponse{} } -func (m *ChangePeerResponse) String() string { return proto.CompactTextString(m) } -func (*ChangePeerResponse) ProtoMessage() {} -func (*ChangePeerResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{15} } - -func (m *ChangePeerResponse) GetRegion() *metapb.Region { - if m != nil { - return m.Region - } - return nil -} - -type SplitRequest struct { - // This can be only called in internal RaftStore now. - // The split_key must be in the been splitting region. - SplitKey []byte `protobuf:"bytes,1,opt,name=split_key,json=splitKey" json:"split_key,omitempty"` - // We split the region into two, first uses the origin - // parent region id, and the second uses the new_region_id. - // We must guarantee that the new_region_id is global unique. - NewRegionId *uint64 `protobuf:"varint,2,opt,name=new_region_id,json=newRegionId" json:"new_region_id,omitempty"` - // The peer ids for the new split region. - NewPeerIds []uint64 `protobuf:"varint,3,rep,name=new_peer_ids,json=newPeerIds" json:"new_peer_ids,omitempty"` - // If true, right region derive the origin region_id, - // left region use new_region_id. - RightDerive *bool `protobuf:"varint,4,opt,name=right_derive,json=rightDerive" json:"right_derive,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *SplitRequest) Reset() { *m = SplitRequest{} } -func (m *SplitRequest) String() string { return proto.CompactTextString(m) } -func (*SplitRequest) ProtoMessage() {} -func (*SplitRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{16} } - -func (m *SplitRequest) GetSplitKey() []byte { - if m != nil { - return m.SplitKey - } - return nil -} - -func (m *SplitRequest) GetNewRegionId() uint64 { - if m != nil && m.NewRegionId != nil { - return *m.NewRegionId - } - return 0 -} - -func (m *SplitRequest) GetNewPeerIds() []uint64 { - if m != nil { - return m.NewPeerIds - } - return nil -} - -func (m *SplitRequest) GetRightDerive() bool { - if m != nil && m.RightDerive != nil { - return *m.RightDerive - } - return false -} - -type SplitResponse struct { - Left *metapb.Region `protobuf:"bytes,1,opt,name=left" json:"left,omitempty"` - Right *metapb.Region `protobuf:"bytes,2,opt,name=right" json:"right,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *SplitResponse) Reset() { *m = SplitResponse{} } -func (m *SplitResponse) String() string { return proto.CompactTextString(m) } -func (*SplitResponse) ProtoMessage() {} -func (*SplitResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{17} } - -func (m *SplitResponse) GetLeft() *metapb.Region { - if m != nil { - return m.Left - } - return nil -} - -func (m *SplitResponse) GetRight() *metapb.Region { - if m != nil { - return m.Right - } - return nil -} - -type CompactLogRequest struct { - CompactIndex *uint64 `protobuf:"varint,1,opt,name=compact_index,json=compactIndex" json:"compact_index,omitempty"` - CompactTerm *uint64 `protobuf:"varint,2,opt,name=compact_term,json=compactTerm" json:"compact_term,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *CompactLogRequest) Reset() { *m = CompactLogRequest{} } -func (m *CompactLogRequest) String() string { return proto.CompactTextString(m) } -func (*CompactLogRequest) ProtoMessage() {} -func (*CompactLogRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{18} } - -func (m *CompactLogRequest) GetCompactIndex() uint64 { - if m != nil && m.CompactIndex != nil { - return *m.CompactIndex - } - return 0 -} - -func (m *CompactLogRequest) GetCompactTerm() uint64 { - if m != nil && m.CompactTerm != nil { - return *m.CompactTerm - } - return 0 -} - -type CompactLogResponse struct { - XXX_unrecognized []byte `json:"-"` -} - -func (m *CompactLogResponse) Reset() { *m = CompactLogResponse{} } -func (m *CompactLogResponse) String() string { return proto.CompactTextString(m) } -func (*CompactLogResponse) ProtoMessage() {} -func (*CompactLogResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{19} } - -type TransferLeaderRequest struct { - Peer *metapb.Peer `protobuf:"bytes,1,opt,name=peer" json:"peer,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *TransferLeaderRequest) Reset() { *m = TransferLeaderRequest{} } -func (m *TransferLeaderRequest) String() string { return proto.CompactTextString(m) } -func (*TransferLeaderRequest) ProtoMessage() {} -func (*TransferLeaderRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{20} } - -func (m *TransferLeaderRequest) GetPeer() *metapb.Peer { - if m != nil { - return m.Peer - } - return nil -} - -type TransferLeaderResponse struct { - XXX_unrecognized []byte `json:"-"` -} - -func (m *TransferLeaderResponse) Reset() { *m = TransferLeaderResponse{} } -func (m *TransferLeaderResponse) String() string { return proto.CompactTextString(m) } -func (*TransferLeaderResponse) ProtoMessage() {} -func (*TransferLeaderResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{21} } - -type VerifyHashRequest struct { - Index *uint64 `protobuf:"varint,1,opt,name=index" json:"index,omitempty"` - Hash []byte `protobuf:"bytes,2,opt,name=hash" json:"hash,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *VerifyHashRequest) Reset() { *m = VerifyHashRequest{} } -func (m *VerifyHashRequest) String() string { return proto.CompactTextString(m) } -func (*VerifyHashRequest) ProtoMessage() {} -func (*VerifyHashRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{22} } - -func (m *VerifyHashRequest) GetIndex() uint64 { - if m != nil && m.Index != nil { - return *m.Index - } - return 0 -} - -func (m *VerifyHashRequest) GetHash() []byte { - if m != nil { - return m.Hash - } - return nil -} - -type VerifyHashResponse struct { - XXX_unrecognized []byte `json:"-"` -} - -func (m *VerifyHashResponse) Reset() { *m = VerifyHashResponse{} } -func (m *VerifyHashResponse) String() string { return proto.CompactTextString(m) } -func (*VerifyHashResponse) ProtoMessage() {} -func (*VerifyHashResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{23} } - -type AdminRequest struct { - CmdType *AdminCmdType `protobuf:"varint,1,opt,name=cmd_type,json=cmdType,enum=raft_cmdpb.AdminCmdType" json:"cmd_type,omitempty"` - ChangePeer *ChangePeerRequest `protobuf:"bytes,2,opt,name=change_peer,json=changePeer" json:"change_peer,omitempty"` - Split *SplitRequest `protobuf:"bytes,3,opt,name=split" json:"split,omitempty"` - CompactLog *CompactLogRequest `protobuf:"bytes,4,opt,name=compact_log,json=compactLog" json:"compact_log,omitempty"` - TransferLeader *TransferLeaderRequest `protobuf:"bytes,5,opt,name=transfer_leader,json=transferLeader" json:"transfer_leader,omitempty"` - VerifyHash *VerifyHashRequest `protobuf:"bytes,6,opt,name=verify_hash,json=verifyHash" json:"verify_hash,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *AdminRequest) Reset() { *m = AdminRequest{} } -func (m *AdminRequest) String() string { return proto.CompactTextString(m) } -func (*AdminRequest) ProtoMessage() {} -func (*AdminRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{24} } - -func (m *AdminRequest) GetCmdType() AdminCmdType { - if m != nil && m.CmdType != nil { - return *m.CmdType - } - return AdminCmdType_InvalidAdmin -} - -func (m *AdminRequest) GetChangePeer() *ChangePeerRequest { - if m != nil { - return m.ChangePeer - } - return nil -} - -func (m *AdminRequest) GetSplit() *SplitRequest { - if m != nil { - return m.Split - } - return nil -} - -func (m *AdminRequest) GetCompactLog() *CompactLogRequest { - if m != nil { - return m.CompactLog - } - return nil -} - -func (m *AdminRequest) GetTransferLeader() *TransferLeaderRequest { - if m != nil { - return m.TransferLeader - } - return nil -} - -func (m *AdminRequest) GetVerifyHash() *VerifyHashRequest { - if m != nil { - return m.VerifyHash - } - return nil -} - -type AdminResponse struct { - CmdType *AdminCmdType `protobuf:"varint,1,opt,name=cmd_type,json=cmdType,enum=raft_cmdpb.AdminCmdType" json:"cmd_type,omitempty"` - ChangePeer *ChangePeerResponse `protobuf:"bytes,2,opt,name=change_peer,json=changePeer" json:"change_peer,omitempty"` - Split *SplitResponse `protobuf:"bytes,3,opt,name=split" json:"split,omitempty"` - CompactLog *CompactLogResponse `protobuf:"bytes,4,opt,name=compact_log,json=compactLog" json:"compact_log,omitempty"` - TransferLeader *TransferLeaderResponse `protobuf:"bytes,5,opt,name=transfer_leader,json=transferLeader" json:"transfer_leader,omitempty"` - VerifyHash *VerifyHashResponse `protobuf:"bytes,6,opt,name=verify_hash,json=verifyHash" json:"verify_hash,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *AdminResponse) Reset() { *m = AdminResponse{} } -func (m *AdminResponse) String() string { return proto.CompactTextString(m) } -func (*AdminResponse) ProtoMessage() {} -func (*AdminResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{25} } - -func (m *AdminResponse) GetCmdType() AdminCmdType { - if m != nil && m.CmdType != nil { - return *m.CmdType - } - return AdminCmdType_InvalidAdmin -} - -func (m *AdminResponse) GetChangePeer() *ChangePeerResponse { - if m != nil { - return m.ChangePeer - } - return nil -} - -func (m *AdminResponse) GetSplit() *SplitResponse { - if m != nil { - return m.Split - } - return nil -} - -func (m *AdminResponse) GetCompactLog() *CompactLogResponse { - if m != nil { - return m.CompactLog - } - return nil -} - -func (m *AdminResponse) GetTransferLeader() *TransferLeaderResponse { - if m != nil { - return m.TransferLeader - } - return nil -} - -func (m *AdminResponse) GetVerifyHash() *VerifyHashResponse { - if m != nil { - return m.VerifyHash - } - return nil -} - -// For get the leader of the region. -type RegionLeaderRequest struct { - XXX_unrecognized []byte `json:"-"` -} - -func (m *RegionLeaderRequest) Reset() { *m = RegionLeaderRequest{} } -func (m *RegionLeaderRequest) String() string { return proto.CompactTextString(m) } -func (*RegionLeaderRequest) ProtoMessage() {} -func (*RegionLeaderRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{26} } - -type RegionLeaderResponse struct { - Leader *metapb.Peer `protobuf:"bytes,1,opt,name=leader" json:"leader,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *RegionLeaderResponse) Reset() { *m = RegionLeaderResponse{} } -func (m *RegionLeaderResponse) String() string { return proto.CompactTextString(m) } -func (*RegionLeaderResponse) ProtoMessage() {} -func (*RegionLeaderResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{27} } - -func (m *RegionLeaderResponse) GetLeader() *metapb.Peer { - if m != nil { - return m.Leader - } - return nil -} - -// For getting more information of the region. -// We add some admin operations (ChangePeer, Split...) into the pb job list, -// then pd server will peek the first one, handle it and then pop it from the job lib. -// But sometimes, the pd server may crash before popping. When another pd server -// starts and finds the job is running but not finished, it will first check whether -// the raft server already has handled this job. -// E,g, for ChangePeer, if we add Peer10 into region1 and find region1 has already had -// Peer10, we can think this ChangePeer is finished, and can pop this job from job list -// directly. -type RegionDetailRequest struct { - XXX_unrecognized []byte `json:"-"` -} - -func (m *RegionDetailRequest) Reset() { *m = RegionDetailRequest{} } -func (m *RegionDetailRequest) String() string { return proto.CompactTextString(m) } -func (*RegionDetailRequest) ProtoMessage() {} -func (*RegionDetailRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{28} } - -type RegionDetailResponse struct { - Region *metapb.Region `protobuf:"bytes,1,opt,name=region" json:"region,omitempty"` - Leader *metapb.Peer `protobuf:"bytes,2,opt,name=leader" json:"leader,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *RegionDetailResponse) Reset() { *m = RegionDetailResponse{} } -func (m *RegionDetailResponse) String() string { return proto.CompactTextString(m) } -func (*RegionDetailResponse) ProtoMessage() {} -func (*RegionDetailResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{29} } - -func (m *RegionDetailResponse) GetRegion() *metapb.Region { - if m != nil { - return m.Region - } - return nil -} - -func (m *RegionDetailResponse) GetLeader() *metapb.Peer { - if m != nil { - return m.Leader - } - return nil -} - -type StatusRequest struct { - CmdType *StatusCmdType `protobuf:"varint,1,opt,name=cmd_type,json=cmdType,enum=raft_cmdpb.StatusCmdType" json:"cmd_type,omitempty"` - RegionLeader *RegionLeaderRequest `protobuf:"bytes,2,opt,name=region_leader,json=regionLeader" json:"region_leader,omitempty"` - RegionDetail *RegionDetailRequest `protobuf:"bytes,3,opt,name=region_detail,json=regionDetail" json:"region_detail,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *StatusRequest) Reset() { *m = StatusRequest{} } -func (m *StatusRequest) String() string { return proto.CompactTextString(m) } -func (*StatusRequest) ProtoMessage() {} -func (*StatusRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{30} } - -func (m *StatusRequest) GetCmdType() StatusCmdType { - if m != nil && m.CmdType != nil { - return *m.CmdType - } - return StatusCmdType_InvalidStatus -} - -func (m *StatusRequest) GetRegionLeader() *RegionLeaderRequest { - if m != nil { - return m.RegionLeader - } - return nil -} - -func (m *StatusRequest) GetRegionDetail() *RegionDetailRequest { - if m != nil { - return m.RegionDetail - } - return nil -} - -type StatusResponse struct { - CmdType *StatusCmdType `protobuf:"varint,1,opt,name=cmd_type,json=cmdType,enum=raft_cmdpb.StatusCmdType" json:"cmd_type,omitempty"` - RegionLeader *RegionLeaderResponse `protobuf:"bytes,2,opt,name=region_leader,json=regionLeader" json:"region_leader,omitempty"` - RegionDetail *RegionDetailResponse `protobuf:"bytes,3,opt,name=region_detail,json=regionDetail" json:"region_detail,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *StatusResponse) Reset() { *m = StatusResponse{} } -func (m *StatusResponse) String() string { return proto.CompactTextString(m) } -func (*StatusResponse) ProtoMessage() {} -func (*StatusResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{31} } - -func (m *StatusResponse) GetCmdType() StatusCmdType { - if m != nil && m.CmdType != nil { - return *m.CmdType - } - return StatusCmdType_InvalidStatus -} - -func (m *StatusResponse) GetRegionLeader() *RegionLeaderResponse { - if m != nil { - return m.RegionLeader - } - return nil -} - -func (m *StatusResponse) GetRegionDetail() *RegionDetailResponse { - if m != nil { - return m.RegionDetail - } - return nil -} - -type RaftRequestHeader struct { - RegionId *uint64 `protobuf:"varint,1,opt,name=region_id,json=regionId" json:"region_id,omitempty"` - Peer *metapb.Peer `protobuf:"bytes,2,opt,name=peer" json:"peer,omitempty"` - // true for read linearization - ReadQuorum *bool `protobuf:"varint,3,opt,name=read_quorum,json=readQuorum" json:"read_quorum,omitempty"` - // 16 bytes, to distinguish request. - Uuid []byte `protobuf:"bytes,4,opt,name=uuid" json:"uuid,omitempty"` - RegionEpoch *metapb.RegionEpoch `protobuf:"bytes,5,opt,name=region_epoch,json=regionEpoch" json:"region_epoch,omitempty"` - Term *uint64 `protobuf:"varint,6,opt,name=term" json:"term,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *RaftRequestHeader) Reset() { *m = RaftRequestHeader{} } -func (m *RaftRequestHeader) String() string { return proto.CompactTextString(m) } -func (*RaftRequestHeader) ProtoMessage() {} -func (*RaftRequestHeader) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{32} } - -func (m *RaftRequestHeader) GetRegionId() uint64 { - if m != nil && m.RegionId != nil { - return *m.RegionId - } - return 0 -} - -func (m *RaftRequestHeader) GetPeer() *metapb.Peer { - if m != nil { - return m.Peer - } - return nil -} - -func (m *RaftRequestHeader) GetReadQuorum() bool { - if m != nil && m.ReadQuorum != nil { - return *m.ReadQuorum - } - return false -} - -func (m *RaftRequestHeader) GetUuid() []byte { - if m != nil { - return m.Uuid - } - return nil -} - -func (m *RaftRequestHeader) GetRegionEpoch() *metapb.RegionEpoch { - if m != nil { - return m.RegionEpoch - } - return nil -} - -func (m *RaftRequestHeader) GetTerm() uint64 { - if m != nil && m.Term != nil { - return *m.Term - } - return 0 -} - -type RaftResponseHeader struct { - Error *errorpb.Error `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"` - Uuid []byte `protobuf:"bytes,2,opt,name=uuid" json:"uuid,omitempty"` - CurrentTerm *uint64 `protobuf:"varint,3,opt,name=current_term,json=currentTerm" json:"current_term,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *RaftResponseHeader) Reset() { *m = RaftResponseHeader{} } -func (m *RaftResponseHeader) String() string { return proto.CompactTextString(m) } -func (*RaftResponseHeader) ProtoMessage() {} -func (*RaftResponseHeader) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{33} } - -func (m *RaftResponseHeader) GetError() *errorpb.Error { - if m != nil { - return m.Error - } - return nil -} - -func (m *RaftResponseHeader) GetUuid() []byte { - if m != nil { - return m.Uuid - } - return nil -} - -func (m *RaftResponseHeader) GetCurrentTerm() uint64 { - if m != nil && m.CurrentTerm != nil { - return *m.CurrentTerm - } - return 0 -} - -type RaftCmdRequest struct { - Header *RaftRequestHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` - // We can't enclose normal requests and administrator request - // at same time. - Requests []*Request `protobuf:"bytes,2,rep,name=requests" json:"requests,omitempty"` - AdminRequest *AdminRequest `protobuf:"bytes,3,opt,name=admin_request,json=adminRequest" json:"admin_request,omitempty"` - StatusRequest *StatusRequest `protobuf:"bytes,4,opt,name=status_request,json=statusRequest" json:"status_request,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *RaftCmdRequest) Reset() { *m = RaftCmdRequest{} } -func (m *RaftCmdRequest) String() string { return proto.CompactTextString(m) } -func (*RaftCmdRequest) ProtoMessage() {} -func (*RaftCmdRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{34} } - -func (m *RaftCmdRequest) GetHeader() *RaftRequestHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *RaftCmdRequest) GetRequests() []*Request { - if m != nil { - return m.Requests - } - return nil -} - -func (m *RaftCmdRequest) GetAdminRequest() *AdminRequest { - if m != nil { - return m.AdminRequest - } - return nil -} - -func (m *RaftCmdRequest) GetStatusRequest() *StatusRequest { - if m != nil { - return m.StatusRequest - } - return nil -} - -type RaftCmdResponse struct { - Header *RaftResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` - Responses []*Response `protobuf:"bytes,2,rep,name=responses" json:"responses,omitempty"` - AdminResponse *AdminResponse `protobuf:"bytes,3,opt,name=admin_response,json=adminResponse" json:"admin_response,omitempty"` - StatusResponse *StatusResponse `protobuf:"bytes,4,opt,name=status_response,json=statusResponse" json:"status_response,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *RaftCmdResponse) Reset() { *m = RaftCmdResponse{} } -func (m *RaftCmdResponse) String() string { return proto.CompactTextString(m) } -func (*RaftCmdResponse) ProtoMessage() {} -func (*RaftCmdResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{35} } - -func (m *RaftCmdResponse) GetHeader() *RaftResponseHeader { - if m != nil { - return m.Header - } - return nil -} - -func (m *RaftCmdResponse) GetResponses() []*Response { - if m != nil { - return m.Responses - } - return nil -} - -func (m *RaftCmdResponse) GetAdminResponse() *AdminResponse { - if m != nil { - return m.AdminResponse - } - return nil -} - -func (m *RaftCmdResponse) GetStatusResponse() *StatusResponse { - if m != nil { - return m.StatusResponse - } - return nil -} - -func init() { - proto.RegisterType((*GetRequest)(nil), "raft_cmdpb.GetRequest") - proto.RegisterType((*GetResponse)(nil), "raft_cmdpb.GetResponse") - proto.RegisterType((*PutRequest)(nil), "raft_cmdpb.PutRequest") - proto.RegisterType((*PutResponse)(nil), "raft_cmdpb.PutResponse") - proto.RegisterType((*DeleteRequest)(nil), "raft_cmdpb.DeleteRequest") - proto.RegisterType((*DeleteResponse)(nil), "raft_cmdpb.DeleteResponse") - proto.RegisterType((*DeleteRangeRequest)(nil), "raft_cmdpb.DeleteRangeRequest") - proto.RegisterType((*DeleteRangeResponse)(nil), "raft_cmdpb.DeleteRangeResponse") - proto.RegisterType((*SnapRequest)(nil), "raft_cmdpb.SnapRequest") - proto.RegisterType((*SnapResponse)(nil), "raft_cmdpb.SnapResponse") - proto.RegisterType((*PrewriteRequest)(nil), "raft_cmdpb.PrewriteRequest") - proto.RegisterType((*PrewriteResponse)(nil), "raft_cmdpb.PrewriteResponse") - proto.RegisterType((*Request)(nil), "raft_cmdpb.Request") - proto.RegisterType((*Response)(nil), "raft_cmdpb.Response") - proto.RegisterType((*ChangePeerRequest)(nil), "raft_cmdpb.ChangePeerRequest") - proto.RegisterType((*ChangePeerResponse)(nil), "raft_cmdpb.ChangePeerResponse") - proto.RegisterType((*SplitRequest)(nil), "raft_cmdpb.SplitRequest") - proto.RegisterType((*SplitResponse)(nil), "raft_cmdpb.SplitResponse") - proto.RegisterType((*CompactLogRequest)(nil), "raft_cmdpb.CompactLogRequest") - proto.RegisterType((*CompactLogResponse)(nil), "raft_cmdpb.CompactLogResponse") - proto.RegisterType((*TransferLeaderRequest)(nil), "raft_cmdpb.TransferLeaderRequest") - proto.RegisterType((*TransferLeaderResponse)(nil), "raft_cmdpb.TransferLeaderResponse") - proto.RegisterType((*VerifyHashRequest)(nil), "raft_cmdpb.VerifyHashRequest") - proto.RegisterType((*VerifyHashResponse)(nil), "raft_cmdpb.VerifyHashResponse") - proto.RegisterType((*AdminRequest)(nil), "raft_cmdpb.AdminRequest") - proto.RegisterType((*AdminResponse)(nil), "raft_cmdpb.AdminResponse") - proto.RegisterType((*RegionLeaderRequest)(nil), "raft_cmdpb.RegionLeaderRequest") - proto.RegisterType((*RegionLeaderResponse)(nil), "raft_cmdpb.RegionLeaderResponse") - proto.RegisterType((*RegionDetailRequest)(nil), "raft_cmdpb.RegionDetailRequest") - proto.RegisterType((*RegionDetailResponse)(nil), "raft_cmdpb.RegionDetailResponse") - proto.RegisterType((*StatusRequest)(nil), "raft_cmdpb.StatusRequest") - proto.RegisterType((*StatusResponse)(nil), "raft_cmdpb.StatusResponse") - proto.RegisterType((*RaftRequestHeader)(nil), "raft_cmdpb.RaftRequestHeader") - proto.RegisterType((*RaftResponseHeader)(nil), "raft_cmdpb.RaftResponseHeader") - proto.RegisterType((*RaftCmdRequest)(nil), "raft_cmdpb.RaftCmdRequest") - proto.RegisterType((*RaftCmdResponse)(nil), "raft_cmdpb.RaftCmdResponse") - proto.RegisterEnum("raft_cmdpb.CmdType", CmdType_name, CmdType_value) - proto.RegisterEnum("raft_cmdpb.AdminCmdType", AdminCmdType_name, AdminCmdType_value) - proto.RegisterEnum("raft_cmdpb.StatusCmdType", StatusCmdType_name, StatusCmdType_value) -} -func (m *GetRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Cf != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(*m.Cf))) - i += copy(dAtA[i:], *m.Cf) - } - if m.Key != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *GetResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Value != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *PutRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PutRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Cf != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(*m.Cf))) - i += copy(dAtA[i:], *m.Cf) - } - if m.Key != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - if m.Value != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *PutResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PutResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *DeleteRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Cf != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(*m.Cf))) - i += copy(dAtA[i:], *m.Cf) - } - if m.Key != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *DeleteResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *DeleteRangeRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteRangeRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Cf != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(*m.Cf))) - i += copy(dAtA[i:], *m.Cf) - } - if m.StartKey != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.StartKey))) - i += copy(dAtA[i:], m.StartKey) - } - if m.EndKey != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.EndKey))) - i += copy(dAtA[i:], m.EndKey) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *DeleteRangeResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DeleteRangeResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *SnapRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SnapRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *SnapResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SnapResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Region != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Region.Size())) - n1, err := m.Region.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *PrewriteRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PrewriteRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Key != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - if m.Value != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) - } - if m.Lock != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.Lock))) - i += copy(dAtA[i:], m.Lock) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *PrewriteResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PrewriteResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Request) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Request) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.CmdType != nil { - dAtA[i] = 0x8 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.CmdType)) - } - if m.Get != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Get.Size())) - n2, err := m.Get.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 - } - if m.Put != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Put.Size())) - n3, err := m.Put.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n3 - } - if m.Delete != nil { - dAtA[i] = 0x2a - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Delete.Size())) - n4, err := m.Delete.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n4 - } - if m.Snap != nil { - dAtA[i] = 0x32 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Snap.Size())) - n5, err := m.Snap.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n5 - } - if m.Prewrite != nil { - dAtA[i] = 0x3a - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Prewrite.Size())) - n6, err := m.Prewrite.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n6 - } - if m.DeleteRange != nil { - dAtA[i] = 0x42 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.DeleteRange.Size())) - n7, err := m.DeleteRange.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n7 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Response) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Response) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.CmdType != nil { - dAtA[i] = 0x8 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.CmdType)) - } - if m.Get != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Get.Size())) - n8, err := m.Get.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n8 - } - if m.Put != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Put.Size())) - n9, err := m.Put.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n9 - } - if m.Delete != nil { - dAtA[i] = 0x2a - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Delete.Size())) - n10, err := m.Delete.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n10 - } - if m.Snap != nil { - dAtA[i] = 0x32 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Snap.Size())) - n11, err := m.Snap.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n11 - } - if m.Prewrite != nil { - dAtA[i] = 0x3a - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Prewrite.Size())) - n12, err := m.Prewrite.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n12 - } - if m.DelteRange != nil { - dAtA[i] = 0x42 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.DelteRange.Size())) - n13, err := m.DelteRange.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n13 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *ChangePeerRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ChangePeerRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.ChangeType != nil { - dAtA[i] = 0x8 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.ChangeType)) - } - if m.Peer != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Peer.Size())) - n14, err := m.Peer.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n14 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *ChangePeerResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ChangePeerResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Region != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Region.Size())) - n15, err := m.Region.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n15 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *SplitRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SplitRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.SplitKey != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.SplitKey))) - i += copy(dAtA[i:], m.SplitKey) - } - if m.NewRegionId != nil { - dAtA[i] = 0x10 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.NewRegionId)) - } - if len(m.NewPeerIds) > 0 { - for _, num := range m.NewPeerIds { - dAtA[i] = 0x18 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(num)) - } - } - if m.RightDerive != nil { - dAtA[i] = 0x20 - i++ - if *m.RightDerive { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *SplitResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SplitResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Left != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Left.Size())) - n16, err := m.Left.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n16 - } - if m.Right != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Right.Size())) - n17, err := m.Right.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n17 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *CompactLogRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CompactLogRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.CompactIndex != nil { - dAtA[i] = 0x8 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.CompactIndex)) - } - if m.CompactTerm != nil { - dAtA[i] = 0x10 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.CompactTerm)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *CompactLogResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CompactLogResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *TransferLeaderRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TransferLeaderRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Peer != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Peer.Size())) - n18, err := m.Peer.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n18 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *TransferLeaderResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TransferLeaderResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *VerifyHashRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VerifyHashRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Index != nil { - dAtA[i] = 0x8 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.Index)) - } - if m.Hash != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.Hash))) - i += copy(dAtA[i:], m.Hash) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *VerifyHashResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VerifyHashResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *AdminRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AdminRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.CmdType != nil { - dAtA[i] = 0x8 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.CmdType)) - } - if m.ChangePeer != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.ChangePeer.Size())) - n19, err := m.ChangePeer.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n19 - } - if m.Split != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Split.Size())) - n20, err := m.Split.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n20 - } - if m.CompactLog != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.CompactLog.Size())) - n21, err := m.CompactLog.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n21 - } - if m.TransferLeader != nil { - dAtA[i] = 0x2a - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.TransferLeader.Size())) - n22, err := m.TransferLeader.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n22 - } - if m.VerifyHash != nil { - dAtA[i] = 0x32 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.VerifyHash.Size())) - n23, err := m.VerifyHash.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n23 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *AdminResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AdminResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.CmdType != nil { - dAtA[i] = 0x8 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.CmdType)) - } - if m.ChangePeer != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.ChangePeer.Size())) - n24, err := m.ChangePeer.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n24 - } - if m.Split != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Split.Size())) - n25, err := m.Split.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n25 - } - if m.CompactLog != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.CompactLog.Size())) - n26, err := m.CompactLog.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n26 - } - if m.TransferLeader != nil { - dAtA[i] = 0x2a - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.TransferLeader.Size())) - n27, err := m.TransferLeader.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n27 - } - if m.VerifyHash != nil { - dAtA[i] = 0x32 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.VerifyHash.Size())) - n28, err := m.VerifyHash.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n28 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *RegionLeaderRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RegionLeaderRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *RegionLeaderResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RegionLeaderResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Leader != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Leader.Size())) - n29, err := m.Leader.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n29 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *RegionDetailRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RegionDetailRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *RegionDetailResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RegionDetailResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Region != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Region.Size())) - n30, err := m.Region.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n30 - } - if m.Leader != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Leader.Size())) - n31, err := m.Leader.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n31 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *StatusRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StatusRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.CmdType != nil { - dAtA[i] = 0x8 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.CmdType)) - } - if m.RegionLeader != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.RegionLeader.Size())) - n32, err := m.RegionLeader.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n32 - } - if m.RegionDetail != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.RegionDetail.Size())) - n33, err := m.RegionDetail.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n33 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *StatusResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StatusResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.CmdType != nil { - dAtA[i] = 0x8 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.CmdType)) - } - if m.RegionLeader != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.RegionLeader.Size())) - n34, err := m.RegionLeader.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n34 - } - if m.RegionDetail != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.RegionDetail.Size())) - n35, err := m.RegionDetail.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n35 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *RaftRequestHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RaftRequestHeader) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionId != nil { - dAtA[i] = 0x8 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.RegionId)) - } - if m.Peer != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Peer.Size())) - n36, err := m.Peer.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n36 - } - if m.ReadQuorum != nil { - dAtA[i] = 0x18 - i++ - if *m.ReadQuorum { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - } - if m.Uuid != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.Uuid))) - i += copy(dAtA[i:], m.Uuid) - } - if m.RegionEpoch != nil { - dAtA[i] = 0x2a - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.RegionEpoch.Size())) - n37, err := m.RegionEpoch.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n37 - } - if m.Term != nil { - dAtA[i] = 0x30 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.Term)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *RaftResponseHeader) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RaftResponseHeader) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Error != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Error.Size())) - n38, err := m.Error.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n38 - } - if m.Uuid != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(len(m.Uuid))) - i += copy(dAtA[i:], m.Uuid) - } - if m.CurrentTerm != nil { - dAtA[i] = 0x18 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(*m.CurrentTerm)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *RaftCmdRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RaftCmdRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Header.Size())) - n39, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n39 - } - if len(m.Requests) > 0 { - for _, msg := range m.Requests { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.AdminRequest != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.AdminRequest.Size())) - n40, err := m.AdminRequest.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n40 - } - if m.StatusRequest != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.StatusRequest.Size())) - n41, err := m.StatusRequest.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n41 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *RaftCmdResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RaftCmdResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.Header.Size())) - n42, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n42 - } - if len(m.Responses) > 0 { - for _, msg := range m.Responses { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.AdminResponse != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.AdminResponse.Size())) - n43, err := m.AdminResponse.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n43 - } - if m.StatusResponse != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintRaftCmdpb(dAtA, i, uint64(m.StatusResponse.Size())) - n44, err := m.StatusResponse.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n44 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func encodeFixed64RaftCmdpb(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32RaftCmdpb(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintRaftCmdpb(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *GetRequest) Size() (n int) { - var l int - _ = l - if m.Cf != nil { - l = len(*m.Cf) - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.Key != nil { - l = len(m.Key) - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *GetResponse) Size() (n int) { - var l int - _ = l - if m.Value != nil { - l = len(m.Value) - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PutRequest) Size() (n int) { - var l int - _ = l - if m.Cf != nil { - l = len(*m.Cf) - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.Key != nil { - l = len(m.Key) - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.Value != nil { - l = len(m.Value) - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PutResponse) Size() (n int) { - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DeleteRequest) Size() (n int) { - var l int - _ = l - if m.Cf != nil { - l = len(*m.Cf) - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.Key != nil { - l = len(m.Key) - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DeleteResponse) Size() (n int) { - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DeleteRangeRequest) Size() (n int) { - var l int - _ = l - if m.Cf != nil { - l = len(*m.Cf) - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.StartKey != nil { - l = len(m.StartKey) - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.EndKey != nil { - l = len(m.EndKey) - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *DeleteRangeResponse) Size() (n int) { - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SnapRequest) Size() (n int) { - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SnapResponse) Size() (n int) { - var l int - _ = l - if m.Region != nil { - l = m.Region.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PrewriteRequest) Size() (n int) { - var l int - _ = l - if m.Key != nil { - l = len(m.Key) - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.Value != nil { - l = len(m.Value) - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.Lock != nil { - l = len(m.Lock) - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PrewriteResponse) Size() (n int) { - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Request) Size() (n int) { - var l int - _ = l - if m.CmdType != nil { - n += 1 + sovRaftCmdpb(uint64(*m.CmdType)) - } - if m.Get != nil { - l = m.Get.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.Put != nil { - l = m.Put.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.Delete != nil { - l = m.Delete.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.Snap != nil { - l = m.Snap.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.Prewrite != nil { - l = m.Prewrite.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.DeleteRange != nil { - l = m.DeleteRange.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Response) Size() (n int) { - var l int - _ = l - if m.CmdType != nil { - n += 1 + sovRaftCmdpb(uint64(*m.CmdType)) - } - if m.Get != nil { - l = m.Get.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.Put != nil { - l = m.Put.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.Delete != nil { - l = m.Delete.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.Snap != nil { - l = m.Snap.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.Prewrite != nil { - l = m.Prewrite.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.DelteRange != nil { - l = m.DelteRange.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ChangePeerRequest) Size() (n int) { - var l int - _ = l - if m.ChangeType != nil { - n += 1 + sovRaftCmdpb(uint64(*m.ChangeType)) - } - if m.Peer != nil { - l = m.Peer.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ChangePeerResponse) Size() (n int) { - var l int - _ = l - if m.Region != nil { - l = m.Region.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SplitRequest) Size() (n int) { - var l int - _ = l - if m.SplitKey != nil { - l = len(m.SplitKey) - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.NewRegionId != nil { - n += 1 + sovRaftCmdpb(uint64(*m.NewRegionId)) - } - if len(m.NewPeerIds) > 0 { - for _, e := range m.NewPeerIds { - n += 1 + sovRaftCmdpb(uint64(e)) - } - } - if m.RightDerive != nil { - n += 2 - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SplitResponse) Size() (n int) { - var l int - _ = l - if m.Left != nil { - l = m.Left.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.Right != nil { - l = m.Right.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *CompactLogRequest) Size() (n int) { - var l int - _ = l - if m.CompactIndex != nil { - n += 1 + sovRaftCmdpb(uint64(*m.CompactIndex)) - } - if m.CompactTerm != nil { - n += 1 + sovRaftCmdpb(uint64(*m.CompactTerm)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *CompactLogResponse) Size() (n int) { - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *TransferLeaderRequest) Size() (n int) { - var l int - _ = l - if m.Peer != nil { - l = m.Peer.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *TransferLeaderResponse) Size() (n int) { - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *VerifyHashRequest) Size() (n int) { - var l int - _ = l - if m.Index != nil { - n += 1 + sovRaftCmdpb(uint64(*m.Index)) - } - if m.Hash != nil { - l = len(m.Hash) - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *VerifyHashResponse) Size() (n int) { - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AdminRequest) Size() (n int) { - var l int - _ = l - if m.CmdType != nil { - n += 1 + sovRaftCmdpb(uint64(*m.CmdType)) - } - if m.ChangePeer != nil { - l = m.ChangePeer.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.Split != nil { - l = m.Split.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.CompactLog != nil { - l = m.CompactLog.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.TransferLeader != nil { - l = m.TransferLeader.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.VerifyHash != nil { - l = m.VerifyHash.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *AdminResponse) Size() (n int) { - var l int - _ = l - if m.CmdType != nil { - n += 1 + sovRaftCmdpb(uint64(*m.CmdType)) - } - if m.ChangePeer != nil { - l = m.ChangePeer.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.Split != nil { - l = m.Split.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.CompactLog != nil { - l = m.CompactLog.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.TransferLeader != nil { - l = m.TransferLeader.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.VerifyHash != nil { - l = m.VerifyHash.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RegionLeaderRequest) Size() (n int) { - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RegionLeaderResponse) Size() (n int) { - var l int - _ = l - if m.Leader != nil { - l = m.Leader.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RegionDetailRequest) Size() (n int) { - var l int - _ = l - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RegionDetailResponse) Size() (n int) { - var l int - _ = l - if m.Region != nil { - l = m.Region.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.Leader != nil { - l = m.Leader.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *StatusRequest) Size() (n int) { - var l int - _ = l - if m.CmdType != nil { - n += 1 + sovRaftCmdpb(uint64(*m.CmdType)) - } - if m.RegionLeader != nil { - l = m.RegionLeader.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.RegionDetail != nil { - l = m.RegionDetail.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *StatusResponse) Size() (n int) { - var l int - _ = l - if m.CmdType != nil { - n += 1 + sovRaftCmdpb(uint64(*m.CmdType)) - } - if m.RegionLeader != nil { - l = m.RegionLeader.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.RegionDetail != nil { - l = m.RegionDetail.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RaftRequestHeader) Size() (n int) { - var l int - _ = l - if m.RegionId != nil { - n += 1 + sovRaftCmdpb(uint64(*m.RegionId)) - } - if m.Peer != nil { - l = m.Peer.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.ReadQuorum != nil { - n += 2 - } - if m.Uuid != nil { - l = len(m.Uuid) - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.RegionEpoch != nil { - l = m.RegionEpoch.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.Term != nil { - n += 1 + sovRaftCmdpb(uint64(*m.Term)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RaftResponseHeader) Size() (n int) { - var l int - _ = l - if m.Error != nil { - l = m.Error.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.Uuid != nil { - l = len(m.Uuid) - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.CurrentTerm != nil { - n += 1 + sovRaftCmdpb(uint64(*m.CurrentTerm)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RaftCmdRequest) Size() (n int) { - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if len(m.Requests) > 0 { - for _, e := range m.Requests { - l = e.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - } - if m.AdminRequest != nil { - l = m.AdminRequest.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.StatusRequest != nil { - l = m.StatusRequest.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RaftCmdResponse) Size() (n int) { - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if len(m.Responses) > 0 { - for _, e := range m.Responses { - l = e.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - } - if m.AdminResponse != nil { - l = m.AdminResponse.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.StatusResponse != nil { - l = m.StatusResponse.Size() - n += 1 + l + sovRaftCmdpb(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovRaftCmdpb(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozRaftCmdpb(x uint64) (n int) { - return sovRaftCmdpb(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GetRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cf", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Cf = &s - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PutRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PutRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PutRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cf", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Cf = &s - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PutResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PutResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PutResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeleteRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cf", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Cf = &s - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeleteResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteRangeRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeleteRangeRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteRangeRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cf", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Cf = &s - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StartKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StartKey = append(m.StartKey[:0], dAtA[iNdEx:postIndex]...) - if m.StartKey == nil { - m.StartKey = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EndKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.EndKey = append(m.EndKey[:0], dAtA[iNdEx:postIndex]...) - if m.EndKey == nil { - m.EndKey = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteRangeResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeleteRangeResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteRangeResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SnapRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SnapRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SnapRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SnapResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SnapResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SnapResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Region", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Region == nil { - m.Region = &metapb.Region{} - } - if err := m.Region.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PrewriteRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PrewriteRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PrewriteRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Lock", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Lock = append(m.Lock[:0], dAtA[iNdEx:postIndex]...) - if m.Lock == nil { - m.Lock = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PrewriteResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PrewriteResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PrewriteResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Request) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Request: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Request: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CmdType", wireType) - } - var v CmdType - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (CmdType(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.CmdType = &v - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Get", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Get == nil { - m.Get = &GetRequest{} - } - if err := m.Get.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Put", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Put == nil { - m.Put = &PutRequest{} - } - if err := m.Put.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Delete", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Delete == nil { - m.Delete = &DeleteRequest{} - } - if err := m.Delete.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Snap", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Snap == nil { - m.Snap = &SnapRequest{} - } - if err := m.Snap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Prewrite", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Prewrite == nil { - m.Prewrite = &PrewriteRequest{} - } - if err := m.Prewrite.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DeleteRange", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.DeleteRange == nil { - m.DeleteRange = &DeleteRangeRequest{} - } - if err := m.DeleteRange.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Response) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Response: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Response: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CmdType", wireType) - } - var v CmdType - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (CmdType(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.CmdType = &v - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Get", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Get == nil { - m.Get = &GetResponse{} - } - if err := m.Get.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Put", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Put == nil { - m.Put = &PutResponse{} - } - if err := m.Put.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Delete", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Delete == nil { - m.Delete = &DeleteResponse{} - } - if err := m.Delete.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Snap", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Snap == nil { - m.Snap = &SnapResponse{} - } - if err := m.Snap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Prewrite", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Prewrite == nil { - m.Prewrite = &PrewriteResponse{} - } - if err := m.Prewrite.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelteRange", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.DelteRange == nil { - m.DelteRange = &DeleteRangeResponse{} - } - if err := m.DelteRange.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ChangePeerRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ChangePeerRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ChangePeerRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ChangeType", wireType) - } - var v eraftpb.ConfChangeType - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (eraftpb.ConfChangeType(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.ChangeType = &v - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Peer", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Peer == nil { - m.Peer = &metapb.Peer{} - } - if err := m.Peer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ChangePeerResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ChangePeerResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ChangePeerResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Region", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Region == nil { - m.Region = &metapb.Region{} - } - if err := m.Region.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SplitRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SplitRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SplitRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SplitKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SplitKey = append(m.SplitKey[:0], dAtA[iNdEx:postIndex]...) - if m.SplitKey == nil { - m.SplitKey = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NewRegionId", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.NewRegionId = &v - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NewPeerIds", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.NewPeerIds = append(m.NewPeerIds, v) - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RightDerive", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.RightDerive = &b - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SplitResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SplitResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SplitResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Left", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Left == nil { - m.Left = &metapb.Region{} - } - if err := m.Left.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Right", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Right == nil { - m.Right = &metapb.Region{} - } - if err := m.Right.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CompactLogRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CompactLogRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CompactLogRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CompactIndex", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.CompactIndex = &v - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CompactTerm", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.CompactTerm = &v - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CompactLogResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CompactLogResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CompactLogResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TransferLeaderRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TransferLeaderRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TransferLeaderRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Peer", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Peer == nil { - m.Peer = &metapb.Peer{} - } - if err := m.Peer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TransferLeaderResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TransferLeaderResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TransferLeaderResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VerifyHashRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VerifyHashRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VerifyHashRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Index = &v - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) - if m.Hash == nil { - m.Hash = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VerifyHashResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VerifyHashResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VerifyHashResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AdminRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AdminRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AdminRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CmdType", wireType) - } - var v AdminCmdType - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (AdminCmdType(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.CmdType = &v - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChangePeer", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ChangePeer == nil { - m.ChangePeer = &ChangePeerRequest{} - } - if err := m.ChangePeer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Split", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Split == nil { - m.Split = &SplitRequest{} - } - if err := m.Split.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CompactLog", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.CompactLog == nil { - m.CompactLog = &CompactLogRequest{} - } - if err := m.CompactLog.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TransferLeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.TransferLeader == nil { - m.TransferLeader = &TransferLeaderRequest{} - } - if err := m.TransferLeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHash", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHash == nil { - m.VerifyHash = &VerifyHashRequest{} - } - if err := m.VerifyHash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AdminResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AdminResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AdminResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CmdType", wireType) - } - var v AdminCmdType - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (AdminCmdType(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.CmdType = &v - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChangePeer", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ChangePeer == nil { - m.ChangePeer = &ChangePeerResponse{} - } - if err := m.ChangePeer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Split", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Split == nil { - m.Split = &SplitResponse{} - } - if err := m.Split.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CompactLog", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.CompactLog == nil { - m.CompactLog = &CompactLogResponse{} - } - if err := m.CompactLog.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TransferLeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.TransferLeader == nil { - m.TransferLeader = &TransferLeaderResponse{} - } - if err := m.TransferLeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VerifyHash", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VerifyHash == nil { - m.VerifyHash = &VerifyHashResponse{} - } - if err := m.VerifyHash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RegionLeaderRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RegionLeaderRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RegionLeaderRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RegionLeaderResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RegionLeaderResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RegionLeaderResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Leader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Leader == nil { - m.Leader = &metapb.Peer{} - } - if err := m.Leader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RegionDetailRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RegionDetailRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RegionDetailRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RegionDetailResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RegionDetailResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RegionDetailResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Region", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Region == nil { - m.Region = &metapb.Region{} - } - if err := m.Region.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Leader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Leader == nil { - m.Leader = &metapb.Peer{} - } - if err := m.Leader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *StatusRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StatusRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StatusRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CmdType", wireType) - } - var v StatusCmdType - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (StatusCmdType(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.CmdType = &v - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionLeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionLeader == nil { - m.RegionLeader = &RegionLeaderRequest{} - } - if err := m.RegionLeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionDetail", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionDetail == nil { - m.RegionDetail = &RegionDetailRequest{} - } - if err := m.RegionDetail.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *StatusResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StatusResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StatusResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CmdType", wireType) - } - var v StatusCmdType - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (StatusCmdType(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.CmdType = &v - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionLeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionLeader == nil { - m.RegionLeader = &RegionLeaderResponse{} - } - if err := m.RegionLeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionDetail", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionDetail == nil { - m.RegionDetail = &RegionDetailResponse{} - } - if err := m.RegionDetail.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RaftRequestHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RaftRequestHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RaftRequestHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionId", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.RegionId = &v - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Peer", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Peer == nil { - m.Peer = &metapb.Peer{} - } - if err := m.Peer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ReadQuorum", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.ReadQuorum = &b - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Uuid", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Uuid = append(m.Uuid[:0], dAtA[iNdEx:postIndex]...) - if m.Uuid == nil { - m.Uuid = []byte{} - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionEpoch", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionEpoch == nil { - m.RegionEpoch = &metapb.RegionEpoch{} - } - if err := m.RegionEpoch.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Term = &v - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RaftResponseHeader) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RaftResponseHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RaftResponseHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Error == nil { - m.Error = &errorpb.Error{} - } - if err := m.Error.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Uuid", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Uuid = append(m.Uuid[:0], dAtA[iNdEx:postIndex]...) - if m.Uuid == nil { - m.Uuid = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrentTerm", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.CurrentTerm = &v - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RaftCmdRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RaftCmdRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RaftCmdRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &RaftRequestHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Requests", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Requests = append(m.Requests, &Request{}) - if err := m.Requests[len(m.Requests)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AdminRequest", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AdminRequest == nil { - m.AdminRequest = &AdminRequest{} - } - if err := m.AdminRequest.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StatusRequest", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.StatusRequest == nil { - m.StatusRequest = &StatusRequest{} - } - if err := m.StatusRequest.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RaftCmdResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RaftCmdResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RaftCmdResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &RaftResponseHeader{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Responses", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Responses = append(m.Responses, &Response{}) - if err := m.Responses[len(m.Responses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AdminResponse", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AdminResponse == nil { - m.AdminResponse = &AdminResponse{} - } - if err := m.AdminResponse.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StatusResponse", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftCmdpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.StatusResponse == nil { - m.StatusResponse = &StatusResponse{} - } - if err := m.StatusResponse.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftCmdpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftCmdpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipRaftCmdpb(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthRaftCmdpb - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRaftCmdpb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipRaftCmdpb(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthRaftCmdpb = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowRaftCmdpb = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("raft_cmdpb.proto", fileDescriptorRaftCmdpb) } - -var fileDescriptorRaftCmdpb = []byte{ - // 1570 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x58, 0x5f, 0x73, 0xdb, 0xc4, - 0x16, 0x8f, 0xfc, 0x3f, 0xc7, 0xb2, 0xa3, 0x6c, 0xd2, 0xc6, 0x6d, 0xef, 0x75, 0x5d, 0xb5, 0x73, - 0x27, 0xcd, 0xbd, 0xe3, 0x4e, 0x73, 0xa1, 0x94, 0x99, 0x96, 0xb6, 0x24, 0xa1, 0x0d, 0x2d, 0x33, - 0x61, 0xdb, 0x61, 0x06, 0x18, 0x46, 0x23, 0xac, 0x75, 0xa2, 0x89, 0x2d, 0xab, 0x92, 0x9c, 0x90, - 0x37, 0x1e, 0xe0, 0x1b, 0xf0, 0xc0, 0x47, 0xe2, 0x11, 0x06, 0x3e, 0x00, 0x53, 0x9e, 0x78, 0xe1, - 0x9d, 0x27, 0x98, 0xdd, 0x3d, 0x2b, 0xad, 0x6c, 0xb9, 0xb4, 0x7d, 0xca, 0xee, 0xd9, 0xb3, 0xe7, - 0xcf, 0xef, 0x77, 0xf6, 0x1c, 0x2b, 0x60, 0x45, 0xee, 0x30, 0x71, 0x06, 0x63, 0x2f, 0xfc, 0xb2, - 0x1f, 0x46, 0x93, 0x64, 0x42, 0x20, 0x93, 0x5c, 0x34, 0xc7, 0x2c, 0x71, 0xd5, 0xc9, 0xc5, 0x16, - 0x8b, 0xa2, 0x49, 0xa4, 0x6f, 0xdd, 0x61, 0xa2, 0xb6, 0x76, 0x1f, 0xe0, 0x21, 0x4b, 0x28, 0x7b, - 0x3e, 0x65, 0x71, 0x42, 0xda, 0x50, 0x1a, 0x0c, 0x3b, 0x46, 0xcf, 0xd8, 0x5c, 0xa6, 0xa5, 0xc1, - 0x90, 0x58, 0x50, 0x3e, 0x66, 0x67, 0x9d, 0x52, 0xcf, 0xd8, 0x34, 0x29, 0x5f, 0xda, 0x57, 0xa1, - 0x29, 0xf4, 0xe3, 0x70, 0x12, 0xc4, 0x8c, 0xac, 0x43, 0xf5, 0xc4, 0x1d, 0x4d, 0x99, 0xb8, 0x63, - 0x52, 0xb9, 0xb1, 0x77, 0x01, 0x0e, 0xa6, 0xaf, 0x6e, 0x34, 0xb3, 0x52, 0xd6, 0xad, 0xb4, 0xa0, - 0x29, 0xac, 0x48, 0x57, 0xf6, 0x4d, 0x68, 0xed, 0xb2, 0x11, 0x4b, 0xd8, 0xab, 0x07, 0x6b, 0x41, - 0x5b, 0x5d, 0x41, 0x23, 0x9f, 0x01, 0x41, 0x89, 0x1b, 0x1c, 0x2e, 0xb4, 0x74, 0x09, 0x96, 0xe3, - 0xc4, 0x8d, 0x12, 0x27, 0xb3, 0xd7, 0x10, 0x82, 0xc7, 0xec, 0x8c, 0x6c, 0x40, 0x9d, 0x05, 0x9e, - 0x38, 0x92, 0xe1, 0xd6, 0x58, 0xe0, 0x3d, 0x66, 0x67, 0xf6, 0x39, 0x58, 0xcb, 0xd9, 0x46, 0x97, - 0x2d, 0x68, 0x3e, 0x0d, 0xdc, 0x10, 0x7d, 0xd9, 0xb7, 0xc0, 0x94, 0x5b, 0x44, 0xf0, 0x3f, 0x50, - 0x8b, 0xd8, 0xa1, 0x3f, 0x09, 0x84, 0xff, 0xe6, 0x76, 0xbb, 0x8f, 0xec, 0x51, 0x21, 0xa5, 0x78, - 0x6a, 0x7f, 0x04, 0x2b, 0x07, 0x11, 0x3b, 0x8d, 0xfc, 0x0c, 0x00, 0x4c, 0xd8, 0x28, 0x00, 0xb2, - 0xa4, 0x01, 0x49, 0x08, 0x54, 0x46, 0x93, 0xc1, 0x31, 0x86, 0x2b, 0xd6, 0x36, 0x01, 0x2b, 0x33, - 0x87, 0x91, 0xfe, 0x5e, 0x82, 0xba, 0xb2, 0xdd, 0x87, 0xc6, 0x60, 0xec, 0x39, 0xc9, 0x59, 0x28, - 0xb9, 0x6d, 0x6f, 0xaf, 0xf5, 0xb5, 0xa2, 0xdb, 0x19, 0x7b, 0xcf, 0xce, 0x42, 0x46, 0xeb, 0x03, - 0xb9, 0x20, 0x9b, 0x50, 0x3e, 0x64, 0x89, 0xf0, 0xdb, 0xdc, 0x3e, 0xaf, 0xab, 0x66, 0xe5, 0x45, - 0xb9, 0x0a, 0xd7, 0x0c, 0xa7, 0x49, 0xa7, 0x32, 0xaf, 0x99, 0xd5, 0x0c, 0xe5, 0x2a, 0xe4, 0x26, - 0xd4, 0x3c, 0x01, 0x68, 0xa7, 0x2a, 0x94, 0x2f, 0xe8, 0xca, 0xb9, 0x5a, 0xa0, 0xa8, 0x48, 0xfe, - 0x0b, 0x95, 0x38, 0x70, 0xc3, 0x4e, 0x4d, 0x5c, 0xd8, 0xd0, 0x2f, 0x68, 0x24, 0x50, 0xa1, 0x44, - 0xde, 0x81, 0x46, 0x88, 0x18, 0x74, 0xea, 0xe2, 0xc2, 0xa5, 0x5c, 0x38, 0x79, 0xb8, 0x69, 0xaa, - 0x4c, 0x1e, 0x80, 0x29, 0xfd, 0x39, 0x11, 0xa7, 0xba, 0xd3, 0x10, 0x97, 0xbb, 0x05, 0xe1, 0x69, - 0x55, 0x46, 0x9b, 0x5e, 0x26, 0xb3, 0xff, 0x28, 0x41, 0x23, 0xad, 0x81, 0xd7, 0x05, 0xfb, 0xba, - 0x0e, 0xf6, 0xc6, 0x1c, 0xd8, 0xd2, 0xaa, 0x44, 0xfb, 0xba, 0x8e, 0xf6, 0xc6, 0x1c, 0xda, 0x4a, - 0x95, 0xc3, 0xbd, 0x3d, 0x03, 0xf7, 0xc5, 0x22, 0xb8, 0xf1, 0x82, 0xc2, 0xfb, 0x7f, 0x39, 0xbc, - 0x3b, 0xf3, 0x78, 0xa3, 0xbe, 0x04, 0xfc, 0xf6, 0x1c, 0xe0, 0xff, 0x2a, 0x06, 0x1c, 0x6f, 0x65, - 0x88, 0xdf, 0x07, 0x8e, 0xde, 0x0c, 0xe0, 0x97, 0x17, 0x02, 0x8e, 0xf7, 0x41, 0xdc, 0x91, 0x80, - 0x4f, 0x60, 0x75, 0xe7, 0x88, 0xaf, 0x0e, 0x18, 0x8b, 0x54, 0x95, 0xdf, 0x86, 0xe6, 0x40, 0x08, - 0x75, 0xec, 0x37, 0xfa, 0xaa, 0x45, 0xee, 0x4c, 0x82, 0xa1, 0xbc, 0x24, 0xf0, 0x87, 0x41, 0xba, - 0x26, 0x3d, 0xa8, 0x84, 0x8c, 0x45, 0xc8, 0x81, 0xa9, 0x1e, 0xad, 0x30, 0x2e, 0x4e, 0xec, 0x3b, - 0x40, 0x74, 0x87, 0xaf, 0xf9, 0xdc, 0xbf, 0x33, 0xc0, 0x7c, 0x1a, 0x8e, 0xfc, 0xb4, 0x8b, 0xf2, - 0x9e, 0xc4, 0xf7, 0x4e, 0xf6, 0xe4, 0x1b, 0x42, 0xc0, 0x7b, 0x92, 0x0d, 0xad, 0x80, 0x9d, 0x3a, - 0xf2, 0xae, 0xe3, 0x7b, 0x22, 0xac, 0x0a, 0x6d, 0x06, 0xec, 0x54, 0xda, 0xdd, 0xf7, 0x48, 0x0f, - 0x4c, 0xae, 0xc3, 0x63, 0x73, 0x7c, 0x2f, 0xee, 0x94, 0x7b, 0xe5, 0xcd, 0x0a, 0x85, 0x80, 0x9d, - 0xf2, 0x00, 0xf7, 0xbd, 0x98, 0x5c, 0x01, 0x33, 0xf2, 0x0f, 0x8f, 0x12, 0xc7, 0x63, 0x91, 0x7f, - 0xc2, 0x44, 0xd1, 0x34, 0x68, 0x53, 0xc8, 0x76, 0x85, 0xc8, 0xfe, 0x14, 0x5a, 0x18, 0x15, 0xe6, - 0x63, 0x43, 0x65, 0xc4, 0x86, 0xc9, 0x82, 0x6c, 0xc4, 0x19, 0xb9, 0x06, 0x55, 0x61, 0x03, 0xc1, - 0x9a, 0x55, 0x92, 0x87, 0xf6, 0xe7, 0xb0, 0xba, 0x33, 0x19, 0x87, 0xee, 0x20, 0x79, 0x32, 0x39, - 0x54, 0x59, 0x5f, 0x85, 0xd6, 0x40, 0x0a, 0x1d, 0x3f, 0xf0, 0xd8, 0x57, 0xc2, 0x4f, 0x85, 0x9a, - 0x28, 0xdc, 0xe7, 0x32, 0x1e, 0xb7, 0x52, 0x4a, 0x58, 0x34, 0x56, 0xc9, 0xa3, 0xec, 0x19, 0x8b, - 0xc6, 0xf6, 0x3a, 0x10, 0xdd, 0x38, 0x36, 0xbc, 0x77, 0xe1, 0xdc, 0xb3, 0xc8, 0x0d, 0xe2, 0x21, - 0x8b, 0x9e, 0x30, 0xd7, 0xcb, 0xea, 0x42, 0xb1, 0x6b, 0x2c, 0x64, 0xb7, 0x03, 0xe7, 0x67, 0xaf, - 0xa2, 0xd1, 0xbb, 0xb0, 0xfa, 0x09, 0x8b, 0xfc, 0xe1, 0xd9, 0x23, 0x37, 0x3e, 0x52, 0x06, 0xd7, - 0xa1, 0xaa, 0xc7, 0x2f, 0x37, 0xbc, 0x31, 0x1f, 0xb9, 0xf1, 0x11, 0x76, 0x6b, 0xb1, 0xe6, 0x91, - 0xea, 0xd7, 0xd1, 0xe8, 0x5f, 0x25, 0x30, 0x1f, 0x78, 0x63, 0x3f, 0x50, 0x06, 0xff, 0x3f, 0xd7, - 0x32, 0x72, 0x8f, 0x4f, 0xe8, 0xce, 0xf5, 0x8d, 0xf7, 0xd2, 0x72, 0xd7, 0x6a, 0xf7, 0xdf, 0xb9, - 0x56, 0x33, 0xfb, 0x44, 0x54, 0xd1, 0x73, 0x11, 0xe9, 0x43, 0x55, 0x94, 0x9c, 0x98, 0x24, 0xb3, - 0xcf, 0x5d, 0x2b, 0x56, 0x2a, 0xd5, 0x84, 0x3f, 0x24, 0x66, 0x34, 0x39, 0xc4, 0x26, 0x94, 0xf7, - 0x37, 0xcb, 0x38, 0x85, 0x41, 0x2a, 0x22, 0x1f, 0xc2, 0x4a, 0x82, 0x20, 0x3b, 0x23, 0x81, 0x32, - 0xb6, 0xa6, 0x2b, 0xba, 0x8d, 0x42, 0x0a, 0x69, 0x3b, 0xc9, 0x89, 0x79, 0x2c, 0x27, 0x02, 0x57, - 0x47, 0x40, 0x5e, 0x9b, 0x8f, 0x65, 0x8e, 0x35, 0x0a, 0x27, 0xa9, 0xc8, 0xfe, 0xb6, 0x0c, 0x2d, - 0x64, 0x00, 0x4b, 0xff, 0x8d, 0x28, 0xb8, 0x57, 0x44, 0x41, 0x77, 0x11, 0x05, 0xaa, 0x8f, 0x69, - 0x1c, 0xdc, 0xc8, 0x73, 0x70, 0xa1, 0x80, 0x03, 0xbc, 0x85, 0x24, 0xdc, 0x2b, 0x22, 0xa1, 0xbb, - 0x88, 0x84, 0xd4, 0x63, 0xc6, 0xc2, 0xe3, 0x45, 0x2c, 0xd8, 0x2f, 0x63, 0x01, 0x0d, 0xcd, 0xd2, - 0x70, 0xaf, 0x88, 0x86, 0xee, 0x22, 0x1a, 0x54, 0x34, 0x1a, 0x0f, 0xe7, 0x60, 0x4d, 0xf6, 0x8d, - 0x1c, 0xdd, 0xf6, 0x1d, 0x58, 0xcf, 0x8b, 0x91, 0xa4, 0x6b, 0x50, 0xc3, 0x98, 0x8b, 0xde, 0x32, - 0x9e, 0x65, 0x46, 0x77, 0x59, 0xe2, 0xfa, 0x23, 0x65, 0xd4, 0x53, 0x46, 0x95, 0xf8, 0xf5, 0x9a, - 0xb8, 0xe6, 0xbc, 0xf4, 0x12, 0xe7, 0x3f, 0x19, 0xd0, 0x7a, 0x9a, 0xb8, 0xc9, 0x34, 0x56, 0x8f, - 0xfb, 0xad, 0xb9, 0xca, 0xca, 0xd3, 0x2c, 0x94, 0xe7, 0x4a, 0x6b, 0x17, 0x5a, 0x38, 0x00, 0x72, - 0x4e, 0x73, 0x53, 0xb2, 0x00, 0x3a, 0x6a, 0x46, 0x9a, 0x50, 0xb3, 0xe2, 0x89, 0xa4, 0xb1, 0xce, - 0x0a, 0xac, 0xe4, 0xb0, 0x52, 0x56, 0xa4, 0xd0, 0xfe, 0xc5, 0x80, 0xb6, 0xca, 0x09, 0x41, 0x7b, - 0xb3, 0xa4, 0xf6, 0x8a, 0x93, 0xea, 0x2d, 0x4e, 0x0a, 0x6b, 0x26, 0x9f, 0xd5, 0x5e, 0x71, 0x56, - 0xbd, 0xc5, 0x59, 0xe5, 0xcd, 0x60, 0x5a, 0x3f, 0x1b, 0xb0, 0x4a, 0xdd, 0xa1, 0xea, 0x73, 0x8f, - 0xa4, 0xf1, 0x4b, 0xb0, 0x9c, 0x4d, 0x5e, 0xd9, 0xe0, 0x1b, 0x51, 0x36, 0x76, 0xff, 0xe1, 0x87, - 0x02, 0xb9, 0x0c, 0xcd, 0x88, 0xb9, 0x9e, 0xf3, 0x7c, 0x3a, 0x89, 0xa6, 0x63, 0x11, 0x59, 0x83, - 0x02, 0x17, 0x7d, 0x2c, 0x24, 0x7c, 0x4c, 0x4c, 0xa7, 0xbe, 0x27, 0x9e, 0xae, 0x49, 0xc5, 0x9a, - 0xdc, 0x02, 0x8c, 0xcc, 0x61, 0xe1, 0x64, 0x70, 0x84, 0x2f, 0x72, 0x2d, 0x5f, 0x88, 0x7b, 0xfc, - 0x88, 0x36, 0xa3, 0x6c, 0xc3, 0x6d, 0x89, 0x19, 0x59, 0x13, 0x61, 0x8a, 0xb5, 0xfd, 0x1c, 0x88, - 0x4c, 0x4a, 0xe6, 0x8c, 0x59, 0x5d, 0x83, 0xaa, 0xf8, 0x72, 0x4c, 0x6b, 0x5c, 0x7d, 0x47, 0xee, - 0xf1, 0xbf, 0x54, 0x1e, 0xa6, 0xb1, 0x95, 0xb4, 0xd8, 0xf8, 0x3c, 0x9e, 0x46, 0x11, 0x0b, 0x70, - 0x1e, 0x97, 0x71, 0x1e, 0x4b, 0x99, 0x98, 0xc7, 0x7f, 0x1a, 0xd0, 0xe6, 0x3e, 0x77, 0xc6, 0x9e, - 0x2a, 0xfa, 0xb7, 0xa1, 0x76, 0xa4, 0xbf, 0xd4, 0x5c, 0x6f, 0x9e, 0x03, 0x9d, 0xa2, 0x32, 0xb9, - 0x01, 0x8d, 0x48, 0x1e, 0xc4, 0x9d, 0x52, 0xaf, 0x2c, 0x40, 0xc8, 0x91, 0x8a, 0x3f, 0xde, 0x95, - 0x12, 0xb9, 0x0b, 0x2d, 0x97, 0xb7, 0x66, 0x07, 0x25, 0x45, 0xc3, 0x4c, 0x1f, 0xb5, 0xd4, 0x74, - 0xf5, 0xc1, 0x7b, 0x1f, 0xda, 0xb1, 0x28, 0xd5, 0xf4, 0x7e, 0xa5, 0xa0, 0x11, 0xeb, 0xcf, 0x99, - 0xb6, 0x62, 0x7d, 0x6b, 0x7f, 0x53, 0x82, 0x95, 0x34, 0x77, 0x7c, 0x1c, 0xb7, 0x66, 0x92, 0xef, - 0xce, 0x27, 0xaf, 0x93, 0x93, 0x66, 0xbf, 0xcd, 0x4b, 0x4f, 0x9e, 0xa8, 0xf4, 0xd7, 0xf3, 0xe9, - 0x63, 0x1d, 0x67, 0x6a, 0x3c, 0x03, 0x05, 0x80, 0x14, 0x15, 0x8d, 0x92, 0xdc, 0xa8, 0xa3, 0x2d, - 0x37, 0x37, 0xf9, 0x76, 0x60, 0x25, 0xc5, 0x00, 0x4d, 0x54, 0xe6, 0x3f, 0x19, 0xf2, 0xef, 0x9f, - 0xb6, 0xe3, 0xdc, 0x7e, 0xeb, 0x0b, 0xa8, 0xe3, 0x6b, 0x27, 0x4d, 0xa8, 0xef, 0x07, 0x27, 0xee, - 0xc8, 0xf7, 0xac, 0x25, 0x52, 0x87, 0xf2, 0x43, 0x96, 0x58, 0x06, 0x5f, 0x1c, 0x4c, 0x13, 0xab, - 0x4c, 0x00, 0x6a, 0xf2, 0xd7, 0xbd, 0x55, 0x21, 0x0d, 0xa8, 0xf0, 0x0f, 0x0b, 0xab, 0x4a, 0x4c, - 0x68, 0xa8, 0x0f, 0x06, 0xab, 0x46, 0x56, 0xa0, 0xa9, 0x7d, 0x01, 0x58, 0xf5, 0xad, 0xaf, 0x0d, - 0xfc, 0xc5, 0xa4, 0x9c, 0x58, 0x60, 0xa2, 0x13, 0x21, 0xb6, 0x96, 0x48, 0x1b, 0x20, 0x1b, 0xb6, - 0x96, 0x41, 0x96, 0xa1, 0x2a, 0x26, 0xa8, 0x55, 0x12, 0x47, 0xe9, 0x04, 0xb4, 0xca, 0x84, 0x40, - 0x3b, 0x3f, 0xe0, 0xac, 0x0a, 0x77, 0xc9, 0x75, 0xa6, 0x09, 0xe3, 0x83, 0xc9, 0xaa, 0xf2, 0x4b, - 0xd9, 0xf0, 0xb2, 0x6a, 0x5b, 0x1f, 0xa8, 0xbe, 0xae, 0x42, 0x58, 0x85, 0x16, 0x86, 0x20, 0xe5, - 0xd6, 0x12, 0x8f, 0x4a, 0x6f, 0x5f, 0x96, 0x91, 0x49, 0x64, 0xcf, 0xb1, 0x4a, 0xef, 0x6f, 0xfd, - 0xf0, 0xa2, 0x6b, 0xfc, 0xf8, 0xa2, 0x6b, 0xfc, 0xfa, 0xa2, 0x6b, 0x7c, 0xff, 0x5b, 0x77, 0x09, - 0x3a, 0x83, 0xc9, 0xb8, 0x1f, 0xfa, 0xc1, 0xe1, 0xc0, 0x0d, 0xfb, 0x89, 0x7f, 0x7c, 0xd2, 0x3f, - 0x3e, 0x11, 0xff, 0xcf, 0xf9, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x1b, 0xa8, 0x27, 0x52, 0x1a, 0x12, - 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/raft_serverpb/raft_serverpb.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/raft_serverpb/raft_serverpb.pb.go deleted file mode 100644 index 18cabe2072c..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/pkg/raft_serverpb/raft_serverpb.pb.go +++ /dev/null @@ -1,2690 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: raft_serverpb.proto -// DO NOT EDIT! - -/* - Package raft_serverpb is a generated protocol buffer package. - - It is generated from these files: - raft_serverpb.proto - - It has these top-level messages: - RaftMessage - RaftTruncatedState - SnapshotCFFile - SnapshotMeta - SnapshotChunk - Done - KeyValue - RaftSnapshotData - StoreIdent - RaftLocalState - RaftApplyState - RegionLocalState -*/ -package raft_serverpb - -import ( - "fmt" - "io" - "math" - - proto "github.com/golang/protobuf/proto" - - eraftpb "github.com/pingcap/kvproto/pkg/eraftpb" - - metapb "github.com/pingcap/kvproto/pkg/metapb" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type PeerState int32 - -const ( - PeerState_Normal PeerState = 0 - PeerState_Applying PeerState = 1 - PeerState_Tombstone PeerState = 2 -) - -var PeerState_name = map[int32]string{ - 0: "Normal", - 1: "Applying", - 2: "Tombstone", -} -var PeerState_value = map[string]int32{ - "Normal": 0, - "Applying": 1, - "Tombstone": 2, -} - -func (x PeerState) String() string { - return proto.EnumName(PeerState_name, int32(x)) -} -func (PeerState) EnumDescriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{0} } - -type RaftMessage struct { - RegionId uint64 `protobuf:"varint,1,opt,name=region_id,json=regionId,proto3" json:"region_id,omitempty"` - FromPeer *metapb.Peer `protobuf:"bytes,2,opt,name=from_peer,json=fromPeer" json:"from_peer,omitempty"` - ToPeer *metapb.Peer `protobuf:"bytes,3,opt,name=to_peer,json=toPeer" json:"to_peer,omitempty"` - Message *eraftpb.Message `protobuf:"bytes,4,opt,name=message" json:"message,omitempty"` - RegionEpoch *metapb.RegionEpoch `protobuf:"bytes,5,opt,name=region_epoch,json=regionEpoch" json:"region_epoch,omitempty"` - // true means to_peer is a tombstone peer and it should remove itself. - IsTombstone bool `protobuf:"varint,6,opt,name=is_tombstone,json=isTombstone,proto3" json:"is_tombstone,omitempty"` - // Region key range [start_key, end_key). - StartKey []byte `protobuf:"bytes,7,opt,name=start_key,json=startKey,proto3" json:"start_key,omitempty"` - EndKey []byte `protobuf:"bytes,8,opt,name=end_key,json=endKey,proto3" json:"end_key,omitempty"` -} - -func (m *RaftMessage) Reset() { *m = RaftMessage{} } -func (m *RaftMessage) String() string { return proto.CompactTextString(m) } -func (*RaftMessage) ProtoMessage() {} -func (*RaftMessage) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{0} } - -func (m *RaftMessage) GetRegionId() uint64 { - if m != nil { - return m.RegionId - } - return 0 -} - -func (m *RaftMessage) GetFromPeer() *metapb.Peer { - if m != nil { - return m.FromPeer - } - return nil -} - -func (m *RaftMessage) GetToPeer() *metapb.Peer { - if m != nil { - return m.ToPeer - } - return nil -} - -func (m *RaftMessage) GetMessage() *eraftpb.Message { - if m != nil { - return m.Message - } - return nil -} - -func (m *RaftMessage) GetRegionEpoch() *metapb.RegionEpoch { - if m != nil { - return m.RegionEpoch - } - return nil -} - -func (m *RaftMessage) GetIsTombstone() bool { - if m != nil { - return m.IsTombstone - } - return false -} - -func (m *RaftMessage) GetStartKey() []byte { - if m != nil { - return m.StartKey - } - return nil -} - -func (m *RaftMessage) GetEndKey() []byte { - if m != nil { - return m.EndKey - } - return nil -} - -type RaftTruncatedState struct { - Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` - Term uint64 `protobuf:"varint,2,opt,name=term,proto3" json:"term,omitempty"` -} - -func (m *RaftTruncatedState) Reset() { *m = RaftTruncatedState{} } -func (m *RaftTruncatedState) String() string { return proto.CompactTextString(m) } -func (*RaftTruncatedState) ProtoMessage() {} -func (*RaftTruncatedState) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{1} } - -func (m *RaftTruncatedState) GetIndex() uint64 { - if m != nil { - return m.Index - } - return 0 -} - -func (m *RaftTruncatedState) GetTerm() uint64 { - if m != nil { - return m.Term - } - return 0 -} - -type SnapshotCFFile struct { - Cf string `protobuf:"bytes,1,opt,name=cf,proto3" json:"cf,omitempty"` - Size_ uint64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` - Checksum uint32 `protobuf:"varint,3,opt,name=checksum,proto3" json:"checksum,omitempty"` -} - -func (m *SnapshotCFFile) Reset() { *m = SnapshotCFFile{} } -func (m *SnapshotCFFile) String() string { return proto.CompactTextString(m) } -func (*SnapshotCFFile) ProtoMessage() {} -func (*SnapshotCFFile) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{2} } - -func (m *SnapshotCFFile) GetCf() string { - if m != nil { - return m.Cf - } - return "" -} - -func (m *SnapshotCFFile) GetSize_() uint64 { - if m != nil { - return m.Size_ - } - return 0 -} - -func (m *SnapshotCFFile) GetChecksum() uint32 { - if m != nil { - return m.Checksum - } - return 0 -} - -type SnapshotMeta struct { - CfFiles []*SnapshotCFFile `protobuf:"bytes,1,rep,name=cf_files,json=cfFiles" json:"cf_files,omitempty"` -} - -func (m *SnapshotMeta) Reset() { *m = SnapshotMeta{} } -func (m *SnapshotMeta) String() string { return proto.CompactTextString(m) } -func (*SnapshotMeta) ProtoMessage() {} -func (*SnapshotMeta) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{3} } - -func (m *SnapshotMeta) GetCfFiles() []*SnapshotCFFile { - if m != nil { - return m.CfFiles - } - return nil -} - -type SnapshotChunk struct { - Message *RaftMessage `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` -} - -func (m *SnapshotChunk) Reset() { *m = SnapshotChunk{} } -func (m *SnapshotChunk) String() string { return proto.CompactTextString(m) } -func (*SnapshotChunk) ProtoMessage() {} -func (*SnapshotChunk) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{4} } - -func (m *SnapshotChunk) GetMessage() *RaftMessage { - if m != nil { - return m.Message - } - return nil -} - -func (m *SnapshotChunk) GetData() []byte { - if m != nil { - return m.Data - } - return nil -} - -type Done struct { -} - -func (m *Done) Reset() { *m = Done{} } -func (m *Done) String() string { return proto.CompactTextString(m) } -func (*Done) ProtoMessage() {} -func (*Done) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{5} } - -type KeyValue struct { - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *KeyValue) Reset() { *m = KeyValue{} } -func (m *KeyValue) String() string { return proto.CompactTextString(m) } -func (*KeyValue) ProtoMessage() {} -func (*KeyValue) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{6} } - -func (m *KeyValue) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *KeyValue) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -type RaftSnapshotData struct { - Region *metapb.Region `protobuf:"bytes,1,opt,name=region" json:"region,omitempty"` - FileSize uint64 `protobuf:"varint,2,opt,name=file_size,json=fileSize,proto3" json:"file_size,omitempty"` - Data []*KeyValue `protobuf:"bytes,3,rep,name=data" json:"data,omitempty"` - Version uint64 `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"` - Meta *SnapshotMeta `protobuf:"bytes,5,opt,name=meta" json:"meta,omitempty"` -} - -func (m *RaftSnapshotData) Reset() { *m = RaftSnapshotData{} } -func (m *RaftSnapshotData) String() string { return proto.CompactTextString(m) } -func (*RaftSnapshotData) ProtoMessage() {} -func (*RaftSnapshotData) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{7} } - -func (m *RaftSnapshotData) GetRegion() *metapb.Region { - if m != nil { - return m.Region - } - return nil -} - -func (m *RaftSnapshotData) GetFileSize() uint64 { - if m != nil { - return m.FileSize - } - return 0 -} - -func (m *RaftSnapshotData) GetData() []*KeyValue { - if m != nil { - return m.Data - } - return nil -} - -func (m *RaftSnapshotData) GetVersion() uint64 { - if m != nil { - return m.Version - } - return 0 -} - -func (m *RaftSnapshotData) GetMeta() *SnapshotMeta { - if m != nil { - return m.Meta - } - return nil -} - -type StoreIdent struct { - ClusterId uint64 `protobuf:"varint,1,opt,name=cluster_id,json=clusterId,proto3" json:"cluster_id,omitempty"` - StoreId uint64 `protobuf:"varint,2,opt,name=store_id,json=storeId,proto3" json:"store_id,omitempty"` -} - -func (m *StoreIdent) Reset() { *m = StoreIdent{} } -func (m *StoreIdent) String() string { return proto.CompactTextString(m) } -func (*StoreIdent) ProtoMessage() {} -func (*StoreIdent) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{8} } - -func (m *StoreIdent) GetClusterId() uint64 { - if m != nil { - return m.ClusterId - } - return 0 -} - -func (m *StoreIdent) GetStoreId() uint64 { - if m != nil { - return m.StoreId - } - return 0 -} - -type RaftLocalState struct { - HardState *eraftpb.HardState `protobuf:"bytes,1,opt,name=hard_state,json=hardState" json:"hard_state,omitempty"` - LastIndex uint64 `protobuf:"varint,2,opt,name=last_index,json=lastIndex,proto3" json:"last_index,omitempty"` -} - -func (m *RaftLocalState) Reset() { *m = RaftLocalState{} } -func (m *RaftLocalState) String() string { return proto.CompactTextString(m) } -func (*RaftLocalState) ProtoMessage() {} -func (*RaftLocalState) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{9} } - -func (m *RaftLocalState) GetHardState() *eraftpb.HardState { - if m != nil { - return m.HardState - } - return nil -} - -func (m *RaftLocalState) GetLastIndex() uint64 { - if m != nil { - return m.LastIndex - } - return 0 -} - -type RaftApplyState struct { - AppliedIndex uint64 `protobuf:"varint,1,opt,name=applied_index,json=appliedIndex,proto3" json:"applied_index,omitempty"` - TruncatedState *RaftTruncatedState `protobuf:"bytes,2,opt,name=truncated_state,json=truncatedState" json:"truncated_state,omitempty"` -} - -func (m *RaftApplyState) Reset() { *m = RaftApplyState{} } -func (m *RaftApplyState) String() string { return proto.CompactTextString(m) } -func (*RaftApplyState) ProtoMessage() {} -func (*RaftApplyState) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{10} } - -func (m *RaftApplyState) GetAppliedIndex() uint64 { - if m != nil { - return m.AppliedIndex - } - return 0 -} - -func (m *RaftApplyState) GetTruncatedState() *RaftTruncatedState { - if m != nil { - return m.TruncatedState - } - return nil -} - -type RegionLocalState struct { - State PeerState `protobuf:"varint,1,opt,name=state,proto3,enum=raft_serverpb.PeerState" json:"state,omitempty"` - Region *metapb.Region `protobuf:"bytes,2,opt,name=region" json:"region,omitempty"` -} - -func (m *RegionLocalState) Reset() { *m = RegionLocalState{} } -func (m *RegionLocalState) String() string { return proto.CompactTextString(m) } -func (*RegionLocalState) ProtoMessage() {} -func (*RegionLocalState) Descriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{11} } - -func (m *RegionLocalState) GetState() PeerState { - if m != nil { - return m.State - } - return PeerState_Normal -} - -func (m *RegionLocalState) GetRegion() *metapb.Region { - if m != nil { - return m.Region - } - return nil -} - -func init() { - proto.RegisterType((*RaftMessage)(nil), "raft_serverpb.RaftMessage") - proto.RegisterType((*RaftTruncatedState)(nil), "raft_serverpb.RaftTruncatedState") - proto.RegisterType((*SnapshotCFFile)(nil), "raft_serverpb.SnapshotCFFile") - proto.RegisterType((*SnapshotMeta)(nil), "raft_serverpb.SnapshotMeta") - proto.RegisterType((*SnapshotChunk)(nil), "raft_serverpb.SnapshotChunk") - proto.RegisterType((*Done)(nil), "raft_serverpb.Done") - proto.RegisterType((*KeyValue)(nil), "raft_serverpb.KeyValue") - proto.RegisterType((*RaftSnapshotData)(nil), "raft_serverpb.RaftSnapshotData") - proto.RegisterType((*StoreIdent)(nil), "raft_serverpb.StoreIdent") - proto.RegisterType((*RaftLocalState)(nil), "raft_serverpb.RaftLocalState") - proto.RegisterType((*RaftApplyState)(nil), "raft_serverpb.RaftApplyState") - proto.RegisterType((*RegionLocalState)(nil), "raft_serverpb.RegionLocalState") - proto.RegisterEnum("raft_serverpb.PeerState", PeerState_name, PeerState_value) -} -func (m *RaftMessage) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RaftMessage) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.RegionId != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(m.RegionId)) - } - if m.FromPeer != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(m.FromPeer.Size())) - n1, err := m.FromPeer.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } - if m.ToPeer != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(m.ToPeer.Size())) - n2, err := m.ToPeer.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 - } - if m.Message != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(m.Message.Size())) - n3, err := m.Message.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n3 - } - if m.RegionEpoch != nil { - dAtA[i] = 0x2a - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(m.RegionEpoch.Size())) - n4, err := m.RegionEpoch.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n4 - } - if m.IsTombstone { - dAtA[i] = 0x30 - i++ - if m.IsTombstone { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - } - if len(m.StartKey) > 0 { - dAtA[i] = 0x3a - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(len(m.StartKey))) - i += copy(dAtA[i:], m.StartKey) - } - if len(m.EndKey) > 0 { - dAtA[i] = 0x42 - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(len(m.EndKey))) - i += copy(dAtA[i:], m.EndKey) - } - return i, nil -} - -func (m *RaftTruncatedState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RaftTruncatedState) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Index != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(m.Index)) - } - if m.Term != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(m.Term)) - } - return i, nil -} - -func (m *SnapshotCFFile) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SnapshotCFFile) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Cf) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(len(m.Cf))) - i += copy(dAtA[i:], m.Cf) - } - if m.Size_ != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(m.Size_)) - } - if m.Checksum != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(m.Checksum)) - } - return i, nil -} - -func (m *SnapshotMeta) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SnapshotMeta) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.CfFiles) > 0 { - for _, msg := range m.CfFiles { - dAtA[i] = 0xa - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - return i, nil -} - -func (m *SnapshotChunk) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SnapshotChunk) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Message != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(m.Message.Size())) - n5, err := m.Message.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n5 - } - if len(m.Data) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) - } - return i, nil -} - -func (m *Done) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Done) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - return i, nil -} - -func (m *KeyValue) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *KeyValue) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Key) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - if len(m.Value) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) - } - return i, nil -} - -func (m *RaftSnapshotData) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RaftSnapshotData) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Region != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(m.Region.Size())) - n6, err := m.Region.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n6 - } - if m.FileSize != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(m.FileSize)) - } - if len(m.Data) > 0 { - for _, msg := range m.Data { - dAtA[i] = 0x1a - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.Version != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(m.Version)) - } - if m.Meta != nil { - dAtA[i] = 0x2a - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(m.Meta.Size())) - n7, err := m.Meta.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n7 - } - return i, nil -} - -func (m *StoreIdent) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StoreIdent) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.ClusterId != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(m.ClusterId)) - } - if m.StoreId != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(m.StoreId)) - } - return i, nil -} - -func (m *RaftLocalState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RaftLocalState) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.HardState != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(m.HardState.Size())) - n8, err := m.HardState.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n8 - } - if m.LastIndex != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(m.LastIndex)) - } - return i, nil -} - -func (m *RaftApplyState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RaftApplyState) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.AppliedIndex != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(m.AppliedIndex)) - } - if m.TruncatedState != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(m.TruncatedState.Size())) - n9, err := m.TruncatedState.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n9 - } - return i, nil -} - -func (m *RegionLocalState) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RegionLocalState) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.State != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(m.State)) - } - if m.Region != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftServerpb(dAtA, i, uint64(m.Region.Size())) - n10, err := m.Region.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n10 - } - return i, nil -} - -func encodeFixed64RaftServerpb(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32RaftServerpb(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintRaftServerpb(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *RaftMessage) Size() (n int) { - var l int - _ = l - if m.RegionId != 0 { - n += 1 + sovRaftServerpb(uint64(m.RegionId)) - } - if m.FromPeer != nil { - l = m.FromPeer.Size() - n += 1 + l + sovRaftServerpb(uint64(l)) - } - if m.ToPeer != nil { - l = m.ToPeer.Size() - n += 1 + l + sovRaftServerpb(uint64(l)) - } - if m.Message != nil { - l = m.Message.Size() - n += 1 + l + sovRaftServerpb(uint64(l)) - } - if m.RegionEpoch != nil { - l = m.RegionEpoch.Size() - n += 1 + l + sovRaftServerpb(uint64(l)) - } - if m.IsTombstone { - n += 2 - } - l = len(m.StartKey) - if l > 0 { - n += 1 + l + sovRaftServerpb(uint64(l)) - } - l = len(m.EndKey) - if l > 0 { - n += 1 + l + sovRaftServerpb(uint64(l)) - } - return n -} - -func (m *RaftTruncatedState) Size() (n int) { - var l int - _ = l - if m.Index != 0 { - n += 1 + sovRaftServerpb(uint64(m.Index)) - } - if m.Term != 0 { - n += 1 + sovRaftServerpb(uint64(m.Term)) - } - return n -} - -func (m *SnapshotCFFile) Size() (n int) { - var l int - _ = l - l = len(m.Cf) - if l > 0 { - n += 1 + l + sovRaftServerpb(uint64(l)) - } - if m.Size_ != 0 { - n += 1 + sovRaftServerpb(uint64(m.Size_)) - } - if m.Checksum != 0 { - n += 1 + sovRaftServerpb(uint64(m.Checksum)) - } - return n -} - -func (m *SnapshotMeta) Size() (n int) { - var l int - _ = l - if len(m.CfFiles) > 0 { - for _, e := range m.CfFiles { - l = e.Size() - n += 1 + l + sovRaftServerpb(uint64(l)) - } - } - return n -} - -func (m *SnapshotChunk) Size() (n int) { - var l int - _ = l - if m.Message != nil { - l = m.Message.Size() - n += 1 + l + sovRaftServerpb(uint64(l)) - } - l = len(m.Data) - if l > 0 { - n += 1 + l + sovRaftServerpb(uint64(l)) - } - return n -} - -func (m *Done) Size() (n int) { - var l int - _ = l - return n -} - -func (m *KeyValue) Size() (n int) { - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovRaftServerpb(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovRaftServerpb(uint64(l)) - } - return n -} - -func (m *RaftSnapshotData) Size() (n int) { - var l int - _ = l - if m.Region != nil { - l = m.Region.Size() - n += 1 + l + sovRaftServerpb(uint64(l)) - } - if m.FileSize != 0 { - n += 1 + sovRaftServerpb(uint64(m.FileSize)) - } - if len(m.Data) > 0 { - for _, e := range m.Data { - l = e.Size() - n += 1 + l + sovRaftServerpb(uint64(l)) - } - } - if m.Version != 0 { - n += 1 + sovRaftServerpb(uint64(m.Version)) - } - if m.Meta != nil { - l = m.Meta.Size() - n += 1 + l + sovRaftServerpb(uint64(l)) - } - return n -} - -func (m *StoreIdent) Size() (n int) { - var l int - _ = l - if m.ClusterId != 0 { - n += 1 + sovRaftServerpb(uint64(m.ClusterId)) - } - if m.StoreId != 0 { - n += 1 + sovRaftServerpb(uint64(m.StoreId)) - } - return n -} - -func (m *RaftLocalState) Size() (n int) { - var l int - _ = l - if m.HardState != nil { - l = m.HardState.Size() - n += 1 + l + sovRaftServerpb(uint64(l)) - } - if m.LastIndex != 0 { - n += 1 + sovRaftServerpb(uint64(m.LastIndex)) - } - return n -} - -func (m *RaftApplyState) Size() (n int) { - var l int - _ = l - if m.AppliedIndex != 0 { - n += 1 + sovRaftServerpb(uint64(m.AppliedIndex)) - } - if m.TruncatedState != nil { - l = m.TruncatedState.Size() - n += 1 + l + sovRaftServerpb(uint64(l)) - } - return n -} - -func (m *RegionLocalState) Size() (n int) { - var l int - _ = l - if m.State != 0 { - n += 1 + sovRaftServerpb(uint64(m.State)) - } - if m.Region != nil { - l = m.Region.Size() - n += 1 + l + sovRaftServerpb(uint64(l)) - } - return n -} - -func sovRaftServerpb(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozRaftServerpb(x uint64) (n int) { - return sovRaftServerpb(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *RaftMessage) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RaftMessage: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RaftMessage: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionId", wireType) - } - m.RegionId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RegionId |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromPeer", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftServerpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.FromPeer == nil { - m.FromPeer = &metapb.Peer{} - } - if err := m.FromPeer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ToPeer", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftServerpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ToPeer == nil { - m.ToPeer = &metapb.Peer{} - } - if err := m.ToPeer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftServerpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Message == nil { - m.Message = &eraftpb.Message{} - } - if err := m.Message.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegionEpoch", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftServerpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.RegionEpoch == nil { - m.RegionEpoch = &metapb.RegionEpoch{} - } - if err := m.RegionEpoch.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsTombstone", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.IsTombstone = bool(v != 0) - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StartKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRaftServerpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StartKey = append(m.StartKey[:0], dAtA[iNdEx:postIndex]...) - if m.StartKey == nil { - m.StartKey = []byte{} - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EndKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRaftServerpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.EndKey = append(m.EndKey[:0], dAtA[iNdEx:postIndex]...) - if m.EndKey == nil { - m.EndKey = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftServerpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftServerpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RaftTruncatedState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RaftTruncatedState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RaftTruncatedState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - m.Index = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Index |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Term", wireType) - } - m.Term = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Term |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRaftServerpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftServerpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SnapshotCFFile) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SnapshotCFFile: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SnapshotCFFile: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cf", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRaftServerpb - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Cf = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Size_", wireType) - } - m.Size_ = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Size_ |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Checksum", wireType) - } - m.Checksum = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Checksum |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRaftServerpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftServerpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SnapshotMeta) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SnapshotMeta: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SnapshotMeta: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CfFiles", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftServerpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CfFiles = append(m.CfFiles, &SnapshotCFFile{}) - if err := m.CfFiles[len(m.CfFiles)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftServerpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftServerpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SnapshotChunk) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SnapshotChunk: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SnapshotChunk: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftServerpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Message == nil { - m.Message = &RaftMessage{} - } - if err := m.Message.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRaftServerpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftServerpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftServerpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Done) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Done: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Done: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipRaftServerpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftServerpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *KeyValue) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: KeyValue: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: KeyValue: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRaftServerpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthRaftServerpb - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftServerpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftServerpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RaftSnapshotData) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RaftSnapshotData: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RaftSnapshotData: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Region", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftServerpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Region == nil { - m.Region = &metapb.Region{} - } - if err := m.Region.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FileSize", wireType) - } - m.FileSize = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.FileSize |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftServerpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data, &KeyValue{}) - if err := m.Data[len(m.Data)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - m.Version = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Version |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Meta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftServerpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Meta == nil { - m.Meta = &SnapshotMeta{} - } - if err := m.Meta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftServerpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftServerpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *StoreIdent) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StoreIdent: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StoreIdent: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ClusterId", wireType) - } - m.ClusterId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ClusterId |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StoreId", wireType) - } - m.StoreId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StoreId |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRaftServerpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftServerpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RaftLocalState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RaftLocalState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RaftLocalState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field HardState", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftServerpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.HardState == nil { - m.HardState = &eraftpb.HardState{} - } - if err := m.HardState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LastIndex", wireType) - } - m.LastIndex = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.LastIndex |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipRaftServerpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftServerpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RaftApplyState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RaftApplyState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RaftApplyState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AppliedIndex", wireType) - } - m.AppliedIndex = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.AppliedIndex |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TruncatedState", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftServerpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.TruncatedState == nil { - m.TruncatedState = &RaftTruncatedState{} - } - if err := m.TruncatedState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftServerpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftServerpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RegionLocalState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RegionLocalState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RegionLocalState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) - } - m.State = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.State |= (PeerState(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Region", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRaftServerpb - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Region == nil { - m.Region = &metapb.Region{} - } - if err := m.Region.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRaftServerpb(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRaftServerpb - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipRaftServerpb(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthRaftServerpb - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowRaftServerpb - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipRaftServerpb(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthRaftServerpb = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowRaftServerpb = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("raft_serverpb.proto", fileDescriptorRaftServerpb) } - -var fileDescriptorRaftServerpb = []byte{ - // 774 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0xdb, 0x8e, 0xdb, 0x44, - 0x18, 0xae, 0xb3, 0xde, 0xc4, 0xfe, 0xe3, 0x84, 0x68, 0x8a, 0x54, 0xb3, 0x55, 0xa3, 0xd4, 0x08, - 0x14, 0x16, 0xc9, 0x88, 0x50, 0x21, 0xae, 0x90, 0x80, 0xb2, 0x6a, 0x58, 0x8a, 0xaa, 0x49, 0x85, - 0xc4, 0x95, 0x35, 0xb1, 0x7f, 0x27, 0x26, 0x3e, 0x69, 0x66, 0x12, 0x11, 0xee, 0x78, 0x0b, 0x5e, - 0x85, 0x37, 0xe0, 0x0e, 0x1e, 0x01, 0x2d, 0x2f, 0x82, 0x66, 0xc6, 0xce, 0x61, 0x55, 0x7a, 0xe5, - 0xff, 0x7c, 0xf8, 0xfe, 0xcf, 0x03, 0x0f, 0x39, 0x4b, 0x65, 0x24, 0x90, 0xef, 0x90, 0xd7, 0xcb, - 0xb0, 0xe6, 0x95, 0xac, 0xc8, 0xe0, 0xcc, 0x78, 0x35, 0x40, 0xa5, 0xb7, 0xde, 0x2b, 0xaf, 0x40, - 0xc9, 0x5a, 0x2d, 0xf8, 0xa3, 0x03, 0x7d, 0xca, 0x52, 0xf9, 0x12, 0x85, 0x60, 0x2b, 0x24, 0x8f, - 0xc1, 0xe5, 0xb8, 0xca, 0xaa, 0x32, 0xca, 0x12, 0xdf, 0x9a, 0x58, 0x53, 0x9b, 0x3a, 0xc6, 0x30, - 0x4f, 0xc8, 0x47, 0xe0, 0xa6, 0xbc, 0x2a, 0xa2, 0x1a, 0x91, 0xfb, 0x9d, 0x89, 0x35, 0xed, 0xcf, - 0xbc, 0xb0, 0x29, 0xf7, 0x0a, 0x91, 0x53, 0x47, 0xb9, 0x95, 0x44, 0x3e, 0x80, 0x9e, 0xac, 0x4c, - 0xe0, 0xc5, 0x1b, 0x02, 0xbb, 0xb2, 0xd2, 0x61, 0xd7, 0xd0, 0x2b, 0x4c, 0x67, 0xdf, 0xd6, 0x61, - 0xa3, 0xb0, 0x9d, 0xb6, 0x99, 0x88, 0xb6, 0x01, 0xe4, 0x73, 0xf0, 0x9a, 0xd1, 0xb0, 0xae, 0xe2, - 0xb5, 0x7f, 0xa9, 0x13, 0x1e, 0xb6, 0x75, 0xa9, 0xf6, 0x7d, 0xab, 0x5c, 0xb4, 0xcf, 0x8f, 0x0a, - 0x79, 0x0a, 0x5e, 0x26, 0x22, 0x59, 0x15, 0x4b, 0x21, 0xab, 0x12, 0xfd, 0xee, 0xc4, 0x9a, 0x3a, - 0xb4, 0x9f, 0x89, 0xd7, 0xad, 0x49, 0x6d, 0x2d, 0x24, 0xe3, 0x32, 0xda, 0xe0, 0xde, 0xef, 0x4d, - 0xac, 0xa9, 0x47, 0x1d, 0x6d, 0xb8, 0xc5, 0x3d, 0x79, 0x04, 0x3d, 0x2c, 0x13, 0xed, 0x72, 0xb4, - 0xab, 0x8b, 0x65, 0x72, 0x8b, 0xfb, 0xe0, 0x4b, 0x20, 0x0a, 0xba, 0xd7, 0x7c, 0x5b, 0xc6, 0x4c, - 0x62, 0xb2, 0x90, 0x4c, 0x22, 0x79, 0x17, 0x2e, 0xb3, 0x32, 0xc1, 0x5f, 0x1a, 0xf4, 0x8c, 0x42, - 0x08, 0xd8, 0x12, 0x79, 0xa1, 0x51, 0xb3, 0xa9, 0x96, 0x83, 0x57, 0x30, 0x5c, 0x94, 0xac, 0x16, - 0xeb, 0x4a, 0x7e, 0x73, 0x73, 0x93, 0xe5, 0x48, 0x86, 0xd0, 0x89, 0x53, 0x9d, 0xe8, 0xd2, 0x4e, - 0x9c, 0xaa, 0x2c, 0x91, 0xfd, 0x8a, 0x6d, 0x96, 0x92, 0xc9, 0x15, 0x38, 0xf1, 0x1a, 0xe3, 0x8d, - 0xd8, 0x16, 0x1a, 0xda, 0x01, 0x3d, 0xe8, 0xc1, 0x0b, 0xf0, 0xda, 0x8a, 0x2f, 0x51, 0x32, 0xf2, - 0x05, 0x38, 0x71, 0x1a, 0xa5, 0x59, 0x8e, 0xc2, 0xb7, 0x26, 0x17, 0xd3, 0xfe, 0xec, 0x49, 0x78, - 0xce, 0x98, 0xf3, 0x01, 0x68, 0x2f, 0x4e, 0xd5, 0x57, 0x04, 0x3f, 0xc1, 0xe0, 0xe0, 0x5a, 0x6f, - 0xcb, 0x0d, 0x79, 0x76, 0xbc, 0x94, 0xa5, 0x81, 0xbf, 0xba, 0x57, 0xe9, 0x84, 0x45, 0xc7, 0x9b, - 0x11, 0xb0, 0x13, 0x26, 0x99, 0x5e, 0xc0, 0xa3, 0x5a, 0x0e, 0xba, 0x60, 0x3f, 0xaf, 0x4a, 0x0c, - 0x66, 0xe0, 0xdc, 0xe2, 0xfe, 0x47, 0x96, 0x6f, 0x91, 0x8c, 0xe0, 0x42, 0xe1, 0x6b, 0xe9, 0x30, - 0x25, 0x2a, 0x18, 0x77, 0xca, 0xd5, 0xa4, 0x1a, 0x25, 0xf8, 0xcb, 0x82, 0x91, 0x6a, 0xd4, 0xce, - 0xf6, 0x9c, 0x49, 0x46, 0x3e, 0x84, 0xae, 0xb9, 0x77, 0x33, 0xd9, 0xf0, 0x9c, 0x12, 0xb4, 0xf1, - 0xaa, 0x2b, 0x2b, 0x28, 0xa2, 0x13, 0x48, 0x1d, 0x65, 0x58, 0x28, 0x58, 0x3f, 0x6e, 0x26, 0xbd, - 0xd0, 0x30, 0x3d, 0xba, 0xb7, 0x5c, 0x3b, 0xa8, 0x59, 0x81, 0xf8, 0xd0, 0xdb, 0x21, 0x17, 0xaa, - 0xa5, 0xad, 0xeb, 0xb4, 0x2a, 0xf9, 0x04, 0x6c, 0xd5, 0xbc, 0x21, 0xe7, 0xe3, 0xff, 0x41, 0x5b, - 0x1d, 0x87, 0xea, 0xc0, 0xe0, 0x06, 0x60, 0x21, 0x2b, 0x8e, 0xf3, 0x04, 0x4b, 0x49, 0x9e, 0x00, - 0xc4, 0xf9, 0x56, 0x48, 0xe4, 0xc7, 0xff, 0xcf, 0x6d, 0x2c, 0xf3, 0x84, 0xbc, 0x07, 0x8e, 0x50, - 0xc1, 0xca, 0x69, 0x16, 0xe8, 0x09, 0x93, 0x1c, 0x2c, 0x61, 0xa8, 0x80, 0xf9, 0xbe, 0x8a, 0x59, - 0x6e, 0x88, 0xf8, 0x29, 0xc0, 0x9a, 0xf1, 0x24, 0x12, 0x4a, 0x6b, 0xa0, 0x21, 0x87, 0xdf, 0xeb, - 0x05, 0xe3, 0x86, 0xb0, 0xd4, 0x5d, 0xb7, 0xa2, 0x6a, 0x9f, 0x33, 0x21, 0x23, 0x43, 0x60, 0xd3, - 0xc1, 0x55, 0x96, 0xb9, 0x32, 0x04, 0xbf, 0x59, 0xa6, 0xc9, 0x57, 0x75, 0x9d, 0xef, 0x4d, 0xc6, - 0xfb, 0x30, 0x60, 0x75, 0x9d, 0x67, 0x98, 0x44, 0xa7, 0xac, 0xf7, 0x1a, 0xa3, 0xce, 0x23, 0xdf, - 0xc1, 0x3b, 0xb2, 0xfd, 0x49, 0x9a, 0x71, 0xcc, 0xeb, 0xf1, 0xf4, 0x0d, 0x1c, 0x3a, 0xff, 0x9d, - 0xe8, 0x50, 0x9e, 0xe9, 0xc1, 0xcf, 0x30, 0x32, 0x67, 0x3d, 0xd9, 0x34, 0x84, 0xcb, 0xe3, 0x92, - 0xc3, 0x99, 0x7f, 0xaf, 0xaa, 0x7a, 0x69, 0x4c, 0x31, 0x13, 0x76, 0x42, 0x98, 0xce, 0xdb, 0x08, - 0x73, 0xfd, 0x0c, 0xdc, 0x43, 0x2e, 0x01, 0xe8, 0xfe, 0x50, 0xf1, 0x82, 0xe5, 0xa3, 0x07, 0xc4, - 0x03, 0x47, 0x63, 0x90, 0x95, 0xab, 0x91, 0x45, 0x06, 0xe0, 0x1e, 0x9e, 0x92, 0x51, 0xe7, 0xeb, - 0xeb, 0x3f, 0xef, 0xc6, 0xd6, 0xdf, 0x77, 0x63, 0xeb, 0x9f, 0xbb, 0xb1, 0xf5, 0xfb, 0xbf, 0xe3, - 0x07, 0xe0, 0xc7, 0x55, 0x11, 0xd6, 0x59, 0xb9, 0x8a, 0x59, 0x1d, 0xca, 0x6c, 0xb3, 0x0b, 0x37, - 0x3b, 0xfd, 0xfc, 0x2e, 0xbb, 0xfa, 0xf3, 0xd9, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x13, 0x81, - 0xd5, 0xd2, 0xc8, 0x05, 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/tikvpb/tikvpb.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/tikvpb/tikvpb.pb.go deleted file mode 100644 index f4dba945e4e..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/pkg/tikvpb/tikvpb.pb.go +++ /dev/null @@ -1,895 +0,0 @@ -// Code generated by protoc-gen-gogo. -// source: tikvpb.proto -// DO NOT EDIT! - -/* - Package tikvpb is a generated protocol buffer package. - - It is generated from these files: - tikvpb.proto - - It has these top-level messages: -*/ -package tikvpb - -import ( - "fmt" - "math" - - proto "github.com/golang/protobuf/proto" - - coprocessor "github.com/pingcap/kvproto/pkg/coprocessor" - - kvrpcpb "github.com/pingcap/kvproto/pkg/kvrpcpb" - - raft_serverpb "github.com/pingcap/kvproto/pkg/raft_serverpb" - - context "golang.org/x/net/context" - - grpc "google.golang.org/grpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// Client API for Tikv service - -type TikvClient interface { - // KV commands with mvcc/txn supported. - KvGet(ctx context.Context, in *kvrpcpb.GetRequest, opts ...grpc.CallOption) (*kvrpcpb.GetResponse, error) - KvScan(ctx context.Context, in *kvrpcpb.ScanRequest, opts ...grpc.CallOption) (*kvrpcpb.ScanResponse, error) - KvPrewrite(ctx context.Context, in *kvrpcpb.PrewriteRequest, opts ...grpc.CallOption) (*kvrpcpb.PrewriteResponse, error) - KvCommit(ctx context.Context, in *kvrpcpb.CommitRequest, opts ...grpc.CallOption) (*kvrpcpb.CommitResponse, error) - KvImport(ctx context.Context, in *kvrpcpb.ImportRequest, opts ...grpc.CallOption) (*kvrpcpb.ImportResponse, error) - KvCleanup(ctx context.Context, in *kvrpcpb.CleanupRequest, opts ...grpc.CallOption) (*kvrpcpb.CleanupResponse, error) - KvBatchGet(ctx context.Context, in *kvrpcpb.BatchGetRequest, opts ...grpc.CallOption) (*kvrpcpb.BatchGetResponse, error) - KvBatchRollback(ctx context.Context, in *kvrpcpb.BatchRollbackRequest, opts ...grpc.CallOption) (*kvrpcpb.BatchRollbackResponse, error) - KvScanLock(ctx context.Context, in *kvrpcpb.ScanLockRequest, opts ...grpc.CallOption) (*kvrpcpb.ScanLockResponse, error) - KvResolveLock(ctx context.Context, in *kvrpcpb.ResolveLockRequest, opts ...grpc.CallOption) (*kvrpcpb.ResolveLockResponse, error) - KvGC(ctx context.Context, in *kvrpcpb.GCRequest, opts ...grpc.CallOption) (*kvrpcpb.GCResponse, error) - KvDeleteRange(ctx context.Context, in *kvrpcpb.DeleteRangeRequest, opts ...grpc.CallOption) (*kvrpcpb.DeleteRangeResponse, error) - // RawKV commands. - RawGet(ctx context.Context, in *kvrpcpb.RawGetRequest, opts ...grpc.CallOption) (*kvrpcpb.RawGetResponse, error) - RawPut(ctx context.Context, in *kvrpcpb.RawPutRequest, opts ...grpc.CallOption) (*kvrpcpb.RawPutResponse, error) - RawDelete(ctx context.Context, in *kvrpcpb.RawDeleteRequest, opts ...grpc.CallOption) (*kvrpcpb.RawDeleteResponse, error) - RawScan(ctx context.Context, in *kvrpcpb.RawScanRequest, opts ...grpc.CallOption) (*kvrpcpb.RawScanResponse, error) - // SQL push down commands. - Coprocessor(ctx context.Context, in *coprocessor.Request, opts ...grpc.CallOption) (*coprocessor.Response, error) - // Raft commands (tikv <-> tikv). - Raft(ctx context.Context, opts ...grpc.CallOption) (Tikv_RaftClient, error) - Snapshot(ctx context.Context, opts ...grpc.CallOption) (Tikv_SnapshotClient, error) - // transaction debugger commands. - MvccGetByKey(ctx context.Context, in *kvrpcpb.MvccGetByKeyRequest, opts ...grpc.CallOption) (*kvrpcpb.MvccGetByKeyResponse, error) - MvccGetByStartTs(ctx context.Context, in *kvrpcpb.MvccGetByStartTsRequest, opts ...grpc.CallOption) (*kvrpcpb.MvccGetByStartTsResponse, error) -} - -type tikvClient struct { - cc *grpc.ClientConn -} - -func NewTikvClient(cc *grpc.ClientConn) TikvClient { - return &tikvClient{cc} -} - -func (c *tikvClient) KvGet(ctx context.Context, in *kvrpcpb.GetRequest, opts ...grpc.CallOption) (*kvrpcpb.GetResponse, error) { - out := new(kvrpcpb.GetResponse) - err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvGet", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *tikvClient) KvScan(ctx context.Context, in *kvrpcpb.ScanRequest, opts ...grpc.CallOption) (*kvrpcpb.ScanResponse, error) { - out := new(kvrpcpb.ScanResponse) - err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvScan", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *tikvClient) KvPrewrite(ctx context.Context, in *kvrpcpb.PrewriteRequest, opts ...grpc.CallOption) (*kvrpcpb.PrewriteResponse, error) { - out := new(kvrpcpb.PrewriteResponse) - err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvPrewrite", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *tikvClient) KvCommit(ctx context.Context, in *kvrpcpb.CommitRequest, opts ...grpc.CallOption) (*kvrpcpb.CommitResponse, error) { - out := new(kvrpcpb.CommitResponse) - err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvCommit", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *tikvClient) KvImport(ctx context.Context, in *kvrpcpb.ImportRequest, opts ...grpc.CallOption) (*kvrpcpb.ImportResponse, error) { - out := new(kvrpcpb.ImportResponse) - err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvImport", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *tikvClient) KvCleanup(ctx context.Context, in *kvrpcpb.CleanupRequest, opts ...grpc.CallOption) (*kvrpcpb.CleanupResponse, error) { - out := new(kvrpcpb.CleanupResponse) - err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvCleanup", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *tikvClient) KvBatchGet(ctx context.Context, in *kvrpcpb.BatchGetRequest, opts ...grpc.CallOption) (*kvrpcpb.BatchGetResponse, error) { - out := new(kvrpcpb.BatchGetResponse) - err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvBatchGet", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *tikvClient) KvBatchRollback(ctx context.Context, in *kvrpcpb.BatchRollbackRequest, opts ...grpc.CallOption) (*kvrpcpb.BatchRollbackResponse, error) { - out := new(kvrpcpb.BatchRollbackResponse) - err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvBatchRollback", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *tikvClient) KvScanLock(ctx context.Context, in *kvrpcpb.ScanLockRequest, opts ...grpc.CallOption) (*kvrpcpb.ScanLockResponse, error) { - out := new(kvrpcpb.ScanLockResponse) - err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvScanLock", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *tikvClient) KvResolveLock(ctx context.Context, in *kvrpcpb.ResolveLockRequest, opts ...grpc.CallOption) (*kvrpcpb.ResolveLockResponse, error) { - out := new(kvrpcpb.ResolveLockResponse) - err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvResolveLock", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *tikvClient) KvGC(ctx context.Context, in *kvrpcpb.GCRequest, opts ...grpc.CallOption) (*kvrpcpb.GCResponse, error) { - out := new(kvrpcpb.GCResponse) - err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvGC", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *tikvClient) KvDeleteRange(ctx context.Context, in *kvrpcpb.DeleteRangeRequest, opts ...grpc.CallOption) (*kvrpcpb.DeleteRangeResponse, error) { - out := new(kvrpcpb.DeleteRangeResponse) - err := grpc.Invoke(ctx, "/tikvpb.Tikv/KvDeleteRange", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *tikvClient) RawGet(ctx context.Context, in *kvrpcpb.RawGetRequest, opts ...grpc.CallOption) (*kvrpcpb.RawGetResponse, error) { - out := new(kvrpcpb.RawGetResponse) - err := grpc.Invoke(ctx, "/tikvpb.Tikv/RawGet", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *tikvClient) RawPut(ctx context.Context, in *kvrpcpb.RawPutRequest, opts ...grpc.CallOption) (*kvrpcpb.RawPutResponse, error) { - out := new(kvrpcpb.RawPutResponse) - err := grpc.Invoke(ctx, "/tikvpb.Tikv/RawPut", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *tikvClient) RawDelete(ctx context.Context, in *kvrpcpb.RawDeleteRequest, opts ...grpc.CallOption) (*kvrpcpb.RawDeleteResponse, error) { - out := new(kvrpcpb.RawDeleteResponse) - err := grpc.Invoke(ctx, "/tikvpb.Tikv/RawDelete", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *tikvClient) RawScan(ctx context.Context, in *kvrpcpb.RawScanRequest, opts ...grpc.CallOption) (*kvrpcpb.RawScanResponse, error) { - out := new(kvrpcpb.RawScanResponse) - err := grpc.Invoke(ctx, "/tikvpb.Tikv/RawScan", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *tikvClient) Coprocessor(ctx context.Context, in *coprocessor.Request, opts ...grpc.CallOption) (*coprocessor.Response, error) { - out := new(coprocessor.Response) - err := grpc.Invoke(ctx, "/tikvpb.Tikv/Coprocessor", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *tikvClient) Raft(ctx context.Context, opts ...grpc.CallOption) (Tikv_RaftClient, error) { - stream, err := grpc.NewClientStream(ctx, &_Tikv_serviceDesc.Streams[0], c.cc, "/tikvpb.Tikv/Raft", opts...) - if err != nil { - return nil, err - } - x := &tikvRaftClient{stream} - return x, nil -} - -type Tikv_RaftClient interface { - Send(*raft_serverpb.RaftMessage) error - CloseAndRecv() (*raft_serverpb.Done, error) - grpc.ClientStream -} - -type tikvRaftClient struct { - grpc.ClientStream -} - -func (x *tikvRaftClient) Send(m *raft_serverpb.RaftMessage) error { - return x.ClientStream.SendMsg(m) -} - -func (x *tikvRaftClient) CloseAndRecv() (*raft_serverpb.Done, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(raft_serverpb.Done) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *tikvClient) Snapshot(ctx context.Context, opts ...grpc.CallOption) (Tikv_SnapshotClient, error) { - stream, err := grpc.NewClientStream(ctx, &_Tikv_serviceDesc.Streams[1], c.cc, "/tikvpb.Tikv/Snapshot", opts...) - if err != nil { - return nil, err - } - x := &tikvSnapshotClient{stream} - return x, nil -} - -type Tikv_SnapshotClient interface { - Send(*raft_serverpb.SnapshotChunk) error - CloseAndRecv() (*raft_serverpb.Done, error) - grpc.ClientStream -} - -type tikvSnapshotClient struct { - grpc.ClientStream -} - -func (x *tikvSnapshotClient) Send(m *raft_serverpb.SnapshotChunk) error { - return x.ClientStream.SendMsg(m) -} - -func (x *tikvSnapshotClient) CloseAndRecv() (*raft_serverpb.Done, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(raft_serverpb.Done) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *tikvClient) MvccGetByKey(ctx context.Context, in *kvrpcpb.MvccGetByKeyRequest, opts ...grpc.CallOption) (*kvrpcpb.MvccGetByKeyResponse, error) { - out := new(kvrpcpb.MvccGetByKeyResponse) - err := grpc.Invoke(ctx, "/tikvpb.Tikv/MvccGetByKey", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *tikvClient) MvccGetByStartTs(ctx context.Context, in *kvrpcpb.MvccGetByStartTsRequest, opts ...grpc.CallOption) (*kvrpcpb.MvccGetByStartTsResponse, error) { - out := new(kvrpcpb.MvccGetByStartTsResponse) - err := grpc.Invoke(ctx, "/tikvpb.Tikv/MvccGetByStartTs", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Server API for Tikv service - -type TikvServer interface { - // KV commands with mvcc/txn supported. - KvGet(context.Context, *kvrpcpb.GetRequest) (*kvrpcpb.GetResponse, error) - KvScan(context.Context, *kvrpcpb.ScanRequest) (*kvrpcpb.ScanResponse, error) - KvPrewrite(context.Context, *kvrpcpb.PrewriteRequest) (*kvrpcpb.PrewriteResponse, error) - KvCommit(context.Context, *kvrpcpb.CommitRequest) (*kvrpcpb.CommitResponse, error) - KvImport(context.Context, *kvrpcpb.ImportRequest) (*kvrpcpb.ImportResponse, error) - KvCleanup(context.Context, *kvrpcpb.CleanupRequest) (*kvrpcpb.CleanupResponse, error) - KvBatchGet(context.Context, *kvrpcpb.BatchGetRequest) (*kvrpcpb.BatchGetResponse, error) - KvBatchRollback(context.Context, *kvrpcpb.BatchRollbackRequest) (*kvrpcpb.BatchRollbackResponse, error) - KvScanLock(context.Context, *kvrpcpb.ScanLockRequest) (*kvrpcpb.ScanLockResponse, error) - KvResolveLock(context.Context, *kvrpcpb.ResolveLockRequest) (*kvrpcpb.ResolveLockResponse, error) - KvGC(context.Context, *kvrpcpb.GCRequest) (*kvrpcpb.GCResponse, error) - KvDeleteRange(context.Context, *kvrpcpb.DeleteRangeRequest) (*kvrpcpb.DeleteRangeResponse, error) - // RawKV commands. - RawGet(context.Context, *kvrpcpb.RawGetRequest) (*kvrpcpb.RawGetResponse, error) - RawPut(context.Context, *kvrpcpb.RawPutRequest) (*kvrpcpb.RawPutResponse, error) - RawDelete(context.Context, *kvrpcpb.RawDeleteRequest) (*kvrpcpb.RawDeleteResponse, error) - RawScan(context.Context, *kvrpcpb.RawScanRequest) (*kvrpcpb.RawScanResponse, error) - // SQL push down commands. - Coprocessor(context.Context, *coprocessor.Request) (*coprocessor.Response, error) - // Raft commands (tikv <-> tikv). - Raft(Tikv_RaftServer) error - Snapshot(Tikv_SnapshotServer) error - // transaction debugger commands. - MvccGetByKey(context.Context, *kvrpcpb.MvccGetByKeyRequest) (*kvrpcpb.MvccGetByKeyResponse, error) - MvccGetByStartTs(context.Context, *kvrpcpb.MvccGetByStartTsRequest) (*kvrpcpb.MvccGetByStartTsResponse, error) -} - -func RegisterTikvServer(s *grpc.Server, srv TikvServer) { - s.RegisterService(&_Tikv_serviceDesc, srv) -} - -func _Tikv_KvGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(kvrpcpb.GetRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TikvServer).KvGet(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tikvpb.Tikv/KvGet", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TikvServer).KvGet(ctx, req.(*kvrpcpb.GetRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Tikv_KvScan_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(kvrpcpb.ScanRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TikvServer).KvScan(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tikvpb.Tikv/KvScan", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TikvServer).KvScan(ctx, req.(*kvrpcpb.ScanRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Tikv_KvPrewrite_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(kvrpcpb.PrewriteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TikvServer).KvPrewrite(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tikvpb.Tikv/KvPrewrite", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TikvServer).KvPrewrite(ctx, req.(*kvrpcpb.PrewriteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Tikv_KvCommit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(kvrpcpb.CommitRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TikvServer).KvCommit(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tikvpb.Tikv/KvCommit", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TikvServer).KvCommit(ctx, req.(*kvrpcpb.CommitRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Tikv_KvImport_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(kvrpcpb.ImportRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TikvServer).KvImport(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tikvpb.Tikv/KvImport", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TikvServer).KvImport(ctx, req.(*kvrpcpb.ImportRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Tikv_KvCleanup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(kvrpcpb.CleanupRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TikvServer).KvCleanup(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tikvpb.Tikv/KvCleanup", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TikvServer).KvCleanup(ctx, req.(*kvrpcpb.CleanupRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Tikv_KvBatchGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(kvrpcpb.BatchGetRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TikvServer).KvBatchGet(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tikvpb.Tikv/KvBatchGet", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TikvServer).KvBatchGet(ctx, req.(*kvrpcpb.BatchGetRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Tikv_KvBatchRollback_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(kvrpcpb.BatchRollbackRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TikvServer).KvBatchRollback(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tikvpb.Tikv/KvBatchRollback", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TikvServer).KvBatchRollback(ctx, req.(*kvrpcpb.BatchRollbackRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Tikv_KvScanLock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(kvrpcpb.ScanLockRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TikvServer).KvScanLock(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tikvpb.Tikv/KvScanLock", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TikvServer).KvScanLock(ctx, req.(*kvrpcpb.ScanLockRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Tikv_KvResolveLock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(kvrpcpb.ResolveLockRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TikvServer).KvResolveLock(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tikvpb.Tikv/KvResolveLock", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TikvServer).KvResolveLock(ctx, req.(*kvrpcpb.ResolveLockRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Tikv_KvGC_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(kvrpcpb.GCRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TikvServer).KvGC(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tikvpb.Tikv/KvGC", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TikvServer).KvGC(ctx, req.(*kvrpcpb.GCRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Tikv_KvDeleteRange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(kvrpcpb.DeleteRangeRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TikvServer).KvDeleteRange(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tikvpb.Tikv/KvDeleteRange", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TikvServer).KvDeleteRange(ctx, req.(*kvrpcpb.DeleteRangeRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Tikv_RawGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(kvrpcpb.RawGetRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TikvServer).RawGet(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tikvpb.Tikv/RawGet", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TikvServer).RawGet(ctx, req.(*kvrpcpb.RawGetRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Tikv_RawPut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(kvrpcpb.RawPutRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TikvServer).RawPut(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tikvpb.Tikv/RawPut", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TikvServer).RawPut(ctx, req.(*kvrpcpb.RawPutRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Tikv_RawDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(kvrpcpb.RawDeleteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TikvServer).RawDelete(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tikvpb.Tikv/RawDelete", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TikvServer).RawDelete(ctx, req.(*kvrpcpb.RawDeleteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Tikv_RawScan_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(kvrpcpb.RawScanRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TikvServer).RawScan(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tikvpb.Tikv/RawScan", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TikvServer).RawScan(ctx, req.(*kvrpcpb.RawScanRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Tikv_Coprocessor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(coprocessor.Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TikvServer).Coprocessor(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tikvpb.Tikv/Coprocessor", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TikvServer).Coprocessor(ctx, req.(*coprocessor.Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Tikv_Raft_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(TikvServer).Raft(&tikvRaftServer{stream}) -} - -type Tikv_RaftServer interface { - SendAndClose(*raft_serverpb.Done) error - Recv() (*raft_serverpb.RaftMessage, error) - grpc.ServerStream -} - -type tikvRaftServer struct { - grpc.ServerStream -} - -func (x *tikvRaftServer) SendAndClose(m *raft_serverpb.Done) error { - return x.ServerStream.SendMsg(m) -} - -func (x *tikvRaftServer) Recv() (*raft_serverpb.RaftMessage, error) { - m := new(raft_serverpb.RaftMessage) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _Tikv_Snapshot_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(TikvServer).Snapshot(&tikvSnapshotServer{stream}) -} - -type Tikv_SnapshotServer interface { - SendAndClose(*raft_serverpb.Done) error - Recv() (*raft_serverpb.SnapshotChunk, error) - grpc.ServerStream -} - -type tikvSnapshotServer struct { - grpc.ServerStream -} - -func (x *tikvSnapshotServer) SendAndClose(m *raft_serverpb.Done) error { - return x.ServerStream.SendMsg(m) -} - -func (x *tikvSnapshotServer) Recv() (*raft_serverpb.SnapshotChunk, error) { - m := new(raft_serverpb.SnapshotChunk) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _Tikv_MvccGetByKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(kvrpcpb.MvccGetByKeyRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TikvServer).MvccGetByKey(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tikvpb.Tikv/MvccGetByKey", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TikvServer).MvccGetByKey(ctx, req.(*kvrpcpb.MvccGetByKeyRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Tikv_MvccGetByStartTs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(kvrpcpb.MvccGetByStartTsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TikvServer).MvccGetByStartTs(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tikvpb.Tikv/MvccGetByStartTs", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TikvServer).MvccGetByStartTs(ctx, req.(*kvrpcpb.MvccGetByStartTsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Tikv_serviceDesc = grpc.ServiceDesc{ - ServiceName: "tikvpb.Tikv", - HandlerType: (*TikvServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "KvGet", - Handler: _Tikv_KvGet_Handler, - }, - { - MethodName: "KvScan", - Handler: _Tikv_KvScan_Handler, - }, - { - MethodName: "KvPrewrite", - Handler: _Tikv_KvPrewrite_Handler, - }, - { - MethodName: "KvCommit", - Handler: _Tikv_KvCommit_Handler, - }, - { - MethodName: "KvImport", - Handler: _Tikv_KvImport_Handler, - }, - { - MethodName: "KvCleanup", - Handler: _Tikv_KvCleanup_Handler, - }, - { - MethodName: "KvBatchGet", - Handler: _Tikv_KvBatchGet_Handler, - }, - { - MethodName: "KvBatchRollback", - Handler: _Tikv_KvBatchRollback_Handler, - }, - { - MethodName: "KvScanLock", - Handler: _Tikv_KvScanLock_Handler, - }, - { - MethodName: "KvResolveLock", - Handler: _Tikv_KvResolveLock_Handler, - }, - { - MethodName: "KvGC", - Handler: _Tikv_KvGC_Handler, - }, - { - MethodName: "KvDeleteRange", - Handler: _Tikv_KvDeleteRange_Handler, - }, - { - MethodName: "RawGet", - Handler: _Tikv_RawGet_Handler, - }, - { - MethodName: "RawPut", - Handler: _Tikv_RawPut_Handler, - }, - { - MethodName: "RawDelete", - Handler: _Tikv_RawDelete_Handler, - }, - { - MethodName: "RawScan", - Handler: _Tikv_RawScan_Handler, - }, - { - MethodName: "Coprocessor", - Handler: _Tikv_Coprocessor_Handler, - }, - { - MethodName: "MvccGetByKey", - Handler: _Tikv_MvccGetByKey_Handler, - }, - { - MethodName: "MvccGetByStartTs", - Handler: _Tikv_MvccGetByStartTs_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "Raft", - Handler: _Tikv_Raft_Handler, - ClientStreams: true, - }, - { - StreamName: "Snapshot", - Handler: _Tikv_Snapshot_Handler, - ClientStreams: true, - }, - }, - Metadata: "tikvpb.proto", -} - -func init() { proto.RegisterFile("tikvpb.proto", fileDescriptorTikvpb) } - -var fileDescriptorTikvpb = []byte{ - // 579 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x95, 0xdd, 0x8e, 0xd2, 0x4e, - 0x18, 0xc6, 0x97, 0x84, 0x3f, 0xff, 0xdd, 0xd9, 0xdd, 0xa8, 0x03, 0x2a, 0x5b, 0x77, 0x89, 0xee, - 0x91, 0xf1, 0xa0, 0xc6, 0x8f, 0xc4, 0x03, 0x3f, 0xa2, 0x94, 0x84, 0x98, 0x2e, 0x09, 0x29, 0x7b, - 0xe2, 0x91, 0x19, 0x26, 0xef, 0x02, 0x29, 0x74, 0xea, 0xcc, 0x30, 0x64, 0xaf, 0xc2, 0x53, 0x2f, - 0xc9, 0x43, 0x2f, 0xc1, 0xe0, 0x8d, 0x98, 0xb6, 0xcc, 0x74, 0x86, 0x82, 0x47, 0xb4, 0xbf, 0xe7, - 0x7d, 0x9e, 0xbe, 0xf3, 0x09, 0x3a, 0x91, 0xb3, 0x58, 0xa5, 0x63, 0x3f, 0xe5, 0x4c, 0x32, 0xdc, - 0x28, 0xde, 0xbc, 0x7b, 0x94, 0xa5, 0x9c, 0x51, 0x10, 0x82, 0xf1, 0x42, 0xf2, 0x4e, 0x63, 0xc5, - 0x53, 0xaa, 0x2b, 0xbd, 0x26, 0x27, 0x37, 0xf2, 0xab, 0x00, 0xae, 0x80, 0x1b, 0xd8, 0x9a, 0xb0, - 0x09, 0xcb, 0x1f, 0x9f, 0x67, 0x4f, 0x05, 0x7d, 0xf9, 0xfd, 0x18, 0xd5, 0xaf, 0x67, 0xb1, 0xc2, - 0xaf, 0xd1, 0x7f, 0xa1, 0xea, 0x83, 0xc4, 0x4d, 0x5f, 0x87, 0xf5, 0x41, 0x46, 0xf0, 0x6d, 0x09, - 0x42, 0x7a, 0x2d, 0x17, 0x8a, 0x94, 0x25, 0x02, 0x2e, 0x0f, 0xf0, 0x1b, 0xd4, 0x08, 0xd5, 0x88, - 0x92, 0x04, 0x97, 0x15, 0xd9, 0xab, 0xf6, 0xdd, 0xdf, 0xa2, 0xc6, 0x18, 0x20, 0x14, 0xaa, 0x21, - 0x87, 0x15, 0x9f, 0x49, 0xc0, 0x6d, 0x53, 0xa6, 0x91, 0x0e, 0x38, 0xdb, 0xa1, 0x98, 0x90, 0xf7, - 0xe8, 0x30, 0x54, 0x01, 0x5b, 0x2c, 0x66, 0x12, 0x3f, 0x30, 0x85, 0x05, 0xd0, 0x01, 0x0f, 0x2b, - 0xdc, 0xb5, 0x7f, 0x5e, 0xa4, 0x8c, 0xdb, 0xf6, 0x02, 0x54, 0xed, 0x9a, 0x1b, 0xfb, 0x47, 0x74, - 0x14, 0xaa, 0x60, 0x0e, 0x24, 0x59, 0xa6, 0xd8, 0xfa, 0x4c, 0x41, 0x74, 0x40, 0xbb, 0x2a, 0xb8, - 0x93, 0xd0, 0x25, 0x92, 0x4e, 0xb3, 0x89, 0x2f, 0x2b, 0x35, 0xaa, 0x4e, 0x42, 0xa9, 0x98, 0x90, - 0x08, 0xdd, 0xd9, 0x84, 0x44, 0x6c, 0x3e, 0x1f, 0x13, 0x1a, 0xe3, 0x0b, 0xb7, 0x5e, 0x73, 0x1d, - 0xd7, 0xd9, 0x27, 0xbb, 0x8d, 0x65, 0x2b, 0x76, 0xc5, 0x68, 0x6c, 0x35, 0xa6, 0x51, 0xb5, 0xb1, - 0x52, 0x31, 0x21, 0x57, 0xe8, 0x34, 0x54, 0x11, 0x08, 0x36, 0x57, 0x90, 0xe7, 0x3c, 0x32, 0xd5, - 0x16, 0xd5, 0x51, 0xe7, 0xbb, 0x45, 0x93, 0xf6, 0x02, 0xd5, 0x43, 0xd5, 0x0f, 0x30, 0x2e, 0x77, - 0x62, 0xa0, 0xbd, 0x4d, 0x87, 0xb9, 0x0d, 0xf4, 0x60, 0x0e, 0x12, 0x22, 0x92, 0x4c, 0xc0, 0x6a, - 0xc0, 0xa2, 0xd5, 0x06, 0x1c, 0xd1, 0xa4, 0xbd, 0x45, 0x8d, 0x88, 0xac, 0xb2, 0x85, 0x2a, 0xf7, - 0x4a, 0x01, 0xaa, 0x7b, 0x45, 0xf3, 0x2d, 0xf3, 0x70, 0xb9, 0x65, 0x1e, 0x2e, 0x77, 0x9b, 0x73, - 0x6e, 0xcc, 0x3d, 0x74, 0x14, 0x91, 0x55, 0xd1, 0x15, 0x3e, 0xb3, 0xeb, 0x36, 0x9d, 0x6e, 0x22, - 0xbc, 0x5d, 0x92, 0x49, 0xf9, 0x80, 0xfe, 0x8f, 0xc8, 0x2a, 0x3f, 0xab, 0xce, 0xb7, 0xec, 0xe3, - 0xda, 0xae, 0x0a, 0xc6, 0xff, 0x0e, 0x1d, 0x07, 0xe5, 0xc5, 0x83, 0x5b, 0xbe, 0x7d, 0x0d, 0x95, - 0xe7, 0xdd, 0xa5, 0xd6, 0x04, 0xd4, 0x23, 0x72, 0x23, 0xb1, 0xe7, 0xbb, 0x77, 0x53, 0x06, 0x07, - 0x20, 0x04, 0x99, 0x80, 0xd7, 0xdc, 0xd2, 0x7a, 0x2c, 0x81, 0xcb, 0x83, 0xa7, 0x35, 0xfc, 0x09, - 0x1d, 0x8e, 0x12, 0x92, 0x8a, 0x29, 0x93, 0xf8, 0x7c, 0xab, 0x48, 0x0b, 0xc1, 0x74, 0x99, 0xc4, - 0xfb, 0x23, 0x06, 0xe8, 0x64, 0xa0, 0x28, 0xed, 0x83, 0xec, 0xde, 0x86, 0x70, 0x8b, 0xcb, 0xd5, - 0xb6, 0xb1, 0x1e, 0xc6, 0xc5, 0x1e, 0xd5, 0x0c, 0xe7, 0x0b, 0xba, 0x6b, 0x94, 0x91, 0x24, 0x5c, - 0x5e, 0x0b, 0xfc, 0xb8, 0x6a, 0xda, 0x48, 0x3a, 0xf6, 0xc9, 0x3f, 0x2a, 0x74, 0x74, 0xf7, 0xd9, - 0xcf, 0x75, 0xa7, 0xf6, 0x6b, 0xdd, 0xa9, 0xfd, 0x5e, 0x77, 0x6a, 0x3f, 0xfe, 0x74, 0x0e, 0x50, - 0x9b, 0xb2, 0x85, 0x9f, 0xce, 0x92, 0x09, 0x25, 0xa9, 0x9f, 0xfd, 0x09, 0xf8, 0xb1, 0xca, 0x6f, - 0xef, 0x71, 0x23, 0xff, 0x79, 0xf5, 0x37, 0x00, 0x00, 0xff, 0xff, 0x04, 0xb8, 0x87, 0xcd, 0x29, - 0x06, 0x00, 0x00, -} diff --git a/_vendor/src/github.com/pingcap/kvproto/proto/coprocessor.proto b/_vendor/src/github.com/pingcap/kvproto/proto/coprocessor.proto deleted file mode 100644 index 908fb087d17..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/proto/coprocessor.proto +++ /dev/null @@ -1,32 +0,0 @@ -syntax = "proto3"; -package coprocessor; - -import "errorpb.proto"; -import "kvrpcpb.proto"; -import "gogoproto/gogo.proto"; - -option (gogoproto.marshaler_all) = true; -option (gogoproto.sizer_all) = true; -option (gogoproto.unmarshaler_all) = true; - -option java_package = "com.pingcap.tikv.kvproto"; - -// [start, end) -message KeyRange { - bytes start = 1; - bytes end = 2; -} - -message Request { - kvrpcpb.Context context = 1; - int64 tp = 2; - bytes data = 3; - repeated KeyRange ranges = 4; -} - -message Response { - bytes data = 1 [(gogoproto.customtype) = "github.com/pingcap/tipb/sharedbytes.SharedBytes", (gogoproto.nullable) = false]; - errorpb.Error region_error = 2; - kvrpcpb.LockInfo locked = 3; - string other_error = 4; -} diff --git a/_vendor/src/github.com/pingcap/kvproto/proto/eraftpb.proto b/_vendor/src/github.com/pingcap/kvproto/proto/eraftpb.proto deleted file mode 100644 index ba6fcc94b26..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/proto/eraftpb.proto +++ /dev/null @@ -1,86 +0,0 @@ -syntax = "proto2"; -package eraftpb; - -option java_package = "com.pingcap.tikv.kvproto"; - -enum EntryType { - EntryNormal = 0; - EntryConfChange = 1; -} - -message Entry { - optional EntryType entry_type = 1; - optional uint64 term = 2; - optional uint64 index = 3; - optional bytes data = 4; -} - -message SnapshotMetadata { - optional ConfState conf_state = 1; - optional uint64 index = 2; - optional uint64 term = 3; -} - -message Snapshot { - optional bytes data = 1; - optional SnapshotMetadata metadata = 2; -} - -enum MessageType { - MsgHup = 0; - MsgBeat = 1; - MsgPropose = 2; - MsgAppend = 3; - MsgAppendResponse = 4; - MsgRequestVote = 5; - MsgRequestVoteResponse = 6; - MsgSnapshot = 7; - MsgHeartbeat = 8; - MsgHeartbeatResponse = 9; - MsgUnreachable = 10; - MsgSnapStatus = 11; - MsgCheckQuorum = 12; - MsgTransferLeader = 13; - MsgTimeoutNow = 14; - MsgReadIndex = 15; - MsgReadIndexResp = 16; - MsgRequestPreVote = 17; - MsgRequestPreVoteResponse = 18; -} - -message Message { - optional MessageType msg_type = 1; - optional uint64 to = 2; - optional uint64 from = 3; - optional uint64 term = 4; - optional uint64 log_term = 5; - optional uint64 index = 6; - repeated Entry entries = 7; - optional uint64 commit = 8; - optional Snapshot snapshot = 9; - optional bool reject = 10; - optional uint64 reject_hint = 11; - optional bytes context = 12; -} - -message HardState { - optional uint64 term = 1; - optional uint64 vote = 2; - optional uint64 commit = 3; -} - -message ConfState { - repeated uint64 nodes = 1; -} - -enum ConfChangeType { - AddNode = 0; - RemoveNode = 1; -} - -message ConfChange { - optional uint64 id = 1; - optional ConfChangeType change_type = 2; - optional uint64 node_id = 3; - optional bytes context = 4; -} diff --git a/_vendor/src/github.com/pingcap/kvproto/proto/errorpb.proto b/_vendor/src/github.com/pingcap/kvproto/proto/errorpb.proto deleted file mode 100644 index 32309d79e79..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/proto/errorpb.proto +++ /dev/null @@ -1,58 +0,0 @@ -syntax = "proto2"; -package errorpb; - -import "metapb.proto"; -import "gogoproto/gogo.proto"; - -option (gogoproto.marshaler_all) = true; -option (gogoproto.sizer_all) = true; -option (gogoproto.unmarshaler_all) = true; - -option java_package = "com.pingcap.tikv.kvproto"; - -message NotLeader { - optional uint64 region_id = 1; - optional metapb.Peer leader = 2; -} - -message StoreNotMatch { -} - -message RegionNotFound { - optional uint64 region_id = 1; -} - -message KeyNotInRegion { - optional bytes key = 1; - optional uint64 region_id = 2; - optional bytes start_key = 3; - optional bytes end_key = 4; -} - -message StaleEpoch { - repeated metapb.Region new_regions = 1; -} - -message ServerIsBusy { - optional string reason = 1; -} - -message StaleCommand { -} - -message RaftEntryTooLarge { - optional uint64 region_id = 1; - optional uint64 entry_size = 2; -} - -message Error { - optional string message = 1; - optional NotLeader not_leader = 2; - optional RegionNotFound region_not_found = 3; - optional KeyNotInRegion key_not_in_region = 4; - optional StaleEpoch stale_epoch = 5; - optional ServerIsBusy server_is_busy = 6; - optional StaleCommand stale_command = 7; - optional StoreNotMatch store_not_match = 8; - optional RaftEntryTooLarge raft_entry_too_large = 9; -} diff --git a/_vendor/src/github.com/pingcap/kvproto/proto/kvrpcpb.proto b/_vendor/src/github.com/pingcap/kvproto/proto/kvrpcpb.proto deleted file mode 100644 index 1f482802fe9..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/proto/kvrpcpb.proto +++ /dev/null @@ -1,292 +0,0 @@ -syntax = "proto3"; -package kvrpcpb; - -import "metapb.proto"; -import "errorpb.proto"; -import "gogoproto/gogo.proto"; - -option (gogoproto.marshaler_all) = true; -option (gogoproto.sizer_all) = true; -option (gogoproto.unmarshaler_all) = true; - -option java_package = "com.pingcap.tikv.kvproto"; - -message LockInfo { - bytes primary_lock = 1; - uint64 lock_version = 2; - bytes key = 3; - uint64 lock_ttl = 4; -} - -message KeyError { - LockInfo locked = 1; // Client should backoff or cleanup the lock then retry. - string retryable = 2; // Client may restart the txn. e.g write conflict. - string abort = 3; // Client should abort the txn. -} - -enum CommandPri { - Normal = 0; // Normal must the default value - Low = 1; - High = 2; -} - -enum IsolationLevel { - SI = 0; // SI = snapshot isolation - RC = 1; // RC = read committed -} - -message Context { - reserved 4; - reserved "read_quorum"; - uint64 region_id = 1; - metapb.RegionEpoch region_epoch = 2; - metapb.Peer peer = 3; - uint64 term = 5; - CommandPri priority = 6; - IsolationLevel isolation_level = 7; -} - -message GetRequest { - Context context = 1; - bytes key = 2; - uint64 version = 3; -} - -message GetResponse { - errorpb.Error region_error = 1; - KeyError error = 2; - bytes value = 3; -} - -message ScanRequest { - Context context = 1; - bytes start_key = 2; - uint32 limit = 3; - uint64 version = 4; - bool key_only = 5; -} - -message KvPair { - KeyError error = 1; - bytes key = 2; - bytes value = 3; -} - -message ScanResponse { - errorpb.Error region_error = 1; - repeated KvPair pairs = 2; -} - -enum Op { - Put = 0; - Del = 1; - Lock = 2; - Rollback = 3; -} - -message Mutation { - Op op = 1; - bytes key = 2; - bytes value = 3; -} - -message PrewriteRequest { - Context context = 1; - repeated Mutation mutations = 2; - // primary_lock_key - bytes primary_lock = 3; - uint64 start_version = 4; - uint64 lock_ttl = 5; - bool skip_constraint_check = 6; -} - -message PrewriteResponse { - errorpb.Error region_error = 1; - repeated KeyError errors = 2; -} - -message CommitRequest { - reserved 5; - reserved "binlog"; - Context context = 1; - uint64 start_version = 2; - repeated bytes keys = 3; - uint64 commit_version = 4; -} - -message CommitResponse { - errorpb.Error region_error = 1; - KeyError error = 2; -} - -message ImportRequest { - repeated Mutation mutations = 1; - uint64 commit_version = 2; -} - -message ImportResponse { - errorpb.Error region_error = 1; - string error = 2; -} - -message BatchRollbackRequest { - Context context = 1; - uint64 start_version = 2; - repeated bytes keys = 3; -} - -message BatchRollbackResponse { - errorpb.Error region_error = 1; - KeyError error = 2; -} - -message CleanupRequest { - Context context = 1; - bytes key = 2; - uint64 start_version = 3; -} - -message CleanupResponse { - errorpb.Error region_error = 1; - KeyError error = 2; - uint64 commit_version = 3; // set this if the key is already committed -} - -message BatchGetRequest { - Context context = 1; - repeated bytes keys = 2; - uint64 version = 3; -} - -message BatchGetResponse { - errorpb.Error region_error = 1; - repeated KvPair pairs = 2; -} - -message ScanLockRequest { - Context context = 1; - uint64 max_version = 2; -} - -message ScanLockResponse { - errorpb.Error region_error = 1; - KeyError error = 2; - repeated LockInfo locks = 3; -} - -message ResolveLockRequest { - Context context = 1; - uint64 start_version = 2; - // If the txn is rolled back, do not set it. - uint64 commit_version = 3; -} - -message ResolveLockResponse { - errorpb.Error region_error = 1; - KeyError error = 2; -} - -message GCRequest { - Context context = 1; - uint64 safe_point = 2; -} - -message GCResponse { - errorpb.Error region_error = 1; - KeyError error = 2; -} - -message RawGetRequest { - Context context = 1; - bytes key = 2; -} - -message RawGetResponse { - errorpb.Error region_error = 1; - string error = 2; - bytes value = 3; -} - -message RawPutRequest { - Context context = 1; - bytes key = 2; - bytes value = 3; -} - -message RawPutResponse { - errorpb.Error region_error = 1; - string error = 2; -} - -message RawDeleteRequest { - Context context = 1; - bytes key = 2; -} - -message RawDeleteResponse { - errorpb.Error region_error = 1; - string error = 2; -} - -message DeleteRangeRequest { - Context context = 1; - bytes start_key = 2; - bytes end_key = 3; -} - -message DeleteRangeResponse { - errorpb.Error region_error = 1; - string error = 2; -} - -message RawScanRequest { - Context context = 1; - bytes start_key = 2; - uint32 limit = 3; -} - -message RawScanResponse { - errorpb.Error region_error = 1; - repeated KvPair kvs = 2; -} - -message WriteInfo { - uint64 start_ts = 1; - Op type = 2; - uint64 commit_ts = 3; -} - -message ValueInfo { - bytes value = 1; - uint64 ts = 2; - bool is_short_value = 3; -} - -message MvccInfo { - LockInfo lock = 1; - repeated WriteInfo writes = 2; - repeated ValueInfo values = 3; -} - -message MvccGetByKeyRequest { - Context context = 1; - bytes key = 2; -} - -message MvccGetByKeyResponse { - errorpb.Error region_error = 1; - string error = 2; - MvccInfo info = 3; -} - -message MvccGetByStartTsRequest { - Context context = 1; - uint64 start_ts = 2; -} - -message MvccGetByStartTsResponse { - errorpb.Error region_error = 1; - string error = 2; - bytes key = 3; - MvccInfo info = 4; -} diff --git a/_vendor/src/github.com/pingcap/kvproto/proto/metapb.proto b/_vendor/src/github.com/pingcap/kvproto/proto/metapb.proto deleted file mode 100644 index c3871c8626a..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/proto/metapb.proto +++ /dev/null @@ -1,59 +0,0 @@ -syntax = "proto2"; -package metapb; - -import "gogoproto/gogo.proto"; - -option (gogoproto.marshaler_all) = true; -option (gogoproto.sizer_all) = true; -option (gogoproto.unmarshaler_all) = true; - -option java_package = "com.pingcap.tikv.kvproto"; - -message Cluster { - optional uint64 id = 1 [(gogoproto.nullable) = false]; - // max peer count for a region. - // pd will do the auto-balance if region peer count mismatches. - optional uint32 max_peer_count = 2 [(gogoproto.nullable) = false]; - // more attributes...... -} - -enum StoreState { - Up = 0; - Offline = 1; - Tombstone = 2; -} - -// Case insensitive key/value for replica constraints. -message StoreLabel { - optional string key = 1 [(gogoproto.nullable) = false]; - optional string value = 2 [(gogoproto.nullable) = false]; -} - -message Store { - optional uint64 id = 1 [(gogoproto.nullable) = false]; - optional string address = 2 [(gogoproto.nullable) = false]; - optional StoreState state = 3 [(gogoproto.nullable) = false]; - repeated StoreLabel labels = 4; - // more attributes...... -} - -message RegionEpoch { - // Conf change version, auto increment when add or remove peer - optional uint64 conf_ver = 1 [(gogoproto.nullable) = false]; - // Region version, auto increment when split or merge - optional uint64 version = 2 [(gogoproto.nullable) = false]; -} - -message Region { - optional uint64 id = 1 [(gogoproto.nullable) = false]; - // Region key range [start_key, end_key). - optional bytes start_key = 2; - optional bytes end_key = 3; - optional RegionEpoch region_epoch = 4; - repeated Peer peers = 5; -} - -message Peer { - optional uint64 id = 1 [(gogoproto.nullable) = false]; - optional uint64 store_id = 2 [(gogoproto.nullable) = false]; -} diff --git a/_vendor/src/github.com/pingcap/kvproto/proto/pdpb.proto b/_vendor/src/github.com/pingcap/kvproto/proto/pdpb.proto deleted file mode 100644 index a901f484871..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/proto/pdpb.proto +++ /dev/null @@ -1,341 +0,0 @@ -syntax = "proto3"; -package pdpb; - -import "metapb.proto"; - -import "gogoproto/gogo.proto"; - -option (gogoproto.sizer_all) = true; -option (gogoproto.marshaler_all) = true; -option (gogoproto.unmarshaler_all) = true; - -option java_package = "com.pingcap.tikv.kvproto"; - -service PD { - // GetMembers get the member list of this cluster. It does not require - // the cluster_id in request matchs the id of this cluster. - rpc GetMembers(GetMembersRequest) returns (GetMembersResponse) {} - - rpc Tso(stream TsoRequest) returns (stream TsoResponse) {} - - rpc Bootstrap(BootstrapRequest) returns (BootstrapResponse) {} - - rpc IsBootstrapped(IsBootstrappedRequest) returns (IsBootstrappedResponse) {} - - rpc AllocID(AllocIDRequest) returns (AllocIDResponse) {} - - rpc GetStore(GetStoreRequest) returns (GetStoreResponse) {} - - rpc PutStore(PutStoreRequest) returns (PutStoreResponse) {} - - rpc StoreHeartbeat(StoreHeartbeatRequest) returns (StoreHeartbeatResponse) {} - - rpc RegionHeartbeat(stream RegionHeartbeatRequest) returns (stream RegionHeartbeatResponse) {} - - rpc GetRegion(GetRegionRequest) returns (GetRegionResponse) {} - - rpc GetRegionByID(GetRegionByIDRequest) returns (GetRegionResponse) {} - - rpc AskSplit(AskSplitRequest) returns (AskSplitResponse) {} - - rpc ReportSplit(ReportSplitRequest) returns (ReportSplitResponse) {} - - rpc GetClusterConfig(GetClusterConfigRequest) returns (GetClusterConfigResponse) {} - - rpc PutClusterConfig(PutClusterConfigRequest) returns (PutClusterConfigResponse) {} -} - -message RequestHeader { - // cluster_id is the ID of the cluster which be sent to. - uint64 cluster_id = 1; -} - -message ResponseHeader { - // cluster_id is the ID of the cluster which sent the response. - uint64 cluster_id = 1; - Error error = 2; -} - -enum ErrorType { - OK = 0; - UNKNOWN = 1; - NOT_BOOTSTRAPPED = 2; - STORE_TOMBSTONE = 3; - ALREADY_BOOTSTRAPPED = 4; -} - -message Error { - ErrorType type = 1; - string message = 2; -} - -message TsoRequest { - RequestHeader header = 1; - - uint32 count = 2; -} - -message Timestamp { - int64 physical = 1; - int64 logical = 2; -} - -message TsoResponse { - ResponseHeader header = 1; - - uint32 count = 2; - Timestamp timestamp = 3; -} - -message BootstrapRequest { - RequestHeader header = 1; - - metapb.Store store = 2; - metapb.Region region = 3; -} - -message BootstrapResponse { - ResponseHeader header = 1; -} - -message IsBootstrappedRequest { - RequestHeader header = 1; -} - -message IsBootstrappedResponse { - ResponseHeader header = 1; - - bool bootstrapped = 2; -} - -message AllocIDRequest { - RequestHeader header = 1; -} - -message AllocIDResponse { - ResponseHeader header = 1; - - uint64 id = 2; -} - -message GetStoreRequest { - RequestHeader header = 1; - - uint64 store_id = 2; -} - -message GetStoreResponse { - ResponseHeader header = 1; - - metapb.Store store = 2; -} - -message PutStoreRequest { - RequestHeader header = 1; - - metapb.Store store = 2; -} - -message PutStoreResponse { - ResponseHeader header = 1; -} - -message GetRegionRequest { - RequestHeader header = 1; - - bytes region_key = 2; -} - -message GetRegionResponse { - ResponseHeader header = 1; - - metapb.Region region = 2; - metapb.Peer leader = 3; -} - -message GetRegionByIDRequest { - RequestHeader header = 1; - - uint64 region_id = 2; -} - -// Use GetRegionResponse as the response of GetRegionByIDRequest. - -message GetClusterConfigRequest { - RequestHeader header = 1; -} - -message GetClusterConfigResponse { - ResponseHeader header = 1; - - metapb.Cluster cluster = 2; -} - -message PutClusterConfigRequest { - RequestHeader header = 1; - - metapb.Cluster cluster = 2; -} - -message PutClusterConfigResponse { - ResponseHeader header = 1; -} - -message Member { - // name is the name of the PD member. - string name = 1; - // member_id is the unique id of the PD member. - uint64 member_id = 2; - repeated string peer_urls = 3; - repeated string client_urls = 4; -} - -message GetMembersRequest { - RequestHeader header = 1; -} - -message GetMembersResponse { - ResponseHeader header = 1; - - repeated Member members = 2; - Member leader = 3; -} - -message PeerStats { - metapb.Peer peer = 1; - uint64 down_seconds = 2; -} - -message RegionHeartbeatRequest { - RequestHeader header = 1; - - metapb.Region region = 2; - // Leader Peer sending the heartbeat. - metapb.Peer leader = 3; - // Leader considers that these peers are down. - repeated PeerStats down_peers = 4; - // Pending peers are the peers that the leader can't consider as - // working followers. - repeated metapb.Peer pending_peers = 5; - // Bytes read/written during this period. - uint64 bytes_written = 6; - uint64 bytes_read = 7; - // Keys read/written during this period. - uint64 keys_written = 8; - uint64 keys_read = 9; - // Approximate region size. - uint64 approximate_size = 10; -} - -// A clone of eraftpb.ConfChangeType, it exists because proto2 enums cannot be -// used directly in proto3 syntax. -// See more: https://developers.google.com/protocol-buffers/docs/proto3#using-proto2-message-types -enum ConfChangeType { - AddNode = 0; - RemoveNode = 1; -} - -message ChangePeer { - metapb.Peer peer = 1; - // FIXME: replace with actual ConfChangeType once eraftpb uses proto3. - ConfChangeType change_type = 2; -} - -message TransferLeader { - metapb.Peer peer = 1; -} - -message RegionHeartbeatResponse { - ResponseHeader header = 1; - - // Notice, Pd only allows handling reported epoch >= current pd's. - // Leader peer reports region status with RegionHeartbeatRequest - // to pd regularly, pd will determine whether this region - // should do ChangePeer or not. - // E,g, max peer number is 3, region A, first only peer 1 in A. - // 1. Pd region state -> Peers (1), ConfVer (1). - // 2. Leader peer 1 reports region state to pd, pd finds the - // peer number is < 3, so first changes its current region - // state -> Peers (1, 2), ConfVer (1), and returns ChangePeer Adding 2. - // 3. Leader does ChangePeer, then reports Peers (1, 2), ConfVer (2), - // pd updates its state -> Peers (1, 2), ConfVer (2). - // 4. Leader may report old Peers (1), ConfVer (1) to pd before ConfChange - // finished, pd stills responses ChangePeer Adding 2, of course, we must - // guarantee the second ChangePeer can't be applied in TiKV. - ChangePeer change_peer = 2; - // Pd can return transfer_leader to let TiKV does leader transfer itself. - TransferLeader transfer_leader = 3; - // ID of the region - uint64 region_id = 4; - metapb.RegionEpoch region_epoch = 5; - // Leader of the region at the moment of the corresponding request was made. - metapb.Peer target_peer = 6; -} - -message AskSplitRequest { - RequestHeader header = 1; - - metapb.Region region = 2; -} - -message AskSplitResponse { - ResponseHeader header = 1; - - // We split the region into two, first uses the origin - // parent region id, and the second uses the new_region_id. - // We must guarantee that the new_region_id is global unique. - uint64 new_region_id = 2; - // The peer ids for the new split region. - repeated uint64 new_peer_ids = 3; -} - -message ReportSplitRequest { - RequestHeader header = 1; - - metapb.Region left = 2; - metapb.Region right = 3; -} - -message ReportSplitResponse { - ResponseHeader header = 1; -} - -message StoreStats { - uint64 store_id = 1; - // Capacity for the store. - uint64 capacity = 2; - // Available size for the store. - uint64 available = 3; - // Total region count in this store. - uint32 region_count = 4; - // Current sending snapshot count. - uint32 sending_snap_count = 5; - // Current receiving snapshot count. - uint32 receiving_snap_count = 6; - // When the store is started (unix timestamp in seconds). - uint32 start_time = 7; - // How many region is applying snapshot. - uint32 applying_snap_count = 8; - // If the store is busy - bool is_busy = 9; - // Actually used space by db - uint64 used_size = 10; - // Bytes written for the store. - uint64 bytes_written = 11; - // Keys written for the store. - uint64 keys_written = 12; - // Bytes read for the store. - uint64 bytes_read = 13; - // Keys read for the store. - uint64 keys_read = 14; -} - -message StoreHeartbeatRequest { - RequestHeader header = 1; - - StoreStats stats = 2; -} - -message StoreHeartbeatResponse { - ResponseHeader header = 1; -} diff --git a/_vendor/src/github.com/pingcap/kvproto/proto/raft_cmdpb.proto b/_vendor/src/github.com/pingcap/kvproto/proto/raft_cmdpb.proto deleted file mode 100644 index addd9fe29c7..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/proto/raft_cmdpb.proto +++ /dev/null @@ -1,256 +0,0 @@ -syntax = "proto2"; -package raft_cmdpb; - -import "metapb.proto"; -import "errorpb.proto"; -import "eraftpb.proto"; - -option java_package = "com.pingcap.tikv.kvproto"; - -message GetRequest { - optional string cf = 1; - optional bytes key = 2; -} - -message GetResponse { - optional bytes value = 1; -} - -message PutRequest { - optional string cf = 1; - optional bytes key = 2; - optional bytes value = 3; -} - -message PutResponse { - -} - -message DeleteRequest { - optional string cf = 1; - optional bytes key = 2; -} - -message DeleteResponse { - -} - -message DeleteRangeRequest { - optional string cf = 1; - optional bytes start_key = 2; - optional bytes end_key = 3; -} - -message DeleteRangeResponse { - -} - -message SnapRequest { - -} - -message SnapResponse { - optional metapb.Region region = 1; -} - -message PrewriteRequest { - optional bytes key = 1; - optional bytes value = 2; - optional bytes lock = 3; -} - -message PrewriteResponse { - -} - -enum CmdType { - Invalid = 0; - Get = 1; - Put = 3; - Delete = 4; - Snap = 5; - Prewrite = 6; - DeleteRange = 7; -} - -message Request { - optional CmdType cmd_type = 1; - optional GetRequest get = 2; - optional PutRequest put = 4; - optional DeleteRequest delete = 5; - optional SnapRequest snap = 6; - optional PrewriteRequest prewrite = 7; - optional DeleteRangeRequest delete_range = 8; -} - -message Response { - optional CmdType cmd_type = 1; - optional GetResponse get = 2; - optional PutResponse put = 4; - optional DeleteResponse delete = 5; - optional SnapResponse snap = 6; - optional PrewriteResponse prewrite = 7; - optional DeleteRangeResponse delte_range = 8; -} - -message ChangePeerRequest { - // This can be only called in internal RaftStore now. - optional eraftpb.ConfChangeType change_type = 1; - optional metapb.Peer peer = 2; -} - -message ChangePeerResponse { - optional metapb.Region region = 1; -} - -message SplitRequest { - // This can be only called in internal RaftStore now. - // The split_key must be in the been splitting region. - optional bytes split_key = 1; - // We split the region into two, first uses the origin - // parent region id, and the second uses the new_region_id. - // We must guarantee that the new_region_id is global unique. - optional uint64 new_region_id = 2; - // The peer ids for the new split region. - repeated uint64 new_peer_ids = 3; - // If true, right region derive the origin region_id, - // left region use new_region_id. - optional bool right_derive = 4; -} - -message SplitResponse { - optional metapb.Region left = 1; - optional metapb.Region right = 2; -} - -message CompactLogRequest { - optional uint64 compact_index = 1; - optional uint64 compact_term = 2; -} - -message CompactLogResponse { - -} - -message TransferLeaderRequest { - optional metapb.Peer peer = 1; -} - -message TransferLeaderResponse { -} - -message VerifyHashRequest { - optional uint64 index = 1; - optional bytes hash = 2; -} - -message VerifyHashResponse { -} - -enum AdminCmdType { - InvalidAdmin = 0; - ChangePeer = 1; - Split = 2; - CompactLog = 3; - TransferLeader = 4; - ComputeHash = 5; - VerifyHash = 6; -} - -message AdminRequest { - optional AdminCmdType cmd_type = 1; - optional ChangePeerRequest change_peer = 2; - optional SplitRequest split = 3; - optional CompactLogRequest compact_log = 4; - optional TransferLeaderRequest transfer_leader = 5; - optional VerifyHashRequest verify_hash = 6; -} - -message AdminResponse { - optional AdminCmdType cmd_type = 1; - optional ChangePeerResponse change_peer = 2; - optional SplitResponse split = 3; - optional CompactLogResponse compact_log = 4; - optional TransferLeaderResponse transfer_leader = 5; - optional VerifyHashResponse verify_hash = 6; -} - -// For get the leader of the region. -message RegionLeaderRequest { - -} - -message RegionLeaderResponse { - optional metapb.Peer leader = 1; -} - -// For getting more information of the region. -// We add some admin operations (ChangePeer, Split...) into the pb job list, -// then pd server will peek the first one, handle it and then pop it from the job lib. -// But sometimes, the pd server may crash before popping. When another pd server -// starts and finds the job is running but not finished, it will first check whether -// the raft server already has handled this job. -// E,g, for ChangePeer, if we add Peer10 into region1 and find region1 has already had -// Peer10, we can think this ChangePeer is finished, and can pop this job from job list -// directly. -message RegionDetailRequest { - -} - -message RegionDetailResponse { - optional metapb.Region region = 1; - optional metapb.Peer leader = 2; -} - - -enum StatusCmdType { - InvalidStatus = 0; - RegionLeader = 1; - RegionDetail = 2; -} - -message StatusRequest { - optional StatusCmdType cmd_type = 1; - optional RegionLeaderRequest region_leader = 2; - optional RegionDetailRequest region_detail = 3; -} - -message StatusResponse { - optional StatusCmdType cmd_type = 1; - optional RegionLeaderResponse region_leader = 2; - optional RegionDetailResponse region_detail = 3; -} - -message RaftRequestHeader { - optional uint64 region_id = 1; - optional metapb.Peer peer = 2; - // true for read linearization - optional bool read_quorum = 3; - // 16 bytes, to distinguish request. - optional bytes uuid = 4; - - optional metapb.RegionEpoch region_epoch = 5; - optional uint64 term = 6; -} - -message RaftResponseHeader { - optional errorpb.Error error = 1; - optional bytes uuid = 2; - optional uint64 current_term = 3; -} - -message RaftCmdRequest { - optional RaftRequestHeader header = 1; - // We can't enclose normal requests and administrator request - // at same time. - repeated Request requests = 2; - optional AdminRequest admin_request = 3; - optional StatusRequest status_request = 4; -} - -message RaftCmdResponse { - optional RaftResponseHeader header = 1; - repeated Response responses = 2; - optional AdminResponse admin_response = 3; - optional StatusResponse status_response = 4; -} diff --git a/_vendor/src/github.com/pingcap/kvproto/proto/raft_serverpb.proto b/_vendor/src/github.com/pingcap/kvproto/proto/raft_serverpb.proto deleted file mode 100644 index 7f2e4f13a41..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/proto/raft_serverpb.proto +++ /dev/null @@ -1,81 +0,0 @@ -syntax = "proto3"; -package raft_serverpb; - -import "eraftpb.proto"; -import "metapb.proto"; - -option java_package = "com.pingcap.tikv.kvproto"; - -message RaftMessage { - uint64 region_id = 1; - metapb.Peer from_peer = 2; - metapb.Peer to_peer = 3; - eraftpb.Message message = 4; - metapb.RegionEpoch region_epoch = 5; - // true means to_peer is a tombstone peer and it should remove itself. - bool is_tombstone = 6; - // Region key range [start_key, end_key). - bytes start_key = 7; - bytes end_key = 8; -} - -message RaftTruncatedState { - uint64 index = 1; - uint64 term = 2; -} - -message SnapshotCFFile { - string cf = 1; - uint64 size = 2; - uint32 checksum = 3; -} - -message SnapshotMeta { - repeated SnapshotCFFile cf_files = 1; -} - -message SnapshotChunk { - RaftMessage message = 1; - bytes data = 2; -} - -message Done {} - -message KeyValue { - bytes key = 1; - bytes value = 2; -} - -message RaftSnapshotData { - metapb.Region region = 1; - uint64 file_size = 2; - repeated KeyValue data = 3; - uint64 version = 4; - SnapshotMeta meta = 5; -} - -message StoreIdent { - uint64 cluster_id = 1; - uint64 store_id = 2; -} - -message RaftLocalState { - eraftpb.HardState hard_state = 1; - uint64 last_index = 2; -} - -message RaftApplyState { - uint64 applied_index = 1; - RaftTruncatedState truncated_state = 2; -} - -enum PeerState { - Normal = 0; - Applying = 1; - Tombstone = 2; -} - -message RegionLocalState { - PeerState state = 1; - metapb.Region region = 2; -} diff --git a/_vendor/src/github.com/pingcap/kvproto/proto/tikvpb.proto b/_vendor/src/github.com/pingcap/kvproto/proto/tikvpb.proto deleted file mode 100644 index f725d8f9f6b..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/proto/tikvpb.proto +++ /dev/null @@ -1,48 +0,0 @@ -syntax = "proto3"; -package tikvpb; - -import "coprocessor.proto"; -import "kvrpcpb.proto"; -import "raft_serverpb.proto"; - -import "gogoproto/gogo.proto"; - -option (gogoproto.sizer_all) = true; -option (gogoproto.marshaler_all) = true; -option (gogoproto.unmarshaler_all) = true; - -option java_package = "com.pingcap.tikv.kvproto"; - -// Serve as a distributed kv database. -service Tikv { - // KV commands with mvcc/txn supported. - rpc KvGet(kvrpcpb.GetRequest) returns (kvrpcpb.GetResponse) {} - rpc KvScan(kvrpcpb.ScanRequest) returns (kvrpcpb.ScanResponse) {} - rpc KvPrewrite(kvrpcpb.PrewriteRequest) returns (kvrpcpb.PrewriteResponse) {} - rpc KvCommit(kvrpcpb.CommitRequest) returns (kvrpcpb.CommitResponse) {} - rpc KvImport(kvrpcpb.ImportRequest) returns (kvrpcpb.ImportResponse) {} - rpc KvCleanup(kvrpcpb.CleanupRequest) returns (kvrpcpb.CleanupResponse) {} - rpc KvBatchGet(kvrpcpb.BatchGetRequest) returns (kvrpcpb.BatchGetResponse) {} - rpc KvBatchRollback(kvrpcpb.BatchRollbackRequest) returns (kvrpcpb.BatchRollbackResponse) {} - rpc KvScanLock(kvrpcpb.ScanLockRequest) returns (kvrpcpb.ScanLockResponse) {} - rpc KvResolveLock(kvrpcpb.ResolveLockRequest) returns (kvrpcpb.ResolveLockResponse) {} - rpc KvGC(kvrpcpb.GCRequest) returns (kvrpcpb.GCResponse) {} - rpc KvDeleteRange(kvrpcpb.DeleteRangeRequest) returns (kvrpcpb.DeleteRangeResponse) {} - - // RawKV commands. - rpc RawGet(kvrpcpb.RawGetRequest) returns (kvrpcpb.RawGetResponse) {} - rpc RawPut(kvrpcpb.RawPutRequest) returns (kvrpcpb.RawPutResponse) {} - rpc RawDelete(kvrpcpb.RawDeleteRequest) returns (kvrpcpb.RawDeleteResponse) {} - rpc RawScan(kvrpcpb.RawScanRequest) returns (kvrpcpb.RawScanResponse) {} - - // SQL push down commands. - rpc Coprocessor(coprocessor.Request) returns (coprocessor.Response) {} - - // Raft commands (tikv <-> tikv). - rpc Raft(stream raft_serverpb.RaftMessage) returns (raft_serverpb.Done) {} - rpc Snapshot(stream raft_serverpb.SnapshotChunk) returns (raft_serverpb.Done) {} - - // transaction debugger commands. - rpc MvccGetByKey(kvrpcpb.MvccGetByKeyRequest) returns (kvrpcpb.MvccGetByKeyResponse) {} - rpc MvccGetByStartTs(kvrpcpb.MvccGetByStartTsRequest) returns (kvrpcpb.MvccGetByStartTsResponse) {} -} diff --git a/_vendor/src/github.com/pingcap/kvproto/src/coprocessor.rs b/_vendor/src/github.com/pingcap/kvproto/src/coprocessor.rs deleted file mode 100644 index e2e67f62031..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/src/coprocessor.rs +++ /dev/null @@ -1,1045 +0,0 @@ -// This file is generated. Do not edit -// @generated - -// https://github.com/Manishearth/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] - -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; - -#[derive(PartialEq,Clone,Default)] -pub struct KeyRange { - // message fields - pub start: ::std::vec::Vec, - pub end: ::std::vec::Vec, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for KeyRange {} - -impl KeyRange { - pub fn new() -> KeyRange { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static KeyRange { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const KeyRange, - }; - unsafe { - instance.get(KeyRange::new) - } - } - - // bytes start = 1; - - pub fn clear_start(&mut self) { - self.start.clear(); - } - - // Param is passed by value, moved - pub fn set_start(&mut self, v: ::std::vec::Vec) { - self.start = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_start(&mut self) -> &mut ::std::vec::Vec { - &mut self.start - } - - // Take field - pub fn take_start(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.start, ::std::vec::Vec::new()) - } - - pub fn get_start(&self) -> &[u8] { - &self.start - } - - fn get_start_for_reflect(&self) -> &::std::vec::Vec { - &self.start - } - - fn mut_start_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.start - } - - // bytes end = 2; - - pub fn clear_end(&mut self) { - self.end.clear(); - } - - // Param is passed by value, moved - pub fn set_end(&mut self, v: ::std::vec::Vec) { - self.end = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_end(&mut self) -> &mut ::std::vec::Vec { - &mut self.end - } - - // Take field - pub fn take_end(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.end, ::std::vec::Vec::new()) - } - - pub fn get_end(&self) -> &[u8] { - &self.end - } - - fn get_end_for_reflect(&self) -> &::std::vec::Vec { - &self.end - } - - fn mut_end_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.end - } -} - -impl ::protobuf::Message for KeyRange { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.start)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.end)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.start.is_empty() { - my_size += ::protobuf::rt::bytes_size(1, &self.start); - } - if !self.end.is_empty() { - my_size += ::protobuf::rt::bytes_size(2, &self.end); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.start.is_empty() { - os.write_bytes(1, &self.start)?; - } - if !self.end.is_empty() { - os.write_bytes(2, &self.end)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for KeyRange { - fn new() -> KeyRange { - KeyRange::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "start", - KeyRange::get_start_for_reflect, - KeyRange::mut_start_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "end", - KeyRange::get_end_for_reflect, - KeyRange::mut_end_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "KeyRange", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for KeyRange { - fn clear(&mut self) { - self.clear_start(); - self.clear_end(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for KeyRange { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for KeyRange { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Request { - // message fields - pub context: ::protobuf::SingularPtrField, - pub tp: i64, - pub data: ::std::vec::Vec, - pub ranges: ::protobuf::RepeatedField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Request {} - -impl Request { - pub fn new() -> Request { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Request { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Request, - }; - unsafe { - instance.get(Request::new) - } - } - - // .kvrpcpb.Context context = 1; - - pub fn clear_context(&mut self) { - self.context.clear(); - } - - pub fn has_context(&self) -> bool { - self.context.is_some() - } - - // Param is passed by value, moved - pub fn set_context(&mut self, v: super::kvrpcpb::Context) { - self.context = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_context(&mut self) -> &mut super::kvrpcpb::Context { - if self.context.is_none() { - self.context.set_default(); - } - self.context.as_mut().unwrap() - } - - // Take field - pub fn take_context(&mut self) -> super::kvrpcpb::Context { - self.context.take().unwrap_or_else(|| super::kvrpcpb::Context::new()) - } - - pub fn get_context(&self) -> &super::kvrpcpb::Context { - self.context.as_ref().unwrap_or_else(|| super::kvrpcpb::Context::default_instance()) - } - - fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.context - } - - fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.context - } - - // int64 tp = 2; - - pub fn clear_tp(&mut self) { - self.tp = 0; - } - - // Param is passed by value, moved - pub fn set_tp(&mut self, v: i64) { - self.tp = v; - } - - pub fn get_tp(&self) -> i64 { - self.tp - } - - fn get_tp_for_reflect(&self) -> &i64 { - &self.tp - } - - fn mut_tp_for_reflect(&mut self) -> &mut i64 { - &mut self.tp - } - - // bytes data = 3; - - pub fn clear_data(&mut self) { - self.data.clear(); - } - - // Param is passed by value, moved - pub fn set_data(&mut self, v: ::std::vec::Vec) { - self.data = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { - &mut self.data - } - - // Take field - pub fn take_data(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.data, ::std::vec::Vec::new()) - } - - pub fn get_data(&self) -> &[u8] { - &self.data - } - - fn get_data_for_reflect(&self) -> &::std::vec::Vec { - &self.data - } - - fn mut_data_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.data - } - - // repeated .coprocessor.KeyRange ranges = 4; - - pub fn clear_ranges(&mut self) { - self.ranges.clear(); - } - - // Param is passed by value, moved - pub fn set_ranges(&mut self, v: ::protobuf::RepeatedField) { - self.ranges = v; - } - - // Mutable pointer to the field. - pub fn mut_ranges(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.ranges - } - - // Take field - pub fn take_ranges(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.ranges, ::protobuf::RepeatedField::new()) - } - - pub fn get_ranges(&self) -> &[KeyRange] { - &self.ranges - } - - fn get_ranges_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.ranges - } - - fn mut_ranges_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.ranges - } -} - -impl ::protobuf::Message for Request { - fn is_initialized(&self) -> bool { - for v in &self.context { - if !v.is_initialized() { - return false; - } - }; - for v in &self.ranges { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_int64()?; - self.tp = tmp; - }, - 3 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.data)?; - }, - 4 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.ranges)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.context.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.tp != 0 { - my_size += ::protobuf::rt::value_size(2, self.tp, ::protobuf::wire_format::WireTypeVarint); - } - if !self.data.is_empty() { - my_size += ::protobuf::rt::bytes_size(3, &self.data); - } - for value in &self.ranges { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.context.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.tp != 0 { - os.write_int64(2, self.tp)?; - } - if !self.data.is_empty() { - os.write_bytes(3, &self.data)?; - } - for v in &self.ranges { - os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Request { - fn new() -> Request { - Request::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "context", - Request::get_context_for_reflect, - Request::mut_context_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( - "tp", - Request::get_tp_for_reflect, - Request::mut_tp_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "data", - Request::get_data_for_reflect, - Request::mut_data_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "ranges", - Request::get_ranges_for_reflect, - Request::mut_ranges_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Request", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Request { - fn clear(&mut self) { - self.clear_context(); - self.clear_tp(); - self.clear_data(); - self.clear_ranges(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Request { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Request { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Response { - // message fields - pub data: ::std::vec::Vec, - pub region_error: ::protobuf::SingularPtrField, - pub locked: ::protobuf::SingularPtrField, - pub other_error: ::std::string::String, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Response {} - -impl Response { - pub fn new() -> Response { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Response { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Response, - }; - unsafe { - instance.get(Response::new) - } - } - - // bytes data = 1; - - pub fn clear_data(&mut self) { - self.data.clear(); - } - - // Param is passed by value, moved - pub fn set_data(&mut self, v: ::std::vec::Vec) { - self.data = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { - &mut self.data - } - - // Take field - pub fn take_data(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.data, ::std::vec::Vec::new()) - } - - pub fn get_data(&self) -> &[u8] { - &self.data - } - - fn get_data_for_reflect(&self) -> &::std::vec::Vec { - &self.data - } - - fn mut_data_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.data - } - - // .errorpb.Error region_error = 2; - - pub fn clear_region_error(&mut self) { - self.region_error.clear(); - } - - pub fn has_region_error(&self) -> bool { - self.region_error.is_some() - } - - // Param is passed by value, moved - pub fn set_region_error(&mut self, v: super::errorpb::Error) { - self.region_error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { - if self.region_error.is_none() { - self.region_error.set_default(); - } - self.region_error.as_mut().unwrap() - } - - // Take field - pub fn take_region_error(&mut self) -> super::errorpb::Error { - self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) - } - - pub fn get_region_error(&self) -> &super::errorpb::Error { - self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) - } - - fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_error - } - - fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_error - } - - // .kvrpcpb.LockInfo locked = 3; - - pub fn clear_locked(&mut self) { - self.locked.clear(); - } - - pub fn has_locked(&self) -> bool { - self.locked.is_some() - } - - // Param is passed by value, moved - pub fn set_locked(&mut self, v: super::kvrpcpb::LockInfo) { - self.locked = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_locked(&mut self) -> &mut super::kvrpcpb::LockInfo { - if self.locked.is_none() { - self.locked.set_default(); - } - self.locked.as_mut().unwrap() - } - - // Take field - pub fn take_locked(&mut self) -> super::kvrpcpb::LockInfo { - self.locked.take().unwrap_or_else(|| super::kvrpcpb::LockInfo::new()) - } - - pub fn get_locked(&self) -> &super::kvrpcpb::LockInfo { - self.locked.as_ref().unwrap_or_else(|| super::kvrpcpb::LockInfo::default_instance()) - } - - fn get_locked_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.locked - } - - fn mut_locked_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.locked - } - - // string other_error = 4; - - pub fn clear_other_error(&mut self) { - self.other_error.clear(); - } - - // Param is passed by value, moved - pub fn set_other_error(&mut self, v: ::std::string::String) { - self.other_error = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_other_error(&mut self) -> &mut ::std::string::String { - &mut self.other_error - } - - // Take field - pub fn take_other_error(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.other_error, ::std::string::String::new()) - } - - pub fn get_other_error(&self) -> &str { - &self.other_error - } - - fn get_other_error_for_reflect(&self) -> &::std::string::String { - &self.other_error - } - - fn mut_other_error_for_reflect(&mut self) -> &mut ::std::string::String { - &mut self.other_error - } -} - -impl ::protobuf::Message for Response { - fn is_initialized(&self) -> bool { - for v in &self.region_error { - if !v.is_initialized() { - return false; - } - }; - for v in &self.locked { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.data)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; - }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.locked)?; - }, - 4 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.other_error)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.data.is_empty() { - my_size += ::protobuf::rt::bytes_size(1, &self.data); - } - if let Some(ref v) = self.region_error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.locked.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.other_error.is_empty() { - my_size += ::protobuf::rt::string_size(4, &self.other_error); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.data.is_empty() { - os.write_bytes(1, &self.data)?; - } - if let Some(ref v) = self.region_error.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.locked.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.other_error.is_empty() { - os.write_string(4, &self.other_error)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Response { - fn new() -> Response { - Response::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "data", - Response::get_data_for_reflect, - Response::mut_data_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_error", - Response::get_region_error_for_reflect, - Response::mut_region_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "locked", - Response::get_locked_for_reflect, - Response::mut_locked_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "other_error", - Response::get_other_error_for_reflect, - Response::mut_other_error_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Response", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Response { - fn clear(&mut self) { - self.clear_data(); - self.clear_region_error(); - self.clear_locked(); - self.clear_other_error(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Response { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Response { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x11coprocessor.proto\x12\x0bcoprocessor\x1a\rerrorpb.proto\x1a\rkvrpc\ - pb.proto\x1a\x14gogoproto/gogo.proto\"2\n\x08KeyRange\x12\x14\n\x05start\ - \x18\x01\x20\x01(\x0cR\x05start\x12\x10\n\x03end\x18\x02\x20\x01(\x0cR\ - \x03end\"\x88\x01\n\x07Request\x12*\n\x07context\x18\x01\x20\x01(\x0b2\ - \x10.kvrpcpb.ContextR\x07context\x12\x0e\n\x02tp\x18\x02\x20\x01(\x03R\ - \x02tp\x12\x12\n\x04data\x18\x03\x20\x01(\x0cR\x04data\x12-\n\x06ranges\ - \x18\x04\x20\x03(\x0b2\x15.coprocessor.KeyRangeR\x06ranges\"\xd6\x01\n\ - \x08Response\x12K\n\x04data\x18\x01\x20\x01(\x0cR\x04dataB7\xda\xde\x1f/\ - github.com/pingcap/tipb/sharedbytes.SharedBytes\xc8\xde\x1f\0\x121\n\x0c\ - region_error\x18\x02\x20\x01(\x0b2\x0e.errorpb.ErrorR\x0bregionError\x12\ - )\n\x06locked\x18\x03\x20\x01(\x0b2\x11.kvrpcpb.LockInfoR\x06locked\x12\ - \x1f\n\x0bother_error\x18\x04\x20\x01(\tR\notherErrorB&\n\x18com.pingcap\ - .tikv.kvproto\xe0\xe2\x1e\x01\xd0\xe2\x1e\x01\xc8\xe2\x1e\x01J\xde\n\n\ - \x06\x12\x04\0\0\x1f\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\ - \x12\x03\x01\x08\x13\n\t\n\x02\x03\0\x12\x03\x03\x07\x16\n\t\n\x02\x03\ - \x01\x12\x03\x04\x07\x16\n\t\n\x02\x03\x02\x12\x03\x05\x07\x1d\n\x08\n\ - \x01\x08\x12\x03\x07\0(\n\x0b\n\x04\x08\xe7\x07\0\x12\x03\x07\0(\n\x0c\n\ - \x05\x08\xe7\x07\0\x02\x12\x03\x07\x07\x20\n\r\n\x06\x08\xe7\x07\0\x02\0\ - \x12\x03\x07\x07\x20\n\x0e\n\x07\x08\xe7\x07\0\x02\0\x01\x12\x03\x07\x08\ - \x1f\n\x0c\n\x05\x08\xe7\x07\0\x03\x12\x03\x07#'\n\x08\n\x01\x08\x12\x03\ - \x08\0$\n\x0b\n\x04\x08\xe7\x07\x01\x12\x03\x08\0$\n\x0c\n\x05\x08\xe7\ - \x07\x01\x02\x12\x03\x08\x07\x1c\n\r\n\x06\x08\xe7\x07\x01\x02\0\x12\x03\ - \x08\x07\x1c\n\x0e\n\x07\x08\xe7\x07\x01\x02\0\x01\x12\x03\x08\x08\x1b\n\ - \x0c\n\x05\x08\xe7\x07\x01\x03\x12\x03\x08\x1f#\n\x08\n\x01\x08\x12\x03\ - \t\0*\n\x0b\n\x04\x08\xe7\x07\x02\x12\x03\t\0*\n\x0c\n\x05\x08\xe7\x07\ - \x02\x02\x12\x03\t\x07\"\n\r\n\x06\x08\xe7\x07\x02\x02\0\x12\x03\t\x07\"\ - \n\x0e\n\x07\x08\xe7\x07\x02\x02\0\x01\x12\x03\t\x08!\n\x0c\n\x05\x08\ - \xe7\x07\x02\x03\x12\x03\t%)\n\x08\n\x01\x08\x12\x03\x0b\01\n\x0b\n\x04\ - \x08\xe7\x07\x03\x12\x03\x0b\01\n\x0c\n\x05\x08\xe7\x07\x03\x02\x12\x03\ - \x0b\x07\x13\n\r\n\x06\x08\xe7\x07\x03\x02\0\x12\x03\x0b\x07\x13\n\x0e\n\ - \x07\x08\xe7\x07\x03\x02\0\x01\x12\x03\x0b\x07\x13\n\x0c\n\x05\x08\xe7\ - \x07\x03\x07\x12\x03\x0b\x160\n\x1a\n\x02\x04\0\x12\x04\x0e\0\x11\x01\ - \x1a\x0e\x20[start,\x20end)\n\n\n\n\x03\x04\0\x01\x12\x03\x0e\x08\x10\n\ - \x0b\n\x04\x04\0\x02\0\x12\x03\x0f\x04\x14\n\r\n\x05\x04\0\x02\0\x04\x12\ - \x04\x0f\x04\x0e\x12\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x0f\x04\t\n\x0c\ - \n\x05\x04\0\x02\0\x01\x12\x03\x0f\n\x0f\n\x0c\n\x05\x04\0\x02\0\x03\x12\ - \x03\x0f\x12\x13\n\x0b\n\x04\x04\0\x02\x01\x12\x03\x10\x04\x12\n\r\n\x05\ - \x04\0\x02\x01\x04\x12\x04\x10\x04\x0f\x14\n\x0c\n\x05\x04\0\x02\x01\x05\ - \x12\x03\x10\x04\t\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x10\n\r\n\x0c\n\ - \x05\x04\0\x02\x01\x03\x12\x03\x10\x10\x11\n\n\n\x02\x04\x01\x12\x04\x13\ - \0\x18\x01\n\n\n\x03\x04\x01\x01\x12\x03\x13\x08\x0f\n\x0b\n\x04\x04\x01\ - \x02\0\x12\x03\x14\x04\x20\n\r\n\x05\x04\x01\x02\0\x04\x12\x04\x14\x04\ - \x13\x11\n\x0c\n\x05\x04\x01\x02\0\x06\x12\x03\x14\x04\x13\n\x0c\n\x05\ - \x04\x01\x02\0\x01\x12\x03\x14\x14\x1b\n\x0c\n\x05\x04\x01\x02\0\x03\x12\ - \x03\x14\x1e\x1f\n\x0b\n\x04\x04\x01\x02\x01\x12\x03\x15\x04\x11\n\r\n\ - \x05\x04\x01\x02\x01\x04\x12\x04\x15\x04\x14\x20\n\x0c\n\x05\x04\x01\x02\ - \x01\x05\x12\x03\x15\x04\t\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\x15\n\ - \x0c\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\x15\x0f\x10\n\x0b\n\x04\x04\ - \x01\x02\x02\x12\x03\x16\x04\x13\n\r\n\x05\x04\x01\x02\x02\x04\x12\x04\ - \x16\x04\x15\x11\n\x0c\n\x05\x04\x01\x02\x02\x05\x12\x03\x16\x04\t\n\x0c\ - \n\x05\x04\x01\x02\x02\x01\x12\x03\x16\n\x0e\n\x0c\n\x05\x04\x01\x02\x02\ - \x03\x12\x03\x16\x11\x12\n\x0b\n\x04\x04\x01\x02\x03\x12\x03\x17\x04!\n\ - \x0c\n\x05\x04\x01\x02\x03\x04\x12\x03\x17\x04\x0c\n\x0c\n\x05\x04\x01\ - \x02\x03\x06\x12\x03\x17\r\x15\n\x0c\n\x05\x04\x01\x02\x03\x01\x12\x03\ - \x17\x16\x1c\n\x0c\n\x05\x04\x01\x02\x03\x03\x12\x03\x17\x1f\x20\n\n\n\ - \x02\x04\x02\x12\x04\x1a\0\x1f\x01\n\n\n\x03\x04\x02\x01\x12\x03\x1a\x08\ - \x10\n\x0b\n\x04\x04\x02\x02\0\x12\x03\x1b\x04~\n\r\n\x05\x04\x02\x02\0\ - \x04\x12\x04\x1b\x04\x1a\x12\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03\x1b\ - \x04\t\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\x1b\n\x0e\n\x0c\n\x05\x04\ - \x02\x02\0\x03\x12\x03\x1b\x11\x12\n\x0c\n\x05\x04\x02\x02\0\x08\x12\x03\ - \x1b\x13}\n\x0f\n\x08\x04\x02\x02\0\x08\xe7\x07\0\x12\x03\x1b\x14^\n\x10\ - \n\t\x04\x02\x02\0\x08\xe7\x07\0\x02\x12\x03\x1b\x14*\n\x11\n\n\x04\x02\ - \x02\0\x08\xe7\x07\0\x02\0\x12\x03\x1b\x14*\n\x12\n\x0b\x04\x02\x02\0\ - \x08\xe7\x07\0\x02\0\x01\x12\x03\x1b\x15)\n\x10\n\t\x04\x02\x02\0\x08\ - \xe7\x07\0\x07\x12\x03\x1b-^\n\x0f\n\x08\x04\x02\x02\0\x08\xe7\x07\x01\ - \x12\x03\x1b`|\n\x10\n\t\x04\x02\x02\0\x08\xe7\x07\x01\x02\x12\x03\x1b`t\ - \n\x11\n\n\x04\x02\x02\0\x08\xe7\x07\x01\x02\0\x12\x03\x1b`t\n\x12\n\x0b\ - \x04\x02\x02\0\x08\xe7\x07\x01\x02\0\x01\x12\x03\x1bas\n\x10\n\t\x04\x02\ - \x02\0\x08\xe7\x07\x01\x03\x12\x03\x1bw|\n\x0b\n\x04\x04\x02\x02\x01\x12\ - \x03\x1c\x04#\n\r\n\x05\x04\x02\x02\x01\x04\x12\x04\x1c\x04\x1b~\n\x0c\n\ - \x05\x04\x02\x02\x01\x06\x12\x03\x1c\x04\x11\n\x0c\n\x05\x04\x02\x02\x01\ - \x01\x12\x03\x1c\x12\x1e\n\x0c\n\x05\x04\x02\x02\x01\x03\x12\x03\x1c!\"\ - \n\x0b\n\x04\x04\x02\x02\x02\x12\x03\x1d\x04\x20\n\r\n\x05\x04\x02\x02\ - \x02\x04\x12\x04\x1d\x04\x1c#\n\x0c\n\x05\x04\x02\x02\x02\x06\x12\x03\ - \x1d\x04\x14\n\x0c\n\x05\x04\x02\x02\x02\x01\x12\x03\x1d\x15\x1b\n\x0c\n\ - \x05\x04\x02\x02\x02\x03\x12\x03\x1d\x1e\x1f\n\x0b\n\x04\x04\x02\x02\x03\ - \x12\x03\x1e\x04\x1b\n\r\n\x05\x04\x02\x02\x03\x04\x12\x04\x1e\x04\x1d\ - \x20\n\x0c\n\x05\x04\x02\x02\x03\x05\x12\x03\x1e\x04\n\n\x0c\n\x05\x04\ - \x02\x02\x03\x01\x12\x03\x1e\x0b\x16\n\x0c\n\x05\x04\x02\x02\x03\x03\x12\ - \x03\x1e\x19\x1ab\x06proto3\ -"; - -static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/src/eraftpb.rs b/_vendor/src/github.com/pingcap/kvproto/src/eraftpb.rs deleted file mode 100644 index 513e343da1a..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/src/eraftpb.rs +++ /dev/null @@ -1,2797 +0,0 @@ -// This file is generated. Do not edit -// @generated - -// https://github.com/Manishearth/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] - -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; - -#[derive(PartialEq,Clone,Default)] -pub struct Entry { - // message fields - entry_type: ::std::option::Option, - term: ::std::option::Option, - index: ::std::option::Option, - data: ::protobuf::SingularField<::std::vec::Vec>, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Entry {} - -impl Entry { - pub fn new() -> Entry { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Entry { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Entry, - }; - unsafe { - instance.get(Entry::new) - } - } - - // optional .eraftpb.EntryType entry_type = 1; - - pub fn clear_entry_type(&mut self) { - self.entry_type = ::std::option::Option::None; - } - - pub fn has_entry_type(&self) -> bool { - self.entry_type.is_some() - } - - // Param is passed by value, moved - pub fn set_entry_type(&mut self, v: EntryType) { - self.entry_type = ::std::option::Option::Some(v); - } - - pub fn get_entry_type(&self) -> EntryType { - self.entry_type.unwrap_or(EntryType::EntryNormal) - } - - fn get_entry_type_for_reflect(&self) -> &::std::option::Option { - &self.entry_type - } - - fn mut_entry_type_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.entry_type - } - - // optional uint64 term = 2; - - pub fn clear_term(&mut self) { - self.term = ::std::option::Option::None; - } - - pub fn has_term(&self) -> bool { - self.term.is_some() - } - - // Param is passed by value, moved - pub fn set_term(&mut self, v: u64) { - self.term = ::std::option::Option::Some(v); - } - - pub fn get_term(&self) -> u64 { - self.term.unwrap_or(0) - } - - fn get_term_for_reflect(&self) -> &::std::option::Option { - &self.term - } - - fn mut_term_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.term - } - - // optional uint64 index = 3; - - pub fn clear_index(&mut self) { - self.index = ::std::option::Option::None; - } - - pub fn has_index(&self) -> bool { - self.index.is_some() - } - - // Param is passed by value, moved - pub fn set_index(&mut self, v: u64) { - self.index = ::std::option::Option::Some(v); - } - - pub fn get_index(&self) -> u64 { - self.index.unwrap_or(0) - } - - fn get_index_for_reflect(&self) -> &::std::option::Option { - &self.index - } - - fn mut_index_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.index - } - - // optional bytes data = 4; - - pub fn clear_data(&mut self) { - self.data.clear(); - } - - pub fn has_data(&self) -> bool { - self.data.is_some() - } - - // Param is passed by value, moved - pub fn set_data(&mut self, v: ::std::vec::Vec) { - self.data = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { - if self.data.is_none() { - self.data.set_default(); - } - self.data.as_mut().unwrap() - } - - // Take field - pub fn take_data(&mut self) -> ::std::vec::Vec { - self.data.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_data(&self) -> &[u8] { - match self.data.as_ref() { - Some(v) => &v, - None => &[], - } - } - - fn get_data_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.data - } - - fn mut_data_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.data - } -} - -impl ::protobuf::Message for Entry { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.entry_type = ::std::option::Option::Some(tmp); - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.term = ::std::option::Option::Some(tmp); - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.index = ::std::option::Option::Some(tmp); - }, - 4 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.data)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.entry_type { - my_size += ::protobuf::rt::enum_size(1, v); - } - if let Some(v) = self.term { - my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.index { - my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(ref v) = self.data.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.entry_type { - os.write_enum(1, v.value())?; - } - if let Some(v) = self.term { - os.write_uint64(2, v)?; - } - if let Some(v) = self.index { - os.write_uint64(3, v)?; - } - if let Some(ref v) = self.data.as_ref() { - os.write_bytes(4, &v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Entry { - fn new() -> Entry { - Entry::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "entry_type", - Entry::get_entry_type_for_reflect, - Entry::mut_entry_type_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "term", - Entry::get_term_for_reflect, - Entry::mut_term_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "index", - Entry::get_index_for_reflect, - Entry::mut_index_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "data", - Entry::get_data_for_reflect, - Entry::mut_data_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Entry", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Entry { - fn clear(&mut self) { - self.clear_entry_type(); - self.clear_term(); - self.clear_index(); - self.clear_data(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Entry { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Entry { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct SnapshotMetadata { - // message fields - conf_state: ::protobuf::SingularPtrField, - index: ::std::option::Option, - term: ::std::option::Option, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for SnapshotMetadata {} - -impl SnapshotMetadata { - pub fn new() -> SnapshotMetadata { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static SnapshotMetadata { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const SnapshotMetadata, - }; - unsafe { - instance.get(SnapshotMetadata::new) - } - } - - // optional .eraftpb.ConfState conf_state = 1; - - pub fn clear_conf_state(&mut self) { - self.conf_state.clear(); - } - - pub fn has_conf_state(&self) -> bool { - self.conf_state.is_some() - } - - // Param is passed by value, moved - pub fn set_conf_state(&mut self, v: ConfState) { - self.conf_state = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_conf_state(&mut self) -> &mut ConfState { - if self.conf_state.is_none() { - self.conf_state.set_default(); - } - self.conf_state.as_mut().unwrap() - } - - // Take field - pub fn take_conf_state(&mut self) -> ConfState { - self.conf_state.take().unwrap_or_else(|| ConfState::new()) - } - - pub fn get_conf_state(&self) -> &ConfState { - self.conf_state.as_ref().unwrap_or_else(|| ConfState::default_instance()) - } - - fn get_conf_state_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.conf_state - } - - fn mut_conf_state_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.conf_state - } - - // optional uint64 index = 2; - - pub fn clear_index(&mut self) { - self.index = ::std::option::Option::None; - } - - pub fn has_index(&self) -> bool { - self.index.is_some() - } - - // Param is passed by value, moved - pub fn set_index(&mut self, v: u64) { - self.index = ::std::option::Option::Some(v); - } - - pub fn get_index(&self) -> u64 { - self.index.unwrap_or(0) - } - - fn get_index_for_reflect(&self) -> &::std::option::Option { - &self.index - } - - fn mut_index_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.index - } - - // optional uint64 term = 3; - - pub fn clear_term(&mut self) { - self.term = ::std::option::Option::None; - } - - pub fn has_term(&self) -> bool { - self.term.is_some() - } - - // Param is passed by value, moved - pub fn set_term(&mut self, v: u64) { - self.term = ::std::option::Option::Some(v); - } - - pub fn get_term(&self) -> u64 { - self.term.unwrap_or(0) - } - - fn get_term_for_reflect(&self) -> &::std::option::Option { - &self.term - } - - fn mut_term_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.term - } -} - -impl ::protobuf::Message for SnapshotMetadata { - fn is_initialized(&self) -> bool { - for v in &self.conf_state { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.conf_state)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.index = ::std::option::Option::Some(tmp); - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.term = ::std::option::Option::Some(tmp); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.conf_state.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(v) = self.index { - my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.term { - my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.conf_state.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(v) = self.index { - os.write_uint64(2, v)?; - } - if let Some(v) = self.term { - os.write_uint64(3, v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for SnapshotMetadata { - fn new() -> SnapshotMetadata { - SnapshotMetadata::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "conf_state", - SnapshotMetadata::get_conf_state_for_reflect, - SnapshotMetadata::mut_conf_state_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "index", - SnapshotMetadata::get_index_for_reflect, - SnapshotMetadata::mut_index_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "term", - SnapshotMetadata::get_term_for_reflect, - SnapshotMetadata::mut_term_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "SnapshotMetadata", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for SnapshotMetadata { - fn clear(&mut self) { - self.clear_conf_state(); - self.clear_index(); - self.clear_term(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for SnapshotMetadata { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SnapshotMetadata { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Snapshot { - // message fields - data: ::protobuf::SingularField<::std::vec::Vec>, - metadata: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Snapshot {} - -impl Snapshot { - pub fn new() -> Snapshot { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Snapshot { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Snapshot, - }; - unsafe { - instance.get(Snapshot::new) - } - } - - // optional bytes data = 1; - - pub fn clear_data(&mut self) { - self.data.clear(); - } - - pub fn has_data(&self) -> bool { - self.data.is_some() - } - - // Param is passed by value, moved - pub fn set_data(&mut self, v: ::std::vec::Vec) { - self.data = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { - if self.data.is_none() { - self.data.set_default(); - } - self.data.as_mut().unwrap() - } - - // Take field - pub fn take_data(&mut self) -> ::std::vec::Vec { - self.data.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_data(&self) -> &[u8] { - match self.data.as_ref() { - Some(v) => &v, - None => &[], - } - } - - fn get_data_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.data - } - - fn mut_data_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.data - } - - // optional .eraftpb.SnapshotMetadata metadata = 2; - - pub fn clear_metadata(&mut self) { - self.metadata.clear(); - } - - pub fn has_metadata(&self) -> bool { - self.metadata.is_some() - } - - // Param is passed by value, moved - pub fn set_metadata(&mut self, v: SnapshotMetadata) { - self.metadata = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_metadata(&mut self) -> &mut SnapshotMetadata { - if self.metadata.is_none() { - self.metadata.set_default(); - } - self.metadata.as_mut().unwrap() - } - - // Take field - pub fn take_metadata(&mut self) -> SnapshotMetadata { - self.metadata.take().unwrap_or_else(|| SnapshotMetadata::new()) - } - - pub fn get_metadata(&self) -> &SnapshotMetadata { - self.metadata.as_ref().unwrap_or_else(|| SnapshotMetadata::default_instance()) - } - - fn get_metadata_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.metadata - } - - fn mut_metadata_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.metadata - } -} - -impl ::protobuf::Message for Snapshot { - fn is_initialized(&self) -> bool { - for v in &self.metadata { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.data)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.metadata)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.data.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(ref v) = self.metadata.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.data.as_ref() { - os.write_bytes(1, &v)?; - } - if let Some(ref v) = self.metadata.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Snapshot { - fn new() -> Snapshot { - Snapshot::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "data", - Snapshot::get_data_for_reflect, - Snapshot::mut_data_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "metadata", - Snapshot::get_metadata_for_reflect, - Snapshot::mut_metadata_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Snapshot", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Snapshot { - fn clear(&mut self) { - self.clear_data(); - self.clear_metadata(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Snapshot { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Snapshot { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Message { - // message fields - msg_type: ::std::option::Option, - to: ::std::option::Option, - from: ::std::option::Option, - term: ::std::option::Option, - log_term: ::std::option::Option, - index: ::std::option::Option, - entries: ::protobuf::RepeatedField, - commit: ::std::option::Option, - snapshot: ::protobuf::SingularPtrField, - reject: ::std::option::Option, - reject_hint: ::std::option::Option, - context: ::protobuf::SingularField<::std::vec::Vec>, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Message {} - -impl Message { - pub fn new() -> Message { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Message { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Message, - }; - unsafe { - instance.get(Message::new) - } - } - - // optional .eraftpb.MessageType msg_type = 1; - - pub fn clear_msg_type(&mut self) { - self.msg_type = ::std::option::Option::None; - } - - pub fn has_msg_type(&self) -> bool { - self.msg_type.is_some() - } - - // Param is passed by value, moved - pub fn set_msg_type(&mut self, v: MessageType) { - self.msg_type = ::std::option::Option::Some(v); - } - - pub fn get_msg_type(&self) -> MessageType { - self.msg_type.unwrap_or(MessageType::MsgHup) - } - - fn get_msg_type_for_reflect(&self) -> &::std::option::Option { - &self.msg_type - } - - fn mut_msg_type_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.msg_type - } - - // optional uint64 to = 2; - - pub fn clear_to(&mut self) { - self.to = ::std::option::Option::None; - } - - pub fn has_to(&self) -> bool { - self.to.is_some() - } - - // Param is passed by value, moved - pub fn set_to(&mut self, v: u64) { - self.to = ::std::option::Option::Some(v); - } - - pub fn get_to(&self) -> u64 { - self.to.unwrap_or(0) - } - - fn get_to_for_reflect(&self) -> &::std::option::Option { - &self.to - } - - fn mut_to_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.to - } - - // optional uint64 from = 3; - - pub fn clear_from(&mut self) { - self.from = ::std::option::Option::None; - } - - pub fn has_from(&self) -> bool { - self.from.is_some() - } - - // Param is passed by value, moved - pub fn set_from(&mut self, v: u64) { - self.from = ::std::option::Option::Some(v); - } - - pub fn get_from(&self) -> u64 { - self.from.unwrap_or(0) - } - - fn get_from_for_reflect(&self) -> &::std::option::Option { - &self.from - } - - fn mut_from_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.from - } - - // optional uint64 term = 4; - - pub fn clear_term(&mut self) { - self.term = ::std::option::Option::None; - } - - pub fn has_term(&self) -> bool { - self.term.is_some() - } - - // Param is passed by value, moved - pub fn set_term(&mut self, v: u64) { - self.term = ::std::option::Option::Some(v); - } - - pub fn get_term(&self) -> u64 { - self.term.unwrap_or(0) - } - - fn get_term_for_reflect(&self) -> &::std::option::Option { - &self.term - } - - fn mut_term_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.term - } - - // optional uint64 log_term = 5; - - pub fn clear_log_term(&mut self) { - self.log_term = ::std::option::Option::None; - } - - pub fn has_log_term(&self) -> bool { - self.log_term.is_some() - } - - // Param is passed by value, moved - pub fn set_log_term(&mut self, v: u64) { - self.log_term = ::std::option::Option::Some(v); - } - - pub fn get_log_term(&self) -> u64 { - self.log_term.unwrap_or(0) - } - - fn get_log_term_for_reflect(&self) -> &::std::option::Option { - &self.log_term - } - - fn mut_log_term_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.log_term - } - - // optional uint64 index = 6; - - pub fn clear_index(&mut self) { - self.index = ::std::option::Option::None; - } - - pub fn has_index(&self) -> bool { - self.index.is_some() - } - - // Param is passed by value, moved - pub fn set_index(&mut self, v: u64) { - self.index = ::std::option::Option::Some(v); - } - - pub fn get_index(&self) -> u64 { - self.index.unwrap_or(0) - } - - fn get_index_for_reflect(&self) -> &::std::option::Option { - &self.index - } - - fn mut_index_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.index - } - - // repeated .eraftpb.Entry entries = 7; - - pub fn clear_entries(&mut self) { - self.entries.clear(); - } - - // Param is passed by value, moved - pub fn set_entries(&mut self, v: ::protobuf::RepeatedField) { - self.entries = v; - } - - // Mutable pointer to the field. - pub fn mut_entries(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.entries - } - - // Take field - pub fn take_entries(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.entries, ::protobuf::RepeatedField::new()) - } - - pub fn get_entries(&self) -> &[Entry] { - &self.entries - } - - fn get_entries_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.entries - } - - fn mut_entries_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.entries - } - - // optional uint64 commit = 8; - - pub fn clear_commit(&mut self) { - self.commit = ::std::option::Option::None; - } - - pub fn has_commit(&self) -> bool { - self.commit.is_some() - } - - // Param is passed by value, moved - pub fn set_commit(&mut self, v: u64) { - self.commit = ::std::option::Option::Some(v); - } - - pub fn get_commit(&self) -> u64 { - self.commit.unwrap_or(0) - } - - fn get_commit_for_reflect(&self) -> &::std::option::Option { - &self.commit - } - - fn mut_commit_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.commit - } - - // optional .eraftpb.Snapshot snapshot = 9; - - pub fn clear_snapshot(&mut self) { - self.snapshot.clear(); - } - - pub fn has_snapshot(&self) -> bool { - self.snapshot.is_some() - } - - // Param is passed by value, moved - pub fn set_snapshot(&mut self, v: Snapshot) { - self.snapshot = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_snapshot(&mut self) -> &mut Snapshot { - if self.snapshot.is_none() { - self.snapshot.set_default(); - } - self.snapshot.as_mut().unwrap() - } - - // Take field - pub fn take_snapshot(&mut self) -> Snapshot { - self.snapshot.take().unwrap_or_else(|| Snapshot::new()) - } - - pub fn get_snapshot(&self) -> &Snapshot { - self.snapshot.as_ref().unwrap_or_else(|| Snapshot::default_instance()) - } - - fn get_snapshot_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.snapshot - } - - fn mut_snapshot_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.snapshot - } - - // optional bool reject = 10; - - pub fn clear_reject(&mut self) { - self.reject = ::std::option::Option::None; - } - - pub fn has_reject(&self) -> bool { - self.reject.is_some() - } - - // Param is passed by value, moved - pub fn set_reject(&mut self, v: bool) { - self.reject = ::std::option::Option::Some(v); - } - - pub fn get_reject(&self) -> bool { - self.reject.unwrap_or(false) - } - - fn get_reject_for_reflect(&self) -> &::std::option::Option { - &self.reject - } - - fn mut_reject_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.reject - } - - // optional uint64 reject_hint = 11; - - pub fn clear_reject_hint(&mut self) { - self.reject_hint = ::std::option::Option::None; - } - - pub fn has_reject_hint(&self) -> bool { - self.reject_hint.is_some() - } - - // Param is passed by value, moved - pub fn set_reject_hint(&mut self, v: u64) { - self.reject_hint = ::std::option::Option::Some(v); - } - - pub fn get_reject_hint(&self) -> u64 { - self.reject_hint.unwrap_or(0) - } - - fn get_reject_hint_for_reflect(&self) -> &::std::option::Option { - &self.reject_hint - } - - fn mut_reject_hint_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.reject_hint - } - - // optional bytes context = 12; - - pub fn clear_context(&mut self) { - self.context.clear(); - } - - pub fn has_context(&self) -> bool { - self.context.is_some() - } - - // Param is passed by value, moved - pub fn set_context(&mut self, v: ::std::vec::Vec) { - self.context = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_context(&mut self) -> &mut ::std::vec::Vec { - if self.context.is_none() { - self.context.set_default(); - } - self.context.as_mut().unwrap() - } - - // Take field - pub fn take_context(&mut self) -> ::std::vec::Vec { - self.context.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_context(&self) -> &[u8] { - match self.context.as_ref() { - Some(v) => &v, - None => &[], - } - } - - fn get_context_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.context - } - - fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.context - } -} - -impl ::protobuf::Message for Message { - fn is_initialized(&self) -> bool { - for v in &self.entries { - if !v.is_initialized() { - return false; - } - }; - for v in &self.snapshot { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.msg_type = ::std::option::Option::Some(tmp); - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.to = ::std::option::Option::Some(tmp); - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.from = ::std::option::Option::Some(tmp); - }, - 4 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.term = ::std::option::Option::Some(tmp); - }, - 5 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.log_term = ::std::option::Option::Some(tmp); - }, - 6 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.index = ::std::option::Option::Some(tmp); - }, - 7 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.entries)?; - }, - 8 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.commit = ::std::option::Option::Some(tmp); - }, - 9 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.snapshot)?; - }, - 10 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_bool()?; - self.reject = ::std::option::Option::Some(tmp); - }, - 11 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.reject_hint = ::std::option::Option::Some(tmp); - }, - 12 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.context)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.msg_type { - my_size += ::protobuf::rt::enum_size(1, v); - } - if let Some(v) = self.to { - my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.from { - my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.term { - my_size += ::protobuf::rt::value_size(4, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.log_term { - my_size += ::protobuf::rt::value_size(5, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.index { - my_size += ::protobuf::rt::value_size(6, v, ::protobuf::wire_format::WireTypeVarint); - } - for value in &self.entries { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - if let Some(v) = self.commit { - my_size += ::protobuf::rt::value_size(8, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(ref v) = self.snapshot.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(v) = self.reject { - my_size += 2; - } - if let Some(v) = self.reject_hint { - my_size += ::protobuf::rt::value_size(11, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(ref v) = self.context.as_ref() { - my_size += ::protobuf::rt::bytes_size(12, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.msg_type { - os.write_enum(1, v.value())?; - } - if let Some(v) = self.to { - os.write_uint64(2, v)?; - } - if let Some(v) = self.from { - os.write_uint64(3, v)?; - } - if let Some(v) = self.term { - os.write_uint64(4, v)?; - } - if let Some(v) = self.log_term { - os.write_uint64(5, v)?; - } - if let Some(v) = self.index { - os.write_uint64(6, v)?; - } - for v in &self.entries { - os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - if let Some(v) = self.commit { - os.write_uint64(8, v)?; - } - if let Some(ref v) = self.snapshot.as_ref() { - os.write_tag(9, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(v) = self.reject { - os.write_bool(10, v)?; - } - if let Some(v) = self.reject_hint { - os.write_uint64(11, v)?; - } - if let Some(ref v) = self.context.as_ref() { - os.write_bytes(12, &v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Message { - fn new() -> Message { - Message::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "msg_type", - Message::get_msg_type_for_reflect, - Message::mut_msg_type_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "to", - Message::get_to_for_reflect, - Message::mut_to_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "from", - Message::get_from_for_reflect, - Message::mut_from_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "term", - Message::get_term_for_reflect, - Message::mut_term_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "log_term", - Message::get_log_term_for_reflect, - Message::mut_log_term_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "index", - Message::get_index_for_reflect, - Message::mut_index_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "entries", - Message::get_entries_for_reflect, - Message::mut_entries_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "commit", - Message::get_commit_for_reflect, - Message::mut_commit_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "snapshot", - Message::get_snapshot_for_reflect, - Message::mut_snapshot_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( - "reject", - Message::get_reject_for_reflect, - Message::mut_reject_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "reject_hint", - Message::get_reject_hint_for_reflect, - Message::mut_reject_hint_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "context", - Message::get_context_for_reflect, - Message::mut_context_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Message", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Message { - fn clear(&mut self) { - self.clear_msg_type(); - self.clear_to(); - self.clear_from(); - self.clear_term(); - self.clear_log_term(); - self.clear_index(); - self.clear_entries(); - self.clear_commit(); - self.clear_snapshot(); - self.clear_reject(); - self.clear_reject_hint(); - self.clear_context(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Message { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Message { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct HardState { - // message fields - term: ::std::option::Option, - vote: ::std::option::Option, - commit: ::std::option::Option, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for HardState {} - -impl HardState { - pub fn new() -> HardState { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static HardState { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const HardState, - }; - unsafe { - instance.get(HardState::new) - } - } - - // optional uint64 term = 1; - - pub fn clear_term(&mut self) { - self.term = ::std::option::Option::None; - } - - pub fn has_term(&self) -> bool { - self.term.is_some() - } - - // Param is passed by value, moved - pub fn set_term(&mut self, v: u64) { - self.term = ::std::option::Option::Some(v); - } - - pub fn get_term(&self) -> u64 { - self.term.unwrap_or(0) - } - - fn get_term_for_reflect(&self) -> &::std::option::Option { - &self.term - } - - fn mut_term_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.term - } - - // optional uint64 vote = 2; - - pub fn clear_vote(&mut self) { - self.vote = ::std::option::Option::None; - } - - pub fn has_vote(&self) -> bool { - self.vote.is_some() - } - - // Param is passed by value, moved - pub fn set_vote(&mut self, v: u64) { - self.vote = ::std::option::Option::Some(v); - } - - pub fn get_vote(&self) -> u64 { - self.vote.unwrap_or(0) - } - - fn get_vote_for_reflect(&self) -> &::std::option::Option { - &self.vote - } - - fn mut_vote_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.vote - } - - // optional uint64 commit = 3; - - pub fn clear_commit(&mut self) { - self.commit = ::std::option::Option::None; - } - - pub fn has_commit(&self) -> bool { - self.commit.is_some() - } - - // Param is passed by value, moved - pub fn set_commit(&mut self, v: u64) { - self.commit = ::std::option::Option::Some(v); - } - - pub fn get_commit(&self) -> u64 { - self.commit.unwrap_or(0) - } - - fn get_commit_for_reflect(&self) -> &::std::option::Option { - &self.commit - } - - fn mut_commit_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.commit - } -} - -impl ::protobuf::Message for HardState { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.term = ::std::option::Option::Some(tmp); - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.vote = ::std::option::Option::Some(tmp); - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.commit = ::std::option::Option::Some(tmp); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.term { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.vote { - my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.commit { - my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.term { - os.write_uint64(1, v)?; - } - if let Some(v) = self.vote { - os.write_uint64(2, v)?; - } - if let Some(v) = self.commit { - os.write_uint64(3, v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for HardState { - fn new() -> HardState { - HardState::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "term", - HardState::get_term_for_reflect, - HardState::mut_term_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "vote", - HardState::get_vote_for_reflect, - HardState::mut_vote_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "commit", - HardState::get_commit_for_reflect, - HardState::mut_commit_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "HardState", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for HardState { - fn clear(&mut self) { - self.clear_term(); - self.clear_vote(); - self.clear_commit(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for HardState { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for HardState { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ConfState { - // message fields - nodes: ::std::vec::Vec, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for ConfState {} - -impl ConfState { - pub fn new() -> ConfState { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static ConfState { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ConfState, - }; - unsafe { - instance.get(ConfState::new) - } - } - - // repeated uint64 nodes = 1; - - pub fn clear_nodes(&mut self) { - self.nodes.clear(); - } - - // Param is passed by value, moved - pub fn set_nodes(&mut self, v: ::std::vec::Vec) { - self.nodes = v; - } - - // Mutable pointer to the field. - pub fn mut_nodes(&mut self) -> &mut ::std::vec::Vec { - &mut self.nodes - } - - // Take field - pub fn take_nodes(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.nodes, ::std::vec::Vec::new()) - } - - pub fn get_nodes(&self) -> &[u64] { - &self.nodes - } - - fn get_nodes_for_reflect(&self) -> &::std::vec::Vec { - &self.nodes - } - - fn mut_nodes_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.nodes - } -} - -impl ::protobuf::Message for ConfState { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_repeated_uint64_into(wire_type, is, &mut self.nodes)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - for value in &self.nodes { - my_size += ::protobuf::rt::value_size(1, *value, ::protobuf::wire_format::WireTypeVarint); - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - for v in &self.nodes { - os.write_uint64(1, *v)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for ConfState { - fn new() -> ConfState { - ConfState::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "nodes", - ConfState::get_nodes_for_reflect, - ConfState::mut_nodes_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "ConfState", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for ConfState { - fn clear(&mut self) { - self.clear_nodes(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ConfState { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ConfState { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ConfChange { - // message fields - id: ::std::option::Option, - change_type: ::std::option::Option, - node_id: ::std::option::Option, - context: ::protobuf::SingularField<::std::vec::Vec>, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for ConfChange {} - -impl ConfChange { - pub fn new() -> ConfChange { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static ConfChange { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ConfChange, - }; - unsafe { - instance.get(ConfChange::new) - } - } - - // optional uint64 id = 1; - - pub fn clear_id(&mut self) { - self.id = ::std::option::Option::None; - } - - pub fn has_id(&self) -> bool { - self.id.is_some() - } - - // Param is passed by value, moved - pub fn set_id(&mut self, v: u64) { - self.id = ::std::option::Option::Some(v); - } - - pub fn get_id(&self) -> u64 { - self.id.unwrap_or(0) - } - - fn get_id_for_reflect(&self) -> &::std::option::Option { - &self.id - } - - fn mut_id_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.id - } - - // optional .eraftpb.ConfChangeType change_type = 2; - - pub fn clear_change_type(&mut self) { - self.change_type = ::std::option::Option::None; - } - - pub fn has_change_type(&self) -> bool { - self.change_type.is_some() - } - - // Param is passed by value, moved - pub fn set_change_type(&mut self, v: ConfChangeType) { - self.change_type = ::std::option::Option::Some(v); - } - - pub fn get_change_type(&self) -> ConfChangeType { - self.change_type.unwrap_or(ConfChangeType::AddNode) - } - - fn get_change_type_for_reflect(&self) -> &::std::option::Option { - &self.change_type - } - - fn mut_change_type_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.change_type - } - - // optional uint64 node_id = 3; - - pub fn clear_node_id(&mut self) { - self.node_id = ::std::option::Option::None; - } - - pub fn has_node_id(&self) -> bool { - self.node_id.is_some() - } - - // Param is passed by value, moved - pub fn set_node_id(&mut self, v: u64) { - self.node_id = ::std::option::Option::Some(v); - } - - pub fn get_node_id(&self) -> u64 { - self.node_id.unwrap_or(0) - } - - fn get_node_id_for_reflect(&self) -> &::std::option::Option { - &self.node_id - } - - fn mut_node_id_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.node_id - } - - // optional bytes context = 4; - - pub fn clear_context(&mut self) { - self.context.clear(); - } - - pub fn has_context(&self) -> bool { - self.context.is_some() - } - - // Param is passed by value, moved - pub fn set_context(&mut self, v: ::std::vec::Vec) { - self.context = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_context(&mut self) -> &mut ::std::vec::Vec { - if self.context.is_none() { - self.context.set_default(); - } - self.context.as_mut().unwrap() - } - - // Take field - pub fn take_context(&mut self) -> ::std::vec::Vec { - self.context.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_context(&self) -> &[u8] { - match self.context.as_ref() { - Some(v) => &v, - None => &[], - } - } - - fn get_context_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.context - } - - fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.context - } -} - -impl ::protobuf::Message for ConfChange { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.id = ::std::option::Option::Some(tmp); - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.change_type = ::std::option::Option::Some(tmp); - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.node_id = ::std::option::Option::Some(tmp); - }, - 4 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.context)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.id { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.change_type { - my_size += ::protobuf::rt::enum_size(2, v); - } - if let Some(v) = self.node_id { - my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(ref v) = self.context.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.id { - os.write_uint64(1, v)?; - } - if let Some(v) = self.change_type { - os.write_enum(2, v.value())?; - } - if let Some(v) = self.node_id { - os.write_uint64(3, v)?; - } - if let Some(ref v) = self.context.as_ref() { - os.write_bytes(4, &v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for ConfChange { - fn new() -> ConfChange { - ConfChange::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "id", - ConfChange::get_id_for_reflect, - ConfChange::mut_id_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "change_type", - ConfChange::get_change_type_for_reflect, - ConfChange::mut_change_type_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "node_id", - ConfChange::get_node_id_for_reflect, - ConfChange::mut_node_id_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "context", - ConfChange::get_context_for_reflect, - ConfChange::mut_context_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "ConfChange", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for ConfChange { - fn clear(&mut self) { - self.clear_id(); - self.clear_change_type(); - self.clear_node_id(); - self.clear_context(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ConfChange { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ConfChange { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum EntryType { - EntryNormal = 0, - EntryConfChange = 1, -} - -impl ::protobuf::ProtobufEnum for EntryType { - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(EntryType::EntryNormal), - 1 => ::std::option::Option::Some(EntryType::EntryConfChange), - _ => ::std::option::Option::None - } - } - - fn values() -> &'static [Self] { - static values: &'static [EntryType] = &[ - EntryType::EntryNormal, - EntryType::EntryConfChange, - ]; - values - } - - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, - }; - unsafe { - descriptor.get(|| { - ::protobuf::reflect::EnumDescriptor::new("EntryType", file_descriptor_proto()) - }) - } - } -} - -impl ::std::marker::Copy for EntryType { -} - -impl ::protobuf::reflect::ProtobufValue for EntryType { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) - } -} - -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum MessageType { - MsgHup = 0, - MsgBeat = 1, - MsgPropose = 2, - MsgAppend = 3, - MsgAppendResponse = 4, - MsgRequestVote = 5, - MsgRequestVoteResponse = 6, - MsgSnapshot = 7, - MsgHeartbeat = 8, - MsgHeartbeatResponse = 9, - MsgUnreachable = 10, - MsgSnapStatus = 11, - MsgCheckQuorum = 12, - MsgTransferLeader = 13, - MsgTimeoutNow = 14, - MsgReadIndex = 15, - MsgReadIndexResp = 16, - MsgRequestPreVote = 17, - MsgRequestPreVoteResponse = 18, -} - -impl ::protobuf::ProtobufEnum for MessageType { - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(MessageType::MsgHup), - 1 => ::std::option::Option::Some(MessageType::MsgBeat), - 2 => ::std::option::Option::Some(MessageType::MsgPropose), - 3 => ::std::option::Option::Some(MessageType::MsgAppend), - 4 => ::std::option::Option::Some(MessageType::MsgAppendResponse), - 5 => ::std::option::Option::Some(MessageType::MsgRequestVote), - 6 => ::std::option::Option::Some(MessageType::MsgRequestVoteResponse), - 7 => ::std::option::Option::Some(MessageType::MsgSnapshot), - 8 => ::std::option::Option::Some(MessageType::MsgHeartbeat), - 9 => ::std::option::Option::Some(MessageType::MsgHeartbeatResponse), - 10 => ::std::option::Option::Some(MessageType::MsgUnreachable), - 11 => ::std::option::Option::Some(MessageType::MsgSnapStatus), - 12 => ::std::option::Option::Some(MessageType::MsgCheckQuorum), - 13 => ::std::option::Option::Some(MessageType::MsgTransferLeader), - 14 => ::std::option::Option::Some(MessageType::MsgTimeoutNow), - 15 => ::std::option::Option::Some(MessageType::MsgReadIndex), - 16 => ::std::option::Option::Some(MessageType::MsgReadIndexResp), - 17 => ::std::option::Option::Some(MessageType::MsgRequestPreVote), - 18 => ::std::option::Option::Some(MessageType::MsgRequestPreVoteResponse), - _ => ::std::option::Option::None - } - } - - fn values() -> &'static [Self] { - static values: &'static [MessageType] = &[ - MessageType::MsgHup, - MessageType::MsgBeat, - MessageType::MsgPropose, - MessageType::MsgAppend, - MessageType::MsgAppendResponse, - MessageType::MsgRequestVote, - MessageType::MsgRequestVoteResponse, - MessageType::MsgSnapshot, - MessageType::MsgHeartbeat, - MessageType::MsgHeartbeatResponse, - MessageType::MsgUnreachable, - MessageType::MsgSnapStatus, - MessageType::MsgCheckQuorum, - MessageType::MsgTransferLeader, - MessageType::MsgTimeoutNow, - MessageType::MsgReadIndex, - MessageType::MsgReadIndexResp, - MessageType::MsgRequestPreVote, - MessageType::MsgRequestPreVoteResponse, - ]; - values - } - - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, - }; - unsafe { - descriptor.get(|| { - ::protobuf::reflect::EnumDescriptor::new("MessageType", file_descriptor_proto()) - }) - } - } -} - -impl ::std::marker::Copy for MessageType { -} - -impl ::protobuf::reflect::ProtobufValue for MessageType { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) - } -} - -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum ConfChangeType { - AddNode = 0, - RemoveNode = 1, -} - -impl ::protobuf::ProtobufEnum for ConfChangeType { - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(ConfChangeType::AddNode), - 1 => ::std::option::Option::Some(ConfChangeType::RemoveNode), - _ => ::std::option::Option::None - } - } - - fn values() -> &'static [Self] { - static values: &'static [ConfChangeType] = &[ - ConfChangeType::AddNode, - ConfChangeType::RemoveNode, - ]; - values - } - - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, - }; - unsafe { - descriptor.get(|| { - ::protobuf::reflect::EnumDescriptor::new("ConfChangeType", file_descriptor_proto()) - }) - } - } -} - -impl ::std::marker::Copy for ConfChangeType { -} - -impl ::protobuf::reflect::ProtobufValue for ConfChangeType { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\reraftpb.proto\x12\x07eraftpb\"x\n\x05Entry\x121\n\nentry_type\x18\ - \x01\x20\x01(\x0e2\x12.eraftpb.EntryTypeR\tentryType\x12\x12\n\x04term\ - \x18\x02\x20\x01(\x04R\x04term\x12\x14\n\x05index\x18\x03\x20\x01(\x04R\ - \x05index\x12\x12\n\x04data\x18\x04\x20\x01(\x0cR\x04data\"o\n\x10Snapsh\ - otMetadata\x121\n\nconf_state\x18\x01\x20\x01(\x0b2\x12.eraftpb.ConfStat\ - eR\tconfState\x12\x14\n\x05index\x18\x02\x20\x01(\x04R\x05index\x12\x12\ - \n\x04term\x18\x03\x20\x01(\x04R\x04term\"U\n\x08Snapshot\x12\x12\n\x04d\ - ata\x18\x01\x20\x01(\x0cR\x04data\x125\n\x08metadata\x18\x02\x20\x01(\ - \x0b2\x19.eraftpb.SnapshotMetadataR\x08metadata\"\xe7\x02\n\x07Message\ - \x12/\n\x08msg_type\x18\x01\x20\x01(\x0e2\x14.eraftpb.MessageTypeR\x07ms\ - gType\x12\x0e\n\x02to\x18\x02\x20\x01(\x04R\x02to\x12\x12\n\x04from\x18\ - \x03\x20\x01(\x04R\x04from\x12\x12\n\x04term\x18\x04\x20\x01(\x04R\x04te\ - rm\x12\x19\n\x08log_term\x18\x05\x20\x01(\x04R\x07logTerm\x12\x14\n\x05i\ - ndex\x18\x06\x20\x01(\x04R\x05index\x12(\n\x07entries\x18\x07\x20\x03(\ - \x0b2\x0e.eraftpb.EntryR\x07entries\x12\x16\n\x06commit\x18\x08\x20\x01(\ - \x04R\x06commit\x12-\n\x08snapshot\x18\t\x20\x01(\x0b2\x11.eraftpb.Snaps\ - hotR\x08snapshot\x12\x16\n\x06reject\x18\n\x20\x01(\x08R\x06reject\x12\ - \x1f\n\x0breject_hint\x18\x0b\x20\x01(\x04R\nrejectHint\x12\x18\n\x07con\ - text\x18\x0c\x20\x01(\x0cR\x07context\"K\n\tHardState\x12\x12\n\x04term\ - \x18\x01\x20\x01(\x04R\x04term\x12\x12\n\x04vote\x18\x02\x20\x01(\x04R\ - \x04vote\x12\x16\n\x06commit\x18\x03\x20\x01(\x04R\x06commit\"!\n\tConfS\ - tate\x12\x14\n\x05nodes\x18\x01\x20\x03(\x04R\x05nodes\"\x89\x01\n\nConf\ - Change\x12\x0e\n\x02id\x18\x01\x20\x01(\x04R\x02id\x128\n\x0bchange_type\ - \x18\x02\x20\x01(\x0e2\x17.eraftpb.ConfChangeTypeR\nchangeType\x12\x17\n\ - \x07node_id\x18\x03\x20\x01(\x04R\x06nodeId\x12\x18\n\x07context\x18\x04\ - \x20\x01(\x0cR\x07context*1\n\tEntryType\x12\x0f\n\x0bEntryNormal\x10\0\ - \x12\x13\n\x0fEntryConfChange\x10\x01*\x8c\x03\n\x0bMessageType\x12\n\n\ - \x06MsgHup\x10\0\x12\x0b\n\x07MsgBeat\x10\x01\x12\x0e\n\nMsgPropose\x10\ - \x02\x12\r\n\tMsgAppend\x10\x03\x12\x15\n\x11MsgAppendResponse\x10\x04\ - \x12\x12\n\x0eMsgRequestVote\x10\x05\x12\x1a\n\x16MsgRequestVoteResponse\ - \x10\x06\x12\x0f\n\x0bMsgSnapshot\x10\x07\x12\x10\n\x0cMsgHeartbeat\x10\ - \x08\x12\x18\n\x14MsgHeartbeatResponse\x10\t\x12\x12\n\x0eMsgUnreachable\ - \x10\n\x12\x11\n\rMsgSnapStatus\x10\x0b\x12\x12\n\x0eMsgCheckQuorum\x10\ - \x0c\x12\x15\n\x11MsgTransferLeader\x10\r\x12\x11\n\rMsgTimeoutNow\x10\ - \x0e\x12\x10\n\x0cMsgReadIndex\x10\x0f\x12\x14\n\x10MsgReadIndexResp\x10\ - \x10\x12\x15\n\x11MsgRequestPreVote\x10\x11\x12\x1d\n\x19MsgRequestPreVo\ - teResponse\x10\x12*-\n\x0eConfChangeType\x12\x0b\n\x07AddNode\x10\0\x12\ - \x0e\n\nRemoveNode\x10\x01B\x1a\n\x18com.pingcap.tikv.kvprotoJ\xde\x19\n\ - \x06\x12\x04\0\0U\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\ - \x12\x03\x01\x08\x0f\n\x08\n\x01\x08\x12\x03\x03\01\n\x0b\n\x04\x08\xe7\ - \x07\0\x12\x03\x03\01\n\x0c\n\x05\x08\xe7\x07\0\x02\x12\x03\x03\x07\x13\ - \n\r\n\x06\x08\xe7\x07\0\x02\0\x12\x03\x03\x07\x13\n\x0e\n\x07\x08\xe7\ - \x07\0\x02\0\x01\x12\x03\x03\x07\x13\n\x0c\n\x05\x08\xe7\x07\0\x07\x12\ - \x03\x03\x160\n\n\n\x02\x05\0\x12\x04\x05\0\x08\x01\n\n\n\x03\x05\0\x01\ - \x12\x03\x05\x05\x0e\n\x0b\n\x04\x05\0\x02\0\x12\x03\x06\x04\x18\n\x0c\n\ - \x05\x05\0\x02\0\x01\x12\x03\x06\x04\x0f\n\x0c\n\x05\x05\0\x02\0\x02\x12\ - \x03\x06\x16\x17\n\x0b\n\x04\x05\0\x02\x01\x12\x03\x07\x04\x18\n\x0c\n\ - \x05\x05\0\x02\x01\x01\x12\x03\x07\x04\x13\n\x0c\n\x05\x05\0\x02\x01\x02\ - \x12\x03\x07\x16\x17\n\n\n\x02\x04\0\x12\x04\n\0\x0f\x01\n\n\n\x03\x04\0\ - \x01\x12\x03\n\x08\r\n\x0b\n\x04\x04\0\x02\0\x12\x03\x0b\x04(\n\x0c\n\ - \x05\x04\0\x02\0\x04\x12\x03\x0b\x04\x0c\n\x0c\n\x05\x04\0\x02\0\x06\x12\ - \x03\x0b\r\x16\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x0b\x18\"\n\x0c\n\x05\ - \x04\0\x02\0\x03\x12\x03\x0b&'\n\x0b\n\x04\x04\0\x02\x01\x12\x03\x0c\x04\ - (\n\x0c\n\x05\x04\0\x02\x01\x04\x12\x03\x0c\x04\x0c\n\x0c\n\x05\x04\0\ - \x02\x01\x05\x12\x03\x0c\r\x13\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x0c\ - \x18\x1c\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x0c&'\n\x0b\n\x04\x04\0\ - \x02\x02\x12\x03\r\x04(\n\x0c\n\x05\x04\0\x02\x02\x04\x12\x03\r\x04\x0c\ - \n\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\r\r\x13\n\x0c\n\x05\x04\0\x02\x02\ - \x01\x12\x03\r\x18\x1d\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x03\r&'\n\x0b\n\ - \x04\x04\0\x02\x03\x12\x03\x0e\x04(\n\x0c\n\x05\x04\0\x02\x03\x04\x12\ - \x03\x0e\x04\x0c\n\x0c\n\x05\x04\0\x02\x03\x05\x12\x03\x0e\r\x12\n\x0c\n\ - \x05\x04\0\x02\x03\x01\x12\x03\x0e\x18\x1c\n\x0c\n\x05\x04\0\x02\x03\x03\ - \x12\x03\x0e&'\n\n\n\x02\x04\x01\x12\x04\x11\0\x15\x01\n\n\n\x03\x04\x01\ - \x01\x12\x03\x11\x08\x18\n\x0b\n\x04\x04\x01\x02\0\x12\x03\x12\x04&\n\ - \x0c\n\x05\x04\x01\x02\0\x04\x12\x03\x12\x04\x0c\n\x0c\n\x05\x04\x01\x02\ - \0\x06\x12\x03\x12\r\x16\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x12\x17!\ - \n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x12$%\n\x0b\n\x04\x04\x01\x02\x01\ - \x12\x03\x13\x04&\n\x0c\n\x05\x04\x01\x02\x01\x04\x12\x03\x13\x04\x0c\n\ - \x0c\n\x05\x04\x01\x02\x01\x05\x12\x03\x13\r\x13\n\x0c\n\x05\x04\x01\x02\ - \x01\x01\x12\x03\x13\x17\x1c\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\x13\ - $%\n\x0b\n\x04\x04\x01\x02\x02\x12\x03\x14\x04&\n\x0c\n\x05\x04\x01\x02\ - \x02\x04\x12\x03\x14\x04\x0c\n\x0c\n\x05\x04\x01\x02\x02\x05\x12\x03\x14\ - \r\x13\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03\x14\x17\x1b\n\x0c\n\x05\ - \x04\x01\x02\x02\x03\x12\x03\x14$%\n\n\n\x02\x04\x02\x12\x04\x17\0\x1a\ - \x01\n\n\n\x03\x04\x02\x01\x12\x03\x17\x08\x10\n\x0b\n\x04\x04\x02\x02\0\ - \x12\x03\x18\x04+\n\x0c\n\x05\x04\x02\x02\0\x04\x12\x03\x18\x04\x0c\n\ - \x0c\n\x05\x04\x02\x02\0\x05\x12\x03\x18\r\x12\n\x0c\n\x05\x04\x02\x02\0\ - \x01\x12\x03\x18\x1e\"\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03\x18)*\n\x0b\ - \n\x04\x04\x02\x02\x01\x12\x03\x19\x04+\n\x0c\n\x05\x04\x02\x02\x01\x04\ - \x12\x03\x19\x04\x0c\n\x0c\n\x05\x04\x02\x02\x01\x06\x12\x03\x19\r\x1d\n\ - \x0c\n\x05\x04\x02\x02\x01\x01\x12\x03\x19\x1e&\n\x0c\n\x05\x04\x02\x02\ - \x01\x03\x12\x03\x19)*\n\n\n\x02\x05\x01\x12\x04\x1c\00\x01\n\n\n\x03\ - \x05\x01\x01\x12\x03\x1c\x05\x10\n\x0b\n\x04\x05\x01\x02\0\x12\x03\x1d\ - \x04\"\n\x0c\n\x05\x05\x01\x02\0\x01\x12\x03\x1d\x04\n\n\x0c\n\x05\x05\ - \x01\x02\0\x02\x12\x03\x1d\x20!\n\x0b\n\x04\x05\x01\x02\x01\x12\x03\x1e\ - \x04\"\n\x0c\n\x05\x05\x01\x02\x01\x01\x12\x03\x1e\x04\x0b\n\x0c\n\x05\ - \x05\x01\x02\x01\x02\x12\x03\x1e\x20!\n\x0b\n\x04\x05\x01\x02\x02\x12\ - \x03\x1f\x04\"\n\x0c\n\x05\x05\x01\x02\x02\x01\x12\x03\x1f\x04\x0e\n\x0c\ - \n\x05\x05\x01\x02\x02\x02\x12\x03\x1f\x20!\n\x0b\n\x04\x05\x01\x02\x03\ - \x12\x03\x20\x04\"\n\x0c\n\x05\x05\x01\x02\x03\x01\x12\x03\x20\x04\r\n\ - \x0c\n\x05\x05\x01\x02\x03\x02\x12\x03\x20\x20!\n\x0b\n\x04\x05\x01\x02\ - \x04\x12\x03!\x04\"\n\x0c\n\x05\x05\x01\x02\x04\x01\x12\x03!\x04\x15\n\ - \x0c\n\x05\x05\x01\x02\x04\x02\x12\x03!\x20!\n\x0b\n\x04\x05\x01\x02\x05\ - \x12\x03\"\x04\"\n\x0c\n\x05\x05\x01\x02\x05\x01\x12\x03\"\x04\x12\n\x0c\ - \n\x05\x05\x01\x02\x05\x02\x12\x03\"\x20!\n\x0b\n\x04\x05\x01\x02\x06\ - \x12\x03#\x04\"\n\x0c\n\x05\x05\x01\x02\x06\x01\x12\x03#\x04\x1a\n\x0c\n\ - \x05\x05\x01\x02\x06\x02\x12\x03#\x20!\n\x0b\n\x04\x05\x01\x02\x07\x12\ - \x03$\x04\"\n\x0c\n\x05\x05\x01\x02\x07\x01\x12\x03$\x04\x0f\n\x0c\n\x05\ - \x05\x01\x02\x07\x02\x12\x03$\x20!\n\x0b\n\x04\x05\x01\x02\x08\x12\x03%\ - \x04\"\n\x0c\n\x05\x05\x01\x02\x08\x01\x12\x03%\x04\x10\n\x0c\n\x05\x05\ - \x01\x02\x08\x02\x12\x03%\x20!\n\x0b\n\x04\x05\x01\x02\t\x12\x03&\x04\"\ - \n\x0c\n\x05\x05\x01\x02\t\x01\x12\x03&\x04\x18\n\x0c\n\x05\x05\x01\x02\ - \t\x02\x12\x03&\x20!\n\x0b\n\x04\x05\x01\x02\n\x12\x03'\x04#\n\x0c\n\x05\ - \x05\x01\x02\n\x01\x12\x03'\x04\x12\n\x0c\n\x05\x05\x01\x02\n\x02\x12\ - \x03'\x20\"\n\x0b\n\x04\x05\x01\x02\x0b\x12\x03(\x04#\n\x0c\n\x05\x05\ - \x01\x02\x0b\x01\x12\x03(\x04\x11\n\x0c\n\x05\x05\x01\x02\x0b\x02\x12\ - \x03(\x20\"\n\x0b\n\x04\x05\x01\x02\x0c\x12\x03)\x04#\n\x0c\n\x05\x05\ - \x01\x02\x0c\x01\x12\x03)\x04\x12\n\x0c\n\x05\x05\x01\x02\x0c\x02\x12\ - \x03)\x20\"\n\x0b\n\x04\x05\x01\x02\r\x12\x03*\x04#\n\x0c\n\x05\x05\x01\ - \x02\r\x01\x12\x03*\x04\x15\n\x0c\n\x05\x05\x01\x02\r\x02\x12\x03*\x20\"\ - \n\x0b\n\x04\x05\x01\x02\x0e\x12\x03+\x04#\n\x0c\n\x05\x05\x01\x02\x0e\ - \x01\x12\x03+\x04\x11\n\x0c\n\x05\x05\x01\x02\x0e\x02\x12\x03+\x20\"\n\ - \x0b\n\x04\x05\x01\x02\x0f\x12\x03,\x04#\n\x0c\n\x05\x05\x01\x02\x0f\x01\ - \x12\x03,\x04\x10\n\x0c\n\x05\x05\x01\x02\x0f\x02\x12\x03,\x20\"\n\x0b\n\ - \x04\x05\x01\x02\x10\x12\x03-\x04#\n\x0c\n\x05\x05\x01\x02\x10\x01\x12\ - \x03-\x04\x14\n\x0c\n\x05\x05\x01\x02\x10\x02\x12\x03-\x20\"\n\x0b\n\x04\ - \x05\x01\x02\x11\x12\x03.\x04#\n\x0c\n\x05\x05\x01\x02\x11\x01\x12\x03.\ - \x04\x15\n\x0c\n\x05\x05\x01\x02\x11\x02\x12\x03.\x20\"\n\x0b\n\x04\x05\ - \x01\x02\x12\x12\x03/\x04#\n\x0c\n\x05\x05\x01\x02\x12\x01\x12\x03/\x04\ - \x1d\n\x0c\n\x05\x05\x01\x02\x12\x02\x12\x03/\x20\"\n\n\n\x02\x04\x03\ - \x12\x042\0?\x01\n\n\n\x03\x04\x03\x01\x12\x032\x08\x0f\n\x0b\n\x04\x04\ - \x03\x02\0\x12\x033\x04,\n\x0c\n\x05\x04\x03\x02\0\x04\x12\x033\x04\x0c\ - \n\x0c\n\x05\x04\x03\x02\0\x06\x12\x033\r\x18\n\x0c\n\x05\x04\x03\x02\0\ - \x01\x12\x033\x19!\n\x0c\n\x05\x04\x03\x02\0\x03\x12\x033*+\n\x0b\n\x04\ - \x04\x03\x02\x01\x12\x034\x04,\n\x0c\n\x05\x04\x03\x02\x01\x04\x12\x034\ - \x04\x0c\n\x0c\n\x05\x04\x03\x02\x01\x05\x12\x034\r\x13\n\x0c\n\x05\x04\ - \x03\x02\x01\x01\x12\x034\x19\x1b\n\x0c\n\x05\x04\x03\x02\x01\x03\x12\ - \x034*+\n\x0b\n\x04\x04\x03\x02\x02\x12\x035\x04,\n\x0c\n\x05\x04\x03\ - \x02\x02\x04\x12\x035\x04\x0c\n\x0c\n\x05\x04\x03\x02\x02\x05\x12\x035\r\ - \x13\n\x0c\n\x05\x04\x03\x02\x02\x01\x12\x035\x19\x1d\n\x0c\n\x05\x04\ - \x03\x02\x02\x03\x12\x035*+\n\x0b\n\x04\x04\x03\x02\x03\x12\x036\x04,\n\ - \x0c\n\x05\x04\x03\x02\x03\x04\x12\x036\x04\x0c\n\x0c\n\x05\x04\x03\x02\ - \x03\x05\x12\x036\r\x13\n\x0c\n\x05\x04\x03\x02\x03\x01\x12\x036\x19\x1d\ - \n\x0c\n\x05\x04\x03\x02\x03\x03\x12\x036*+\n\x0b\n\x04\x04\x03\x02\x04\ - \x12\x037\x04,\n\x0c\n\x05\x04\x03\x02\x04\x04\x12\x037\x04\x0c\n\x0c\n\ - \x05\x04\x03\x02\x04\x05\x12\x037\r\x13\n\x0c\n\x05\x04\x03\x02\x04\x01\ - \x12\x037\x19!\n\x0c\n\x05\x04\x03\x02\x04\x03\x12\x037*+\n\x0b\n\x04\ - \x04\x03\x02\x05\x12\x038\x04,\n\x0c\n\x05\x04\x03\x02\x05\x04\x12\x038\ - \x04\x0c\n\x0c\n\x05\x04\x03\x02\x05\x05\x12\x038\r\x13\n\x0c\n\x05\x04\ - \x03\x02\x05\x01\x12\x038\x19\x1e\n\x0c\n\x05\x04\x03\x02\x05\x03\x12\ - \x038*+\n\x0b\n\x04\x04\x03\x02\x06\x12\x039\x04,\n\x0c\n\x05\x04\x03\ - \x02\x06\x04\x12\x039\x04\x0c\n\x0c\n\x05\x04\x03\x02\x06\x06\x12\x039\r\ - \x12\n\x0c\n\x05\x04\x03\x02\x06\x01\x12\x039\x19\x20\n\x0c\n\x05\x04\ - \x03\x02\x06\x03\x12\x039*+\n\x0b\n\x04\x04\x03\x02\x07\x12\x03:\x04,\n\ - \x0c\n\x05\x04\x03\x02\x07\x04\x12\x03:\x04\x0c\n\x0c\n\x05\x04\x03\x02\ - \x07\x05\x12\x03:\r\x13\n\x0c\n\x05\x04\x03\x02\x07\x01\x12\x03:\x19\x1f\ - \n\x0c\n\x05\x04\x03\x02\x07\x03\x12\x03:*+\n\x0b\n\x04\x04\x03\x02\x08\ - \x12\x03;\x04,\n\x0c\n\x05\x04\x03\x02\x08\x04\x12\x03;\x04\x0c\n\x0c\n\ - \x05\x04\x03\x02\x08\x06\x12\x03;\r\x15\n\x0c\n\x05\x04\x03\x02\x08\x01\ - \x12\x03;\x19!\n\x0c\n\x05\x04\x03\x02\x08\x03\x12\x03;*+\n\x0b\n\x04\ - \x04\x03\x02\t\x12\x03<\x04-\n\x0c\n\x05\x04\x03\x02\t\x04\x12\x03<\x04\ - \x0c\n\x0c\n\x05\x04\x03\x02\t\x05\x12\x03<\r\x11\n\x0c\n\x05\x04\x03\ - \x02\t\x01\x12\x03<\x19\x1f\n\x0c\n\x05\x04\x03\x02\t\x03\x12\x03<*,\n\ - \x0b\n\x04\x04\x03\x02\n\x12\x03=\x04-\n\x0c\n\x05\x04\x03\x02\n\x04\x12\ - \x03=\x04\x0c\n\x0c\n\x05\x04\x03\x02\n\x05\x12\x03=\r\x13\n\x0c\n\x05\ - \x04\x03\x02\n\x01\x12\x03=\x19$\n\x0c\n\x05\x04\x03\x02\n\x03\x12\x03=*\ - ,\n\x0b\n\x04\x04\x03\x02\x0b\x12\x03>\x04-\n\x0c\n\x05\x04\x03\x02\x0b\ - \x04\x12\x03>\x04\x0c\n\x0c\n\x05\x04\x03\x02\x0b\x05\x12\x03>\r\x12\n\ - \x0c\n\x05\x04\x03\x02\x0b\x01\x12\x03>\x19\x20\n\x0c\n\x05\x04\x03\x02\ - \x0b\x03\x12\x03>*,\n\n\n\x02\x04\x04\x12\x04A\0E\x01\n\n\n\x03\x04\x04\ - \x01\x12\x03A\x08\x11\n\x0b\n\x04\x04\x04\x02\0\x12\x03B\x04\x1f\n\x0c\n\ - \x05\x04\x04\x02\0\x04\x12\x03B\x04\x0c\n\x0c\n\x05\x04\x04\x02\0\x05\ - \x12\x03B\r\x13\n\x0c\n\x05\x04\x04\x02\0\x01\x12\x03B\x14\x18\n\x0c\n\ - \x05\x04\x04\x02\0\x03\x12\x03B\x1d\x1e\n\x0b\n\x04\x04\x04\x02\x01\x12\ - \x03C\x04\x1f\n\x0c\n\x05\x04\x04\x02\x01\x04\x12\x03C\x04\x0c\n\x0c\n\ - \x05\x04\x04\x02\x01\x05\x12\x03C\r\x13\n\x0c\n\x05\x04\x04\x02\x01\x01\ - \x12\x03C\x14\x18\n\x0c\n\x05\x04\x04\x02\x01\x03\x12\x03C\x1d\x1e\n\x0b\ - \n\x04\x04\x04\x02\x02\x12\x03D\x04\x1f\n\x0c\n\x05\x04\x04\x02\x02\x04\ - \x12\x03D\x04\x0c\n\x0c\n\x05\x04\x04\x02\x02\x05\x12\x03D\r\x13\n\x0c\n\ - \x05\x04\x04\x02\x02\x01\x12\x03D\x14\x1a\n\x0c\n\x05\x04\x04\x02\x02\ - \x03\x12\x03D\x1d\x1e\n\n\n\x02\x04\x05\x12\x04G\0I\x01\n\n\n\x03\x04\ - \x05\x01\x12\x03G\x08\x11\n\x0b\n\x04\x04\x05\x02\0\x12\x03H\x04\x1e\n\ - \x0c\n\x05\x04\x05\x02\0\x04\x12\x03H\x04\x0c\n\x0c\n\x05\x04\x05\x02\0\ - \x05\x12\x03H\r\x13\n\x0c\n\x05\x04\x05\x02\0\x01\x12\x03H\x14\x19\n\x0c\ - \n\x05\x04\x05\x02\0\x03\x12\x03H\x1c\x1d\n\n\n\x02\x05\x02\x12\x04K\0N\ - \x01\n\n\n\x03\x05\x02\x01\x12\x03K\x05\x13\n\x0b\n\x04\x05\x02\x02\0\ - \x12\x03L\x04\x13\n\x0c\n\x05\x05\x02\x02\0\x01\x12\x03L\x04\x0b\n\x0c\n\ - \x05\x05\x02\x02\0\x02\x12\x03L\x11\x12\n\x0b\n\x04\x05\x02\x02\x01\x12\ - \x03M\x04\x13\n\x0c\n\x05\x05\x02\x02\x01\x01\x12\x03M\x04\x0e\n\x0c\n\ - \x05\x05\x02\x02\x01\x02\x12\x03M\x11\x12\n\n\n\x02\x04\x06\x12\x04P\0U\ - \x01\n\n\n\x03\x04\x06\x01\x12\x03P\x08\x12\n\x0b\n\x04\x04\x06\x02\0\ - \x12\x03Q\x040\n\x0c\n\x05\x04\x06\x02\0\x04\x12\x03Q\x04\x0c\n\x0c\n\ - \x05\x04\x06\x02\0\x05\x12\x03Q\r\x13\n\x0c\n\x05\x04\x06\x02\0\x01\x12\ - \x03Q\x1d\x1f\n\x0c\n\x05\x04\x06\x02\0\x03\x12\x03Q./\n\x0b\n\x04\x04\ - \x06\x02\x01\x12\x03R\x040\n\x0c\n\x05\x04\x06\x02\x01\x04\x12\x03R\x04\ - \x0c\n\x0c\n\x05\x04\x06\x02\x01\x06\x12\x03R\r\x1b\n\x0c\n\x05\x04\x06\ - \x02\x01\x01\x12\x03R\x1d(\n\x0c\n\x05\x04\x06\x02\x01\x03\x12\x03R./\n\ - \x0b\n\x04\x04\x06\x02\x02\x12\x03S\x040\n\x0c\n\x05\x04\x06\x02\x02\x04\ - \x12\x03S\x04\x0c\n\x0c\n\x05\x04\x06\x02\x02\x05\x12\x03S\r\x13\n\x0c\n\ - \x05\x04\x06\x02\x02\x01\x12\x03S\x1d$\n\x0c\n\x05\x04\x06\x02\x02\x03\ - \x12\x03S./\n\x0b\n\x04\x04\x06\x02\x03\x12\x03T\x040\n\x0c\n\x05\x04\ - \x06\x02\x03\x04\x12\x03T\x04\x0c\n\x0c\n\x05\x04\x06\x02\x03\x05\x12\ - \x03T\r\x12\n\x0c\n\x05\x04\x06\x02\x03\x01\x12\x03T\x1d$\n\x0c\n\x05\ - \x04\x06\x02\x03\x03\x12\x03T./\ -"; - -static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/src/errorpb.rs b/_vendor/src/github.com/pingcap/kvproto/src/errorpb.rs deleted file mode 100644 index 369bce725b7..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/src/errorpb.rs +++ /dev/null @@ -1,2469 +0,0 @@ -// This file is generated. Do not edit -// @generated - -// https://github.com/Manishearth/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] - -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; - -#[derive(PartialEq,Clone,Default)] -pub struct NotLeader { - // message fields - region_id: ::std::option::Option, - leader: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for NotLeader {} - -impl NotLeader { - pub fn new() -> NotLeader { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static NotLeader { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const NotLeader, - }; - unsafe { - instance.get(NotLeader::new) - } - } - - // optional uint64 region_id = 1; - - pub fn clear_region_id(&mut self) { - self.region_id = ::std::option::Option::None; - } - - pub fn has_region_id(&self) -> bool { - self.region_id.is_some() - } - - // Param is passed by value, moved - pub fn set_region_id(&mut self, v: u64) { - self.region_id = ::std::option::Option::Some(v); - } - - pub fn get_region_id(&self) -> u64 { - self.region_id.unwrap_or(0) - } - - fn get_region_id_for_reflect(&self) -> &::std::option::Option { - &self.region_id - } - - fn mut_region_id_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.region_id - } - - // optional .metapb.Peer leader = 2; - - pub fn clear_leader(&mut self) { - self.leader.clear(); - } - - pub fn has_leader(&self) -> bool { - self.leader.is_some() - } - - // Param is passed by value, moved - pub fn set_leader(&mut self, v: super::metapb::Peer) { - self.leader = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_leader(&mut self) -> &mut super::metapb::Peer { - if self.leader.is_none() { - self.leader.set_default(); - } - self.leader.as_mut().unwrap() - } - - // Take field - pub fn take_leader(&mut self) -> super::metapb::Peer { - self.leader.take().unwrap_or_else(|| super::metapb::Peer::new()) - } - - pub fn get_leader(&self) -> &super::metapb::Peer { - self.leader.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) - } - - fn get_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.leader - } - - fn mut_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.leader - } -} - -impl ::protobuf::Message for NotLeader { - fn is_initialized(&self) -> bool { - for v in &self.leader { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.region_id = ::std::option::Option::Some(tmp); - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.leader)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.region_id { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(ref v) = self.leader.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.region_id { - os.write_uint64(1, v)?; - } - if let Some(ref v) = self.leader.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for NotLeader { - fn new() -> NotLeader { - NotLeader::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "region_id", - NotLeader::get_region_id_for_reflect, - NotLeader::mut_region_id_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "leader", - NotLeader::get_leader_for_reflect, - NotLeader::mut_leader_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "NotLeader", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for NotLeader { - fn clear(&mut self) { - self.clear_region_id(); - self.clear_leader(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for NotLeader { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for NotLeader { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct StoreNotMatch { - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for StoreNotMatch {} - -impl StoreNotMatch { - pub fn new() -> StoreNotMatch { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static StoreNotMatch { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const StoreNotMatch, - }; - unsafe { - instance.get(StoreNotMatch::new) - } - } -} - -impl ::protobuf::Message for StoreNotMatch { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for StoreNotMatch { - fn new() -> StoreNotMatch { - StoreNotMatch::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let fields = ::std::vec::Vec::new(); - ::protobuf::reflect::MessageDescriptor::new::( - "StoreNotMatch", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for StoreNotMatch { - fn clear(&mut self) { - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for StoreNotMatch { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StoreNotMatch { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RegionNotFound { - // message fields - region_id: ::std::option::Option, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RegionNotFound {} - -impl RegionNotFound { - pub fn new() -> RegionNotFound { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RegionNotFound { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RegionNotFound, - }; - unsafe { - instance.get(RegionNotFound::new) - } - } - - // optional uint64 region_id = 1; - - pub fn clear_region_id(&mut self) { - self.region_id = ::std::option::Option::None; - } - - pub fn has_region_id(&self) -> bool { - self.region_id.is_some() - } - - // Param is passed by value, moved - pub fn set_region_id(&mut self, v: u64) { - self.region_id = ::std::option::Option::Some(v); - } - - pub fn get_region_id(&self) -> u64 { - self.region_id.unwrap_or(0) - } - - fn get_region_id_for_reflect(&self) -> &::std::option::Option { - &self.region_id - } - - fn mut_region_id_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.region_id - } -} - -impl ::protobuf::Message for RegionNotFound { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.region_id = ::std::option::Option::Some(tmp); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.region_id { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.region_id { - os.write_uint64(1, v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RegionNotFound { - fn new() -> RegionNotFound { - RegionNotFound::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "region_id", - RegionNotFound::get_region_id_for_reflect, - RegionNotFound::mut_region_id_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RegionNotFound", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RegionNotFound { - fn clear(&mut self) { - self.clear_region_id(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RegionNotFound { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RegionNotFound { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct KeyNotInRegion { - // message fields - key: ::protobuf::SingularField<::std::vec::Vec>, - region_id: ::std::option::Option, - start_key: ::protobuf::SingularField<::std::vec::Vec>, - end_key: ::protobuf::SingularField<::std::vec::Vec>, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for KeyNotInRegion {} - -impl KeyNotInRegion { - pub fn new() -> KeyNotInRegion { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static KeyNotInRegion { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const KeyNotInRegion, - }; - unsafe { - instance.get(KeyNotInRegion::new) - } - } - - // optional bytes key = 1; - - pub fn clear_key(&mut self) { - self.key.clear(); - } - - pub fn has_key(&self) -> bool { - self.key.is_some() - } - - // Param is passed by value, moved - pub fn set_key(&mut self, v: ::std::vec::Vec) { - self.key = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { - if self.key.is_none() { - self.key.set_default(); - } - self.key.as_mut().unwrap() - } - - // Take field - pub fn take_key(&mut self) -> ::std::vec::Vec { - self.key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_key(&self) -> &[u8] { - match self.key.as_ref() { - Some(v) => &v, - None => &[], - } - } - - fn get_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.key - } - - fn mut_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.key - } - - // optional uint64 region_id = 2; - - pub fn clear_region_id(&mut self) { - self.region_id = ::std::option::Option::None; - } - - pub fn has_region_id(&self) -> bool { - self.region_id.is_some() - } - - // Param is passed by value, moved - pub fn set_region_id(&mut self, v: u64) { - self.region_id = ::std::option::Option::Some(v); - } - - pub fn get_region_id(&self) -> u64 { - self.region_id.unwrap_or(0) - } - - fn get_region_id_for_reflect(&self) -> &::std::option::Option { - &self.region_id - } - - fn mut_region_id_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.region_id - } - - // optional bytes start_key = 3; - - pub fn clear_start_key(&mut self) { - self.start_key.clear(); - } - - pub fn has_start_key(&self) -> bool { - self.start_key.is_some() - } - - // Param is passed by value, moved - pub fn set_start_key(&mut self, v: ::std::vec::Vec) { - self.start_key = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_start_key(&mut self) -> &mut ::std::vec::Vec { - if self.start_key.is_none() { - self.start_key.set_default(); - } - self.start_key.as_mut().unwrap() - } - - // Take field - pub fn take_start_key(&mut self) -> ::std::vec::Vec { - self.start_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_start_key(&self) -> &[u8] { - match self.start_key.as_ref() { - Some(v) => &v, - None => &[], - } - } - - fn get_start_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.start_key - } - - fn mut_start_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.start_key - } - - // optional bytes end_key = 4; - - pub fn clear_end_key(&mut self) { - self.end_key.clear(); - } - - pub fn has_end_key(&self) -> bool { - self.end_key.is_some() - } - - // Param is passed by value, moved - pub fn set_end_key(&mut self, v: ::std::vec::Vec) { - self.end_key = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_end_key(&mut self) -> &mut ::std::vec::Vec { - if self.end_key.is_none() { - self.end_key.set_default(); - } - self.end_key.as_mut().unwrap() - } - - // Take field - pub fn take_end_key(&mut self) -> ::std::vec::Vec { - self.end_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_end_key(&self) -> &[u8] { - match self.end_key.as_ref() { - Some(v) => &v, - None => &[], - } - } - - fn get_end_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.end_key - } - - fn mut_end_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.end_key - } -} - -impl ::protobuf::Message for KeyNotInRegion { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.key)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.region_id = ::std::option::Option::Some(tmp); - }, - 3 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.start_key)?; - }, - 4 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.end_key)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.key.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.region_id { - my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(ref v) = self.start_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(ref v) = self.end_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.key.as_ref() { - os.write_bytes(1, &v)?; - } - if let Some(v) = self.region_id { - os.write_uint64(2, v)?; - } - if let Some(ref v) = self.start_key.as_ref() { - os.write_bytes(3, &v)?; - } - if let Some(ref v) = self.end_key.as_ref() { - os.write_bytes(4, &v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for KeyNotInRegion { - fn new() -> KeyNotInRegion { - KeyNotInRegion::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "key", - KeyNotInRegion::get_key_for_reflect, - KeyNotInRegion::mut_key_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "region_id", - KeyNotInRegion::get_region_id_for_reflect, - KeyNotInRegion::mut_region_id_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "start_key", - KeyNotInRegion::get_start_key_for_reflect, - KeyNotInRegion::mut_start_key_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "end_key", - KeyNotInRegion::get_end_key_for_reflect, - KeyNotInRegion::mut_end_key_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "KeyNotInRegion", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for KeyNotInRegion { - fn clear(&mut self) { - self.clear_key(); - self.clear_region_id(); - self.clear_start_key(); - self.clear_end_key(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for KeyNotInRegion { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for KeyNotInRegion { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct StaleEpoch { - // message fields - new_regions: ::protobuf::RepeatedField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for StaleEpoch {} - -impl StaleEpoch { - pub fn new() -> StaleEpoch { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static StaleEpoch { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const StaleEpoch, - }; - unsafe { - instance.get(StaleEpoch::new) - } - } - - // repeated .metapb.Region new_regions = 1; - - pub fn clear_new_regions(&mut self) { - self.new_regions.clear(); - } - - // Param is passed by value, moved - pub fn set_new_regions(&mut self, v: ::protobuf::RepeatedField) { - self.new_regions = v; - } - - // Mutable pointer to the field. - pub fn mut_new_regions(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.new_regions - } - - // Take field - pub fn take_new_regions(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.new_regions, ::protobuf::RepeatedField::new()) - } - - pub fn get_new_regions(&self) -> &[super::metapb::Region] { - &self.new_regions - } - - fn get_new_regions_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.new_regions - } - - fn mut_new_regions_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.new_regions - } -} - -impl ::protobuf::Message for StaleEpoch { - fn is_initialized(&self) -> bool { - for v in &self.new_regions { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.new_regions)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - for value in &self.new_regions { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - for v in &self.new_regions { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for StaleEpoch { - fn new() -> StaleEpoch { - StaleEpoch::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "new_regions", - StaleEpoch::get_new_regions_for_reflect, - StaleEpoch::mut_new_regions_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "StaleEpoch", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for StaleEpoch { - fn clear(&mut self) { - self.clear_new_regions(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for StaleEpoch { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StaleEpoch { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ServerIsBusy { - // message fields - reason: ::protobuf::SingularField<::std::string::String>, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for ServerIsBusy {} - -impl ServerIsBusy { - pub fn new() -> ServerIsBusy { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static ServerIsBusy { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ServerIsBusy, - }; - unsafe { - instance.get(ServerIsBusy::new) - } - } - - // optional string reason = 1; - - pub fn clear_reason(&mut self) { - self.reason.clear(); - } - - pub fn has_reason(&self) -> bool { - self.reason.is_some() - } - - // Param is passed by value, moved - pub fn set_reason(&mut self, v: ::std::string::String) { - self.reason = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_reason(&mut self) -> &mut ::std::string::String { - if self.reason.is_none() { - self.reason.set_default(); - } - self.reason.as_mut().unwrap() - } - - // Take field - pub fn take_reason(&mut self) -> ::std::string::String { - self.reason.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub fn get_reason(&self) -> &str { - match self.reason.as_ref() { - Some(v) => &v, - None => "", - } - } - - fn get_reason_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.reason - } - - fn mut_reason_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.reason - } -} - -impl ::protobuf::Message for ServerIsBusy { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.reason)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.reason.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.reason.as_ref() { - os.write_string(1, &v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for ServerIsBusy { - fn new() -> ServerIsBusy { - ServerIsBusy::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "reason", - ServerIsBusy::get_reason_for_reflect, - ServerIsBusy::mut_reason_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "ServerIsBusy", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for ServerIsBusy { - fn clear(&mut self) { - self.clear_reason(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ServerIsBusy { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ServerIsBusy { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct StaleCommand { - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for StaleCommand {} - -impl StaleCommand { - pub fn new() -> StaleCommand { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static StaleCommand { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const StaleCommand, - }; - unsafe { - instance.get(StaleCommand::new) - } - } -} - -impl ::protobuf::Message for StaleCommand { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for StaleCommand { - fn new() -> StaleCommand { - StaleCommand::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let fields = ::std::vec::Vec::new(); - ::protobuf::reflect::MessageDescriptor::new::( - "StaleCommand", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for StaleCommand { - fn clear(&mut self) { - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for StaleCommand { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StaleCommand { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RaftEntryTooLarge { - // message fields - region_id: ::std::option::Option, - entry_size: ::std::option::Option, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RaftEntryTooLarge {} - -impl RaftEntryTooLarge { - pub fn new() -> RaftEntryTooLarge { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RaftEntryTooLarge { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RaftEntryTooLarge, - }; - unsafe { - instance.get(RaftEntryTooLarge::new) - } - } - - // optional uint64 region_id = 1; - - pub fn clear_region_id(&mut self) { - self.region_id = ::std::option::Option::None; - } - - pub fn has_region_id(&self) -> bool { - self.region_id.is_some() - } - - // Param is passed by value, moved - pub fn set_region_id(&mut self, v: u64) { - self.region_id = ::std::option::Option::Some(v); - } - - pub fn get_region_id(&self) -> u64 { - self.region_id.unwrap_or(0) - } - - fn get_region_id_for_reflect(&self) -> &::std::option::Option { - &self.region_id - } - - fn mut_region_id_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.region_id - } - - // optional uint64 entry_size = 2; - - pub fn clear_entry_size(&mut self) { - self.entry_size = ::std::option::Option::None; - } - - pub fn has_entry_size(&self) -> bool { - self.entry_size.is_some() - } - - // Param is passed by value, moved - pub fn set_entry_size(&mut self, v: u64) { - self.entry_size = ::std::option::Option::Some(v); - } - - pub fn get_entry_size(&self) -> u64 { - self.entry_size.unwrap_or(0) - } - - fn get_entry_size_for_reflect(&self) -> &::std::option::Option { - &self.entry_size - } - - fn mut_entry_size_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.entry_size - } -} - -impl ::protobuf::Message for RaftEntryTooLarge { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.region_id = ::std::option::Option::Some(tmp); - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.entry_size = ::std::option::Option::Some(tmp); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.region_id { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.entry_size { - my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.region_id { - os.write_uint64(1, v)?; - } - if let Some(v) = self.entry_size { - os.write_uint64(2, v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RaftEntryTooLarge { - fn new() -> RaftEntryTooLarge { - RaftEntryTooLarge::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "region_id", - RaftEntryTooLarge::get_region_id_for_reflect, - RaftEntryTooLarge::mut_region_id_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "entry_size", - RaftEntryTooLarge::get_entry_size_for_reflect, - RaftEntryTooLarge::mut_entry_size_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RaftEntryTooLarge", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RaftEntryTooLarge { - fn clear(&mut self) { - self.clear_region_id(); - self.clear_entry_size(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RaftEntryTooLarge { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RaftEntryTooLarge { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Error { - // message fields - message: ::protobuf::SingularField<::std::string::String>, - not_leader: ::protobuf::SingularPtrField, - region_not_found: ::protobuf::SingularPtrField, - key_not_in_region: ::protobuf::SingularPtrField, - stale_epoch: ::protobuf::SingularPtrField, - server_is_busy: ::protobuf::SingularPtrField, - stale_command: ::protobuf::SingularPtrField, - store_not_match: ::protobuf::SingularPtrField, - raft_entry_too_large: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Error {} - -impl Error { - pub fn new() -> Error { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Error { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Error, - }; - unsafe { - instance.get(Error::new) - } - } - - // optional string message = 1; - - pub fn clear_message(&mut self) { - self.message.clear(); - } - - pub fn has_message(&self) -> bool { - self.message.is_some() - } - - // Param is passed by value, moved - pub fn set_message(&mut self, v: ::std::string::String) { - self.message = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_message(&mut self) -> &mut ::std::string::String { - if self.message.is_none() { - self.message.set_default(); - } - self.message.as_mut().unwrap() - } - - // Take field - pub fn take_message(&mut self) -> ::std::string::String { - self.message.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub fn get_message(&self) -> &str { - match self.message.as_ref() { - Some(v) => &v, - None => "", - } - } - - fn get_message_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.message - } - - fn mut_message_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.message - } - - // optional .errorpb.NotLeader not_leader = 2; - - pub fn clear_not_leader(&mut self) { - self.not_leader.clear(); - } - - pub fn has_not_leader(&self) -> bool { - self.not_leader.is_some() - } - - // Param is passed by value, moved - pub fn set_not_leader(&mut self, v: NotLeader) { - self.not_leader = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_not_leader(&mut self) -> &mut NotLeader { - if self.not_leader.is_none() { - self.not_leader.set_default(); - } - self.not_leader.as_mut().unwrap() - } - - // Take field - pub fn take_not_leader(&mut self) -> NotLeader { - self.not_leader.take().unwrap_or_else(|| NotLeader::new()) - } - - pub fn get_not_leader(&self) -> &NotLeader { - self.not_leader.as_ref().unwrap_or_else(|| NotLeader::default_instance()) - } - - fn get_not_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.not_leader - } - - fn mut_not_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.not_leader - } - - // optional .errorpb.RegionNotFound region_not_found = 3; - - pub fn clear_region_not_found(&mut self) { - self.region_not_found.clear(); - } - - pub fn has_region_not_found(&self) -> bool { - self.region_not_found.is_some() - } - - // Param is passed by value, moved - pub fn set_region_not_found(&mut self, v: RegionNotFound) { - self.region_not_found = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_not_found(&mut self) -> &mut RegionNotFound { - if self.region_not_found.is_none() { - self.region_not_found.set_default(); - } - self.region_not_found.as_mut().unwrap() - } - - // Take field - pub fn take_region_not_found(&mut self) -> RegionNotFound { - self.region_not_found.take().unwrap_or_else(|| RegionNotFound::new()) - } - - pub fn get_region_not_found(&self) -> &RegionNotFound { - self.region_not_found.as_ref().unwrap_or_else(|| RegionNotFound::default_instance()) - } - - fn get_region_not_found_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_not_found - } - - fn mut_region_not_found_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_not_found - } - - // optional .errorpb.KeyNotInRegion key_not_in_region = 4; - - pub fn clear_key_not_in_region(&mut self) { - self.key_not_in_region.clear(); - } - - pub fn has_key_not_in_region(&self) -> bool { - self.key_not_in_region.is_some() - } - - // Param is passed by value, moved - pub fn set_key_not_in_region(&mut self, v: KeyNotInRegion) { - self.key_not_in_region = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key_not_in_region(&mut self) -> &mut KeyNotInRegion { - if self.key_not_in_region.is_none() { - self.key_not_in_region.set_default(); - } - self.key_not_in_region.as_mut().unwrap() - } - - // Take field - pub fn take_key_not_in_region(&mut self) -> KeyNotInRegion { - self.key_not_in_region.take().unwrap_or_else(|| KeyNotInRegion::new()) - } - - pub fn get_key_not_in_region(&self) -> &KeyNotInRegion { - self.key_not_in_region.as_ref().unwrap_or_else(|| KeyNotInRegion::default_instance()) - } - - fn get_key_not_in_region_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.key_not_in_region - } - - fn mut_key_not_in_region_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.key_not_in_region - } - - // optional .errorpb.StaleEpoch stale_epoch = 5; - - pub fn clear_stale_epoch(&mut self) { - self.stale_epoch.clear(); - } - - pub fn has_stale_epoch(&self) -> bool { - self.stale_epoch.is_some() - } - - // Param is passed by value, moved - pub fn set_stale_epoch(&mut self, v: StaleEpoch) { - self.stale_epoch = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_stale_epoch(&mut self) -> &mut StaleEpoch { - if self.stale_epoch.is_none() { - self.stale_epoch.set_default(); - } - self.stale_epoch.as_mut().unwrap() - } - - // Take field - pub fn take_stale_epoch(&mut self) -> StaleEpoch { - self.stale_epoch.take().unwrap_or_else(|| StaleEpoch::new()) - } - - pub fn get_stale_epoch(&self) -> &StaleEpoch { - self.stale_epoch.as_ref().unwrap_or_else(|| StaleEpoch::default_instance()) - } - - fn get_stale_epoch_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.stale_epoch - } - - fn mut_stale_epoch_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.stale_epoch - } - - // optional .errorpb.ServerIsBusy server_is_busy = 6; - - pub fn clear_server_is_busy(&mut self) { - self.server_is_busy.clear(); - } - - pub fn has_server_is_busy(&self) -> bool { - self.server_is_busy.is_some() - } - - // Param is passed by value, moved - pub fn set_server_is_busy(&mut self, v: ServerIsBusy) { - self.server_is_busy = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_server_is_busy(&mut self) -> &mut ServerIsBusy { - if self.server_is_busy.is_none() { - self.server_is_busy.set_default(); - } - self.server_is_busy.as_mut().unwrap() - } - - // Take field - pub fn take_server_is_busy(&mut self) -> ServerIsBusy { - self.server_is_busy.take().unwrap_or_else(|| ServerIsBusy::new()) - } - - pub fn get_server_is_busy(&self) -> &ServerIsBusy { - self.server_is_busy.as_ref().unwrap_or_else(|| ServerIsBusy::default_instance()) - } - - fn get_server_is_busy_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.server_is_busy - } - - fn mut_server_is_busy_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.server_is_busy - } - - // optional .errorpb.StaleCommand stale_command = 7; - - pub fn clear_stale_command(&mut self) { - self.stale_command.clear(); - } - - pub fn has_stale_command(&self) -> bool { - self.stale_command.is_some() - } - - // Param is passed by value, moved - pub fn set_stale_command(&mut self, v: StaleCommand) { - self.stale_command = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_stale_command(&mut self) -> &mut StaleCommand { - if self.stale_command.is_none() { - self.stale_command.set_default(); - } - self.stale_command.as_mut().unwrap() - } - - // Take field - pub fn take_stale_command(&mut self) -> StaleCommand { - self.stale_command.take().unwrap_or_else(|| StaleCommand::new()) - } - - pub fn get_stale_command(&self) -> &StaleCommand { - self.stale_command.as_ref().unwrap_or_else(|| StaleCommand::default_instance()) - } - - fn get_stale_command_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.stale_command - } - - fn mut_stale_command_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.stale_command - } - - // optional .errorpb.StoreNotMatch store_not_match = 8; - - pub fn clear_store_not_match(&mut self) { - self.store_not_match.clear(); - } - - pub fn has_store_not_match(&self) -> bool { - self.store_not_match.is_some() - } - - // Param is passed by value, moved - pub fn set_store_not_match(&mut self, v: StoreNotMatch) { - self.store_not_match = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_store_not_match(&mut self) -> &mut StoreNotMatch { - if self.store_not_match.is_none() { - self.store_not_match.set_default(); - } - self.store_not_match.as_mut().unwrap() - } - - // Take field - pub fn take_store_not_match(&mut self) -> StoreNotMatch { - self.store_not_match.take().unwrap_or_else(|| StoreNotMatch::new()) - } - - pub fn get_store_not_match(&self) -> &StoreNotMatch { - self.store_not_match.as_ref().unwrap_or_else(|| StoreNotMatch::default_instance()) - } - - fn get_store_not_match_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.store_not_match - } - - fn mut_store_not_match_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.store_not_match - } - - // optional .errorpb.RaftEntryTooLarge raft_entry_too_large = 9; - - pub fn clear_raft_entry_too_large(&mut self) { - self.raft_entry_too_large.clear(); - } - - pub fn has_raft_entry_too_large(&self) -> bool { - self.raft_entry_too_large.is_some() - } - - // Param is passed by value, moved - pub fn set_raft_entry_too_large(&mut self, v: RaftEntryTooLarge) { - self.raft_entry_too_large = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_raft_entry_too_large(&mut self) -> &mut RaftEntryTooLarge { - if self.raft_entry_too_large.is_none() { - self.raft_entry_too_large.set_default(); - } - self.raft_entry_too_large.as_mut().unwrap() - } - - // Take field - pub fn take_raft_entry_too_large(&mut self) -> RaftEntryTooLarge { - self.raft_entry_too_large.take().unwrap_or_else(|| RaftEntryTooLarge::new()) - } - - pub fn get_raft_entry_too_large(&self) -> &RaftEntryTooLarge { - self.raft_entry_too_large.as_ref().unwrap_or_else(|| RaftEntryTooLarge::default_instance()) - } - - fn get_raft_entry_too_large_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.raft_entry_too_large - } - - fn mut_raft_entry_too_large_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.raft_entry_too_large - } -} - -impl ::protobuf::Message for Error { - fn is_initialized(&self) -> bool { - for v in &self.not_leader { - if !v.is_initialized() { - return false; - } - }; - for v in &self.region_not_found { - if !v.is_initialized() { - return false; - } - }; - for v in &self.key_not_in_region { - if !v.is_initialized() { - return false; - } - }; - for v in &self.stale_epoch { - if !v.is_initialized() { - return false; - } - }; - for v in &self.server_is_busy { - if !v.is_initialized() { - return false; - } - }; - for v in &self.stale_command { - if !v.is_initialized() { - return false; - } - }; - for v in &self.store_not_match { - if !v.is_initialized() { - return false; - } - }; - for v in &self.raft_entry_too_large { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.message)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.not_leader)?; - }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_not_found)?; - }, - 4 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.key_not_in_region)?; - }, - 5 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.stale_epoch)?; - }, - 6 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.server_is_busy)?; - }, - 7 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.stale_command)?; - }, - 8 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.store_not_match)?; - }, - 9 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.raft_entry_too_large)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.message.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(ref v) = self.not_leader.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.region_not_found.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.key_not_in_region.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.stale_epoch.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.server_is_busy.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.stale_command.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.store_not_match.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.raft_entry_too_large.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.message.as_ref() { - os.write_string(1, &v)?; - } - if let Some(ref v) = self.not_leader.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.region_not_found.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.key_not_in_region.as_ref() { - os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.stale_epoch.as_ref() { - os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.server_is_busy.as_ref() { - os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.stale_command.as_ref() { - os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.store_not_match.as_ref() { - os.write_tag(8, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.raft_entry_too_large.as_ref() { - os.write_tag(9, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Error { - fn new() -> Error { - Error::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "message", - Error::get_message_for_reflect, - Error::mut_message_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "not_leader", - Error::get_not_leader_for_reflect, - Error::mut_not_leader_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_not_found", - Error::get_region_not_found_for_reflect, - Error::mut_region_not_found_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "key_not_in_region", - Error::get_key_not_in_region_for_reflect, - Error::mut_key_not_in_region_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "stale_epoch", - Error::get_stale_epoch_for_reflect, - Error::mut_stale_epoch_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "server_is_busy", - Error::get_server_is_busy_for_reflect, - Error::mut_server_is_busy_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "stale_command", - Error::get_stale_command_for_reflect, - Error::mut_stale_command_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "store_not_match", - Error::get_store_not_match_for_reflect, - Error::mut_store_not_match_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "raft_entry_too_large", - Error::get_raft_entry_too_large_for_reflect, - Error::mut_raft_entry_too_large_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Error", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Error { - fn clear(&mut self) { - self.clear_message(); - self.clear_not_leader(); - self.clear_region_not_found(); - self.clear_key_not_in_region(); - self.clear_stale_epoch(); - self.clear_server_is_busy(); - self.clear_stale_command(); - self.clear_store_not_match(); - self.clear_raft_entry_too_large(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Error { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Error { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\rerrorpb.proto\x12\x07errorpb\x1a\x0cmetapb.proto\x1a\x14gogoproto/go\ - go.proto\"N\n\tNotLeader\x12\x1b\n\tregion_id\x18\x01\x20\x01(\x04R\x08r\ - egionId\x12$\n\x06leader\x18\x02\x20\x01(\x0b2\x0c.metapb.PeerR\x06leade\ - r\"\x0f\n\rStoreNotMatch\"-\n\x0eRegionNotFound\x12\x1b\n\tregion_id\x18\ - \x01\x20\x01(\x04R\x08regionId\"u\n\x0eKeyNotInRegion\x12\x10\n\x03key\ - \x18\x01\x20\x01(\x0cR\x03key\x12\x1b\n\tregion_id\x18\x02\x20\x01(\x04R\ - \x08regionId\x12\x1b\n\tstart_key\x18\x03\x20\x01(\x0cR\x08startKey\x12\ - \x17\n\x07end_key\x18\x04\x20\x01(\x0cR\x06endKey\"=\n\nStaleEpoch\x12/\ - \n\x0bnew_regions\x18\x01\x20\x03(\x0b2\x0e.metapb.RegionR\nnewRegions\"\ - &\n\x0cServerIsBusy\x12\x16\n\x06reason\x18\x01\x20\x01(\tR\x06reason\"\ - \x0e\n\x0cStaleCommand\"O\n\x11RaftEntryTooLarge\x12\x1b\n\tregion_id\ - \x18\x01\x20\x01(\x04R\x08regionId\x12\x1d\n\nentry_size\x18\x02\x20\x01\ - (\x04R\tentrySize\"\x97\x04\n\x05Error\x12\x18\n\x07message\x18\x01\x20\ - \x01(\tR\x07message\x121\n\nnot_leader\x18\x02\x20\x01(\x0b2\x12.errorpb\ - .NotLeaderR\tnotLeader\x12A\n\x10region_not_found\x18\x03\x20\x01(\x0b2\ - \x17.errorpb.RegionNotFoundR\x0eregionNotFound\x12B\n\x11key_not_in_regi\ - on\x18\x04\x20\x01(\x0b2\x17.errorpb.KeyNotInRegionR\x0ekeyNotInRegion\ - \x124\n\x0bstale_epoch\x18\x05\x20\x01(\x0b2\x13.errorpb.StaleEpochR\nst\ - aleEpoch\x12;\n\x0eserver_is_busy\x18\x06\x20\x01(\x0b2\x15.errorpb.Serv\ - erIsBusyR\x0cserverIsBusy\x12:\n\rstale_command\x18\x07\x20\x01(\x0b2\ - \x15.errorpb.StaleCommandR\x0cstaleCommand\x12>\n\x0fstore_not_match\x18\ - \x08\x20\x01(\x0b2\x16.errorpb.StoreNotMatchR\rstoreNotMatch\x12K\n\x14r\ - aft_entry_too_large\x18\t\x20\x01(\x0b2\x1a.errorpb.RaftEntryTooLargeR\ - \x11raftEntryTooLargeB&\n\x18com.pingcap.tikv.kvproto\xe0\xe2\x1e\x01\ - \xd0\xe2\x1e\x01\xc8\xe2\x1e\x01J\xb6\x0f\n\x06\x12\x04\0\09\x01\n\x08\n\ - \x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x01\x08\x0f\n\t\n\x02\ - \x03\0\x12\x03\x03\x07\x15\n\t\n\x02\x03\x01\x12\x03\x04\x07\x1d\n\x08\n\ - \x01\x08\x12\x03\x06\0(\n\x0b\n\x04\x08\xe7\x07\0\x12\x03\x06\0(\n\x0c\n\ - \x05\x08\xe7\x07\0\x02\x12\x03\x06\x07\x20\n\r\n\x06\x08\xe7\x07\0\x02\0\ - \x12\x03\x06\x07\x20\n\x0e\n\x07\x08\xe7\x07\0\x02\0\x01\x12\x03\x06\x08\ - \x1f\n\x0c\n\x05\x08\xe7\x07\0\x03\x12\x03\x06#'\n\x08\n\x01\x08\x12\x03\ - \x07\0$\n\x0b\n\x04\x08\xe7\x07\x01\x12\x03\x07\0$\n\x0c\n\x05\x08\xe7\ - \x07\x01\x02\x12\x03\x07\x07\x1c\n\r\n\x06\x08\xe7\x07\x01\x02\0\x12\x03\ - \x07\x07\x1c\n\x0e\n\x07\x08\xe7\x07\x01\x02\0\x01\x12\x03\x07\x08\x1b\n\ - \x0c\n\x05\x08\xe7\x07\x01\x03\x12\x03\x07\x1f#\n\x08\n\x01\x08\x12\x03\ - \x08\0*\n\x0b\n\x04\x08\xe7\x07\x02\x12\x03\x08\0*\n\x0c\n\x05\x08\xe7\ - \x07\x02\x02\x12\x03\x08\x07\"\n\r\n\x06\x08\xe7\x07\x02\x02\0\x12\x03\ - \x08\x07\"\n\x0e\n\x07\x08\xe7\x07\x02\x02\0\x01\x12\x03\x08\x08!\n\x0c\ - \n\x05\x08\xe7\x07\x02\x03\x12\x03\x08%)\n\x08\n\x01\x08\x12\x03\n\01\n\ - \x0b\n\x04\x08\xe7\x07\x03\x12\x03\n\01\n\x0c\n\x05\x08\xe7\x07\x03\x02\ - \x12\x03\n\x07\x13\n\r\n\x06\x08\xe7\x07\x03\x02\0\x12\x03\n\x07\x13\n\ - \x0e\n\x07\x08\xe7\x07\x03\x02\0\x01\x12\x03\n\x07\x13\n\x0c\n\x05\x08\ - \xe7\x07\x03\x07\x12\x03\n\x160\n\n\n\x02\x04\0\x12\x04\x0c\0\x0f\x01\n\ - \n\n\x03\x04\0\x01\x12\x03\x0c\x08\x11\n\x0b\n\x04\x04\0\x02\0\x12\x03\r\ - \x04'\n\x0c\n\x05\x04\0\x02\0\x04\x12\x03\r\x04\x0c\n\x0c\n\x05\x04\0\ - \x02\0\x05\x12\x03\r\r\x13\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\r\x14\x1d\ - \n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\r%&\n\x0b\n\x04\x04\0\x02\x01\x12\ - \x03\x0e\x04'\n\x0c\n\x05\x04\0\x02\x01\x04\x12\x03\x0e\x04\x0c\n\x0c\n\ - \x05\x04\0\x02\x01\x06\x12\x03\x0e\r\x18\n\x0c\n\x05\x04\0\x02\x01\x01\ - \x12\x03\x0e\x19\x1f\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x0e%&\n\n\n\ - \x02\x04\x01\x12\x04\x11\0\x12\x01\n\n\n\x03\x04\x01\x01\x12\x03\x11\x08\ - \x15\n\n\n\x02\x04\x02\x12\x04\x14\0\x16\x01\n\n\n\x03\x04\x02\x01\x12\ - \x03\x14\x08\x16\n\x0b\n\x04\x04\x02\x02\0\x12\x03\x15\x04\"\n\x0c\n\x05\ - \x04\x02\x02\0\x04\x12\x03\x15\x04\x0c\n\x0c\n\x05\x04\x02\x02\0\x05\x12\ - \x03\x15\r\x13\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\x15\x14\x1d\n\x0c\n\ - \x05\x04\x02\x02\0\x03\x12\x03\x15\x20!\n\n\n\x02\x04\x03\x12\x04\x18\0\ - \x1d\x01\n\n\n\x03\x04\x03\x01\x12\x03\x18\x08\x16\n\x0b\n\x04\x04\x03\ - \x02\0\x12\x03\x19\x04#\n\x0c\n\x05\x04\x03\x02\0\x04\x12\x03\x19\x04\ - \x0c\n\x0c\n\x05\x04\x03\x02\0\x05\x12\x03\x19\r\x12\n\x0c\n\x05\x04\x03\ - \x02\0\x01\x12\x03\x19\x13\x16\n\x0c\n\x05\x04\x03\x02\0\x03\x12\x03\x19\ - !\"\n\x0b\n\x04\x04\x03\x02\x01\x12\x03\x1a\x04#\n\x0c\n\x05\x04\x03\x02\ - \x01\x04\x12\x03\x1a\x04\x0c\n\x0c\n\x05\x04\x03\x02\x01\x05\x12\x03\x1a\ - \r\x13\n\x0c\n\x05\x04\x03\x02\x01\x01\x12\x03\x1a\x14\x1d\n\x0c\n\x05\ - \x04\x03\x02\x01\x03\x12\x03\x1a!\"\n\x0b\n\x04\x04\x03\x02\x02\x12\x03\ - \x1b\x04#\n\x0c\n\x05\x04\x03\x02\x02\x04\x12\x03\x1b\x04\x0c\n\x0c\n\ - \x05\x04\x03\x02\x02\x05\x12\x03\x1b\r\x12\n\x0c\n\x05\x04\x03\x02\x02\ - \x01\x12\x03\x1b\x13\x1c\n\x0c\n\x05\x04\x03\x02\x02\x03\x12\x03\x1b!\"\ - \n\x0b\n\x04\x04\x03\x02\x03\x12\x03\x1c\x04#\n\x0c\n\x05\x04\x03\x02\ - \x03\x04\x12\x03\x1c\x04\x0c\n\x0c\n\x05\x04\x03\x02\x03\x05\x12\x03\x1c\ - \r\x12\n\x0c\n\x05\x04\x03\x02\x03\x01\x12\x03\x1c\x13\x1a\n\x0c\n\x05\ - \x04\x03\x02\x03\x03\x12\x03\x1c!\"\n\n\n\x02\x04\x04\x12\x04\x1f\0!\x01\ - \n\n\n\x03\x04\x04\x01\x12\x03\x1f\x08\x12\n\x0b\n\x04\x04\x04\x02\0\x12\ - \x03\x20\x04+\n\x0c\n\x05\x04\x04\x02\0\x04\x12\x03\x20\x04\x0c\n\x0c\n\ - \x05\x04\x04\x02\0\x06\x12\x03\x20\r\x1a\n\x0c\n\x05\x04\x04\x02\0\x01\ - \x12\x03\x20\x1b&\n\x0c\n\x05\x04\x04\x02\0\x03\x12\x03\x20)*\n\n\n\x02\ - \x04\x05\x12\x04#\0%\x01\n\n\n\x03\x04\x05\x01\x12\x03#\x08\x14\n\x0b\n\ - \x04\x04\x05\x02\0\x12\x03$\x04\x1f\n\x0c\n\x05\x04\x05\x02\0\x04\x12\ - \x03$\x04\x0c\n\x0c\n\x05\x04\x05\x02\0\x05\x12\x03$\r\x13\n\x0c\n\x05\ - \x04\x05\x02\0\x01\x12\x03$\x14\x1a\n\x0c\n\x05\x04\x05\x02\0\x03\x12\ - \x03$\x1d\x1e\n\n\n\x02\x04\x06\x12\x04'\0(\x01\n\n\n\x03\x04\x06\x01\ - \x12\x03'\x08\x14\n\n\n\x02\x04\x07\x12\x04*\0-\x01\n\n\n\x03\x04\x07\ - \x01\x12\x03*\x08\x19\n\x0b\n\x04\x04\x07\x02\0\x12\x03+\x04#\n\x0c\n\ - \x05\x04\x07\x02\0\x04\x12\x03+\x04\x0c\n\x0c\n\x05\x04\x07\x02\0\x05\ - \x12\x03+\r\x13\n\x0c\n\x05\x04\x07\x02\0\x01\x12\x03+\x14\x1d\n\x0c\n\ - \x05\x04\x07\x02\0\x03\x12\x03+!\"\n\x0b\n\x04\x04\x07\x02\x01\x12\x03,\ - \x04#\n\x0c\n\x05\x04\x07\x02\x01\x04\x12\x03,\x04\x0c\n\x0c\n\x05\x04\ - \x07\x02\x01\x05\x12\x03,\r\x13\n\x0c\n\x05\x04\x07\x02\x01\x01\x12\x03,\ - \x14\x1e\n\x0c\n\x05\x04\x07\x02\x01\x03\x12\x03,!\"\n\n\n\x02\x04\x08\ - \x12\x04/\09\x01\n\n\n\x03\x04\x08\x01\x12\x03/\x08\r\n\x0b\n\x04\x04\ - \x08\x02\0\x12\x030\x048\n\x0c\n\x05\x04\x08\x02\0\x04\x12\x030\x04\x0c\ - \n\x0c\n\x05\x04\x08\x02\0\x05\x12\x030\r\x13\n\x0c\n\x05\x04\x08\x02\0\ - \x01\x12\x030\x14\x1b\n\x0c\n\x05\x04\x08\x02\0\x03\x12\x03067\n\x0b\n\ - \x04\x04\x08\x02\x01\x12\x031\x048\n\x0c\n\x05\x04\x08\x02\x01\x04\x12\ - \x031\x04\x0c\n\x0c\n\x05\x04\x08\x02\x01\x06\x12\x031\r\x16\n\x0c\n\x05\ - \x04\x08\x02\x01\x01\x12\x031\x17!\n\x0c\n\x05\x04\x08\x02\x01\x03\x12\ - \x03167\n\x0b\n\x04\x04\x08\x02\x02\x12\x032\x048\n\x0c\n\x05\x04\x08\ - \x02\x02\x04\x12\x032\x04\x0c\n\x0c\n\x05\x04\x08\x02\x02\x06\x12\x032\r\ - \x1b\n\x0c\n\x05\x04\x08\x02\x02\x01\x12\x032\x1c,\n\x0c\n\x05\x04\x08\ - \x02\x02\x03\x12\x03267\n\x0b\n\x04\x04\x08\x02\x03\x12\x033\x048\n\x0c\ - \n\x05\x04\x08\x02\x03\x04\x12\x033\x04\x0c\n\x0c\n\x05\x04\x08\x02\x03\ - \x06\x12\x033\r\x1b\n\x0c\n\x05\x04\x08\x02\x03\x01\x12\x033\x1c-\n\x0c\ - \n\x05\x04\x08\x02\x03\x03\x12\x03367\n\x0b\n\x04\x04\x08\x02\x04\x12\ - \x034\x048\n\x0c\n\x05\x04\x08\x02\x04\x04\x12\x034\x04\x0c\n\x0c\n\x05\ - \x04\x08\x02\x04\x06\x12\x034\r\x17\n\x0c\n\x05\x04\x08\x02\x04\x01\x12\ - \x034\x18#\n\x0c\n\x05\x04\x08\x02\x04\x03\x12\x03467\n\x0b\n\x04\x04\ - \x08\x02\x05\x12\x035\x048\n\x0c\n\x05\x04\x08\x02\x05\x04\x12\x035\x04\ - \x0c\n\x0c\n\x05\x04\x08\x02\x05\x06\x12\x035\r\x19\n\x0c\n\x05\x04\x08\ - \x02\x05\x01\x12\x035\x1a(\n\x0c\n\x05\x04\x08\x02\x05\x03\x12\x03567\n\ - \x0b\n\x04\x04\x08\x02\x06\x12\x036\x048\n\x0c\n\x05\x04\x08\x02\x06\x04\ - \x12\x036\x04\x0c\n\x0c\n\x05\x04\x08\x02\x06\x06\x12\x036\r\x19\n\x0c\n\ - \x05\x04\x08\x02\x06\x01\x12\x036\x1a'\n\x0c\n\x05\x04\x08\x02\x06\x03\ - \x12\x03667\n\x0b\n\x04\x04\x08\x02\x07\x12\x037\x048\n\x0c\n\x05\x04\ - \x08\x02\x07\x04\x12\x037\x04\x0c\n\x0c\n\x05\x04\x08\x02\x07\x06\x12\ - \x037\r\x1a\n\x0c\n\x05\x04\x08\x02\x07\x01\x12\x037\x1b*\n\x0c\n\x05\ - \x04\x08\x02\x07\x03\x12\x03767\n\x0b\n\x04\x04\x08\x02\x08\x12\x038\x04\ - 8\n\x0c\n\x05\x04\x08\x02\x08\x04\x12\x038\x04\x0c\n\x0c\n\x05\x04\x08\ - \x02\x08\x06\x12\x038\r\x1e\n\x0c\n\x05\x04\x08\x02\x08\x01\x12\x038\x1f\ - 3\n\x0c\n\x05\x04\x08\x02\x08\x03\x12\x03867\ -"; - -static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/src/kvrpcpb.rs b/_vendor/src/github.com/pingcap/kvproto/src/kvrpcpb.rs deleted file mode 100644 index 131f66d65dc..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/src/kvrpcpb.rs +++ /dev/null @@ -1,13213 +0,0 @@ -// This file is generated. Do not edit -// @generated - -// https://github.com/Manishearth/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] - -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; - -#[derive(PartialEq,Clone,Default)] -pub struct LockInfo { - // message fields - pub primary_lock: ::std::vec::Vec, - pub lock_version: u64, - pub key: ::std::vec::Vec, - pub lock_ttl: u64, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for LockInfo {} - -impl LockInfo { - pub fn new() -> LockInfo { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static LockInfo { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const LockInfo, - }; - unsafe { - instance.get(LockInfo::new) - } - } - - // bytes primary_lock = 1; - - pub fn clear_primary_lock(&mut self) { - self.primary_lock.clear(); - } - - // Param is passed by value, moved - pub fn set_primary_lock(&mut self, v: ::std::vec::Vec) { - self.primary_lock = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_primary_lock(&mut self) -> &mut ::std::vec::Vec { - &mut self.primary_lock - } - - // Take field - pub fn take_primary_lock(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.primary_lock, ::std::vec::Vec::new()) - } - - pub fn get_primary_lock(&self) -> &[u8] { - &self.primary_lock - } - - fn get_primary_lock_for_reflect(&self) -> &::std::vec::Vec { - &self.primary_lock - } - - fn mut_primary_lock_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.primary_lock - } - - // uint64 lock_version = 2; - - pub fn clear_lock_version(&mut self) { - self.lock_version = 0; - } - - // Param is passed by value, moved - pub fn set_lock_version(&mut self, v: u64) { - self.lock_version = v; - } - - pub fn get_lock_version(&self) -> u64 { - self.lock_version - } - - fn get_lock_version_for_reflect(&self) -> &u64 { - &self.lock_version - } - - fn mut_lock_version_for_reflect(&mut self) -> &mut u64 { - &mut self.lock_version - } - - // bytes key = 3; - - pub fn clear_key(&mut self) { - self.key.clear(); - } - - // Param is passed by value, moved - pub fn set_key(&mut self, v: ::std::vec::Vec) { - self.key = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { - &mut self.key - } - - // Take field - pub fn take_key(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) - } - - pub fn get_key(&self) -> &[u8] { - &self.key - } - - fn get_key_for_reflect(&self) -> &::std::vec::Vec { - &self.key - } - - fn mut_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.key - } - - // uint64 lock_ttl = 4; - - pub fn clear_lock_ttl(&mut self) { - self.lock_ttl = 0; - } - - // Param is passed by value, moved - pub fn set_lock_ttl(&mut self, v: u64) { - self.lock_ttl = v; - } - - pub fn get_lock_ttl(&self) -> u64 { - self.lock_ttl - } - - fn get_lock_ttl_for_reflect(&self) -> &u64 { - &self.lock_ttl - } - - fn mut_lock_ttl_for_reflect(&mut self) -> &mut u64 { - &mut self.lock_ttl - } -} - -impl ::protobuf::Message for LockInfo { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.primary_lock)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.lock_version = tmp; - }, - 3 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; - }, - 4 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.lock_ttl = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.primary_lock.is_empty() { - my_size += ::protobuf::rt::bytes_size(1, &self.primary_lock); - } - if self.lock_version != 0 { - my_size += ::protobuf::rt::value_size(2, self.lock_version, ::protobuf::wire_format::WireTypeVarint); - } - if !self.key.is_empty() { - my_size += ::protobuf::rt::bytes_size(3, &self.key); - } - if self.lock_ttl != 0 { - my_size += ::protobuf::rt::value_size(4, self.lock_ttl, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.primary_lock.is_empty() { - os.write_bytes(1, &self.primary_lock)?; - } - if self.lock_version != 0 { - os.write_uint64(2, self.lock_version)?; - } - if !self.key.is_empty() { - os.write_bytes(3, &self.key)?; - } - if self.lock_ttl != 0 { - os.write_uint64(4, self.lock_ttl)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for LockInfo { - fn new() -> LockInfo { - LockInfo::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "primary_lock", - LockInfo::get_primary_lock_for_reflect, - LockInfo::mut_primary_lock_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "lock_version", - LockInfo::get_lock_version_for_reflect, - LockInfo::mut_lock_version_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "key", - LockInfo::get_key_for_reflect, - LockInfo::mut_key_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "lock_ttl", - LockInfo::get_lock_ttl_for_reflect, - LockInfo::mut_lock_ttl_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "LockInfo", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for LockInfo { - fn clear(&mut self) { - self.clear_primary_lock(); - self.clear_lock_version(); - self.clear_key(); - self.clear_lock_ttl(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for LockInfo { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for LockInfo { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct KeyError { - // message fields - pub locked: ::protobuf::SingularPtrField, - pub retryable: ::std::string::String, - pub abort: ::std::string::String, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for KeyError {} - -impl KeyError { - pub fn new() -> KeyError { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static KeyError { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const KeyError, - }; - unsafe { - instance.get(KeyError::new) - } - } - - // .kvrpcpb.LockInfo locked = 1; - - pub fn clear_locked(&mut self) { - self.locked.clear(); - } - - pub fn has_locked(&self) -> bool { - self.locked.is_some() - } - - // Param is passed by value, moved - pub fn set_locked(&mut self, v: LockInfo) { - self.locked = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_locked(&mut self) -> &mut LockInfo { - if self.locked.is_none() { - self.locked.set_default(); - } - self.locked.as_mut().unwrap() - } - - // Take field - pub fn take_locked(&mut self) -> LockInfo { - self.locked.take().unwrap_or_else(|| LockInfo::new()) - } - - pub fn get_locked(&self) -> &LockInfo { - self.locked.as_ref().unwrap_or_else(|| LockInfo::default_instance()) - } - - fn get_locked_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.locked - } - - fn mut_locked_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.locked - } - - // string retryable = 2; - - pub fn clear_retryable(&mut self) { - self.retryable.clear(); - } - - // Param is passed by value, moved - pub fn set_retryable(&mut self, v: ::std::string::String) { - self.retryable = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_retryable(&mut self) -> &mut ::std::string::String { - &mut self.retryable - } - - // Take field - pub fn take_retryable(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.retryable, ::std::string::String::new()) - } - - pub fn get_retryable(&self) -> &str { - &self.retryable - } - - fn get_retryable_for_reflect(&self) -> &::std::string::String { - &self.retryable - } - - fn mut_retryable_for_reflect(&mut self) -> &mut ::std::string::String { - &mut self.retryable - } - - // string abort = 3; - - pub fn clear_abort(&mut self) { - self.abort.clear(); - } - - // Param is passed by value, moved - pub fn set_abort(&mut self, v: ::std::string::String) { - self.abort = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_abort(&mut self) -> &mut ::std::string::String { - &mut self.abort - } - - // Take field - pub fn take_abort(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.abort, ::std::string::String::new()) - } - - pub fn get_abort(&self) -> &str { - &self.abort - } - - fn get_abort_for_reflect(&self) -> &::std::string::String { - &self.abort - } - - fn mut_abort_for_reflect(&mut self) -> &mut ::std::string::String { - &mut self.abort - } -} - -impl ::protobuf::Message for KeyError { - fn is_initialized(&self) -> bool { - for v in &self.locked { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.locked)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.retryable)?; - }, - 3 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.abort)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.locked.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.retryable.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.retryable); - } - if !self.abort.is_empty() { - my_size += ::protobuf::rt::string_size(3, &self.abort); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.locked.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.retryable.is_empty() { - os.write_string(2, &self.retryable)?; - } - if !self.abort.is_empty() { - os.write_string(3, &self.abort)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for KeyError { - fn new() -> KeyError { - KeyError::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "locked", - KeyError::get_locked_for_reflect, - KeyError::mut_locked_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "retryable", - KeyError::get_retryable_for_reflect, - KeyError::mut_retryable_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "abort", - KeyError::get_abort_for_reflect, - KeyError::mut_abort_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "KeyError", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for KeyError { - fn clear(&mut self) { - self.clear_locked(); - self.clear_retryable(); - self.clear_abort(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for KeyError { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for KeyError { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Context { - // message fields - pub region_id: u64, - pub region_epoch: ::protobuf::SingularPtrField, - pub peer: ::protobuf::SingularPtrField, - pub term: u64, - pub priority: CommandPri, - pub isolation_level: IsolationLevel, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Context {} - -impl Context { - pub fn new() -> Context { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Context { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Context, - }; - unsafe { - instance.get(Context::new) - } - } - - // uint64 region_id = 1; - - pub fn clear_region_id(&mut self) { - self.region_id = 0; - } - - // Param is passed by value, moved - pub fn set_region_id(&mut self, v: u64) { - self.region_id = v; - } - - pub fn get_region_id(&self) -> u64 { - self.region_id - } - - fn get_region_id_for_reflect(&self) -> &u64 { - &self.region_id - } - - fn mut_region_id_for_reflect(&mut self) -> &mut u64 { - &mut self.region_id - } - - // .metapb.RegionEpoch region_epoch = 2; - - pub fn clear_region_epoch(&mut self) { - self.region_epoch.clear(); - } - - pub fn has_region_epoch(&self) -> bool { - self.region_epoch.is_some() - } - - // Param is passed by value, moved - pub fn set_region_epoch(&mut self, v: super::metapb::RegionEpoch) { - self.region_epoch = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_epoch(&mut self) -> &mut super::metapb::RegionEpoch { - if self.region_epoch.is_none() { - self.region_epoch.set_default(); - } - self.region_epoch.as_mut().unwrap() - } - - // Take field - pub fn take_region_epoch(&mut self) -> super::metapb::RegionEpoch { - self.region_epoch.take().unwrap_or_else(|| super::metapb::RegionEpoch::new()) - } - - pub fn get_region_epoch(&self) -> &super::metapb::RegionEpoch { - self.region_epoch.as_ref().unwrap_or_else(|| super::metapb::RegionEpoch::default_instance()) - } - - fn get_region_epoch_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_epoch - } - - fn mut_region_epoch_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_epoch - } - - // .metapb.Peer peer = 3; - - pub fn clear_peer(&mut self) { - self.peer.clear(); - } - - pub fn has_peer(&self) -> bool { - self.peer.is_some() - } - - // Param is passed by value, moved - pub fn set_peer(&mut self, v: super::metapb::Peer) { - self.peer = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_peer(&mut self) -> &mut super::metapb::Peer { - if self.peer.is_none() { - self.peer.set_default(); - } - self.peer.as_mut().unwrap() - } - - // Take field - pub fn take_peer(&mut self) -> super::metapb::Peer { - self.peer.take().unwrap_or_else(|| super::metapb::Peer::new()) - } - - pub fn get_peer(&self) -> &super::metapb::Peer { - self.peer.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) - } - - fn get_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.peer - } - - fn mut_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.peer - } - - // uint64 term = 5; - - pub fn clear_term(&mut self) { - self.term = 0; - } - - // Param is passed by value, moved - pub fn set_term(&mut self, v: u64) { - self.term = v; - } - - pub fn get_term(&self) -> u64 { - self.term - } - - fn get_term_for_reflect(&self) -> &u64 { - &self.term - } - - fn mut_term_for_reflect(&mut self) -> &mut u64 { - &mut self.term - } - - // .kvrpcpb.CommandPri priority = 6; - - pub fn clear_priority(&mut self) { - self.priority = CommandPri::Normal; - } - - // Param is passed by value, moved - pub fn set_priority(&mut self, v: CommandPri) { - self.priority = v; - } - - pub fn get_priority(&self) -> CommandPri { - self.priority - } - - fn get_priority_for_reflect(&self) -> &CommandPri { - &self.priority - } - - fn mut_priority_for_reflect(&mut self) -> &mut CommandPri { - &mut self.priority - } - - // .kvrpcpb.IsolationLevel isolation_level = 7; - - pub fn clear_isolation_level(&mut self) { - self.isolation_level = IsolationLevel::SI; - } - - // Param is passed by value, moved - pub fn set_isolation_level(&mut self, v: IsolationLevel) { - self.isolation_level = v; - } - - pub fn get_isolation_level(&self) -> IsolationLevel { - self.isolation_level - } - - fn get_isolation_level_for_reflect(&self) -> &IsolationLevel { - &self.isolation_level - } - - fn mut_isolation_level_for_reflect(&mut self) -> &mut IsolationLevel { - &mut self.isolation_level - } -} - -impl ::protobuf::Message for Context { - fn is_initialized(&self) -> bool { - for v in &self.region_epoch { - if !v.is_initialized() { - return false; - } - }; - for v in &self.peer { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.region_id = tmp; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_epoch)?; - }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.peer)?; - }, - 5 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.term = tmp; - }, - 6 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.priority = tmp; - }, - 7 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.isolation_level = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if self.region_id != 0 { - my_size += ::protobuf::rt::value_size(1, self.region_id, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(ref v) = self.region_epoch.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.peer.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.term != 0 { - my_size += ::protobuf::rt::value_size(5, self.term, ::protobuf::wire_format::WireTypeVarint); - } - if self.priority != CommandPri::Normal { - my_size += ::protobuf::rt::enum_size(6, self.priority); - } - if self.isolation_level != IsolationLevel::SI { - my_size += ::protobuf::rt::enum_size(7, self.isolation_level); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if self.region_id != 0 { - os.write_uint64(1, self.region_id)?; - } - if let Some(ref v) = self.region_epoch.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.peer.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.term != 0 { - os.write_uint64(5, self.term)?; - } - if self.priority != CommandPri::Normal { - os.write_enum(6, self.priority.value())?; - } - if self.isolation_level != IsolationLevel::SI { - os.write_enum(7, self.isolation_level.value())?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Context { - fn new() -> Context { - Context::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "region_id", - Context::get_region_id_for_reflect, - Context::mut_region_id_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_epoch", - Context::get_region_epoch_for_reflect, - Context::mut_region_epoch_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "peer", - Context::get_peer_for_reflect, - Context::mut_peer_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "term", - Context::get_term_for_reflect, - Context::mut_term_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "priority", - Context::get_priority_for_reflect, - Context::mut_priority_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "isolation_level", - Context::get_isolation_level_for_reflect, - Context::mut_isolation_level_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Context", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Context { - fn clear(&mut self) { - self.clear_region_id(); - self.clear_region_epoch(); - self.clear_peer(); - self.clear_term(); - self.clear_priority(); - self.clear_isolation_level(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Context { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Context { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct GetRequest { - // message fields - pub context: ::protobuf::SingularPtrField, - pub key: ::std::vec::Vec, - pub version: u64, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for GetRequest {} - -impl GetRequest { - pub fn new() -> GetRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static GetRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const GetRequest, - }; - unsafe { - instance.get(GetRequest::new) - } - } - - // .kvrpcpb.Context context = 1; - - pub fn clear_context(&mut self) { - self.context.clear(); - } - - pub fn has_context(&self) -> bool { - self.context.is_some() - } - - // Param is passed by value, moved - pub fn set_context(&mut self, v: Context) { - self.context = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_context(&mut self) -> &mut Context { - if self.context.is_none() { - self.context.set_default(); - } - self.context.as_mut().unwrap() - } - - // Take field - pub fn take_context(&mut self) -> Context { - self.context.take().unwrap_or_else(|| Context::new()) - } - - pub fn get_context(&self) -> &Context { - self.context.as_ref().unwrap_or_else(|| Context::default_instance()) - } - - fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.context - } - - fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.context - } - - // bytes key = 2; - - pub fn clear_key(&mut self) { - self.key.clear(); - } - - // Param is passed by value, moved - pub fn set_key(&mut self, v: ::std::vec::Vec) { - self.key = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { - &mut self.key - } - - // Take field - pub fn take_key(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) - } - - pub fn get_key(&self) -> &[u8] { - &self.key - } - - fn get_key_for_reflect(&self) -> &::std::vec::Vec { - &self.key - } - - fn mut_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.key - } - - // uint64 version = 3; - - pub fn clear_version(&mut self) { - self.version = 0; - } - - // Param is passed by value, moved - pub fn set_version(&mut self, v: u64) { - self.version = v; - } - - pub fn get_version(&self) -> u64 { - self.version - } - - fn get_version_for_reflect(&self) -> &u64 { - &self.version - } - - fn mut_version_for_reflect(&mut self) -> &mut u64 { - &mut self.version - } -} - -impl ::protobuf::Message for GetRequest { - fn is_initialized(&self) -> bool { - for v in &self.context { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.version = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.context.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.key.is_empty() { - my_size += ::protobuf::rt::bytes_size(2, &self.key); - } - if self.version != 0 { - my_size += ::protobuf::rt::value_size(3, self.version, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.context.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.key.is_empty() { - os.write_bytes(2, &self.key)?; - } - if self.version != 0 { - os.write_uint64(3, self.version)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for GetRequest { - fn new() -> GetRequest { - GetRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "context", - GetRequest::get_context_for_reflect, - GetRequest::mut_context_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "key", - GetRequest::get_key_for_reflect, - GetRequest::mut_key_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "version", - GetRequest::get_version_for_reflect, - GetRequest::mut_version_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "GetRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for GetRequest { - fn clear(&mut self) { - self.clear_context(); - self.clear_key(); - self.clear_version(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for GetRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct GetResponse { - // message fields - pub region_error: ::protobuf::SingularPtrField, - pub error: ::protobuf::SingularPtrField, - pub value: ::std::vec::Vec, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for GetResponse {} - -impl GetResponse { - pub fn new() -> GetResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static GetResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const GetResponse, - }; - unsafe { - instance.get(GetResponse::new) - } - } - - // .errorpb.Error region_error = 1; - - pub fn clear_region_error(&mut self) { - self.region_error.clear(); - } - - pub fn has_region_error(&self) -> bool { - self.region_error.is_some() - } - - // Param is passed by value, moved - pub fn set_region_error(&mut self, v: super::errorpb::Error) { - self.region_error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { - if self.region_error.is_none() { - self.region_error.set_default(); - } - self.region_error.as_mut().unwrap() - } - - // Take field - pub fn take_region_error(&mut self) -> super::errorpb::Error { - self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) - } - - pub fn get_region_error(&self) -> &super::errorpb::Error { - self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) - } - - fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_error - } - - fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_error - } - - // .kvrpcpb.KeyError error = 2; - - pub fn clear_error(&mut self) { - self.error.clear(); - } - - pub fn has_error(&self) -> bool { - self.error.is_some() - } - - // Param is passed by value, moved - pub fn set_error(&mut self, v: KeyError) { - self.error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_error(&mut self) -> &mut KeyError { - if self.error.is_none() { - self.error.set_default(); - } - self.error.as_mut().unwrap() - } - - // Take field - pub fn take_error(&mut self) -> KeyError { - self.error.take().unwrap_or_else(|| KeyError::new()) - } - - pub fn get_error(&self) -> &KeyError { - self.error.as_ref().unwrap_or_else(|| KeyError::default_instance()) - } - - fn get_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.error - } - - fn mut_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.error - } - - // bytes value = 3; - - pub fn clear_value(&mut self) { - self.value.clear(); - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: ::std::vec::Vec) { - self.value = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { - &mut self.value - } - - // Take field - pub fn take_value(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.value, ::std::vec::Vec::new()) - } - - pub fn get_value(&self) -> &[u8] { - &self.value - } - - fn get_value_for_reflect(&self) -> &::std::vec::Vec { - &self.value - } - - fn mut_value_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.value - } -} - -impl ::protobuf::Message for GetResponse { - fn is_initialized(&self) -> bool { - for v in &self.region_error { - if !v.is_initialized() { - return false; - } - }; - for v in &self.error { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.error)?; - }, - 3 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.value)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.region_error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.value.is_empty() { - my_size += ::protobuf::rt::bytes_size(3, &self.value); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.region_error.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.error.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.value.is_empty() { - os.write_bytes(3, &self.value)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for GetResponse { - fn new() -> GetResponse { - GetResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_error", - GetResponse::get_region_error_for_reflect, - GetResponse::mut_region_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "error", - GetResponse::get_error_for_reflect, - GetResponse::mut_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "value", - GetResponse::get_value_for_reflect, - GetResponse::mut_value_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "GetResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for GetResponse { - fn clear(&mut self) { - self.clear_region_error(); - self.clear_error(); - self.clear_value(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for GetResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ScanRequest { - // message fields - pub context: ::protobuf::SingularPtrField, - pub start_key: ::std::vec::Vec, - pub limit: u32, - pub version: u64, - pub key_only: bool, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for ScanRequest {} - -impl ScanRequest { - pub fn new() -> ScanRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static ScanRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ScanRequest, - }; - unsafe { - instance.get(ScanRequest::new) - } - } - - // .kvrpcpb.Context context = 1; - - pub fn clear_context(&mut self) { - self.context.clear(); - } - - pub fn has_context(&self) -> bool { - self.context.is_some() - } - - // Param is passed by value, moved - pub fn set_context(&mut self, v: Context) { - self.context = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_context(&mut self) -> &mut Context { - if self.context.is_none() { - self.context.set_default(); - } - self.context.as_mut().unwrap() - } - - // Take field - pub fn take_context(&mut self) -> Context { - self.context.take().unwrap_or_else(|| Context::new()) - } - - pub fn get_context(&self) -> &Context { - self.context.as_ref().unwrap_or_else(|| Context::default_instance()) - } - - fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.context - } - - fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.context - } - - // bytes start_key = 2; - - pub fn clear_start_key(&mut self) { - self.start_key.clear(); - } - - // Param is passed by value, moved - pub fn set_start_key(&mut self, v: ::std::vec::Vec) { - self.start_key = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_start_key(&mut self) -> &mut ::std::vec::Vec { - &mut self.start_key - } - - // Take field - pub fn take_start_key(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.start_key, ::std::vec::Vec::new()) - } - - pub fn get_start_key(&self) -> &[u8] { - &self.start_key - } - - fn get_start_key_for_reflect(&self) -> &::std::vec::Vec { - &self.start_key - } - - fn mut_start_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.start_key - } - - // uint32 limit = 3; - - pub fn clear_limit(&mut self) { - self.limit = 0; - } - - // Param is passed by value, moved - pub fn set_limit(&mut self, v: u32) { - self.limit = v; - } - - pub fn get_limit(&self) -> u32 { - self.limit - } - - fn get_limit_for_reflect(&self) -> &u32 { - &self.limit - } - - fn mut_limit_for_reflect(&mut self) -> &mut u32 { - &mut self.limit - } - - // uint64 version = 4; - - pub fn clear_version(&mut self) { - self.version = 0; - } - - // Param is passed by value, moved - pub fn set_version(&mut self, v: u64) { - self.version = v; - } - - pub fn get_version(&self) -> u64 { - self.version - } - - fn get_version_for_reflect(&self) -> &u64 { - &self.version - } - - fn mut_version_for_reflect(&mut self) -> &mut u64 { - &mut self.version - } - - // bool key_only = 5; - - pub fn clear_key_only(&mut self) { - self.key_only = false; - } - - // Param is passed by value, moved - pub fn set_key_only(&mut self, v: bool) { - self.key_only = v; - } - - pub fn get_key_only(&self) -> bool { - self.key_only - } - - fn get_key_only_for_reflect(&self) -> &bool { - &self.key_only - } - - fn mut_key_only_for_reflect(&mut self) -> &mut bool { - &mut self.key_only - } -} - -impl ::protobuf::Message for ScanRequest { - fn is_initialized(&self) -> bool { - for v in &self.context { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.start_key)?; - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint32()?; - self.limit = tmp; - }, - 4 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.version = tmp; - }, - 5 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_bool()?; - self.key_only = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.context.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.start_key.is_empty() { - my_size += ::protobuf::rt::bytes_size(2, &self.start_key); - } - if self.limit != 0 { - my_size += ::protobuf::rt::value_size(3, self.limit, ::protobuf::wire_format::WireTypeVarint); - } - if self.version != 0 { - my_size += ::protobuf::rt::value_size(4, self.version, ::protobuf::wire_format::WireTypeVarint); - } - if self.key_only != false { - my_size += 2; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.context.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.start_key.is_empty() { - os.write_bytes(2, &self.start_key)?; - } - if self.limit != 0 { - os.write_uint32(3, self.limit)?; - } - if self.version != 0 { - os.write_uint64(4, self.version)?; - } - if self.key_only != false { - os.write_bool(5, self.key_only)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for ScanRequest { - fn new() -> ScanRequest { - ScanRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "context", - ScanRequest::get_context_for_reflect, - ScanRequest::mut_context_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "start_key", - ScanRequest::get_start_key_for_reflect, - ScanRequest::mut_start_key_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( - "limit", - ScanRequest::get_limit_for_reflect, - ScanRequest::mut_limit_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "version", - ScanRequest::get_version_for_reflect, - ScanRequest::mut_version_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( - "key_only", - ScanRequest::get_key_only_for_reflect, - ScanRequest::mut_key_only_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "ScanRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for ScanRequest { - fn clear(&mut self) { - self.clear_context(); - self.clear_start_key(); - self.clear_limit(); - self.clear_version(); - self.clear_key_only(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ScanRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ScanRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct KvPair { - // message fields - pub error: ::protobuf::SingularPtrField, - pub key: ::std::vec::Vec, - pub value: ::std::vec::Vec, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for KvPair {} - -impl KvPair { - pub fn new() -> KvPair { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static KvPair { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const KvPair, - }; - unsafe { - instance.get(KvPair::new) - } - } - - // .kvrpcpb.KeyError error = 1; - - pub fn clear_error(&mut self) { - self.error.clear(); - } - - pub fn has_error(&self) -> bool { - self.error.is_some() - } - - // Param is passed by value, moved - pub fn set_error(&mut self, v: KeyError) { - self.error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_error(&mut self) -> &mut KeyError { - if self.error.is_none() { - self.error.set_default(); - } - self.error.as_mut().unwrap() - } - - // Take field - pub fn take_error(&mut self) -> KeyError { - self.error.take().unwrap_or_else(|| KeyError::new()) - } - - pub fn get_error(&self) -> &KeyError { - self.error.as_ref().unwrap_or_else(|| KeyError::default_instance()) - } - - fn get_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.error - } - - fn mut_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.error - } - - // bytes key = 2; - - pub fn clear_key(&mut self) { - self.key.clear(); - } - - // Param is passed by value, moved - pub fn set_key(&mut self, v: ::std::vec::Vec) { - self.key = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { - &mut self.key - } - - // Take field - pub fn take_key(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) - } - - pub fn get_key(&self) -> &[u8] { - &self.key - } - - fn get_key_for_reflect(&self) -> &::std::vec::Vec { - &self.key - } - - fn mut_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.key - } - - // bytes value = 3; - - pub fn clear_value(&mut self) { - self.value.clear(); - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: ::std::vec::Vec) { - self.value = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { - &mut self.value - } - - // Take field - pub fn take_value(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.value, ::std::vec::Vec::new()) - } - - pub fn get_value(&self) -> &[u8] { - &self.value - } - - fn get_value_for_reflect(&self) -> &::std::vec::Vec { - &self.value - } - - fn mut_value_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.value - } -} - -impl ::protobuf::Message for KvPair { - fn is_initialized(&self) -> bool { - for v in &self.error { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.error)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; - }, - 3 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.value)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.key.is_empty() { - my_size += ::protobuf::rt::bytes_size(2, &self.key); - } - if !self.value.is_empty() { - my_size += ::protobuf::rt::bytes_size(3, &self.value); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.error.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.key.is_empty() { - os.write_bytes(2, &self.key)?; - } - if !self.value.is_empty() { - os.write_bytes(3, &self.value)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for KvPair { - fn new() -> KvPair { - KvPair::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "error", - KvPair::get_error_for_reflect, - KvPair::mut_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "key", - KvPair::get_key_for_reflect, - KvPair::mut_key_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "value", - KvPair::get_value_for_reflect, - KvPair::mut_value_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "KvPair", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for KvPair { - fn clear(&mut self) { - self.clear_error(); - self.clear_key(); - self.clear_value(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for KvPair { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for KvPair { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ScanResponse { - // message fields - pub region_error: ::protobuf::SingularPtrField, - pub pairs: ::protobuf::RepeatedField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for ScanResponse {} - -impl ScanResponse { - pub fn new() -> ScanResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static ScanResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ScanResponse, - }; - unsafe { - instance.get(ScanResponse::new) - } - } - - // .errorpb.Error region_error = 1; - - pub fn clear_region_error(&mut self) { - self.region_error.clear(); - } - - pub fn has_region_error(&self) -> bool { - self.region_error.is_some() - } - - // Param is passed by value, moved - pub fn set_region_error(&mut self, v: super::errorpb::Error) { - self.region_error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { - if self.region_error.is_none() { - self.region_error.set_default(); - } - self.region_error.as_mut().unwrap() - } - - // Take field - pub fn take_region_error(&mut self) -> super::errorpb::Error { - self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) - } - - pub fn get_region_error(&self) -> &super::errorpb::Error { - self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) - } - - fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_error - } - - fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_error - } - - // repeated .kvrpcpb.KvPair pairs = 2; - - pub fn clear_pairs(&mut self) { - self.pairs.clear(); - } - - // Param is passed by value, moved - pub fn set_pairs(&mut self, v: ::protobuf::RepeatedField) { - self.pairs = v; - } - - // Mutable pointer to the field. - pub fn mut_pairs(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.pairs - } - - // Take field - pub fn take_pairs(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.pairs, ::protobuf::RepeatedField::new()) - } - - pub fn get_pairs(&self) -> &[KvPair] { - &self.pairs - } - - fn get_pairs_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.pairs - } - - fn mut_pairs_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.pairs - } -} - -impl ::protobuf::Message for ScanResponse { - fn is_initialized(&self) -> bool { - for v in &self.region_error { - if !v.is_initialized() { - return false; - } - }; - for v in &self.pairs { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; - }, - 2 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.pairs)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.region_error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - for value in &self.pairs { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.region_error.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - for v in &self.pairs { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for ScanResponse { - fn new() -> ScanResponse { - ScanResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_error", - ScanResponse::get_region_error_for_reflect, - ScanResponse::mut_region_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "pairs", - ScanResponse::get_pairs_for_reflect, - ScanResponse::mut_pairs_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "ScanResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for ScanResponse { - fn clear(&mut self) { - self.clear_region_error(); - self.clear_pairs(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ScanResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ScanResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Mutation { - // message fields - pub op: Op, - pub key: ::std::vec::Vec, - pub value: ::std::vec::Vec, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Mutation {} - -impl Mutation { - pub fn new() -> Mutation { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Mutation { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Mutation, - }; - unsafe { - instance.get(Mutation::new) - } - } - - // .kvrpcpb.Op op = 1; - - pub fn clear_op(&mut self) { - self.op = Op::Put; - } - - // Param is passed by value, moved - pub fn set_op(&mut self, v: Op) { - self.op = v; - } - - pub fn get_op(&self) -> Op { - self.op - } - - fn get_op_for_reflect(&self) -> &Op { - &self.op - } - - fn mut_op_for_reflect(&mut self) -> &mut Op { - &mut self.op - } - - // bytes key = 2; - - pub fn clear_key(&mut self) { - self.key.clear(); - } - - // Param is passed by value, moved - pub fn set_key(&mut self, v: ::std::vec::Vec) { - self.key = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { - &mut self.key - } - - // Take field - pub fn take_key(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) - } - - pub fn get_key(&self) -> &[u8] { - &self.key - } - - fn get_key_for_reflect(&self) -> &::std::vec::Vec { - &self.key - } - - fn mut_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.key - } - - // bytes value = 3; - - pub fn clear_value(&mut self) { - self.value.clear(); - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: ::std::vec::Vec) { - self.value = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { - &mut self.value - } - - // Take field - pub fn take_value(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.value, ::std::vec::Vec::new()) - } - - pub fn get_value(&self) -> &[u8] { - &self.value - } - - fn get_value_for_reflect(&self) -> &::std::vec::Vec { - &self.value - } - - fn mut_value_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.value - } -} - -impl ::protobuf::Message for Mutation { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.op = tmp; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; - }, - 3 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.value)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if self.op != Op::Put { - my_size += ::protobuf::rt::enum_size(1, self.op); - } - if !self.key.is_empty() { - my_size += ::protobuf::rt::bytes_size(2, &self.key); - } - if !self.value.is_empty() { - my_size += ::protobuf::rt::bytes_size(3, &self.value); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if self.op != Op::Put { - os.write_enum(1, self.op.value())?; - } - if !self.key.is_empty() { - os.write_bytes(2, &self.key)?; - } - if !self.value.is_empty() { - os.write_bytes(3, &self.value)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Mutation { - fn new() -> Mutation { - Mutation::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "op", - Mutation::get_op_for_reflect, - Mutation::mut_op_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "key", - Mutation::get_key_for_reflect, - Mutation::mut_key_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "value", - Mutation::get_value_for_reflect, - Mutation::mut_value_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Mutation", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Mutation { - fn clear(&mut self) { - self.clear_op(); - self.clear_key(); - self.clear_value(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Mutation { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Mutation { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct PrewriteRequest { - // message fields - pub context: ::protobuf::SingularPtrField, - pub mutations: ::protobuf::RepeatedField, - pub primary_lock: ::std::vec::Vec, - pub start_version: u64, - pub lock_ttl: u64, - pub skip_constraint_check: bool, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for PrewriteRequest {} - -impl PrewriteRequest { - pub fn new() -> PrewriteRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static PrewriteRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const PrewriteRequest, - }; - unsafe { - instance.get(PrewriteRequest::new) - } - } - - // .kvrpcpb.Context context = 1; - - pub fn clear_context(&mut self) { - self.context.clear(); - } - - pub fn has_context(&self) -> bool { - self.context.is_some() - } - - // Param is passed by value, moved - pub fn set_context(&mut self, v: Context) { - self.context = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_context(&mut self) -> &mut Context { - if self.context.is_none() { - self.context.set_default(); - } - self.context.as_mut().unwrap() - } - - // Take field - pub fn take_context(&mut self) -> Context { - self.context.take().unwrap_or_else(|| Context::new()) - } - - pub fn get_context(&self) -> &Context { - self.context.as_ref().unwrap_or_else(|| Context::default_instance()) - } - - fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.context - } - - fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.context - } - - // repeated .kvrpcpb.Mutation mutations = 2; - - pub fn clear_mutations(&mut self) { - self.mutations.clear(); - } - - // Param is passed by value, moved - pub fn set_mutations(&mut self, v: ::protobuf::RepeatedField) { - self.mutations = v; - } - - // Mutable pointer to the field. - pub fn mut_mutations(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.mutations - } - - // Take field - pub fn take_mutations(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.mutations, ::protobuf::RepeatedField::new()) - } - - pub fn get_mutations(&self) -> &[Mutation] { - &self.mutations - } - - fn get_mutations_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.mutations - } - - fn mut_mutations_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.mutations - } - - // bytes primary_lock = 3; - - pub fn clear_primary_lock(&mut self) { - self.primary_lock.clear(); - } - - // Param is passed by value, moved - pub fn set_primary_lock(&mut self, v: ::std::vec::Vec) { - self.primary_lock = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_primary_lock(&mut self) -> &mut ::std::vec::Vec { - &mut self.primary_lock - } - - // Take field - pub fn take_primary_lock(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.primary_lock, ::std::vec::Vec::new()) - } - - pub fn get_primary_lock(&self) -> &[u8] { - &self.primary_lock - } - - fn get_primary_lock_for_reflect(&self) -> &::std::vec::Vec { - &self.primary_lock - } - - fn mut_primary_lock_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.primary_lock - } - - // uint64 start_version = 4; - - pub fn clear_start_version(&mut self) { - self.start_version = 0; - } - - // Param is passed by value, moved - pub fn set_start_version(&mut self, v: u64) { - self.start_version = v; - } - - pub fn get_start_version(&self) -> u64 { - self.start_version - } - - fn get_start_version_for_reflect(&self) -> &u64 { - &self.start_version - } - - fn mut_start_version_for_reflect(&mut self) -> &mut u64 { - &mut self.start_version - } - - // uint64 lock_ttl = 5; - - pub fn clear_lock_ttl(&mut self) { - self.lock_ttl = 0; - } - - // Param is passed by value, moved - pub fn set_lock_ttl(&mut self, v: u64) { - self.lock_ttl = v; - } - - pub fn get_lock_ttl(&self) -> u64 { - self.lock_ttl - } - - fn get_lock_ttl_for_reflect(&self) -> &u64 { - &self.lock_ttl - } - - fn mut_lock_ttl_for_reflect(&mut self) -> &mut u64 { - &mut self.lock_ttl - } - - // bool skip_constraint_check = 6; - - pub fn clear_skip_constraint_check(&mut self) { - self.skip_constraint_check = false; - } - - // Param is passed by value, moved - pub fn set_skip_constraint_check(&mut self, v: bool) { - self.skip_constraint_check = v; - } - - pub fn get_skip_constraint_check(&self) -> bool { - self.skip_constraint_check - } - - fn get_skip_constraint_check_for_reflect(&self) -> &bool { - &self.skip_constraint_check - } - - fn mut_skip_constraint_check_for_reflect(&mut self) -> &mut bool { - &mut self.skip_constraint_check - } -} - -impl ::protobuf::Message for PrewriteRequest { - fn is_initialized(&self) -> bool { - for v in &self.context { - if !v.is_initialized() { - return false; - } - }; - for v in &self.mutations { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; - }, - 2 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.mutations)?; - }, - 3 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.primary_lock)?; - }, - 4 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.start_version = tmp; - }, - 5 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.lock_ttl = tmp; - }, - 6 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_bool()?; - self.skip_constraint_check = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.context.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - for value in &self.mutations { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - if !self.primary_lock.is_empty() { - my_size += ::protobuf::rt::bytes_size(3, &self.primary_lock); - } - if self.start_version != 0 { - my_size += ::protobuf::rt::value_size(4, self.start_version, ::protobuf::wire_format::WireTypeVarint); - } - if self.lock_ttl != 0 { - my_size += ::protobuf::rt::value_size(5, self.lock_ttl, ::protobuf::wire_format::WireTypeVarint); - } - if self.skip_constraint_check != false { - my_size += 2; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.context.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - for v in &self.mutations { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - if !self.primary_lock.is_empty() { - os.write_bytes(3, &self.primary_lock)?; - } - if self.start_version != 0 { - os.write_uint64(4, self.start_version)?; - } - if self.lock_ttl != 0 { - os.write_uint64(5, self.lock_ttl)?; - } - if self.skip_constraint_check != false { - os.write_bool(6, self.skip_constraint_check)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for PrewriteRequest { - fn new() -> PrewriteRequest { - PrewriteRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "context", - PrewriteRequest::get_context_for_reflect, - PrewriteRequest::mut_context_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "mutations", - PrewriteRequest::get_mutations_for_reflect, - PrewriteRequest::mut_mutations_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "primary_lock", - PrewriteRequest::get_primary_lock_for_reflect, - PrewriteRequest::mut_primary_lock_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "start_version", - PrewriteRequest::get_start_version_for_reflect, - PrewriteRequest::mut_start_version_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "lock_ttl", - PrewriteRequest::get_lock_ttl_for_reflect, - PrewriteRequest::mut_lock_ttl_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( - "skip_constraint_check", - PrewriteRequest::get_skip_constraint_check_for_reflect, - PrewriteRequest::mut_skip_constraint_check_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "PrewriteRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for PrewriteRequest { - fn clear(&mut self) { - self.clear_context(); - self.clear_mutations(); - self.clear_primary_lock(); - self.clear_start_version(); - self.clear_lock_ttl(); - self.clear_skip_constraint_check(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for PrewriteRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for PrewriteRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct PrewriteResponse { - // message fields - pub region_error: ::protobuf::SingularPtrField, - pub errors: ::protobuf::RepeatedField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for PrewriteResponse {} - -impl PrewriteResponse { - pub fn new() -> PrewriteResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static PrewriteResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const PrewriteResponse, - }; - unsafe { - instance.get(PrewriteResponse::new) - } - } - - // .errorpb.Error region_error = 1; - - pub fn clear_region_error(&mut self) { - self.region_error.clear(); - } - - pub fn has_region_error(&self) -> bool { - self.region_error.is_some() - } - - // Param is passed by value, moved - pub fn set_region_error(&mut self, v: super::errorpb::Error) { - self.region_error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { - if self.region_error.is_none() { - self.region_error.set_default(); - } - self.region_error.as_mut().unwrap() - } - - // Take field - pub fn take_region_error(&mut self) -> super::errorpb::Error { - self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) - } - - pub fn get_region_error(&self) -> &super::errorpb::Error { - self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) - } - - fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_error - } - - fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_error - } - - // repeated .kvrpcpb.KeyError errors = 2; - - pub fn clear_errors(&mut self) { - self.errors.clear(); - } - - // Param is passed by value, moved - pub fn set_errors(&mut self, v: ::protobuf::RepeatedField) { - self.errors = v; - } - - // Mutable pointer to the field. - pub fn mut_errors(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.errors - } - - // Take field - pub fn take_errors(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.errors, ::protobuf::RepeatedField::new()) - } - - pub fn get_errors(&self) -> &[KeyError] { - &self.errors - } - - fn get_errors_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.errors - } - - fn mut_errors_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.errors - } -} - -impl ::protobuf::Message for PrewriteResponse { - fn is_initialized(&self) -> bool { - for v in &self.region_error { - if !v.is_initialized() { - return false; - } - }; - for v in &self.errors { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; - }, - 2 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.errors)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.region_error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - for value in &self.errors { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.region_error.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - for v in &self.errors { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for PrewriteResponse { - fn new() -> PrewriteResponse { - PrewriteResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_error", - PrewriteResponse::get_region_error_for_reflect, - PrewriteResponse::mut_region_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "errors", - PrewriteResponse::get_errors_for_reflect, - PrewriteResponse::mut_errors_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "PrewriteResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for PrewriteResponse { - fn clear(&mut self) { - self.clear_region_error(); - self.clear_errors(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for PrewriteResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for PrewriteResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct CommitRequest { - // message fields - pub context: ::protobuf::SingularPtrField, - pub start_version: u64, - pub keys: ::protobuf::RepeatedField<::std::vec::Vec>, - pub commit_version: u64, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for CommitRequest {} - -impl CommitRequest { - pub fn new() -> CommitRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static CommitRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const CommitRequest, - }; - unsafe { - instance.get(CommitRequest::new) - } - } - - // .kvrpcpb.Context context = 1; - - pub fn clear_context(&mut self) { - self.context.clear(); - } - - pub fn has_context(&self) -> bool { - self.context.is_some() - } - - // Param is passed by value, moved - pub fn set_context(&mut self, v: Context) { - self.context = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_context(&mut self) -> &mut Context { - if self.context.is_none() { - self.context.set_default(); - } - self.context.as_mut().unwrap() - } - - // Take field - pub fn take_context(&mut self) -> Context { - self.context.take().unwrap_or_else(|| Context::new()) - } - - pub fn get_context(&self) -> &Context { - self.context.as_ref().unwrap_or_else(|| Context::default_instance()) - } - - fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.context - } - - fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.context - } - - // uint64 start_version = 2; - - pub fn clear_start_version(&mut self) { - self.start_version = 0; - } - - // Param is passed by value, moved - pub fn set_start_version(&mut self, v: u64) { - self.start_version = v; - } - - pub fn get_start_version(&self) -> u64 { - self.start_version - } - - fn get_start_version_for_reflect(&self) -> &u64 { - &self.start_version - } - - fn mut_start_version_for_reflect(&mut self) -> &mut u64 { - &mut self.start_version - } - - // repeated bytes keys = 3; - - pub fn clear_keys(&mut self) { - self.keys.clear(); - } - - // Param is passed by value, moved - pub fn set_keys(&mut self, v: ::protobuf::RepeatedField<::std::vec::Vec>) { - self.keys = v; - } - - // Mutable pointer to the field. - pub fn mut_keys(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { - &mut self.keys - } - - // Take field - pub fn take_keys(&mut self) -> ::protobuf::RepeatedField<::std::vec::Vec> { - ::std::mem::replace(&mut self.keys, ::protobuf::RepeatedField::new()) - } - - pub fn get_keys(&self) -> &[::std::vec::Vec] { - &self.keys - } - - fn get_keys_for_reflect(&self) -> &::protobuf::RepeatedField<::std::vec::Vec> { - &self.keys - } - - fn mut_keys_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { - &mut self.keys - } - - // uint64 commit_version = 4; - - pub fn clear_commit_version(&mut self) { - self.commit_version = 0; - } - - // Param is passed by value, moved - pub fn set_commit_version(&mut self, v: u64) { - self.commit_version = v; - } - - pub fn get_commit_version(&self) -> u64 { - self.commit_version - } - - fn get_commit_version_for_reflect(&self) -> &u64 { - &self.commit_version - } - - fn mut_commit_version_for_reflect(&mut self) -> &mut u64 { - &mut self.commit_version - } -} - -impl ::protobuf::Message for CommitRequest { - fn is_initialized(&self) -> bool { - for v in &self.context { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.start_version = tmp; - }, - 3 => { - ::protobuf::rt::read_repeated_bytes_into(wire_type, is, &mut self.keys)?; - }, - 4 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.commit_version = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.context.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.start_version != 0 { - my_size += ::protobuf::rt::value_size(2, self.start_version, ::protobuf::wire_format::WireTypeVarint); - } - for value in &self.keys { - my_size += ::protobuf::rt::bytes_size(3, &value); - }; - if self.commit_version != 0 { - my_size += ::protobuf::rt::value_size(4, self.commit_version, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.context.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.start_version != 0 { - os.write_uint64(2, self.start_version)?; - } - for v in &self.keys { - os.write_bytes(3, &v)?; - }; - if self.commit_version != 0 { - os.write_uint64(4, self.commit_version)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for CommitRequest { - fn new() -> CommitRequest { - CommitRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "context", - CommitRequest::get_context_for_reflect, - CommitRequest::mut_context_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "start_version", - CommitRequest::get_start_version_for_reflect, - CommitRequest::mut_start_version_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "keys", - CommitRequest::get_keys_for_reflect, - CommitRequest::mut_keys_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "commit_version", - CommitRequest::get_commit_version_for_reflect, - CommitRequest::mut_commit_version_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "CommitRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for CommitRequest { - fn clear(&mut self) { - self.clear_context(); - self.clear_start_version(); - self.clear_keys(); - self.clear_commit_version(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for CommitRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CommitRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct CommitResponse { - // message fields - pub region_error: ::protobuf::SingularPtrField, - pub error: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for CommitResponse {} - -impl CommitResponse { - pub fn new() -> CommitResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static CommitResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const CommitResponse, - }; - unsafe { - instance.get(CommitResponse::new) - } - } - - // .errorpb.Error region_error = 1; - - pub fn clear_region_error(&mut self) { - self.region_error.clear(); - } - - pub fn has_region_error(&self) -> bool { - self.region_error.is_some() - } - - // Param is passed by value, moved - pub fn set_region_error(&mut self, v: super::errorpb::Error) { - self.region_error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { - if self.region_error.is_none() { - self.region_error.set_default(); - } - self.region_error.as_mut().unwrap() - } - - // Take field - pub fn take_region_error(&mut self) -> super::errorpb::Error { - self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) - } - - pub fn get_region_error(&self) -> &super::errorpb::Error { - self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) - } - - fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_error - } - - fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_error - } - - // .kvrpcpb.KeyError error = 2; - - pub fn clear_error(&mut self) { - self.error.clear(); - } - - pub fn has_error(&self) -> bool { - self.error.is_some() - } - - // Param is passed by value, moved - pub fn set_error(&mut self, v: KeyError) { - self.error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_error(&mut self) -> &mut KeyError { - if self.error.is_none() { - self.error.set_default(); - } - self.error.as_mut().unwrap() - } - - // Take field - pub fn take_error(&mut self) -> KeyError { - self.error.take().unwrap_or_else(|| KeyError::new()) - } - - pub fn get_error(&self) -> &KeyError { - self.error.as_ref().unwrap_or_else(|| KeyError::default_instance()) - } - - fn get_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.error - } - - fn mut_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.error - } -} - -impl ::protobuf::Message for CommitResponse { - fn is_initialized(&self) -> bool { - for v in &self.region_error { - if !v.is_initialized() { - return false; - } - }; - for v in &self.error { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.error)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.region_error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.region_error.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.error.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for CommitResponse { - fn new() -> CommitResponse { - CommitResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_error", - CommitResponse::get_region_error_for_reflect, - CommitResponse::mut_region_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "error", - CommitResponse::get_error_for_reflect, - CommitResponse::mut_error_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "CommitResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for CommitResponse { - fn clear(&mut self) { - self.clear_region_error(); - self.clear_error(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for CommitResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CommitResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ImportRequest { - // message fields - pub mutations: ::protobuf::RepeatedField, - pub commit_version: u64, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for ImportRequest {} - -impl ImportRequest { - pub fn new() -> ImportRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static ImportRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ImportRequest, - }; - unsafe { - instance.get(ImportRequest::new) - } - } - - // repeated .kvrpcpb.Mutation mutations = 1; - - pub fn clear_mutations(&mut self) { - self.mutations.clear(); - } - - // Param is passed by value, moved - pub fn set_mutations(&mut self, v: ::protobuf::RepeatedField) { - self.mutations = v; - } - - // Mutable pointer to the field. - pub fn mut_mutations(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.mutations - } - - // Take field - pub fn take_mutations(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.mutations, ::protobuf::RepeatedField::new()) - } - - pub fn get_mutations(&self) -> &[Mutation] { - &self.mutations - } - - fn get_mutations_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.mutations - } - - fn mut_mutations_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.mutations - } - - // uint64 commit_version = 2; - - pub fn clear_commit_version(&mut self) { - self.commit_version = 0; - } - - // Param is passed by value, moved - pub fn set_commit_version(&mut self, v: u64) { - self.commit_version = v; - } - - pub fn get_commit_version(&self) -> u64 { - self.commit_version - } - - fn get_commit_version_for_reflect(&self) -> &u64 { - &self.commit_version - } - - fn mut_commit_version_for_reflect(&mut self) -> &mut u64 { - &mut self.commit_version - } -} - -impl ::protobuf::Message for ImportRequest { - fn is_initialized(&self) -> bool { - for v in &self.mutations { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.mutations)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.commit_version = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - for value in &self.mutations { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - if self.commit_version != 0 { - my_size += ::protobuf::rt::value_size(2, self.commit_version, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - for v in &self.mutations { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - if self.commit_version != 0 { - os.write_uint64(2, self.commit_version)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for ImportRequest { - fn new() -> ImportRequest { - ImportRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "mutations", - ImportRequest::get_mutations_for_reflect, - ImportRequest::mut_mutations_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "commit_version", - ImportRequest::get_commit_version_for_reflect, - ImportRequest::mut_commit_version_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "ImportRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for ImportRequest { - fn clear(&mut self) { - self.clear_mutations(); - self.clear_commit_version(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ImportRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ImportRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ImportResponse { - // message fields - pub region_error: ::protobuf::SingularPtrField, - pub error: ::std::string::String, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for ImportResponse {} - -impl ImportResponse { - pub fn new() -> ImportResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static ImportResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ImportResponse, - }; - unsafe { - instance.get(ImportResponse::new) - } - } - - // .errorpb.Error region_error = 1; - - pub fn clear_region_error(&mut self) { - self.region_error.clear(); - } - - pub fn has_region_error(&self) -> bool { - self.region_error.is_some() - } - - // Param is passed by value, moved - pub fn set_region_error(&mut self, v: super::errorpb::Error) { - self.region_error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { - if self.region_error.is_none() { - self.region_error.set_default(); - } - self.region_error.as_mut().unwrap() - } - - // Take field - pub fn take_region_error(&mut self) -> super::errorpb::Error { - self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) - } - - pub fn get_region_error(&self) -> &super::errorpb::Error { - self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) - } - - fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_error - } - - fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_error - } - - // string error = 2; - - pub fn clear_error(&mut self) { - self.error.clear(); - } - - // Param is passed by value, moved - pub fn set_error(&mut self, v: ::std::string::String) { - self.error = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_error(&mut self) -> &mut ::std::string::String { - &mut self.error - } - - // Take field - pub fn take_error(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.error, ::std::string::String::new()) - } - - pub fn get_error(&self) -> &str { - &self.error - } - - fn get_error_for_reflect(&self) -> &::std::string::String { - &self.error - } - - fn mut_error_for_reflect(&mut self) -> &mut ::std::string::String { - &mut self.error - } -} - -impl ::protobuf::Message for ImportResponse { - fn is_initialized(&self) -> bool { - for v in &self.region_error { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.error)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.region_error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.error.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.error); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.region_error.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.error.is_empty() { - os.write_string(2, &self.error)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for ImportResponse { - fn new() -> ImportResponse { - ImportResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_error", - ImportResponse::get_region_error_for_reflect, - ImportResponse::mut_region_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "error", - ImportResponse::get_error_for_reflect, - ImportResponse::mut_error_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "ImportResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for ImportResponse { - fn clear(&mut self) { - self.clear_region_error(); - self.clear_error(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ImportResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ImportResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct BatchRollbackRequest { - // message fields - pub context: ::protobuf::SingularPtrField, - pub start_version: u64, - pub keys: ::protobuf::RepeatedField<::std::vec::Vec>, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for BatchRollbackRequest {} - -impl BatchRollbackRequest { - pub fn new() -> BatchRollbackRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static BatchRollbackRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const BatchRollbackRequest, - }; - unsafe { - instance.get(BatchRollbackRequest::new) - } - } - - // .kvrpcpb.Context context = 1; - - pub fn clear_context(&mut self) { - self.context.clear(); - } - - pub fn has_context(&self) -> bool { - self.context.is_some() - } - - // Param is passed by value, moved - pub fn set_context(&mut self, v: Context) { - self.context = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_context(&mut self) -> &mut Context { - if self.context.is_none() { - self.context.set_default(); - } - self.context.as_mut().unwrap() - } - - // Take field - pub fn take_context(&mut self) -> Context { - self.context.take().unwrap_or_else(|| Context::new()) - } - - pub fn get_context(&self) -> &Context { - self.context.as_ref().unwrap_or_else(|| Context::default_instance()) - } - - fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.context - } - - fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.context - } - - // uint64 start_version = 2; - - pub fn clear_start_version(&mut self) { - self.start_version = 0; - } - - // Param is passed by value, moved - pub fn set_start_version(&mut self, v: u64) { - self.start_version = v; - } - - pub fn get_start_version(&self) -> u64 { - self.start_version - } - - fn get_start_version_for_reflect(&self) -> &u64 { - &self.start_version - } - - fn mut_start_version_for_reflect(&mut self) -> &mut u64 { - &mut self.start_version - } - - // repeated bytes keys = 3; - - pub fn clear_keys(&mut self) { - self.keys.clear(); - } - - // Param is passed by value, moved - pub fn set_keys(&mut self, v: ::protobuf::RepeatedField<::std::vec::Vec>) { - self.keys = v; - } - - // Mutable pointer to the field. - pub fn mut_keys(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { - &mut self.keys - } - - // Take field - pub fn take_keys(&mut self) -> ::protobuf::RepeatedField<::std::vec::Vec> { - ::std::mem::replace(&mut self.keys, ::protobuf::RepeatedField::new()) - } - - pub fn get_keys(&self) -> &[::std::vec::Vec] { - &self.keys - } - - fn get_keys_for_reflect(&self) -> &::protobuf::RepeatedField<::std::vec::Vec> { - &self.keys - } - - fn mut_keys_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { - &mut self.keys - } -} - -impl ::protobuf::Message for BatchRollbackRequest { - fn is_initialized(&self) -> bool { - for v in &self.context { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.start_version = tmp; - }, - 3 => { - ::protobuf::rt::read_repeated_bytes_into(wire_type, is, &mut self.keys)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.context.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.start_version != 0 { - my_size += ::protobuf::rt::value_size(2, self.start_version, ::protobuf::wire_format::WireTypeVarint); - } - for value in &self.keys { - my_size += ::protobuf::rt::bytes_size(3, &value); - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.context.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.start_version != 0 { - os.write_uint64(2, self.start_version)?; - } - for v in &self.keys { - os.write_bytes(3, &v)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for BatchRollbackRequest { - fn new() -> BatchRollbackRequest { - BatchRollbackRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "context", - BatchRollbackRequest::get_context_for_reflect, - BatchRollbackRequest::mut_context_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "start_version", - BatchRollbackRequest::get_start_version_for_reflect, - BatchRollbackRequest::mut_start_version_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "keys", - BatchRollbackRequest::get_keys_for_reflect, - BatchRollbackRequest::mut_keys_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "BatchRollbackRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for BatchRollbackRequest { - fn clear(&mut self) { - self.clear_context(); - self.clear_start_version(); - self.clear_keys(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for BatchRollbackRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for BatchRollbackRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct BatchRollbackResponse { - // message fields - pub region_error: ::protobuf::SingularPtrField, - pub error: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for BatchRollbackResponse {} - -impl BatchRollbackResponse { - pub fn new() -> BatchRollbackResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static BatchRollbackResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const BatchRollbackResponse, - }; - unsafe { - instance.get(BatchRollbackResponse::new) - } - } - - // .errorpb.Error region_error = 1; - - pub fn clear_region_error(&mut self) { - self.region_error.clear(); - } - - pub fn has_region_error(&self) -> bool { - self.region_error.is_some() - } - - // Param is passed by value, moved - pub fn set_region_error(&mut self, v: super::errorpb::Error) { - self.region_error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { - if self.region_error.is_none() { - self.region_error.set_default(); - } - self.region_error.as_mut().unwrap() - } - - // Take field - pub fn take_region_error(&mut self) -> super::errorpb::Error { - self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) - } - - pub fn get_region_error(&self) -> &super::errorpb::Error { - self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) - } - - fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_error - } - - fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_error - } - - // .kvrpcpb.KeyError error = 2; - - pub fn clear_error(&mut self) { - self.error.clear(); - } - - pub fn has_error(&self) -> bool { - self.error.is_some() - } - - // Param is passed by value, moved - pub fn set_error(&mut self, v: KeyError) { - self.error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_error(&mut self) -> &mut KeyError { - if self.error.is_none() { - self.error.set_default(); - } - self.error.as_mut().unwrap() - } - - // Take field - pub fn take_error(&mut self) -> KeyError { - self.error.take().unwrap_or_else(|| KeyError::new()) - } - - pub fn get_error(&self) -> &KeyError { - self.error.as_ref().unwrap_or_else(|| KeyError::default_instance()) - } - - fn get_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.error - } - - fn mut_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.error - } -} - -impl ::protobuf::Message for BatchRollbackResponse { - fn is_initialized(&self) -> bool { - for v in &self.region_error { - if !v.is_initialized() { - return false; - } - }; - for v in &self.error { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.error)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.region_error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.region_error.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.error.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for BatchRollbackResponse { - fn new() -> BatchRollbackResponse { - BatchRollbackResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_error", - BatchRollbackResponse::get_region_error_for_reflect, - BatchRollbackResponse::mut_region_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "error", - BatchRollbackResponse::get_error_for_reflect, - BatchRollbackResponse::mut_error_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "BatchRollbackResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for BatchRollbackResponse { - fn clear(&mut self) { - self.clear_region_error(); - self.clear_error(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for BatchRollbackResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for BatchRollbackResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct CleanupRequest { - // message fields - pub context: ::protobuf::SingularPtrField, - pub key: ::std::vec::Vec, - pub start_version: u64, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for CleanupRequest {} - -impl CleanupRequest { - pub fn new() -> CleanupRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static CleanupRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const CleanupRequest, - }; - unsafe { - instance.get(CleanupRequest::new) - } - } - - // .kvrpcpb.Context context = 1; - - pub fn clear_context(&mut self) { - self.context.clear(); - } - - pub fn has_context(&self) -> bool { - self.context.is_some() - } - - // Param is passed by value, moved - pub fn set_context(&mut self, v: Context) { - self.context = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_context(&mut self) -> &mut Context { - if self.context.is_none() { - self.context.set_default(); - } - self.context.as_mut().unwrap() - } - - // Take field - pub fn take_context(&mut self) -> Context { - self.context.take().unwrap_or_else(|| Context::new()) - } - - pub fn get_context(&self) -> &Context { - self.context.as_ref().unwrap_or_else(|| Context::default_instance()) - } - - fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.context - } - - fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.context - } - - // bytes key = 2; - - pub fn clear_key(&mut self) { - self.key.clear(); - } - - // Param is passed by value, moved - pub fn set_key(&mut self, v: ::std::vec::Vec) { - self.key = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { - &mut self.key - } - - // Take field - pub fn take_key(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) - } - - pub fn get_key(&self) -> &[u8] { - &self.key - } - - fn get_key_for_reflect(&self) -> &::std::vec::Vec { - &self.key - } - - fn mut_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.key - } - - // uint64 start_version = 3; - - pub fn clear_start_version(&mut self) { - self.start_version = 0; - } - - // Param is passed by value, moved - pub fn set_start_version(&mut self, v: u64) { - self.start_version = v; - } - - pub fn get_start_version(&self) -> u64 { - self.start_version - } - - fn get_start_version_for_reflect(&self) -> &u64 { - &self.start_version - } - - fn mut_start_version_for_reflect(&mut self) -> &mut u64 { - &mut self.start_version - } -} - -impl ::protobuf::Message for CleanupRequest { - fn is_initialized(&self) -> bool { - for v in &self.context { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.start_version = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.context.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.key.is_empty() { - my_size += ::protobuf::rt::bytes_size(2, &self.key); - } - if self.start_version != 0 { - my_size += ::protobuf::rt::value_size(3, self.start_version, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.context.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.key.is_empty() { - os.write_bytes(2, &self.key)?; - } - if self.start_version != 0 { - os.write_uint64(3, self.start_version)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for CleanupRequest { - fn new() -> CleanupRequest { - CleanupRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "context", - CleanupRequest::get_context_for_reflect, - CleanupRequest::mut_context_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "key", - CleanupRequest::get_key_for_reflect, - CleanupRequest::mut_key_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "start_version", - CleanupRequest::get_start_version_for_reflect, - CleanupRequest::mut_start_version_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "CleanupRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for CleanupRequest { - fn clear(&mut self) { - self.clear_context(); - self.clear_key(); - self.clear_start_version(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for CleanupRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CleanupRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct CleanupResponse { - // message fields - pub region_error: ::protobuf::SingularPtrField, - pub error: ::protobuf::SingularPtrField, - pub commit_version: u64, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for CleanupResponse {} - -impl CleanupResponse { - pub fn new() -> CleanupResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static CleanupResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const CleanupResponse, - }; - unsafe { - instance.get(CleanupResponse::new) - } - } - - // .errorpb.Error region_error = 1; - - pub fn clear_region_error(&mut self) { - self.region_error.clear(); - } - - pub fn has_region_error(&self) -> bool { - self.region_error.is_some() - } - - // Param is passed by value, moved - pub fn set_region_error(&mut self, v: super::errorpb::Error) { - self.region_error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { - if self.region_error.is_none() { - self.region_error.set_default(); - } - self.region_error.as_mut().unwrap() - } - - // Take field - pub fn take_region_error(&mut self) -> super::errorpb::Error { - self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) - } - - pub fn get_region_error(&self) -> &super::errorpb::Error { - self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) - } - - fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_error - } - - fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_error - } - - // .kvrpcpb.KeyError error = 2; - - pub fn clear_error(&mut self) { - self.error.clear(); - } - - pub fn has_error(&self) -> bool { - self.error.is_some() - } - - // Param is passed by value, moved - pub fn set_error(&mut self, v: KeyError) { - self.error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_error(&mut self) -> &mut KeyError { - if self.error.is_none() { - self.error.set_default(); - } - self.error.as_mut().unwrap() - } - - // Take field - pub fn take_error(&mut self) -> KeyError { - self.error.take().unwrap_or_else(|| KeyError::new()) - } - - pub fn get_error(&self) -> &KeyError { - self.error.as_ref().unwrap_or_else(|| KeyError::default_instance()) - } - - fn get_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.error - } - - fn mut_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.error - } - - // uint64 commit_version = 3; - - pub fn clear_commit_version(&mut self) { - self.commit_version = 0; - } - - // Param is passed by value, moved - pub fn set_commit_version(&mut self, v: u64) { - self.commit_version = v; - } - - pub fn get_commit_version(&self) -> u64 { - self.commit_version - } - - fn get_commit_version_for_reflect(&self) -> &u64 { - &self.commit_version - } - - fn mut_commit_version_for_reflect(&mut self) -> &mut u64 { - &mut self.commit_version - } -} - -impl ::protobuf::Message for CleanupResponse { - fn is_initialized(&self) -> bool { - for v in &self.region_error { - if !v.is_initialized() { - return false; - } - }; - for v in &self.error { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.error)?; - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.commit_version = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.region_error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.commit_version != 0 { - my_size += ::protobuf::rt::value_size(3, self.commit_version, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.region_error.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.error.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.commit_version != 0 { - os.write_uint64(3, self.commit_version)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for CleanupResponse { - fn new() -> CleanupResponse { - CleanupResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_error", - CleanupResponse::get_region_error_for_reflect, - CleanupResponse::mut_region_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "error", - CleanupResponse::get_error_for_reflect, - CleanupResponse::mut_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "commit_version", - CleanupResponse::get_commit_version_for_reflect, - CleanupResponse::mut_commit_version_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "CleanupResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for CleanupResponse { - fn clear(&mut self) { - self.clear_region_error(); - self.clear_error(); - self.clear_commit_version(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for CleanupResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CleanupResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct BatchGetRequest { - // message fields - pub context: ::protobuf::SingularPtrField, - pub keys: ::protobuf::RepeatedField<::std::vec::Vec>, - pub version: u64, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for BatchGetRequest {} - -impl BatchGetRequest { - pub fn new() -> BatchGetRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static BatchGetRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const BatchGetRequest, - }; - unsafe { - instance.get(BatchGetRequest::new) - } - } - - // .kvrpcpb.Context context = 1; - - pub fn clear_context(&mut self) { - self.context.clear(); - } - - pub fn has_context(&self) -> bool { - self.context.is_some() - } - - // Param is passed by value, moved - pub fn set_context(&mut self, v: Context) { - self.context = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_context(&mut self) -> &mut Context { - if self.context.is_none() { - self.context.set_default(); - } - self.context.as_mut().unwrap() - } - - // Take field - pub fn take_context(&mut self) -> Context { - self.context.take().unwrap_or_else(|| Context::new()) - } - - pub fn get_context(&self) -> &Context { - self.context.as_ref().unwrap_or_else(|| Context::default_instance()) - } - - fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.context - } - - fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.context - } - - // repeated bytes keys = 2; - - pub fn clear_keys(&mut self) { - self.keys.clear(); - } - - // Param is passed by value, moved - pub fn set_keys(&mut self, v: ::protobuf::RepeatedField<::std::vec::Vec>) { - self.keys = v; - } - - // Mutable pointer to the field. - pub fn mut_keys(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { - &mut self.keys - } - - // Take field - pub fn take_keys(&mut self) -> ::protobuf::RepeatedField<::std::vec::Vec> { - ::std::mem::replace(&mut self.keys, ::protobuf::RepeatedField::new()) - } - - pub fn get_keys(&self) -> &[::std::vec::Vec] { - &self.keys - } - - fn get_keys_for_reflect(&self) -> &::protobuf::RepeatedField<::std::vec::Vec> { - &self.keys - } - - fn mut_keys_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { - &mut self.keys - } - - // uint64 version = 3; - - pub fn clear_version(&mut self) { - self.version = 0; - } - - // Param is passed by value, moved - pub fn set_version(&mut self, v: u64) { - self.version = v; - } - - pub fn get_version(&self) -> u64 { - self.version - } - - fn get_version_for_reflect(&self) -> &u64 { - &self.version - } - - fn mut_version_for_reflect(&mut self) -> &mut u64 { - &mut self.version - } -} - -impl ::protobuf::Message for BatchGetRequest { - fn is_initialized(&self) -> bool { - for v in &self.context { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; - }, - 2 => { - ::protobuf::rt::read_repeated_bytes_into(wire_type, is, &mut self.keys)?; - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.version = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.context.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - for value in &self.keys { - my_size += ::protobuf::rt::bytes_size(2, &value); - }; - if self.version != 0 { - my_size += ::protobuf::rt::value_size(3, self.version, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.context.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - for v in &self.keys { - os.write_bytes(2, &v)?; - }; - if self.version != 0 { - os.write_uint64(3, self.version)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for BatchGetRequest { - fn new() -> BatchGetRequest { - BatchGetRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "context", - BatchGetRequest::get_context_for_reflect, - BatchGetRequest::mut_context_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "keys", - BatchGetRequest::get_keys_for_reflect, - BatchGetRequest::mut_keys_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "version", - BatchGetRequest::get_version_for_reflect, - BatchGetRequest::mut_version_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "BatchGetRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for BatchGetRequest { - fn clear(&mut self) { - self.clear_context(); - self.clear_keys(); - self.clear_version(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for BatchGetRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for BatchGetRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct BatchGetResponse { - // message fields - pub region_error: ::protobuf::SingularPtrField, - pub pairs: ::protobuf::RepeatedField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for BatchGetResponse {} - -impl BatchGetResponse { - pub fn new() -> BatchGetResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static BatchGetResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const BatchGetResponse, - }; - unsafe { - instance.get(BatchGetResponse::new) - } - } - - // .errorpb.Error region_error = 1; - - pub fn clear_region_error(&mut self) { - self.region_error.clear(); - } - - pub fn has_region_error(&self) -> bool { - self.region_error.is_some() - } - - // Param is passed by value, moved - pub fn set_region_error(&mut self, v: super::errorpb::Error) { - self.region_error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { - if self.region_error.is_none() { - self.region_error.set_default(); - } - self.region_error.as_mut().unwrap() - } - - // Take field - pub fn take_region_error(&mut self) -> super::errorpb::Error { - self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) - } - - pub fn get_region_error(&self) -> &super::errorpb::Error { - self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) - } - - fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_error - } - - fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_error - } - - // repeated .kvrpcpb.KvPair pairs = 2; - - pub fn clear_pairs(&mut self) { - self.pairs.clear(); - } - - // Param is passed by value, moved - pub fn set_pairs(&mut self, v: ::protobuf::RepeatedField) { - self.pairs = v; - } - - // Mutable pointer to the field. - pub fn mut_pairs(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.pairs - } - - // Take field - pub fn take_pairs(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.pairs, ::protobuf::RepeatedField::new()) - } - - pub fn get_pairs(&self) -> &[KvPair] { - &self.pairs - } - - fn get_pairs_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.pairs - } - - fn mut_pairs_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.pairs - } -} - -impl ::protobuf::Message for BatchGetResponse { - fn is_initialized(&self) -> bool { - for v in &self.region_error { - if !v.is_initialized() { - return false; - } - }; - for v in &self.pairs { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; - }, - 2 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.pairs)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.region_error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - for value in &self.pairs { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.region_error.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - for v in &self.pairs { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for BatchGetResponse { - fn new() -> BatchGetResponse { - BatchGetResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_error", - BatchGetResponse::get_region_error_for_reflect, - BatchGetResponse::mut_region_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "pairs", - BatchGetResponse::get_pairs_for_reflect, - BatchGetResponse::mut_pairs_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "BatchGetResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for BatchGetResponse { - fn clear(&mut self) { - self.clear_region_error(); - self.clear_pairs(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for BatchGetResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for BatchGetResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ScanLockRequest { - // message fields - pub context: ::protobuf::SingularPtrField, - pub max_version: u64, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for ScanLockRequest {} - -impl ScanLockRequest { - pub fn new() -> ScanLockRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static ScanLockRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ScanLockRequest, - }; - unsafe { - instance.get(ScanLockRequest::new) - } - } - - // .kvrpcpb.Context context = 1; - - pub fn clear_context(&mut self) { - self.context.clear(); - } - - pub fn has_context(&self) -> bool { - self.context.is_some() - } - - // Param is passed by value, moved - pub fn set_context(&mut self, v: Context) { - self.context = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_context(&mut self) -> &mut Context { - if self.context.is_none() { - self.context.set_default(); - } - self.context.as_mut().unwrap() - } - - // Take field - pub fn take_context(&mut self) -> Context { - self.context.take().unwrap_or_else(|| Context::new()) - } - - pub fn get_context(&self) -> &Context { - self.context.as_ref().unwrap_or_else(|| Context::default_instance()) - } - - fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.context - } - - fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.context - } - - // uint64 max_version = 2; - - pub fn clear_max_version(&mut self) { - self.max_version = 0; - } - - // Param is passed by value, moved - pub fn set_max_version(&mut self, v: u64) { - self.max_version = v; - } - - pub fn get_max_version(&self) -> u64 { - self.max_version - } - - fn get_max_version_for_reflect(&self) -> &u64 { - &self.max_version - } - - fn mut_max_version_for_reflect(&mut self) -> &mut u64 { - &mut self.max_version - } -} - -impl ::protobuf::Message for ScanLockRequest { - fn is_initialized(&self) -> bool { - for v in &self.context { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.max_version = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.context.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.max_version != 0 { - my_size += ::protobuf::rt::value_size(2, self.max_version, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.context.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.max_version != 0 { - os.write_uint64(2, self.max_version)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for ScanLockRequest { - fn new() -> ScanLockRequest { - ScanLockRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "context", - ScanLockRequest::get_context_for_reflect, - ScanLockRequest::mut_context_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "max_version", - ScanLockRequest::get_max_version_for_reflect, - ScanLockRequest::mut_max_version_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "ScanLockRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for ScanLockRequest { - fn clear(&mut self) { - self.clear_context(); - self.clear_max_version(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ScanLockRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ScanLockRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ScanLockResponse { - // message fields - pub region_error: ::protobuf::SingularPtrField, - pub error: ::protobuf::SingularPtrField, - pub locks: ::protobuf::RepeatedField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for ScanLockResponse {} - -impl ScanLockResponse { - pub fn new() -> ScanLockResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static ScanLockResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ScanLockResponse, - }; - unsafe { - instance.get(ScanLockResponse::new) - } - } - - // .errorpb.Error region_error = 1; - - pub fn clear_region_error(&mut self) { - self.region_error.clear(); - } - - pub fn has_region_error(&self) -> bool { - self.region_error.is_some() - } - - // Param is passed by value, moved - pub fn set_region_error(&mut self, v: super::errorpb::Error) { - self.region_error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { - if self.region_error.is_none() { - self.region_error.set_default(); - } - self.region_error.as_mut().unwrap() - } - - // Take field - pub fn take_region_error(&mut self) -> super::errorpb::Error { - self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) - } - - pub fn get_region_error(&self) -> &super::errorpb::Error { - self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) - } - - fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_error - } - - fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_error - } - - // .kvrpcpb.KeyError error = 2; - - pub fn clear_error(&mut self) { - self.error.clear(); - } - - pub fn has_error(&self) -> bool { - self.error.is_some() - } - - // Param is passed by value, moved - pub fn set_error(&mut self, v: KeyError) { - self.error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_error(&mut self) -> &mut KeyError { - if self.error.is_none() { - self.error.set_default(); - } - self.error.as_mut().unwrap() - } - - // Take field - pub fn take_error(&mut self) -> KeyError { - self.error.take().unwrap_or_else(|| KeyError::new()) - } - - pub fn get_error(&self) -> &KeyError { - self.error.as_ref().unwrap_or_else(|| KeyError::default_instance()) - } - - fn get_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.error - } - - fn mut_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.error - } - - // repeated .kvrpcpb.LockInfo locks = 3; - - pub fn clear_locks(&mut self) { - self.locks.clear(); - } - - // Param is passed by value, moved - pub fn set_locks(&mut self, v: ::protobuf::RepeatedField) { - self.locks = v; - } - - // Mutable pointer to the field. - pub fn mut_locks(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.locks - } - - // Take field - pub fn take_locks(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.locks, ::protobuf::RepeatedField::new()) - } - - pub fn get_locks(&self) -> &[LockInfo] { - &self.locks - } - - fn get_locks_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.locks - } - - fn mut_locks_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.locks - } -} - -impl ::protobuf::Message for ScanLockResponse { - fn is_initialized(&self) -> bool { - for v in &self.region_error { - if !v.is_initialized() { - return false; - } - }; - for v in &self.error { - if !v.is_initialized() { - return false; - } - }; - for v in &self.locks { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.error)?; - }, - 3 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.locks)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.region_error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - for value in &self.locks { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.region_error.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.error.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - for v in &self.locks { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for ScanLockResponse { - fn new() -> ScanLockResponse { - ScanLockResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_error", - ScanLockResponse::get_region_error_for_reflect, - ScanLockResponse::mut_region_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "error", - ScanLockResponse::get_error_for_reflect, - ScanLockResponse::mut_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "locks", - ScanLockResponse::get_locks_for_reflect, - ScanLockResponse::mut_locks_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "ScanLockResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for ScanLockResponse { - fn clear(&mut self) { - self.clear_region_error(); - self.clear_error(); - self.clear_locks(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ScanLockResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ScanLockResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ResolveLockRequest { - // message fields - pub context: ::protobuf::SingularPtrField, - pub start_version: u64, - pub commit_version: u64, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for ResolveLockRequest {} - -impl ResolveLockRequest { - pub fn new() -> ResolveLockRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static ResolveLockRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ResolveLockRequest, - }; - unsafe { - instance.get(ResolveLockRequest::new) - } - } - - // .kvrpcpb.Context context = 1; - - pub fn clear_context(&mut self) { - self.context.clear(); - } - - pub fn has_context(&self) -> bool { - self.context.is_some() - } - - // Param is passed by value, moved - pub fn set_context(&mut self, v: Context) { - self.context = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_context(&mut self) -> &mut Context { - if self.context.is_none() { - self.context.set_default(); - } - self.context.as_mut().unwrap() - } - - // Take field - pub fn take_context(&mut self) -> Context { - self.context.take().unwrap_or_else(|| Context::new()) - } - - pub fn get_context(&self) -> &Context { - self.context.as_ref().unwrap_or_else(|| Context::default_instance()) - } - - fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.context - } - - fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.context - } - - // uint64 start_version = 2; - - pub fn clear_start_version(&mut self) { - self.start_version = 0; - } - - // Param is passed by value, moved - pub fn set_start_version(&mut self, v: u64) { - self.start_version = v; - } - - pub fn get_start_version(&self) -> u64 { - self.start_version - } - - fn get_start_version_for_reflect(&self) -> &u64 { - &self.start_version - } - - fn mut_start_version_for_reflect(&mut self) -> &mut u64 { - &mut self.start_version - } - - // uint64 commit_version = 3; - - pub fn clear_commit_version(&mut self) { - self.commit_version = 0; - } - - // Param is passed by value, moved - pub fn set_commit_version(&mut self, v: u64) { - self.commit_version = v; - } - - pub fn get_commit_version(&self) -> u64 { - self.commit_version - } - - fn get_commit_version_for_reflect(&self) -> &u64 { - &self.commit_version - } - - fn mut_commit_version_for_reflect(&mut self) -> &mut u64 { - &mut self.commit_version - } -} - -impl ::protobuf::Message for ResolveLockRequest { - fn is_initialized(&self) -> bool { - for v in &self.context { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.start_version = tmp; - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.commit_version = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.context.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.start_version != 0 { - my_size += ::protobuf::rt::value_size(2, self.start_version, ::protobuf::wire_format::WireTypeVarint); - } - if self.commit_version != 0 { - my_size += ::protobuf::rt::value_size(3, self.commit_version, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.context.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.start_version != 0 { - os.write_uint64(2, self.start_version)?; - } - if self.commit_version != 0 { - os.write_uint64(3, self.commit_version)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for ResolveLockRequest { - fn new() -> ResolveLockRequest { - ResolveLockRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "context", - ResolveLockRequest::get_context_for_reflect, - ResolveLockRequest::mut_context_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "start_version", - ResolveLockRequest::get_start_version_for_reflect, - ResolveLockRequest::mut_start_version_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "commit_version", - ResolveLockRequest::get_commit_version_for_reflect, - ResolveLockRequest::mut_commit_version_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "ResolveLockRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for ResolveLockRequest { - fn clear(&mut self) { - self.clear_context(); - self.clear_start_version(); - self.clear_commit_version(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ResolveLockRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ResolveLockRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ResolveLockResponse { - // message fields - pub region_error: ::protobuf::SingularPtrField, - pub error: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for ResolveLockResponse {} - -impl ResolveLockResponse { - pub fn new() -> ResolveLockResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static ResolveLockResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ResolveLockResponse, - }; - unsafe { - instance.get(ResolveLockResponse::new) - } - } - - // .errorpb.Error region_error = 1; - - pub fn clear_region_error(&mut self) { - self.region_error.clear(); - } - - pub fn has_region_error(&self) -> bool { - self.region_error.is_some() - } - - // Param is passed by value, moved - pub fn set_region_error(&mut self, v: super::errorpb::Error) { - self.region_error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { - if self.region_error.is_none() { - self.region_error.set_default(); - } - self.region_error.as_mut().unwrap() - } - - // Take field - pub fn take_region_error(&mut self) -> super::errorpb::Error { - self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) - } - - pub fn get_region_error(&self) -> &super::errorpb::Error { - self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) - } - - fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_error - } - - fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_error - } - - // .kvrpcpb.KeyError error = 2; - - pub fn clear_error(&mut self) { - self.error.clear(); - } - - pub fn has_error(&self) -> bool { - self.error.is_some() - } - - // Param is passed by value, moved - pub fn set_error(&mut self, v: KeyError) { - self.error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_error(&mut self) -> &mut KeyError { - if self.error.is_none() { - self.error.set_default(); - } - self.error.as_mut().unwrap() - } - - // Take field - pub fn take_error(&mut self) -> KeyError { - self.error.take().unwrap_or_else(|| KeyError::new()) - } - - pub fn get_error(&self) -> &KeyError { - self.error.as_ref().unwrap_or_else(|| KeyError::default_instance()) - } - - fn get_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.error - } - - fn mut_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.error - } -} - -impl ::protobuf::Message for ResolveLockResponse { - fn is_initialized(&self) -> bool { - for v in &self.region_error { - if !v.is_initialized() { - return false; - } - }; - for v in &self.error { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.error)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.region_error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.region_error.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.error.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for ResolveLockResponse { - fn new() -> ResolveLockResponse { - ResolveLockResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_error", - ResolveLockResponse::get_region_error_for_reflect, - ResolveLockResponse::mut_region_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "error", - ResolveLockResponse::get_error_for_reflect, - ResolveLockResponse::mut_error_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "ResolveLockResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for ResolveLockResponse { - fn clear(&mut self) { - self.clear_region_error(); - self.clear_error(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ResolveLockResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ResolveLockResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct GCRequest { - // message fields - pub context: ::protobuf::SingularPtrField, - pub safe_point: u64, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for GCRequest {} - -impl GCRequest { - pub fn new() -> GCRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static GCRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const GCRequest, - }; - unsafe { - instance.get(GCRequest::new) - } - } - - // .kvrpcpb.Context context = 1; - - pub fn clear_context(&mut self) { - self.context.clear(); - } - - pub fn has_context(&self) -> bool { - self.context.is_some() - } - - // Param is passed by value, moved - pub fn set_context(&mut self, v: Context) { - self.context = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_context(&mut self) -> &mut Context { - if self.context.is_none() { - self.context.set_default(); - } - self.context.as_mut().unwrap() - } - - // Take field - pub fn take_context(&mut self) -> Context { - self.context.take().unwrap_or_else(|| Context::new()) - } - - pub fn get_context(&self) -> &Context { - self.context.as_ref().unwrap_or_else(|| Context::default_instance()) - } - - fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.context - } - - fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.context - } - - // uint64 safe_point = 2; - - pub fn clear_safe_point(&mut self) { - self.safe_point = 0; - } - - // Param is passed by value, moved - pub fn set_safe_point(&mut self, v: u64) { - self.safe_point = v; - } - - pub fn get_safe_point(&self) -> u64 { - self.safe_point - } - - fn get_safe_point_for_reflect(&self) -> &u64 { - &self.safe_point - } - - fn mut_safe_point_for_reflect(&mut self) -> &mut u64 { - &mut self.safe_point - } -} - -impl ::protobuf::Message for GCRequest { - fn is_initialized(&self) -> bool { - for v in &self.context { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.safe_point = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.context.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.safe_point != 0 { - my_size += ::protobuf::rt::value_size(2, self.safe_point, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.context.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.safe_point != 0 { - os.write_uint64(2, self.safe_point)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for GCRequest { - fn new() -> GCRequest { - GCRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "context", - GCRequest::get_context_for_reflect, - GCRequest::mut_context_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "safe_point", - GCRequest::get_safe_point_for_reflect, - GCRequest::mut_safe_point_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "GCRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for GCRequest { - fn clear(&mut self) { - self.clear_context(); - self.clear_safe_point(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for GCRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GCRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct GCResponse { - // message fields - pub region_error: ::protobuf::SingularPtrField, - pub error: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for GCResponse {} - -impl GCResponse { - pub fn new() -> GCResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static GCResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const GCResponse, - }; - unsafe { - instance.get(GCResponse::new) - } - } - - // .errorpb.Error region_error = 1; - - pub fn clear_region_error(&mut self) { - self.region_error.clear(); - } - - pub fn has_region_error(&self) -> bool { - self.region_error.is_some() - } - - // Param is passed by value, moved - pub fn set_region_error(&mut self, v: super::errorpb::Error) { - self.region_error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { - if self.region_error.is_none() { - self.region_error.set_default(); - } - self.region_error.as_mut().unwrap() - } - - // Take field - pub fn take_region_error(&mut self) -> super::errorpb::Error { - self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) - } - - pub fn get_region_error(&self) -> &super::errorpb::Error { - self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) - } - - fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_error - } - - fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_error - } - - // .kvrpcpb.KeyError error = 2; - - pub fn clear_error(&mut self) { - self.error.clear(); - } - - pub fn has_error(&self) -> bool { - self.error.is_some() - } - - // Param is passed by value, moved - pub fn set_error(&mut self, v: KeyError) { - self.error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_error(&mut self) -> &mut KeyError { - if self.error.is_none() { - self.error.set_default(); - } - self.error.as_mut().unwrap() - } - - // Take field - pub fn take_error(&mut self) -> KeyError { - self.error.take().unwrap_or_else(|| KeyError::new()) - } - - pub fn get_error(&self) -> &KeyError { - self.error.as_ref().unwrap_or_else(|| KeyError::default_instance()) - } - - fn get_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.error - } - - fn mut_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.error - } -} - -impl ::protobuf::Message for GCResponse { - fn is_initialized(&self) -> bool { - for v in &self.region_error { - if !v.is_initialized() { - return false; - } - }; - for v in &self.error { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.error)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.region_error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.region_error.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.error.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for GCResponse { - fn new() -> GCResponse { - GCResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_error", - GCResponse::get_region_error_for_reflect, - GCResponse::mut_region_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "error", - GCResponse::get_error_for_reflect, - GCResponse::mut_error_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "GCResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for GCResponse { - fn clear(&mut self) { - self.clear_region_error(); - self.clear_error(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for GCResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GCResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RawGetRequest { - // message fields - pub context: ::protobuf::SingularPtrField, - pub key: ::std::vec::Vec, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RawGetRequest {} - -impl RawGetRequest { - pub fn new() -> RawGetRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RawGetRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RawGetRequest, - }; - unsafe { - instance.get(RawGetRequest::new) - } - } - - // .kvrpcpb.Context context = 1; - - pub fn clear_context(&mut self) { - self.context.clear(); - } - - pub fn has_context(&self) -> bool { - self.context.is_some() - } - - // Param is passed by value, moved - pub fn set_context(&mut self, v: Context) { - self.context = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_context(&mut self) -> &mut Context { - if self.context.is_none() { - self.context.set_default(); - } - self.context.as_mut().unwrap() - } - - // Take field - pub fn take_context(&mut self) -> Context { - self.context.take().unwrap_or_else(|| Context::new()) - } - - pub fn get_context(&self) -> &Context { - self.context.as_ref().unwrap_or_else(|| Context::default_instance()) - } - - fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.context - } - - fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.context - } - - // bytes key = 2; - - pub fn clear_key(&mut self) { - self.key.clear(); - } - - // Param is passed by value, moved - pub fn set_key(&mut self, v: ::std::vec::Vec) { - self.key = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { - &mut self.key - } - - // Take field - pub fn take_key(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) - } - - pub fn get_key(&self) -> &[u8] { - &self.key - } - - fn get_key_for_reflect(&self) -> &::std::vec::Vec { - &self.key - } - - fn mut_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.key - } -} - -impl ::protobuf::Message for RawGetRequest { - fn is_initialized(&self) -> bool { - for v in &self.context { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.context.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.key.is_empty() { - my_size += ::protobuf::rt::bytes_size(2, &self.key); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.context.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.key.is_empty() { - os.write_bytes(2, &self.key)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RawGetRequest { - fn new() -> RawGetRequest { - RawGetRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "context", - RawGetRequest::get_context_for_reflect, - RawGetRequest::mut_context_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "key", - RawGetRequest::get_key_for_reflect, - RawGetRequest::mut_key_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RawGetRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RawGetRequest { - fn clear(&mut self) { - self.clear_context(); - self.clear_key(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RawGetRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RawGetRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RawGetResponse { - // message fields - pub region_error: ::protobuf::SingularPtrField, - pub error: ::std::string::String, - pub value: ::std::vec::Vec, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RawGetResponse {} - -impl RawGetResponse { - pub fn new() -> RawGetResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RawGetResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RawGetResponse, - }; - unsafe { - instance.get(RawGetResponse::new) - } - } - - // .errorpb.Error region_error = 1; - - pub fn clear_region_error(&mut self) { - self.region_error.clear(); - } - - pub fn has_region_error(&self) -> bool { - self.region_error.is_some() - } - - // Param is passed by value, moved - pub fn set_region_error(&mut self, v: super::errorpb::Error) { - self.region_error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { - if self.region_error.is_none() { - self.region_error.set_default(); - } - self.region_error.as_mut().unwrap() - } - - // Take field - pub fn take_region_error(&mut self) -> super::errorpb::Error { - self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) - } - - pub fn get_region_error(&self) -> &super::errorpb::Error { - self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) - } - - fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_error - } - - fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_error - } - - // string error = 2; - - pub fn clear_error(&mut self) { - self.error.clear(); - } - - // Param is passed by value, moved - pub fn set_error(&mut self, v: ::std::string::String) { - self.error = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_error(&mut self) -> &mut ::std::string::String { - &mut self.error - } - - // Take field - pub fn take_error(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.error, ::std::string::String::new()) - } - - pub fn get_error(&self) -> &str { - &self.error - } - - fn get_error_for_reflect(&self) -> &::std::string::String { - &self.error - } - - fn mut_error_for_reflect(&mut self) -> &mut ::std::string::String { - &mut self.error - } - - // bytes value = 3; - - pub fn clear_value(&mut self) { - self.value.clear(); - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: ::std::vec::Vec) { - self.value = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { - &mut self.value - } - - // Take field - pub fn take_value(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.value, ::std::vec::Vec::new()) - } - - pub fn get_value(&self) -> &[u8] { - &self.value - } - - fn get_value_for_reflect(&self) -> &::std::vec::Vec { - &self.value - } - - fn mut_value_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.value - } -} - -impl ::protobuf::Message for RawGetResponse { - fn is_initialized(&self) -> bool { - for v in &self.region_error { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.error)?; - }, - 3 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.value)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.region_error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.error.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.error); - } - if !self.value.is_empty() { - my_size += ::protobuf::rt::bytes_size(3, &self.value); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.region_error.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.error.is_empty() { - os.write_string(2, &self.error)?; - } - if !self.value.is_empty() { - os.write_bytes(3, &self.value)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RawGetResponse { - fn new() -> RawGetResponse { - RawGetResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_error", - RawGetResponse::get_region_error_for_reflect, - RawGetResponse::mut_region_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "error", - RawGetResponse::get_error_for_reflect, - RawGetResponse::mut_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "value", - RawGetResponse::get_value_for_reflect, - RawGetResponse::mut_value_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RawGetResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RawGetResponse { - fn clear(&mut self) { - self.clear_region_error(); - self.clear_error(); - self.clear_value(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RawGetResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RawGetResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RawPutRequest { - // message fields - pub context: ::protobuf::SingularPtrField, - pub key: ::std::vec::Vec, - pub value: ::std::vec::Vec, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RawPutRequest {} - -impl RawPutRequest { - pub fn new() -> RawPutRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RawPutRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RawPutRequest, - }; - unsafe { - instance.get(RawPutRequest::new) - } - } - - // .kvrpcpb.Context context = 1; - - pub fn clear_context(&mut self) { - self.context.clear(); - } - - pub fn has_context(&self) -> bool { - self.context.is_some() - } - - // Param is passed by value, moved - pub fn set_context(&mut self, v: Context) { - self.context = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_context(&mut self) -> &mut Context { - if self.context.is_none() { - self.context.set_default(); - } - self.context.as_mut().unwrap() - } - - // Take field - pub fn take_context(&mut self) -> Context { - self.context.take().unwrap_or_else(|| Context::new()) - } - - pub fn get_context(&self) -> &Context { - self.context.as_ref().unwrap_or_else(|| Context::default_instance()) - } - - fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.context - } - - fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.context - } - - // bytes key = 2; - - pub fn clear_key(&mut self) { - self.key.clear(); - } - - // Param is passed by value, moved - pub fn set_key(&mut self, v: ::std::vec::Vec) { - self.key = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { - &mut self.key - } - - // Take field - pub fn take_key(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) - } - - pub fn get_key(&self) -> &[u8] { - &self.key - } - - fn get_key_for_reflect(&self) -> &::std::vec::Vec { - &self.key - } - - fn mut_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.key - } - - // bytes value = 3; - - pub fn clear_value(&mut self) { - self.value.clear(); - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: ::std::vec::Vec) { - self.value = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { - &mut self.value - } - - // Take field - pub fn take_value(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.value, ::std::vec::Vec::new()) - } - - pub fn get_value(&self) -> &[u8] { - &self.value - } - - fn get_value_for_reflect(&self) -> &::std::vec::Vec { - &self.value - } - - fn mut_value_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.value - } -} - -impl ::protobuf::Message for RawPutRequest { - fn is_initialized(&self) -> bool { - for v in &self.context { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; - }, - 3 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.value)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.context.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.key.is_empty() { - my_size += ::protobuf::rt::bytes_size(2, &self.key); - } - if !self.value.is_empty() { - my_size += ::protobuf::rt::bytes_size(3, &self.value); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.context.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.key.is_empty() { - os.write_bytes(2, &self.key)?; - } - if !self.value.is_empty() { - os.write_bytes(3, &self.value)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RawPutRequest { - fn new() -> RawPutRequest { - RawPutRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "context", - RawPutRequest::get_context_for_reflect, - RawPutRequest::mut_context_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "key", - RawPutRequest::get_key_for_reflect, - RawPutRequest::mut_key_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "value", - RawPutRequest::get_value_for_reflect, - RawPutRequest::mut_value_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RawPutRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RawPutRequest { - fn clear(&mut self) { - self.clear_context(); - self.clear_key(); - self.clear_value(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RawPutRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RawPutRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RawPutResponse { - // message fields - pub region_error: ::protobuf::SingularPtrField, - pub error: ::std::string::String, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RawPutResponse {} - -impl RawPutResponse { - pub fn new() -> RawPutResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RawPutResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RawPutResponse, - }; - unsafe { - instance.get(RawPutResponse::new) - } - } - - // .errorpb.Error region_error = 1; - - pub fn clear_region_error(&mut self) { - self.region_error.clear(); - } - - pub fn has_region_error(&self) -> bool { - self.region_error.is_some() - } - - // Param is passed by value, moved - pub fn set_region_error(&mut self, v: super::errorpb::Error) { - self.region_error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { - if self.region_error.is_none() { - self.region_error.set_default(); - } - self.region_error.as_mut().unwrap() - } - - // Take field - pub fn take_region_error(&mut self) -> super::errorpb::Error { - self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) - } - - pub fn get_region_error(&self) -> &super::errorpb::Error { - self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) - } - - fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_error - } - - fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_error - } - - // string error = 2; - - pub fn clear_error(&mut self) { - self.error.clear(); - } - - // Param is passed by value, moved - pub fn set_error(&mut self, v: ::std::string::String) { - self.error = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_error(&mut self) -> &mut ::std::string::String { - &mut self.error - } - - // Take field - pub fn take_error(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.error, ::std::string::String::new()) - } - - pub fn get_error(&self) -> &str { - &self.error - } - - fn get_error_for_reflect(&self) -> &::std::string::String { - &self.error - } - - fn mut_error_for_reflect(&mut self) -> &mut ::std::string::String { - &mut self.error - } -} - -impl ::protobuf::Message for RawPutResponse { - fn is_initialized(&self) -> bool { - for v in &self.region_error { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.error)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.region_error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.error.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.error); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.region_error.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.error.is_empty() { - os.write_string(2, &self.error)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RawPutResponse { - fn new() -> RawPutResponse { - RawPutResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_error", - RawPutResponse::get_region_error_for_reflect, - RawPutResponse::mut_region_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "error", - RawPutResponse::get_error_for_reflect, - RawPutResponse::mut_error_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RawPutResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RawPutResponse { - fn clear(&mut self) { - self.clear_region_error(); - self.clear_error(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RawPutResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RawPutResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RawDeleteRequest { - // message fields - pub context: ::protobuf::SingularPtrField, - pub key: ::std::vec::Vec, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RawDeleteRequest {} - -impl RawDeleteRequest { - pub fn new() -> RawDeleteRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RawDeleteRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RawDeleteRequest, - }; - unsafe { - instance.get(RawDeleteRequest::new) - } - } - - // .kvrpcpb.Context context = 1; - - pub fn clear_context(&mut self) { - self.context.clear(); - } - - pub fn has_context(&self) -> bool { - self.context.is_some() - } - - // Param is passed by value, moved - pub fn set_context(&mut self, v: Context) { - self.context = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_context(&mut self) -> &mut Context { - if self.context.is_none() { - self.context.set_default(); - } - self.context.as_mut().unwrap() - } - - // Take field - pub fn take_context(&mut self) -> Context { - self.context.take().unwrap_or_else(|| Context::new()) - } - - pub fn get_context(&self) -> &Context { - self.context.as_ref().unwrap_or_else(|| Context::default_instance()) - } - - fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.context - } - - fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.context - } - - // bytes key = 2; - - pub fn clear_key(&mut self) { - self.key.clear(); - } - - // Param is passed by value, moved - pub fn set_key(&mut self, v: ::std::vec::Vec) { - self.key = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { - &mut self.key - } - - // Take field - pub fn take_key(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) - } - - pub fn get_key(&self) -> &[u8] { - &self.key - } - - fn get_key_for_reflect(&self) -> &::std::vec::Vec { - &self.key - } - - fn mut_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.key - } -} - -impl ::protobuf::Message for RawDeleteRequest { - fn is_initialized(&self) -> bool { - for v in &self.context { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.context.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.key.is_empty() { - my_size += ::protobuf::rt::bytes_size(2, &self.key); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.context.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.key.is_empty() { - os.write_bytes(2, &self.key)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RawDeleteRequest { - fn new() -> RawDeleteRequest { - RawDeleteRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "context", - RawDeleteRequest::get_context_for_reflect, - RawDeleteRequest::mut_context_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "key", - RawDeleteRequest::get_key_for_reflect, - RawDeleteRequest::mut_key_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RawDeleteRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RawDeleteRequest { - fn clear(&mut self) { - self.clear_context(); - self.clear_key(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RawDeleteRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RawDeleteRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RawDeleteResponse { - // message fields - pub region_error: ::protobuf::SingularPtrField, - pub error: ::std::string::String, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RawDeleteResponse {} - -impl RawDeleteResponse { - pub fn new() -> RawDeleteResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RawDeleteResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RawDeleteResponse, - }; - unsafe { - instance.get(RawDeleteResponse::new) - } - } - - // .errorpb.Error region_error = 1; - - pub fn clear_region_error(&mut self) { - self.region_error.clear(); - } - - pub fn has_region_error(&self) -> bool { - self.region_error.is_some() - } - - // Param is passed by value, moved - pub fn set_region_error(&mut self, v: super::errorpb::Error) { - self.region_error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { - if self.region_error.is_none() { - self.region_error.set_default(); - } - self.region_error.as_mut().unwrap() - } - - // Take field - pub fn take_region_error(&mut self) -> super::errorpb::Error { - self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) - } - - pub fn get_region_error(&self) -> &super::errorpb::Error { - self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) - } - - fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_error - } - - fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_error - } - - // string error = 2; - - pub fn clear_error(&mut self) { - self.error.clear(); - } - - // Param is passed by value, moved - pub fn set_error(&mut self, v: ::std::string::String) { - self.error = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_error(&mut self) -> &mut ::std::string::String { - &mut self.error - } - - // Take field - pub fn take_error(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.error, ::std::string::String::new()) - } - - pub fn get_error(&self) -> &str { - &self.error - } - - fn get_error_for_reflect(&self) -> &::std::string::String { - &self.error - } - - fn mut_error_for_reflect(&mut self) -> &mut ::std::string::String { - &mut self.error - } -} - -impl ::protobuf::Message for RawDeleteResponse { - fn is_initialized(&self) -> bool { - for v in &self.region_error { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.error)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.region_error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.error.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.error); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.region_error.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.error.is_empty() { - os.write_string(2, &self.error)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RawDeleteResponse { - fn new() -> RawDeleteResponse { - RawDeleteResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_error", - RawDeleteResponse::get_region_error_for_reflect, - RawDeleteResponse::mut_region_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "error", - RawDeleteResponse::get_error_for_reflect, - RawDeleteResponse::mut_error_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RawDeleteResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RawDeleteResponse { - fn clear(&mut self) { - self.clear_region_error(); - self.clear_error(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RawDeleteResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RawDeleteResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct DeleteRangeRequest { - // message fields - pub context: ::protobuf::SingularPtrField, - pub start_key: ::std::vec::Vec, - pub end_key: ::std::vec::Vec, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for DeleteRangeRequest {} - -impl DeleteRangeRequest { - pub fn new() -> DeleteRangeRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static DeleteRangeRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const DeleteRangeRequest, - }; - unsafe { - instance.get(DeleteRangeRequest::new) - } - } - - // .kvrpcpb.Context context = 1; - - pub fn clear_context(&mut self) { - self.context.clear(); - } - - pub fn has_context(&self) -> bool { - self.context.is_some() - } - - // Param is passed by value, moved - pub fn set_context(&mut self, v: Context) { - self.context = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_context(&mut self) -> &mut Context { - if self.context.is_none() { - self.context.set_default(); - } - self.context.as_mut().unwrap() - } - - // Take field - pub fn take_context(&mut self) -> Context { - self.context.take().unwrap_or_else(|| Context::new()) - } - - pub fn get_context(&self) -> &Context { - self.context.as_ref().unwrap_or_else(|| Context::default_instance()) - } - - fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.context - } - - fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.context - } - - // bytes start_key = 2; - - pub fn clear_start_key(&mut self) { - self.start_key.clear(); - } - - // Param is passed by value, moved - pub fn set_start_key(&mut self, v: ::std::vec::Vec) { - self.start_key = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_start_key(&mut self) -> &mut ::std::vec::Vec { - &mut self.start_key - } - - // Take field - pub fn take_start_key(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.start_key, ::std::vec::Vec::new()) - } - - pub fn get_start_key(&self) -> &[u8] { - &self.start_key - } - - fn get_start_key_for_reflect(&self) -> &::std::vec::Vec { - &self.start_key - } - - fn mut_start_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.start_key - } - - // bytes end_key = 3; - - pub fn clear_end_key(&mut self) { - self.end_key.clear(); - } - - // Param is passed by value, moved - pub fn set_end_key(&mut self, v: ::std::vec::Vec) { - self.end_key = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_end_key(&mut self) -> &mut ::std::vec::Vec { - &mut self.end_key - } - - // Take field - pub fn take_end_key(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.end_key, ::std::vec::Vec::new()) - } - - pub fn get_end_key(&self) -> &[u8] { - &self.end_key - } - - fn get_end_key_for_reflect(&self) -> &::std::vec::Vec { - &self.end_key - } - - fn mut_end_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.end_key - } -} - -impl ::protobuf::Message for DeleteRangeRequest { - fn is_initialized(&self) -> bool { - for v in &self.context { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.start_key)?; - }, - 3 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.end_key)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.context.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.start_key.is_empty() { - my_size += ::protobuf::rt::bytes_size(2, &self.start_key); - } - if !self.end_key.is_empty() { - my_size += ::protobuf::rt::bytes_size(3, &self.end_key); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.context.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.start_key.is_empty() { - os.write_bytes(2, &self.start_key)?; - } - if !self.end_key.is_empty() { - os.write_bytes(3, &self.end_key)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for DeleteRangeRequest { - fn new() -> DeleteRangeRequest { - DeleteRangeRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "context", - DeleteRangeRequest::get_context_for_reflect, - DeleteRangeRequest::mut_context_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "start_key", - DeleteRangeRequest::get_start_key_for_reflect, - DeleteRangeRequest::mut_start_key_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "end_key", - DeleteRangeRequest::get_end_key_for_reflect, - DeleteRangeRequest::mut_end_key_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "DeleteRangeRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for DeleteRangeRequest { - fn clear(&mut self) { - self.clear_context(); - self.clear_start_key(); - self.clear_end_key(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for DeleteRangeRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DeleteRangeRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct DeleteRangeResponse { - // message fields - pub region_error: ::protobuf::SingularPtrField, - pub error: ::std::string::String, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for DeleteRangeResponse {} - -impl DeleteRangeResponse { - pub fn new() -> DeleteRangeResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static DeleteRangeResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const DeleteRangeResponse, - }; - unsafe { - instance.get(DeleteRangeResponse::new) - } - } - - // .errorpb.Error region_error = 1; - - pub fn clear_region_error(&mut self) { - self.region_error.clear(); - } - - pub fn has_region_error(&self) -> bool { - self.region_error.is_some() - } - - // Param is passed by value, moved - pub fn set_region_error(&mut self, v: super::errorpb::Error) { - self.region_error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { - if self.region_error.is_none() { - self.region_error.set_default(); - } - self.region_error.as_mut().unwrap() - } - - // Take field - pub fn take_region_error(&mut self) -> super::errorpb::Error { - self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) - } - - pub fn get_region_error(&self) -> &super::errorpb::Error { - self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) - } - - fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_error - } - - fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_error - } - - // string error = 2; - - pub fn clear_error(&mut self) { - self.error.clear(); - } - - // Param is passed by value, moved - pub fn set_error(&mut self, v: ::std::string::String) { - self.error = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_error(&mut self) -> &mut ::std::string::String { - &mut self.error - } - - // Take field - pub fn take_error(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.error, ::std::string::String::new()) - } - - pub fn get_error(&self) -> &str { - &self.error - } - - fn get_error_for_reflect(&self) -> &::std::string::String { - &self.error - } - - fn mut_error_for_reflect(&mut self) -> &mut ::std::string::String { - &mut self.error - } -} - -impl ::protobuf::Message for DeleteRangeResponse { - fn is_initialized(&self) -> bool { - for v in &self.region_error { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.error)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.region_error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.error.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.error); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.region_error.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.error.is_empty() { - os.write_string(2, &self.error)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for DeleteRangeResponse { - fn new() -> DeleteRangeResponse { - DeleteRangeResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_error", - DeleteRangeResponse::get_region_error_for_reflect, - DeleteRangeResponse::mut_region_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "error", - DeleteRangeResponse::get_error_for_reflect, - DeleteRangeResponse::mut_error_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "DeleteRangeResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for DeleteRangeResponse { - fn clear(&mut self) { - self.clear_region_error(); - self.clear_error(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for DeleteRangeResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DeleteRangeResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RawScanRequest { - // message fields - pub context: ::protobuf::SingularPtrField, - pub start_key: ::std::vec::Vec, - pub limit: u32, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RawScanRequest {} - -impl RawScanRequest { - pub fn new() -> RawScanRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RawScanRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RawScanRequest, - }; - unsafe { - instance.get(RawScanRequest::new) - } - } - - // .kvrpcpb.Context context = 1; - - pub fn clear_context(&mut self) { - self.context.clear(); - } - - pub fn has_context(&self) -> bool { - self.context.is_some() - } - - // Param is passed by value, moved - pub fn set_context(&mut self, v: Context) { - self.context = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_context(&mut self) -> &mut Context { - if self.context.is_none() { - self.context.set_default(); - } - self.context.as_mut().unwrap() - } - - // Take field - pub fn take_context(&mut self) -> Context { - self.context.take().unwrap_or_else(|| Context::new()) - } - - pub fn get_context(&self) -> &Context { - self.context.as_ref().unwrap_or_else(|| Context::default_instance()) - } - - fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.context - } - - fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.context - } - - // bytes start_key = 2; - - pub fn clear_start_key(&mut self) { - self.start_key.clear(); - } - - // Param is passed by value, moved - pub fn set_start_key(&mut self, v: ::std::vec::Vec) { - self.start_key = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_start_key(&mut self) -> &mut ::std::vec::Vec { - &mut self.start_key - } - - // Take field - pub fn take_start_key(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.start_key, ::std::vec::Vec::new()) - } - - pub fn get_start_key(&self) -> &[u8] { - &self.start_key - } - - fn get_start_key_for_reflect(&self) -> &::std::vec::Vec { - &self.start_key - } - - fn mut_start_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.start_key - } - - // uint32 limit = 3; - - pub fn clear_limit(&mut self) { - self.limit = 0; - } - - // Param is passed by value, moved - pub fn set_limit(&mut self, v: u32) { - self.limit = v; - } - - pub fn get_limit(&self) -> u32 { - self.limit - } - - fn get_limit_for_reflect(&self) -> &u32 { - &self.limit - } - - fn mut_limit_for_reflect(&mut self) -> &mut u32 { - &mut self.limit - } -} - -impl ::protobuf::Message for RawScanRequest { - fn is_initialized(&self) -> bool { - for v in &self.context { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.start_key)?; - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint32()?; - self.limit = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.context.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.start_key.is_empty() { - my_size += ::protobuf::rt::bytes_size(2, &self.start_key); - } - if self.limit != 0 { - my_size += ::protobuf::rt::value_size(3, self.limit, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.context.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.start_key.is_empty() { - os.write_bytes(2, &self.start_key)?; - } - if self.limit != 0 { - os.write_uint32(3, self.limit)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RawScanRequest { - fn new() -> RawScanRequest { - RawScanRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "context", - RawScanRequest::get_context_for_reflect, - RawScanRequest::mut_context_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "start_key", - RawScanRequest::get_start_key_for_reflect, - RawScanRequest::mut_start_key_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( - "limit", - RawScanRequest::get_limit_for_reflect, - RawScanRequest::mut_limit_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RawScanRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RawScanRequest { - fn clear(&mut self) { - self.clear_context(); - self.clear_start_key(); - self.clear_limit(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RawScanRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RawScanRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RawScanResponse { - // message fields - pub region_error: ::protobuf::SingularPtrField, - pub kvs: ::protobuf::RepeatedField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RawScanResponse {} - -impl RawScanResponse { - pub fn new() -> RawScanResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RawScanResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RawScanResponse, - }; - unsafe { - instance.get(RawScanResponse::new) - } - } - - // .errorpb.Error region_error = 1; - - pub fn clear_region_error(&mut self) { - self.region_error.clear(); - } - - pub fn has_region_error(&self) -> bool { - self.region_error.is_some() - } - - // Param is passed by value, moved - pub fn set_region_error(&mut self, v: super::errorpb::Error) { - self.region_error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { - if self.region_error.is_none() { - self.region_error.set_default(); - } - self.region_error.as_mut().unwrap() - } - - // Take field - pub fn take_region_error(&mut self) -> super::errorpb::Error { - self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) - } - - pub fn get_region_error(&self) -> &super::errorpb::Error { - self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) - } - - fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_error - } - - fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_error - } - - // repeated .kvrpcpb.KvPair kvs = 2; - - pub fn clear_kvs(&mut self) { - self.kvs.clear(); - } - - // Param is passed by value, moved - pub fn set_kvs(&mut self, v: ::protobuf::RepeatedField) { - self.kvs = v; - } - - // Mutable pointer to the field. - pub fn mut_kvs(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.kvs - } - - // Take field - pub fn take_kvs(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.kvs, ::protobuf::RepeatedField::new()) - } - - pub fn get_kvs(&self) -> &[KvPair] { - &self.kvs - } - - fn get_kvs_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.kvs - } - - fn mut_kvs_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.kvs - } -} - -impl ::protobuf::Message for RawScanResponse { - fn is_initialized(&self) -> bool { - for v in &self.region_error { - if !v.is_initialized() { - return false; - } - }; - for v in &self.kvs { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; - }, - 2 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.kvs)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.region_error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - for value in &self.kvs { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.region_error.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - for v in &self.kvs { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RawScanResponse { - fn new() -> RawScanResponse { - RawScanResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_error", - RawScanResponse::get_region_error_for_reflect, - RawScanResponse::mut_region_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "kvs", - RawScanResponse::get_kvs_for_reflect, - RawScanResponse::mut_kvs_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RawScanResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RawScanResponse { - fn clear(&mut self) { - self.clear_region_error(); - self.clear_kvs(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RawScanResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RawScanResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct WriteInfo { - // message fields - pub start_ts: u64, - pub field_type: Op, - pub commit_ts: u64, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for WriteInfo {} - -impl WriteInfo { - pub fn new() -> WriteInfo { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static WriteInfo { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const WriteInfo, - }; - unsafe { - instance.get(WriteInfo::new) - } - } - - // uint64 start_ts = 1; - - pub fn clear_start_ts(&mut self) { - self.start_ts = 0; - } - - // Param is passed by value, moved - pub fn set_start_ts(&mut self, v: u64) { - self.start_ts = v; - } - - pub fn get_start_ts(&self) -> u64 { - self.start_ts - } - - fn get_start_ts_for_reflect(&self) -> &u64 { - &self.start_ts - } - - fn mut_start_ts_for_reflect(&mut self) -> &mut u64 { - &mut self.start_ts - } - - // .kvrpcpb.Op type = 2; - - pub fn clear_field_type(&mut self) { - self.field_type = Op::Put; - } - - // Param is passed by value, moved - pub fn set_field_type(&mut self, v: Op) { - self.field_type = v; - } - - pub fn get_field_type(&self) -> Op { - self.field_type - } - - fn get_field_type_for_reflect(&self) -> &Op { - &self.field_type - } - - fn mut_field_type_for_reflect(&mut self) -> &mut Op { - &mut self.field_type - } - - // uint64 commit_ts = 3; - - pub fn clear_commit_ts(&mut self) { - self.commit_ts = 0; - } - - // Param is passed by value, moved - pub fn set_commit_ts(&mut self, v: u64) { - self.commit_ts = v; - } - - pub fn get_commit_ts(&self) -> u64 { - self.commit_ts - } - - fn get_commit_ts_for_reflect(&self) -> &u64 { - &self.commit_ts - } - - fn mut_commit_ts_for_reflect(&mut self) -> &mut u64 { - &mut self.commit_ts - } -} - -impl ::protobuf::Message for WriteInfo { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.start_ts = tmp; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.field_type = tmp; - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.commit_ts = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if self.start_ts != 0 { - my_size += ::protobuf::rt::value_size(1, self.start_ts, ::protobuf::wire_format::WireTypeVarint); - } - if self.field_type != Op::Put { - my_size += ::protobuf::rt::enum_size(2, self.field_type); - } - if self.commit_ts != 0 { - my_size += ::protobuf::rt::value_size(3, self.commit_ts, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if self.start_ts != 0 { - os.write_uint64(1, self.start_ts)?; - } - if self.field_type != Op::Put { - os.write_enum(2, self.field_type.value())?; - } - if self.commit_ts != 0 { - os.write_uint64(3, self.commit_ts)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for WriteInfo { - fn new() -> WriteInfo { - WriteInfo::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "start_ts", - WriteInfo::get_start_ts_for_reflect, - WriteInfo::mut_start_ts_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "type", - WriteInfo::get_field_type_for_reflect, - WriteInfo::mut_field_type_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "commit_ts", - WriteInfo::get_commit_ts_for_reflect, - WriteInfo::mut_commit_ts_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "WriteInfo", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for WriteInfo { - fn clear(&mut self) { - self.clear_start_ts(); - self.clear_field_type(); - self.clear_commit_ts(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for WriteInfo { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for WriteInfo { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ValueInfo { - // message fields - pub value: ::std::vec::Vec, - pub ts: u64, - pub is_short_value: bool, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for ValueInfo {} - -impl ValueInfo { - pub fn new() -> ValueInfo { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static ValueInfo { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ValueInfo, - }; - unsafe { - instance.get(ValueInfo::new) - } - } - - // bytes value = 1; - - pub fn clear_value(&mut self) { - self.value.clear(); - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: ::std::vec::Vec) { - self.value = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { - &mut self.value - } - - // Take field - pub fn take_value(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.value, ::std::vec::Vec::new()) - } - - pub fn get_value(&self) -> &[u8] { - &self.value - } - - fn get_value_for_reflect(&self) -> &::std::vec::Vec { - &self.value - } - - fn mut_value_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.value - } - - // uint64 ts = 2; - - pub fn clear_ts(&mut self) { - self.ts = 0; - } - - // Param is passed by value, moved - pub fn set_ts(&mut self, v: u64) { - self.ts = v; - } - - pub fn get_ts(&self) -> u64 { - self.ts - } - - fn get_ts_for_reflect(&self) -> &u64 { - &self.ts - } - - fn mut_ts_for_reflect(&mut self) -> &mut u64 { - &mut self.ts - } - - // bool is_short_value = 3; - - pub fn clear_is_short_value(&mut self) { - self.is_short_value = false; - } - - // Param is passed by value, moved - pub fn set_is_short_value(&mut self, v: bool) { - self.is_short_value = v; - } - - pub fn get_is_short_value(&self) -> bool { - self.is_short_value - } - - fn get_is_short_value_for_reflect(&self) -> &bool { - &self.is_short_value - } - - fn mut_is_short_value_for_reflect(&mut self) -> &mut bool { - &mut self.is_short_value - } -} - -impl ::protobuf::Message for ValueInfo { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.value)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.ts = tmp; - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_bool()?; - self.is_short_value = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.value.is_empty() { - my_size += ::protobuf::rt::bytes_size(1, &self.value); - } - if self.ts != 0 { - my_size += ::protobuf::rt::value_size(2, self.ts, ::protobuf::wire_format::WireTypeVarint); - } - if self.is_short_value != false { - my_size += 2; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.value.is_empty() { - os.write_bytes(1, &self.value)?; - } - if self.ts != 0 { - os.write_uint64(2, self.ts)?; - } - if self.is_short_value != false { - os.write_bool(3, self.is_short_value)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for ValueInfo { - fn new() -> ValueInfo { - ValueInfo::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "value", - ValueInfo::get_value_for_reflect, - ValueInfo::mut_value_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "ts", - ValueInfo::get_ts_for_reflect, - ValueInfo::mut_ts_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( - "is_short_value", - ValueInfo::get_is_short_value_for_reflect, - ValueInfo::mut_is_short_value_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "ValueInfo", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for ValueInfo { - fn clear(&mut self) { - self.clear_value(); - self.clear_ts(); - self.clear_is_short_value(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ValueInfo { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ValueInfo { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct MvccInfo { - // message fields - pub lock: ::protobuf::SingularPtrField, - pub writes: ::protobuf::RepeatedField, - pub values: ::protobuf::RepeatedField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for MvccInfo {} - -impl MvccInfo { - pub fn new() -> MvccInfo { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static MvccInfo { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const MvccInfo, - }; - unsafe { - instance.get(MvccInfo::new) - } - } - - // .kvrpcpb.LockInfo lock = 1; - - pub fn clear_lock(&mut self) { - self.lock.clear(); - } - - pub fn has_lock(&self) -> bool { - self.lock.is_some() - } - - // Param is passed by value, moved - pub fn set_lock(&mut self, v: LockInfo) { - self.lock = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_lock(&mut self) -> &mut LockInfo { - if self.lock.is_none() { - self.lock.set_default(); - } - self.lock.as_mut().unwrap() - } - - // Take field - pub fn take_lock(&mut self) -> LockInfo { - self.lock.take().unwrap_or_else(|| LockInfo::new()) - } - - pub fn get_lock(&self) -> &LockInfo { - self.lock.as_ref().unwrap_or_else(|| LockInfo::default_instance()) - } - - fn get_lock_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.lock - } - - fn mut_lock_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.lock - } - - // repeated .kvrpcpb.WriteInfo writes = 2; - - pub fn clear_writes(&mut self) { - self.writes.clear(); - } - - // Param is passed by value, moved - pub fn set_writes(&mut self, v: ::protobuf::RepeatedField) { - self.writes = v; - } - - // Mutable pointer to the field. - pub fn mut_writes(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.writes - } - - // Take field - pub fn take_writes(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.writes, ::protobuf::RepeatedField::new()) - } - - pub fn get_writes(&self) -> &[WriteInfo] { - &self.writes - } - - fn get_writes_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.writes - } - - fn mut_writes_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.writes - } - - // repeated .kvrpcpb.ValueInfo values = 3; - - pub fn clear_values(&mut self) { - self.values.clear(); - } - - // Param is passed by value, moved - pub fn set_values(&mut self, v: ::protobuf::RepeatedField) { - self.values = v; - } - - // Mutable pointer to the field. - pub fn mut_values(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.values - } - - // Take field - pub fn take_values(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.values, ::protobuf::RepeatedField::new()) - } - - pub fn get_values(&self) -> &[ValueInfo] { - &self.values - } - - fn get_values_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.values - } - - fn mut_values_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.values - } -} - -impl ::protobuf::Message for MvccInfo { - fn is_initialized(&self) -> bool { - for v in &self.lock { - if !v.is_initialized() { - return false; - } - }; - for v in &self.writes { - if !v.is_initialized() { - return false; - } - }; - for v in &self.values { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.lock)?; - }, - 2 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.writes)?; - }, - 3 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.values)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.lock.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - for value in &self.writes { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - for value in &self.values { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.lock.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - for v in &self.writes { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - for v in &self.values { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for MvccInfo { - fn new() -> MvccInfo { - MvccInfo::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "lock", - MvccInfo::get_lock_for_reflect, - MvccInfo::mut_lock_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "writes", - MvccInfo::get_writes_for_reflect, - MvccInfo::mut_writes_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "values", - MvccInfo::get_values_for_reflect, - MvccInfo::mut_values_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "MvccInfo", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for MvccInfo { - fn clear(&mut self) { - self.clear_lock(); - self.clear_writes(); - self.clear_values(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for MvccInfo { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MvccInfo { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct MvccGetByKeyRequest { - // message fields - pub context: ::protobuf::SingularPtrField, - pub key: ::std::vec::Vec, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for MvccGetByKeyRequest {} - -impl MvccGetByKeyRequest { - pub fn new() -> MvccGetByKeyRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static MvccGetByKeyRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const MvccGetByKeyRequest, - }; - unsafe { - instance.get(MvccGetByKeyRequest::new) - } - } - - // .kvrpcpb.Context context = 1; - - pub fn clear_context(&mut self) { - self.context.clear(); - } - - pub fn has_context(&self) -> bool { - self.context.is_some() - } - - // Param is passed by value, moved - pub fn set_context(&mut self, v: Context) { - self.context = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_context(&mut self) -> &mut Context { - if self.context.is_none() { - self.context.set_default(); - } - self.context.as_mut().unwrap() - } - - // Take field - pub fn take_context(&mut self) -> Context { - self.context.take().unwrap_or_else(|| Context::new()) - } - - pub fn get_context(&self) -> &Context { - self.context.as_ref().unwrap_or_else(|| Context::default_instance()) - } - - fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.context - } - - fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.context - } - - // bytes key = 2; - - pub fn clear_key(&mut self) { - self.key.clear(); - } - - // Param is passed by value, moved - pub fn set_key(&mut self, v: ::std::vec::Vec) { - self.key = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { - &mut self.key - } - - // Take field - pub fn take_key(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) - } - - pub fn get_key(&self) -> &[u8] { - &self.key - } - - fn get_key_for_reflect(&self) -> &::std::vec::Vec { - &self.key - } - - fn mut_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.key - } -} - -impl ::protobuf::Message for MvccGetByKeyRequest { - fn is_initialized(&self) -> bool { - for v in &self.context { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.context.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.key.is_empty() { - my_size += ::protobuf::rt::bytes_size(2, &self.key); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.context.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.key.is_empty() { - os.write_bytes(2, &self.key)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for MvccGetByKeyRequest { - fn new() -> MvccGetByKeyRequest { - MvccGetByKeyRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "context", - MvccGetByKeyRequest::get_context_for_reflect, - MvccGetByKeyRequest::mut_context_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "key", - MvccGetByKeyRequest::get_key_for_reflect, - MvccGetByKeyRequest::mut_key_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "MvccGetByKeyRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for MvccGetByKeyRequest { - fn clear(&mut self) { - self.clear_context(); - self.clear_key(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for MvccGetByKeyRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MvccGetByKeyRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct MvccGetByKeyResponse { - // message fields - pub region_error: ::protobuf::SingularPtrField, - pub error: ::std::string::String, - pub info: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for MvccGetByKeyResponse {} - -impl MvccGetByKeyResponse { - pub fn new() -> MvccGetByKeyResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static MvccGetByKeyResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const MvccGetByKeyResponse, - }; - unsafe { - instance.get(MvccGetByKeyResponse::new) - } - } - - // .errorpb.Error region_error = 1; - - pub fn clear_region_error(&mut self) { - self.region_error.clear(); - } - - pub fn has_region_error(&self) -> bool { - self.region_error.is_some() - } - - // Param is passed by value, moved - pub fn set_region_error(&mut self, v: super::errorpb::Error) { - self.region_error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { - if self.region_error.is_none() { - self.region_error.set_default(); - } - self.region_error.as_mut().unwrap() - } - - // Take field - pub fn take_region_error(&mut self) -> super::errorpb::Error { - self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) - } - - pub fn get_region_error(&self) -> &super::errorpb::Error { - self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) - } - - fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_error - } - - fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_error - } - - // string error = 2; - - pub fn clear_error(&mut self) { - self.error.clear(); - } - - // Param is passed by value, moved - pub fn set_error(&mut self, v: ::std::string::String) { - self.error = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_error(&mut self) -> &mut ::std::string::String { - &mut self.error - } - - // Take field - pub fn take_error(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.error, ::std::string::String::new()) - } - - pub fn get_error(&self) -> &str { - &self.error - } - - fn get_error_for_reflect(&self) -> &::std::string::String { - &self.error - } - - fn mut_error_for_reflect(&mut self) -> &mut ::std::string::String { - &mut self.error - } - - // .kvrpcpb.MvccInfo info = 3; - - pub fn clear_info(&mut self) { - self.info.clear(); - } - - pub fn has_info(&self) -> bool { - self.info.is_some() - } - - // Param is passed by value, moved - pub fn set_info(&mut self, v: MvccInfo) { - self.info = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_info(&mut self) -> &mut MvccInfo { - if self.info.is_none() { - self.info.set_default(); - } - self.info.as_mut().unwrap() - } - - // Take field - pub fn take_info(&mut self) -> MvccInfo { - self.info.take().unwrap_or_else(|| MvccInfo::new()) - } - - pub fn get_info(&self) -> &MvccInfo { - self.info.as_ref().unwrap_or_else(|| MvccInfo::default_instance()) - } - - fn get_info_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.info - } - - fn mut_info_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.info - } -} - -impl ::protobuf::Message for MvccGetByKeyResponse { - fn is_initialized(&self) -> bool { - for v in &self.region_error { - if !v.is_initialized() { - return false; - } - }; - for v in &self.info { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.error)?; - }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.info)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.region_error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.error.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.error); - } - if let Some(ref v) = self.info.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.region_error.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.error.is_empty() { - os.write_string(2, &self.error)?; - } - if let Some(ref v) = self.info.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for MvccGetByKeyResponse { - fn new() -> MvccGetByKeyResponse { - MvccGetByKeyResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_error", - MvccGetByKeyResponse::get_region_error_for_reflect, - MvccGetByKeyResponse::mut_region_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "error", - MvccGetByKeyResponse::get_error_for_reflect, - MvccGetByKeyResponse::mut_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "info", - MvccGetByKeyResponse::get_info_for_reflect, - MvccGetByKeyResponse::mut_info_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "MvccGetByKeyResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for MvccGetByKeyResponse { - fn clear(&mut self) { - self.clear_region_error(); - self.clear_error(); - self.clear_info(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for MvccGetByKeyResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MvccGetByKeyResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct MvccGetByStartTsRequest { - // message fields - pub context: ::protobuf::SingularPtrField, - pub start_ts: u64, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for MvccGetByStartTsRequest {} - -impl MvccGetByStartTsRequest { - pub fn new() -> MvccGetByStartTsRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static MvccGetByStartTsRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const MvccGetByStartTsRequest, - }; - unsafe { - instance.get(MvccGetByStartTsRequest::new) - } - } - - // .kvrpcpb.Context context = 1; - - pub fn clear_context(&mut self) { - self.context.clear(); - } - - pub fn has_context(&self) -> bool { - self.context.is_some() - } - - // Param is passed by value, moved - pub fn set_context(&mut self, v: Context) { - self.context = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_context(&mut self) -> &mut Context { - if self.context.is_none() { - self.context.set_default(); - } - self.context.as_mut().unwrap() - } - - // Take field - pub fn take_context(&mut self) -> Context { - self.context.take().unwrap_or_else(|| Context::new()) - } - - pub fn get_context(&self) -> &Context { - self.context.as_ref().unwrap_or_else(|| Context::default_instance()) - } - - fn get_context_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.context - } - - fn mut_context_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.context - } - - // uint64 start_ts = 2; - - pub fn clear_start_ts(&mut self) { - self.start_ts = 0; - } - - // Param is passed by value, moved - pub fn set_start_ts(&mut self, v: u64) { - self.start_ts = v; - } - - pub fn get_start_ts(&self) -> u64 { - self.start_ts - } - - fn get_start_ts_for_reflect(&self) -> &u64 { - &self.start_ts - } - - fn mut_start_ts_for_reflect(&mut self) -> &mut u64 { - &mut self.start_ts - } -} - -impl ::protobuf::Message for MvccGetByStartTsRequest { - fn is_initialized(&self) -> bool { - for v in &self.context { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.context)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.start_ts = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.context.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.start_ts != 0 { - my_size += ::protobuf::rt::value_size(2, self.start_ts, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.context.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.start_ts != 0 { - os.write_uint64(2, self.start_ts)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for MvccGetByStartTsRequest { - fn new() -> MvccGetByStartTsRequest { - MvccGetByStartTsRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "context", - MvccGetByStartTsRequest::get_context_for_reflect, - MvccGetByStartTsRequest::mut_context_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "start_ts", - MvccGetByStartTsRequest::get_start_ts_for_reflect, - MvccGetByStartTsRequest::mut_start_ts_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "MvccGetByStartTsRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for MvccGetByStartTsRequest { - fn clear(&mut self) { - self.clear_context(); - self.clear_start_ts(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for MvccGetByStartTsRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MvccGetByStartTsRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct MvccGetByStartTsResponse { - // message fields - pub region_error: ::protobuf::SingularPtrField, - pub error: ::std::string::String, - pub key: ::std::vec::Vec, - pub info: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for MvccGetByStartTsResponse {} - -impl MvccGetByStartTsResponse { - pub fn new() -> MvccGetByStartTsResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static MvccGetByStartTsResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const MvccGetByStartTsResponse, - }; - unsafe { - instance.get(MvccGetByStartTsResponse::new) - } - } - - // .errorpb.Error region_error = 1; - - pub fn clear_region_error(&mut self) { - self.region_error.clear(); - } - - pub fn has_region_error(&self) -> bool { - self.region_error.is_some() - } - - // Param is passed by value, moved - pub fn set_region_error(&mut self, v: super::errorpb::Error) { - self.region_error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_error(&mut self) -> &mut super::errorpb::Error { - if self.region_error.is_none() { - self.region_error.set_default(); - } - self.region_error.as_mut().unwrap() - } - - // Take field - pub fn take_region_error(&mut self) -> super::errorpb::Error { - self.region_error.take().unwrap_or_else(|| super::errorpb::Error::new()) - } - - pub fn get_region_error(&self) -> &super::errorpb::Error { - self.region_error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) - } - - fn get_region_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_error - } - - fn mut_region_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_error - } - - // string error = 2; - - pub fn clear_error(&mut self) { - self.error.clear(); - } - - // Param is passed by value, moved - pub fn set_error(&mut self, v: ::std::string::String) { - self.error = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_error(&mut self) -> &mut ::std::string::String { - &mut self.error - } - - // Take field - pub fn take_error(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.error, ::std::string::String::new()) - } - - pub fn get_error(&self) -> &str { - &self.error - } - - fn get_error_for_reflect(&self) -> &::std::string::String { - &self.error - } - - fn mut_error_for_reflect(&mut self) -> &mut ::std::string::String { - &mut self.error - } - - // bytes key = 3; - - pub fn clear_key(&mut self) { - self.key.clear(); - } - - // Param is passed by value, moved - pub fn set_key(&mut self, v: ::std::vec::Vec) { - self.key = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { - &mut self.key - } - - // Take field - pub fn take_key(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) - } - - pub fn get_key(&self) -> &[u8] { - &self.key - } - - fn get_key_for_reflect(&self) -> &::std::vec::Vec { - &self.key - } - - fn mut_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.key - } - - // .kvrpcpb.MvccInfo info = 4; - - pub fn clear_info(&mut self) { - self.info.clear(); - } - - pub fn has_info(&self) -> bool { - self.info.is_some() - } - - // Param is passed by value, moved - pub fn set_info(&mut self, v: MvccInfo) { - self.info = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_info(&mut self) -> &mut MvccInfo { - if self.info.is_none() { - self.info.set_default(); - } - self.info.as_mut().unwrap() - } - - // Take field - pub fn take_info(&mut self) -> MvccInfo { - self.info.take().unwrap_or_else(|| MvccInfo::new()) - } - - pub fn get_info(&self) -> &MvccInfo { - self.info.as_ref().unwrap_or_else(|| MvccInfo::default_instance()) - } - - fn get_info_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.info - } - - fn mut_info_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.info - } -} - -impl ::protobuf::Message for MvccGetByStartTsResponse { - fn is_initialized(&self) -> bool { - for v in &self.region_error { - if !v.is_initialized() { - return false; - } - }; - for v in &self.info { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_error)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.error)?; - }, - 3 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; - }, - 4 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.info)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.region_error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.error.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.error); - } - if !self.key.is_empty() { - my_size += ::protobuf::rt::bytes_size(3, &self.key); - } - if let Some(ref v) = self.info.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.region_error.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.error.is_empty() { - os.write_string(2, &self.error)?; - } - if !self.key.is_empty() { - os.write_bytes(3, &self.key)?; - } - if let Some(ref v) = self.info.as_ref() { - os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for MvccGetByStartTsResponse { - fn new() -> MvccGetByStartTsResponse { - MvccGetByStartTsResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_error", - MvccGetByStartTsResponse::get_region_error_for_reflect, - MvccGetByStartTsResponse::mut_region_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "error", - MvccGetByStartTsResponse::get_error_for_reflect, - MvccGetByStartTsResponse::mut_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "key", - MvccGetByStartTsResponse::get_key_for_reflect, - MvccGetByStartTsResponse::mut_key_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "info", - MvccGetByStartTsResponse::get_info_for_reflect, - MvccGetByStartTsResponse::mut_info_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "MvccGetByStartTsResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for MvccGetByStartTsResponse { - fn clear(&mut self) { - self.clear_region_error(); - self.clear_error(); - self.clear_key(); - self.clear_info(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for MvccGetByStartTsResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MvccGetByStartTsResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum CommandPri { - Normal = 0, - Low = 1, - High = 2, -} - -impl ::protobuf::ProtobufEnum for CommandPri { - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(CommandPri::Normal), - 1 => ::std::option::Option::Some(CommandPri::Low), - 2 => ::std::option::Option::Some(CommandPri::High), - _ => ::std::option::Option::None - } - } - - fn values() -> &'static [Self] { - static values: &'static [CommandPri] = &[ - CommandPri::Normal, - CommandPri::Low, - CommandPri::High, - ]; - values - } - - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, - }; - unsafe { - descriptor.get(|| { - ::protobuf::reflect::EnumDescriptor::new("CommandPri", file_descriptor_proto()) - }) - } - } -} - -impl ::std::marker::Copy for CommandPri { -} - -impl ::std::default::Default for CommandPri { - fn default() -> Self { - CommandPri::Normal - } -} - -impl ::protobuf::reflect::ProtobufValue for CommandPri { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) - } -} - -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum IsolationLevel { - SI = 0, - RC = 1, -} - -impl ::protobuf::ProtobufEnum for IsolationLevel { - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(IsolationLevel::SI), - 1 => ::std::option::Option::Some(IsolationLevel::RC), - _ => ::std::option::Option::None - } - } - - fn values() -> &'static [Self] { - static values: &'static [IsolationLevel] = &[ - IsolationLevel::SI, - IsolationLevel::RC, - ]; - values - } - - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, - }; - unsafe { - descriptor.get(|| { - ::protobuf::reflect::EnumDescriptor::new("IsolationLevel", file_descriptor_proto()) - }) - } - } -} - -impl ::std::marker::Copy for IsolationLevel { -} - -impl ::std::default::Default for IsolationLevel { - fn default() -> Self { - IsolationLevel::SI - } -} - -impl ::protobuf::reflect::ProtobufValue for IsolationLevel { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) - } -} - -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum Op { - Put = 0, - Del = 1, - Lock = 2, - Rollback = 3, -} - -impl ::protobuf::ProtobufEnum for Op { - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(Op::Put), - 1 => ::std::option::Option::Some(Op::Del), - 2 => ::std::option::Option::Some(Op::Lock), - 3 => ::std::option::Option::Some(Op::Rollback), - _ => ::std::option::Option::None - } - } - - fn values() -> &'static [Self] { - static values: &'static [Op] = &[ - Op::Put, - Op::Del, - Op::Lock, - Op::Rollback, - ]; - values - } - - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, - }; - unsafe { - descriptor.get(|| { - ::protobuf::reflect::EnumDescriptor::new("Op", file_descriptor_proto()) - }) - } - } -} - -impl ::std::marker::Copy for Op { -} - -impl ::std::default::Default for Op { - fn default() -> Self { - Op::Put - } -} - -impl ::protobuf::reflect::ProtobufValue for Op { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\rkvrpcpb.proto\x12\x07kvrpcpb\x1a\x0cmetapb.proto\x1a\rerrorpb.proto\ - \x1a\x14gogoproto/gogo.proto\"}\n\x08LockInfo\x12!\n\x0cprimary_lock\x18\ - \x01\x20\x01(\x0cR\x0bprimaryLock\x12!\n\x0clock_version\x18\x02\x20\x01\ - (\x04R\x0blockVersion\x12\x10\n\x03key\x18\x03\x20\x01(\x0cR\x03key\x12\ - \x19\n\x08lock_ttl\x18\x04\x20\x01(\x04R\x07lockTtl\"i\n\x08KeyError\x12\ - )\n\x06locked\x18\x01\x20\x01(\x0b2\x11.kvrpcpb.LockInfoR\x06locked\x12\ - \x1c\n\tretryable\x18\x02\x20\x01(\tR\tretryable\x12\x14\n\x05abort\x18\ - \x03\x20\x01(\tR\x05abort\"\x9a\x02\n\x07Context\x12\x1b\n\tregion_id\ - \x18\x01\x20\x01(\x04R\x08regionId\x126\n\x0cregion_epoch\x18\x02\x20\ - \x01(\x0b2\x13.metapb.RegionEpochR\x0bregionEpoch\x12\x20\n\x04peer\x18\ - \x03\x20\x01(\x0b2\x0c.metapb.PeerR\x04peer\x12\x12\n\x04term\x18\x05\ - \x20\x01(\x04R\x04term\x12/\n\x08priority\x18\x06\x20\x01(\x0e2\x13.kvrp\ - cpb.CommandPriR\x08priority\x12@\n\x0fisolation_level\x18\x07\x20\x01(\ - \x0e2\x17.kvrpcpb.IsolationLevelR\x0eisolationLevelJ\x04\x08\x04\x10\x05\ - R\x0bread_quorum\"d\n\nGetRequest\x12*\n\x07context\x18\x01\x20\x01(\x0b\ - 2\x10.kvrpcpb.ContextR\x07context\x12\x10\n\x03key\x18\x02\x20\x01(\x0cR\ - \x03key\x12\x18\n\x07version\x18\x03\x20\x01(\x04R\x07version\"\x7f\n\ - \x0bGetResponse\x121\n\x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb\ - .ErrorR\x0bregionError\x12'\n\x05error\x18\x02\x20\x01(\x0b2\x11.kvrpcpb\ - .KeyErrorR\x05error\x12\x14\n\x05value\x18\x03\x20\x01(\x0cR\x05value\"\ - \xa1\x01\n\x0bScanRequest\x12*\n\x07context\x18\x01\x20\x01(\x0b2\x10.kv\ - rpcpb.ContextR\x07context\x12\x1b\n\tstart_key\x18\x02\x20\x01(\x0cR\x08\ - startKey\x12\x14\n\x05limit\x18\x03\x20\x01(\rR\x05limit\x12\x18\n\x07ve\ - rsion\x18\x04\x20\x01(\x04R\x07version\x12\x19\n\x08key_only\x18\x05\x20\ - \x01(\x08R\x07keyOnly\"Y\n\x06KvPair\x12'\n\x05error\x18\x01\x20\x01(\ - \x0b2\x11.kvrpcpb.KeyErrorR\x05error\x12\x10\n\x03key\x18\x02\x20\x01(\ - \x0cR\x03key\x12\x14\n\x05value\x18\x03\x20\x01(\x0cR\x05value\"h\n\x0cS\ - canResponse\x121\n\x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb.Err\ - orR\x0bregionError\x12%\n\x05pairs\x18\x02\x20\x03(\x0b2\x0f.kvrpcpb.KvP\ - airR\x05pairs\"O\n\x08Mutation\x12\x1b\n\x02op\x18\x01\x20\x01(\x0e2\x0b\ - .kvrpcpb.OpR\x02op\x12\x10\n\x03key\x18\x02\x20\x01(\x0cR\x03key\x12\x14\ - \n\x05value\x18\x03\x20\x01(\x0cR\x05value\"\x85\x02\n\x0fPrewriteReques\ - t\x12*\n\x07context\x18\x01\x20\x01(\x0b2\x10.kvrpcpb.ContextR\x07contex\ - t\x12/\n\tmutations\x18\x02\x20\x03(\x0b2\x11.kvrpcpb.MutationR\tmutatio\ - ns\x12!\n\x0cprimary_lock\x18\x03\x20\x01(\x0cR\x0bprimaryLock\x12#\n\rs\ - tart_version\x18\x04\x20\x01(\x04R\x0cstartVersion\x12\x19\n\x08lock_ttl\ - \x18\x05\x20\x01(\x04R\x07lockTtl\x122\n\x15skip_constraint_check\x18\ - \x06\x20\x01(\x08R\x13skipConstraintCheck\"p\n\x10PrewriteResponse\x121\ - \n\x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb.ErrorR\x0bregionErr\ - or\x12)\n\x06errors\x18\x02\x20\x03(\x0b2\x11.kvrpcpb.KeyErrorR\x06error\ - s\"\xa9\x01\n\rCommitRequest\x12*\n\x07context\x18\x01\x20\x01(\x0b2\x10\ - .kvrpcpb.ContextR\x07context\x12#\n\rstart_version\x18\x02\x20\x01(\x04R\ - \x0cstartVersion\x12\x12\n\x04keys\x18\x03\x20\x03(\x0cR\x04keys\x12%\n\ - \x0ecommit_version\x18\x04\x20\x01(\x04R\rcommitVersionJ\x04\x08\x05\x10\ - \x06R\x06binlog\"l\n\x0eCommitResponse\x121\n\x0cregion_error\x18\x01\ - \x20\x01(\x0b2\x0e.errorpb.ErrorR\x0bregionError\x12'\n\x05error\x18\x02\ - \x20\x01(\x0b2\x11.kvrpcpb.KeyErrorR\x05error\"g\n\rImportRequest\x12/\n\ - \tmutations\x18\x01\x20\x03(\x0b2\x11.kvrpcpb.MutationR\tmutations\x12%\ - \n\x0ecommit_version\x18\x02\x20\x01(\x04R\rcommitVersion\"Y\n\x0eImport\ - Response\x121\n\x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb.ErrorR\ - \x0bregionError\x12\x14\n\x05error\x18\x02\x20\x01(\tR\x05error\"{\n\x14\ - BatchRollbackRequest\x12*\n\x07context\x18\x01\x20\x01(\x0b2\x10.kvrpcpb\ - .ContextR\x07context\x12#\n\rstart_version\x18\x02\x20\x01(\x04R\x0cstar\ - tVersion\x12\x12\n\x04keys\x18\x03\x20\x03(\x0cR\x04keys\"s\n\x15BatchRo\ - llbackResponse\x121\n\x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb.\ - ErrorR\x0bregionError\x12'\n\x05error\x18\x02\x20\x01(\x0b2\x11.kvrpcpb.\ - KeyErrorR\x05error\"s\n\x0eCleanupRequest\x12*\n\x07context\x18\x01\x20\ - \x01(\x0b2\x10.kvrpcpb.ContextR\x07context\x12\x10\n\x03key\x18\x02\x20\ - \x01(\x0cR\x03key\x12#\n\rstart_version\x18\x03\x20\x01(\x04R\x0cstartVe\ - rsion\"\x94\x01\n\x0fCleanupResponse\x121\n\x0cregion_error\x18\x01\x20\ - \x01(\x0b2\x0e.errorpb.ErrorR\x0bregionError\x12'\n\x05error\x18\x02\x20\ - \x01(\x0b2\x11.kvrpcpb.KeyErrorR\x05error\x12%\n\x0ecommit_version\x18\ - \x03\x20\x01(\x04R\rcommitVersion\"k\n\x0fBatchGetRequest\x12*\n\x07cont\ - ext\x18\x01\x20\x01(\x0b2\x10.kvrpcpb.ContextR\x07context\x12\x12\n\x04k\ - eys\x18\x02\x20\x03(\x0cR\x04keys\x12\x18\n\x07version\x18\x03\x20\x01(\ - \x04R\x07version\"l\n\x10BatchGetResponse\x121\n\x0cregion_error\x18\x01\ - \x20\x01(\x0b2\x0e.errorpb.ErrorR\x0bregionError\x12%\n\x05pairs\x18\x02\ - \x20\x03(\x0b2\x0f.kvrpcpb.KvPairR\x05pairs\"^\n\x0fScanLockRequest\x12*\ - \n\x07context\x18\x01\x20\x01(\x0b2\x10.kvrpcpb.ContextR\x07context\x12\ - \x1f\n\x0bmax_version\x18\x02\x20\x01(\x04R\nmaxVersion\"\x97\x01\n\x10S\ - canLockResponse\x121\n\x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb\ - .ErrorR\x0bregionError\x12'\n\x05error\x18\x02\x20\x01(\x0b2\x11.kvrpcpb\ - .KeyErrorR\x05error\x12'\n\x05locks\x18\x03\x20\x03(\x0b2\x11.kvrpcpb.Lo\ - ckInfoR\x05locks\"\x8c\x01\n\x12ResolveLockRequest\x12*\n\x07context\x18\ - \x01\x20\x01(\x0b2\x10.kvrpcpb.ContextR\x07context\x12#\n\rstart_version\ - \x18\x02\x20\x01(\x04R\x0cstartVersion\x12%\n\x0ecommit_version\x18\x03\ - \x20\x01(\x04R\rcommitVersion\"q\n\x13ResolveLockResponse\x121\n\x0cregi\ - on_error\x18\x01\x20\x01(\x0b2\x0e.errorpb.ErrorR\x0bregionError\x12'\n\ - \x05error\x18\x02\x20\x01(\x0b2\x11.kvrpcpb.KeyErrorR\x05error\"V\n\tGCR\ - equest\x12*\n\x07context\x18\x01\x20\x01(\x0b2\x10.kvrpcpb.ContextR\x07c\ - ontext\x12\x1d\n\nsafe_point\x18\x02\x20\x01(\x04R\tsafePoint\"h\n\nGCRe\ - sponse\x121\n\x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb.ErrorR\ - \x0bregionError\x12'\n\x05error\x18\x02\x20\x01(\x0b2\x11.kvrpcpb.KeyErr\ - orR\x05error\"M\n\rRawGetRequest\x12*\n\x07context\x18\x01\x20\x01(\x0b2\ - \x10.kvrpcpb.ContextR\x07context\x12\x10\n\x03key\x18\x02\x20\x01(\x0cR\ - \x03key\"o\n\x0eRawGetResponse\x121\n\x0cregion_error\x18\x01\x20\x01(\ - \x0b2\x0e.errorpb.ErrorR\x0bregionError\x12\x14\n\x05error\x18\x02\x20\ - \x01(\tR\x05error\x12\x14\n\x05value\x18\x03\x20\x01(\x0cR\x05value\"c\n\ - \rRawPutRequest\x12*\n\x07context\x18\x01\x20\x01(\x0b2\x10.kvrpcpb.Cont\ - extR\x07context\x12\x10\n\x03key\x18\x02\x20\x01(\x0cR\x03key\x12\x14\n\ - \x05value\x18\x03\x20\x01(\x0cR\x05value\"Y\n\x0eRawPutResponse\x121\n\ - \x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb.ErrorR\x0bregionError\ - \x12\x14\n\x05error\x18\x02\x20\x01(\tR\x05error\"P\n\x10RawDeleteReques\ - t\x12*\n\x07context\x18\x01\x20\x01(\x0b2\x10.kvrpcpb.ContextR\x07contex\ - t\x12\x10\n\x03key\x18\x02\x20\x01(\x0cR\x03key\"\\\n\x11RawDeleteRespon\ - se\x121\n\x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb.ErrorR\x0bre\ - gionError\x12\x14\n\x05error\x18\x02\x20\x01(\tR\x05error\"v\n\x12Delete\ - RangeRequest\x12*\n\x07context\x18\x01\x20\x01(\x0b2\x10.kvrpcpb.Context\ - R\x07context\x12\x1b\n\tstart_key\x18\x02\x20\x01(\x0cR\x08startKey\x12\ - \x17\n\x07end_key\x18\x03\x20\x01(\x0cR\x06endKey\"^\n\x13DeleteRangeRes\ - ponse\x121\n\x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb.ErrorR\ - \x0bregionError\x12\x14\n\x05error\x18\x02\x20\x01(\tR\x05error\"o\n\x0e\ - RawScanRequest\x12*\n\x07context\x18\x01\x20\x01(\x0b2\x10.kvrpcpb.Conte\ - xtR\x07context\x12\x1b\n\tstart_key\x18\x02\x20\x01(\x0cR\x08startKey\ - \x12\x14\n\x05limit\x18\x03\x20\x01(\rR\x05limit\"g\n\x0fRawScanResponse\ - \x121\n\x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb.ErrorR\x0bregi\ - onError\x12!\n\x03kvs\x18\x02\x20\x03(\x0b2\x0f.kvrpcpb.KvPairR\x03kvs\"\ - d\n\tWriteInfo\x12\x19\n\x08start_ts\x18\x01\x20\x01(\x04R\x07startTs\ - \x12\x1f\n\x04type\x18\x02\x20\x01(\x0e2\x0b.kvrpcpb.OpR\x04type\x12\x1b\ - \n\tcommit_ts\x18\x03\x20\x01(\x04R\x08commitTs\"W\n\tValueInfo\x12\x14\ - \n\x05value\x18\x01\x20\x01(\x0cR\x05value\x12\x0e\n\x02ts\x18\x02\x20\ - \x01(\x04R\x02ts\x12$\n\x0eis_short_value\x18\x03\x20\x01(\x08R\x0cisSho\ - rtValue\"\x89\x01\n\x08MvccInfo\x12%\n\x04lock\x18\x01\x20\x01(\x0b2\x11\ - .kvrpcpb.LockInfoR\x04lock\x12*\n\x06writes\x18\x02\x20\x03(\x0b2\x12.kv\ - rpcpb.WriteInfoR\x06writes\x12*\n\x06values\x18\x03\x20\x03(\x0b2\x12.kv\ - rpcpb.ValueInfoR\x06values\"S\n\x13MvccGetByKeyRequest\x12*\n\x07context\ - \x18\x01\x20\x01(\x0b2\x10.kvrpcpb.ContextR\x07context\x12\x10\n\x03key\ - \x18\x02\x20\x01(\x0cR\x03key\"\x86\x01\n\x14MvccGetByKeyResponse\x121\n\ - \x0cregion_error\x18\x01\x20\x01(\x0b2\x0e.errorpb.ErrorR\x0bregionError\ - \x12\x14\n\x05error\x18\x02\x20\x01(\tR\x05error\x12%\n\x04info\x18\x03\ - \x20\x01(\x0b2\x11.kvrpcpb.MvccInfoR\x04info\"`\n\x17MvccGetByStartTsReq\ - uest\x12*\n\x07context\x18\x01\x20\x01(\x0b2\x10.kvrpcpb.ContextR\x07con\ - text\x12\x19\n\x08start_ts\x18\x02\x20\x01(\x04R\x07startTs\"\x9c\x01\n\ - \x18MvccGetByStartTsResponse\x121\n\x0cregion_error\x18\x01\x20\x01(\x0b\ - 2\x0e.errorpb.ErrorR\x0bregionError\x12\x14\n\x05error\x18\x02\x20\x01(\ - \tR\x05error\x12\x10\n\x03key\x18\x03\x20\x01(\x0cR\x03key\x12%\n\x04inf\ - o\x18\x04\x20\x01(\x0b2\x11.kvrpcpb.MvccInfoR\x04info*+\n\nCommandPri\ - \x12\n\n\x06Normal\x10\0\x12\x07\n\x03Low\x10\x01\x12\x08\n\x04High\x10\ - \x02*\x20\n\x0eIsolationLevel\x12\x06\n\x02SI\x10\0\x12\x06\n\x02RC\x10\ - \x01*.\n\x02Op\x12\x07\n\x03Put\x10\0\x12\x07\n\x03Del\x10\x01\x12\x08\n\ - \x04Lock\x10\x02\x12\x0c\n\x08Rollback\x10\x03B&\n\x18com.pingcap.tikv.k\ - vproto\xd0\xe2\x1e\x01\xc8\xe2\x1e\x01\xe0\xe2\x1e\x01J\xb5Z\n\x07\x12\ - \x05\0\0\xa3\x02\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\ - \x03\x01\x08\x0f\n\t\n\x02\x03\0\x12\x03\x03\x07\x15\n\t\n\x02\x03\x01\ - \x12\x03\x04\x07\x16\n\t\n\x02\x03\x02\x12\x03\x05\x07\x1d\n\x08\n\x01\ - \x08\x12\x03\x07\0(\n\x0b\n\x04\x08\xe7\x07\0\x12\x03\x07\0(\n\x0c\n\x05\ - \x08\xe7\x07\0\x02\x12\x03\x07\x07\x20\n\r\n\x06\x08\xe7\x07\0\x02\0\x12\ - \x03\x07\x07\x20\n\x0e\n\x07\x08\xe7\x07\0\x02\0\x01\x12\x03\x07\x08\x1f\ - \n\x0c\n\x05\x08\xe7\x07\0\x03\x12\x03\x07#'\n\x08\n\x01\x08\x12\x03\x08\ - \0$\n\x0b\n\x04\x08\xe7\x07\x01\x12\x03\x08\0$\n\x0c\n\x05\x08\xe7\x07\ - \x01\x02\x12\x03\x08\x07\x1c\n\r\n\x06\x08\xe7\x07\x01\x02\0\x12\x03\x08\ - \x07\x1c\n\x0e\n\x07\x08\xe7\x07\x01\x02\0\x01\x12\x03\x08\x08\x1b\n\x0c\ - \n\x05\x08\xe7\x07\x01\x03\x12\x03\x08\x1f#\n\x08\n\x01\x08\x12\x03\t\0*\ - \n\x0b\n\x04\x08\xe7\x07\x02\x12\x03\t\0*\n\x0c\n\x05\x08\xe7\x07\x02\ - \x02\x12\x03\t\x07\"\n\r\n\x06\x08\xe7\x07\x02\x02\0\x12\x03\t\x07\"\n\ - \x0e\n\x07\x08\xe7\x07\x02\x02\0\x01\x12\x03\t\x08!\n\x0c\n\x05\x08\xe7\ - \x07\x02\x03\x12\x03\t%)\n\x08\n\x01\x08\x12\x03\x0b\01\n\x0b\n\x04\x08\ - \xe7\x07\x03\x12\x03\x0b\01\n\x0c\n\x05\x08\xe7\x07\x03\x02\x12\x03\x0b\ - \x07\x13\n\r\n\x06\x08\xe7\x07\x03\x02\0\x12\x03\x0b\x07\x13\n\x0e\n\x07\ - \x08\xe7\x07\x03\x02\0\x01\x12\x03\x0b\x07\x13\n\x0c\n\x05\x08\xe7\x07\ - \x03\x07\x12\x03\x0b\x160\n\n\n\x02\x04\0\x12\x04\r\0\x12\x01\n\n\n\x03\ - \x04\0\x01\x12\x03\r\x08\x10\n\x0b\n\x04\x04\0\x02\0\x12\x03\x0e\x04\x1b\ - \n\r\n\x05\x04\0\x02\0\x04\x12\x04\x0e\x04\r\x12\n\x0c\n\x05\x04\0\x02\0\ - \x05\x12\x03\x0e\x04\t\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x0e\n\x16\n\ - \x0c\n\x05\x04\0\x02\0\x03\x12\x03\x0e\x19\x1a\n\x0b\n\x04\x04\0\x02\x01\ - \x12\x03\x0f\x04\x1c\n\r\n\x05\x04\0\x02\x01\x04\x12\x04\x0f\x04\x0e\x1b\ - \n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\x0f\x04\n\n\x0c\n\x05\x04\0\x02\ - \x01\x01\x12\x03\x0f\x0b\x17\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x0f\ - \x1a\x1b\n\x0b\n\x04\x04\0\x02\x02\x12\x03\x10\x04\x12\n\r\n\x05\x04\0\ - \x02\x02\x04\x12\x04\x10\x04\x0f\x1c\n\x0c\n\x05\x04\0\x02\x02\x05\x12\ - \x03\x10\x04\t\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x10\n\r\n\x0c\n\x05\ - \x04\0\x02\x02\x03\x12\x03\x10\x10\x11\n\x0b\n\x04\x04\0\x02\x03\x12\x03\ - \x11\x04\x18\n\r\n\x05\x04\0\x02\x03\x04\x12\x04\x11\x04\x10\x12\n\x0c\n\ - \x05\x04\0\x02\x03\x05\x12\x03\x11\x04\n\n\x0c\n\x05\x04\0\x02\x03\x01\ - \x12\x03\x11\x0b\x13\n\x0c\n\x05\x04\0\x02\x03\x03\x12\x03\x11\x16\x17\n\ - \n\n\x02\x04\x01\x12\x04\x14\0\x18\x01\n\n\n\x03\x04\x01\x01\x12\x03\x14\ - \x08\x10\nD\n\x04\x04\x01\x02\0\x12\x03\x15\x04\x18\"7\x20Client\x20shou\ - ld\x20backoff\x20or\x20cleanup\x20the\x20lock\x20then\x20retry.\n\n\r\n\ - \x05\x04\x01\x02\0\x04\x12\x04\x15\x04\x14\x12\n\x0c\n\x05\x04\x01\x02\0\ - \x06\x12\x03\x15\x04\x0c\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x15\r\x13\ - \n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x15\x16\x17\n>\n\x04\x04\x01\x02\ - \x01\x12\x03\x16\x04\x19\"1\x20Client\x20may\x20restart\x20the\x20txn.\ - \x20e.g\x20write\x20conflict.\n\n\r\n\x05\x04\x01\x02\x01\x04\x12\x04\ - \x16\x04\x15\x18\n\x0c\n\x05\x04\x01\x02\x01\x05\x12\x03\x16\x04\n\n\x0c\ - \n\x05\x04\x01\x02\x01\x01\x12\x03\x16\x0b\x14\n\x0c\n\x05\x04\x01\x02\ - \x01\x03\x12\x03\x16\x17\x18\n+\n\x04\x04\x01\x02\x02\x12\x03\x17\x04\ - \x15\"\x1e\x20Client\x20should\x20abort\x20the\x20txn.\n\n\r\n\x05\x04\ - \x01\x02\x02\x04\x12\x04\x17\x04\x16\x19\n\x0c\n\x05\x04\x01\x02\x02\x05\ - \x12\x03\x17\x04\n\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03\x17\x0b\x10\n\ - \x0c\n\x05\x04\x01\x02\x02\x03\x12\x03\x17\x13\x14\n\n\n\x02\x05\0\x12\ - \x04\x1a\0\x1e\x01\n\n\n\x03\x05\0\x01\x12\x03\x1a\x05\x0f\n,\n\x04\x05\ - \0\x02\0\x12\x03\x1b\x04\x0f\"\x1f\x20Normal\x20must\x20the\x20default\ - \x20value\n\n\x0c\n\x05\x05\0\x02\0\x01\x12\x03\x1b\x04\n\n\x0c\n\x05\ - \x05\0\x02\0\x02\x12\x03\x1b\r\x0e\n\x0b\n\x04\x05\0\x02\x01\x12\x03\x1c\ - \x04\x0c\n\x0c\n\x05\x05\0\x02\x01\x01\x12\x03\x1c\x04\x07\n\x0c\n\x05\ - \x05\0\x02\x01\x02\x12\x03\x1c\n\x0b\n\x0b\n\x04\x05\0\x02\x02\x12\x03\ - \x1d\x04\r\n\x0c\n\x05\x05\0\x02\x02\x01\x12\x03\x1d\x04\x08\n\x0c\n\x05\ - \x05\0\x02\x02\x02\x12\x03\x1d\x0b\x0c\n\n\n\x02\x05\x01\x12\x04\x20\0#\ - \x01\n\n\n\x03\x05\x01\x01\x12\x03\x20\x05\x13\n&\n\x04\x05\x01\x02\0\ - \x12\x03!\x04\x0b\"\x19\x20SI\x20=\x20snapshot\x20isolation\n\n\x0c\n\ - \x05\x05\x01\x02\0\x01\x12\x03!\x04\x06\n\x0c\n\x05\x05\x01\x02\0\x02\ - \x12\x03!\t\n\n\"\n\x04\x05\x01\x02\x01\x12\x03\"\x04\x0b\"\x15\x20RC\ - \x20=\x20read\x20committed\n\n\x0c\n\x05\x05\x01\x02\x01\x01\x12\x03\"\ - \x04\x06\n\x0c\n\x05\x05\x01\x02\x01\x02\x12\x03\"\t\n\n\n\n\x02\x04\x02\ - \x12\x04%\0.\x01\n\n\n\x03\x04\x02\x01\x12\x03%\x08\x0f\n\n\n\x03\x04\ - \x02\t\x12\x03&\r\x0f\n\x0b\n\x04\x04\x02\t\0\x12\x03&\r\x0e\n\x0c\n\x05\ - \x04\x02\t\0\x01\x12\x03&\r\x0e\n\x0c\n\x05\x04\x02\t\0\x02\x12\x03&\r\ - \x0e\n\n\n\x03\x04\x02\n\x12\x03'\r\x1b\n\x0b\n\x04\x04\x02\n\0\x12\x03'\ - \r\x1a\n\x0b\n\x04\x04\x02\x02\0\x12\x03(\x04\x19\n\r\n\x05\x04\x02\x02\ - \0\x04\x12\x04(\x04'\x1b\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03(\x04\n\n\ - \x0c\n\x05\x04\x02\x02\0\x01\x12\x03(\x0b\x14\n\x0c\n\x05\x04\x02\x02\0\ - \x03\x12\x03(\x17\x18\n\x0b\n\x04\x04\x02\x02\x01\x12\x03)\x04(\n\r\n\ - \x05\x04\x02\x02\x01\x04\x12\x04)\x04(\x19\n\x0c\n\x05\x04\x02\x02\x01\ - \x06\x12\x03)\x04\x16\n\x0c\n\x05\x04\x02\x02\x01\x01\x12\x03)\x17#\n\ - \x0c\n\x05\x04\x02\x02\x01\x03\x12\x03)&'\n\x0b\n\x04\x04\x02\x02\x02\ - \x12\x03*\x04\x19\n\r\n\x05\x04\x02\x02\x02\x04\x12\x04*\x04)(\n\x0c\n\ - \x05\x04\x02\x02\x02\x06\x12\x03*\x04\x0f\n\x0c\n\x05\x04\x02\x02\x02\ - \x01\x12\x03*\x10\x14\n\x0c\n\x05\x04\x02\x02\x02\x03\x12\x03*\x17\x18\n\ - \x0b\n\x04\x04\x02\x02\x03\x12\x03+\x04\x14\n\r\n\x05\x04\x02\x02\x03\ - \x04\x12\x04+\x04*\x19\n\x0c\n\x05\x04\x02\x02\x03\x05\x12\x03+\x04\n\n\ - \x0c\n\x05\x04\x02\x02\x03\x01\x12\x03+\x0b\x0f\n\x0c\n\x05\x04\x02\x02\ - \x03\x03\x12\x03+\x12\x13\n\x0b\n\x04\x04\x02\x02\x04\x12\x03,\x04\x1c\n\ - \r\n\x05\x04\x02\x02\x04\x04\x12\x04,\x04+\x14\n\x0c\n\x05\x04\x02\x02\ - \x04\x06\x12\x03,\x04\x0e\n\x0c\n\x05\x04\x02\x02\x04\x01\x12\x03,\x0f\ - \x17\n\x0c\n\x05\x04\x02\x02\x04\x03\x12\x03,\x1a\x1b\n\x0b\n\x04\x04\ - \x02\x02\x05\x12\x03-\x04'\n\r\n\x05\x04\x02\x02\x05\x04\x12\x04-\x04,\ - \x1c\n\x0c\n\x05\x04\x02\x02\x05\x06\x12\x03-\x04\x12\n\x0c\n\x05\x04\ - \x02\x02\x05\x01\x12\x03-\x13\"\n\x0c\n\x05\x04\x02\x02\x05\x03\x12\x03-\ - %&\n\n\n\x02\x04\x03\x12\x040\04\x01\n\n\n\x03\x04\x03\x01\x12\x030\x08\ - \x12\n\x0b\n\x04\x04\x03\x02\0\x12\x031\x04\x18\n\r\n\x05\x04\x03\x02\0\ - \x04\x12\x041\x040\x14\n\x0c\n\x05\x04\x03\x02\0\x06\x12\x031\x04\x0b\n\ - \x0c\n\x05\x04\x03\x02\0\x01\x12\x031\x0c\x13\n\x0c\n\x05\x04\x03\x02\0\ - \x03\x12\x031\x16\x17\n\x0b\n\x04\x04\x03\x02\x01\x12\x032\x04\x12\n\r\n\ - \x05\x04\x03\x02\x01\x04\x12\x042\x041\x18\n\x0c\n\x05\x04\x03\x02\x01\ - \x05\x12\x032\x04\t\n\x0c\n\x05\x04\x03\x02\x01\x01\x12\x032\n\r\n\x0c\n\ - \x05\x04\x03\x02\x01\x03\x12\x032\x10\x11\n\x0b\n\x04\x04\x03\x02\x02\ - \x12\x033\x04\x17\n\r\n\x05\x04\x03\x02\x02\x04\x12\x043\x042\x12\n\x0c\ - \n\x05\x04\x03\x02\x02\x05\x12\x033\x04\n\n\x0c\n\x05\x04\x03\x02\x02\ - \x01\x12\x033\x0b\x12\n\x0c\n\x05\x04\x03\x02\x02\x03\x12\x033\x15\x16\n\ - \n\n\x02\x04\x04\x12\x046\0:\x01\n\n\n\x03\x04\x04\x01\x12\x036\x08\x13\ - \n\x0b\n\x04\x04\x04\x02\0\x12\x037\x04#\n\r\n\x05\x04\x04\x02\0\x04\x12\ - \x047\x046\x15\n\x0c\n\x05\x04\x04\x02\0\x06\x12\x037\x04\x11\n\x0c\n\ - \x05\x04\x04\x02\0\x01\x12\x037\x12\x1e\n\x0c\n\x05\x04\x04\x02\0\x03\ - \x12\x037!\"\n\x0b\n\x04\x04\x04\x02\x01\x12\x038\x04\x17\n\r\n\x05\x04\ - \x04\x02\x01\x04\x12\x048\x047#\n\x0c\n\x05\x04\x04\x02\x01\x06\x12\x038\ - \x04\x0c\n\x0c\n\x05\x04\x04\x02\x01\x01\x12\x038\r\x12\n\x0c\n\x05\x04\ - \x04\x02\x01\x03\x12\x038\x15\x16\n\x0b\n\x04\x04\x04\x02\x02\x12\x039\ - \x04\x14\n\r\n\x05\x04\x04\x02\x02\x04\x12\x049\x048\x17\n\x0c\n\x05\x04\ - \x04\x02\x02\x05\x12\x039\x04\t\n\x0c\n\x05\x04\x04\x02\x02\x01\x12\x039\ - \n\x0f\n\x0c\n\x05\x04\x04\x02\x02\x03\x12\x039\x12\x13\n\n\n\x02\x04\ - \x05\x12\x04<\0B\x01\n\n\n\x03\x04\x05\x01\x12\x03<\x08\x13\n\x0b\n\x04\ - \x04\x05\x02\0\x12\x03=\x04\x18\n\r\n\x05\x04\x05\x02\0\x04\x12\x04=\x04\ - <\x15\n\x0c\n\x05\x04\x05\x02\0\x06\x12\x03=\x04\x0b\n\x0c\n\x05\x04\x05\ - \x02\0\x01\x12\x03=\x0c\x13\n\x0c\n\x05\x04\x05\x02\0\x03\x12\x03=\x16\ - \x17\n\x0b\n\x04\x04\x05\x02\x01\x12\x03>\x04\x18\n\r\n\x05\x04\x05\x02\ - \x01\x04\x12\x04>\x04=\x18\n\x0c\n\x05\x04\x05\x02\x01\x05\x12\x03>\x04\ - \t\n\x0c\n\x05\x04\x05\x02\x01\x01\x12\x03>\n\x13\n\x0c\n\x05\x04\x05\ - \x02\x01\x03\x12\x03>\x16\x17\n\x0b\n\x04\x04\x05\x02\x02\x12\x03?\x04\ - \x15\n\r\n\x05\x04\x05\x02\x02\x04\x12\x04?\x04>\x18\n\x0c\n\x05\x04\x05\ - \x02\x02\x05\x12\x03?\x04\n\n\x0c\n\x05\x04\x05\x02\x02\x01\x12\x03?\x0b\ - \x10\n\x0c\n\x05\x04\x05\x02\x02\x03\x12\x03?\x13\x14\n\x0b\n\x04\x04\ - \x05\x02\x03\x12\x03@\x04\x17\n\r\n\x05\x04\x05\x02\x03\x04\x12\x04@\x04\ - ?\x15\n\x0c\n\x05\x04\x05\x02\x03\x05\x12\x03@\x04\n\n\x0c\n\x05\x04\x05\ - \x02\x03\x01\x12\x03@\x0b\x12\n\x0c\n\x05\x04\x05\x02\x03\x03\x12\x03@\ - \x15\x16\n\x0b\n\x04\x04\x05\x02\x04\x12\x03A\x04\x16\n\r\n\x05\x04\x05\ - \x02\x04\x04\x12\x04A\x04@\x17\n\x0c\n\x05\x04\x05\x02\x04\x05\x12\x03A\ - \x04\x08\n\x0c\n\x05\x04\x05\x02\x04\x01\x12\x03A\t\x11\n\x0c\n\x05\x04\ - \x05\x02\x04\x03\x12\x03A\x14\x15\n\n\n\x02\x04\x06\x12\x04D\0H\x01\n\n\ - \n\x03\x04\x06\x01\x12\x03D\x08\x0e\n\x0b\n\x04\x04\x06\x02\0\x12\x03E\ - \x04\x17\n\r\n\x05\x04\x06\x02\0\x04\x12\x04E\x04D\x10\n\x0c\n\x05\x04\ - \x06\x02\0\x06\x12\x03E\x04\x0c\n\x0c\n\x05\x04\x06\x02\0\x01\x12\x03E\r\ - \x12\n\x0c\n\x05\x04\x06\x02\0\x03\x12\x03E\x15\x16\n\x0b\n\x04\x04\x06\ - \x02\x01\x12\x03F\x04\x12\n\r\n\x05\x04\x06\x02\x01\x04\x12\x04F\x04E\ - \x17\n\x0c\n\x05\x04\x06\x02\x01\x05\x12\x03F\x04\t\n\x0c\n\x05\x04\x06\ - \x02\x01\x01\x12\x03F\n\r\n\x0c\n\x05\x04\x06\x02\x01\x03\x12\x03F\x10\ - \x11\n\x0b\n\x04\x04\x06\x02\x02\x12\x03G\x04\x14\n\r\n\x05\x04\x06\x02\ - \x02\x04\x12\x04G\x04F\x12\n\x0c\n\x05\x04\x06\x02\x02\x05\x12\x03G\x04\ - \t\n\x0c\n\x05\x04\x06\x02\x02\x01\x12\x03G\n\x0f\n\x0c\n\x05\x04\x06\ - \x02\x02\x03\x12\x03G\x12\x13\n\n\n\x02\x04\x07\x12\x04J\0M\x01\n\n\n\ - \x03\x04\x07\x01\x12\x03J\x08\x14\n\x0b\n\x04\x04\x07\x02\0\x12\x03K\x04\ - #\n\r\n\x05\x04\x07\x02\0\x04\x12\x04K\x04J\x16\n\x0c\n\x05\x04\x07\x02\ - \0\x06\x12\x03K\x04\x11\n\x0c\n\x05\x04\x07\x02\0\x01\x12\x03K\x12\x1e\n\ - \x0c\n\x05\x04\x07\x02\0\x03\x12\x03K!\"\n\x0b\n\x04\x04\x07\x02\x01\x12\ - \x03L\x04\x1e\n\x0c\n\x05\x04\x07\x02\x01\x04\x12\x03L\x04\x0c\n\x0c\n\ - \x05\x04\x07\x02\x01\x06\x12\x03L\r\x13\n\x0c\n\x05\x04\x07\x02\x01\x01\ - \x12\x03L\x14\x19\n\x0c\n\x05\x04\x07\x02\x01\x03\x12\x03L\x1c\x1d\n\n\n\ - \x02\x05\x02\x12\x04O\0T\x01\n\n\n\x03\x05\x02\x01\x12\x03O\x05\x07\n\ - \x0b\n\x04\x05\x02\x02\0\x12\x03P\x04\x0c\n\x0c\n\x05\x05\x02\x02\0\x01\ - \x12\x03P\x04\x07\n\x0c\n\x05\x05\x02\x02\0\x02\x12\x03P\n\x0b\n\x0b\n\ - \x04\x05\x02\x02\x01\x12\x03Q\x04\x0c\n\x0c\n\x05\x05\x02\x02\x01\x01\ - \x12\x03Q\x04\x07\n\x0c\n\x05\x05\x02\x02\x01\x02\x12\x03Q\n\x0b\n\x0b\n\ - \x04\x05\x02\x02\x02\x12\x03R\x04\r\n\x0c\n\x05\x05\x02\x02\x02\x01\x12\ - \x03R\x04\x08\n\x0c\n\x05\x05\x02\x02\x02\x02\x12\x03R\x0b\x0c\n\x0b\n\ - \x04\x05\x02\x02\x03\x12\x03S\x04\x11\n\x0c\n\x05\x05\x02\x02\x03\x01\ - \x12\x03S\x04\x0c\n\x0c\n\x05\x05\x02\x02\x03\x02\x12\x03S\x0f\x10\n\n\n\ - \x02\x04\x08\x12\x04V\0Z\x01\n\n\n\x03\x04\x08\x01\x12\x03V\x08\x10\n\ - \x0b\n\x04\x04\x08\x02\0\x12\x03W\x04\x0e\n\r\n\x05\x04\x08\x02\0\x04\ - \x12\x04W\x04V\x12\n\x0c\n\x05\x04\x08\x02\0\x06\x12\x03W\x04\x06\n\x0c\ - \n\x05\x04\x08\x02\0\x01\x12\x03W\x07\t\n\x0c\n\x05\x04\x08\x02\0\x03\ - \x12\x03W\x0c\r\n\x0b\n\x04\x04\x08\x02\x01\x12\x03X\x04\x12\n\r\n\x05\ - \x04\x08\x02\x01\x04\x12\x04X\x04W\x0e\n\x0c\n\x05\x04\x08\x02\x01\x05\ - \x12\x03X\x04\t\n\x0c\n\x05\x04\x08\x02\x01\x01\x12\x03X\n\r\n\x0c\n\x05\ - \x04\x08\x02\x01\x03\x12\x03X\x10\x11\n\x0b\n\x04\x04\x08\x02\x02\x12\ - \x03Y\x04\x14\n\r\n\x05\x04\x08\x02\x02\x04\x12\x04Y\x04X\x12\n\x0c\n\ - \x05\x04\x08\x02\x02\x05\x12\x03Y\x04\t\n\x0c\n\x05\x04\x08\x02\x02\x01\ - \x12\x03Y\n\x0f\n\x0c\n\x05\x04\x08\x02\x02\x03\x12\x03Y\x12\x13\n\n\n\ - \x02\x04\t\x12\x04\\\0d\x01\n\n\n\x03\x04\t\x01\x12\x03\\\x08\x17\n\x0b\ - \n\x04\x04\t\x02\0\x12\x03]\x04\x18\n\r\n\x05\x04\t\x02\0\x04\x12\x04]\ - \x04\\\x19\n\x0c\n\x05\x04\t\x02\0\x06\x12\x03]\x04\x0b\n\x0c\n\x05\x04\ - \t\x02\0\x01\x12\x03]\x0c\x13\n\x0c\n\x05\x04\t\x02\0\x03\x12\x03]\x16\ - \x17\n\x0b\n\x04\x04\t\x02\x01\x12\x03^\x04$\n\x0c\n\x05\x04\t\x02\x01\ - \x04\x12\x03^\x04\x0c\n\x0c\n\x05\x04\t\x02\x01\x06\x12\x03^\r\x15\n\x0c\ - \n\x05\x04\t\x02\x01\x01\x12\x03^\x16\x1f\n\x0c\n\x05\x04\t\x02\x01\x03\ - \x12\x03^\"#\n\x1f\n\x04\x04\t\x02\x02\x12\x03`\x04\x1b\x1a\x12\x20prima\ - ry_lock_key\n\n\r\n\x05\x04\t\x02\x02\x04\x12\x04`\x04^$\n\x0c\n\x05\x04\ - \t\x02\x02\x05\x12\x03`\x04\t\n\x0c\n\x05\x04\t\x02\x02\x01\x12\x03`\n\ - \x16\n\x0c\n\x05\x04\t\x02\x02\x03\x12\x03`\x19\x1a\n\x0b\n\x04\x04\t\ - \x02\x03\x12\x03a\x04\x1d\n\r\n\x05\x04\t\x02\x03\x04\x12\x04a\x04`\x1b\ - \n\x0c\n\x05\x04\t\x02\x03\x05\x12\x03a\x04\n\n\x0c\n\x05\x04\t\x02\x03\ - \x01\x12\x03a\x0b\x18\n\x0c\n\x05\x04\t\x02\x03\x03\x12\x03a\x1b\x1c\n\ - \x0b\n\x04\x04\t\x02\x04\x12\x03b\x04\x18\n\r\n\x05\x04\t\x02\x04\x04\ - \x12\x04b\x04a\x1d\n\x0c\n\x05\x04\t\x02\x04\x05\x12\x03b\x04\n\n\x0c\n\ - \x05\x04\t\x02\x04\x01\x12\x03b\x0b\x13\n\x0c\n\x05\x04\t\x02\x04\x03\ - \x12\x03b\x16\x17\n\x0b\n\x04\x04\t\x02\x05\x12\x03c\x04#\n\r\n\x05\x04\ - \t\x02\x05\x04\x12\x04c\x04b\x18\n\x0c\n\x05\x04\t\x02\x05\x05\x12\x03c\ - \x04\x08\n\x0c\n\x05\x04\t\x02\x05\x01\x12\x03c\t\x1e\n\x0c\n\x05\x04\t\ - \x02\x05\x03\x12\x03c!\"\n\n\n\x02\x04\n\x12\x04f\0i\x01\n\n\n\x03\x04\n\ - \x01\x12\x03f\x08\x18\n\x0b\n\x04\x04\n\x02\0\x12\x03g\x04#\n\r\n\x05\ - \x04\n\x02\0\x04\x12\x04g\x04f\x1a\n\x0c\n\x05\x04\n\x02\0\x06\x12\x03g\ - \x04\x11\n\x0c\n\x05\x04\n\x02\0\x01\x12\x03g\x12\x1e\n\x0c\n\x05\x04\n\ - \x02\0\x03\x12\x03g!\"\n\x0b\n\x04\x04\n\x02\x01\x12\x03h\x04!\n\x0c\n\ - \x05\x04\n\x02\x01\x04\x12\x03h\x04\x0c\n\x0c\n\x05\x04\n\x02\x01\x06\ - \x12\x03h\r\x15\n\x0c\n\x05\x04\n\x02\x01\x01\x12\x03h\x16\x1c\n\x0c\n\ - \x05\x04\n\x02\x01\x03\x12\x03h\x1f\x20\n\n\n\x02\x04\x0b\x12\x04k\0r\ - \x01\n\n\n\x03\x04\x0b\x01\x12\x03k\x08\x15\n\n\n\x03\x04\x0b\t\x12\x03l\ - \r\x0f\n\x0b\n\x04\x04\x0b\t\0\x12\x03l\r\x0e\n\x0c\n\x05\x04\x0b\t\0\ - \x01\x12\x03l\r\x0e\n\x0c\n\x05\x04\x0b\t\0\x02\x12\x03l\r\x0e\n\n\n\x03\ - \x04\x0b\n\x12\x03m\r\x16\n\x0b\n\x04\x04\x0b\n\0\x12\x03m\r\x15\n\x0b\n\ - \x04\x04\x0b\x02\0\x12\x03n\x04\x18\n\r\n\x05\x04\x0b\x02\0\x04\x12\x04n\ - \x04m\x16\n\x0c\n\x05\x04\x0b\x02\0\x06\x12\x03n\x04\x0b\n\x0c\n\x05\x04\ - \x0b\x02\0\x01\x12\x03n\x0c\x13\n\x0c\n\x05\x04\x0b\x02\0\x03\x12\x03n\ - \x16\x17\n\x0b\n\x04\x04\x0b\x02\x01\x12\x03o\x04\x1d\n\r\n\x05\x04\x0b\ - \x02\x01\x04\x12\x04o\x04n\x18\n\x0c\n\x05\x04\x0b\x02\x01\x05\x12\x03o\ - \x04\n\n\x0c\n\x05\x04\x0b\x02\x01\x01\x12\x03o\x0b\x18\n\x0c\n\x05\x04\ - \x0b\x02\x01\x03\x12\x03o\x1b\x1c\n\x0b\n\x04\x04\x0b\x02\x02\x12\x03p\ - \x04\x1c\n\x0c\n\x05\x04\x0b\x02\x02\x04\x12\x03p\x04\x0c\n\x0c\n\x05\ - \x04\x0b\x02\x02\x05\x12\x03p\r\x12\n\x0c\n\x05\x04\x0b\x02\x02\x01\x12\ - \x03p\x13\x17\n\x0c\n\x05\x04\x0b\x02\x02\x03\x12\x03p\x1a\x1b\n\x0b\n\ - \x04\x04\x0b\x02\x03\x12\x03q\x04\x1e\n\r\n\x05\x04\x0b\x02\x03\x04\x12\ - \x04q\x04p\x1c\n\x0c\n\x05\x04\x0b\x02\x03\x05\x12\x03q\x04\n\n\x0c\n\ - \x05\x04\x0b\x02\x03\x01\x12\x03q\x0b\x19\n\x0c\n\x05\x04\x0b\x02\x03\ - \x03\x12\x03q\x1c\x1d\n\n\n\x02\x04\x0c\x12\x04t\0w\x01\n\n\n\x03\x04\ - \x0c\x01\x12\x03t\x08\x16\n\x0b\n\x04\x04\x0c\x02\0\x12\x03u\x04#\n\r\n\ - \x05\x04\x0c\x02\0\x04\x12\x04u\x04t\x18\n\x0c\n\x05\x04\x0c\x02\0\x06\ - \x12\x03u\x04\x11\n\x0c\n\x05\x04\x0c\x02\0\x01\x12\x03u\x12\x1e\n\x0c\n\ - \x05\x04\x0c\x02\0\x03\x12\x03u!\"\n\x0b\n\x04\x04\x0c\x02\x01\x12\x03v\ - \x04\x17\n\r\n\x05\x04\x0c\x02\x01\x04\x12\x04v\x04u#\n\x0c\n\x05\x04\ - \x0c\x02\x01\x06\x12\x03v\x04\x0c\n\x0c\n\x05\x04\x0c\x02\x01\x01\x12\ - \x03v\r\x12\n\x0c\n\x05\x04\x0c\x02\x01\x03\x12\x03v\x15\x16\n\n\n\x02\ - \x04\r\x12\x04y\0|\x01\n\n\n\x03\x04\r\x01\x12\x03y\x08\x15\n\x0b\n\x04\ - \x04\r\x02\0\x12\x03z\x04$\n\x0c\n\x05\x04\r\x02\0\x04\x12\x03z\x04\x0c\ - \n\x0c\n\x05\x04\r\x02\0\x06\x12\x03z\r\x15\n\x0c\n\x05\x04\r\x02\0\x01\ - \x12\x03z\x16\x1f\n\x0c\n\x05\x04\r\x02\0\x03\x12\x03z\"#\n\x0b\n\x04\ - \x04\r\x02\x01\x12\x03{\x04\x1e\n\r\n\x05\x04\r\x02\x01\x04\x12\x04{\x04\ - z$\n\x0c\n\x05\x04\r\x02\x01\x05\x12\x03{\x04\n\n\x0c\n\x05\x04\r\x02\ - \x01\x01\x12\x03{\x0b\x19\n\x0c\n\x05\x04\r\x02\x01\x03\x12\x03{\x1c\x1d\ - \n\x0b\n\x02\x04\x0e\x12\x05~\0\x81\x01\x01\n\n\n\x03\x04\x0e\x01\x12\ - \x03~\x08\x16\n\x0b\n\x04\x04\x0e\x02\0\x12\x03\x7f\x04#\n\r\n\x05\x04\ - \x0e\x02\0\x04\x12\x04\x7f\x04~\x18\n\x0c\n\x05\x04\x0e\x02\0\x06\x12\ - \x03\x7f\x04\x11\n\x0c\n\x05\x04\x0e\x02\0\x01\x12\x03\x7f\x12\x1e\n\x0c\ - \n\x05\x04\x0e\x02\0\x03\x12\x03\x7f!\"\n\x0c\n\x04\x04\x0e\x02\x01\x12\ - \x04\x80\x01\x04\x15\n\x0e\n\x05\x04\x0e\x02\x01\x04\x12\x05\x80\x01\x04\ - \x7f#\n\r\n\x05\x04\x0e\x02\x01\x05\x12\x04\x80\x01\x04\n\n\r\n\x05\x04\ - \x0e\x02\x01\x01\x12\x04\x80\x01\x0b\x10\n\r\n\x05\x04\x0e\x02\x01\x03\ - \x12\x04\x80\x01\x13\x14\n\x0c\n\x02\x04\x0f\x12\x06\x83\x01\0\x87\x01\ - \x01\n\x0b\n\x03\x04\x0f\x01\x12\x04\x83\x01\x08\x1c\n\x0c\n\x04\x04\x0f\ - \x02\0\x12\x04\x84\x01\x04\x18\n\x0f\n\x05\x04\x0f\x02\0\x04\x12\x06\x84\ - \x01\x04\x83\x01\x1e\n\r\n\x05\x04\x0f\x02\0\x06\x12\x04\x84\x01\x04\x0b\ - \n\r\n\x05\x04\x0f\x02\0\x01\x12\x04\x84\x01\x0c\x13\n\r\n\x05\x04\x0f\ - \x02\0\x03\x12\x04\x84\x01\x16\x17\n\x0c\n\x04\x04\x0f\x02\x01\x12\x04\ - \x85\x01\x04\x1d\n\x0f\n\x05\x04\x0f\x02\x01\x04\x12\x06\x85\x01\x04\x84\ - \x01\x18\n\r\n\x05\x04\x0f\x02\x01\x05\x12\x04\x85\x01\x04\n\n\r\n\x05\ - \x04\x0f\x02\x01\x01\x12\x04\x85\x01\x0b\x18\n\r\n\x05\x04\x0f\x02\x01\ - \x03\x12\x04\x85\x01\x1b\x1c\n\x0c\n\x04\x04\x0f\x02\x02\x12\x04\x86\x01\ - \x04\x1c\n\r\n\x05\x04\x0f\x02\x02\x04\x12\x04\x86\x01\x04\x0c\n\r\n\x05\ - \x04\x0f\x02\x02\x05\x12\x04\x86\x01\r\x12\n\r\n\x05\x04\x0f\x02\x02\x01\ - \x12\x04\x86\x01\x13\x17\n\r\n\x05\x04\x0f\x02\x02\x03\x12\x04\x86\x01\ - \x1a\x1b\n\x0c\n\x02\x04\x10\x12\x06\x89\x01\0\x8c\x01\x01\n\x0b\n\x03\ - \x04\x10\x01\x12\x04\x89\x01\x08\x1d\n\x0c\n\x04\x04\x10\x02\0\x12\x04\ - \x8a\x01\x04#\n\x0f\n\x05\x04\x10\x02\0\x04\x12\x06\x8a\x01\x04\x89\x01\ - \x1f\n\r\n\x05\x04\x10\x02\0\x06\x12\x04\x8a\x01\x04\x11\n\r\n\x05\x04\ - \x10\x02\0\x01\x12\x04\x8a\x01\x12\x1e\n\r\n\x05\x04\x10\x02\0\x03\x12\ - \x04\x8a\x01!\"\n\x0c\n\x04\x04\x10\x02\x01\x12\x04\x8b\x01\x04\x17\n\ - \x0f\n\x05\x04\x10\x02\x01\x04\x12\x06\x8b\x01\x04\x8a\x01#\n\r\n\x05\ - \x04\x10\x02\x01\x06\x12\x04\x8b\x01\x04\x0c\n\r\n\x05\x04\x10\x02\x01\ - \x01\x12\x04\x8b\x01\r\x12\n\r\n\x05\x04\x10\x02\x01\x03\x12\x04\x8b\x01\ - \x15\x16\n\x0c\n\x02\x04\x11\x12\x06\x8e\x01\0\x92\x01\x01\n\x0b\n\x03\ - \x04\x11\x01\x12\x04\x8e\x01\x08\x16\n\x0c\n\x04\x04\x11\x02\0\x12\x04\ - \x8f\x01\x04\x18\n\x0f\n\x05\x04\x11\x02\0\x04\x12\x06\x8f\x01\x04\x8e\ - \x01\x18\n\r\n\x05\x04\x11\x02\0\x06\x12\x04\x8f\x01\x04\x0b\n\r\n\x05\ - \x04\x11\x02\0\x01\x12\x04\x8f\x01\x0c\x13\n\r\n\x05\x04\x11\x02\0\x03\ - \x12\x04\x8f\x01\x16\x17\n\x0c\n\x04\x04\x11\x02\x01\x12\x04\x90\x01\x04\ - \x12\n\x0f\n\x05\x04\x11\x02\x01\x04\x12\x06\x90\x01\x04\x8f\x01\x18\n\r\ - \n\x05\x04\x11\x02\x01\x05\x12\x04\x90\x01\x04\t\n\r\n\x05\x04\x11\x02\ - \x01\x01\x12\x04\x90\x01\n\r\n\r\n\x05\x04\x11\x02\x01\x03\x12\x04\x90\ - \x01\x10\x11\n\x0c\n\x04\x04\x11\x02\x02\x12\x04\x91\x01\x04\x1d\n\x0f\n\ - \x05\x04\x11\x02\x02\x04\x12\x06\x91\x01\x04\x90\x01\x12\n\r\n\x05\x04\ - \x11\x02\x02\x05\x12\x04\x91\x01\x04\n\n\r\n\x05\x04\x11\x02\x02\x01\x12\ - \x04\x91\x01\x0b\x18\n\r\n\x05\x04\x11\x02\x02\x03\x12\x04\x91\x01\x1b\ - \x1c\n\x0c\n\x02\x04\x12\x12\x06\x94\x01\0\x98\x01\x01\n\x0b\n\x03\x04\ - \x12\x01\x12\x04\x94\x01\x08\x17\n\x0c\n\x04\x04\x12\x02\0\x12\x04\x95\ - \x01\x04#\n\x0f\n\x05\x04\x12\x02\0\x04\x12\x06\x95\x01\x04\x94\x01\x19\ - \n\r\n\x05\x04\x12\x02\0\x06\x12\x04\x95\x01\x04\x11\n\r\n\x05\x04\x12\ - \x02\0\x01\x12\x04\x95\x01\x12\x1e\n\r\n\x05\x04\x12\x02\0\x03\x12\x04\ - \x95\x01!\"\n\x0c\n\x04\x04\x12\x02\x01\x12\x04\x96\x01\x04\x17\n\x0f\n\ - \x05\x04\x12\x02\x01\x04\x12\x06\x96\x01\x04\x95\x01#\n\r\n\x05\x04\x12\ - \x02\x01\x06\x12\x04\x96\x01\x04\x0c\n\r\n\x05\x04\x12\x02\x01\x01\x12\ - \x04\x96\x01\r\x12\n\r\n\x05\x04\x12\x02\x01\x03\x12\x04\x96\x01\x15\x16\ - \n8\n\x04\x04\x12\x02\x02\x12\x04\x97\x01\x04\x1e\"*\x20set\x20this\x20i\ - f\x20the\x20key\x20is\x20already\x20committed\n\n\x0f\n\x05\x04\x12\x02\ - \x02\x04\x12\x06\x97\x01\x04\x96\x01\x17\n\r\n\x05\x04\x12\x02\x02\x05\ - \x12\x04\x97\x01\x04\n\n\r\n\x05\x04\x12\x02\x02\x01\x12\x04\x97\x01\x0b\ - \x19\n\r\n\x05\x04\x12\x02\x02\x03\x12\x04\x97\x01\x1c\x1d\n\x0c\n\x02\ - \x04\x13\x12\x06\x9a\x01\0\x9e\x01\x01\n\x0b\n\x03\x04\x13\x01\x12\x04\ - \x9a\x01\x08\x17\n\x0c\n\x04\x04\x13\x02\0\x12\x04\x9b\x01\x04\x18\n\x0f\ - \n\x05\x04\x13\x02\0\x04\x12\x06\x9b\x01\x04\x9a\x01\x19\n\r\n\x05\x04\ - \x13\x02\0\x06\x12\x04\x9b\x01\x04\x0b\n\r\n\x05\x04\x13\x02\0\x01\x12\ - \x04\x9b\x01\x0c\x13\n\r\n\x05\x04\x13\x02\0\x03\x12\x04\x9b\x01\x16\x17\ - \n\x0c\n\x04\x04\x13\x02\x01\x12\x04\x9c\x01\x04\x1c\n\r\n\x05\x04\x13\ - \x02\x01\x04\x12\x04\x9c\x01\x04\x0c\n\r\n\x05\x04\x13\x02\x01\x05\x12\ - \x04\x9c\x01\r\x12\n\r\n\x05\x04\x13\x02\x01\x01\x12\x04\x9c\x01\x13\x17\ - \n\r\n\x05\x04\x13\x02\x01\x03\x12\x04\x9c\x01\x1a\x1b\n\x0c\n\x04\x04\ - \x13\x02\x02\x12\x04\x9d\x01\x04\x17\n\x0f\n\x05\x04\x13\x02\x02\x04\x12\ - \x06\x9d\x01\x04\x9c\x01\x1c\n\r\n\x05\x04\x13\x02\x02\x05\x12\x04\x9d\ - \x01\x04\n\n\r\n\x05\x04\x13\x02\x02\x01\x12\x04\x9d\x01\x0b\x12\n\r\n\ - \x05\x04\x13\x02\x02\x03\x12\x04\x9d\x01\x15\x16\n\x0c\n\x02\x04\x14\x12\ - \x06\xa0\x01\0\xa3\x01\x01\n\x0b\n\x03\x04\x14\x01\x12\x04\xa0\x01\x08\ - \x18\n\x0c\n\x04\x04\x14\x02\0\x12\x04\xa1\x01\x04#\n\x0f\n\x05\x04\x14\ - \x02\0\x04\x12\x06\xa1\x01\x04\xa0\x01\x1a\n\r\n\x05\x04\x14\x02\0\x06\ - \x12\x04\xa1\x01\x04\x11\n\r\n\x05\x04\x14\x02\0\x01\x12\x04\xa1\x01\x12\ - \x1e\n\r\n\x05\x04\x14\x02\0\x03\x12\x04\xa1\x01!\"\n\x0c\n\x04\x04\x14\ - \x02\x01\x12\x04\xa2\x01\x04\x1e\n\r\n\x05\x04\x14\x02\x01\x04\x12\x04\ - \xa2\x01\x04\x0c\n\r\n\x05\x04\x14\x02\x01\x06\x12\x04\xa2\x01\r\x13\n\r\ - \n\x05\x04\x14\x02\x01\x01\x12\x04\xa2\x01\x14\x19\n\r\n\x05\x04\x14\x02\ - \x01\x03\x12\x04\xa2\x01\x1c\x1d\n\x0c\n\x02\x04\x15\x12\x06\xa5\x01\0\ - \xa8\x01\x01\n\x0b\n\x03\x04\x15\x01\x12\x04\xa5\x01\x08\x17\n\x0c\n\x04\ - \x04\x15\x02\0\x12\x04\xa6\x01\x04\x18\n\x0f\n\x05\x04\x15\x02\0\x04\x12\ - \x06\xa6\x01\x04\xa5\x01\x19\n\r\n\x05\x04\x15\x02\0\x06\x12\x04\xa6\x01\ - \x04\x0b\n\r\n\x05\x04\x15\x02\0\x01\x12\x04\xa6\x01\x0c\x13\n\r\n\x05\ - \x04\x15\x02\0\x03\x12\x04\xa6\x01\x16\x17\n\x0c\n\x04\x04\x15\x02\x01\ - \x12\x04\xa7\x01\x04\x1b\n\x0f\n\x05\x04\x15\x02\x01\x04\x12\x06\xa7\x01\ - \x04\xa6\x01\x18\n\r\n\x05\x04\x15\x02\x01\x05\x12\x04\xa7\x01\x04\n\n\r\ - \n\x05\x04\x15\x02\x01\x01\x12\x04\xa7\x01\x0b\x16\n\r\n\x05\x04\x15\x02\ - \x01\x03\x12\x04\xa7\x01\x19\x1a\n\x0c\n\x02\x04\x16\x12\x06\xaa\x01\0\ - \xae\x01\x01\n\x0b\n\x03\x04\x16\x01\x12\x04\xaa\x01\x08\x18\n\x0c\n\x04\ - \x04\x16\x02\0\x12\x04\xab\x01\x04#\n\x0f\n\x05\x04\x16\x02\0\x04\x12\ - \x06\xab\x01\x04\xaa\x01\x1a\n\r\n\x05\x04\x16\x02\0\x06\x12\x04\xab\x01\ - \x04\x11\n\r\n\x05\x04\x16\x02\0\x01\x12\x04\xab\x01\x12\x1e\n\r\n\x05\ - \x04\x16\x02\0\x03\x12\x04\xab\x01!\"\n\x0c\n\x04\x04\x16\x02\x01\x12\ - \x04\xac\x01\x04\x17\n\x0f\n\x05\x04\x16\x02\x01\x04\x12\x06\xac\x01\x04\ - \xab\x01#\n\r\n\x05\x04\x16\x02\x01\x06\x12\x04\xac\x01\x04\x0c\n\r\n\ - \x05\x04\x16\x02\x01\x01\x12\x04\xac\x01\r\x12\n\r\n\x05\x04\x16\x02\x01\ - \x03\x12\x04\xac\x01\x15\x16\n\x0c\n\x04\x04\x16\x02\x02\x12\x04\xad\x01\ - \x04\x20\n\r\n\x05\x04\x16\x02\x02\x04\x12\x04\xad\x01\x04\x0c\n\r\n\x05\ - \x04\x16\x02\x02\x06\x12\x04\xad\x01\r\x15\n\r\n\x05\x04\x16\x02\x02\x01\ - \x12\x04\xad\x01\x16\x1b\n\r\n\x05\x04\x16\x02\x02\x03\x12\x04\xad\x01\ - \x1e\x1f\n\x0c\n\x02\x04\x17\x12\x06\xb0\x01\0\xb5\x01\x01\n\x0b\n\x03\ - \x04\x17\x01\x12\x04\xb0\x01\x08\x1a\n\x0c\n\x04\x04\x17\x02\0\x12\x04\ - \xb1\x01\x04\x18\n\x0f\n\x05\x04\x17\x02\0\x04\x12\x06\xb1\x01\x04\xb0\ - \x01\x1c\n\r\n\x05\x04\x17\x02\0\x06\x12\x04\xb1\x01\x04\x0b\n\r\n\x05\ - \x04\x17\x02\0\x01\x12\x04\xb1\x01\x0c\x13\n\r\n\x05\x04\x17\x02\0\x03\ - \x12\x04\xb1\x01\x16\x17\n\x0c\n\x04\x04\x17\x02\x01\x12\x04\xb2\x01\x04\ - \x1e\n\x0f\n\x05\x04\x17\x02\x01\x04\x12\x06\xb2\x01\x04\xb1\x01\x18\n\r\ - \n\x05\x04\x17\x02\x01\x05\x12\x04\xb2\x01\x04\n\n\r\n\x05\x04\x17\x02\ - \x01\x01\x12\x04\xb2\x01\x0b\x18\n\r\n\x05\x04\x17\x02\x01\x03\x12\x04\ - \xb2\x01\x1c\x1d\n9\n\x04\x04\x17\x02\x02\x12\x04\xb4\x01\x04\x1e\x1a+\ - \x20If\x20the\x20txn\x20is\x20rolled\x20back,\x20do\x20not\x20set\x20it.\ - \n\n\x0f\n\x05\x04\x17\x02\x02\x04\x12\x06\xb4\x01\x04\xb2\x01\x1e\n\r\n\ - \x05\x04\x17\x02\x02\x05\x12\x04\xb4\x01\x04\n\n\r\n\x05\x04\x17\x02\x02\ - \x01\x12\x04\xb4\x01\x0b\x19\n\r\n\x05\x04\x17\x02\x02\x03\x12\x04\xb4\ - \x01\x1c\x1d\n\x0c\n\x02\x04\x18\x12\x06\xb7\x01\0\xba\x01\x01\n\x0b\n\ - \x03\x04\x18\x01\x12\x04\xb7\x01\x08\x1b\n\x0c\n\x04\x04\x18\x02\0\x12\ - \x04\xb8\x01\x04#\n\x0f\n\x05\x04\x18\x02\0\x04\x12\x06\xb8\x01\x04\xb7\ - \x01\x1d\n\r\n\x05\x04\x18\x02\0\x06\x12\x04\xb8\x01\x04\x11\n\r\n\x05\ - \x04\x18\x02\0\x01\x12\x04\xb8\x01\x12\x1e\n\r\n\x05\x04\x18\x02\0\x03\ - \x12\x04\xb8\x01!\"\n\x0c\n\x04\x04\x18\x02\x01\x12\x04\xb9\x01\x04\x17\ - \n\x0f\n\x05\x04\x18\x02\x01\x04\x12\x06\xb9\x01\x04\xb8\x01#\n\r\n\x05\ - \x04\x18\x02\x01\x06\x12\x04\xb9\x01\x04\x0c\n\r\n\x05\x04\x18\x02\x01\ - \x01\x12\x04\xb9\x01\r\x12\n\r\n\x05\x04\x18\x02\x01\x03\x12\x04\xb9\x01\ - \x15\x16\n\x0c\n\x02\x04\x19\x12\x06\xbc\x01\0\xbf\x01\x01\n\x0b\n\x03\ - \x04\x19\x01\x12\x04\xbc\x01\x08\x11\n\x0c\n\x04\x04\x19\x02\0\x12\x04\ - \xbd\x01\x04\x18\n\x0f\n\x05\x04\x19\x02\0\x04\x12\x06\xbd\x01\x04\xbc\ - \x01\x13\n\r\n\x05\x04\x19\x02\0\x06\x12\x04\xbd\x01\x04\x0b\n\r\n\x05\ - \x04\x19\x02\0\x01\x12\x04\xbd\x01\x0c\x13\n\r\n\x05\x04\x19\x02\0\x03\ - \x12\x04\xbd\x01\x16\x17\n\x0c\n\x04\x04\x19\x02\x01\x12\x04\xbe\x01\x04\ - \x1a\n\x0f\n\x05\x04\x19\x02\x01\x04\x12\x06\xbe\x01\x04\xbd\x01\x18\n\r\ - \n\x05\x04\x19\x02\x01\x05\x12\x04\xbe\x01\x04\n\n\r\n\x05\x04\x19\x02\ - \x01\x01\x12\x04\xbe\x01\x0b\x15\n\r\n\x05\x04\x19\x02\x01\x03\x12\x04\ - \xbe\x01\x18\x19\n\x0c\n\x02\x04\x1a\x12\x06\xc1\x01\0\xc4\x01\x01\n\x0b\ - \n\x03\x04\x1a\x01\x12\x04\xc1\x01\x08\x12\n\x0c\n\x04\x04\x1a\x02\0\x12\ - \x04\xc2\x01\x04#\n\x0f\n\x05\x04\x1a\x02\0\x04\x12\x06\xc2\x01\x04\xc1\ - \x01\x14\n\r\n\x05\x04\x1a\x02\0\x06\x12\x04\xc2\x01\x04\x11\n\r\n\x05\ - \x04\x1a\x02\0\x01\x12\x04\xc2\x01\x12\x1e\n\r\n\x05\x04\x1a\x02\0\x03\ - \x12\x04\xc2\x01!\"\n\x0c\n\x04\x04\x1a\x02\x01\x12\x04\xc3\x01\x04\x17\ - \n\x0f\n\x05\x04\x1a\x02\x01\x04\x12\x06\xc3\x01\x04\xc2\x01#\n\r\n\x05\ - \x04\x1a\x02\x01\x06\x12\x04\xc3\x01\x04\x0c\n\r\n\x05\x04\x1a\x02\x01\ - \x01\x12\x04\xc3\x01\r\x12\n\r\n\x05\x04\x1a\x02\x01\x03\x12\x04\xc3\x01\ - \x15\x16\n\x0c\n\x02\x04\x1b\x12\x06\xc6\x01\0\xc9\x01\x01\n\x0b\n\x03\ - \x04\x1b\x01\x12\x04\xc6\x01\x08\x15\n\x0c\n\x04\x04\x1b\x02\0\x12\x04\ - \xc7\x01\x04\x18\n\x0f\n\x05\x04\x1b\x02\0\x04\x12\x06\xc7\x01\x04\xc6\ - \x01\x17\n\r\n\x05\x04\x1b\x02\0\x06\x12\x04\xc7\x01\x04\x0b\n\r\n\x05\ - \x04\x1b\x02\0\x01\x12\x04\xc7\x01\x0c\x13\n\r\n\x05\x04\x1b\x02\0\x03\ - \x12\x04\xc7\x01\x16\x17\n\x0c\n\x04\x04\x1b\x02\x01\x12\x04\xc8\x01\x04\ - \x12\n\x0f\n\x05\x04\x1b\x02\x01\x04\x12\x06\xc8\x01\x04\xc7\x01\x18\n\r\ - \n\x05\x04\x1b\x02\x01\x05\x12\x04\xc8\x01\x04\t\n\r\n\x05\x04\x1b\x02\ - \x01\x01\x12\x04\xc8\x01\n\r\n\r\n\x05\x04\x1b\x02\x01\x03\x12\x04\xc8\ - \x01\x10\x11\n\x0c\n\x02\x04\x1c\x12\x06\xcb\x01\0\xcf\x01\x01\n\x0b\n\ - \x03\x04\x1c\x01\x12\x04\xcb\x01\x08\x16\n\x0c\n\x04\x04\x1c\x02\0\x12\ - \x04\xcc\x01\x04#\n\x0f\n\x05\x04\x1c\x02\0\x04\x12\x06\xcc\x01\x04\xcb\ - \x01\x18\n\r\n\x05\x04\x1c\x02\0\x06\x12\x04\xcc\x01\x04\x11\n\r\n\x05\ - \x04\x1c\x02\0\x01\x12\x04\xcc\x01\x12\x1e\n\r\n\x05\x04\x1c\x02\0\x03\ - \x12\x04\xcc\x01!\"\n\x0c\n\x04\x04\x1c\x02\x01\x12\x04\xcd\x01\x04\x15\ - \n\x0f\n\x05\x04\x1c\x02\x01\x04\x12\x06\xcd\x01\x04\xcc\x01#\n\r\n\x05\ - \x04\x1c\x02\x01\x05\x12\x04\xcd\x01\x04\n\n\r\n\x05\x04\x1c\x02\x01\x01\ - \x12\x04\xcd\x01\x0b\x10\n\r\n\x05\x04\x1c\x02\x01\x03\x12\x04\xcd\x01\ - \x13\x14\n\x0c\n\x04\x04\x1c\x02\x02\x12\x04\xce\x01\x04\x14\n\x0f\n\x05\ - \x04\x1c\x02\x02\x04\x12\x06\xce\x01\x04\xcd\x01\x15\n\r\n\x05\x04\x1c\ - \x02\x02\x05\x12\x04\xce\x01\x04\t\n\r\n\x05\x04\x1c\x02\x02\x01\x12\x04\ - \xce\x01\n\x0f\n\r\n\x05\x04\x1c\x02\x02\x03\x12\x04\xce\x01\x12\x13\n\ - \x0c\n\x02\x04\x1d\x12\x06\xd1\x01\0\xd5\x01\x01\n\x0b\n\x03\x04\x1d\x01\ - \x12\x04\xd1\x01\x08\x15\n\x0c\n\x04\x04\x1d\x02\0\x12\x04\xd2\x01\x04\ - \x18\n\x0f\n\x05\x04\x1d\x02\0\x04\x12\x06\xd2\x01\x04\xd1\x01\x17\n\r\n\ - \x05\x04\x1d\x02\0\x06\x12\x04\xd2\x01\x04\x0b\n\r\n\x05\x04\x1d\x02\0\ - \x01\x12\x04\xd2\x01\x0c\x13\n\r\n\x05\x04\x1d\x02\0\x03\x12\x04\xd2\x01\ - \x16\x17\n\x0c\n\x04\x04\x1d\x02\x01\x12\x04\xd3\x01\x04\x12\n\x0f\n\x05\ - \x04\x1d\x02\x01\x04\x12\x06\xd3\x01\x04\xd2\x01\x18\n\r\n\x05\x04\x1d\ - \x02\x01\x05\x12\x04\xd3\x01\x04\t\n\r\n\x05\x04\x1d\x02\x01\x01\x12\x04\ - \xd3\x01\n\r\n\r\n\x05\x04\x1d\x02\x01\x03\x12\x04\xd3\x01\x10\x11\n\x0c\ - \n\x04\x04\x1d\x02\x02\x12\x04\xd4\x01\x04\x14\n\x0f\n\x05\x04\x1d\x02\ - \x02\x04\x12\x06\xd4\x01\x04\xd3\x01\x12\n\r\n\x05\x04\x1d\x02\x02\x05\ - \x12\x04\xd4\x01\x04\t\n\r\n\x05\x04\x1d\x02\x02\x01\x12\x04\xd4\x01\n\ - \x0f\n\r\n\x05\x04\x1d\x02\x02\x03\x12\x04\xd4\x01\x12\x13\n\x0c\n\x02\ - \x04\x1e\x12\x06\xd7\x01\0\xda\x01\x01\n\x0b\n\x03\x04\x1e\x01\x12\x04\ - \xd7\x01\x08\x16\n\x0c\n\x04\x04\x1e\x02\0\x12\x04\xd8\x01\x04#\n\x0f\n\ - \x05\x04\x1e\x02\0\x04\x12\x06\xd8\x01\x04\xd7\x01\x18\n\r\n\x05\x04\x1e\ - \x02\0\x06\x12\x04\xd8\x01\x04\x11\n\r\n\x05\x04\x1e\x02\0\x01\x12\x04\ - \xd8\x01\x12\x1e\n\r\n\x05\x04\x1e\x02\0\x03\x12\x04\xd8\x01!\"\n\x0c\n\ - \x04\x04\x1e\x02\x01\x12\x04\xd9\x01\x04\x15\n\x0f\n\x05\x04\x1e\x02\x01\ - \x04\x12\x06\xd9\x01\x04\xd8\x01#\n\r\n\x05\x04\x1e\x02\x01\x05\x12\x04\ - \xd9\x01\x04\n\n\r\n\x05\x04\x1e\x02\x01\x01\x12\x04\xd9\x01\x0b\x10\n\r\ - \n\x05\x04\x1e\x02\x01\x03\x12\x04\xd9\x01\x13\x14\n\x0c\n\x02\x04\x1f\ - \x12\x06\xdc\x01\0\xdf\x01\x01\n\x0b\n\x03\x04\x1f\x01\x12\x04\xdc\x01\ - \x08\x18\n\x0c\n\x04\x04\x1f\x02\0\x12\x04\xdd\x01\x04\x18\n\x0f\n\x05\ - \x04\x1f\x02\0\x04\x12\x06\xdd\x01\x04\xdc\x01\x1a\n\r\n\x05\x04\x1f\x02\ - \0\x06\x12\x04\xdd\x01\x04\x0b\n\r\n\x05\x04\x1f\x02\0\x01\x12\x04\xdd\ - \x01\x0c\x13\n\r\n\x05\x04\x1f\x02\0\x03\x12\x04\xdd\x01\x16\x17\n\x0c\n\ - \x04\x04\x1f\x02\x01\x12\x04\xde\x01\x04\x12\n\x0f\n\x05\x04\x1f\x02\x01\ - \x04\x12\x06\xde\x01\x04\xdd\x01\x18\n\r\n\x05\x04\x1f\x02\x01\x05\x12\ - \x04\xde\x01\x04\t\n\r\n\x05\x04\x1f\x02\x01\x01\x12\x04\xde\x01\n\r\n\r\ - \n\x05\x04\x1f\x02\x01\x03\x12\x04\xde\x01\x10\x11\n\x0c\n\x02\x04\x20\ - \x12\x06\xe1\x01\0\xe4\x01\x01\n\x0b\n\x03\x04\x20\x01\x12\x04\xe1\x01\ - \x08\x19\n\x0c\n\x04\x04\x20\x02\0\x12\x04\xe2\x01\x04#\n\x0f\n\x05\x04\ - \x20\x02\0\x04\x12\x06\xe2\x01\x04\xe1\x01\x1b\n\r\n\x05\x04\x20\x02\0\ - \x06\x12\x04\xe2\x01\x04\x11\n\r\n\x05\x04\x20\x02\0\x01\x12\x04\xe2\x01\ - \x12\x1e\n\r\n\x05\x04\x20\x02\0\x03\x12\x04\xe2\x01!\"\n\x0c\n\x04\x04\ - \x20\x02\x01\x12\x04\xe3\x01\x04\x15\n\x0f\n\x05\x04\x20\x02\x01\x04\x12\ - \x06\xe3\x01\x04\xe2\x01#\n\r\n\x05\x04\x20\x02\x01\x05\x12\x04\xe3\x01\ - \x04\n\n\r\n\x05\x04\x20\x02\x01\x01\x12\x04\xe3\x01\x0b\x10\n\r\n\x05\ - \x04\x20\x02\x01\x03\x12\x04\xe3\x01\x13\x14\n\x0c\n\x02\x04!\x12\x06\ - \xe6\x01\0\xea\x01\x01\n\x0b\n\x03\x04!\x01\x12\x04\xe6\x01\x08\x1a\n\ - \x0c\n\x04\x04!\x02\0\x12\x04\xe7\x01\x04\x18\n\x0f\n\x05\x04!\x02\0\x04\ - \x12\x06\xe7\x01\x04\xe6\x01\x1c\n\r\n\x05\x04!\x02\0\x06\x12\x04\xe7\ - \x01\x04\x0b\n\r\n\x05\x04!\x02\0\x01\x12\x04\xe7\x01\x0c\x13\n\r\n\x05\ - \x04!\x02\0\x03\x12\x04\xe7\x01\x16\x17\n\x0c\n\x04\x04!\x02\x01\x12\x04\ - \xe8\x01\x04\x18\n\x0f\n\x05\x04!\x02\x01\x04\x12\x06\xe8\x01\x04\xe7\ - \x01\x18\n\r\n\x05\x04!\x02\x01\x05\x12\x04\xe8\x01\x04\t\n\r\n\x05\x04!\ - \x02\x01\x01\x12\x04\xe8\x01\n\x13\n\r\n\x05\x04!\x02\x01\x03\x12\x04\ - \xe8\x01\x16\x17\n\x0c\n\x04\x04!\x02\x02\x12\x04\xe9\x01\x04\x16\n\x0f\ - \n\x05\x04!\x02\x02\x04\x12\x06\xe9\x01\x04\xe8\x01\x18\n\r\n\x05\x04!\ - \x02\x02\x05\x12\x04\xe9\x01\x04\t\n\r\n\x05\x04!\x02\x02\x01\x12\x04\ - \xe9\x01\n\x11\n\r\n\x05\x04!\x02\x02\x03\x12\x04\xe9\x01\x14\x15\n\x0c\ - \n\x02\x04\"\x12\x06\xec\x01\0\xef\x01\x01\n\x0b\n\x03\x04\"\x01\x12\x04\ - \xec\x01\x08\x1b\n\x0c\n\x04\x04\"\x02\0\x12\x04\xed\x01\x04#\n\x0f\n\ - \x05\x04\"\x02\0\x04\x12\x06\xed\x01\x04\xec\x01\x1d\n\r\n\x05\x04\"\x02\ - \0\x06\x12\x04\xed\x01\x04\x11\n\r\n\x05\x04\"\x02\0\x01\x12\x04\xed\x01\ - \x12\x1e\n\r\n\x05\x04\"\x02\0\x03\x12\x04\xed\x01!\"\n\x0c\n\x04\x04\"\ - \x02\x01\x12\x04\xee\x01\x04\x15\n\x0f\n\x05\x04\"\x02\x01\x04\x12\x06\ - \xee\x01\x04\xed\x01#\n\r\n\x05\x04\"\x02\x01\x05\x12\x04\xee\x01\x04\n\ - \n\r\n\x05\x04\"\x02\x01\x01\x12\x04\xee\x01\x0b\x10\n\r\n\x05\x04\"\x02\ - \x01\x03\x12\x04\xee\x01\x13\x14\n\x0c\n\x02\x04#\x12\x06\xf1\x01\0\xf5\ - \x01\x01\n\x0b\n\x03\x04#\x01\x12\x04\xf1\x01\x08\x16\n\x0c\n\x04\x04#\ - \x02\0\x12\x04\xf2\x01\x04\x18\n\x0f\n\x05\x04#\x02\0\x04\x12\x06\xf2\ - \x01\x04\xf1\x01\x18\n\r\n\x05\x04#\x02\0\x06\x12\x04\xf2\x01\x04\x0b\n\ - \r\n\x05\x04#\x02\0\x01\x12\x04\xf2\x01\x0c\x13\n\r\n\x05\x04#\x02\0\x03\ - \x12\x04\xf2\x01\x16\x17\n\x0c\n\x04\x04#\x02\x01\x12\x04\xf3\x01\x04\ - \x18\n\x0f\n\x05\x04#\x02\x01\x04\x12\x06\xf3\x01\x04\xf2\x01\x18\n\r\n\ - \x05\x04#\x02\x01\x05\x12\x04\xf3\x01\x04\t\n\r\n\x05\x04#\x02\x01\x01\ - \x12\x04\xf3\x01\n\x13\n\r\n\x05\x04#\x02\x01\x03\x12\x04\xf3\x01\x16\ - \x17\n\x0c\n\x04\x04#\x02\x02\x12\x04\xf4\x01\x04\x15\n\x0f\n\x05\x04#\ - \x02\x02\x04\x12\x06\xf4\x01\x04\xf3\x01\x18\n\r\n\x05\x04#\x02\x02\x05\ - \x12\x04\xf4\x01\x04\n\n\r\n\x05\x04#\x02\x02\x01\x12\x04\xf4\x01\x0b\ - \x10\n\r\n\x05\x04#\x02\x02\x03\x12\x04\xf4\x01\x13\x14\n\x0c\n\x02\x04$\ - \x12\x06\xf7\x01\0\xfa\x01\x01\n\x0b\n\x03\x04$\x01\x12\x04\xf7\x01\x08\ - \x17\n\x0c\n\x04\x04$\x02\0\x12\x04\xf8\x01\x04#\n\x0f\n\x05\x04$\x02\0\ - \x04\x12\x06\xf8\x01\x04\xf7\x01\x19\n\r\n\x05\x04$\x02\0\x06\x12\x04\ - \xf8\x01\x04\x11\n\r\n\x05\x04$\x02\0\x01\x12\x04\xf8\x01\x12\x1e\n\r\n\ - \x05\x04$\x02\0\x03\x12\x04\xf8\x01!\"\n\x0c\n\x04\x04$\x02\x01\x12\x04\ - \xf9\x01\x04\x1c\n\r\n\x05\x04$\x02\x01\x04\x12\x04\xf9\x01\x04\x0c\n\r\ - \n\x05\x04$\x02\x01\x06\x12\x04\xf9\x01\r\x13\n\r\n\x05\x04$\x02\x01\x01\ - \x12\x04\xf9\x01\x14\x17\n\r\n\x05\x04$\x02\x01\x03\x12\x04\xf9\x01\x1a\ - \x1b\n\x0c\n\x02\x04%\x12\x06\xfc\x01\0\x80\x02\x01\n\x0b\n\x03\x04%\x01\ - \x12\x04\xfc\x01\x08\x11\n\x0c\n\x04\x04%\x02\0\x12\x04\xfd\x01\x04\x18\ - \n\x0f\n\x05\x04%\x02\0\x04\x12\x06\xfd\x01\x04\xfc\x01\x13\n\r\n\x05\ - \x04%\x02\0\x05\x12\x04\xfd\x01\x04\n\n\r\n\x05\x04%\x02\0\x01\x12\x04\ - \xfd\x01\x0b\x13\n\r\n\x05\x04%\x02\0\x03\x12\x04\xfd\x01\x16\x17\n\x0c\ - \n\x04\x04%\x02\x01\x12\x04\xfe\x01\x04\x10\n\x0f\n\x05\x04%\x02\x01\x04\ - \x12\x06\xfe\x01\x04\xfd\x01\x18\n\r\n\x05\x04%\x02\x01\x06\x12\x04\xfe\ - \x01\x04\x06\n\r\n\x05\x04%\x02\x01\x01\x12\x04\xfe\x01\x07\x0b\n\r\n\ - \x05\x04%\x02\x01\x03\x12\x04\xfe\x01\x0e\x0f\n\x0c\n\x04\x04%\x02\x02\ - \x12\x04\xff\x01\x04\x19\n\x0f\n\x05\x04%\x02\x02\x04\x12\x06\xff\x01\ - \x04\xfe\x01\x10\n\r\n\x05\x04%\x02\x02\x05\x12\x04\xff\x01\x04\n\n\r\n\ - \x05\x04%\x02\x02\x01\x12\x04\xff\x01\x0b\x14\n\r\n\x05\x04%\x02\x02\x03\ - \x12\x04\xff\x01\x17\x18\n\x0c\n\x02\x04&\x12\x06\x82\x02\0\x86\x02\x01\ - \n\x0b\n\x03\x04&\x01\x12\x04\x82\x02\x08\x11\n\x0c\n\x04\x04&\x02\0\x12\ - \x04\x83\x02\x04\x14\n\x0f\n\x05\x04&\x02\0\x04\x12\x06\x83\x02\x04\x82\ - \x02\x13\n\r\n\x05\x04&\x02\0\x05\x12\x04\x83\x02\x04\t\n\r\n\x05\x04&\ - \x02\0\x01\x12\x04\x83\x02\n\x0f\n\r\n\x05\x04&\x02\0\x03\x12\x04\x83\ - \x02\x12\x13\n\x0c\n\x04\x04&\x02\x01\x12\x04\x84\x02\x04\x12\n\x0f\n\ - \x05\x04&\x02\x01\x04\x12\x06\x84\x02\x04\x83\x02\x14\n\r\n\x05\x04&\x02\ - \x01\x05\x12\x04\x84\x02\x04\n\n\r\n\x05\x04&\x02\x01\x01\x12\x04\x84\ - \x02\x0b\r\n\r\n\x05\x04&\x02\x01\x03\x12\x04\x84\x02\x10\x11\n\x0c\n\ - \x04\x04&\x02\x02\x12\x04\x85\x02\x04\x1c\n\x0f\n\x05\x04&\x02\x02\x04\ - \x12\x06\x85\x02\x04\x84\x02\x12\n\r\n\x05\x04&\x02\x02\x05\x12\x04\x85\ - \x02\x04\x08\n\r\n\x05\x04&\x02\x02\x01\x12\x04\x85\x02\t\x17\n\r\n\x05\ - \x04&\x02\x02\x03\x12\x04\x85\x02\x1a\x1b\n\x0c\n\x02\x04'\x12\x06\x88\ - \x02\0\x8c\x02\x01\n\x0b\n\x03\x04'\x01\x12\x04\x88\x02\x08\x10\n\x0c\n\ - \x04\x04'\x02\0\x12\x04\x89\x02\x04\x16\n\x0f\n\x05\x04'\x02\0\x04\x12\ - \x06\x89\x02\x04\x88\x02\x12\n\r\n\x05\x04'\x02\0\x06\x12\x04\x89\x02\ - \x04\x0c\n\r\n\x05\x04'\x02\0\x01\x12\x04\x89\x02\r\x11\n\r\n\x05\x04'\ - \x02\0\x03\x12\x04\x89\x02\x14\x15\n\x0c\n\x04\x04'\x02\x01\x12\x04\x8a\ - \x02\x04\"\n\r\n\x05\x04'\x02\x01\x04\x12\x04\x8a\x02\x04\x0c\n\r\n\x05\ - \x04'\x02\x01\x06\x12\x04\x8a\x02\r\x16\n\r\n\x05\x04'\x02\x01\x01\x12\ - \x04\x8a\x02\x17\x1d\n\r\n\x05\x04'\x02\x01\x03\x12\x04\x8a\x02\x20!\n\ - \x0c\n\x04\x04'\x02\x02\x12\x04\x8b\x02\x04\"\n\r\n\x05\x04'\x02\x02\x04\ - \x12\x04\x8b\x02\x04\x0c\n\r\n\x05\x04'\x02\x02\x06\x12\x04\x8b\x02\r\ - \x16\n\r\n\x05\x04'\x02\x02\x01\x12\x04\x8b\x02\x17\x1d\n\r\n\x05\x04'\ - \x02\x02\x03\x12\x04\x8b\x02\x20!\n\x0c\n\x02\x04(\x12\x06\x8e\x02\0\x91\ - \x02\x01\n\x0b\n\x03\x04(\x01\x12\x04\x8e\x02\x08\x1b\n\x0c\n\x04\x04(\ - \x02\0\x12\x04\x8f\x02\x04\x18\n\x0f\n\x05\x04(\x02\0\x04\x12\x06\x8f\ - \x02\x04\x8e\x02\x1d\n\r\n\x05\x04(\x02\0\x06\x12\x04\x8f\x02\x04\x0b\n\ - \r\n\x05\x04(\x02\0\x01\x12\x04\x8f\x02\x0c\x13\n\r\n\x05\x04(\x02\0\x03\ - \x12\x04\x8f\x02\x16\x17\n\x0c\n\x04\x04(\x02\x01\x12\x04\x90\x02\x04\ - \x12\n\x0f\n\x05\x04(\x02\x01\x04\x12\x06\x90\x02\x04\x8f\x02\x18\n\r\n\ - \x05\x04(\x02\x01\x05\x12\x04\x90\x02\x04\t\n\r\n\x05\x04(\x02\x01\x01\ - \x12\x04\x90\x02\n\r\n\r\n\x05\x04(\x02\x01\x03\x12\x04\x90\x02\x10\x11\ - \n\x0c\n\x02\x04)\x12\x06\x93\x02\0\x97\x02\x01\n\x0b\n\x03\x04)\x01\x12\ - \x04\x93\x02\x08\x1c\n\x0c\n\x04\x04)\x02\0\x12\x04\x94\x02\x04#\n\x0f\n\ - \x05\x04)\x02\0\x04\x12\x06\x94\x02\x04\x93\x02\x1e\n\r\n\x05\x04)\x02\0\ - \x06\x12\x04\x94\x02\x04\x11\n\r\n\x05\x04)\x02\0\x01\x12\x04\x94\x02\ - \x12\x1e\n\r\n\x05\x04)\x02\0\x03\x12\x04\x94\x02!\"\n\x0c\n\x04\x04)\ - \x02\x01\x12\x04\x95\x02\x04\x15\n\x0f\n\x05\x04)\x02\x01\x04\x12\x06\ - \x95\x02\x04\x94\x02#\n\r\n\x05\x04)\x02\x01\x05\x12\x04\x95\x02\x04\n\n\ - \r\n\x05\x04)\x02\x01\x01\x12\x04\x95\x02\x0b\x10\n\r\n\x05\x04)\x02\x01\ - \x03\x12\x04\x95\x02\x13\x14\n\x0c\n\x04\x04)\x02\x02\x12\x04\x96\x02\ - \x04\x16\n\x0f\n\x05\x04)\x02\x02\x04\x12\x06\x96\x02\x04\x95\x02\x15\n\ - \r\n\x05\x04)\x02\x02\x06\x12\x04\x96\x02\x04\x0c\n\r\n\x05\x04)\x02\x02\ - \x01\x12\x04\x96\x02\r\x11\n\r\n\x05\x04)\x02\x02\x03\x12\x04\x96\x02\ - \x14\x15\n\x0c\n\x02\x04*\x12\x06\x99\x02\0\x9c\x02\x01\n\x0b\n\x03\x04*\ - \x01\x12\x04\x99\x02\x08\x1f\n\x0c\n\x04\x04*\x02\0\x12\x04\x9a\x02\x04\ - \x18\n\x0f\n\x05\x04*\x02\0\x04\x12\x06\x9a\x02\x04\x99\x02!\n\r\n\x05\ - \x04*\x02\0\x06\x12\x04\x9a\x02\x04\x0b\n\r\n\x05\x04*\x02\0\x01\x12\x04\ - \x9a\x02\x0c\x13\n\r\n\x05\x04*\x02\0\x03\x12\x04\x9a\x02\x16\x17\n\x0c\ - \n\x04\x04*\x02\x01\x12\x04\x9b\x02\x04\x18\n\x0f\n\x05\x04*\x02\x01\x04\ - \x12\x06\x9b\x02\x04\x9a\x02\x18\n\r\n\x05\x04*\x02\x01\x05\x12\x04\x9b\ - \x02\x04\n\n\r\n\x05\x04*\x02\x01\x01\x12\x04\x9b\x02\x0b\x13\n\r\n\x05\ - \x04*\x02\x01\x03\x12\x04\x9b\x02\x16\x17\n\x0c\n\x02\x04+\x12\x06\x9e\ - \x02\0\xa3\x02\x01\n\x0b\n\x03\x04+\x01\x12\x04\x9e\x02\x08\x20\n\x0c\n\ - \x04\x04+\x02\0\x12\x04\x9f\x02\x04#\n\x0f\n\x05\x04+\x02\0\x04\x12\x06\ - \x9f\x02\x04\x9e\x02\"\n\r\n\x05\x04+\x02\0\x06\x12\x04\x9f\x02\x04\x11\ - \n\r\n\x05\x04+\x02\0\x01\x12\x04\x9f\x02\x12\x1e\n\r\n\x05\x04+\x02\0\ - \x03\x12\x04\x9f\x02!\"\n\x0c\n\x04\x04+\x02\x01\x12\x04\xa0\x02\x04\x15\ - \n\x0f\n\x05\x04+\x02\x01\x04\x12\x06\xa0\x02\x04\x9f\x02#\n\r\n\x05\x04\ - +\x02\x01\x05\x12\x04\xa0\x02\x04\n\n\r\n\x05\x04+\x02\x01\x01\x12\x04\ - \xa0\x02\x0b\x10\n\r\n\x05\x04+\x02\x01\x03\x12\x04\xa0\x02\x13\x14\n\ - \x0c\n\x04\x04+\x02\x02\x12\x04\xa1\x02\x04\x12\n\x0f\n\x05\x04+\x02\x02\ - \x04\x12\x06\xa1\x02\x04\xa0\x02\x15\n\r\n\x05\x04+\x02\x02\x05\x12\x04\ - \xa1\x02\x04\t\n\r\n\x05\x04+\x02\x02\x01\x12\x04\xa1\x02\n\r\n\r\n\x05\ - \x04+\x02\x02\x03\x12\x04\xa1\x02\x10\x11\n\x0c\n\x04\x04+\x02\x03\x12\ - \x04\xa2\x02\x04\x16\n\x0f\n\x05\x04+\x02\x03\x04\x12\x06\xa2\x02\x04\ - \xa1\x02\x12\n\r\n\x05\x04+\x02\x03\x06\x12\x04\xa2\x02\x04\x0c\n\r\n\ - \x05\x04+\x02\x03\x01\x12\x04\xa2\x02\r\x11\n\r\n\x05\x04+\x02\x03\x03\ - \x12\x04\xa2\x02\x14\x15b\x06proto3\ -"; - -static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/src/lib.rs b/_vendor/src/github.com/pingcap/kvproto/src/lib.rs deleted file mode 100644 index 12c108b34d8..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/src/lib.rs +++ /dev/null @@ -1,15 +0,0 @@ -extern crate protobuf; -extern crate futures; -extern crate grpcio; - -pub mod coprocessor; -pub mod eraftpb; -pub mod errorpb; -pub mod kvrpcpb; -pub mod metapb; -pub mod pdpb_grpc; -pub mod pdpb; -pub mod raft_cmdpb; -pub mod raft_serverpb; -pub mod tikvpb_grpc; -pub mod util; diff --git a/_vendor/src/github.com/pingcap/kvproto/src/metapb.rs b/_vendor/src/github.com/pingcap/kvproto/src/metapb.rs deleted file mode 100644 index f0006b1ae1c..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/src/metapb.rs +++ /dev/null @@ -1,1923 +0,0 @@ -// This file is generated. Do not edit -// @generated - -// https://github.com/Manishearth/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] - -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; - -#[derive(PartialEq,Clone,Default)] -pub struct Cluster { - // message fields - id: ::std::option::Option, - max_peer_count: ::std::option::Option, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Cluster {} - -impl Cluster { - pub fn new() -> Cluster { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Cluster { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Cluster, - }; - unsafe { - instance.get(Cluster::new) - } - } - - // optional uint64 id = 1; - - pub fn clear_id(&mut self) { - self.id = ::std::option::Option::None; - } - - pub fn has_id(&self) -> bool { - self.id.is_some() - } - - // Param is passed by value, moved - pub fn set_id(&mut self, v: u64) { - self.id = ::std::option::Option::Some(v); - } - - pub fn get_id(&self) -> u64 { - self.id.unwrap_or(0) - } - - fn get_id_for_reflect(&self) -> &::std::option::Option { - &self.id - } - - fn mut_id_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.id - } - - // optional uint32 max_peer_count = 2; - - pub fn clear_max_peer_count(&mut self) { - self.max_peer_count = ::std::option::Option::None; - } - - pub fn has_max_peer_count(&self) -> bool { - self.max_peer_count.is_some() - } - - // Param is passed by value, moved - pub fn set_max_peer_count(&mut self, v: u32) { - self.max_peer_count = ::std::option::Option::Some(v); - } - - pub fn get_max_peer_count(&self) -> u32 { - self.max_peer_count.unwrap_or(0) - } - - fn get_max_peer_count_for_reflect(&self) -> &::std::option::Option { - &self.max_peer_count - } - - fn mut_max_peer_count_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.max_peer_count - } -} - -impl ::protobuf::Message for Cluster { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.id = ::std::option::Option::Some(tmp); - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint32()?; - self.max_peer_count = ::std::option::Option::Some(tmp); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.id { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.max_peer_count { - my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.id { - os.write_uint64(1, v)?; - } - if let Some(v) = self.max_peer_count { - os.write_uint32(2, v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Cluster { - fn new() -> Cluster { - Cluster::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "id", - Cluster::get_id_for_reflect, - Cluster::mut_id_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( - "max_peer_count", - Cluster::get_max_peer_count_for_reflect, - Cluster::mut_max_peer_count_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Cluster", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Cluster { - fn clear(&mut self) { - self.clear_id(); - self.clear_max_peer_count(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Cluster { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Cluster { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct StoreLabel { - // message fields - key: ::protobuf::SingularField<::std::string::String>, - value: ::protobuf::SingularField<::std::string::String>, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for StoreLabel {} - -impl StoreLabel { - pub fn new() -> StoreLabel { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static StoreLabel { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const StoreLabel, - }; - unsafe { - instance.get(StoreLabel::new) - } - } - - // optional string key = 1; - - pub fn clear_key(&mut self) { - self.key.clear(); - } - - pub fn has_key(&self) -> bool { - self.key.is_some() - } - - // Param is passed by value, moved - pub fn set_key(&mut self, v: ::std::string::String) { - self.key = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key(&mut self) -> &mut ::std::string::String { - if self.key.is_none() { - self.key.set_default(); - } - self.key.as_mut().unwrap() - } - - // Take field - pub fn take_key(&mut self) -> ::std::string::String { - self.key.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub fn get_key(&self) -> &str { - match self.key.as_ref() { - Some(v) => &v, - None => "", - } - } - - fn get_key_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.key - } - - fn mut_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.key - } - - // optional string value = 2; - - pub fn clear_value(&mut self) { - self.value.clear(); - } - - pub fn has_value(&self) -> bool { - self.value.is_some() - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: ::std::string::String) { - self.value = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_value(&mut self) -> &mut ::std::string::String { - if self.value.is_none() { - self.value.set_default(); - } - self.value.as_mut().unwrap() - } - - // Take field - pub fn take_value(&mut self) -> ::std::string::String { - self.value.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub fn get_value(&self) -> &str { - match self.value.as_ref() { - Some(v) => &v, - None => "", - } - } - - fn get_value_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.value - } - - fn mut_value_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.value - } -} - -impl ::protobuf::Message for StoreLabel { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.key)?; - }, - 2 => { - ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.value)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.key.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(ref v) = self.value.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.key.as_ref() { - os.write_string(1, &v)?; - } - if let Some(ref v) = self.value.as_ref() { - os.write_string(2, &v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for StoreLabel { - fn new() -> StoreLabel { - StoreLabel::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "key", - StoreLabel::get_key_for_reflect, - StoreLabel::mut_key_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "value", - StoreLabel::get_value_for_reflect, - StoreLabel::mut_value_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "StoreLabel", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for StoreLabel { - fn clear(&mut self) { - self.clear_key(); - self.clear_value(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for StoreLabel { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StoreLabel { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Store { - // message fields - id: ::std::option::Option, - address: ::protobuf::SingularField<::std::string::String>, - state: ::std::option::Option, - labels: ::protobuf::RepeatedField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Store {} - -impl Store { - pub fn new() -> Store { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Store { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Store, - }; - unsafe { - instance.get(Store::new) - } - } - - // optional uint64 id = 1; - - pub fn clear_id(&mut self) { - self.id = ::std::option::Option::None; - } - - pub fn has_id(&self) -> bool { - self.id.is_some() - } - - // Param is passed by value, moved - pub fn set_id(&mut self, v: u64) { - self.id = ::std::option::Option::Some(v); - } - - pub fn get_id(&self) -> u64 { - self.id.unwrap_or(0) - } - - fn get_id_for_reflect(&self) -> &::std::option::Option { - &self.id - } - - fn mut_id_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.id - } - - // optional string address = 2; - - pub fn clear_address(&mut self) { - self.address.clear(); - } - - pub fn has_address(&self) -> bool { - self.address.is_some() - } - - // Param is passed by value, moved - pub fn set_address(&mut self, v: ::std::string::String) { - self.address = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_address(&mut self) -> &mut ::std::string::String { - if self.address.is_none() { - self.address.set_default(); - } - self.address.as_mut().unwrap() - } - - // Take field - pub fn take_address(&mut self) -> ::std::string::String { - self.address.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub fn get_address(&self) -> &str { - match self.address.as_ref() { - Some(v) => &v, - None => "", - } - } - - fn get_address_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.address - } - - fn mut_address_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.address - } - - // optional .metapb.StoreState state = 3; - - pub fn clear_state(&mut self) { - self.state = ::std::option::Option::None; - } - - pub fn has_state(&self) -> bool { - self.state.is_some() - } - - // Param is passed by value, moved - pub fn set_state(&mut self, v: StoreState) { - self.state = ::std::option::Option::Some(v); - } - - pub fn get_state(&self) -> StoreState { - self.state.unwrap_or(StoreState::Up) - } - - fn get_state_for_reflect(&self) -> &::std::option::Option { - &self.state - } - - fn mut_state_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.state - } - - // repeated .metapb.StoreLabel labels = 4; - - pub fn clear_labels(&mut self) { - self.labels.clear(); - } - - // Param is passed by value, moved - pub fn set_labels(&mut self, v: ::protobuf::RepeatedField) { - self.labels = v; - } - - // Mutable pointer to the field. - pub fn mut_labels(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.labels - } - - // Take field - pub fn take_labels(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.labels, ::protobuf::RepeatedField::new()) - } - - pub fn get_labels(&self) -> &[StoreLabel] { - &self.labels - } - - fn get_labels_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.labels - } - - fn mut_labels_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.labels - } -} - -impl ::protobuf::Message for Store { - fn is_initialized(&self) -> bool { - for v in &self.labels { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.id = ::std::option::Option::Some(tmp); - }, - 2 => { - ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.address)?; - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.state = ::std::option::Option::Some(tmp); - }, - 4 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.labels)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.id { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(ref v) = self.address.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.state { - my_size += ::protobuf::rt::enum_size(3, v); - } - for value in &self.labels { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.id { - os.write_uint64(1, v)?; - } - if let Some(ref v) = self.address.as_ref() { - os.write_string(2, &v)?; - } - if let Some(v) = self.state { - os.write_enum(3, v.value())?; - } - for v in &self.labels { - os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Store { - fn new() -> Store { - Store::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "id", - Store::get_id_for_reflect, - Store::mut_id_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "address", - Store::get_address_for_reflect, - Store::mut_address_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "state", - Store::get_state_for_reflect, - Store::mut_state_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "labels", - Store::get_labels_for_reflect, - Store::mut_labels_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Store", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Store { - fn clear(&mut self) { - self.clear_id(); - self.clear_address(); - self.clear_state(); - self.clear_labels(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Store { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Store { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RegionEpoch { - // message fields - conf_ver: ::std::option::Option, - version: ::std::option::Option, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RegionEpoch {} - -impl RegionEpoch { - pub fn new() -> RegionEpoch { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RegionEpoch { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RegionEpoch, - }; - unsafe { - instance.get(RegionEpoch::new) - } - } - - // optional uint64 conf_ver = 1; - - pub fn clear_conf_ver(&mut self) { - self.conf_ver = ::std::option::Option::None; - } - - pub fn has_conf_ver(&self) -> bool { - self.conf_ver.is_some() - } - - // Param is passed by value, moved - pub fn set_conf_ver(&mut self, v: u64) { - self.conf_ver = ::std::option::Option::Some(v); - } - - pub fn get_conf_ver(&self) -> u64 { - self.conf_ver.unwrap_or(0) - } - - fn get_conf_ver_for_reflect(&self) -> &::std::option::Option { - &self.conf_ver - } - - fn mut_conf_ver_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.conf_ver - } - - // optional uint64 version = 2; - - pub fn clear_version(&mut self) { - self.version = ::std::option::Option::None; - } - - pub fn has_version(&self) -> bool { - self.version.is_some() - } - - // Param is passed by value, moved - pub fn set_version(&mut self, v: u64) { - self.version = ::std::option::Option::Some(v); - } - - pub fn get_version(&self) -> u64 { - self.version.unwrap_or(0) - } - - fn get_version_for_reflect(&self) -> &::std::option::Option { - &self.version - } - - fn mut_version_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.version - } -} - -impl ::protobuf::Message for RegionEpoch { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.conf_ver = ::std::option::Option::Some(tmp); - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.version = ::std::option::Option::Some(tmp); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.conf_ver { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.version { - my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.conf_ver { - os.write_uint64(1, v)?; - } - if let Some(v) = self.version { - os.write_uint64(2, v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RegionEpoch { - fn new() -> RegionEpoch { - RegionEpoch::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "conf_ver", - RegionEpoch::get_conf_ver_for_reflect, - RegionEpoch::mut_conf_ver_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "version", - RegionEpoch::get_version_for_reflect, - RegionEpoch::mut_version_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RegionEpoch", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RegionEpoch { - fn clear(&mut self) { - self.clear_conf_ver(); - self.clear_version(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RegionEpoch { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RegionEpoch { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Region { - // message fields - id: ::std::option::Option, - start_key: ::protobuf::SingularField<::std::vec::Vec>, - end_key: ::protobuf::SingularField<::std::vec::Vec>, - region_epoch: ::protobuf::SingularPtrField, - peers: ::protobuf::RepeatedField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Region {} - -impl Region { - pub fn new() -> Region { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Region { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Region, - }; - unsafe { - instance.get(Region::new) - } - } - - // optional uint64 id = 1; - - pub fn clear_id(&mut self) { - self.id = ::std::option::Option::None; - } - - pub fn has_id(&self) -> bool { - self.id.is_some() - } - - // Param is passed by value, moved - pub fn set_id(&mut self, v: u64) { - self.id = ::std::option::Option::Some(v); - } - - pub fn get_id(&self) -> u64 { - self.id.unwrap_or(0) - } - - fn get_id_for_reflect(&self) -> &::std::option::Option { - &self.id - } - - fn mut_id_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.id - } - - // optional bytes start_key = 2; - - pub fn clear_start_key(&mut self) { - self.start_key.clear(); - } - - pub fn has_start_key(&self) -> bool { - self.start_key.is_some() - } - - // Param is passed by value, moved - pub fn set_start_key(&mut self, v: ::std::vec::Vec) { - self.start_key = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_start_key(&mut self) -> &mut ::std::vec::Vec { - if self.start_key.is_none() { - self.start_key.set_default(); - } - self.start_key.as_mut().unwrap() - } - - // Take field - pub fn take_start_key(&mut self) -> ::std::vec::Vec { - self.start_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_start_key(&self) -> &[u8] { - match self.start_key.as_ref() { - Some(v) => &v, - None => &[], - } - } - - fn get_start_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.start_key - } - - fn mut_start_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.start_key - } - - // optional bytes end_key = 3; - - pub fn clear_end_key(&mut self) { - self.end_key.clear(); - } - - pub fn has_end_key(&self) -> bool { - self.end_key.is_some() - } - - // Param is passed by value, moved - pub fn set_end_key(&mut self, v: ::std::vec::Vec) { - self.end_key = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_end_key(&mut self) -> &mut ::std::vec::Vec { - if self.end_key.is_none() { - self.end_key.set_default(); - } - self.end_key.as_mut().unwrap() - } - - // Take field - pub fn take_end_key(&mut self) -> ::std::vec::Vec { - self.end_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_end_key(&self) -> &[u8] { - match self.end_key.as_ref() { - Some(v) => &v, - None => &[], - } - } - - fn get_end_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.end_key - } - - fn mut_end_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.end_key - } - - // optional .metapb.RegionEpoch region_epoch = 4; - - pub fn clear_region_epoch(&mut self) { - self.region_epoch.clear(); - } - - pub fn has_region_epoch(&self) -> bool { - self.region_epoch.is_some() - } - - // Param is passed by value, moved - pub fn set_region_epoch(&mut self, v: RegionEpoch) { - self.region_epoch = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_epoch(&mut self) -> &mut RegionEpoch { - if self.region_epoch.is_none() { - self.region_epoch.set_default(); - } - self.region_epoch.as_mut().unwrap() - } - - // Take field - pub fn take_region_epoch(&mut self) -> RegionEpoch { - self.region_epoch.take().unwrap_or_else(|| RegionEpoch::new()) - } - - pub fn get_region_epoch(&self) -> &RegionEpoch { - self.region_epoch.as_ref().unwrap_or_else(|| RegionEpoch::default_instance()) - } - - fn get_region_epoch_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_epoch - } - - fn mut_region_epoch_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_epoch - } - - // repeated .metapb.Peer peers = 5; - - pub fn clear_peers(&mut self) { - self.peers.clear(); - } - - // Param is passed by value, moved - pub fn set_peers(&mut self, v: ::protobuf::RepeatedField) { - self.peers = v; - } - - // Mutable pointer to the field. - pub fn mut_peers(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.peers - } - - // Take field - pub fn take_peers(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.peers, ::protobuf::RepeatedField::new()) - } - - pub fn get_peers(&self) -> &[Peer] { - &self.peers - } - - fn get_peers_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.peers - } - - fn mut_peers_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.peers - } -} - -impl ::protobuf::Message for Region { - fn is_initialized(&self) -> bool { - for v in &self.region_epoch { - if !v.is_initialized() { - return false; - } - }; - for v in &self.peers { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.id = ::std::option::Option::Some(tmp); - }, - 2 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.start_key)?; - }, - 3 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.end_key)?; - }, - 4 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_epoch)?; - }, - 5 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.peers)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.id { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(ref v) = self.start_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(ref v) = self.end_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - if let Some(ref v) = self.region_epoch.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - for value in &self.peers { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.id { - os.write_uint64(1, v)?; - } - if let Some(ref v) = self.start_key.as_ref() { - os.write_bytes(2, &v)?; - } - if let Some(ref v) = self.end_key.as_ref() { - os.write_bytes(3, &v)?; - } - if let Some(ref v) = self.region_epoch.as_ref() { - os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - for v in &self.peers { - os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Region { - fn new() -> Region { - Region::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "id", - Region::get_id_for_reflect, - Region::mut_id_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "start_key", - Region::get_start_key_for_reflect, - Region::mut_start_key_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "end_key", - Region::get_end_key_for_reflect, - Region::mut_end_key_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_epoch", - Region::get_region_epoch_for_reflect, - Region::mut_region_epoch_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "peers", - Region::get_peers_for_reflect, - Region::mut_peers_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Region", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Region { - fn clear(&mut self) { - self.clear_id(); - self.clear_start_key(); - self.clear_end_key(); - self.clear_region_epoch(); - self.clear_peers(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Region { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Region { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Peer { - // message fields - id: ::std::option::Option, - store_id: ::std::option::Option, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Peer {} - -impl Peer { - pub fn new() -> Peer { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Peer { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Peer, - }; - unsafe { - instance.get(Peer::new) - } - } - - // optional uint64 id = 1; - - pub fn clear_id(&mut self) { - self.id = ::std::option::Option::None; - } - - pub fn has_id(&self) -> bool { - self.id.is_some() - } - - // Param is passed by value, moved - pub fn set_id(&mut self, v: u64) { - self.id = ::std::option::Option::Some(v); - } - - pub fn get_id(&self) -> u64 { - self.id.unwrap_or(0) - } - - fn get_id_for_reflect(&self) -> &::std::option::Option { - &self.id - } - - fn mut_id_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.id - } - - // optional uint64 store_id = 2; - - pub fn clear_store_id(&mut self) { - self.store_id = ::std::option::Option::None; - } - - pub fn has_store_id(&self) -> bool { - self.store_id.is_some() - } - - // Param is passed by value, moved - pub fn set_store_id(&mut self, v: u64) { - self.store_id = ::std::option::Option::Some(v); - } - - pub fn get_store_id(&self) -> u64 { - self.store_id.unwrap_or(0) - } - - fn get_store_id_for_reflect(&self) -> &::std::option::Option { - &self.store_id - } - - fn mut_store_id_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.store_id - } -} - -impl ::protobuf::Message for Peer { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.id = ::std::option::Option::Some(tmp); - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.store_id = ::std::option::Option::Some(tmp); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.id { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.store_id { - my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.id { - os.write_uint64(1, v)?; - } - if let Some(v) = self.store_id { - os.write_uint64(2, v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Peer { - fn new() -> Peer { - Peer::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "id", - Peer::get_id_for_reflect, - Peer::mut_id_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "store_id", - Peer::get_store_id_for_reflect, - Peer::mut_store_id_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Peer", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Peer { - fn clear(&mut self) { - self.clear_id(); - self.clear_store_id(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Peer { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Peer { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum StoreState { - Up = 0, - Offline = 1, - Tombstone = 2, -} - -impl ::protobuf::ProtobufEnum for StoreState { - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(StoreState::Up), - 1 => ::std::option::Option::Some(StoreState::Offline), - 2 => ::std::option::Option::Some(StoreState::Tombstone), - _ => ::std::option::Option::None - } - } - - fn values() -> &'static [Self] { - static values: &'static [StoreState] = &[ - StoreState::Up, - StoreState::Offline, - StoreState::Tombstone, - ]; - values - } - - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, - }; - unsafe { - descriptor.get(|| { - ::protobuf::reflect::EnumDescriptor::new("StoreState", file_descriptor_proto()) - }) - } - } -} - -impl ::std::marker::Copy for StoreState { -} - -impl ::protobuf::reflect::ProtobufValue for StoreState { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x0cmetapb.proto\x12\x06metapb\x1a\x14gogoproto/gogo.proto\"K\n\x07Clu\ - ster\x12\x14\n\x02id\x18\x01\x20\x01(\x04R\x02idB\x04\xc8\xde\x1f\0\x12*\ - \n\x0emax_peer_count\x18\x02\x20\x01(\rR\x0cmaxPeerCountB\x04\xc8\xde\ - \x1f\0\"@\n\nStoreLabel\x12\x16\n\x03key\x18\x01\x20\x01(\tR\x03keyB\x04\ - \xc8\xde\x1f\0\x12\x1a\n\x05value\x18\x02\x20\x01(\tR\x05valueB\x04\xc8\ - \xde\x1f\0\"\x99\x01\n\x05Store\x12\x14\n\x02id\x18\x01\x20\x01(\x04R\ - \x02idB\x04\xc8\xde\x1f\0\x12\x1e\n\x07address\x18\x02\x20\x01(\tR\x07ad\ - dressB\x04\xc8\xde\x1f\0\x12.\n\x05state\x18\x03\x20\x01(\x0e2\x12.metap\ - b.StoreStateR\x05stateB\x04\xc8\xde\x1f\0\x12*\n\x06labels\x18\x04\x20\ - \x03(\x0b2\x12.metapb.StoreLabelR\x06labels\"N\n\x0bRegionEpoch\x12\x1f\ - \n\x08conf_ver\x18\x01\x20\x01(\x04R\x07confVerB\x04\xc8\xde\x1f\0\x12\ - \x1e\n\x07version\x18\x02\x20\x01(\x04R\x07versionB\x04\xc8\xde\x1f\0\"\ - \xb0\x01\n\x06Region\x12\x14\n\x02id\x18\x01\x20\x01(\x04R\x02idB\x04\ - \xc8\xde\x1f\0\x12\x1b\n\tstart_key\x18\x02\x20\x01(\x0cR\x08startKey\ - \x12\x17\n\x07end_key\x18\x03\x20\x01(\x0cR\x06endKey\x126\n\x0cregion_e\ - poch\x18\x04\x20\x01(\x0b2\x13.metapb.RegionEpochR\x0bregionEpoch\x12\"\ - \n\x05peers\x18\x05\x20\x03(\x0b2\x0c.metapb.PeerR\x05peers\"=\n\x04Peer\ - \x12\x14\n\x02id\x18\x01\x20\x01(\x04R\x02idB\x04\xc8\xde\x1f\0\x12\x1f\ - \n\x08store_id\x18\x02\x20\x01(\x04R\x07storeIdB\x04\xc8\xde\x1f\0*0\n\n\ - StoreState\x12\x06\n\x02Up\x10\0\x12\x0b\n\x07Offline\x10\x01\x12\r\n\tT\ - ombstone\x10\x02B&\n\x18com.pingcap.tikv.kvproto\xe0\xe2\x1e\x01\xc8\xe2\ - \x1e\x01\xd0\xe2\x1e\x01J\x86\x1b\n\x06\x12\x04\0\0:\x01\n\x08\n\x01\x0c\ - \x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x01\x08\x0e\n\t\n\x02\x03\0\x12\ - \x03\x03\x07\x1d\n\x08\n\x01\x08\x12\x03\x05\0(\n\x0b\n\x04\x08\xe7\x07\ - \0\x12\x03\x05\0(\n\x0c\n\x05\x08\xe7\x07\0\x02\x12\x03\x05\x07\x20\n\r\ - \n\x06\x08\xe7\x07\0\x02\0\x12\x03\x05\x07\x20\n\x0e\n\x07\x08\xe7\x07\0\ - \x02\0\x01\x12\x03\x05\x08\x1f\n\x0c\n\x05\x08\xe7\x07\0\x03\x12\x03\x05\ - #'\n\x08\n\x01\x08\x12\x03\x06\0$\n\x0b\n\x04\x08\xe7\x07\x01\x12\x03\ - \x06\0$\n\x0c\n\x05\x08\xe7\x07\x01\x02\x12\x03\x06\x07\x1c\n\r\n\x06\ - \x08\xe7\x07\x01\x02\0\x12\x03\x06\x07\x1c\n\x0e\n\x07\x08\xe7\x07\x01\ - \x02\0\x01\x12\x03\x06\x08\x1b\n\x0c\n\x05\x08\xe7\x07\x01\x03\x12\x03\ - \x06\x1f#\n\x08\n\x01\x08\x12\x03\x07\0*\n\x0b\n\x04\x08\xe7\x07\x02\x12\ - \x03\x07\0*\n\x0c\n\x05\x08\xe7\x07\x02\x02\x12\x03\x07\x07\"\n\r\n\x06\ - \x08\xe7\x07\x02\x02\0\x12\x03\x07\x07\"\n\x0e\n\x07\x08\xe7\x07\x02\x02\ - \0\x01\x12\x03\x07\x08!\n\x0c\n\x05\x08\xe7\x07\x02\x03\x12\x03\x07%)\n\ - \x08\n\x01\x08\x12\x03\t\01\n\x0b\n\x04\x08\xe7\x07\x03\x12\x03\t\01\n\ - \x0c\n\x05\x08\xe7\x07\x03\x02\x12\x03\t\x07\x13\n\r\n\x06\x08\xe7\x07\ - \x03\x02\0\x12\x03\t\x07\x13\n\x0e\n\x07\x08\xe7\x07\x03\x02\0\x01\x12\ - \x03\t\x07\x13\n\x0c\n\x05\x08\xe7\x07\x03\x07\x12\x03\t\x160\n\n\n\x02\ - \x04\0\x12\x04\x0b\0\x11\x01\n\n\n\x03\x04\0\x01\x12\x03\x0b\x08\x0f\n\ - \x0b\n\x04\x04\0\x02\0\x12\x03\x0c\x04G\n\x0c\n\x05\x04\0\x02\0\x04\x12\ - \x03\x0c\x04\x0c\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x0c\r\x13\n\x0c\n\ - \x05\x04\0\x02\0\x01\x12\x03\x0c\x14\x16\n\x0c\n\x05\x04\0\x02\0\x03\x12\ - \x03\x0c&'\n\x0c\n\x05\x04\0\x02\0\x08\x12\x03\x0c(F\n\x0f\n\x08\x04\0\ - \x02\0\x08\xe7\x07\0\x12\x03\x0c)E\n\x10\n\t\x04\0\x02\0\x08\xe7\x07\0\ - \x02\x12\x03\x0c)=\n\x11\n\n\x04\0\x02\0\x08\xe7\x07\0\x02\0\x12\x03\x0c\ - )=\n\x12\n\x0b\x04\0\x02\0\x08\xe7\x07\0\x02\0\x01\x12\x03\x0c*<\n\x10\n\ - \t\x04\0\x02\0\x08\xe7\x07\0\x03\x12\x03\x0c@E\n\x82\x01\n\x04\x04\0\x02\ - \x01\x12\x03\x0f\x04G\x1a\\\x20max\x20peer\x20count\x20for\x20a\x20regio\ - n.\n\x20pd\x20will\x20do\x20the\x20auto-balance\x20if\x20region\x20peer\ - \x20count\x20mismatches.\n\"\x17\x20more\x20attributes......\n\n\x0c\n\ - \x05\x04\0\x02\x01\x04\x12\x03\x0f\x04\x0c\n\x0c\n\x05\x04\0\x02\x01\x05\ - \x12\x03\x0f\r\x13\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x0f\x14\"\n\x0c\ - \n\x05\x04\0\x02\x01\x03\x12\x03\x0f&'\n\x0c\n\x05\x04\0\x02\x01\x08\x12\ - \x03\x0f(F\n\x0f\n\x08\x04\0\x02\x01\x08\xe7\x07\0\x12\x03\x0f)E\n\x10\n\ - \t\x04\0\x02\x01\x08\xe7\x07\0\x02\x12\x03\x0f)=\n\x11\n\n\x04\0\x02\x01\ - \x08\xe7\x07\0\x02\0\x12\x03\x0f)=\n\x12\n\x0b\x04\0\x02\x01\x08\xe7\x07\ - \0\x02\0\x01\x12\x03\x0f*<\n\x10\n\t\x04\0\x02\x01\x08\xe7\x07\0\x03\x12\ - \x03\x0f@E\n\n\n\x02\x05\0\x12\x04\x13\0\x17\x01\n\n\n\x03\x05\0\x01\x12\ - \x03\x13\x05\x0f\n\x0b\n\x04\x05\0\x02\0\x12\x03\x14\x04\x12\n\x0c\n\x05\ - \x05\0\x02\0\x01\x12\x03\x14\x04\x06\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03\ - \x14\x10\x11\n\x0b\n\x04\x05\0\x02\x01\x12\x03\x15\x04\x12\n\x0c\n\x05\ - \x05\0\x02\x01\x01\x12\x03\x15\x04\x0b\n\x0c\n\x05\x05\0\x02\x01\x02\x12\ - \x03\x15\x10\x11\n\x0b\n\x04\x05\0\x02\x02\x12\x03\x16\x04\x12\n\x0c\n\ - \x05\x05\0\x02\x02\x01\x12\x03\x16\x04\r\n\x0c\n\x05\x05\0\x02\x02\x02\ - \x12\x03\x16\x10\x11\nA\n\x02\x04\x01\x12\x04\x1a\0\x1d\x01\x1a5\x20Case\ - \x20insensitive\x20key/value\x20for\x20replica\x20constraints.\n\n\n\n\ - \x03\x04\x01\x01\x12\x03\x1a\x08\x12\n\x0b\n\x04\x04\x01\x02\0\x12\x03\ - \x1b\x04C\n\x0c\n\x05\x04\x01\x02\0\x04\x12\x03\x1b\x04\x0c\n\x0c\n\x05\ - \x04\x01\x02\0\x05\x12\x03\x1b\r\x13\n\x0c\n\x05\x04\x01\x02\0\x01\x12\ - \x03\x1b\x14\x17\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x1b\"#\n\x0c\n\ - \x05\x04\x01\x02\0\x08\x12\x03\x1b$B\n\x0f\n\x08\x04\x01\x02\0\x08\xe7\ - \x07\0\x12\x03\x1b%A\n\x10\n\t\x04\x01\x02\0\x08\xe7\x07\0\x02\x12\x03\ - \x1b%9\n\x11\n\n\x04\x01\x02\0\x08\xe7\x07\0\x02\0\x12\x03\x1b%9\n\x12\n\ - \x0b\x04\x01\x02\0\x08\xe7\x07\0\x02\0\x01\x12\x03\x1b&8\n\x10\n\t\x04\ - \x01\x02\0\x08\xe7\x07\0\x03\x12\x03\x1b = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/src/pdpb.rs b/_vendor/src/github.com/pingcap/kvproto/src/pdpb.rs deleted file mode 100644 index 866d819986f..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/src/pdpb.rs +++ /dev/null @@ -1,11027 +0,0 @@ -// This file is generated. Do not edit -// @generated - -// https://github.com/Manishearth/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] - -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; - -#[derive(PartialEq,Clone,Default)] -pub struct RequestHeader { - // message fields - pub cluster_id: u64, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RequestHeader {} - -impl RequestHeader { - pub fn new() -> RequestHeader { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RequestHeader { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RequestHeader, - }; - unsafe { - instance.get(RequestHeader::new) - } - } - - // uint64 cluster_id = 1; - - pub fn clear_cluster_id(&mut self) { - self.cluster_id = 0; - } - - // Param is passed by value, moved - pub fn set_cluster_id(&mut self, v: u64) { - self.cluster_id = v; - } - - pub fn get_cluster_id(&self) -> u64 { - self.cluster_id - } - - fn get_cluster_id_for_reflect(&self) -> &u64 { - &self.cluster_id - } - - fn mut_cluster_id_for_reflect(&mut self) -> &mut u64 { - &mut self.cluster_id - } -} - -impl ::protobuf::Message for RequestHeader { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.cluster_id = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if self.cluster_id != 0 { - my_size += ::protobuf::rt::value_size(1, self.cluster_id, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if self.cluster_id != 0 { - os.write_uint64(1, self.cluster_id)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RequestHeader { - fn new() -> RequestHeader { - RequestHeader::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "cluster_id", - RequestHeader::get_cluster_id_for_reflect, - RequestHeader::mut_cluster_id_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RequestHeader", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RequestHeader { - fn clear(&mut self) { - self.clear_cluster_id(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RequestHeader { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RequestHeader { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ResponseHeader { - // message fields - pub cluster_id: u64, - pub error: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for ResponseHeader {} - -impl ResponseHeader { - pub fn new() -> ResponseHeader { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static ResponseHeader { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ResponseHeader, - }; - unsafe { - instance.get(ResponseHeader::new) - } - } - - // uint64 cluster_id = 1; - - pub fn clear_cluster_id(&mut self) { - self.cluster_id = 0; - } - - // Param is passed by value, moved - pub fn set_cluster_id(&mut self, v: u64) { - self.cluster_id = v; - } - - pub fn get_cluster_id(&self) -> u64 { - self.cluster_id - } - - fn get_cluster_id_for_reflect(&self) -> &u64 { - &self.cluster_id - } - - fn mut_cluster_id_for_reflect(&mut self) -> &mut u64 { - &mut self.cluster_id - } - - // .pdpb.Error error = 2; - - pub fn clear_error(&mut self) { - self.error.clear(); - } - - pub fn has_error(&self) -> bool { - self.error.is_some() - } - - // Param is passed by value, moved - pub fn set_error(&mut self, v: Error) { - self.error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_error(&mut self) -> &mut Error { - if self.error.is_none() { - self.error.set_default(); - } - self.error.as_mut().unwrap() - } - - // Take field - pub fn take_error(&mut self) -> Error { - self.error.take().unwrap_or_else(|| Error::new()) - } - - pub fn get_error(&self) -> &Error { - self.error.as_ref().unwrap_or_else(|| Error::default_instance()) - } - - fn get_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.error - } - - fn mut_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.error - } -} - -impl ::protobuf::Message for ResponseHeader { - fn is_initialized(&self) -> bool { - for v in &self.error { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.cluster_id = tmp; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.error)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if self.cluster_id != 0 { - my_size += ::protobuf::rt::value_size(1, self.cluster_id, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(ref v) = self.error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if self.cluster_id != 0 { - os.write_uint64(1, self.cluster_id)?; - } - if let Some(ref v) = self.error.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for ResponseHeader { - fn new() -> ResponseHeader { - ResponseHeader::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "cluster_id", - ResponseHeader::get_cluster_id_for_reflect, - ResponseHeader::mut_cluster_id_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "error", - ResponseHeader::get_error_for_reflect, - ResponseHeader::mut_error_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "ResponseHeader", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for ResponseHeader { - fn clear(&mut self) { - self.clear_cluster_id(); - self.clear_error(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ResponseHeader { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ResponseHeader { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Error { - // message fields - pub field_type: ErrorType, - pub message: ::std::string::String, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Error {} - -impl Error { - pub fn new() -> Error { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Error { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Error, - }; - unsafe { - instance.get(Error::new) - } - } - - // .pdpb.ErrorType type = 1; - - pub fn clear_field_type(&mut self) { - self.field_type = ErrorType::OK; - } - - // Param is passed by value, moved - pub fn set_field_type(&mut self, v: ErrorType) { - self.field_type = v; - } - - pub fn get_field_type(&self) -> ErrorType { - self.field_type - } - - fn get_field_type_for_reflect(&self) -> &ErrorType { - &self.field_type - } - - fn mut_field_type_for_reflect(&mut self) -> &mut ErrorType { - &mut self.field_type - } - - // string message = 2; - - pub fn clear_message(&mut self) { - self.message.clear(); - } - - // Param is passed by value, moved - pub fn set_message(&mut self, v: ::std::string::String) { - self.message = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_message(&mut self) -> &mut ::std::string::String { - &mut self.message - } - - // Take field - pub fn take_message(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.message, ::std::string::String::new()) - } - - pub fn get_message(&self) -> &str { - &self.message - } - - fn get_message_for_reflect(&self) -> &::std::string::String { - &self.message - } - - fn mut_message_for_reflect(&mut self) -> &mut ::std::string::String { - &mut self.message - } -} - -impl ::protobuf::Message for Error { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.field_type = tmp; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.message)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if self.field_type != ErrorType::OK { - my_size += ::protobuf::rt::enum_size(1, self.field_type); - } - if !self.message.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.message); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if self.field_type != ErrorType::OK { - os.write_enum(1, self.field_type.value())?; - } - if !self.message.is_empty() { - os.write_string(2, &self.message)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Error { - fn new() -> Error { - Error::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "type", - Error::get_field_type_for_reflect, - Error::mut_field_type_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "message", - Error::get_message_for_reflect, - Error::mut_message_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Error", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Error { - fn clear(&mut self) { - self.clear_field_type(); - self.clear_message(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Error { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Error { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct TsoRequest { - // message fields - pub header: ::protobuf::SingularPtrField, - pub count: u32, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for TsoRequest {} - -impl TsoRequest { - pub fn new() -> TsoRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static TsoRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const TsoRequest, - }; - unsafe { - instance.get(TsoRequest::new) - } - } - - // .pdpb.RequestHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: RequestHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut RequestHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> RequestHeader { - self.header.take().unwrap_or_else(|| RequestHeader::new()) - } - - pub fn get_header(&self) -> &RequestHeader { - self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } - - // uint32 count = 2; - - pub fn clear_count(&mut self) { - self.count = 0; - } - - // Param is passed by value, moved - pub fn set_count(&mut self, v: u32) { - self.count = v; - } - - pub fn get_count(&self) -> u32 { - self.count - } - - fn get_count_for_reflect(&self) -> &u32 { - &self.count - } - - fn mut_count_for_reflect(&mut self) -> &mut u32 { - &mut self.count - } -} - -impl ::protobuf::Message for TsoRequest { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint32()?; - self.count = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.count != 0 { - my_size += ::protobuf::rt::value_size(2, self.count, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.count != 0 { - os.write_uint32(2, self.count)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for TsoRequest { - fn new() -> TsoRequest { - TsoRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - TsoRequest::get_header_for_reflect, - TsoRequest::mut_header_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( - "count", - TsoRequest::get_count_for_reflect, - TsoRequest::mut_count_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "TsoRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for TsoRequest { - fn clear(&mut self) { - self.clear_header(); - self.clear_count(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for TsoRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TsoRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Timestamp { - // message fields - pub physical: i64, - pub logical: i64, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Timestamp {} - -impl Timestamp { - pub fn new() -> Timestamp { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Timestamp { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Timestamp, - }; - unsafe { - instance.get(Timestamp::new) - } - } - - // int64 physical = 1; - - pub fn clear_physical(&mut self) { - self.physical = 0; - } - - // Param is passed by value, moved - pub fn set_physical(&mut self, v: i64) { - self.physical = v; - } - - pub fn get_physical(&self) -> i64 { - self.physical - } - - fn get_physical_for_reflect(&self) -> &i64 { - &self.physical - } - - fn mut_physical_for_reflect(&mut self) -> &mut i64 { - &mut self.physical - } - - // int64 logical = 2; - - pub fn clear_logical(&mut self) { - self.logical = 0; - } - - // Param is passed by value, moved - pub fn set_logical(&mut self, v: i64) { - self.logical = v; - } - - pub fn get_logical(&self) -> i64 { - self.logical - } - - fn get_logical_for_reflect(&self) -> &i64 { - &self.logical - } - - fn mut_logical_for_reflect(&mut self) -> &mut i64 { - &mut self.logical - } -} - -impl ::protobuf::Message for Timestamp { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_int64()?; - self.physical = tmp; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_int64()?; - self.logical = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if self.physical != 0 { - my_size += ::protobuf::rt::value_size(1, self.physical, ::protobuf::wire_format::WireTypeVarint); - } - if self.logical != 0 { - my_size += ::protobuf::rt::value_size(2, self.logical, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if self.physical != 0 { - os.write_int64(1, self.physical)?; - } - if self.logical != 0 { - os.write_int64(2, self.logical)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Timestamp { - fn new() -> Timestamp { - Timestamp::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( - "physical", - Timestamp::get_physical_for_reflect, - Timestamp::mut_physical_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( - "logical", - Timestamp::get_logical_for_reflect, - Timestamp::mut_logical_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Timestamp", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Timestamp { - fn clear(&mut self) { - self.clear_physical(); - self.clear_logical(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Timestamp { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Timestamp { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct TsoResponse { - // message fields - pub header: ::protobuf::SingularPtrField, - pub count: u32, - pub timestamp: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for TsoResponse {} - -impl TsoResponse { - pub fn new() -> TsoResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static TsoResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const TsoResponse, - }; - unsafe { - instance.get(TsoResponse::new) - } - } - - // .pdpb.ResponseHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: ResponseHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut ResponseHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> ResponseHeader { - self.header.take().unwrap_or_else(|| ResponseHeader::new()) - } - - pub fn get_header(&self) -> &ResponseHeader { - self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } - - // uint32 count = 2; - - pub fn clear_count(&mut self) { - self.count = 0; - } - - // Param is passed by value, moved - pub fn set_count(&mut self, v: u32) { - self.count = v; - } - - pub fn get_count(&self) -> u32 { - self.count - } - - fn get_count_for_reflect(&self) -> &u32 { - &self.count - } - - fn mut_count_for_reflect(&mut self) -> &mut u32 { - &mut self.count - } - - // .pdpb.Timestamp timestamp = 3; - - pub fn clear_timestamp(&mut self) { - self.timestamp.clear(); - } - - pub fn has_timestamp(&self) -> bool { - self.timestamp.is_some() - } - - // Param is passed by value, moved - pub fn set_timestamp(&mut self, v: Timestamp) { - self.timestamp = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_timestamp(&mut self) -> &mut Timestamp { - if self.timestamp.is_none() { - self.timestamp.set_default(); - } - self.timestamp.as_mut().unwrap() - } - - // Take field - pub fn take_timestamp(&mut self) -> Timestamp { - self.timestamp.take().unwrap_or_else(|| Timestamp::new()) - } - - pub fn get_timestamp(&self) -> &Timestamp { - self.timestamp.as_ref().unwrap_or_else(|| Timestamp::default_instance()) - } - - fn get_timestamp_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.timestamp - } - - fn mut_timestamp_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.timestamp - } -} - -impl ::protobuf::Message for TsoResponse { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - for v in &self.timestamp { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint32()?; - self.count = tmp; - }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.timestamp)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.count != 0 { - my_size += ::protobuf::rt::value_size(2, self.count, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(ref v) = self.timestamp.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.count != 0 { - os.write_uint32(2, self.count)?; - } - if let Some(ref v) = self.timestamp.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for TsoResponse { - fn new() -> TsoResponse { - TsoResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - TsoResponse::get_header_for_reflect, - TsoResponse::mut_header_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( - "count", - TsoResponse::get_count_for_reflect, - TsoResponse::mut_count_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "timestamp", - TsoResponse::get_timestamp_for_reflect, - TsoResponse::mut_timestamp_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "TsoResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for TsoResponse { - fn clear(&mut self) { - self.clear_header(); - self.clear_count(); - self.clear_timestamp(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for TsoResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TsoResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct BootstrapRequest { - // message fields - pub header: ::protobuf::SingularPtrField, - pub store: ::protobuf::SingularPtrField, - pub region: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for BootstrapRequest {} - -impl BootstrapRequest { - pub fn new() -> BootstrapRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static BootstrapRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const BootstrapRequest, - }; - unsafe { - instance.get(BootstrapRequest::new) - } - } - - // .pdpb.RequestHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: RequestHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut RequestHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> RequestHeader { - self.header.take().unwrap_or_else(|| RequestHeader::new()) - } - - pub fn get_header(&self) -> &RequestHeader { - self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } - - // .metapb.Store store = 2; - - pub fn clear_store(&mut self) { - self.store.clear(); - } - - pub fn has_store(&self) -> bool { - self.store.is_some() - } - - // Param is passed by value, moved - pub fn set_store(&mut self, v: super::metapb::Store) { - self.store = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_store(&mut self) -> &mut super::metapb::Store { - if self.store.is_none() { - self.store.set_default(); - } - self.store.as_mut().unwrap() - } - - // Take field - pub fn take_store(&mut self) -> super::metapb::Store { - self.store.take().unwrap_or_else(|| super::metapb::Store::new()) - } - - pub fn get_store(&self) -> &super::metapb::Store { - self.store.as_ref().unwrap_or_else(|| super::metapb::Store::default_instance()) - } - - fn get_store_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.store - } - - fn mut_store_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.store - } - - // .metapb.Region region = 3; - - pub fn clear_region(&mut self) { - self.region.clear(); - } - - pub fn has_region(&self) -> bool { - self.region.is_some() - } - - // Param is passed by value, moved - pub fn set_region(&mut self, v: super::metapb::Region) { - self.region = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region(&mut self) -> &mut super::metapb::Region { - if self.region.is_none() { - self.region.set_default(); - } - self.region.as_mut().unwrap() - } - - // Take field - pub fn take_region(&mut self) -> super::metapb::Region { - self.region.take().unwrap_or_else(|| super::metapb::Region::new()) - } - - pub fn get_region(&self) -> &super::metapb::Region { - self.region.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) - } - - fn get_region_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region - } - - fn mut_region_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region - } -} - -impl ::protobuf::Message for BootstrapRequest { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - for v in &self.store { - if !v.is_initialized() { - return false; - } - }; - for v in &self.region { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.store)?; - }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.store.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.region.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.store.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.region.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for BootstrapRequest { - fn new() -> BootstrapRequest { - BootstrapRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - BootstrapRequest::get_header_for_reflect, - BootstrapRequest::mut_header_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "store", - BootstrapRequest::get_store_for_reflect, - BootstrapRequest::mut_store_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region", - BootstrapRequest::get_region_for_reflect, - BootstrapRequest::mut_region_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "BootstrapRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for BootstrapRequest { - fn clear(&mut self) { - self.clear_header(); - self.clear_store(); - self.clear_region(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for BootstrapRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for BootstrapRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct BootstrapResponse { - // message fields - pub header: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for BootstrapResponse {} - -impl BootstrapResponse { - pub fn new() -> BootstrapResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static BootstrapResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const BootstrapResponse, - }; - unsafe { - instance.get(BootstrapResponse::new) - } - } - - // .pdpb.ResponseHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: ResponseHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut ResponseHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> ResponseHeader { - self.header.take().unwrap_or_else(|| ResponseHeader::new()) - } - - pub fn get_header(&self) -> &ResponseHeader { - self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } -} - -impl ::protobuf::Message for BootstrapResponse { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for BootstrapResponse { - fn new() -> BootstrapResponse { - BootstrapResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - BootstrapResponse::get_header_for_reflect, - BootstrapResponse::mut_header_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "BootstrapResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for BootstrapResponse { - fn clear(&mut self) { - self.clear_header(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for BootstrapResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for BootstrapResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct IsBootstrappedRequest { - // message fields - pub header: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for IsBootstrappedRequest {} - -impl IsBootstrappedRequest { - pub fn new() -> IsBootstrappedRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static IsBootstrappedRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const IsBootstrappedRequest, - }; - unsafe { - instance.get(IsBootstrappedRequest::new) - } - } - - // .pdpb.RequestHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: RequestHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut RequestHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> RequestHeader { - self.header.take().unwrap_or_else(|| RequestHeader::new()) - } - - pub fn get_header(&self) -> &RequestHeader { - self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } -} - -impl ::protobuf::Message for IsBootstrappedRequest { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for IsBootstrappedRequest { - fn new() -> IsBootstrappedRequest { - IsBootstrappedRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - IsBootstrappedRequest::get_header_for_reflect, - IsBootstrappedRequest::mut_header_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "IsBootstrappedRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for IsBootstrappedRequest { - fn clear(&mut self) { - self.clear_header(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for IsBootstrappedRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for IsBootstrappedRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct IsBootstrappedResponse { - // message fields - pub header: ::protobuf::SingularPtrField, - pub bootstrapped: bool, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for IsBootstrappedResponse {} - -impl IsBootstrappedResponse { - pub fn new() -> IsBootstrappedResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static IsBootstrappedResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const IsBootstrappedResponse, - }; - unsafe { - instance.get(IsBootstrappedResponse::new) - } - } - - // .pdpb.ResponseHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: ResponseHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut ResponseHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> ResponseHeader { - self.header.take().unwrap_or_else(|| ResponseHeader::new()) - } - - pub fn get_header(&self) -> &ResponseHeader { - self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } - - // bool bootstrapped = 2; - - pub fn clear_bootstrapped(&mut self) { - self.bootstrapped = false; - } - - // Param is passed by value, moved - pub fn set_bootstrapped(&mut self, v: bool) { - self.bootstrapped = v; - } - - pub fn get_bootstrapped(&self) -> bool { - self.bootstrapped - } - - fn get_bootstrapped_for_reflect(&self) -> &bool { - &self.bootstrapped - } - - fn mut_bootstrapped_for_reflect(&mut self) -> &mut bool { - &mut self.bootstrapped - } -} - -impl ::protobuf::Message for IsBootstrappedResponse { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_bool()?; - self.bootstrapped = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.bootstrapped != false { - my_size += 2; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.bootstrapped != false { - os.write_bool(2, self.bootstrapped)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for IsBootstrappedResponse { - fn new() -> IsBootstrappedResponse { - IsBootstrappedResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - IsBootstrappedResponse::get_header_for_reflect, - IsBootstrappedResponse::mut_header_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( - "bootstrapped", - IsBootstrappedResponse::get_bootstrapped_for_reflect, - IsBootstrappedResponse::mut_bootstrapped_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "IsBootstrappedResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for IsBootstrappedResponse { - fn clear(&mut self) { - self.clear_header(); - self.clear_bootstrapped(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for IsBootstrappedResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for IsBootstrappedResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct AllocIDRequest { - // message fields - pub header: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for AllocIDRequest {} - -impl AllocIDRequest { - pub fn new() -> AllocIDRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static AllocIDRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const AllocIDRequest, - }; - unsafe { - instance.get(AllocIDRequest::new) - } - } - - // .pdpb.RequestHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: RequestHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut RequestHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> RequestHeader { - self.header.take().unwrap_or_else(|| RequestHeader::new()) - } - - pub fn get_header(&self) -> &RequestHeader { - self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } -} - -impl ::protobuf::Message for AllocIDRequest { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for AllocIDRequest { - fn new() -> AllocIDRequest { - AllocIDRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - AllocIDRequest::get_header_for_reflect, - AllocIDRequest::mut_header_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "AllocIDRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for AllocIDRequest { - fn clear(&mut self) { - self.clear_header(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for AllocIDRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for AllocIDRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct AllocIDResponse { - // message fields - pub header: ::protobuf::SingularPtrField, - pub id: u64, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for AllocIDResponse {} - -impl AllocIDResponse { - pub fn new() -> AllocIDResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static AllocIDResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const AllocIDResponse, - }; - unsafe { - instance.get(AllocIDResponse::new) - } - } - - // .pdpb.ResponseHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: ResponseHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut ResponseHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> ResponseHeader { - self.header.take().unwrap_or_else(|| ResponseHeader::new()) - } - - pub fn get_header(&self) -> &ResponseHeader { - self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } - - // uint64 id = 2; - - pub fn clear_id(&mut self) { - self.id = 0; - } - - // Param is passed by value, moved - pub fn set_id(&mut self, v: u64) { - self.id = v; - } - - pub fn get_id(&self) -> u64 { - self.id - } - - fn get_id_for_reflect(&self) -> &u64 { - &self.id - } - - fn mut_id_for_reflect(&mut self) -> &mut u64 { - &mut self.id - } -} - -impl ::protobuf::Message for AllocIDResponse { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.id = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.id != 0 { - my_size += ::protobuf::rt::value_size(2, self.id, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.id != 0 { - os.write_uint64(2, self.id)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for AllocIDResponse { - fn new() -> AllocIDResponse { - AllocIDResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - AllocIDResponse::get_header_for_reflect, - AllocIDResponse::mut_header_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "id", - AllocIDResponse::get_id_for_reflect, - AllocIDResponse::mut_id_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "AllocIDResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for AllocIDResponse { - fn clear(&mut self) { - self.clear_header(); - self.clear_id(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for AllocIDResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for AllocIDResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct GetStoreRequest { - // message fields - pub header: ::protobuf::SingularPtrField, - pub store_id: u64, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for GetStoreRequest {} - -impl GetStoreRequest { - pub fn new() -> GetStoreRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static GetStoreRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const GetStoreRequest, - }; - unsafe { - instance.get(GetStoreRequest::new) - } - } - - // .pdpb.RequestHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: RequestHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut RequestHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> RequestHeader { - self.header.take().unwrap_or_else(|| RequestHeader::new()) - } - - pub fn get_header(&self) -> &RequestHeader { - self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } - - // uint64 store_id = 2; - - pub fn clear_store_id(&mut self) { - self.store_id = 0; - } - - // Param is passed by value, moved - pub fn set_store_id(&mut self, v: u64) { - self.store_id = v; - } - - pub fn get_store_id(&self) -> u64 { - self.store_id - } - - fn get_store_id_for_reflect(&self) -> &u64 { - &self.store_id - } - - fn mut_store_id_for_reflect(&mut self) -> &mut u64 { - &mut self.store_id - } -} - -impl ::protobuf::Message for GetStoreRequest { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.store_id = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.store_id != 0 { - my_size += ::protobuf::rt::value_size(2, self.store_id, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.store_id != 0 { - os.write_uint64(2, self.store_id)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for GetStoreRequest { - fn new() -> GetStoreRequest { - GetStoreRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - GetStoreRequest::get_header_for_reflect, - GetStoreRequest::mut_header_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "store_id", - GetStoreRequest::get_store_id_for_reflect, - GetStoreRequest::mut_store_id_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "GetStoreRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for GetStoreRequest { - fn clear(&mut self) { - self.clear_header(); - self.clear_store_id(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for GetStoreRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetStoreRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct GetStoreResponse { - // message fields - pub header: ::protobuf::SingularPtrField, - pub store: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for GetStoreResponse {} - -impl GetStoreResponse { - pub fn new() -> GetStoreResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static GetStoreResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const GetStoreResponse, - }; - unsafe { - instance.get(GetStoreResponse::new) - } - } - - // .pdpb.ResponseHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: ResponseHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut ResponseHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> ResponseHeader { - self.header.take().unwrap_or_else(|| ResponseHeader::new()) - } - - pub fn get_header(&self) -> &ResponseHeader { - self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } - - // .metapb.Store store = 2; - - pub fn clear_store(&mut self) { - self.store.clear(); - } - - pub fn has_store(&self) -> bool { - self.store.is_some() - } - - // Param is passed by value, moved - pub fn set_store(&mut self, v: super::metapb::Store) { - self.store = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_store(&mut self) -> &mut super::metapb::Store { - if self.store.is_none() { - self.store.set_default(); - } - self.store.as_mut().unwrap() - } - - // Take field - pub fn take_store(&mut self) -> super::metapb::Store { - self.store.take().unwrap_or_else(|| super::metapb::Store::new()) - } - - pub fn get_store(&self) -> &super::metapb::Store { - self.store.as_ref().unwrap_or_else(|| super::metapb::Store::default_instance()) - } - - fn get_store_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.store - } - - fn mut_store_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.store - } -} - -impl ::protobuf::Message for GetStoreResponse { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - for v in &self.store { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.store)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.store.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.store.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for GetStoreResponse { - fn new() -> GetStoreResponse { - GetStoreResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - GetStoreResponse::get_header_for_reflect, - GetStoreResponse::mut_header_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "store", - GetStoreResponse::get_store_for_reflect, - GetStoreResponse::mut_store_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "GetStoreResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for GetStoreResponse { - fn clear(&mut self) { - self.clear_header(); - self.clear_store(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for GetStoreResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetStoreResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct PutStoreRequest { - // message fields - pub header: ::protobuf::SingularPtrField, - pub store: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for PutStoreRequest {} - -impl PutStoreRequest { - pub fn new() -> PutStoreRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static PutStoreRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const PutStoreRequest, - }; - unsafe { - instance.get(PutStoreRequest::new) - } - } - - // .pdpb.RequestHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: RequestHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut RequestHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> RequestHeader { - self.header.take().unwrap_or_else(|| RequestHeader::new()) - } - - pub fn get_header(&self) -> &RequestHeader { - self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } - - // .metapb.Store store = 2; - - pub fn clear_store(&mut self) { - self.store.clear(); - } - - pub fn has_store(&self) -> bool { - self.store.is_some() - } - - // Param is passed by value, moved - pub fn set_store(&mut self, v: super::metapb::Store) { - self.store = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_store(&mut self) -> &mut super::metapb::Store { - if self.store.is_none() { - self.store.set_default(); - } - self.store.as_mut().unwrap() - } - - // Take field - pub fn take_store(&mut self) -> super::metapb::Store { - self.store.take().unwrap_or_else(|| super::metapb::Store::new()) - } - - pub fn get_store(&self) -> &super::metapb::Store { - self.store.as_ref().unwrap_or_else(|| super::metapb::Store::default_instance()) - } - - fn get_store_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.store - } - - fn mut_store_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.store - } -} - -impl ::protobuf::Message for PutStoreRequest { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - for v in &self.store { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.store)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.store.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.store.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for PutStoreRequest { - fn new() -> PutStoreRequest { - PutStoreRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - PutStoreRequest::get_header_for_reflect, - PutStoreRequest::mut_header_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "store", - PutStoreRequest::get_store_for_reflect, - PutStoreRequest::mut_store_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "PutStoreRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for PutStoreRequest { - fn clear(&mut self) { - self.clear_header(); - self.clear_store(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for PutStoreRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for PutStoreRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct PutStoreResponse { - // message fields - pub header: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for PutStoreResponse {} - -impl PutStoreResponse { - pub fn new() -> PutStoreResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static PutStoreResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const PutStoreResponse, - }; - unsafe { - instance.get(PutStoreResponse::new) - } - } - - // .pdpb.ResponseHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: ResponseHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut ResponseHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> ResponseHeader { - self.header.take().unwrap_or_else(|| ResponseHeader::new()) - } - - pub fn get_header(&self) -> &ResponseHeader { - self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } -} - -impl ::protobuf::Message for PutStoreResponse { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for PutStoreResponse { - fn new() -> PutStoreResponse { - PutStoreResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - PutStoreResponse::get_header_for_reflect, - PutStoreResponse::mut_header_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "PutStoreResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for PutStoreResponse { - fn clear(&mut self) { - self.clear_header(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for PutStoreResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for PutStoreResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct GetRegionRequest { - // message fields - pub header: ::protobuf::SingularPtrField, - pub region_key: ::std::vec::Vec, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for GetRegionRequest {} - -impl GetRegionRequest { - pub fn new() -> GetRegionRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static GetRegionRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const GetRegionRequest, - }; - unsafe { - instance.get(GetRegionRequest::new) - } - } - - // .pdpb.RequestHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: RequestHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut RequestHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> RequestHeader { - self.header.take().unwrap_or_else(|| RequestHeader::new()) - } - - pub fn get_header(&self) -> &RequestHeader { - self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } - - // bytes region_key = 2; - - pub fn clear_region_key(&mut self) { - self.region_key.clear(); - } - - // Param is passed by value, moved - pub fn set_region_key(&mut self, v: ::std::vec::Vec) { - self.region_key = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_key(&mut self) -> &mut ::std::vec::Vec { - &mut self.region_key - } - - // Take field - pub fn take_region_key(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.region_key, ::std::vec::Vec::new()) - } - - pub fn get_region_key(&self) -> &[u8] { - &self.region_key - } - - fn get_region_key_for_reflect(&self) -> &::std::vec::Vec { - &self.region_key - } - - fn mut_region_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.region_key - } -} - -impl ::protobuf::Message for GetRegionRequest { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.region_key)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.region_key.is_empty() { - my_size += ::protobuf::rt::bytes_size(2, &self.region_key); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.region_key.is_empty() { - os.write_bytes(2, &self.region_key)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for GetRegionRequest { - fn new() -> GetRegionRequest { - GetRegionRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - GetRegionRequest::get_header_for_reflect, - GetRegionRequest::mut_header_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "region_key", - GetRegionRequest::get_region_key_for_reflect, - GetRegionRequest::mut_region_key_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "GetRegionRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for GetRegionRequest { - fn clear(&mut self) { - self.clear_header(); - self.clear_region_key(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for GetRegionRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetRegionRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct GetRegionResponse { - // message fields - pub header: ::protobuf::SingularPtrField, - pub region: ::protobuf::SingularPtrField, - pub leader: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for GetRegionResponse {} - -impl GetRegionResponse { - pub fn new() -> GetRegionResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static GetRegionResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const GetRegionResponse, - }; - unsafe { - instance.get(GetRegionResponse::new) - } - } - - // .pdpb.ResponseHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: ResponseHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut ResponseHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> ResponseHeader { - self.header.take().unwrap_or_else(|| ResponseHeader::new()) - } - - pub fn get_header(&self) -> &ResponseHeader { - self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } - - // .metapb.Region region = 2; - - pub fn clear_region(&mut self) { - self.region.clear(); - } - - pub fn has_region(&self) -> bool { - self.region.is_some() - } - - // Param is passed by value, moved - pub fn set_region(&mut self, v: super::metapb::Region) { - self.region = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region(&mut self) -> &mut super::metapb::Region { - if self.region.is_none() { - self.region.set_default(); - } - self.region.as_mut().unwrap() - } - - // Take field - pub fn take_region(&mut self) -> super::metapb::Region { - self.region.take().unwrap_or_else(|| super::metapb::Region::new()) - } - - pub fn get_region(&self) -> &super::metapb::Region { - self.region.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) - } - - fn get_region_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region - } - - fn mut_region_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region - } - - // .metapb.Peer leader = 3; - - pub fn clear_leader(&mut self) { - self.leader.clear(); - } - - pub fn has_leader(&self) -> bool { - self.leader.is_some() - } - - // Param is passed by value, moved - pub fn set_leader(&mut self, v: super::metapb::Peer) { - self.leader = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_leader(&mut self) -> &mut super::metapb::Peer { - if self.leader.is_none() { - self.leader.set_default(); - } - self.leader.as_mut().unwrap() - } - - // Take field - pub fn take_leader(&mut self) -> super::metapb::Peer { - self.leader.take().unwrap_or_else(|| super::metapb::Peer::new()) - } - - pub fn get_leader(&self) -> &super::metapb::Peer { - self.leader.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) - } - - fn get_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.leader - } - - fn mut_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.leader - } -} - -impl ::protobuf::Message for GetRegionResponse { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - for v in &self.region { - if !v.is_initialized() { - return false; - } - }; - for v in &self.leader { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region)?; - }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.leader)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.region.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.leader.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.region.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.leader.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for GetRegionResponse { - fn new() -> GetRegionResponse { - GetRegionResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - GetRegionResponse::get_header_for_reflect, - GetRegionResponse::mut_header_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region", - GetRegionResponse::get_region_for_reflect, - GetRegionResponse::mut_region_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "leader", - GetRegionResponse::get_leader_for_reflect, - GetRegionResponse::mut_leader_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "GetRegionResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for GetRegionResponse { - fn clear(&mut self) { - self.clear_header(); - self.clear_region(); - self.clear_leader(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for GetRegionResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetRegionResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct GetRegionByIDRequest { - // message fields - pub header: ::protobuf::SingularPtrField, - pub region_id: u64, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for GetRegionByIDRequest {} - -impl GetRegionByIDRequest { - pub fn new() -> GetRegionByIDRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static GetRegionByIDRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const GetRegionByIDRequest, - }; - unsafe { - instance.get(GetRegionByIDRequest::new) - } - } - - // .pdpb.RequestHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: RequestHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut RequestHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> RequestHeader { - self.header.take().unwrap_or_else(|| RequestHeader::new()) - } - - pub fn get_header(&self) -> &RequestHeader { - self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } - - // uint64 region_id = 2; - - pub fn clear_region_id(&mut self) { - self.region_id = 0; - } - - // Param is passed by value, moved - pub fn set_region_id(&mut self, v: u64) { - self.region_id = v; - } - - pub fn get_region_id(&self) -> u64 { - self.region_id - } - - fn get_region_id_for_reflect(&self) -> &u64 { - &self.region_id - } - - fn mut_region_id_for_reflect(&mut self) -> &mut u64 { - &mut self.region_id - } -} - -impl ::protobuf::Message for GetRegionByIDRequest { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.region_id = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.region_id != 0 { - my_size += ::protobuf::rt::value_size(2, self.region_id, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.region_id != 0 { - os.write_uint64(2, self.region_id)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for GetRegionByIDRequest { - fn new() -> GetRegionByIDRequest { - GetRegionByIDRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - GetRegionByIDRequest::get_header_for_reflect, - GetRegionByIDRequest::mut_header_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "region_id", - GetRegionByIDRequest::get_region_id_for_reflect, - GetRegionByIDRequest::mut_region_id_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "GetRegionByIDRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for GetRegionByIDRequest { - fn clear(&mut self) { - self.clear_header(); - self.clear_region_id(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for GetRegionByIDRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetRegionByIDRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct GetClusterConfigRequest { - // message fields - pub header: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for GetClusterConfigRequest {} - -impl GetClusterConfigRequest { - pub fn new() -> GetClusterConfigRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static GetClusterConfigRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const GetClusterConfigRequest, - }; - unsafe { - instance.get(GetClusterConfigRequest::new) - } - } - - // .pdpb.RequestHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: RequestHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut RequestHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> RequestHeader { - self.header.take().unwrap_or_else(|| RequestHeader::new()) - } - - pub fn get_header(&self) -> &RequestHeader { - self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } -} - -impl ::protobuf::Message for GetClusterConfigRequest { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for GetClusterConfigRequest { - fn new() -> GetClusterConfigRequest { - GetClusterConfigRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - GetClusterConfigRequest::get_header_for_reflect, - GetClusterConfigRequest::mut_header_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "GetClusterConfigRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for GetClusterConfigRequest { - fn clear(&mut self) { - self.clear_header(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for GetClusterConfigRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetClusterConfigRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct GetClusterConfigResponse { - // message fields - pub header: ::protobuf::SingularPtrField, - pub cluster: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for GetClusterConfigResponse {} - -impl GetClusterConfigResponse { - pub fn new() -> GetClusterConfigResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static GetClusterConfigResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const GetClusterConfigResponse, - }; - unsafe { - instance.get(GetClusterConfigResponse::new) - } - } - - // .pdpb.ResponseHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: ResponseHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut ResponseHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> ResponseHeader { - self.header.take().unwrap_or_else(|| ResponseHeader::new()) - } - - pub fn get_header(&self) -> &ResponseHeader { - self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } - - // .metapb.Cluster cluster = 2; - - pub fn clear_cluster(&mut self) { - self.cluster.clear(); - } - - pub fn has_cluster(&self) -> bool { - self.cluster.is_some() - } - - // Param is passed by value, moved - pub fn set_cluster(&mut self, v: super::metapb::Cluster) { - self.cluster = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_cluster(&mut self) -> &mut super::metapb::Cluster { - if self.cluster.is_none() { - self.cluster.set_default(); - } - self.cluster.as_mut().unwrap() - } - - // Take field - pub fn take_cluster(&mut self) -> super::metapb::Cluster { - self.cluster.take().unwrap_or_else(|| super::metapb::Cluster::new()) - } - - pub fn get_cluster(&self) -> &super::metapb::Cluster { - self.cluster.as_ref().unwrap_or_else(|| super::metapb::Cluster::default_instance()) - } - - fn get_cluster_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.cluster - } - - fn mut_cluster_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.cluster - } -} - -impl ::protobuf::Message for GetClusterConfigResponse { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - for v in &self.cluster { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.cluster)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.cluster.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.cluster.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for GetClusterConfigResponse { - fn new() -> GetClusterConfigResponse { - GetClusterConfigResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - GetClusterConfigResponse::get_header_for_reflect, - GetClusterConfigResponse::mut_header_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "cluster", - GetClusterConfigResponse::get_cluster_for_reflect, - GetClusterConfigResponse::mut_cluster_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "GetClusterConfigResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for GetClusterConfigResponse { - fn clear(&mut self) { - self.clear_header(); - self.clear_cluster(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for GetClusterConfigResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetClusterConfigResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct PutClusterConfigRequest { - // message fields - pub header: ::protobuf::SingularPtrField, - pub cluster: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for PutClusterConfigRequest {} - -impl PutClusterConfigRequest { - pub fn new() -> PutClusterConfigRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static PutClusterConfigRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const PutClusterConfigRequest, - }; - unsafe { - instance.get(PutClusterConfigRequest::new) - } - } - - // .pdpb.RequestHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: RequestHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut RequestHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> RequestHeader { - self.header.take().unwrap_or_else(|| RequestHeader::new()) - } - - pub fn get_header(&self) -> &RequestHeader { - self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } - - // .metapb.Cluster cluster = 2; - - pub fn clear_cluster(&mut self) { - self.cluster.clear(); - } - - pub fn has_cluster(&self) -> bool { - self.cluster.is_some() - } - - // Param is passed by value, moved - pub fn set_cluster(&mut self, v: super::metapb::Cluster) { - self.cluster = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_cluster(&mut self) -> &mut super::metapb::Cluster { - if self.cluster.is_none() { - self.cluster.set_default(); - } - self.cluster.as_mut().unwrap() - } - - // Take field - pub fn take_cluster(&mut self) -> super::metapb::Cluster { - self.cluster.take().unwrap_or_else(|| super::metapb::Cluster::new()) - } - - pub fn get_cluster(&self) -> &super::metapb::Cluster { - self.cluster.as_ref().unwrap_or_else(|| super::metapb::Cluster::default_instance()) - } - - fn get_cluster_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.cluster - } - - fn mut_cluster_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.cluster - } -} - -impl ::protobuf::Message for PutClusterConfigRequest { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - for v in &self.cluster { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.cluster)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.cluster.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.cluster.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for PutClusterConfigRequest { - fn new() -> PutClusterConfigRequest { - PutClusterConfigRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - PutClusterConfigRequest::get_header_for_reflect, - PutClusterConfigRequest::mut_header_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "cluster", - PutClusterConfigRequest::get_cluster_for_reflect, - PutClusterConfigRequest::mut_cluster_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "PutClusterConfigRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for PutClusterConfigRequest { - fn clear(&mut self) { - self.clear_header(); - self.clear_cluster(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for PutClusterConfigRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for PutClusterConfigRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct PutClusterConfigResponse { - // message fields - pub header: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for PutClusterConfigResponse {} - -impl PutClusterConfigResponse { - pub fn new() -> PutClusterConfigResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static PutClusterConfigResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const PutClusterConfigResponse, - }; - unsafe { - instance.get(PutClusterConfigResponse::new) - } - } - - // .pdpb.ResponseHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: ResponseHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut ResponseHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> ResponseHeader { - self.header.take().unwrap_or_else(|| ResponseHeader::new()) - } - - pub fn get_header(&self) -> &ResponseHeader { - self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } -} - -impl ::protobuf::Message for PutClusterConfigResponse { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for PutClusterConfigResponse { - fn new() -> PutClusterConfigResponse { - PutClusterConfigResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - PutClusterConfigResponse::get_header_for_reflect, - PutClusterConfigResponse::mut_header_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "PutClusterConfigResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for PutClusterConfigResponse { - fn clear(&mut self) { - self.clear_header(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for PutClusterConfigResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for PutClusterConfigResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Member { - // message fields - pub name: ::std::string::String, - pub member_id: u64, - pub peer_urls: ::protobuf::RepeatedField<::std::string::String>, - pub client_urls: ::protobuf::RepeatedField<::std::string::String>, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Member {} - -impl Member { - pub fn new() -> Member { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Member { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Member, - }; - unsafe { - instance.get(Member::new) - } - } - - // string name = 1; - - pub fn clear_name(&mut self) { - self.name.clear(); - } - - // Param is passed by value, moved - pub fn set_name(&mut self, v: ::std::string::String) { - self.name = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_name(&mut self) -> &mut ::std::string::String { - &mut self.name - } - - // Take field - pub fn take_name(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.name, ::std::string::String::new()) - } - - pub fn get_name(&self) -> &str { - &self.name - } - - fn get_name_for_reflect(&self) -> &::std::string::String { - &self.name - } - - fn mut_name_for_reflect(&mut self) -> &mut ::std::string::String { - &mut self.name - } - - // uint64 member_id = 2; - - pub fn clear_member_id(&mut self) { - self.member_id = 0; - } - - // Param is passed by value, moved - pub fn set_member_id(&mut self, v: u64) { - self.member_id = v; - } - - pub fn get_member_id(&self) -> u64 { - self.member_id - } - - fn get_member_id_for_reflect(&self) -> &u64 { - &self.member_id - } - - fn mut_member_id_for_reflect(&mut self) -> &mut u64 { - &mut self.member_id - } - - // repeated string peer_urls = 3; - - pub fn clear_peer_urls(&mut self) { - self.peer_urls.clear(); - } - - // Param is passed by value, moved - pub fn set_peer_urls(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { - self.peer_urls = v; - } - - // Mutable pointer to the field. - pub fn mut_peer_urls(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { - &mut self.peer_urls - } - - // Take field - pub fn take_peer_urls(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { - ::std::mem::replace(&mut self.peer_urls, ::protobuf::RepeatedField::new()) - } - - pub fn get_peer_urls(&self) -> &[::std::string::String] { - &self.peer_urls - } - - fn get_peer_urls_for_reflect(&self) -> &::protobuf::RepeatedField<::std::string::String> { - &self.peer_urls - } - - fn mut_peer_urls_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { - &mut self.peer_urls - } - - // repeated string client_urls = 4; - - pub fn clear_client_urls(&mut self) { - self.client_urls.clear(); - } - - // Param is passed by value, moved - pub fn set_client_urls(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { - self.client_urls = v; - } - - // Mutable pointer to the field. - pub fn mut_client_urls(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { - &mut self.client_urls - } - - // Take field - pub fn take_client_urls(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { - ::std::mem::replace(&mut self.client_urls, ::protobuf::RepeatedField::new()) - } - - pub fn get_client_urls(&self) -> &[::std::string::String] { - &self.client_urls - } - - fn get_client_urls_for_reflect(&self) -> &::protobuf::RepeatedField<::std::string::String> { - &self.client_urls - } - - fn mut_client_urls_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { - &mut self.client_urls - } -} - -impl ::protobuf::Message for Member { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.member_id = tmp; - }, - 3 => { - ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.peer_urls)?; - }, - 4 => { - ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.client_urls)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.name.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.name); - } - if self.member_id != 0 { - my_size += ::protobuf::rt::value_size(2, self.member_id, ::protobuf::wire_format::WireTypeVarint); - } - for value in &self.peer_urls { - my_size += ::protobuf::rt::string_size(3, &value); - }; - for value in &self.client_urls { - my_size += ::protobuf::rt::string_size(4, &value); - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.name.is_empty() { - os.write_string(1, &self.name)?; - } - if self.member_id != 0 { - os.write_uint64(2, self.member_id)?; - } - for v in &self.peer_urls { - os.write_string(3, &v)?; - }; - for v in &self.client_urls { - os.write_string(4, &v)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Member { - fn new() -> Member { - Member::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "name", - Member::get_name_for_reflect, - Member::mut_name_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "member_id", - Member::get_member_id_for_reflect, - Member::mut_member_id_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "peer_urls", - Member::get_peer_urls_for_reflect, - Member::mut_peer_urls_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "client_urls", - Member::get_client_urls_for_reflect, - Member::mut_client_urls_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Member", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Member { - fn clear(&mut self) { - self.clear_name(); - self.clear_member_id(); - self.clear_peer_urls(); - self.clear_client_urls(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Member { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Member { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct GetMembersRequest { - // message fields - pub header: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for GetMembersRequest {} - -impl GetMembersRequest { - pub fn new() -> GetMembersRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static GetMembersRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const GetMembersRequest, - }; - unsafe { - instance.get(GetMembersRequest::new) - } - } - - // .pdpb.RequestHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: RequestHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut RequestHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> RequestHeader { - self.header.take().unwrap_or_else(|| RequestHeader::new()) - } - - pub fn get_header(&self) -> &RequestHeader { - self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } -} - -impl ::protobuf::Message for GetMembersRequest { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for GetMembersRequest { - fn new() -> GetMembersRequest { - GetMembersRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - GetMembersRequest::get_header_for_reflect, - GetMembersRequest::mut_header_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "GetMembersRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for GetMembersRequest { - fn clear(&mut self) { - self.clear_header(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for GetMembersRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetMembersRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct GetMembersResponse { - // message fields - pub header: ::protobuf::SingularPtrField, - pub members: ::protobuf::RepeatedField, - pub leader: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for GetMembersResponse {} - -impl GetMembersResponse { - pub fn new() -> GetMembersResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static GetMembersResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const GetMembersResponse, - }; - unsafe { - instance.get(GetMembersResponse::new) - } - } - - // .pdpb.ResponseHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: ResponseHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut ResponseHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> ResponseHeader { - self.header.take().unwrap_or_else(|| ResponseHeader::new()) - } - - pub fn get_header(&self) -> &ResponseHeader { - self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } - - // repeated .pdpb.Member members = 2; - - pub fn clear_members(&mut self) { - self.members.clear(); - } - - // Param is passed by value, moved - pub fn set_members(&mut self, v: ::protobuf::RepeatedField) { - self.members = v; - } - - // Mutable pointer to the field. - pub fn mut_members(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.members - } - - // Take field - pub fn take_members(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.members, ::protobuf::RepeatedField::new()) - } - - pub fn get_members(&self) -> &[Member] { - &self.members - } - - fn get_members_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.members - } - - fn mut_members_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.members - } - - // .pdpb.Member leader = 3; - - pub fn clear_leader(&mut self) { - self.leader.clear(); - } - - pub fn has_leader(&self) -> bool { - self.leader.is_some() - } - - // Param is passed by value, moved - pub fn set_leader(&mut self, v: Member) { - self.leader = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_leader(&mut self) -> &mut Member { - if self.leader.is_none() { - self.leader.set_default(); - } - self.leader.as_mut().unwrap() - } - - // Take field - pub fn take_leader(&mut self) -> Member { - self.leader.take().unwrap_or_else(|| Member::new()) - } - - pub fn get_leader(&self) -> &Member { - self.leader.as_ref().unwrap_or_else(|| Member::default_instance()) - } - - fn get_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.leader - } - - fn mut_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.leader - } -} - -impl ::protobuf::Message for GetMembersResponse { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - for v in &self.members { - if !v.is_initialized() { - return false; - } - }; - for v in &self.leader { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - 2 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.members)?; - }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.leader)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - for value in &self.members { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - if let Some(ref v) = self.leader.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - for v in &self.members { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - if let Some(ref v) = self.leader.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for GetMembersResponse { - fn new() -> GetMembersResponse { - GetMembersResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - GetMembersResponse::get_header_for_reflect, - GetMembersResponse::mut_header_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "members", - GetMembersResponse::get_members_for_reflect, - GetMembersResponse::mut_members_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "leader", - GetMembersResponse::get_leader_for_reflect, - GetMembersResponse::mut_leader_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "GetMembersResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for GetMembersResponse { - fn clear(&mut self) { - self.clear_header(); - self.clear_members(); - self.clear_leader(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for GetMembersResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetMembersResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct PeerStats { - // message fields - pub peer: ::protobuf::SingularPtrField, - pub down_seconds: u64, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for PeerStats {} - -impl PeerStats { - pub fn new() -> PeerStats { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static PeerStats { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const PeerStats, - }; - unsafe { - instance.get(PeerStats::new) - } - } - - // .metapb.Peer peer = 1; - - pub fn clear_peer(&mut self) { - self.peer.clear(); - } - - pub fn has_peer(&self) -> bool { - self.peer.is_some() - } - - // Param is passed by value, moved - pub fn set_peer(&mut self, v: super::metapb::Peer) { - self.peer = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_peer(&mut self) -> &mut super::metapb::Peer { - if self.peer.is_none() { - self.peer.set_default(); - } - self.peer.as_mut().unwrap() - } - - // Take field - pub fn take_peer(&mut self) -> super::metapb::Peer { - self.peer.take().unwrap_or_else(|| super::metapb::Peer::new()) - } - - pub fn get_peer(&self) -> &super::metapb::Peer { - self.peer.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) - } - - fn get_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.peer - } - - fn mut_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.peer - } - - // uint64 down_seconds = 2; - - pub fn clear_down_seconds(&mut self) { - self.down_seconds = 0; - } - - // Param is passed by value, moved - pub fn set_down_seconds(&mut self, v: u64) { - self.down_seconds = v; - } - - pub fn get_down_seconds(&self) -> u64 { - self.down_seconds - } - - fn get_down_seconds_for_reflect(&self) -> &u64 { - &self.down_seconds - } - - fn mut_down_seconds_for_reflect(&mut self) -> &mut u64 { - &mut self.down_seconds - } -} - -impl ::protobuf::Message for PeerStats { - fn is_initialized(&self) -> bool { - for v in &self.peer { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.peer)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.down_seconds = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.peer.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.down_seconds != 0 { - my_size += ::protobuf::rt::value_size(2, self.down_seconds, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.peer.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.down_seconds != 0 { - os.write_uint64(2, self.down_seconds)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for PeerStats { - fn new() -> PeerStats { - PeerStats::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "peer", - PeerStats::get_peer_for_reflect, - PeerStats::mut_peer_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "down_seconds", - PeerStats::get_down_seconds_for_reflect, - PeerStats::mut_down_seconds_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "PeerStats", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for PeerStats { - fn clear(&mut self) { - self.clear_peer(); - self.clear_down_seconds(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for PeerStats { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for PeerStats { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RegionHeartbeatRequest { - // message fields - pub header: ::protobuf::SingularPtrField, - pub region: ::protobuf::SingularPtrField, - pub leader: ::protobuf::SingularPtrField, - pub down_peers: ::protobuf::RepeatedField, - pub pending_peers: ::protobuf::RepeatedField, - pub bytes_written: u64, - pub bytes_read: u64, - pub keys_written: u64, - pub keys_read: u64, - pub approximate_size: u64, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RegionHeartbeatRequest {} - -impl RegionHeartbeatRequest { - pub fn new() -> RegionHeartbeatRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RegionHeartbeatRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RegionHeartbeatRequest, - }; - unsafe { - instance.get(RegionHeartbeatRequest::new) - } - } - - // .pdpb.RequestHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: RequestHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut RequestHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> RequestHeader { - self.header.take().unwrap_or_else(|| RequestHeader::new()) - } - - pub fn get_header(&self) -> &RequestHeader { - self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } - - // .metapb.Region region = 2; - - pub fn clear_region(&mut self) { - self.region.clear(); - } - - pub fn has_region(&self) -> bool { - self.region.is_some() - } - - // Param is passed by value, moved - pub fn set_region(&mut self, v: super::metapb::Region) { - self.region = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region(&mut self) -> &mut super::metapb::Region { - if self.region.is_none() { - self.region.set_default(); - } - self.region.as_mut().unwrap() - } - - // Take field - pub fn take_region(&mut self) -> super::metapb::Region { - self.region.take().unwrap_or_else(|| super::metapb::Region::new()) - } - - pub fn get_region(&self) -> &super::metapb::Region { - self.region.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) - } - - fn get_region_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region - } - - fn mut_region_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region - } - - // .metapb.Peer leader = 3; - - pub fn clear_leader(&mut self) { - self.leader.clear(); - } - - pub fn has_leader(&self) -> bool { - self.leader.is_some() - } - - // Param is passed by value, moved - pub fn set_leader(&mut self, v: super::metapb::Peer) { - self.leader = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_leader(&mut self) -> &mut super::metapb::Peer { - if self.leader.is_none() { - self.leader.set_default(); - } - self.leader.as_mut().unwrap() - } - - // Take field - pub fn take_leader(&mut self) -> super::metapb::Peer { - self.leader.take().unwrap_or_else(|| super::metapb::Peer::new()) - } - - pub fn get_leader(&self) -> &super::metapb::Peer { - self.leader.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) - } - - fn get_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.leader - } - - fn mut_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.leader - } - - // repeated .pdpb.PeerStats down_peers = 4; - - pub fn clear_down_peers(&mut self) { - self.down_peers.clear(); - } - - // Param is passed by value, moved - pub fn set_down_peers(&mut self, v: ::protobuf::RepeatedField) { - self.down_peers = v; - } - - // Mutable pointer to the field. - pub fn mut_down_peers(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.down_peers - } - - // Take field - pub fn take_down_peers(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.down_peers, ::protobuf::RepeatedField::new()) - } - - pub fn get_down_peers(&self) -> &[PeerStats] { - &self.down_peers - } - - fn get_down_peers_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.down_peers - } - - fn mut_down_peers_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.down_peers - } - - // repeated .metapb.Peer pending_peers = 5; - - pub fn clear_pending_peers(&mut self) { - self.pending_peers.clear(); - } - - // Param is passed by value, moved - pub fn set_pending_peers(&mut self, v: ::protobuf::RepeatedField) { - self.pending_peers = v; - } - - // Mutable pointer to the field. - pub fn mut_pending_peers(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.pending_peers - } - - // Take field - pub fn take_pending_peers(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.pending_peers, ::protobuf::RepeatedField::new()) - } - - pub fn get_pending_peers(&self) -> &[super::metapb::Peer] { - &self.pending_peers - } - - fn get_pending_peers_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.pending_peers - } - - fn mut_pending_peers_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.pending_peers - } - - // uint64 bytes_written = 6; - - pub fn clear_bytes_written(&mut self) { - self.bytes_written = 0; - } - - // Param is passed by value, moved - pub fn set_bytes_written(&mut self, v: u64) { - self.bytes_written = v; - } - - pub fn get_bytes_written(&self) -> u64 { - self.bytes_written - } - - fn get_bytes_written_for_reflect(&self) -> &u64 { - &self.bytes_written - } - - fn mut_bytes_written_for_reflect(&mut self) -> &mut u64 { - &mut self.bytes_written - } - - // uint64 bytes_read = 7; - - pub fn clear_bytes_read(&mut self) { - self.bytes_read = 0; - } - - // Param is passed by value, moved - pub fn set_bytes_read(&mut self, v: u64) { - self.bytes_read = v; - } - - pub fn get_bytes_read(&self) -> u64 { - self.bytes_read - } - - fn get_bytes_read_for_reflect(&self) -> &u64 { - &self.bytes_read - } - - fn mut_bytes_read_for_reflect(&mut self) -> &mut u64 { - &mut self.bytes_read - } - - // uint64 keys_written = 8; - - pub fn clear_keys_written(&mut self) { - self.keys_written = 0; - } - - // Param is passed by value, moved - pub fn set_keys_written(&mut self, v: u64) { - self.keys_written = v; - } - - pub fn get_keys_written(&self) -> u64 { - self.keys_written - } - - fn get_keys_written_for_reflect(&self) -> &u64 { - &self.keys_written - } - - fn mut_keys_written_for_reflect(&mut self) -> &mut u64 { - &mut self.keys_written - } - - // uint64 keys_read = 9; - - pub fn clear_keys_read(&mut self) { - self.keys_read = 0; - } - - // Param is passed by value, moved - pub fn set_keys_read(&mut self, v: u64) { - self.keys_read = v; - } - - pub fn get_keys_read(&self) -> u64 { - self.keys_read - } - - fn get_keys_read_for_reflect(&self) -> &u64 { - &self.keys_read - } - - fn mut_keys_read_for_reflect(&mut self) -> &mut u64 { - &mut self.keys_read - } - - // uint64 approximate_size = 10; - - pub fn clear_approximate_size(&mut self) { - self.approximate_size = 0; - } - - // Param is passed by value, moved - pub fn set_approximate_size(&mut self, v: u64) { - self.approximate_size = v; - } - - pub fn get_approximate_size(&self) -> u64 { - self.approximate_size - } - - fn get_approximate_size_for_reflect(&self) -> &u64 { - &self.approximate_size - } - - fn mut_approximate_size_for_reflect(&mut self) -> &mut u64 { - &mut self.approximate_size - } -} - -impl ::protobuf::Message for RegionHeartbeatRequest { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - for v in &self.region { - if !v.is_initialized() { - return false; - } - }; - for v in &self.leader { - if !v.is_initialized() { - return false; - } - }; - for v in &self.down_peers { - if !v.is_initialized() { - return false; - } - }; - for v in &self.pending_peers { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region)?; - }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.leader)?; - }, - 4 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.down_peers)?; - }, - 5 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.pending_peers)?; - }, - 6 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.bytes_written = tmp; - }, - 7 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.bytes_read = tmp; - }, - 8 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.keys_written = tmp; - }, - 9 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.keys_read = tmp; - }, - 10 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.approximate_size = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.region.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.leader.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - for value in &self.down_peers { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - for value in &self.pending_peers { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - if self.bytes_written != 0 { - my_size += ::protobuf::rt::value_size(6, self.bytes_written, ::protobuf::wire_format::WireTypeVarint); - } - if self.bytes_read != 0 { - my_size += ::protobuf::rt::value_size(7, self.bytes_read, ::protobuf::wire_format::WireTypeVarint); - } - if self.keys_written != 0 { - my_size += ::protobuf::rt::value_size(8, self.keys_written, ::protobuf::wire_format::WireTypeVarint); - } - if self.keys_read != 0 { - my_size += ::protobuf::rt::value_size(9, self.keys_read, ::protobuf::wire_format::WireTypeVarint); - } - if self.approximate_size != 0 { - my_size += ::protobuf::rt::value_size(10, self.approximate_size, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.region.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.leader.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - for v in &self.down_peers { - os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - for v in &self.pending_peers { - os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - if self.bytes_written != 0 { - os.write_uint64(6, self.bytes_written)?; - } - if self.bytes_read != 0 { - os.write_uint64(7, self.bytes_read)?; - } - if self.keys_written != 0 { - os.write_uint64(8, self.keys_written)?; - } - if self.keys_read != 0 { - os.write_uint64(9, self.keys_read)?; - } - if self.approximate_size != 0 { - os.write_uint64(10, self.approximate_size)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RegionHeartbeatRequest { - fn new() -> RegionHeartbeatRequest { - RegionHeartbeatRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - RegionHeartbeatRequest::get_header_for_reflect, - RegionHeartbeatRequest::mut_header_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region", - RegionHeartbeatRequest::get_region_for_reflect, - RegionHeartbeatRequest::mut_region_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "leader", - RegionHeartbeatRequest::get_leader_for_reflect, - RegionHeartbeatRequest::mut_leader_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "down_peers", - RegionHeartbeatRequest::get_down_peers_for_reflect, - RegionHeartbeatRequest::mut_down_peers_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "pending_peers", - RegionHeartbeatRequest::get_pending_peers_for_reflect, - RegionHeartbeatRequest::mut_pending_peers_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "bytes_written", - RegionHeartbeatRequest::get_bytes_written_for_reflect, - RegionHeartbeatRequest::mut_bytes_written_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "bytes_read", - RegionHeartbeatRequest::get_bytes_read_for_reflect, - RegionHeartbeatRequest::mut_bytes_read_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "keys_written", - RegionHeartbeatRequest::get_keys_written_for_reflect, - RegionHeartbeatRequest::mut_keys_written_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "keys_read", - RegionHeartbeatRequest::get_keys_read_for_reflect, - RegionHeartbeatRequest::mut_keys_read_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "approximate_size", - RegionHeartbeatRequest::get_approximate_size_for_reflect, - RegionHeartbeatRequest::mut_approximate_size_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RegionHeartbeatRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RegionHeartbeatRequest { - fn clear(&mut self) { - self.clear_header(); - self.clear_region(); - self.clear_leader(); - self.clear_down_peers(); - self.clear_pending_peers(); - self.clear_bytes_written(); - self.clear_bytes_read(); - self.clear_keys_written(); - self.clear_keys_read(); - self.clear_approximate_size(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RegionHeartbeatRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RegionHeartbeatRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ChangePeer { - // message fields - pub peer: ::protobuf::SingularPtrField, - pub change_type: ConfChangeType, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for ChangePeer {} - -impl ChangePeer { - pub fn new() -> ChangePeer { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static ChangePeer { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ChangePeer, - }; - unsafe { - instance.get(ChangePeer::new) - } - } - - // .metapb.Peer peer = 1; - - pub fn clear_peer(&mut self) { - self.peer.clear(); - } - - pub fn has_peer(&self) -> bool { - self.peer.is_some() - } - - // Param is passed by value, moved - pub fn set_peer(&mut self, v: super::metapb::Peer) { - self.peer = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_peer(&mut self) -> &mut super::metapb::Peer { - if self.peer.is_none() { - self.peer.set_default(); - } - self.peer.as_mut().unwrap() - } - - // Take field - pub fn take_peer(&mut self) -> super::metapb::Peer { - self.peer.take().unwrap_or_else(|| super::metapb::Peer::new()) - } - - pub fn get_peer(&self) -> &super::metapb::Peer { - self.peer.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) - } - - fn get_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.peer - } - - fn mut_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.peer - } - - // .pdpb.ConfChangeType change_type = 2; - - pub fn clear_change_type(&mut self) { - self.change_type = ConfChangeType::AddNode; - } - - // Param is passed by value, moved - pub fn set_change_type(&mut self, v: ConfChangeType) { - self.change_type = v; - } - - pub fn get_change_type(&self) -> ConfChangeType { - self.change_type - } - - fn get_change_type_for_reflect(&self) -> &ConfChangeType { - &self.change_type - } - - fn mut_change_type_for_reflect(&mut self) -> &mut ConfChangeType { - &mut self.change_type - } -} - -impl ::protobuf::Message for ChangePeer { - fn is_initialized(&self) -> bool { - for v in &self.peer { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.peer)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.change_type = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.peer.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.change_type != ConfChangeType::AddNode { - my_size += ::protobuf::rt::enum_size(2, self.change_type); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.peer.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.change_type != ConfChangeType::AddNode { - os.write_enum(2, self.change_type.value())?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for ChangePeer { - fn new() -> ChangePeer { - ChangePeer::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "peer", - ChangePeer::get_peer_for_reflect, - ChangePeer::mut_peer_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "change_type", - ChangePeer::get_change_type_for_reflect, - ChangePeer::mut_change_type_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "ChangePeer", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for ChangePeer { - fn clear(&mut self) { - self.clear_peer(); - self.clear_change_type(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ChangePeer { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ChangePeer { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct TransferLeader { - // message fields - pub peer: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for TransferLeader {} - -impl TransferLeader { - pub fn new() -> TransferLeader { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static TransferLeader { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const TransferLeader, - }; - unsafe { - instance.get(TransferLeader::new) - } - } - - // .metapb.Peer peer = 1; - - pub fn clear_peer(&mut self) { - self.peer.clear(); - } - - pub fn has_peer(&self) -> bool { - self.peer.is_some() - } - - // Param is passed by value, moved - pub fn set_peer(&mut self, v: super::metapb::Peer) { - self.peer = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_peer(&mut self) -> &mut super::metapb::Peer { - if self.peer.is_none() { - self.peer.set_default(); - } - self.peer.as_mut().unwrap() - } - - // Take field - pub fn take_peer(&mut self) -> super::metapb::Peer { - self.peer.take().unwrap_or_else(|| super::metapb::Peer::new()) - } - - pub fn get_peer(&self) -> &super::metapb::Peer { - self.peer.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) - } - - fn get_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.peer - } - - fn mut_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.peer - } -} - -impl ::protobuf::Message for TransferLeader { - fn is_initialized(&self) -> bool { - for v in &self.peer { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.peer)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.peer.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.peer.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for TransferLeader { - fn new() -> TransferLeader { - TransferLeader::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "peer", - TransferLeader::get_peer_for_reflect, - TransferLeader::mut_peer_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "TransferLeader", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for TransferLeader { - fn clear(&mut self) { - self.clear_peer(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for TransferLeader { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TransferLeader { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RegionHeartbeatResponse { - // message fields - pub header: ::protobuf::SingularPtrField, - pub change_peer: ::protobuf::SingularPtrField, - pub transfer_leader: ::protobuf::SingularPtrField, - pub region_id: u64, - pub region_epoch: ::protobuf::SingularPtrField, - pub target_peer: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RegionHeartbeatResponse {} - -impl RegionHeartbeatResponse { - pub fn new() -> RegionHeartbeatResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RegionHeartbeatResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RegionHeartbeatResponse, - }; - unsafe { - instance.get(RegionHeartbeatResponse::new) - } - } - - // .pdpb.ResponseHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: ResponseHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut ResponseHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> ResponseHeader { - self.header.take().unwrap_or_else(|| ResponseHeader::new()) - } - - pub fn get_header(&self) -> &ResponseHeader { - self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } - - // .pdpb.ChangePeer change_peer = 2; - - pub fn clear_change_peer(&mut self) { - self.change_peer.clear(); - } - - pub fn has_change_peer(&self) -> bool { - self.change_peer.is_some() - } - - // Param is passed by value, moved - pub fn set_change_peer(&mut self, v: ChangePeer) { - self.change_peer = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_change_peer(&mut self) -> &mut ChangePeer { - if self.change_peer.is_none() { - self.change_peer.set_default(); - } - self.change_peer.as_mut().unwrap() - } - - // Take field - pub fn take_change_peer(&mut self) -> ChangePeer { - self.change_peer.take().unwrap_or_else(|| ChangePeer::new()) - } - - pub fn get_change_peer(&self) -> &ChangePeer { - self.change_peer.as_ref().unwrap_or_else(|| ChangePeer::default_instance()) - } - - fn get_change_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.change_peer - } - - fn mut_change_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.change_peer - } - - // .pdpb.TransferLeader transfer_leader = 3; - - pub fn clear_transfer_leader(&mut self) { - self.transfer_leader.clear(); - } - - pub fn has_transfer_leader(&self) -> bool { - self.transfer_leader.is_some() - } - - // Param is passed by value, moved - pub fn set_transfer_leader(&mut self, v: TransferLeader) { - self.transfer_leader = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_transfer_leader(&mut self) -> &mut TransferLeader { - if self.transfer_leader.is_none() { - self.transfer_leader.set_default(); - } - self.transfer_leader.as_mut().unwrap() - } - - // Take field - pub fn take_transfer_leader(&mut self) -> TransferLeader { - self.transfer_leader.take().unwrap_or_else(|| TransferLeader::new()) - } - - pub fn get_transfer_leader(&self) -> &TransferLeader { - self.transfer_leader.as_ref().unwrap_or_else(|| TransferLeader::default_instance()) - } - - fn get_transfer_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.transfer_leader - } - - fn mut_transfer_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.transfer_leader - } - - // uint64 region_id = 4; - - pub fn clear_region_id(&mut self) { - self.region_id = 0; - } - - // Param is passed by value, moved - pub fn set_region_id(&mut self, v: u64) { - self.region_id = v; - } - - pub fn get_region_id(&self) -> u64 { - self.region_id - } - - fn get_region_id_for_reflect(&self) -> &u64 { - &self.region_id - } - - fn mut_region_id_for_reflect(&mut self) -> &mut u64 { - &mut self.region_id - } - - // .metapb.RegionEpoch region_epoch = 5; - - pub fn clear_region_epoch(&mut self) { - self.region_epoch.clear(); - } - - pub fn has_region_epoch(&self) -> bool { - self.region_epoch.is_some() - } - - // Param is passed by value, moved - pub fn set_region_epoch(&mut self, v: super::metapb::RegionEpoch) { - self.region_epoch = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_epoch(&mut self) -> &mut super::metapb::RegionEpoch { - if self.region_epoch.is_none() { - self.region_epoch.set_default(); - } - self.region_epoch.as_mut().unwrap() - } - - // Take field - pub fn take_region_epoch(&mut self) -> super::metapb::RegionEpoch { - self.region_epoch.take().unwrap_or_else(|| super::metapb::RegionEpoch::new()) - } - - pub fn get_region_epoch(&self) -> &super::metapb::RegionEpoch { - self.region_epoch.as_ref().unwrap_or_else(|| super::metapb::RegionEpoch::default_instance()) - } - - fn get_region_epoch_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_epoch - } - - fn mut_region_epoch_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_epoch - } - - // .metapb.Peer target_peer = 6; - - pub fn clear_target_peer(&mut self) { - self.target_peer.clear(); - } - - pub fn has_target_peer(&self) -> bool { - self.target_peer.is_some() - } - - // Param is passed by value, moved - pub fn set_target_peer(&mut self, v: super::metapb::Peer) { - self.target_peer = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_target_peer(&mut self) -> &mut super::metapb::Peer { - if self.target_peer.is_none() { - self.target_peer.set_default(); - } - self.target_peer.as_mut().unwrap() - } - - // Take field - pub fn take_target_peer(&mut self) -> super::metapb::Peer { - self.target_peer.take().unwrap_or_else(|| super::metapb::Peer::new()) - } - - pub fn get_target_peer(&self) -> &super::metapb::Peer { - self.target_peer.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) - } - - fn get_target_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.target_peer - } - - fn mut_target_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.target_peer - } -} - -impl ::protobuf::Message for RegionHeartbeatResponse { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - for v in &self.change_peer { - if !v.is_initialized() { - return false; - } - }; - for v in &self.transfer_leader { - if !v.is_initialized() { - return false; - } - }; - for v in &self.region_epoch { - if !v.is_initialized() { - return false; - } - }; - for v in &self.target_peer { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.change_peer)?; - }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.transfer_leader)?; - }, - 4 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.region_id = tmp; - }, - 5 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_epoch)?; - }, - 6 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.target_peer)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.change_peer.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.transfer_leader.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.region_id != 0 { - my_size += ::protobuf::rt::value_size(4, self.region_id, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(ref v) = self.region_epoch.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.target_peer.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.change_peer.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.transfer_leader.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.region_id != 0 { - os.write_uint64(4, self.region_id)?; - } - if let Some(ref v) = self.region_epoch.as_ref() { - os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.target_peer.as_ref() { - os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RegionHeartbeatResponse { - fn new() -> RegionHeartbeatResponse { - RegionHeartbeatResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - RegionHeartbeatResponse::get_header_for_reflect, - RegionHeartbeatResponse::mut_header_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "change_peer", - RegionHeartbeatResponse::get_change_peer_for_reflect, - RegionHeartbeatResponse::mut_change_peer_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "transfer_leader", - RegionHeartbeatResponse::get_transfer_leader_for_reflect, - RegionHeartbeatResponse::mut_transfer_leader_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "region_id", - RegionHeartbeatResponse::get_region_id_for_reflect, - RegionHeartbeatResponse::mut_region_id_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_epoch", - RegionHeartbeatResponse::get_region_epoch_for_reflect, - RegionHeartbeatResponse::mut_region_epoch_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "target_peer", - RegionHeartbeatResponse::get_target_peer_for_reflect, - RegionHeartbeatResponse::mut_target_peer_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RegionHeartbeatResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RegionHeartbeatResponse { - fn clear(&mut self) { - self.clear_header(); - self.clear_change_peer(); - self.clear_transfer_leader(); - self.clear_region_id(); - self.clear_region_epoch(); - self.clear_target_peer(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RegionHeartbeatResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RegionHeartbeatResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct AskSplitRequest { - // message fields - pub header: ::protobuf::SingularPtrField, - pub region: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for AskSplitRequest {} - -impl AskSplitRequest { - pub fn new() -> AskSplitRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static AskSplitRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const AskSplitRequest, - }; - unsafe { - instance.get(AskSplitRequest::new) - } - } - - // .pdpb.RequestHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: RequestHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut RequestHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> RequestHeader { - self.header.take().unwrap_or_else(|| RequestHeader::new()) - } - - pub fn get_header(&self) -> &RequestHeader { - self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } - - // .metapb.Region region = 2; - - pub fn clear_region(&mut self) { - self.region.clear(); - } - - pub fn has_region(&self) -> bool { - self.region.is_some() - } - - // Param is passed by value, moved - pub fn set_region(&mut self, v: super::metapb::Region) { - self.region = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region(&mut self) -> &mut super::metapb::Region { - if self.region.is_none() { - self.region.set_default(); - } - self.region.as_mut().unwrap() - } - - // Take field - pub fn take_region(&mut self) -> super::metapb::Region { - self.region.take().unwrap_or_else(|| super::metapb::Region::new()) - } - - pub fn get_region(&self) -> &super::metapb::Region { - self.region.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) - } - - fn get_region_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region - } - - fn mut_region_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region - } -} - -impl ::protobuf::Message for AskSplitRequest { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - for v in &self.region { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.region.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.region.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for AskSplitRequest { - fn new() -> AskSplitRequest { - AskSplitRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - AskSplitRequest::get_header_for_reflect, - AskSplitRequest::mut_header_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region", - AskSplitRequest::get_region_for_reflect, - AskSplitRequest::mut_region_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "AskSplitRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for AskSplitRequest { - fn clear(&mut self) { - self.clear_header(); - self.clear_region(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for AskSplitRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for AskSplitRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct AskSplitResponse { - // message fields - pub header: ::protobuf::SingularPtrField, - pub new_region_id: u64, - pub new_peer_ids: ::std::vec::Vec, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for AskSplitResponse {} - -impl AskSplitResponse { - pub fn new() -> AskSplitResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static AskSplitResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const AskSplitResponse, - }; - unsafe { - instance.get(AskSplitResponse::new) - } - } - - // .pdpb.ResponseHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: ResponseHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut ResponseHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> ResponseHeader { - self.header.take().unwrap_or_else(|| ResponseHeader::new()) - } - - pub fn get_header(&self) -> &ResponseHeader { - self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } - - // uint64 new_region_id = 2; - - pub fn clear_new_region_id(&mut self) { - self.new_region_id = 0; - } - - // Param is passed by value, moved - pub fn set_new_region_id(&mut self, v: u64) { - self.new_region_id = v; - } - - pub fn get_new_region_id(&self) -> u64 { - self.new_region_id - } - - fn get_new_region_id_for_reflect(&self) -> &u64 { - &self.new_region_id - } - - fn mut_new_region_id_for_reflect(&mut self) -> &mut u64 { - &mut self.new_region_id - } - - // repeated uint64 new_peer_ids = 3; - - pub fn clear_new_peer_ids(&mut self) { - self.new_peer_ids.clear(); - } - - // Param is passed by value, moved - pub fn set_new_peer_ids(&mut self, v: ::std::vec::Vec) { - self.new_peer_ids = v; - } - - // Mutable pointer to the field. - pub fn mut_new_peer_ids(&mut self) -> &mut ::std::vec::Vec { - &mut self.new_peer_ids - } - - // Take field - pub fn take_new_peer_ids(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.new_peer_ids, ::std::vec::Vec::new()) - } - - pub fn get_new_peer_ids(&self) -> &[u64] { - &self.new_peer_ids - } - - fn get_new_peer_ids_for_reflect(&self) -> &::std::vec::Vec { - &self.new_peer_ids - } - - fn mut_new_peer_ids_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.new_peer_ids - } -} - -impl ::protobuf::Message for AskSplitResponse { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.new_region_id = tmp; - }, - 3 => { - ::protobuf::rt::read_repeated_uint64_into(wire_type, is, &mut self.new_peer_ids)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.new_region_id != 0 { - my_size += ::protobuf::rt::value_size(2, self.new_region_id, ::protobuf::wire_format::WireTypeVarint); - } - for value in &self.new_peer_ids { - my_size += ::protobuf::rt::value_size(3, *value, ::protobuf::wire_format::WireTypeVarint); - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.new_region_id != 0 { - os.write_uint64(2, self.new_region_id)?; - } - for v in &self.new_peer_ids { - os.write_uint64(3, *v)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for AskSplitResponse { - fn new() -> AskSplitResponse { - AskSplitResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - AskSplitResponse::get_header_for_reflect, - AskSplitResponse::mut_header_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "new_region_id", - AskSplitResponse::get_new_region_id_for_reflect, - AskSplitResponse::mut_new_region_id_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "new_peer_ids", - AskSplitResponse::get_new_peer_ids_for_reflect, - AskSplitResponse::mut_new_peer_ids_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "AskSplitResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for AskSplitResponse { - fn clear(&mut self) { - self.clear_header(); - self.clear_new_region_id(); - self.clear_new_peer_ids(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for AskSplitResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for AskSplitResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ReportSplitRequest { - // message fields - pub header: ::protobuf::SingularPtrField, - pub left: ::protobuf::SingularPtrField, - pub right: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for ReportSplitRequest {} - -impl ReportSplitRequest { - pub fn new() -> ReportSplitRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static ReportSplitRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ReportSplitRequest, - }; - unsafe { - instance.get(ReportSplitRequest::new) - } - } - - // .pdpb.RequestHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: RequestHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut RequestHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> RequestHeader { - self.header.take().unwrap_or_else(|| RequestHeader::new()) - } - - pub fn get_header(&self) -> &RequestHeader { - self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } - - // .metapb.Region left = 2; - - pub fn clear_left(&mut self) { - self.left.clear(); - } - - pub fn has_left(&self) -> bool { - self.left.is_some() - } - - // Param is passed by value, moved - pub fn set_left(&mut self, v: super::metapb::Region) { - self.left = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_left(&mut self) -> &mut super::metapb::Region { - if self.left.is_none() { - self.left.set_default(); - } - self.left.as_mut().unwrap() - } - - // Take field - pub fn take_left(&mut self) -> super::metapb::Region { - self.left.take().unwrap_or_else(|| super::metapb::Region::new()) - } - - pub fn get_left(&self) -> &super::metapb::Region { - self.left.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) - } - - fn get_left_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.left - } - - fn mut_left_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.left - } - - // .metapb.Region right = 3; - - pub fn clear_right(&mut self) { - self.right.clear(); - } - - pub fn has_right(&self) -> bool { - self.right.is_some() - } - - // Param is passed by value, moved - pub fn set_right(&mut self, v: super::metapb::Region) { - self.right = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_right(&mut self) -> &mut super::metapb::Region { - if self.right.is_none() { - self.right.set_default(); - } - self.right.as_mut().unwrap() - } - - // Take field - pub fn take_right(&mut self) -> super::metapb::Region { - self.right.take().unwrap_or_else(|| super::metapb::Region::new()) - } - - pub fn get_right(&self) -> &super::metapb::Region { - self.right.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) - } - - fn get_right_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.right - } - - fn mut_right_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.right - } -} - -impl ::protobuf::Message for ReportSplitRequest { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - for v in &self.left { - if !v.is_initialized() { - return false; - } - }; - for v in &self.right { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.left)?; - }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.right)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.left.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.right.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.left.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.right.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for ReportSplitRequest { - fn new() -> ReportSplitRequest { - ReportSplitRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - ReportSplitRequest::get_header_for_reflect, - ReportSplitRequest::mut_header_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "left", - ReportSplitRequest::get_left_for_reflect, - ReportSplitRequest::mut_left_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "right", - ReportSplitRequest::get_right_for_reflect, - ReportSplitRequest::mut_right_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "ReportSplitRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for ReportSplitRequest { - fn clear(&mut self) { - self.clear_header(); - self.clear_left(); - self.clear_right(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ReportSplitRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ReportSplitRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ReportSplitResponse { - // message fields - pub header: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for ReportSplitResponse {} - -impl ReportSplitResponse { - pub fn new() -> ReportSplitResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static ReportSplitResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ReportSplitResponse, - }; - unsafe { - instance.get(ReportSplitResponse::new) - } - } - - // .pdpb.ResponseHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: ResponseHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut ResponseHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> ResponseHeader { - self.header.take().unwrap_or_else(|| ResponseHeader::new()) - } - - pub fn get_header(&self) -> &ResponseHeader { - self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } -} - -impl ::protobuf::Message for ReportSplitResponse { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for ReportSplitResponse { - fn new() -> ReportSplitResponse { - ReportSplitResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - ReportSplitResponse::get_header_for_reflect, - ReportSplitResponse::mut_header_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "ReportSplitResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for ReportSplitResponse { - fn clear(&mut self) { - self.clear_header(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ReportSplitResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ReportSplitResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct StoreStats { - // message fields - pub store_id: u64, - pub capacity: u64, - pub available: u64, - pub region_count: u32, - pub sending_snap_count: u32, - pub receiving_snap_count: u32, - pub start_time: u32, - pub applying_snap_count: u32, - pub is_busy: bool, - pub used_size: u64, - pub bytes_written: u64, - pub keys_written: u64, - pub bytes_read: u64, - pub keys_read: u64, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for StoreStats {} - -impl StoreStats { - pub fn new() -> StoreStats { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static StoreStats { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const StoreStats, - }; - unsafe { - instance.get(StoreStats::new) - } - } - - // uint64 store_id = 1; - - pub fn clear_store_id(&mut self) { - self.store_id = 0; - } - - // Param is passed by value, moved - pub fn set_store_id(&mut self, v: u64) { - self.store_id = v; - } - - pub fn get_store_id(&self) -> u64 { - self.store_id - } - - fn get_store_id_for_reflect(&self) -> &u64 { - &self.store_id - } - - fn mut_store_id_for_reflect(&mut self) -> &mut u64 { - &mut self.store_id - } - - // uint64 capacity = 2; - - pub fn clear_capacity(&mut self) { - self.capacity = 0; - } - - // Param is passed by value, moved - pub fn set_capacity(&mut self, v: u64) { - self.capacity = v; - } - - pub fn get_capacity(&self) -> u64 { - self.capacity - } - - fn get_capacity_for_reflect(&self) -> &u64 { - &self.capacity - } - - fn mut_capacity_for_reflect(&mut self) -> &mut u64 { - &mut self.capacity - } - - // uint64 available = 3; - - pub fn clear_available(&mut self) { - self.available = 0; - } - - // Param is passed by value, moved - pub fn set_available(&mut self, v: u64) { - self.available = v; - } - - pub fn get_available(&self) -> u64 { - self.available - } - - fn get_available_for_reflect(&self) -> &u64 { - &self.available - } - - fn mut_available_for_reflect(&mut self) -> &mut u64 { - &mut self.available - } - - // uint32 region_count = 4; - - pub fn clear_region_count(&mut self) { - self.region_count = 0; - } - - // Param is passed by value, moved - pub fn set_region_count(&mut self, v: u32) { - self.region_count = v; - } - - pub fn get_region_count(&self) -> u32 { - self.region_count - } - - fn get_region_count_for_reflect(&self) -> &u32 { - &self.region_count - } - - fn mut_region_count_for_reflect(&mut self) -> &mut u32 { - &mut self.region_count - } - - // uint32 sending_snap_count = 5; - - pub fn clear_sending_snap_count(&mut self) { - self.sending_snap_count = 0; - } - - // Param is passed by value, moved - pub fn set_sending_snap_count(&mut self, v: u32) { - self.sending_snap_count = v; - } - - pub fn get_sending_snap_count(&self) -> u32 { - self.sending_snap_count - } - - fn get_sending_snap_count_for_reflect(&self) -> &u32 { - &self.sending_snap_count - } - - fn mut_sending_snap_count_for_reflect(&mut self) -> &mut u32 { - &mut self.sending_snap_count - } - - // uint32 receiving_snap_count = 6; - - pub fn clear_receiving_snap_count(&mut self) { - self.receiving_snap_count = 0; - } - - // Param is passed by value, moved - pub fn set_receiving_snap_count(&mut self, v: u32) { - self.receiving_snap_count = v; - } - - pub fn get_receiving_snap_count(&self) -> u32 { - self.receiving_snap_count - } - - fn get_receiving_snap_count_for_reflect(&self) -> &u32 { - &self.receiving_snap_count - } - - fn mut_receiving_snap_count_for_reflect(&mut self) -> &mut u32 { - &mut self.receiving_snap_count - } - - // uint32 start_time = 7; - - pub fn clear_start_time(&mut self) { - self.start_time = 0; - } - - // Param is passed by value, moved - pub fn set_start_time(&mut self, v: u32) { - self.start_time = v; - } - - pub fn get_start_time(&self) -> u32 { - self.start_time - } - - fn get_start_time_for_reflect(&self) -> &u32 { - &self.start_time - } - - fn mut_start_time_for_reflect(&mut self) -> &mut u32 { - &mut self.start_time - } - - // uint32 applying_snap_count = 8; - - pub fn clear_applying_snap_count(&mut self) { - self.applying_snap_count = 0; - } - - // Param is passed by value, moved - pub fn set_applying_snap_count(&mut self, v: u32) { - self.applying_snap_count = v; - } - - pub fn get_applying_snap_count(&self) -> u32 { - self.applying_snap_count - } - - fn get_applying_snap_count_for_reflect(&self) -> &u32 { - &self.applying_snap_count - } - - fn mut_applying_snap_count_for_reflect(&mut self) -> &mut u32 { - &mut self.applying_snap_count - } - - // bool is_busy = 9; - - pub fn clear_is_busy(&mut self) { - self.is_busy = false; - } - - // Param is passed by value, moved - pub fn set_is_busy(&mut self, v: bool) { - self.is_busy = v; - } - - pub fn get_is_busy(&self) -> bool { - self.is_busy - } - - fn get_is_busy_for_reflect(&self) -> &bool { - &self.is_busy - } - - fn mut_is_busy_for_reflect(&mut self) -> &mut bool { - &mut self.is_busy - } - - // uint64 used_size = 10; - - pub fn clear_used_size(&mut self) { - self.used_size = 0; - } - - // Param is passed by value, moved - pub fn set_used_size(&mut self, v: u64) { - self.used_size = v; - } - - pub fn get_used_size(&self) -> u64 { - self.used_size - } - - fn get_used_size_for_reflect(&self) -> &u64 { - &self.used_size - } - - fn mut_used_size_for_reflect(&mut self) -> &mut u64 { - &mut self.used_size - } - - // uint64 bytes_written = 11; - - pub fn clear_bytes_written(&mut self) { - self.bytes_written = 0; - } - - // Param is passed by value, moved - pub fn set_bytes_written(&mut self, v: u64) { - self.bytes_written = v; - } - - pub fn get_bytes_written(&self) -> u64 { - self.bytes_written - } - - fn get_bytes_written_for_reflect(&self) -> &u64 { - &self.bytes_written - } - - fn mut_bytes_written_for_reflect(&mut self) -> &mut u64 { - &mut self.bytes_written - } - - // uint64 keys_written = 12; - - pub fn clear_keys_written(&mut self) { - self.keys_written = 0; - } - - // Param is passed by value, moved - pub fn set_keys_written(&mut self, v: u64) { - self.keys_written = v; - } - - pub fn get_keys_written(&self) -> u64 { - self.keys_written - } - - fn get_keys_written_for_reflect(&self) -> &u64 { - &self.keys_written - } - - fn mut_keys_written_for_reflect(&mut self) -> &mut u64 { - &mut self.keys_written - } - - // uint64 bytes_read = 13; - - pub fn clear_bytes_read(&mut self) { - self.bytes_read = 0; - } - - // Param is passed by value, moved - pub fn set_bytes_read(&mut self, v: u64) { - self.bytes_read = v; - } - - pub fn get_bytes_read(&self) -> u64 { - self.bytes_read - } - - fn get_bytes_read_for_reflect(&self) -> &u64 { - &self.bytes_read - } - - fn mut_bytes_read_for_reflect(&mut self) -> &mut u64 { - &mut self.bytes_read - } - - // uint64 keys_read = 14; - - pub fn clear_keys_read(&mut self) { - self.keys_read = 0; - } - - // Param is passed by value, moved - pub fn set_keys_read(&mut self, v: u64) { - self.keys_read = v; - } - - pub fn get_keys_read(&self) -> u64 { - self.keys_read - } - - fn get_keys_read_for_reflect(&self) -> &u64 { - &self.keys_read - } - - fn mut_keys_read_for_reflect(&mut self) -> &mut u64 { - &mut self.keys_read - } -} - -impl ::protobuf::Message for StoreStats { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.store_id = tmp; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.capacity = tmp; - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.available = tmp; - }, - 4 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint32()?; - self.region_count = tmp; - }, - 5 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint32()?; - self.sending_snap_count = tmp; - }, - 6 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint32()?; - self.receiving_snap_count = tmp; - }, - 7 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint32()?; - self.start_time = tmp; - }, - 8 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint32()?; - self.applying_snap_count = tmp; - }, - 9 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_bool()?; - self.is_busy = tmp; - }, - 10 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.used_size = tmp; - }, - 11 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.bytes_written = tmp; - }, - 12 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.keys_written = tmp; - }, - 13 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.bytes_read = tmp; - }, - 14 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.keys_read = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if self.store_id != 0 { - my_size += ::protobuf::rt::value_size(1, self.store_id, ::protobuf::wire_format::WireTypeVarint); - } - if self.capacity != 0 { - my_size += ::protobuf::rt::value_size(2, self.capacity, ::protobuf::wire_format::WireTypeVarint); - } - if self.available != 0 { - my_size += ::protobuf::rt::value_size(3, self.available, ::protobuf::wire_format::WireTypeVarint); - } - if self.region_count != 0 { - my_size += ::protobuf::rt::value_size(4, self.region_count, ::protobuf::wire_format::WireTypeVarint); - } - if self.sending_snap_count != 0 { - my_size += ::protobuf::rt::value_size(5, self.sending_snap_count, ::protobuf::wire_format::WireTypeVarint); - } - if self.receiving_snap_count != 0 { - my_size += ::protobuf::rt::value_size(6, self.receiving_snap_count, ::protobuf::wire_format::WireTypeVarint); - } - if self.start_time != 0 { - my_size += ::protobuf::rt::value_size(7, self.start_time, ::protobuf::wire_format::WireTypeVarint); - } - if self.applying_snap_count != 0 { - my_size += ::protobuf::rt::value_size(8, self.applying_snap_count, ::protobuf::wire_format::WireTypeVarint); - } - if self.is_busy != false { - my_size += 2; - } - if self.used_size != 0 { - my_size += ::protobuf::rt::value_size(10, self.used_size, ::protobuf::wire_format::WireTypeVarint); - } - if self.bytes_written != 0 { - my_size += ::protobuf::rt::value_size(11, self.bytes_written, ::protobuf::wire_format::WireTypeVarint); - } - if self.keys_written != 0 { - my_size += ::protobuf::rt::value_size(12, self.keys_written, ::protobuf::wire_format::WireTypeVarint); - } - if self.bytes_read != 0 { - my_size += ::protobuf::rt::value_size(13, self.bytes_read, ::protobuf::wire_format::WireTypeVarint); - } - if self.keys_read != 0 { - my_size += ::protobuf::rt::value_size(14, self.keys_read, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if self.store_id != 0 { - os.write_uint64(1, self.store_id)?; - } - if self.capacity != 0 { - os.write_uint64(2, self.capacity)?; - } - if self.available != 0 { - os.write_uint64(3, self.available)?; - } - if self.region_count != 0 { - os.write_uint32(4, self.region_count)?; - } - if self.sending_snap_count != 0 { - os.write_uint32(5, self.sending_snap_count)?; - } - if self.receiving_snap_count != 0 { - os.write_uint32(6, self.receiving_snap_count)?; - } - if self.start_time != 0 { - os.write_uint32(7, self.start_time)?; - } - if self.applying_snap_count != 0 { - os.write_uint32(8, self.applying_snap_count)?; - } - if self.is_busy != false { - os.write_bool(9, self.is_busy)?; - } - if self.used_size != 0 { - os.write_uint64(10, self.used_size)?; - } - if self.bytes_written != 0 { - os.write_uint64(11, self.bytes_written)?; - } - if self.keys_written != 0 { - os.write_uint64(12, self.keys_written)?; - } - if self.bytes_read != 0 { - os.write_uint64(13, self.bytes_read)?; - } - if self.keys_read != 0 { - os.write_uint64(14, self.keys_read)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for StoreStats { - fn new() -> StoreStats { - StoreStats::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "store_id", - StoreStats::get_store_id_for_reflect, - StoreStats::mut_store_id_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "capacity", - StoreStats::get_capacity_for_reflect, - StoreStats::mut_capacity_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "available", - StoreStats::get_available_for_reflect, - StoreStats::mut_available_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( - "region_count", - StoreStats::get_region_count_for_reflect, - StoreStats::mut_region_count_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( - "sending_snap_count", - StoreStats::get_sending_snap_count_for_reflect, - StoreStats::mut_sending_snap_count_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( - "receiving_snap_count", - StoreStats::get_receiving_snap_count_for_reflect, - StoreStats::mut_receiving_snap_count_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( - "start_time", - StoreStats::get_start_time_for_reflect, - StoreStats::mut_start_time_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( - "applying_snap_count", - StoreStats::get_applying_snap_count_for_reflect, - StoreStats::mut_applying_snap_count_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( - "is_busy", - StoreStats::get_is_busy_for_reflect, - StoreStats::mut_is_busy_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "used_size", - StoreStats::get_used_size_for_reflect, - StoreStats::mut_used_size_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "bytes_written", - StoreStats::get_bytes_written_for_reflect, - StoreStats::mut_bytes_written_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "keys_written", - StoreStats::get_keys_written_for_reflect, - StoreStats::mut_keys_written_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "bytes_read", - StoreStats::get_bytes_read_for_reflect, - StoreStats::mut_bytes_read_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "keys_read", - StoreStats::get_keys_read_for_reflect, - StoreStats::mut_keys_read_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "StoreStats", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for StoreStats { - fn clear(&mut self) { - self.clear_store_id(); - self.clear_capacity(); - self.clear_available(); - self.clear_region_count(); - self.clear_sending_snap_count(); - self.clear_receiving_snap_count(); - self.clear_start_time(); - self.clear_applying_snap_count(); - self.clear_is_busy(); - self.clear_used_size(); - self.clear_bytes_written(); - self.clear_keys_written(); - self.clear_bytes_read(); - self.clear_keys_read(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for StoreStats { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StoreStats { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct StoreHeartbeatRequest { - // message fields - pub header: ::protobuf::SingularPtrField, - pub stats: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for StoreHeartbeatRequest {} - -impl StoreHeartbeatRequest { - pub fn new() -> StoreHeartbeatRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static StoreHeartbeatRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const StoreHeartbeatRequest, - }; - unsafe { - instance.get(StoreHeartbeatRequest::new) - } - } - - // .pdpb.RequestHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: RequestHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut RequestHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> RequestHeader { - self.header.take().unwrap_or_else(|| RequestHeader::new()) - } - - pub fn get_header(&self) -> &RequestHeader { - self.header.as_ref().unwrap_or_else(|| RequestHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } - - // .pdpb.StoreStats stats = 2; - - pub fn clear_stats(&mut self) { - self.stats.clear(); - } - - pub fn has_stats(&self) -> bool { - self.stats.is_some() - } - - // Param is passed by value, moved - pub fn set_stats(&mut self, v: StoreStats) { - self.stats = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_stats(&mut self) -> &mut StoreStats { - if self.stats.is_none() { - self.stats.set_default(); - } - self.stats.as_mut().unwrap() - } - - // Take field - pub fn take_stats(&mut self) -> StoreStats { - self.stats.take().unwrap_or_else(|| StoreStats::new()) - } - - pub fn get_stats(&self) -> &StoreStats { - self.stats.as_ref().unwrap_or_else(|| StoreStats::default_instance()) - } - - fn get_stats_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.stats - } - - fn mut_stats_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.stats - } -} - -impl ::protobuf::Message for StoreHeartbeatRequest { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - for v in &self.stats { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.stats)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.stats.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.stats.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for StoreHeartbeatRequest { - fn new() -> StoreHeartbeatRequest { - StoreHeartbeatRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - StoreHeartbeatRequest::get_header_for_reflect, - StoreHeartbeatRequest::mut_header_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "stats", - StoreHeartbeatRequest::get_stats_for_reflect, - StoreHeartbeatRequest::mut_stats_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "StoreHeartbeatRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for StoreHeartbeatRequest { - fn clear(&mut self) { - self.clear_header(); - self.clear_stats(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for StoreHeartbeatRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StoreHeartbeatRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct StoreHeartbeatResponse { - // message fields - pub header: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for StoreHeartbeatResponse {} - -impl StoreHeartbeatResponse { - pub fn new() -> StoreHeartbeatResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static StoreHeartbeatResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const StoreHeartbeatResponse, - }; - unsafe { - instance.get(StoreHeartbeatResponse::new) - } - } - - // .pdpb.ResponseHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: ResponseHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut ResponseHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> ResponseHeader { - self.header.take().unwrap_or_else(|| ResponseHeader::new()) - } - - pub fn get_header(&self) -> &ResponseHeader { - self.header.as_ref().unwrap_or_else(|| ResponseHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } -} - -impl ::protobuf::Message for StoreHeartbeatResponse { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for StoreHeartbeatResponse { - fn new() -> StoreHeartbeatResponse { - StoreHeartbeatResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - StoreHeartbeatResponse::get_header_for_reflect, - StoreHeartbeatResponse::mut_header_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "StoreHeartbeatResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for StoreHeartbeatResponse { - fn clear(&mut self) { - self.clear_header(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for StoreHeartbeatResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StoreHeartbeatResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum ErrorType { - OK = 0, - UNKNOWN = 1, - NOT_BOOTSTRAPPED = 2, - STORE_TOMBSTONE = 3, - ALREADY_BOOTSTRAPPED = 4, -} - -impl ::protobuf::ProtobufEnum for ErrorType { - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(ErrorType::OK), - 1 => ::std::option::Option::Some(ErrorType::UNKNOWN), - 2 => ::std::option::Option::Some(ErrorType::NOT_BOOTSTRAPPED), - 3 => ::std::option::Option::Some(ErrorType::STORE_TOMBSTONE), - 4 => ::std::option::Option::Some(ErrorType::ALREADY_BOOTSTRAPPED), - _ => ::std::option::Option::None - } - } - - fn values() -> &'static [Self] { - static values: &'static [ErrorType] = &[ - ErrorType::OK, - ErrorType::UNKNOWN, - ErrorType::NOT_BOOTSTRAPPED, - ErrorType::STORE_TOMBSTONE, - ErrorType::ALREADY_BOOTSTRAPPED, - ]; - values - } - - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, - }; - unsafe { - descriptor.get(|| { - ::protobuf::reflect::EnumDescriptor::new("ErrorType", file_descriptor_proto()) - }) - } - } -} - -impl ::std::marker::Copy for ErrorType { -} - -impl ::std::default::Default for ErrorType { - fn default() -> Self { - ErrorType::OK - } -} - -impl ::protobuf::reflect::ProtobufValue for ErrorType { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) - } -} - -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum ConfChangeType { - AddNode = 0, - RemoveNode = 1, -} - -impl ::protobuf::ProtobufEnum for ConfChangeType { - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(ConfChangeType::AddNode), - 1 => ::std::option::Option::Some(ConfChangeType::RemoveNode), - _ => ::std::option::Option::None - } - } - - fn values() -> &'static [Self] { - static values: &'static [ConfChangeType] = &[ - ConfChangeType::AddNode, - ConfChangeType::RemoveNode, - ]; - values - } - - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, - }; - unsafe { - descriptor.get(|| { - ::protobuf::reflect::EnumDescriptor::new("ConfChangeType", file_descriptor_proto()) - }) - } - } -} - -impl ::std::marker::Copy for ConfChangeType { -} - -impl ::std::default::Default for ConfChangeType { - fn default() -> Self { - ConfChangeType::AddNode - } -} - -impl ::protobuf::reflect::ProtobufValue for ConfChangeType { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\npdpb.proto\x12\x04pdpb\x1a\x0cmetapb.proto\x1a\x14gogoproto/gogo.pro\ - to\".\n\rRequestHeader\x12\x1d\n\ncluster_id\x18\x01\x20\x01(\x04R\tclus\ - terId\"R\n\x0eResponseHeader\x12\x1d\n\ncluster_id\x18\x01\x20\x01(\x04R\ - \tclusterId\x12!\n\x05error\x18\x02\x20\x01(\x0b2\x0b.pdpb.ErrorR\x05err\ - or\"F\n\x05Error\x12#\n\x04type\x18\x01\x20\x01(\x0e2\x0f.pdpb.ErrorType\ - R\x04type\x12\x18\n\x07message\x18\x02\x20\x01(\tR\x07message\"O\n\nTsoR\ - equest\x12+\n\x06header\x18\x01\x20\x01(\x0b2\x13.pdpb.RequestHeaderR\ - \x06header\x12\x14\n\x05count\x18\x02\x20\x01(\rR\x05count\"A\n\tTimesta\ - mp\x12\x1a\n\x08physical\x18\x01\x20\x01(\x03R\x08physical\x12\x18\n\x07\ - logical\x18\x02\x20\x01(\x03R\x07logical\"\x80\x01\n\x0bTsoResponse\x12,\ - \n\x06header\x18\x01\x20\x01(\x0b2\x14.pdpb.ResponseHeaderR\x06header\ - \x12\x14\n\x05count\x18\x02\x20\x01(\rR\x05count\x12-\n\ttimestamp\x18\ - \x03\x20\x01(\x0b2\x0f.pdpb.TimestampR\ttimestamp\"\x8c\x01\n\x10Bootstr\ - apRequest\x12+\n\x06header\x18\x01\x20\x01(\x0b2\x13.pdpb.RequestHeaderR\ - \x06header\x12#\n\x05store\x18\x02\x20\x01(\x0b2\r.metapb.StoreR\x05stor\ - e\x12&\n\x06region\x18\x03\x20\x01(\x0b2\x0e.metapb.RegionR\x06region\"A\ - \n\x11BootstrapResponse\x12,\n\x06header\x18\x01\x20\x01(\x0b2\x14.pdpb.\ - ResponseHeaderR\x06header\"D\n\x15IsBootstrappedRequest\x12+\n\x06header\ - \x18\x01\x20\x01(\x0b2\x13.pdpb.RequestHeaderR\x06header\"j\n\x16IsBoots\ - trappedResponse\x12,\n\x06header\x18\x01\x20\x01(\x0b2\x14.pdpb.Response\ - HeaderR\x06header\x12\"\n\x0cbootstrapped\x18\x02\x20\x01(\x08R\x0cboots\ - trapped\"=\n\x0eAllocIDRequest\x12+\n\x06header\x18\x01\x20\x01(\x0b2\ - \x13.pdpb.RequestHeaderR\x06header\"O\n\x0fAllocIDResponse\x12,\n\x06hea\ - der\x18\x01\x20\x01(\x0b2\x14.pdpb.ResponseHeaderR\x06header\x12\x0e\n\ - \x02id\x18\x02\x20\x01(\x04R\x02id\"Y\n\x0fGetStoreRequest\x12+\n\x06hea\ - der\x18\x01\x20\x01(\x0b2\x13.pdpb.RequestHeaderR\x06header\x12\x19\n\ - \x08store_id\x18\x02\x20\x01(\x04R\x07storeId\"e\n\x10GetStoreResponse\ - \x12,\n\x06header\x18\x01\x20\x01(\x0b2\x14.pdpb.ResponseHeaderR\x06head\ - er\x12#\n\x05store\x18\x02\x20\x01(\x0b2\r.metapb.StoreR\x05store\"c\n\ - \x0fPutStoreRequest\x12+\n\x06header\x18\x01\x20\x01(\x0b2\x13.pdpb.Requ\ - estHeaderR\x06header\x12#\n\x05store\x18\x02\x20\x01(\x0b2\r.metapb.Stor\ - eR\x05store\"@\n\x10PutStoreResponse\x12,\n\x06header\x18\x01\x20\x01(\ - \x0b2\x14.pdpb.ResponseHeaderR\x06header\"^\n\x10GetRegionRequest\x12+\n\ - \x06header\x18\x01\x20\x01(\x0b2\x13.pdpb.RequestHeaderR\x06header\x12\ - \x1d\n\nregion_key\x18\x02\x20\x01(\x0cR\tregionKey\"\x8f\x01\n\x11GetRe\ - gionResponse\x12,\n\x06header\x18\x01\x20\x01(\x0b2\x14.pdpb.ResponseHea\ - derR\x06header\x12&\n\x06region\x18\x02\x20\x01(\x0b2\x0e.metapb.RegionR\ - \x06region\x12$\n\x06leader\x18\x03\x20\x01(\x0b2\x0c.metapb.PeerR\x06le\ - ader\"`\n\x14GetRegionByIDRequest\x12+\n\x06header\x18\x01\x20\x01(\x0b2\ - \x13.pdpb.RequestHeaderR\x06header\x12\x1b\n\tregion_id\x18\x02\x20\x01(\ - \x04R\x08regionId\"F\n\x17GetClusterConfigRequest\x12+\n\x06header\x18\ - \x01\x20\x01(\x0b2\x13.pdpb.RequestHeaderR\x06header\"s\n\x18GetClusterC\ - onfigResponse\x12,\n\x06header\x18\x01\x20\x01(\x0b2\x14.pdpb.ResponseHe\ - aderR\x06header\x12)\n\x07cluster\x18\x02\x20\x01(\x0b2\x0f.metapb.Clust\ - erR\x07cluster\"q\n\x17PutClusterConfigRequest\x12+\n\x06header\x18\x01\ - \x20\x01(\x0b2\x13.pdpb.RequestHeaderR\x06header\x12)\n\x07cluster\x18\ - \x02\x20\x01(\x0b2\x0f.metapb.ClusterR\x07cluster\"H\n\x18PutClusterConf\ - igResponse\x12,\n\x06header\x18\x01\x20\x01(\x0b2\x14.pdpb.ResponseHeade\ - rR\x06header\"w\n\x06Member\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04nam\ - e\x12\x1b\n\tmember_id\x18\x02\x20\x01(\x04R\x08memberId\x12\x1b\n\tpeer\ - _urls\x18\x03\x20\x03(\tR\x08peerUrls\x12\x1f\n\x0bclient_urls\x18\x04\ - \x20\x03(\tR\nclientUrls\"@\n\x11GetMembersRequest\x12+\n\x06header\x18\ - \x01\x20\x01(\x0b2\x13.pdpb.RequestHeaderR\x06header\"\x90\x01\n\x12GetM\ - embersResponse\x12,\n\x06header\x18\x01\x20\x01(\x0b2\x14.pdpb.ResponseH\ - eaderR\x06header\x12&\n\x07members\x18\x02\x20\x03(\x0b2\x0c.pdpb.Member\ - R\x07members\x12$\n\x06leader\x18\x03\x20\x01(\x0b2\x0c.pdpb.MemberR\x06\ - leader\"P\n\tPeerStats\x12\x20\n\x04peer\x18\x01\x20\x01(\x0b2\x0c.metap\ - b.PeerR\x04peer\x12!\n\x0cdown_seconds\x18\x02\x20\x01(\x04R\x0bdownSeco\ - nds\"\xa5\x03\n\x16RegionHeartbeatRequest\x12+\n\x06header\x18\x01\x20\ - \x01(\x0b2\x13.pdpb.RequestHeaderR\x06header\x12&\n\x06region\x18\x02\ - \x20\x01(\x0b2\x0e.metapb.RegionR\x06region\x12$\n\x06leader\x18\x03\x20\ - \x01(\x0b2\x0c.metapb.PeerR\x06leader\x12.\n\ndown_peers\x18\x04\x20\x03\ - (\x0b2\x0f.pdpb.PeerStatsR\tdownPeers\x121\n\rpending_peers\x18\x05\x20\ - \x03(\x0b2\x0c.metapb.PeerR\x0cpendingPeers\x12#\n\rbytes_written\x18\ - \x06\x20\x01(\x04R\x0cbytesWritten\x12\x1d\n\nbytes_read\x18\x07\x20\x01\ - (\x04R\tbytesRead\x12!\n\x0ckeys_written\x18\x08\x20\x01(\x04R\x0bkeysWr\ - itten\x12\x1b\n\tkeys_read\x18\t\x20\x01(\x04R\x08keysRead\x12)\n\x10app\ - roximate_size\x18\n\x20\x01(\x04R\x0fapproximateSize\"e\n\nChangePeer\ - \x12\x20\n\x04peer\x18\x01\x20\x01(\x0b2\x0c.metapb.PeerR\x04peer\x125\n\ - \x0bchange_type\x18\x02\x20\x01(\x0e2\x14.pdpb.ConfChangeTypeR\nchangeTy\ - pe\"2\n\x0eTransferLeader\x12\x20\n\x04peer\x18\x01\x20\x01(\x0b2\x0c.me\ - tapb.PeerR\x04peer\"\xbd\x02\n\x17RegionHeartbeatResponse\x12,\n\x06head\ - er\x18\x01\x20\x01(\x0b2\x14.pdpb.ResponseHeaderR\x06header\x121\n\x0bch\ - ange_peer\x18\x02\x20\x01(\x0b2\x10.pdpb.ChangePeerR\nchangePeer\x12=\n\ - \x0ftransfer_leader\x18\x03\x20\x01(\x0b2\x14.pdpb.TransferLeaderR\x0etr\ - ansferLeader\x12\x1b\n\tregion_id\x18\x04\x20\x01(\x04R\x08regionId\x126\ - \n\x0cregion_epoch\x18\x05\x20\x01(\x0b2\x13.metapb.RegionEpochR\x0bregi\ - onEpoch\x12-\n\x0btarget_peer\x18\x06\x20\x01(\x0b2\x0c.metapb.PeerR\nta\ - rgetPeer\"f\n\x0fAskSplitRequest\x12+\n\x06header\x18\x01\x20\x01(\x0b2\ - \x13.pdpb.RequestHeaderR\x06header\x12&\n\x06region\x18\x02\x20\x01(\x0b\ - 2\x0e.metapb.RegionR\x06region\"\x86\x01\n\x10AskSplitResponse\x12,\n\ - \x06header\x18\x01\x20\x01(\x0b2\x14.pdpb.ResponseHeaderR\x06header\x12\ - \"\n\rnew_region_id\x18\x02\x20\x01(\x04R\x0bnewRegionId\x12\x20\n\x0cne\ - w_peer_ids\x18\x03\x20\x03(\x04R\nnewPeerIds\"\x8b\x01\n\x12ReportSplitR\ - equest\x12+\n\x06header\x18\x01\x20\x01(\x0b2\x13.pdpb.RequestHeaderR\ - \x06header\x12\"\n\x04left\x18\x02\x20\x01(\x0b2\x0e.metapb.RegionR\x04l\ - eft\x12$\n\x05right\x18\x03\x20\x01(\x0b2\x0e.metapb.RegionR\x05right\"C\ - \n\x13ReportSplitResponse\x12,\n\x06header\x18\x01\x20\x01(\x0b2\x14.pdp\ - b.ResponseHeaderR\x06header\"\xed\x03\n\nStoreStats\x12\x19\n\x08store_i\ - d\x18\x01\x20\x01(\x04R\x07storeId\x12\x1a\n\x08capacity\x18\x02\x20\x01\ - (\x04R\x08capacity\x12\x1c\n\tavailable\x18\x03\x20\x01(\x04R\tavailable\ - \x12!\n\x0cregion_count\x18\x04\x20\x01(\rR\x0bregionCount\x12,\n\x12sen\ - ding_snap_count\x18\x05\x20\x01(\rR\x10sendingSnapCount\x120\n\x14receiv\ - ing_snap_count\x18\x06\x20\x01(\rR\x12receivingSnapCount\x12\x1d\n\nstar\ - t_time\x18\x07\x20\x01(\rR\tstartTime\x12.\n\x13applying_snap_count\x18\ - \x08\x20\x01(\rR\x11applyingSnapCount\x12\x17\n\x07is_busy\x18\t\x20\x01\ - (\x08R\x06isBusy\x12\x1b\n\tused_size\x18\n\x20\x01(\x04R\x08usedSize\ - \x12#\n\rbytes_written\x18\x0b\x20\x01(\x04R\x0cbytesWritten\x12!\n\x0ck\ - eys_written\x18\x0c\x20\x01(\x04R\x0bkeysWritten\x12\x1d\n\nbytes_read\ - \x18\r\x20\x01(\x04R\tbytesRead\x12\x1b\n\tkeys_read\x18\x0e\x20\x01(\ - \x04R\x08keysRead\"l\n\x15StoreHeartbeatRequest\x12+\n\x06header\x18\x01\ - \x20\x01(\x0b2\x13.pdpb.RequestHeaderR\x06header\x12&\n\x05stats\x18\x02\ - \x20\x01(\x0b2\x10.pdpb.StoreStatsR\x05stats\"F\n\x16StoreHeartbeatRespo\ - nse\x12,\n\x06header\x18\x01\x20\x01(\x0b2\x14.pdpb.ResponseHeaderR\x06h\ - eader*e\n\tErrorType\x12\x06\n\x02OK\x10\0\x12\x0b\n\x07UNKNOWN\x10\x01\ - \x12\x14\n\x10NOT_BOOTSTRAPPED\x10\x02\x12\x13\n\x0fSTORE_TOMBSTONE\x10\ - \x03\x12\x18\n\x14ALREADY_BOOTSTRAPPED\x10\x04*-\n\x0eConfChangeType\x12\ - \x0b\n\x07AddNode\x10\0\x12\x0e\n\nRemoveNode\x10\x012\x96\x08\n\x02PD\ - \x12A\n\nGetMembers\x12\x17.pdpb.GetMembersRequest\x1a\x18.pdpb.GetMembe\ - rsResponse\"\0\x120\n\x03Tso\x12\x10.pdpb.TsoRequest\x1a\x11.pdpb.TsoRes\ - ponse\"\0(\x010\x01\x12>\n\tBootstrap\x12\x16.pdpb.BootstrapRequest\x1a\ - \x17.pdpb.BootstrapResponse\"\0\x12M\n\x0eIsBootstrapped\x12\x1b.pdpb.Is\ - BootstrappedRequest\x1a\x1c.pdpb.IsBootstrappedResponse\"\0\x128\n\x07Al\ - locID\x12\x14.pdpb.AllocIDRequest\x1a\x15.pdpb.AllocIDResponse\"\0\x12;\ - \n\x08GetStore\x12\x15.pdpb.GetStoreRequest\x1a\x16.pdpb.GetStoreRespons\ - e\"\0\x12;\n\x08PutStore\x12\x15.pdpb.PutStoreRequest\x1a\x16.pdpb.PutSt\ - oreResponse\"\0\x12M\n\x0eStoreHeartbeat\x12\x1b.pdpb.StoreHeartbeatRequ\ - est\x1a\x1c.pdpb.StoreHeartbeatResponse\"\0\x12T\n\x0fRegionHeartbeat\ - \x12\x1c.pdpb.RegionHeartbeatRequest\x1a\x1d.pdpb.RegionHeartbeatRespons\ - e\"\0(\x010\x01\x12>\n\tGetRegion\x12\x16.pdpb.GetRegionRequest\x1a\x17.\ - pdpb.GetRegionResponse\"\0\x12F\n\rGetRegionByID\x12\x1a.pdpb.GetRegionB\ - yIDRequest\x1a\x17.pdpb.GetRegionResponse\"\0\x12;\n\x08AskSplit\x12\x15\ - .pdpb.AskSplitRequest\x1a\x16.pdpb.AskSplitResponse\"\0\x12D\n\x0bReport\ - Split\x12\x18.pdpb.ReportSplitRequest\x1a\x19.pdpb.ReportSplitResponse\"\ - \0\x12S\n\x10GetClusterConfig\x12\x1d.pdpb.GetClusterConfigRequest\x1a\ - \x1e.pdpb.GetClusterConfigResponse\"\0\x12S\n\x10PutClusterConfig\x12\ - \x1d.pdpb.PutClusterConfigRequest\x1a\x1e.pdpb.PutClusterConfigResponse\ - \"\0B&\n\x18com.pingcap.tikv.kvproto\xd0\xe2\x1e\x01\xc8\xe2\x1e\x01\xe0\ - \xe2\x1e\x01J\xa5a\n\x07\x12\x05\0\0\xd4\x02\x01\n\x08\n\x01\x0c\x12\x03\ - \0\0\x12\n\x08\n\x01\x02\x12\x03\x01\x08\x0c\n\t\n\x02\x03\0\x12\x03\x03\ - \x07\x15\n\t\n\x02\x03\x01\x12\x03\x05\x07\x1d\n\x08\n\x01\x08\x12\x03\ - \x07\0$\n\x0b\n\x04\x08\xe7\x07\0\x12\x03\x07\0$\n\x0c\n\x05\x08\xe7\x07\ - \0\x02\x12\x03\x07\x07\x1c\n\r\n\x06\x08\xe7\x07\0\x02\0\x12\x03\x07\x07\ - \x1c\n\x0e\n\x07\x08\xe7\x07\0\x02\0\x01\x12\x03\x07\x08\x1b\n\x0c\n\x05\ - \x08\xe7\x07\0\x03\x12\x03\x07\x1f#\n\x08\n\x01\x08\x12\x03\x08\0(\n\x0b\ - \n\x04\x08\xe7\x07\x01\x12\x03\x08\0(\n\x0c\n\x05\x08\xe7\x07\x01\x02\ - \x12\x03\x08\x07\x20\n\r\n\x06\x08\xe7\x07\x01\x02\0\x12\x03\x08\x07\x20\ - \n\x0e\n\x07\x08\xe7\x07\x01\x02\0\x01\x12\x03\x08\x08\x1f\n\x0c\n\x05\ - \x08\xe7\x07\x01\x03\x12\x03\x08#'\n\x08\n\x01\x08\x12\x03\t\0*\n\x0b\n\ - \x04\x08\xe7\x07\x02\x12\x03\t\0*\n\x0c\n\x05\x08\xe7\x07\x02\x02\x12\ - \x03\t\x07\"\n\r\n\x06\x08\xe7\x07\x02\x02\0\x12\x03\t\x07\"\n\x0e\n\x07\ - \x08\xe7\x07\x02\x02\0\x01\x12\x03\t\x08!\n\x0c\n\x05\x08\xe7\x07\x02\ - \x03\x12\x03\t%)\n\x08\n\x01\x08\x12\x03\x0b\01\n\x0b\n\x04\x08\xe7\x07\ - \x03\x12\x03\x0b\01\n\x0c\n\x05\x08\xe7\x07\x03\x02\x12\x03\x0b\x07\x13\ - \n\r\n\x06\x08\xe7\x07\x03\x02\0\x12\x03\x0b\x07\x13\n\x0e\n\x07\x08\xe7\ - \x07\x03\x02\0\x01\x12\x03\x0b\x07\x13\n\x0c\n\x05\x08\xe7\x07\x03\x07\ - \x12\x03\x0b\x160\n\n\n\x02\x06\0\x12\x04\r\0-\x01\n\n\n\x03\x06\0\x01\ - \x12\x03\r\x08\n\n\x8c\x01\n\x04\x06\0\x02\0\x12\x03\x10\x04E\x1a\x7f\ - \x20GetMembers\x20get\x20the\x20member\x20list\x20of\x20this\x20cluster.\ - \x20It\x20does\x20not\x20require\n\x20the\x20cluster_id\x20in\x20request\ - \x20matchs\x20the\x20id\x20of\x20this\x20cluster.\n\n\x0c\n\x05\x06\0\ - \x02\0\x01\x12\x03\x10\x08\x12\n\x0c\n\x05\x06\0\x02\0\x02\x12\x03\x10\ - \x13$\n\x0c\n\x05\x06\0\x02\0\x03\x12\x03\x10/A\n\x0b\n\x04\x06\0\x02\ - \x01\x12\x03\x12\x04>\n\x0c\n\x05\x06\0\x02\x01\x01\x12\x03\x12\x08\x0b\ - \n\x0c\n\x05\x06\0\x02\x01\x05\x12\x03\x12\x0c\x12\n\x0c\n\x05\x06\0\x02\ - \x01\x02\x12\x03\x12\x13\x1d\n\x0c\n\x05\x06\0\x02\x01\x06\x12\x03\x12(.\ - \n\x0c\n\x05\x06\0\x02\x01\x03\x12\x03\x12/:\n\x0b\n\x04\x06\0\x02\x02\ - \x12\x03\x14\x04B\n\x0c\n\x05\x06\0\x02\x02\x01\x12\x03\x14\x08\x11\n\ - \x0c\n\x05\x06\0\x02\x02\x02\x12\x03\x14\x12\"\n\x0c\n\x05\x06\0\x02\x02\ - \x03\x12\x03\x14->\n\x0b\n\x04\x06\0\x02\x03\x12\x03\x16\x04Q\n\x0c\n\ - \x05\x06\0\x02\x03\x01\x12\x03\x16\x08\x16\n\x0c\n\x05\x06\0\x02\x03\x02\ - \x12\x03\x16\x17,\n\x0c\n\x05\x06\0\x02\x03\x03\x12\x03\x167M\n\x0b\n\ - \x04\x06\0\x02\x04\x12\x03\x18\x04<\n\x0c\n\x05\x06\0\x02\x04\x01\x12\ - \x03\x18\x08\x0f\n\x0c\n\x05\x06\0\x02\x04\x02\x12\x03\x18\x10\x1e\n\x0c\ - \n\x05\x06\0\x02\x04\x03\x12\x03\x18)8\n\x0b\n\x04\x06\0\x02\x05\x12\x03\ - \x1a\x04?\n\x0c\n\x05\x06\0\x02\x05\x01\x12\x03\x1a\x08\x10\n\x0c\n\x05\ - \x06\0\x02\x05\x02\x12\x03\x1a\x11\x20\n\x0c\n\x05\x06\0\x02\x05\x03\x12\ - \x03\x1a+;\n\x0b\n\x04\x06\0\x02\x06\x12\x03\x1c\x04?\n\x0c\n\x05\x06\0\ - \x02\x06\x01\x12\x03\x1c\x08\x10\n\x0c\n\x05\x06\0\x02\x06\x02\x12\x03\ - \x1c\x11\x20\n\x0c\n\x05\x06\0\x02\x06\x03\x12\x03\x1c+;\n\x0b\n\x04\x06\ - \0\x02\x07\x12\x03\x1e\x04Q\n\x0c\n\x05\x06\0\x02\x07\x01\x12\x03\x1e\ - \x08\x16\n\x0c\n\x05\x06\0\x02\x07\x02\x12\x03\x1e\x17,\n\x0c\n\x05\x06\ - \0\x02\x07\x03\x12\x03\x1e7M\n\x0b\n\x04\x06\0\x02\x08\x12\x03\x20\x04b\ - \n\x0c\n\x05\x06\0\x02\x08\x01\x12\x03\x20\x08\x17\n\x0c\n\x05\x06\0\x02\ - \x08\x05\x12\x03\x20\x18\x1e\n\x0c\n\x05\x06\0\x02\x08\x02\x12\x03\x20\ - \x1f5\n\x0c\n\x05\x06\0\x02\x08\x06\x12\x03\x20@F\n\x0c\n\x05\x06\0\x02\ - \x08\x03\x12\x03\x20G^\n\x0b\n\x04\x06\0\x02\t\x12\x03\"\x04B\n\x0c\n\ - \x05\x06\0\x02\t\x01\x12\x03\"\x08\x11\n\x0c\n\x05\x06\0\x02\t\x02\x12\ - \x03\"\x12\"\n\x0c\n\x05\x06\0\x02\t\x03\x12\x03\"->\n\x0b\n\x04\x06\0\ - \x02\n\x12\x03$\x04J\n\x0c\n\x05\x06\0\x02\n\x01\x12\x03$\x08\x15\n\x0c\ - \n\x05\x06\0\x02\n\x02\x12\x03$\x16*\n\x0c\n\x05\x06\0\x02\n\x03\x12\x03\ - $5F\n\x0b\n\x04\x06\0\x02\x0b\x12\x03&\x04?\n\x0c\n\x05\x06\0\x02\x0b\ - \x01\x12\x03&\x08\x10\n\x0c\n\x05\x06\0\x02\x0b\x02\x12\x03&\x11\x20\n\ - \x0c\n\x05\x06\0\x02\x0b\x03\x12\x03&+;\n\x0b\n\x04\x06\0\x02\x0c\x12\ - \x03(\x04H\n\x0c\n\x05\x06\0\x02\x0c\x01\x12\x03(\x08\x13\n\x0c\n\x05\ - \x06\0\x02\x0c\x02\x12\x03(\x14&\n\x0c\n\x05\x06\0\x02\x0c\x03\x12\x03(1\ - D\n\x0b\n\x04\x06\0\x02\r\x12\x03*\x04W\n\x0c\n\x05\x06\0\x02\r\x01\x12\ - \x03*\x08\x18\n\x0c\n\x05\x06\0\x02\r\x02\x12\x03*\x190\n\x0c\n\x05\x06\ - \0\x02\r\x03\x12\x03*;S\n\x0b\n\x04\x06\0\x02\x0e\x12\x03,\x04W\n\x0c\n\ - \x05\x06\0\x02\x0e\x01\x12\x03,\x08\x18\n\x0c\n\x05\x06\0\x02\x0e\x02\ - \x12\x03,\x190\n\x0c\n\x05\x06\0\x02\x0e\x03\x12\x03,;S\n\n\n\x02\x04\0\ - \x12\x04/\02\x01\n\n\n\x03\x04\0\x01\x12\x03/\x08\x15\nD\n\x04\x04\0\x02\ - \0\x12\x031\x04\x1a\x1a7\x20cluster_id\x20is\x20the\x20ID\x20of\x20the\ - \x20cluster\x20which\x20be\x20sent\x20to.\n\n\r\n\x05\x04\0\x02\0\x04\ - \x12\x041\x04/\x17\n\x0c\n\x05\x04\0\x02\0\x05\x12\x031\x04\n\n\x0c\n\ - \x05\x04\0\x02\0\x01\x12\x031\x0b\x15\n\x0c\n\x05\x04\0\x02\0\x03\x12\ - \x031\x18\x19\n\n\n\x02\x04\x01\x12\x044\08\x01\n\n\n\x03\x04\x01\x01\ - \x12\x034\x08\x16\nK\n\x04\x04\x01\x02\0\x12\x036\x04\x1a\x1a>\x20cluste\ - r_id\x20is\x20the\x20ID\x20of\x20the\x20cluster\x20which\x20sent\x20the\ - \x20response.\n\n\r\n\x05\x04\x01\x02\0\x04\x12\x046\x044\x18\n\x0c\n\ - \x05\x04\x01\x02\0\x05\x12\x036\x04\n\n\x0c\n\x05\x04\x01\x02\0\x01\x12\ - \x036\x0b\x15\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x036\x18\x19\n\x0b\n\x04\ - \x04\x01\x02\x01\x12\x037\x04\x14\n\r\n\x05\x04\x01\x02\x01\x04\x12\x047\ - \x046\x1a\n\x0c\n\x05\x04\x01\x02\x01\x06\x12\x037\x04\t\n\x0c\n\x05\x04\ - \x01\x02\x01\x01\x12\x037\n\x0f\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x037\ - \x12\x13\n\n\n\x02\x05\0\x12\x04:\0@\x01\n\n\n\x03\x05\0\x01\x12\x03:\ - \x05\x0e\n\x0b\n\x04\x05\0\x02\0\x12\x03;\x04\x0b\n\x0c\n\x05\x05\0\x02\ - \0\x01\x12\x03;\x04\x06\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03;\t\n\n\x0b\n\ - \x04\x05\0\x02\x01\x12\x03<\x04\x10\n\x0c\n\x05\x05\0\x02\x01\x01\x12\ - \x03<\x04\x0b\n\x0c\n\x05\x05\0\x02\x01\x02\x12\x03<\x0e\x0f\n\x0b\n\x04\ - \x05\0\x02\x02\x12\x03=\x04\x19\n\x0c\n\x05\x05\0\x02\x02\x01\x12\x03=\ - \x04\x14\n\x0c\n\x05\x05\0\x02\x02\x02\x12\x03=\x17\x18\n\x0b\n\x04\x05\ - \0\x02\x03\x12\x03>\x04\x18\n\x0c\n\x05\x05\0\x02\x03\x01\x12\x03>\x04\ - \x13\n\x0c\n\x05\x05\0\x02\x03\x02\x12\x03>\x16\x17\n\x0b\n\x04\x05\0\ - \x02\x04\x12\x03?\x04\x1d\n\x0c\n\x05\x05\0\x02\x04\x01\x12\x03?\x04\x18\ - \n\x0c\n\x05\x05\0\x02\x04\x02\x12\x03?\x1b\x1c\n\n\n\x02\x04\x02\x12\ - \x04B\0E\x01\n\n\n\x03\x04\x02\x01\x12\x03B\x08\r\n\x0b\n\x04\x04\x02\ - \x02\0\x12\x03C\x04\x17\n\r\n\x05\x04\x02\x02\0\x04\x12\x04C\x04B\x0f\n\ - \x0c\n\x05\x04\x02\x02\0\x06\x12\x03C\x04\r\n\x0c\n\x05\x04\x02\x02\0\ - \x01\x12\x03C\x0e\x12\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03C\x15\x16\n\ - \x0b\n\x04\x04\x02\x02\x01\x12\x03D\x04\x17\n\r\n\x05\x04\x02\x02\x01\ - \x04\x12\x04D\x04C\x17\n\x0c\n\x05\x04\x02\x02\x01\x05\x12\x03D\x04\n\n\ - \x0c\n\x05\x04\x02\x02\x01\x01\x12\x03D\x0b\x12\n\x0c\n\x05\x04\x02\x02\ - \x01\x03\x12\x03D\x15\x16\n\n\n\x02\x04\x03\x12\x04G\0K\x01\n\n\n\x03\ - \x04\x03\x01\x12\x03G\x08\x12\n\x0b\n\x04\x04\x03\x02\0\x12\x03H\x04\x1d\ - \n\r\n\x05\x04\x03\x02\0\x04\x12\x04H\x04G\x14\n\x0c\n\x05\x04\x03\x02\0\ - \x06\x12\x03H\x04\x11\n\x0c\n\x05\x04\x03\x02\0\x01\x12\x03H\x12\x18\n\ - \x0c\n\x05\x04\x03\x02\0\x03\x12\x03H\x1b\x1c\n\x0b\n\x04\x04\x03\x02\ - \x01\x12\x03J\x04\x15\n\r\n\x05\x04\x03\x02\x01\x04\x12\x04J\x04H\x1d\n\ - \x0c\n\x05\x04\x03\x02\x01\x05\x12\x03J\x04\n\n\x0c\n\x05\x04\x03\x02\ - \x01\x01\x12\x03J\x0b\x10\n\x0c\n\x05\x04\x03\x02\x01\x03\x12\x03J\x13\ - \x14\n\n\n\x02\x04\x04\x12\x04M\0P\x01\n\n\n\x03\x04\x04\x01\x12\x03M\ - \x08\x11\n\x0b\n\x04\x04\x04\x02\0\x12\x03N\x04\x17\n\r\n\x05\x04\x04\ - \x02\0\x04\x12\x04N\x04M\x13\n\x0c\n\x05\x04\x04\x02\0\x05\x12\x03N\x04\ - \t\n\x0c\n\x05\x04\x04\x02\0\x01\x12\x03N\n\x12\n\x0c\n\x05\x04\x04\x02\ - \0\x03\x12\x03N\x15\x16\n\x0b\n\x04\x04\x04\x02\x01\x12\x03O\x04\x16\n\r\ - \n\x05\x04\x04\x02\x01\x04\x12\x04O\x04N\x17\n\x0c\n\x05\x04\x04\x02\x01\ - \x05\x12\x03O\x04\t\n\x0c\n\x05\x04\x04\x02\x01\x01\x12\x03O\n\x11\n\x0c\ - \n\x05\x04\x04\x02\x01\x03\x12\x03O\x14\x15\n\n\n\x02\x04\x05\x12\x04R\0\ - W\x01\n\n\n\x03\x04\x05\x01\x12\x03R\x08\x13\n\x0b\n\x04\x04\x05\x02\0\ - \x12\x03S\x04\x1e\n\r\n\x05\x04\x05\x02\0\x04\x12\x04S\x04R\x15\n\x0c\n\ - \x05\x04\x05\x02\0\x06\x12\x03S\x04\x12\n\x0c\n\x05\x04\x05\x02\0\x01\ - \x12\x03S\x13\x19\n\x0c\n\x05\x04\x05\x02\0\x03\x12\x03S\x1c\x1d\n\x0b\n\ - \x04\x04\x05\x02\x01\x12\x03U\x04\x15\n\r\n\x05\x04\x05\x02\x01\x04\x12\ - \x04U\x04S\x1e\n\x0c\n\x05\x04\x05\x02\x01\x05\x12\x03U\x04\n\n\x0c\n\ - \x05\x04\x05\x02\x01\x01\x12\x03U\x0b\x10\n\x0c\n\x05\x04\x05\x02\x01\ - \x03\x12\x03U\x13\x14\n\x0b\n\x04\x04\x05\x02\x02\x12\x03V\x04\x1c\n\r\n\ - \x05\x04\x05\x02\x02\x04\x12\x04V\x04U\x15\n\x0c\n\x05\x04\x05\x02\x02\ - \x06\x12\x03V\x04\r\n\x0c\n\x05\x04\x05\x02\x02\x01\x12\x03V\x0e\x17\n\ - \x0c\n\x05\x04\x05\x02\x02\x03\x12\x03V\x1a\x1b\n\n\n\x02\x04\x06\x12\ - \x04Y\0^\x01\n\n\n\x03\x04\x06\x01\x12\x03Y\x08\x18\n\x0b\n\x04\x04\x06\ - \x02\0\x12\x03Z\x04\x1d\n\r\n\x05\x04\x06\x02\0\x04\x12\x04Z\x04Y\x1a\n\ - \x0c\n\x05\x04\x06\x02\0\x06\x12\x03Z\x04\x11\n\x0c\n\x05\x04\x06\x02\0\ - \x01\x12\x03Z\x12\x18\n\x0c\n\x05\x04\x06\x02\0\x03\x12\x03Z\x1b\x1c\n\ - \x0b\n\x04\x04\x06\x02\x01\x12\x03\\\x04\x1b\n\r\n\x05\x04\x06\x02\x01\ - \x04\x12\x04\\\x04Z\x1d\n\x0c\n\x05\x04\x06\x02\x01\x06\x12\x03\\\x04\ - \x10\n\x0c\n\x05\x04\x06\x02\x01\x01\x12\x03\\\x11\x16\n\x0c\n\x05\x04\ - \x06\x02\x01\x03\x12\x03\\\x19\x1a\n\x0b\n\x04\x04\x06\x02\x02\x12\x03]\ - \x04\x1d\n\r\n\x05\x04\x06\x02\x02\x04\x12\x04]\x04\\\x1b\n\x0c\n\x05\ - \x04\x06\x02\x02\x06\x12\x03]\x04\x11\n\x0c\n\x05\x04\x06\x02\x02\x01\ - \x12\x03]\x12\x18\n\x0c\n\x05\x04\x06\x02\x02\x03\x12\x03]\x1b\x1c\n\n\n\ - \x02\x04\x07\x12\x04`\0b\x01\n\n\n\x03\x04\x07\x01\x12\x03`\x08\x19\n\ - \x0b\n\x04\x04\x07\x02\0\x12\x03a\x04\x1e\n\r\n\x05\x04\x07\x02\0\x04\ - \x12\x04a\x04`\x1b\n\x0c\n\x05\x04\x07\x02\0\x06\x12\x03a\x04\x12\n\x0c\ - \n\x05\x04\x07\x02\0\x01\x12\x03a\x13\x19\n\x0c\n\x05\x04\x07\x02\0\x03\ - \x12\x03a\x1c\x1d\n\n\n\x02\x04\x08\x12\x04d\0f\x01\n\n\n\x03\x04\x08\ - \x01\x12\x03d\x08\x1d\n\x0b\n\x04\x04\x08\x02\0\x12\x03e\x04\x1d\n\r\n\ - \x05\x04\x08\x02\0\x04\x12\x04e\x04d\x1f\n\x0c\n\x05\x04\x08\x02\0\x06\ - \x12\x03e\x04\x11\n\x0c\n\x05\x04\x08\x02\0\x01\x12\x03e\x12\x18\n\x0c\n\ - \x05\x04\x08\x02\0\x03\x12\x03e\x1b\x1c\n\n\n\x02\x04\t\x12\x04h\0l\x01\ - \n\n\n\x03\x04\t\x01\x12\x03h\x08\x1e\n\x0b\n\x04\x04\t\x02\0\x12\x03i\ - \x04\x1e\n\r\n\x05\x04\t\x02\0\x04\x12\x04i\x04h\x20\n\x0c\n\x05\x04\t\ - \x02\0\x06\x12\x03i\x04\x12\n\x0c\n\x05\x04\t\x02\0\x01\x12\x03i\x13\x19\ - \n\x0c\n\x05\x04\t\x02\0\x03\x12\x03i\x1c\x1d\n\x0b\n\x04\x04\t\x02\x01\ - \x12\x03k\x04\x1a\n\r\n\x05\x04\t\x02\x01\x04\x12\x04k\x04i\x1e\n\x0c\n\ - \x05\x04\t\x02\x01\x05\x12\x03k\x04\x08\n\x0c\n\x05\x04\t\x02\x01\x01\ - \x12\x03k\t\x15\n\x0c\n\x05\x04\t\x02\x01\x03\x12\x03k\x18\x19\n\n\n\x02\ - \x04\n\x12\x04n\0p\x01\n\n\n\x03\x04\n\x01\x12\x03n\x08\x16\n\x0b\n\x04\ - \x04\n\x02\0\x12\x03o\x04\x1d\n\r\n\x05\x04\n\x02\0\x04\x12\x04o\x04n\ - \x18\n\x0c\n\x05\x04\n\x02\0\x06\x12\x03o\x04\x11\n\x0c\n\x05\x04\n\x02\ - \0\x01\x12\x03o\x12\x18\n\x0c\n\x05\x04\n\x02\0\x03\x12\x03o\x1b\x1c\n\n\ - \n\x02\x04\x0b\x12\x04r\0v\x01\n\n\n\x03\x04\x0b\x01\x12\x03r\x08\x17\n\ - \x0b\n\x04\x04\x0b\x02\0\x12\x03s\x04\x1e\n\r\n\x05\x04\x0b\x02\0\x04\ - \x12\x04s\x04r\x19\n\x0c\n\x05\x04\x0b\x02\0\x06\x12\x03s\x04\x12\n\x0c\ - \n\x05\x04\x0b\x02\0\x01\x12\x03s\x13\x19\n\x0c\n\x05\x04\x0b\x02\0\x03\ - \x12\x03s\x1c\x1d\n\x0b\n\x04\x04\x0b\x02\x01\x12\x03u\x04\x12\n\r\n\x05\ - \x04\x0b\x02\x01\x04\x12\x04u\x04s\x1e\n\x0c\n\x05\x04\x0b\x02\x01\x05\ - \x12\x03u\x04\n\n\x0c\n\x05\x04\x0b\x02\x01\x01\x12\x03u\x0b\r\n\x0c\n\ - \x05\x04\x0b\x02\x01\x03\x12\x03u\x10\x11\n\n\n\x02\x04\x0c\x12\x04x\0|\ - \x01\n\n\n\x03\x04\x0c\x01\x12\x03x\x08\x17\n\x0b\n\x04\x04\x0c\x02\0\ - \x12\x03y\x04\x1d\n\r\n\x05\x04\x0c\x02\0\x04\x12\x04y\x04x\x19\n\x0c\n\ - \x05\x04\x0c\x02\0\x06\x12\x03y\x04\x11\n\x0c\n\x05\x04\x0c\x02\0\x01\ - \x12\x03y\x12\x18\n\x0c\n\x05\x04\x0c\x02\0\x03\x12\x03y\x1b\x1c\n\x0b\n\ - \x04\x04\x0c\x02\x01\x12\x03{\x04\x18\n\r\n\x05\x04\x0c\x02\x01\x04\x12\ - \x04{\x04y\x1d\n\x0c\n\x05\x04\x0c\x02\x01\x05\x12\x03{\x04\n\n\x0c\n\ - \x05\x04\x0c\x02\x01\x01\x12\x03{\x0b\x13\n\x0c\n\x05\x04\x0c\x02\x01\ - \x03\x12\x03{\x16\x17\n\x0b\n\x02\x04\r\x12\x05~\0\x82\x01\x01\n\n\n\x03\ - \x04\r\x01\x12\x03~\x08\x18\n\x0b\n\x04\x04\r\x02\0\x12\x03\x7f\x04\x1e\ - \n\r\n\x05\x04\r\x02\0\x04\x12\x04\x7f\x04~\x1a\n\x0c\n\x05\x04\r\x02\0\ - \x06\x12\x03\x7f\x04\x12\n\x0c\n\x05\x04\r\x02\0\x01\x12\x03\x7f\x13\x19\ - \n\x0c\n\x05\x04\r\x02\0\x03\x12\x03\x7f\x1c\x1d\n\x0c\n\x04\x04\r\x02\ - \x01\x12\x04\x81\x01\x04\x1b\n\x0e\n\x05\x04\r\x02\x01\x04\x12\x05\x81\ - \x01\x04\x7f\x1e\n\r\n\x05\x04\r\x02\x01\x06\x12\x04\x81\x01\x04\x10\n\r\ - \n\x05\x04\r\x02\x01\x01\x12\x04\x81\x01\x11\x16\n\r\n\x05\x04\r\x02\x01\ - \x03\x12\x04\x81\x01\x19\x1a\n\x0c\n\x02\x04\x0e\x12\x06\x84\x01\0\x88\ - \x01\x01\n\x0b\n\x03\x04\x0e\x01\x12\x04\x84\x01\x08\x17\n\x0c\n\x04\x04\ - \x0e\x02\0\x12\x04\x85\x01\x04\x1d\n\x0f\n\x05\x04\x0e\x02\0\x04\x12\x06\ - \x85\x01\x04\x84\x01\x19\n\r\n\x05\x04\x0e\x02\0\x06\x12\x04\x85\x01\x04\ - \x11\n\r\n\x05\x04\x0e\x02\0\x01\x12\x04\x85\x01\x12\x18\n\r\n\x05\x04\ - \x0e\x02\0\x03\x12\x04\x85\x01\x1b\x1c\n\x0c\n\x04\x04\x0e\x02\x01\x12\ - \x04\x87\x01\x04\x1b\n\x0f\n\x05\x04\x0e\x02\x01\x04\x12\x06\x87\x01\x04\ - \x85\x01\x1d\n\r\n\x05\x04\x0e\x02\x01\x06\x12\x04\x87\x01\x04\x10\n\r\n\ - \x05\x04\x0e\x02\x01\x01\x12\x04\x87\x01\x11\x16\n\r\n\x05\x04\x0e\x02\ - \x01\x03\x12\x04\x87\x01\x19\x1a\n\x0c\n\x02\x04\x0f\x12\x06\x8a\x01\0\ - \x8c\x01\x01\n\x0b\n\x03\x04\x0f\x01\x12\x04\x8a\x01\x08\x18\n\x0c\n\x04\ - \x04\x0f\x02\0\x12\x04\x8b\x01\x04\x1e\n\x0f\n\x05\x04\x0f\x02\0\x04\x12\ - \x06\x8b\x01\x04\x8a\x01\x1a\n\r\n\x05\x04\x0f\x02\0\x06\x12\x04\x8b\x01\ - \x04\x12\n\r\n\x05\x04\x0f\x02\0\x01\x12\x04\x8b\x01\x13\x19\n\r\n\x05\ - \x04\x0f\x02\0\x03\x12\x04\x8b\x01\x1c\x1d\n\x0c\n\x02\x04\x10\x12\x06\ - \x8e\x01\0\x92\x01\x01\n\x0b\n\x03\x04\x10\x01\x12\x04\x8e\x01\x08\x18\n\ - \x0c\n\x04\x04\x10\x02\0\x12\x04\x8f\x01\x04\x1d\n\x0f\n\x05\x04\x10\x02\ - \0\x04\x12\x06\x8f\x01\x04\x8e\x01\x1a\n\r\n\x05\x04\x10\x02\0\x06\x12\ - \x04\x8f\x01\x04\x11\n\r\n\x05\x04\x10\x02\0\x01\x12\x04\x8f\x01\x12\x18\ - \n\r\n\x05\x04\x10\x02\0\x03\x12\x04\x8f\x01\x1b\x1c\n\x0c\n\x04\x04\x10\ - \x02\x01\x12\x04\x91\x01\x04\x19\n\x0f\n\x05\x04\x10\x02\x01\x04\x12\x06\ - \x91\x01\x04\x8f\x01\x1d\n\r\n\x05\x04\x10\x02\x01\x05\x12\x04\x91\x01\ - \x04\t\n\r\n\x05\x04\x10\x02\x01\x01\x12\x04\x91\x01\n\x14\n\r\n\x05\x04\ - \x10\x02\x01\x03\x12\x04\x91\x01\x17\x18\n\x0c\n\x02\x04\x11\x12\x06\x94\ - \x01\0\x99\x01\x01\n\x0b\n\x03\x04\x11\x01\x12\x04\x94\x01\x08\x19\n\x0c\ - \n\x04\x04\x11\x02\0\x12\x04\x95\x01\x04\x1e\n\x0f\n\x05\x04\x11\x02\0\ - \x04\x12\x06\x95\x01\x04\x94\x01\x1b\n\r\n\x05\x04\x11\x02\0\x06\x12\x04\ - \x95\x01\x04\x12\n\r\n\x05\x04\x11\x02\0\x01\x12\x04\x95\x01\x13\x19\n\r\ - \n\x05\x04\x11\x02\0\x03\x12\x04\x95\x01\x1c\x1d\n\x0c\n\x04\x04\x11\x02\ - \x01\x12\x04\x97\x01\x04\x1d\n\x0f\n\x05\x04\x11\x02\x01\x04\x12\x06\x97\ - \x01\x04\x95\x01\x1e\n\r\n\x05\x04\x11\x02\x01\x06\x12\x04\x97\x01\x04\ - \x11\n\r\n\x05\x04\x11\x02\x01\x01\x12\x04\x97\x01\x12\x18\n\r\n\x05\x04\ - \x11\x02\x01\x03\x12\x04\x97\x01\x1b\x1c\n\x0c\n\x04\x04\x11\x02\x02\x12\ - \x04\x98\x01\x04\x1b\n\x0f\n\x05\x04\x11\x02\x02\x04\x12\x06\x98\x01\x04\ - \x97\x01\x1d\n\r\n\x05\x04\x11\x02\x02\x06\x12\x04\x98\x01\x04\x0f\n\r\n\ - \x05\x04\x11\x02\x02\x01\x12\x04\x98\x01\x10\x16\n\r\n\x05\x04\x11\x02\ - \x02\x03\x12\x04\x98\x01\x19\x1a\n\x0c\n\x02\x04\x12\x12\x06\x9b\x01\0\ - \x9f\x01\x01\n\x0b\n\x03\x04\x12\x01\x12\x04\x9b\x01\x08\x1c\n\x0c\n\x04\ - \x04\x12\x02\0\x12\x04\x9c\x01\x04\x1d\n\x0f\n\x05\x04\x12\x02\0\x04\x12\ - \x06\x9c\x01\x04\x9b\x01\x1e\n\r\n\x05\x04\x12\x02\0\x06\x12\x04\x9c\x01\ - \x04\x11\n\r\n\x05\x04\x12\x02\0\x01\x12\x04\x9c\x01\x12\x18\n\r\n\x05\ - \x04\x12\x02\0\x03\x12\x04\x9c\x01\x1b\x1c\n\x0c\n\x04\x04\x12\x02\x01\ - \x12\x04\x9e\x01\x04\x19\n\x0f\n\x05\x04\x12\x02\x01\x04\x12\x06\x9e\x01\ - \x04\x9c\x01\x1d\n\r\n\x05\x04\x12\x02\x01\x05\x12\x04\x9e\x01\x04\n\n\r\ - \n\x05\x04\x12\x02\x01\x01\x12\x04\x9e\x01\x0b\x14\n\r\n\x05\x04\x12\x02\ - \x01\x03\x12\x04\x9e\x01\x17\x18\nN\n\x02\x04\x13\x12\x06\xa3\x01\0\xa5\ - \x01\x012@\x20Use\x20GetRegionResponse\x20as\x20the\x20response\x20of\ - \x20GetRegionByIDRequest.\n\n\x0b\n\x03\x04\x13\x01\x12\x04\xa3\x01\x08\ - \x1f\n\x0c\n\x04\x04\x13\x02\0\x12\x04\xa4\x01\x04\x1d\n\x0f\n\x05\x04\ - \x13\x02\0\x04\x12\x06\xa4\x01\x04\xa3\x01!\n\r\n\x05\x04\x13\x02\0\x06\ - \x12\x04\xa4\x01\x04\x11\n\r\n\x05\x04\x13\x02\0\x01\x12\x04\xa4\x01\x12\ - \x18\n\r\n\x05\x04\x13\x02\0\x03\x12\x04\xa4\x01\x1b\x1c\n\x0c\n\x02\x04\ - \x14\x12\x06\xa7\x01\0\xab\x01\x01\n\x0b\n\x03\x04\x14\x01\x12\x04\xa7\ - \x01\x08\x20\n\x0c\n\x04\x04\x14\x02\0\x12\x04\xa8\x01\x04\x1e\n\x0f\n\ - \x05\x04\x14\x02\0\x04\x12\x06\xa8\x01\x04\xa7\x01\"\n\r\n\x05\x04\x14\ - \x02\0\x06\x12\x04\xa8\x01\x04\x12\n\r\n\x05\x04\x14\x02\0\x01\x12\x04\ - \xa8\x01\x13\x19\n\r\n\x05\x04\x14\x02\0\x03\x12\x04\xa8\x01\x1c\x1d\n\ - \x0c\n\x04\x04\x14\x02\x01\x12\x04\xaa\x01\x04\x1f\n\x0f\n\x05\x04\x14\ - \x02\x01\x04\x12\x06\xaa\x01\x04\xa8\x01\x1e\n\r\n\x05\x04\x14\x02\x01\ - \x06\x12\x04\xaa\x01\x04\x12\n\r\n\x05\x04\x14\x02\x01\x01\x12\x04\xaa\ - \x01\x13\x1a\n\r\n\x05\x04\x14\x02\x01\x03\x12\x04\xaa\x01\x1d\x1e\n\x0c\ - \n\x02\x04\x15\x12\x06\xad\x01\0\xb1\x01\x01\n\x0b\n\x03\x04\x15\x01\x12\ - \x04\xad\x01\x08\x1f\n\x0c\n\x04\x04\x15\x02\0\x12\x04\xae\x01\x04\x1d\n\ - \x0f\n\x05\x04\x15\x02\0\x04\x12\x06\xae\x01\x04\xad\x01!\n\r\n\x05\x04\ - \x15\x02\0\x06\x12\x04\xae\x01\x04\x11\n\r\n\x05\x04\x15\x02\0\x01\x12\ - \x04\xae\x01\x12\x18\n\r\n\x05\x04\x15\x02\0\x03\x12\x04\xae\x01\x1b\x1c\ - \n\x0c\n\x04\x04\x15\x02\x01\x12\x04\xb0\x01\x04\x1f\n\x0f\n\x05\x04\x15\ - \x02\x01\x04\x12\x06\xb0\x01\x04\xae\x01\x1d\n\r\n\x05\x04\x15\x02\x01\ - \x06\x12\x04\xb0\x01\x04\x12\n\r\n\x05\x04\x15\x02\x01\x01\x12\x04\xb0\ - \x01\x13\x1a\n\r\n\x05\x04\x15\x02\x01\x03\x12\x04\xb0\x01\x1d\x1e\n\x0c\ - \n\x02\x04\x16\x12\x06\xb3\x01\0\xb5\x01\x01\n\x0b\n\x03\x04\x16\x01\x12\ - \x04\xb3\x01\x08\x20\n\x0c\n\x04\x04\x16\x02\0\x12\x04\xb4\x01\x04\x1e\n\ - \x0f\n\x05\x04\x16\x02\0\x04\x12\x06\xb4\x01\x04\xb3\x01\"\n\r\n\x05\x04\ - \x16\x02\0\x06\x12\x04\xb4\x01\x04\x12\n\r\n\x05\x04\x16\x02\0\x01\x12\ - \x04\xb4\x01\x13\x19\n\r\n\x05\x04\x16\x02\0\x03\x12\x04\xb4\x01\x1c\x1d\ - \n\x0c\n\x02\x04\x17\x12\x06\xb7\x01\0\xbe\x01\x01\n\x0b\n\x03\x04\x17\ - \x01\x12\x04\xb7\x01\x08\x0e\n2\n\x04\x04\x17\x02\0\x12\x04\xb9\x01\x04\ - \x14\x1a$\x20name\x20is\x20the\x20name\x20of\x20the\x20PD\x20member.\n\n\ - \x0f\n\x05\x04\x17\x02\0\x04\x12\x06\xb9\x01\x04\xb7\x01\x10\n\r\n\x05\ - \x04\x17\x02\0\x05\x12\x04\xb9\x01\x04\n\n\r\n\x05\x04\x17\x02\0\x01\x12\ - \x04\xb9\x01\x0b\x0f\n\r\n\x05\x04\x17\x02\0\x03\x12\x04\xb9\x01\x12\x13\ - \n<\n\x04\x04\x17\x02\x01\x12\x04\xbb\x01\x04\x19\x1a.\x20member_id\x20i\ - s\x20the\x20unique\x20id\x20of\x20the\x20PD\x20member.\n\n\x0f\n\x05\x04\ - \x17\x02\x01\x04\x12\x06\xbb\x01\x04\xb9\x01\x14\n\r\n\x05\x04\x17\x02\ - \x01\x05\x12\x04\xbb\x01\x04\n\n\r\n\x05\x04\x17\x02\x01\x01\x12\x04\xbb\ - \x01\x0b\x14\n\r\n\x05\x04\x17\x02\x01\x03\x12\x04\xbb\x01\x17\x18\n\x0c\ - \n\x04\x04\x17\x02\x02\x12\x04\xbc\x01\x04\"\n\r\n\x05\x04\x17\x02\x02\ - \x04\x12\x04\xbc\x01\x04\x0c\n\r\n\x05\x04\x17\x02\x02\x05\x12\x04\xbc\ - \x01\r\x13\n\r\n\x05\x04\x17\x02\x02\x01\x12\x04\xbc\x01\x14\x1d\n\r\n\ - \x05\x04\x17\x02\x02\x03\x12\x04\xbc\x01\x20!\n\x0c\n\x04\x04\x17\x02\ - \x03\x12\x04\xbd\x01\x04$\n\r\n\x05\x04\x17\x02\x03\x04\x12\x04\xbd\x01\ - \x04\x0c\n\r\n\x05\x04\x17\x02\x03\x05\x12\x04\xbd\x01\r\x13\n\r\n\x05\ - \x04\x17\x02\x03\x01\x12\x04\xbd\x01\x14\x1f\n\r\n\x05\x04\x17\x02\x03\ - \x03\x12\x04\xbd\x01\"#\n\x0c\n\x02\x04\x18\x12\x06\xc0\x01\0\xc2\x01\ - \x01\n\x0b\n\x03\x04\x18\x01\x12\x04\xc0\x01\x08\x19\n\x0c\n\x04\x04\x18\ - \x02\0\x12\x04\xc1\x01\x04\x1d\n\x0f\n\x05\x04\x18\x02\0\x04\x12\x06\xc1\ - \x01\x04\xc0\x01\x1b\n\r\n\x05\x04\x18\x02\0\x06\x12\x04\xc1\x01\x04\x11\ - \n\r\n\x05\x04\x18\x02\0\x01\x12\x04\xc1\x01\x12\x18\n\r\n\x05\x04\x18\ - \x02\0\x03\x12\x04\xc1\x01\x1b\x1c\n\x0c\n\x02\x04\x19\x12\x06\xc4\x01\0\ - \xc9\x01\x01\n\x0b\n\x03\x04\x19\x01\x12\x04\xc4\x01\x08\x1a\n\x0c\n\x04\ - \x04\x19\x02\0\x12\x04\xc5\x01\x04\x1e\n\x0f\n\x05\x04\x19\x02\0\x04\x12\ - \x06\xc5\x01\x04\xc4\x01\x1c\n\r\n\x05\x04\x19\x02\0\x06\x12\x04\xc5\x01\ - \x04\x12\n\r\n\x05\x04\x19\x02\0\x01\x12\x04\xc5\x01\x13\x19\n\r\n\x05\ - \x04\x19\x02\0\x03\x12\x04\xc5\x01\x1c\x1d\n\x0c\n\x04\x04\x19\x02\x01\ - \x12\x04\xc7\x01\x04\x20\n\r\n\x05\x04\x19\x02\x01\x04\x12\x04\xc7\x01\ - \x04\x0c\n\r\n\x05\x04\x19\x02\x01\x06\x12\x04\xc7\x01\r\x13\n\r\n\x05\ - \x04\x19\x02\x01\x01\x12\x04\xc7\x01\x14\x1b\n\r\n\x05\x04\x19\x02\x01\ - \x03\x12\x04\xc7\x01\x1e\x1f\n\x0c\n\x04\x04\x19\x02\x02\x12\x04\xc8\x01\ - \x04\x16\n\x0f\n\x05\x04\x19\x02\x02\x04\x12\x06\xc8\x01\x04\xc7\x01\x20\ - \n\r\n\x05\x04\x19\x02\x02\x06\x12\x04\xc8\x01\x04\n\n\r\n\x05\x04\x19\ - \x02\x02\x01\x12\x04\xc8\x01\x0b\x11\n\r\n\x05\x04\x19\x02\x02\x03\x12\ - \x04\xc8\x01\x14\x15\n\x0c\n\x02\x04\x1a\x12\x06\xcb\x01\0\xce\x01\x01\n\ - \x0b\n\x03\x04\x1a\x01\x12\x04\xcb\x01\x08\x11\n\x0c\n\x04\x04\x1a\x02\0\ - \x12\x04\xcc\x01\x04\x19\n\x0f\n\x05\x04\x1a\x02\0\x04\x12\x06\xcc\x01\ - \x04\xcb\x01\x13\n\r\n\x05\x04\x1a\x02\0\x06\x12\x04\xcc\x01\x04\x0f\n\r\ - \n\x05\x04\x1a\x02\0\x01\x12\x04\xcc\x01\x10\x14\n\r\n\x05\x04\x1a\x02\0\ - \x03\x12\x04\xcc\x01\x17\x18\n\x0c\n\x04\x04\x1a\x02\x01\x12\x04\xcd\x01\ - \x04\x1c\n\x0f\n\x05\x04\x1a\x02\x01\x04\x12\x06\xcd\x01\x04\xcc\x01\x19\ - \n\r\n\x05\x04\x1a\x02\x01\x05\x12\x04\xcd\x01\x04\n\n\r\n\x05\x04\x1a\ - \x02\x01\x01\x12\x04\xcd\x01\x0b\x17\n\r\n\x05\x04\x1a\x02\x01\x03\x12\ - \x04\xcd\x01\x1a\x1b\n\x0c\n\x02\x04\x1b\x12\x06\xd0\x01\0\xe3\x01\x01\n\ - \x0b\n\x03\x04\x1b\x01\x12\x04\xd0\x01\x08\x1e\n\x0c\n\x04\x04\x1b\x02\0\ - \x12\x04\xd1\x01\x04\x1d\n\x0f\n\x05\x04\x1b\x02\0\x04\x12\x06\xd1\x01\ - \x04\xd0\x01\x20\n\r\n\x05\x04\x1b\x02\0\x06\x12\x04\xd1\x01\x04\x11\n\r\ - \n\x05\x04\x1b\x02\0\x01\x12\x04\xd1\x01\x12\x18\n\r\n\x05\x04\x1b\x02\0\ - \x03\x12\x04\xd1\x01\x1b\x1c\n\x0c\n\x04\x04\x1b\x02\x01\x12\x04\xd3\x01\ - \x04\x1d\n\x0f\n\x05\x04\x1b\x02\x01\x04\x12\x06\xd3\x01\x04\xd1\x01\x1d\ - \n\r\n\x05\x04\x1b\x02\x01\x06\x12\x04\xd3\x01\x04\x11\n\r\n\x05\x04\x1b\ - \x02\x01\x01\x12\x04\xd3\x01\x12\x18\n\r\n\x05\x04\x1b\x02\x01\x03\x12\ - \x04\xd3\x01\x1b\x1c\n2\n\x04\x04\x1b\x02\x02\x12\x04\xd5\x01\x04\x1b\ - \x1a$\x20Leader\x20Peer\x20sending\x20the\x20heartbeat.\n\n\x0f\n\x05\ - \x04\x1b\x02\x02\x04\x12\x06\xd5\x01\x04\xd3\x01\x1d\n\r\n\x05\x04\x1b\ - \x02\x02\x06\x12\x04\xd5\x01\x04\x0f\n\r\n\x05\x04\x1b\x02\x02\x01\x12\ - \x04\xd5\x01\x10\x16\n\r\n\x05\x04\x1b\x02\x02\x03\x12\x04\xd5\x01\x19\ - \x1a\n;\n\x04\x04\x1b\x02\x03\x12\x04\xd7\x01\x04&\x1a-\x20Leader\x20con\ - siders\x20that\x20these\x20peers\x20are\x20down.\n\n\r\n\x05\x04\x1b\x02\ - \x03\x04\x12\x04\xd7\x01\x04\x0c\n\r\n\x05\x04\x1b\x02\x03\x06\x12\x04\ - \xd7\x01\r\x16\n\r\n\x05\x04\x1b\x02\x03\x01\x12\x04\xd7\x01\x17!\n\r\n\ - \x05\x04\x1b\x02\x03\x03\x12\x04\xd7\x01$%\na\n\x04\x04\x1b\x02\x04\x12\ - \x04\xda\x01\x04+\x1aS\x20Pending\x20peers\x20are\x20the\x20peers\x20tha\ - t\x20the\x20leader\x20can't\x20consider\x20as\n\x20working\x20followers.\ - \n\n\r\n\x05\x04\x1b\x02\x04\x04\x12\x04\xda\x01\x04\x0c\n\r\n\x05\x04\ - \x1b\x02\x04\x06\x12\x04\xda\x01\r\x18\n\r\n\x05\x04\x1b\x02\x04\x01\x12\ - \x04\xda\x01\x19&\n\r\n\x05\x04\x1b\x02\x04\x03\x12\x04\xda\x01)*\n6\n\ - \x04\x04\x1b\x02\x05\x12\x04\xdc\x01\x04\x1d\x1a(\x20Bytes\x20read/writt\ - en\x20during\x20this\x20period.\n\n\x0f\n\x05\x04\x1b\x02\x05\x04\x12\ - \x06\xdc\x01\x04\xda\x01+\n\r\n\x05\x04\x1b\x02\x05\x05\x12\x04\xdc\x01\ - \x04\n\n\r\n\x05\x04\x1b\x02\x05\x01\x12\x04\xdc\x01\x0b\x18\n\r\n\x05\ - \x04\x1b\x02\x05\x03\x12\x04\xdc\x01\x1b\x1c\n\x0c\n\x04\x04\x1b\x02\x06\ - \x12\x04\xdd\x01\x04\x1a\n\x0f\n\x05\x04\x1b\x02\x06\x04\x12\x06\xdd\x01\ - \x04\xdc\x01\x1d\n\r\n\x05\x04\x1b\x02\x06\x05\x12\x04\xdd\x01\x04\n\n\r\ - \n\x05\x04\x1b\x02\x06\x01\x12\x04\xdd\x01\x0b\x15\n\r\n\x05\x04\x1b\x02\ - \x06\x03\x12\x04\xdd\x01\x18\x19\n5\n\x04\x04\x1b\x02\x07\x12\x04\xdf\ - \x01\x04\x1c\x1a'\x20Keys\x20read/written\x20during\x20this\x20period.\n\ - \n\x0f\n\x05\x04\x1b\x02\x07\x04\x12\x06\xdf\x01\x04\xdd\x01\x1a\n\r\n\ - \x05\x04\x1b\x02\x07\x05\x12\x04\xdf\x01\x04\n\n\r\n\x05\x04\x1b\x02\x07\ - \x01\x12\x04\xdf\x01\x0b\x17\n\r\n\x05\x04\x1b\x02\x07\x03\x12\x04\xdf\ - \x01\x1a\x1b\n\x0c\n\x04\x04\x1b\x02\x08\x12\x04\xe0\x01\x04\x19\n\x0f\n\ - \x05\x04\x1b\x02\x08\x04\x12\x06\xe0\x01\x04\xdf\x01\x1c\n\r\n\x05\x04\ - \x1b\x02\x08\x05\x12\x04\xe0\x01\x04\n\n\r\n\x05\x04\x1b\x02\x08\x01\x12\ - \x04\xe0\x01\x0b\x14\n\r\n\x05\x04\x1b\x02\x08\x03\x12\x04\xe0\x01\x17\ - \x18\n(\n\x04\x04\x1b\x02\t\x12\x04\xe2\x01\x04!\x1a\x1a\x20Approximate\ - \x20region\x20size.\n\n\x0f\n\x05\x04\x1b\x02\t\x04\x12\x06\xe2\x01\x04\ - \xe0\x01\x19\n\r\n\x05\x04\x1b\x02\t\x05\x12\x04\xe2\x01\x04\n\n\r\n\x05\ - \x04\x1b\x02\t\x01\x12\x04\xe2\x01\x0b\x1b\n\r\n\x05\x04\x1b\x02\t\x03\ - \x12\x04\xe2\x01\x1e\x20\n\xde\x01\n\x02\x05\x01\x12\x06\xe8\x01\0\xeb\ - \x01\x01\x1a\xcf\x01\x20A\x20clone\x20of\x20eraftpb.ConfChangeType,\x20i\ - t\x20exists\x20because\x20proto2\x20enums\x20cannot\x20be\n\x20used\x20d\ - irectly\x20in\x20proto3\x20syntax.\n\x20See\x20more:\x20https://develope\ - rs.google.com/protocol-buffers/docs/proto3#using-proto2-message-types\n\ - \n\x0b\n\x03\x05\x01\x01\x12\x04\xe8\x01\x05\x13\n\x0c\n\x04\x05\x01\x02\ - \0\x12\x04\xe9\x01\x04\x13\n\r\n\x05\x05\x01\x02\0\x01\x12\x04\xe9\x01\ - \x04\x0b\n\r\n\x05\x05\x01\x02\0\x02\x12\x04\xe9\x01\x11\x12\n\x0c\n\x04\ - \x05\x01\x02\x01\x12\x04\xea\x01\x04\x13\n\r\n\x05\x05\x01\x02\x01\x01\ - \x12\x04\xea\x01\x04\x0e\n\r\n\x05\x05\x01\x02\x01\x02\x12\x04\xea\x01\ - \x11\x12\n\x0c\n\x02\x04\x1c\x12\x06\xed\x01\0\xf1\x01\x01\n\x0b\n\x03\ - \x04\x1c\x01\x12\x04\xed\x01\x08\x12\n\x0c\n\x04\x04\x1c\x02\0\x12\x04\ - \xee\x01\x04\x19\n\x0f\n\x05\x04\x1c\x02\0\x04\x12\x06\xee\x01\x04\xed\ - \x01\x14\n\r\n\x05\x04\x1c\x02\0\x06\x12\x04\xee\x01\x04\x0f\n\r\n\x05\ - \x04\x1c\x02\0\x01\x12\x04\xee\x01\x10\x14\n\r\n\x05\x04\x1c\x02\0\x03\ - \x12\x04\xee\x01\x17\x18\nS\n\x04\x04\x1c\x02\x01\x12\x04\xf0\x01\x04#\ - \x1aE\x20FIXME:\x20replace\x20with\x20actual\x20ConfChangeType\x20once\ - \x20eraftpb\x20uses\x20proto3.\n\n\x0f\n\x05\x04\x1c\x02\x01\x04\x12\x06\ - \xf0\x01\x04\xee\x01\x19\n\r\n\x05\x04\x1c\x02\x01\x06\x12\x04\xf0\x01\ - \x04\x12\n\r\n\x05\x04\x1c\x02\x01\x01\x12\x04\xf0\x01\x13\x1e\n\r\n\x05\ - \x04\x1c\x02\x01\x03\x12\x04\xf0\x01!\"\n\x0c\n\x02\x04\x1d\x12\x06\xf3\ - \x01\0\xf5\x01\x01\n\x0b\n\x03\x04\x1d\x01\x12\x04\xf3\x01\x08\x16\n\x0c\ - \n\x04\x04\x1d\x02\0\x12\x04\xf4\x01\x04\x19\n\x0f\n\x05\x04\x1d\x02\0\ - \x04\x12\x06\xf4\x01\x04\xf3\x01\x18\n\r\n\x05\x04\x1d\x02\0\x06\x12\x04\ - \xf4\x01\x04\x0f\n\r\n\x05\x04\x1d\x02\0\x01\x12\x04\xf4\x01\x10\x14\n\r\ - \n\x05\x04\x1d\x02\0\x03\x12\x04\xf4\x01\x17\x18\n\x0c\n\x02\x04\x1e\x12\ - \x06\xf7\x01\0\x90\x02\x01\n\x0b\n\x03\x04\x1e\x01\x12\x04\xf7\x01\x08\ - \x1f\n\x0c\n\x04\x04\x1e\x02\0\x12\x04\xf8\x01\x04\x1e\n\x0f\n\x05\x04\ - \x1e\x02\0\x04\x12\x06\xf8\x01\x04\xf7\x01!\n\r\n\x05\x04\x1e\x02\0\x06\ - \x12\x04\xf8\x01\x04\x12\n\r\n\x05\x04\x1e\x02\0\x01\x12\x04\xf8\x01\x13\ - \x19\n\r\n\x05\x04\x1e\x02\0\x03\x12\x04\xf8\x01\x1c\x1d\n\xcf\x06\n\x04\ - \x04\x1e\x02\x01\x12\x04\x88\x02\x04\x1f\x1a\xc0\x06\x20Notice,\x20Pd\ - \x20only\x20allows\x20handling\x20reported\x20epoch\x20>=\x20current\x20\ - pd's.\n\x20Leader\x20peer\x20reports\x20region\x20status\x20with\x20Regi\ - onHeartbeatRequest\n\x20to\x20pd\x20regularly,\x20pd\x20will\x20determin\ - e\x20whether\x20this\x20region\n\x20should\x20do\x20ChangePeer\x20or\x20\ - not.\n\x20E,g,\x20max\x20peer\x20number\x20is\x203,\x20region\x20A,\x20f\ - irst\x20only\x20peer\x201\x20in\x20A.\n\x201.\x20Pd\x20region\x20state\ - \x20->\x20Peers\x20(1),\x20ConfVer\x20(1).\n\x202.\x20Leader\x20peer\x20\ - 1\x20reports\x20region\x20state\x20to\x20pd,\x20pd\x20finds\x20the\n\x20\ - peer\x20number\x20is\x20<\x203,\x20so\x20first\x20changes\x20its\x20curr\ - ent\x20region\n\x20state\x20->\x20Peers\x20(1,\x202),\x20ConfVer\x20(1),\ - \x20and\x20returns\x20ChangePeer\x20Adding\x202.\n\x203.\x20Leader\x20do\ - es\x20ChangePeer,\x20then\x20reports\x20Peers\x20(1,\x202),\x20ConfVer\ - \x20(2),\n\x20pd\x20updates\x20its\x20state\x20->\x20Peers\x20(1,\x202),\ - \x20ConfVer\x20(2).\n\x204.\x20Leader\x20may\x20report\x20old\x20Peers\ - \x20(1),\x20ConfVer\x20(1)\x20to\x20pd\x20before\x20ConfChange\n\x20fini\ - shed,\x20pd\x20stills\x20responses\x20ChangePeer\x20Adding\x202,\x20of\ - \x20course,\x20we\x20must\n\x20guarantee\x20the\x20second\x20ChangePeer\ - \x20can't\x20be\x20applied\x20in\x20TiKV.\n\n\x0f\n\x05\x04\x1e\x02\x01\ - \x04\x12\x06\x88\x02\x04\xf8\x01\x1e\n\r\n\x05\x04\x1e\x02\x01\x06\x12\ - \x04\x88\x02\x04\x0e\n\r\n\x05\x04\x1e\x02\x01\x01\x12\x04\x88\x02\x0f\ - \x1a\n\r\n\x05\x04\x1e\x02\x01\x03\x12\x04\x88\x02\x1d\x1e\nV\n\x04\x04\ - \x1e\x02\x02\x12\x04\x8a\x02\x04'\x1aH\x20Pd\x20can\x20return\x20transfe\ - r_leader\x20to\x20let\x20TiKV\x20does\x20leader\x20transfer\x20itself.\n\ - \n\x0f\n\x05\x04\x1e\x02\x02\x04\x12\x06\x8a\x02\x04\x88\x02\x1f\n\r\n\ - \x05\x04\x1e\x02\x02\x06\x12\x04\x8a\x02\x04\x12\n\r\n\x05\x04\x1e\x02\ - \x02\x01\x12\x04\x8a\x02\x13\"\n\r\n\x05\x04\x1e\x02\x02\x03\x12\x04\x8a\ - \x02%&\n\x20\n\x04\x04\x1e\x02\x03\x12\x04\x8c\x02\x04\x19\x1a\x12\x20ID\ - \x20of\x20the\x20region\n\n\x0f\n\x05\x04\x1e\x02\x03\x04\x12\x06\x8c\ - \x02\x04\x8a\x02'\n\r\n\x05\x04\x1e\x02\x03\x05\x12\x04\x8c\x02\x04\n\n\ - \r\n\x05\x04\x1e\x02\x03\x01\x12\x04\x8c\x02\x0b\x14\n\r\n\x05\x04\x1e\ - \x02\x03\x03\x12\x04\x8c\x02\x17\x18\n\x0c\n\x04\x04\x1e\x02\x04\x12\x04\ - \x8d\x02\x04(\n\x0f\n\x05\x04\x1e\x02\x04\x04\x12\x06\x8d\x02\x04\x8c\ - \x02\x19\n\r\n\x05\x04\x1e\x02\x04\x06\x12\x04\x8d\x02\x04\x16\n\r\n\x05\ - \x04\x1e\x02\x04\x01\x12\x04\x8d\x02\x17#\n\r\n\x05\x04\x1e\x02\x04\x03\ - \x12\x04\x8d\x02&'\nY\n\x04\x04\x1e\x02\x05\x12\x04\x8f\x02\x04\x20\x1aK\ - \x20Leader\x20of\x20the\x20region\x20at\x20the\x20moment\x20of\x20the\ - \x20corresponding\x20request\x20was\x20made.\n\n\x0f\n\x05\x04\x1e\x02\ - \x05\x04\x12\x06\x8f\x02\x04\x8d\x02(\n\r\n\x05\x04\x1e\x02\x05\x06\x12\ - \x04\x8f\x02\x04\x0f\n\r\n\x05\x04\x1e\x02\x05\x01\x12\x04\x8f\x02\x10\ - \x1b\n\r\n\x05\x04\x1e\x02\x05\x03\x12\x04\x8f\x02\x1e\x1f\n\x0c\n\x02\ - \x04\x1f\x12\x06\x92\x02\0\x96\x02\x01\n\x0b\n\x03\x04\x1f\x01\x12\x04\ - \x92\x02\x08\x17\n\x0c\n\x04\x04\x1f\x02\0\x12\x04\x93\x02\x04\x1d\n\x0f\ - \n\x05\x04\x1f\x02\0\x04\x12\x06\x93\x02\x04\x92\x02\x19\n\r\n\x05\x04\ - \x1f\x02\0\x06\x12\x04\x93\x02\x04\x11\n\r\n\x05\x04\x1f\x02\0\x01\x12\ - \x04\x93\x02\x12\x18\n\r\n\x05\x04\x1f\x02\0\x03\x12\x04\x93\x02\x1b\x1c\ - \n\x0c\n\x04\x04\x1f\x02\x01\x12\x04\x95\x02\x04\x1d\n\x0f\n\x05\x04\x1f\ - \x02\x01\x04\x12\x06\x95\x02\x04\x93\x02\x1d\n\r\n\x05\x04\x1f\x02\x01\ - \x06\x12\x04\x95\x02\x04\x11\n\r\n\x05\x04\x1f\x02\x01\x01\x12\x04\x95\ - \x02\x12\x18\n\r\n\x05\x04\x1f\x02\x01\x03\x12\x04\x95\x02\x1b\x1c\n\x0c\ - \n\x02\x04\x20\x12\x06\x98\x02\0\xa1\x02\x01\n\x0b\n\x03\x04\x20\x01\x12\ - \x04\x98\x02\x08\x18\n\x0c\n\x04\x04\x20\x02\0\x12\x04\x99\x02\x04\x1e\n\ - \x0f\n\x05\x04\x20\x02\0\x04\x12\x06\x99\x02\x04\x98\x02\x1a\n\r\n\x05\ - \x04\x20\x02\0\x06\x12\x04\x99\x02\x04\x12\n\r\n\x05\x04\x20\x02\0\x01\ - \x12\x04\x99\x02\x13\x19\n\r\n\x05\x04\x20\x02\0\x03\x12\x04\x99\x02\x1c\ - \x1d\n\xba\x01\n\x04\x04\x20\x02\x01\x12\x04\x9e\x02\x04\x1d\x1a\xab\x01\ - \x20We\x20split\x20the\x20region\x20into\x20two,\x20first\x20uses\x20the\ - \x20origin\n\x20parent\x20region\x20id,\x20and\x20the\x20second\x20uses\ - \x20the\x20new_region_id.\n\x20We\x20must\x20guarantee\x20that\x20the\ - \x20new_region_id\x20is\x20global\x20unique.\n\n\x0f\n\x05\x04\x20\x02\ - \x01\x04\x12\x06\x9e\x02\x04\x99\x02\x1e\n\r\n\x05\x04\x20\x02\x01\x05\ - \x12\x04\x9e\x02\x04\n\n\r\n\x05\x04\x20\x02\x01\x01\x12\x04\x9e\x02\x0b\ - \x18\n\r\n\x05\x04\x20\x02\x01\x03\x12\x04\x9e\x02\x1b\x1c\n6\n\x04\x04\ - \x20\x02\x02\x12\x04\xa0\x02\x04%\x1a(\x20The\x20peer\x20ids\x20for\x20t\ - he\x20new\x20split\x20region.\n\n\r\n\x05\x04\x20\x02\x02\x04\x12\x04\ - \xa0\x02\x04\x0c\n\r\n\x05\x04\x20\x02\x02\x05\x12\x04\xa0\x02\r\x13\n\r\ - \n\x05\x04\x20\x02\x02\x01\x12\x04\xa0\x02\x14\x20\n\r\n\x05\x04\x20\x02\ - \x02\x03\x12\x04\xa0\x02#$\n\x0c\n\x02\x04!\x12\x06\xa3\x02\0\xa8\x02\ - \x01\n\x0b\n\x03\x04!\x01\x12\x04\xa3\x02\x08\x1a\n\x0c\n\x04\x04!\x02\0\ - \x12\x04\xa4\x02\x04\x1d\n\x0f\n\x05\x04!\x02\0\x04\x12\x06\xa4\x02\x04\ - \xa3\x02\x1c\n\r\n\x05\x04!\x02\0\x06\x12\x04\xa4\x02\x04\x11\n\r\n\x05\ - \x04!\x02\0\x01\x12\x04\xa4\x02\x12\x18\n\r\n\x05\x04!\x02\0\x03\x12\x04\ - \xa4\x02\x1b\x1c\n\x0c\n\x04\x04!\x02\x01\x12\x04\xa6\x02\x04\x1b\n\x0f\ - \n\x05\x04!\x02\x01\x04\x12\x06\xa6\x02\x04\xa4\x02\x1d\n\r\n\x05\x04!\ - \x02\x01\x06\x12\x04\xa6\x02\x04\x11\n\r\n\x05\x04!\x02\x01\x01\x12\x04\ - \xa6\x02\x12\x16\n\r\n\x05\x04!\x02\x01\x03\x12\x04\xa6\x02\x19\x1a\n\ - \x0c\n\x04\x04!\x02\x02\x12\x04\xa7\x02\x04\x1c\n\x0f\n\x05\x04!\x02\x02\ - \x04\x12\x06\xa7\x02\x04\xa6\x02\x1b\n\r\n\x05\x04!\x02\x02\x06\x12\x04\ - \xa7\x02\x04\x11\n\r\n\x05\x04!\x02\x02\x01\x12\x04\xa7\x02\x12\x17\n\r\ - \n\x05\x04!\x02\x02\x03\x12\x04\xa7\x02\x1a\x1b\n\x0c\n\x02\x04\"\x12\ - \x06\xaa\x02\0\xac\x02\x01\n\x0b\n\x03\x04\"\x01\x12\x04\xaa\x02\x08\x1b\ - \n\x0c\n\x04\x04\"\x02\0\x12\x04\xab\x02\x04\x1e\n\x0f\n\x05\x04\"\x02\0\ - \x04\x12\x06\xab\x02\x04\xaa\x02\x1d\n\r\n\x05\x04\"\x02\0\x06\x12\x04\ - \xab\x02\x04\x12\n\r\n\x05\x04\"\x02\0\x01\x12\x04\xab\x02\x13\x19\n\r\n\ - \x05\x04\"\x02\0\x03\x12\x04\xab\x02\x1c\x1d\n\x0c\n\x02\x04#\x12\x06\ - \xae\x02\0\xca\x02\x01\n\x0b\n\x03\x04#\x01\x12\x04\xae\x02\x08\x12\n\ - \x0c\n\x04\x04#\x02\0\x12\x04\xaf\x02\x04\x18\n\x0f\n\x05\x04#\x02\0\x04\ - \x12\x06\xaf\x02\x04\xae\x02\x14\n\r\n\x05\x04#\x02\0\x05\x12\x04\xaf\ - \x02\x04\n\n\r\n\x05\x04#\x02\0\x01\x12\x04\xaf\x02\x0b\x13\n\r\n\x05\ - \x04#\x02\0\x03\x12\x04\xaf\x02\x16\x17\n'\n\x04\x04#\x02\x01\x12\x04\ - \xb1\x02\x04\x18\x1a\x19\x20Capacity\x20for\x20the\x20store.\n\n\x0f\n\ - \x05\x04#\x02\x01\x04\x12\x06\xb1\x02\x04\xaf\x02\x18\n\r\n\x05\x04#\x02\ - \x01\x05\x12\x04\xb1\x02\x04\n\n\r\n\x05\x04#\x02\x01\x01\x12\x04\xb1\ - \x02\x0b\x13\n\r\n\x05\x04#\x02\x01\x03\x12\x04\xb1\x02\x16\x17\n-\n\x04\ - \x04#\x02\x02\x12\x04\xb3\x02\x04\x19\x1a\x1f\x20Available\x20size\x20fo\ - r\x20the\x20store.\n\n\x0f\n\x05\x04#\x02\x02\x04\x12\x06\xb3\x02\x04\ - \xb1\x02\x18\n\r\n\x05\x04#\x02\x02\x05\x12\x04\xb3\x02\x04\n\n\r\n\x05\ - \x04#\x02\x02\x01\x12\x04\xb3\x02\x0b\x14\n\r\n\x05\x04#\x02\x02\x03\x12\ - \x04\xb3\x02\x17\x18\n1\n\x04\x04#\x02\x03\x12\x04\xb5\x02\x04\x1c\x1a#\ - \x20Total\x20region\x20count\x20in\x20this\x20store.\n\n\x0f\n\x05\x04#\ - \x02\x03\x04\x12\x06\xb5\x02\x04\xb3\x02\x19\n\r\n\x05\x04#\x02\x03\x05\ - \x12\x04\xb5\x02\x04\n\n\r\n\x05\x04#\x02\x03\x01\x12\x04\xb5\x02\x0b\ - \x17\n\r\n\x05\x04#\x02\x03\x03\x12\x04\xb5\x02\x1a\x1b\n/\n\x04\x04#\ - \x02\x04\x12\x04\xb7\x02\x04\"\x1a!\x20Current\x20sending\x20snapshot\ - \x20count.\n\n\x0f\n\x05\x04#\x02\x04\x04\x12\x06\xb7\x02\x04\xb5\x02\ - \x1c\n\r\n\x05\x04#\x02\x04\x05\x12\x04\xb7\x02\x04\n\n\r\n\x05\x04#\x02\ - \x04\x01\x12\x04\xb7\x02\x0b\x1d\n\r\n\x05\x04#\x02\x04\x03\x12\x04\xb7\ - \x02\x20!\n1\n\x04\x04#\x02\x05\x12\x04\xb9\x02\x04$\x1a#\x20Current\x20\ - receiving\x20snapshot\x20count.\n\n\x0f\n\x05\x04#\x02\x05\x04\x12\x06\ - \xb9\x02\x04\xb7\x02\"\n\r\n\x05\x04#\x02\x05\x05\x12\x04\xb9\x02\x04\n\ - \n\r\n\x05\x04#\x02\x05\x01\x12\x04\xb9\x02\x0b\x1f\n\r\n\x05\x04#\x02\ - \x05\x03\x12\x04\xb9\x02\"#\nF\n\x04\x04#\x02\x06\x12\x04\xbb\x02\x04\ - \x1a\x1a8\x20When\x20the\x20store\x20is\x20started\x20(unix\x20timestamp\ - \x20in\x20seconds).\n\n\x0f\n\x05\x04#\x02\x06\x04\x12\x06\xbb\x02\x04\ - \xb9\x02$\n\r\n\x05\x04#\x02\x06\x05\x12\x04\xbb\x02\x04\n\n\r\n\x05\x04\ - #\x02\x06\x01\x12\x04\xbb\x02\x0b\x15\n\r\n\x05\x04#\x02\x06\x03\x12\x04\ - \xbb\x02\x18\x19\n5\n\x04\x04#\x02\x07\x12\x04\xbd\x02\x04#\x1a'\x20How\ - \x20many\x20region\x20is\x20applying\x20snapshot.\n\n\x0f\n\x05\x04#\x02\ - \x07\x04\x12\x06\xbd\x02\x04\xbb\x02\x1a\n\r\n\x05\x04#\x02\x07\x05\x12\ - \x04\xbd\x02\x04\n\n\r\n\x05\x04#\x02\x07\x01\x12\x04\xbd\x02\x0b\x1e\n\ - \r\n\x05\x04#\x02\x07\x03\x12\x04\xbd\x02!\"\n$\n\x04\x04#\x02\x08\x12\ - \x04\xbf\x02\x04\x15\x1a\x16\x20If\x20the\x20store\x20is\x20busy\n\n\x0f\ - \n\x05\x04#\x02\x08\x04\x12\x06\xbf\x02\x04\xbd\x02#\n\r\n\x05\x04#\x02\ - \x08\x05\x12\x04\xbf\x02\x04\x08\n\r\n\x05\x04#\x02\x08\x01\x12\x04\xbf\ - \x02\t\x10\n\r\n\x05\x04#\x02\x08\x03\x12\x04\xbf\x02\x13\x14\n)\n\x04\ - \x04#\x02\t\x12\x04\xc1\x02\x04\x1a\x1a\x1b\x20Actually\x20used\x20space\ - \x20by\x20db\n\n\x0f\n\x05\x04#\x02\t\x04\x12\x06\xc1\x02\x04\xbf\x02\ - \x15\n\r\n\x05\x04#\x02\t\x05\x12\x04\xc1\x02\x04\n\n\r\n\x05\x04#\x02\t\ - \x01\x12\x04\xc1\x02\x0b\x14\n\r\n\x05\x04#\x02\t\x03\x12\x04\xc1\x02\ - \x17\x19\n,\n\x04\x04#\x02\n\x12\x04\xc3\x02\x04\x1e\x1a\x1e\x20Bytes\ - \x20written\x20for\x20the\x20store.\n\n\x0f\n\x05\x04#\x02\n\x04\x12\x06\ - \xc3\x02\x04\xc1\x02\x1a\n\r\n\x05\x04#\x02\n\x05\x12\x04\xc3\x02\x04\n\ - \n\r\n\x05\x04#\x02\n\x01\x12\x04\xc3\x02\x0b\x18\n\r\n\x05\x04#\x02\n\ - \x03\x12\x04\xc3\x02\x1b\x1d\n+\n\x04\x04#\x02\x0b\x12\x04\xc5\x02\x04\ - \x1d\x1a\x1d\x20Keys\x20written\x20for\x20the\x20store.\n\n\x0f\n\x05\ - \x04#\x02\x0b\x04\x12\x06\xc5\x02\x04\xc3\x02\x1e\n\r\n\x05\x04#\x02\x0b\ - \x05\x12\x04\xc5\x02\x04\n\n\r\n\x05\x04#\x02\x0b\x01\x12\x04\xc5\x02\ - \x0b\x17\n\r\n\x05\x04#\x02\x0b\x03\x12\x04\xc5\x02\x1a\x1c\n)\n\x04\x04\ - #\x02\x0c\x12\x04\xc7\x02\x04\x1b\x1a\x1b\x20Bytes\x20read\x20for\x20the\ - \x20store.\n\n\x0f\n\x05\x04#\x02\x0c\x04\x12\x06\xc7\x02\x04\xc5\x02\ - \x1d\n\r\n\x05\x04#\x02\x0c\x05\x12\x04\xc7\x02\x04\n\n\r\n\x05\x04#\x02\ - \x0c\x01\x12\x04\xc7\x02\x0b\x15\n\r\n\x05\x04#\x02\x0c\x03\x12\x04\xc7\ - \x02\x18\x1a\n(\n\x04\x04#\x02\r\x12\x04\xc9\x02\x04\x1a\x1a\x1a\x20Keys\ - \x20read\x20for\x20the\x20store.\n\n\x0f\n\x05\x04#\x02\r\x04\x12\x06\ - \xc9\x02\x04\xc7\x02\x1b\n\r\n\x05\x04#\x02\r\x05\x12\x04\xc9\x02\x04\n\ - \n\r\n\x05\x04#\x02\r\x01\x12\x04\xc9\x02\x0b\x14\n\r\n\x05\x04#\x02\r\ - \x03\x12\x04\xc9\x02\x17\x19\n\x0c\n\x02\x04$\x12\x06\xcc\x02\0\xd0\x02\ - \x01\n\x0b\n\x03\x04$\x01\x12\x04\xcc\x02\x08\x1d\n\x0c\n\x04\x04$\x02\0\ - \x12\x04\xcd\x02\x04\x1d\n\x0f\n\x05\x04$\x02\0\x04\x12\x06\xcd\x02\x04\ - \xcc\x02\x1f\n\r\n\x05\x04$\x02\0\x06\x12\x04\xcd\x02\x04\x11\n\r\n\x05\ - \x04$\x02\0\x01\x12\x04\xcd\x02\x12\x18\n\r\n\x05\x04$\x02\0\x03\x12\x04\ - \xcd\x02\x1b\x1c\n\x0c\n\x04\x04$\x02\x01\x12\x04\xcf\x02\x04\x19\n\x0f\ - \n\x05\x04$\x02\x01\x04\x12\x06\xcf\x02\x04\xcd\x02\x1d\n\r\n\x05\x04$\ - \x02\x01\x06\x12\x04\xcf\x02\x04\x0e\n\r\n\x05\x04$\x02\x01\x01\x12\x04\ - \xcf\x02\x0f\x14\n\r\n\x05\x04$\x02\x01\x03\x12\x04\xcf\x02\x17\x18\n\ - \x0c\n\x02\x04%\x12\x06\xd2\x02\0\xd4\x02\x01\n\x0b\n\x03\x04%\x01\x12\ - \x04\xd2\x02\x08\x1e\n\x0c\n\x04\x04%\x02\0\x12\x04\xd3\x02\x04\x1e\n\ - \x0f\n\x05\x04%\x02\0\x04\x12\x06\xd3\x02\x04\xd2\x02\x20\n\r\n\x05\x04%\ - \x02\0\x06\x12\x04\xd3\x02\x04\x12\n\r\n\x05\x04%\x02\0\x01\x12\x04\xd3\ - \x02\x13\x19\n\r\n\x05\x04%\x02\0\x03\x12\x04\xd3\x02\x1c\x1db\x06proto3\ -"; - -static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/src/pdpb_grpc.rs b/_vendor/src/github.com/pingcap/kvproto/src/pdpb_grpc.rs deleted file mode 100644 index 2001670586c..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/src/pdpb_grpc.rs +++ /dev/null @@ -1,446 +0,0 @@ -// This file is generated. Do not edit -// @generated - -// https://github.com/Manishearth/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] - -const METHOD_PD_GET_MEMBERS: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/pdpb.PD/GetMembers", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_PD_TSO: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Duplex, - name: "/pdpb.PD/Tso", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_PD_BOOTSTRAP: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/pdpb.PD/Bootstrap", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_PD_IS_BOOTSTRAPPED: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/pdpb.PD/IsBootstrapped", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_PD_ALLOC_ID: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/pdpb.PD/AllocID", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_PD_GET_STORE: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/pdpb.PD/GetStore", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_PD_PUT_STORE: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/pdpb.PD/PutStore", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_PD_STORE_HEARTBEAT: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/pdpb.PD/StoreHeartbeat", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_PD_REGION_HEARTBEAT: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Duplex, - name: "/pdpb.PD/RegionHeartbeat", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_PD_GET_REGION: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/pdpb.PD/GetRegion", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_PD_GET_REGION_BY_ID: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/pdpb.PD/GetRegionByID", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_PD_ASK_SPLIT: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/pdpb.PD/AskSplit", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_PD_REPORT_SPLIT: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/pdpb.PD/ReportSplit", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_PD_GET_CLUSTER_CONFIG: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/pdpb.PD/GetClusterConfig", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_PD_PUT_CLUSTER_CONFIG: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/pdpb.PD/PutClusterConfig", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -pub struct PdClient { - client: ::grpcio::Client, -} - -impl PdClient { - pub fn new(channel: ::grpcio::Channel) -> Self { - PdClient { - client: ::grpcio::Client::new(channel), - } - } - - pub fn get_members_opt(&self, req: super::pdpb::GetMembersRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_PD_GET_MEMBERS, req, opt) - } - - pub fn get_members(&self, req: super::pdpb::GetMembersRequest) -> ::grpcio::Result { - self.get_members_opt(req, ::grpcio::CallOption::default()) - } - - pub fn get_members_async_opt(&self, req: super::pdpb::GetMembersRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_PD_GET_MEMBERS, req, opt) - } - - pub fn get_members_async(&self, req: super::pdpb::GetMembersRequest) -> ::grpcio::ClientUnaryReceiver { - self.get_members_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn tso_opt(&self, opt: ::grpcio::CallOption) -> (::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver) { - self.client.duplex_streaming(&METHOD_PD_TSO, opt) - } - - pub fn tso(&self) -> (::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver) { - self.tso_opt(::grpcio::CallOption::default()) - } - - pub fn bootstrap_opt(&self, req: super::pdpb::BootstrapRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_PD_BOOTSTRAP, req, opt) - } - - pub fn bootstrap(&self, req: super::pdpb::BootstrapRequest) -> ::grpcio::Result { - self.bootstrap_opt(req, ::grpcio::CallOption::default()) - } - - pub fn bootstrap_async_opt(&self, req: super::pdpb::BootstrapRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_PD_BOOTSTRAP, req, opt) - } - - pub fn bootstrap_async(&self, req: super::pdpb::BootstrapRequest) -> ::grpcio::ClientUnaryReceiver { - self.bootstrap_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn is_bootstrapped_opt(&self, req: super::pdpb::IsBootstrappedRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_PD_IS_BOOTSTRAPPED, req, opt) - } - - pub fn is_bootstrapped(&self, req: super::pdpb::IsBootstrappedRequest) -> ::grpcio::Result { - self.is_bootstrapped_opt(req, ::grpcio::CallOption::default()) - } - - pub fn is_bootstrapped_async_opt(&self, req: super::pdpb::IsBootstrappedRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_PD_IS_BOOTSTRAPPED, req, opt) - } - - pub fn is_bootstrapped_async(&self, req: super::pdpb::IsBootstrappedRequest) -> ::grpcio::ClientUnaryReceiver { - self.is_bootstrapped_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn alloc_id_opt(&self, req: super::pdpb::AllocIDRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_PD_ALLOC_ID, req, opt) - } - - pub fn alloc_id(&self, req: super::pdpb::AllocIDRequest) -> ::grpcio::Result { - self.alloc_id_opt(req, ::grpcio::CallOption::default()) - } - - pub fn alloc_id_async_opt(&self, req: super::pdpb::AllocIDRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_PD_ALLOC_ID, req, opt) - } - - pub fn alloc_id_async(&self, req: super::pdpb::AllocIDRequest) -> ::grpcio::ClientUnaryReceiver { - self.alloc_id_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn get_store_opt(&self, req: super::pdpb::GetStoreRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_PD_GET_STORE, req, opt) - } - - pub fn get_store(&self, req: super::pdpb::GetStoreRequest) -> ::grpcio::Result { - self.get_store_opt(req, ::grpcio::CallOption::default()) - } - - pub fn get_store_async_opt(&self, req: super::pdpb::GetStoreRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_PD_GET_STORE, req, opt) - } - - pub fn get_store_async(&self, req: super::pdpb::GetStoreRequest) -> ::grpcio::ClientUnaryReceiver { - self.get_store_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn put_store_opt(&self, req: super::pdpb::PutStoreRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_PD_PUT_STORE, req, opt) - } - - pub fn put_store(&self, req: super::pdpb::PutStoreRequest) -> ::grpcio::Result { - self.put_store_opt(req, ::grpcio::CallOption::default()) - } - - pub fn put_store_async_opt(&self, req: super::pdpb::PutStoreRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_PD_PUT_STORE, req, opt) - } - - pub fn put_store_async(&self, req: super::pdpb::PutStoreRequest) -> ::grpcio::ClientUnaryReceiver { - self.put_store_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn store_heartbeat_opt(&self, req: super::pdpb::StoreHeartbeatRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_PD_STORE_HEARTBEAT, req, opt) - } - - pub fn store_heartbeat(&self, req: super::pdpb::StoreHeartbeatRequest) -> ::grpcio::Result { - self.store_heartbeat_opt(req, ::grpcio::CallOption::default()) - } - - pub fn store_heartbeat_async_opt(&self, req: super::pdpb::StoreHeartbeatRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_PD_STORE_HEARTBEAT, req, opt) - } - - pub fn store_heartbeat_async(&self, req: super::pdpb::StoreHeartbeatRequest) -> ::grpcio::ClientUnaryReceiver { - self.store_heartbeat_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn region_heartbeat_opt(&self, opt: ::grpcio::CallOption) -> (::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver) { - self.client.duplex_streaming(&METHOD_PD_REGION_HEARTBEAT, opt) - } - - pub fn region_heartbeat(&self) -> (::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver) { - self.region_heartbeat_opt(::grpcio::CallOption::default()) - } - - pub fn get_region_opt(&self, req: super::pdpb::GetRegionRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_PD_GET_REGION, req, opt) - } - - pub fn get_region(&self, req: super::pdpb::GetRegionRequest) -> ::grpcio::Result { - self.get_region_opt(req, ::grpcio::CallOption::default()) - } - - pub fn get_region_async_opt(&self, req: super::pdpb::GetRegionRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_PD_GET_REGION, req, opt) - } - - pub fn get_region_async(&self, req: super::pdpb::GetRegionRequest) -> ::grpcio::ClientUnaryReceiver { - self.get_region_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn get_region_by_id_opt(&self, req: super::pdpb::GetRegionByIDRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_PD_GET_REGION_BY_ID, req, opt) - } - - pub fn get_region_by_id(&self, req: super::pdpb::GetRegionByIDRequest) -> ::grpcio::Result { - self.get_region_by_id_opt(req, ::grpcio::CallOption::default()) - } - - pub fn get_region_by_id_async_opt(&self, req: super::pdpb::GetRegionByIDRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_PD_GET_REGION_BY_ID, req, opt) - } - - pub fn get_region_by_id_async(&self, req: super::pdpb::GetRegionByIDRequest) -> ::grpcio::ClientUnaryReceiver { - self.get_region_by_id_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn ask_split_opt(&self, req: super::pdpb::AskSplitRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_PD_ASK_SPLIT, req, opt) - } - - pub fn ask_split(&self, req: super::pdpb::AskSplitRequest) -> ::grpcio::Result { - self.ask_split_opt(req, ::grpcio::CallOption::default()) - } - - pub fn ask_split_async_opt(&self, req: super::pdpb::AskSplitRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_PD_ASK_SPLIT, req, opt) - } - - pub fn ask_split_async(&self, req: super::pdpb::AskSplitRequest) -> ::grpcio::ClientUnaryReceiver { - self.ask_split_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn report_split_opt(&self, req: super::pdpb::ReportSplitRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_PD_REPORT_SPLIT, req, opt) - } - - pub fn report_split(&self, req: super::pdpb::ReportSplitRequest) -> ::grpcio::Result { - self.report_split_opt(req, ::grpcio::CallOption::default()) - } - - pub fn report_split_async_opt(&self, req: super::pdpb::ReportSplitRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_PD_REPORT_SPLIT, req, opt) - } - - pub fn report_split_async(&self, req: super::pdpb::ReportSplitRequest) -> ::grpcio::ClientUnaryReceiver { - self.report_split_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn get_cluster_config_opt(&self, req: super::pdpb::GetClusterConfigRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_PD_GET_CLUSTER_CONFIG, req, opt) - } - - pub fn get_cluster_config(&self, req: super::pdpb::GetClusterConfigRequest) -> ::grpcio::Result { - self.get_cluster_config_opt(req, ::grpcio::CallOption::default()) - } - - pub fn get_cluster_config_async_opt(&self, req: super::pdpb::GetClusterConfigRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_PD_GET_CLUSTER_CONFIG, req, opt) - } - - pub fn get_cluster_config_async(&self, req: super::pdpb::GetClusterConfigRequest) -> ::grpcio::ClientUnaryReceiver { - self.get_cluster_config_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn put_cluster_config_opt(&self, req: super::pdpb::PutClusterConfigRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_PD_PUT_CLUSTER_CONFIG, req, opt) - } - - pub fn put_cluster_config(&self, req: super::pdpb::PutClusterConfigRequest) -> ::grpcio::Result { - self.put_cluster_config_opt(req, ::grpcio::CallOption::default()) - } - - pub fn put_cluster_config_async_opt(&self, req: super::pdpb::PutClusterConfigRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_PD_PUT_CLUSTER_CONFIG, req, opt) - } - - pub fn put_cluster_config_async(&self, req: super::pdpb::PutClusterConfigRequest) -> ::grpcio::ClientUnaryReceiver { - self.put_cluster_config_async_opt(req, ::grpcio::CallOption::default()) - } - pub fn spawn(&self, f: F) where F: ::futures::Future + Send + 'static { - self.client.spawn(f) - } -} - -pub trait Pd { - fn get_members(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::GetMembersRequest, sink: ::grpcio::UnarySink); - fn tso(&self, ctx: ::grpcio::RpcContext, stream: ::grpcio::RequestStream, sink: ::grpcio::DuplexSink); - fn bootstrap(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::BootstrapRequest, sink: ::grpcio::UnarySink); - fn is_bootstrapped(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::IsBootstrappedRequest, sink: ::grpcio::UnarySink); - fn alloc_id(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::AllocIDRequest, sink: ::grpcio::UnarySink); - fn get_store(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::GetStoreRequest, sink: ::grpcio::UnarySink); - fn put_store(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::PutStoreRequest, sink: ::grpcio::UnarySink); - fn store_heartbeat(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::StoreHeartbeatRequest, sink: ::grpcio::UnarySink); - fn region_heartbeat(&self, ctx: ::grpcio::RpcContext, stream: ::grpcio::RequestStream, sink: ::grpcio::DuplexSink); - fn get_region(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::GetRegionRequest, sink: ::grpcio::UnarySink); - fn get_region_by_id(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::GetRegionByIDRequest, sink: ::grpcio::UnarySink); - fn ask_split(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::AskSplitRequest, sink: ::grpcio::UnarySink); - fn report_split(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::ReportSplitRequest, sink: ::grpcio::UnarySink); - fn get_cluster_config(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::GetClusterConfigRequest, sink: ::grpcio::UnarySink); - fn put_cluster_config(&self, ctx: ::grpcio::RpcContext, req: super::pdpb::PutClusterConfigRequest, sink: ::grpcio::UnarySink); -} - -pub fn create_pd(s: S) -> ::grpcio::Service { - let mut builder = ::grpcio::ServiceBuilder::new(); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_PD_GET_MEMBERS, move |ctx, req, resp| { - instance.get_members(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_duplex_streaming_handler(&METHOD_PD_TSO, move |ctx, req, resp| { - instance.tso(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_PD_BOOTSTRAP, move |ctx, req, resp| { - instance.bootstrap(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_PD_IS_BOOTSTRAPPED, move |ctx, req, resp| { - instance.is_bootstrapped(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_PD_ALLOC_ID, move |ctx, req, resp| { - instance.alloc_id(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_PD_GET_STORE, move |ctx, req, resp| { - instance.get_store(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_PD_PUT_STORE, move |ctx, req, resp| { - instance.put_store(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_PD_STORE_HEARTBEAT, move |ctx, req, resp| { - instance.store_heartbeat(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_duplex_streaming_handler(&METHOD_PD_REGION_HEARTBEAT, move |ctx, req, resp| { - instance.region_heartbeat(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_PD_GET_REGION, move |ctx, req, resp| { - instance.get_region(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_PD_GET_REGION_BY_ID, move |ctx, req, resp| { - instance.get_region_by_id(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_PD_ASK_SPLIT, move |ctx, req, resp| { - instance.ask_split(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_PD_REPORT_SPLIT, move |ctx, req, resp| { - instance.report_split(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_PD_GET_CLUSTER_CONFIG, move |ctx, req, resp| { - instance.get_cluster_config(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_PD_PUT_CLUSTER_CONFIG, move |ctx, req, resp| { - instance.put_cluster_config(ctx, req, resp) - }); - builder.build() -} diff --git a/_vendor/src/github.com/pingcap/kvproto/src/raft_cmdpb.rs b/_vendor/src/github.com/pingcap/kvproto/src/raft_cmdpb.rs deleted file mode 100644 index 0295ff43b37..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/src/raft_cmdpb.rs +++ /dev/null @@ -1,10096 +0,0 @@ -// This file is generated. Do not edit -// @generated - -// https://github.com/Manishearth/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] - -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; - -#[derive(PartialEq,Clone,Default)] -pub struct GetRequest { - // message fields - cf: ::protobuf::SingularField<::std::string::String>, - key: ::protobuf::SingularField<::std::vec::Vec>, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for GetRequest {} - -impl GetRequest { - pub fn new() -> GetRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static GetRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const GetRequest, - }; - unsafe { - instance.get(GetRequest::new) - } - } - - // optional string cf = 1; - - pub fn clear_cf(&mut self) { - self.cf.clear(); - } - - pub fn has_cf(&self) -> bool { - self.cf.is_some() - } - - // Param is passed by value, moved - pub fn set_cf(&mut self, v: ::std::string::String) { - self.cf = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_cf(&mut self) -> &mut ::std::string::String { - if self.cf.is_none() { - self.cf.set_default(); - } - self.cf.as_mut().unwrap() - } - - // Take field - pub fn take_cf(&mut self) -> ::std::string::String { - self.cf.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub fn get_cf(&self) -> &str { - match self.cf.as_ref() { - Some(v) => &v, - None => "", - } - } - - fn get_cf_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.cf - } - - fn mut_cf_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.cf - } - - // optional bytes key = 2; - - pub fn clear_key(&mut self) { - self.key.clear(); - } - - pub fn has_key(&self) -> bool { - self.key.is_some() - } - - // Param is passed by value, moved - pub fn set_key(&mut self, v: ::std::vec::Vec) { - self.key = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { - if self.key.is_none() { - self.key.set_default(); - } - self.key.as_mut().unwrap() - } - - // Take field - pub fn take_key(&mut self) -> ::std::vec::Vec { - self.key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_key(&self) -> &[u8] { - match self.key.as_ref() { - Some(v) => &v, - None => &[], - } - } - - fn get_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.key - } - - fn mut_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.key - } -} - -impl ::protobuf::Message for GetRequest { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.cf)?; - }, - 2 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.key)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.cf.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(ref v) = self.key.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.cf.as_ref() { - os.write_string(1, &v)?; - } - if let Some(ref v) = self.key.as_ref() { - os.write_bytes(2, &v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for GetRequest { - fn new() -> GetRequest { - GetRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "cf", - GetRequest::get_cf_for_reflect, - GetRequest::mut_cf_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "key", - GetRequest::get_key_for_reflect, - GetRequest::mut_key_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "GetRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for GetRequest { - fn clear(&mut self) { - self.clear_cf(); - self.clear_key(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for GetRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct GetResponse { - // message fields - value: ::protobuf::SingularField<::std::vec::Vec>, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for GetResponse {} - -impl GetResponse { - pub fn new() -> GetResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static GetResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const GetResponse, - }; - unsafe { - instance.get(GetResponse::new) - } - } - - // optional bytes value = 1; - - pub fn clear_value(&mut self) { - self.value.clear(); - } - - pub fn has_value(&self) -> bool { - self.value.is_some() - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: ::std::vec::Vec) { - self.value = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { - if self.value.is_none() { - self.value.set_default(); - } - self.value.as_mut().unwrap() - } - - // Take field - pub fn take_value(&mut self) -> ::std::vec::Vec { - self.value.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_value(&self) -> &[u8] { - match self.value.as_ref() { - Some(v) => &v, - None => &[], - } - } - - fn get_value_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.value - } - - fn mut_value_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.value - } -} - -impl ::protobuf::Message for GetResponse { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.value)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.value.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.value.as_ref() { - os.write_bytes(1, &v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for GetResponse { - fn new() -> GetResponse { - GetResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "value", - GetResponse::get_value_for_reflect, - GetResponse::mut_value_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "GetResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for GetResponse { - fn clear(&mut self) { - self.clear_value(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for GetResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for GetResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct PutRequest { - // message fields - cf: ::protobuf::SingularField<::std::string::String>, - key: ::protobuf::SingularField<::std::vec::Vec>, - value: ::protobuf::SingularField<::std::vec::Vec>, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for PutRequest {} - -impl PutRequest { - pub fn new() -> PutRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static PutRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const PutRequest, - }; - unsafe { - instance.get(PutRequest::new) - } - } - - // optional string cf = 1; - - pub fn clear_cf(&mut self) { - self.cf.clear(); - } - - pub fn has_cf(&self) -> bool { - self.cf.is_some() - } - - // Param is passed by value, moved - pub fn set_cf(&mut self, v: ::std::string::String) { - self.cf = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_cf(&mut self) -> &mut ::std::string::String { - if self.cf.is_none() { - self.cf.set_default(); - } - self.cf.as_mut().unwrap() - } - - // Take field - pub fn take_cf(&mut self) -> ::std::string::String { - self.cf.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub fn get_cf(&self) -> &str { - match self.cf.as_ref() { - Some(v) => &v, - None => "", - } - } - - fn get_cf_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.cf - } - - fn mut_cf_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.cf - } - - // optional bytes key = 2; - - pub fn clear_key(&mut self) { - self.key.clear(); - } - - pub fn has_key(&self) -> bool { - self.key.is_some() - } - - // Param is passed by value, moved - pub fn set_key(&mut self, v: ::std::vec::Vec) { - self.key = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { - if self.key.is_none() { - self.key.set_default(); - } - self.key.as_mut().unwrap() - } - - // Take field - pub fn take_key(&mut self) -> ::std::vec::Vec { - self.key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_key(&self) -> &[u8] { - match self.key.as_ref() { - Some(v) => &v, - None => &[], - } - } - - fn get_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.key - } - - fn mut_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.key - } - - // optional bytes value = 3; - - pub fn clear_value(&mut self) { - self.value.clear(); - } - - pub fn has_value(&self) -> bool { - self.value.is_some() - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: ::std::vec::Vec) { - self.value = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { - if self.value.is_none() { - self.value.set_default(); - } - self.value.as_mut().unwrap() - } - - // Take field - pub fn take_value(&mut self) -> ::std::vec::Vec { - self.value.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_value(&self) -> &[u8] { - match self.value.as_ref() { - Some(v) => &v, - None => &[], - } - } - - fn get_value_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.value - } - - fn mut_value_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.value - } -} - -impl ::protobuf::Message for PutRequest { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.cf)?; - }, - 2 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.key)?; - }, - 3 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.value)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.cf.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(ref v) = self.key.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(ref v) = self.value.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.cf.as_ref() { - os.write_string(1, &v)?; - } - if let Some(ref v) = self.key.as_ref() { - os.write_bytes(2, &v)?; - } - if let Some(ref v) = self.value.as_ref() { - os.write_bytes(3, &v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for PutRequest { - fn new() -> PutRequest { - PutRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "cf", - PutRequest::get_cf_for_reflect, - PutRequest::mut_cf_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "key", - PutRequest::get_key_for_reflect, - PutRequest::mut_key_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "value", - PutRequest::get_value_for_reflect, - PutRequest::mut_value_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "PutRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for PutRequest { - fn clear(&mut self) { - self.clear_cf(); - self.clear_key(); - self.clear_value(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for PutRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for PutRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct PutResponse { - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for PutResponse {} - -impl PutResponse { - pub fn new() -> PutResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static PutResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const PutResponse, - }; - unsafe { - instance.get(PutResponse::new) - } - } -} - -impl ::protobuf::Message for PutResponse { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for PutResponse { - fn new() -> PutResponse { - PutResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let fields = ::std::vec::Vec::new(); - ::protobuf::reflect::MessageDescriptor::new::( - "PutResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for PutResponse { - fn clear(&mut self) { - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for PutResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for PutResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct DeleteRequest { - // message fields - cf: ::protobuf::SingularField<::std::string::String>, - key: ::protobuf::SingularField<::std::vec::Vec>, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for DeleteRequest {} - -impl DeleteRequest { - pub fn new() -> DeleteRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static DeleteRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const DeleteRequest, - }; - unsafe { - instance.get(DeleteRequest::new) - } - } - - // optional string cf = 1; - - pub fn clear_cf(&mut self) { - self.cf.clear(); - } - - pub fn has_cf(&self) -> bool { - self.cf.is_some() - } - - // Param is passed by value, moved - pub fn set_cf(&mut self, v: ::std::string::String) { - self.cf = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_cf(&mut self) -> &mut ::std::string::String { - if self.cf.is_none() { - self.cf.set_default(); - } - self.cf.as_mut().unwrap() - } - - // Take field - pub fn take_cf(&mut self) -> ::std::string::String { - self.cf.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub fn get_cf(&self) -> &str { - match self.cf.as_ref() { - Some(v) => &v, - None => "", - } - } - - fn get_cf_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.cf - } - - fn mut_cf_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.cf - } - - // optional bytes key = 2; - - pub fn clear_key(&mut self) { - self.key.clear(); - } - - pub fn has_key(&self) -> bool { - self.key.is_some() - } - - // Param is passed by value, moved - pub fn set_key(&mut self, v: ::std::vec::Vec) { - self.key = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { - if self.key.is_none() { - self.key.set_default(); - } - self.key.as_mut().unwrap() - } - - // Take field - pub fn take_key(&mut self) -> ::std::vec::Vec { - self.key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_key(&self) -> &[u8] { - match self.key.as_ref() { - Some(v) => &v, - None => &[], - } - } - - fn get_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.key - } - - fn mut_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.key - } -} - -impl ::protobuf::Message for DeleteRequest { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.cf)?; - }, - 2 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.key)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.cf.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(ref v) = self.key.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.cf.as_ref() { - os.write_string(1, &v)?; - } - if let Some(ref v) = self.key.as_ref() { - os.write_bytes(2, &v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for DeleteRequest { - fn new() -> DeleteRequest { - DeleteRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "cf", - DeleteRequest::get_cf_for_reflect, - DeleteRequest::mut_cf_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "key", - DeleteRequest::get_key_for_reflect, - DeleteRequest::mut_key_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "DeleteRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for DeleteRequest { - fn clear(&mut self) { - self.clear_cf(); - self.clear_key(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for DeleteRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DeleteRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct DeleteResponse { - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for DeleteResponse {} - -impl DeleteResponse { - pub fn new() -> DeleteResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static DeleteResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const DeleteResponse, - }; - unsafe { - instance.get(DeleteResponse::new) - } - } -} - -impl ::protobuf::Message for DeleteResponse { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for DeleteResponse { - fn new() -> DeleteResponse { - DeleteResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let fields = ::std::vec::Vec::new(); - ::protobuf::reflect::MessageDescriptor::new::( - "DeleteResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for DeleteResponse { - fn clear(&mut self) { - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for DeleteResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DeleteResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct DeleteRangeRequest { - // message fields - cf: ::protobuf::SingularField<::std::string::String>, - start_key: ::protobuf::SingularField<::std::vec::Vec>, - end_key: ::protobuf::SingularField<::std::vec::Vec>, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for DeleteRangeRequest {} - -impl DeleteRangeRequest { - pub fn new() -> DeleteRangeRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static DeleteRangeRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const DeleteRangeRequest, - }; - unsafe { - instance.get(DeleteRangeRequest::new) - } - } - - // optional string cf = 1; - - pub fn clear_cf(&mut self) { - self.cf.clear(); - } - - pub fn has_cf(&self) -> bool { - self.cf.is_some() - } - - // Param is passed by value, moved - pub fn set_cf(&mut self, v: ::std::string::String) { - self.cf = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_cf(&mut self) -> &mut ::std::string::String { - if self.cf.is_none() { - self.cf.set_default(); - } - self.cf.as_mut().unwrap() - } - - // Take field - pub fn take_cf(&mut self) -> ::std::string::String { - self.cf.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub fn get_cf(&self) -> &str { - match self.cf.as_ref() { - Some(v) => &v, - None => "", - } - } - - fn get_cf_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.cf - } - - fn mut_cf_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.cf - } - - // optional bytes start_key = 2; - - pub fn clear_start_key(&mut self) { - self.start_key.clear(); - } - - pub fn has_start_key(&self) -> bool { - self.start_key.is_some() - } - - // Param is passed by value, moved - pub fn set_start_key(&mut self, v: ::std::vec::Vec) { - self.start_key = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_start_key(&mut self) -> &mut ::std::vec::Vec { - if self.start_key.is_none() { - self.start_key.set_default(); - } - self.start_key.as_mut().unwrap() - } - - // Take field - pub fn take_start_key(&mut self) -> ::std::vec::Vec { - self.start_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_start_key(&self) -> &[u8] { - match self.start_key.as_ref() { - Some(v) => &v, - None => &[], - } - } - - fn get_start_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.start_key - } - - fn mut_start_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.start_key - } - - // optional bytes end_key = 3; - - pub fn clear_end_key(&mut self) { - self.end_key.clear(); - } - - pub fn has_end_key(&self) -> bool { - self.end_key.is_some() - } - - // Param is passed by value, moved - pub fn set_end_key(&mut self, v: ::std::vec::Vec) { - self.end_key = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_end_key(&mut self) -> &mut ::std::vec::Vec { - if self.end_key.is_none() { - self.end_key.set_default(); - } - self.end_key.as_mut().unwrap() - } - - // Take field - pub fn take_end_key(&mut self) -> ::std::vec::Vec { - self.end_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_end_key(&self) -> &[u8] { - match self.end_key.as_ref() { - Some(v) => &v, - None => &[], - } - } - - fn get_end_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.end_key - } - - fn mut_end_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.end_key - } -} - -impl ::protobuf::Message for DeleteRangeRequest { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.cf)?; - }, - 2 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.start_key)?; - }, - 3 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.end_key)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.cf.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(ref v) = self.start_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(ref v) = self.end_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.cf.as_ref() { - os.write_string(1, &v)?; - } - if let Some(ref v) = self.start_key.as_ref() { - os.write_bytes(2, &v)?; - } - if let Some(ref v) = self.end_key.as_ref() { - os.write_bytes(3, &v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for DeleteRangeRequest { - fn new() -> DeleteRangeRequest { - DeleteRangeRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "cf", - DeleteRangeRequest::get_cf_for_reflect, - DeleteRangeRequest::mut_cf_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "start_key", - DeleteRangeRequest::get_start_key_for_reflect, - DeleteRangeRequest::mut_start_key_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "end_key", - DeleteRangeRequest::get_end_key_for_reflect, - DeleteRangeRequest::mut_end_key_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "DeleteRangeRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for DeleteRangeRequest { - fn clear(&mut self) { - self.clear_cf(); - self.clear_start_key(); - self.clear_end_key(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for DeleteRangeRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DeleteRangeRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct DeleteRangeResponse { - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for DeleteRangeResponse {} - -impl DeleteRangeResponse { - pub fn new() -> DeleteRangeResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static DeleteRangeResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const DeleteRangeResponse, - }; - unsafe { - instance.get(DeleteRangeResponse::new) - } - } -} - -impl ::protobuf::Message for DeleteRangeResponse { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for DeleteRangeResponse { - fn new() -> DeleteRangeResponse { - DeleteRangeResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let fields = ::std::vec::Vec::new(); - ::protobuf::reflect::MessageDescriptor::new::( - "DeleteRangeResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for DeleteRangeResponse { - fn clear(&mut self) { - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for DeleteRangeResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for DeleteRangeResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct SnapRequest { - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for SnapRequest {} - -impl SnapRequest { - pub fn new() -> SnapRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static SnapRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const SnapRequest, - }; - unsafe { - instance.get(SnapRequest::new) - } - } -} - -impl ::protobuf::Message for SnapRequest { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for SnapRequest { - fn new() -> SnapRequest { - SnapRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let fields = ::std::vec::Vec::new(); - ::protobuf::reflect::MessageDescriptor::new::( - "SnapRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for SnapRequest { - fn clear(&mut self) { - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for SnapRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SnapRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct SnapResponse { - // message fields - region: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for SnapResponse {} - -impl SnapResponse { - pub fn new() -> SnapResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static SnapResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const SnapResponse, - }; - unsafe { - instance.get(SnapResponse::new) - } - } - - // optional .metapb.Region region = 1; - - pub fn clear_region(&mut self) { - self.region.clear(); - } - - pub fn has_region(&self) -> bool { - self.region.is_some() - } - - // Param is passed by value, moved - pub fn set_region(&mut self, v: super::metapb::Region) { - self.region = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region(&mut self) -> &mut super::metapb::Region { - if self.region.is_none() { - self.region.set_default(); - } - self.region.as_mut().unwrap() - } - - // Take field - pub fn take_region(&mut self) -> super::metapb::Region { - self.region.take().unwrap_or_else(|| super::metapb::Region::new()) - } - - pub fn get_region(&self) -> &super::metapb::Region { - self.region.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) - } - - fn get_region_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region - } - - fn mut_region_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region - } -} - -impl ::protobuf::Message for SnapResponse { - fn is_initialized(&self) -> bool { - for v in &self.region { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.region.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.region.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for SnapResponse { - fn new() -> SnapResponse { - SnapResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region", - SnapResponse::get_region_for_reflect, - SnapResponse::mut_region_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "SnapResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for SnapResponse { - fn clear(&mut self) { - self.clear_region(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for SnapResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SnapResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct PrewriteRequest { - // message fields - key: ::protobuf::SingularField<::std::vec::Vec>, - value: ::protobuf::SingularField<::std::vec::Vec>, - lock: ::protobuf::SingularField<::std::vec::Vec>, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for PrewriteRequest {} - -impl PrewriteRequest { - pub fn new() -> PrewriteRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static PrewriteRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const PrewriteRequest, - }; - unsafe { - instance.get(PrewriteRequest::new) - } - } - - // optional bytes key = 1; - - pub fn clear_key(&mut self) { - self.key.clear(); - } - - pub fn has_key(&self) -> bool { - self.key.is_some() - } - - // Param is passed by value, moved - pub fn set_key(&mut self, v: ::std::vec::Vec) { - self.key = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { - if self.key.is_none() { - self.key.set_default(); - } - self.key.as_mut().unwrap() - } - - // Take field - pub fn take_key(&mut self) -> ::std::vec::Vec { - self.key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_key(&self) -> &[u8] { - match self.key.as_ref() { - Some(v) => &v, - None => &[], - } - } - - fn get_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.key - } - - fn mut_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.key - } - - // optional bytes value = 2; - - pub fn clear_value(&mut self) { - self.value.clear(); - } - - pub fn has_value(&self) -> bool { - self.value.is_some() - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: ::std::vec::Vec) { - self.value = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { - if self.value.is_none() { - self.value.set_default(); - } - self.value.as_mut().unwrap() - } - - // Take field - pub fn take_value(&mut self) -> ::std::vec::Vec { - self.value.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_value(&self) -> &[u8] { - match self.value.as_ref() { - Some(v) => &v, - None => &[], - } - } - - fn get_value_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.value - } - - fn mut_value_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.value - } - - // optional bytes lock = 3; - - pub fn clear_lock(&mut self) { - self.lock.clear(); - } - - pub fn has_lock(&self) -> bool { - self.lock.is_some() - } - - // Param is passed by value, moved - pub fn set_lock(&mut self, v: ::std::vec::Vec) { - self.lock = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_lock(&mut self) -> &mut ::std::vec::Vec { - if self.lock.is_none() { - self.lock.set_default(); - } - self.lock.as_mut().unwrap() - } - - // Take field - pub fn take_lock(&mut self) -> ::std::vec::Vec { - self.lock.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_lock(&self) -> &[u8] { - match self.lock.as_ref() { - Some(v) => &v, - None => &[], - } - } - - fn get_lock_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.lock - } - - fn mut_lock_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.lock - } -} - -impl ::protobuf::Message for PrewriteRequest { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.key)?; - }, - 2 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.value)?; - }, - 3 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.lock)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.key.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(ref v) = self.value.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(ref v) = self.lock.as_ref() { - my_size += ::protobuf::rt::bytes_size(3, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.key.as_ref() { - os.write_bytes(1, &v)?; - } - if let Some(ref v) = self.value.as_ref() { - os.write_bytes(2, &v)?; - } - if let Some(ref v) = self.lock.as_ref() { - os.write_bytes(3, &v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for PrewriteRequest { - fn new() -> PrewriteRequest { - PrewriteRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "key", - PrewriteRequest::get_key_for_reflect, - PrewriteRequest::mut_key_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "value", - PrewriteRequest::get_value_for_reflect, - PrewriteRequest::mut_value_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "lock", - PrewriteRequest::get_lock_for_reflect, - PrewriteRequest::mut_lock_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "PrewriteRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for PrewriteRequest { - fn clear(&mut self) { - self.clear_key(); - self.clear_value(); - self.clear_lock(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for PrewriteRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for PrewriteRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct PrewriteResponse { - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for PrewriteResponse {} - -impl PrewriteResponse { - pub fn new() -> PrewriteResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static PrewriteResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const PrewriteResponse, - }; - unsafe { - instance.get(PrewriteResponse::new) - } - } -} - -impl ::protobuf::Message for PrewriteResponse { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for PrewriteResponse { - fn new() -> PrewriteResponse { - PrewriteResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let fields = ::std::vec::Vec::new(); - ::protobuf::reflect::MessageDescriptor::new::( - "PrewriteResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for PrewriteResponse { - fn clear(&mut self) { - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for PrewriteResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for PrewriteResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Request { - // message fields - cmd_type: ::std::option::Option, - get: ::protobuf::SingularPtrField, - put: ::protobuf::SingularPtrField, - delete: ::protobuf::SingularPtrField, - snap: ::protobuf::SingularPtrField, - prewrite: ::protobuf::SingularPtrField, - delete_range: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Request {} - -impl Request { - pub fn new() -> Request { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Request { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Request, - }; - unsafe { - instance.get(Request::new) - } - } - - // optional .raft_cmdpb.CmdType cmd_type = 1; - - pub fn clear_cmd_type(&mut self) { - self.cmd_type = ::std::option::Option::None; - } - - pub fn has_cmd_type(&self) -> bool { - self.cmd_type.is_some() - } - - // Param is passed by value, moved - pub fn set_cmd_type(&mut self, v: CmdType) { - self.cmd_type = ::std::option::Option::Some(v); - } - - pub fn get_cmd_type(&self) -> CmdType { - self.cmd_type.unwrap_or(CmdType::Invalid) - } - - fn get_cmd_type_for_reflect(&self) -> &::std::option::Option { - &self.cmd_type - } - - fn mut_cmd_type_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.cmd_type - } - - // optional .raft_cmdpb.GetRequest get = 2; - - pub fn clear_get(&mut self) { - self.get.clear(); - } - - pub fn has_get(&self) -> bool { - self.get.is_some() - } - - // Param is passed by value, moved - pub fn set_get(&mut self, v: GetRequest) { - self.get = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_get(&mut self) -> &mut GetRequest { - if self.get.is_none() { - self.get.set_default(); - } - self.get.as_mut().unwrap() - } - - // Take field - pub fn take_get(&mut self) -> GetRequest { - self.get.take().unwrap_or_else(|| GetRequest::new()) - } - - pub fn get_get(&self) -> &GetRequest { - self.get.as_ref().unwrap_or_else(|| GetRequest::default_instance()) - } - - fn get_get_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.get - } - - fn mut_get_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.get - } - - // optional .raft_cmdpb.PutRequest put = 4; - - pub fn clear_put(&mut self) { - self.put.clear(); - } - - pub fn has_put(&self) -> bool { - self.put.is_some() - } - - // Param is passed by value, moved - pub fn set_put(&mut self, v: PutRequest) { - self.put = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_put(&mut self) -> &mut PutRequest { - if self.put.is_none() { - self.put.set_default(); - } - self.put.as_mut().unwrap() - } - - // Take field - pub fn take_put(&mut self) -> PutRequest { - self.put.take().unwrap_or_else(|| PutRequest::new()) - } - - pub fn get_put(&self) -> &PutRequest { - self.put.as_ref().unwrap_or_else(|| PutRequest::default_instance()) - } - - fn get_put_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.put - } - - fn mut_put_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.put - } - - // optional .raft_cmdpb.DeleteRequest delete = 5; - - pub fn clear_delete(&mut self) { - self.delete.clear(); - } - - pub fn has_delete(&self) -> bool { - self.delete.is_some() - } - - // Param is passed by value, moved - pub fn set_delete(&mut self, v: DeleteRequest) { - self.delete = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_delete(&mut self) -> &mut DeleteRequest { - if self.delete.is_none() { - self.delete.set_default(); - } - self.delete.as_mut().unwrap() - } - - // Take field - pub fn take_delete(&mut self) -> DeleteRequest { - self.delete.take().unwrap_or_else(|| DeleteRequest::new()) - } - - pub fn get_delete(&self) -> &DeleteRequest { - self.delete.as_ref().unwrap_or_else(|| DeleteRequest::default_instance()) - } - - fn get_delete_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.delete - } - - fn mut_delete_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.delete - } - - // optional .raft_cmdpb.SnapRequest snap = 6; - - pub fn clear_snap(&mut self) { - self.snap.clear(); - } - - pub fn has_snap(&self) -> bool { - self.snap.is_some() - } - - // Param is passed by value, moved - pub fn set_snap(&mut self, v: SnapRequest) { - self.snap = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_snap(&mut self) -> &mut SnapRequest { - if self.snap.is_none() { - self.snap.set_default(); - } - self.snap.as_mut().unwrap() - } - - // Take field - pub fn take_snap(&mut self) -> SnapRequest { - self.snap.take().unwrap_or_else(|| SnapRequest::new()) - } - - pub fn get_snap(&self) -> &SnapRequest { - self.snap.as_ref().unwrap_or_else(|| SnapRequest::default_instance()) - } - - fn get_snap_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.snap - } - - fn mut_snap_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.snap - } - - // optional .raft_cmdpb.PrewriteRequest prewrite = 7; - - pub fn clear_prewrite(&mut self) { - self.prewrite.clear(); - } - - pub fn has_prewrite(&self) -> bool { - self.prewrite.is_some() - } - - // Param is passed by value, moved - pub fn set_prewrite(&mut self, v: PrewriteRequest) { - self.prewrite = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_prewrite(&mut self) -> &mut PrewriteRequest { - if self.prewrite.is_none() { - self.prewrite.set_default(); - } - self.prewrite.as_mut().unwrap() - } - - // Take field - pub fn take_prewrite(&mut self) -> PrewriteRequest { - self.prewrite.take().unwrap_or_else(|| PrewriteRequest::new()) - } - - pub fn get_prewrite(&self) -> &PrewriteRequest { - self.prewrite.as_ref().unwrap_or_else(|| PrewriteRequest::default_instance()) - } - - fn get_prewrite_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.prewrite - } - - fn mut_prewrite_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.prewrite - } - - // optional .raft_cmdpb.DeleteRangeRequest delete_range = 8; - - pub fn clear_delete_range(&mut self) { - self.delete_range.clear(); - } - - pub fn has_delete_range(&self) -> bool { - self.delete_range.is_some() - } - - // Param is passed by value, moved - pub fn set_delete_range(&mut self, v: DeleteRangeRequest) { - self.delete_range = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_delete_range(&mut self) -> &mut DeleteRangeRequest { - if self.delete_range.is_none() { - self.delete_range.set_default(); - } - self.delete_range.as_mut().unwrap() - } - - // Take field - pub fn take_delete_range(&mut self) -> DeleteRangeRequest { - self.delete_range.take().unwrap_or_else(|| DeleteRangeRequest::new()) - } - - pub fn get_delete_range(&self) -> &DeleteRangeRequest { - self.delete_range.as_ref().unwrap_or_else(|| DeleteRangeRequest::default_instance()) - } - - fn get_delete_range_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.delete_range - } - - fn mut_delete_range_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.delete_range - } -} - -impl ::protobuf::Message for Request { - fn is_initialized(&self) -> bool { - for v in &self.get { - if !v.is_initialized() { - return false; - } - }; - for v in &self.put { - if !v.is_initialized() { - return false; - } - }; - for v in &self.delete { - if !v.is_initialized() { - return false; - } - }; - for v in &self.snap { - if !v.is_initialized() { - return false; - } - }; - for v in &self.prewrite { - if !v.is_initialized() { - return false; - } - }; - for v in &self.delete_range { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.cmd_type = ::std::option::Option::Some(tmp); - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.get)?; - }, - 4 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.put)?; - }, - 5 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.delete)?; - }, - 6 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.snap)?; - }, - 7 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.prewrite)?; - }, - 8 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.delete_range)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.cmd_type { - my_size += ::protobuf::rt::enum_size(1, v); - } - if let Some(ref v) = self.get.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.put.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.delete.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.snap.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.prewrite.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.delete_range.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.cmd_type { - os.write_enum(1, v.value())?; - } - if let Some(ref v) = self.get.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.put.as_ref() { - os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.delete.as_ref() { - os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.snap.as_ref() { - os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.prewrite.as_ref() { - os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.delete_range.as_ref() { - os.write_tag(8, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Request { - fn new() -> Request { - Request::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "cmd_type", - Request::get_cmd_type_for_reflect, - Request::mut_cmd_type_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "get", - Request::get_get_for_reflect, - Request::mut_get_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "put", - Request::get_put_for_reflect, - Request::mut_put_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "delete", - Request::get_delete_for_reflect, - Request::mut_delete_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "snap", - Request::get_snap_for_reflect, - Request::mut_snap_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "prewrite", - Request::get_prewrite_for_reflect, - Request::mut_prewrite_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "delete_range", - Request::get_delete_range_for_reflect, - Request::mut_delete_range_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Request", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Request { - fn clear(&mut self) { - self.clear_cmd_type(); - self.clear_get(); - self.clear_put(); - self.clear_delete(); - self.clear_snap(); - self.clear_prewrite(); - self.clear_delete_range(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Request { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Request { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Response { - // message fields - cmd_type: ::std::option::Option, - get: ::protobuf::SingularPtrField, - put: ::protobuf::SingularPtrField, - delete: ::protobuf::SingularPtrField, - snap: ::protobuf::SingularPtrField, - prewrite: ::protobuf::SingularPtrField, - delte_range: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Response {} - -impl Response { - pub fn new() -> Response { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Response { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Response, - }; - unsafe { - instance.get(Response::new) - } - } - - // optional .raft_cmdpb.CmdType cmd_type = 1; - - pub fn clear_cmd_type(&mut self) { - self.cmd_type = ::std::option::Option::None; - } - - pub fn has_cmd_type(&self) -> bool { - self.cmd_type.is_some() - } - - // Param is passed by value, moved - pub fn set_cmd_type(&mut self, v: CmdType) { - self.cmd_type = ::std::option::Option::Some(v); - } - - pub fn get_cmd_type(&self) -> CmdType { - self.cmd_type.unwrap_or(CmdType::Invalid) - } - - fn get_cmd_type_for_reflect(&self) -> &::std::option::Option { - &self.cmd_type - } - - fn mut_cmd_type_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.cmd_type - } - - // optional .raft_cmdpb.GetResponse get = 2; - - pub fn clear_get(&mut self) { - self.get.clear(); - } - - pub fn has_get(&self) -> bool { - self.get.is_some() - } - - // Param is passed by value, moved - pub fn set_get(&mut self, v: GetResponse) { - self.get = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_get(&mut self) -> &mut GetResponse { - if self.get.is_none() { - self.get.set_default(); - } - self.get.as_mut().unwrap() - } - - // Take field - pub fn take_get(&mut self) -> GetResponse { - self.get.take().unwrap_or_else(|| GetResponse::new()) - } - - pub fn get_get(&self) -> &GetResponse { - self.get.as_ref().unwrap_or_else(|| GetResponse::default_instance()) - } - - fn get_get_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.get - } - - fn mut_get_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.get - } - - // optional .raft_cmdpb.PutResponse put = 4; - - pub fn clear_put(&mut self) { - self.put.clear(); - } - - pub fn has_put(&self) -> bool { - self.put.is_some() - } - - // Param is passed by value, moved - pub fn set_put(&mut self, v: PutResponse) { - self.put = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_put(&mut self) -> &mut PutResponse { - if self.put.is_none() { - self.put.set_default(); - } - self.put.as_mut().unwrap() - } - - // Take field - pub fn take_put(&mut self) -> PutResponse { - self.put.take().unwrap_or_else(|| PutResponse::new()) - } - - pub fn get_put(&self) -> &PutResponse { - self.put.as_ref().unwrap_or_else(|| PutResponse::default_instance()) - } - - fn get_put_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.put - } - - fn mut_put_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.put - } - - // optional .raft_cmdpb.DeleteResponse delete = 5; - - pub fn clear_delete(&mut self) { - self.delete.clear(); - } - - pub fn has_delete(&self) -> bool { - self.delete.is_some() - } - - // Param is passed by value, moved - pub fn set_delete(&mut self, v: DeleteResponse) { - self.delete = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_delete(&mut self) -> &mut DeleteResponse { - if self.delete.is_none() { - self.delete.set_default(); - } - self.delete.as_mut().unwrap() - } - - // Take field - pub fn take_delete(&mut self) -> DeleteResponse { - self.delete.take().unwrap_or_else(|| DeleteResponse::new()) - } - - pub fn get_delete(&self) -> &DeleteResponse { - self.delete.as_ref().unwrap_or_else(|| DeleteResponse::default_instance()) - } - - fn get_delete_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.delete - } - - fn mut_delete_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.delete - } - - // optional .raft_cmdpb.SnapResponse snap = 6; - - pub fn clear_snap(&mut self) { - self.snap.clear(); - } - - pub fn has_snap(&self) -> bool { - self.snap.is_some() - } - - // Param is passed by value, moved - pub fn set_snap(&mut self, v: SnapResponse) { - self.snap = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_snap(&mut self) -> &mut SnapResponse { - if self.snap.is_none() { - self.snap.set_default(); - } - self.snap.as_mut().unwrap() - } - - // Take field - pub fn take_snap(&mut self) -> SnapResponse { - self.snap.take().unwrap_or_else(|| SnapResponse::new()) - } - - pub fn get_snap(&self) -> &SnapResponse { - self.snap.as_ref().unwrap_or_else(|| SnapResponse::default_instance()) - } - - fn get_snap_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.snap - } - - fn mut_snap_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.snap - } - - // optional .raft_cmdpb.PrewriteResponse prewrite = 7; - - pub fn clear_prewrite(&mut self) { - self.prewrite.clear(); - } - - pub fn has_prewrite(&self) -> bool { - self.prewrite.is_some() - } - - // Param is passed by value, moved - pub fn set_prewrite(&mut self, v: PrewriteResponse) { - self.prewrite = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_prewrite(&mut self) -> &mut PrewriteResponse { - if self.prewrite.is_none() { - self.prewrite.set_default(); - } - self.prewrite.as_mut().unwrap() - } - - // Take field - pub fn take_prewrite(&mut self) -> PrewriteResponse { - self.prewrite.take().unwrap_or_else(|| PrewriteResponse::new()) - } - - pub fn get_prewrite(&self) -> &PrewriteResponse { - self.prewrite.as_ref().unwrap_or_else(|| PrewriteResponse::default_instance()) - } - - fn get_prewrite_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.prewrite - } - - fn mut_prewrite_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.prewrite - } - - // optional .raft_cmdpb.DeleteRangeResponse delte_range = 8; - - pub fn clear_delte_range(&mut self) { - self.delte_range.clear(); - } - - pub fn has_delte_range(&self) -> bool { - self.delte_range.is_some() - } - - // Param is passed by value, moved - pub fn set_delte_range(&mut self, v: DeleteRangeResponse) { - self.delte_range = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_delte_range(&mut self) -> &mut DeleteRangeResponse { - if self.delte_range.is_none() { - self.delte_range.set_default(); - } - self.delte_range.as_mut().unwrap() - } - - // Take field - pub fn take_delte_range(&mut self) -> DeleteRangeResponse { - self.delte_range.take().unwrap_or_else(|| DeleteRangeResponse::new()) - } - - pub fn get_delte_range(&self) -> &DeleteRangeResponse { - self.delte_range.as_ref().unwrap_or_else(|| DeleteRangeResponse::default_instance()) - } - - fn get_delte_range_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.delte_range - } - - fn mut_delte_range_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.delte_range - } -} - -impl ::protobuf::Message for Response { - fn is_initialized(&self) -> bool { - for v in &self.get { - if !v.is_initialized() { - return false; - } - }; - for v in &self.put { - if !v.is_initialized() { - return false; - } - }; - for v in &self.delete { - if !v.is_initialized() { - return false; - } - }; - for v in &self.snap { - if !v.is_initialized() { - return false; - } - }; - for v in &self.prewrite { - if !v.is_initialized() { - return false; - } - }; - for v in &self.delte_range { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.cmd_type = ::std::option::Option::Some(tmp); - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.get)?; - }, - 4 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.put)?; - }, - 5 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.delete)?; - }, - 6 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.snap)?; - }, - 7 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.prewrite)?; - }, - 8 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.delte_range)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.cmd_type { - my_size += ::protobuf::rt::enum_size(1, v); - } - if let Some(ref v) = self.get.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.put.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.delete.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.snap.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.prewrite.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.delte_range.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.cmd_type { - os.write_enum(1, v.value())?; - } - if let Some(ref v) = self.get.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.put.as_ref() { - os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.delete.as_ref() { - os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.snap.as_ref() { - os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.prewrite.as_ref() { - os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.delte_range.as_ref() { - os.write_tag(8, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Response { - fn new() -> Response { - Response::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "cmd_type", - Response::get_cmd_type_for_reflect, - Response::mut_cmd_type_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "get", - Response::get_get_for_reflect, - Response::mut_get_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "put", - Response::get_put_for_reflect, - Response::mut_put_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "delete", - Response::get_delete_for_reflect, - Response::mut_delete_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "snap", - Response::get_snap_for_reflect, - Response::mut_snap_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "prewrite", - Response::get_prewrite_for_reflect, - Response::mut_prewrite_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "delte_range", - Response::get_delte_range_for_reflect, - Response::mut_delte_range_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Response", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Response { - fn clear(&mut self) { - self.clear_cmd_type(); - self.clear_get(); - self.clear_put(); - self.clear_delete(); - self.clear_snap(); - self.clear_prewrite(); - self.clear_delte_range(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Response { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Response { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ChangePeerRequest { - // message fields - change_type: ::std::option::Option, - peer: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for ChangePeerRequest {} - -impl ChangePeerRequest { - pub fn new() -> ChangePeerRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static ChangePeerRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ChangePeerRequest, - }; - unsafe { - instance.get(ChangePeerRequest::new) - } - } - - // optional .eraftpb.ConfChangeType change_type = 1; - - pub fn clear_change_type(&mut self) { - self.change_type = ::std::option::Option::None; - } - - pub fn has_change_type(&self) -> bool { - self.change_type.is_some() - } - - // Param is passed by value, moved - pub fn set_change_type(&mut self, v: super::eraftpb::ConfChangeType) { - self.change_type = ::std::option::Option::Some(v); - } - - pub fn get_change_type(&self) -> super::eraftpb::ConfChangeType { - self.change_type.unwrap_or(super::eraftpb::ConfChangeType::AddNode) - } - - fn get_change_type_for_reflect(&self) -> &::std::option::Option { - &self.change_type - } - - fn mut_change_type_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.change_type - } - - // optional .metapb.Peer peer = 2; - - pub fn clear_peer(&mut self) { - self.peer.clear(); - } - - pub fn has_peer(&self) -> bool { - self.peer.is_some() - } - - // Param is passed by value, moved - pub fn set_peer(&mut self, v: super::metapb::Peer) { - self.peer = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_peer(&mut self) -> &mut super::metapb::Peer { - if self.peer.is_none() { - self.peer.set_default(); - } - self.peer.as_mut().unwrap() - } - - // Take field - pub fn take_peer(&mut self) -> super::metapb::Peer { - self.peer.take().unwrap_or_else(|| super::metapb::Peer::new()) - } - - pub fn get_peer(&self) -> &super::metapb::Peer { - self.peer.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) - } - - fn get_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.peer - } - - fn mut_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.peer - } -} - -impl ::protobuf::Message for ChangePeerRequest { - fn is_initialized(&self) -> bool { - for v in &self.peer { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.change_type = ::std::option::Option::Some(tmp); - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.peer)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.change_type { - my_size += ::protobuf::rt::enum_size(1, v); - } - if let Some(ref v) = self.peer.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.change_type { - os.write_enum(1, v.value())?; - } - if let Some(ref v) = self.peer.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for ChangePeerRequest { - fn new() -> ChangePeerRequest { - ChangePeerRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "change_type", - ChangePeerRequest::get_change_type_for_reflect, - ChangePeerRequest::mut_change_type_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "peer", - ChangePeerRequest::get_peer_for_reflect, - ChangePeerRequest::mut_peer_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "ChangePeerRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for ChangePeerRequest { - fn clear(&mut self) { - self.clear_change_type(); - self.clear_peer(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ChangePeerRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ChangePeerRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct ChangePeerResponse { - // message fields - region: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for ChangePeerResponse {} - -impl ChangePeerResponse { - pub fn new() -> ChangePeerResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static ChangePeerResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ChangePeerResponse, - }; - unsafe { - instance.get(ChangePeerResponse::new) - } - } - - // optional .metapb.Region region = 1; - - pub fn clear_region(&mut self) { - self.region.clear(); - } - - pub fn has_region(&self) -> bool { - self.region.is_some() - } - - // Param is passed by value, moved - pub fn set_region(&mut self, v: super::metapb::Region) { - self.region = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region(&mut self) -> &mut super::metapb::Region { - if self.region.is_none() { - self.region.set_default(); - } - self.region.as_mut().unwrap() - } - - // Take field - pub fn take_region(&mut self) -> super::metapb::Region { - self.region.take().unwrap_or_else(|| super::metapb::Region::new()) - } - - pub fn get_region(&self) -> &super::metapb::Region { - self.region.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) - } - - fn get_region_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region - } - - fn mut_region_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region - } -} - -impl ::protobuf::Message for ChangePeerResponse { - fn is_initialized(&self) -> bool { - for v in &self.region { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.region.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.region.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for ChangePeerResponse { - fn new() -> ChangePeerResponse { - ChangePeerResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region", - ChangePeerResponse::get_region_for_reflect, - ChangePeerResponse::mut_region_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "ChangePeerResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for ChangePeerResponse { - fn clear(&mut self) { - self.clear_region(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ChangePeerResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ChangePeerResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct SplitRequest { - // message fields - split_key: ::protobuf::SingularField<::std::vec::Vec>, - new_region_id: ::std::option::Option, - new_peer_ids: ::std::vec::Vec, - right_derive: ::std::option::Option, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for SplitRequest {} - -impl SplitRequest { - pub fn new() -> SplitRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static SplitRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const SplitRequest, - }; - unsafe { - instance.get(SplitRequest::new) - } - } - - // optional bytes split_key = 1; - - pub fn clear_split_key(&mut self) { - self.split_key.clear(); - } - - pub fn has_split_key(&self) -> bool { - self.split_key.is_some() - } - - // Param is passed by value, moved - pub fn set_split_key(&mut self, v: ::std::vec::Vec) { - self.split_key = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_split_key(&mut self) -> &mut ::std::vec::Vec { - if self.split_key.is_none() { - self.split_key.set_default(); - } - self.split_key.as_mut().unwrap() - } - - // Take field - pub fn take_split_key(&mut self) -> ::std::vec::Vec { - self.split_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_split_key(&self) -> &[u8] { - match self.split_key.as_ref() { - Some(v) => &v, - None => &[], - } - } - - fn get_split_key_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.split_key - } - - fn mut_split_key_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.split_key - } - - // optional uint64 new_region_id = 2; - - pub fn clear_new_region_id(&mut self) { - self.new_region_id = ::std::option::Option::None; - } - - pub fn has_new_region_id(&self) -> bool { - self.new_region_id.is_some() - } - - // Param is passed by value, moved - pub fn set_new_region_id(&mut self, v: u64) { - self.new_region_id = ::std::option::Option::Some(v); - } - - pub fn get_new_region_id(&self) -> u64 { - self.new_region_id.unwrap_or(0) - } - - fn get_new_region_id_for_reflect(&self) -> &::std::option::Option { - &self.new_region_id - } - - fn mut_new_region_id_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.new_region_id - } - - // repeated uint64 new_peer_ids = 3; - - pub fn clear_new_peer_ids(&mut self) { - self.new_peer_ids.clear(); - } - - // Param is passed by value, moved - pub fn set_new_peer_ids(&mut self, v: ::std::vec::Vec) { - self.new_peer_ids = v; - } - - // Mutable pointer to the field. - pub fn mut_new_peer_ids(&mut self) -> &mut ::std::vec::Vec { - &mut self.new_peer_ids - } - - // Take field - pub fn take_new_peer_ids(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.new_peer_ids, ::std::vec::Vec::new()) - } - - pub fn get_new_peer_ids(&self) -> &[u64] { - &self.new_peer_ids - } - - fn get_new_peer_ids_for_reflect(&self) -> &::std::vec::Vec { - &self.new_peer_ids - } - - fn mut_new_peer_ids_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.new_peer_ids - } - - // optional bool right_derive = 4; - - pub fn clear_right_derive(&mut self) { - self.right_derive = ::std::option::Option::None; - } - - pub fn has_right_derive(&self) -> bool { - self.right_derive.is_some() - } - - // Param is passed by value, moved - pub fn set_right_derive(&mut self, v: bool) { - self.right_derive = ::std::option::Option::Some(v); - } - - pub fn get_right_derive(&self) -> bool { - self.right_derive.unwrap_or(false) - } - - fn get_right_derive_for_reflect(&self) -> &::std::option::Option { - &self.right_derive - } - - fn mut_right_derive_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.right_derive - } -} - -impl ::protobuf::Message for SplitRequest { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.split_key)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.new_region_id = ::std::option::Option::Some(tmp); - }, - 3 => { - ::protobuf::rt::read_repeated_uint64_into(wire_type, is, &mut self.new_peer_ids)?; - }, - 4 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_bool()?; - self.right_derive = ::std::option::Option::Some(tmp); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.split_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); - } - if let Some(v) = self.new_region_id { - my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); - } - for value in &self.new_peer_ids { - my_size += ::protobuf::rt::value_size(3, *value, ::protobuf::wire_format::WireTypeVarint); - }; - if let Some(v) = self.right_derive { - my_size += 2; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.split_key.as_ref() { - os.write_bytes(1, &v)?; - } - if let Some(v) = self.new_region_id { - os.write_uint64(2, v)?; - } - for v in &self.new_peer_ids { - os.write_uint64(3, *v)?; - }; - if let Some(v) = self.right_derive { - os.write_bool(4, v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for SplitRequest { - fn new() -> SplitRequest { - SplitRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "split_key", - SplitRequest::get_split_key_for_reflect, - SplitRequest::mut_split_key_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "new_region_id", - SplitRequest::get_new_region_id_for_reflect, - SplitRequest::mut_new_region_id_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "new_peer_ids", - SplitRequest::get_new_peer_ids_for_reflect, - SplitRequest::mut_new_peer_ids_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( - "right_derive", - SplitRequest::get_right_derive_for_reflect, - SplitRequest::mut_right_derive_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "SplitRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for SplitRequest { - fn clear(&mut self) { - self.clear_split_key(); - self.clear_new_region_id(); - self.clear_new_peer_ids(); - self.clear_right_derive(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for SplitRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SplitRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct SplitResponse { - // message fields - left: ::protobuf::SingularPtrField, - right: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for SplitResponse {} - -impl SplitResponse { - pub fn new() -> SplitResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static SplitResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const SplitResponse, - }; - unsafe { - instance.get(SplitResponse::new) - } - } - - // optional .metapb.Region left = 1; - - pub fn clear_left(&mut self) { - self.left.clear(); - } - - pub fn has_left(&self) -> bool { - self.left.is_some() - } - - // Param is passed by value, moved - pub fn set_left(&mut self, v: super::metapb::Region) { - self.left = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_left(&mut self) -> &mut super::metapb::Region { - if self.left.is_none() { - self.left.set_default(); - } - self.left.as_mut().unwrap() - } - - // Take field - pub fn take_left(&mut self) -> super::metapb::Region { - self.left.take().unwrap_or_else(|| super::metapb::Region::new()) - } - - pub fn get_left(&self) -> &super::metapb::Region { - self.left.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) - } - - fn get_left_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.left - } - - fn mut_left_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.left - } - - // optional .metapb.Region right = 2; - - pub fn clear_right(&mut self) { - self.right.clear(); - } - - pub fn has_right(&self) -> bool { - self.right.is_some() - } - - // Param is passed by value, moved - pub fn set_right(&mut self, v: super::metapb::Region) { - self.right = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_right(&mut self) -> &mut super::metapb::Region { - if self.right.is_none() { - self.right.set_default(); - } - self.right.as_mut().unwrap() - } - - // Take field - pub fn take_right(&mut self) -> super::metapb::Region { - self.right.take().unwrap_or_else(|| super::metapb::Region::new()) - } - - pub fn get_right(&self) -> &super::metapb::Region { - self.right.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) - } - - fn get_right_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.right - } - - fn mut_right_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.right - } -} - -impl ::protobuf::Message for SplitResponse { - fn is_initialized(&self) -> bool { - for v in &self.left { - if !v.is_initialized() { - return false; - } - }; - for v in &self.right { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.left)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.right)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.left.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.right.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.left.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.right.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for SplitResponse { - fn new() -> SplitResponse { - SplitResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "left", - SplitResponse::get_left_for_reflect, - SplitResponse::mut_left_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "right", - SplitResponse::get_right_for_reflect, - SplitResponse::mut_right_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "SplitResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for SplitResponse { - fn clear(&mut self) { - self.clear_left(); - self.clear_right(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for SplitResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SplitResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct CompactLogRequest { - // message fields - compact_index: ::std::option::Option, - compact_term: ::std::option::Option, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for CompactLogRequest {} - -impl CompactLogRequest { - pub fn new() -> CompactLogRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static CompactLogRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const CompactLogRequest, - }; - unsafe { - instance.get(CompactLogRequest::new) - } - } - - // optional uint64 compact_index = 1; - - pub fn clear_compact_index(&mut self) { - self.compact_index = ::std::option::Option::None; - } - - pub fn has_compact_index(&self) -> bool { - self.compact_index.is_some() - } - - // Param is passed by value, moved - pub fn set_compact_index(&mut self, v: u64) { - self.compact_index = ::std::option::Option::Some(v); - } - - pub fn get_compact_index(&self) -> u64 { - self.compact_index.unwrap_or(0) - } - - fn get_compact_index_for_reflect(&self) -> &::std::option::Option { - &self.compact_index - } - - fn mut_compact_index_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.compact_index - } - - // optional uint64 compact_term = 2; - - pub fn clear_compact_term(&mut self) { - self.compact_term = ::std::option::Option::None; - } - - pub fn has_compact_term(&self) -> bool { - self.compact_term.is_some() - } - - // Param is passed by value, moved - pub fn set_compact_term(&mut self, v: u64) { - self.compact_term = ::std::option::Option::Some(v); - } - - pub fn get_compact_term(&self) -> u64 { - self.compact_term.unwrap_or(0) - } - - fn get_compact_term_for_reflect(&self) -> &::std::option::Option { - &self.compact_term - } - - fn mut_compact_term_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.compact_term - } -} - -impl ::protobuf::Message for CompactLogRequest { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.compact_index = ::std::option::Option::Some(tmp); - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.compact_term = ::std::option::Option::Some(tmp); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.compact_index { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.compact_term { - my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.compact_index { - os.write_uint64(1, v)?; - } - if let Some(v) = self.compact_term { - os.write_uint64(2, v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for CompactLogRequest { - fn new() -> CompactLogRequest { - CompactLogRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "compact_index", - CompactLogRequest::get_compact_index_for_reflect, - CompactLogRequest::mut_compact_index_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "compact_term", - CompactLogRequest::get_compact_term_for_reflect, - CompactLogRequest::mut_compact_term_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "CompactLogRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for CompactLogRequest { - fn clear(&mut self) { - self.clear_compact_index(); - self.clear_compact_term(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for CompactLogRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CompactLogRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct CompactLogResponse { - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for CompactLogResponse {} - -impl CompactLogResponse { - pub fn new() -> CompactLogResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static CompactLogResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const CompactLogResponse, - }; - unsafe { - instance.get(CompactLogResponse::new) - } - } -} - -impl ::protobuf::Message for CompactLogResponse { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for CompactLogResponse { - fn new() -> CompactLogResponse { - CompactLogResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let fields = ::std::vec::Vec::new(); - ::protobuf::reflect::MessageDescriptor::new::( - "CompactLogResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for CompactLogResponse { - fn clear(&mut self) { - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for CompactLogResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for CompactLogResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct TransferLeaderRequest { - // message fields - peer: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for TransferLeaderRequest {} - -impl TransferLeaderRequest { - pub fn new() -> TransferLeaderRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static TransferLeaderRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const TransferLeaderRequest, - }; - unsafe { - instance.get(TransferLeaderRequest::new) - } - } - - // optional .metapb.Peer peer = 1; - - pub fn clear_peer(&mut self) { - self.peer.clear(); - } - - pub fn has_peer(&self) -> bool { - self.peer.is_some() - } - - // Param is passed by value, moved - pub fn set_peer(&mut self, v: super::metapb::Peer) { - self.peer = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_peer(&mut self) -> &mut super::metapb::Peer { - if self.peer.is_none() { - self.peer.set_default(); - } - self.peer.as_mut().unwrap() - } - - // Take field - pub fn take_peer(&mut self) -> super::metapb::Peer { - self.peer.take().unwrap_or_else(|| super::metapb::Peer::new()) - } - - pub fn get_peer(&self) -> &super::metapb::Peer { - self.peer.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) - } - - fn get_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.peer - } - - fn mut_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.peer - } -} - -impl ::protobuf::Message for TransferLeaderRequest { - fn is_initialized(&self) -> bool { - for v in &self.peer { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.peer)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.peer.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.peer.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for TransferLeaderRequest { - fn new() -> TransferLeaderRequest { - TransferLeaderRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "peer", - TransferLeaderRequest::get_peer_for_reflect, - TransferLeaderRequest::mut_peer_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "TransferLeaderRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for TransferLeaderRequest { - fn clear(&mut self) { - self.clear_peer(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for TransferLeaderRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TransferLeaderRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct TransferLeaderResponse { - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for TransferLeaderResponse {} - -impl TransferLeaderResponse { - pub fn new() -> TransferLeaderResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static TransferLeaderResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const TransferLeaderResponse, - }; - unsafe { - instance.get(TransferLeaderResponse::new) - } - } -} - -impl ::protobuf::Message for TransferLeaderResponse { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for TransferLeaderResponse { - fn new() -> TransferLeaderResponse { - TransferLeaderResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let fields = ::std::vec::Vec::new(); - ::protobuf::reflect::MessageDescriptor::new::( - "TransferLeaderResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for TransferLeaderResponse { - fn clear(&mut self) { - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for TransferLeaderResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for TransferLeaderResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct VerifyHashRequest { - // message fields - index: ::std::option::Option, - hash: ::protobuf::SingularField<::std::vec::Vec>, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for VerifyHashRequest {} - -impl VerifyHashRequest { - pub fn new() -> VerifyHashRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static VerifyHashRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const VerifyHashRequest, - }; - unsafe { - instance.get(VerifyHashRequest::new) - } - } - - // optional uint64 index = 1; - - pub fn clear_index(&mut self) { - self.index = ::std::option::Option::None; - } - - pub fn has_index(&self) -> bool { - self.index.is_some() - } - - // Param is passed by value, moved - pub fn set_index(&mut self, v: u64) { - self.index = ::std::option::Option::Some(v); - } - - pub fn get_index(&self) -> u64 { - self.index.unwrap_or(0) - } - - fn get_index_for_reflect(&self) -> &::std::option::Option { - &self.index - } - - fn mut_index_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.index - } - - // optional bytes hash = 2; - - pub fn clear_hash(&mut self) { - self.hash.clear(); - } - - pub fn has_hash(&self) -> bool { - self.hash.is_some() - } - - // Param is passed by value, moved - pub fn set_hash(&mut self, v: ::std::vec::Vec) { - self.hash = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_hash(&mut self) -> &mut ::std::vec::Vec { - if self.hash.is_none() { - self.hash.set_default(); - } - self.hash.as_mut().unwrap() - } - - // Take field - pub fn take_hash(&mut self) -> ::std::vec::Vec { - self.hash.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_hash(&self) -> &[u8] { - match self.hash.as_ref() { - Some(v) => &v, - None => &[], - } - } - - fn get_hash_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.hash - } - - fn mut_hash_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.hash - } -} - -impl ::protobuf::Message for VerifyHashRequest { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.index = ::std::option::Option::Some(tmp); - }, - 2 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.hash)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.index { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(ref v) = self.hash.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.index { - os.write_uint64(1, v)?; - } - if let Some(ref v) = self.hash.as_ref() { - os.write_bytes(2, &v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for VerifyHashRequest { - fn new() -> VerifyHashRequest { - VerifyHashRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "index", - VerifyHashRequest::get_index_for_reflect, - VerifyHashRequest::mut_index_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "hash", - VerifyHashRequest::get_hash_for_reflect, - VerifyHashRequest::mut_hash_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "VerifyHashRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for VerifyHashRequest { - fn clear(&mut self) { - self.clear_index(); - self.clear_hash(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for VerifyHashRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for VerifyHashRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct VerifyHashResponse { - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for VerifyHashResponse {} - -impl VerifyHashResponse { - pub fn new() -> VerifyHashResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static VerifyHashResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const VerifyHashResponse, - }; - unsafe { - instance.get(VerifyHashResponse::new) - } - } -} - -impl ::protobuf::Message for VerifyHashResponse { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for VerifyHashResponse { - fn new() -> VerifyHashResponse { - VerifyHashResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let fields = ::std::vec::Vec::new(); - ::protobuf::reflect::MessageDescriptor::new::( - "VerifyHashResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for VerifyHashResponse { - fn clear(&mut self) { - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for VerifyHashResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for VerifyHashResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct AdminRequest { - // message fields - cmd_type: ::std::option::Option, - change_peer: ::protobuf::SingularPtrField, - split: ::protobuf::SingularPtrField, - compact_log: ::protobuf::SingularPtrField, - transfer_leader: ::protobuf::SingularPtrField, - verify_hash: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for AdminRequest {} - -impl AdminRequest { - pub fn new() -> AdminRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static AdminRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const AdminRequest, - }; - unsafe { - instance.get(AdminRequest::new) - } - } - - // optional .raft_cmdpb.AdminCmdType cmd_type = 1; - - pub fn clear_cmd_type(&mut self) { - self.cmd_type = ::std::option::Option::None; - } - - pub fn has_cmd_type(&self) -> bool { - self.cmd_type.is_some() - } - - // Param is passed by value, moved - pub fn set_cmd_type(&mut self, v: AdminCmdType) { - self.cmd_type = ::std::option::Option::Some(v); - } - - pub fn get_cmd_type(&self) -> AdminCmdType { - self.cmd_type.unwrap_or(AdminCmdType::InvalidAdmin) - } - - fn get_cmd_type_for_reflect(&self) -> &::std::option::Option { - &self.cmd_type - } - - fn mut_cmd_type_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.cmd_type - } - - // optional .raft_cmdpb.ChangePeerRequest change_peer = 2; - - pub fn clear_change_peer(&mut self) { - self.change_peer.clear(); - } - - pub fn has_change_peer(&self) -> bool { - self.change_peer.is_some() - } - - // Param is passed by value, moved - pub fn set_change_peer(&mut self, v: ChangePeerRequest) { - self.change_peer = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_change_peer(&mut self) -> &mut ChangePeerRequest { - if self.change_peer.is_none() { - self.change_peer.set_default(); - } - self.change_peer.as_mut().unwrap() - } - - // Take field - pub fn take_change_peer(&mut self) -> ChangePeerRequest { - self.change_peer.take().unwrap_or_else(|| ChangePeerRequest::new()) - } - - pub fn get_change_peer(&self) -> &ChangePeerRequest { - self.change_peer.as_ref().unwrap_or_else(|| ChangePeerRequest::default_instance()) - } - - fn get_change_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.change_peer - } - - fn mut_change_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.change_peer - } - - // optional .raft_cmdpb.SplitRequest split = 3; - - pub fn clear_split(&mut self) { - self.split.clear(); - } - - pub fn has_split(&self) -> bool { - self.split.is_some() - } - - // Param is passed by value, moved - pub fn set_split(&mut self, v: SplitRequest) { - self.split = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_split(&mut self) -> &mut SplitRequest { - if self.split.is_none() { - self.split.set_default(); - } - self.split.as_mut().unwrap() - } - - // Take field - pub fn take_split(&mut self) -> SplitRequest { - self.split.take().unwrap_or_else(|| SplitRequest::new()) - } - - pub fn get_split(&self) -> &SplitRequest { - self.split.as_ref().unwrap_or_else(|| SplitRequest::default_instance()) - } - - fn get_split_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.split - } - - fn mut_split_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.split - } - - // optional .raft_cmdpb.CompactLogRequest compact_log = 4; - - pub fn clear_compact_log(&mut self) { - self.compact_log.clear(); - } - - pub fn has_compact_log(&self) -> bool { - self.compact_log.is_some() - } - - // Param is passed by value, moved - pub fn set_compact_log(&mut self, v: CompactLogRequest) { - self.compact_log = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_compact_log(&mut self) -> &mut CompactLogRequest { - if self.compact_log.is_none() { - self.compact_log.set_default(); - } - self.compact_log.as_mut().unwrap() - } - - // Take field - pub fn take_compact_log(&mut self) -> CompactLogRequest { - self.compact_log.take().unwrap_or_else(|| CompactLogRequest::new()) - } - - pub fn get_compact_log(&self) -> &CompactLogRequest { - self.compact_log.as_ref().unwrap_or_else(|| CompactLogRequest::default_instance()) - } - - fn get_compact_log_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.compact_log - } - - fn mut_compact_log_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.compact_log - } - - // optional .raft_cmdpb.TransferLeaderRequest transfer_leader = 5; - - pub fn clear_transfer_leader(&mut self) { - self.transfer_leader.clear(); - } - - pub fn has_transfer_leader(&self) -> bool { - self.transfer_leader.is_some() - } - - // Param is passed by value, moved - pub fn set_transfer_leader(&mut self, v: TransferLeaderRequest) { - self.transfer_leader = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_transfer_leader(&mut self) -> &mut TransferLeaderRequest { - if self.transfer_leader.is_none() { - self.transfer_leader.set_default(); - } - self.transfer_leader.as_mut().unwrap() - } - - // Take field - pub fn take_transfer_leader(&mut self) -> TransferLeaderRequest { - self.transfer_leader.take().unwrap_or_else(|| TransferLeaderRequest::new()) - } - - pub fn get_transfer_leader(&self) -> &TransferLeaderRequest { - self.transfer_leader.as_ref().unwrap_or_else(|| TransferLeaderRequest::default_instance()) - } - - fn get_transfer_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.transfer_leader - } - - fn mut_transfer_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.transfer_leader - } - - // optional .raft_cmdpb.VerifyHashRequest verify_hash = 6; - - pub fn clear_verify_hash(&mut self) { - self.verify_hash.clear(); - } - - pub fn has_verify_hash(&self) -> bool { - self.verify_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_verify_hash(&mut self, v: VerifyHashRequest) { - self.verify_hash = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_verify_hash(&mut self) -> &mut VerifyHashRequest { - if self.verify_hash.is_none() { - self.verify_hash.set_default(); - } - self.verify_hash.as_mut().unwrap() - } - - // Take field - pub fn take_verify_hash(&mut self) -> VerifyHashRequest { - self.verify_hash.take().unwrap_or_else(|| VerifyHashRequest::new()) - } - - pub fn get_verify_hash(&self) -> &VerifyHashRequest { - self.verify_hash.as_ref().unwrap_or_else(|| VerifyHashRequest::default_instance()) - } - - fn get_verify_hash_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.verify_hash - } - - fn mut_verify_hash_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.verify_hash - } -} - -impl ::protobuf::Message for AdminRequest { - fn is_initialized(&self) -> bool { - for v in &self.change_peer { - if !v.is_initialized() { - return false; - } - }; - for v in &self.split { - if !v.is_initialized() { - return false; - } - }; - for v in &self.compact_log { - if !v.is_initialized() { - return false; - } - }; - for v in &self.transfer_leader { - if !v.is_initialized() { - return false; - } - }; - for v in &self.verify_hash { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.cmd_type = ::std::option::Option::Some(tmp); - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.change_peer)?; - }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.split)?; - }, - 4 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.compact_log)?; - }, - 5 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.transfer_leader)?; - }, - 6 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.verify_hash)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.cmd_type { - my_size += ::protobuf::rt::enum_size(1, v); - } - if let Some(ref v) = self.change_peer.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.split.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.compact_log.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.transfer_leader.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.verify_hash.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.cmd_type { - os.write_enum(1, v.value())?; - } - if let Some(ref v) = self.change_peer.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.split.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.compact_log.as_ref() { - os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.transfer_leader.as_ref() { - os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.verify_hash.as_ref() { - os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for AdminRequest { - fn new() -> AdminRequest { - AdminRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "cmd_type", - AdminRequest::get_cmd_type_for_reflect, - AdminRequest::mut_cmd_type_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "change_peer", - AdminRequest::get_change_peer_for_reflect, - AdminRequest::mut_change_peer_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "split", - AdminRequest::get_split_for_reflect, - AdminRequest::mut_split_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "compact_log", - AdminRequest::get_compact_log_for_reflect, - AdminRequest::mut_compact_log_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "transfer_leader", - AdminRequest::get_transfer_leader_for_reflect, - AdminRequest::mut_transfer_leader_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "verify_hash", - AdminRequest::get_verify_hash_for_reflect, - AdminRequest::mut_verify_hash_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "AdminRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for AdminRequest { - fn clear(&mut self) { - self.clear_cmd_type(); - self.clear_change_peer(); - self.clear_split(); - self.clear_compact_log(); - self.clear_transfer_leader(); - self.clear_verify_hash(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for AdminRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for AdminRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct AdminResponse { - // message fields - cmd_type: ::std::option::Option, - change_peer: ::protobuf::SingularPtrField, - split: ::protobuf::SingularPtrField, - compact_log: ::protobuf::SingularPtrField, - transfer_leader: ::protobuf::SingularPtrField, - verify_hash: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for AdminResponse {} - -impl AdminResponse { - pub fn new() -> AdminResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static AdminResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const AdminResponse, - }; - unsafe { - instance.get(AdminResponse::new) - } - } - - // optional .raft_cmdpb.AdminCmdType cmd_type = 1; - - pub fn clear_cmd_type(&mut self) { - self.cmd_type = ::std::option::Option::None; - } - - pub fn has_cmd_type(&self) -> bool { - self.cmd_type.is_some() - } - - // Param is passed by value, moved - pub fn set_cmd_type(&mut self, v: AdminCmdType) { - self.cmd_type = ::std::option::Option::Some(v); - } - - pub fn get_cmd_type(&self) -> AdminCmdType { - self.cmd_type.unwrap_or(AdminCmdType::InvalidAdmin) - } - - fn get_cmd_type_for_reflect(&self) -> &::std::option::Option { - &self.cmd_type - } - - fn mut_cmd_type_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.cmd_type - } - - // optional .raft_cmdpb.ChangePeerResponse change_peer = 2; - - pub fn clear_change_peer(&mut self) { - self.change_peer.clear(); - } - - pub fn has_change_peer(&self) -> bool { - self.change_peer.is_some() - } - - // Param is passed by value, moved - pub fn set_change_peer(&mut self, v: ChangePeerResponse) { - self.change_peer = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_change_peer(&mut self) -> &mut ChangePeerResponse { - if self.change_peer.is_none() { - self.change_peer.set_default(); - } - self.change_peer.as_mut().unwrap() - } - - // Take field - pub fn take_change_peer(&mut self) -> ChangePeerResponse { - self.change_peer.take().unwrap_or_else(|| ChangePeerResponse::new()) - } - - pub fn get_change_peer(&self) -> &ChangePeerResponse { - self.change_peer.as_ref().unwrap_or_else(|| ChangePeerResponse::default_instance()) - } - - fn get_change_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.change_peer - } - - fn mut_change_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.change_peer - } - - // optional .raft_cmdpb.SplitResponse split = 3; - - pub fn clear_split(&mut self) { - self.split.clear(); - } - - pub fn has_split(&self) -> bool { - self.split.is_some() - } - - // Param is passed by value, moved - pub fn set_split(&mut self, v: SplitResponse) { - self.split = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_split(&mut self) -> &mut SplitResponse { - if self.split.is_none() { - self.split.set_default(); - } - self.split.as_mut().unwrap() - } - - // Take field - pub fn take_split(&mut self) -> SplitResponse { - self.split.take().unwrap_or_else(|| SplitResponse::new()) - } - - pub fn get_split(&self) -> &SplitResponse { - self.split.as_ref().unwrap_or_else(|| SplitResponse::default_instance()) - } - - fn get_split_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.split - } - - fn mut_split_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.split - } - - // optional .raft_cmdpb.CompactLogResponse compact_log = 4; - - pub fn clear_compact_log(&mut self) { - self.compact_log.clear(); - } - - pub fn has_compact_log(&self) -> bool { - self.compact_log.is_some() - } - - // Param is passed by value, moved - pub fn set_compact_log(&mut self, v: CompactLogResponse) { - self.compact_log = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_compact_log(&mut self) -> &mut CompactLogResponse { - if self.compact_log.is_none() { - self.compact_log.set_default(); - } - self.compact_log.as_mut().unwrap() - } - - // Take field - pub fn take_compact_log(&mut self) -> CompactLogResponse { - self.compact_log.take().unwrap_or_else(|| CompactLogResponse::new()) - } - - pub fn get_compact_log(&self) -> &CompactLogResponse { - self.compact_log.as_ref().unwrap_or_else(|| CompactLogResponse::default_instance()) - } - - fn get_compact_log_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.compact_log - } - - fn mut_compact_log_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.compact_log - } - - // optional .raft_cmdpb.TransferLeaderResponse transfer_leader = 5; - - pub fn clear_transfer_leader(&mut self) { - self.transfer_leader.clear(); - } - - pub fn has_transfer_leader(&self) -> bool { - self.transfer_leader.is_some() - } - - // Param is passed by value, moved - pub fn set_transfer_leader(&mut self, v: TransferLeaderResponse) { - self.transfer_leader = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_transfer_leader(&mut self) -> &mut TransferLeaderResponse { - if self.transfer_leader.is_none() { - self.transfer_leader.set_default(); - } - self.transfer_leader.as_mut().unwrap() - } - - // Take field - pub fn take_transfer_leader(&mut self) -> TransferLeaderResponse { - self.transfer_leader.take().unwrap_or_else(|| TransferLeaderResponse::new()) - } - - pub fn get_transfer_leader(&self) -> &TransferLeaderResponse { - self.transfer_leader.as_ref().unwrap_or_else(|| TransferLeaderResponse::default_instance()) - } - - fn get_transfer_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.transfer_leader - } - - fn mut_transfer_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.transfer_leader - } - - // optional .raft_cmdpb.VerifyHashResponse verify_hash = 6; - - pub fn clear_verify_hash(&mut self) { - self.verify_hash.clear(); - } - - pub fn has_verify_hash(&self) -> bool { - self.verify_hash.is_some() - } - - // Param is passed by value, moved - pub fn set_verify_hash(&mut self, v: VerifyHashResponse) { - self.verify_hash = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_verify_hash(&mut self) -> &mut VerifyHashResponse { - if self.verify_hash.is_none() { - self.verify_hash.set_default(); - } - self.verify_hash.as_mut().unwrap() - } - - // Take field - pub fn take_verify_hash(&mut self) -> VerifyHashResponse { - self.verify_hash.take().unwrap_or_else(|| VerifyHashResponse::new()) - } - - pub fn get_verify_hash(&self) -> &VerifyHashResponse { - self.verify_hash.as_ref().unwrap_or_else(|| VerifyHashResponse::default_instance()) - } - - fn get_verify_hash_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.verify_hash - } - - fn mut_verify_hash_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.verify_hash - } -} - -impl ::protobuf::Message for AdminResponse { - fn is_initialized(&self) -> bool { - for v in &self.change_peer { - if !v.is_initialized() { - return false; - } - }; - for v in &self.split { - if !v.is_initialized() { - return false; - } - }; - for v in &self.compact_log { - if !v.is_initialized() { - return false; - } - }; - for v in &self.transfer_leader { - if !v.is_initialized() { - return false; - } - }; - for v in &self.verify_hash { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.cmd_type = ::std::option::Option::Some(tmp); - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.change_peer)?; - }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.split)?; - }, - 4 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.compact_log)?; - }, - 5 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.transfer_leader)?; - }, - 6 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.verify_hash)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.cmd_type { - my_size += ::protobuf::rt::enum_size(1, v); - } - if let Some(ref v) = self.change_peer.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.split.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.compact_log.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.transfer_leader.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.verify_hash.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.cmd_type { - os.write_enum(1, v.value())?; - } - if let Some(ref v) = self.change_peer.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.split.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.compact_log.as_ref() { - os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.transfer_leader.as_ref() { - os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.verify_hash.as_ref() { - os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for AdminResponse { - fn new() -> AdminResponse { - AdminResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "cmd_type", - AdminResponse::get_cmd_type_for_reflect, - AdminResponse::mut_cmd_type_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "change_peer", - AdminResponse::get_change_peer_for_reflect, - AdminResponse::mut_change_peer_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "split", - AdminResponse::get_split_for_reflect, - AdminResponse::mut_split_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "compact_log", - AdminResponse::get_compact_log_for_reflect, - AdminResponse::mut_compact_log_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "transfer_leader", - AdminResponse::get_transfer_leader_for_reflect, - AdminResponse::mut_transfer_leader_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "verify_hash", - AdminResponse::get_verify_hash_for_reflect, - AdminResponse::mut_verify_hash_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "AdminResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for AdminResponse { - fn clear(&mut self) { - self.clear_cmd_type(); - self.clear_change_peer(); - self.clear_split(); - self.clear_compact_log(); - self.clear_transfer_leader(); - self.clear_verify_hash(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for AdminResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for AdminResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RegionLeaderRequest { - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RegionLeaderRequest {} - -impl RegionLeaderRequest { - pub fn new() -> RegionLeaderRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RegionLeaderRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RegionLeaderRequest, - }; - unsafe { - instance.get(RegionLeaderRequest::new) - } - } -} - -impl ::protobuf::Message for RegionLeaderRequest { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RegionLeaderRequest { - fn new() -> RegionLeaderRequest { - RegionLeaderRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let fields = ::std::vec::Vec::new(); - ::protobuf::reflect::MessageDescriptor::new::( - "RegionLeaderRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RegionLeaderRequest { - fn clear(&mut self) { - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RegionLeaderRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RegionLeaderRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RegionLeaderResponse { - // message fields - leader: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RegionLeaderResponse {} - -impl RegionLeaderResponse { - pub fn new() -> RegionLeaderResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RegionLeaderResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RegionLeaderResponse, - }; - unsafe { - instance.get(RegionLeaderResponse::new) - } - } - - // optional .metapb.Peer leader = 1; - - pub fn clear_leader(&mut self) { - self.leader.clear(); - } - - pub fn has_leader(&self) -> bool { - self.leader.is_some() - } - - // Param is passed by value, moved - pub fn set_leader(&mut self, v: super::metapb::Peer) { - self.leader = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_leader(&mut self) -> &mut super::metapb::Peer { - if self.leader.is_none() { - self.leader.set_default(); - } - self.leader.as_mut().unwrap() - } - - // Take field - pub fn take_leader(&mut self) -> super::metapb::Peer { - self.leader.take().unwrap_or_else(|| super::metapb::Peer::new()) - } - - pub fn get_leader(&self) -> &super::metapb::Peer { - self.leader.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) - } - - fn get_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.leader - } - - fn mut_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.leader - } -} - -impl ::protobuf::Message for RegionLeaderResponse { - fn is_initialized(&self) -> bool { - for v in &self.leader { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.leader)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.leader.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.leader.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RegionLeaderResponse { - fn new() -> RegionLeaderResponse { - RegionLeaderResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "leader", - RegionLeaderResponse::get_leader_for_reflect, - RegionLeaderResponse::mut_leader_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RegionLeaderResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RegionLeaderResponse { - fn clear(&mut self) { - self.clear_leader(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RegionLeaderResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RegionLeaderResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RegionDetailRequest { - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RegionDetailRequest {} - -impl RegionDetailRequest { - pub fn new() -> RegionDetailRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RegionDetailRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RegionDetailRequest, - }; - unsafe { - instance.get(RegionDetailRequest::new) - } - } -} - -impl ::protobuf::Message for RegionDetailRequest { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RegionDetailRequest { - fn new() -> RegionDetailRequest { - RegionDetailRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let fields = ::std::vec::Vec::new(); - ::protobuf::reflect::MessageDescriptor::new::( - "RegionDetailRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RegionDetailRequest { - fn clear(&mut self) { - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RegionDetailRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RegionDetailRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RegionDetailResponse { - // message fields - region: ::protobuf::SingularPtrField, - leader: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RegionDetailResponse {} - -impl RegionDetailResponse { - pub fn new() -> RegionDetailResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RegionDetailResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RegionDetailResponse, - }; - unsafe { - instance.get(RegionDetailResponse::new) - } - } - - // optional .metapb.Region region = 1; - - pub fn clear_region(&mut self) { - self.region.clear(); - } - - pub fn has_region(&self) -> bool { - self.region.is_some() - } - - // Param is passed by value, moved - pub fn set_region(&mut self, v: super::metapb::Region) { - self.region = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region(&mut self) -> &mut super::metapb::Region { - if self.region.is_none() { - self.region.set_default(); - } - self.region.as_mut().unwrap() - } - - // Take field - pub fn take_region(&mut self) -> super::metapb::Region { - self.region.take().unwrap_or_else(|| super::metapb::Region::new()) - } - - pub fn get_region(&self) -> &super::metapb::Region { - self.region.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) - } - - fn get_region_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region - } - - fn mut_region_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region - } - - // optional .metapb.Peer leader = 2; - - pub fn clear_leader(&mut self) { - self.leader.clear(); - } - - pub fn has_leader(&self) -> bool { - self.leader.is_some() - } - - // Param is passed by value, moved - pub fn set_leader(&mut self, v: super::metapb::Peer) { - self.leader = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_leader(&mut self) -> &mut super::metapb::Peer { - if self.leader.is_none() { - self.leader.set_default(); - } - self.leader.as_mut().unwrap() - } - - // Take field - pub fn take_leader(&mut self) -> super::metapb::Peer { - self.leader.take().unwrap_or_else(|| super::metapb::Peer::new()) - } - - pub fn get_leader(&self) -> &super::metapb::Peer { - self.leader.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) - } - - fn get_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.leader - } - - fn mut_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.leader - } -} - -impl ::protobuf::Message for RegionDetailResponse { - fn is_initialized(&self) -> bool { - for v in &self.region { - if !v.is_initialized() { - return false; - } - }; - for v in &self.leader { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.leader)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.region.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.leader.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.region.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.leader.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RegionDetailResponse { - fn new() -> RegionDetailResponse { - RegionDetailResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region", - RegionDetailResponse::get_region_for_reflect, - RegionDetailResponse::mut_region_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "leader", - RegionDetailResponse::get_leader_for_reflect, - RegionDetailResponse::mut_leader_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RegionDetailResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RegionDetailResponse { - fn clear(&mut self) { - self.clear_region(); - self.clear_leader(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RegionDetailResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RegionDetailResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct StatusRequest { - // message fields - cmd_type: ::std::option::Option, - region_leader: ::protobuf::SingularPtrField, - region_detail: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for StatusRequest {} - -impl StatusRequest { - pub fn new() -> StatusRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static StatusRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const StatusRequest, - }; - unsafe { - instance.get(StatusRequest::new) - } - } - - // optional .raft_cmdpb.StatusCmdType cmd_type = 1; - - pub fn clear_cmd_type(&mut self) { - self.cmd_type = ::std::option::Option::None; - } - - pub fn has_cmd_type(&self) -> bool { - self.cmd_type.is_some() - } - - // Param is passed by value, moved - pub fn set_cmd_type(&mut self, v: StatusCmdType) { - self.cmd_type = ::std::option::Option::Some(v); - } - - pub fn get_cmd_type(&self) -> StatusCmdType { - self.cmd_type.unwrap_or(StatusCmdType::InvalidStatus) - } - - fn get_cmd_type_for_reflect(&self) -> &::std::option::Option { - &self.cmd_type - } - - fn mut_cmd_type_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.cmd_type - } - - // optional .raft_cmdpb.RegionLeaderRequest region_leader = 2; - - pub fn clear_region_leader(&mut self) { - self.region_leader.clear(); - } - - pub fn has_region_leader(&self) -> bool { - self.region_leader.is_some() - } - - // Param is passed by value, moved - pub fn set_region_leader(&mut self, v: RegionLeaderRequest) { - self.region_leader = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_leader(&mut self) -> &mut RegionLeaderRequest { - if self.region_leader.is_none() { - self.region_leader.set_default(); - } - self.region_leader.as_mut().unwrap() - } - - // Take field - pub fn take_region_leader(&mut self) -> RegionLeaderRequest { - self.region_leader.take().unwrap_or_else(|| RegionLeaderRequest::new()) - } - - pub fn get_region_leader(&self) -> &RegionLeaderRequest { - self.region_leader.as_ref().unwrap_or_else(|| RegionLeaderRequest::default_instance()) - } - - fn get_region_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_leader - } - - fn mut_region_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_leader - } - - // optional .raft_cmdpb.RegionDetailRequest region_detail = 3; - - pub fn clear_region_detail(&mut self) { - self.region_detail.clear(); - } - - pub fn has_region_detail(&self) -> bool { - self.region_detail.is_some() - } - - // Param is passed by value, moved - pub fn set_region_detail(&mut self, v: RegionDetailRequest) { - self.region_detail = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_detail(&mut self) -> &mut RegionDetailRequest { - if self.region_detail.is_none() { - self.region_detail.set_default(); - } - self.region_detail.as_mut().unwrap() - } - - // Take field - pub fn take_region_detail(&mut self) -> RegionDetailRequest { - self.region_detail.take().unwrap_or_else(|| RegionDetailRequest::new()) - } - - pub fn get_region_detail(&self) -> &RegionDetailRequest { - self.region_detail.as_ref().unwrap_or_else(|| RegionDetailRequest::default_instance()) - } - - fn get_region_detail_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_detail - } - - fn mut_region_detail_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_detail - } -} - -impl ::protobuf::Message for StatusRequest { - fn is_initialized(&self) -> bool { - for v in &self.region_leader { - if !v.is_initialized() { - return false; - } - }; - for v in &self.region_detail { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.cmd_type = ::std::option::Option::Some(tmp); - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_leader)?; - }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_detail)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.cmd_type { - my_size += ::protobuf::rt::enum_size(1, v); - } - if let Some(ref v) = self.region_leader.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.region_detail.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.cmd_type { - os.write_enum(1, v.value())?; - } - if let Some(ref v) = self.region_leader.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.region_detail.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for StatusRequest { - fn new() -> StatusRequest { - StatusRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "cmd_type", - StatusRequest::get_cmd_type_for_reflect, - StatusRequest::mut_cmd_type_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_leader", - StatusRequest::get_region_leader_for_reflect, - StatusRequest::mut_region_leader_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_detail", - StatusRequest::get_region_detail_for_reflect, - StatusRequest::mut_region_detail_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "StatusRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for StatusRequest { - fn clear(&mut self) { - self.clear_cmd_type(); - self.clear_region_leader(); - self.clear_region_detail(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for StatusRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StatusRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct StatusResponse { - // message fields - cmd_type: ::std::option::Option, - region_leader: ::protobuf::SingularPtrField, - region_detail: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for StatusResponse {} - -impl StatusResponse { - pub fn new() -> StatusResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static StatusResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const StatusResponse, - }; - unsafe { - instance.get(StatusResponse::new) - } - } - - // optional .raft_cmdpb.StatusCmdType cmd_type = 1; - - pub fn clear_cmd_type(&mut self) { - self.cmd_type = ::std::option::Option::None; - } - - pub fn has_cmd_type(&self) -> bool { - self.cmd_type.is_some() - } - - // Param is passed by value, moved - pub fn set_cmd_type(&mut self, v: StatusCmdType) { - self.cmd_type = ::std::option::Option::Some(v); - } - - pub fn get_cmd_type(&self) -> StatusCmdType { - self.cmd_type.unwrap_or(StatusCmdType::InvalidStatus) - } - - fn get_cmd_type_for_reflect(&self) -> &::std::option::Option { - &self.cmd_type - } - - fn mut_cmd_type_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.cmd_type - } - - // optional .raft_cmdpb.RegionLeaderResponse region_leader = 2; - - pub fn clear_region_leader(&mut self) { - self.region_leader.clear(); - } - - pub fn has_region_leader(&self) -> bool { - self.region_leader.is_some() - } - - // Param is passed by value, moved - pub fn set_region_leader(&mut self, v: RegionLeaderResponse) { - self.region_leader = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_leader(&mut self) -> &mut RegionLeaderResponse { - if self.region_leader.is_none() { - self.region_leader.set_default(); - } - self.region_leader.as_mut().unwrap() - } - - // Take field - pub fn take_region_leader(&mut self) -> RegionLeaderResponse { - self.region_leader.take().unwrap_or_else(|| RegionLeaderResponse::new()) - } - - pub fn get_region_leader(&self) -> &RegionLeaderResponse { - self.region_leader.as_ref().unwrap_or_else(|| RegionLeaderResponse::default_instance()) - } - - fn get_region_leader_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_leader - } - - fn mut_region_leader_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_leader - } - - // optional .raft_cmdpb.RegionDetailResponse region_detail = 3; - - pub fn clear_region_detail(&mut self) { - self.region_detail.clear(); - } - - pub fn has_region_detail(&self) -> bool { - self.region_detail.is_some() - } - - // Param is passed by value, moved - pub fn set_region_detail(&mut self, v: RegionDetailResponse) { - self.region_detail = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_detail(&mut self) -> &mut RegionDetailResponse { - if self.region_detail.is_none() { - self.region_detail.set_default(); - } - self.region_detail.as_mut().unwrap() - } - - // Take field - pub fn take_region_detail(&mut self) -> RegionDetailResponse { - self.region_detail.take().unwrap_or_else(|| RegionDetailResponse::new()) - } - - pub fn get_region_detail(&self) -> &RegionDetailResponse { - self.region_detail.as_ref().unwrap_or_else(|| RegionDetailResponse::default_instance()) - } - - fn get_region_detail_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_detail - } - - fn mut_region_detail_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_detail - } -} - -impl ::protobuf::Message for StatusResponse { - fn is_initialized(&self) -> bool { - for v in &self.region_leader { - if !v.is_initialized() { - return false; - } - }; - for v in &self.region_detail { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.cmd_type = ::std::option::Option::Some(tmp); - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_leader)?; - }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_detail)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.cmd_type { - my_size += ::protobuf::rt::enum_size(1, v); - } - if let Some(ref v) = self.region_leader.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.region_detail.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.cmd_type { - os.write_enum(1, v.value())?; - } - if let Some(ref v) = self.region_leader.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.region_detail.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for StatusResponse { - fn new() -> StatusResponse { - StatusResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "cmd_type", - StatusResponse::get_cmd_type_for_reflect, - StatusResponse::mut_cmd_type_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_leader", - StatusResponse::get_region_leader_for_reflect, - StatusResponse::mut_region_leader_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_detail", - StatusResponse::get_region_detail_for_reflect, - StatusResponse::mut_region_detail_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "StatusResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for StatusResponse { - fn clear(&mut self) { - self.clear_cmd_type(); - self.clear_region_leader(); - self.clear_region_detail(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for StatusResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StatusResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RaftRequestHeader { - // message fields - region_id: ::std::option::Option, - peer: ::protobuf::SingularPtrField, - read_quorum: ::std::option::Option, - uuid: ::protobuf::SingularField<::std::vec::Vec>, - region_epoch: ::protobuf::SingularPtrField, - term: ::std::option::Option, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RaftRequestHeader {} - -impl RaftRequestHeader { - pub fn new() -> RaftRequestHeader { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RaftRequestHeader { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RaftRequestHeader, - }; - unsafe { - instance.get(RaftRequestHeader::new) - } - } - - // optional uint64 region_id = 1; - - pub fn clear_region_id(&mut self) { - self.region_id = ::std::option::Option::None; - } - - pub fn has_region_id(&self) -> bool { - self.region_id.is_some() - } - - // Param is passed by value, moved - pub fn set_region_id(&mut self, v: u64) { - self.region_id = ::std::option::Option::Some(v); - } - - pub fn get_region_id(&self) -> u64 { - self.region_id.unwrap_or(0) - } - - fn get_region_id_for_reflect(&self) -> &::std::option::Option { - &self.region_id - } - - fn mut_region_id_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.region_id - } - - // optional .metapb.Peer peer = 2; - - pub fn clear_peer(&mut self) { - self.peer.clear(); - } - - pub fn has_peer(&self) -> bool { - self.peer.is_some() - } - - // Param is passed by value, moved - pub fn set_peer(&mut self, v: super::metapb::Peer) { - self.peer = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_peer(&mut self) -> &mut super::metapb::Peer { - if self.peer.is_none() { - self.peer.set_default(); - } - self.peer.as_mut().unwrap() - } - - // Take field - pub fn take_peer(&mut self) -> super::metapb::Peer { - self.peer.take().unwrap_or_else(|| super::metapb::Peer::new()) - } - - pub fn get_peer(&self) -> &super::metapb::Peer { - self.peer.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) - } - - fn get_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.peer - } - - fn mut_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.peer - } - - // optional bool read_quorum = 3; - - pub fn clear_read_quorum(&mut self) { - self.read_quorum = ::std::option::Option::None; - } - - pub fn has_read_quorum(&self) -> bool { - self.read_quorum.is_some() - } - - // Param is passed by value, moved - pub fn set_read_quorum(&mut self, v: bool) { - self.read_quorum = ::std::option::Option::Some(v); - } - - pub fn get_read_quorum(&self) -> bool { - self.read_quorum.unwrap_or(false) - } - - fn get_read_quorum_for_reflect(&self) -> &::std::option::Option { - &self.read_quorum - } - - fn mut_read_quorum_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.read_quorum - } - - // optional bytes uuid = 4; - - pub fn clear_uuid(&mut self) { - self.uuid.clear(); - } - - pub fn has_uuid(&self) -> bool { - self.uuid.is_some() - } - - // Param is passed by value, moved - pub fn set_uuid(&mut self, v: ::std::vec::Vec) { - self.uuid = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_uuid(&mut self) -> &mut ::std::vec::Vec { - if self.uuid.is_none() { - self.uuid.set_default(); - } - self.uuid.as_mut().unwrap() - } - - // Take field - pub fn take_uuid(&mut self) -> ::std::vec::Vec { - self.uuid.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_uuid(&self) -> &[u8] { - match self.uuid.as_ref() { - Some(v) => &v, - None => &[], - } - } - - fn get_uuid_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.uuid - } - - fn mut_uuid_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.uuid - } - - // optional .metapb.RegionEpoch region_epoch = 5; - - pub fn clear_region_epoch(&mut self) { - self.region_epoch.clear(); - } - - pub fn has_region_epoch(&self) -> bool { - self.region_epoch.is_some() - } - - // Param is passed by value, moved - pub fn set_region_epoch(&mut self, v: super::metapb::RegionEpoch) { - self.region_epoch = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_epoch(&mut self) -> &mut super::metapb::RegionEpoch { - if self.region_epoch.is_none() { - self.region_epoch.set_default(); - } - self.region_epoch.as_mut().unwrap() - } - - // Take field - pub fn take_region_epoch(&mut self) -> super::metapb::RegionEpoch { - self.region_epoch.take().unwrap_or_else(|| super::metapb::RegionEpoch::new()) - } - - pub fn get_region_epoch(&self) -> &super::metapb::RegionEpoch { - self.region_epoch.as_ref().unwrap_or_else(|| super::metapb::RegionEpoch::default_instance()) - } - - fn get_region_epoch_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_epoch - } - - fn mut_region_epoch_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_epoch - } - - // optional uint64 term = 6; - - pub fn clear_term(&mut self) { - self.term = ::std::option::Option::None; - } - - pub fn has_term(&self) -> bool { - self.term.is_some() - } - - // Param is passed by value, moved - pub fn set_term(&mut self, v: u64) { - self.term = ::std::option::Option::Some(v); - } - - pub fn get_term(&self) -> u64 { - self.term.unwrap_or(0) - } - - fn get_term_for_reflect(&self) -> &::std::option::Option { - &self.term - } - - fn mut_term_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.term - } -} - -impl ::protobuf::Message for RaftRequestHeader { - fn is_initialized(&self) -> bool { - for v in &self.peer { - if !v.is_initialized() { - return false; - } - }; - for v in &self.region_epoch { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.region_id = ::std::option::Option::Some(tmp); - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.peer)?; - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_bool()?; - self.read_quorum = ::std::option::Option::Some(tmp); - }, - 4 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.uuid)?; - }, - 5 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_epoch)?; - }, - 6 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.term = ::std::option::Option::Some(tmp); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(v) = self.region_id { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(ref v) = self.peer.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(v) = self.read_quorum { - my_size += 2; - } - if let Some(ref v) = self.uuid.as_ref() { - my_size += ::protobuf::rt::bytes_size(4, &v); - } - if let Some(ref v) = self.region_epoch.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(v) = self.term { - my_size += ::protobuf::rt::value_size(6, v, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(v) = self.region_id { - os.write_uint64(1, v)?; - } - if let Some(ref v) = self.peer.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(v) = self.read_quorum { - os.write_bool(3, v)?; - } - if let Some(ref v) = self.uuid.as_ref() { - os.write_bytes(4, &v)?; - } - if let Some(ref v) = self.region_epoch.as_ref() { - os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(v) = self.term { - os.write_uint64(6, v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RaftRequestHeader { - fn new() -> RaftRequestHeader { - RaftRequestHeader::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "region_id", - RaftRequestHeader::get_region_id_for_reflect, - RaftRequestHeader::mut_region_id_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "peer", - RaftRequestHeader::get_peer_for_reflect, - RaftRequestHeader::mut_peer_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>( - "read_quorum", - RaftRequestHeader::get_read_quorum_for_reflect, - RaftRequestHeader::mut_read_quorum_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "uuid", - RaftRequestHeader::get_uuid_for_reflect, - RaftRequestHeader::mut_uuid_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_epoch", - RaftRequestHeader::get_region_epoch_for_reflect, - RaftRequestHeader::mut_region_epoch_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "term", - RaftRequestHeader::get_term_for_reflect, - RaftRequestHeader::mut_term_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RaftRequestHeader", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RaftRequestHeader { - fn clear(&mut self) { - self.clear_region_id(); - self.clear_peer(); - self.clear_read_quorum(); - self.clear_uuid(); - self.clear_region_epoch(); - self.clear_term(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RaftRequestHeader { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RaftRequestHeader { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RaftResponseHeader { - // message fields - error: ::protobuf::SingularPtrField, - uuid: ::protobuf::SingularField<::std::vec::Vec>, - current_term: ::std::option::Option, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RaftResponseHeader {} - -impl RaftResponseHeader { - pub fn new() -> RaftResponseHeader { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RaftResponseHeader { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RaftResponseHeader, - }; - unsafe { - instance.get(RaftResponseHeader::new) - } - } - - // optional .errorpb.Error error = 1; - - pub fn clear_error(&mut self) { - self.error.clear(); - } - - pub fn has_error(&self) -> bool { - self.error.is_some() - } - - // Param is passed by value, moved - pub fn set_error(&mut self, v: super::errorpb::Error) { - self.error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_error(&mut self) -> &mut super::errorpb::Error { - if self.error.is_none() { - self.error.set_default(); - } - self.error.as_mut().unwrap() - } - - // Take field - pub fn take_error(&mut self) -> super::errorpb::Error { - self.error.take().unwrap_or_else(|| super::errorpb::Error::new()) - } - - pub fn get_error(&self) -> &super::errorpb::Error { - self.error.as_ref().unwrap_or_else(|| super::errorpb::Error::default_instance()) - } - - fn get_error_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.error - } - - fn mut_error_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.error - } - - // optional bytes uuid = 2; - - pub fn clear_uuid(&mut self) { - self.uuid.clear(); - } - - pub fn has_uuid(&self) -> bool { - self.uuid.is_some() - } - - // Param is passed by value, moved - pub fn set_uuid(&mut self, v: ::std::vec::Vec) { - self.uuid = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_uuid(&mut self) -> &mut ::std::vec::Vec { - if self.uuid.is_none() { - self.uuid.set_default(); - } - self.uuid.as_mut().unwrap() - } - - // Take field - pub fn take_uuid(&mut self) -> ::std::vec::Vec { - self.uuid.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } - - pub fn get_uuid(&self) -> &[u8] { - match self.uuid.as_ref() { - Some(v) => &v, - None => &[], - } - } - - fn get_uuid_for_reflect(&self) -> &::protobuf::SingularField<::std::vec::Vec> { - &self.uuid - } - - fn mut_uuid_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::vec::Vec> { - &mut self.uuid - } - - // optional uint64 current_term = 3; - - pub fn clear_current_term(&mut self) { - self.current_term = ::std::option::Option::None; - } - - pub fn has_current_term(&self) -> bool { - self.current_term.is_some() - } - - // Param is passed by value, moved - pub fn set_current_term(&mut self, v: u64) { - self.current_term = ::std::option::Option::Some(v); - } - - pub fn get_current_term(&self) -> u64 { - self.current_term.unwrap_or(0) - } - - fn get_current_term_for_reflect(&self) -> &::std::option::Option { - &self.current_term - } - - fn mut_current_term_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.current_term - } -} - -impl ::protobuf::Message for RaftResponseHeader { - fn is_initialized(&self) -> bool { - for v in &self.error { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.error)?; - }, - 2 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.uuid)?; - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.current_term = ::std::option::Option::Some(tmp); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.error.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.uuid.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); - } - if let Some(v) = self.current_term { - my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.error.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.uuid.as_ref() { - os.write_bytes(2, &v)?; - } - if let Some(v) = self.current_term { - os.write_uint64(3, v)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RaftResponseHeader { - fn new() -> RaftResponseHeader { - RaftResponseHeader::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "error", - RaftResponseHeader::get_error_for_reflect, - RaftResponseHeader::mut_error_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "uuid", - RaftResponseHeader::get_uuid_for_reflect, - RaftResponseHeader::mut_uuid_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "current_term", - RaftResponseHeader::get_current_term_for_reflect, - RaftResponseHeader::mut_current_term_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RaftResponseHeader", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RaftResponseHeader { - fn clear(&mut self) { - self.clear_error(); - self.clear_uuid(); - self.clear_current_term(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RaftResponseHeader { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RaftResponseHeader { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RaftCmdRequest { - // message fields - header: ::protobuf::SingularPtrField, - requests: ::protobuf::RepeatedField, - admin_request: ::protobuf::SingularPtrField, - status_request: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RaftCmdRequest {} - -impl RaftCmdRequest { - pub fn new() -> RaftCmdRequest { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RaftCmdRequest { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RaftCmdRequest, - }; - unsafe { - instance.get(RaftCmdRequest::new) - } - } - - // optional .raft_cmdpb.RaftRequestHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: RaftRequestHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut RaftRequestHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> RaftRequestHeader { - self.header.take().unwrap_or_else(|| RaftRequestHeader::new()) - } - - pub fn get_header(&self) -> &RaftRequestHeader { - self.header.as_ref().unwrap_or_else(|| RaftRequestHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } - - // repeated .raft_cmdpb.Request requests = 2; - - pub fn clear_requests(&mut self) { - self.requests.clear(); - } - - // Param is passed by value, moved - pub fn set_requests(&mut self, v: ::protobuf::RepeatedField) { - self.requests = v; - } - - // Mutable pointer to the field. - pub fn mut_requests(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.requests - } - - // Take field - pub fn take_requests(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.requests, ::protobuf::RepeatedField::new()) - } - - pub fn get_requests(&self) -> &[Request] { - &self.requests - } - - fn get_requests_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.requests - } - - fn mut_requests_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.requests - } - - // optional .raft_cmdpb.AdminRequest admin_request = 3; - - pub fn clear_admin_request(&mut self) { - self.admin_request.clear(); - } - - pub fn has_admin_request(&self) -> bool { - self.admin_request.is_some() - } - - // Param is passed by value, moved - pub fn set_admin_request(&mut self, v: AdminRequest) { - self.admin_request = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_admin_request(&mut self) -> &mut AdminRequest { - if self.admin_request.is_none() { - self.admin_request.set_default(); - } - self.admin_request.as_mut().unwrap() - } - - // Take field - pub fn take_admin_request(&mut self) -> AdminRequest { - self.admin_request.take().unwrap_or_else(|| AdminRequest::new()) - } - - pub fn get_admin_request(&self) -> &AdminRequest { - self.admin_request.as_ref().unwrap_or_else(|| AdminRequest::default_instance()) - } - - fn get_admin_request_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.admin_request - } - - fn mut_admin_request_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.admin_request - } - - // optional .raft_cmdpb.StatusRequest status_request = 4; - - pub fn clear_status_request(&mut self) { - self.status_request.clear(); - } - - pub fn has_status_request(&self) -> bool { - self.status_request.is_some() - } - - // Param is passed by value, moved - pub fn set_status_request(&mut self, v: StatusRequest) { - self.status_request = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_status_request(&mut self) -> &mut StatusRequest { - if self.status_request.is_none() { - self.status_request.set_default(); - } - self.status_request.as_mut().unwrap() - } - - // Take field - pub fn take_status_request(&mut self) -> StatusRequest { - self.status_request.take().unwrap_or_else(|| StatusRequest::new()) - } - - pub fn get_status_request(&self) -> &StatusRequest { - self.status_request.as_ref().unwrap_or_else(|| StatusRequest::default_instance()) - } - - fn get_status_request_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.status_request - } - - fn mut_status_request_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.status_request - } -} - -impl ::protobuf::Message for RaftCmdRequest { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - for v in &self.requests { - if !v.is_initialized() { - return false; - } - }; - for v in &self.admin_request { - if !v.is_initialized() { - return false; - } - }; - for v in &self.status_request { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - 2 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.requests)?; - }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.admin_request)?; - }, - 4 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.status_request)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - for value in &self.requests { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - if let Some(ref v) = self.admin_request.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.status_request.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - for v in &self.requests { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - if let Some(ref v) = self.admin_request.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.status_request.as_ref() { - os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RaftCmdRequest { - fn new() -> RaftCmdRequest { - RaftCmdRequest::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - RaftCmdRequest::get_header_for_reflect, - RaftCmdRequest::mut_header_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "requests", - RaftCmdRequest::get_requests_for_reflect, - RaftCmdRequest::mut_requests_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "admin_request", - RaftCmdRequest::get_admin_request_for_reflect, - RaftCmdRequest::mut_admin_request_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "status_request", - RaftCmdRequest::get_status_request_for_reflect, - RaftCmdRequest::mut_status_request_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RaftCmdRequest", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RaftCmdRequest { - fn clear(&mut self) { - self.clear_header(); - self.clear_requests(); - self.clear_admin_request(); - self.clear_status_request(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RaftCmdRequest { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RaftCmdRequest { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RaftCmdResponse { - // message fields - header: ::protobuf::SingularPtrField, - responses: ::protobuf::RepeatedField, - admin_response: ::protobuf::SingularPtrField, - status_response: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RaftCmdResponse {} - -impl RaftCmdResponse { - pub fn new() -> RaftCmdResponse { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RaftCmdResponse { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RaftCmdResponse, - }; - unsafe { - instance.get(RaftCmdResponse::new) - } - } - - // optional .raft_cmdpb.RaftResponseHeader header = 1; - - pub fn clear_header(&mut self) { - self.header.clear(); - } - - pub fn has_header(&self) -> bool { - self.header.is_some() - } - - // Param is passed by value, moved - pub fn set_header(&mut self, v: RaftResponseHeader) { - self.header = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_header(&mut self) -> &mut RaftResponseHeader { - if self.header.is_none() { - self.header.set_default(); - } - self.header.as_mut().unwrap() - } - - // Take field - pub fn take_header(&mut self) -> RaftResponseHeader { - self.header.take().unwrap_or_else(|| RaftResponseHeader::new()) - } - - pub fn get_header(&self) -> &RaftResponseHeader { - self.header.as_ref().unwrap_or_else(|| RaftResponseHeader::default_instance()) - } - - fn get_header_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.header - } - - fn mut_header_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.header - } - - // repeated .raft_cmdpb.Response responses = 2; - - pub fn clear_responses(&mut self) { - self.responses.clear(); - } - - // Param is passed by value, moved - pub fn set_responses(&mut self, v: ::protobuf::RepeatedField) { - self.responses = v; - } - - // Mutable pointer to the field. - pub fn mut_responses(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.responses - } - - // Take field - pub fn take_responses(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.responses, ::protobuf::RepeatedField::new()) - } - - pub fn get_responses(&self) -> &[Response] { - &self.responses - } - - fn get_responses_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.responses - } - - fn mut_responses_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.responses - } - - // optional .raft_cmdpb.AdminResponse admin_response = 3; - - pub fn clear_admin_response(&mut self) { - self.admin_response.clear(); - } - - pub fn has_admin_response(&self) -> bool { - self.admin_response.is_some() - } - - // Param is passed by value, moved - pub fn set_admin_response(&mut self, v: AdminResponse) { - self.admin_response = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_admin_response(&mut self) -> &mut AdminResponse { - if self.admin_response.is_none() { - self.admin_response.set_default(); - } - self.admin_response.as_mut().unwrap() - } - - // Take field - pub fn take_admin_response(&mut self) -> AdminResponse { - self.admin_response.take().unwrap_or_else(|| AdminResponse::new()) - } - - pub fn get_admin_response(&self) -> &AdminResponse { - self.admin_response.as_ref().unwrap_or_else(|| AdminResponse::default_instance()) - } - - fn get_admin_response_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.admin_response - } - - fn mut_admin_response_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.admin_response - } - - // optional .raft_cmdpb.StatusResponse status_response = 4; - - pub fn clear_status_response(&mut self) { - self.status_response.clear(); - } - - pub fn has_status_response(&self) -> bool { - self.status_response.is_some() - } - - // Param is passed by value, moved - pub fn set_status_response(&mut self, v: StatusResponse) { - self.status_response = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_status_response(&mut self) -> &mut StatusResponse { - if self.status_response.is_none() { - self.status_response.set_default(); - } - self.status_response.as_mut().unwrap() - } - - // Take field - pub fn take_status_response(&mut self) -> StatusResponse { - self.status_response.take().unwrap_or_else(|| StatusResponse::new()) - } - - pub fn get_status_response(&self) -> &StatusResponse { - self.status_response.as_ref().unwrap_or_else(|| StatusResponse::default_instance()) - } - - fn get_status_response_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.status_response - } - - fn mut_status_response_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.status_response - } -} - -impl ::protobuf::Message for RaftCmdResponse { - fn is_initialized(&self) -> bool { - for v in &self.header { - if !v.is_initialized() { - return false; - } - }; - for v in &self.responses { - if !v.is_initialized() { - return false; - } - }; - for v in &self.admin_response { - if !v.is_initialized() { - return false; - } - }; - for v in &self.status_response { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.header)?; - }, - 2 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.responses)?; - }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.admin_response)?; - }, - 4 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.status_response)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.header.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - for value in &self.responses { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - if let Some(ref v) = self.admin_response.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.status_response.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.header.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - for v in &self.responses { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - if let Some(ref v) = self.admin_response.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.status_response.as_ref() { - os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RaftCmdResponse { - fn new() -> RaftCmdResponse { - RaftCmdResponse::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "header", - RaftCmdResponse::get_header_for_reflect, - RaftCmdResponse::mut_header_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "responses", - RaftCmdResponse::get_responses_for_reflect, - RaftCmdResponse::mut_responses_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "admin_response", - RaftCmdResponse::get_admin_response_for_reflect, - RaftCmdResponse::mut_admin_response_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "status_response", - RaftCmdResponse::get_status_response_for_reflect, - RaftCmdResponse::mut_status_response_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RaftCmdResponse", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RaftCmdResponse { - fn clear(&mut self) { - self.clear_header(); - self.clear_responses(); - self.clear_admin_response(); - self.clear_status_response(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RaftCmdResponse { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RaftCmdResponse { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum CmdType { - Invalid = 0, - Get = 1, - Put = 3, - Delete = 4, - Snap = 5, - Prewrite = 6, - DeleteRange = 7, -} - -impl ::protobuf::ProtobufEnum for CmdType { - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(CmdType::Invalid), - 1 => ::std::option::Option::Some(CmdType::Get), - 3 => ::std::option::Option::Some(CmdType::Put), - 4 => ::std::option::Option::Some(CmdType::Delete), - 5 => ::std::option::Option::Some(CmdType::Snap), - 6 => ::std::option::Option::Some(CmdType::Prewrite), - 7 => ::std::option::Option::Some(CmdType::DeleteRange), - _ => ::std::option::Option::None - } - } - - fn values() -> &'static [Self] { - static values: &'static [CmdType] = &[ - CmdType::Invalid, - CmdType::Get, - CmdType::Put, - CmdType::Delete, - CmdType::Snap, - CmdType::Prewrite, - CmdType::DeleteRange, - ]; - values - } - - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, - }; - unsafe { - descriptor.get(|| { - ::protobuf::reflect::EnumDescriptor::new("CmdType", file_descriptor_proto()) - }) - } - } -} - -impl ::std::marker::Copy for CmdType { -} - -impl ::protobuf::reflect::ProtobufValue for CmdType { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) - } -} - -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum AdminCmdType { - InvalidAdmin = 0, - ChangePeer = 1, - Split = 2, - CompactLog = 3, - TransferLeader = 4, - ComputeHash = 5, - VerifyHash = 6, -} - -impl ::protobuf::ProtobufEnum for AdminCmdType { - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(AdminCmdType::InvalidAdmin), - 1 => ::std::option::Option::Some(AdminCmdType::ChangePeer), - 2 => ::std::option::Option::Some(AdminCmdType::Split), - 3 => ::std::option::Option::Some(AdminCmdType::CompactLog), - 4 => ::std::option::Option::Some(AdminCmdType::TransferLeader), - 5 => ::std::option::Option::Some(AdminCmdType::ComputeHash), - 6 => ::std::option::Option::Some(AdminCmdType::VerifyHash), - _ => ::std::option::Option::None - } - } - - fn values() -> &'static [Self] { - static values: &'static [AdminCmdType] = &[ - AdminCmdType::InvalidAdmin, - AdminCmdType::ChangePeer, - AdminCmdType::Split, - AdminCmdType::CompactLog, - AdminCmdType::TransferLeader, - AdminCmdType::ComputeHash, - AdminCmdType::VerifyHash, - ]; - values - } - - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, - }; - unsafe { - descriptor.get(|| { - ::protobuf::reflect::EnumDescriptor::new("AdminCmdType", file_descriptor_proto()) - }) - } - } -} - -impl ::std::marker::Copy for AdminCmdType { -} - -impl ::protobuf::reflect::ProtobufValue for AdminCmdType { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) - } -} - -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum StatusCmdType { - InvalidStatus = 0, - RegionLeader = 1, - RegionDetail = 2, -} - -impl ::protobuf::ProtobufEnum for StatusCmdType { - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(StatusCmdType::InvalidStatus), - 1 => ::std::option::Option::Some(StatusCmdType::RegionLeader), - 2 => ::std::option::Option::Some(StatusCmdType::RegionDetail), - _ => ::std::option::Option::None - } - } - - fn values() -> &'static [Self] { - static values: &'static [StatusCmdType] = &[ - StatusCmdType::InvalidStatus, - StatusCmdType::RegionLeader, - StatusCmdType::RegionDetail, - ]; - values - } - - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, - }; - unsafe { - descriptor.get(|| { - ::protobuf::reflect::EnumDescriptor::new("StatusCmdType", file_descriptor_proto()) - }) - } - } -} - -impl ::std::marker::Copy for StatusCmdType { -} - -impl ::protobuf::reflect::ProtobufValue for StatusCmdType { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x10raft_cmdpb.proto\x12\nraft_cmdpb\x1a\x0cmetapb.proto\x1a\rerrorpb.\ - proto\x1a\reraftpb.proto\".\n\nGetRequest\x12\x0e\n\x02cf\x18\x01\x20\ - \x01(\tR\x02cf\x12\x10\n\x03key\x18\x02\x20\x01(\x0cR\x03key\"#\n\x0bGet\ - Response\x12\x14\n\x05value\x18\x01\x20\x01(\x0cR\x05value\"D\n\nPutRequ\ - est\x12\x0e\n\x02cf\x18\x01\x20\x01(\tR\x02cf\x12\x10\n\x03key\x18\x02\ - \x20\x01(\x0cR\x03key\x12\x14\n\x05value\x18\x03\x20\x01(\x0cR\x05value\ - \"\r\n\x0bPutResponse\"1\n\rDeleteRequest\x12\x0e\n\x02cf\x18\x01\x20\ - \x01(\tR\x02cf\x12\x10\n\x03key\x18\x02\x20\x01(\x0cR\x03key\"\x10\n\x0e\ - DeleteResponse\"Z\n\x12DeleteRangeRequest\x12\x0e\n\x02cf\x18\x01\x20\ - \x01(\tR\x02cf\x12\x1b\n\tstart_key\x18\x02\x20\x01(\x0cR\x08startKey\ - \x12\x17\n\x07end_key\x18\x03\x20\x01(\x0cR\x06endKey\"\x15\n\x13DeleteR\ - angeResponse\"\r\n\x0bSnapRequest\"6\n\x0cSnapResponse\x12&\n\x06region\ - \x18\x01\x20\x01(\x0b2\x0e.metapb.RegionR\x06region\"M\n\x0fPrewriteRequ\ - est\x12\x10\n\x03key\x18\x01\x20\x01(\x0cR\x03key\x12\x14\n\x05value\x18\ - \x02\x20\x01(\x0cR\x05value\x12\x12\n\x04lock\x18\x03\x20\x01(\x0cR\x04l\ - ock\"\x12\n\x10PrewriteResponse\"\xe9\x02\n\x07Request\x12.\n\x08cmd_typ\ - e\x18\x01\x20\x01(\x0e2\x13.raft_cmdpb.CmdTypeR\x07cmdType\x12(\n\x03get\ - \x18\x02\x20\x01(\x0b2\x16.raft_cmdpb.GetRequestR\x03get\x12(\n\x03put\ - \x18\x04\x20\x01(\x0b2\x16.raft_cmdpb.PutRequestR\x03put\x121\n\x06delet\ - e\x18\x05\x20\x01(\x0b2\x19.raft_cmdpb.DeleteRequestR\x06delete\x12+\n\ - \x04snap\x18\x06\x20\x01(\x0b2\x17.raft_cmdpb.SnapRequestR\x04snap\x127\ - \n\x08prewrite\x18\x07\x20\x01(\x0b2\x1b.raft_cmdpb.PrewriteRequestR\x08\ - prewrite\x12A\n\x0cdelete_range\x18\x08\x20\x01(\x0b2\x1e.raft_cmdpb.Del\ - eteRangeRequestR\x0bdeleteRange\"\xee\x02\n\x08Response\x12.\n\x08cmd_ty\ - pe\x18\x01\x20\x01(\x0e2\x13.raft_cmdpb.CmdTypeR\x07cmdType\x12)\n\x03ge\ - t\x18\x02\x20\x01(\x0b2\x17.raft_cmdpb.GetResponseR\x03get\x12)\n\x03put\ - \x18\x04\x20\x01(\x0b2\x17.raft_cmdpb.PutResponseR\x03put\x122\n\x06dele\ - te\x18\x05\x20\x01(\x0b2\x1a.raft_cmdpb.DeleteResponseR\x06delete\x12,\n\ - \x04snap\x18\x06\x20\x01(\x0b2\x18.raft_cmdpb.SnapResponseR\x04snap\x128\ - \n\x08prewrite\x18\x07\x20\x01(\x0b2\x1c.raft_cmdpb.PrewriteResponseR\ - \x08prewrite\x12@\n\x0bdelte_range\x18\x08\x20\x01(\x0b2\x1f.raft_cmdpb.\ - DeleteRangeResponseR\ndelteRange\"o\n\x11ChangePeerRequest\x128\n\x0bcha\ - nge_type\x18\x01\x20\x01(\x0e2\x17.eraftpb.ConfChangeTypeR\nchangeType\ - \x12\x20\n\x04peer\x18\x02\x20\x01(\x0b2\x0c.metapb.PeerR\x04peer\"<\n\ - \x12ChangePeerResponse\x12&\n\x06region\x18\x01\x20\x01(\x0b2\x0e.metapb\ - .RegionR\x06region\"\x94\x01\n\x0cSplitRequest\x12\x1b\n\tsplit_key\x18\ - \x01\x20\x01(\x0cR\x08splitKey\x12\"\n\rnew_region_id\x18\x02\x20\x01(\ - \x04R\x0bnewRegionId\x12\x20\n\x0cnew_peer_ids\x18\x03\x20\x03(\x04R\nne\ - wPeerIds\x12!\n\x0cright_derive\x18\x04\x20\x01(\x08R\x0brightDerive\"Y\ - \n\rSplitResponse\x12\"\n\x04left\x18\x01\x20\x01(\x0b2\x0e.metapb.Regio\ - nR\x04left\x12$\n\x05right\x18\x02\x20\x01(\x0b2\x0e.metapb.RegionR\x05r\ - ight\"[\n\x11CompactLogRequest\x12#\n\rcompact_index\x18\x01\x20\x01(\ - \x04R\x0ccompactIndex\x12!\n\x0ccompact_term\x18\x02\x20\x01(\x04R\x0bco\ - mpactTerm\"\x14\n\x12CompactLogResponse\"9\n\x15TransferLeaderRequest\ - \x12\x20\n\x04peer\x18\x01\x20\x01(\x0b2\x0c.metapb.PeerR\x04peer\"\x18\ - \n\x16TransferLeaderResponse\"=\n\x11VerifyHashRequest\x12\x14\n\x05inde\ - x\x18\x01\x20\x01(\x04R\x05index\x12\x12\n\x04hash\x18\x02\x20\x01(\x0cR\ - \x04hash\"\x14\n\x12VerifyHashResponse\"\xff\x02\n\x0cAdminRequest\x123\ - \n\x08cmd_type\x18\x01\x20\x01(\x0e2\x18.raft_cmdpb.AdminCmdTypeR\x07cmd\ - Type\x12>\n\x0bchange_peer\x18\x02\x20\x01(\x0b2\x1d.raft_cmdpb.ChangePe\ - erRequestR\nchangePeer\x12.\n\x05split\x18\x03\x20\x01(\x0b2\x18.raft_cm\ - dpb.SplitRequestR\x05split\x12>\n\x0bcompact_log\x18\x04\x20\x01(\x0b2\ - \x1d.raft_cmdpb.CompactLogRequestR\ncompactLog\x12J\n\x0ftransfer_leader\ - \x18\x05\x20\x01(\x0b2!.raft_cmdpb.TransferLeaderRequestR\x0etransferLea\ - der\x12>\n\x0bverify_hash\x18\x06\x20\x01(\x0b2\x1d.raft_cmdpb.VerifyHas\ - hRequestR\nverifyHash\"\x85\x03\n\rAdminResponse\x123\n\x08cmd_type\x18\ - \x01\x20\x01(\x0e2\x18.raft_cmdpb.AdminCmdTypeR\x07cmdType\x12?\n\x0bcha\ - nge_peer\x18\x02\x20\x01(\x0b2\x1e.raft_cmdpb.ChangePeerResponseR\nchang\ - ePeer\x12/\n\x05split\x18\x03\x20\x01(\x0b2\x19.raft_cmdpb.SplitResponse\ - R\x05split\x12?\n\x0bcompact_log\x18\x04\x20\x01(\x0b2\x1e.raft_cmdpb.Co\ - mpactLogResponseR\ncompactLog\x12K\n\x0ftransfer_leader\x18\x05\x20\x01(\ - \x0b2\".raft_cmdpb.TransferLeaderResponseR\x0etransferLeader\x12?\n\x0bv\ - erify_hash\x18\x06\x20\x01(\x0b2\x1e.raft_cmdpb.VerifyHashResponseR\nver\ - ifyHash\"\x15\n\x13RegionLeaderRequest\"<\n\x14RegionLeaderResponse\x12$\ - \n\x06leader\x18\x01\x20\x01(\x0b2\x0c.metapb.PeerR\x06leader\"\x15\n\ - \x13RegionDetailRequest\"d\n\x14RegionDetailResponse\x12&\n\x06region\ - \x18\x01\x20\x01(\x0b2\x0e.metapb.RegionR\x06region\x12$\n\x06leader\x18\ - \x02\x20\x01(\x0b2\x0c.metapb.PeerR\x06leader\"\xd1\x01\n\rStatusRequest\ - \x124\n\x08cmd_type\x18\x01\x20\x01(\x0e2\x19.raft_cmdpb.StatusCmdTypeR\ - \x07cmdType\x12D\n\rregion_leader\x18\x02\x20\x01(\x0b2\x1f.raft_cmdpb.R\ - egionLeaderRequestR\x0cregionLeader\x12D\n\rregion_detail\x18\x03\x20\ - \x01(\x0b2\x1f.raft_cmdpb.RegionDetailRequestR\x0cregionDetail\"\xd4\x01\ - \n\x0eStatusResponse\x124\n\x08cmd_type\x18\x01\x20\x01(\x0e2\x19.raft_c\ - mdpb.StatusCmdTypeR\x07cmdType\x12E\n\rregion_leader\x18\x02\x20\x01(\ - \x0b2\x20.raft_cmdpb.RegionLeaderResponseR\x0cregionLeader\x12E\n\rregio\ - n_detail\x18\x03\x20\x01(\x0b2\x20.raft_cmdpb.RegionDetailResponseR\x0cr\ - egionDetail\"\xd3\x01\n\x11RaftRequestHeader\x12\x1b\n\tregion_id\x18\ - \x01\x20\x01(\x04R\x08regionId\x12\x20\n\x04peer\x18\x02\x20\x01(\x0b2\ - \x0c.metapb.PeerR\x04peer\x12\x1f\n\x0bread_quorum\x18\x03\x20\x01(\x08R\ - \nreadQuorum\x12\x12\n\x04uuid\x18\x04\x20\x01(\x0cR\x04uuid\x126\n\x0cr\ - egion_epoch\x18\x05\x20\x01(\x0b2\x13.metapb.RegionEpochR\x0bregionEpoch\ - \x12\x12\n\x04term\x18\x06\x20\x01(\x04R\x04term\"q\n\x12RaftResponseHea\ - der\x12$\n\x05error\x18\x01\x20\x01(\x0b2\x0e.errorpb.ErrorR\x05error\ - \x12\x12\n\x04uuid\x18\x02\x20\x01(\x0cR\x04uuid\x12!\n\x0ccurrent_term\ - \x18\x03\x20\x01(\x04R\x0bcurrentTerm\"\xf9\x01\n\x0eRaftCmdRequest\x125\ - \n\x06header\x18\x01\x20\x01(\x0b2\x1d.raft_cmdpb.RaftRequestHeaderR\x06\ - header\x12/\n\x08requests\x18\x02\x20\x03(\x0b2\x13.raft_cmdpb.RequestR\ - \x08requests\x12=\n\radmin_request\x18\x03\x20\x01(\x0b2\x18.raft_cmdpb.\ - AdminRequestR\x0cadminRequest\x12@\n\x0estatus_request\x18\x04\x20\x01(\ - \x0b2\x19.raft_cmdpb.StatusRequestR\rstatusRequest\"\x84\x02\n\x0fRaftCm\ - dResponse\x126\n\x06header\x18\x01\x20\x01(\x0b2\x1e.raft_cmdpb.RaftResp\ - onseHeaderR\x06header\x122\n\tresponses\x18\x02\x20\x03(\x0b2\x14.raft_c\ - mdpb.ResponseR\tresponses\x12@\n\x0eadmin_response\x18\x03\x20\x01(\x0b2\ - \x19.raft_cmdpb.AdminResponseR\radminResponse\x12C\n\x0fstatus_response\ - \x18\x04\x20\x01(\x0b2\x1a.raft_cmdpb.StatusResponseR\x0estatusResponse*\ - ]\n\x07CmdType\x12\x0b\n\x07Invalid\x10\0\x12\x07\n\x03Get\x10\x01\x12\ - \x07\n\x03Put\x10\x03\x12\n\n\x06Delete\x10\x04\x12\x08\n\x04Snap\x10\ - \x05\x12\x0c\n\x08Prewrite\x10\x06\x12\x0f\n\x0bDeleteRange\x10\x07*\x80\ - \x01\n\x0cAdminCmdType\x12\x10\n\x0cInvalidAdmin\x10\0\x12\x0e\n\nChange\ - Peer\x10\x01\x12\t\n\x05Split\x10\x02\x12\x0e\n\nCompactLog\x10\x03\x12\ - \x12\n\x0eTransferLeader\x10\x04\x12\x0f\n\x0bComputeHash\x10\x05\x12\ - \x0e\n\nVerifyHash\x10\x06*F\n\rStatusCmdType\x12\x11\n\rInvalidStatus\ - \x10\0\x12\x10\n\x0cRegionLeader\x10\x01\x12\x10\n\x0cRegionDetail\x10\ - \x02B\x1a\n\x18com.pingcap.tikv.kvprotoJ\xcfE\n\x07\x12\x05\0\0\xff\x01\ - \x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x01\x08\x12\ - \n\t\n\x02\x03\0\x12\x03\x03\x07\x15\n\t\n\x02\x03\x01\x12\x03\x04\x07\ - \x16\n\t\n\x02\x03\x02\x12\x03\x05\x07\x16\n\x08\n\x01\x08\x12\x03\x07\0\ - 1\n\x0b\n\x04\x08\xe7\x07\0\x12\x03\x07\01\n\x0c\n\x05\x08\xe7\x07\0\x02\ - \x12\x03\x07\x07\x13\n\r\n\x06\x08\xe7\x07\0\x02\0\x12\x03\x07\x07\x13\n\ - \x0e\n\x07\x08\xe7\x07\0\x02\0\x01\x12\x03\x07\x07\x13\n\x0c\n\x05\x08\ - \xe7\x07\0\x07\x12\x03\x07\x160\n\n\n\x02\x04\0\x12\x04\t\0\x0c\x01\n\n\ - \n\x03\x04\0\x01\x12\x03\t\x08\x12\n\x0b\n\x04\x04\0\x02\0\x12\x03\n\x04\ - \x1c\n\x0c\n\x05\x04\0\x02\0\x04\x12\x03\n\x04\x0c\n\x0c\n\x05\x04\0\x02\ - \0\x05\x12\x03\n\r\x13\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\n\x14\x16\n\ - \x0c\n\x05\x04\0\x02\0\x03\x12\x03\n\x1a\x1b\n\x0b\n\x04\x04\0\x02\x01\ - \x12\x03\x0b\x04\x1c\n\x0c\n\x05\x04\0\x02\x01\x04\x12\x03\x0b\x04\x0c\n\ - \x0c\n\x05\x04\0\x02\x01\x05\x12\x03\x0b\r\x12\n\x0c\n\x05\x04\0\x02\x01\ - \x01\x12\x03\x0b\x14\x17\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x0b\x1a\ - \x1b\n\n\n\x02\x04\x01\x12\x04\x0e\0\x10\x01\n\n\n\x03\x04\x01\x01\x12\ - \x03\x0e\x08\x13\n\x0b\n\x04\x04\x01\x02\0\x12\x03\x0f\x04\x1d\n\x0c\n\ - \x05\x04\x01\x02\0\x04\x12\x03\x0f\x04\x0c\n\x0c\n\x05\x04\x01\x02\0\x05\ - \x12\x03\x0f\r\x12\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x0f\x13\x18\n\ - \x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x0f\x1b\x1c\n\n\n\x02\x04\x02\x12\ - \x04\x12\0\x16\x01\n\n\n\x03\x04\x02\x01\x12\x03\x12\x08\x12\n\x0b\n\x04\ - \x04\x02\x02\0\x12\x03\x13\x04\x1e\n\x0c\n\x05\x04\x02\x02\0\x04\x12\x03\ - \x13\x04\x0c\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03\x13\r\x13\n\x0c\n\x05\ - \x04\x02\x02\0\x01\x12\x03\x13\x14\x16\n\x0c\n\x05\x04\x02\x02\0\x03\x12\ - \x03\x13\x1c\x1d\n\x0b\n\x04\x04\x02\x02\x01\x12\x03\x14\x04\x1e\n\x0c\n\ - \x05\x04\x02\x02\x01\x04\x12\x03\x14\x04\x0c\n\x0c\n\x05\x04\x02\x02\x01\ - \x05\x12\x03\x14\r\x12\n\x0c\n\x05\x04\x02\x02\x01\x01\x12\x03\x14\x14\ - \x17\n\x0c\n\x05\x04\x02\x02\x01\x03\x12\x03\x14\x1c\x1d\n\x0b\n\x04\x04\ - \x02\x02\x02\x12\x03\x15\x04\x1e\n\x0c\n\x05\x04\x02\x02\x02\x04\x12\x03\ - \x15\x04\x0c\n\x0c\n\x05\x04\x02\x02\x02\x05\x12\x03\x15\r\x12\n\x0c\n\ - \x05\x04\x02\x02\x02\x01\x12\x03\x15\x14\x19\n\x0c\n\x05\x04\x02\x02\x02\ - \x03\x12\x03\x15\x1c\x1d\n\n\n\x02\x04\x03\x12\x04\x18\0\x1a\x01\n\n\n\ - \x03\x04\x03\x01\x12\x03\x18\x08\x13\n\n\n\x02\x04\x04\x12\x04\x1c\0\x1f\ - \x01\n\n\n\x03\x04\x04\x01\x12\x03\x1c\x08\x15\n\x0b\n\x04\x04\x04\x02\0\ - \x12\x03\x1d\x04\x1c\n\x0c\n\x05\x04\x04\x02\0\x04\x12\x03\x1d\x04\x0c\n\ - \x0c\n\x05\x04\x04\x02\0\x05\x12\x03\x1d\r\x13\n\x0c\n\x05\x04\x04\x02\0\ - \x01\x12\x03\x1d\x14\x16\n\x0c\n\x05\x04\x04\x02\0\x03\x12\x03\x1d\x1a\ - \x1b\n\x0b\n\x04\x04\x04\x02\x01\x12\x03\x1e\x04\x1c\n\x0c\n\x05\x04\x04\ - \x02\x01\x04\x12\x03\x1e\x04\x0c\n\x0c\n\x05\x04\x04\x02\x01\x05\x12\x03\ - \x1e\r\x12\n\x0c\n\x05\x04\x04\x02\x01\x01\x12\x03\x1e\x14\x17\n\x0c\n\ - \x05\x04\x04\x02\x01\x03\x12\x03\x1e\x1a\x1b\n\n\n\x02\x04\x05\x12\x04!\ - \0#\x01\n\n\n\x03\x04\x05\x01\x12\x03!\x08\x16\n\n\n\x02\x04\x06\x12\x04\ - %\0)\x01\n\n\n\x03\x04\x06\x01\x12\x03%\x08\x1a\n\x0b\n\x04\x04\x06\x02\ - \0\x12\x03&\x04!\n\x0c\n\x05\x04\x06\x02\0\x04\x12\x03&\x04\x0c\n\x0c\n\ - \x05\x04\x06\x02\0\x05\x12\x03&\r\x13\n\x0c\n\x05\x04\x06\x02\0\x01\x12\ - \x03&\x14\x16\n\x0c\n\x05\x04\x06\x02\0\x03\x12\x03&\x1f\x20\n\x0b\n\x04\ - \x04\x06\x02\x01\x12\x03'\x04!\n\x0c\n\x05\x04\x06\x02\x01\x04\x12\x03'\ - \x04\x0c\n\x0c\n\x05\x04\x06\x02\x01\x05\x12\x03'\r\x12\n\x0c\n\x05\x04\ - \x06\x02\x01\x01\x12\x03'\x13\x1c\n\x0c\n\x05\x04\x06\x02\x01\x03\x12\ - \x03'\x1f\x20\n\x0b\n\x04\x04\x06\x02\x02\x12\x03(\x04!\n\x0c\n\x05\x04\ - \x06\x02\x02\x04\x12\x03(\x04\x0c\n\x0c\n\x05\x04\x06\x02\x02\x05\x12\ - \x03(\r\x12\n\x0c\n\x05\x04\x06\x02\x02\x01\x12\x03(\x13\x1a\n\x0c\n\x05\ - \x04\x06\x02\x02\x03\x12\x03(\x1f\x20\n\n\n\x02\x04\x07\x12\x04+\0-\x01\ - \n\n\n\x03\x04\x07\x01\x12\x03+\x08\x1b\n\n\n\x02\x04\x08\x12\x04/\01\ - \x01\n\n\n\x03\x04\x08\x01\x12\x03/\x08\x13\n\n\n\x02\x04\t\x12\x043\05\ - \x01\n\n\n\x03\x04\t\x01\x12\x033\x08\x14\n\x0b\n\x04\x04\t\x02\0\x12\ - \x034\x04&\n\x0c\n\x05\x04\t\x02\0\x04\x12\x034\x04\x0c\n\x0c\n\x05\x04\ - \t\x02\0\x06\x12\x034\r\x1a\n\x0c\n\x05\x04\t\x02\0\x01\x12\x034\x1b!\n\ - \x0c\n\x05\x04\t\x02\0\x03\x12\x034$%\n\n\n\x02\x04\n\x12\x047\0;\x01\n\ - \n\n\x03\x04\n\x01\x12\x037\x08\x17\n\x0b\n\x04\x04\n\x02\0\x12\x038\x04\ - \x1e\n\x0c\n\x05\x04\n\x02\0\x04\x12\x038\x04\x0c\n\x0c\n\x05\x04\n\x02\ - \0\x05\x12\x038\r\x12\n\x0c\n\x05\x04\n\x02\0\x01\x12\x038\x13\x16\n\x0c\ - \n\x05\x04\n\x02\0\x03\x12\x038\x1c\x1d\n\x0b\n\x04\x04\n\x02\x01\x12\ - \x039\x04\x1e\n\x0c\n\x05\x04\n\x02\x01\x04\x12\x039\x04\x0c\n\x0c\n\x05\ - \x04\n\x02\x01\x05\x12\x039\r\x12\n\x0c\n\x05\x04\n\x02\x01\x01\x12\x039\ - \x13\x18\n\x0c\n\x05\x04\n\x02\x01\x03\x12\x039\x1c\x1d\n\x0b\n\x04\x04\ - \n\x02\x02\x12\x03:\x04\x1e\n\x0c\n\x05\x04\n\x02\x02\x04\x12\x03:\x04\ - \x0c\n\x0c\n\x05\x04\n\x02\x02\x05\x12\x03:\r\x12\n\x0c\n\x05\x04\n\x02\ - \x02\x01\x12\x03:\x13\x17\n\x0c\n\x05\x04\n\x02\x02\x03\x12\x03:\x1c\x1d\ - \n\n\n\x02\x04\x0b\x12\x04=\0?\x01\n\n\n\x03\x04\x0b\x01\x12\x03=\x08\ - \x18\n\n\n\x02\x05\0\x12\x04A\0I\x01\n\n\n\x03\x05\0\x01\x12\x03A\x05\ - \x0c\n\x0b\n\x04\x05\0\x02\0\x12\x03B\x04\x14\n\x0c\n\x05\x05\0\x02\0\ - \x01\x12\x03B\x04\x0b\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03B\x12\x13\n\x0b\ - \n\x04\x05\0\x02\x01\x12\x03C\x04\x14\n\x0c\n\x05\x05\0\x02\x01\x01\x12\ - \x03C\x04\x07\n\x0c\n\x05\x05\0\x02\x01\x02\x12\x03C\x12\x13\n\x0b\n\x04\ - \x05\0\x02\x02\x12\x03D\x04\x14\n\x0c\n\x05\x05\0\x02\x02\x01\x12\x03D\ - \x04\x07\n\x0c\n\x05\x05\0\x02\x02\x02\x12\x03D\x12\x13\n\x0b\n\x04\x05\ - \0\x02\x03\x12\x03E\x04\x14\n\x0c\n\x05\x05\0\x02\x03\x01\x12\x03E\x04\n\ - \n\x0c\n\x05\x05\0\x02\x03\x02\x12\x03E\x12\x13\n\x0b\n\x04\x05\0\x02\ - \x04\x12\x03F\x04\x14\n\x0c\n\x05\x05\0\x02\x04\x01\x12\x03F\x04\x08\n\ - \x0c\n\x05\x05\0\x02\x04\x02\x12\x03F\x12\x13\n\x0b\n\x04\x05\0\x02\x05\ - \x12\x03G\x04\x14\n\x0c\n\x05\x05\0\x02\x05\x01\x12\x03G\x04\x0c\n\x0c\n\ - \x05\x05\0\x02\x05\x02\x12\x03G\x12\x13\n\x0b\n\x04\x05\0\x02\x06\x12\ - \x03H\x04\x14\n\x0c\n\x05\x05\0\x02\x06\x01\x12\x03H\x04\x0f\n\x0c\n\x05\ - \x05\0\x02\x06\x02\x12\x03H\x12\x13\n\n\n\x02\x04\x0c\x12\x04K\0S\x01\n\ - \n\n\x03\x04\x0c\x01\x12\x03K\x08\x0f\n\x0b\n\x04\x04\x0c\x02\0\x12\x03L\ - \x041\n\x0c\n\x05\x04\x0c\x02\0\x04\x12\x03L\x04\x0c\n\x0c\n\x05\x04\x0c\ - \x02\0\x06\x12\x03L\r\x14\n\x0c\n\x05\x04\x0c\x02\0\x01\x12\x03L\x20(\n\ - \x0c\n\x05\x04\x0c\x02\0\x03\x12\x03L/0\n\x0b\n\x04\x04\x0c\x02\x01\x12\ - \x03M\x041\n\x0c\n\x05\x04\x0c\x02\x01\x04\x12\x03M\x04\x0c\n\x0c\n\x05\ - \x04\x0c\x02\x01\x06\x12\x03M\r\x17\n\x0c\n\x05\x04\x0c\x02\x01\x01\x12\ - \x03M\x20#\n\x0c\n\x05\x04\x0c\x02\x01\x03\x12\x03M/0\n\x0b\n\x04\x04\ - \x0c\x02\x02\x12\x03N\x041\n\x0c\n\x05\x04\x0c\x02\x02\x04\x12\x03N\x04\ - \x0c\n\x0c\n\x05\x04\x0c\x02\x02\x06\x12\x03N\r\x17\n\x0c\n\x05\x04\x0c\ - \x02\x02\x01\x12\x03N\x20#\n\x0c\n\x05\x04\x0c\x02\x02\x03\x12\x03N/0\n\ - \x0b\n\x04\x04\x0c\x02\x03\x12\x03O\x041\n\x0c\n\x05\x04\x0c\x02\x03\x04\ - \x12\x03O\x04\x0c\n\x0c\n\x05\x04\x0c\x02\x03\x06\x12\x03O\r\x1a\n\x0c\n\ - \x05\x04\x0c\x02\x03\x01\x12\x03O\x20&\n\x0c\n\x05\x04\x0c\x02\x03\x03\ - \x12\x03O/0\n\x0b\n\x04\x04\x0c\x02\x04\x12\x03P\x041\n\x0c\n\x05\x04\ - \x0c\x02\x04\x04\x12\x03P\x04\x0c\n\x0c\n\x05\x04\x0c\x02\x04\x06\x12\ - \x03P\r\x18\n\x0c\n\x05\x04\x0c\x02\x04\x01\x12\x03P\x20$\n\x0c\n\x05\ - \x04\x0c\x02\x04\x03\x12\x03P/0\n\x0b\n\x04\x04\x0c\x02\x05\x12\x03Q\x04\ - 1\n\x0c\n\x05\x04\x0c\x02\x05\x04\x12\x03Q\x04\x0c\n\x0c\n\x05\x04\x0c\ - \x02\x05\x06\x12\x03Q\r\x1c\n\x0c\n\x05\x04\x0c\x02\x05\x01\x12\x03Q\x20\ - (\n\x0c\n\x05\x04\x0c\x02\x05\x03\x12\x03Q/0\n\x0b\n\x04\x04\x0c\x02\x06\ - \x12\x03R\x041\n\x0c\n\x05\x04\x0c\x02\x06\x04\x12\x03R\x04\x0c\n\x0c\n\ - \x05\x04\x0c\x02\x06\x06\x12\x03R\r\x1f\n\x0c\n\x05\x04\x0c\x02\x06\x01\ - \x12\x03R\x20,\n\x0c\n\x05\x04\x0c\x02\x06\x03\x12\x03R/0\n\n\n\x02\x04\ - \r\x12\x04U\0]\x01\n\n\n\x03\x04\r\x01\x12\x03U\x08\x10\n\x0b\n\x04\x04\ - \r\x02\0\x12\x03V\x041\n\x0c\n\x05\x04\r\x02\0\x04\x12\x03V\x04\x0c\n\ - \x0c\n\x05\x04\r\x02\0\x06\x12\x03V\r\x14\n\x0c\n\x05\x04\r\x02\0\x01\ - \x12\x03V!)\n\x0c\n\x05\x04\r\x02\0\x03\x12\x03V/0\n\x0b\n\x04\x04\r\x02\ - \x01\x12\x03W\x041\n\x0c\n\x05\x04\r\x02\x01\x04\x12\x03W\x04\x0c\n\x0c\ - \n\x05\x04\r\x02\x01\x06\x12\x03W\r\x18\n\x0c\n\x05\x04\r\x02\x01\x01\ - \x12\x03W!$\n\x0c\n\x05\x04\r\x02\x01\x03\x12\x03W/0\n\x0b\n\x04\x04\r\ - \x02\x02\x12\x03X\x041\n\x0c\n\x05\x04\r\x02\x02\x04\x12\x03X\x04\x0c\n\ - \x0c\n\x05\x04\r\x02\x02\x06\x12\x03X\r\x18\n\x0c\n\x05\x04\r\x02\x02\ - \x01\x12\x03X!$\n\x0c\n\x05\x04\r\x02\x02\x03\x12\x03X/0\n\x0b\n\x04\x04\ - \r\x02\x03\x12\x03Y\x041\n\x0c\n\x05\x04\r\x02\x03\x04\x12\x03Y\x04\x0c\ - \n\x0c\n\x05\x04\r\x02\x03\x06\x12\x03Y\r\x1b\n\x0c\n\x05\x04\r\x02\x03\ - \x01\x12\x03Y!'\n\x0c\n\x05\x04\r\x02\x03\x03\x12\x03Y/0\n\x0b\n\x04\x04\ - \r\x02\x04\x12\x03Z\x041\n\x0c\n\x05\x04\r\x02\x04\x04\x12\x03Z\x04\x0c\ - \n\x0c\n\x05\x04\r\x02\x04\x06\x12\x03Z\r\x19\n\x0c\n\x05\x04\r\x02\x04\ - \x01\x12\x03Z!%\n\x0c\n\x05\x04\r\x02\x04\x03\x12\x03Z/0\n\x0b\n\x04\x04\ - \r\x02\x05\x12\x03[\x041\n\x0c\n\x05\x04\r\x02\x05\x04\x12\x03[\x04\x0c\ - \n\x0c\n\x05\x04\r\x02\x05\x06\x12\x03[\r\x1d\n\x0c\n\x05\x04\r\x02\x05\ - \x01\x12\x03[!)\n\x0c\n\x05\x04\r\x02\x05\x03\x12\x03[/0\n\x0b\n\x04\x04\ - \r\x02\x06\x12\x03\\\x041\n\x0c\n\x05\x04\r\x02\x06\x04\x12\x03\\\x04\ - \x0c\n\x0c\n\x05\x04\r\x02\x06\x06\x12\x03\\\r\x20\n\x0c\n\x05\x04\r\x02\ - \x06\x01\x12\x03\\!,\n\x0c\n\x05\x04\r\x02\x06\x03\x12\x03\\/0\n\n\n\x02\ - \x04\x0e\x12\x04_\0c\x01\n\n\n\x03\x04\x0e\x01\x12\x03_\x08\x19\nA\n\x04\ - \x04\x0e\x02\0\x12\x03a\x044\x1a4\x20This\x20can\x20be\x20only\x20called\ - \x20in\x20internal\x20RaftStore\x20now.\n\n\x0c\n\x05\x04\x0e\x02\0\x04\ - \x12\x03a\x04\x0c\n\x0c\n\x05\x04\x0e\x02\0\x06\x12\x03a\r#\n\x0c\n\x05\ - \x04\x0e\x02\0\x01\x12\x03a$/\n\x0c\n\x05\x04\x0e\x02\0\x03\x12\x03a23\n\ - \x0b\n\x04\x04\x0e\x02\x01\x12\x03b\x044\n\x0c\n\x05\x04\x0e\x02\x01\x04\ - \x12\x03b\x04\x0c\n\x0c\n\x05\x04\x0e\x02\x01\x06\x12\x03b\r\x18\n\x0c\n\ - \x05\x04\x0e\x02\x01\x01\x12\x03b\x19\x1d\n\x0c\n\x05\x04\x0e\x02\x01\ - \x03\x12\x03b23\n\n\n\x02\x04\x0f\x12\x04e\0g\x01\n\n\n\x03\x04\x0f\x01\ - \x12\x03e\x08\x1a\n\x0b\n\x04\x04\x0f\x02\0\x12\x03f\x04&\n\x0c\n\x05\ - \x04\x0f\x02\0\x04\x12\x03f\x04\x0c\n\x0c\n\x05\x04\x0f\x02\0\x06\x12\ - \x03f\r\x1a\n\x0c\n\x05\x04\x0f\x02\0\x01\x12\x03f\x1b!\n\x0c\n\x05\x04\ - \x0f\x02\0\x03\x12\x03f$%\n\n\n\x02\x04\x10\x12\x04i\0v\x01\n\n\n\x03\ - \x04\x10\x01\x12\x03i\x08\x14\nv\n\x04\x04\x10\x02\0\x12\x03l\x042\x1ai\ - \x20This\x20can\x20be\x20only\x20called\x20in\x20internal\x20RaftStore\ - \x20now.\n\x20The\x20split_key\x20must\x20be\x20in\x20the\x20been\x20spl\ - itting\x20region.\n\n\x0c\n\x05\x04\x10\x02\0\x04\x12\x03l\x04\x0c\n\x0c\ - \n\x05\x04\x10\x02\0\x05\x12\x03l\r\x12\n\x0c\n\x05\x04\x10\x02\0\x01\ - \x12\x03l\x13\x1c\n\x0c\n\x05\x04\x10\x02\0\x03\x12\x03l01\n\xba\x01\n\ - \x04\x04\x10\x02\x01\x12\x03p\x042\x1a\xac\x01\x20We\x20split\x20the\x20\ - region\x20into\x20two,\x20first\x20uses\x20the\x20origin\x20\n\x20parent\ - \x20region\x20id,\x20and\x20the\x20second\x20uses\x20the\x20new_region_i\ - d.\n\x20We\x20must\x20guarantee\x20that\x20the\x20new_region_id\x20is\ - \x20global\x20unique.\n\n\x0c\n\x05\x04\x10\x02\x01\x04\x12\x03p\x04\x0c\ - \n\x0c\n\x05\x04\x10\x02\x01\x05\x12\x03p\r\x13\n\x0c\n\x05\x04\x10\x02\ - \x01\x01\x12\x03p\x14!\n\x0c\n\x05\x04\x10\x02\x01\x03\x12\x03p01\n5\n\ - \x04\x04\x10\x02\x02\x12\x03r\x042\x1a(\x20The\x20peer\x20ids\x20for\x20\ - the\x20new\x20split\x20region.\n\n\x0c\n\x05\x04\x10\x02\x02\x04\x12\x03\ - r\x04\x0c\n\x0c\n\x05\x04\x10\x02\x02\x05\x12\x03r\r\x13\n\x0c\n\x05\x04\ - \x10\x02\x02\x01\x12\x03r\x14\x20\n\x0c\n\x05\x04\x10\x02\x02\x03\x12\ - \x03r01\nb\n\x04\x04\x10\x02\x03\x12\x03u\x042\x1aU\x20If\x20true,\x20ri\ - ght\x20region\x20derive\x20the\x20origin\x20region_id,\x20\n\x20left\x20\ - region\x20use\x20new_region_id.\n\n\x0c\n\x05\x04\x10\x02\x03\x04\x12\ - \x03u\x04\x0c\n\x0c\n\x05\x04\x10\x02\x03\x05\x12\x03u\r\x11\n\x0c\n\x05\ - \x04\x10\x02\x03\x01\x12\x03u\x12\x1e\n\x0c\n\x05\x04\x10\x02\x03\x03\ - \x12\x03u01\n\n\n\x02\x04\x11\x12\x04x\0{\x01\n\n\n\x03\x04\x11\x01\x12\ - \x03x\x08\x15\n\x0b\n\x04\x04\x11\x02\0\x12\x03y\x04%\n\x0c\n\x05\x04\ - \x11\x02\0\x04\x12\x03y\x04\x0c\n\x0c\n\x05\x04\x11\x02\0\x06\x12\x03y\r\ - \x1a\n\x0c\n\x05\x04\x11\x02\0\x01\x12\x03y\x1b\x1f\n\x0c\n\x05\x04\x11\ - \x02\0\x03\x12\x03y#$\n\x0b\n\x04\x04\x11\x02\x01\x12\x03z\x04%\n\x0c\n\ - \x05\x04\x11\x02\x01\x04\x12\x03z\x04\x0c\n\x0c\n\x05\x04\x11\x02\x01\ - \x06\x12\x03z\r\x1a\n\x0c\n\x05\x04\x11\x02\x01\x01\x12\x03z\x1b\x20\n\ - \x0c\n\x05\x04\x11\x02\x01\x03\x12\x03z#$\n\x0b\n\x02\x04\x12\x12\x05}\0\ - \x80\x01\x01\n\n\n\x03\x04\x12\x01\x12\x03}\x08\x19\n\x0b\n\x04\x04\x12\ - \x02\0\x12\x03~\x04(\n\x0c\n\x05\x04\x12\x02\0\x04\x12\x03~\x04\x0c\n\ - \x0c\n\x05\x04\x12\x02\0\x05\x12\x03~\r\x13\n\x0c\n\x05\x04\x12\x02\0\ - \x01\x12\x03~\x14!\n\x0c\n\x05\x04\x12\x02\0\x03\x12\x03~&'\n\x0b\n\x04\ - \x04\x12\x02\x01\x12\x03\x7f\x04(\n\x0c\n\x05\x04\x12\x02\x01\x04\x12\ - \x03\x7f\x04\x0c\n\x0c\n\x05\x04\x12\x02\x01\x05\x12\x03\x7f\r\x13\n\x0c\ - \n\x05\x04\x12\x02\x01\x01\x12\x03\x7f\x14\x20\n\x0c\n\x05\x04\x12\x02\ - \x01\x03\x12\x03\x7f&'\n\x0c\n\x02\x04\x13\x12\x06\x82\x01\0\x84\x01\x01\ - \n\x0b\n\x03\x04\x13\x01\x12\x04\x82\x01\x08\x1a\n\x0c\n\x02\x04\x14\x12\ - \x06\x86\x01\0\x88\x01\x01\n\x0b\n\x03\x04\x14\x01\x12\x04\x86\x01\x08\ - \x1d\n\x0c\n\x04\x04\x14\x02\0\x12\x04\x87\x01\x04\"\n\r\n\x05\x04\x14\ - \x02\0\x04\x12\x04\x87\x01\x04\x0c\n\r\n\x05\x04\x14\x02\0\x06\x12\x04\ - \x87\x01\r\x18\n\r\n\x05\x04\x14\x02\0\x01\x12\x04\x87\x01\x19\x1d\n\r\n\ - \x05\x04\x14\x02\0\x03\x12\x04\x87\x01\x20!\n\x0c\n\x02\x04\x15\x12\x06\ - \x8a\x01\0\x8b\x01\x01\n\x0b\n\x03\x04\x15\x01\x12\x04\x8a\x01\x08\x1e\n\ - \x0c\n\x02\x04\x16\x12\x06\x8d\x01\0\x90\x01\x01\n\x0b\n\x03\x04\x16\x01\ - \x12\x04\x8d\x01\x08\x19\n\x0c\n\x04\x04\x16\x02\0\x12\x04\x8e\x01\x04\ - \x20\n\r\n\x05\x04\x16\x02\0\x04\x12\x04\x8e\x01\x04\x0c\n\r\n\x05\x04\ - \x16\x02\0\x05\x12\x04\x8e\x01\r\x13\n\r\n\x05\x04\x16\x02\0\x01\x12\x04\ - \x8e\x01\x14\x19\n\r\n\x05\x04\x16\x02\0\x03\x12\x04\x8e\x01\x1e\x1f\n\ - \x0c\n\x04\x04\x16\x02\x01\x12\x04\x8f\x01\x04\x20\n\r\n\x05\x04\x16\x02\ - \x01\x04\x12\x04\x8f\x01\x04\x0c\n\r\n\x05\x04\x16\x02\x01\x05\x12\x04\ - \x8f\x01\r\x12\n\r\n\x05\x04\x16\x02\x01\x01\x12\x04\x8f\x01\x13\x17\n\r\ - \n\x05\x04\x16\x02\x01\x03\x12\x04\x8f\x01\x1e\x1f\n\x0c\n\x02\x04\x17\ - \x12\x06\x92\x01\0\x93\x01\x01\n\x0b\n\x03\x04\x17\x01\x12\x04\x92\x01\ - \x08\x1a\n\x0c\n\x02\x05\x01\x12\x06\x95\x01\0\x9d\x01\x01\n\x0b\n\x03\ - \x05\x01\x01\x12\x04\x95\x01\x05\x11\n\x0c\n\x04\x05\x01\x02\0\x12\x04\ - \x96\x01\x04\x18\n\r\n\x05\x05\x01\x02\0\x01\x12\x04\x96\x01\x04\x10\n\r\ - \n\x05\x05\x01\x02\0\x02\x12\x04\x96\x01\x16\x17\n\x0c\n\x04\x05\x01\x02\ - \x01\x12\x04\x97\x01\x04\x18\n\r\n\x05\x05\x01\x02\x01\x01\x12\x04\x97\ - \x01\x04\x0e\n\r\n\x05\x05\x01\x02\x01\x02\x12\x04\x97\x01\x16\x17\n\x0c\ - \n\x04\x05\x01\x02\x02\x12\x04\x98\x01\x04\x18\n\r\n\x05\x05\x01\x02\x02\ - \x01\x12\x04\x98\x01\x04\t\n\r\n\x05\x05\x01\x02\x02\x02\x12\x04\x98\x01\ - \x16\x17\n\x0c\n\x04\x05\x01\x02\x03\x12\x04\x99\x01\x04\x18\n\r\n\x05\ - \x05\x01\x02\x03\x01\x12\x04\x99\x01\x04\x0e\n\r\n\x05\x05\x01\x02\x03\ - \x02\x12\x04\x99\x01\x16\x17\n\x0c\n\x04\x05\x01\x02\x04\x12\x04\x9a\x01\ - \x04\x18\n\r\n\x05\x05\x01\x02\x04\x01\x12\x04\x9a\x01\x04\x12\n\r\n\x05\ - \x05\x01\x02\x04\x02\x12\x04\x9a\x01\x16\x17\n\x0c\n\x04\x05\x01\x02\x05\ - \x12\x04\x9b\x01\x04\x18\n\r\n\x05\x05\x01\x02\x05\x01\x12\x04\x9b\x01\ - \x04\x0f\n\r\n\x05\x05\x01\x02\x05\x02\x12\x04\x9b\x01\x16\x17\n\x0c\n\ - \x04\x05\x01\x02\x06\x12\x04\x9c\x01\x04\x18\n\r\n\x05\x05\x01\x02\x06\ - \x01\x12\x04\x9c\x01\x04\x0e\n\r\n\x05\x05\x01\x02\x06\x02\x12\x04\x9c\ - \x01\x16\x17\n\x0c\n\x02\x04\x18\x12\x06\x9f\x01\0\xa6\x01\x01\n\x0b\n\ - \x03\x04\x18\x01\x12\x04\x9f\x01\x08\x14\n\x0c\n\x04\x04\x18\x02\0\x12\ - \x04\xa0\x01\x048\n\r\n\x05\x04\x18\x02\0\x04\x12\x04\xa0\x01\x04\x0c\n\ - \r\n\x05\x04\x18\x02\0\x06\x12\x04\xa0\x01\r\x19\n\r\n\x05\x04\x18\x02\0\ - \x01\x12\x04\xa0\x01\x1a\"\n\r\n\x05\x04\x18\x02\0\x03\x12\x04\xa0\x0167\ - \n\x0c\n\x04\x04\x18\x02\x01\x12\x04\xa1\x01\x048\n\r\n\x05\x04\x18\x02\ - \x01\x04\x12\x04\xa1\x01\x04\x0c\n\r\n\x05\x04\x18\x02\x01\x06\x12\x04\ - \xa1\x01\r\x1e\n\r\n\x05\x04\x18\x02\x01\x01\x12\x04\xa1\x01\x1f*\n\r\n\ - \x05\x04\x18\x02\x01\x03\x12\x04\xa1\x0167\n\x0c\n\x04\x04\x18\x02\x02\ - \x12\x04\xa2\x01\x048\n\r\n\x05\x04\x18\x02\x02\x04\x12\x04\xa2\x01\x04\ - \x0c\n\r\n\x05\x04\x18\x02\x02\x06\x12\x04\xa2\x01\r\x19\n\r\n\x05\x04\ - \x18\x02\x02\x01\x12\x04\xa2\x01\x1a\x1f\n\r\n\x05\x04\x18\x02\x02\x03\ - \x12\x04\xa2\x0167\n\x0c\n\x04\x04\x18\x02\x03\x12\x04\xa3\x01\x048\n\r\ - \n\x05\x04\x18\x02\x03\x04\x12\x04\xa3\x01\x04\x0c\n\r\n\x05\x04\x18\x02\ - \x03\x06\x12\x04\xa3\x01\r\x1e\n\r\n\x05\x04\x18\x02\x03\x01\x12\x04\xa3\ - \x01\x1f*\n\r\n\x05\x04\x18\x02\x03\x03\x12\x04\xa3\x0167\n\x0c\n\x04\ - \x04\x18\x02\x04\x12\x04\xa4\x01\x048\n\r\n\x05\x04\x18\x02\x04\x04\x12\ - \x04\xa4\x01\x04\x0c\n\r\n\x05\x04\x18\x02\x04\x06\x12\x04\xa4\x01\r\"\n\ - \r\n\x05\x04\x18\x02\x04\x01\x12\x04\xa4\x01#2\n\r\n\x05\x04\x18\x02\x04\ - \x03\x12\x04\xa4\x0167\n\x0c\n\x04\x04\x18\x02\x05\x12\x04\xa5\x01\x048\ - \n\r\n\x05\x04\x18\x02\x05\x04\x12\x04\xa5\x01\x04\x0c\n\r\n\x05\x04\x18\ - \x02\x05\x06\x12\x04\xa5\x01\r\x1e\n\r\n\x05\x04\x18\x02\x05\x01\x12\x04\ - \xa5\x01\x1f*\n\r\n\x05\x04\x18\x02\x05\x03\x12\x04\xa5\x0167\n\x0c\n\ - \x02\x04\x19\x12\x06\xa8\x01\0\xaf\x01\x01\n\x0b\n\x03\x04\x19\x01\x12\ - \x04\xa8\x01\x08\x15\n\x0c\n\x04\x04\x19\x02\0\x12\x04\xa9\x01\x048\n\r\ - \n\x05\x04\x19\x02\0\x04\x12\x04\xa9\x01\x04\x0c\n\r\n\x05\x04\x19\x02\0\ - \x06\x12\x04\xa9\x01\r\x19\n\r\n\x05\x04\x19\x02\0\x01\x12\x04\xa9\x01\ - \x1a\"\n\r\n\x05\x04\x19\x02\0\x03\x12\x04\xa9\x0167\n\x0c\n\x04\x04\x19\ - \x02\x01\x12\x04\xaa\x01\x048\n\r\n\x05\x04\x19\x02\x01\x04\x12\x04\xaa\ - \x01\x04\x0c\n\r\n\x05\x04\x19\x02\x01\x06\x12\x04\xaa\x01\r\x1f\n\r\n\ - \x05\x04\x19\x02\x01\x01\x12\x04\xaa\x01\x20+\n\r\n\x05\x04\x19\x02\x01\ - \x03\x12\x04\xaa\x0167\n\x0c\n\x04\x04\x19\x02\x02\x12\x04\xab\x01\x048\ - \n\r\n\x05\x04\x19\x02\x02\x04\x12\x04\xab\x01\x04\x0c\n\r\n\x05\x04\x19\ - \x02\x02\x06\x12\x04\xab\x01\r\x1a\n\r\n\x05\x04\x19\x02\x02\x01\x12\x04\ - \xab\x01\x1b\x20\n\r\n\x05\x04\x19\x02\x02\x03\x12\x04\xab\x0167\n\x0c\n\ - \x04\x04\x19\x02\x03\x12\x04\xac\x01\x048\n\r\n\x05\x04\x19\x02\x03\x04\ - \x12\x04\xac\x01\x04\x0c\n\r\n\x05\x04\x19\x02\x03\x06\x12\x04\xac\x01\r\ - \x1f\n\r\n\x05\x04\x19\x02\x03\x01\x12\x04\xac\x01\x20+\n\r\n\x05\x04\ - \x19\x02\x03\x03\x12\x04\xac\x0167\n\x0c\n\x04\x04\x19\x02\x04\x12\x04\ - \xad\x01\x048\n\r\n\x05\x04\x19\x02\x04\x04\x12\x04\xad\x01\x04\x0c\n\r\ - \n\x05\x04\x19\x02\x04\x06\x12\x04\xad\x01\r#\n\r\n\x05\x04\x19\x02\x04\ - \x01\x12\x04\xad\x01$3\n\r\n\x05\x04\x19\x02\x04\x03\x12\x04\xad\x0167\n\ - \x0c\n\x04\x04\x19\x02\x05\x12\x04\xae\x01\x048\n\r\n\x05\x04\x19\x02\ - \x05\x04\x12\x04\xae\x01\x04\x0c\n\r\n\x05\x04\x19\x02\x05\x06\x12\x04\ - \xae\x01\r\x1f\n\r\n\x05\x04\x19\x02\x05\x01\x12\x04\xae\x01\x20+\n\r\n\ - \x05\x04\x19\x02\x05\x03\x12\x04\xae\x0167\n1\n\x02\x04\x1a\x12\x06\xb2\ - \x01\0\xb4\x01\x01\x1a#\x20For\x20get\x20the\x20leader\x20of\x20the\x20r\ - egion.\n\n\x0b\n\x03\x04\x1a\x01\x12\x04\xb2\x01\x08\x1b\n\x0c\n\x02\x04\ - \x1b\x12\x06\xb6\x01\0\xb8\x01\x01\n\x0b\n\x03\x04\x1b\x01\x12\x04\xb6\ - \x01\x08\x1c\n\x0c\n\x04\x04\x1b\x02\0\x12\x04\xb7\x01\x04$\n\r\n\x05\ - \x04\x1b\x02\0\x04\x12\x04\xb7\x01\x04\x0c\n\r\n\x05\x04\x1b\x02\0\x06\ - \x12\x04\xb7\x01\r\x18\n\r\n\x05\x04\x1b\x02\0\x01\x12\x04\xb7\x01\x19\ - \x1f\n\r\n\x05\x04\x1b\x02\0\x03\x12\x04\xb7\x01\"#\n\xe4\x04\n\x02\x04\ - \x1c\x12\x06\xc3\x01\0\xc5\x01\x01\x1a\xd5\x04\x20For\x20getting\x20more\ - \x20information\x20of\x20the\x20region.\n\x20We\x20add\x20some\x20admin\ - \x20operations\x20(ChangePeer,\x20Split...)\x20into\x20the\x20pb\x20job\ - \x20list,\n\x20then\x20pd\x20server\x20will\x20peek\x20the\x20first\x20o\ - ne,\x20handle\x20it\x20and\x20then\x20pop\x20it\x20from\x20the\x20job\ - \x20lib.\x20\n\x20But\x20sometimes,\x20the\x20pd\x20server\x20may\x20cra\ - sh\x20before\x20popping.\x20When\x20another\x20pd\x20server\n\x20starts\ - \x20and\x20finds\x20the\x20job\x20is\x20running\x20but\x20not\x20finishe\ - d,\x20it\x20will\x20first\x20check\x20whether\n\x20the\x20raft\x20server\ - \x20already\x20has\x20handled\x20this\x20job.\n\x20E,g,\x20for\x20Change\ - Peer,\x20if\x20we\x20add\x20Peer10\x20into\x20region1\x20and\x20find\x20\ - region1\x20has\x20already\x20had\n\x20Peer10,\x20we\x20can\x20think\x20t\ - his\x20ChangePeer\x20is\x20finished,\x20and\x20can\x20pop\x20this\x20job\ - \x20from\x20job\x20list\n\x20directly.\n\n\x0b\n\x03\x04\x1c\x01\x12\x04\ - \xc3\x01\x08\x1b\n\x0c\n\x02\x04\x1d\x12\x06\xc7\x01\0\xca\x01\x01\n\x0b\ - \n\x03\x04\x1d\x01\x12\x04\xc7\x01\x08\x1c\n\x0c\n\x04\x04\x1d\x02\0\x12\ - \x04\xc8\x01\x04'\n\r\n\x05\x04\x1d\x02\0\x04\x12\x04\xc8\x01\x04\x0c\n\ - \r\n\x05\x04\x1d\x02\0\x06\x12\x04\xc8\x01\r\x1a\n\r\n\x05\x04\x1d\x02\0\ - \x01\x12\x04\xc8\x01\x1b!\n\r\n\x05\x04\x1d\x02\0\x03\x12\x04\xc8\x01%&\ - \n\x0c\n\x04\x04\x1d\x02\x01\x12\x04\xc9\x01\x04'\n\r\n\x05\x04\x1d\x02\ - \x01\x04\x12\x04\xc9\x01\x04\x0c\n\r\n\x05\x04\x1d\x02\x01\x06\x12\x04\ - \xc9\x01\r\x18\n\r\n\x05\x04\x1d\x02\x01\x01\x12\x04\xc9\x01\x19\x1f\n\r\ - \n\x05\x04\x1d\x02\x01\x03\x12\x04\xc9\x01%&\n\x0c\n\x02\x05\x02\x12\x06\ - \xcd\x01\0\xd1\x01\x01\n\x0b\n\x03\x05\x02\x01\x12\x04\xcd\x01\x05\x12\n\ - \x0c\n\x04\x05\x02\x02\0\x12\x04\xce\x01\x04\x19\n\r\n\x05\x05\x02\x02\0\ - \x01\x12\x04\xce\x01\x04\x11\n\r\n\x05\x05\x02\x02\0\x02\x12\x04\xce\x01\ - \x17\x18\n\x0c\n\x04\x05\x02\x02\x01\x12\x04\xcf\x01\x04\x19\n\r\n\x05\ - \x05\x02\x02\x01\x01\x12\x04\xcf\x01\x04\x10\n\r\n\x05\x05\x02\x02\x01\ - \x02\x12\x04\xcf\x01\x17\x18\n\x0c\n\x04\x05\x02\x02\x02\x12\x04\xd0\x01\ - \x04\x19\n\r\n\x05\x05\x02\x02\x02\x01\x12\x04\xd0\x01\x04\x10\n\r\n\x05\ - \x05\x02\x02\x02\x02\x12\x04\xd0\x01\x17\x18\n\x0c\n\x02\x04\x1e\x12\x06\ - \xd3\x01\0\xd7\x01\x01\n\x0b\n\x03\x04\x1e\x01\x12\x04\xd3\x01\x08\x15\n\ - \x0c\n\x04\x04\x1e\x02\0\x12\x04\xd4\x01\x046\n\r\n\x05\x04\x1e\x02\0\ - \x04\x12\x04\xd4\x01\x04\x0c\n\r\n\x05\x04\x1e\x02\0\x06\x12\x04\xd4\x01\ - \r\x1a\n\r\n\x05\x04\x1e\x02\0\x01\x12\x04\xd4\x01\x1b#\n\r\n\x05\x04\ - \x1e\x02\0\x03\x12\x04\xd4\x0145\n\x0c\n\x04\x04\x1e\x02\x01\x12\x04\xd5\ - \x01\x046\n\r\n\x05\x04\x1e\x02\x01\x04\x12\x04\xd5\x01\x04\x0c\n\r\n\ - \x05\x04\x1e\x02\x01\x06\x12\x04\xd5\x01\r\x20\n\r\n\x05\x04\x1e\x02\x01\ - \x01\x12\x04\xd5\x01!.\n\r\n\x05\x04\x1e\x02\x01\x03\x12\x04\xd5\x0145\n\ - \x0c\n\x04\x04\x1e\x02\x02\x12\x04\xd6\x01\x046\n\r\n\x05\x04\x1e\x02\ - \x02\x04\x12\x04\xd6\x01\x04\x0c\n\r\n\x05\x04\x1e\x02\x02\x06\x12\x04\ - \xd6\x01\r\x20\n\r\n\x05\x04\x1e\x02\x02\x01\x12\x04\xd6\x01!.\n\r\n\x05\ - \x04\x1e\x02\x02\x03\x12\x04\xd6\x0145\n\x0c\n\x02\x04\x1f\x12\x06\xd9\ - \x01\0\xdd\x01\x01\n\x0b\n\x03\x04\x1f\x01\x12\x04\xd9\x01\x08\x16\n\x0c\ - \n\x04\x04\x1f\x02\0\x12\x04\xda\x01\x046\n\r\n\x05\x04\x1f\x02\0\x04\ - \x12\x04\xda\x01\x04\x0c\n\r\n\x05\x04\x1f\x02\0\x06\x12\x04\xda\x01\r\ - \x1a\n\r\n\x05\x04\x1f\x02\0\x01\x12\x04\xda\x01\x1b#\n\r\n\x05\x04\x1f\ - \x02\0\x03\x12\x04\xda\x0145\n\x0c\n\x04\x04\x1f\x02\x01\x12\x04\xdb\x01\ - \x046\n\r\n\x05\x04\x1f\x02\x01\x04\x12\x04\xdb\x01\x04\x0c\n\r\n\x05\ - \x04\x1f\x02\x01\x06\x12\x04\xdb\x01\r!\n\r\n\x05\x04\x1f\x02\x01\x01\ - \x12\x04\xdb\x01\"/\n\r\n\x05\x04\x1f\x02\x01\x03\x12\x04\xdb\x0145\n\ - \x0c\n\x04\x04\x1f\x02\x02\x12\x04\xdc\x01\x046\n\r\n\x05\x04\x1f\x02\ - \x02\x04\x12\x04\xdc\x01\x04\x0c\n\r\n\x05\x04\x1f\x02\x02\x06\x12\x04\ - \xdc\x01\r!\n\r\n\x05\x04\x1f\x02\x02\x01\x12\x04\xdc\x01\"/\n\r\n\x05\ - \x04\x1f\x02\x02\x03\x12\x04\xdc\x0145\n\x0c\n\x02\x04\x20\x12\x06\xdf\ - \x01\0\xe9\x01\x01\n\x0b\n\x03\x04\x20\x01\x12\x04\xdf\x01\x08\x19\n\x0c\ - \n\x04\x04\x20\x02\0\x12\x04\xe0\x01\x044\n\r\n\x05\x04\x20\x02\0\x04\ - \x12\x04\xe0\x01\x04\x0c\n\r\n\x05\x04\x20\x02\0\x05\x12\x04\xe0\x01\r\ - \x13\n\r\n\x05\x04\x20\x02\0\x01\x12\x04\xe0\x01\x14\x1d\n\r\n\x05\x04\ - \x20\x02\0\x03\x12\x04\xe0\x0123\n\x0c\n\x04\x04\x20\x02\x01\x12\x04\xe1\ - \x01\x044\n\r\n\x05\x04\x20\x02\x01\x04\x12\x04\xe1\x01\x04\x0c\n\r\n\ - \x05\x04\x20\x02\x01\x06\x12\x04\xe1\x01\r\x18\n\r\n\x05\x04\x20\x02\x01\ - \x01\x12\x04\xe1\x01\x19\x1d\n\r\n\x05\x04\x20\x02\x01\x03\x12\x04\xe1\ - \x0123\n+\n\x04\x04\x20\x02\x02\x12\x04\xe3\x01\x044\x1a\x1d\x20true\x20\ - for\x20read\x20linearization\n\n\r\n\x05\x04\x20\x02\x02\x04\x12\x04\xe3\ - \x01\x04\x0c\n\r\n\x05\x04\x20\x02\x02\x05\x12\x04\xe3\x01\r\x11\n\r\n\ - \x05\x04\x20\x02\x02\x01\x12\x04\xe3\x01\x12\x1d\n\r\n\x05\x04\x20\x02\ - \x02\x03\x12\x04\xe3\x0123\n3\n\x04\x04\x20\x02\x03\x12\x04\xe5\x01\x044\ - \x1a%\x2016\x20bytes,\x20to\x20distinguish\x20request.\x20\x20\n\n\r\n\ - \x05\x04\x20\x02\x03\x04\x12\x04\xe5\x01\x04\x0c\n\r\n\x05\x04\x20\x02\ - \x03\x05\x12\x04\xe5\x01\r\x12\n\r\n\x05\x04\x20\x02\x03\x01\x12\x04\xe5\ - \x01\x13\x17\n\r\n\x05\x04\x20\x02\x03\x03\x12\x04\xe5\x0123\n\x0c\n\x04\ - \x04\x20\x02\x04\x12\x04\xe7\x01\x044\n\r\n\x05\x04\x20\x02\x04\x04\x12\ - \x04\xe7\x01\x04\x0c\n\r\n\x05\x04\x20\x02\x04\x06\x12\x04\xe7\x01\r\x1f\ - \n\r\n\x05\x04\x20\x02\x04\x01\x12\x04\xe7\x01\x20,\n\r\n\x05\x04\x20\ - \x02\x04\x03\x12\x04\xe7\x0123\n\x0c\n\x04\x04\x20\x02\x05\x12\x04\xe8\ - \x01\x044\n\r\n\x05\x04\x20\x02\x05\x04\x12\x04\xe8\x01\x04\x0c\n\r\n\ - \x05\x04\x20\x02\x05\x05\x12\x04\xe8\x01\r\x13\n\r\n\x05\x04\x20\x02\x05\ - \x01\x12\x04\xe8\x01\x14\x18\n\r\n\x05\x04\x20\x02\x05\x03\x12\x04\xe8\ - \x0123\n\x0c\n\x02\x04!\x12\x06\xeb\x01\0\xef\x01\x01\n\x0b\n\x03\x04!\ - \x01\x12\x04\xeb\x01\x08\x1a\n\x0c\n\x04\x04!\x02\0\x12\x04\xec\x01\x04&\ - \n\r\n\x05\x04!\x02\0\x04\x12\x04\xec\x01\x04\x0c\n\r\n\x05\x04!\x02\0\ - \x06\x12\x04\xec\x01\r\x1a\n\r\n\x05\x04!\x02\0\x01\x12\x04\xec\x01\x1b\ - \x20\n\r\n\x05\x04!\x02\0\x03\x12\x04\xec\x01$%\n\x0c\n\x04\x04!\x02\x01\ - \x12\x04\xed\x01\x04&\n\r\n\x05\x04!\x02\x01\x04\x12\x04\xed\x01\x04\x0c\ - \n\r\n\x05\x04!\x02\x01\x05\x12\x04\xed\x01\r\x12\n\r\n\x05\x04!\x02\x01\ - \x01\x12\x04\xed\x01\x13\x17\n\r\n\x05\x04!\x02\x01\x03\x12\x04\xed\x01$\ - %\n\x0c\n\x04\x04!\x02\x02\x12\x04\xee\x01\x04&\n\r\n\x05\x04!\x02\x02\ - \x04\x12\x04\xee\x01\x04\x0c\n\r\n\x05\x04!\x02\x02\x05\x12\x04\xee\x01\ - \r\x13\n\r\n\x05\x04!\x02\x02\x01\x12\x04\xee\x01\x14\x20\n\r\n\x05\x04!\ - \x02\x02\x03\x12\x04\xee\x01$%\n\x0c\n\x02\x04\"\x12\x06\xf1\x01\0\xf8\ - \x01\x01\n\x0b\n\x03\x04\"\x01\x12\x04\xf1\x01\x08\x16\n\x0c\n\x04\x04\"\ - \x02\0\x12\x04\xf2\x01\x04.\n\r\n\x05\x04\"\x02\0\x04\x12\x04\xf2\x01\ - \x04\x0c\n\r\n\x05\x04\"\x02\0\x06\x12\x04\xf2\x01\r\x1e\n\r\n\x05\x04\"\ - \x02\0\x01\x12\x04\xf2\x01\x1f%\n\r\n\x05\x04\"\x02\0\x03\x12\x04\xf2\ - \x01,-\nZ\n\x04\x04\"\x02\x01\x12\x04\xf5\x01\x04.\x1aL\x20We\x20can't\ - \x20enclose\x20normal\x20requests\x20and\x20administrator\x20request\n\ - \x20at\x20same\x20time.\x20\n\n\r\n\x05\x04\"\x02\x01\x04\x12\x04\xf5\ - \x01\x04\x0c\n\r\n\x05\x04\"\x02\x01\x06\x12\x04\xf5\x01\r\x14\n\r\n\x05\ - \x04\"\x02\x01\x01\x12\x04\xf5\x01\x15\x1d\n\r\n\x05\x04\"\x02\x01\x03\ - \x12\x04\xf5\x01,-\n\x0c\n\x04\x04\"\x02\x02\x12\x04\xf6\x01\x04.\n\r\n\ - \x05\x04\"\x02\x02\x04\x12\x04\xf6\x01\x04\x0c\n\r\n\x05\x04\"\x02\x02\ - \x06\x12\x04\xf6\x01\r\x19\n\r\n\x05\x04\"\x02\x02\x01\x12\x04\xf6\x01\ - \x1a'\n\r\n\x05\x04\"\x02\x02\x03\x12\x04\xf6\x01,-\n\x0c\n\x04\x04\"\ - \x02\x03\x12\x04\xf7\x01\x04.\n\r\n\x05\x04\"\x02\x03\x04\x12\x04\xf7\ - \x01\x04\x0c\n\r\n\x05\x04\"\x02\x03\x06\x12\x04\xf7\x01\r\x1a\n\r\n\x05\ - \x04\"\x02\x03\x01\x12\x04\xf7\x01\x1b)\n\r\n\x05\x04\"\x02\x03\x03\x12\ - \x04\xf7\x01,-\n\x0c\n\x02\x04#\x12\x06\xfa\x01\0\xff\x01\x01\n\x0b\n\ - \x03\x04#\x01\x12\x04\xfa\x01\x08\x17\n\x0c\n\x04\x04#\x02\0\x12\x04\xfb\ - \x01\x040\n\r\n\x05\x04#\x02\0\x04\x12\x04\xfb\x01\x04\x0c\n\r\n\x05\x04\ - #\x02\0\x06\x12\x04\xfb\x01\r\x1f\n\r\n\x05\x04#\x02\0\x01\x12\x04\xfb\ - \x01\x20&\n\r\n\x05\x04#\x02\0\x03\x12\x04\xfb\x01./\n\x0c\n\x04\x04#\ - \x02\x01\x12\x04\xfc\x01\x040\n\r\n\x05\x04#\x02\x01\x04\x12\x04\xfc\x01\ - \x04\x0c\n\r\n\x05\x04#\x02\x01\x06\x12\x04\xfc\x01\r\x15\n\r\n\x05\x04#\ - \x02\x01\x01\x12\x04\xfc\x01\x16\x1f\n\r\n\x05\x04#\x02\x01\x03\x12\x04\ - \xfc\x01./\n\x0c\n\x04\x04#\x02\x02\x12\x04\xfd\x01\x040\n\r\n\x05\x04#\ - \x02\x02\x04\x12\x04\xfd\x01\x04\x0c\n\r\n\x05\x04#\x02\x02\x06\x12\x04\ - \xfd\x01\r\x1a\n\r\n\x05\x04#\x02\x02\x01\x12\x04\xfd\x01\x1b)\n\r\n\x05\ - \x04#\x02\x02\x03\x12\x04\xfd\x01./\n\x0c\n\x04\x04#\x02\x03\x12\x04\xfe\ - \x01\x040\n\r\n\x05\x04#\x02\x03\x04\x12\x04\xfe\x01\x04\x0c\n\r\n\x05\ - \x04#\x02\x03\x06\x12\x04\xfe\x01\r\x1b\n\r\n\x05\x04#\x02\x03\x01\x12\ - \x04\xfe\x01\x1c+\n\r\n\x05\x04#\x02\x03\x03\x12\x04\xfe\x01./\ -"; - -static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/src/raft_serverpb.rs b/_vendor/src/github.com/pingcap/kvproto/src/raft_serverpb.rs deleted file mode 100644 index 2d345ccdcb0..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/src/raft_serverpb.rs +++ /dev/null @@ -1,3400 +0,0 @@ -// This file is generated. Do not edit -// @generated - -// https://github.com/Manishearth/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] - -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; - -#[derive(PartialEq,Clone,Default)] -pub struct RaftMessage { - // message fields - pub region_id: u64, - pub from_peer: ::protobuf::SingularPtrField, - pub to_peer: ::protobuf::SingularPtrField, - pub message: ::protobuf::SingularPtrField, - pub region_epoch: ::protobuf::SingularPtrField, - pub is_tombstone: bool, - pub start_key: ::std::vec::Vec, - pub end_key: ::std::vec::Vec, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RaftMessage {} - -impl RaftMessage { - pub fn new() -> RaftMessage { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RaftMessage { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RaftMessage, - }; - unsafe { - instance.get(RaftMessage::new) - } - } - - // uint64 region_id = 1; - - pub fn clear_region_id(&mut self) { - self.region_id = 0; - } - - // Param is passed by value, moved - pub fn set_region_id(&mut self, v: u64) { - self.region_id = v; - } - - pub fn get_region_id(&self) -> u64 { - self.region_id - } - - fn get_region_id_for_reflect(&self) -> &u64 { - &self.region_id - } - - fn mut_region_id_for_reflect(&mut self) -> &mut u64 { - &mut self.region_id - } - - // .metapb.Peer from_peer = 2; - - pub fn clear_from_peer(&mut self) { - self.from_peer.clear(); - } - - pub fn has_from_peer(&self) -> bool { - self.from_peer.is_some() - } - - // Param is passed by value, moved - pub fn set_from_peer(&mut self, v: super::metapb::Peer) { - self.from_peer = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_from_peer(&mut self) -> &mut super::metapb::Peer { - if self.from_peer.is_none() { - self.from_peer.set_default(); - } - self.from_peer.as_mut().unwrap() - } - - // Take field - pub fn take_from_peer(&mut self) -> super::metapb::Peer { - self.from_peer.take().unwrap_or_else(|| super::metapb::Peer::new()) - } - - pub fn get_from_peer(&self) -> &super::metapb::Peer { - self.from_peer.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) - } - - fn get_from_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.from_peer - } - - fn mut_from_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.from_peer - } - - // .metapb.Peer to_peer = 3; - - pub fn clear_to_peer(&mut self) { - self.to_peer.clear(); - } - - pub fn has_to_peer(&self) -> bool { - self.to_peer.is_some() - } - - // Param is passed by value, moved - pub fn set_to_peer(&mut self, v: super::metapb::Peer) { - self.to_peer = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_to_peer(&mut self) -> &mut super::metapb::Peer { - if self.to_peer.is_none() { - self.to_peer.set_default(); - } - self.to_peer.as_mut().unwrap() - } - - // Take field - pub fn take_to_peer(&mut self) -> super::metapb::Peer { - self.to_peer.take().unwrap_or_else(|| super::metapb::Peer::new()) - } - - pub fn get_to_peer(&self) -> &super::metapb::Peer { - self.to_peer.as_ref().unwrap_or_else(|| super::metapb::Peer::default_instance()) - } - - fn get_to_peer_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.to_peer - } - - fn mut_to_peer_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.to_peer - } - - // .eraftpb.Message message = 4; - - pub fn clear_message(&mut self) { - self.message.clear(); - } - - pub fn has_message(&self) -> bool { - self.message.is_some() - } - - // Param is passed by value, moved - pub fn set_message(&mut self, v: super::eraftpb::Message) { - self.message = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_message(&mut self) -> &mut super::eraftpb::Message { - if self.message.is_none() { - self.message.set_default(); - } - self.message.as_mut().unwrap() - } - - // Take field - pub fn take_message(&mut self) -> super::eraftpb::Message { - self.message.take().unwrap_or_else(|| super::eraftpb::Message::new()) - } - - pub fn get_message(&self) -> &super::eraftpb::Message { - self.message.as_ref().unwrap_or_else(|| super::eraftpb::Message::default_instance()) - } - - fn get_message_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.message - } - - fn mut_message_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.message - } - - // .metapb.RegionEpoch region_epoch = 5; - - pub fn clear_region_epoch(&mut self) { - self.region_epoch.clear(); - } - - pub fn has_region_epoch(&self) -> bool { - self.region_epoch.is_some() - } - - // Param is passed by value, moved - pub fn set_region_epoch(&mut self, v: super::metapb::RegionEpoch) { - self.region_epoch = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region_epoch(&mut self) -> &mut super::metapb::RegionEpoch { - if self.region_epoch.is_none() { - self.region_epoch.set_default(); - } - self.region_epoch.as_mut().unwrap() - } - - // Take field - pub fn take_region_epoch(&mut self) -> super::metapb::RegionEpoch { - self.region_epoch.take().unwrap_or_else(|| super::metapb::RegionEpoch::new()) - } - - pub fn get_region_epoch(&self) -> &super::metapb::RegionEpoch { - self.region_epoch.as_ref().unwrap_or_else(|| super::metapb::RegionEpoch::default_instance()) - } - - fn get_region_epoch_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region_epoch - } - - fn mut_region_epoch_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region_epoch - } - - // bool is_tombstone = 6; - - pub fn clear_is_tombstone(&mut self) { - self.is_tombstone = false; - } - - // Param is passed by value, moved - pub fn set_is_tombstone(&mut self, v: bool) { - self.is_tombstone = v; - } - - pub fn get_is_tombstone(&self) -> bool { - self.is_tombstone - } - - fn get_is_tombstone_for_reflect(&self) -> &bool { - &self.is_tombstone - } - - fn mut_is_tombstone_for_reflect(&mut self) -> &mut bool { - &mut self.is_tombstone - } - - // bytes start_key = 7; - - pub fn clear_start_key(&mut self) { - self.start_key.clear(); - } - - // Param is passed by value, moved - pub fn set_start_key(&mut self, v: ::std::vec::Vec) { - self.start_key = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_start_key(&mut self) -> &mut ::std::vec::Vec { - &mut self.start_key - } - - // Take field - pub fn take_start_key(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.start_key, ::std::vec::Vec::new()) - } - - pub fn get_start_key(&self) -> &[u8] { - &self.start_key - } - - fn get_start_key_for_reflect(&self) -> &::std::vec::Vec { - &self.start_key - } - - fn mut_start_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.start_key - } - - // bytes end_key = 8; - - pub fn clear_end_key(&mut self) { - self.end_key.clear(); - } - - // Param is passed by value, moved - pub fn set_end_key(&mut self, v: ::std::vec::Vec) { - self.end_key = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_end_key(&mut self) -> &mut ::std::vec::Vec { - &mut self.end_key - } - - // Take field - pub fn take_end_key(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.end_key, ::std::vec::Vec::new()) - } - - pub fn get_end_key(&self) -> &[u8] { - &self.end_key - } - - fn get_end_key_for_reflect(&self) -> &::std::vec::Vec { - &self.end_key - } - - fn mut_end_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.end_key - } -} - -impl ::protobuf::Message for RaftMessage { - fn is_initialized(&self) -> bool { - for v in &self.from_peer { - if !v.is_initialized() { - return false; - } - }; - for v in &self.to_peer { - if !v.is_initialized() { - return false; - } - }; - for v in &self.message { - if !v.is_initialized() { - return false; - } - }; - for v in &self.region_epoch { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.region_id = tmp; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.from_peer)?; - }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.to_peer)?; - }, - 4 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.message)?; - }, - 5 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region_epoch)?; - }, - 6 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_bool()?; - self.is_tombstone = tmp; - }, - 7 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.start_key)?; - }, - 8 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.end_key)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if self.region_id != 0 { - my_size += ::protobuf::rt::value_size(1, self.region_id, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(ref v) = self.from_peer.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.to_peer.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.message.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.region_epoch.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.is_tombstone != false { - my_size += 2; - } - if !self.start_key.is_empty() { - my_size += ::protobuf::rt::bytes_size(7, &self.start_key); - } - if !self.end_key.is_empty() { - my_size += ::protobuf::rt::bytes_size(8, &self.end_key); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if self.region_id != 0 { - os.write_uint64(1, self.region_id)?; - } - if let Some(ref v) = self.from_peer.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.to_peer.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.message.as_ref() { - os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.region_epoch.as_ref() { - os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.is_tombstone != false { - os.write_bool(6, self.is_tombstone)?; - } - if !self.start_key.is_empty() { - os.write_bytes(7, &self.start_key)?; - } - if !self.end_key.is_empty() { - os.write_bytes(8, &self.end_key)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RaftMessage { - fn new() -> RaftMessage { - RaftMessage::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "region_id", - RaftMessage::get_region_id_for_reflect, - RaftMessage::mut_region_id_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "from_peer", - RaftMessage::get_from_peer_for_reflect, - RaftMessage::mut_from_peer_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "to_peer", - RaftMessage::get_to_peer_for_reflect, - RaftMessage::mut_to_peer_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "message", - RaftMessage::get_message_for_reflect, - RaftMessage::mut_message_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region_epoch", - RaftMessage::get_region_epoch_for_reflect, - RaftMessage::mut_region_epoch_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( - "is_tombstone", - RaftMessage::get_is_tombstone_for_reflect, - RaftMessage::mut_is_tombstone_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "start_key", - RaftMessage::get_start_key_for_reflect, - RaftMessage::mut_start_key_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "end_key", - RaftMessage::get_end_key_for_reflect, - RaftMessage::mut_end_key_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RaftMessage", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RaftMessage { - fn clear(&mut self) { - self.clear_region_id(); - self.clear_from_peer(); - self.clear_to_peer(); - self.clear_message(); - self.clear_region_epoch(); - self.clear_is_tombstone(); - self.clear_start_key(); - self.clear_end_key(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RaftMessage { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RaftMessage { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RaftTruncatedState { - // message fields - pub index: u64, - pub term: u64, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RaftTruncatedState {} - -impl RaftTruncatedState { - pub fn new() -> RaftTruncatedState { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RaftTruncatedState { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RaftTruncatedState, - }; - unsafe { - instance.get(RaftTruncatedState::new) - } - } - - // uint64 index = 1; - - pub fn clear_index(&mut self) { - self.index = 0; - } - - // Param is passed by value, moved - pub fn set_index(&mut self, v: u64) { - self.index = v; - } - - pub fn get_index(&self) -> u64 { - self.index - } - - fn get_index_for_reflect(&self) -> &u64 { - &self.index - } - - fn mut_index_for_reflect(&mut self) -> &mut u64 { - &mut self.index - } - - // uint64 term = 2; - - pub fn clear_term(&mut self) { - self.term = 0; - } - - // Param is passed by value, moved - pub fn set_term(&mut self, v: u64) { - self.term = v; - } - - pub fn get_term(&self) -> u64 { - self.term - } - - fn get_term_for_reflect(&self) -> &u64 { - &self.term - } - - fn mut_term_for_reflect(&mut self) -> &mut u64 { - &mut self.term - } -} - -impl ::protobuf::Message for RaftTruncatedState { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.index = tmp; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.term = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if self.index != 0 { - my_size += ::protobuf::rt::value_size(1, self.index, ::protobuf::wire_format::WireTypeVarint); - } - if self.term != 0 { - my_size += ::protobuf::rt::value_size(2, self.term, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if self.index != 0 { - os.write_uint64(1, self.index)?; - } - if self.term != 0 { - os.write_uint64(2, self.term)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RaftTruncatedState { - fn new() -> RaftTruncatedState { - RaftTruncatedState::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "index", - RaftTruncatedState::get_index_for_reflect, - RaftTruncatedState::mut_index_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "term", - RaftTruncatedState::get_term_for_reflect, - RaftTruncatedState::mut_term_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RaftTruncatedState", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RaftTruncatedState { - fn clear(&mut self) { - self.clear_index(); - self.clear_term(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RaftTruncatedState { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RaftTruncatedState { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct SnapshotCFFile { - // message fields - pub cf: ::std::string::String, - pub size: u64, - pub checksum: u32, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for SnapshotCFFile {} - -impl SnapshotCFFile { - pub fn new() -> SnapshotCFFile { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static SnapshotCFFile { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const SnapshotCFFile, - }; - unsafe { - instance.get(SnapshotCFFile::new) - } - } - - // string cf = 1; - - pub fn clear_cf(&mut self) { - self.cf.clear(); - } - - // Param is passed by value, moved - pub fn set_cf(&mut self, v: ::std::string::String) { - self.cf = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_cf(&mut self) -> &mut ::std::string::String { - &mut self.cf - } - - // Take field - pub fn take_cf(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.cf, ::std::string::String::new()) - } - - pub fn get_cf(&self) -> &str { - &self.cf - } - - fn get_cf_for_reflect(&self) -> &::std::string::String { - &self.cf - } - - fn mut_cf_for_reflect(&mut self) -> &mut ::std::string::String { - &mut self.cf - } - - // uint64 size = 2; - - pub fn clear_size(&mut self) { - self.size = 0; - } - - // Param is passed by value, moved - pub fn set_size(&mut self, v: u64) { - self.size = v; - } - - pub fn get_size(&self) -> u64 { - self.size - } - - fn get_size_for_reflect(&self) -> &u64 { - &self.size - } - - fn mut_size_for_reflect(&mut self) -> &mut u64 { - &mut self.size - } - - // uint32 checksum = 3; - - pub fn clear_checksum(&mut self) { - self.checksum = 0; - } - - // Param is passed by value, moved - pub fn set_checksum(&mut self, v: u32) { - self.checksum = v; - } - - pub fn get_checksum(&self) -> u32 { - self.checksum - } - - fn get_checksum_for_reflect(&self) -> &u32 { - &self.checksum - } - - fn mut_checksum_for_reflect(&mut self) -> &mut u32 { - &mut self.checksum - } -} - -impl ::protobuf::Message for SnapshotCFFile { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.cf)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.size = tmp; - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint32()?; - self.checksum = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.cf.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.cf); - } - if self.size != 0 { - my_size += ::protobuf::rt::value_size(2, self.size, ::protobuf::wire_format::WireTypeVarint); - } - if self.checksum != 0 { - my_size += ::protobuf::rt::value_size(3, self.checksum, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.cf.is_empty() { - os.write_string(1, &self.cf)?; - } - if self.size != 0 { - os.write_uint64(2, self.size)?; - } - if self.checksum != 0 { - os.write_uint32(3, self.checksum)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for SnapshotCFFile { - fn new() -> SnapshotCFFile { - SnapshotCFFile::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "cf", - SnapshotCFFile::get_cf_for_reflect, - SnapshotCFFile::mut_cf_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "size", - SnapshotCFFile::get_size_for_reflect, - SnapshotCFFile::mut_size_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( - "checksum", - SnapshotCFFile::get_checksum_for_reflect, - SnapshotCFFile::mut_checksum_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "SnapshotCFFile", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for SnapshotCFFile { - fn clear(&mut self) { - self.clear_cf(); - self.clear_size(); - self.clear_checksum(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for SnapshotCFFile { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SnapshotCFFile { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct SnapshotMeta { - // message fields - pub cf_files: ::protobuf::RepeatedField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for SnapshotMeta {} - -impl SnapshotMeta { - pub fn new() -> SnapshotMeta { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static SnapshotMeta { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const SnapshotMeta, - }; - unsafe { - instance.get(SnapshotMeta::new) - } - } - - // repeated .raft_serverpb.SnapshotCFFile cf_files = 1; - - pub fn clear_cf_files(&mut self) { - self.cf_files.clear(); - } - - // Param is passed by value, moved - pub fn set_cf_files(&mut self, v: ::protobuf::RepeatedField) { - self.cf_files = v; - } - - // Mutable pointer to the field. - pub fn mut_cf_files(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.cf_files - } - - // Take field - pub fn take_cf_files(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.cf_files, ::protobuf::RepeatedField::new()) - } - - pub fn get_cf_files(&self) -> &[SnapshotCFFile] { - &self.cf_files - } - - fn get_cf_files_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.cf_files - } - - fn mut_cf_files_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.cf_files - } -} - -impl ::protobuf::Message for SnapshotMeta { - fn is_initialized(&self) -> bool { - for v in &self.cf_files { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.cf_files)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - for value in &self.cf_files { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - for v in &self.cf_files { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for SnapshotMeta { - fn new() -> SnapshotMeta { - SnapshotMeta::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "cf_files", - SnapshotMeta::get_cf_files_for_reflect, - SnapshotMeta::mut_cf_files_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "SnapshotMeta", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for SnapshotMeta { - fn clear(&mut self) { - self.clear_cf_files(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for SnapshotMeta { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SnapshotMeta { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct SnapshotChunk { - // message fields - pub message: ::protobuf::SingularPtrField, - pub data: ::std::vec::Vec, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for SnapshotChunk {} - -impl SnapshotChunk { - pub fn new() -> SnapshotChunk { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static SnapshotChunk { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const SnapshotChunk, - }; - unsafe { - instance.get(SnapshotChunk::new) - } - } - - // .raft_serverpb.RaftMessage message = 1; - - pub fn clear_message(&mut self) { - self.message.clear(); - } - - pub fn has_message(&self) -> bool { - self.message.is_some() - } - - // Param is passed by value, moved - pub fn set_message(&mut self, v: RaftMessage) { - self.message = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_message(&mut self) -> &mut RaftMessage { - if self.message.is_none() { - self.message.set_default(); - } - self.message.as_mut().unwrap() - } - - // Take field - pub fn take_message(&mut self) -> RaftMessage { - self.message.take().unwrap_or_else(|| RaftMessage::new()) - } - - pub fn get_message(&self) -> &RaftMessage { - self.message.as_ref().unwrap_or_else(|| RaftMessage::default_instance()) - } - - fn get_message_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.message - } - - fn mut_message_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.message - } - - // bytes data = 2; - - pub fn clear_data(&mut self) { - self.data.clear(); - } - - // Param is passed by value, moved - pub fn set_data(&mut self, v: ::std::vec::Vec) { - self.data = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { - &mut self.data - } - - // Take field - pub fn take_data(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.data, ::std::vec::Vec::new()) - } - - pub fn get_data(&self) -> &[u8] { - &self.data - } - - fn get_data_for_reflect(&self) -> &::std::vec::Vec { - &self.data - } - - fn mut_data_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.data - } -} - -impl ::protobuf::Message for SnapshotChunk { - fn is_initialized(&self) -> bool { - for v in &self.message { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.message)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.data)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.message.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.data.is_empty() { - my_size += ::protobuf::rt::bytes_size(2, &self.data); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.message.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.data.is_empty() { - os.write_bytes(2, &self.data)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for SnapshotChunk { - fn new() -> SnapshotChunk { - SnapshotChunk::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "message", - SnapshotChunk::get_message_for_reflect, - SnapshotChunk::mut_message_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "data", - SnapshotChunk::get_data_for_reflect, - SnapshotChunk::mut_data_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "SnapshotChunk", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for SnapshotChunk { - fn clear(&mut self) { - self.clear_message(); - self.clear_data(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for SnapshotChunk { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for SnapshotChunk { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Done { - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Done {} - -impl Done { - pub fn new() -> Done { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Done { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Done, - }; - unsafe { - instance.get(Done::new) - } - } -} - -impl ::protobuf::Message for Done { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Done { - fn new() -> Done { - Done::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let fields = ::std::vec::Vec::new(); - ::protobuf::reflect::MessageDescriptor::new::( - "Done", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Done { - fn clear(&mut self) { - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Done { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Done { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct KeyValue { - // message fields - pub key: ::std::vec::Vec, - pub value: ::std::vec::Vec, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for KeyValue {} - -impl KeyValue { - pub fn new() -> KeyValue { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static KeyValue { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const KeyValue, - }; - unsafe { - instance.get(KeyValue::new) - } - } - - // bytes key = 1; - - pub fn clear_key(&mut self) { - self.key.clear(); - } - - // Param is passed by value, moved - pub fn set_key(&mut self, v: ::std::vec::Vec) { - self.key = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_key(&mut self) -> &mut ::std::vec::Vec { - &mut self.key - } - - // Take field - pub fn take_key(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.key, ::std::vec::Vec::new()) - } - - pub fn get_key(&self) -> &[u8] { - &self.key - } - - fn get_key_for_reflect(&self) -> &::std::vec::Vec { - &self.key - } - - fn mut_key_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.key - } - - // bytes value = 2; - - pub fn clear_value(&mut self) { - self.value.clear(); - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: ::std::vec::Vec) { - self.value = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { - &mut self.value - } - - // Take field - pub fn take_value(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.value, ::std::vec::Vec::new()) - } - - pub fn get_value(&self) -> &[u8] { - &self.value - } - - fn get_value_for_reflect(&self) -> &::std::vec::Vec { - &self.value - } - - fn mut_value_for_reflect(&mut self) -> &mut ::std::vec::Vec { - &mut self.value - } -} - -impl ::protobuf::Message for KeyValue { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.key)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.value)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.key.is_empty() { - my_size += ::protobuf::rt::bytes_size(1, &self.key); - } - if !self.value.is_empty() { - my_size += ::protobuf::rt::bytes_size(2, &self.value); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.key.is_empty() { - os.write_bytes(1, &self.key)?; - } - if !self.value.is_empty() { - os.write_bytes(2, &self.value)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for KeyValue { - fn new() -> KeyValue { - KeyValue::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "key", - KeyValue::get_key_for_reflect, - KeyValue::mut_key_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "value", - KeyValue::get_value_for_reflect, - KeyValue::mut_value_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "KeyValue", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for KeyValue { - fn clear(&mut self) { - self.clear_key(); - self.clear_value(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for KeyValue { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for KeyValue { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RaftSnapshotData { - // message fields - pub region: ::protobuf::SingularPtrField, - pub file_size: u64, - pub data: ::protobuf::RepeatedField, - pub version: u64, - pub meta: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RaftSnapshotData {} - -impl RaftSnapshotData { - pub fn new() -> RaftSnapshotData { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RaftSnapshotData { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RaftSnapshotData, - }; - unsafe { - instance.get(RaftSnapshotData::new) - } - } - - // .metapb.Region region = 1; - - pub fn clear_region(&mut self) { - self.region.clear(); - } - - pub fn has_region(&self) -> bool { - self.region.is_some() - } - - // Param is passed by value, moved - pub fn set_region(&mut self, v: super::metapb::Region) { - self.region = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region(&mut self) -> &mut super::metapb::Region { - if self.region.is_none() { - self.region.set_default(); - } - self.region.as_mut().unwrap() - } - - // Take field - pub fn take_region(&mut self) -> super::metapb::Region { - self.region.take().unwrap_or_else(|| super::metapb::Region::new()) - } - - pub fn get_region(&self) -> &super::metapb::Region { - self.region.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) - } - - fn get_region_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region - } - - fn mut_region_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region - } - - // uint64 file_size = 2; - - pub fn clear_file_size(&mut self) { - self.file_size = 0; - } - - // Param is passed by value, moved - pub fn set_file_size(&mut self, v: u64) { - self.file_size = v; - } - - pub fn get_file_size(&self) -> u64 { - self.file_size - } - - fn get_file_size_for_reflect(&self) -> &u64 { - &self.file_size - } - - fn mut_file_size_for_reflect(&mut self) -> &mut u64 { - &mut self.file_size - } - - // repeated .raft_serverpb.KeyValue data = 3; - - pub fn clear_data(&mut self) { - self.data.clear(); - } - - // Param is passed by value, moved - pub fn set_data(&mut self, v: ::protobuf::RepeatedField) { - self.data = v; - } - - // Mutable pointer to the field. - pub fn mut_data(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.data - } - - // Take field - pub fn take_data(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.data, ::protobuf::RepeatedField::new()) - } - - pub fn get_data(&self) -> &[KeyValue] { - &self.data - } - - fn get_data_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.data - } - - fn mut_data_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.data - } - - // uint64 version = 4; - - pub fn clear_version(&mut self) { - self.version = 0; - } - - // Param is passed by value, moved - pub fn set_version(&mut self, v: u64) { - self.version = v; - } - - pub fn get_version(&self) -> u64 { - self.version - } - - fn get_version_for_reflect(&self) -> &u64 { - &self.version - } - - fn mut_version_for_reflect(&mut self) -> &mut u64 { - &mut self.version - } - - // .raft_serverpb.SnapshotMeta meta = 5; - - pub fn clear_meta(&mut self) { - self.meta.clear(); - } - - pub fn has_meta(&self) -> bool { - self.meta.is_some() - } - - // Param is passed by value, moved - pub fn set_meta(&mut self, v: SnapshotMeta) { - self.meta = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_meta(&mut self) -> &mut SnapshotMeta { - if self.meta.is_none() { - self.meta.set_default(); - } - self.meta.as_mut().unwrap() - } - - // Take field - pub fn take_meta(&mut self) -> SnapshotMeta { - self.meta.take().unwrap_or_else(|| SnapshotMeta::new()) - } - - pub fn get_meta(&self) -> &SnapshotMeta { - self.meta.as_ref().unwrap_or_else(|| SnapshotMeta::default_instance()) - } - - fn get_meta_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.meta - } - - fn mut_meta_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.meta - } -} - -impl ::protobuf::Message for RaftSnapshotData { - fn is_initialized(&self) -> bool { - for v in &self.region { - if !v.is_initialized() { - return false; - } - }; - for v in &self.data { - if !v.is_initialized() { - return false; - } - }; - for v in &self.meta { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.file_size = tmp; - }, - 3 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.data)?; - }, - 4 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.version = tmp; - }, - 5 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.meta)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.region.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.file_size != 0 { - my_size += ::protobuf::rt::value_size(2, self.file_size, ::protobuf::wire_format::WireTypeVarint); - } - for value in &self.data { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - if self.version != 0 { - my_size += ::protobuf::rt::value_size(4, self.version, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(ref v) = self.meta.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.region.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.file_size != 0 { - os.write_uint64(2, self.file_size)?; - } - for v in &self.data { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - if self.version != 0 { - os.write_uint64(4, self.version)?; - } - if let Some(ref v) = self.meta.as_ref() { - os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RaftSnapshotData { - fn new() -> RaftSnapshotData { - RaftSnapshotData::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region", - RaftSnapshotData::get_region_for_reflect, - RaftSnapshotData::mut_region_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "file_size", - RaftSnapshotData::get_file_size_for_reflect, - RaftSnapshotData::mut_file_size_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "data", - RaftSnapshotData::get_data_for_reflect, - RaftSnapshotData::mut_data_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "version", - RaftSnapshotData::get_version_for_reflect, - RaftSnapshotData::mut_version_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "meta", - RaftSnapshotData::get_meta_for_reflect, - RaftSnapshotData::mut_meta_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RaftSnapshotData", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RaftSnapshotData { - fn clear(&mut self) { - self.clear_region(); - self.clear_file_size(); - self.clear_data(); - self.clear_version(); - self.clear_meta(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RaftSnapshotData { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RaftSnapshotData { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct StoreIdent { - // message fields - pub cluster_id: u64, - pub store_id: u64, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for StoreIdent {} - -impl StoreIdent { - pub fn new() -> StoreIdent { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static StoreIdent { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const StoreIdent, - }; - unsafe { - instance.get(StoreIdent::new) - } - } - - // uint64 cluster_id = 1; - - pub fn clear_cluster_id(&mut self) { - self.cluster_id = 0; - } - - // Param is passed by value, moved - pub fn set_cluster_id(&mut self, v: u64) { - self.cluster_id = v; - } - - pub fn get_cluster_id(&self) -> u64 { - self.cluster_id - } - - fn get_cluster_id_for_reflect(&self) -> &u64 { - &self.cluster_id - } - - fn mut_cluster_id_for_reflect(&mut self) -> &mut u64 { - &mut self.cluster_id - } - - // uint64 store_id = 2; - - pub fn clear_store_id(&mut self) { - self.store_id = 0; - } - - // Param is passed by value, moved - pub fn set_store_id(&mut self, v: u64) { - self.store_id = v; - } - - pub fn get_store_id(&self) -> u64 { - self.store_id - } - - fn get_store_id_for_reflect(&self) -> &u64 { - &self.store_id - } - - fn mut_store_id_for_reflect(&mut self) -> &mut u64 { - &mut self.store_id - } -} - -impl ::protobuf::Message for StoreIdent { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.cluster_id = tmp; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.store_id = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if self.cluster_id != 0 { - my_size += ::protobuf::rt::value_size(1, self.cluster_id, ::protobuf::wire_format::WireTypeVarint); - } - if self.store_id != 0 { - my_size += ::protobuf::rt::value_size(2, self.store_id, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if self.cluster_id != 0 { - os.write_uint64(1, self.cluster_id)?; - } - if self.store_id != 0 { - os.write_uint64(2, self.store_id)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for StoreIdent { - fn new() -> StoreIdent { - StoreIdent::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "cluster_id", - StoreIdent::get_cluster_id_for_reflect, - StoreIdent::mut_cluster_id_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "store_id", - StoreIdent::get_store_id_for_reflect, - StoreIdent::mut_store_id_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "StoreIdent", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for StoreIdent { - fn clear(&mut self) { - self.clear_cluster_id(); - self.clear_store_id(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for StoreIdent { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for StoreIdent { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RaftLocalState { - // message fields - pub hard_state: ::protobuf::SingularPtrField, - pub last_index: u64, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RaftLocalState {} - -impl RaftLocalState { - pub fn new() -> RaftLocalState { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RaftLocalState { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RaftLocalState, - }; - unsafe { - instance.get(RaftLocalState::new) - } - } - - // .eraftpb.HardState hard_state = 1; - - pub fn clear_hard_state(&mut self) { - self.hard_state.clear(); - } - - pub fn has_hard_state(&self) -> bool { - self.hard_state.is_some() - } - - // Param is passed by value, moved - pub fn set_hard_state(&mut self, v: super::eraftpb::HardState) { - self.hard_state = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_hard_state(&mut self) -> &mut super::eraftpb::HardState { - if self.hard_state.is_none() { - self.hard_state.set_default(); - } - self.hard_state.as_mut().unwrap() - } - - // Take field - pub fn take_hard_state(&mut self) -> super::eraftpb::HardState { - self.hard_state.take().unwrap_or_else(|| super::eraftpb::HardState::new()) - } - - pub fn get_hard_state(&self) -> &super::eraftpb::HardState { - self.hard_state.as_ref().unwrap_or_else(|| super::eraftpb::HardState::default_instance()) - } - - fn get_hard_state_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.hard_state - } - - fn mut_hard_state_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.hard_state - } - - // uint64 last_index = 2; - - pub fn clear_last_index(&mut self) { - self.last_index = 0; - } - - // Param is passed by value, moved - pub fn set_last_index(&mut self, v: u64) { - self.last_index = v; - } - - pub fn get_last_index(&self) -> u64 { - self.last_index - } - - fn get_last_index_for_reflect(&self) -> &u64 { - &self.last_index - } - - fn mut_last_index_for_reflect(&mut self) -> &mut u64 { - &mut self.last_index - } -} - -impl ::protobuf::Message for RaftLocalState { - fn is_initialized(&self) -> bool { - for v in &self.hard_state { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.hard_state)?; - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.last_index = tmp; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.hard_state.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if self.last_index != 0 { - my_size += ::protobuf::rt::value_size(2, self.last_index, ::protobuf::wire_format::WireTypeVarint); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.hard_state.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if self.last_index != 0 { - os.write_uint64(2, self.last_index)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RaftLocalState { - fn new() -> RaftLocalState { - RaftLocalState::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "hard_state", - RaftLocalState::get_hard_state_for_reflect, - RaftLocalState::mut_hard_state_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "last_index", - RaftLocalState::get_last_index_for_reflect, - RaftLocalState::mut_last_index_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RaftLocalState", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RaftLocalState { - fn clear(&mut self) { - self.clear_hard_state(); - self.clear_last_index(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RaftLocalState { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RaftLocalState { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RaftApplyState { - // message fields - pub applied_index: u64, - pub truncated_state: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RaftApplyState {} - -impl RaftApplyState { - pub fn new() -> RaftApplyState { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RaftApplyState { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RaftApplyState, - }; - unsafe { - instance.get(RaftApplyState::new) - } - } - - // uint64 applied_index = 1; - - pub fn clear_applied_index(&mut self) { - self.applied_index = 0; - } - - // Param is passed by value, moved - pub fn set_applied_index(&mut self, v: u64) { - self.applied_index = v; - } - - pub fn get_applied_index(&self) -> u64 { - self.applied_index - } - - fn get_applied_index_for_reflect(&self) -> &u64 { - &self.applied_index - } - - fn mut_applied_index_for_reflect(&mut self) -> &mut u64 { - &mut self.applied_index - } - - // .raft_serverpb.RaftTruncatedState truncated_state = 2; - - pub fn clear_truncated_state(&mut self) { - self.truncated_state.clear(); - } - - pub fn has_truncated_state(&self) -> bool { - self.truncated_state.is_some() - } - - // Param is passed by value, moved - pub fn set_truncated_state(&mut self, v: RaftTruncatedState) { - self.truncated_state = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_truncated_state(&mut self) -> &mut RaftTruncatedState { - if self.truncated_state.is_none() { - self.truncated_state.set_default(); - } - self.truncated_state.as_mut().unwrap() - } - - // Take field - pub fn take_truncated_state(&mut self) -> RaftTruncatedState { - self.truncated_state.take().unwrap_or_else(|| RaftTruncatedState::new()) - } - - pub fn get_truncated_state(&self) -> &RaftTruncatedState { - self.truncated_state.as_ref().unwrap_or_else(|| RaftTruncatedState::default_instance()) - } - - fn get_truncated_state_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.truncated_state - } - - fn mut_truncated_state_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.truncated_state - } -} - -impl ::protobuf::Message for RaftApplyState { - fn is_initialized(&self) -> bool { - for v in &self.truncated_state { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint64()?; - self.applied_index = tmp; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.truncated_state)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if self.applied_index != 0 { - my_size += ::protobuf::rt::value_size(1, self.applied_index, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(ref v) = self.truncated_state.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if self.applied_index != 0 { - os.write_uint64(1, self.applied_index)?; - } - if let Some(ref v) = self.truncated_state.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RaftApplyState { - fn new() -> RaftApplyState { - RaftApplyState::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "applied_index", - RaftApplyState::get_applied_index_for_reflect, - RaftApplyState::mut_applied_index_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "truncated_state", - RaftApplyState::get_truncated_state_for_reflect, - RaftApplyState::mut_truncated_state_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RaftApplyState", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RaftApplyState { - fn clear(&mut self) { - self.clear_applied_index(); - self.clear_truncated_state(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RaftApplyState { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RaftApplyState { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RegionLocalState { - // message fields - pub state: PeerState, - pub region: ::protobuf::SingularPtrField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for RegionLocalState {} - -impl RegionLocalState { - pub fn new() -> RegionLocalState { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static RegionLocalState { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const RegionLocalState, - }; - unsafe { - instance.get(RegionLocalState::new) - } - } - - // .raft_serverpb.PeerState state = 1; - - pub fn clear_state(&mut self) { - self.state = PeerState::Normal; - } - - // Param is passed by value, moved - pub fn set_state(&mut self, v: PeerState) { - self.state = v; - } - - pub fn get_state(&self) -> PeerState { - self.state - } - - fn get_state_for_reflect(&self) -> &PeerState { - &self.state - } - - fn mut_state_for_reflect(&mut self) -> &mut PeerState { - &mut self.state - } - - // .metapb.Region region = 2; - - pub fn clear_region(&mut self) { - self.region.clear(); - } - - pub fn has_region(&self) -> bool { - self.region.is_some() - } - - // Param is passed by value, moved - pub fn set_region(&mut self, v: super::metapb::Region) { - self.region = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_region(&mut self) -> &mut super::metapb::Region { - if self.region.is_none() { - self.region.set_default(); - } - self.region.as_mut().unwrap() - } - - // Take field - pub fn take_region(&mut self) -> super::metapb::Region { - self.region.take().unwrap_or_else(|| super::metapb::Region::new()) - } - - pub fn get_region(&self) -> &super::metapb::Region { - self.region.as_ref().unwrap_or_else(|| super::metapb::Region::default_instance()) - } - - fn get_region_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.region - } - - fn mut_region_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.region - } -} - -impl ::protobuf::Message for RegionLocalState { - fn is_initialized(&self) -> bool { - for v in &self.region { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.state = tmp; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.region)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if self.state != PeerState::Normal { - my_size += ::protobuf::rt::enum_size(1, self.state); - } - if let Some(ref v) = self.region.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if self.state != PeerState::Normal { - os.write_enum(1, self.state.value())?; - } - if let Some(ref v) = self.region.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for RegionLocalState { - fn new() -> RegionLocalState { - RegionLocalState::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "state", - RegionLocalState::get_state_for_reflect, - RegionLocalState::mut_state_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "region", - RegionLocalState::get_region_for_reflect, - RegionLocalState::mut_region_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "RegionLocalState", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for RegionLocalState { - fn clear(&mut self) { - self.clear_state(); - self.clear_region(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RegionLocalState { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RegionLocalState { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum PeerState { - Normal = 0, - Applying = 1, - Tombstone = 2, -} - -impl ::protobuf::ProtobufEnum for PeerState { - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(PeerState::Normal), - 1 => ::std::option::Option::Some(PeerState::Applying), - 2 => ::std::option::Option::Some(PeerState::Tombstone), - _ => ::std::option::Option::None - } - } - - fn values() -> &'static [Self] { - static values: &'static [PeerState] = &[ - PeerState::Normal, - PeerState::Applying, - PeerState::Tombstone, - ]; - values - } - - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, - }; - unsafe { - descriptor.get(|| { - ::protobuf::reflect::EnumDescriptor::new("PeerState", file_descriptor_proto()) - }) - } - } -} - -impl ::std::marker::Copy for PeerState { -} - -impl ::std::default::Default for PeerState { - fn default() -> Self { - PeerState::Normal - } -} - -impl ::protobuf::reflect::ProtobufValue for PeerState { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x13raft_serverpb.proto\x12\rraft_serverpb\x1a\reraftpb.proto\x1a\x0cm\ - etapb.proto\"\xb9\x02\n\x0bRaftMessage\x12\x1b\n\tregion_id\x18\x01\x20\ - \x01(\x04R\x08regionId\x12)\n\tfrom_peer\x18\x02\x20\x01(\x0b2\x0c.metap\ - b.PeerR\x08fromPeer\x12%\n\x07to_peer\x18\x03\x20\x01(\x0b2\x0c.metapb.P\ - eerR\x06toPeer\x12*\n\x07message\x18\x04\x20\x01(\x0b2\x10.eraftpb.Messa\ - geR\x07message\x126\n\x0cregion_epoch\x18\x05\x20\x01(\x0b2\x13.metapb.R\ - egionEpochR\x0bregionEpoch\x12!\n\x0cis_tombstone\x18\x06\x20\x01(\x08R\ - \x0bisTombstone\x12\x1b\n\tstart_key\x18\x07\x20\x01(\x0cR\x08startKey\ - \x12\x17\n\x07end_key\x18\x08\x20\x01(\x0cR\x06endKey\">\n\x12RaftTrunca\ - tedState\x12\x14\n\x05index\x18\x01\x20\x01(\x04R\x05index\x12\x12\n\x04\ - term\x18\x02\x20\x01(\x04R\x04term\"P\n\x0eSnapshotCFFile\x12\x0e\n\x02c\ - f\x18\x01\x20\x01(\tR\x02cf\x12\x12\n\x04size\x18\x02\x20\x01(\x04R\x04s\ - ize\x12\x1a\n\x08checksum\x18\x03\x20\x01(\rR\x08checksum\"H\n\x0cSnapsh\ - otMeta\x128\n\x08cf_files\x18\x01\x20\x03(\x0b2\x1d.raft_serverpb.Snapsh\ - otCFFileR\x07cfFiles\"Y\n\rSnapshotChunk\x124\n\x07message\x18\x01\x20\ - \x01(\x0b2\x1a.raft_serverpb.RaftMessageR\x07message\x12\x12\n\x04data\ - \x18\x02\x20\x01(\x0cR\x04data\"\x06\n\x04Done\"2\n\x08KeyValue\x12\x10\ - \n\x03key\x18\x01\x20\x01(\x0cR\x03key\x12\x14\n\x05value\x18\x02\x20\ - \x01(\x0cR\x05value\"\xcf\x01\n\x10RaftSnapshotData\x12&\n\x06region\x18\ - \x01\x20\x01(\x0b2\x0e.metapb.RegionR\x06region\x12\x1b\n\tfile_size\x18\ - \x02\x20\x01(\x04R\x08fileSize\x12+\n\x04data\x18\x03\x20\x03(\x0b2\x17.\ - raft_serverpb.KeyValueR\x04data\x12\x18\n\x07version\x18\x04\x20\x01(\ - \x04R\x07version\x12/\n\x04meta\x18\x05\x20\x01(\x0b2\x1b.raft_serverpb.\ - SnapshotMetaR\x04meta\"F\n\nStoreIdent\x12\x1d\n\ncluster_id\x18\x01\x20\ - \x01(\x04R\tclusterId\x12\x19\n\x08store_id\x18\x02\x20\x01(\x04R\x07sto\ - reId\"b\n\x0eRaftLocalState\x121\n\nhard_state\x18\x01\x20\x01(\x0b2\x12\ - .eraftpb.HardStateR\thardState\x12\x1d\n\nlast_index\x18\x02\x20\x01(\ - \x04R\tlastIndex\"\x81\x01\n\x0eRaftApplyState\x12#\n\rapplied_index\x18\ - \x01\x20\x01(\x04R\x0cappliedIndex\x12J\n\x0ftruncated_state\x18\x02\x20\ - \x01(\x0b2!.raft_serverpb.RaftTruncatedStateR\x0etruncatedState\"j\n\x10\ - RegionLocalState\x12.\n\x05state\x18\x01\x20\x01(\x0e2\x18.raft_serverpb\ - .PeerStateR\x05state\x12&\n\x06region\x18\x02\x20\x01(\x0b2\x0e.metapb.R\ - egionR\x06region*4\n\tPeerState\x12\n\n\x06Normal\x10\0\x12\x0c\n\x08App\ - lying\x10\x01\x12\r\n\tTombstone\x10\x02B\x1a\n\x18com.pingcap.tikv.kvpr\ - otoJ\x9f\x16\n\x06\x12\x04\0\0P\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\ - \x08\n\x01\x02\x12\x03\x01\x08\x15\n\t\n\x02\x03\0\x12\x03\x03\x07\x16\n\ - \t\n\x02\x03\x01\x12\x03\x04\x07\x15\n\x08\n\x01\x08\x12\x03\x06\01\n\ - \x0b\n\x04\x08\xe7\x07\0\x12\x03\x06\01\n\x0c\n\x05\x08\xe7\x07\0\x02\ - \x12\x03\x06\x07\x13\n\r\n\x06\x08\xe7\x07\0\x02\0\x12\x03\x06\x07\x13\n\ - \x0e\n\x07\x08\xe7\x07\0\x02\0\x01\x12\x03\x06\x07\x13\n\x0c\n\x05\x08\ - \xe7\x07\0\x07\x12\x03\x06\x160\n\n\n\x02\x04\0\x12\x04\x08\0\x13\x01\n\ - \n\n\x03\x04\0\x01\x12\x03\x08\x08\x13\n\x0b\n\x04\x04\0\x02\0\x12\x03\t\ - \x04\x19\n\r\n\x05\x04\0\x02\0\x04\x12\x04\t\x04\x08\x15\n\x0c\n\x05\x04\ - \0\x02\0\x05\x12\x03\t\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\t\x0b\ - \x14\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\t\x17\x18\n\x0b\n\x04\x04\0\x02\ - \x01\x12\x03\n\x04\x1e\n\r\n\x05\x04\0\x02\x01\x04\x12\x04\n\x04\t\x19\n\ - \x0c\n\x05\x04\0\x02\x01\x06\x12\x03\n\x04\x0f\n\x0c\n\x05\x04\0\x02\x01\ - \x01\x12\x03\n\x10\x19\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\n\x1c\x1d\n\ - \x0b\n\x04\x04\0\x02\x02\x12\x03\x0b\x04\x1c\n\r\n\x05\x04\0\x02\x02\x04\ - \x12\x04\x0b\x04\n\x1e\n\x0c\n\x05\x04\0\x02\x02\x06\x12\x03\x0b\x04\x0f\ - \n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x0b\x10\x17\n\x0c\n\x05\x04\0\x02\ - \x02\x03\x12\x03\x0b\x1a\x1b\n\x0b\n\x04\x04\0\x02\x03\x12\x03\x0c\x04\ - \x20\n\r\n\x05\x04\0\x02\x03\x04\x12\x04\x0c\x04\x0b\x1c\n\x0c\n\x05\x04\ - \0\x02\x03\x06\x12\x03\x0c\x04\x13\n\x0c\n\x05\x04\0\x02\x03\x01\x12\x03\ - \x0c\x14\x1b\n\x0c\n\x05\x04\0\x02\x03\x03\x12\x03\x0c\x1e\x1f\n\x0b\n\ - \x04\x04\0\x02\x04\x12\x03\r\x04(\n\r\n\x05\x04\0\x02\x04\x04\x12\x04\r\ - \x04\x0c\x20\n\x0c\n\x05\x04\0\x02\x04\x06\x12\x03\r\x04\x16\n\x0c\n\x05\ - \x04\0\x02\x04\x01\x12\x03\r\x17#\n\x0c\n\x05\x04\0\x02\x04\x03\x12\x03\ - \r&'\nR\n\x04\x04\0\x02\x05\x12\x03\x0f\x04\x1a\x1aE\x20true\x20means\ - \x20to_peer\x20is\x20a\x20tombstone\x20peer\x20and\x20it\x20should\x20re\ - move\x20itself.\n\n\r\n\x05\x04\0\x02\x05\x04\x12\x04\x0f\x04\r(\n\x0c\n\ - \x05\x04\0\x02\x05\x05\x12\x03\x0f\x04\x08\n\x0c\n\x05\x04\0\x02\x05\x01\ - \x12\x03\x0f\t\x15\n\x0c\n\x05\x04\0\x02\x05\x03\x12\x03\x0f\x18\x19\n5\ - \n\x04\x04\0\x02\x06\x12\x03\x11\x04\x18\x1a(\x20Region\x20key\x20range\ - \x20[start_key,\x20end_key).\n\n\r\n\x05\x04\0\x02\x06\x04\x12\x04\x11\ - \x04\x0f\x1a\n\x0c\n\x05\x04\0\x02\x06\x05\x12\x03\x11\x04\t\n\x0c\n\x05\ - \x04\0\x02\x06\x01\x12\x03\x11\n\x13\n\x0c\n\x05\x04\0\x02\x06\x03\x12\ - \x03\x11\x16\x17\n\x0b\n\x04\x04\0\x02\x07\x12\x03\x12\x04\x16\n\r\n\x05\ - \x04\0\x02\x07\x04\x12\x04\x12\x04\x11\x18\n\x0c\n\x05\x04\0\x02\x07\x05\ - \x12\x03\x12\x04\t\n\x0c\n\x05\x04\0\x02\x07\x01\x12\x03\x12\n\x11\n\x0c\ - \n\x05\x04\0\x02\x07\x03\x12\x03\x12\x14\x15\n\n\n\x02\x04\x01\x12\x04\ - \x15\0\x18\x01\n\n\n\x03\x04\x01\x01\x12\x03\x15\x08\x1a\n\x0b\n\x04\x04\ - \x01\x02\0\x12\x03\x16\x04\x15\n\r\n\x05\x04\x01\x02\0\x04\x12\x04\x16\ - \x04\x15\x1c\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\x16\x04\n\n\x0c\n\x05\ - \x04\x01\x02\0\x01\x12\x03\x16\x0b\x10\n\x0c\n\x05\x04\x01\x02\0\x03\x12\ - \x03\x16\x13\x14\n\x0b\n\x04\x04\x01\x02\x01\x12\x03\x17\x04\x14\n\r\n\ - \x05\x04\x01\x02\x01\x04\x12\x04\x17\x04\x16\x15\n\x0c\n\x05\x04\x01\x02\ - \x01\x05\x12\x03\x17\x04\n\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\x17\ - \x0b\x0f\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\x17\x12\x13\n\n\n\x02\ - \x04\x02\x12\x04\x1a\0\x1e\x01\n\n\n\x03\x04\x02\x01\x12\x03\x1a\x08\x16\ - \n\x0b\n\x04\x04\x02\x02\0\x12\x03\x1b\x04\x12\n\r\n\x05\x04\x02\x02\0\ - \x04\x12\x04\x1b\x04\x1a\x18\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03\x1b\ - \x04\n\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\x1b\x0b\r\n\x0c\n\x05\x04\ - \x02\x02\0\x03\x12\x03\x1b\x10\x11\n\x0b\n\x04\x04\x02\x02\x01\x12\x03\ - \x1c\x04\x14\n\r\n\x05\x04\x02\x02\x01\x04\x12\x04\x1c\x04\x1b\x12\n\x0c\ - \n\x05\x04\x02\x02\x01\x05\x12\x03\x1c\x04\n\n\x0c\n\x05\x04\x02\x02\x01\ - \x01\x12\x03\x1c\x0b\x0f\n\x0c\n\x05\x04\x02\x02\x01\x03\x12\x03\x1c\x12\ - \x13\n\x0b\n\x04\x04\x02\x02\x02\x12\x03\x1d\x04\x18\n\r\n\x05\x04\x02\ - \x02\x02\x04\x12\x04\x1d\x04\x1c\x14\n\x0c\n\x05\x04\x02\x02\x02\x05\x12\ - \x03\x1d\x04\n\n\x0c\n\x05\x04\x02\x02\x02\x01\x12\x03\x1d\x0b\x13\n\x0c\ - \n\x05\x04\x02\x02\x02\x03\x12\x03\x1d\x16\x17\n\n\n\x02\x04\x03\x12\x04\ - \x20\0\"\x01\n\n\n\x03\x04\x03\x01\x12\x03\x20\x08\x14\n\x0b\n\x04\x04\ - \x03\x02\0\x12\x03!\x04)\n\x0c\n\x05\x04\x03\x02\0\x04\x12\x03!\x04\x0c\ - \n\x0c\n\x05\x04\x03\x02\0\x06\x12\x03!\r\x1b\n\x0c\n\x05\x04\x03\x02\0\ - \x01\x12\x03!\x1c$\n\x0c\n\x05\x04\x03\x02\0\x03\x12\x03!'(\n\n\n\x02\ - \x04\x04\x12\x04$\0'\x01\n\n\n\x03\x04\x04\x01\x12\x03$\x08\x15\n\x0b\n\ - \x04\x04\x04\x02\0\x12\x03%\x04\x1c\n\r\n\x05\x04\x04\x02\0\x04\x12\x04%\ - \x04$\x17\n\x0c\n\x05\x04\x04\x02\0\x06\x12\x03%\x04\x0f\n\x0c\n\x05\x04\ - \x04\x02\0\x01\x12\x03%\x10\x17\n\x0c\n\x05\x04\x04\x02\0\x03\x12\x03%\ - \x1a\x1b\n\x0b\n\x04\x04\x04\x02\x01\x12\x03&\x04\x13\n\r\n\x05\x04\x04\ - \x02\x01\x04\x12\x04&\x04%\x1c\n\x0c\n\x05\x04\x04\x02\x01\x05\x12\x03&\ - \x04\t\n\x0c\n\x05\x04\x04\x02\x01\x01\x12\x03&\n\x0e\n\x0c\n\x05\x04\ - \x04\x02\x01\x03\x12\x03&\x11\x12\n\t\n\x02\x04\x05\x12\x03)\0\x0f\n\n\n\ - \x03\x04\x05\x01\x12\x03)\x08\x0c\n\n\n\x02\x04\x06\x12\x04+\0.\x01\n\n\ - \n\x03\x04\x06\x01\x12\x03+\x08\x10\n\x0b\n\x04\x04\x06\x02\0\x12\x03,\ - \x04\x17\n\r\n\x05\x04\x06\x02\0\x04\x12\x04,\x04+\x12\n\x0c\n\x05\x04\ - \x06\x02\0\x05\x12\x03,\x04\t\n\x0c\n\x05\x04\x06\x02\0\x01\x12\x03,\n\r\ - \n\x0c\n\x05\x04\x06\x02\0\x03\x12\x03,\x15\x16\n\x0b\n\x04\x04\x06\x02\ - \x01\x12\x03-\x04\x17\n\r\n\x05\x04\x06\x02\x01\x04\x12\x04-\x04,\x17\n\ - \x0c\n\x05\x04\x06\x02\x01\x05\x12\x03-\x04\t\n\x0c\n\x05\x04\x06\x02\ - \x01\x01\x12\x03-\n\x0f\n\x0c\n\x05\x04\x06\x02\x01\x03\x12\x03-\x15\x16\ - \n\n\n\x02\x04\x07\x12\x040\06\x01\n\n\n\x03\x04\x07\x01\x12\x030\x08\ - \x18\n\x0b\n\x04\x04\x07\x02\0\x12\x031\x04\x1d\n\r\n\x05\x04\x07\x02\0\ - \x04\x12\x041\x040\x1a\n\x0c\n\x05\x04\x07\x02\0\x06\x12\x031\x04\x11\n\ - \x0c\n\x05\x04\x07\x02\0\x01\x12\x031\x12\x18\n\x0c\n\x05\x04\x07\x02\0\ - \x03\x12\x031\x1b\x1c\n\x0b\n\x04\x04\x07\x02\x01\x12\x032\x04\x19\n\r\n\ - \x05\x04\x07\x02\x01\x04\x12\x042\x041\x1d\n\x0c\n\x05\x04\x07\x02\x01\ - \x05\x12\x032\x04\n\n\x0c\n\x05\x04\x07\x02\x01\x01\x12\x032\x0b\x14\n\ - \x0c\n\x05\x04\x07\x02\x01\x03\x12\x032\x17\x18\n\x0b\n\x04\x04\x07\x02\ - \x02\x12\x033\x04\x1f\n\x0c\n\x05\x04\x07\x02\x02\x04\x12\x033\x04\x0c\n\ - \x0c\n\x05\x04\x07\x02\x02\x06\x12\x033\r\x15\n\x0c\n\x05\x04\x07\x02\ - \x02\x01\x12\x033\x16\x1a\n\x0c\n\x05\x04\x07\x02\x02\x03\x12\x033\x1d\ - \x1e\n\x0b\n\x04\x04\x07\x02\x03\x12\x034\x04\x17\n\r\n\x05\x04\x07\x02\ - \x03\x04\x12\x044\x043\x1f\n\x0c\n\x05\x04\x07\x02\x03\x05\x12\x034\x04\ - \n\n\x0c\n\x05\x04\x07\x02\x03\x01\x12\x034\x0b\x12\n\x0c\n\x05\x04\x07\ - \x02\x03\x03\x12\x034\x15\x16\n\x0b\n\x04\x04\x07\x02\x04\x12\x035\x04\ - \x1a\n\r\n\x05\x04\x07\x02\x04\x04\x12\x045\x044\x17\n\x0c\n\x05\x04\x07\ - \x02\x04\x06\x12\x035\x04\x10\n\x0c\n\x05\x04\x07\x02\x04\x01\x12\x035\ - \x11\x15\n\x0c\n\x05\x04\x07\x02\x04\x03\x12\x035\x18\x19\n\n\n\x02\x04\ - \x08\x12\x048\0;\x01\n\n\n\x03\x04\x08\x01\x12\x038\x08\x12\n\x0b\n\x04\ - \x04\x08\x02\0\x12\x039\x04\x1a\n\r\n\x05\x04\x08\x02\0\x04\x12\x049\x04\ - 8\x14\n\x0c\n\x05\x04\x08\x02\0\x05\x12\x039\x04\n\n\x0c\n\x05\x04\x08\ - \x02\0\x01\x12\x039\x0b\x15\n\x0c\n\x05\x04\x08\x02\0\x03\x12\x039\x18\ - \x19\n\x0b\n\x04\x04\x08\x02\x01\x12\x03:\x04\x18\n\r\n\x05\x04\x08\x02\ - \x01\x04\x12\x04:\x049\x1a\n\x0c\n\x05\x04\x08\x02\x01\x05\x12\x03:\x04\ - \n\n\x0c\n\x05\x04\x08\x02\x01\x01\x12\x03:\x0b\x13\n\x0c\n\x05\x04\x08\ - \x02\x01\x03\x12\x03:\x16\x17\n\n\n\x02\x04\t\x12\x04=\0@\x01\n\n\n\x03\ - \x04\t\x01\x12\x03=\x08\x16\n\x0b\n\x04\x04\t\x02\0\x12\x03>\x04%\n\r\n\ - \x05\x04\t\x02\0\x04\x12\x04>\x04=\x18\n\x0c\n\x05\x04\t\x02\0\x06\x12\ - \x03>\x04\x15\n\x0c\n\x05\x04\t\x02\0\x01\x12\x03>\x16\x20\n\x0c\n\x05\ - \x04\t\x02\0\x03\x12\x03>#$\n\x0b\n\x04\x04\t\x02\x01\x12\x03?\x04\x1a\n\ - \r\n\x05\x04\t\x02\x01\x04\x12\x04?\x04>%\n\x0c\n\x05\x04\t\x02\x01\x05\ - \x12\x03?\x04\n\n\x0c\n\x05\x04\t\x02\x01\x01\x12\x03?\x0b\x15\n\x0c\n\ - \x05\x04\t\x02\x01\x03\x12\x03?\x18\x19\n\n\n\x02\x04\n\x12\x04B\0E\x01\ - \n\n\n\x03\x04\n\x01\x12\x03B\x08\x16\n\x0b\n\x04\x04\n\x02\0\x12\x03C\ - \x04\x1d\n\r\n\x05\x04\n\x02\0\x04\x12\x04C\x04B\x18\n\x0c\n\x05\x04\n\ - \x02\0\x05\x12\x03C\x04\n\n\x0c\n\x05\x04\n\x02\0\x01\x12\x03C\x0b\x18\n\ - \x0c\n\x05\x04\n\x02\0\x03\x12\x03C\x1b\x1c\n\x0b\n\x04\x04\n\x02\x01\ - \x12\x03D\x04+\n\r\n\x05\x04\n\x02\x01\x04\x12\x04D\x04C\x1d\n\x0c\n\x05\ - \x04\n\x02\x01\x06\x12\x03D\x04\x16\n\x0c\n\x05\x04\n\x02\x01\x01\x12\ - \x03D\x17&\n\x0c\n\x05\x04\n\x02\x01\x03\x12\x03D)*\n\n\n\x02\x05\0\x12\ - \x04G\0K\x01\n\n\n\x03\x05\0\x01\x12\x03G\x05\x0e\n\x0b\n\x04\x05\0\x02\ - \0\x12\x03H\x04\x0f\n\x0c\n\x05\x05\0\x02\0\x01\x12\x03H\x04\n\n\x0c\n\ - \x05\x05\0\x02\0\x02\x12\x03H\r\x0e\n\x0b\n\x04\x05\0\x02\x01\x12\x03I\ - \x04\x11\n\x0c\n\x05\x05\0\x02\x01\x01\x12\x03I\x04\x0c\n\x0c\n\x05\x05\ - \0\x02\x01\x02\x12\x03I\x0f\x10\n\x0b\n\x04\x05\0\x02\x02\x12\x03J\x04\ - \x12\n\x0c\n\x05\x05\0\x02\x02\x01\x12\x03J\x04\r\n\x0c\n\x05\x05\0\x02\ - \x02\x02\x12\x03J\x10\x11\n\n\n\x02\x04\x0b\x12\x04M\0P\x01\n\n\n\x03\ - \x04\x0b\x01\x12\x03M\x08\x18\n\x0b\n\x04\x04\x0b\x02\0\x12\x03N\x04\x18\ - \n\r\n\x05\x04\x0b\x02\0\x04\x12\x04N\x04M\x1a\n\x0c\n\x05\x04\x0b\x02\0\ - \x06\x12\x03N\x04\r\n\x0c\n\x05\x04\x0b\x02\0\x01\x12\x03N\x0e\x13\n\x0c\ - \n\x05\x04\x0b\x02\0\x03\x12\x03N\x16\x17\n\x0b\n\x04\x04\x0b\x02\x01\ - \x12\x03O\x04\x1d\n\r\n\x05\x04\x0b\x02\x01\x04\x12\x04O\x04N\x18\n\x0c\ - \n\x05\x04\x0b\x02\x01\x06\x12\x03O\x04\x11\n\x0c\n\x05\x04\x0b\x02\x01\ - \x01\x12\x03O\x12\x18\n\x0c\n\x05\x04\x0b\x02\x01\x03\x12\x03O\x1b\x1cb\ - \x06proto3\ -"; - -static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } -} diff --git a/_vendor/src/github.com/pingcap/kvproto/src/tikvpb_grpc.rs b/_vendor/src/github.com/pingcap/kvproto/src/tikvpb_grpc.rs deleted file mode 100644 index 61744d376ba..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/src/tikvpb_grpc.rs +++ /dev/null @@ -1,614 +0,0 @@ -// This file is generated. Do not edit -// @generated - -// https://github.com/Manishearth/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] - -const METHOD_TIKV_KV_GET: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/tikvpb.Tikv/KvGet", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_TIKV_KV_SCAN: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/tikvpb.Tikv/KvScan", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_TIKV_KV_PREWRITE: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/tikvpb.Tikv/KvPrewrite", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_TIKV_KV_COMMIT: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/tikvpb.Tikv/KvCommit", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_TIKV_KV_IMPORT: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/tikvpb.Tikv/KvImport", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_TIKV_KV_CLEANUP: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/tikvpb.Tikv/KvCleanup", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_TIKV_KV_BATCH_GET: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/tikvpb.Tikv/KvBatchGet", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_TIKV_KV_BATCH_ROLLBACK: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/tikvpb.Tikv/KvBatchRollback", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_TIKV_KV_SCAN_LOCK: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/tikvpb.Tikv/KvScanLock", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_TIKV_KV_RESOLVE_LOCK: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/tikvpb.Tikv/KvResolveLock", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_TIKV_KV_GC: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/tikvpb.Tikv/KvGC", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_TIKV_KV_DELETE_RANGE: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/tikvpb.Tikv/KvDeleteRange", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_TIKV_RAW_GET: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/tikvpb.Tikv/RawGet", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_TIKV_RAW_PUT: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/tikvpb.Tikv/RawPut", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_TIKV_RAW_DELETE: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/tikvpb.Tikv/RawDelete", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_TIKV_RAW_SCAN: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/tikvpb.Tikv/RawScan", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_TIKV_COPROCESSOR: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/tikvpb.Tikv/Coprocessor", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_TIKV_RAFT: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::ClientStreaming, - name: "/tikvpb.Tikv/Raft", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_TIKV_SNAPSHOT: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::ClientStreaming, - name: "/tikvpb.Tikv/Snapshot", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_TIKV_MVCC_GET_BY_KEY: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/tikvpb.Tikv/MvccGetByKey", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -const METHOD_TIKV_MVCC_GET_BY_START_TS: ::grpcio::Method = ::grpcio::Method { - ty: ::grpcio::MethodType::Unary, - name: "/tikvpb.Tikv/MvccGetByStartTs", - req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, - resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, -}; - -pub struct TikvClient { - client: ::grpcio::Client, -} - -impl TikvClient { - pub fn new(channel: ::grpcio::Channel) -> Self { - TikvClient { - client: ::grpcio::Client::new(channel), - } - } - - pub fn kv_get_opt(&self, req: super::kvrpcpb::GetRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_TIKV_KV_GET, req, opt) - } - - pub fn kv_get(&self, req: super::kvrpcpb::GetRequest) -> ::grpcio::Result { - self.kv_get_opt(req, ::grpcio::CallOption::default()) - } - - pub fn kv_get_async_opt(&self, req: super::kvrpcpb::GetRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_TIKV_KV_GET, req, opt) - } - - pub fn kv_get_async(&self, req: super::kvrpcpb::GetRequest) -> ::grpcio::ClientUnaryReceiver { - self.kv_get_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn kv_scan_opt(&self, req: super::kvrpcpb::ScanRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_TIKV_KV_SCAN, req, opt) - } - - pub fn kv_scan(&self, req: super::kvrpcpb::ScanRequest) -> ::grpcio::Result { - self.kv_scan_opt(req, ::grpcio::CallOption::default()) - } - - pub fn kv_scan_async_opt(&self, req: super::kvrpcpb::ScanRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_TIKV_KV_SCAN, req, opt) - } - - pub fn kv_scan_async(&self, req: super::kvrpcpb::ScanRequest) -> ::grpcio::ClientUnaryReceiver { - self.kv_scan_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn kv_prewrite_opt(&self, req: super::kvrpcpb::PrewriteRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_TIKV_KV_PREWRITE, req, opt) - } - - pub fn kv_prewrite(&self, req: super::kvrpcpb::PrewriteRequest) -> ::grpcio::Result { - self.kv_prewrite_opt(req, ::grpcio::CallOption::default()) - } - - pub fn kv_prewrite_async_opt(&self, req: super::kvrpcpb::PrewriteRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_TIKV_KV_PREWRITE, req, opt) - } - - pub fn kv_prewrite_async(&self, req: super::kvrpcpb::PrewriteRequest) -> ::grpcio::ClientUnaryReceiver { - self.kv_prewrite_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn kv_commit_opt(&self, req: super::kvrpcpb::CommitRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_TIKV_KV_COMMIT, req, opt) - } - - pub fn kv_commit(&self, req: super::kvrpcpb::CommitRequest) -> ::grpcio::Result { - self.kv_commit_opt(req, ::grpcio::CallOption::default()) - } - - pub fn kv_commit_async_opt(&self, req: super::kvrpcpb::CommitRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_TIKV_KV_COMMIT, req, opt) - } - - pub fn kv_commit_async(&self, req: super::kvrpcpb::CommitRequest) -> ::grpcio::ClientUnaryReceiver { - self.kv_commit_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn kv_import_opt(&self, req: super::kvrpcpb::ImportRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_TIKV_KV_IMPORT, req, opt) - } - - pub fn kv_import(&self, req: super::kvrpcpb::ImportRequest) -> ::grpcio::Result { - self.kv_import_opt(req, ::grpcio::CallOption::default()) - } - - pub fn kv_import_async_opt(&self, req: super::kvrpcpb::ImportRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_TIKV_KV_IMPORT, req, opt) - } - - pub fn kv_import_async(&self, req: super::kvrpcpb::ImportRequest) -> ::grpcio::ClientUnaryReceiver { - self.kv_import_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn kv_cleanup_opt(&self, req: super::kvrpcpb::CleanupRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_TIKV_KV_CLEANUP, req, opt) - } - - pub fn kv_cleanup(&self, req: super::kvrpcpb::CleanupRequest) -> ::grpcio::Result { - self.kv_cleanup_opt(req, ::grpcio::CallOption::default()) - } - - pub fn kv_cleanup_async_opt(&self, req: super::kvrpcpb::CleanupRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_TIKV_KV_CLEANUP, req, opt) - } - - pub fn kv_cleanup_async(&self, req: super::kvrpcpb::CleanupRequest) -> ::grpcio::ClientUnaryReceiver { - self.kv_cleanup_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn kv_batch_get_opt(&self, req: super::kvrpcpb::BatchGetRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_TIKV_KV_BATCH_GET, req, opt) - } - - pub fn kv_batch_get(&self, req: super::kvrpcpb::BatchGetRequest) -> ::grpcio::Result { - self.kv_batch_get_opt(req, ::grpcio::CallOption::default()) - } - - pub fn kv_batch_get_async_opt(&self, req: super::kvrpcpb::BatchGetRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_TIKV_KV_BATCH_GET, req, opt) - } - - pub fn kv_batch_get_async(&self, req: super::kvrpcpb::BatchGetRequest) -> ::grpcio::ClientUnaryReceiver { - self.kv_batch_get_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn kv_batch_rollback_opt(&self, req: super::kvrpcpb::BatchRollbackRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_TIKV_KV_BATCH_ROLLBACK, req, opt) - } - - pub fn kv_batch_rollback(&self, req: super::kvrpcpb::BatchRollbackRequest) -> ::grpcio::Result { - self.kv_batch_rollback_opt(req, ::grpcio::CallOption::default()) - } - - pub fn kv_batch_rollback_async_opt(&self, req: super::kvrpcpb::BatchRollbackRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_TIKV_KV_BATCH_ROLLBACK, req, opt) - } - - pub fn kv_batch_rollback_async(&self, req: super::kvrpcpb::BatchRollbackRequest) -> ::grpcio::ClientUnaryReceiver { - self.kv_batch_rollback_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn kv_scan_lock_opt(&self, req: super::kvrpcpb::ScanLockRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_TIKV_KV_SCAN_LOCK, req, opt) - } - - pub fn kv_scan_lock(&self, req: super::kvrpcpb::ScanLockRequest) -> ::grpcio::Result { - self.kv_scan_lock_opt(req, ::grpcio::CallOption::default()) - } - - pub fn kv_scan_lock_async_opt(&self, req: super::kvrpcpb::ScanLockRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_TIKV_KV_SCAN_LOCK, req, opt) - } - - pub fn kv_scan_lock_async(&self, req: super::kvrpcpb::ScanLockRequest) -> ::grpcio::ClientUnaryReceiver { - self.kv_scan_lock_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn kv_resolve_lock_opt(&self, req: super::kvrpcpb::ResolveLockRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_TIKV_KV_RESOLVE_LOCK, req, opt) - } - - pub fn kv_resolve_lock(&self, req: super::kvrpcpb::ResolveLockRequest) -> ::grpcio::Result { - self.kv_resolve_lock_opt(req, ::grpcio::CallOption::default()) - } - - pub fn kv_resolve_lock_async_opt(&self, req: super::kvrpcpb::ResolveLockRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_TIKV_KV_RESOLVE_LOCK, req, opt) - } - - pub fn kv_resolve_lock_async(&self, req: super::kvrpcpb::ResolveLockRequest) -> ::grpcio::ClientUnaryReceiver { - self.kv_resolve_lock_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn kv_gc_opt(&self, req: super::kvrpcpb::GCRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_TIKV_KV_GC, req, opt) - } - - pub fn kv_gc(&self, req: super::kvrpcpb::GCRequest) -> ::grpcio::Result { - self.kv_gc_opt(req, ::grpcio::CallOption::default()) - } - - pub fn kv_gc_async_opt(&self, req: super::kvrpcpb::GCRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_TIKV_KV_GC, req, opt) - } - - pub fn kv_gc_async(&self, req: super::kvrpcpb::GCRequest) -> ::grpcio::ClientUnaryReceiver { - self.kv_gc_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn kv_delete_range_opt(&self, req: super::kvrpcpb::DeleteRangeRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_TIKV_KV_DELETE_RANGE, req, opt) - } - - pub fn kv_delete_range(&self, req: super::kvrpcpb::DeleteRangeRequest) -> ::grpcio::Result { - self.kv_delete_range_opt(req, ::grpcio::CallOption::default()) - } - - pub fn kv_delete_range_async_opt(&self, req: super::kvrpcpb::DeleteRangeRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_TIKV_KV_DELETE_RANGE, req, opt) - } - - pub fn kv_delete_range_async(&self, req: super::kvrpcpb::DeleteRangeRequest) -> ::grpcio::ClientUnaryReceiver { - self.kv_delete_range_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn raw_get_opt(&self, req: super::kvrpcpb::RawGetRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_TIKV_RAW_GET, req, opt) - } - - pub fn raw_get(&self, req: super::kvrpcpb::RawGetRequest) -> ::grpcio::Result { - self.raw_get_opt(req, ::grpcio::CallOption::default()) - } - - pub fn raw_get_async_opt(&self, req: super::kvrpcpb::RawGetRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_TIKV_RAW_GET, req, opt) - } - - pub fn raw_get_async(&self, req: super::kvrpcpb::RawGetRequest) -> ::grpcio::ClientUnaryReceiver { - self.raw_get_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn raw_put_opt(&self, req: super::kvrpcpb::RawPutRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_TIKV_RAW_PUT, req, opt) - } - - pub fn raw_put(&self, req: super::kvrpcpb::RawPutRequest) -> ::grpcio::Result { - self.raw_put_opt(req, ::grpcio::CallOption::default()) - } - - pub fn raw_put_async_opt(&self, req: super::kvrpcpb::RawPutRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_TIKV_RAW_PUT, req, opt) - } - - pub fn raw_put_async(&self, req: super::kvrpcpb::RawPutRequest) -> ::grpcio::ClientUnaryReceiver { - self.raw_put_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn raw_delete_opt(&self, req: super::kvrpcpb::RawDeleteRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_TIKV_RAW_DELETE, req, opt) - } - - pub fn raw_delete(&self, req: super::kvrpcpb::RawDeleteRequest) -> ::grpcio::Result { - self.raw_delete_opt(req, ::grpcio::CallOption::default()) - } - - pub fn raw_delete_async_opt(&self, req: super::kvrpcpb::RawDeleteRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_TIKV_RAW_DELETE, req, opt) - } - - pub fn raw_delete_async(&self, req: super::kvrpcpb::RawDeleteRequest) -> ::grpcio::ClientUnaryReceiver { - self.raw_delete_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn raw_scan_opt(&self, req: super::kvrpcpb::RawScanRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_TIKV_RAW_SCAN, req, opt) - } - - pub fn raw_scan(&self, req: super::kvrpcpb::RawScanRequest) -> ::grpcio::Result { - self.raw_scan_opt(req, ::grpcio::CallOption::default()) - } - - pub fn raw_scan_async_opt(&self, req: super::kvrpcpb::RawScanRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_TIKV_RAW_SCAN, req, opt) - } - - pub fn raw_scan_async(&self, req: super::kvrpcpb::RawScanRequest) -> ::grpcio::ClientUnaryReceiver { - self.raw_scan_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn coprocessor_opt(&self, req: super::coprocessor::Request, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_TIKV_COPROCESSOR, req, opt) - } - - pub fn coprocessor(&self, req: super::coprocessor::Request) -> ::grpcio::Result { - self.coprocessor_opt(req, ::grpcio::CallOption::default()) - } - - pub fn coprocessor_async_opt(&self, req: super::coprocessor::Request, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_TIKV_COPROCESSOR, req, opt) - } - - pub fn coprocessor_async(&self, req: super::coprocessor::Request) -> ::grpcio::ClientUnaryReceiver { - self.coprocessor_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn raft_opt(&self, opt: ::grpcio::CallOption) -> (::grpcio::ClientCStreamSender, ::grpcio::ClientCStreamReceiver) { - self.client.client_streaming(&METHOD_TIKV_RAFT, opt) - } - - pub fn raft(&self) -> (::grpcio::ClientCStreamSender, ::grpcio::ClientCStreamReceiver) { - self.raft_opt(::grpcio::CallOption::default()) - } - - pub fn snapshot_opt(&self, opt: ::grpcio::CallOption) -> (::grpcio::ClientCStreamSender, ::grpcio::ClientCStreamReceiver) { - self.client.client_streaming(&METHOD_TIKV_SNAPSHOT, opt) - } - - pub fn snapshot(&self) -> (::grpcio::ClientCStreamSender, ::grpcio::ClientCStreamReceiver) { - self.snapshot_opt(::grpcio::CallOption::default()) - } - - pub fn mvcc_get_by_key_opt(&self, req: super::kvrpcpb::MvccGetByKeyRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_TIKV_MVCC_GET_BY_KEY, req, opt) - } - - pub fn mvcc_get_by_key(&self, req: super::kvrpcpb::MvccGetByKeyRequest) -> ::grpcio::Result { - self.mvcc_get_by_key_opt(req, ::grpcio::CallOption::default()) - } - - pub fn mvcc_get_by_key_async_opt(&self, req: super::kvrpcpb::MvccGetByKeyRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_TIKV_MVCC_GET_BY_KEY, req, opt) - } - - pub fn mvcc_get_by_key_async(&self, req: super::kvrpcpb::MvccGetByKeyRequest) -> ::grpcio::ClientUnaryReceiver { - self.mvcc_get_by_key_async_opt(req, ::grpcio::CallOption::default()) - } - - pub fn mvcc_get_by_start_ts_opt(&self, req: super::kvrpcpb::MvccGetByStartTsRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { - self.client.unary_call(&METHOD_TIKV_MVCC_GET_BY_START_TS, req, opt) - } - - pub fn mvcc_get_by_start_ts(&self, req: super::kvrpcpb::MvccGetByStartTsRequest) -> ::grpcio::Result { - self.mvcc_get_by_start_ts_opt(req, ::grpcio::CallOption::default()) - } - - pub fn mvcc_get_by_start_ts_async_opt(&self, req: super::kvrpcpb::MvccGetByStartTsRequest, opt: ::grpcio::CallOption) -> ::grpcio::ClientUnaryReceiver { - self.client.unary_call_async(&METHOD_TIKV_MVCC_GET_BY_START_TS, req, opt) - } - - pub fn mvcc_get_by_start_ts_async(&self, req: super::kvrpcpb::MvccGetByStartTsRequest) -> ::grpcio::ClientUnaryReceiver { - self.mvcc_get_by_start_ts_async_opt(req, ::grpcio::CallOption::default()) - } - pub fn spawn(&self, f: F) where F: ::futures::Future + Send + 'static { - self.client.spawn(f) - } -} - -pub trait Tikv { - fn kv_get(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::GetRequest, sink: ::grpcio::UnarySink); - fn kv_scan(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::ScanRequest, sink: ::grpcio::UnarySink); - fn kv_prewrite(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::PrewriteRequest, sink: ::grpcio::UnarySink); - fn kv_commit(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::CommitRequest, sink: ::grpcio::UnarySink); - fn kv_import(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::ImportRequest, sink: ::grpcio::UnarySink); - fn kv_cleanup(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::CleanupRequest, sink: ::grpcio::UnarySink); - fn kv_batch_get(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::BatchGetRequest, sink: ::grpcio::UnarySink); - fn kv_batch_rollback(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::BatchRollbackRequest, sink: ::grpcio::UnarySink); - fn kv_scan_lock(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::ScanLockRequest, sink: ::grpcio::UnarySink); - fn kv_resolve_lock(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::ResolveLockRequest, sink: ::grpcio::UnarySink); - fn kv_gc(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::GCRequest, sink: ::grpcio::UnarySink); - fn kv_delete_range(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::DeleteRangeRequest, sink: ::grpcio::UnarySink); - fn raw_get(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::RawGetRequest, sink: ::grpcio::UnarySink); - fn raw_put(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::RawPutRequest, sink: ::grpcio::UnarySink); - fn raw_delete(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::RawDeleteRequest, sink: ::grpcio::UnarySink); - fn raw_scan(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::RawScanRequest, sink: ::grpcio::UnarySink); - fn coprocessor(&self, ctx: ::grpcio::RpcContext, req: super::coprocessor::Request, sink: ::grpcio::UnarySink); - fn raft(&self, ctx: ::grpcio::RpcContext, stream: ::grpcio::RequestStream, sink: ::grpcio::ClientStreamingSink); - fn snapshot(&self, ctx: ::grpcio::RpcContext, stream: ::grpcio::RequestStream, sink: ::grpcio::ClientStreamingSink); - fn mvcc_get_by_key(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::MvccGetByKeyRequest, sink: ::grpcio::UnarySink); - fn mvcc_get_by_start_ts(&self, ctx: ::grpcio::RpcContext, req: super::kvrpcpb::MvccGetByStartTsRequest, sink: ::grpcio::UnarySink); -} - -pub fn create_tikv(s: S) -> ::grpcio::Service { - let mut builder = ::grpcio::ServiceBuilder::new(); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_TIKV_KV_GET, move |ctx, req, resp| { - instance.kv_get(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_TIKV_KV_SCAN, move |ctx, req, resp| { - instance.kv_scan(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_TIKV_KV_PREWRITE, move |ctx, req, resp| { - instance.kv_prewrite(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_TIKV_KV_COMMIT, move |ctx, req, resp| { - instance.kv_commit(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_TIKV_KV_IMPORT, move |ctx, req, resp| { - instance.kv_import(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_TIKV_KV_CLEANUP, move |ctx, req, resp| { - instance.kv_cleanup(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_TIKV_KV_BATCH_GET, move |ctx, req, resp| { - instance.kv_batch_get(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_TIKV_KV_BATCH_ROLLBACK, move |ctx, req, resp| { - instance.kv_batch_rollback(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_TIKV_KV_SCAN_LOCK, move |ctx, req, resp| { - instance.kv_scan_lock(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_TIKV_KV_RESOLVE_LOCK, move |ctx, req, resp| { - instance.kv_resolve_lock(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_TIKV_KV_GC, move |ctx, req, resp| { - instance.kv_gc(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_TIKV_KV_DELETE_RANGE, move |ctx, req, resp| { - instance.kv_delete_range(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_TIKV_RAW_GET, move |ctx, req, resp| { - instance.raw_get(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_TIKV_RAW_PUT, move |ctx, req, resp| { - instance.raw_put(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_TIKV_RAW_DELETE, move |ctx, req, resp| { - instance.raw_delete(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_TIKV_RAW_SCAN, move |ctx, req, resp| { - instance.raw_scan(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_TIKV_COPROCESSOR, move |ctx, req, resp| { - instance.coprocessor(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_client_streaming_handler(&METHOD_TIKV_RAFT, move |ctx, req, resp| { - instance.raft(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_client_streaming_handler(&METHOD_TIKV_SNAPSHOT, move |ctx, req, resp| { - instance.snapshot(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_TIKV_MVCC_GET_BY_KEY, move |ctx, req, resp| { - instance.mvcc_get_by_key(ctx, req, resp) - }); - let instance = s.clone(); - builder = builder.add_unary_handler(&METHOD_TIKV_MVCC_GET_BY_START_TS, move |ctx, req, resp| { - instance.mvcc_get_by_start_ts(ctx, req, resp) - }); - builder.build() -} diff --git a/_vendor/src/github.com/pingcap/kvproto/src/util.rs b/_vendor/src/github.com/pingcap/kvproto/src/util.rs deleted file mode 100644 index b00f57e594c..00000000000 --- a/_vendor/src/github.com/pingcap/kvproto/src/util.rs +++ /dev/null @@ -1,20 +0,0 @@ -use eraftpb; -use pdpb; - -impl From for eraftpb::ConfChangeType { - fn from(ct: pdpb::ConfChangeType) -> Self { - match ct { - pdpb::ConfChangeType::AddNode => eraftpb::ConfChangeType::AddNode, - pdpb::ConfChangeType::RemoveNode => eraftpb::ConfChangeType::RemoveNode, - } - } -} - -impl From for pdpb::ConfChangeType { - fn from(ct: eraftpb::ConfChangeType) -> Self { - match ct { - eraftpb::ConfChangeType::AddNode => pdpb::ConfChangeType::AddNode, - eraftpb::ConfChangeType::RemoveNode => pdpb::ConfChangeType::RemoveNode, - } - } -} From 0b037668c54e2149cc8b653038fc585b31113ac2 Mon Sep 17 00:00:00 2001 From: UncP Date: Thu, 17 Aug 2017 18:15:39 +0800 Subject: [PATCH 03/13] balance based on read flow Signed-off-by: UncP --- server/balancer.go | 375 ++++++++++++++++++++++++++++++++++++++++ server/balancer_test.go | 80 +++++++++ server/cache.go | 85 +++++++++ server/grpc_service.go | 1 + server/region.go | 2 + 5 files changed, 543 insertions(+) diff --git a/server/balancer.go b/server/balancer.go index 0bbcb7435d0..f7cdfe10c55 100644 --- a/server/balancer.go +++ b/server/balancer.go @@ -791,3 +791,378 @@ func (h *balanceHotRegionScheduler) GetStatus() *StoreHotRegionInfos { AsLeader: asLeader, } } + +// ReadRegionStat records each read hot region's statistics +type ReadRegionStat struct { + RegionID uint64 `json:"region_id"` + ReadBytes uint64 `json:"read_bytes"` + // HotDegree records the hot region update times + HotDegree int `json:"hot_degree"` + // LastUpdateTime used to calculate average read + LastUpdateTime time.Time `json:"last_update_time"` + StoreID uint64 `json:"-"` + // antiCount used to eliminate some noise when remove region in cache + antiCount int + // version used to check the region split times + version uint64 +} + +// ReadRegionsStat is a list of a group read region state type +type ReadRegionsStat []ReadRegionStat + +func (m ReadRegionsStat) Len() int { return len(m) } +func (m ReadRegionsStat) Swap(i, j int) { m[i], m[j] = m[j], m[i] } +func (m ReadRegionsStat) Less(i, j int) bool { return m[i].ReadBytes < m[j].ReadBytes } + +// HotReadRegionsStat records all hot read regions statistics +type HotReadRegionsStat struct { + ReadBytes uint64 `json:"total_read_bytes"` + RegionsCount int `json:"regions_count"` + ReadRegionsStat ReadRegionsStat `json:"statistics"` +} + +type balanceHotReadRegionScheduler struct { + sync.RWMutex + opt *scheduleOption + limit uint64 + + // store id -> hot read regions statistics as the role of replica + statisticsAsPeer map[uint64]*HotReadRegionsStat + // store id -> hot read regions statistics as the role of leader + statisticsAsLeader map[uint64]*HotReadRegionsStat + r *rand.Rand +} + +func newBalanceHotReadRegionScheduler(opt *scheduleOption) *balanceHotReadRegionScheduler { + return &balanceHotReadRegionScheduler{ + opt: opt, + limit: 1, + statisticsAsPeer: make(map[uint64]*HotReadRegionsStat), + statisticsAsLeader: make(map[uint64]*HotReadRegionsStat), + r: rand.New(rand.NewSource(time.Now().UnixNano())), + } +} + +func (h *balanceHotReadRegionScheduler) GetName() string { + return "balance-hot-read-region-scheduler" +} + +func (h *balanceHotReadRegionScheduler) GetResourceKind() ResourceKind { + return PriorityKind +} + +func (h *balanceHotReadRegionScheduler) GetResourceLimit() uint64 { + return h.limit +} + +func (h *balanceHotReadRegionScheduler) Prepare(cluster *clusterInfo) error { return nil } + +func (h *balanceHotReadRegionScheduler) Cleanup(cluster *clusterInfo) {} + +func (h *balanceHotReadRegionScheduler) Schedule(cluster *clusterInfo) Operator { + schedulerCounter.WithLabelValues(h.GetName(), "schedule").Inc() + h.calcScore(cluster) + + // balance by peer + srcRegion, srcPeer, destPeer := h.balanceByPeer(cluster) + if srcRegion != nil { + schedulerCounter.WithLabelValues(h.GetName(), "move_peer").Inc() + return newTransferPeer(srcRegion, PriorityKind, srcPeer, destPeer) + } + + // balance by leader + srcRegion, newLeader := h.balanceByLeader(cluster) + if srcRegion != nil { + schedulerCounter.WithLabelValues(h.GetName(), "move_leader").Inc() + return newPriorityTransferLeader(srcRegion, newLeader) + } + + schedulerCounter.WithLabelValues(h.GetName(), "skip").Inc() + return nil +} + +func (h *balanceHotReadRegionScheduler) calcScore(cluster *clusterInfo) { + h.Lock() + defer h.Unlock() + + h.statisticsAsPeer = make(map[uint64]*HotReadRegionsStat) + h.statisticsAsLeader = make(map[uint64]*HotReadRegionsStat) + items := cluster.readStatistics.elems() + for _, item := range items { + r, ok := item.value.(*ReadRegionStat) + if !ok { + continue + } + if r.HotDegree < hotRegionLowThreshold { + continue + } + + regionInfo := cluster.getRegion(r.RegionID) + leaderStoreID := regionInfo.Leader.GetStoreId() + storeIDs := regionInfo.GetStoreIds() + for storeID := range storeIDs { + peerStat, ok := h.statisticsAsPeer[storeID] + if !ok { + peerStat = &HotReadRegionsStat{ + ReadRegionsStat: make(ReadRegionsStat, 0, storeHotRegionsDefaultLen), + } + h.statisticsAsPeer[storeID] = peerStat + } + leaderStat, ok := h.statisticsAsLeader[storeID] + if !ok { + leaderStat = &HotReadRegionsStat{ + ReadRegionsStat: make(ReadRegionsStat, 0, storeHotRegionsDefaultLen), + } + h.statisticsAsLeader[storeID] = leaderStat + } + + stat := ReadRegionStat{ + RegionID: r.RegionID, + ReadBytes: r.ReadBytes, + HotDegree: r.HotDegree, + LastUpdateTime: r.LastUpdateTime, + StoreID: storeID, + antiCount: r.antiCount, + version: r.version, + } + peerStat.ReadBytes += r.ReadBytes + peerStat.RegionsCount++ + peerStat.ReadRegionsStat = append(peerStat.ReadRegionsStat, stat) + + if storeID == leaderStoreID { + leaderStat.ReadBytes += r.ReadBytes + leaderStat.RegionsCount++ + leaderStat.ReadRegionsStat = append(leaderStat.ReadRegionsStat, stat) + } + } + } +} + +func (h *balanceHotReadRegionScheduler) balanceByPeer(cluster *clusterInfo) (*RegionInfo, *metapb.Peer, *metapb.Peer) { + var ( + maxReadBytes uint64 + srcStoreID uint64 + maxHotStoreRegionCount int + ) + + // get the srcStoreId + for storeID, statistics := range h.statisticsAsPeer { + count, readBytes := statistics.ReadRegionsStat.Len(), statistics.ReadBytes + if count >= 2 && (count > maxHotStoreRegionCount || (count == maxHotStoreRegionCount && readBytes > maxReadBytes)) { + maxHotStoreRegionCount = count + maxReadBytes = readBytes + srcStoreID = storeID + } + } + if srcStoreID == 0 { + return nil, nil, nil + } + + stores := cluster.getStores() + var destStoreID uint64 + for _, i := range h.r.Perm(h.statisticsAsPeer[srcStoreID].ReadRegionsStat.Len()) { + rs := h.statisticsAsPeer[srcStoreID].ReadRegionsStat[i] + srcRegion := cluster.getRegion(rs.RegionID) + if len(srcRegion.DownPeers) != 0 || len(srcRegion.PendingPeers) != 0 { + continue + } + + filters := []Filter{ + newExcludedFilter(srcRegion.GetStoreIds(), srcRegion.GetStoreIds()), + newDistinctScoreFilter(h.opt.GetReplication(), stores, cluster.getLeaderStore(srcRegion)), + newStateFilter(h.opt), + newStorageThresholdFilter(h.opt), + } + destStoreIDs := make([]uint64, 0, len(stores)) + for _, store := range stores { + if filterTarget(store, filters) { + continue + } + destStoreIDs = append(destStoreIDs, store.GetId()) + } + + destStoreID = h.selectDestStoreByPeer(destStoreIDs, srcRegion, srcStoreID) + if destStoreID != 0 { + srcRegion.ReadBytes = rs.ReadBytes + h.adjustBalanceLimit(srcStoreID, byPeer) + + var srcPeer *metapb.Peer + for _, peer := range srcRegion.GetPeers() { + if peer.GetStoreId() == srcStoreID { + srcPeer = peer + break + } + } + + if srcPeer == nil { + return nil, nil, nil + } + + destPeer, err := cluster.allocPeer(destStoreID) + if err != nil { + log.Errorf("failed to allocate peer: %v", err) + return nil, nil, nil + } + + return srcRegion, srcPeer, destPeer + } + } + + return nil, nil, nil +} + +func (h *balanceHotReadRegionScheduler) selectDestStoreByPeer(candidateStoreIDs []uint64, srcRegion *RegionInfo, srcStoreID uint64) uint64 { + sr := h.statisticsAsPeer[srcStoreID] + srcReadBytes := sr.ReadBytes + srcHotRegionsCount := sr.ReadRegionsStat.Len() + + var ( + destStoreID uint64 + minReadBytes uint64 = math.MaxUint64 + ) + minRegionsCount := int(math.MaxInt32) + for _, storeID := range candidateStoreIDs { + if s, ok := h.statisticsAsPeer[storeID]; ok { + if srcHotRegionsCount-s.ReadRegionsStat.Len() > 1 && minRegionsCount > s.ReadRegionsStat.Len() { + destStoreID = storeID + minReadBytes = s.ReadBytes + minRegionsCount = s.ReadRegionsStat.Len() + continue + } + if minRegionsCount == s.ReadRegionsStat.Len() && minReadBytes > s.ReadBytes && + uint64(float64(srcReadBytes)*hotRegionScheduleFactor) > s.ReadBytes+2*srcRegion.ReadBytes { + minReadBytes = s.ReadBytes + destStoreID = storeID + } + } else { + destStoreID = storeID + break + } + } + return destStoreID +} + +func (h *balanceHotReadRegionScheduler) adjustBalanceLimit(storeID uint64, t BalanceType) { + var srcStatistics *HotReadRegionsStat + var allStatistics map[uint64]*HotReadRegionsStat + switch t { + case byPeer: + srcStatistics = h.statisticsAsPeer[storeID] + allStatistics = h.statisticsAsPeer + case byLeader: + srcStatistics = h.statisticsAsLeader[storeID] + allStatistics = h.statisticsAsLeader + } + + var hotRegionTotalCount float64 + for _, m := range allStatistics { + hotRegionTotalCount += float64(m.ReadRegionsStat.Len()) + } + + avgRegionCount := hotRegionTotalCount / float64(len(allStatistics)) + // Multiplied by hotRegionLimitFactor to avoid transfer back and forth + limit := uint64((float64(srcStatistics.ReadRegionsStat.Len()) - avgRegionCount) * hotRegionLimitFactor) + h.limit = maxUint64(1, limit) +} + +func (h *balanceHotReadRegionScheduler) balanceByLeader(cluster *clusterInfo) (*RegionInfo, *metapb.Peer) { + var ( + maxReadBytes uint64 + srcStoreID uint64 + maxHotStoreRegionCount int + ) + + // select srcStoreId by leader + for storeID, statistics := range h.statisticsAsLeader { + if statistics.ReadRegionsStat.Len() < 2 { + continue + } + + if maxHotStoreRegionCount < statistics.ReadRegionsStat.Len() { + maxHotStoreRegionCount = statistics.ReadRegionsStat.Len() + maxReadBytes = statistics.ReadBytes + srcStoreID = storeID + continue + } + + if maxHotStoreRegionCount == statistics.ReadRegionsStat.Len() && maxReadBytes < statistics.ReadBytes { + maxReadBytes = statistics.ReadBytes + srcStoreID = storeID + } + } + if srcStoreID == 0 { + return nil, nil + } + + // select destPeer + for _, i := range h.r.Perm(h.statisticsAsLeader[srcStoreID].ReadRegionsStat.Len()) { + rs := h.statisticsAsLeader[srcStoreID].ReadRegionsStat[i] + srcRegion := cluster.getRegion(rs.RegionID) + if len(srcRegion.DownPeers) != 0 || len(srcRegion.PendingPeers) != 0 { + continue + } + + destPeer := h.selectDestStoreByLeader(srcRegion) + if destPeer != nil { + h.adjustBalanceLimit(srcStoreID, byLeader) + return srcRegion, destPeer + } + } + return nil, nil +} + +func (h *balanceHotReadRegionScheduler) selectDestStoreByLeader(srcRegion *RegionInfo) *metapb.Peer { + sr := h.statisticsAsLeader[srcRegion.Leader.GetStoreId()] + srcReadBytes := sr.ReadBytes + srcHotRegionsCount := sr.ReadRegionsStat.Len() + + var ( + destPeer *metapb.Peer + minReadBytes uint64 = math.MaxUint64 + ) + minRegionsCount := int(math.MaxInt32) + for storeID, peer := range srcRegion.GetFollowers() { + if s, ok := h.statisticsAsLeader[storeID]; ok { + if srcHotRegionsCount-s.ReadRegionsStat.Len() > 1 && minRegionsCount > s.ReadRegionsStat.Len() { + destPeer = peer + minReadBytes = s.ReadBytes + minRegionsCount = s.ReadRegionsStat.Len() + continue + } + if minRegionsCount == s.ReadRegionsStat.Len() && minReadBytes > s.ReadBytes && + uint64(float64(srcReadBytes)*hotRegionScheduleFactor) > s.ReadBytes+2*srcRegion.ReadBytes { + minReadBytes = s.ReadBytes + destPeer = peer + } + } else { + destPeer = peer + break + } + } + return destPeer +} + +// StoreHotReadRegionInfos : used to get human readable description for hot read regions. +type StoreHotReadRegionInfos struct { + AsPeer map[uint64]*HotReadRegionsStat `json:"as_peer"` + AsLeader map[uint64]*HotReadRegionsStat `json:"as_leader"` +} + +func (h *balanceHotReadRegionScheduler) GetStatus() *StoreHotReadRegionInfos { + h.RLock() + defer h.RUnlock() + asPeer := make(map[uint64]*HotReadRegionsStat, len(h.statisticsAsPeer)) + for id, stat := range h.statisticsAsPeer { + clone := *stat + asPeer[id] = &clone + } + asLeader := make(map[uint64]*HotReadRegionsStat, len(h.statisticsAsLeader)) + for id, stat := range h.statisticsAsLeader { + clone := *stat + asLeader[id] = &clone + } + return &StoreHotReadRegionInfos{ + AsPeer: asPeer, + AsLeader: asLeader, + } +} diff --git a/server/balancer_test.go b/server/balancer_test.go index 26259f6e49f..dcf7b04abb9 100644 --- a/server/balancer_test.go +++ b/server/balancer_test.go @@ -876,3 +876,83 @@ func (s *testBalanceHotRegionSchedulerSuite) TestBalance(c *C) { // so one of the leader will transfer to another store. checkTransferLeaderFrom(c, hb.Schedule(cluster), 1) } + +func (c *testClusterInfo) updateStorageReadBytes(storeID uint64, BytesRead uint64) { + store := c.getStore(storeID) + store.status.BytesRead = BytesRead + c.putStore(store) +} + +func (c *testClusterInfo) addLeaderRegionWithReadInfo(regionID uint64, leaderID uint64, readBytes uint64, followerIds ...uint64) { + region := &metapb.Region{Id: regionID} + leader, _ := c.allocPeer(leaderID) + region.Peers = []*metapb.Peer{leader} + for _, id := range followerIds { + peer, _ := c.allocPeer(id) + region.Peers = append(region.Peers, peer) + } + r := newRegionInfo(region, leader) + r.ReadBytes = readBytes + c.updateReadStatus(r) + c.putRegion(r) +} + +var _ = Suite(&testBalanceHotReadRegionSchedulerSuite{}) + +type testBalanceHotReadRegionSchedulerSuite struct{} + +func (s *testBalanceHotReadRegionSchedulerSuite) TestBalance(c *C) { + cluster := newClusterInfo(newMockIDAllocator()) + tc := newTestClusterInfo(cluster) + + _, opt := newTestScheduleConfig() + hb := newBalanceHotReadRegionScheduler(opt) + + // Add stores 1, 2, 3, 4, 5 with region counts 3, 2, 2, 2, 0. + tc.addRegionStore(1, 3) + tc.addRegionStore(2, 2) + tc.addRegionStore(3, 2) + tc.addRegionStore(4, 2) + tc.addRegionStore(5, 0) + + // Report store read bytes. + tc.updateStorageReadBytes(1, 75*1024*1024) + tc.updateStorageReadBytes(2, 45*1024*1024) + tc.updateStorageReadBytes(3, 45*1024*1024) + tc.updateStorageReadBytes(4, 60*1024*1024) + tc.updateStorageReadBytes(5, 0) + + // Region 1, 2 and 3 are hot regions. + //| region_id | leader_sotre | follower_store | follower_store | read_bytes | + //|-----------|--------------|----------------|----------------|---------------| + //| 1 | 1 | 2 | 3 | 512KB | + //| 2 | 1 | 3 | 4 | 512KB | + //| 3 | 1 | 2 | 4 | 512KB | + tc.addLeaderRegionWithReadInfo(1, 1, 512*1024*regionHeartBeatReportInterval, 2, 3) + tc.addLeaderRegionWithReadInfo(2, 1, 512*1024*regionHeartBeatReportInterval, 3, 4) + tc.addLeaderRegionWithReadInfo(3, 1, 512*1024*regionHeartBeatReportInterval, 2, 4) + hotRegionLowThreshold = 0 + + // Will transfer a hot region from store 1 to store 5, because the total count of peers + // which is hot for store 1 is more larger than other stores. + checkTransferPeerWithLeaderTransfer(c, hb.Schedule(cluster), 1, 5) + + // After transfer a hot region from store 1 to store 5 + //| region_id | leader_sotre | follower_store | follower_store | read_bytes | + //|-----------|--------------|----------------|----------------|---------------| + //| 1 | 1 | 2 | 3 | 512KB | + //| 2 | 1 | 3 | 4 | 512KB | + //| 3 | 5 | 2 | 4 | 512KB | + tc.updateStorageReadBytes(1, 60*1024*1024) + tc.updateStorageReadBytes(2, 30*1024*1024) + tc.updateStorageReadBytes(3, 60*1024*1024) + tc.updateStorageReadBytes(4, 30*1024*1024) + tc.updateStorageReadBytes(5, 30*1024*1024) + tc.addLeaderRegionWithReadInfo(1, 1, 512*1024*regionHeartBeatReportInterval, 2, 3) + tc.addLeaderRegionWithReadInfo(2, 1, 512*1024*regionHeartBeatReportInterval, 3, 4) + tc.addLeaderRegionWithReadInfo(3, 5, 512*1024*regionHeartBeatReportInterval, 2, 4) + + // We can find that the leader of all hot regions are on store 1, + // so one of the leader will transfer to another store. + checkTransferLeaderFrom(c, hb.Schedule(cluster), 1) +} diff --git a/server/cache.go b/server/cache.go index 56e130400fb..67d4b7ee1bb 100644 --- a/server/cache.go +++ b/server/cache.go @@ -124,6 +124,16 @@ func (s *storesInfo) totalWrittenBytes() uint64 { return totalWrittenBytes } +func (s *storesInfo) totalReadBytes() uint64 { + var totalReadBytes uint64 + for _, s := range s.stores { + if s.isUp() { + totalReadBytes += s.status.GetBytesRead() + } + } + return totalReadBytes +} + // regionMap wraps a map[uint64]*RegionInfo and supports randomly pick a region. type regionMap struct { m map[uint64]*regionEntry @@ -345,6 +355,7 @@ type clusterInfo struct { activeRegions int writeStatistics *lruCache + readStatistics *lruCache } func newClusterInfo(id IDAllocator) *clusterInfo { @@ -353,6 +364,7 @@ func newClusterInfo(id IDAllocator) *clusterInfo { stores: newStoresInfo(), regions: newRegionsInfo(), writeStatistics: newLRUCache(writeStatLRUMaxLen), + readStatistics: newLRUCache(writeStatLRUMaxLen), // ? } } @@ -492,6 +504,16 @@ func (c *clusterInfo) getStoresWriteStat() map[uint64]uint64 { return res } +func (c *clusterInfo) getStoresReadStat() map[uint64]uint64 { + c.RLock() + defer c.RUnlock() + res := make(map[uint64]uint64) + for _, s := range c.stores.stores { + res[s.GetId()] = s.status.GetBytesRead() + } + return res +} + func (c *clusterInfo) getRegion(regionID uint64) *RegionInfo { c.RLock() defer c.RUnlock() @@ -533,6 +555,41 @@ func (c *clusterInfo) updateWriteStatCache(region *RegionInfo, hotRegionThreshol c.writeStatistics.add(key, newItem) } +// updateReadStatCache updates statistic for a region if it's hot, or remove it from statistics if it cools down +func (c *clusterInfo) updateReadStatCache(region *RegionInfo, hotRegionThreshold uint64) { + var v *ReadRegionStat + key := region.GetId() + value, isExist := c.readStatistics.peek(key) + newItem := &ReadRegionStat{ + RegionID: region.GetId(), + ReadBytes: region.ReadBytes, + LastUpdateTime: time.Now(), + StoreID: region.Leader.GetStoreId(), + version: region.GetRegionEpoch().GetVersion(), + antiCount: hotRegionAntiCount, + } + + if isExist { + v = value.(*ReadRegionStat) + newItem.HotDegree = v.HotDegree + 1 + } + + if region.ReadBytes < hotRegionThreshold { + if !isExist { + return + } + if v.antiCount <= 0 { + c.readStatistics.remove(key) + return + } + // eliminate some noise + newItem.HotDegree = v.HotDegree - 1 + newItem.antiCount = v.antiCount - 1 + newItem.ReadBytes = v.ReadBytes + } + c.readStatistics.add(key, newItem) +} + func (c *clusterInfo) searchRegion(regionKey []byte) *RegionInfo { c.RLock() defer c.RUnlock() @@ -734,6 +791,7 @@ func (c *clusterInfo) handleRegionHeartbeat(region *RegionInfo) error { } c.updateWriteStatus(region) + c.updateReadStatus(region) return nil } @@ -764,3 +822,30 @@ func (c *clusterInfo) updateWriteStatus(region *RegionInfo) { } c.updateWriteStatCache(region, hotRegionThreshold) } + +func (c *clusterInfo) updateReadStatus(region *RegionInfo) { + var ReadBytesPerSec uint64 + v, isExist := c.readStatistics.peek(region.GetId()) + if isExist { + interval := time.Now().Sub(v.(*ReadRegionStat).LastUpdateTime).Seconds() + if interval < minHotRegionReportInterval { + return + } + ReadBytesPerSec = uint64(float64(region.ReadBytes) / interval) + } else { + ReadBytesPerSec = uint64(float64(region.ReadBytes) / float64(regionHeartBeatReportInterval)) + } + region.ReadBytes = ReadBytesPerSec + + // hotRegionThreshold is use to pick hot region + // suppose the number of the hot regions is writeStatLRUMaxLen + // and we use total written Bytes past storeHeartBeatReportInterval seconds to divide the number of hot regions + // divide 2 because the store reports data about two times than the region record write to rocksdb + divisor := float64(writeStatLRUMaxLen) * 2 * storeHeartBeatReportInterval // ? + hotRegionThreshold := uint64(float64(c.stores.totalReadBytes()) / divisor) + + if hotRegionThreshold < hotRegionMinWriteRate { // ? + hotRegionThreshold = hotRegionMinWriteRate + } + c.updateReadStatCache(region, hotRegionThreshold) +} diff --git a/server/grpc_service.go b/server/grpc_service.go index beaf6319694..472256bf14d 100644 --- a/server/grpc_service.go +++ b/server/grpc_service.go @@ -270,6 +270,7 @@ func (s *Server) RegionHeartbeat(server pdpb.PD_RegionHeartbeatServer) error { region.DownPeers = request.GetDownPeers() region.PendingPeers = request.GetPendingPeers() region.WrittenBytes = request.GetBytesWritten() + region.ReadBytes = request.GetBytesRead() if region.GetId() == 0 { msg := fmt.Sprintf("invalid request region, %v", request) hbStreams.sendErr(region, pdpb.ErrorType_UNKNOWN, msg) diff --git a/server/region.go b/server/region.go index 36ad6485d77..b73e94192bc 100644 --- a/server/region.go +++ b/server/region.go @@ -28,6 +28,7 @@ type RegionInfo struct { DownPeers []*pdpb.PeerStats PendingPeers []*metapb.Peer WrittenBytes uint64 + ReadBytes uint64 } func newRegionInfo(region *metapb.Region, leader *metapb.Peer) *RegionInfo { @@ -52,6 +53,7 @@ func (r *RegionInfo) clone() *RegionInfo { DownPeers: downPeers, PendingPeers: pendingPeers, WrittenBytes: r.WrittenBytes, + ReadBytes: r.ReadBytes, } } From 9aa27dc79048f79063025d7616d4ab934a9422b0 Mon Sep 17 00:00:00 2001 From: UncP Date: Wed, 30 Aug 2017 15:38:29 +0800 Subject: [PATCH 04/13] add hot read region command Signed-off-by: UncP --- pdctl/command/hot_command.go | 25 +++++++++++++++++++++++-- server/api/hot_status.go | 4 ++++ server/api/router.go | 1 + server/coordinator.go | 12 ++++++++++++ server/coordinator_test.go | 1 + server/handler.go | 9 +++++++++ 6 files changed, 50 insertions(+), 2 deletions(-) diff --git a/pdctl/command/hot_command.go b/pdctl/command/hot_command.go index fc5629178a0..45f8df50852 100644 --- a/pdctl/command/hot_command.go +++ b/pdctl/command/hot_command.go @@ -21,8 +21,9 @@ import ( ) const ( - hotRegionsPrefix = "pd/api/v1/hotspot/regions" - hotStoresPrefix = "pd/api/v1/hotspot/stores" + hotRegionsPrefix = "pd/api/v1/hotspot/regions" + hotReadRegionsPrefix = "pd/api/v1/hotspot/readregions" + hotStoresPrefix = "pd/api/v1/hotspot/stores" ) // NewHotSpotCommand return a hot subcommand of rootCmd @@ -32,6 +33,7 @@ func NewHotSpotCommand() *cobra.Command { Short: "show the hotspot status of the cluster", } cmd.AddCommand(NewHotRegionCommand()) + cmd.AddCommand(NewHotReadRegionCommand()) cmd.AddCommand(NewHotStoreCommand()) return cmd } @@ -55,6 +57,25 @@ func showHotRegionsCommandFunc(cmd *cobra.Command, args []string) { fmt.Println(r) } +// NewHotReadRegionCommand return a hot read regions subcommand of hotSpotCmd +func NewHotReadRegionCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "read region", + Short: "show the hot read regions", + Run: showHotReadRegionsCommandFunc, + } + return cmd +} + +func showHotRegionsCommandFunc(cmd *cobra.Command, args []string) { + r, err := doRequest(cmd, hotReadRegionsPrefix, http.MethodGet) + if err != nil { + fmt.Printf("Failed to get hotspot: %s\n", err) + return + } + fmt.Println(r) +} + // NewHotStoreCommand return a hot stores subcommand of hotSpotCmd func NewHotStoreCommand() *cobra.Command { cmd := &cobra.Command{ diff --git a/server/api/hot_status.go b/server/api/hot_status.go index 0266835bd66..a220dc0f43c 100644 --- a/server/api/hot_status.go +++ b/server/api/hot_status.go @@ -36,6 +36,10 @@ func (h *hotStatusHandler) GetHotRegions(w http.ResponseWriter, r *http.Request) h.rd.JSON(w, http.StatusOK, h.GetHotWriteRegions()) } +func (h *hotStatusHandler) GetHotReadRegions(w http.ResponseWriter, r *http.Request) { + h.rd.JSON(w, http.StatusOK, h.GetHotReadRegions()) +} + func (h *hotStatusHandler) GetHotStores(w http.ResponseWriter, r *http.Request) { h.rd.JSON(w, http.StatusOK, h.GetHotWriteStores()) } diff --git a/server/api/router.go b/server/api/router.go index 32650bcbb42..e7a70aecfc2 100644 --- a/server/api/router.go +++ b/server/api/router.go @@ -67,6 +67,7 @@ func createRouter(prefix string, svr *server.Server) *mux.Router { hotStatusHandler := newHotStatusHandler(handler, rd) router.HandleFunc("/api/v1/hotspot/regions", hotStatusHandler.GetHotRegions).Methods("GET") + router.HandleFunc("/api/v1/hotspot/readregions", hotStatusHandler.GetHotReadRegions).Methods("GET") router.HandleFunc("/api/v1/hotspot/stores", hotStatusHandler.GetHotStores).Methods("GET") router.Handle("/api/v1/events", newEventsHandler(svr, rd)).Methods("GET") router.Handle("/api/v1/feed", newFeedHandler(svr, rd)).Methods("GET") diff --git a/server/coordinator.go b/server/coordinator.go index 23dd02ce364..d461937e498 100644 --- a/server/coordinator.go +++ b/server/coordinator.go @@ -46,6 +46,7 @@ const ( minHotRegionReportInterval = 3 hotRegionAntiCount = 1 hotRegionScheduleName = "balance-hot-region-scheduler" + hotReadRegionScheduleName = "balance-hot-read-region-scheduler" ) var ( @@ -134,6 +135,7 @@ func (c *coordinator) run() { c.addScheduler(newBalanceLeaderScheduler(c.opt), minScheduleInterval) c.addScheduler(newBalanceRegionScheduler(c.opt), minScheduleInterval) c.addScheduler(newBalanceHotRegionScheduler(c.opt), minSlowScheduleInterval) + c.addScheduler(newBalanceHotReadRegionScheduler(c.opt), minSlowScheduleInterval) } func (c *coordinator) stop() { @@ -151,6 +153,16 @@ func (c *coordinator) getHotWriteRegions() *StoreHotRegionInfos { return s.Scheduler.(*balanceHotRegionScheduler).GetStatus() } +func (c *coordinator) getHotReadRegions() *StoreHotReadRegionInfos { + c.RLock() + defer c.RUnlock() + s, ok := c.schedulers[hotReadRegionScheduleName] + if !ok { + return nil + } + return s.Scheduler.(*balanceHotReadRegionScheduler).GetStatus() +} + func (c *coordinator) getSchedulers() []string { c.RLock() defer c.RUnlock() diff --git a/server/coordinator_test.go b/server/coordinator_test.go index 62c8a1563ff..87389f298cd 100644 --- a/server/coordinator_test.go +++ b/server/coordinator_test.go @@ -306,6 +306,7 @@ func (s *testCoordinatorSuite) TestAddScheduler(c *C) { c.Assert(co.removeScheduler("balance-leader-scheduler"), IsNil) c.Assert(co.removeScheduler("balance-region-scheduler"), IsNil) c.Assert(co.removeScheduler("balance-hot-region-scheduler"), IsNil) + c.Assert(co.removeScheduler("balance-hot-read-region-scheduler"), IsNil) c.Assert(co.schedulers, HasLen, 0) stream := newMockHeartbeatStream() diff --git a/server/handler.go b/server/handler.go index 868a448f282..bb1ef8d3995 100644 --- a/server/handler.go +++ b/server/handler.go @@ -56,6 +56,15 @@ func (h *Handler) GetHotWriteRegions() *StoreHotRegionInfos { return c.getHotWriteRegions() } +// GetHotReadRegions gets all hot read regions status +func (h *Handler) GetHotReadRegions() *StoreHotReadRegionInfos { + c, err := h.getCoordinator() + if err != nil { + return nil + } + return c.getHotReadRegions() +} + // GetHotWriteStores gets all hot write stores status func (h *Handler) GetHotWriteStores() map[uint64]uint64 { return h.s.cluster.cachedCluster.getStoresWriteStat() From e481c6c9432421854e8cf6488d193b419a4570c0 Mon Sep 17 00:00:00 2001 From: UncP Date: Wed, 30 Aug 2017 16:12:32 +0800 Subject: [PATCH 05/13] minor fix Signed-off-by: UncP --- pdctl/command/hot_command.go | 2 +- server/api/hot_status.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pdctl/command/hot_command.go b/pdctl/command/hot_command.go index 45f8df50852..ba5a0cf027c 100644 --- a/pdctl/command/hot_command.go +++ b/pdctl/command/hot_command.go @@ -67,7 +67,7 @@ func NewHotReadRegionCommand() *cobra.Command { return cmd } -func showHotRegionsCommandFunc(cmd *cobra.Command, args []string) { +func showHotReadRegionsCommandFunc(cmd *cobra.Command, args []string) { r, err := doRequest(cmd, hotReadRegionsPrefix, http.MethodGet) if err != nil { fmt.Printf("Failed to get hotspot: %s\n", err) diff --git a/server/api/hot_status.go b/server/api/hot_status.go index a220dc0f43c..20fcf125072 100644 --- a/server/api/hot_status.go +++ b/server/api/hot_status.go @@ -37,7 +37,7 @@ func (h *hotStatusHandler) GetHotRegions(w http.ResponseWriter, r *http.Request) } func (h *hotStatusHandler) GetHotReadRegions(w http.ResponseWriter, r *http.Request) { - h.rd.JSON(w, http.StatusOK, h.GetHotReadRegions()) + h.rd.JSON(w, http.StatusOK, h.Handler.GetHotReadRegions()) } func (h *hotStatusHandler) GetHotStores(w http.ResponseWriter, r *http.Request) { From 51b8cb965db793d2818b1ed6bb89ab8d3f0f99e3 Mon Sep 17 00:00:00 2001 From: UncP Date: Thu, 31 Aug 2017 19:17:02 +0800 Subject: [PATCH 06/13] adjust policy for read flow control Signed-off-by: UncP --- server/balancer.go | 55 ++++++++++++---------------------------------- 1 file changed, 14 insertions(+), 41 deletions(-) diff --git a/server/balancer.go b/server/balancer.go index f7cdfe10c55..29157f66d5d 100644 --- a/server/balancer.go +++ b/server/balancer.go @@ -826,8 +826,6 @@ type balanceHotReadRegionScheduler struct { opt *scheduleOption limit uint64 - // store id -> hot read regions statistics as the role of replica - statisticsAsPeer map[uint64]*HotReadRegionsStat // store id -> hot read regions statistics as the role of leader statisticsAsLeader map[uint64]*HotReadRegionsStat r *rand.Rand @@ -837,7 +835,6 @@ func newBalanceHotReadRegionScheduler(opt *scheduleOption) *balanceHotReadRegion return &balanceHotReadRegionScheduler{ opt: opt, limit: 1, - statisticsAsPeer: make(map[uint64]*HotReadRegionsStat), statisticsAsLeader: make(map[uint64]*HotReadRegionsStat), r: rand.New(rand.NewSource(time.Now().UnixNano())), } @@ -863,13 +860,6 @@ func (h *balanceHotReadRegionScheduler) Schedule(cluster *clusterInfo) Operator schedulerCounter.WithLabelValues(h.GetName(), "schedule").Inc() h.calcScore(cluster) - // balance by peer - srcRegion, srcPeer, destPeer := h.balanceByPeer(cluster) - if srcRegion != nil { - schedulerCounter.WithLabelValues(h.GetName(), "move_peer").Inc() - return newTransferPeer(srcRegion, PriorityKind, srcPeer, destPeer) - } - // balance by leader srcRegion, newLeader := h.balanceByLeader(cluster) if srcRegion != nil { @@ -877,6 +867,13 @@ func (h *balanceHotReadRegionScheduler) Schedule(cluster *clusterInfo) Operator return newPriorityTransferLeader(srcRegion, newLeader) } + // balance by peer + srcRegion, srcPeer, destPeer := h.balanceByPeer(cluster) + if srcRegion != nil { + schedulerCounter.WithLabelValues(h.GetName(), "move_peer").Inc() + return newTransferPeer(srcRegion, PriorityKind, srcPeer, destPeer) + } + schedulerCounter.WithLabelValues(h.GetName(), "skip").Inc() return nil } @@ -885,7 +882,6 @@ func (h *balanceHotReadRegionScheduler) calcScore(cluster *clusterInfo) { h.Lock() defer h.Unlock() - h.statisticsAsPeer = make(map[uint64]*HotReadRegionsStat) h.statisticsAsLeader = make(map[uint64]*HotReadRegionsStat) items := cluster.readStatistics.elems() for _, item := range items { @@ -901,13 +897,6 @@ func (h *balanceHotReadRegionScheduler) calcScore(cluster *clusterInfo) { leaderStoreID := regionInfo.Leader.GetStoreId() storeIDs := regionInfo.GetStoreIds() for storeID := range storeIDs { - peerStat, ok := h.statisticsAsPeer[storeID] - if !ok { - peerStat = &HotReadRegionsStat{ - ReadRegionsStat: make(ReadRegionsStat, 0, storeHotRegionsDefaultLen), - } - h.statisticsAsPeer[storeID] = peerStat - } leaderStat, ok := h.statisticsAsLeader[storeID] if !ok { leaderStat = &HotReadRegionsStat{ @@ -925,9 +914,6 @@ func (h *balanceHotReadRegionScheduler) calcScore(cluster *clusterInfo) { antiCount: r.antiCount, version: r.version, } - peerStat.ReadBytes += r.ReadBytes - peerStat.RegionsCount++ - peerStat.ReadRegionsStat = append(peerStat.ReadRegionsStat, stat) if storeID == leaderStoreID { leaderStat.ReadBytes += r.ReadBytes @@ -946,7 +932,7 @@ func (h *balanceHotReadRegionScheduler) balanceByPeer(cluster *clusterInfo) (*Re ) // get the srcStoreId - for storeID, statistics := range h.statisticsAsPeer { + for storeID, statistics := range h.statisticsAsLeader { count, readBytes := statistics.ReadRegionsStat.Len(), statistics.ReadBytes if count >= 2 && (count > maxHotStoreRegionCount || (count == maxHotStoreRegionCount && readBytes > maxReadBytes)) { maxHotStoreRegionCount = count @@ -960,8 +946,8 @@ func (h *balanceHotReadRegionScheduler) balanceByPeer(cluster *clusterInfo) (*Re stores := cluster.getStores() var destStoreID uint64 - for _, i := range h.r.Perm(h.statisticsAsPeer[srcStoreID].ReadRegionsStat.Len()) { - rs := h.statisticsAsPeer[srcStoreID].ReadRegionsStat[i] + for _, i := range h.r.Perm(h.statisticsAsLeader[srcStoreID].ReadRegionsStat.Len()) { + rs := h.statisticsAsLeader[srcStoreID].ReadRegionsStat[i] srcRegion := cluster.getRegion(rs.RegionID) if len(srcRegion.DownPeers) != 0 || len(srcRegion.PendingPeers) != 0 { continue @@ -1012,7 +998,7 @@ func (h *balanceHotReadRegionScheduler) balanceByPeer(cluster *clusterInfo) (*Re } func (h *balanceHotReadRegionScheduler) selectDestStoreByPeer(candidateStoreIDs []uint64, srcRegion *RegionInfo, srcStoreID uint64) uint64 { - sr := h.statisticsAsPeer[srcStoreID] + sr := h.statisticsAsLeader[srcStoreID] srcReadBytes := sr.ReadBytes srcHotRegionsCount := sr.ReadRegionsStat.Len() @@ -1022,7 +1008,7 @@ func (h *balanceHotReadRegionScheduler) selectDestStoreByPeer(candidateStoreIDs ) minRegionsCount := int(math.MaxInt32) for _, storeID := range candidateStoreIDs { - if s, ok := h.statisticsAsPeer[storeID]; ok { + if s, ok := h.statisticsAsLeader[storeID]; ok { if srcHotRegionsCount-s.ReadRegionsStat.Len() > 1 && minRegionsCount > s.ReadRegionsStat.Len() { destStoreID = storeID minReadBytes = s.ReadBytes @@ -1045,14 +1031,8 @@ func (h *balanceHotReadRegionScheduler) selectDestStoreByPeer(candidateStoreIDs func (h *balanceHotReadRegionScheduler) adjustBalanceLimit(storeID uint64, t BalanceType) { var srcStatistics *HotReadRegionsStat var allStatistics map[uint64]*HotReadRegionsStat - switch t { - case byPeer: - srcStatistics = h.statisticsAsPeer[storeID] - allStatistics = h.statisticsAsPeer - case byLeader: - srcStatistics = h.statisticsAsLeader[storeID] - allStatistics = h.statisticsAsLeader - } + srcStatistics = h.statisticsAsLeader[storeID] + allStatistics = h.statisticsAsLeader var hotRegionTotalCount float64 for _, m := range allStatistics { @@ -1144,25 +1124,18 @@ func (h *balanceHotReadRegionScheduler) selectDestStoreByLeader(srcRegion *Regio // StoreHotReadRegionInfos : used to get human readable description for hot read regions. type StoreHotReadRegionInfos struct { - AsPeer map[uint64]*HotReadRegionsStat `json:"as_peer"` AsLeader map[uint64]*HotReadRegionsStat `json:"as_leader"` } func (h *balanceHotReadRegionScheduler) GetStatus() *StoreHotReadRegionInfos { h.RLock() defer h.RUnlock() - asPeer := make(map[uint64]*HotReadRegionsStat, len(h.statisticsAsPeer)) - for id, stat := range h.statisticsAsPeer { - clone := *stat - asPeer[id] = &clone - } asLeader := make(map[uint64]*HotReadRegionsStat, len(h.statisticsAsLeader)) for id, stat := range h.statisticsAsLeader { clone := *stat asLeader[id] = &clone } return &StoreHotReadRegionInfos{ - AsPeer: asPeer, AsLeader: asLeader, } } From 5c2f04329a862278fec57e4e2b6948a71c1172ed Mon Sep 17 00:00:00 2001 From: UncP Date: Wed, 6 Sep 2017 11:28:41 +0800 Subject: [PATCH 07/13] update leader status directly Signed-off-by: UncP --- pdctl/command/hot_command.go | 2 +- server/balancer.go | 41 ++++++++++++++++-------------------- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/pdctl/command/hot_command.go b/pdctl/command/hot_command.go index ba5a0cf027c..d52dec9a621 100644 --- a/pdctl/command/hot_command.go +++ b/pdctl/command/hot_command.go @@ -60,7 +60,7 @@ func showHotRegionsCommandFunc(cmd *cobra.Command, args []string) { // NewHotReadRegionCommand return a hot read regions subcommand of hotSpotCmd func NewHotReadRegionCommand() *cobra.Command { cmd := &cobra.Command{ - Use: "read region", + Use: "read", Short: "show the hot read regions", Run: showHotReadRegionsCommandFunc, } diff --git a/server/balancer.go b/server/balancer.go index 29157f66d5d..d609894ef6b 100644 --- a/server/balancer.go +++ b/server/balancer.go @@ -895,32 +895,27 @@ func (h *balanceHotReadRegionScheduler) calcScore(cluster *clusterInfo) { regionInfo := cluster.getRegion(r.RegionID) leaderStoreID := regionInfo.Leader.GetStoreId() - storeIDs := regionInfo.GetStoreIds() - for storeID := range storeIDs { - leaderStat, ok := h.statisticsAsLeader[storeID] - if !ok { - leaderStat = &HotReadRegionsStat{ - ReadRegionsStat: make(ReadRegionsStat, 0, storeHotRegionsDefaultLen), - } - h.statisticsAsLeader[storeID] = leaderStat - } - - stat := ReadRegionStat{ - RegionID: r.RegionID, - ReadBytes: r.ReadBytes, - HotDegree: r.HotDegree, - LastUpdateTime: r.LastUpdateTime, - StoreID: storeID, - antiCount: r.antiCount, - version: r.version, + leaderStat, ok := h.statisticsAsLeader[leaderStoreID] + if !ok { + leaderStat = &HotReadRegionsStat{ + ReadRegionsStat: make(ReadRegionsStat, 0, storeHotRegionsDefaultLen), } + h.statisticsAsLeader[leaderStoreID] = leaderStat + } - if storeID == leaderStoreID { - leaderStat.ReadBytes += r.ReadBytes - leaderStat.RegionsCount++ - leaderStat.ReadRegionsStat = append(leaderStat.ReadRegionsStat, stat) - } + stat := ReadRegionStat{ + RegionID: r.RegionID, + ReadBytes: r.ReadBytes, + HotDegree: r.HotDegree, + LastUpdateTime: r.LastUpdateTime, + StoreID: leaderStoreID, + antiCount: r.antiCount, + version: r.version, } + + leaderStat.ReadBytes += r.ReadBytes + leaderStat.RegionsCount++ + leaderStat.ReadRegionsStat = append(leaderStat.ReadRegionsStat, stat) } } From a4a776d272e246d698b2f574ec9cbda424f672c5 Mon Sep 17 00:00:00 2001 From: nolouch Date: Mon, 11 Sep 2017 10:27:06 +0800 Subject: [PATCH 08/13] merge master --- server/balancer_test.go | 13 +++++++------ server/schedulers/hot_read_region.go | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/server/balancer_test.go b/server/balancer_test.go index b63b50c9fce..8f07f0f6479 100644 --- a/server/balancer_test.go +++ b/server/balancer_test.go @@ -931,20 +931,20 @@ func (s *testBalanceHotRegionSchedulerSuite) TestBalance(c *C) { } func (c *testClusterInfo) updateStorageReadBytes(storeID uint64, BytesRead uint64) { - store := c.getStore(storeID) - store.status.BytesRead = BytesRead + store := c.GetStore(storeID) + store.Stats.BytesRead = BytesRead c.putStore(store) } func (c *testClusterInfo) addLeaderRegionWithReadInfo(regionID uint64, leaderID uint64, readBytes uint64, followerIds ...uint64) { region := &metapb.Region{Id: regionID} - leader, _ := c.allocPeer(leaderID) + leader, _ := c.AllocPeer(leaderID) region.Peers = []*metapb.Peer{leader} for _, id := range followerIds { - peer, _ := c.allocPeer(id) + peer, _ := c.AllocPeer(id) region.Peers = append(region.Peers, peer) } - r := newRegionInfo(region, leader) + r := core.NewRegionInfo(region, leader) r.ReadBytes = readBytes c.updateReadStatus(r) c.putRegion(r) @@ -959,7 +959,8 @@ func (s *testBalanceHotReadRegionSchedulerSuite) TestBalance(c *C) { tc := newTestClusterInfo(cluster) _, opt := newTestScheduleConfig() - hb := newBalanceHotReadRegionScheduler(opt) + hb, err := schedule.CreateScheduler("hotReadRegion", opt) + c.Assert(err, IsNil) // Add stores 1, 2, 3, 4, 5 with region counts 3, 2, 2, 2, 0. tc.addRegionStore(1, 3) diff --git a/server/schedulers/hot_read_region.go b/server/schedulers/hot_read_region.go index 037c01cd433..489a5d3c047 100644 --- a/server/schedulers/hot_read_region.go +++ b/server/schedulers/hot_read_region.go @@ -14,7 +14,7 @@ import ( func init() { schedule.RegisterScheduler("hotReadRegion", func(opt schedule.Options, args []string) (schedule.Scheduler, error) { - return newBalanceHotRegionScheduler(opt), nil + return newBalanceHotReadRegionsScheduler(opt), nil }) } From d35cb83b821fd398703279045c157c8702abb7a8 Mon Sep 17 00:00:00 2001 From: nolouch Date: Mon, 11 Sep 2017 15:07:19 +0800 Subject: [PATCH 09/13] *: fix test --- server/balancer_test.go | 35 +++++++++++++--------------- server/coordinator.go | 4 +++- server/coordinator_test.go | 4 ++-- server/schedulers/hot_read_region.go | 16 ++++++------- server/schedulers/hot_region.go | 2 +- 5 files changed, 30 insertions(+), 31 deletions(-) diff --git a/server/balancer_test.go b/server/balancer_test.go index 8f07f0f6479..41b548d74e4 100644 --- a/server/balancer_test.go +++ b/server/balancer_test.go @@ -878,7 +878,7 @@ func (s *testBalanceHotRegionSchedulerSuite) TestBalance(c *C) { tc := newTestClusterInfo(cluster) _, opt := newTestScheduleConfig() - hb, err := schedule.CreateScheduler("hotRegion", opt) + hb, err := schedule.CreateScheduler("hotWriteRegion", opt) c.Assert(err, IsNil) // Add stores 1, 2, 3, 4, 5 with region counts 3, 2, 2, 2, 0. @@ -980,33 +980,30 @@ func (s *testBalanceHotReadRegionSchedulerSuite) TestBalance(c *C) { //| region_id | leader_sotre | follower_store | follower_store | read_bytes | //|-----------|--------------|----------------|----------------|---------------| //| 1 | 1 | 2 | 3 | 512KB | - //| 2 | 1 | 3 | 4 | 512KB | - //| 3 | 1 | 2 | 4 | 512KB | + //| 2 | 2 | 1 | 3 | 512KB | + //| 3 | 1 | 2 | 3 | 512KB | tc.addLeaderRegionWithReadInfo(1, 1, 512*1024*regionHeartBeatReportInterval, 2, 3) - tc.addLeaderRegionWithReadInfo(2, 1, 512*1024*regionHeartBeatReportInterval, 3, 4) - tc.addLeaderRegionWithReadInfo(3, 1, 512*1024*regionHeartBeatReportInterval, 2, 4) + tc.addLeaderRegionWithReadInfo(2, 2, 512*1024*regionHeartBeatReportInterval, 1, 3) + tc.addLeaderRegionWithReadInfo(3, 1, 512*1024*regionHeartBeatReportInterval, 2, 3) hotRegionLowThreshold = 0 - // Will transfer a hot region from store 1 to store 5, because the total count of peers + // Will transfer a hot region leader from store 1 to store 3, because the total count of peers // which is hot for store 1 is more larger than other stores. - checkTransferPeerWithLeaderTransfer(c, hb.Schedule(cluster), 1, 5) + checkTransferLeader(c, hb.Schedule(cluster), 1, 3) + // assume handle the operator + tc.addLeaderRegionWithReadInfo(3, 3, 512*1024*regionHeartBeatReportInterval, 1, 2) - // After transfer a hot region from store 1 to store 5 - //| region_id | leader_sotre | follower_store | follower_store | read_bytes | - //|-----------|--------------|----------------|----------------|---------------| - //| 1 | 1 | 2 | 3 | 512KB | - //| 2 | 1 | 3 | 4 | 512KB | - //| 3 | 5 | 2 | 4 | 512KB | + // After transfer a hot region leader from store 1 to store 3 + // the tree region leader will be evenly distributed in three stores tc.updateStorageReadBytes(1, 60*1024*1024) tc.updateStorageReadBytes(2, 30*1024*1024) tc.updateStorageReadBytes(3, 60*1024*1024) tc.updateStorageReadBytes(4, 30*1024*1024) tc.updateStorageReadBytes(5, 30*1024*1024) - tc.addLeaderRegionWithReadInfo(1, 1, 512*1024*regionHeartBeatReportInterval, 2, 3) - tc.addLeaderRegionWithReadInfo(2, 1, 512*1024*regionHeartBeatReportInterval, 3, 4) - tc.addLeaderRegionWithReadInfo(3, 5, 512*1024*regionHeartBeatReportInterval, 2, 4) + tc.addLeaderRegionWithReadInfo(4, 1, 512*1024*regionHeartBeatReportInterval, 2, 3) + tc.addLeaderRegionWithReadInfo(5, 4, 512*1024*regionHeartBeatReportInterval, 2, 5) - // We can find that the leader of all hot regions are on store 1, - // so one of the leader will transfer to another store. - checkTransferLeaderFrom(c, hb.Schedule(cluster), 1) + // Now appear two read hot region in store 1 and 4 + // We will Transfer peer from 1 to 5 + checkTransferPeerWithLeaderTransfer(c, hb.Schedule(cluster), 1, 5) } diff --git a/server/coordinator.go b/server/coordinator.go index 1b47e86431c..1c61c2f395b 100644 --- a/server/coordinator.go +++ b/server/coordinator.go @@ -139,7 +139,9 @@ func (c *coordinator) run() { c.addScheduler(s, minScheduleInterval) s, _ = schedule.CreateScheduler("balanceRegion", c.opt) c.addScheduler(s, minScheduleInterval) - s, _ = schedule.CreateScheduler("hotRegion", c.opt) + s, _ = schedule.CreateScheduler("hotWriteRegion", c.opt) + c.addScheduler(s, minSlowScheduleInterval) + s, _ = schedule.CreateScheduler("hotReadRegion", c.opt) c.addScheduler(s, minSlowScheduleInterval) } diff --git a/server/coordinator_test.go b/server/coordinator_test.go index a4d7866453c..68c08f86847 100644 --- a/server/coordinator_test.go +++ b/server/coordinator_test.go @@ -304,10 +304,10 @@ func (s *testCoordinatorSuite) TestAddScheduler(c *C) { co.run() defer co.stop() - c.Assert(co.schedulers, HasLen, 3) + c.Assert(co.schedulers, HasLen, 4) c.Assert(co.removeScheduler("balance-leader-scheduler"), IsNil) c.Assert(co.removeScheduler("balance-region-scheduler"), IsNil) - c.Assert(co.removeScheduler("balance-hot-region-scheduler"), IsNil) + c.Assert(co.removeScheduler("balance-hot-write-region-scheduler"), IsNil) c.Assert(co.removeScheduler("balance-hot-read-region-scheduler"), IsNil) c.Assert(co.schedulers, HasLen, 0) diff --git a/server/schedulers/hot_read_region.go b/server/schedulers/hot_read_region.go index 489a5d3c047..aa32e7167cc 100644 --- a/server/schedulers/hot_read_region.go +++ b/server/schedulers/hot_read_region.go @@ -57,13 +57,6 @@ func (h *balanceHotReadRegionsScheduler) Schedule(cluster schedule.Cluster) *sch schedulerCounter.WithLabelValues(h.GetName(), "schedule").Inc() h.calcScore(cluster) - // balance by peer - srcRegion, srcPeer, destPeer := h.balanceByPeer(cluster) - if srcRegion != nil { - schedulerCounter.WithLabelValues(h.GetName(), "move_peer").Inc() - return schedule.CreateMovePeerOperator("moveHotReadRegion", srcRegion, core.PriorityKind, srcPeer.GetStoreId(), destPeer.GetStoreId(), destPeer.GetId()) - } - // balance by leader srcRegion, newLeader := h.balanceByLeader(cluster) if srcRegion != nil { @@ -72,6 +65,13 @@ func (h *balanceHotReadRegionsScheduler) Schedule(cluster schedule.Cluster) *sch return schedule.NewOperator("transferHotReadLeader", srcRegion.GetId(), core.PriorityKind, step) } + // balance by peer + srcRegion, srcPeer, destPeer := h.balanceByPeer(cluster) + if srcRegion != nil { + schedulerCounter.WithLabelValues(h.GetName(), "move_peer").Inc() + return schedule.CreateMovePeerOperator("moveHotReadRegion", srcRegion, core.PriorityKind, srcPeer.GetStoreId(), destPeer.GetStoreId(), destPeer.GetId()) + } + schedulerCounter.WithLabelValues(h.GetName(), "skip").Inc() return nil } @@ -158,7 +158,7 @@ func (h *balanceHotReadRegionsScheduler) balanceByPeer(cluster schedule.Cluster) destStoreID = h.selectDestStoreByPeer(destStoreIDs, srcRegion, srcStoreID) if destStoreID != 0 { srcRegion.ReadBytes = rs.FlowBytes - h.adjustBalanceLimit(srcStoreID, byPeer) + h.adjustBalanceLimit(srcStoreID, byLeader) var srcPeer *metapb.Peer for _, peer := range srcRegion.GetPeers() { diff --git a/server/schedulers/hot_region.go b/server/schedulers/hot_region.go index e3f72dc9188..a6d9ae4520c 100644 --- a/server/schedulers/hot_region.go +++ b/server/schedulers/hot_region.go @@ -70,7 +70,7 @@ func newBalanceHotRegionScheduler(opt schedule.Options) schedule.Scheduler { } func (h *balanceHotRegionScheduler) GetName() string { - return "balance-hot-region-scheduler" + return "balance-hot-write-region-scheduler" } func (h *balanceHotRegionScheduler) GetResourceKind() core.ResourceKind { From c26ac0024c7065fbd53997b680357d82aca8f321 Mon Sep 17 00:00:00 2001 From: nolouch Date: Mon, 11 Sep 2017 15:21:19 +0800 Subject: [PATCH 10/13] address comments --- pdctl/command/hot_command.go | 16 ++++++++-------- server/api/hot_status.go | 4 ++-- server/api/router.go | 4 ++-- server/handler.go | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pdctl/command/hot_command.go b/pdctl/command/hot_command.go index d52dec9a621..239142de594 100644 --- a/pdctl/command/hot_command.go +++ b/pdctl/command/hot_command.go @@ -21,9 +21,9 @@ import ( ) const ( - hotRegionsPrefix = "pd/api/v1/hotspot/regions" - hotReadRegionsPrefix = "pd/api/v1/hotspot/readregions" - hotStoresPrefix = "pd/api/v1/hotspot/stores" + hotReadRegionsPrefix = "pd/api/v1/hotspot/regions/read" + hotWriteRegionsPrefix = "pd/api/v1/hotspot/regions/write" + hotStoresPrefix = "pd/api/v1/hotspot/stores" ) // NewHotSpotCommand return a hot subcommand of rootCmd @@ -41,15 +41,15 @@ func NewHotSpotCommand() *cobra.Command { // NewHotRegionCommand return a hot regions subcommand of hotSpotCmd func NewHotRegionCommand() *cobra.Command { cmd := &cobra.Command{ - Use: "region", - Short: "show the hot regions", - Run: showHotRegionsCommandFunc, + Use: "write", + Short: "show the hot write regions", + Run: showHotWriteRegionsCommandFunc, } return cmd } -func showHotRegionsCommandFunc(cmd *cobra.Command, args []string) { - r, err := doRequest(cmd, hotRegionsPrefix, http.MethodGet) +func showHotWriteRegionsCommandFunc(cmd *cobra.Command, args []string) { + r, err := doRequest(cmd, hotWriteRegionsPrefix, http.MethodGet) if err != nil { fmt.Printf("Failed to get hotspot: %s\n", err) return diff --git a/server/api/hot_status.go b/server/api/hot_status.go index 20fcf125072..fa92365d8a7 100644 --- a/server/api/hot_status.go +++ b/server/api/hot_status.go @@ -32,8 +32,8 @@ func newHotStatusHandler(handler *server.Handler, rd *render.Render) *hotStatusH } } -func (h *hotStatusHandler) GetHotRegions(w http.ResponseWriter, r *http.Request) { - h.rd.JSON(w, http.StatusOK, h.GetHotWriteRegions()) +func (h *hotStatusHandler) GetHotWriteRegions(w http.ResponseWriter, r *http.Request) { + h.rd.JSON(w, http.StatusOK, h.Handler.GetHotWriteRegions()) } func (h *hotStatusHandler) GetHotReadRegions(w http.ResponseWriter, r *http.Request) { diff --git a/server/api/router.go b/server/api/router.go index 90219deba4f..dabcccf0a5f 100644 --- a/server/api/router.go +++ b/server/api/router.go @@ -67,8 +67,8 @@ func createRouter(prefix string, svr *server.Server) *mux.Router { router.HandleFunc("/api/v1/labels/stores", labelsHandler.GetStores).Methods("GET") hotStatusHandler := newHotStatusHandler(handler, rd) - router.HandleFunc("/api/v1/hotspot/regions", hotStatusHandler.GetHotRegions).Methods("GET") - router.HandleFunc("/api/v1/hotspot/readregions", hotStatusHandler.GetHotReadRegions).Methods("GET") + router.HandleFunc("/api/v1/hotspot/regions/read", hotStatusHandler.GetHotWriteRegions).Methods("GET") + router.HandleFunc("/api/v1/hotspot/regions/write", hotStatusHandler.GetHotReadRegions).Methods("GET") router.HandleFunc("/api/v1/hotspot/stores", hotStatusHandler.GetHotStores).Methods("GET") regionHandler := newRegionHandler(svr, rd) diff --git a/server/handler.go b/server/handler.go index e918427a9a4..90a430097d4 100644 --- a/server/handler.go +++ b/server/handler.go @@ -53,7 +53,7 @@ func (h *Handler) GetSchedulers() ([]string, error) { return c.getSchedulers(), nil } -// GetHotWriteRegions gets all hot regions status +// GetHotWriteRegions gets all hot write regions status func (h *Handler) GetHotWriteRegions() *core.StoreHotRegionInfos { c, err := h.getCoordinator() if err != nil { From e98507e0b519121b38caa9e18ba32aa881dfbfa0 Mon Sep 17 00:00:00 2001 From: nolouch Date: Mon, 11 Sep 2017 19:44:05 +0800 Subject: [PATCH 11/13] *: fix api and metrics --- server/api/router.go | 4 ++-- server/coordinator.go | 22 ++++++++++++++++--- server/schedulers/hot_read_region.go | 9 ++------ .../{hot_region.go => hot_write_region.go} | 0 4 files changed, 23 insertions(+), 12 deletions(-) rename server/schedulers/{hot_region.go => hot_write_region.go} (100%) diff --git a/server/api/router.go b/server/api/router.go index dabcccf0a5f..0676dd864b6 100644 --- a/server/api/router.go +++ b/server/api/router.go @@ -67,8 +67,8 @@ func createRouter(prefix string, svr *server.Server) *mux.Router { router.HandleFunc("/api/v1/labels/stores", labelsHandler.GetStores).Methods("GET") hotStatusHandler := newHotStatusHandler(handler, rd) - router.HandleFunc("/api/v1/hotspot/regions/read", hotStatusHandler.GetHotWriteRegions).Methods("GET") - router.HandleFunc("/api/v1/hotspot/regions/write", hotStatusHandler.GetHotReadRegions).Methods("GET") + router.HandleFunc("/api/v1/hotspot/regions/write", hotStatusHandler.GetHotWriteRegions).Methods("GET") + router.HandleFunc("/api/v1/hotspot/regions/read", hotStatusHandler.GetHotReadRegions).Methods("GET") router.HandleFunc("/api/v1/hotspot/stores", hotStatusHandler.GetHotStores).Methods("GET") regionHandler := newRegionHandler(svr, rd) diff --git a/server/coordinator.go b/server/coordinator.go index 1c61c2f395b..99df5e22d8a 100644 --- a/server/coordinator.go +++ b/server/coordinator.go @@ -46,7 +46,7 @@ const ( storeHeartBeatReportInterval = 10 minHotRegionReportInterval = 3 hotRegionAntiCount = 1 - hotRegionScheduleName = "balance-hot-region-scheduler" + hotWriteRegionScheduleName = "balance-hot-write-region-scheduler" hotReadRegionScheduleName = "balance-hot-read-region-scheduler" ) @@ -159,7 +159,7 @@ type hasHotStatus interface { func (c *coordinator) getHotWriteRegions() *core.StoreHotRegionInfos { c.RLock() defer c.RUnlock() - s, ok := c.schedulers[hotRegionScheduleName] + s, ok := c.schedulers[hotWriteRegionScheduleName] if !ok { return nil } @@ -211,7 +211,8 @@ func (c *coordinator) collectSchedulerMetrics() { func (c *coordinator) collectHotSpotMetrics() { c.RLock() defer c.RUnlock() - s, ok := c.schedulers[hotRegionScheduleName] + // collect hot write region metrics + s, ok := c.schedulers[hotWriteRegionScheduleName] if !ok { return } @@ -232,6 +233,21 @@ func (c *coordinator) collectHotSpotMetrics() { hotSpotStatusGauge.WithLabelValues(store, "total_written_bytes_as_leader").Set(totalWriteBytes) hotSpotStatusGauge.WithLabelValues(store, "hot_write_region_as_leader").Set(hotWriteRegionCount) } + + // collect hot read region metrics + s, ok = c.schedulers[hotReadRegionScheduleName] + if !ok { + return + } + status = s.Scheduler.(hasHotStatus).GetStatus() + for storeID, stat := range status.AsLeader { + store := fmt.Sprintf("store_%d", storeID) + totalReadBytes := float64(stat.TotalFlowBytes) + hotReadRegionCount := float64(stat.RegionsCount) + + hotSpotStatusGauge.WithLabelValues(store, "total_read_bytes_as_leader").Set(totalReadBytes) + hotSpotStatusGauge.WithLabelValues(store, "hot_read_region_as_leader").Set(hotReadRegionCount) + } } func (c *coordinator) shouldRun() bool { diff --git a/server/schedulers/hot_read_region.go b/server/schedulers/hot_read_region.go index aa32e7167cc..1bd29dc6281 100644 --- a/server/schedulers/hot_read_region.go +++ b/server/schedulers/hot_read_region.go @@ -308,12 +308,7 @@ func (h *balanceHotReadRegionsScheduler) selectDestStoreByLeader(srcRegion *core return destPeer } -// StoreHotReadRegionsInfos : used to get human readable description for hot regions. -type StoreHotReadRegionsInfos struct { - AsLeader map[uint64]*core.HotRegionsStat `json:"as_leader"` -} - -func (h *balanceHotReadRegionsScheduler) GetStatus() *StoreHotReadRegionsInfos { +func (h *balanceHotReadRegionsScheduler) GetStatus() *core.StoreHotRegionInfos { h.RLock() defer h.RUnlock() asLeader := make(map[uint64]*core.HotRegionsStat, len(h.statisticsAsLeader)) @@ -321,7 +316,7 @@ func (h *balanceHotReadRegionsScheduler) GetStatus() *StoreHotReadRegionsInfos { clone := *stat asLeader[id] = &clone } - return &StoreHotReadRegionsInfos{ + return &core.StoreHotRegionInfos{ AsLeader: asLeader, } } diff --git a/server/schedulers/hot_region.go b/server/schedulers/hot_write_region.go similarity index 100% rename from server/schedulers/hot_region.go rename to server/schedulers/hot_write_region.go From 81aaecf51408a464e24fe1679285dc1c6fc5b604 Mon Sep 17 00:00:00 2001 From: nolouch Date: Tue, 12 Sep 2017 14:00:24 +0800 Subject: [PATCH 12/13] tune region threshold --- server/cache.go | 9 ++++----- server/coordinator.go | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/server/cache.go b/server/cache.go index 806b37ba3af..1eafb3f7c34 100644 --- a/server/cache.go +++ b/server/cache.go @@ -365,8 +365,8 @@ func newClusterInfo(id IDAllocator) *clusterInfo { id: id, stores: newStoresInfo(), regions: newRegionsInfo(), - readStatistics: cache.NewDefaultCache(writeStatCacheMaxLen), - writeStatistics: cache.NewDefaultCache(writeStatCacheMaxLen), + readStatistics: cache.NewDefaultCache(statCacheMaxLen), + writeStatistics: cache.NewDefaultCache(statCacheMaxLen), } } @@ -857,7 +857,7 @@ func (c *clusterInfo) updateWriteStatus(region *core.RegionInfo) { // suppose the number of the hot regions is writeStatCacheMaxLen // and we use total written Bytes past storeHeartBeatReportInterval seconds to divide the number of hot regions // divide 2 because the store reports data about two times than the region record write to rocksdb - divisor := float64(writeStatCacheMaxLen) * 2 * storeHeartBeatReportInterval + divisor := float64(statCacheMaxLen) * 2 * storeHeartBeatReportInterval hotRegionThreshold := uint64(float64(c.stores.totalWrittenBytes()) / divisor) if hotRegionThreshold < hotRegionMinWriteRate { @@ -883,8 +883,7 @@ func (c *clusterInfo) updateReadStatus(region *core.RegionInfo) { // hotRegionThreshold is use to pick hot region // suppose the number of the hot regions is writeStatLRUMaxLen // and we use total written Bytes past storeHeartBeatReportInterval seconds to divide the number of hot regions - // divide 2 because the store reports data about two times than the region record write to rocksdb - divisor := float64(writeStatCacheMaxLen) * 2 * storeHeartBeatReportInterval + divisor := float64(statCacheMaxLen) * storeHeartBeatReportInterval hotRegionThreshold := uint64(float64(c.stores.totalReadBytes()) / divisor) if hotRegionThreshold < hotRegionMinWriteRate { diff --git a/server/coordinator.go b/server/coordinator.go index 99df5e22d8a..d9d069cc45e 100644 --- a/server/coordinator.go +++ b/server/coordinator.go @@ -39,7 +39,7 @@ const ( minSlowScheduleInterval = time.Second * 3 scheduleIntervalFactor = 1.3 - writeStatCacheMaxLen = 1000 + statCacheMaxLen = 1000 hotRegionMinWriteRate = 16 * 1024 regionHeartBeatReportInterval = 60 regionheartbeatSendChanCap = 1024 From 2e171cfe5d0f758864ad470da6262c51f7973a15 Mon Sep 17 00:00:00 2001 From: nolouch Date: Tue, 12 Sep 2017 16:18:42 +0800 Subject: [PATCH 13/13] address comment --- pdctl/command/hot_command.go | 6 ++--- server/balancer_test.go | 6 ++--- server/cache.go | 12 ++++----- server/coordinator.go | 2 +- server/schedulers/hot_write_region.go | 36 +++++++++++++-------------- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/pdctl/command/hot_command.go b/pdctl/command/hot_command.go index 239142de594..fba6a365ea7 100644 --- a/pdctl/command/hot_command.go +++ b/pdctl/command/hot_command.go @@ -32,14 +32,14 @@ func NewHotSpotCommand() *cobra.Command { Use: "hot", Short: "show the hotspot status of the cluster", } - cmd.AddCommand(NewHotRegionCommand()) + cmd.AddCommand(NewHotWriteRegionCommand()) cmd.AddCommand(NewHotReadRegionCommand()) cmd.AddCommand(NewHotStoreCommand()) return cmd } -// NewHotRegionCommand return a hot regions subcommand of hotSpotCmd -func NewHotRegionCommand() *cobra.Command { +// NewHotWriteRegionCommand return a hot regions subcommand of hotSpotCmd +func NewHotWriteRegionCommand() *cobra.Command { cmd := &cobra.Command{ Use: "write", Short: "show the hot write regions", diff --git a/server/balancer_test.go b/server/balancer_test.go index 41b548d74e4..efdd38fa180 100644 --- a/server/balancer_test.go +++ b/server/balancer_test.go @@ -869,11 +869,11 @@ func checkTransferLeaderFrom(c *C, op *schedule.Operator, sourceID uint64) { c.Assert(op.Step(0).(schedule.TransferLeader).FromStore, Equals, sourceID) } -var _ = Suite(&testBalanceHotRegionSchedulerSuite{}) +var _ = Suite(&testBalanceHotWriteRegionSchedulerSuite{}) -type testBalanceHotRegionSchedulerSuite struct{} +type testBalanceHotWriteRegionSchedulerSuite struct{} -func (s *testBalanceHotRegionSchedulerSuite) TestBalance(c *C) { +func (s *testBalanceHotWriteRegionSchedulerSuite) TestBalance(c *C) { cluster := newClusterInfo(newMockIDAllocator()) tc := newTestClusterInfo(cluster) diff --git a/server/cache.go b/server/cache.go index 1eafb3f7c34..c3d9e05c45b 100644 --- a/server/cache.go +++ b/server/cache.go @@ -854,14 +854,14 @@ func (c *clusterInfo) updateWriteStatus(region *core.RegionInfo) { region.WrittenBytes = WrittenBytesPerSec // hotRegionThreshold is use to pick hot region - // suppose the number of the hot regions is writeStatCacheMaxLen + // suppose the number of the hot regions is statCacheMaxLen // and we use total written Bytes past storeHeartBeatReportInterval seconds to divide the number of hot regions // divide 2 because the store reports data about two times than the region record write to rocksdb divisor := float64(statCacheMaxLen) * 2 * storeHeartBeatReportInterval hotRegionThreshold := uint64(float64(c.stores.totalWrittenBytes()) / divisor) - if hotRegionThreshold < hotRegionMinWriteRate { - hotRegionThreshold = hotRegionMinWriteRate + if hotRegionThreshold < hotRegionMinFlowRate { + hotRegionThreshold = hotRegionMinFlowRate } c.updateWriteStatCache(region, hotRegionThreshold) } @@ -881,13 +881,13 @@ func (c *clusterInfo) updateReadStatus(region *core.RegionInfo) { region.ReadBytes = ReadBytesPerSec // hotRegionThreshold is use to pick hot region - // suppose the number of the hot regions is writeStatLRUMaxLen + // suppose the number of the hot regions is statLRUMaxLen // and we use total written Bytes past storeHeartBeatReportInterval seconds to divide the number of hot regions divisor := float64(statCacheMaxLen) * storeHeartBeatReportInterval hotRegionThreshold := uint64(float64(c.stores.totalReadBytes()) / divisor) - if hotRegionThreshold < hotRegionMinWriteRate { - hotRegionThreshold = hotRegionMinWriteRate + if hotRegionThreshold < hotRegionMinFlowRate { + hotRegionThreshold = hotRegionMinFlowRate } c.updateReadStatCache(region, hotRegionThreshold) } diff --git a/server/coordinator.go b/server/coordinator.go index d9d069cc45e..1fb3d947e79 100644 --- a/server/coordinator.go +++ b/server/coordinator.go @@ -40,7 +40,7 @@ const ( scheduleIntervalFactor = 1.3 statCacheMaxLen = 1000 - hotRegionMinWriteRate = 16 * 1024 + hotRegionMinFlowRate = 16 * 1024 regionHeartBeatReportInterval = 60 regionheartbeatSendChanCap = 1024 storeHeartBeatReportInterval = 10 diff --git a/server/schedulers/hot_write_region.go b/server/schedulers/hot_write_region.go index a6d9ae4520c..598d74c396c 100644 --- a/server/schedulers/hot_write_region.go +++ b/server/schedulers/hot_write_region.go @@ -27,7 +27,7 @@ import ( func init() { schedule.RegisterScheduler("hotWriteRegion", func(opt schedule.Options, args []string) (schedule.Scheduler, error) { - return newBalanceHotRegionScheduler(opt), nil + return newBalanceHotWriteRegionScheduler(opt), nil }) } @@ -45,7 +45,7 @@ const ( byLeader ) -type balanceHotRegionScheduler struct { +type balanceHotWriteRegionScheduler struct { sync.RWMutex opt schedule.Options limit uint64 @@ -57,10 +57,10 @@ type balanceHotRegionScheduler struct { r *rand.Rand } -// newBalanceHotRegionScheduler creates a scheduler that keeps hot regions on +// newBalanceHotWriteRegionScheduler creates a scheduler that keeps hot regions on // each stores balanced. -func newBalanceHotRegionScheduler(opt schedule.Options) schedule.Scheduler { - return &balanceHotRegionScheduler{ +func newBalanceHotWriteRegionScheduler(opt schedule.Options) schedule.Scheduler { + return &balanceHotWriteRegionScheduler{ opt: opt, limit: 1, statisticsAsPeer: make(map[uint64]*core.HotRegionsStat), @@ -69,23 +69,23 @@ func newBalanceHotRegionScheduler(opt schedule.Options) schedule.Scheduler { } } -func (h *balanceHotRegionScheduler) GetName() string { +func (h *balanceHotWriteRegionScheduler) GetName() string { return "balance-hot-write-region-scheduler" } -func (h *balanceHotRegionScheduler) GetResourceKind() core.ResourceKind { +func (h *balanceHotWriteRegionScheduler) GetResourceKind() core.ResourceKind { return core.PriorityKind } -func (h *balanceHotRegionScheduler) GetResourceLimit() uint64 { +func (h *balanceHotWriteRegionScheduler) GetResourceLimit() uint64 { return h.limit } -func (h *balanceHotRegionScheduler) Prepare(cluster schedule.Cluster) error { return nil } +func (h *balanceHotWriteRegionScheduler) Prepare(cluster schedule.Cluster) error { return nil } -func (h *balanceHotRegionScheduler) Cleanup(cluster schedule.Cluster) {} +func (h *balanceHotWriteRegionScheduler) Cleanup(cluster schedule.Cluster) {} -func (h *balanceHotRegionScheduler) Schedule(cluster schedule.Cluster) *schedule.Operator { +func (h *balanceHotWriteRegionScheduler) Schedule(cluster schedule.Cluster) *schedule.Operator { schedulerCounter.WithLabelValues(h.GetName(), "schedule").Inc() h.calcScore(cluster) @@ -108,7 +108,7 @@ func (h *balanceHotRegionScheduler) Schedule(cluster schedule.Cluster) *schedule return nil } -func (h *balanceHotRegionScheduler) calcScore(cluster schedule.Cluster) { +func (h *balanceHotWriteRegionScheduler) calcScore(cluster schedule.Cluster) { h.Lock() defer h.Unlock() @@ -161,7 +161,7 @@ func (h *balanceHotRegionScheduler) calcScore(cluster schedule.Cluster) { } } -func (h *balanceHotRegionScheduler) balanceByPeer(cluster schedule.Cluster) (*core.RegionInfo, *metapb.Peer, *metapb.Peer) { +func (h *balanceHotWriteRegionScheduler) balanceByPeer(cluster schedule.Cluster) (*core.RegionInfo, *metapb.Peer, *metapb.Peer) { var ( maxWrittenBytes uint64 srcStoreID uint64 @@ -234,7 +234,7 @@ func (h *balanceHotRegionScheduler) balanceByPeer(cluster schedule.Cluster) (*co return nil, nil, nil } -func (h *balanceHotRegionScheduler) selectDestStoreByPeer(candidateStoreIDs []uint64, srcRegion *core.RegionInfo, srcStoreID uint64) uint64 { +func (h *balanceHotWriteRegionScheduler) selectDestStoreByPeer(candidateStoreIDs []uint64, srcRegion *core.RegionInfo, srcStoreID uint64) uint64 { sr := h.statisticsAsPeer[srcStoreID] srcWrittenBytes := sr.TotalFlowBytes srcHotRegionsCount := sr.RegionsStat.Len() @@ -265,7 +265,7 @@ func (h *balanceHotRegionScheduler) selectDestStoreByPeer(candidateStoreIDs []ui return destStoreID } -func (h *balanceHotRegionScheduler) adjustBalanceLimit(storeID uint64, t BalanceType) { +func (h *balanceHotWriteRegionScheduler) adjustBalanceLimit(storeID uint64, t BalanceType) { var srcStatistics *core.HotRegionsStat var allStatistics map[uint64]*core.HotRegionsStat switch t { @@ -288,7 +288,7 @@ func (h *balanceHotRegionScheduler) adjustBalanceLimit(storeID uint64, t Balance h.limit = maxUint64(1, limit) } -func (h *balanceHotRegionScheduler) balanceByLeader(cluster schedule.Cluster) (*core.RegionInfo, *metapb.Peer) { +func (h *balanceHotWriteRegionScheduler) balanceByLeader(cluster schedule.Cluster) (*core.RegionInfo, *metapb.Peer) { var ( maxWrittenBytes uint64 srcStoreID uint64 @@ -334,7 +334,7 @@ func (h *balanceHotRegionScheduler) balanceByLeader(cluster schedule.Cluster) (* return nil, nil } -func (h *balanceHotRegionScheduler) selectDestStoreByLeader(srcRegion *core.RegionInfo) *metapb.Peer { +func (h *balanceHotWriteRegionScheduler) selectDestStoreByLeader(srcRegion *core.RegionInfo) *metapb.Peer { sr := h.statisticsAsLeader[srcRegion.Leader.GetStoreId()] srcWrittenBytes := sr.TotalFlowBytes srcHotRegionsCount := sr.RegionsStat.Len() @@ -365,7 +365,7 @@ func (h *balanceHotRegionScheduler) selectDestStoreByLeader(srcRegion *core.Regi return destPeer } -func (h *balanceHotRegionScheduler) GetStatus() *core.StoreHotRegionInfos { +func (h *balanceHotWriteRegionScheduler) GetStatus() *core.StoreHotRegionInfos { h.RLock() defer h.RUnlock() asPeer := make(map[uint64]*core.HotRegionsStat, len(h.statisticsAsPeer))